@cortexkit/aft-pi 0.57.2 → 0.58.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,7 +22,7 @@ pi install npm:@cortexkit/aft-pi@0.13.1
22
22
 
23
23
  ### Hoisted built-in overrides
24
24
 
25
- Pi's default `read`, `write`, `edit`, and `grep` are replaced with AFT-backed versions by default. Set `hoist_builtin_tools: false` to keep Pi's native tools and use `aft_read`, `aft_write`, `aft_edit`, `aft_grep`, and `aft_bash` for AFT instead; AFT background-bash companions remain `bash_status`, `bash_watch`, `bash_write`, and `bash_kill`.
25
+ Pi's default `read`, `write`, `edit`, `grep`, and `bash` are replaced with AFT-backed versions. List a name in `disabled_tools` (for example `["grep"]`) to keep Pi's native tool for that slot. The AFT background-bash companions `bash_status`, `bash_watch`, `bash_write`, and `bash_kill` register independently of `bash`.
26
26
 
27
27
  | Tool | Pi built-in | AFT replacement |
28
28
  | ------- | ------------------------ | -------------------------------------------------------------------------------------------- |
@@ -65,13 +65,6 @@ All keys are optional. Example:
65
65
 
66
66
  ```jsonc
67
67
  {
68
- // "minimal" | "recommended" (default) | "all"
69
- "tool_surface": "recommended",
70
-
71
- // Default true replaces Pi's native file and bash tools.
72
- // Set false to retain Pi's tools and use aft_read/aft_write/aft_edit/aft_bash for AFT.
73
- "hoist_builtin_tools": false,
74
-
75
68
  // Auto-format on write/edit using project formatter config.
76
69
  "format_on_edit": true,
77
70
 
@@ -82,14 +75,12 @@ All keys are optional. Example:
82
75
  // Defaults to false to match Pi's built-in behavior.
83
76
  "restrict_to_project_root": false,
84
77
 
85
- // Enable the trigram-indexed grep/glob (hoists them when true).
86
- "experimental_search_index": true,
87
-
88
- // Enable semantic search (aft_search). Requires ONNX runtime for local
89
- // embeddings; downloaded automatically on supported platforms.
90
- "experimental_semantic_search": true,
78
+ // Background indexes, all on by default. The local semantic backend may
79
+ // download an ONNX runtime and model and use CPU.
80
+ "indexes": { "trigram": true, "semantic": true, "callgraph": true },
91
81
 
92
- // Disable specific tool names (applied after tool_surface selection).
82
+ // Tools that are not registered. Absent => ["aft_move", "aft_delete"];
83
+ // an explicit list replaces that default ([] enables every tool).
93
84
  "disabled_tools": ["aft_move"],
94
85
 
95
86
  // Pi / OMP harness options:
@@ -112,7 +103,7 @@ All keys are optional. Example:
112
103
  // Missing formatter/checker/LSP warnings after configure: "toast" (default), "log", or "chat".
113
104
  "configure_warnings_delivery": "toast",
114
105
 
115
- // Semantic backend (when experimental_semantic_search=true).
106
+ // Semantic backend for the semantic index.
116
107
  // "fastembed" (default, local ONNX) | "openai_compatible" | "ollama"
117
108
  "semantic": {
118
109
  "backend": "fastembed",
@@ -125,13 +116,15 @@ All keys are optional. Example:
125
116
 
126
117
  Sensitive semantic backend fields (`backend`, `base_url`, `api_key_env`) are only read from **user-level** config. Project configs that try to set them are ignored with a warning to prevent credential-exfiltration via malicious repos.
127
118
 
128
- ### Tool surface tiers
119
+ ### Registered tools
129
120
 
130
- | Tier | Tools |
131
- | ----------------- | ----------------------------------------------------------------------------------------------------------------------- |
132
- | `minimal` | `aft_outline`, `aft_zoom`, `aft_safety` |
133
- | `recommended` (default) | `minimal` + `read`/`write`/`edit` (or `aft_` alternatives when hoisting is disabled) + `aft_import` + `ast_grep_*` + `lsp_diagnostics` + `aft_conflicts` + (optional) `grep`/`aft_grep` + (optional) `aft_search` |
134
- | `all` | `recommended` + `aft_callgraph` + `aft_delete` + `aft_move` |
121
+ Every AFT tool registers unless listed in `disabled_tools`: `read`, `write`, `edit`, `grep`,
122
+ `bash` and its companions, `aft_outline`, `aft_zoom`, `aft_search`, `aft_callgraph`,
123
+ `aft_inspect`, `aft_import`, `aft_safety`, `aft_conflicts`, `ast_grep_search`,
124
+ `ast_grep_replace`, `aft_delete` and `aft_move` (the last two are in the default disabled
125
+ list). Pi has no AFT `apply_patch` or `glob` tool. Index state and runtime settings never
126
+ remove a registration. `tool_surface`, `hoist_builtin_tools` and the `search_index` /
127
+ `semantic_search` keys are translated during v0.58 and rejected from v0.59.
135
128
 
136
129
  ## Architecture
137
130
 
@@ -1,11 +1,26 @@
1
- import type { AftTransportPool } from "@cortexkit/aft-bridge";
1
+ import { type AftTransportPool } from "@cortexkit/aft-bridge";
2
2
  import type { AftConfig } from "./config.js";
3
3
  type ActiveBridgePool = Pick<AftTransportPool, "getActiveBridgeForRoot">;
4
- export declare const BASH_WAIT_DETACH_MAGIC_KEYWORD = "&detach";
4
+ export { BASH_WAIT_DETACH_MAGIC_KEYWORD } from "@cortexkit/aft-bridge";
5
5
  /** Strip the `&detach` control token before Pi's input transform delivers the user message to the model. */
6
6
  export declare function stripUserMessageDetachKeyword(messageText: string): string;
7
- /** Decide whether a user message should signal an active wait:true bash call. */
7
+ /**
8
+ * Decide whether a message should detach an active wait:true bash call and
9
+ * abort a sync bash_watch. `messageText` is read before the keyword is
10
+ * stripped from it.
11
+ */
8
12
  export declare function shouldDetachBashWaitOnUserMessage(config: AftConfig, messageText: string): boolean;
13
+ /** The fields of Pi's `input` event this module reads. */
14
+ export interface PiInputEvent {
15
+ text: string;
16
+ }
17
+ /**
18
+ * Handle Pi's `input` event for the session's blocking waits: decide before
19
+ * the `&detach` token is stripped, then (only when the decision says so) abort
20
+ * any sync bash_watch and detach any wait:true bash. Both waits follow the same
21
+ * decision, so `bash.detach_on_user_message: false` protects a sync bash_watch
22
+ * as well. Returns the text to deliver to the model.
23
+ */
24
+ export declare function interruptBashWaitsForInput(pool: ActiveBridgePool, config: AftConfig, projectRoot: string, sessionID: string | undefined, event: PiInputEvent): string;
9
25
  export declare function signalBashWaitDetachForProject(pool: ActiveBridgePool, projectRoot: string, sessionID: string | undefined): Promise<void>;
10
- export {};
11
26
  //# sourceMappingURL=bash-wait-detach.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bash-wait-detach.d.ts","sourceRoot":"","sources":["../src/bash-wait-detach.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuB,gBAAgB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ACnB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,EAAE,YAAY,GAClB,MAAM,CAMR;AAaD,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,OAAO,CAAC,IAAI,CAAC,CAWf"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The Pi side of the config error state (see `config-error.ts` in
3
+ * `@cortexkit/aft-bridge`). An unusable configuration used to make the
4
+ * extension register nothing, or throw from its factory, which Pi records
5
+ * only in its own log. Instead the extension registers AFT's tool surface and
6
+ * every call fails with the error and its fix; no binary is resolved and no
7
+ * bridge is started.
8
+ */
9
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
10
+ import { type AftConfig, type ConfigLoadError } from "./config.js";
11
+ /** Status-bar key the config error is shown under. */
12
+ export declare const CONFIG_ERROR_STATUS_KEY = "aft";
13
+ export type PiBootstrapConfig = {
14
+ ok: true;
15
+ config: AftConfig;
16
+ /** The config files this load read; a live config reload starts from them. */
17
+ sources?: readonly string[];
18
+ /** The text of each file this load read, keyed by path. */
19
+ sourceTexts?: Readonly<Record<string, string>>;
20
+ } | {
21
+ ok: false;
22
+ /** The error, its fix, and the note that a restart is needed. */
23
+ message: string;
24
+ /** Config whose tool surface is registered: the loaded one when usable, else the default. */
25
+ config: AftConfig;
26
+ };
27
+ /** Side effects of the config load, replaceable in tests. */
28
+ export interface PiBootstrapDependencies {
29
+ loadConfig(directory: string): AftConfig;
30
+ configLoadErrors(): readonly ConfigLoadError[];
31
+ /** The config files the most recent `loadConfig` call read. */
32
+ configLoadSources?(): readonly string[];
33
+ /** The text of each file the most recent `loadConfig` call read. */
34
+ configLoadTexts?(): ReadonlyMap<string, string>;
35
+ /** Moves legacy config files into the CortexKit layout; returns user-facing warnings. */
36
+ migrateConfigLocations(directory: string): string[];
37
+ subcConnectionFileError(subcConnectionFile: string | undefined): Promise<string | null>;
38
+ }
39
+ /**
40
+ * Load the config for `directory`, migrating legacy config file locations in
41
+ * between two loads (migration may move the file the first read came from).
42
+ * A rejected configuration, a file that does not parse, any other load
43
+ * failure, or a configured subc connection file that does not exist yields
44
+ * the config error state. Migration is skipped when the first load fails.
45
+ */
46
+ export declare function resolvePiBootstrapConfig(directory: string, notify: (message: string) => void, dependencies?: PiBootstrapDependencies): Promise<PiBootstrapConfig>;
47
+ /**
48
+ * Register the config error state: the tool surface `config` selects with
49
+ * every call failing, and the error on one line in Pi's status bar. Commands
50
+ * and lifecycle hooks are not registered; there is no bridge for them.
51
+ */
52
+ export declare function registerPiConfigErrorState(pi: ExtensionAPI, config: AftConfig, message: string): void;
53
+ //# sourceMappingURL=config-error-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-error-state.d.ts","sourceRoot":"","sources":["../src/config-error-state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EACL,KAAK,SAAS,EACd,KAAK,eAAe,EAMrB,MAAM,aAAa,CAAC;AAKrB,sDAAsD;AACtD,eAAO,MAAM,uBAAuB,QAAQ,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GACzB;IACE,EAAE,EAAE,IAAI,CAAC;IACT,MAAM,EAAE,SAAS,CAAC;IAClB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,2DAA2D;IAC3D,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAChD,GACD;IACE,EAAE,EAAE,KAAK,CAAC;IACV,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,6FAA6F;IAC7F,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AAEN,6DAA6D;AAC7D,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,gBAAgB,IAAI,SAAS,eAAe,EAAE,CAAC;IAC/C,+DAA+D;IAC/D,iBAAiB,CAAC,IAAI,SAAS,MAAM,EAAE,CAAC;IACxC,oEAAoE;IACpE,eAAe,CAAC,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChD,yFAAyF;IACzF,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACpD,uBAAuB,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACzF;AAiCD;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC5C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EACjC,YAAY,GAAE,uBAA6C,GAC1D,OAAO,CAAC,iBAAiB,CAAC,CAqB5B;AAwBD;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,YAAY,EAChB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,MAAM,GACd,IAAI,CAsBN"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Live reload of the plugin's own copy of the AFT config (`ctx.config`) when
3
+ * `~/.config/cortexkit/aft.jsonc` or `<project>/.cortexkit/aft.jsonc` changes.
4
+ * Used by the Pi extension. The engine applies its own keys from the same
5
+ * files separately.
6
+ */
7
+ import { type LiveConfigLoad, type LiveConfigReload } from "@cortexkit/aft-bridge";
8
+ import { type AftConfig } from "./config.js";
9
+ /** The live keys, read through this host's bash resolution. */
10
+ export declare const PI_LIVE_CONFIG_KEYS: import("@cortexkit/aft-bridge").LiveConfigKey<AftConfig>[];
11
+ export declare function loadPiConfigForLiveReload(directory: string): LiveConfigLoad<AftConfig>;
12
+ export interface PiLiveConfigReloadOptions {
13
+ /** The directory whose project config applies. */
14
+ directory: string;
15
+ /** The config files the startup load read (the bootstrap result's `sources`). */
16
+ initialSources: readonly string[];
17
+ /** Their texts (the bootstrap result's `sourceTexts`). */
18
+ initialSourceTexts?: Readonly<Record<string, string>>;
19
+ getConfig(): AftConfig;
20
+ setConfig(config: AftConfig): void;
21
+ /** Show a config error to the user. */
22
+ notify(message: string): void;
23
+ /** Tests drive `reload()` directly instead of watching. */
24
+ watch?: boolean;
25
+ }
26
+ /** Keep `ctx.config` current for the live keys while the host runs. */
27
+ export declare function startPiLiveConfigReload(options: PiLiveConfigReloadOptions): LiveConfigReload;
28
+ //# sourceMappingURL=config-live-reload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-live-reload.d.ts","sourceRoot":"","sources":["../src/config-live-reload.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAGtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,KAAK,SAAS,EAOf,MAAM,aAAa,CAAC;AAGrB,+DAA+D;AAC/D,eAAO,MAAM,mBAAmB,4DAG/B,CAAC;AAaF,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC,CAwBtF;AAED,MAAM,WAAW,yBAAyB;IACxC,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,0DAA0D;IAC1D,kBAAkB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,SAAS,IAAI,SAAS,CAAC;IACvB,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACnC,uCAAuC;IACvC,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,uEAAuE;AACvE,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,CAmB5F"}