@cortexkit/aft-pi 0.18.1 → 0.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bg-notifications.d.ts +16 -1
- package/dist/bg-notifications.d.ts.map +1 -1
- package/dist/bridge.d.ts +25 -0
- package/dist/bridge.d.ts.map +1 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +182 -36
- package/dist/logger.d.ts.map +1 -1
- package/dist/notifications.d.ts.map +1 -1
- package/dist/pool.d.ts.map +1 -1
- package/dist/tools/bash.d.ts +1 -0
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/hoisted.d.ts +16 -0
- package/dist/tools/hoisted.d.ts.map +1 -1
- package/package.json +7 -6
|
@@ -7,6 +7,10 @@ export interface BgCompletion {
|
|
|
7
7
|
duration_ms?: number;
|
|
8
8
|
runtime_ms?: number;
|
|
9
9
|
runtime?: number;
|
|
10
|
+
/** Tail of stdout+stderr captured at completion (≤300 bytes from Rust). */
|
|
11
|
+
output_preview?: string;
|
|
12
|
+
/** True when the captured tail is shorter than the actual output. */
|
|
13
|
+
output_truncated?: boolean;
|
|
10
14
|
}
|
|
11
15
|
type SessionBgState = {
|
|
12
16
|
outstandingTaskIds: Set<string>;
|
|
@@ -16,6 +20,11 @@ type SessionBgState = {
|
|
|
16
20
|
firstCompletionAt: number | null;
|
|
17
21
|
scheduledFireAt: number | null;
|
|
18
22
|
scheduledCompletionCount: number;
|
|
23
|
+
retryDelayMs: number | null;
|
|
24
|
+
unknownCompletions: Array<{
|
|
25
|
+
completion: BgCompletion;
|
|
26
|
+
receivedAt: number;
|
|
27
|
+
}>;
|
|
19
28
|
lastSeenAt: number;
|
|
20
29
|
};
|
|
21
30
|
type TextContent = {
|
|
@@ -30,7 +39,9 @@ type ImageContent = {
|
|
|
30
39
|
};
|
|
31
40
|
type ContentBlock = TextContent | ImageContent;
|
|
32
41
|
type SendUserMessageRuntime = {
|
|
33
|
-
sendUserMessage: (content: string
|
|
42
|
+
sendUserMessage: (content: string, options?: {
|
|
43
|
+
deliverAs?: "steer" | "followUp";
|
|
44
|
+
}) => void;
|
|
34
45
|
};
|
|
35
46
|
export declare const sessionBgStates: Map<string, SessionBgState>;
|
|
36
47
|
export declare const SESSION_BG_STATE_IDLE_TTL_MS: number;
|
|
@@ -38,9 +49,13 @@ interface DrainContext {
|
|
|
38
49
|
ctx: PluginContext;
|
|
39
50
|
directory: string;
|
|
40
51
|
sessionID?: string;
|
|
52
|
+
isActive?: () => boolean;
|
|
41
53
|
}
|
|
42
54
|
export declare function trackBgTask(sessionID: string | undefined, taskId: string): void;
|
|
43
55
|
export declare function ingestBgCompletions(sessionID: string | undefined, completions: unknown): BgCompletion[];
|
|
56
|
+
export declare function handlePushedBgCompletion(drainContext: DrainContext & {
|
|
57
|
+
runtime: SendUserMessageRuntime;
|
|
58
|
+
}, completion: unknown): Promise<void>;
|
|
44
59
|
export declare function appendToolResultBgCompletions(drainContext: DrainContext, content: ContentBlock[]): Promise<ContentBlock[] | undefined>;
|
|
45
60
|
export declare function handleTurnEndBgCompletions(drainContext: DrainContext & {
|
|
46
61
|
runtime: SendUserMessageRuntime;
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"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AAI,CAE/D;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CASjF;AAED,wBAAgB,kCAAkC,IAAI,IAAI,CAKzD;AAiGD,wBAAgB,wBAAwB,CAAC,GAAG,GAAE,MAAmB,GAAG,IAAI,CAQvE"}
|
package/dist/bridge.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BgCompletion } from "./bg-notifications.js";
|
|
1
2
|
/**
|
|
2
3
|
* Compare two semver version strings (major.minor.patch plus pre-release).
|
|
3
4
|
* Returns: negative if a < b, 0 if equal, positive if a > b.
|
|
@@ -20,6 +21,12 @@ export interface BridgeOptions {
|
|
|
20
21
|
onVersionMismatch?: (binaryVersion: string, minVersion: string) => void;
|
|
21
22
|
/** Called after the first successful configure returns user-visible warnings. */
|
|
22
23
|
onConfigureWarnings?: (context: ConfigureWarningsContext) => void | Promise<void>;
|
|
24
|
+
/** Called for server-pushed background bash completions. */
|
|
25
|
+
onBashCompletion?: (completion: BashCompletedPayload, bridge: BinaryBridge) => void | Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export interface BashCompletedPayload extends BgCompletion {
|
|
28
|
+
type: "bash_completed";
|
|
29
|
+
session_id: string;
|
|
23
30
|
}
|
|
24
31
|
export interface BridgeRequestOptions {
|
|
25
32
|
onProgress?: (chunk: {
|
|
@@ -28,6 +35,22 @@ export interface BridgeRequestOptions {
|
|
|
28
35
|
}) => void;
|
|
29
36
|
/** Per-call transport timeout in milliseconds. Defaults to the bridge-wide timeout. */
|
|
30
37
|
transportTimeoutMs?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Skip the "kill the child process on timeout" behavior for this request.
|
|
40
|
+
*
|
|
41
|
+
* The default (false) treats a transport-level timeout as evidence the bridge
|
|
42
|
+
* is wedged — Rust normally responds well within the budget, so silence past
|
|
43
|
+
* the deadline almost always means a stuck child. Killing forces a clean
|
|
44
|
+
* respawn on the next call.
|
|
45
|
+
*
|
|
46
|
+
* Some commands enforce their own timeouts on the Rust side (notably `bash`,
|
|
47
|
+
* which uses a watchdog thread to terminate the child shell and return a
|
|
48
|
+
* timeout response). For those, a transport timeout means the response was
|
|
49
|
+
* lost or queued behind something else — the bridge itself is still healthy
|
|
50
|
+
* and should keep its warm state. Pass `keepBridgeOnTimeout: true` to
|
|
51
|
+
* reject the request without tearing down the bridge.
|
|
52
|
+
*/
|
|
53
|
+
keepBridgeOnTimeout?: boolean;
|
|
31
54
|
}
|
|
32
55
|
interface SendOptions extends BridgeRequestOptions {
|
|
33
56
|
timeoutMs?: number;
|
|
@@ -60,12 +83,14 @@ export declare class BinaryBridge {
|
|
|
60
83
|
private minVersion;
|
|
61
84
|
private onVersionMismatch;
|
|
62
85
|
private onConfigureWarnings;
|
|
86
|
+
private onBashCompletion;
|
|
63
87
|
private restartResetTimer;
|
|
64
88
|
constructor(binaryPath: string, cwd: string, options?: BridgeOptions, configOverrides?: Record<string, unknown>);
|
|
65
89
|
/** Number of times the binary has been restarted after a crash. */
|
|
66
90
|
get restartCount(): number;
|
|
67
91
|
/** Whether the child process is currently alive. */
|
|
68
92
|
isAlive(): boolean;
|
|
93
|
+
hasPendingRequests(): boolean;
|
|
69
94
|
/**
|
|
70
95
|
* Send a command to the binary and return the parsed response.
|
|
71
96
|
* Lazy-spawns the binary on first call.
|
package/dist/bridge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAiB1D;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAkC1D;AA6CD,UAAU,wBAAwB;IAChC,WAAW,EA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Q,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B/B,gGAAgG;YAClF,YAAY;IAoB1B,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,YAAY;IA6GpB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,YAAY;IA+DpB,OAAO,CAAC,aAAa;IA+BrB,OAAO,CAAC,WAAW;IAoDnB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,yBAAyB;IAQjC,OAAO,CAAC,sBAAsB;CAM/B"}
|
package/dist/config.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export interface ConfigureExperimentalOverrides {
|
|
|
50
50
|
export type ToolSurface = "minimal" | "recommended" | "all";
|
|
51
51
|
export interface AftConfig {
|
|
52
52
|
format_on_edit?: boolean;
|
|
53
|
+
/** Maximum formatter subprocess wallclock seconds. Bounded 1..=600. Default 10. */
|
|
54
|
+
formatter_timeout_secs?: number;
|
|
53
55
|
validate_on_edit?: "syntax" | "full";
|
|
54
56
|
formatter?: Record<string, Formatter>;
|
|
55
57
|
checker?: Record<string, Checker>;
|
|
@@ -81,6 +83,7 @@ export declare const LspServerSchema: z.ZodObject<{
|
|
|
81
83
|
}, z.core.$strip>;
|
|
82
84
|
export declare const AftConfigSchema: z.ZodObject<{
|
|
83
85
|
format_on_edit: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
+
formatter_timeout_secs: z.ZodOptional<z.ZodNumber>;
|
|
84
87
|
validate_on_edit: z.ZodOptional<z.ZodEnum<{
|
|
85
88
|
syntax: "syntax";
|
|
86
89
|
full: "full";
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,UAAU,GACV,MAAM,GACN,MAAM,GAC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EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AA0LlE;;;;GAIG;AACH,yBAA+B,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAuT9D"}
|
package/dist/index.js
CHANGED
|
@@ -7893,7 +7893,8 @@ import * as fs from "node:fs";
|
|
|
7893
7893
|
import * as os from "node:os";
|
|
7894
7894
|
import * as path from "node:path";
|
|
7895
7895
|
var TAG = "[aft-pi]";
|
|
7896
|
-
var
|
|
7896
|
+
var isTestEnv = process.env.BUN_TEST === "1" || false;
|
|
7897
|
+
var logFile = path.join(os.tmpdir(), isTestEnv ? "aft-pi-test.log" : "aft-pi.log");
|
|
7897
7898
|
var useStderr = process.env.AFT_LOG_STDERR === "1";
|
|
7898
7899
|
var buffer = [];
|
|
7899
7900
|
var flushTimer = null;
|
|
@@ -7951,6 +7952,9 @@ function warn(message, data) {
|
|
|
7951
7952
|
function error(message, data) {
|
|
7952
7953
|
write("ERROR", message, data);
|
|
7953
7954
|
}
|
|
7955
|
+
function sessionLog(sessionId, message, data) {
|
|
7956
|
+
write("INFO", message, data, sessionId);
|
|
7957
|
+
}
|
|
7954
7958
|
function sessionWarn(sessionId, message, data) {
|
|
7955
7959
|
write("WARN", message, data, sessionId);
|
|
7956
7960
|
}
|
|
@@ -7963,10 +7967,24 @@ var sessionBgStates = new Map;
|
|
|
7963
7967
|
var SESSION_BG_STATE_IDLE_TTL_MS = 60 * 60 * 1000;
|
|
7964
7968
|
var DEBOUNCE_STEP_MS = 200;
|
|
7965
7969
|
var DEBOUNCE_CAP_MS = 1000;
|
|
7970
|
+
var UNKNOWN_COMPLETION_TTL_MS = 5000;
|
|
7971
|
+
var UNKNOWN_COMPLETION_CAP = 32;
|
|
7966
7972
|
var DEFAULT_SESSION_ID = "__default__";
|
|
7967
7973
|
var LOG_PREFIX = "[aft-pi] bg-notifications:";
|
|
7968
7974
|
function trackBgTask(sessionID, taskId) {
|
|
7969
|
-
stateFor(sessionID)
|
|
7975
|
+
const state = stateFor(sessionID);
|
|
7976
|
+
pruneUnknownCompletions(state, Date.now());
|
|
7977
|
+
const buffered = state.unknownCompletions.filter((entry) => entry.completion.task_id === taskId);
|
|
7978
|
+
state.unknownCompletions = state.unknownCompletions.filter((entry) => entry.completion.task_id !== taskId);
|
|
7979
|
+
if (buffered.length > 0) {
|
|
7980
|
+
for (const entry of buffered) {
|
|
7981
|
+
if (!state.pendingCompletions.some((pending) => pending.task_id === taskId)) {
|
|
7982
|
+
state.pendingCompletions.push(entry.completion);
|
|
7983
|
+
}
|
|
7984
|
+
}
|
|
7985
|
+
return;
|
|
7986
|
+
}
|
|
7987
|
+
state.outstandingTaskIds.add(taskId);
|
|
7970
7988
|
}
|
|
7971
7989
|
function ingestBgCompletions(sessionID, completions) {
|
|
7972
7990
|
if (!Array.isArray(completions) || completions.length === 0)
|
|
@@ -7976,8 +7994,10 @@ function ingestBgCompletions(sessionID, completions) {
|
|
|
7976
7994
|
for (const completion of completions) {
|
|
7977
7995
|
if (!isBgCompletion(completion))
|
|
7978
7996
|
continue;
|
|
7979
|
-
if (!state.outstandingTaskIds.has(completion.task_id))
|
|
7997
|
+
if (!state.outstandingTaskIds.has(completion.task_id)) {
|
|
7998
|
+
bufferUnknownCompletion(state, completion);
|
|
7980
7999
|
continue;
|
|
8000
|
+
}
|
|
7981
8001
|
state.outstandingTaskIds.delete(completion.task_id);
|
|
7982
8002
|
if (!state.pendingCompletions.some((pending) => pending.task_id === completion.task_id) && !accepted.some((pending) => pending.task_id === completion.task_id)) {
|
|
7983
8003
|
accepted.push(completion);
|
|
@@ -7986,6 +8006,10 @@ function ingestBgCompletions(sessionID, completions) {
|
|
|
7986
8006
|
state.pendingCompletions.push(...accepted);
|
|
7987
8007
|
return accepted;
|
|
7988
8008
|
}
|
|
8009
|
+
async function handlePushedBgCompletion(drainContext, completion) {
|
|
8010
|
+
ingestBgCompletions(drainContext.sessionID, [completion]);
|
|
8011
|
+
await triggerWakeIfPending(drainContext, true);
|
|
8012
|
+
}
|
|
7989
8013
|
async function appendToolResultBgCompletions(drainContext, content) {
|
|
7990
8014
|
const state = stateFor(drainContext.sessionID);
|
|
7991
8015
|
if (state.outstandingTaskIds.size === 0 && state.pendingCompletions.length === 0)
|
|
@@ -8000,50 +8024,56 @@ async function appendToolResultBgCompletions(drainContext, content) {
|
|
|
8000
8024
|
return [...content, { type: "text", text: reminder }];
|
|
8001
8025
|
}
|
|
8002
8026
|
async function handleTurnEndBgCompletions(drainContext) {
|
|
8027
|
+
await triggerWakeIfPending(drainContext, false);
|
|
8028
|
+
}
|
|
8029
|
+
async function triggerWakeIfPending(drainContext, skipDrain) {
|
|
8003
8030
|
const state = stateFor(drainContext.sessionID);
|
|
8004
8031
|
if (state.wakeFiredThisIdle)
|
|
8005
8032
|
return;
|
|
8006
|
-
if (
|
|
8033
|
+
if (drainContext.isActive?.())
|
|
8034
|
+
return;
|
|
8035
|
+
if (!skipDrain && state.outstandingTaskIds.size > 0) {
|
|
8007
8036
|
await drainCompletions(drainContext);
|
|
8008
8037
|
}
|
|
8009
8038
|
if (state.pendingCompletions.length === 0)
|
|
8010
8039
|
return;
|
|
8011
8040
|
scheduleWake(state, async (reminder) => {
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
}
|
|
8015
|
-
warn(`${LOG_PREFIX} wake send failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
8016
|
-
}
|
|
8041
|
+
drainContext.runtime.sendUserMessage(reminder, { deliverAs: "followUp" });
|
|
8042
|
+
}, (err) => {
|
|
8043
|
+
sessionWarn(drainContext.sessionID ?? "", `${LOG_PREFIX} wake send failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
8017
8044
|
});
|
|
8018
8045
|
}
|
|
8019
8046
|
function resetBgWake(sessionID) {
|
|
8020
8047
|
stateFor(sessionID).wakeFiredThisIdle = false;
|
|
8021
8048
|
}
|
|
8022
8049
|
function formatSystemReminder(completions) {
|
|
8023
|
-
const bullets = completions.map((completion) =>
|
|
8050
|
+
const bullets = completions.map((completion) => formatCompletion(completion)).join(`
|
|
8024
8051
|
`);
|
|
8052
|
+
const anyTruncated = completions.some((c) => c.output_truncated === true);
|
|
8053
|
+
const tail = anyTruncated ? `
|
|
8054
|
+
|
|
8055
|
+
For truncated tasks, use bash_status({ task_id: "..." }) to retrieve full output.` : "";
|
|
8025
8056
|
return `<system-reminder>
|
|
8026
8057
|
[BACKGROUND BASH COMPLETED]
|
|
8027
|
-
${bullets}
|
|
8028
|
-
|
|
8029
|
-
Use bash_status({ task_id: "..." }) to retrieve full output.
|
|
8058
|
+
${bullets}${tail}
|
|
8030
8059
|
</system-reminder>`;
|
|
8031
8060
|
}
|
|
8032
8061
|
async function drainCompletions({ ctx, directory, sessionID }) {
|
|
8033
8062
|
try {
|
|
8034
8063
|
const bridge = ctx.pool.getAnyActiveBridge(directory) ?? ctx.pool.getBridge(directory);
|
|
8035
|
-
|
|
8036
|
-
|
|
8064
|
+
if (!sessionID)
|
|
8065
|
+
return;
|
|
8066
|
+
const response = await bridge.send("bash_drain_completions", { session_id: sessionID });
|
|
8037
8067
|
if (response.success === false) {
|
|
8038
|
-
|
|
8068
|
+
sessionWarn(sessionID ?? "", `${LOG_PREFIX} drain failed: ${String(response.message ?? "unknown error")}`);
|
|
8039
8069
|
return;
|
|
8040
8070
|
}
|
|
8041
8071
|
ingestBgCompletions(sessionID, response.bg_completions);
|
|
8042
8072
|
} catch (err) {
|
|
8043
|
-
|
|
8073
|
+
sessionWarn(sessionID ?? "", `${LOG_PREFIX} drain failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
8044
8074
|
}
|
|
8045
8075
|
}
|
|
8046
|
-
function scheduleWake(state, sendWake) {
|
|
8076
|
+
function scheduleWake(state, sendWake, onSendFailure) {
|
|
8047
8077
|
const now = Date.now();
|
|
8048
8078
|
if (state.debounceTimer && state.pendingCompletions.length <= state.scheduledCompletionCount) {
|
|
8049
8079
|
return;
|
|
@@ -8058,16 +8088,24 @@ function scheduleWake(state, sendWake) {
|
|
|
8058
8088
|
state.scheduledCompletionCount = state.pendingCompletions.length;
|
|
8059
8089
|
if (state.debounceTimer)
|
|
8060
8090
|
clearTimeout(state.debounceTimer);
|
|
8061
|
-
const delay = Math.max(0, (state.scheduledFireAt ?? now) - now);
|
|
8091
|
+
const delay = state.retryDelayMs ?? Math.max(0, (state.scheduledFireAt ?? now) - now);
|
|
8062
8092
|
state.debounceTimer = setTimeout(() => {
|
|
8063
|
-
const
|
|
8093
|
+
const pending = state.pendingCompletions;
|
|
8094
|
+
const reminder = formatSystemReminder(pending);
|
|
8064
8095
|
state.pendingCompletions = [];
|
|
8065
8096
|
state.debounceTimer = null;
|
|
8066
|
-
state.wakeFiredThisIdle = true;
|
|
8067
8097
|
state.firstCompletionAt = null;
|
|
8068
8098
|
state.scheduledFireAt = null;
|
|
8069
8099
|
state.scheduledCompletionCount = 0;
|
|
8070
|
-
sendWake(reminder)
|
|
8100
|
+
sendWake(reminder).then(() => {
|
|
8101
|
+
state.retryDelayMs = null;
|
|
8102
|
+
state.wakeFiredThisIdle = true;
|
|
8103
|
+
}).catch((err) => {
|
|
8104
|
+
state.pendingCompletions = [...pending, ...state.pendingCompletions];
|
|
8105
|
+
state.retryDelayMs = Math.min((delay || DEBOUNCE_STEP_MS) * 2, DEBOUNCE_CAP_MS);
|
|
8106
|
+
onSendFailure(err);
|
|
8107
|
+
scheduleWake(state, sendWake, onSendFailure);
|
|
8108
|
+
});
|
|
8071
8109
|
}, delay);
|
|
8072
8110
|
state.debounceTimer.unref?.();
|
|
8073
8111
|
}
|
|
@@ -8085,6 +8123,8 @@ function stateFor(sessionID) {
|
|
|
8085
8123
|
firstCompletionAt: null,
|
|
8086
8124
|
scheduledFireAt: null,
|
|
8087
8125
|
scheduledCompletionCount: 0,
|
|
8126
|
+
retryDelayMs: null,
|
|
8127
|
+
unknownCompletions: [],
|
|
8088
8128
|
lastSeenAt: now
|
|
8089
8129
|
};
|
|
8090
8130
|
sessionBgStates.set(key, state);
|
|
@@ -8105,6 +8145,18 @@ function cleanupIdleSessionStates(now = Date.now()) {
|
|
|
8105
8145
|
sessionBgStates.delete(sessionID);
|
|
8106
8146
|
}
|
|
8107
8147
|
}
|
|
8148
|
+
function bufferUnknownCompletion(state, completion) {
|
|
8149
|
+
const now = Date.now();
|
|
8150
|
+
pruneUnknownCompletions(state, now);
|
|
8151
|
+
state.unknownCompletions = state.unknownCompletions.filter((entry) => entry.completion.task_id !== completion.task_id);
|
|
8152
|
+
state.unknownCompletions.push({ completion, receivedAt: now });
|
|
8153
|
+
if (state.unknownCompletions.length > UNKNOWN_COMPLETION_CAP) {
|
|
8154
|
+
state.unknownCompletions.splice(0, state.unknownCompletions.length - UNKNOWN_COMPLETION_CAP);
|
|
8155
|
+
}
|
|
8156
|
+
}
|
|
8157
|
+
function pruneUnknownCompletions(state, now) {
|
|
8158
|
+
state.unknownCompletions = state.unknownCompletions.filter((entry) => now - entry.receivedAt <= UNKNOWN_COMPLETION_TTL_MS);
|
|
8159
|
+
}
|
|
8108
8160
|
function isBgCompletion(value) {
|
|
8109
8161
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
8110
8162
|
return false;
|
|
@@ -8114,10 +8166,26 @@ function isBgCompletion(value) {
|
|
|
8114
8166
|
function formatCompletion(completion) {
|
|
8115
8167
|
const status = formatStatus(completion);
|
|
8116
8168
|
const duration = formatDuration(completion);
|
|
8117
|
-
|
|
8169
|
+
const header = `- task ${completion.task_id} (${status}${duration ? `, ${duration}` : ""})`;
|
|
8170
|
+
const previewBlock = formatOutputPreview(completion);
|
|
8171
|
+
return previewBlock ? `${header}
|
|
8172
|
+
${previewBlock}` : header;
|
|
8173
|
+
}
|
|
8174
|
+
function formatOutputPreview(completion) {
|
|
8175
|
+
const ansiRegex = /\x1b\[[0-9;]*[a-zA-Z]/g;
|
|
8176
|
+
const raw = (completion.output_preview ?? "").replace(ansiRegex, "");
|
|
8177
|
+
if (!raw.trim())
|
|
8178
|
+
return "";
|
|
8179
|
+
const trimmed = raw.replace(/\n+$/, "");
|
|
8180
|
+
const ellipsis = completion.output_truncated ? "…" : "";
|
|
8181
|
+
const indented = trimmed.split(`
|
|
8182
|
+
`).map((line) => ` ${line}`).join(`
|
|
8183
|
+
`);
|
|
8184
|
+
return ellipsis ? ` ${ellipsis}
|
|
8185
|
+
${indented}` : indented;
|
|
8118
8186
|
}
|
|
8119
8187
|
function formatStatus(completion) {
|
|
8120
|
-
if (completion.status === "timeout")
|
|
8188
|
+
if (completion.status === "timed_out" || completion.status === "timeout")
|
|
8121
8189
|
return "timed out";
|
|
8122
8190
|
if (completion.status === "killed")
|
|
8123
8191
|
return "killed";
|
|
@@ -21949,6 +22017,7 @@ var ExperimentalConfigSchema = exports_external.object({
|
|
|
21949
22017
|
});
|
|
21950
22018
|
var AftConfigSchema = exports_external.object({
|
|
21951
22019
|
format_on_edit: exports_external.boolean().optional(),
|
|
22020
|
+
formatter_timeout_secs: exports_external.number().int().min(1).max(600).optional(),
|
|
21952
22021
|
validate_on_edit: exports_external.enum(["syntax", "full"]).optional(),
|
|
21953
22022
|
formatter: exports_external.record(exports_external.string(), FormatterEnum).optional(),
|
|
21954
22023
|
checker: exports_external.record(exports_external.string(), CheckerEnum).optional(),
|
|
@@ -23738,7 +23807,7 @@ import { join as join6 } from "node:path";
|
|
|
23738
23807
|
var WARNING_MARKER = "\uD83D\uDD27 AFT: ⚠️";
|
|
23739
23808
|
var FEATURE_MARKER = "\uD83D\uDD27 AFT: ✨";
|
|
23740
23809
|
var WARNED_TOOLS_FILE = "warned_tools.json";
|
|
23741
|
-
function sendIgnoredMessage(client,
|
|
23810
|
+
function sendIgnoredMessage(client, sessionId, text) {
|
|
23742
23811
|
const typedClient = client;
|
|
23743
23812
|
if (typeof typedClient.ui?.notify !== "function")
|
|
23744
23813
|
return false;
|
|
@@ -23746,7 +23815,7 @@ function sendIgnoredMessage(client, _sessionId, text) {
|
|
|
23746
23815
|
typedClient.ui.notify(text, "warning");
|
|
23747
23816
|
return true;
|
|
23748
23817
|
} catch (err) {
|
|
23749
|
-
|
|
23818
|
+
sessionLog(sessionId, `[aft-pi] notification send failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
23750
23819
|
return false;
|
|
23751
23820
|
}
|
|
23752
23821
|
}
|
|
@@ -24387,6 +24456,7 @@ class BinaryBridge {
|
|
|
24387
24456
|
minVersion;
|
|
24388
24457
|
onVersionMismatch;
|
|
24389
24458
|
onConfigureWarnings;
|
|
24459
|
+
onBashCompletion;
|
|
24390
24460
|
restartResetTimer = null;
|
|
24391
24461
|
constructor(binaryPath, cwd, options, configOverrides) {
|
|
24392
24462
|
this.binaryPath = binaryPath;
|
|
@@ -24397,6 +24467,7 @@ class BinaryBridge {
|
|
|
24397
24467
|
this.minVersion = options?.minVersion;
|
|
24398
24468
|
this.onVersionMismatch = options?.onVersionMismatch;
|
|
24399
24469
|
this.onConfigureWarnings = options?.onConfigureWarnings;
|
|
24470
|
+
this.onBashCompletion = options?.onBashCompletion;
|
|
24400
24471
|
}
|
|
24401
24472
|
get restartCount() {
|
|
24402
24473
|
return this._restartCount;
|
|
@@ -24404,6 +24475,9 @@ class BinaryBridge {
|
|
|
24404
24475
|
isAlive() {
|
|
24405
24476
|
return this.process !== null && this.process.exitCode === null && !this.process.killed;
|
|
24406
24477
|
}
|
|
24478
|
+
hasPendingRequests() {
|
|
24479
|
+
return this.pending.size > 0;
|
|
24480
|
+
}
|
|
24407
24481
|
async send(command, params = {}, options) {
|
|
24408
24482
|
if (this._shuttingDown) {
|
|
24409
24483
|
throw new Error(`[aft-pi] Bridge is shutting down, cannot send "${command}"`);
|
|
@@ -24457,17 +24531,21 @@ class BinaryBridge {
|
|
|
24457
24531
|
`;
|
|
24458
24532
|
const effectiveTimeoutMs = options?.transportTimeoutMs ?? options?.timeoutMs ?? this.timeoutMs;
|
|
24459
24533
|
const requestSessionId = typeof params.session_id === "string" && params.session_id.length > 0 ? params.session_id : undefined;
|
|
24534
|
+
const keepBridgeOnTimeout = options?.keepBridgeOnTimeout === true;
|
|
24460
24535
|
return new Promise((resolve3, reject) => {
|
|
24461
24536
|
const timer = setTimeout(() => {
|
|
24462
24537
|
this.pending.delete(id);
|
|
24463
|
-
const
|
|
24538
|
+
const restartSuffix = keepBridgeOnTimeout ? "" : " — restarting bridge";
|
|
24539
|
+
const timeoutMsg = `Request "${command}" (id=${id}) timed out after ${effectiveTimeoutMs}ms${restartSuffix}`;
|
|
24464
24540
|
if (requestSessionId) {
|
|
24465
24541
|
sessionWarn(requestSessionId, timeoutMsg);
|
|
24466
24542
|
} else {
|
|
24467
24543
|
warn(timeoutMsg);
|
|
24468
24544
|
}
|
|
24469
24545
|
reject(new Error(`[aft-pi] Request "${command}" (id=${id}) timed out after ${effectiveTimeoutMs}ms`));
|
|
24470
|
-
|
|
24546
|
+
if (!keepBridgeOnTimeout) {
|
|
24547
|
+
this.handleTimeout();
|
|
24548
|
+
}
|
|
24471
24549
|
}, effectiveTimeoutMs);
|
|
24472
24550
|
this.pending.set(id, { resolve: resolve3, reject, timer, onProgress: options?.onProgress });
|
|
24473
24551
|
if (!this.process?.stdin?.writable) {
|
|
@@ -24672,6 +24750,10 @@ class BinaryBridge {
|
|
|
24672
24750
|
}
|
|
24673
24751
|
continue;
|
|
24674
24752
|
}
|
|
24753
|
+
if (response.type === "bash_completed") {
|
|
24754
|
+
this.onBashCompletion?.(response, this);
|
|
24755
|
+
continue;
|
|
24756
|
+
}
|
|
24675
24757
|
const id = response.id;
|
|
24676
24758
|
if (id && this.pending.has(id)) {
|
|
24677
24759
|
const entry = this.pending.get(id);
|
|
@@ -24681,6 +24763,8 @@ class BinaryBridge {
|
|
|
24681
24763
|
clearTimeout(entry.timer);
|
|
24682
24764
|
this.scheduleRestartCountReset();
|
|
24683
24765
|
entry.resolve(response);
|
|
24766
|
+
} else if (typeof response.type === "string") {
|
|
24767
|
+
log(`Ignoring unknown stdout push frame type: ${response.type}`);
|
|
24684
24768
|
}
|
|
24685
24769
|
} catch (_err) {
|
|
24686
24770
|
warn(`Failed to parse stdout line: ${line}`);
|
|
@@ -24778,7 +24862,8 @@ class BridgePool {
|
|
|
24778
24862
|
maxRestarts: options.maxRestarts,
|
|
24779
24863
|
minVersion: options.minVersion,
|
|
24780
24864
|
onVersionMismatch: options.onVersionMismatch,
|
|
24781
|
-
onConfigureWarnings: options.onConfigureWarnings
|
|
24865
|
+
onConfigureWarnings: options.onConfigureWarnings,
|
|
24866
|
+
onBashCompletion: options.onBashCompletion
|
|
24782
24867
|
};
|
|
24783
24868
|
this.configOverrides = configOverrides;
|
|
24784
24869
|
if (Number.isFinite(this.idleTimeoutMs)) {
|
|
@@ -25674,6 +25759,7 @@ function registerBashTool(pi, ctx) {
|
|
|
25674
25759
|
compressed: params.compressed
|
|
25675
25760
|
}, extCtx, {
|
|
25676
25761
|
transportTimeoutMs: bashTransportTimeoutMs(params.timeout),
|
|
25762
|
+
keepBridgeOnTimeout: true,
|
|
25677
25763
|
onProgress: ({ text }) => {
|
|
25678
25764
|
streamed += text;
|
|
25679
25765
|
const displayText = truncateToVisualLines(streamed, 100);
|
|
@@ -25748,7 +25834,7 @@ function createBashKillTool(ctx) {
|
|
|
25748
25834
|
throw new Error(data.message ?? "bash_kill failed");
|
|
25749
25835
|
}
|
|
25750
25836
|
const details = data;
|
|
25751
|
-
return bashKillResult(`Task ${params.task_id}:
|
|
25837
|
+
return bashKillResult(`Task ${params.task_id}: ${details.status}`, details);
|
|
25752
25838
|
}
|
|
25753
25839
|
};
|
|
25754
25840
|
}
|
|
@@ -25779,10 +25865,11 @@ function bashKillResult(output, details) {
|
|
|
25779
25865
|
}
|
|
25780
25866
|
function formatBashStatus(taskId, details) {
|
|
25781
25867
|
const exit = typeof details.exit_code === "number" ? ` (exit ${details.exit_code})` : "";
|
|
25782
|
-
|
|
25868
|
+
const dur = typeof details.duration_ms === "number" ? ` ${Math.round(details.duration_ms / 1000)}s` : "";
|
|
25869
|
+
let text = `Task ${taskId}: ${details.status}${exit}${dur}`;
|
|
25783
25870
|
if (isTerminalStatus(details.status) && details.output_preview) {
|
|
25784
25871
|
text += `
|
|
25785
|
-
${details.output_preview.slice(0,
|
|
25872
|
+
${details.output_preview.slice(0, 2000)}`;
|
|
25786
25873
|
}
|
|
25787
25874
|
return text;
|
|
25788
25875
|
}
|
|
@@ -25810,6 +25897,17 @@ ${theme.fg("error", errorText || "bash failed")}`);
|
|
|
25810
25897
|
const container = reuseContainer2(context.lastComponent);
|
|
25811
25898
|
container.clear();
|
|
25812
25899
|
container.addChild(new Spacer2(1));
|
|
25900
|
+
const rawOutput = result.content.filter((c) => c.type === "text").map((c) => c.text ?? "").join(`
|
|
25901
|
+
`).trim();
|
|
25902
|
+
if (rawOutput) {
|
|
25903
|
+
const lines = rawOutput.split(`
|
|
25904
|
+
`);
|
|
25905
|
+
const preview = lines.length > 25 ? `... (${lines.length - 25} lines omitted)
|
|
25906
|
+
${lines.slice(-25).join(`
|
|
25907
|
+
`)}` : rawOutput;
|
|
25908
|
+
container.addChild(new Text2(preview, 1, 0));
|
|
25909
|
+
container.addChild(new Spacer2(1));
|
|
25910
|
+
}
|
|
25813
25911
|
if (exitCode !== undefined) {
|
|
25814
25912
|
const exitColor = exitCode === 0 ? "success" : "error";
|
|
25815
25913
|
const exitText = theme.fg(exitColor, `exit ${exitCode}`);
|
|
@@ -26248,12 +26346,15 @@ function buildMutationResult(filePath, response) {
|
|
|
26248
26346
|
const replacements = response.replacements;
|
|
26249
26347
|
const diagnostics = response.lsp_diagnostics;
|
|
26250
26348
|
const truncated = diffObj?.truncated === true;
|
|
26349
|
+
const formatted = response.formatted;
|
|
26350
|
+
const formatSkippedReason = response.format_skipped_reason;
|
|
26351
|
+
const globFormatSkipReasons = response.format_skip_reasons;
|
|
26251
26352
|
let diffText;
|
|
26252
26353
|
let firstChangedLine;
|
|
26253
26354
|
if (diffObj && !truncated && typeof diffObj.before === "string" && typeof diffObj.after === "string") {
|
|
26254
|
-
const
|
|
26255
|
-
diffText =
|
|
26256
|
-
firstChangedLine =
|
|
26355
|
+
const piDiff = formatDiffForPi(diffObj.before, diffObj.after);
|
|
26356
|
+
diffText = piDiff.diff;
|
|
26357
|
+
firstChangedLine = piDiff.firstChangedLine;
|
|
26257
26358
|
}
|
|
26258
26359
|
const summaryHeader = replacements !== undefined ? `Edited ${filePath} (+${additions}/-${deletions}, ${replacements} replacement${replacements === 1 ? "" : "s"})` : `Wrote ${filePath} (+${additions}/-${deletions})`;
|
|
26259
26360
|
let text = summaryHeader;
|
|
@@ -26266,6 +26367,16 @@ ${diffText}`;
|
|
|
26266
26367
|
|
|
26267
26368
|
(diff truncated — file too large to include before/after content)`;
|
|
26268
26369
|
}
|
|
26370
|
+
const skipNote = formatSkipReasonNote(formatSkippedReason);
|
|
26371
|
+
if (skipNote)
|
|
26372
|
+
text += `
|
|
26373
|
+
|
|
26374
|
+
${skipNote}`;
|
|
26375
|
+
const globSkipNote = formatGlobSkipReasonsNote(globFormatSkipReasons);
|
|
26376
|
+
if (globSkipNote)
|
|
26377
|
+
text += `
|
|
26378
|
+
|
|
26379
|
+
${globSkipNote}`;
|
|
26269
26380
|
if (diagnostics && diagnostics.length > 0) {
|
|
26270
26381
|
text += `
|
|
26271
26382
|
|
|
@@ -26281,10 +26392,34 @@ ${formatDiagnosticsText(diagnostics)}`;
|
|
|
26281
26392
|
deletions,
|
|
26282
26393
|
replacements,
|
|
26283
26394
|
diagnostics,
|
|
26284
|
-
truncated: truncated || undefined
|
|
26395
|
+
truncated: truncated || undefined,
|
|
26396
|
+
formatted,
|
|
26397
|
+
formatSkippedReason
|
|
26285
26398
|
}
|
|
26286
26399
|
};
|
|
26287
26400
|
}
|
|
26401
|
+
function formatGlobSkipReasonsNote(reasons) {
|
|
26402
|
+
if (!Array.isArray(reasons))
|
|
26403
|
+
return;
|
|
26404
|
+
const actionable = reasons.filter((reason) => typeof reason === "string").filter((reason) => ["formatter_not_installed", "formatter_excluded_path", "timeout", "error"].includes(reason));
|
|
26405
|
+
if (actionable.length === 0)
|
|
26406
|
+
return;
|
|
26407
|
+
return `Note: formatter skipped some glob edit result file(s): ${[...new Set(actionable)].sort().join(", ")}. See per-file format_skipped_reason values for details.`;
|
|
26408
|
+
}
|
|
26409
|
+
function formatSkipReasonNote(reason) {
|
|
26410
|
+
switch (reason) {
|
|
26411
|
+
case "formatter_not_installed":
|
|
26412
|
+
return "Note: formatter binary not installed; file written unformatted.";
|
|
26413
|
+
case "timeout":
|
|
26414
|
+
return "Note: formatter timed out; file written unformatted. Raise formatter_timeout_secs or check the formatter for hangs.";
|
|
26415
|
+
case "formatter_excluded_path":
|
|
26416
|
+
return "Note: formatter is configured to ignore this path (e.g. biome.json files.includes, .prettierignore). File written unformatted.";
|
|
26417
|
+
case "error":
|
|
26418
|
+
return "Note: formatter exited with an unrecognized error; file written unformatted.";
|
|
26419
|
+
default:
|
|
26420
|
+
return;
|
|
26421
|
+
}
|
|
26422
|
+
}
|
|
26288
26423
|
function formatDiagnosticsText(diagnostics) {
|
|
26289
26424
|
try {
|
|
26290
26425
|
return diagnostics.map((d) => {
|
|
@@ -27608,6 +27743,8 @@ async function src_default(pi) {
|
|
|
27608
27743
|
const configOverrides = {};
|
|
27609
27744
|
if (config2.format_on_edit !== undefined)
|
|
27610
27745
|
configOverrides.format_on_edit = config2.format_on_edit;
|
|
27746
|
+
if (config2.formatter_timeout_secs !== undefined)
|
|
27747
|
+
configOverrides.formatter_timeout_secs = config2.formatter_timeout_secs;
|
|
27611
27748
|
if (config2.validate_on_edit !== undefined)
|
|
27612
27749
|
configOverrides.validate_on_edit = config2.validate_on_edit;
|
|
27613
27750
|
if (config2.formatter !== undefined)
|
|
@@ -27709,6 +27846,15 @@ ${lines}
|
|
|
27709
27846
|
pluginVersion: PLUGIN_VERSION,
|
|
27710
27847
|
projectRoot
|
|
27711
27848
|
}, validWarnings);
|
|
27849
|
+
},
|
|
27850
|
+
onBashCompletion: (completion, bridge) => {
|
|
27851
|
+
handlePushedBgCompletion({
|
|
27852
|
+
ctx,
|
|
27853
|
+
directory: process.cwd(),
|
|
27854
|
+
sessionID: completion.session_id,
|
|
27855
|
+
runtime: pi,
|
|
27856
|
+
isActive: () => bridge.hasPendingRequests()
|
|
27857
|
+
}, completion);
|
|
27712
27858
|
}
|
|
27713
27859
|
}, configOverrides);
|
|
27714
27860
|
const ctx = { pool, config: config2, storageDir };
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAmEA,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;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAEnF;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAEpF;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAErF;AAED,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../src/notifications.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,yBAAyB,GAAG,uBAAuB,GAAG,oBAAoB,CAAC;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../src/notifications.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,yBAAyB,GAAG,uBAAuB,GAAG,oBAAoB,CAAC;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA8FD,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,uBAAuB,EAC7B,QAAQ,EAAE,gBAAgB,EAAE,GAC3B,OAAO,CAAC,IAAI,CAAC,CAqBf;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAAE,EAClB,UAAU,EAAE,MAAM,GACjB,IAAI,CAqBN"}
|
package/dist/pool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":"AACA,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;
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":"AACA,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,C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AM,CAAC,OAAO,cAAc,CAAC,WAC5B,WAAW,GAAG,SAAS,aACrB,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,UACnE,gBAAgB;EAW7B"}
|
package/dist/tools/hoisted.d.ts
CHANGED
|
@@ -39,6 +39,22 @@ interface FileMutationDetails {
|
|
|
39
39
|
* surface this explicitly rather than silently showing a summary.
|
|
40
40
|
*/
|
|
41
41
|
truncated?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether AFT's auto-formatter ran on the post-write content. Mirrors the
|
|
44
|
+
* `data.formatted` field from the Rust write/edit response. When true,
|
|
45
|
+
* the file content on disk is what the formatter produced; when false,
|
|
46
|
+
* `formatSkippedReason` explains why.
|
|
47
|
+
*/
|
|
48
|
+
formatted?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Reason the formatter was skipped, when `formatted=false`. One of the
|
|
51
|
+
* documented values from `crates/aft/src/format.rs::auto_format`:
|
|
52
|
+
* `"unsupported_language"`, `"no_formatter_configured"`,
|
|
53
|
+
* `"formatter_not_installed"`, `"formatter_excluded_path"`, `"timeout"`,
|
|
54
|
+
* `"error"`. Pi agents read this to decide whether to retry, fix config,
|
|
55
|
+
* or accept the unformatted result.
|
|
56
|
+
*/
|
|
57
|
+
formatSkippedReason?: string;
|
|
42
58
|
}
|
|
43
59
|
export declare function registerHoistedTools(pi: ExtensionAPI, ctx: PluginContext, surface: ToolSurfaceFlags): void;
|
|
44
60
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hoisted.d.ts","sourceRoot":"","sources":["../../src/tools/hoisted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EAGlB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA2DjD,MAAM,WAAW,g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E,MAAM,CAAC;CAC9B;AAED,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,YAAY,EAChB,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAmLN;AAMD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,eAAe,CAAC,mBAAmB,CAAC,CAiFtC;AAwJD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,mBAAmB,EAAE,OAAO,EAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,MAAM,CAgBR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft-pi",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
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",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
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 --external diff && tsc --emitDeclarationOnly",
|
|
19
19
|
"typecheck": "tsc --noEmit",
|
|
20
20
|
"test": "bun test src/__tests__/",
|
|
21
|
+
"lint": "biome check src",
|
|
21
22
|
"prepublishOnly": "bun run build"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
@@ -27,11 +28,11 @@
|
|
|
27
28
|
"zod": "^4.1.8"
|
|
28
29
|
},
|
|
29
30
|
"optionalDependencies": {
|
|
30
|
-
"@cortexkit/aft-darwin-arm64": "0.18.
|
|
31
|
-
"@cortexkit/aft-darwin-x64": "0.18.
|
|
32
|
-
"@cortexkit/aft-linux-arm64": "0.18.
|
|
33
|
-
"@cortexkit/aft-linux-x64": "0.18.
|
|
34
|
-
"@cortexkit/aft-win32-x64": "0.18.
|
|
31
|
+
"@cortexkit/aft-darwin-arm64": "0.18.3",
|
|
32
|
+
"@cortexkit/aft-darwin-x64": "0.18.3",
|
|
33
|
+
"@cortexkit/aft-linux-arm64": "0.18.3",
|
|
34
|
+
"@cortexkit/aft-linux-x64": "0.18.3",
|
|
35
|
+
"@cortexkit/aft-win32-x64": "0.18.3"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@mariozechner/pi-coding-agent": "*",
|