@floydous/pi-agent-kernel 0.2.0 → 0.3.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/CHANGELOG.md +10 -23
- package/README.md +127 -82
- package/docs/testing.md +10 -9
- package/package.json +9 -5
- package/src/config/kernel_config.ts +15 -0
- package/src/dedup/content_store.ts +365 -365
- package/src/dedup/recall_tool.ts +3 -5
- package/src/index.ts +975 -918
- package/src/retrieval/ast_search.ts +1035 -930
- package/src/retrieval/repomap.ts +353 -37
- package/src/retrieval/search_bm25.ts +195 -190
- package/src/retrieval/search_chunker.ts +261 -254
- package/src/retrieval/search_index.ts +21 -10
- package/src/retrieval/symbol_reader.ts +198 -203
- package/src/retrieval/tree_sitter_engine.ts +1 -1
- package/src/safety/epistemic_guard.ts +8 -1
- package/src/tools/ast_search_formatter.ts +161 -0
- package/src/tools/ast_search_tool.ts +22 -18
- package/src/tools/code_search_output.ts +237 -0
- package/src/tools/code_search_tool.ts +52 -18
- package/src/tools/context.ts +20 -20
- package/src/tools/edit_tool.ts +6 -7
- package/src/tools/lsp_tool.ts +207 -241
- package/src/tools/read_tool.ts +38 -19
- package/src/tools/repo_map_tool.ts +1 -2
- package/src/ui/tui_utils.ts +278 -278
- package/static/with-agent-kernel.png +0 -0
- package/static/without-agent-kernel-1.png +0 -0
- package/static/without-agent-kernel-2.png +0 -0
- package/static/without-agent-kernel-3.png +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,32 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.
|
|
4
|
-
|
|
5
|
-
This release replaces the old line-based symbol extraction path with a Tree-sitter WASM parser where a bundled grammar is available, while keeping the scanner fallback for unsupported or unavailable languages.
|
|
3
|
+
## [0.3.1] - 2026-09-09
|
|
6
4
|
|
|
7
5
|
### Added
|
|
8
6
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
7
|
+
- **Adaptive Codebase Profiles**: Introduced `/profile` command with `auto`, `light`, and `heavy` profiles dynamically adjusting repository map token budgets, indexing thresholds, and test file separation based on workspace scale.
|
|
8
|
+
- **Bare-Symbol LSP Definition Lookup**: Support looking up symbol definitions directly by symbol name across the workspace without requiring explicit file paths or line/column coordinates.
|
|
9
|
+
- **Fuzzy Symbol Suggestions**: When a requested symbol is not found during targeted reading, suggest close matching symbols within the file to guide navigation.
|
|
10
|
+
- **LSP Provenance Metadata & Directory Guard**: Explicitly surface result provenance (active language server vs. Tree-sitter fallback) on LSP responses, and guard against passing directory paths to diagnostics.
|
|
11
|
+
- **Adaptive Code Search Formatting & Scopes**: Added token-efficient result layouts and scope filtering (`code` vs `all`) for code search.
|
|
12
|
+
- **Navigation Session Benchmarks**: Added automated benchmarks evaluating token efficiency and call counts across navigation and discovery tools.
|
|
14
13
|
|
|
15
14
|
### Changed
|
|
16
15
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
- Repository-map startup waits for Tree-sitter initialization, including the `/repomap` command path.
|
|
20
|
-
- LSP executable lookup checks both the extension-local directory and the legacy user directory.
|
|
21
|
-
- Hover output removes transient `(loading...)` markers returned by language servers.
|
|
22
|
-
- `typebox` is now packaged as a runtime dependency.
|
|
23
|
-
|
|
24
|
-
### Fixed
|
|
25
|
-
|
|
26
|
-
- Native Tree-sitter parse trees are released after extraction.
|
|
27
|
-
- Local variables no longer appear as top-level repository-map symbols.
|
|
28
|
-
- Braces in strings and comments no longer truncate symbol content.
|
|
29
|
-
- Syntax errors are reported on extracted file tags.
|
|
30
|
-
- LSP reference filtering preserves the intended fallback behavior.
|
|
16
|
+
- **Compact Tool Schemas**: Minified tool descriptions and schemas across tools to reduce system prompt overhead and save context tokens.
|
|
17
|
+
- **Optimized Repository Map Ranking**: Enhanced PageRank scoring heuristics and budget management to prioritize core implementation symbols over tests and boilerplate.
|
|
31
18
|
|
|
32
|
-
[0.
|
|
19
|
+
[0.3.1]: https://github.com/floydous/pi-agent-kernel/compare/v0.3.0...v0.3.1
|
package/README.md
CHANGED
|
@@ -1,125 +1,170 @@
|
|
|
1
|
-
#
|
|
1
|
+
# pi-agent-kernel
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Most coding agents drown in context. They read entire files when looking for a single function, dump thousands of lines of terminal logs into prompts, and rewrite full files just to tweak one line. `pi-agent-kernel` is built around a straightforward rule: **spend the bare minimum tokens necessary to get maximum workflow performance**. It provides surgical retrieval, bounded outputs, and guarded editing tools so your model stays fast, focused, and well within budget.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
---
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Token savings
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Here is how tool overhead compares to an unconstrained agent harness across everyday coding tasks:
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
| Interaction | Traditional agent harness | `pi-agent-kernel` | Tokens saved | Why |
|
|
14
|
+
|---|---|---|---|---|
|
|
15
|
+
| **Project orientation** | Walks directory tree, reads dozens of files (~92.8k tokens) | PageRank AST repository map (~1.0k tokens) | **~99% fewer tokens** | Only index-relevant code symbols and signatures are loaded. |
|
|
16
|
+
| **Inspecting a function** | Reads the full file (~1.5k–4.0k tokens) | Surgical symbol read: `read(symbol="foo")` (~420 tokens) | **~70–90% fewer tokens** | Pulls just the target AST node; skips line-number prefixes. |
|
|
17
|
+
| **Patching code** | Re-emits entire file content (~2.0k+ tokens) | Surgical search/replace block (`edit`) (~60 tokens) | **~95% fewer tokens** | Only generates the exact lines that change. |
|
|
18
|
+
| **Running tests / builds** | Floods context with raw build logs (~20k+ tokens) | Clamped output with disk spillover (~1.0k tokens) | **~95% context saved** | Full logs are written to disk; agent sees head, tail, and log path. |
|
|
19
|
+
| **AST symbol search** | Repeated absolute paths per match (~1.8k tokens) | Hierarchical grouped layout (~1.2k tokens) | **~34% fewer tokens** | Groups matching symbols under shared files and kinds. |
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
---
|
|
16
22
|
|
|
17
|
-
|
|
23
|
+
## Cross-harness benchmark & reproducibility
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
`pi-agent-kernel` is continuously evaluated using an 8-task ground-truth benchmark suite derived from real-world bug fixes merged in popular open-source repositories (`hono`, `ky`, `zod`, `ufo`, `picomatch`, `fastify`, `uuid`, `p-limit`).
|
|
20
26
|
|
|
21
|
-
|
|
27
|
+
All 5 harnesses were evaluated under identical prompts and base commits on **`cx/gpt-5.6-luna:high`** via **`OmniRoute`**:
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
| Harness | Solved | Success Rate | Total Wall Clock | Cumulative Turn Tokens | Total Tool Calls |
|
|
30
|
+
|---|:---:|:---:|---:|---:|:---:|
|
|
31
|
+
| **Pi + Agent-Kernel** | **8 / 8** | **100%** | **787s (13.1m)** | **1,280,980** | **134** |
|
|
32
|
+
| **Pi (Vanilla)** | **8 / 8** | **100%** | 594s (9.9m) | 953,034 | 103 |
|
|
33
|
+
| **Codex CLI** | **8 / 8** | **100%** | 639s (10.7m) | 1,382,922 | 55 |
|
|
34
|
+
| **OMP** | **8 / 8** | **100%** | 791s (13.2m) | 2,071,885 | 214 |
|
|
35
|
+
| **Claude Code** | 7 / 8 | 88% | 1,128s (18.8m) | 1,911,546 | 109 |
|
|
24
36
|
|
|
25
|
-
|
|
37
|
+

|
|
26
38
|
|
|
27
|
-
|
|
39
|
+
### Running the benchmark locally
|
|
28
40
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
| **Code Inspection** (Targeted function read) | Whole file read (~1.4k tokens) | AST Symbol Extraction (`read(symbol=...)`) (~428 tokens) | **-68.5%** prompt tokens | <1 ms |
|
|
33
|
-
| **Code Mutation** (Surgical function patch) | Full file rewrite (~1.4k tokens in tool payload) | Surgical search/replace (`edit`) (~58 tokens) | **-95.7%** output tokens | <5 ms |
|
|
34
|
-
| **Command Execution** (Large test/build output) | Unbounded stream (~27.5k tokens) | Bounded Clamp + Disk Spillover (~1.1k tokens) | **-95.9%** flood tokens prevented | Instant |
|
|
35
|
-
| **Codebase Search** (Lexical / BM25 Query) | Linear `grep`/`find` disk scan | Inverted In-Memory BM25 Index | **0 MB** background RAM (Lean) | ~0.03 ms / query |
|
|
36
|
-
| **Pre-Commit Safety** (Broken syntax gate) | Allowed to commit broken code | Local Fast AST Delimiter Gate | **Deterministic** failure block | Instant |
|
|
41
|
+
```bash
|
|
42
|
+
# 1. Copy and customize configuration
|
|
43
|
+
cp agent-kernel-benchmark/.env.example agent-kernel-benchmark/.env
|
|
37
44
|
|
|
38
|
-
|
|
45
|
+
# 2. Run the full benchmark suite
|
|
46
|
+
npm run bench
|
|
39
47
|
|
|
40
|
-
|
|
48
|
+
# Or run a specific task / harness
|
|
49
|
+
npx tsx agent-kernel-benchmark/run.ts task-3
|
|
50
|
+
npx tsx agent-kernel-benchmark/run.ts --harnesses pi-kernel,pi-vanilla
|
|
41
51
|
|
|
42
|
-
|
|
52
|
+
# 3. Clean transient workspaces
|
|
53
|
+
npm run bench:clean
|
|
43
54
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
├── src/
|
|
47
|
-
│ ├── index.ts # Main extension entry point
|
|
48
|
-
│ ├── config/ # Hierarchical TOML configuration loader
|
|
49
|
-
│ ├── context/ # Context engineering and session repair
|
|
50
|
-
│ ├── editing/ # Surgical patching and verification
|
|
51
|
-
│ ├── lsp/ # Language Server Protocol integration
|
|
52
|
-
│ ├── retrieval/ # AST, BM25, and semantic code search
|
|
53
|
-
│ ├── safety/ # Epistemic guards and bounded execution
|
|
54
|
-
│ ├── tools/ # Pi tool registrations
|
|
55
|
-
│ └── ui/ # Terminal UI components
|
|
56
|
-
├── tests/ # Focused verification sections
|
|
57
|
-
├── docs/ # Project documentation and guides
|
|
58
|
-
├── config.toml # Live configuration
|
|
59
|
-
└── package.json # Extension manifest
|
|
55
|
+
# 4. Generate the comparison chart from benchmark results
|
|
56
|
+
npm run bench:chart
|
|
60
57
|
```
|
|
61
58
|
|
|
62
|
-
|
|
59
|
+
See [`agent-kernel-benchmark/README.md`](agent-kernel-benchmark/README.md) for full configuration details, CLI flags, and task descriptions, and [`agent-kernel-benchmark/BENCHMARK_RESULTS.md`](agent-kernel-benchmark/BENCHMARK_RESULTS.md) for task-by-task forensic analysis.
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|---|---|---|
|
|
66
|
-
| `read` | Content and surgical AST symbol inspection | Bounded, zero bloat, line-targeted |
|
|
67
|
-
| `edit` | Exact and fuzzy surgical patching with a syntax gate | Empty on clean (`OK!`), diagnostic on `WARN/FAIL` |
|
|
68
|
-
| `write` | Complete new-file authoring | Direct write |
|
|
69
|
-
| `get_repo_map` | PageRank-ranked repository AST definitions | Pure code symbols without import noise (~1k tokens) |
|
|
70
|
-
| `ast_search` | AST structure search across definitions | Concise `file:line [kind] signature` |
|
|
71
|
-
| `code_search` | Hybrid BM25 and semantic AST chunk search | Compact `file:start-end (breadcrumb)` snippets |
|
|
72
|
-
| `lsp` | Realtime Language Server Protocol queries | Compact `def`, `ref`, and structural symbols |
|
|
73
|
-
| `recall` | Restore an exact deduplicated tool result by reference | Bare original output content |
|
|
74
|
-
| `search_tools` | Deferred tool discovery | On-demand tool capability matching |
|
|
61
|
+
---
|
|
75
62
|
|
|
76
|
-
##
|
|
63
|
+
## Quick start
|
|
77
64
|
|
|
78
|
-
|
|
79
|
-
- **Output Clamping**: Limits stdout and stderr so they do not fill the context window, while saving complete output to disk.
|
|
80
|
-
- **Tool Result Deduplication**: Replaces byte-identical repeated output with a small `[=rN,sizeB,tool,paramsKey]` notice that can be recovered with `recall`.
|
|
81
|
-
- **Bounded Syntax Verification**: Runs a fast local check on mutations before committing changes to disk.
|
|
65
|
+
### 1. Install
|
|
82
66
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
Install the extension as a Pi package, either globally or in a project:
|
|
67
|
+
Install the extension directly with Pi's package manager:
|
|
86
68
|
|
|
87
69
|
```bash
|
|
70
|
+
# Global install (recommended)
|
|
88
71
|
pi install npm:@floydous/pi-agent-kernel
|
|
72
|
+
|
|
73
|
+
# Or install locally for the current repository only
|
|
74
|
+
pi install -l npm:@floydous/pi-agent-kernel
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Restart Pi or start a new session. The extension registers its tools, guards, and status indicators automatically.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### 2. Configure the retrieval engine (`/engine`)
|
|
82
|
+
|
|
83
|
+
`pi-agent-kernel` includes an in-memory retrieval engine for keyword and semantic searches:
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
/engine status
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
- **`lean`** *(default)*: Fast, AST-aware BM25 search. Consumes 0 MB background model RAM.
|
|
90
|
+
- **`hybrid`**: BM25 keyword search blended with lightweight local 256-dimension embeddings.
|
|
91
|
+
- **`full`**: Dense 768-dimension semantic embeddings for deep conceptual queries across large codebases.
|
|
92
|
+
- **`off`**: Turns off local index building if you only want AST and LSP tools.
|
|
93
|
+
|
|
94
|
+
Switch profiles at any time:
|
|
95
|
+
```text
|
|
96
|
+
/engine hybrid
|
|
97
|
+
# or
|
|
98
|
+
/engine full
|
|
89
99
|
```
|
|
90
100
|
|
|
91
|
-
|
|
101
|
+
---
|
|
92
102
|
|
|
103
|
+
### 3. Configure codebase scale profile (`/profile`)
|
|
104
|
+
|
|
105
|
+
Agent-kernel automatically scales its prompt context to the size of the repository. On light repositories (<10 implementation files, <50 KB code), the 1,024-token PageRank map is suppressed to minimize token usage. On larger projects, the map is injected automatically.
|
|
106
|
+
|
|
107
|
+
You can view or override this setting at any time:
|
|
108
|
+
```text
|
|
109
|
+
/profile status # Check current profile and detected codebase metrics
|
|
110
|
+
/profile light # Force light profile (suppress automatic repo-map injection)
|
|
111
|
+
/profile heavy # Force heavy profile (always inject PageRank repo map)
|
|
112
|
+
/profile auto # Auto-detect based on implementation code volume (default)
|
|
113
|
+
```
|
|
114
|
+
Or configure via environment variable:
|
|
93
115
|
```bash
|
|
94
|
-
|
|
116
|
+
export PI_CODEBASE_PROFILE=light # or "heavy", "auto", "smart"
|
|
95
117
|
```
|
|
96
118
|
|
|
97
|
-
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### 4. Setup language servers (`/lsp`)
|
|
122
|
+
|
|
123
|
+
Get real-time compiler diagnostics, definitions, and references without manual setup:
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
/lsp
|
|
127
|
+
```
|
|
98
128
|
|
|
99
|
-
|
|
129
|
+
Running `/lsp` opens an interactive management screen showing active servers, connection status, and one-click installs for detected workspace languages.
|
|
100
130
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
131
|
+
Alternatively, install a server directly from the command line:
|
|
132
|
+
```text
|
|
133
|
+
/lsp install <language> # e.g., python, typescript, rust, go, csharp, etc.
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### 5. Tip: Turn off Pi documentation when working on your own projects
|
|
139
|
+
|
|
140
|
+
By default, Pi loads system prompt instructions explaining how to extend Pi itself (extensions, themes, skills, and TUI APIs).
|
|
141
|
+
|
|
142
|
+
When you are working on your own software—such as a React app, a Python backend, or a Rust crate—those internal Pi instructions take up room in your prompt that you do not need. You can silence them for the current session with:
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
/pi-docs off
|
|
146
|
+
```
|
|
107
147
|
|
|
108
|
-
|
|
148
|
+
Turn it back on with `/pi-docs on` whenever you switch back to hacking on Pi extensions.
|
|
109
149
|
|
|
110
|
-
|
|
150
|
+
---
|
|
111
151
|
|
|
112
|
-
|
|
152
|
+
## Tool reference
|
|
113
153
|
|
|
114
|
-
|
|
154
|
+
| Tool | What it does |
|
|
155
|
+
|---|---|
|
|
156
|
+
| `read` | Read specific lines or extract an exact function, class, or type via AST (`symbol="name"`). |
|
|
157
|
+
| `edit` | Apply surgical search/replace patches with built-in syntax checks. |
|
|
158
|
+
| `write` | Create new files or perform complete rewrites when explicitly requested. |
|
|
159
|
+
| `get_repo_map` | Retrieve a concise, PageRank-ranked symbol overview of the codebase (~1k tokens). |
|
|
160
|
+
| `ast_search` | Search declarations across files using Tree-sitter AST queries, grouped cleanly by file. |
|
|
161
|
+
| `code_search` | Hybrid keyword and semantic chunk search with breadcrumb locations. |
|
|
162
|
+
| `lsp` | Query definitions, references, type hover docs, and diagnostics directly from language servers. |
|
|
163
|
+
| `recall` | Retrieve the full text of a deduplicated output previously replaced by a short reference tag. |
|
|
164
|
+
| `search_tools` | Search and activate deferred tools on demand. |
|
|
115
165
|
|
|
116
|
-
|
|
117
|
-
- [`docs/retrieval.md`](docs/retrieval.md): search profile semantics
|
|
118
|
-
- [`docs/editing-and-verification.md`](docs/editing-and-verification.md): patch and verification pipeline
|
|
119
|
-
- [`docs/lsp.md`](docs/lsp.md): LSP integration and registry
|
|
120
|
-
- [`docs/configuration.md`](docs/configuration.md): TOML schema and precedence
|
|
121
|
-
- [`docs/testing.md`](docs/testing.md): section-based test layout
|
|
166
|
+
---
|
|
122
167
|
|
|
123
168
|
## License
|
|
124
169
|
|
|
125
|
-
ISC
|
|
170
|
+
ISC
|
package/docs/testing.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Testing
|
|
2
2
|
|
|
3
|
-
The suite is split into focused
|
|
3
|
+
The suite is split into focused suite directories under `tests/`. Each suite is
|
|
4
4
|
independently runnable and uses isolated temporary workspaces where needed.
|
|
5
5
|
|
|
6
6
|
## Commands
|
|
@@ -9,24 +9,25 @@ independently runnable and uses isolated temporary workspaces where needed.
|
|
|
9
9
|
# Full suite
|
|
10
10
|
npm test
|
|
11
11
|
|
|
12
|
-
# Direct section orchestrator
|
|
13
|
-
npm run test:focused
|
|
14
|
-
|
|
15
12
|
# One focused section
|
|
16
|
-
npx tsx tests/
|
|
13
|
+
npx tsx tests/epistemic-guard/index.ts
|
|
17
14
|
```
|
|
18
15
|
|
|
19
|
-
`npm test` runs the
|
|
16
|
+
`npm test` runs the suite orchestrator under `tests/`.
|
|
20
17
|
|
|
21
18
|
## Verification policy
|
|
22
19
|
|
|
23
20
|
Prefer the narrowest useful check first:
|
|
24
21
|
|
|
25
|
-
1. Run the focused
|
|
22
|
+
1. Run the focused suite related to a change.
|
|
26
23
|
2. Run bounded TypeScript/LSP diagnostics for changed implementation files.
|
|
27
24
|
3. Run the full suite once the focused checks are understood.
|
|
28
25
|
4. Review `git diff --check` and the final working-tree status.
|
|
29
26
|
|
|
30
27
|
The suite covers AST extraction, repository maps, patching, syntax checks,
|
|
31
|
-
session repair, retrieval, output clamping, LSP support,
|
|
32
|
-
|
|
28
|
+
session repair, retrieval, output clamping, LSP support, configuration,
|
|
29
|
+
lifecycle integration, and post-edit verification.
|
|
30
|
+
|
|
31
|
+
The `cold-process-ast` suite launches a fresh process per language and checks
|
|
32
|
+
required symbols, kinds, and local-scope exclusions. This catches warm singleton
|
|
33
|
+
state masking fallback defects.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floydous/pi-agent-kernel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Focused code retrieval, editing, safety checks, and language-server support for Pi.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
"author": "floydous https://github.com/floydous",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "npx tsx tests/run-all.ts",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
12
|
+
"typecheck": "tsc --noEmit",
|
|
13
|
+
"bench": "npx tsx agent-kernel-benchmark/run.ts",
|
|
14
|
+
"bench:clean": "npx tsx agent-kernel-benchmark/run.ts --clean",
|
|
15
|
+
"bench:chart": "PATH=\"$HOME/.local/bin:$HOME/.venv/bin:$PATH\" python3 agent-kernel-benchmark/generate_chart.py"
|
|
14
16
|
},
|
|
15
17
|
"dependencies": {
|
|
16
18
|
"@huggingface/transformers": "^4.2.0",
|
|
@@ -40,10 +42,12 @@
|
|
|
40
42
|
"src",
|
|
41
43
|
"grammars",
|
|
42
44
|
"README.md",
|
|
43
|
-
"static",
|
|
44
45
|
"docs",
|
|
45
46
|
"LICENSE",
|
|
46
47
|
"config.toml",
|
|
47
48
|
"CHANGELOG.md"
|
|
48
|
-
]
|
|
49
|
+
],
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
}
|
|
49
53
|
}
|
|
@@ -5,9 +5,14 @@ import { parseToml, stringifyToml, type TomlValue } from "./toml";
|
|
|
5
5
|
import { kernelDebug } from "../safety/kernel_debug";
|
|
6
6
|
import { writeFileSyncAtomic } from "../safety/atomic_write";
|
|
7
7
|
|
|
8
|
+
export type CodebaseProfile = "auto" | "light" | "heavy";
|
|
9
|
+
|
|
8
10
|
export interface RetrievalConfig {
|
|
9
11
|
default_profile: "lean" | "hybrid" | "full";
|
|
12
|
+
codebase_profile: CodebaseProfile;
|
|
10
13
|
repo_map_budget: number;
|
|
14
|
+
repo_map_min_files: number;
|
|
15
|
+
repo_map_min_bytes: number;
|
|
11
16
|
max_search_results: number;
|
|
12
17
|
}
|
|
13
18
|
|
|
@@ -52,7 +57,10 @@ export interface KernelConfig {
|
|
|
52
57
|
const DEFAULT_CONFIG: KernelConfig = {
|
|
53
58
|
retrieval: {
|
|
54
59
|
default_profile: "lean",
|
|
60
|
+
codebase_profile: "auto",
|
|
55
61
|
repo_map_budget: 1024,
|
|
62
|
+
repo_map_min_files: 10,
|
|
63
|
+
repo_map_min_bytes: 50 * 1024,
|
|
56
64
|
max_search_results: 5,
|
|
57
65
|
},
|
|
58
66
|
safety: {
|
|
@@ -175,6 +183,13 @@ export function loadKernelConfig(cwd = process.cwd()): KernelConfig {
|
|
|
175
183
|
}
|
|
176
184
|
}
|
|
177
185
|
|
|
186
|
+
if (process.env.PI_CODEBASE_PROFILE) {
|
|
187
|
+
const cp = process.env.PI_CODEBASE_PROFILE.toLowerCase();
|
|
188
|
+
if (cp === "auto" || cp === "smart" || cp === "light" || cp === "heavy") {
|
|
189
|
+
config.retrieval.codebase_profile = (cp === "smart" ? "auto" : cp) as CodebaseProfile;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
178
193
|
return config;
|
|
179
194
|
}
|
|
180
195
|
|