@cortexkit/aft-pi 0.36.1 → 0.37.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 +2 -3
- package/dist/bg-notifications.d.ts +5 -1
- package/dist/bg-notifications.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +325 -241
- package/dist/tools/_shared.d.ts +1 -11
- package/dist/tools/_shared.d.ts.map +1 -1
- package/dist/tools/bash.d.ts +1 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/conflicts.d.ts.map +1 -1
- package/dist/tools/hoisted.d.ts.map +1 -1
- package/dist/tools/navigate.d.ts +1 -1
- package/dist/tools/semantic.d.ts.map +1 -1
- package/dist/workflow-hints.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/tools/structure.d.ts +0 -32
- package/dist/tools/structure.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -49,7 +49,6 @@ All four keep the same agent-facing parameters as Pi's built-ins, so your prompt
|
|
|
49
49
|
| `lsp_diagnostics` | On-demand LSP diagnostics (edit/write already inline diagnostics automatically) |
|
|
50
50
|
| `aft_delete` | Delete a file with backup (surface: `all`) |
|
|
51
51
|
| `aft_move` | Move/rename a file (surface: `all`) |
|
|
52
|
-
| `aft_transform` | Scope-aware structural transformations (surface: `all`) |
|
|
53
52
|
| `aft_refactor` | Workspace-wide refactor: move symbol, extract function, inline call (surface: `all`) |
|
|
54
53
|
|
|
55
54
|
### Slash command
|
|
@@ -88,7 +87,7 @@ All keys are optional. Example:
|
|
|
88
87
|
"experimental_semantic_search": true,
|
|
89
88
|
|
|
90
89
|
// Disable specific tool names (applied after tool_surface selection).
|
|
91
|
-
"disabled_tools": ["
|
|
90
|
+
"disabled_tools": ["aft_refactor"],
|
|
92
91
|
|
|
93
92
|
"formatter": {
|
|
94
93
|
"typescript": "biome",
|
|
@@ -121,7 +120,7 @@ Sensitive semantic backend fields (`backend`, `base_url`, `api_key_env`) are onl
|
|
|
121
120
|
| ----------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
122
121
|
| `minimal` | `aft_outline`, `aft_zoom`, `aft_safety` |
|
|
123
122
|
| `recommended` (default) | `minimal` + hoisted `read`/`write`/`edit` + `aft_import` + `ast_grep_*` + `lsp_diagnostics` + `aft_conflicts` + (optional) `grep` + (optional) `aft_search` |
|
|
124
|
-
| `all` | `recommended` + `aft_callgraph` + `aft_delete` + `aft_move` + `
|
|
123
|
+
| `all` | `recommended` + `aft_callgraph` + `aft_delete` + `aft_move` + `aft_refactor` |
|
|
125
124
|
|
|
126
125
|
## Architecture
|
|
127
126
|
|
|
@@ -7,7 +7,11 @@ export interface BgCompletion {
|
|
|
7
7
|
duration_ms?: number;
|
|
8
8
|
runtime_ms?: number;
|
|
9
9
|
runtime?: number;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Exit-aware preview of stdout+stderr captured at completion (from Rust):
|
|
12
|
+
* success = short tail (≤600 B), failure = small head + larger tail
|
|
13
|
+
* (≤2.25 KiB). Full output stays recoverable via bash_status / file pointers.
|
|
14
|
+
*/
|
|
11
15
|
output_preview?: string;
|
|
12
16
|
/** True when the captured tail is shorter than the actual output. */
|
|
13
17
|
output_truncated?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bg-notifications.d.ts","sourceRoot":"","sources":["../src/bg-notifications.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IAC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
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAcH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AASpE,OAAO,EACL,KAAK,SAAS,EACd,aAAa,EAId,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAcH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AASpE,OAAO,EACL,KAAK,SAAS,EACd,aAAa,EAId,MAAM,aAAa,CAAC;AA6DrB,KAAK,mBAAmB,GAAG;IACzB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF,iBAAS,4BAA4B,CACnC,OAAO,EAAE,MAAM,mBAAmB,GAAG,SAAS,EAC9C,sBAAsB,GAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAgB,IAOrE,eAAe,MAAM,EAAE,YAAY,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAyCjF;AAsDD,iBAAS,wBAAwB,CAC/B,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,iBAAiB,GAAG,UAAU,CAAC,GACtD,OAAO,CAGT;AAED,iBAAS,2BAA2B,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG9E;AASD,iBAAe,iCAAiC,CAAC,OAAO,EAAE;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,IAAI,CAAC,OAAO,uBAAuB,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;IACnE,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiChB;AAED;;;;;;;;GAQG;AACH,iBAAS,kBAAkB,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,GAAG;IACrE,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAqEA;AAED;;;;GAIG;AACH,yBAA+B,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAge9D;AAED,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11678,6 +11678,9 @@ function error(message, meta) {
|
|
|
11678
11678
|
var CONFLICT_HINT = `
|
|
11679
11679
|
|
|
11680
11680
|
[Hint] Use aft_conflicts to see all conflict regions across files in a single call.`;
|
|
11681
|
+
var GREP_SEARCH_AFT_SEARCH_HINT = "DO NOT search code by running grep/rg in bash — it is unindexed, unranked, and serial. Use the `aft_search` tool instead (it auto-routes concepts, identifiers, regex, and literals).";
|
|
11682
|
+
var GREP_SEARCH_GREP_HINT = "DO NOT search code by running grep/rg in bash — it is unindexed, unranked, and serial. Use the `grep` tool instead (indexed and ranked).";
|
|
11683
|
+
var GREP_SEARCH_HINT_PREFIX = "DO NOT search code by running grep/rg in bash —";
|
|
11681
11684
|
function maybeAppendConflictsHint(output) {
|
|
11682
11685
|
if (!output.includes("Automatic merge failed; fix conflicts"))
|
|
11683
11686
|
return output;
|
|
@@ -11685,6 +11688,146 @@ function maybeAppendConflictsHint(output) {
|
|
|
11685
11688
|
return output;
|
|
11686
11689
|
return output + CONFLICT_HINT;
|
|
11687
11690
|
}
|
|
11691
|
+
function commandLeadsWithCodeSearch(command) {
|
|
11692
|
+
const trimmed = command.trim();
|
|
11693
|
+
if (!trimmed)
|
|
11694
|
+
return false;
|
|
11695
|
+
const afterCd = peelLeadingCdAnd(trimmed);
|
|
11696
|
+
if (afterCd === null)
|
|
11697
|
+
return false;
|
|
11698
|
+
const firstStage = firstPipelineStage(afterCd);
|
|
11699
|
+
if (firstStage === null)
|
|
11700
|
+
return false;
|
|
11701
|
+
const firstToken = readShellToken(firstStage, skipSpaces(firstStage, 0));
|
|
11702
|
+
if (firstToken === null)
|
|
11703
|
+
return false;
|
|
11704
|
+
return firstToken.token === "grep" || firstToken.token === "rg";
|
|
11705
|
+
}
|
|
11706
|
+
function maybeAppendGrepSearchHint(output, command, aftSearchRegistered) {
|
|
11707
|
+
if (output === "")
|
|
11708
|
+
return output;
|
|
11709
|
+
if (!commandLeadsWithCodeSearch(command))
|
|
11710
|
+
return output;
|
|
11711
|
+
if (output.includes(GREP_SEARCH_HINT_PREFIX))
|
|
11712
|
+
return output;
|
|
11713
|
+
const hint = aftSearchRegistered ? GREP_SEARCH_AFT_SEARCH_HINT : GREP_SEARCH_GREP_HINT;
|
|
11714
|
+
return `${output}
|
|
11715
|
+
|
|
11716
|
+
${hint}`;
|
|
11717
|
+
}
|
|
11718
|
+
function peelLeadingCdAnd(command) {
|
|
11719
|
+
const first = readShellToken(command, skipSpaces(command, 0));
|
|
11720
|
+
if (first === null)
|
|
11721
|
+
return null;
|
|
11722
|
+
if (first.token !== "cd")
|
|
11723
|
+
return command;
|
|
11724
|
+
const dir = readShellToken(command, skipSpaces(command, first.end));
|
|
11725
|
+
if (dir === null)
|
|
11726
|
+
return null;
|
|
11727
|
+
if (!dir.token)
|
|
11728
|
+
return command;
|
|
11729
|
+
const afterDir = skipSpaces(command, dir.end);
|
|
11730
|
+
if (!command.startsWith("&&", afterDir))
|
|
11731
|
+
return command;
|
|
11732
|
+
return command.slice(afterDir + 2).trim();
|
|
11733
|
+
}
|
|
11734
|
+
function firstPipelineStage(command) {
|
|
11735
|
+
let quote = "none";
|
|
11736
|
+
let firstPipeIndex;
|
|
11737
|
+
for (let index = 0;index < command.length; index++) {
|
|
11738
|
+
const ch = command[index];
|
|
11739
|
+
if (quote === "single") {
|
|
11740
|
+
if (ch === "'")
|
|
11741
|
+
quote = "none";
|
|
11742
|
+
continue;
|
|
11743
|
+
}
|
|
11744
|
+
if (quote === "double") {
|
|
11745
|
+
if (ch === '"') {
|
|
11746
|
+
quote = "none";
|
|
11747
|
+
} else if (ch === "\\") {
|
|
11748
|
+
index++;
|
|
11749
|
+
} else if (ch === "`") {
|
|
11750
|
+
return null;
|
|
11751
|
+
}
|
|
11752
|
+
continue;
|
|
11753
|
+
}
|
|
11754
|
+
if (ch === "'") {
|
|
11755
|
+
quote = "single";
|
|
11756
|
+
} else if (ch === '"') {
|
|
11757
|
+
quote = "double";
|
|
11758
|
+
} else if (ch === "\\") {
|
|
11759
|
+
index++;
|
|
11760
|
+
} else if (ch === "`") {
|
|
11761
|
+
return null;
|
|
11762
|
+
} else if (ch === "|") {
|
|
11763
|
+
if (command[index + 1] === "|") {
|
|
11764
|
+
index++;
|
|
11765
|
+
} else if (firstPipeIndex === undefined) {
|
|
11766
|
+
firstPipeIndex = index;
|
|
11767
|
+
}
|
|
11768
|
+
}
|
|
11769
|
+
}
|
|
11770
|
+
if (quote !== "none")
|
|
11771
|
+
return null;
|
|
11772
|
+
return command.slice(0, firstPipeIndex ?? command.length).trim();
|
|
11773
|
+
}
|
|
11774
|
+
function readShellToken(command, start) {
|
|
11775
|
+
let quote = "none";
|
|
11776
|
+
let token = "";
|
|
11777
|
+
let index = start;
|
|
11778
|
+
for (;index < command.length; index++) {
|
|
11779
|
+
const ch = command[index];
|
|
11780
|
+
if (quote === "single") {
|
|
11781
|
+
if (ch === "'") {
|
|
11782
|
+
quote = "none";
|
|
11783
|
+
} else {
|
|
11784
|
+
token += ch;
|
|
11785
|
+
}
|
|
11786
|
+
continue;
|
|
11787
|
+
}
|
|
11788
|
+
if (quote === "double") {
|
|
11789
|
+
if (ch === '"') {
|
|
11790
|
+
quote = "none";
|
|
11791
|
+
} else if (ch === "\\") {
|
|
11792
|
+
index++;
|
|
11793
|
+
token += command[index] ?? "\\";
|
|
11794
|
+
} else if (ch === "`") {
|
|
11795
|
+
return null;
|
|
11796
|
+
} else {
|
|
11797
|
+
token += ch;
|
|
11798
|
+
}
|
|
11799
|
+
continue;
|
|
11800
|
+
}
|
|
11801
|
+
if (/\s/.test(ch))
|
|
11802
|
+
break;
|
|
11803
|
+
if (isTokenBoundary(ch))
|
|
11804
|
+
break;
|
|
11805
|
+
if (ch === "'") {
|
|
11806
|
+
quote = "single";
|
|
11807
|
+
} else if (ch === '"') {
|
|
11808
|
+
quote = "double";
|
|
11809
|
+
} else if (ch === "\\") {
|
|
11810
|
+
index++;
|
|
11811
|
+
token += command[index] ?? "\\";
|
|
11812
|
+
} else if (ch === "`") {
|
|
11813
|
+
return null;
|
|
11814
|
+
} else {
|
|
11815
|
+
token += ch;
|
|
11816
|
+
}
|
|
11817
|
+
}
|
|
11818
|
+
if (quote !== "none")
|
|
11819
|
+
return null;
|
|
11820
|
+
return { token, end: index };
|
|
11821
|
+
}
|
|
11822
|
+
function isTokenBoundary(ch) {
|
|
11823
|
+
return ch === "|" || ch === ";" || ch === "&" || ch === "<" || ch === ">";
|
|
11824
|
+
}
|
|
11825
|
+
function skipSpaces(input, start) {
|
|
11826
|
+
let index = start;
|
|
11827
|
+
while (index < input.length && /\s/.test(input[index]))
|
|
11828
|
+
index++;
|
|
11829
|
+
return index;
|
|
11830
|
+
}
|
|
11688
11831
|
// ../aft-bridge/dist/bash-timeout.js
|
|
11689
11832
|
function resolveBashKillTimeout(modelTimeout, foregroundWaitMs) {
|
|
11690
11833
|
if (modelTimeout !== undefined && modelTimeout >= foregroundWaitMs) {
|
|
@@ -11698,6 +11841,21 @@ import { homedir } from "node:os";
|
|
|
11698
11841
|
import { join } from "node:path";
|
|
11699
11842
|
import { StringDecoder } from "node:string_decoder";
|
|
11700
11843
|
|
|
11844
|
+
// ../aft-bridge/dist/command-timeouts.js
|
|
11845
|
+
var LONG_RUNNING_COMMAND_TIMEOUT_MS = {
|
|
11846
|
+
callers: 60000,
|
|
11847
|
+
trace_to: 60000,
|
|
11848
|
+
trace_to_symbol: 60000,
|
|
11849
|
+
trace_data: 60000,
|
|
11850
|
+
impact: 60000,
|
|
11851
|
+
grep: 60000,
|
|
11852
|
+
glob: 60000,
|
|
11853
|
+
semantic_search: 60000
|
|
11854
|
+
};
|
|
11855
|
+
function timeoutForCommand(command) {
|
|
11856
|
+
return LONG_RUNNING_COMMAND_TIMEOUT_MS[command];
|
|
11857
|
+
}
|
|
11858
|
+
|
|
11701
11859
|
// ../aft-bridge/dist/status-bar.js
|
|
11702
11860
|
var STATUS_BAR_HEARTBEAT_CALLS = 15;
|
|
11703
11861
|
function createStatusBarEmitState() {
|
|
@@ -11745,6 +11903,27 @@ var DEFAULT_BRIDGE_TIMEOUT_MS = 30000;
|
|
|
11745
11903
|
var BRIDGE_HANG_TIMEOUT_THRESHOLD = 2;
|
|
11746
11904
|
var SEMANTIC_TIMEOUT_SAFETY_MARGIN_MS = 5000;
|
|
11747
11905
|
var MAX_STDOUT_BUFFER = 64 * 1024 * 1024;
|
|
11906
|
+
var STDOUT_BUFFER_COMPACT_THRESHOLD = 64 * 1024;
|
|
11907
|
+
var TERMINAL_BASH_STATUSES = new Set([
|
|
11908
|
+
"completed",
|
|
11909
|
+
"failed",
|
|
11910
|
+
"killed",
|
|
11911
|
+
"timed_out",
|
|
11912
|
+
"cancelled",
|
|
11913
|
+
"timeout"
|
|
11914
|
+
]);
|
|
11915
|
+
function isTerminalBashStatus(status) {
|
|
11916
|
+
return typeof status === "string" && TERMINAL_BASH_STATUSES.has(status);
|
|
11917
|
+
}
|
|
11918
|
+
function bashTaskIdFrom(response) {
|
|
11919
|
+
const snakeCase = response.task_id;
|
|
11920
|
+
if (typeof snakeCase === "string" && snakeCase.length > 0)
|
|
11921
|
+
return snakeCase;
|
|
11922
|
+
const camelCase = response.taskId;
|
|
11923
|
+
if (typeof camelCase === "string" && camelCase.length > 0)
|
|
11924
|
+
return camelCase;
|
|
11925
|
+
return;
|
|
11926
|
+
}
|
|
11748
11927
|
function tagStderrLine(line) {
|
|
11749
11928
|
return /^\[aft(-\w+)?\] /.test(line) ? line : `[aft] ${line}`;
|
|
11750
11929
|
}
|
|
@@ -11799,11 +11978,12 @@ function clampSemanticTimeout(configOverrides, bridgeTimeoutMs) {
|
|
|
11799
11978
|
if (typeof timeoutMs !== "number" || !Number.isFinite(timeoutMs)) {
|
|
11800
11979
|
return configOverrides;
|
|
11801
11980
|
}
|
|
11802
|
-
const
|
|
11981
|
+
const semanticTransportBudgetMs = Math.max(bridgeTimeoutMs, LONG_RUNNING_COMMAND_TIMEOUT_MS.semantic_search ?? 0);
|
|
11982
|
+
const maxSemanticTimeoutMs = semanticTransportBudgetMs > SEMANTIC_TIMEOUT_SAFETY_MARGIN_MS ? semanticTransportBudgetMs - SEMANTIC_TIMEOUT_SAFETY_MARGIN_MS : Math.max(1, semanticTransportBudgetMs - 1);
|
|
11803
11983
|
if (timeoutMs <= maxSemanticTimeoutMs) {
|
|
11804
11984
|
return configOverrides;
|
|
11805
11985
|
}
|
|
11806
|
-
warn(`semantic.timeout_ms=${timeoutMs} exceeds
|
|
11986
|
+
warn(`semantic.timeout_ms=${timeoutMs} exceeds the semantic transport budget; clamping to ${maxSemanticTimeoutMs}ms (budget: ${semanticTransportBudgetMs}ms)`);
|
|
11807
11987
|
return {
|
|
11808
11988
|
...configOverrides,
|
|
11809
11989
|
semantic: {
|
|
@@ -11829,8 +12009,10 @@ class BinaryBridge {
|
|
|
11829
12009
|
cwd;
|
|
11830
12010
|
process = null;
|
|
11831
12011
|
pending = new Map;
|
|
12012
|
+
outstandingBackgroundTaskIds = new Set;
|
|
11832
12013
|
nextId = 1;
|
|
11833
12014
|
stdoutBuffer = "";
|
|
12015
|
+
stdoutReadOffset = 0;
|
|
11834
12016
|
stderrBuffer = "";
|
|
11835
12017
|
stderrTail = [];
|
|
11836
12018
|
_restartCount = 0;
|
|
@@ -11940,6 +12122,9 @@ class BinaryBridge {
|
|
|
11940
12122
|
hasPendingRequests() {
|
|
11941
12123
|
return this.pending.size > 0;
|
|
11942
12124
|
}
|
|
12125
|
+
hasOutstandingBackgroundTasks() {
|
|
12126
|
+
return this.outstandingBackgroundTaskIds.size > 0;
|
|
12127
|
+
}
|
|
11943
12128
|
getCwd() {
|
|
11944
12129
|
return this.cwd;
|
|
11945
12130
|
}
|
|
@@ -12061,7 +12246,7 @@ class BinaryBridge {
|
|
|
12061
12246
|
entry.reject(new Error(`${this.errorPrefix} Request "${command}" (id=${id}) timed out after ${effectiveTimeoutMs}ms`));
|
|
12062
12247
|
this.handleTimeout(requestSessionId);
|
|
12063
12248
|
}, effectiveTimeoutMs);
|
|
12064
|
-
this.pending.set(id, { resolve, reject, timer, onProgress: options?.onProgress });
|
|
12249
|
+
this.pending.set(id, { resolve, reject, timer, onProgress: options?.onProgress, command });
|
|
12065
12250
|
if (!this.process?.stdin?.writable) {
|
|
12066
12251
|
this.pending.delete(id);
|
|
12067
12252
|
clearTimeout(timer);
|
|
@@ -12322,6 +12507,7 @@ class BinaryBridge {
|
|
|
12322
12507
|
});
|
|
12323
12508
|
this.process = child;
|
|
12324
12509
|
this.stdoutBuffer = "";
|
|
12510
|
+
this.stdoutReadOffset = 0;
|
|
12325
12511
|
this.stderrBuffer = "";
|
|
12326
12512
|
this.lastChildActivityAt = 0;
|
|
12327
12513
|
this.consecutiveRequestTimeouts = 0;
|
|
@@ -12366,24 +12552,41 @@ class BinaryBridge {
|
|
|
12366
12552
|
${tail}`;
|
|
12367
12553
|
}
|
|
12368
12554
|
onStdoutData(data) {
|
|
12555
|
+
if (this.stdoutReadOffset > STDOUT_BUFFER_COMPACT_THRESHOLD) {
|
|
12556
|
+
this.compactStdoutBuffer();
|
|
12557
|
+
}
|
|
12369
12558
|
this.stdoutBuffer += data;
|
|
12370
|
-
if (this.stdoutBuffer.length > MAX_STDOUT_BUFFER) {
|
|
12559
|
+
if (this.stdoutBuffer.length - this.stdoutReadOffset > MAX_STDOUT_BUFFER) {
|
|
12371
12560
|
this.handleCrash(new Error(`aft bridge stdout buffer exceeded ${MAX_STDOUT_BUFFER} bytes — killing bridge`));
|
|
12372
12561
|
return;
|
|
12373
12562
|
}
|
|
12374
12563
|
let newlineIdx;
|
|
12375
12564
|
while ((newlineIdx = this.stdoutBuffer.indexOf(`
|
|
12376
|
-
|
|
12377
|
-
const line = this.stdoutBuffer.slice(
|
|
12378
|
-
this.
|
|
12379
|
-
if (
|
|
12380
|
-
|
|
12381
|
-
|
|
12565
|
+
`, this.stdoutReadOffset)) !== -1) {
|
|
12566
|
+
const line = this.stdoutBuffer.slice(this.stdoutReadOffset, newlineIdx).trim();
|
|
12567
|
+
this.stdoutReadOffset = newlineIdx + 1;
|
|
12568
|
+
if (line) {
|
|
12569
|
+
this.processStdoutLine(line);
|
|
12570
|
+
}
|
|
12571
|
+
if (this.stdoutReadOffset > STDOUT_BUFFER_COMPACT_THRESHOLD && this.stdoutReadOffset > this.stdoutBuffer.length / 2) {
|
|
12572
|
+
this.compactStdoutBuffer();
|
|
12573
|
+
}
|
|
12574
|
+
}
|
|
12575
|
+
if (this.stdoutReadOffset === this.stdoutBuffer.length) {
|
|
12576
|
+
this.stdoutBuffer = "";
|
|
12577
|
+
this.stdoutReadOffset = 0;
|
|
12382
12578
|
}
|
|
12383
12579
|
}
|
|
12580
|
+
compactStdoutBuffer() {
|
|
12581
|
+
if (this.stdoutReadOffset === 0)
|
|
12582
|
+
return;
|
|
12583
|
+
this.stdoutBuffer = this.stdoutBuffer.slice(this.stdoutReadOffset);
|
|
12584
|
+
this.stdoutReadOffset = 0;
|
|
12585
|
+
}
|
|
12384
12586
|
flushStdoutBuffer() {
|
|
12385
|
-
const line = this.stdoutBuffer.trim();
|
|
12587
|
+
const line = this.stdoutBuffer.slice(this.stdoutReadOffset).trim();
|
|
12386
12588
|
this.stdoutBuffer = "";
|
|
12589
|
+
this.stdoutReadOffset = 0;
|
|
12387
12590
|
if (!line)
|
|
12388
12591
|
return;
|
|
12389
12592
|
this.processStdoutLine(line);
|
|
@@ -12416,6 +12619,9 @@ class BinaryBridge {
|
|
|
12416
12619
|
return;
|
|
12417
12620
|
}
|
|
12418
12621
|
if (response.type === "bash_completed") {
|
|
12622
|
+
const taskId = bashTaskIdFrom(response);
|
|
12623
|
+
if (taskId)
|
|
12624
|
+
this.outstandingBackgroundTaskIds.delete(taskId);
|
|
12419
12625
|
this.onBashCompletion?.(response, this);
|
|
12420
12626
|
return;
|
|
12421
12627
|
}
|
|
@@ -12446,6 +12652,7 @@ class BinaryBridge {
|
|
|
12446
12652
|
clearTimeout(entry.timer);
|
|
12447
12653
|
this.consecutiveRequestTimeouts = 0;
|
|
12448
12654
|
this.scheduleRestartCountReset();
|
|
12655
|
+
this.accountForBashTaskResponse(entry.command, response);
|
|
12449
12656
|
this.captureStatusBar(response);
|
|
12450
12657
|
entry.resolve(response);
|
|
12451
12658
|
} else if (typeof response.type === "string") {
|
|
@@ -12455,6 +12662,18 @@ class BinaryBridge {
|
|
|
12455
12662
|
this.warnVia(`Failed to parse stdout line: ${line}`);
|
|
12456
12663
|
}
|
|
12457
12664
|
}
|
|
12665
|
+
accountForBashTaskResponse(command, response) {
|
|
12666
|
+
const taskId = bashTaskIdFrom(response);
|
|
12667
|
+
if (!taskId)
|
|
12668
|
+
return;
|
|
12669
|
+
if (isTerminalBashStatus(response.status)) {
|
|
12670
|
+
this.outstandingBackgroundTaskIds.delete(taskId);
|
|
12671
|
+
return;
|
|
12672
|
+
}
|
|
12673
|
+
if (command === "bash" && response.success !== false) {
|
|
12674
|
+
this.outstandingBackgroundTaskIds.add(taskId);
|
|
12675
|
+
}
|
|
12676
|
+
}
|
|
12458
12677
|
captureStatusBar(response) {
|
|
12459
12678
|
const parsed = parseStatusBarCounts(response.status_bar);
|
|
12460
12679
|
if (parsed)
|
|
@@ -12466,6 +12685,7 @@ class BinaryBridge {
|
|
|
12466
12685
|
handleTimeout(triggeringSessionId) {
|
|
12467
12686
|
this.consecutiveRequestTimeouts = 0;
|
|
12468
12687
|
this.rejectAllPending(new Error(`${this.errorPrefix} bridge killed during sibling timeout — request aborted`));
|
|
12688
|
+
this.outstandingBackgroundTaskIds.clear();
|
|
12469
12689
|
if (this.process) {
|
|
12470
12690
|
this.process.kill("SIGKILL");
|
|
12471
12691
|
this.process = null;
|
|
@@ -12495,6 +12715,7 @@ class BinaryBridge {
|
|
|
12495
12715
|
}
|
|
12496
12716
|
this.clearRestartResetTimer();
|
|
12497
12717
|
this.configured = false;
|
|
12718
|
+
this.outstandingBackgroundTaskIds.clear();
|
|
12498
12719
|
const tail = this.formatStderrTail();
|
|
12499
12720
|
if (tail) {
|
|
12500
12721
|
this.errorVia(`Binary crashed (restarts: ${this._restartCount})${cause ? `: ${cause.message}` : ""}.${tail}`);
|
|
@@ -14536,7 +14757,7 @@ function tokenizeStage(stage) {
|
|
|
14536
14757
|
// ../aft-bridge/dist/pool.js
|
|
14537
14758
|
import { realpathSync as realpathSync2 } from "node:fs";
|
|
14538
14759
|
import { homedir as homedir6 } from "node:os";
|
|
14539
|
-
var DEFAULT_IDLE_TIMEOUT_MS =
|
|
14760
|
+
var DEFAULT_IDLE_TIMEOUT_MS = 30 * 60 * 1000;
|
|
14540
14761
|
var DEFAULT_MAX_POOL_SIZE = 8;
|
|
14541
14762
|
var CLEANUP_INTERVAL_MS = 60 * 1000;
|
|
14542
14763
|
function canonicalHomeDir() {
|
|
@@ -14631,7 +14852,7 @@ class BridgePool {
|
|
|
14631
14852
|
cleanup() {
|
|
14632
14853
|
const now = Date.now();
|
|
14633
14854
|
for (const [dir, entry] of this.bridges) {
|
|
14634
|
-
if (entry.bridge.hasPendingRequests())
|
|
14855
|
+
if (entry.bridge.hasPendingRequests() || entry.bridge.hasOutstandingBackgroundTasks())
|
|
14635
14856
|
continue;
|
|
14636
14857
|
if (now - entry.lastUsed > this.idleTimeoutMs) {
|
|
14637
14858
|
entry.bridge.shutdown().catch((err) => this.error("cleanup shutdown failed:", err));
|
|
@@ -14639,7 +14860,7 @@ class BridgePool {
|
|
|
14639
14860
|
}
|
|
14640
14861
|
}
|
|
14641
14862
|
for (const bridge of this.staleBridges) {
|
|
14642
|
-
if (bridge.hasPendingRequests())
|
|
14863
|
+
if (bridge.hasPendingRequests() || bridge.hasOutstandingBackgroundTasks())
|
|
14643
14864
|
continue;
|
|
14644
14865
|
bridge.shutdown().catch((err) => this.error("stale cleanup shutdown failed:", err));
|
|
14645
14866
|
this.staleBridges.delete(bridge);
|
|
@@ -14649,7 +14870,7 @@ class BridgePool {
|
|
|
14649
14870
|
let oldestDir = null;
|
|
14650
14871
|
let oldestTime = Infinity;
|
|
14651
14872
|
for (const [dir, entry] of this.bridges) {
|
|
14652
|
-
if (entry.bridge.hasPendingRequests())
|
|
14873
|
+
if (entry.bridge.hasPendingRequests() || entry.bridge.hasOutstandingBackgroundTasks())
|
|
14653
14874
|
continue;
|
|
14654
14875
|
if (entry.lastUsed < oldestTime) {
|
|
14655
14876
|
oldestTime = entry.lastUsed;
|
|
@@ -15455,7 +15676,7 @@ import {
|
|
|
15455
15676
|
// package.json
|
|
15456
15677
|
var package_default = {
|
|
15457
15678
|
name: "@cortexkit/aft-pi",
|
|
15458
|
-
version: "0.
|
|
15679
|
+
version: "0.37.0",
|
|
15459
15680
|
type: "module",
|
|
15460
15681
|
description: "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
|
|
15461
15682
|
main: "dist/index.js",
|
|
@@ -15478,7 +15699,7 @@ var package_default = {
|
|
|
15478
15699
|
"test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'"
|
|
15479
15700
|
},
|
|
15480
15701
|
dependencies: {
|
|
15481
|
-
"@cortexkit/aft-bridge": "0.
|
|
15702
|
+
"@cortexkit/aft-bridge": "0.37.0",
|
|
15482
15703
|
"@xterm/headless": "^5.5.0",
|
|
15483
15704
|
"comment-json": "^5.0.0",
|
|
15484
15705
|
diff: "^8.0.4",
|
|
@@ -15486,12 +15707,12 @@ var package_default = {
|
|
|
15486
15707
|
zod: "^4.1.8"
|
|
15487
15708
|
},
|
|
15488
15709
|
optionalDependencies: {
|
|
15489
|
-
"@cortexkit/aft-darwin-arm64": "0.
|
|
15490
|
-
"@cortexkit/aft-darwin-x64": "0.
|
|
15491
|
-
"@cortexkit/aft-linux-arm64": "0.
|
|
15492
|
-
"@cortexkit/aft-linux-x64": "0.
|
|
15493
|
-
"@cortexkit/aft-win32-arm64": "0.
|
|
15494
|
-
"@cortexkit/aft-win32-x64": "0.
|
|
15710
|
+
"@cortexkit/aft-darwin-arm64": "0.37.0",
|
|
15711
|
+
"@cortexkit/aft-darwin-x64": "0.37.0",
|
|
15712
|
+
"@cortexkit/aft-linux-arm64": "0.37.0",
|
|
15713
|
+
"@cortexkit/aft-linux-x64": "0.37.0",
|
|
15714
|
+
"@cortexkit/aft-win32-arm64": "0.37.0",
|
|
15715
|
+
"@cortexkit/aft-win32-x64": "0.37.0"
|
|
15495
15716
|
},
|
|
15496
15717
|
devDependencies: {
|
|
15497
15718
|
"@earendil-works/pi-coding-agent": "*",
|
|
@@ -15749,19 +15970,6 @@ function isEmptyParam(value) {
|
|
|
15749
15970
|
return Object.keys(value).length === 0;
|
|
15750
15971
|
return false;
|
|
15751
15972
|
}
|
|
15752
|
-
var LONG_RUNNING_COMMAND_TIMEOUT_MS = {
|
|
15753
|
-
callers: 60000,
|
|
15754
|
-
trace_to: 60000,
|
|
15755
|
-
trace_to_symbol: 60000,
|
|
15756
|
-
trace_data: 60000,
|
|
15757
|
-
impact: 60000,
|
|
15758
|
-
grep: 60000,
|
|
15759
|
-
glob: 60000,
|
|
15760
|
-
semantic_search: 60000
|
|
15761
|
-
};
|
|
15762
|
-
function timeoutForCommand(command) {
|
|
15763
|
-
return LONG_RUNNING_COMMAND_TIMEOUT_MS[command];
|
|
15764
|
-
}
|
|
15765
15973
|
function asPlainObject(value) {
|
|
15766
15974
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
15767
15975
|
return;
|
|
@@ -32399,7 +32607,6 @@ function formatDiffForPi(oldContent, newContent, contextLines = DEFAULT_CONTEXT_
|
|
|
32399
32607
|
}
|
|
32400
32608
|
|
|
32401
32609
|
// src/tools/hoisted.ts
|
|
32402
|
-
var DIAGNOSTICS_PARAM_DESCRIPTION = "When true, wait up to 3 seconds for fresh LSP diagnostics on the edited file and include them in the result. Defaults to the configured `lsp.diagnostics_on_edit` value (false unless configured); per-call true/false overrides. Use aft_inspect to check diagnostics across a batch of edits or before tests/commits.";
|
|
32403
32610
|
function diagnosticsOnEditDefault(ctx) {
|
|
32404
32611
|
return ctx.config.lsp?.diagnostics_on_edit ?? false;
|
|
32405
32612
|
}
|
|
@@ -32469,8 +32676,7 @@ var WriteParams = Type2.Object({
|
|
|
32469
32676
|
filePath: Type2.String({
|
|
32470
32677
|
description: "Path to the file to write (absolute or relative to project root)"
|
|
32471
32678
|
}),
|
|
32472
|
-
content: Type2.String({ description: "Full file contents to write" })
|
|
32473
|
-
diagnostics: Type2.Optional(Type2.Boolean({ description: DIAGNOSTICS_PARAM_DESCRIPTION }))
|
|
32679
|
+
content: Type2.String({ description: "Full file contents to write" })
|
|
32474
32680
|
});
|
|
32475
32681
|
var EditParams = Type2.Object({
|
|
32476
32682
|
filePath: Type2.String({
|
|
@@ -32482,8 +32688,7 @@ var EditParams = Type2.Object({
|
|
|
32482
32688
|
occurrence: optionalInt(0, Number.MAX_SAFE_INTEGER),
|
|
32483
32689
|
appendContent: Type2.Optional(Type2.String({
|
|
32484
32690
|
description: "Append text to the end of the file (creates the file if missing, parent dirs auto-created). When set, oldString/newString are ignored."
|
|
32485
|
-
}))
|
|
32486
|
-
diagnostics: Type2.Optional(Type2.Boolean({ description: DIAGNOSTICS_PARAM_DESCRIPTION }))
|
|
32691
|
+
}))
|
|
32487
32692
|
});
|
|
32488
32693
|
var GrepParams = Type2.Object({
|
|
32489
32694
|
pattern: Type2.String({ description: "Regex pattern to search for" }),
|
|
@@ -32491,8 +32696,7 @@ var GrepParams = Type2.Object({
|
|
|
32491
32696
|
description: "Path scope (file or directory; absolute or relative to project root)"
|
|
32492
32697
|
})),
|
|
32493
32698
|
include: Type2.Optional(Type2.String({ description: "Glob filter for included files (e.g. '*.ts,*.tsx')" })),
|
|
32494
|
-
caseSensitive: Type2.Optional(Type2.Boolean({ description: "Case-sensitive matching" }))
|
|
32495
|
-
contextLines: optionalInt(1, Number.MAX_SAFE_INTEGER)
|
|
32699
|
+
caseSensitive: Type2.Optional(Type2.Boolean({ description: "Case-sensitive matching" }))
|
|
32496
32700
|
});
|
|
32497
32701
|
function registerHoistedTools(pi, ctx, surface) {
|
|
32498
32702
|
if (surface.hoistRead) {
|
|
@@ -32507,7 +32711,9 @@ function registerHoistedTools(pi, ctx, surface) {
|
|
|
32507
32711
|
const bridge = bridgeFor(ctx, extCtx.cwd);
|
|
32508
32712
|
const offset = coerceOptionalInt(params.offset, "offset", 1, Number.MAX_SAFE_INTEGER);
|
|
32509
32713
|
const limit = coerceOptionalInt(params.limit, "limit", 1, Number.MAX_SAFE_INTEGER);
|
|
32510
|
-
const req = {
|
|
32714
|
+
const req = {
|
|
32715
|
+
file: await resolvePathArg(extCtx.cwd, params.path)
|
|
32716
|
+
};
|
|
32511
32717
|
if (offset !== undefined) {
|
|
32512
32718
|
req.start_line = offset;
|
|
32513
32719
|
if (limit !== undefined) {
|
|
@@ -32534,19 +32740,20 @@ function registerHoistedTools(pi, ctx, surface) {
|
|
|
32534
32740
|
pi.registerTool({
|
|
32535
32741
|
name: "write",
|
|
32536
32742
|
label: "write",
|
|
32537
|
-
description: "Write a file
|
|
32538
|
-
promptSnippet: "Create or overwrite files (uses filePath; auto-formats
|
|
32743
|
+
description: "Write content to a file, creating it and parent directories automatically. Existing files are backed up before overwriting (undo via aft_safety) and auto-formatted when the project has a formatter configured. Uses `filePath` (not `path`). For partial edits, use the `edit` tool.",
|
|
32744
|
+
promptSnippet: "Create or overwrite files (uses filePath; auto-formats)",
|
|
32539
32745
|
promptGuidelines: ["Use write only for new files or complete rewrites."],
|
|
32540
32746
|
parameters: WriteParams,
|
|
32541
32747
|
async execute(_toolCallId, params, _signal, _onUpdate, extCtx) {
|
|
32542
|
-
await
|
|
32748
|
+
const filePath = await resolvePathArg(extCtx.cwd, params.filePath);
|
|
32749
|
+
await assertExternalDirectoryPermission(extCtx, filePath, "modify", {
|
|
32543
32750
|
restrictToProjectRoot: surface.restrictToProjectRoot
|
|
32544
32751
|
});
|
|
32545
32752
|
const bridge = bridgeFor(ctx, extCtx.cwd);
|
|
32546
32753
|
const response = await callBridge(bridge, "write", {
|
|
32547
|
-
file:
|
|
32754
|
+
file: filePath,
|
|
32548
32755
|
content: params.content,
|
|
32549
|
-
diagnostics:
|
|
32756
|
+
diagnostics: diagnosticsOnEditDefault(ctx),
|
|
32550
32757
|
include_diff_content: true
|
|
32551
32758
|
}, extCtx);
|
|
32552
32759
|
return buildMutationResult(response);
|
|
@@ -32563,8 +32770,8 @@ function registerHoistedTools(pi, ctx, surface) {
|
|
|
32563
32770
|
pi.registerTool({
|
|
32564
32771
|
name: "edit",
|
|
32565
32772
|
label: "edit",
|
|
32566
|
-
description: "Find-and-replace edit with progressive fuzzy matching (handles whitespace and Unicode drift). Uses `filePath`, `oldString`, `newString`. Errors on multiple matches — use `occurrence` to pick one, or `replaceAll: true`.
|
|
32567
|
-
promptSnippet: "Targeted find-and-replace (uses filePath/oldString/newString; occurrence or replaceAll for disambiguation; fuzzy whitespace matching). Pass appendContent to append to a file (creates if missing).
|
|
32773
|
+
description: "Find-and-replace edit with progressive fuzzy matching (handles whitespace and Unicode drift). Uses `filePath`, `oldString`, `newString`. Errors on multiple matches — use `occurrence` to pick one, or `replaceAll: true`.",
|
|
32774
|
+
promptSnippet: "Targeted find-and-replace (uses filePath/oldString/newString; occurrence or replaceAll for disambiguation; fuzzy whitespace matching). Pass appendContent to append to a file (creates if missing).",
|
|
32568
32775
|
promptGuidelines: [
|
|
32569
32776
|
"Prefer edit over write when changing part of an existing file.",
|
|
32570
32777
|
"Include enough surrounding context in oldString to make the match unique, or set replaceAll/occurrence explicitly.",
|
|
@@ -32572,26 +32779,27 @@ function registerHoistedTools(pi, ctx, surface) {
|
|
|
32572
32779
|
],
|
|
32573
32780
|
parameters: EditParams,
|
|
32574
32781
|
async execute(_toolCallId, params, _signal, _onUpdate, extCtx) {
|
|
32575
|
-
await
|
|
32782
|
+
const filePath = await resolvePathArg(extCtx.cwd, params.filePath);
|
|
32783
|
+
await assertExternalDirectoryPermission(extCtx, filePath, "modify", {
|
|
32576
32784
|
restrictToProjectRoot: surface.restrictToProjectRoot
|
|
32577
32785
|
});
|
|
32578
32786
|
const bridge = bridgeFor(ctx, extCtx.cwd);
|
|
32579
32787
|
if (typeof params.appendContent === "string") {
|
|
32580
32788
|
const req2 = {
|
|
32581
32789
|
op: "append",
|
|
32582
|
-
file:
|
|
32790
|
+
file: filePath,
|
|
32583
32791
|
append_content: params.appendContent,
|
|
32584
|
-
diagnostics:
|
|
32792
|
+
diagnostics: diagnosticsOnEditDefault(ctx),
|
|
32585
32793
|
include_diff_content: true
|
|
32586
32794
|
};
|
|
32587
32795
|
const response2 = await callBridge(bridge, "edit_match", req2, extCtx);
|
|
32588
32796
|
return buildMutationResult(response2);
|
|
32589
32797
|
}
|
|
32590
32798
|
const req = {
|
|
32591
|
-
file:
|
|
32799
|
+
file: filePath,
|
|
32592
32800
|
match: params.oldString ?? "",
|
|
32593
32801
|
replacement: params.newString ?? "",
|
|
32594
|
-
diagnostics:
|
|
32802
|
+
diagnostics: diagnosticsOnEditDefault(ctx),
|
|
32595
32803
|
include_diff_content: true
|
|
32596
32804
|
};
|
|
32597
32805
|
if (params.replaceAll === true)
|
|
@@ -32631,9 +32839,6 @@ function registerHoistedTools(pi, ctx, surface) {
|
|
|
32631
32839
|
req.include = splitIncludeGlobs(params.include);
|
|
32632
32840
|
if (params.caseSensitive !== undefined)
|
|
32633
32841
|
req.case_sensitive = params.caseSensitive;
|
|
32634
|
-
const contextLines = coerceOptionalInt(params.contextLines, "contextLines", 1, Number.MAX_SAFE_INTEGER);
|
|
32635
|
-
if (contextLines !== undefined)
|
|
32636
|
-
req.context_lines = contextLines;
|
|
32637
32842
|
const response = await callBridge(bridge, "grep", req, extCtx);
|
|
32638
32843
|
const text = response.text ?? "";
|
|
32639
32844
|
return textResult(text);
|
|
@@ -33194,7 +33399,7 @@ function registerAstTools(pi, ctx, surface) {
|
|
|
33194
33399
|
if (!isEmptyParam(params.globs))
|
|
33195
33400
|
req.globs = params.globs;
|
|
33196
33401
|
if (params.contextLines !== undefined)
|
|
33197
|
-
req.
|
|
33402
|
+
req.context = params.contextLines;
|
|
33198
33403
|
const response = await callBridge(bridge, "ast_search", req, extCtx);
|
|
33199
33404
|
return textResult(response.text ?? JSON.stringify(response));
|
|
33200
33405
|
},
|
|
@@ -33348,22 +33553,28 @@ function getBashSpawnHook(pi) {
|
|
|
33348
33553
|
}
|
|
33349
33554
|
return api2.hooks?.bashSpawn;
|
|
33350
33555
|
}
|
|
33351
|
-
function registerBashTool(pi, ctx) {
|
|
33556
|
+
function registerBashTool(pi, ctx, aftSearchRegistered = false) {
|
|
33352
33557
|
const spawnHook = getBashSpawnHook(pi);
|
|
33558
|
+
const searchSteer = aftSearchRegistered ? "use `aft_search` (concepts, identifiers, regex, literals), `read`, `aft_outline`, or `aft_zoom` instead" : "use the `grep` tool, `read`, `aft_outline`, or `aft_zoom` instead";
|
|
33559
|
+
const bashCfg = resolveBashConfig(ctx.config);
|
|
33560
|
+
const compressionSentence = bashCfg.compress ? " Output is compressed by default; pass `compressed: false` for raw output." : "";
|
|
33561
|
+
const tasksSentence = bashCfg.background ? ' Pass `background: true` to run in the background and get a task_id for `bash_status`/`bash_kill`. Pass `pty: true` for interactive programs (REPLs, TUIs) and drive them with `bash_status({ output_mode: "screen" })` plus `bash_write`.' : " Commands that outlive the foreground wait window are promoted to background tasks; inspect them with `bash_status({ task_id })` or terminate with `bash_kill`.";
|
|
33353
33562
|
pi.registerTool({
|
|
33354
33563
|
name: "bash",
|
|
33355
33564
|
label: "bash",
|
|
33356
|
-
description:
|
|
33565
|
+
description: `Execute shell commands.${compressionSentence}${tasksSentence}
|
|
33566
|
+
|
|
33567
|
+
DO NOT use bash for code search or code exploration. If you are about to run grep, rg, sed, awk, find, or cat through bash to locate or read code: STOP — ${searchSteer}.`,
|
|
33357
33568
|
promptSnippet: "Run shell commands (timeout in milliseconds; supports workdir, background tasks, compressed output, PTY mode)",
|
|
33358
33569
|
promptGuidelines: [
|
|
33359
|
-
|
|
33570
|
+
`DO NOT use bash for code search or exploration — ${searchSteer}.`,
|
|
33360
33571
|
"Set compressed: false when you need ANSI color codes in the output."
|
|
33361
33572
|
],
|
|
33362
33573
|
parameters: BashParams,
|
|
33363
33574
|
async execute(_toolCallId, params, _signal, onUpdate, extCtx) {
|
|
33364
33575
|
const bridge = bridgeFor(ctx, extCtx.cwd);
|
|
33365
|
-
const
|
|
33366
|
-
const foregroundWaitMs = resolveForegroundWaitMs(
|
|
33576
|
+
const bashCfg2 = resolveBashConfig(ctx.config);
|
|
33577
|
+
const foregroundWaitMs = resolveForegroundWaitMs(bashCfg2.foreground_wait_window_ms);
|
|
33367
33578
|
const timeout = coerceOptionalInt(params.timeout, "timeout", 1, Number.MAX_SAFE_INTEGER);
|
|
33368
33579
|
const ptyRows = coerceOptionalInt(params.ptyRows, "ptyRows", 1, 60);
|
|
33369
33580
|
const ptyCols = coerceOptionalInt(params.ptyCols, "ptyCols", 1, 140);
|
|
@@ -33380,7 +33591,7 @@ function registerBashTool(pi, ctx) {
|
|
|
33380
33591
|
throw new Error(`BashSpawnHook failed: ${hookErr instanceof Error ? hookErr.message : String(hookErr)}`);
|
|
33381
33592
|
}
|
|
33382
33593
|
}
|
|
33383
|
-
const compressionEnabled =
|
|
33594
|
+
const compressionEnabled = bashCfg2.compress && params.compressed !== false;
|
|
33384
33595
|
const pipeStrip = maybeStripCompressorPipe(spawnContext.command, compressionEnabled);
|
|
33385
33596
|
const bridgeCommand = pipeStrip.command;
|
|
33386
33597
|
let streamed = "";
|
|
@@ -33425,7 +33636,7 @@ function registerBashTool(pi, ctx) {
|
|
|
33425
33636
|
throw new Error(status.message ?? "bash_status failed");
|
|
33426
33637
|
}
|
|
33427
33638
|
if (isTerminalStatus(status.status)) {
|
|
33428
|
-
return bashResult(appendPipeStripNote(withBashHints(formatForegroundResult(status)), pipeStrip.note), {
|
|
33639
|
+
return bashResult(appendPipeStripNote(withBashHints(formatForegroundResult(status), bridgeCommand, aftSearchRegistered), pipeStrip.note), {
|
|
33429
33640
|
exit_code: status.exit_code,
|
|
33430
33641
|
duration_ms: status.duration_ms,
|
|
33431
33642
|
truncated: status.output_truncated,
|
|
@@ -33452,7 +33663,7 @@ function registerBashTool(pi, ctx) {
|
|
|
33452
33663
|
task_id: taskId
|
|
33453
33664
|
};
|
|
33454
33665
|
const output = response.output ?? "";
|
|
33455
|
-
return bashResult(appendPipeStripNote(withBashHints(output), pipeStrip.note), details);
|
|
33666
|
+
return bashResult(appendPipeStripNote(withBashHints(output, bridgeCommand, aftSearchRegistered), pipeStrip.note), details);
|
|
33456
33667
|
},
|
|
33457
33668
|
renderCall(args, theme, context) {
|
|
33458
33669
|
return renderBashCall(args?.command, args?.description, theme, context);
|
|
@@ -33484,8 +33695,8 @@ function formatPromotionMessage(taskId, timeout, waitWindowMs) {
|
|
|
33484
33695
|
function formatSeconds(ms) {
|
|
33485
33696
|
return `${Number((ms / 1000).toFixed(1))}s`;
|
|
33486
33697
|
}
|
|
33487
|
-
function withBashHints(output) {
|
|
33488
|
-
return maybeAppendConflictsHint(output);
|
|
33698
|
+
function withBashHints(output, command, aftSearchRegistered) {
|
|
33699
|
+
return maybeAppendGrepSearchHint(maybeAppendConflictsHint(output), command, aftSearchRegistered);
|
|
33489
33700
|
}
|
|
33490
33701
|
function formatForegroundResult(data) {
|
|
33491
33702
|
const output = data.output_preview ?? "";
|
|
@@ -33953,8 +34164,12 @@ function registerConflictsTool(pi, ctx) {
|
|
|
33953
34164
|
const bridge = bridgeFor(ctx, extCtx.cwd);
|
|
33954
34165
|
const reqParams = {};
|
|
33955
34166
|
const path2 = params?.path;
|
|
33956
|
-
if (typeof path2 === "string" && path2.trim() !== "")
|
|
33957
|
-
|
|
34167
|
+
if (typeof path2 === "string" && path2.trim() !== "") {
|
|
34168
|
+
await assertExternalDirectoryPermission(extCtx, path2, "inspect", {
|
|
34169
|
+
restrictToProjectRoot: ctx.config.restrict_to_project_root ?? false
|
|
34170
|
+
});
|
|
34171
|
+
reqParams.path = await resolvePathArg(extCtx.cwd, path2);
|
|
34172
|
+
}
|
|
33958
34173
|
const response = await callBridge(bridge, "git_conflicts", reqParams, extCtx);
|
|
33959
34174
|
return textResult(response.text ?? JSON.stringify(response, null, 2));
|
|
33960
34175
|
},
|
|
@@ -35247,7 +35462,7 @@ function registerRefactorTool(pi, ctx) {
|
|
|
35247
35462
|
pi.registerTool({
|
|
35248
35463
|
name: "aft_refactor",
|
|
35249
35464
|
label: "refactor",
|
|
35250
|
-
description: "Workspace-wide refactoring that updates imports and references across files. `move` relocates a top-level symbol; `extract` pulls a line range into a new function
|
|
35465
|
+
description: "Workspace-wide refactoring that updates imports and references across files. `move` relocates a top-level symbol (not nested functions or class methods) to another file, rewriting imports workspace-wide; a checkpoint is created first. To move/rename a whole file, use aft_move. `extract` pulls a line range into a new function (TS/JS/TSX, Python). `inline` replaces a call with the function's body.",
|
|
35251
35466
|
parameters: RefactorParams,
|
|
35252
35467
|
async execute(_toolCallId, params, _signal, _onUpdate, extCtx) {
|
|
35253
35468
|
const commandMap = {
|
|
@@ -35626,21 +35841,9 @@ function registerSemanticTool(pi, ctx) {
|
|
|
35626
35841
|
name: "aft_search",
|
|
35627
35842
|
label: "search",
|
|
35628
35843
|
description: [
|
|
35629
|
-
"
|
|
35630
|
-
"",
|
|
35631
|
-
"When to reach for it:",
|
|
35632
|
-
"- Exploring an unfamiliar area: 'where is rate limiting handled', 'how does auth flow work'",
|
|
35633
|
-
"- Concept doesn't appear as a literal string: 'retry logic', 'cache invalidation', 'graceful shutdown'",
|
|
35634
|
-
"- Filename-shaped concepts: 'the bridge spawn helper', 'the session detection module'",
|
|
35635
|
-
"- Regex-shaped or exact text queries when you want AFT to classify and route automatically",
|
|
35636
|
-
"- You know roughly what the function does but not what it's named",
|
|
35637
|
-
"",
|
|
35638
|
-
"When NOT to use:",
|
|
35639
|
-
"- You need exhaustive literal enumeration → use grep directly",
|
|
35640
|
-
"- You want the file/module structure → use aft_outline",
|
|
35641
|
-
"- You're following a call chain → use aft_callgraph",
|
|
35844
|
+
"Search code with one tool: concepts, identifiers, error strings, regex, literals, and filenames are auto-routed to the right engine and returned ranked. Use it for any code search — including when you only know what the code does, not what it's named ('where is rate limiting handled', 'retry logic', '^export', 'Cargo.lock').",
|
|
35642
35845
|
"",
|
|
35643
|
-
"Set hint to 'regex', 'literal',
|
|
35846
|
+
"Set hint to 'regex', 'literal', or 'semantic' to force a lane."
|
|
35644
35847
|
].join(`
|
|
35645
35848
|
`),
|
|
35646
35849
|
parameters: SearchParams2,
|
|
@@ -35671,138 +35874,8 @@ ${extra}`;
|
|
|
35671
35874
|
});
|
|
35672
35875
|
}
|
|
35673
35876
|
|
|
35674
|
-
// src/tools/structure.ts
|
|
35675
|
-
import { StringEnum as StringEnum6 } from "@earendil-works/pi-ai";
|
|
35676
|
-
import { Type as Type14 } from "typebox";
|
|
35677
|
-
var TransformParams = Type14.Object({
|
|
35678
|
-
op: StringEnum6(["add_member", "add_derive", "wrap_try_catch", "add_decorator", "add_struct_tags"], { description: "Transformation operation" }),
|
|
35679
|
-
filePath: Type14.String({
|
|
35680
|
-
description: "Path to the source file (absolute or relative to project root)"
|
|
35681
|
-
}),
|
|
35682
|
-
container: Type14.Optional(Type14.String({ description: "Class/struct/impl name for add_member" })),
|
|
35683
|
-
code: Type14.Optional(Type14.String({ description: "Member code to insert (add_member)" })),
|
|
35684
|
-
target: Type14.Optional(Type14.String({ description: "Target symbol name" })),
|
|
35685
|
-
derives: Type14.Optional(Type14.Array(Type14.String(), { description: "Derive macro names (add_derive)" })),
|
|
35686
|
-
catchBody: Type14.Optional(Type14.String({ description: "Catch block body (wrap_try_catch, default: 'throw error;')" })),
|
|
35687
|
-
decorator: Type14.Optional(Type14.String({ description: "Decorator text without @ (add_decorator)" })),
|
|
35688
|
-
field: Type14.Optional(Type14.String({ description: "Struct field name (add_struct_tags)" })),
|
|
35689
|
-
tag: Type14.Optional(Type14.String({ description: "Tag key (add_struct_tags)" })),
|
|
35690
|
-
value: Type14.Optional(Type14.String({ description: "Tag value (add_struct_tags)" })),
|
|
35691
|
-
position: Type14.Optional(Type14.String({
|
|
35692
|
-
description: "Position hint: 'first', 'last' (default), 'before:name', 'after:name' for add_member"
|
|
35693
|
-
})),
|
|
35694
|
-
validate: Type14.Optional(StringEnum6(["syntax", "full"], {
|
|
35695
|
-
description: "Validation level (default: syntax)"
|
|
35696
|
-
}))
|
|
35697
|
-
});
|
|
35698
|
-
function buildTransformSections(args, payload, theme) {
|
|
35699
|
-
const response = asRecord2(payload);
|
|
35700
|
-
if (!response)
|
|
35701
|
-
return [theme.fg("muted", "No transform result.")];
|
|
35702
|
-
const target = asString(response.target) ?? asString(response.scope) ?? args.target ?? args.container ?? args.field ?? args.filePath;
|
|
35703
|
-
return [
|
|
35704
|
-
`${theme.fg("success", "transformed")} ${theme.fg("accent", args.op)}`,
|
|
35705
|
-
`${theme.fg("muted", "file")} ${theme.fg("accent", asString(response.file) ?? args.filePath)}`,
|
|
35706
|
-
target ? `${theme.fg("muted", "target")} ${target}` : theme.fg("muted", "No target metadata.")
|
|
35707
|
-
];
|
|
35708
|
-
}
|
|
35709
|
-
function renderTransformCall(args, theme, context) {
|
|
35710
|
-
const target = args.target ?? args.container ?? args.field;
|
|
35711
|
-
const summary = [
|
|
35712
|
-
theme.fg("accent", args.op),
|
|
35713
|
-
accentPath(theme, args.filePath),
|
|
35714
|
-
target ? theme.fg("toolOutput", target) : undefined
|
|
35715
|
-
].filter(Boolean).join(" ");
|
|
35716
|
-
return renderToolCall("transform", summary, theme, context);
|
|
35717
|
-
}
|
|
35718
|
-
function renderTransformResult(result, args, theme, context) {
|
|
35719
|
-
if (context.isError)
|
|
35720
|
-
return renderErrorResult(result, "transform failed", theme, context);
|
|
35721
|
-
return renderSections(buildTransformSections(args, extractStructuredPayload(result), theme), context);
|
|
35722
|
-
}
|
|
35723
|
-
function registerStructureTool(pi, ctx) {
|
|
35724
|
-
pi.registerTool({
|
|
35725
|
-
name: "aft_transform",
|
|
35726
|
-
label: "transform",
|
|
35727
|
-
description: "Scope-aware structural code transformations with correct indentation. Use aft_safety checkpoint/undo before risky transforms.",
|
|
35728
|
-
parameters: TransformParams,
|
|
35729
|
-
async execute(_toolCallId, params, _signal, _onUpdate, extCtx) {
|
|
35730
|
-
validateTransformParams(params);
|
|
35731
|
-
const filePath = await resolvePathArg(extCtx.cwd, params.filePath);
|
|
35732
|
-
await assertExternalDirectoryPermission(extCtx, filePath, "modify", {
|
|
35733
|
-
restrictToProjectRoot: ctx.config.restrict_to_project_root ?? false
|
|
35734
|
-
});
|
|
35735
|
-
const bridge = bridgeFor(ctx, extCtx.cwd);
|
|
35736
|
-
const req = { file: filePath };
|
|
35737
|
-
if (params.container !== undefined)
|
|
35738
|
-
req.scope = params.container;
|
|
35739
|
-
if (params.code !== undefined)
|
|
35740
|
-
req.code = params.code;
|
|
35741
|
-
if (params.target !== undefined)
|
|
35742
|
-
req.target = params.target;
|
|
35743
|
-
if (params.derives !== undefined)
|
|
35744
|
-
req.derives = params.derives;
|
|
35745
|
-
if (params.catchBody !== undefined)
|
|
35746
|
-
req.catch_body = params.catchBody;
|
|
35747
|
-
if (params.decorator !== undefined)
|
|
35748
|
-
req.decorator = params.decorator;
|
|
35749
|
-
if (params.field !== undefined)
|
|
35750
|
-
req.field = params.field;
|
|
35751
|
-
if (params.tag !== undefined)
|
|
35752
|
-
req.tag = params.tag;
|
|
35753
|
-
if (params.value !== undefined)
|
|
35754
|
-
req.value = params.value;
|
|
35755
|
-
if (params.position !== undefined)
|
|
35756
|
-
req.position = params.position;
|
|
35757
|
-
if (params.validate !== undefined)
|
|
35758
|
-
req.validate = params.validate;
|
|
35759
|
-
const response = await callBridge(bridge, params.op, req, extCtx);
|
|
35760
|
-
return textResult(JSON.stringify(response, null, 2));
|
|
35761
|
-
},
|
|
35762
|
-
renderCall(args, theme, context) {
|
|
35763
|
-
return renderTransformCall(args, theme, context);
|
|
35764
|
-
},
|
|
35765
|
-
renderResult(result, _options, theme, context) {
|
|
35766
|
-
return renderTransformResult(result, context.args, theme, context);
|
|
35767
|
-
}
|
|
35768
|
-
});
|
|
35769
|
-
}
|
|
35770
|
-
function validateTransformParams(params) {
|
|
35771
|
-
const op = params.op;
|
|
35772
|
-
if (op === "add_member") {
|
|
35773
|
-
if (isEmptyParam(params.container)) {
|
|
35774
|
-
throw new Error("'container' is required for 'add_member' op");
|
|
35775
|
-
}
|
|
35776
|
-
if (isEmptyParam(params.code)) {
|
|
35777
|
-
throw new Error("'code' is required for 'add_member' op");
|
|
35778
|
-
}
|
|
35779
|
-
}
|
|
35780
|
-
if (op === "add_derive" || op === "wrap_try_catch" || op === "add_decorator" || op === "add_struct_tags") {
|
|
35781
|
-
if (isEmptyParam(params.target)) {
|
|
35782
|
-
throw new Error(`'target' is required for '${op}' op`);
|
|
35783
|
-
}
|
|
35784
|
-
}
|
|
35785
|
-
if (op === "add_derive" && isEmptyParam(params.derives)) {
|
|
35786
|
-
throw new Error("'derives' array is required for 'add_derive' op");
|
|
35787
|
-
}
|
|
35788
|
-
if (op === "add_decorator" && isEmptyParam(params.decorator)) {
|
|
35789
|
-
throw new Error("'decorator' is required for 'add_decorator' op");
|
|
35790
|
-
}
|
|
35791
|
-
if (op === "add_struct_tags") {
|
|
35792
|
-
if (isEmptyParam(params.field)) {
|
|
35793
|
-
throw new Error("'field' is required for 'add_struct_tags' op");
|
|
35794
|
-
}
|
|
35795
|
-
if (isEmptyParam(params.tag)) {
|
|
35796
|
-
throw new Error("'tag' is required for 'add_struct_tags' op");
|
|
35797
|
-
}
|
|
35798
|
-
if (isEmptyParam(params.value)) {
|
|
35799
|
-
throw new Error("'value' is required for 'add_struct_tags' op");
|
|
35800
|
-
}
|
|
35801
|
-
}
|
|
35802
|
-
}
|
|
35803
|
-
|
|
35804
35877
|
// src/workflow-hints.ts
|
|
35805
|
-
var HEADING = "##
|
|
35878
|
+
var HEADING = "## IMPORTANT NOTICE about your tools";
|
|
35806
35879
|
function buildWorkflowHints(opts) {
|
|
35807
35880
|
const sections = [];
|
|
35808
35881
|
const grepName = opts.hoistBuiltins ? "grep" : "aft_grep";
|
|
@@ -35816,14 +35889,28 @@ function buildWorkflowHints(opts) {
|
|
|
35816
35889
|
const hasBash = !opts.absentTools.has(bashName);
|
|
35817
35890
|
const hasBgBash = opts.bashBackgroundEnabled && hasBash && !opts.absentTools.has("bash_status");
|
|
35818
35891
|
if (hasBash && opts.bashCompressionEnabled) {
|
|
35819
|
-
sections.push(
|
|
35892
|
+
sections.push([
|
|
35893
|
+
"**Test/build output**: bash output is auto-compressed — failures and the summary are always kept. DO NOT pipe test/build commands through filters to summarize; that hides failures:",
|
|
35894
|
+
"- `bun test | grep fail` → run `bun test`",
|
|
35895
|
+
"- `cargo test 2>&1 | tail -20` → run `cargo test`",
|
|
35896
|
+
"- `npm run build | head -50` → run `npm run build`"
|
|
35897
|
+
].join(`
|
|
35898
|
+
`));
|
|
35820
35899
|
}
|
|
35821
35900
|
if (hasOutline && hasZoom) {
|
|
35822
35901
|
sections.push(`**Web/URL access**: \`aft_outline({ target: "<url>" })\` first for structure, then \`aft_zoom({ url: "<url>", symbols: "<heading>" })\` for the specific section.`);
|
|
35823
35902
|
}
|
|
35824
35903
|
if (hasOutline && hasZoom && (hasGrep || hasSearch)) {
|
|
35904
|
+
const searchName = hasSearch ? "aft_search" : grepName;
|
|
35825
35905
|
const locate = hasSearch ? '`aft_search` is the primary code-search tool: one call auto-routes concepts, identifiers, regex, error strings, and literals (pass `hint: "regex"`/`"literal"`/`"semantic"` to force a lane).' : `\`${grepName}\` (the tool — indexed and ranked) locates code.`;
|
|
35826
|
-
|
|
35906
|
+
const readName = opts.hoistBuiltins ? "read" : "aft_read";
|
|
35907
|
+
sections.push([
|
|
35908
|
+
`**Code exploration**: ${locate} Then \`aft_outline\` for structure → \`aft_zoom\` for symbol(s). DO NOT run \`grep\`/\`rg\`/\`find\`/\`sed\`/\`cat\` through \`bash\` to locate or read code — the bash path is unindexed, unranked, serial, and routinely surfaces the wrong hit. Keep \`bash\` for shell facts (git state, file metadata, processes). Reflex translations:`,
|
|
35909
|
+
`- \`grep -rn "handleAuth" src/\` in bash → \`${searchName}({ query: "handleAuth" })\``,
|
|
35910
|
+
`- \`find . -name "*.ts" | xargs grep watcher\` in bash → \`${searchName}({ query: "watcher invalidation" })\` (concepts work too)`,
|
|
35911
|
+
`- \`sed -n '100,160p' app.ts\` / \`cat app.ts\` in bash → \`${readName}({ filePath: "app.ts", startLine: 100, endLine: 160 })\``
|
|
35912
|
+
].join(`
|
|
35913
|
+
`));
|
|
35827
35914
|
}
|
|
35828
35915
|
if (hasInspect) {
|
|
35829
35916
|
sections.push("**Codebase health & diagnostics**: AFT does not surface compile/type errors automatically after edits — pull them with `aft_inspect`. Run it after a batch of edits and before you run tests or commit, when starting in unfamiliar code, or before a refactor/review. One call summarizes diagnostics (compile/type errors), TODOs, metrics, dead code, unused exports, and duplicates; pass `sections` for focused drill-down and `scope` to actively pull diagnostics for a specific file or directory. Its diagnostics are a fast checkpoint, not the authority — a clean `tsc` / `cargo check` / `pyright` run is the real gate. Treat `stale_categories` as a genuine stale-cache signal while an async Tier 2 refresh catches up.");
|
|
@@ -35841,13 +35928,22 @@ function buildWorkflowHints(opts) {
|
|
|
35841
35928
|
`));
|
|
35842
35929
|
}
|
|
35843
35930
|
if (hasBgBash) {
|
|
35844
|
-
sections.push(
|
|
35931
|
+
sections.push([
|
|
35932
|
+
`**Long-running commands** (builds, installs, full test suites): \`${bashName}({ background: true })\` returns a \`task_id\` immediately. Then do ONE of these:`,
|
|
35933
|
+
"1. Keep working on something independent of the result.",
|
|
35934
|
+
"2. End your turn — a completion reminder with the result arrives automatically.",
|
|
35935
|
+
`3. Need to react to a specific output line early? Register \`bash_watch({ task_id, pattern, background: true })\`, then end your turn — it pings you the moment the pattern appears.`,
|
|
35936
|
+
`\`bash_status({ task_id })\` is for inspecting output AFTER the reminder arrives, or one quick look at a live task — never call it repeatedly to wait: the reminder already delivers the result, and each poll wastes a turn. Sync \`bash_watch\` (without \`background: true\`) blocks your turn and locks the user out — reserve it for waits of a few seconds (a dev server printing its ready line), never for builds or test suites.`
|
|
35937
|
+
].join(`
|
|
35938
|
+
`));
|
|
35845
35939
|
sections.push(`**PTY / interactive commands**: PTY mode is for interactive REPLs and terminal apps (python, node, bash itself, vim). Start with \`${bashName}({ command: "python", pty: true, background: true })\`, read the screen with \`bash_status({ task_id, output_mode: "screen" })\`, and send input with \`bash_write({ task_id, input: "..." })\`.`);
|
|
35846
35940
|
}
|
|
35847
35941
|
if (sections.length === 0) {
|
|
35848
35942
|
return null;
|
|
35849
35943
|
}
|
|
35850
|
-
sections.unshift(
|
|
35944
|
+
sections.unshift(`You are equipped with a non-standard tool set: indexed code search, symbol-level reading, structural editing, and code analysis that are faster, more precise, and far cheaper in tokens than stitching together command-line utilities in bash. Always reach for these tools first.
|
|
35945
|
+
|
|
35946
|
+
**Parallel tool calls**: when several read-only operations are independent, emit them in ONE response instead of serializing — file reads, structure and symbol lookups, code search, diagnostics, and git status/diff/log. Sequence only when a call depends on a prior result or when a command mutates state.`);
|
|
35851
35947
|
return `${HEADING}
|
|
35852
35948
|
|
|
35853
35949
|
${sections.join(`
|
|
@@ -35939,21 +36035,15 @@ var PLUGIN_VERSION = (() => {
|
|
|
35939
36035
|
return "0.0.0";
|
|
35940
36036
|
}
|
|
35941
36037
|
})();
|
|
35942
|
-
var ANNOUNCEMENT_VERSION = "0.
|
|
36038
|
+
var ANNOUNCEMENT_VERSION = "0.37.0";
|
|
35943
36039
|
var ANNOUNCEMENT_FEATURES = [
|
|
35944
|
-
"
|
|
35945
|
-
"
|
|
35946
|
-
"
|
|
35947
|
-
"
|
|
36040
|
+
"Much lower background CPU: idle bridges shut down after 30 minutes, deleted project roots stop the watcher instead of spinning it, and background scans reuse warm caches on a bounded thread pool.",
|
|
36041
|
+
"`aft_transform` removed: usage data showed agents never called it — `edit` covers everything it did, and every request now carries a smaller tool surface.",
|
|
36042
|
+
"Leaner tools: `bash`, `write`, `edit`, `apply_patch`, `aft_search`, and `aft_refactor` descriptions trimmed and config-aware; system-prompt guidance rewritten around what to do instead of what to avoid.",
|
|
36043
|
+
"Background bash reminders are right-sized: failures keep head + tail context, successes show a short tail, and compressors never print a success summary for a non-zero exit."
|
|
35948
36044
|
];
|
|
35949
36045
|
var ANNOUNCEMENT_FOOTER = "Join us on Discord: https://discord.gg/DSa65w8wuf";
|
|
35950
|
-
var ALL_ONLY_TOOLS = new Set([
|
|
35951
|
-
"aft_callgraph",
|
|
35952
|
-
"aft_delete",
|
|
35953
|
-
"aft_move",
|
|
35954
|
-
"aft_transform",
|
|
35955
|
-
"aft_refactor"
|
|
35956
|
-
]);
|
|
36046
|
+
var ALL_ONLY_TOOLS = new Set(["aft_callgraph", "aft_delete", "aft_move", "aft_refactor"]);
|
|
35957
36047
|
var pendingEagerWarnings = new Map;
|
|
35958
36048
|
function isConfigureWarning(value) {
|
|
35959
36049
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
@@ -36031,7 +36121,6 @@ function resolveToolSurface(config2) {
|
|
|
36031
36121
|
move: false,
|
|
36032
36122
|
astSearch: false,
|
|
36033
36123
|
astReplace: false,
|
|
36034
|
-
structure: false,
|
|
36035
36124
|
refactor: false
|
|
36036
36125
|
};
|
|
36037
36126
|
}
|
|
@@ -36054,7 +36143,6 @@ function resolveToolSurface(config2) {
|
|
|
36054
36143
|
move: false,
|
|
36055
36144
|
astSearch: ok("ast_grep_search"),
|
|
36056
36145
|
astReplace: ok("ast_grep_replace"),
|
|
36057
|
-
structure: false,
|
|
36058
36146
|
refactor: false
|
|
36059
36147
|
};
|
|
36060
36148
|
if (surface === "all") {
|
|
@@ -36063,7 +36151,6 @@ function resolveToolSurface(config2) {
|
|
|
36063
36151
|
navigate: allOnly("aft_callgraph"),
|
|
36064
36152
|
delete: allOnly("aft_delete"),
|
|
36065
36153
|
move: allOnly("aft_move"),
|
|
36066
|
-
structure: allOnly("aft_transform"),
|
|
36067
36154
|
refactor: allOnly("aft_refactor")
|
|
36068
36155
|
};
|
|
36069
36156
|
}
|
|
@@ -36269,7 +36356,7 @@ ${lines}
|
|
|
36269
36356
|
}
|
|
36270
36357
|
const surface = resolveToolSurface(config2);
|
|
36271
36358
|
if (surface.hoistBash && resolveBashConfig(config2).enabled) {
|
|
36272
|
-
registerBashTool(pi, ctx);
|
|
36359
|
+
registerBashTool(pi, ctx, surface.semantic);
|
|
36273
36360
|
}
|
|
36274
36361
|
registerHoistedTools(pi, ctx, surface);
|
|
36275
36362
|
if (surface.outline || surface.zoom) {
|
|
@@ -36299,9 +36386,6 @@ ${lines}
|
|
|
36299
36386
|
if (surface.delete || surface.move) {
|
|
36300
36387
|
registerFsTools(pi, ctx, surface);
|
|
36301
36388
|
}
|
|
36302
|
-
if (surface.structure) {
|
|
36303
|
-
registerStructureTool(pi, ctx);
|
|
36304
|
-
}
|
|
36305
36389
|
if (surface.refactor) {
|
|
36306
36390
|
registerRefactorTool(pi, ctx);
|
|
36307
36391
|
}
|
package/dist/tools/_shared.d.ts
CHANGED
|
@@ -20,17 +20,7 @@ export declare function coerceOptionalInt(v: unknown, paramName: string, min: nu
|
|
|
20
20
|
* collection sentinels qualify.
|
|
21
21
|
*/
|
|
22
22
|
export declare function isEmptyParam(value: unknown): boolean;
|
|
23
|
-
|
|
24
|
-
* Per-command timeout overrides (milliseconds).
|
|
25
|
-
*
|
|
26
|
-
* Commands not listed fall back to the bridge-wide default (30s). Only
|
|
27
|
-
* extend budgets for operations that legitimately walk the project
|
|
28
|
-
* file tree or wait on external I/O (embedding API, index build). The
|
|
29
|
-
* goal is to absorb slow first-call spikes without masking real hangs.
|
|
30
|
-
*/
|
|
31
|
-
export declare const LONG_RUNNING_COMMAND_TIMEOUT_MS: Record<string, number>;
|
|
32
|
-
/** Returns the per-command timeout override, or undefined to use the bridge default. */
|
|
33
|
-
export declare function timeoutForCommand(command: string): number | undefined;
|
|
23
|
+
export { LONG_RUNNING_COMMAND_TIMEOUT_MS, timeoutForCommand } from "@cortexkit/aft-bridge";
|
|
34
24
|
/** Format bridge failure envelopes without dropping structured error data. */
|
|
35
25
|
export declare function formatBridgeErrorMessage(command: string, response: Record<string, unknown>, params?: Record<string, unknown>): string;
|
|
36
26
|
/** Get the session bridge for the current working directory. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/tools/_shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,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C;gBACV,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAK1C;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACpC,MAAM,CAAC,EAAE,gBAAgB,EACzB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAyBlC;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"}
|
package/dist/tools/bash.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ interface BashKillDetails {
|
|
|
52
52
|
}
|
|
53
53
|
interface BashWatchDetails extends Record<string, unknown> {
|
|
54
54
|
}
|
|
55
|
-
export declare function registerBashTool(pi: ExtensionAPI, ctx: PluginContext): void;
|
|
55
|
+
export declare function registerBashTool(pi: ExtensionAPI, ctx: PluginContext, aftSearchRegistered?: boolean): void;
|
|
56
56
|
export declare function createBashStatusTool(ctx: PluginContext): {
|
|
57
57
|
name: string;
|
|
58
58
|
label: string;
|
package/dist/tools/bash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EAEjB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAiB5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAgGjD,QAAA,MAAM,cAAc;;EAIlB,CAAC;AAEH,QAAA,MAAM,gBAAgB;;;EAUpB,CAAC;AAEH,QAAA,MAAM,eAAe;;;;;;;;EAQnB,CAAC;AAEH,QAAA,MAAM,eAAe;;;;;EA+BnB,CAAC;AAWH,UAAU,gBAAgB;IACxB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B;AAED,UAAU,gBAAgB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,eAAe;IACvB,OAAO,EAAE,O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"file":"conflicts.d.ts","sourceRoot":"","sources":["../../src/tools/conflicts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"conflicts.d.ts","sourceRoot":"","sources":["../../src/tools/conflicts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAEL,KAAK,iBAAiB,EACtB,iBAAiB,EAEjB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAW7B,wCAAwC;AACxC,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,EAC3C,OAAO,EAAE,iBAAiB,yCAG3B;AAED,wCAAwC;AACxC,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAe5D;AAED,wCAAwC;AACxC,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,EAC3C,OAAO,EAAE,iBAAiB,8CAM3B;AAED,wCAAwC;AACxC,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAC/C,KAAK,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,EAC3C,OAAO,EAAE,iBAAiB,sFAI3B;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CA8BhF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hoisted.d.ts","sourceRoot":"","sources":["../../src/tools/hoisted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EAGlB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"hoisted.d.ts","sourceRoot":"","sources":["../../src/tools/hoisted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EAGlB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA2DjD,wBAAsB,iCAAiC,CACrD,MAAM,EAAE;IACN,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,EAAE,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC;CACzE,EACD,MAAM,EAAE,MAAM,EACd,MAAM,SAAW,EACjB,OAAO,GAAE;IAAE,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAAO,GAChD,OAAO,CAAC,IAAI,CAAC,CAkDf;AAgDD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;;;;;;OAWG;IACH,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED,kEAAkE;AAClE,UAAU,mBAAmB;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;IACxB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,YAAY,EAChB,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAgNN;AAMD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,eAAe,CAAC,mBAAmB,CAAC,CA6FtC;AA8ID,+EAA+E;AAC/E,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAS/E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CA0B3D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,mBAAmB,EAAE,OAAO,EAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,MAAM,CAgBR"}
|
package/dist/tools/navigate.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { type Static, Type } from "typebox";
|
|
|
7
7
|
import type { PluginContext } from "../types.js";
|
|
8
8
|
import { type RenderContextLike } from "./render-helpers.js";
|
|
9
9
|
declare function navigateParamsSchema(): Type.TObject<{
|
|
10
|
-
op: Type.TUnsafe<"
|
|
10
|
+
op: Type.TUnsafe<"call_tree" | "callers" | "trace_to" | "trace_to_symbol" | "impact" | "trace_data">;
|
|
11
11
|
filePath: Type.TString;
|
|
12
12
|
symbol: Type.TString;
|
|
13
13
|
depth: Type.TOptional<Type.TAny>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../src/tools/semantic.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAOL,KAAK,iBAAiB,EAKvB,MAAM,qBAAqB,CAAC;AAwB7B,QAAA,MAAM,YAAY;;;;EA0BhB,CAAC;AAEH,wCAAwC;AACxC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,CAAC,OAAO,YAAY,CAAC,EACjC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,GACX,MAAM,EAAE,CAuFV;AAED,wCAAwC;AACxC,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,CAAC,OAAO,YAAY,CAAC,EACjC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,iBAAiB,yCAG3B;AAED,wCAAwC;AACxC,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,EAChC,IAAI,EAAE,MAAM,CAAC,OAAO,YAAY,CAAC,EACjC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,iBAAiB,sFAO3B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../src/tools/semantic.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,iCAAiC,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HANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft-pi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@cortexkit/aft-bridge": "0.
|
|
26
|
+
"@cortexkit/aft-bridge": "0.37.0",
|
|
27
27
|
"@xterm/headless": "^5.5.0",
|
|
28
28
|
"comment-json": "^5.0.0",
|
|
29
29
|
"diff": "^8.0.4",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"zod": "^4.1.8"
|
|
32
32
|
},
|
|
33
33
|
"optionalDependencies": {
|
|
34
|
-
"@cortexkit/aft-darwin-arm64": "0.
|
|
35
|
-
"@cortexkit/aft-darwin-x64": "0.
|
|
36
|
-
"@cortexkit/aft-linux-arm64": "0.
|
|
37
|
-
"@cortexkit/aft-linux-x64": "0.
|
|
38
|
-
"@cortexkit/aft-win32-arm64": "0.
|
|
39
|
-
"@cortexkit/aft-win32-x64": "0.
|
|
34
|
+
"@cortexkit/aft-darwin-arm64": "0.37.0",
|
|
35
|
+
"@cortexkit/aft-darwin-x64": "0.37.0",
|
|
36
|
+
"@cortexkit/aft-linux-arm64": "0.37.0",
|
|
37
|
+
"@cortexkit/aft-linux-x64": "0.37.0",
|
|
38
|
+
"@cortexkit/aft-win32-arm64": "0.37.0",
|
|
39
|
+
"@cortexkit/aft-win32-x64": "0.37.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@earendil-works/pi-coding-agent": "*",
|
|
@@ -1,32 +0,0 @@
|
|
|
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 { AgentToolResult, ExtensionAPI, Theme } from "@earendil-works/pi-coding-agent";
|
|
6
|
-
import { type Static, Type } from "typebox";
|
|
7
|
-
import type { PluginContext } from "../types.js";
|
|
8
|
-
import { type RenderContextLike } from "./render-helpers.js";
|
|
9
|
-
declare const TransformParams: Type.TObject<{
|
|
10
|
-
op: Type.TUnsafe<"add_member" | "add_derive" | "wrap_try_catch" | "add_decorator" | "add_struct_tags">;
|
|
11
|
-
filePath: Type.TString;
|
|
12
|
-
container: Type.TOptional<Type.TString>;
|
|
13
|
-
code: Type.TOptional<Type.TString>;
|
|
14
|
-
target: Type.TOptional<Type.TString>;
|
|
15
|
-
derives: Type.TOptional<Type.TArray<Type.TString>>;
|
|
16
|
-
catchBody: Type.TOptional<Type.TString>;
|
|
17
|
-
decorator: Type.TOptional<Type.TString>;
|
|
18
|
-
field: Type.TOptional<Type.TString>;
|
|
19
|
-
tag: Type.TOptional<Type.TString>;
|
|
20
|
-
value: Type.TOptional<Type.TString>;
|
|
21
|
-
position: Type.TOptional<Type.TString>;
|
|
22
|
-
validate: Type.TOptional<Type.TUnsafe<"syntax" | "full">>;
|
|
23
|
-
}>;
|
|
24
|
-
/** Exported for renderer unit tests. */
|
|
25
|
-
export declare function buildTransformSections(args: Static<typeof TransformParams>, payload: unknown, theme: Theme): string[];
|
|
26
|
-
/** Exported for renderer unit tests. */
|
|
27
|
-
export declare function renderTransformCall(args: Static<typeof TransformParams>, theme: Theme, context: RenderContextLike): import("@earendil-works/pi-tui").Text;
|
|
28
|
-
/** Exported for renderer unit tests. */
|
|
29
|
-
export declare function renderTransformResult(result: AgentToolResult<unknown>, args: Static<typeof TransformParams>, theme: Theme, context: RenderContextLike): import("@earendil-works/pi-tui").Container | import("@earendil-works/pi-tui").Text;
|
|
30
|
-
export declare function registerStructureTool(pi: ExtensionAPI, ctx: PluginContext): void;
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=structure.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../../src/tools/structure.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAKL,KAAK,iBAAiB,EAIvB,MAAM,qBAAqB,CAAC;AAE7B,QAAA,MAAM,eAAe;;;;;;;;;;;;;;EAkCnB,CAAC;AAEH,wCAAwC;AACxC,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,CAAC,OAAO,eAAe,CAAC,EACpC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,GACX,MAAM,EAAE,CAiBV;AAED,wCAAwC;AACxC,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,CAAC,OAAO,eAAe,CAAC,EACpC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,iBAAiB,yCAW3B;AAED,wCAAwC;AACxC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,EAChC,IAAI,EAAE,MAAM,CAAC,OAAO,eAAe,CAAC,EACpC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,iBAAiB,sFAO3B;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CA6ChF"}
|