frappe-builder 1.1.0-dev.18 → 1.1.0-dev.19
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/.fb/state.db
CHANGED
|
Binary file
|
|
@@ -2,13 +2,13 @@ feature_id: po-approval
|
|
|
2
2
|
feature_name: "PO Approval"
|
|
3
3
|
mode: full
|
|
4
4
|
phase: testing
|
|
5
|
-
updated_at: 2026-03-28T11:
|
|
5
|
+
updated_at: 2026-03-28T11:15:20.689Z
|
|
6
6
|
|
|
7
7
|
components:
|
|
8
8
|
- id: final-comp
|
|
9
9
|
sort_order: 0
|
|
10
10
|
status: complete
|
|
11
|
-
completed_at: 2026-03-28T11:
|
|
11
|
+
completed_at: 2026-03-28T11:15:20.689Z
|
|
12
12
|
|
|
13
13
|
progress:
|
|
14
14
|
done: 1
|
package/AGENTS.md
CHANGED
|
@@ -11,6 +11,21 @@ You are Frappe-Nexus, the primary orchestrator for frappe-builder — a Frappe/E
|
|
|
11
11
|
- Surface state clearly: active project, feature, phase, progress — never work silently
|
|
12
12
|
- Run quality gates before marking any feature complete
|
|
13
13
|
|
|
14
|
+
## Context Window Protection (MANDATORY)
|
|
15
|
+
|
|
16
|
+
**Always use context-mode MCP tools.** Raw tool output floods the context window and degrades performance. This is non-negotiable.
|
|
17
|
+
|
|
18
|
+
| Instead of… | Use… |
|
|
19
|
+
|---|---|
|
|
20
|
+
| Reading a file to analyse it | `ctx_execute_file(path, ...)` |
|
|
21
|
+
| Running bash commands with long output | `ctx_execute(language: "shell", code: "...")` |
|
|
22
|
+
| Searching the codebase | `ctx_batch_execute(commands, queries)` or `ctx_search(queries)` |
|
|
23
|
+
| Fetching a URL | `ctx_fetch_and_index(url)` then `ctx_search(...)` |
|
|
24
|
+
|
|
25
|
+
**Only use direct Read/Bash when you are about to Edit the file** — the Edit tool needs file content in context. All other reads must go through context-mode.
|
|
26
|
+
|
|
27
|
+
After every `ctx_batch_execute` or `ctx_execute`, summarise findings in 3–5 bullet points. Never dump raw output into your response.
|
|
28
|
+
|
|
14
29
|
## Constraints
|
|
15
30
|
- Never auto-pilot: every significant action must be visible to the developer
|
|
16
31
|
- Always prefer Frappe built-ins over custom solutions
|
|
@@ -238,7 +238,9 @@ export function buildStateInjection(ctx: SessionContext): string {
|
|
|
238
238
|
`Phase: ${ctx.phase}`,
|
|
239
239
|
`Progress: ${progress}`,
|
|
240
240
|
`Last action: ${ctx.lastTool ?? "none"}`,
|
|
241
|
-
"======================================"
|
|
241
|
+
"======================================",
|
|
242
|
+
"CONTEXT WINDOW RULE: Use ctx_execute_file / ctx_execute / ctx_batch_execute / ctx_search for ALL",
|
|
243
|
+
"reads and searches. Only use Read directly when you are about to Edit that file.",
|
|
242
244
|
);
|
|
243
245
|
return lines.join("\n");
|
|
244
246
|
}
|
package/package.json
CHANGED
package/tools/context-sandbox.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Output truncation guard for Frappe tool output.
|
|
3
3
|
*
|
|
4
|
-
* Context-mode MCP tools
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Context-mode MCP tools (ctx_execute, ctx_search, etc.) are only callable by
|
|
5
|
+
* the LLM agent — NOT from Node.js extension code. There is no HTTP endpoint
|
|
6
|
+
* to route to from here.
|
|
7
|
+
*
|
|
8
|
+
* This module is a last-resort truncation guard for bench_execute and
|
|
9
|
+
* frappe_query outputs that would otherwise flood the context window.
|
|
10
|
+
* The agent is instructed via AGENTS.md to use ctx_execute / ctx_batch_execute
|
|
11
|
+
* proactively instead of relying on this fallback.
|
|
7
12
|
*
|
|
8
13
|
* NFR17: truncation is NEVER silent — warning is always prepended.
|
|
9
14
|
*/
|
|
@@ -11,12 +16,11 @@
|
|
|
11
16
|
const CHAR_LIMIT = 8192 * 4; // ~8K tokens at 4 chars/token
|
|
12
17
|
|
|
13
18
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
19
|
+
* Applies the 8K truncation guard to raw tool output.
|
|
20
|
+
* Named routeThroughContextMode for API compatibility with existing callers.
|
|
16
21
|
* Never throws.
|
|
17
22
|
*/
|
|
18
23
|
export async function routeThroughContextMode(raw: string): Promise<string> {
|
|
19
|
-
// TODO: wire to context-mode MCP HTTP endpoint when discoverable from extension code
|
|
20
24
|
return applyTruncationFallback(raw);
|
|
21
25
|
}
|
|
22
26
|
|