fecode-cli 1.0.1 → 1.0.2
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 -2
- package/dist/index.js +871 -798
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,20 +12,20 @@ import * as m from "os";
|
|
|
12
12
|
import * as h from "readline";
|
|
13
13
|
import { fileURLToPath as g } from "url";
|
|
14
14
|
import { useCallback as _, useEffect as v, useRef as y, useState as b } from "react";
|
|
15
|
-
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
15
|
+
import { Fragment as ee, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
16
16
|
import C from "ink-text-input";
|
|
17
17
|
//#region \0rolldown/runtime.js
|
|
18
|
-
var
|
|
18
|
+
var te = Object.defineProperty, ne = (e, t) => {
|
|
19
19
|
let n = {};
|
|
20
|
-
for (var r in e)
|
|
20
|
+
for (var r in e) te(n, r, {
|
|
21
21
|
get: e[r],
|
|
22
22
|
enumerable: !0
|
|
23
23
|
});
|
|
24
|
-
return t ||
|
|
24
|
+
return t || te(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
25
25
|
};
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region ../../packages/shared/src/config.ts
|
|
28
|
-
function
|
|
28
|
+
function re(e) {
|
|
29
29
|
let t = s.resolve(e);
|
|
30
30
|
for (;;) {
|
|
31
31
|
let e = s.join(t, ".env");
|
|
@@ -35,8 +35,8 @@ function ne(e) {
|
|
|
35
35
|
t = n;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
let t = e.cwd || process.cwd(), n = e.envFile ? s.resolve(e.envFile) :
|
|
38
|
+
function ie(e = {}) {
|
|
39
|
+
let t = e.cwd || process.cwd(), n = e.envFile ? s.resolve(e.envFile) : re(t);
|
|
40
40
|
n && o.existsSync(n) && c.config({
|
|
41
41
|
path: n,
|
|
42
42
|
override: !1
|
|
@@ -52,7 +52,7 @@ function re(e = {}) {
|
|
|
52
52
|
}
|
|
53
53
|
//#endregion
|
|
54
54
|
//#region ../../packages/models/src/providers/openai/index.ts
|
|
55
|
-
var
|
|
55
|
+
var ae = class {
|
|
56
56
|
id = "openai";
|
|
57
57
|
model;
|
|
58
58
|
apiKey;
|
|
@@ -187,7 +187,7 @@ var w = class {
|
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
},
|
|
190
|
+
}, w = class {
|
|
191
191
|
id = "gemini";
|
|
192
192
|
model;
|
|
193
193
|
apiKey;
|
|
@@ -337,7 +337,7 @@ var w = class {
|
|
|
337
337
|
};
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
},
|
|
340
|
+
}, oe = class {
|
|
341
341
|
id = "ollama";
|
|
342
342
|
baseUrl;
|
|
343
343
|
model;
|
|
@@ -361,7 +361,7 @@ var w = class {
|
|
|
361
361
|
baseURL: this.baseUrl,
|
|
362
362
|
apiKey: "ollama"
|
|
363
363
|
});
|
|
364
|
-
this.delegate = new
|
|
364
|
+
this.delegate = new ae({
|
|
365
365
|
apiKey: "ollama",
|
|
366
366
|
model: this.model,
|
|
367
367
|
client: i,
|
|
@@ -389,17 +389,17 @@ var w = class {
|
|
|
389
389
|
};
|
|
390
390
|
//#endregion
|
|
391
391
|
//#region ../../packages/models/src/factory.ts
|
|
392
|
-
function
|
|
392
|
+
function T(e) {
|
|
393
393
|
switch (e.provider.toLowerCase().trim()) {
|
|
394
|
-
case "openai": return new
|
|
394
|
+
case "openai": return new ae({
|
|
395
395
|
apiKey: e.apiKey,
|
|
396
396
|
model: e.model
|
|
397
397
|
});
|
|
398
|
-
case "gemini": return new
|
|
398
|
+
case "gemini": return new w({
|
|
399
399
|
apiKey: e.apiKey,
|
|
400
400
|
model: e.model
|
|
401
401
|
});
|
|
402
|
-
case "ollama": return new
|
|
402
|
+
case "ollama": return new oe({
|
|
403
403
|
baseUrl: e.baseUrl,
|
|
404
404
|
model: e.model
|
|
405
405
|
});
|
|
@@ -408,7 +408,7 @@ function E(e) {
|
|
|
408
408
|
}
|
|
409
409
|
//#endregion
|
|
410
410
|
//#region ../../packages/models/src/tools/registry.ts
|
|
411
|
-
var
|
|
411
|
+
var E = class {
|
|
412
412
|
tools = /* @__PURE__ */ new Map();
|
|
413
413
|
register(e) {
|
|
414
414
|
this.tools.set(e.name, e);
|
|
@@ -419,7 +419,7 @@ var D = class {
|
|
|
419
419
|
list() {
|
|
420
420
|
return Array.from(this.tools.values());
|
|
421
421
|
}
|
|
422
|
-
},
|
|
422
|
+
}, D = class {
|
|
423
423
|
registry;
|
|
424
424
|
constructor(e) {
|
|
425
425
|
this.registry = e;
|
|
@@ -449,7 +449,7 @@ var D = class {
|
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
},
|
|
452
|
+
}, O = class {
|
|
453
453
|
checkPermission(e, t) {
|
|
454
454
|
let n = e.permissionCategory || "read";
|
|
455
455
|
return n === "read" ? { type: "allowed" } : {
|
|
@@ -457,15 +457,15 @@ var D = class {
|
|
|
457
457
|
reason: `Tool '${e.name}' requires approval for ${n} permission.`
|
|
458
458
|
};
|
|
459
459
|
}
|
|
460
|
-
},
|
|
460
|
+
}, se = class {
|
|
461
461
|
policy;
|
|
462
|
-
constructor(e = new
|
|
462
|
+
constructor(e = new O()) {
|
|
463
463
|
this.policy = e;
|
|
464
464
|
}
|
|
465
465
|
async check(e, t) {
|
|
466
466
|
return this.policy.checkPermission(e, t);
|
|
467
467
|
}
|
|
468
|
-
},
|
|
468
|
+
}, ce = "# FeCode — Expert Coding Agent\n\nYou are FeCode, an expert terminal-based coding agent for software engineering. You operate inside a project workspace and have direct access to powerful tools. Your job is to help the user understand, modify, debug, and build code.\n\n## Your Tools\n\nYou have exactly 6 tools. Always use the RIGHT tool for the job:\n\n| Tool | Purpose | Risk |\n|------|---------|------|\n| `list_directory` | List files and folders in a directory | Low (auto-approved) |\n| `read_file` | Read text contents of a file | Low (auto-approved) |\n| `search_files` | Search for text/patterns across files | Low (auto-approved) |\n| `write_file` | Create a new file or overwrite an existing file | Medium (may need approval) |\n| `edit_file` | Replace exact text in an existing file | Medium (may need approval) |\n| `execute_command` | Run a dev command (npm, node, git, etc.) | High (needs user approval) |\n\n## Tool Usage Rules\n\n### For reading and exploring code:\n- Use `list_directory` to explore project structure. Do NOT use `ls`, `dir`, or `find` commands.\n- Use `read_file` to read file contents. Do NOT use `cat`, `type`, `head`, `tail`, `more`, or `less` commands.\n- Use `search_files` to find text in code. Do NOT use `grep`, `rg`, `findstr`, or `ack` commands.\n\n### For modifying code:\n- Use `write_file` to create new files or overwrite entire files.\n- Use `edit_file` to make targeted changes. Always `read_file` first so you know the exact text to replace.\n- Do NOT use `sed`, `awk`, `echo`, `cp`, `mv`, `rm`, or `mkdir` commands.\n\n### For running dev tools:\n- Use `execute_command` ONLY for: `npm`, `npx`, `pnpm`, `yarn`, `bun`, `node`, `git`.\n- Example valid commands: `npm test`, `npx tsc --noEmit`, `git status`, `npm run build`.\n- Do NOT use shell operators: no `|`, `;`, `&&`, `||`, `>`, `<`, backticks, or `$()`.\n- Each command must be a single executable with arguments. Run multiple commands as separate tool calls.\n\n## Critical Rules\n\n1. **ALWAYS explore before acting.** Use `list_directory`, `search_files`, and `read_file` to understand the codebase before making changes or assertions. Never guess at file contents or structure.\n2. **NEVER use execute_command for file operations.** This is the most important rule. `cat`, `grep`, `find`, `ls` — these are all forbidden. Use the dedicated tools listed above.\n3. **READ before EDIT.** Always call `read_file` to see current file contents before calling `edit_file`. The `oldText` parameter must exactly match existing text.\n4. **Stay in workspace.** All file paths must be within the project workspace. Do not access files outside it.\n5. **Respect denials.** If the user denies an action, accept it and find an alternative. Do not retry denied actions.\n6. **Never leak secrets.** Do not print, persist, or include API keys, tokens, passwords, or private keys in output.\n7. **Verify your changes.** After making code changes, run relevant verification commands (tests, lint, typecheck) to confirm correctness. Never claim verification passed without running it.\n8. **COMPLETE ALL PARTS OF THE REQUEST.** When the user asks you to perform multiple actions (e.g. inspect code, explain architecture, AND run the test suite), you must complete ALL parts. Do not stop after reading files. Immediately explain your findings and execute the requested commands.\n9. **ALWAYS RESPOND AFTER TOOL EXECUTION.** Never finish a turn with an empty response after tools have executed. Synthesize what you learned from the tools, answer the user, and proceed with the remaining tasks.\n10. **NO DRIFT OR TRIVIAL QUESTIONS.** Do not interrogate the user with unnecessary questions when instructions are clear. Take action, run the tools, and deliver the requested results.\n\n## Workflow\n\nFor every task:\n1. **Understand** — Read the user's request. Ask for clarification if anything is unclear.\n2. **Explore** — Use `list_directory` and `search_files` to understand the relevant parts of the codebase.\n3. **Read** — Use `read_file` to examine the specific files you need to understand or change.\n4. **Plan** — For complex tasks, think through your approach step by step before acting.\n5. **Act** — Make changes using `write_file` or `edit_file`. Run commands with `execute_command`.\n6. **Verify** — Run tests/lint/typecheck with `execute_command` to confirm your changes work.\n\n## Response Style\n\n- Be concise and direct.\n- Explain your reasoning before making changes.\n- Report what you found when exploring the codebase.\n- If something fails, diagnose the root cause before retrying. Do not blindly repeat failed actions.\n- Accurately report what is done, verified, and unverified.\n", le = class {
|
|
469
469
|
format(e) {
|
|
470
470
|
if (!e || e.relevantFiles.length === 0) return "";
|
|
471
471
|
let t = ["## Repository Exploration", "\nRelevant files:"];
|
|
@@ -476,7 +476,7 @@ var D = class {
|
|
|
476
476
|
}
|
|
477
477
|
return t.join("\n");
|
|
478
478
|
}
|
|
479
|
-
},
|
|
479
|
+
}, ue = class {
|
|
480
480
|
format(e) {
|
|
481
481
|
if (!e || e.regions.length === 0) return "";
|
|
482
482
|
let t = ["## Code Context"], n = /* @__PURE__ */ new Map();
|
|
@@ -510,7 +510,7 @@ function k(e) {
|
|
|
510
510
|
}
|
|
511
511
|
//#endregion
|
|
512
512
|
//#region ../../packages/agent/src/skills/formatter.ts
|
|
513
|
-
var
|
|
513
|
+
var de = class {
|
|
514
514
|
maxTokens;
|
|
515
515
|
constructor(e) {
|
|
516
516
|
this.maxTokens = e?.maxTokens ?? 6e3;
|
|
@@ -597,8 +597,8 @@ var ue = class {
|
|
|
597
597
|
};
|
|
598
598
|
//#endregion
|
|
599
599
|
//#region ../../packages/agent/src/skills/composer.ts
|
|
600
|
-
function
|
|
601
|
-
let t = [e.baseSystemPrompt ||
|
|
600
|
+
function fe(e = {}) {
|
|
601
|
+
let t = [e.baseSystemPrompt || ce];
|
|
602
602
|
if (e.policies && e.policies.length > 0) {
|
|
603
603
|
let n = e.policies.map((e) => {
|
|
604
604
|
let t = [`### Policy: ${e.name}`];
|
|
@@ -614,20 +614,20 @@ function de(e = {}) {
|
|
|
614
614
|
if (e.explorationResult) {
|
|
615
615
|
if (typeof e.explorationResult == "string") e.explorationResult.trim().length > 0 && t.push(e.explorationResult.trim());
|
|
616
616
|
else {
|
|
617
|
-
let n = new
|
|
617
|
+
let n = new le().format(e.explorationResult);
|
|
618
618
|
n.trim().length > 0 && t.push(n.trim());
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
621
|
if (e.codeContext) {
|
|
622
622
|
if (typeof e.codeContext == "string") e.codeContext.trim().length > 0 && t.push(e.codeContext.trim());
|
|
623
623
|
else {
|
|
624
|
-
let n = new
|
|
624
|
+
let n = new ue().format(e.codeContext);
|
|
625
625
|
n.trim().length > 0 && t.push(n.trim());
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
628
|
if (e.activeSkillsContext) t.push(e.activeSkillsContext);
|
|
629
629
|
else if (e.activeSkills && e.activeSkills.length > 0) {
|
|
630
|
-
let n = new
|
|
630
|
+
let n = new de().format(e.activeSkills);
|
|
631
631
|
if (e.tokenOptimizer) {
|
|
632
632
|
let r = e.tokenOptimizer.optimize({
|
|
633
633
|
text: n.content,
|
|
@@ -640,7 +640,7 @@ function de(e = {}) {
|
|
|
640
640
|
}
|
|
641
641
|
//#endregion
|
|
642
642
|
//#region ../../packages/agent/src/optimization/defaultOptimizer.ts
|
|
643
|
-
var
|
|
643
|
+
var pe = class {
|
|
644
644
|
defaultMaxTokens;
|
|
645
645
|
enabled;
|
|
646
646
|
constructor(e = {}) {
|
|
@@ -797,7 +797,7 @@ var A = class {
|
|
|
797
797
|
changed: i
|
|
798
798
|
};
|
|
799
799
|
}
|
|
800
|
-
},
|
|
800
|
+
}, me = {
|
|
801
801
|
name: "default-coding",
|
|
802
802
|
description: "Core engineering and modification discipline for coding agents. Governs how changes are investigated, implemented, and verified.",
|
|
803
803
|
instructions: [
|
|
@@ -815,10 +815,10 @@ var A = class {
|
|
|
815
815
|
"Error Recovery: When a build, test, or lint command fails, inspect the error output carefully, isolate the root cause, apply a targeted fix, and re-run verification. Do not blindly repeat the same failing command without modifications.",
|
|
816
816
|
"User Intent: Strictly adhere to the scope of the user request. Do not expand tasks or redesign surrounding systems unless explicitly instructed."
|
|
817
817
|
]
|
|
818
|
-
},
|
|
818
|
+
}, he = class {
|
|
819
819
|
policies = /* @__PURE__ */ new Map();
|
|
820
820
|
constructor() {
|
|
821
|
-
this.register(
|
|
821
|
+
this.register(me);
|
|
822
822
|
}
|
|
823
823
|
register(e) {
|
|
824
824
|
this.policies.set(e.name, e);
|
|
@@ -835,7 +835,7 @@ var A = class {
|
|
|
835
835
|
};
|
|
836
836
|
//#endregion
|
|
837
837
|
//#region ../../packages/agent/src/tasks/taskPlan.ts
|
|
838
|
-
function
|
|
838
|
+
function ge(e, t, n) {
|
|
839
839
|
let r = typeof t == "number" ? t : e.steps.findIndex((e) => e.id === t);
|
|
840
840
|
if (r < 0 || r >= e.steps.length) return e;
|
|
841
841
|
let i = e.steps[r].id, a = /* @__PURE__ */ new Set(), o = (t) => {
|
|
@@ -858,7 +858,7 @@ function me(e, t, n) {
|
|
|
858
858
|
}
|
|
859
859
|
//#endregion
|
|
860
860
|
//#region ../../packages/agent/src/tools/pathUtils.ts
|
|
861
|
-
function
|
|
861
|
+
function A(e, t) {
|
|
862
862
|
let n = s.resolve(e), r = t ? s.resolve(n, t) : n, i = s.relative(n, r);
|
|
863
863
|
return i === ".." || i.startsWith(".." + s.sep) || i.startsWith("../") || s.isAbsolute(i) ? { error: {
|
|
864
864
|
message: `Access denied: path traversal outside project root is not permitted (${t || ""}).`,
|
|
@@ -871,7 +871,7 @@ function j(e, t) {
|
|
|
871
871
|
}
|
|
872
872
|
//#endregion
|
|
873
873
|
//#region ../../packages/agent/src/tools/diffUtils.ts
|
|
874
|
-
function
|
|
874
|
+
function j(e, t, n, r = 3, i = 60) {
|
|
875
875
|
let a = s.normalize(e).replace(/\\/g, "/"), o = t.split("\n"), c = n.split("\n"), l = [`--- ${a}`, `+++ ${a}`], u = 0;
|
|
876
876
|
for (; u < o.length && u < c.length && o[u] === c[u];) u++;
|
|
877
877
|
let d = o.length - 1, f = c.length - 1;
|
|
@@ -895,24 +895,24 @@ function M(e, t, n, r = 3, i = 60) {
|
|
|
895
895
|
}
|
|
896
896
|
//#endregion
|
|
897
897
|
//#region ../../packages/agent/src/editing/hashUtils.ts
|
|
898
|
-
function
|
|
898
|
+
function _e(e) {
|
|
899
899
|
if (typeof e != "string") return "";
|
|
900
900
|
let t = e.replace(/\r\n/g, "\n");
|
|
901
901
|
return f.createHash("sha256").update(t, "utf-8").digest("hex");
|
|
902
902
|
}
|
|
903
903
|
//#endregion
|
|
904
904
|
//#region ../../packages/agent/src/editing/validator.ts
|
|
905
|
-
function
|
|
905
|
+
function ve(e, t) {
|
|
906
906
|
if (!t) return 0;
|
|
907
907
|
let n = 0, r = 0;
|
|
908
908
|
for (; (r = e.indexOf(t, r)) !== -1;) n++, r += t.length;
|
|
909
909
|
return n;
|
|
910
910
|
}
|
|
911
|
-
function
|
|
911
|
+
function M(e) {
|
|
912
912
|
let t = s.basename(e).toLowerCase();
|
|
913
913
|
return t === ".env.example" || t === ".env.sample" || t === ".env.template" || t === ".env.dist" || t === ".env.schema" ? !1 : !!(t.startsWith(".env") || t.endsWith(".pem") || t.endsWith(".key") || t.endsWith(".pfx") || t.endsWith(".p12") || t.endsWith(".kdbx") || t === "id_rsa" || t === "id_dsa" || t === "id_ed25519" || t === "credentials" || t === "secrets.json" || t === ".npmrc" || t === ".netrc");
|
|
914
914
|
}
|
|
915
|
-
var
|
|
915
|
+
var N = class {
|
|
916
916
|
async validateEdit(e, t, n, r, i = {}) {
|
|
917
917
|
if (i.signal?.aborted) return {
|
|
918
918
|
path: e,
|
|
@@ -928,7 +928,7 @@ var ge = class {
|
|
|
928
928
|
code: "CANCELLED"
|
|
929
929
|
}
|
|
930
930
|
};
|
|
931
|
-
let a =
|
|
931
|
+
let a = A(r, e);
|
|
932
932
|
if ("error" in a) return {
|
|
933
933
|
path: e,
|
|
934
934
|
targetPath: "",
|
|
@@ -944,7 +944,7 @@ var ge = class {
|
|
|
944
944
|
}
|
|
945
945
|
};
|
|
946
946
|
let { targetPath: o, displayPath: s } = a;
|
|
947
|
-
if (
|
|
947
|
+
if (M(s)) return {
|
|
948
948
|
path: e,
|
|
949
949
|
targetPath: o,
|
|
950
950
|
displayPath: s,
|
|
@@ -973,7 +973,7 @@ var ge = class {
|
|
|
973
973
|
code: "EDIT_INVALID"
|
|
974
974
|
}
|
|
975
975
|
};
|
|
976
|
-
let r = await d.readFile(o, "utf-8"), a =
|
|
976
|
+
let r = await d.readFile(o, "utf-8"), a = _e(r);
|
|
977
977
|
if (i.expectedHash && a !== i.expectedHash) return {
|
|
978
978
|
path: e,
|
|
979
979
|
targetPath: o,
|
|
@@ -988,7 +988,7 @@ var ge = class {
|
|
|
988
988
|
code: "EDIT_CONFLICT"
|
|
989
989
|
}
|
|
990
990
|
};
|
|
991
|
-
let c =
|
|
991
|
+
let c = ve(r, t);
|
|
992
992
|
if (c === 0) return {
|
|
993
993
|
path: e,
|
|
994
994
|
targetPath: o,
|
|
@@ -1024,7 +1024,7 @@ var ge = class {
|
|
|
1024
1024
|
displayPath: s,
|
|
1025
1025
|
originalContent: r,
|
|
1026
1026
|
proposedContent: l,
|
|
1027
|
-
diff:
|
|
1027
|
+
diff: j(s, r, l),
|
|
1028
1028
|
contentHash: a,
|
|
1029
1029
|
valid: !0
|
|
1030
1030
|
};
|
|
@@ -1060,7 +1060,7 @@ var ge = class {
|
|
|
1060
1060
|
code: "CANCELLED"
|
|
1061
1061
|
}
|
|
1062
1062
|
};
|
|
1063
|
-
let i =
|
|
1063
|
+
let i = A(n, e);
|
|
1064
1064
|
if ("error" in i) return {
|
|
1065
1065
|
path: e,
|
|
1066
1066
|
targetPath: "",
|
|
@@ -1076,7 +1076,7 @@ var ge = class {
|
|
|
1076
1076
|
}
|
|
1077
1077
|
};
|
|
1078
1078
|
let { targetPath: a, displayPath: o } = i;
|
|
1079
|
-
if (
|
|
1079
|
+
if (M(o)) return {
|
|
1080
1080
|
path: e,
|
|
1081
1081
|
targetPath: a,
|
|
1082
1082
|
displayPath: o,
|
|
@@ -1124,7 +1124,7 @@ var ge = class {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
};
|
|
1126
1126
|
}
|
|
1127
|
-
let l =
|
|
1127
|
+
let l = j(o, c ? s : "", t);
|
|
1128
1128
|
return {
|
|
1129
1129
|
path: e,
|
|
1130
1130
|
targetPath: a,
|
|
@@ -1132,28 +1132,28 @@ var ge = class {
|
|
|
1132
1132
|
originalContent: s,
|
|
1133
1133
|
proposedContent: t,
|
|
1134
1134
|
diff: l,
|
|
1135
|
-
contentHash:
|
|
1135
|
+
contentHash: _e(t),
|
|
1136
1136
|
valid: !0
|
|
1137
1137
|
};
|
|
1138
1138
|
}
|
|
1139
1139
|
};
|
|
1140
1140
|
//#endregion
|
|
1141
1141
|
//#region ../../packages/agent/src/session/sanitizer.ts
|
|
1142
|
-
function
|
|
1142
|
+
function P(e) {
|
|
1143
1143
|
if (!e) return e;
|
|
1144
1144
|
let t = e;
|
|
1145
1145
|
return t = t.replace(/\b(OPENAI_API_KEY|GEMINI_API_KEY|API_KEY|AUTHORIZATION|ACCESS_TOKEN|SECRET_KEY)\s*[:=]\s*["']?([^"' \n\r\t,;]{6,})["']?/gi, "$1=[REDACTED_SECRET]"), t = t.replace(/\bsk-[a-zA-Z0-9_-]{20,}\b/g, "[REDACTED_SECRET]"), t = t.replace(/\bAIza[0-9A-Za-z_-]{20,}\b/g, "[REDACTED_SECRET]"), t = t.replace(/\bBearer\s+[a-zA-Z0-9_.-]{20,}\b/gi, "Bearer [REDACTED_SECRET]"), t;
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1147
|
+
function ye(e) {
|
|
1148
1148
|
let t = { ...e };
|
|
1149
|
-
return typeof t.content == "string" && (t.content =
|
|
1149
|
+
return typeof t.content == "string" && (t.content = P(t.content)), t.toolCalls && t.toolCalls.length > 0 && (t.toolCalls = t.toolCalls.map((e) => {
|
|
1150
1150
|
let t = "";
|
|
1151
1151
|
try {
|
|
1152
1152
|
t = JSON.stringify(e.arguments);
|
|
1153
1153
|
} catch {
|
|
1154
1154
|
t = String(e.arguments);
|
|
1155
1155
|
}
|
|
1156
|
-
let n =
|
|
1156
|
+
let n = P(t), r = e.arguments;
|
|
1157
1157
|
try {
|
|
1158
1158
|
r = JSON.parse(n);
|
|
1159
1159
|
} catch {}
|
|
@@ -1163,12 +1163,12 @@ function I(e) {
|
|
|
1163
1163
|
};
|
|
1164
1164
|
})), t;
|
|
1165
1165
|
}
|
|
1166
|
-
function
|
|
1167
|
-
return e.map((e) =>
|
|
1166
|
+
function be(e) {
|
|
1167
|
+
return e.map((e) => ye(e));
|
|
1168
1168
|
}
|
|
1169
1169
|
//#endregion
|
|
1170
1170
|
//#region ../../packages/agent/src/editing/changeReview.ts
|
|
1171
|
-
function
|
|
1171
|
+
function xe(e) {
|
|
1172
1172
|
if (!e) return {
|
|
1173
1173
|
additions: 0,
|
|
1174
1174
|
deletions: 0
|
|
@@ -1180,7 +1180,7 @@ function L(e) {
|
|
|
1180
1180
|
deletions: n
|
|
1181
1181
|
};
|
|
1182
1182
|
}
|
|
1183
|
-
function
|
|
1183
|
+
function F(e, t = {}) {
|
|
1184
1184
|
let n = 0, r = 0, i = !1, a = t.maxDisplayLines || 100, o = [...e].sort((e, t) => e.path.localeCompare(t.path)), s = 0;
|
|
1185
1185
|
for (let e of o) n += e.additions, r += e.deletions, e.diff && (s += e.diff.split("\n").length);
|
|
1186
1186
|
return s > a && (i = !0), {
|
|
@@ -1192,7 +1192,7 @@ function R(e, t = {}) {
|
|
|
1192
1192
|
}
|
|
1193
1193
|
//#endregion
|
|
1194
1194
|
//#region ../../packages/agent/src/git/parser.ts
|
|
1195
|
-
function
|
|
1195
|
+
function I(e) {
|
|
1196
1196
|
let t = null, n = null, r = null, i = [], a = !1, o = e.split(/\r?\n/);
|
|
1197
1197
|
for (let e of o) if (e && e.trim()) {
|
|
1198
1198
|
if (e.startsWith("##")) {
|
|
@@ -1234,7 +1234,7 @@ function ve(e) {
|
|
|
1234
1234
|
}
|
|
1235
1235
|
//#endregion
|
|
1236
1236
|
//#region ../../packages/agent/src/commands/policy.ts
|
|
1237
|
-
var
|
|
1237
|
+
var Se = [
|
|
1238
1238
|
"npm",
|
|
1239
1239
|
"npx",
|
|
1240
1240
|
"pnpm",
|
|
@@ -1243,7 +1243,7 @@ var ye = [
|
|
|
1243
1243
|
"node",
|
|
1244
1244
|
"git"
|
|
1245
1245
|
];
|
|
1246
|
-
function
|
|
1246
|
+
function Ce(e) {
|
|
1247
1247
|
let t = !1, n = "", r = !1;
|
|
1248
1248
|
for (let i = 0; i < e.length; i++) {
|
|
1249
1249
|
let a = e[i];
|
|
@@ -1263,7 +1263,7 @@ function be(e) {
|
|
|
1263
1263
|
}
|
|
1264
1264
|
return !1;
|
|
1265
1265
|
}
|
|
1266
|
-
function
|
|
1266
|
+
function we(e) {
|
|
1267
1267
|
let t = [], n = "", r = !1, i = "", a = !1;
|
|
1268
1268
|
for (let o = 0; o < e.length; o++) {
|
|
1269
1269
|
let s = e[o];
|
|
@@ -1279,10 +1279,10 @@ function xe(e) {
|
|
|
1279
1279
|
}
|
|
1280
1280
|
return n.length > 0 && t.push(n), t;
|
|
1281
1281
|
}
|
|
1282
|
-
var
|
|
1282
|
+
var Te = class {
|
|
1283
1283
|
allowedExecutables;
|
|
1284
1284
|
constructor(e = {}) {
|
|
1285
|
-
this.allowedExecutables = new Set(e.allowedExecutables ||
|
|
1285
|
+
this.allowedExecutables = new Set(e.allowedExecutables || Se);
|
|
1286
1286
|
}
|
|
1287
1287
|
validate(e) {
|
|
1288
1288
|
let t = (e || "").trim();
|
|
@@ -1291,12 +1291,12 @@ var Se = class {
|
|
|
1291
1291
|
reason: "Command string is empty.",
|
|
1292
1292
|
code: "INVALID_COMMAND"
|
|
1293
1293
|
};
|
|
1294
|
-
if (
|
|
1294
|
+
if (Ce(t)) return {
|
|
1295
1295
|
type: "denied",
|
|
1296
1296
|
reason: "Command contains unsupported shell metacharacters or chaining syntax.",
|
|
1297
1297
|
code: "UNSUPPORTED_SHELL_SYNTAX"
|
|
1298
1298
|
};
|
|
1299
|
-
let n =
|
|
1299
|
+
let n = we(t);
|
|
1300
1300
|
if (n.length === 0) return {
|
|
1301
1301
|
type: "denied",
|
|
1302
1302
|
reason: "Failed to parse command executable.",
|
|
@@ -1325,22 +1325,22 @@ var Se = class {
|
|
|
1325
1325
|
args: n.slice(1)
|
|
1326
1326
|
};
|
|
1327
1327
|
}
|
|
1328
|
-
},
|
|
1328
|
+
}, Ee = /* @__PURE__ */ new Set([
|
|
1329
1329
|
"OPENAI_API_KEY",
|
|
1330
1330
|
"GEMINI_API_KEY",
|
|
1331
1331
|
"ANTHROPIC_API_KEY",
|
|
1332
1332
|
"AWS_SECRET_ACCESS_KEY",
|
|
1333
1333
|
"SECRET_KEY"
|
|
1334
1334
|
]);
|
|
1335
|
-
function
|
|
1335
|
+
function De(e = {}) {
|
|
1336
1336
|
let t = {};
|
|
1337
|
-
for (let [e, n] of Object.entries(process.env)) n !== void 0 && !
|
|
1338
|
-
for (let [n, r] of Object.entries(e))
|
|
1337
|
+
for (let [e, n] of Object.entries(process.env)) n !== void 0 && !Ee.has(e.toUpperCase()) && (t[e] = n);
|
|
1338
|
+
for (let [n, r] of Object.entries(e)) Ee.has(n.toUpperCase()) || (t[n] = r);
|
|
1339
1339
|
return t;
|
|
1340
1340
|
}
|
|
1341
|
-
var
|
|
1341
|
+
var Oe = class {
|
|
1342
1342
|
policy;
|
|
1343
|
-
constructor(e = new
|
|
1343
|
+
constructor(e = new Te()) {
|
|
1344
1344
|
this.policy = e;
|
|
1345
1345
|
}
|
|
1346
1346
|
async execute(e, t) {
|
|
@@ -1354,7 +1354,7 @@ var we = class {
|
|
|
1354
1354
|
truncated: !1,
|
|
1355
1355
|
error: `${n.code}: ${n.reason}`
|
|
1356
1356
|
};
|
|
1357
|
-
let r = n.executable, i = n.args || [], a = t.timeoutMs ?? 3e4, o = t.maxOutputBytes ?? 1048576, s =
|
|
1357
|
+
let r = n.executable, i = n.args || [], a = t.timeoutMs ?? 3e4, o = t.maxOutputBytes ?? 1048576, s = De(t.env);
|
|
1358
1358
|
return t.signal?.aborted ? {
|
|
1359
1359
|
command: e,
|
|
1360
1360
|
exitCode: null,
|
|
@@ -1409,18 +1409,18 @@ var we = class {
|
|
|
1409
1409
|
c.kill("SIGKILL");
|
|
1410
1410
|
} catch {}
|
|
1411
1411
|
}, 1e3);
|
|
1412
|
-
}, a),
|
|
1412
|
+
}, a), ee = () => {
|
|
1413
1413
|
u = !0;
|
|
1414
1414
|
try {
|
|
1415
1415
|
c.kill("SIGTERM");
|
|
1416
1416
|
} catch {}
|
|
1417
1417
|
};
|
|
1418
|
-
t.signal && t.signal.addEventListener("abort",
|
|
1418
|
+
t.signal && t.signal.addEventListener("abort", ee, { once: !0 }), c.stdout && c.stdout.on("data", (e) => {
|
|
1419
1419
|
h < o ? (f.push(e), h += e.length) : d = !0;
|
|
1420
1420
|
}), c.stderr && c.stderr.on("data", (e) => {
|
|
1421
1421
|
g < o ? (m.push(e), g += e.length) : d = !0;
|
|
1422
1422
|
}), c.on("error", (r) => {
|
|
1423
|
-
clearTimeout(b), t.signal && t.signal.removeEventListener("abort",
|
|
1423
|
+
clearTimeout(b), t.signal && t.signal.removeEventListener("abort", ee), n({
|
|
1424
1424
|
command: e,
|
|
1425
1425
|
exitCode: null,
|
|
1426
1426
|
stdout: "",
|
|
@@ -1430,7 +1430,7 @@ var we = class {
|
|
|
1430
1430
|
error: `Process execution error: ${r.message}`
|
|
1431
1431
|
});
|
|
1432
1432
|
}), c.on("close", (r) => {
|
|
1433
|
-
clearTimeout(b), t.signal && t.signal.removeEventListener("abort",
|
|
1433
|
+
clearTimeout(b), t.signal && t.signal.removeEventListener("abort", ee);
|
|
1434
1434
|
let i = Buffer.concat(f).toString("utf-8"), s = Buffer.concat(m).toString("utf-8");
|
|
1435
1435
|
h > o && (i = i.slice(0, o) + "\n... [output truncated due to size limit]", d = !0), g > o && (s = s.slice(0, o) + "\n... [output truncated due to size limit]", d = !0);
|
|
1436
1436
|
let c;
|
|
@@ -1446,7 +1446,7 @@ var we = class {
|
|
|
1446
1446
|
});
|
|
1447
1447
|
});
|
|
1448
1448
|
}
|
|
1449
|
-
},
|
|
1449
|
+
}, ke = class e {
|
|
1450
1450
|
runner;
|
|
1451
1451
|
constructor(t) {
|
|
1452
1452
|
this.runner = t || e.defaultRunner;
|
|
@@ -1457,7 +1457,7 @@ var we = class {
|
|
|
1457
1457
|
stderr: "Aborted",
|
|
1458
1458
|
exitCode: null
|
|
1459
1459
|
});
|
|
1460
|
-
let i =
|
|
1460
|
+
let i = De(), a;
|
|
1461
1461
|
try {
|
|
1462
1462
|
a = p("git", e, {
|
|
1463
1463
|
cwd: t,
|
|
@@ -1531,7 +1531,7 @@ var we = class {
|
|
|
1531
1531
|
"--porcelain=v1",
|
|
1532
1532
|
"-b"
|
|
1533
1533
|
], e);
|
|
1534
|
-
return r.exitCode === 0 ?
|
|
1534
|
+
return r.exitCode === 0 ? I(r.stdout).branch : null;
|
|
1535
1535
|
} catch {
|
|
1536
1536
|
return null;
|
|
1537
1537
|
}
|
|
@@ -1563,7 +1563,7 @@ var we = class {
|
|
|
1563
1563
|
behind: null,
|
|
1564
1564
|
hasConflicts: !1
|
|
1565
1565
|
};
|
|
1566
|
-
let r =
|
|
1566
|
+
let r = I(n.stdout);
|
|
1567
1567
|
return {
|
|
1568
1568
|
isRepository: !0,
|
|
1569
1569
|
gitAvailable: !0,
|
|
@@ -1596,12 +1596,12 @@ var we = class {
|
|
|
1596
1596
|
files: t.files
|
|
1597
1597
|
};
|
|
1598
1598
|
}
|
|
1599
|
-
},
|
|
1599
|
+
}, Ae = /* @__PURE__ */ new Set([
|
|
1600
1600
|
"completed",
|
|
1601
1601
|
"failed",
|
|
1602
1602
|
"cancelled"
|
|
1603
1603
|
]);
|
|
1604
|
-
function
|
|
1604
|
+
function je(e) {
|
|
1605
1605
|
return {
|
|
1606
1606
|
status: e?.status || "idle",
|
|
1607
1607
|
lifecycleState: e?.lifecycleState || "idle",
|
|
@@ -1624,7 +1624,7 @@ function De(e) {
|
|
|
1624
1624
|
diagnostics: e?.diagnostics
|
|
1625
1625
|
};
|
|
1626
1626
|
}
|
|
1627
|
-
function
|
|
1627
|
+
function L(e) {
|
|
1628
1628
|
return {
|
|
1629
1629
|
stepId: e.stepId,
|
|
1630
1630
|
order: e.order,
|
|
@@ -1638,8 +1638,8 @@ function Oe(e) {
|
|
|
1638
1638
|
expectedFiles: e.expectedFiles ? [...e.expectedFiles] : void 0
|
|
1639
1639
|
};
|
|
1640
1640
|
}
|
|
1641
|
-
function
|
|
1642
|
-
let t = e.steps.map(
|
|
1641
|
+
function Me(e) {
|
|
1642
|
+
let t = e.steps.map(L), n = t.filter((e) => e.status === "completed").length;
|
|
1643
1643
|
return {
|
|
1644
1644
|
planId: e.planId,
|
|
1645
1645
|
runId: e.runId,
|
|
@@ -1652,13 +1652,13 @@ function B(e) {
|
|
|
1652
1652
|
totalStepsCount: t.length
|
|
1653
1653
|
};
|
|
1654
1654
|
}
|
|
1655
|
-
function
|
|
1655
|
+
function Ne(e, t) {
|
|
1656
1656
|
let n = {
|
|
1657
1657
|
...e,
|
|
1658
1658
|
timeline: [...e.timeline],
|
|
1659
1659
|
messages: [...e.messages],
|
|
1660
1660
|
skills: [...e.skills]
|
|
1661
|
-
}, r =
|
|
1661
|
+
}, r = Ae.has(e.status), i = Date.now();
|
|
1662
1662
|
switch (t.type) {
|
|
1663
1663
|
case "run_started":
|
|
1664
1664
|
r || (n.runId = t.runId, n.status = "executing", n.lifecycleState = "executing"), n.timeline.push({
|
|
@@ -1699,7 +1699,7 @@ function ke(e, t) {
|
|
|
1699
1699
|
});
|
|
1700
1700
|
break;
|
|
1701
1701
|
case "plan_created":
|
|
1702
|
-
n.activePlan =
|
|
1702
|
+
n.activePlan = Me(t.plan), r || (t.plan.status === "draft" || t.plan.status === "ready" ? (n.status = "awaiting_plan_approval", n.pendingApproval = {
|
|
1703
1703
|
approvalId: `plan-app-${t.plan.planId}`,
|
|
1704
1704
|
type: "plan",
|
|
1705
1705
|
runId: t.plan.runId,
|
|
@@ -2093,14 +2093,14 @@ function ke(e, t) {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
//#endregion
|
|
2095
2095
|
//#region ../../packages/agent/src/product/productRuntime.ts
|
|
2096
|
-
var
|
|
2096
|
+
var Pe = class {
|
|
2097
2097
|
agentRuntime;
|
|
2098
2098
|
gitRepository;
|
|
2099
2099
|
approvalResolver;
|
|
2100
2100
|
uiState;
|
|
2101
2101
|
subscribers = /* @__PURE__ */ new Set();
|
|
2102
2102
|
constructor(e) {
|
|
2103
|
-
this.agentRuntime = e.agentRuntime, this.gitRepository = e.gitRepository || ("getGitRepository" in this.agentRuntime && typeof this.agentRuntime.getGitRepository == "function" ? this.agentRuntime.getGitRepository() : new
|
|
2103
|
+
this.agentRuntime = e.agentRuntime, this.gitRepository = e.gitRepository || ("getGitRepository" in this.agentRuntime && typeof this.agentRuntime.getGitRepository == "function" ? this.agentRuntime.getGitRepository() : new ke()), this.approvalResolver = e.approvalResolver || ("getApprovalResolver" in this.agentRuntime && typeof this.agentRuntime.getApprovalResolver == "function" ? this.agentRuntime.getApprovalResolver() : void 0), this.uiState = je({
|
|
2104
2104
|
cwd: e.initialCwd || process.cwd(),
|
|
2105
2105
|
sessionId: e.initialSessionId
|
|
2106
2106
|
});
|
|
@@ -2132,7 +2132,7 @@ var Ae = class {
|
|
|
2132
2132
|
});
|
|
2133
2133
|
for await (let e of t) {
|
|
2134
2134
|
let t = this.uiState.status;
|
|
2135
|
-
this.uiState =
|
|
2135
|
+
this.uiState = Ne(this.uiState, e);
|
|
2136
2136
|
let n = {
|
|
2137
2137
|
type: "raw_agent_event",
|
|
2138
2138
|
event: e
|
|
@@ -2303,7 +2303,7 @@ var Ae = class {
|
|
|
2303
2303
|
let t = this.agentRuntime.resumeRun(e);
|
|
2304
2304
|
for await (let n of t) {
|
|
2305
2305
|
let t = this.uiState.status;
|
|
2306
|
-
this.uiState =
|
|
2306
|
+
this.uiState = Ne(this.uiState, n);
|
|
2307
2307
|
let r = {
|
|
2308
2308
|
type: "raw_agent_event",
|
|
2309
2309
|
event: n
|
|
@@ -2349,7 +2349,7 @@ var Ae = class {
|
|
|
2349
2349
|
try {
|
|
2350
2350
|
let n = this.agentRuntime.executeExecutionRecovery(e, t);
|
|
2351
2351
|
for await (let e of n) {
|
|
2352
|
-
this.uiState =
|
|
2352
|
+
this.uiState = Ne(this.uiState, e);
|
|
2353
2353
|
let t = {
|
|
2354
2354
|
type: "raw_agent_event",
|
|
2355
2355
|
event: e
|
|
@@ -2373,7 +2373,7 @@ var Ae = class {
|
|
|
2373
2373
|
try {
|
|
2374
2374
|
let n = this.agentRuntime.continueRecoveredPlan(e, t);
|
|
2375
2375
|
for await (let e of n) {
|
|
2376
|
-
this.uiState =
|
|
2376
|
+
this.uiState = Ne(this.uiState, e);
|
|
2377
2377
|
let t = {
|
|
2378
2378
|
type: "raw_agent_event",
|
|
2379
2379
|
event: e
|
|
@@ -2413,7 +2413,7 @@ var Ae = class {
|
|
|
2413
2413
|
};
|
|
2414
2414
|
//#endregion
|
|
2415
2415
|
//#region ../../packages/agent/src/context/messageOptimizer.ts
|
|
2416
|
-
function
|
|
2416
|
+
function R(e, t = 16384, n = {}) {
|
|
2417
2417
|
if (e.length === 0) return [];
|
|
2418
2418
|
let r = n.maxToolResultChars ?? 3500, i = e.map((e) => {
|
|
2419
2419
|
if (e.role === "assistant" && e.content) {
|
|
@@ -2442,7 +2442,7 @@ function je(e, t = 16384, n = {}) {
|
|
|
2442
2442
|
s = e;
|
|
2443
2443
|
break;
|
|
2444
2444
|
}
|
|
2445
|
-
if (s <= 0) return
|
|
2445
|
+
if (s <= 0) return Fe(i, t, a);
|
|
2446
2446
|
let c = [];
|
|
2447
2447
|
for (let e = 1; e < s; e++) i[e].role === "user" && c.push(e);
|
|
2448
2448
|
for (let e of c) {
|
|
@@ -2470,9 +2470,9 @@ function je(e, t = 16384, n = {}) {
|
|
|
2470
2470
|
},
|
|
2471
2471
|
...i.slice(s)
|
|
2472
2472
|
];
|
|
2473
|
-
return a(l) > t ?
|
|
2473
|
+
return a(l) > t ? Fe(l, t, a) : l;
|
|
2474
2474
|
}
|
|
2475
|
-
function
|
|
2475
|
+
function Fe(e, t, n) {
|
|
2476
2476
|
let r = n(e);
|
|
2477
2477
|
if (r <= t) return e;
|
|
2478
2478
|
let i = e.map((e) => ({ ...e })), a = [];
|
|
@@ -2491,7 +2491,7 @@ function V(e, t, n) {
|
|
|
2491
2491
|
}
|
|
2492
2492
|
//#endregion
|
|
2493
2493
|
//#region ../../packages/agent/src/strategy/executionStrategy.ts
|
|
2494
|
-
var
|
|
2494
|
+
var Ie = class {
|
|
2495
2495
|
decide(e, t = {}) {
|
|
2496
2496
|
let n = e.trim(), r = n.toLowerCase();
|
|
2497
2497
|
if (this.isVerificationRequest(r)) {
|
|
@@ -2592,23 +2592,23 @@ var Me = class {
|
|
|
2592
2592
|
};
|
|
2593
2593
|
//#endregion
|
|
2594
2594
|
//#region ../../packages/agent/src/changes/classifier.ts
|
|
2595
|
-
function
|
|
2595
|
+
function Le(e) {
|
|
2596
2596
|
return e.replace(/\\/g, "/").toLowerCase();
|
|
2597
2597
|
}
|
|
2598
|
-
function
|
|
2599
|
-
let t =
|
|
2598
|
+
function Re(e) {
|
|
2599
|
+
let t = Le(e), n = s.basename(e);
|
|
2600
2600
|
return t.includes("/tests/") || t.startsWith("tests/") || t.includes("/__tests__/") || t.includes(".test.") || t.includes(".spec.") ? "tests" : t.includes("/components/") || t.startsWith("components/") || t.includes("/widgets/") ? "components" : t.includes("/pages/") || t.startsWith("pages/") || t.includes("/views/") ? "pages" : t.includes("/routes/") || t.startsWith("routes/") || t.includes("/app/") || t.startsWith("app/") ? "routes" : t.includes("/hooks/") || t.startsWith("hooks/") || /^use[A-Z0-9_]/.test(n) ? "hooks" : t.includes("/auth/") || t.startsWith("auth/") || t.endsWith("/auth.ts") || t.endsWith("/auth.js") || t.endsWith("/auth.tsx") || t.endsWith("/auth.jsx") || t === "auth.ts" || t === "auth.js" ? "authentication" : t.includes("/utils/") || t.startsWith("utils/") || t.includes("/lib/") || t.startsWith("lib/") || t.includes("/helpers/") ? "utilities" : t.includes("/styles/") || t.startsWith("styles/") || t.endsWith(".css") || t.endsWith(".scss") || t.endsWith(".sass") || t.endsWith(".less") ? "styles" : t.includes("/services/") || t.startsWith("services/") || t.includes("/api/") || t.startsWith("api/") ? "services" : t.includes("/context/") || t.startsWith("context/") || t.includes("/state/") || t.startsWith("state/") || t.includes("/store/") || t.startsWith("store/") ? "state" : "other";
|
|
2601
2601
|
}
|
|
2602
|
-
function
|
|
2603
|
-
let t =
|
|
2602
|
+
function ze(e) {
|
|
2603
|
+
let t = Le(e), n = s.basename(t);
|
|
2604
2604
|
return t.includes("/tests/") || t.startsWith("tests/") || t.includes("/__tests__/") || t.includes(".test.") || t.includes(".spec.") ? "tests" : t.endsWith(".css") || t.endsWith(".scss") || t.endsWith(".sass") || t.endsWith(".less") || n.startsWith("tailwind.config") || n.startsWith("postcss.config") ? "styling" : n === "package.json" || n === "package-lock.json" || n.startsWith("tsconfig") || n.startsWith("vite.config") || n.startsWith("next.config") || n.startsWith("webpack.config") || n.startsWith("vitest.config") || n.startsWith("jest.config") || n.startsWith(".eslintrc") || n.startsWith("eslint.config") || n.startsWith(".prettier") || n.startsWith(".babel") ? "configuration" : t.endsWith(".md") || t.endsWith(".mdx") || t.includes("/docs/") || t.startsWith("docs/") || n.startsWith("readme") || n.startsWith("license") || n.startsWith("changelog") ? "documentation" : t.includes("/scripts/") || t.startsWith("scripts/") || t.includes("/.github/") || t.startsWith(".github/") || t.includes("/.vscode/") || t.startsWith(".vscode/") ? "tooling" : t.endsWith(".tsx") || t.endsWith(".jsx") || t.endsWith(".vue") || t.endsWith(".svelte") || t.endsWith(".html") || t.includes("/components/") || t.includes("/pages/") || t.includes("/hooks/") ? "frontend" : t.includes("/server/") || t.startsWith("server/") || t.includes("/backend/") || t.startsWith("backend/") || n === "server.ts" || n === "server.js" ? "backend" : "other";
|
|
2605
2605
|
}
|
|
2606
2606
|
//#endregion
|
|
2607
2607
|
//#region ../../packages/agent/src/changes/changeSetBuilder.ts
|
|
2608
|
-
function
|
|
2608
|
+
function Be(e, t) {
|
|
2609
2609
|
return e === "added" ? t === "deleted" ? "deleted" : "added" : e === "modified" ? t === "deleted" ? "deleted" : "modified" : e === "deleted" ? t === "added" ? "modified" : "deleted" : t;
|
|
2610
2610
|
}
|
|
2611
|
-
var
|
|
2611
|
+
var Ve = class {
|
|
2612
2612
|
filesMap = /* @__PURE__ */ new Map();
|
|
2613
2613
|
commandsList = [];
|
|
2614
2614
|
recordFileChange(e) {
|
|
@@ -2619,7 +2619,7 @@ var W = class {
|
|
|
2619
2619
|
this.filesMap.delete(t);
|
|
2620
2620
|
return;
|
|
2621
2621
|
}
|
|
2622
|
-
n.additions += e.additions, n.deletions += e.deletions, n.operation =
|
|
2622
|
+
n.additions += e.additions, n.deletions += e.deletions, n.operation = Be(n.operation, e.operation);
|
|
2623
2623
|
} else this.filesMap.set(t, {
|
|
2624
2624
|
path: t,
|
|
2625
2625
|
operation: e.operation,
|
|
@@ -2637,7 +2637,7 @@ var W = class {
|
|
|
2637
2637
|
}
|
|
2638
2638
|
build(e) {
|
|
2639
2639
|
let t = Array.from(this.filesMap.values()).sort((e, t) => e.path.localeCompare(t.path)), n = 0, r = 0, i = 0, a = 0, o = 0, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
|
|
2640
|
-
for (let e of t) n += e.additions, r += e.deletions, e.operation === "added" ? i++ : e.operation === "deleted" ? o++ : a++, s.add(
|
|
2640
|
+
for (let e of t) n += e.additions, r += e.deletions, e.operation === "added" ? i++ : e.operation === "deleted" ? o++ : a++, s.add(Re(e.path)), c.add(ze(e.path));
|
|
2641
2641
|
let l = {
|
|
2642
2642
|
totalFiles: t.length,
|
|
2643
2643
|
addedFiles: i,
|
|
@@ -2668,13 +2668,13 @@ var W = class {
|
|
|
2668
2668
|
reset() {
|
|
2669
2669
|
this.filesMap.clear(), this.commandsList = [];
|
|
2670
2670
|
}
|
|
2671
|
-
},
|
|
2671
|
+
}, He = class {
|
|
2672
2672
|
taskId;
|
|
2673
2673
|
taskIndex;
|
|
2674
2674
|
request;
|
|
2675
2675
|
startedAt;
|
|
2676
2676
|
modifiedFiles = /* @__PURE__ */ new Set();
|
|
2677
|
-
changeSetBuilder = new
|
|
2677
|
+
changeSetBuilder = new Ve();
|
|
2678
2678
|
verifiedCommands = /* @__PURE__ */ new Set();
|
|
2679
2679
|
failedCommands = /* @__PURE__ */ new Set();
|
|
2680
2680
|
requirements = /* @__PURE__ */ new Map();
|
|
@@ -2867,7 +2867,7 @@ var W = class {
|
|
|
2867
2867
|
};
|
|
2868
2868
|
//#endregion
|
|
2869
2869
|
//#region ../../packages/agent/src/git/attribution.ts
|
|
2870
|
-
function
|
|
2870
|
+
function Ue(e, t, n = []) {
|
|
2871
2871
|
let r = (e) => e.replace(/\\/g, "/").trim(), i = new Set((e?.files || []).map((e) => r(e.path))), a = new Set(n.map(r)), o = new Set((t?.files || []).map((e) => r(e.path))), s = Array.from(i).sort(), c = Array.from(a).sort(), l = /* @__PURE__ */ new Set();
|
|
2872
2872
|
for (let e of o) !i.has(e) && !a.has(e) && l.add(e);
|
|
2873
2873
|
let u = Array.from(l).sort(), d = /* @__PURE__ */ new Set();
|
|
@@ -2881,25 +2881,25 @@ function G(e, t, n = []) {
|
|
|
2881
2881
|
}
|
|
2882
2882
|
//#endregion
|
|
2883
2883
|
//#region ../../packages/agent/src/checkpoints/pathResolver.ts
|
|
2884
|
-
function
|
|
2884
|
+
function We() {
|
|
2885
2885
|
return process.env.FECODE_CHECKPOINTS_DIR ? s.resolve(process.env.FECODE_CHECKPOINTS_DIR) : s.join(m.homedir(), ".fecode", "checkpoints");
|
|
2886
2886
|
}
|
|
2887
2887
|
//#endregion
|
|
2888
2888
|
//#region ../../packages/agent/src/checkpoints/checkpointStore.ts
|
|
2889
|
-
function
|
|
2889
|
+
function Ge(e) {
|
|
2890
2890
|
return !e || typeof e != "string" ? !1 : /^[a-zA-Z0-9_.-]+$/.test(e) && !e.includes("..");
|
|
2891
2891
|
}
|
|
2892
|
-
var
|
|
2892
|
+
var z = class {
|
|
2893
2893
|
storageDir;
|
|
2894
2894
|
maxCheckpoints;
|
|
2895
2895
|
constructor(e, t = 10) {
|
|
2896
|
-
this.storageDir = e ||
|
|
2896
|
+
this.storageDir = e || We(), this.maxCheckpoints = t;
|
|
2897
2897
|
}
|
|
2898
2898
|
getStorageDir() {
|
|
2899
2899
|
return this.storageDir;
|
|
2900
2900
|
}
|
|
2901
2901
|
async save(e) {
|
|
2902
|
-
if (!
|
|
2902
|
+
if (!Ge(e.id)) throw Error(`Invalid checkpointId: ${e.id}`);
|
|
2903
2903
|
try {
|
|
2904
2904
|
await d.mkdir(this.storageDir, {
|
|
2905
2905
|
recursive: !0,
|
|
@@ -2929,7 +2929,7 @@ var q = class {
|
|
|
2929
2929
|
await this.pruneOldCheckpoints(e.id);
|
|
2930
2930
|
}
|
|
2931
2931
|
async get(e) {
|
|
2932
|
-
if (!
|
|
2932
|
+
if (!Ge(e)) return null;
|
|
2933
2933
|
let t = s.join(this.storageDir, `${e}.json`);
|
|
2934
2934
|
try {
|
|
2935
2935
|
let e = await d.readFile(t, "utf-8");
|
|
@@ -2958,7 +2958,7 @@ var q = class {
|
|
|
2958
2958
|
}
|
|
2959
2959
|
}
|
|
2960
2960
|
async remove(e) {
|
|
2961
|
-
if (!
|
|
2961
|
+
if (!Ge(e)) return;
|
|
2962
2962
|
let t = s.join(this.storageDir, `${e}.json`);
|
|
2963
2963
|
try {
|
|
2964
2964
|
await d.unlink(t);
|
|
@@ -2984,21 +2984,21 @@ var q = class {
|
|
|
2984
2984
|
}
|
|
2985
2985
|
} catch {}
|
|
2986
2986
|
}
|
|
2987
|
-
},
|
|
2987
|
+
}, Ke = {
|
|
2988
2988
|
low: 1,
|
|
2989
2989
|
normal: 2,
|
|
2990
2990
|
elevated: 3,
|
|
2991
2991
|
critical: 4
|
|
2992
2992
|
};
|
|
2993
|
-
function
|
|
2993
|
+
function B() {
|
|
2994
2994
|
return `checkpoint-${(/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").slice(0, 15).replace("T", "-")}-${Math.random().toString(36).substring(2, 6)}`;
|
|
2995
2995
|
}
|
|
2996
|
-
var
|
|
2996
|
+
var qe = class {
|
|
2997
2997
|
store;
|
|
2998
2998
|
gitRepo;
|
|
2999
2999
|
records = /* @__PURE__ */ new Map();
|
|
3000
3000
|
constructor(e, t) {
|
|
3001
|
-
this.store = e || new
|
|
3001
|
+
this.store = e || new z(), this.gitRepo = t || new ke();
|
|
3002
3002
|
}
|
|
3003
3003
|
async create(e) {
|
|
3004
3004
|
if (e.signal?.aborted) return {
|
|
@@ -3007,7 +3007,7 @@ var ze = class {
|
|
|
3007
3007
|
code: "ABORTED"
|
|
3008
3008
|
};
|
|
3009
3009
|
try {
|
|
3010
|
-
let t =
|
|
3010
|
+
let t = B(), n = await this.gitRepo.isRepository(e.cwd), r = e.cwd, i = null, a = [];
|
|
3011
3011
|
if (n) {
|
|
3012
3012
|
let t = await this.gitRepo.getStatus(e.cwd);
|
|
3013
3013
|
r = t.root || e.cwd, i = t.branch;
|
|
@@ -3102,11 +3102,11 @@ var ze = class {
|
|
|
3102
3102
|
});
|
|
3103
3103
|
}
|
|
3104
3104
|
async restore(e, t = { cwd: process.cwd() }) {
|
|
3105
|
-
let { DefaultRecoveryManager: n } = await Promise.resolve().then(() =>
|
|
3105
|
+
let { DefaultRecoveryManager: n } = await Promise.resolve().then(() => G);
|
|
3106
3106
|
return new n(this.store, this.gitRepo).recover(e, t);
|
|
3107
3107
|
}
|
|
3108
3108
|
async requestApproval(e) {
|
|
3109
|
-
let t = e.checkpointId ||
|
|
3109
|
+
let t = e.checkpointId || B(), n = Date.now(), r = n + (e.ttlMs ?? 3e5), i = null;
|
|
3110
3110
|
try {
|
|
3111
3111
|
await this.gitRepo.isRepository(e.cwd) && (i = await this.gitRepo.getBranch(e.cwd));
|
|
3112
3112
|
} catch {}
|
|
@@ -3196,8 +3196,8 @@ var ze = class {
|
|
|
3196
3196
|
reason: n.invalidationReason,
|
|
3197
3197
|
invalidated: !0
|
|
3198
3198
|
};
|
|
3199
|
-
let r =
|
|
3200
|
-
if ((
|
|
3199
|
+
let r = Ke[n.riskLevel] ?? 2;
|
|
3200
|
+
if ((Ke[t.riskLevel] ?? 2) > r) return n.status = "invalidated", n.invalidationReason = `Risk level escalated from '${n.riskLevel}' to '${t.riskLevel}'. A fresh approval is required.`, {
|
|
3201
3201
|
valid: !1,
|
|
3202
3202
|
status: "invalidated",
|
|
3203
3203
|
checkpointId: e,
|
|
@@ -3268,10 +3268,10 @@ var ze = class {
|
|
|
3268
3268
|
};
|
|
3269
3269
|
//#endregion
|
|
3270
3270
|
//#region ../../packages/agent/src/recovery/safety.ts
|
|
3271
|
-
function
|
|
3271
|
+
function V(e) {
|
|
3272
3272
|
return s.resolve(e).replace(/\\/g, "/");
|
|
3273
3273
|
}
|
|
3274
|
-
async function
|
|
3274
|
+
async function H(e, t, n) {
|
|
3275
3275
|
let r = [], i = [], a = [], o = [];
|
|
3276
3276
|
if (e.status === "discarded") return i.push("Checkpoint has been discarded"), {
|
|
3277
3277
|
safe: !1,
|
|
@@ -3288,11 +3288,11 @@ async function Ve(e, t, n) {
|
|
|
3288
3288
|
reasons: i
|
|
3289
3289
|
};
|
|
3290
3290
|
let s = await n.isRepository(t), c = null, l = t;
|
|
3291
|
-
s ? (c = await n.getStatus(t), l = c.root || t,
|
|
3291
|
+
s ? (c = await n.getStatus(t), l = c.root || t, V(e.repositoryRoot) !== V(l) && i.push("Checkpoint repository mismatch"), e.branch && c.branch && e.branch !== c.branch && i.push("Checkpoint branch differs from current branch"), c.hasConflicts && i.push("Repository contains merge conflicts")) : (V(e.repositoryRoot) !== V(t) && i.push("Checkpoint repository mismatch"), i.push("Automatic file recovery is only supported in Git repositories"));
|
|
3292
3292
|
let u = new Map(e.files.map((e) => [e.path, e.status]));
|
|
3293
3293
|
if (s && c) {
|
|
3294
3294
|
for (let e of c.files) {
|
|
3295
|
-
if (
|
|
3295
|
+
if (M(e.path)) {
|
|
3296
3296
|
r.push({
|
|
3297
3297
|
path: e.path,
|
|
3298
3298
|
reason: "Protected file cannot be restored automatically"
|
|
@@ -3302,9 +3302,9 @@ async function Ve(e, t, n) {
|
|
|
3302
3302
|
let t = u.get(e.path);
|
|
3303
3303
|
t && (t === "modified" || t === "untracked") ? o.push(e.path) : a.push(e.path);
|
|
3304
3304
|
}
|
|
3305
|
-
for (let t of e.files)
|
|
3305
|
+
for (let t of e.files) M(t.path) || !c.files.find((e) => e.path === t.path) && !a.includes(t.path) && o.push(t.path);
|
|
3306
3306
|
} else for (let t of e.files) {
|
|
3307
|
-
if (
|
|
3307
|
+
if (M(t.path)) {
|
|
3308
3308
|
r.push({
|
|
3309
3309
|
path: t.path,
|
|
3310
3310
|
reason: "Protected file cannot be restored automatically"
|
|
@@ -3323,19 +3323,19 @@ async function Ve(e, t, n) {
|
|
|
3323
3323
|
}
|
|
3324
3324
|
//#endregion
|
|
3325
3325
|
//#region ../../packages/agent/src/recovery/pathResolver.ts
|
|
3326
|
-
function
|
|
3326
|
+
function Je() {
|
|
3327
3327
|
return process.env.FECODE_RECOVERY_SNAPSHOTS_DIR ? s.resolve(process.env.FECODE_RECOVERY_SNAPSHOTS_DIR) : s.join(m.homedir(), ".fecode", "recovery-snapshots");
|
|
3328
3328
|
}
|
|
3329
3329
|
//#endregion
|
|
3330
3330
|
//#region ../../packages/agent/src/recovery/emergencySnapshot.ts
|
|
3331
|
-
async function
|
|
3332
|
-
let r =
|
|
3331
|
+
async function U(e, t, n) {
|
|
3332
|
+
let r = Je(), i = Math.random().toString(36).substring(2, 7), a = s.join(r, `${n}-${Date.now()}-${i}`);
|
|
3333
3333
|
await d.mkdir(a, {
|
|
3334
3334
|
recursive: !0,
|
|
3335
3335
|
mode: 448
|
|
3336
3336
|
});
|
|
3337
3337
|
for (let n of e) {
|
|
3338
|
-
if (
|
|
3338
|
+
if (M(n)) continue;
|
|
3339
3339
|
let e = s.resolve(t, n), r = s.join(a, n);
|
|
3340
3340
|
try {
|
|
3341
3341
|
(await d.stat(e)).isFile() && (await d.mkdir(s.dirname(r), { recursive: !0 }), await d.copyFile(e, r));
|
|
@@ -3343,16 +3343,16 @@ async function He(e, t, n) {
|
|
|
3343
3343
|
}
|
|
3344
3344
|
return a;
|
|
3345
3345
|
}
|
|
3346
|
-
async function
|
|
3346
|
+
async function Ye(e, t) {
|
|
3347
3347
|
try {
|
|
3348
|
-
let n = await
|
|
3348
|
+
let n = await Xe(e);
|
|
3349
3349
|
for (let r of n) {
|
|
3350
3350
|
let n = s.relative(e, r), i = s.resolve(t, n);
|
|
3351
3351
|
await d.mkdir(s.dirname(i), { recursive: !0 }), await d.copyFile(r, i);
|
|
3352
3352
|
}
|
|
3353
3353
|
} catch {}
|
|
3354
3354
|
}
|
|
3355
|
-
async function
|
|
3355
|
+
async function W(e) {
|
|
3356
3356
|
try {
|
|
3357
3357
|
await d.rm(e, {
|
|
3358
3358
|
recursive: !0,
|
|
@@ -3360,14 +3360,14 @@ async function We(e) {
|
|
|
3360
3360
|
});
|
|
3361
3361
|
} catch {}
|
|
3362
3362
|
}
|
|
3363
|
-
async function
|
|
3363
|
+
async function Xe(e) {
|
|
3364
3364
|
let t = [];
|
|
3365
3365
|
try {
|
|
3366
3366
|
let n = await d.readdir(e, { withFileTypes: !0 });
|
|
3367
3367
|
for (let r of n) {
|
|
3368
3368
|
let n = s.join(e, r.name);
|
|
3369
3369
|
if (r.isDirectory()) {
|
|
3370
|
-
let e = await
|
|
3370
|
+
let e = await Xe(n);
|
|
3371
3371
|
t.push(...e);
|
|
3372
3372
|
} else r.isFile() && t.push(n);
|
|
3373
3373
|
}
|
|
@@ -3376,13 +3376,13 @@ async function Ge(e) {
|
|
|
3376
3376
|
}
|
|
3377
3377
|
//#endregion
|
|
3378
3378
|
//#region ../../packages/agent/src/recovery/recoveryManager.ts
|
|
3379
|
-
var
|
|
3379
|
+
var G = /* @__PURE__ */ ne({ DefaultRecoveryManager: () => Ze }), Ze = class {
|
|
3380
3380
|
store;
|
|
3381
3381
|
gitRepo;
|
|
3382
3382
|
runner;
|
|
3383
3383
|
lastRecord = null;
|
|
3384
3384
|
constructor(e, t, n) {
|
|
3385
|
-
this.store = e || new
|
|
3385
|
+
this.store = e || new z(), this.gitRepo = t || new ke(), this.runner = n || ke.defaultRunner;
|
|
3386
3386
|
}
|
|
3387
3387
|
getLastRecord() {
|
|
3388
3388
|
return this.lastRecord ? { ...this.lastRecord } : null;
|
|
@@ -3401,7 +3401,7 @@ var Ke = /* @__PURE__ */ te({ DefaultRecoveryManager: () => qe }), qe = class {
|
|
|
3401
3401
|
reasons: [`Checkpoint not found: ${e}`],
|
|
3402
3402
|
conflicts: []
|
|
3403
3403
|
};
|
|
3404
|
-
let r = await
|
|
3404
|
+
let r = await H(n, t, this.gitRepo), i = [], a = await this.gitRepo.isRepository(t), o = null;
|
|
3405
3405
|
if (a) {
|
|
3406
3406
|
let e = await this.gitRepo.getStatus(t);
|
|
3407
3407
|
o = e.branch;
|
|
@@ -3476,7 +3476,7 @@ var Ke = /* @__PURE__ */ te({ DefaultRecoveryManager: () => qe }), qe = class {
|
|
|
3476
3476
|
error: `Checkpoint not found: ${e}`
|
|
3477
3477
|
};
|
|
3478
3478
|
}
|
|
3479
|
-
let i = await
|
|
3479
|
+
let i = await H(r, t.cwd, this.gitRepo);
|
|
3480
3480
|
if (!i.safe) return this.lastRecord = {
|
|
3481
3481
|
checkpointId: e,
|
|
3482
3482
|
startedAt: n,
|
|
@@ -3511,7 +3511,7 @@ var Ke = /* @__PURE__ */ te({ DefaultRecoveryManager: () => qe }), qe = class {
|
|
|
3511
3511
|
conflicts: [],
|
|
3512
3512
|
error: "Recovery requires explicit user approval."
|
|
3513
3513
|
};
|
|
3514
|
-
let a = await
|
|
3514
|
+
let a = await U(i.affectedFiles, t.cwd, e);
|
|
3515
3515
|
try {
|
|
3516
3516
|
let o = await this.gitRepo.isRepository(t.cwd);
|
|
3517
3517
|
if (!o) throw Error("Automatic file recovery requires a Git repository.");
|
|
@@ -3532,7 +3532,7 @@ var Ke = /* @__PURE__ */ te({ DefaultRecoveryManager: () => qe }), qe = class {
|
|
|
3532
3532
|
if (e.exitCode !== 0) throw Error(`Failed to checkout file ${n}: ${e.stderr}`);
|
|
3533
3533
|
}
|
|
3534
3534
|
}
|
|
3535
|
-
o && (c = await this.gitRepo.getStatus(t.cwd)), await
|
|
3535
|
+
o && (c = await this.gitRepo.getStatus(t.cwd)), await W(a);
|
|
3536
3536
|
try {
|
|
3537
3537
|
await this.store.save({
|
|
3538
3538
|
...r,
|
|
@@ -3557,7 +3557,7 @@ var Ke = /* @__PURE__ */ te({ DefaultRecoveryManager: () => qe }), qe = class {
|
|
|
3557
3557
|
};
|
|
3558
3558
|
} catch (r) {
|
|
3559
3559
|
let o = r instanceof Error ? r.message : String(r);
|
|
3560
|
-
return await
|
|
3560
|
+
return await Ye(a, t.cwd), await W(a), this.lastRecord = {
|
|
3561
3561
|
checkpointId: e,
|
|
3562
3562
|
startedAt: n,
|
|
3563
3563
|
completedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -3577,12 +3577,12 @@ var Ke = /* @__PURE__ */ te({ DefaultRecoveryManager: () => qe }), qe = class {
|
|
|
3577
3577
|
};
|
|
3578
3578
|
}
|
|
3579
3579
|
}
|
|
3580
|
-
},
|
|
3580
|
+
}, K = {
|
|
3581
3581
|
low: 1,
|
|
3582
3582
|
normal: 2,
|
|
3583
3583
|
elevated: 3,
|
|
3584
3584
|
critical: 4
|
|
3585
|
-
},
|
|
3585
|
+
}, Qe = /* @__PURE__ */ "package.json,package-lock.json,npm-shrinkwrap.json,pnpm-lock.yaml,yarn.lock,bun.lockb,tsconfig.json,tsconfig.node.json,tsconfig.app.json,vite.config.ts,vite.config.js,vite.config.mjs,next.config.js,next.config.mjs,next.config.ts,webpack.config.js,webpack.config.ts,rollup.config.js,rollup.config.ts,eslint.config.js,eslint.config.mjs,eslint.config.ts,.eslintrc.json,.eslintrc.js,.eslintrc.cjs,.eslintrc.yaml,.eslintrc.yml,.prettierrc,.prettierrc.json,.prettierrc.js,babel.config.js,babel.config.json,jest.config.js,jest.config.ts,vitest.config.ts,vitest.config.js".split(","), q = /* @__PURE__ */ new Set([
|
|
3586
3586
|
"read_file",
|
|
3587
3587
|
"list_directory",
|
|
3588
3588
|
"search_files",
|
|
@@ -3590,7 +3590,7 @@ var Ke = /* @__PURE__ */ te({ DefaultRecoveryManager: () => qe }), qe = class {
|
|
|
3590
3590
|
"list",
|
|
3591
3591
|
"search",
|
|
3592
3592
|
"inspect"
|
|
3593
|
-
]),
|
|
3593
|
+
]), $e = /* @__PURE__ */ new Set([
|
|
3594
3594
|
"delete",
|
|
3595
3595
|
"delete_file",
|
|
3596
3596
|
"remove",
|
|
@@ -3599,27 +3599,27 @@ var Ke = /* @__PURE__ */ te({ DefaultRecoveryManager: () => qe }), qe = class {
|
|
|
3599
3599
|
"destroy",
|
|
3600
3600
|
"purge",
|
|
3601
3601
|
"wipe"
|
|
3602
|
-
]),
|
|
3602
|
+
]), et = /* @__PURE__ */ new Set([
|
|
3603
3603
|
"recovery",
|
|
3604
3604
|
"restore",
|
|
3605
3605
|
"rollback",
|
|
3606
3606
|
"recover_checkpoint",
|
|
3607
3607
|
"restore_checkpoint"
|
|
3608
3608
|
]);
|
|
3609
|
-
function
|
|
3609
|
+
function tt(e) {
|
|
3610
3610
|
let t = s.basename(e.replace(/\\/g, "/")).toLowerCase();
|
|
3611
|
-
return !!(
|
|
3611
|
+
return !!(Qe.includes(t) || t.startsWith("tsconfig.") || t.startsWith("vite.config.") || t.startsWith("next.config.") || t.startsWith("webpack.config.") || t.startsWith("eslint.config.") || t.startsWith(".eslintrc") || t.startsWith(".prettierrc"));
|
|
3612
3612
|
}
|
|
3613
|
-
var
|
|
3613
|
+
var nt = class {
|
|
3614
3614
|
assess(e) {
|
|
3615
|
-
let t = "low", n = [], r = (e, r) => (r && !n.includes(r) && n.push(r),
|
|
3615
|
+
let t = "low", n = [], r = (e, r) => (r && !n.includes(r) && n.push(r), K[e] > K[t] ? e : t), i = e.affectedFiles ? e.affectedFiles.length : 0;
|
|
3616
3616
|
if (i > 10 ? t = r("elevated", `Large workspace modification (${i} files)`) : i >= 4 ? t = r("elevated", `${i} files may be modified`) : i >= 1 && (t = r("normal", `${i} file${i === 1 ? "" : "s"} modified`)), e.affectedFiles && e.affectedFiles.length > 0) for (let n of e.affectedFiles) {
|
|
3617
3617
|
let e = n.replace(/\\/g, "/");
|
|
3618
|
-
|
|
3618
|
+
M(e) ? t = r("critical", `Protected/sensitive file involved: ${s.basename(e)}`) : tt(e) && (t = r("elevated", `Configuration or dependency file will change: ${s.basename(e)}`));
|
|
3619
3619
|
}
|
|
3620
3620
|
if (e.operations && e.operations.length > 0) for (let n of e.operations) {
|
|
3621
3621
|
let e = n.toLowerCase();
|
|
3622
|
-
|
|
3622
|
+
et.has(e) ? t = r("critical", "Recovery operation requested") : $e.has(e) ? t = r("critical", `Destructive operation requested: ${n}`) : e === "write_file" || e === "edit_file" || e === "write" || e === "edit" || e === "execute_command" || e === "exec" ? t = r("normal") : q.has(e) || (t = r("normal"));
|
|
3623
3623
|
}
|
|
3624
3624
|
if (e.userMessage) {
|
|
3625
3625
|
let n = e.userMessage.toLowerCase();
|
|
@@ -3636,10 +3636,10 @@ var et = class {
|
|
|
3636
3636
|
};
|
|
3637
3637
|
//#endregion
|
|
3638
3638
|
//#region ../../packages/agent/src/run/stateMachine.ts
|
|
3639
|
-
function
|
|
3639
|
+
function rt() {
|
|
3640
3640
|
return `run-${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 7)}`;
|
|
3641
3641
|
}
|
|
3642
|
-
var
|
|
3642
|
+
var J = {
|
|
3643
3643
|
idle: /* @__PURE__ */ new Set(["planning", "cancelled"]),
|
|
3644
3644
|
planning: /* @__PURE__ */ new Set([
|
|
3645
3645
|
"executing",
|
|
@@ -3687,12 +3687,12 @@ var nt = {
|
|
|
3687
3687
|
completed: /* @__PURE__ */ new Set([]),
|
|
3688
3688
|
failed: /* @__PURE__ */ new Set([]),
|
|
3689
3689
|
cancelled: /* @__PURE__ */ new Set([])
|
|
3690
|
-
},
|
|
3690
|
+
}, it = class {
|
|
3691
3691
|
context;
|
|
3692
3692
|
transitions = [];
|
|
3693
3693
|
constructor(e = {}) {
|
|
3694
3694
|
this.context = {
|
|
3695
|
-
runId: e.runId ||
|
|
3695
|
+
runId: e.runId || rt(),
|
|
3696
3696
|
startedAt: Date.now(),
|
|
3697
3697
|
status: "idle",
|
|
3698
3698
|
cwd: e.cwd || process.cwd(),
|
|
@@ -3724,7 +3724,7 @@ var nt = {
|
|
|
3724
3724
|
reason: t,
|
|
3725
3725
|
error: `INVALID_STATE_TRANSITION: Run is already in terminal state '${n}' and cannot transition to '${e}'.`
|
|
3726
3726
|
};
|
|
3727
|
-
if (!
|
|
3727
|
+
if (!J[n].has(e)) return {
|
|
3728
3728
|
success: !1,
|
|
3729
3729
|
from: n,
|
|
3730
3730
|
to: e,
|
|
@@ -3766,7 +3766,7 @@ var nt = {
|
|
|
3766
3766
|
function Y(e) {
|
|
3767
3767
|
return e.replace(/(?:sk-[a-zA-Z0-9_-]{20,})/g, "[REDACTED_API_KEY]").replace(/(?:AIza[0-9A-Za-z-_]{35})/g, "[REDACTED_API_KEY]").replace(/(?:ghp_[a-zA-Z0-9]{36})/g, "[REDACTED_TOKEN]");
|
|
3768
3768
|
}
|
|
3769
|
-
var
|
|
3769
|
+
var at = class {
|
|
3770
3770
|
maxRetainedRuns;
|
|
3771
3771
|
maxEventsPerRun;
|
|
3772
3772
|
runOrder = [];
|
|
@@ -4027,7 +4027,7 @@ var it = class {
|
|
|
4027
4027
|
};
|
|
4028
4028
|
//#endregion
|
|
4029
4029
|
//#region ../../packages/agent/src/history/pathResolver.ts
|
|
4030
|
-
function
|
|
4030
|
+
function X() {
|
|
4031
4031
|
return process.env.FECODE_HISTORY_DIR ? s.resolve(process.env.FECODE_HISTORY_DIR) : s.join(m.homedir(), ".fecode", "history");
|
|
4032
4032
|
}
|
|
4033
4033
|
//#endregion
|
|
@@ -4092,7 +4092,7 @@ var dt = class {
|
|
|
4092
4092
|
maxRuns;
|
|
4093
4093
|
maxSizeBytes;
|
|
4094
4094
|
constructor(e = {}) {
|
|
4095
|
-
this.storageDir = e.storageDir ||
|
|
4095
|
+
this.storageDir = e.storageDir || X(), this.maxRuns = e.maxRuns ?? 100, this.maxSizeBytes = e.maxSizeBytes ?? 52428800;
|
|
4096
4096
|
}
|
|
4097
4097
|
getStorageDir() {
|
|
4098
4098
|
return this.storageDir;
|
|
@@ -4602,7 +4602,7 @@ function vt(e) {
|
|
|
4602
4602
|
replanReason: e.replanReason
|
|
4603
4603
|
};
|
|
4604
4604
|
}
|
|
4605
|
-
function
|
|
4605
|
+
function Z(e, t, n) {
|
|
4606
4606
|
if (e.status === t) return e;
|
|
4607
4607
|
let r = gt[e.status];
|
|
4608
4608
|
if (!r || !r.includes(t)) throw Error(`Invalid plan status transition from "${e.status}" to "${t}".`);
|
|
@@ -4702,7 +4702,7 @@ function Ct(e) {
|
|
|
4702
4702
|
return [...e.steps].sort((e, t) => e.order - t.order).find((e) => e.status !== "completed");
|
|
4703
4703
|
}
|
|
4704
4704
|
function wt(e) {
|
|
4705
|
-
let t =
|
|
4705
|
+
let t = Z(e, "executing"), n = t.steps.map((e) => e.status === "failed" || e.status === "in_progress" || e.status === "skipped" ? {
|
|
4706
4706
|
...e,
|
|
4707
4707
|
status: "pending",
|
|
4708
4708
|
error: void 0
|
|
@@ -5704,7 +5704,7 @@ var Lt = class {
|
|
|
5704
5704
|
}, Error(n);
|
|
5705
5705
|
}
|
|
5706
5706
|
let a;
|
|
5707
|
-
a = e.status === "blocked" ? wt(e) : e.status === "approved" ?
|
|
5707
|
+
a = e.status === "blocked" ? wt(e) : e.status === "approved" ? Z(e, "executing") : e, i && (a = {
|
|
5708
5708
|
...a,
|
|
5709
5709
|
steps: a.steps.map((e) => e.status === "completed" ? e : {
|
|
5710
5710
|
...e,
|
|
@@ -5805,7 +5805,7 @@ var Lt = class {
|
|
|
5805
5805
|
timestamp: Date.now()
|
|
5806
5806
|
});
|
|
5807
5807
|
let o = this.feedbackManager.assessPlanAdaptation(a);
|
|
5808
|
-
a =
|
|
5808
|
+
a = Z(a, "blocked", n), this.options.diagnosticsManager && (this.options.diagnosticsManager.recordPlan(t.runId, a), this.options.diagnosticsManager.recordPlanAdaptation(t.runId, n, o.affectedSteps)), yield {
|
|
5809
5809
|
type: "plan_adaptation_required",
|
|
5810
5810
|
runId: t.runId,
|
|
5811
5811
|
planId: a.planId,
|
|
@@ -6023,7 +6023,7 @@ var Lt = class {
|
|
|
6023
6023
|
timestamp: Date.now()
|
|
6024
6024
|
}, this.options.diagnosticsManager && this.options.diagnosticsManager.updatePlanStep(t.runId, e.stepId, "failed", u);
|
|
6025
6025
|
let r = this.feedbackManager.assessPlanAdaptation(a);
|
|
6026
|
-
a =
|
|
6026
|
+
a = Z(a, "blocked", u), this.options.diagnosticsManager && (this.options.diagnosticsManager.recordPlan(t.runId, a), this.options.diagnosticsManager.recordPlanAdaptation(t.runId, u, r.affectedSteps)), yield {
|
|
6027
6027
|
type: "plan_adaptation_required",
|
|
6028
6028
|
runId: t.runId,
|
|
6029
6029
|
planId: a.planId,
|
|
@@ -6045,7 +6045,7 @@ var Lt = class {
|
|
|
6045
6045
|
}
|
|
6046
6046
|
let m = Date.now() - r, h = a.steps.filter((e) => e.status === "completed").length;
|
|
6047
6047
|
if (d) {
|
|
6048
|
-
a =
|
|
6048
|
+
a = Z(a, "cancelled"), this.options.diagnosticsManager && this.options.diagnosticsManager.recordPlan(t.runId, a), yield {
|
|
6049
6049
|
type: "plan_execution_cancelled",
|
|
6050
6050
|
runId: t.runId,
|
|
6051
6051
|
planId: a.planId,
|
|
@@ -6056,7 +6056,7 @@ var Lt = class {
|
|
|
6056
6056
|
}
|
|
6057
6057
|
if (a.status !== "blocked") {
|
|
6058
6058
|
if (c) {
|
|
6059
|
-
a =
|
|
6059
|
+
a = Z(a, "failed"), this.options.diagnosticsManager && this.options.diagnosticsManager.recordPlan(t.runId, a), yield {
|
|
6060
6060
|
type: "plan_execution_failed",
|
|
6061
6061
|
runId: t.runId,
|
|
6062
6062
|
planId: a.planId,
|
|
@@ -6109,7 +6109,7 @@ var Lt = class {
|
|
|
6109
6109
|
timestamp: Date.now()
|
|
6110
6110
|
};
|
|
6111
6111
|
let i = this.feedbackManager.assessPlanAdaptation(a);
|
|
6112
|
-
a =
|
|
6112
|
+
a = Z(a, "blocked", n), this.options.diagnosticsManager && (this.options.diagnosticsManager.recordPlan(t.runId, a), this.options.diagnosticsManager.recordPlanAdaptation(t.runId, n, i.affectedSteps)), yield {
|
|
6113
6113
|
type: "plan_adaptation_required",
|
|
6114
6114
|
runId: t.runId,
|
|
6115
6115
|
planId: a.planId,
|
|
@@ -6133,7 +6133,7 @@ var Lt = class {
|
|
|
6133
6133
|
timestamp: Date.now()
|
|
6134
6134
|
};
|
|
6135
6135
|
}
|
|
6136
|
-
a =
|
|
6136
|
+
a = Z(a, "completed"), this.options.diagnosticsManager && this.options.diagnosticsManager.recordPlan(t.runId, a), i && (yield {
|
|
6137
6137
|
type: "execution_resume_completed",
|
|
6138
6138
|
runId: t.runId,
|
|
6139
6139
|
planId: a.planId,
|
|
@@ -6311,7 +6311,7 @@ var Lt = class {
|
|
|
6311
6311
|
status: "ready"
|
|
6312
6312
|
};
|
|
6313
6313
|
if (r) try {
|
|
6314
|
-
let e =
|
|
6314
|
+
let e = Z(r, "superseded");
|
|
6315
6315
|
this.registerPlan(e);
|
|
6316
6316
|
} catch {}
|
|
6317
6317
|
return this.registerPlan(c), this.options.diagnosticsManager && this.options.diagnosticsManager.recordPlan(e.runId, c), {
|
|
@@ -6643,7 +6643,7 @@ var Gt = class {
|
|
|
6643
6643
|
let o = [], c = [], l = [];
|
|
6644
6644
|
if (t.strategy === "cancel") {
|
|
6645
6645
|
try {
|
|
6646
|
-
|
|
6646
|
+
Z(e, "cancelled");
|
|
6647
6647
|
} catch {}
|
|
6648
6648
|
let o = Object.freeze({
|
|
6649
6649
|
recoveryId: i,
|
|
@@ -6730,10 +6730,10 @@ var Gt = class {
|
|
|
6730
6730
|
requestedBy: "user"
|
|
6731
6731
|
}), s = o.status === "created" ? "recovered" : "failed", c = e.status;
|
|
6732
6732
|
if (o.status === "created") try {
|
|
6733
|
-
e.status =
|
|
6733
|
+
e.status = Z(e, "superseded").status, c = "superseded";
|
|
6734
6734
|
} catch {}
|
|
6735
6735
|
else try {
|
|
6736
|
-
e.status =
|
|
6736
|
+
e.status = Z(e, "failed").status, c = "failed";
|
|
6737
6737
|
} catch {}
|
|
6738
6738
|
let l = Object.freeze({
|
|
6739
6739
|
recoveryId: i,
|
|
@@ -6899,23 +6899,23 @@ var Gt = class {
|
|
|
6899
6899
|
let g = e.status;
|
|
6900
6900
|
if (m === "recovered" || m === "recovered_with_changes") {
|
|
6901
6901
|
if (e.steps.every((e) => e.status === "completed" || e.status === "skipped")) try {
|
|
6902
|
-
e.status =
|
|
6902
|
+
e.status = Z(e, "completed").status, g = "completed";
|
|
6903
6903
|
} catch {}
|
|
6904
6904
|
else try {
|
|
6905
|
-
e.status =
|
|
6905
|
+
e.status = Z(e, "executing").status, g = "executing";
|
|
6906
6906
|
} catch {}
|
|
6907
6907
|
} else if (m === "still_blocked") try {
|
|
6908
|
-
e.status !== "blocked" && (e.status =
|
|
6908
|
+
e.status !== "blocked" && (e.status = Z(e, "blocked").status), g = "blocked";
|
|
6909
6909
|
} catch {
|
|
6910
6910
|
g = e.status;
|
|
6911
6911
|
}
|
|
6912
6912
|
else if (m === "cancelled") try {
|
|
6913
|
-
e.status =
|
|
6913
|
+
e.status = Z(e, "cancelled").status, g = "cancelled";
|
|
6914
6914
|
} catch {
|
|
6915
6915
|
g = e.status;
|
|
6916
6916
|
}
|
|
6917
6917
|
else if (m === "failed") try {
|
|
6918
|
-
e.status =
|
|
6918
|
+
e.status = Z(e, "failed").status, g = "failed";
|
|
6919
6919
|
} catch {
|
|
6920
6920
|
g = e.status;
|
|
6921
6921
|
}
|
|
@@ -7069,7 +7069,7 @@ var qt = class {
|
|
|
7069
7069
|
};
|
|
7070
7070
|
if (a.length === 0) {
|
|
7071
7071
|
if (e.status !== "completed") try {
|
|
7072
|
-
e.status =
|
|
7072
|
+
e.status = Z(e, "completed").status;
|
|
7073
7073
|
} catch {}
|
|
7074
7074
|
return {
|
|
7075
7075
|
eligible: !1,
|
|
@@ -7184,7 +7184,7 @@ var qt = class {
|
|
|
7184
7184
|
let s = e.status;
|
|
7185
7185
|
try {
|
|
7186
7186
|
if (e.status === "executing") {
|
|
7187
|
-
let t =
|
|
7187
|
+
let t = Z(e, "cancelled");
|
|
7188
7188
|
e.status = t.status, s = t.status;
|
|
7189
7189
|
}
|
|
7190
7190
|
} catch {
|
|
@@ -7257,7 +7257,7 @@ var qt = class {
|
|
|
7257
7257
|
requestedBy: "user"
|
|
7258
7258
|
}), c = e.status;
|
|
7259
7259
|
if (s.status === "created") try {
|
|
7260
|
-
e.status =
|
|
7260
|
+
e.status = Z(e, "superseded").status, c = "superseded";
|
|
7261
7261
|
} catch {}
|
|
7262
7262
|
let l = Object.freeze({
|
|
7263
7263
|
continuationId: r,
|
|
@@ -7341,7 +7341,7 @@ var qt = class {
|
|
|
7341
7341
|
}
|
|
7342
7342
|
if (!s.consistent) {
|
|
7343
7343
|
try {
|
|
7344
|
-
e.status !== "blocked" && (e.status =
|
|
7344
|
+
e.status !== "blocked" && (e.status = Z(e, "blocked").status);
|
|
7345
7345
|
} catch {}
|
|
7346
7346
|
let n = Object.freeze({
|
|
7347
7347
|
continuationId: r,
|
|
@@ -7384,7 +7384,7 @@ var qt = class {
|
|
|
7384
7384
|
} catch {}
|
|
7385
7385
|
if (c && c.stale) {
|
|
7386
7386
|
try {
|
|
7387
|
-
e.status !== "blocked" && (e.status =
|
|
7387
|
+
e.status !== "blocked" && (e.status = Z(e, "blocked").status);
|
|
7388
7388
|
} catch {}
|
|
7389
7389
|
let n = Object.freeze({
|
|
7390
7390
|
continuationId: r,
|
|
@@ -7415,7 +7415,7 @@ var qt = class {
|
|
|
7415
7415
|
return;
|
|
7416
7416
|
}
|
|
7417
7417
|
try {
|
|
7418
|
-
(e.status === "blocked" || e.status === "approved" || e.status === "failed") && (e.status =
|
|
7418
|
+
(e.status === "blocked" || e.status === "approved" || e.status === "failed") && (e.status = Z(e, "executing").status);
|
|
7419
7419
|
} catch {}
|
|
7420
7420
|
let l = new Set(t.remainingSteps.map((e) => e.stepId));
|
|
7421
7421
|
e.steps = e.steps.map((e) => l.has(e.stepId) && e.status !== "completed" ? {
|
|
@@ -7572,9 +7572,9 @@ var qt = class {
|
|
|
7572
7572
|
recoveryContinuationManager;
|
|
7573
7573
|
handoffManager;
|
|
7574
7574
|
maxReplanDepth;
|
|
7575
|
-
completionTracker = new
|
|
7576
|
-
safeEditValidator = new
|
|
7577
|
-
commandPolicy = new
|
|
7575
|
+
completionTracker = new He();
|
|
7576
|
+
safeEditValidator = new N();
|
|
7577
|
+
commandPolicy = new Te();
|
|
7578
7578
|
currentRunStateMachine;
|
|
7579
7579
|
currentParentRunId;
|
|
7580
7580
|
currentResumeDepth;
|
|
@@ -7586,7 +7586,7 @@ var qt = class {
|
|
|
7586
7586
|
lastToolCallKey = null;
|
|
7587
7587
|
consecutiveToolCallCount = 0;
|
|
7588
7588
|
constructor(e, t = {}) {
|
|
7589
|
-
this.modelProvider = e, this.systemPrompt = t.systemPrompt ||
|
|
7589
|
+
this.modelProvider = e, this.systemPrompt = t.systemPrompt || ce, this.registry = t.registry || new E(), this.executor = t.executor || new D(this.registry), this.permissionManager = t.permissionManager || new se(), this.approvalResolver = t.approvalResolver, this.maxVerificationAttempts = t.maxVerificationAttempts ?? 3, this.maxIdenticalToolCalls = t.maxIdenticalToolCalls ?? 3, this.maxTurns = t.maxTurns ?? 50, this.emitRunEvents = t.emitRunEvents ?? !1, this.projectContext = t.projectContext, this.skillRegistry = t.skillRegistry, this.activationPolicy = t.activationPolicy, this.tokenOptimizer = t.tokenOptimizer || new pe(), this.policyRegistry = t.policyRegistry || new he(), this.repositoryExplorer = t.repositoryExplorer, this.codeContextSelector = t.codeContextSelector, this.executionStrategy = t.executionStrategy || new Ie(), this.gitRepository = t.gitRepository || new ke(), this.checkpointManager = t.checkpointManager || new qe(t.checkpointStore, this.gitRepository), this.recoveryManager = t.recoveryManager || new Ze(t.checkpointStore, this.gitRepository), this.executionPolicy = t.executionPolicy || new nt(), this.diagnosticsManager = t.diagnosticsManager || new at({ maxRetainedRuns: t.maxRetainedRuns }), this.historyStore = t.historyStore || new dt({ storageDir: t.historyStorageDir }), this.planner = t.planner || new Dt(), this.feedbackManager = t.feedbackManager || new jt(), this.retryPolicy = t.retryPolicy || new Nt(), this.decisionManager = t.decisionManager || new Vt(), this.reconciler = t.reconciler || new Pt(), this.reconciliationPolicy = t.reconciliationPolicy || { required: !0 }, this.handoffManager = t.handoffManager || new Lt({
|
|
7590
7590
|
registry: this.registry,
|
|
7591
7591
|
executor: this.executor,
|
|
7592
7592
|
permissionManager: this.permissionManager,
|
|
@@ -7879,7 +7879,7 @@ var qt = class {
|
|
|
7879
7879
|
return this.approvalResolver;
|
|
7880
7880
|
}
|
|
7881
7881
|
getProductRuntime(e) {
|
|
7882
|
-
return new
|
|
7882
|
+
return new Pe({
|
|
7883
7883
|
agentRuntime: this,
|
|
7884
7884
|
gitRepository: this.gitRepository,
|
|
7885
7885
|
approvalResolver: this.approvalResolver,
|
|
@@ -7976,7 +7976,7 @@ var qt = class {
|
|
|
7976
7976
|
}
|
|
7977
7977
|
async *run(e) {
|
|
7978
7978
|
e.sessionId && this.state.messages.length === 0 && (this.state.sessionId = e.sessionId), this.currentParentRunId = e.parentRunId, this.currentResumeDepth = e.resumeDepth, this.state.status = "running", this.activeController = new AbortController(), this.completionTracker.reset(), this.completionTracker.setRequest(e.message), this.lastToolCallKey = null, this.consecutiveToolCallCount = 0, this.state.verificationAttempts = 0;
|
|
7979
|
-
let t = new
|
|
7979
|
+
let t = new it({
|
|
7980
7980
|
cwd: e.cwd,
|
|
7981
7981
|
maxVerificationAttempts: this.maxVerificationAttempts
|
|
7982
7982
|
});
|
|
@@ -8078,7 +8078,7 @@ var qt = class {
|
|
|
8078
8078
|
t.skills.length > 0 && (yield {
|
|
8079
8079
|
type: "skills_activated",
|
|
8080
8080
|
skills: t.skills.map((e) => e.name)
|
|
8081
|
-
}), u =
|
|
8081
|
+
}), u = fe({
|
|
8082
8082
|
baseSystemPrompt: this.systemPrompt,
|
|
8083
8083
|
policies: l,
|
|
8084
8084
|
projectContext: this.projectContext,
|
|
@@ -8088,7 +8088,7 @@ var qt = class {
|
|
|
8088
8088
|
codeContext: c,
|
|
8089
8089
|
strategyGuidance: o.guidance
|
|
8090
8090
|
});
|
|
8091
|
-
} else u =
|
|
8091
|
+
} else u = fe({
|
|
8092
8092
|
baseSystemPrompt: this.systemPrompt,
|
|
8093
8093
|
policies: l,
|
|
8094
8094
|
projectContext: this.projectContext,
|
|
@@ -8105,7 +8105,7 @@ var qt = class {
|
|
|
8105
8105
|
name: e.name,
|
|
8106
8106
|
description: e.description,
|
|
8107
8107
|
inputSchema: e.inputSchema
|
|
8108
|
-
})), r = this.modelProvider.capabilities.maxContextTokens || 32768, i = k(u), a = Math.max(2048, r - 2048 - i), o =
|
|
8108
|
+
})), r = this.modelProvider.capabilities.maxContextTokens || 32768, i = k(u), a = Math.max(2048, r - 2048 - i), o = R(this.state.messages, a), s = {
|
|
8109
8109
|
system: u,
|
|
8110
8110
|
messages: o,
|
|
8111
8111
|
tools: t.length ? t : void 0
|
|
@@ -8175,7 +8175,7 @@ var qt = class {
|
|
|
8175
8175
|
if (await this.gitRepository.isRepository(e.cwd)) {
|
|
8176
8176
|
let t = await this.gitRepository.getSnapshot(e.cwd);
|
|
8177
8177
|
this.completionTracker.setPostTaskSnapshot(t);
|
|
8178
|
-
let n = this.completionTracker.getBaselineSnapshot() || null, r = this.completionTracker.getSummary(), i =
|
|
8178
|
+
let n = this.completionTracker.getBaselineSnapshot() || null, r = this.completionTracker.getSummary(), i = Ue(n, t, r.changeSet ? r.changeSet.files.map((e) => e.path) : r.completedFiles);
|
|
8179
8179
|
this.completionTracker.setGitAttribution(i);
|
|
8180
8180
|
}
|
|
8181
8181
|
} catch {}
|
|
@@ -8289,7 +8289,7 @@ var qt = class {
|
|
|
8289
8289
|
error: t.error
|
|
8290
8290
|
};
|
|
8291
8291
|
else {
|
|
8292
|
-
let e =
|
|
8292
|
+
let e = xe(t.diff);
|
|
8293
8293
|
e.additions === 0 && e.deletions === 0 ? (n = !0, s = {
|
|
8294
8294
|
success: !0,
|
|
8295
8295
|
output: {
|
|
@@ -8299,7 +8299,7 @@ var qt = class {
|
|
|
8299
8299
|
changed: !1,
|
|
8300
8300
|
reason: "NO_CHANGE"
|
|
8301
8301
|
}
|
|
8302
|
-
}) : r =
|
|
8302
|
+
}) : r = F([{
|
|
8303
8303
|
path: t.displayPath,
|
|
8304
8304
|
operation: "modified",
|
|
8305
8305
|
additions: e.additions,
|
|
@@ -8326,8 +8326,8 @@ var qt = class {
|
|
|
8326
8326
|
}
|
|
8327
8327
|
};
|
|
8328
8328
|
else {
|
|
8329
|
-
let e =
|
|
8330
|
-
r =
|
|
8329
|
+
let e = xe(i.diff), t = i.originalContent === "";
|
|
8330
|
+
r = F([{
|
|
8331
8331
|
path: i.displayPath,
|
|
8332
8332
|
operation: t ? "added" : "modified",
|
|
8333
8333
|
additions: e.additions,
|
|
@@ -8426,7 +8426,7 @@ var qt = class {
|
|
|
8426
8426
|
this.lastToolCallKey = null, this.consecutiveToolCallCount = 0;
|
|
8427
8427
|
let e = t.arguments?.path, r = s.output;
|
|
8428
8428
|
if (e && r?.changed !== !1) {
|
|
8429
|
-
let i =
|
|
8429
|
+
let i = xe(r?.diff || ""), a = t.name === "write_file" && r?.created ? "added" : "modified";
|
|
8430
8430
|
this.completionTracker.recordFileChange({
|
|
8431
8431
|
path: e,
|
|
8432
8432
|
operation: a,
|
|
@@ -8482,13 +8482,13 @@ var qt = class {
|
|
|
8482
8482
|
if (this.activeController = null, this.currentPlan) {
|
|
8483
8483
|
let e = this.currentRunStateMachine?.getState();
|
|
8484
8484
|
if (e === "completed" && this.currentPlan.status !== "completed") try {
|
|
8485
|
-
this.currentPlan =
|
|
8485
|
+
this.currentPlan = Z(this.currentPlan, "completed");
|
|
8486
8486
|
} catch {}
|
|
8487
8487
|
else if ((e === "cancelled" || this.state.status === "cancelled") && this.currentPlan.status !== "cancelled") try {
|
|
8488
|
-
this.currentPlan =
|
|
8488
|
+
this.currentPlan = Z(this.currentPlan, "cancelled");
|
|
8489
8489
|
} catch {}
|
|
8490
8490
|
else if (e === "failed" && this.currentPlan.status !== "failed") try {
|
|
8491
|
-
this.currentPlan =
|
|
8491
|
+
this.currentPlan = Z(this.currentPlan, "failed");
|
|
8492
8492
|
} catch {}
|
|
8493
8493
|
this.diagnosticsManager.recordPlan(n, this.currentPlan);
|
|
8494
8494
|
}
|
|
@@ -8501,10 +8501,10 @@ var qt = class {
|
|
|
8501
8501
|
async cancel() {
|
|
8502
8502
|
if (this.completionTracker.recordCancelled(), this.state.activePlan && this.state.activePlan.status === "in_progress") {
|
|
8503
8503
|
let e = this.state.activePlan.currentStep ?? 0;
|
|
8504
|
-
this.state.activePlan =
|
|
8504
|
+
this.state.activePlan = ge(this.state.activePlan, e, "Cancelled");
|
|
8505
8505
|
}
|
|
8506
8506
|
if (this.currentPlan && this.currentPlan.status !== "cancelled" && this.currentPlan.status !== "completed") try {
|
|
8507
|
-
this.currentPlan =
|
|
8507
|
+
this.currentPlan = Z(this.currentPlan, "cancelled");
|
|
8508
8508
|
} catch {}
|
|
8509
8509
|
if (this.currentRunStateMachine && !this.currentRunStateMachine.isTerminal()) {
|
|
8510
8510
|
let e = this.currentRunStateMachine.getContext().runId;
|
|
@@ -8570,7 +8570,7 @@ var $t = class {
|
|
|
8570
8570
|
this.maxEntries = e.maxEntries ?? 500;
|
|
8571
8571
|
}
|
|
8572
8572
|
async execute(e, t) {
|
|
8573
|
-
let n =
|
|
8573
|
+
let n = A(t.cwd, e.path);
|
|
8574
8574
|
if ("error" in n) return {
|
|
8575
8575
|
success: !1,
|
|
8576
8576
|
error: n.error
|
|
@@ -8660,7 +8660,7 @@ var nn = class {
|
|
|
8660
8660
|
code: "INVALID_ARGUMENT"
|
|
8661
8661
|
}
|
|
8662
8662
|
};
|
|
8663
|
-
let n =
|
|
8663
|
+
let n = A(t.cwd, e.path);
|
|
8664
8664
|
if ("error" in n) return {
|
|
8665
8665
|
success: !1,
|
|
8666
8666
|
error: n.error
|
|
@@ -8807,7 +8807,7 @@ var on = class {
|
|
|
8807
8807
|
code: "INVALID_ARGUMENT"
|
|
8808
8808
|
}
|
|
8809
8809
|
};
|
|
8810
|
-
let n = e.query.trim(), r = n.toLowerCase(), i = e.maxResults ?? this.defaultMaxResults, a = Math.max(i * 10, 1e3), o =
|
|
8810
|
+
let n = e.query.trim(), r = n.toLowerCase(), i = e.maxResults ?? this.defaultMaxResults, a = Math.max(i * 10, 1e3), o = A(t.cwd, e.path);
|
|
8811
8811
|
if ("error" in o) return {
|
|
8812
8812
|
success: !1,
|
|
8813
8813
|
error: o.error
|
|
@@ -8977,13 +8977,13 @@ var cn = class {
|
|
|
8977
8977
|
code: "INVALID_ARGUMENT"
|
|
8978
8978
|
}
|
|
8979
8979
|
};
|
|
8980
|
-
let n =
|
|
8980
|
+
let n = A(t.cwd, e.path);
|
|
8981
8981
|
if ("error" in n) return {
|
|
8982
8982
|
success: !1,
|
|
8983
8983
|
error: n.error
|
|
8984
8984
|
};
|
|
8985
8985
|
let { targetPath: r, displayPath: i } = n;
|
|
8986
|
-
if (
|
|
8986
|
+
if (M(i)) return {
|
|
8987
8987
|
success: !1,
|
|
8988
8988
|
error: {
|
|
8989
8989
|
message: `Writing to secret files is prohibited (${i}).`,
|
|
@@ -9087,13 +9087,13 @@ var un = class {
|
|
|
9087
9087
|
code: "INVALID_ARGUMENT"
|
|
9088
9088
|
}
|
|
9089
9089
|
};
|
|
9090
|
-
let n =
|
|
9090
|
+
let n = A(t.cwd, e.path);
|
|
9091
9091
|
if ("error" in n) return {
|
|
9092
9092
|
success: !1,
|
|
9093
9093
|
error: n.error
|
|
9094
9094
|
};
|
|
9095
9095
|
let { targetPath: r, displayPath: i } = n;
|
|
9096
|
-
if (
|
|
9096
|
+
if (M(i)) return {
|
|
9097
9097
|
success: !1,
|
|
9098
9098
|
error: {
|
|
9099
9099
|
message: `Editing secret files is prohibited (${i}).`,
|
|
@@ -9118,7 +9118,7 @@ var un = class {
|
|
|
9118
9118
|
code: "NOT_A_FILE"
|
|
9119
9119
|
}
|
|
9120
9120
|
};
|
|
9121
|
-
let n = await d.readFile(r, "utf-8"), a =
|
|
9121
|
+
let n = await d.readFile(r, "utf-8"), a = _e(n);
|
|
9122
9122
|
if (e.expectedHash && a !== e.expectedHash) return {
|
|
9123
9123
|
success: !1,
|
|
9124
9124
|
error: {
|
|
@@ -9149,7 +9149,7 @@ var un = class {
|
|
|
9149
9149
|
code: "FILE_TOO_LARGE"
|
|
9150
9150
|
}
|
|
9151
9151
|
};
|
|
9152
|
-
let l =
|
|
9152
|
+
let l = j(i, n, s);
|
|
9153
9153
|
return this.onPreWrite && await this.onPreWrite(), ln(await d.readFile(r, "utf-8"), e.oldText) === 1 ? (await sn(r, s, t.signal), {
|
|
9154
9154
|
success: !0,
|
|
9155
9155
|
output: {
|
|
@@ -9158,7 +9158,7 @@ var un = class {
|
|
|
9158
9158
|
bytesWritten: c,
|
|
9159
9159
|
changed: !0,
|
|
9160
9160
|
diff: l,
|
|
9161
|
-
contentHash:
|
|
9161
|
+
contentHash: _e(s)
|
|
9162
9162
|
}
|
|
9163
9163
|
}) : {
|
|
9164
9164
|
success: !1,
|
|
@@ -9203,7 +9203,7 @@ var un = class {
|
|
|
9203
9203
|
required: ["command"]
|
|
9204
9204
|
};
|
|
9205
9205
|
executor;
|
|
9206
|
-
constructor(e = new
|
|
9206
|
+
constructor(e = new Oe()) {
|
|
9207
9207
|
this.executor = e;
|
|
9208
9208
|
}
|
|
9209
9209
|
async execute(e, t) {
|
|
@@ -9234,12 +9234,12 @@ var un = class {
|
|
|
9234
9234
|
//#endregion
|
|
9235
9235
|
//#region ../../packages/agent/src/tools/defaultRegistry.ts
|
|
9236
9236
|
function fn() {
|
|
9237
|
-
let e = new
|
|
9237
|
+
let e = new E();
|
|
9238
9238
|
return e.register(new $t()), e.register(new nn()), e.register(new on()), e.register(new cn()), e.register(new un()), e.register(new dn()), e;
|
|
9239
9239
|
}
|
|
9240
9240
|
//#endregion
|
|
9241
9241
|
//#region ../../packages/agent/src/project/intelligence.ts
|
|
9242
|
-
async function
|
|
9242
|
+
async function Q(e) {
|
|
9243
9243
|
try {
|
|
9244
9244
|
return (await d.stat(e)).isFile();
|
|
9245
9245
|
} catch {
|
|
@@ -9268,7 +9268,7 @@ var mn = class {
|
|
|
9268
9268
|
}
|
|
9269
9269
|
async inspect(e) {
|
|
9270
9270
|
let t = s.resolve(e), n, r = s.join(t, "package.json");
|
|
9271
|
-
if (await
|
|
9271
|
+
if (await Q(r)) try {
|
|
9272
9272
|
let e = await d.readFile(r, "utf-8");
|
|
9273
9273
|
n = JSON.parse(e);
|
|
9274
9274
|
} catch {}
|
|
@@ -9299,7 +9299,7 @@ var mn = class {
|
|
|
9299
9299
|
if (e.startsWith("bun")) return "bun";
|
|
9300
9300
|
if (e.startsWith("npm")) return "npm";
|
|
9301
9301
|
}
|
|
9302
|
-
return await
|
|
9302
|
+
return await Q(s.join(e, "pnpm-lock.yaml")) ? "pnpm" : await Q(s.join(e, "yarn.lock")) ? "yarn" : await Q(s.join(e, "bun.lockb")) || await Q(s.join(e, "bun.lock")) ? "bun" : await Q(s.join(e, "package-lock.json")) ? "npm" : null;
|
|
9303
9303
|
}
|
|
9304
9304
|
detectFrameworks(e) {
|
|
9305
9305
|
let t = {
|
|
@@ -9317,7 +9317,7 @@ var mn = class {
|
|
|
9317
9317
|
...t?.dependencies || {},
|
|
9318
9318
|
...t?.devDependencies || {}
|
|
9319
9319
|
};
|
|
9320
|
-
return (n.some((e) => e.startsWith("tsconfig")) || "typescript" in i) && r.add("TypeScript"), (t || n.some((e) => e.endsWith(".js") || e.endsWith(".mjs") || e.endsWith(".cjs"))) && r.add("JavaScript"), ("tailwindcss" in i || "postcss" in i || n.some((e) => e.startsWith("tailwind.") || e.startsWith("postcss."))) && r.add("CSS"), ("sass" in i || "node-sass" in i) && r.add("SCSS"), (await
|
|
9320
|
+
return (n.some((e) => e.startsWith("tsconfig")) || "typescript" in i) && r.add("TypeScript"), (t || n.some((e) => e.endsWith(".js") || e.endsWith(".mjs") || e.endsWith(".cjs"))) && r.add("JavaScript"), ("tailwindcss" in i || "postcss" in i || n.some((e) => e.startsWith("tailwind.") || e.startsWith("postcss."))) && r.add("CSS"), ("sass" in i || "node-sass" in i) && r.add("SCSS"), (await Q(s.join(e, "index.html")) || await Q(s.join(e, "public/index.html"))) && r.add("HTML"), r.size === 0 && r.add("JavaScript"), Array.from(r);
|
|
9321
9321
|
}
|
|
9322
9322
|
detectBuildTools(e, t = []) {
|
|
9323
9323
|
let n = /* @__PURE__ */ new Set(), r = {
|
|
@@ -9348,7 +9348,7 @@ var mn = class {
|
|
|
9348
9348
|
return ("prettier" in r || t.some((e) => e.startsWith("prettier.config.") || e.startsWith(".prettierrc"))) && n.add("Prettier"), ("@biomejs/biome" in r || t.includes("biome.json")) && n.add("Biome"), Array.from(n);
|
|
9349
9349
|
}
|
|
9350
9350
|
async detectWorkspaces(e, t) {
|
|
9351
|
-
if (await
|
|
9351
|
+
if (await Q(s.join(e, "pnpm-workspace.yaml"))) return {
|
|
9352
9352
|
isMonorepo: !0,
|
|
9353
9353
|
type: "pnpm"
|
|
9354
9354
|
};
|
|
@@ -9356,15 +9356,15 @@ var mn = class {
|
|
|
9356
9356
|
let n = Array.isArray(t.workspaces) ? t.workspaces : t.workspaces.packages || [];
|
|
9357
9357
|
return {
|
|
9358
9358
|
isMonorepo: !0,
|
|
9359
|
-
type: await
|
|
9359
|
+
type: await Q(s.join(e, "yarn.lock")) ? "yarn" : "npm",
|
|
9360
9360
|
packages: n.sort()
|
|
9361
9361
|
};
|
|
9362
9362
|
}
|
|
9363
|
-
if (await
|
|
9363
|
+
if (await Q(s.join(e, "turbo.json"))) return {
|
|
9364
9364
|
isMonorepo: !0,
|
|
9365
9365
|
type: "turborepo"
|
|
9366
9366
|
};
|
|
9367
|
-
if (await
|
|
9367
|
+
if (await Q(s.join(e, "lerna.json"))) return {
|
|
9368
9368
|
isMonorepo: !0,
|
|
9369
9369
|
type: "lerna"
|
|
9370
9370
|
};
|
|
@@ -9394,7 +9394,7 @@ var mn = class {
|
|
|
9394
9394
|
}
|
|
9395
9395
|
async detectConfigFiles(e) {
|
|
9396
9396
|
let t = /* @__PURE__ */ "package.json,tsconfig.json,tsconfig.base.json,vite.config.ts,vite.config.js,vite.config.mjs,next.config.js,next.config.mjs,next.config.ts,nuxt.config.ts,nuxt.config.js,astro.config.mjs,astro.config.ts,svelte.config.js,tailwind.config.js,tailwind.config.ts,tailwind.config.cjs,postcss.config.js,vitest.config.ts,vitest.config.js,vitest.workspace.js,vitest.workspace.ts,jest.config.js,jest.config.ts,playwright.config.ts,playwright.config.js,cypress.config.ts,cypress.config.js,eslint.config.js,.eslintrc.json,.eslintrc.js,prettier.config.js,.prettierrc,.prettierrc.json,biome.json,turbo.json,lerna.json".split(","), n = [];
|
|
9397
|
-
for (let r of t) await
|
|
9397
|
+
for (let r of t) await Q(s.join(e, r)) && n.push(r);
|
|
9398
9398
|
return n;
|
|
9399
9399
|
}
|
|
9400
9400
|
detectScripts(e) {
|
|
@@ -9421,24 +9421,24 @@ var mn = class {
|
|
|
9421
9421
|
};
|
|
9422
9422
|
//#endregion
|
|
9423
9423
|
//#region ../../packages/agent/src/project/detector.ts
|
|
9424
|
-
async function
|
|
9424
|
+
async function hn(e) {
|
|
9425
9425
|
try {
|
|
9426
9426
|
return (await d.stat(e)).isFile();
|
|
9427
9427
|
} catch {
|
|
9428
9428
|
return !1;
|
|
9429
9429
|
}
|
|
9430
9430
|
}
|
|
9431
|
-
async function
|
|
9431
|
+
async function gn(e) {
|
|
9432
9432
|
try {
|
|
9433
9433
|
return (await d.stat(e)).isDirectory();
|
|
9434
9434
|
} catch {
|
|
9435
9435
|
return !1;
|
|
9436
9436
|
}
|
|
9437
9437
|
}
|
|
9438
|
-
var
|
|
9438
|
+
var _n = class {
|
|
9439
9439
|
async detect(e) {
|
|
9440
9440
|
let t = s.resolve(e), n, r = s.join(t, "package.json");
|
|
9441
|
-
if (await
|
|
9441
|
+
if (await hn(r)) try {
|
|
9442
9442
|
let e = await d.readFile(r, "utf-8");
|
|
9443
9443
|
n = JSON.parse(e);
|
|
9444
9444
|
} catch {}
|
|
@@ -9475,10 +9475,10 @@ var gn = class {
|
|
|
9475
9475
|
};
|
|
9476
9476
|
}
|
|
9477
9477
|
async detectPackageManager(e, t) {
|
|
9478
|
-
if (await
|
|
9479
|
-
if (await
|
|
9480
|
-
if (await
|
|
9481
|
-
if (await
|
|
9478
|
+
if (await hn(s.join(e, "pnpm-lock.yaml"))) return "pnpm";
|
|
9479
|
+
if (await hn(s.join(e, "yarn.lock"))) return "yarn";
|
|
9480
|
+
if (await hn(s.join(e, "bun.lockb")) || await hn(s.join(e, "bun.lock"))) return "bun";
|
|
9481
|
+
if (await hn(s.join(e, "package-lock.json"))) return "npm";
|
|
9482
9482
|
if (t?.packageManager) {
|
|
9483
9483
|
let e = t.packageManager.toLowerCase();
|
|
9484
9484
|
if (e.startsWith("pnpm")) return "pnpm";
|
|
@@ -9489,7 +9489,7 @@ var gn = class {
|
|
|
9489
9489
|
return null;
|
|
9490
9490
|
}
|
|
9491
9491
|
async detectLanguages(e, t) {
|
|
9492
|
-
let n = await
|
|
9492
|
+
let n = await hn(s.join(e, "tsconfig.json")), r = "typescript" in {
|
|
9493
9493
|
...t?.dependencies || {},
|
|
9494
9494
|
...t?.devDependencies || {}
|
|
9495
9495
|
};
|
|
@@ -9544,7 +9544,7 @@ var gn = class {
|
|
|
9544
9544
|
}
|
|
9545
9545
|
async detectConfigFiles(e) {
|
|
9546
9546
|
let t = /* @__PURE__ */ "package.json,tsconfig.json,tsconfig.base.json,vite.config.ts,vite.config.js,vite.config.mjs,next.config.js,next.config.mjs,next.config.ts,nuxt.config.ts,nuxt.config.js,astro.config.mjs,astro.config.ts,svelte.config.js,tailwind.config.js,tailwind.config.ts,tailwind.config.cjs,postcss.config.js,vitest.config.ts,vitest.config.js,vitest.workspace.js,vitest.workspace.ts,jest.config.js,jest.config.ts,playwright.config.ts,playwright.config.js,cypress.config.ts,cypress.config.js,eslint.config.js,.eslintrc.json,.eslintrc.js".split(","), n = [];
|
|
9547
|
-
for (let r of t) await
|
|
9547
|
+
for (let r of t) await hn(s.join(e, r)) && n.push(r);
|
|
9548
9548
|
return n;
|
|
9549
9549
|
}
|
|
9550
9550
|
async detectSourceDirectories(e) {
|
|
@@ -9607,7 +9607,7 @@ var gn = class {
|
|
|
9607
9607
|
}
|
|
9608
9608
|
async findExistingDirectories(e, t) {
|
|
9609
9609
|
let n = [];
|
|
9610
|
-
for (let r of t) await
|
|
9610
|
+
for (let r of t) await gn(s.join(e, r)) && n.push(r);
|
|
9611
9611
|
return n.sort();
|
|
9612
9612
|
}
|
|
9613
9613
|
detectScripts(e) {
|
|
@@ -9625,7 +9625,7 @@ var gn = class {
|
|
|
9625
9625
|
testing: t.filter((e) => e.startsWith("vitest.") || e.startsWith("jest.") || e.startsWith("playwright.") || e.startsWith("cypress."))
|
|
9626
9626
|
};
|
|
9627
9627
|
}
|
|
9628
|
-
},
|
|
9628
|
+
}, vn = class {
|
|
9629
9629
|
skills = /* @__PURE__ */ new Map();
|
|
9630
9630
|
register(e) {
|
|
9631
9631
|
if (!e || !e.name) throw Error("Invalid skill object.");
|
|
@@ -9640,7 +9640,7 @@ var gn = class {
|
|
|
9640
9640
|
has(e) {
|
|
9641
9641
|
return this.skills.has(e);
|
|
9642
9642
|
}
|
|
9643
|
-
},
|
|
9643
|
+
}, yn = /* @__PURE__ */ new Set([
|
|
9644
9644
|
"frontend",
|
|
9645
9645
|
"framework",
|
|
9646
9646
|
"styling",
|
|
@@ -9648,7 +9648,7 @@ var gn = class {
|
|
|
9648
9648
|
"accessibility",
|
|
9649
9649
|
"architecture"
|
|
9650
9650
|
]);
|
|
9651
|
-
function
|
|
9651
|
+
function bn(e) {
|
|
9652
9652
|
let t = e.trimStart();
|
|
9653
9653
|
if (!t.startsWith("---")) throw Error("Invalid SKILL.md: Frontmatter starting delimiter '---' not found.");
|
|
9654
9654
|
let n = t.slice(3).match(/\r?\n---\r?\n?/);
|
|
@@ -9666,7 +9666,7 @@ function yn(e) {
|
|
|
9666
9666
|
body: a
|
|
9667
9667
|
};
|
|
9668
9668
|
}
|
|
9669
|
-
function
|
|
9669
|
+
function xn(e) {
|
|
9670
9670
|
let t = [], n = e.split("\n");
|
|
9671
9671
|
for (let e of n) {
|
|
9672
9672
|
let n = e.trim();
|
|
@@ -9674,7 +9674,7 @@ function bn(e) {
|
|
|
9674
9674
|
}
|
|
9675
9675
|
return t;
|
|
9676
9676
|
}
|
|
9677
|
-
function
|
|
9677
|
+
function Sn(e) {
|
|
9678
9678
|
let t = [], n = e.split(/^###\s+/m);
|
|
9679
9679
|
for (let e of n) {
|
|
9680
9680
|
let n = e.trim();
|
|
@@ -9694,7 +9694,7 @@ function xn(e) {
|
|
|
9694
9694
|
}
|
|
9695
9695
|
return t;
|
|
9696
9696
|
}
|
|
9697
|
-
function
|
|
9697
|
+
function Cn(e) {
|
|
9698
9698
|
let t = [], n = e.split("\n");
|
|
9699
9699
|
for (let e of n) {
|
|
9700
9700
|
let n = e.trim();
|
|
@@ -9711,14 +9711,14 @@ function Sn(e) {
|
|
|
9711
9711
|
}
|
|
9712
9712
|
return t;
|
|
9713
9713
|
}
|
|
9714
|
-
function
|
|
9715
|
-
let { frontmatter: t, body: n } =
|
|
9714
|
+
function wn(e) {
|
|
9715
|
+
let { frontmatter: t, body: n } = bn(e);
|
|
9716
9716
|
if (!t.name) throw Error("Frontmatter field 'name' is required.");
|
|
9717
9717
|
if (!t.description) throw Error("Frontmatter field 'description' is required.");
|
|
9718
9718
|
if (!t.category) throw Error("Frontmatter field 'category' is required.");
|
|
9719
9719
|
if (!t.version) throw Error("Frontmatter field 'version' is required.");
|
|
9720
9720
|
let r = t.category;
|
|
9721
|
-
if (!
|
|
9721
|
+
if (!yn.has(r)) throw Error(`Invalid category '${t.category}'. Must be one of: ${Array.from(yn).join(", ")}`);
|
|
9722
9722
|
let i = [], a = [], o = [], s = [], c = [], l = [], u = [], d = [], f = {
|
|
9723
9723
|
workflow: "workflow",
|
|
9724
9724
|
"design workflow": "workflow",
|
|
@@ -9747,7 +9747,7 @@ function Cn(e) {
|
|
|
9747
9747
|
let t = e.trim();
|
|
9748
9748
|
if (!t) continue;
|
|
9749
9749
|
let n = t.indexOf("\n"), r = (n === -1 ? t : t.slice(0, n)).trim().toLowerCase(), p = n === -1 ? "" : t.slice(n + 1).trim(), m = f[r] ?? r;
|
|
9750
|
-
r === "when to use" ? i.push(...
|
|
9750
|
+
r === "when to use" ? i.push(...xn(p)) : r === "when not to use" ? a.push(...xn(p)) : r === "instructions" ? o = xn(p) : m === "workflow" ? s = xn(p) : m === "rules" ? c = xn(p) : m === "antiPatterns" ? l = xn(p) : r === "examples" ? u = Sn(p) : r === "references" && (d = Cn(p));
|
|
9751
9751
|
}
|
|
9752
9752
|
return o.length === 0 && (o = [t.description]), {
|
|
9753
9753
|
name: t.name,
|
|
@@ -9768,7 +9768,7 @@ function Cn(e) {
|
|
|
9768
9768
|
}
|
|
9769
9769
|
//#endregion
|
|
9770
9770
|
//#region ../../packages/agent/src/skills/loader.ts
|
|
9771
|
-
var
|
|
9771
|
+
var Tn = class {
|
|
9772
9772
|
getBuiltinSkillsDir() {
|
|
9773
9773
|
let e = s.dirname(g(import.meta.url)), t = s.resolve(e, "../../skills");
|
|
9774
9774
|
if (o.existsSync(t)) return t;
|
|
@@ -9780,7 +9780,7 @@ var wn = class {
|
|
|
9780
9780
|
loadSkillFromFileSync(e, t) {
|
|
9781
9781
|
let n = s.resolve(e);
|
|
9782
9782
|
if (t) {
|
|
9783
|
-
let r =
|
|
9783
|
+
let r = A(t, e);
|
|
9784
9784
|
if ("error" in r) {
|
|
9785
9785
|
let e = Error(r.error.message);
|
|
9786
9786
|
throw e.code = r.error.code, e;
|
|
@@ -9788,7 +9788,7 @@ var wn = class {
|
|
|
9788
9788
|
n = r.targetPath;
|
|
9789
9789
|
}
|
|
9790
9790
|
try {
|
|
9791
|
-
return
|
|
9791
|
+
return wn(o.readFileSync(n, "utf-8"));
|
|
9792
9792
|
} catch (t) {
|
|
9793
9793
|
throw t instanceof Error ? "code" in t && t.code === "PATH_OUT_OF_BOUNDS" ? t : Error(`Failed to load skill file '${s.basename(e)}': ${t.message}`) : Error(`Failed to load skill file '${e}': ${String(t)}`);
|
|
9794
9794
|
}
|
|
@@ -9810,7 +9810,7 @@ var wn = class {
|
|
|
9810
9810
|
async loadSkillFromFile(e, t) {
|
|
9811
9811
|
let n = s.resolve(e);
|
|
9812
9812
|
if (t) {
|
|
9813
|
-
let r =
|
|
9813
|
+
let r = A(t, e);
|
|
9814
9814
|
if ("error" in r) {
|
|
9815
9815
|
let e = Error(r.error.message);
|
|
9816
9816
|
throw e.code = r.error.code, e;
|
|
@@ -9818,7 +9818,7 @@ var wn = class {
|
|
|
9818
9818
|
n = r.targetPath;
|
|
9819
9819
|
}
|
|
9820
9820
|
try {
|
|
9821
|
-
return
|
|
9821
|
+
return wn(await d.readFile(n, "utf-8"));
|
|
9822
9822
|
} catch (t) {
|
|
9823
9823
|
throw t instanceof Error ? "code" in t && t.code === "PATH_OUT_OF_BOUNDS" ? t : Error(`Failed to load skill file '${s.basename(e)}': ${t.message}`) : Error(`Failed to load skill file '${e}': ${String(t)}`);
|
|
9824
9824
|
}
|
|
@@ -9850,7 +9850,7 @@ var wn = class {
|
|
|
9850
9850
|
}
|
|
9851
9851
|
return r.sort((e, t) => e.name.localeCompare(t.name)), r;
|
|
9852
9852
|
}
|
|
9853
|
-
},
|
|
9853
|
+
}, En = [new Tn().loadBuiltinSkillSync("frontend-design"), {
|
|
9854
9854
|
name: "typescript-frontend",
|
|
9855
9855
|
description: "Type safety, component prop contracts, event typing, and clean TypeScript architecture.",
|
|
9856
9856
|
category: "architecture",
|
|
@@ -9868,19 +9868,19 @@ var wn = class {
|
|
|
9868
9868
|
rules: ["Verify exact variable names, component prop keys, and method signatures before passing them.", "Prevent NullPointerException and ReferenceError crashes by verifying non-null states before dereferencing."],
|
|
9869
9869
|
antiPatterns: ["Avoid using unsafe 'any' assertions to bypass compiler type checks."]
|
|
9870
9870
|
}];
|
|
9871
|
-
function
|
|
9872
|
-
for (let t of
|
|
9871
|
+
function Dn(e) {
|
|
9872
|
+
for (let t of En) e.register(t);
|
|
9873
9873
|
}
|
|
9874
9874
|
//#endregion
|
|
9875
9875
|
//#region ../../packages/agent/src/skills/requestRecommender.ts
|
|
9876
|
-
var
|
|
9877
|
-
function
|
|
9876
|
+
var On = 3;
|
|
9877
|
+
function kn(e) {
|
|
9878
9878
|
return e.toLowerCase().replace(/[^\w\s]/g, " ").replace(/\s+/g, " ").trim().replace(/\bcomponents\b/g, "component").replace(/\btests\b/g, "test");
|
|
9879
9879
|
}
|
|
9880
|
-
function
|
|
9881
|
-
return new Set(
|
|
9880
|
+
function An(e) {
|
|
9881
|
+
return new Set(kn(e).split(" ").filter((e) => e.length > 0));
|
|
9882
9882
|
}
|
|
9883
|
-
var
|
|
9883
|
+
var jn = [
|
|
9884
9884
|
{
|
|
9885
9885
|
keywords: [
|
|
9886
9886
|
"build",
|
|
@@ -9980,7 +9980,7 @@ var An = [
|
|
|
9980
9980
|
skillName: "frontend-testing",
|
|
9981
9981
|
bonus: 15
|
|
9982
9982
|
}
|
|
9983
|
-
],
|
|
9983
|
+
], Mn = [
|
|
9984
9984
|
"database",
|
|
9985
9985
|
"postgres",
|
|
9986
9986
|
"postgresql",
|
|
@@ -9991,7 +9991,7 @@ var An = [
|
|
|
9991
9991
|
"worker",
|
|
9992
9992
|
"server",
|
|
9993
9993
|
"docker"
|
|
9994
|
-
],
|
|
9994
|
+
], Nn = /* @__PURE__ */ new Set([
|
|
9995
9995
|
"build",
|
|
9996
9996
|
"create",
|
|
9997
9997
|
"implement",
|
|
@@ -10007,56 +10007,56 @@ var An = [
|
|
|
10007
10007
|
"style",
|
|
10008
10008
|
"redesign"
|
|
10009
10009
|
]);
|
|
10010
|
-
function
|
|
10011
|
-
let n =
|
|
10010
|
+
function Pn(e, t) {
|
|
10011
|
+
let n = An(e);
|
|
10012
10012
|
if (n.size === 0) return 0;
|
|
10013
10013
|
let r = 0;
|
|
10014
10014
|
for (let e of n) t.has(e) && r++;
|
|
10015
10015
|
return r;
|
|
10016
10016
|
}
|
|
10017
|
-
function
|
|
10018
|
-
let n =
|
|
10017
|
+
function Fn(e, t) {
|
|
10018
|
+
let n = An(e).size;
|
|
10019
10019
|
if (n === 0) return 0;
|
|
10020
|
-
let r =
|
|
10020
|
+
let r = Pn(e, t);
|
|
10021
10021
|
return r === 0 ? 0 : r / n;
|
|
10022
10022
|
}
|
|
10023
|
-
var
|
|
10023
|
+
var In = 10, Ln = 4, Rn = 8, zn = 2, Bn = 1, Vn = -10, Hn = 4, Un = {
|
|
10024
10024
|
react: ["react"],
|
|
10025
10025
|
next: ["react", "nextjs"],
|
|
10026
10026
|
vue: ["vue"],
|
|
10027
10027
|
nuxt: ["vue"],
|
|
10028
10028
|
svelte: ["svelte"],
|
|
10029
10029
|
sveltekit: ["svelte"]
|
|
10030
|
-
},
|
|
10031
|
-
function
|
|
10032
|
-
let r = 0, i =
|
|
10030
|
+
}, Wn = /* @__PURE__ */ new Set(["framework", "styling"]);
|
|
10031
|
+
function Gn(e, t, n) {
|
|
10032
|
+
let r = 0, i = Wn.has(e.category), a = An(kn(e.name)), o = [...a].some((e) => t.has(e)), s = n?.framework && (Un[n.framework] ?? []).includes(e.name) || n?.styling && n.styling.includes(e.name);
|
|
10033
10033
|
if (i && !o && !s || e.name === "ui-review" && (t.has("codebase") || t.has("repo") || t.has("repository") || (t.has("bug") || t.has("bugs")) && !t.has("ui"))) return 0;
|
|
10034
|
-
for (let n of
|
|
10035
|
-
if (a.size > 0 && [...a].every((e) => t.has(e))) r +=
|
|
10036
|
-
else for (let e of a) t.has(e) && (r +=
|
|
10034
|
+
for (let n of jn) n.skillName === e.name && n.keywords.some((e) => t.has(e)) && (r += n.bonus);
|
|
10035
|
+
if (a.size > 0 && [...a].every((e) => t.has(e))) r += In;
|
|
10036
|
+
else for (let e of a) t.has(e) && (r += Ln * (1 / a.size));
|
|
10037
10037
|
if (e.activation?.when) for (let n of e.activation.when) {
|
|
10038
|
-
let e =
|
|
10039
|
-
e > 0 && (r +=
|
|
10038
|
+
let e = Fn(n, t);
|
|
10039
|
+
e > 0 && (r += Rn * e);
|
|
10040
10040
|
}
|
|
10041
10041
|
if (e.activation?.notWhen) for (let n of e.activation.notWhen) {
|
|
10042
|
-
let e =
|
|
10043
|
-
e > 0 && (r +=
|
|
10042
|
+
let e = Fn(n, t);
|
|
10043
|
+
e > 0 && (r += Vn * e);
|
|
10044
10044
|
}
|
|
10045
|
-
let c =
|
|
10046
|
-
for (let e of c) t.has(e) && e.length > 3 && (r +=
|
|
10045
|
+
let c = An(e.description);
|
|
10046
|
+
for (let e of c) t.has(e) && e.length > 3 && (r += zn * (1 / c.size));
|
|
10047
10047
|
for (let n of e.instructions) {
|
|
10048
|
-
let e =
|
|
10048
|
+
let e = An(n);
|
|
10049
10049
|
for (let n of e) if (t.has(n) && n.length > 4) {
|
|
10050
|
-
r +=
|
|
10050
|
+
r += Bn * (1 / e.size);
|
|
10051
10051
|
break;
|
|
10052
10052
|
}
|
|
10053
10053
|
}
|
|
10054
|
-
return s && (r +=
|
|
10054
|
+
return s && (r += Hn, [...t].some((e) => Nn.has(e)) && (r += 2)), Mn.some((e) => t.has(e)) && (r -= 30), r;
|
|
10055
10055
|
}
|
|
10056
|
-
function
|
|
10057
|
-
let { request: t, registry: n, projectContext: r, maxResults: i =
|
|
10056
|
+
function Kn(e) {
|
|
10057
|
+
let { request: t, registry: n, projectContext: r, maxResults: i = On } = e, a = An(t), o = [];
|
|
10058
10058
|
for (let e of n.list()) {
|
|
10059
|
-
let t =
|
|
10059
|
+
let t = Gn(e, a, r);
|
|
10060
10060
|
t > 0 && o.push({
|
|
10061
10061
|
skill: e,
|
|
10062
10062
|
score: t
|
|
@@ -10066,14 +10066,14 @@ function Gn(e) {
|
|
|
10066
10066
|
}
|
|
10067
10067
|
//#endregion
|
|
10068
10068
|
//#region ../../packages/agent/src/skills/activation.ts
|
|
10069
|
-
var
|
|
10069
|
+
var qn = class {
|
|
10070
10070
|
maxSkills;
|
|
10071
10071
|
minThreshold;
|
|
10072
10072
|
constructor(e = {}) {
|
|
10073
10073
|
this.maxSkills = e.maxSkills ?? 3, this.minThreshold = e.minThreshold ?? 5;
|
|
10074
10074
|
}
|
|
10075
10075
|
activate(e, t, n) {
|
|
10076
|
-
let r =
|
|
10076
|
+
let r = Kn({
|
|
10077
10077
|
request: e,
|
|
10078
10078
|
registry: t,
|
|
10079
10079
|
projectContext: n,
|
|
@@ -10088,7 +10088,7 @@ var Kn = class {
|
|
|
10088
10088
|
};
|
|
10089
10089
|
//#endregion
|
|
10090
10090
|
//#region ../../packages/agent/src/session/pathResolver.ts
|
|
10091
|
-
function
|
|
10091
|
+
function Jn() {
|
|
10092
10092
|
if (process.env.FECODE_SESSIONS_DIR) return s.resolve(process.env.FECODE_SESSIONS_DIR);
|
|
10093
10093
|
let e = m.homedir(), t = process.platform;
|
|
10094
10094
|
if (t === "win32") {
|
|
@@ -10101,20 +10101,20 @@ function qn() {
|
|
|
10101
10101
|
}
|
|
10102
10102
|
//#endregion
|
|
10103
10103
|
//#region ../../packages/agent/src/session/store.ts
|
|
10104
|
-
function
|
|
10104
|
+
function Yn(e) {
|
|
10105
10105
|
return !e || typeof e != "string" ? !1 : /^[a-zA-Z0-9_.-]+$/.test(e) && !e.includes("..");
|
|
10106
10106
|
}
|
|
10107
|
-
var
|
|
10107
|
+
var Xn = class {
|
|
10108
10108
|
sessionsDir;
|
|
10109
10109
|
constructor(e) {
|
|
10110
|
-
this.sessionsDir = e ||
|
|
10110
|
+
this.sessionsDir = e || Jn();
|
|
10111
10111
|
}
|
|
10112
10112
|
getSessionsDir() {
|
|
10113
10113
|
return this.sessionsDir;
|
|
10114
10114
|
}
|
|
10115
10115
|
async save(e) {
|
|
10116
|
-
if (!
|
|
10117
|
-
let t =
|
|
10116
|
+
if (!Yn(e.sessionId)) throw Error(`Invalid sessionId: ${e.sessionId}`);
|
|
10117
|
+
let t = be(e.messages || []), n = {
|
|
10118
10118
|
...e,
|
|
10119
10119
|
version: 1,
|
|
10120
10120
|
startedAt: e.startedAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -10148,7 +10148,7 @@ var Yn = class {
|
|
|
10148
10148
|
}
|
|
10149
10149
|
}
|
|
10150
10150
|
async load(e) {
|
|
10151
|
-
if (!
|
|
10151
|
+
if (!Yn(e)) throw Error(`Invalid sessionId: ${e}`);
|
|
10152
10152
|
let t = s.join(this.sessionsDir, `${e}.json`), n;
|
|
10153
10153
|
try {
|
|
10154
10154
|
n = await d.readFile(t, "utf-8");
|
|
@@ -10201,7 +10201,7 @@ var Yn = class {
|
|
|
10201
10201
|
});
|
|
10202
10202
|
}
|
|
10203
10203
|
async delete(e) {
|
|
10204
|
-
if (!
|
|
10204
|
+
if (!Yn(e)) return !1;
|
|
10205
10205
|
let t = s.join(this.sessionsDir, `${e}.json`);
|
|
10206
10206
|
try {
|
|
10207
10207
|
return await d.unlink(t), !0;
|
|
@@ -10213,7 +10213,7 @@ var Yn = class {
|
|
|
10213
10213
|
};
|
|
10214
10214
|
//#endregion
|
|
10215
10215
|
//#region ../../packages/agent/src/session/historyFormatter.ts
|
|
10216
|
-
function
|
|
10216
|
+
function Zn(e) {
|
|
10217
10217
|
try {
|
|
10218
10218
|
let t = new Date(e);
|
|
10219
10219
|
if (isNaN(t.getTime())) return e;
|
|
@@ -10223,12 +10223,12 @@ function Xn(e) {
|
|
|
10223
10223
|
return e;
|
|
10224
10224
|
}
|
|
10225
10225
|
}
|
|
10226
|
-
function
|
|
10226
|
+
function Qn(e, t = 3) {
|
|
10227
10227
|
if (e.length <= t) return e;
|
|
10228
10228
|
let n = e.slice(0, t), r = e.length - t;
|
|
10229
10229
|
return [...n, `+${r} more`];
|
|
10230
10230
|
}
|
|
10231
|
-
function
|
|
10231
|
+
function $n(e) {
|
|
10232
10232
|
switch (e) {
|
|
10233
10233
|
case "completed": return "✓";
|
|
10234
10234
|
case "blocked":
|
|
@@ -10236,7 +10236,7 @@ function Qn(e) {
|
|
|
10236
10236
|
default: return "●";
|
|
10237
10237
|
}
|
|
10238
10238
|
}
|
|
10239
|
-
var
|
|
10239
|
+
var er = class {
|
|
10240
10240
|
static formatHistory(e, t = {}) {
|
|
10241
10241
|
let n = t.limit || 20, r = t.maxChangedFiles || 3;
|
|
10242
10242
|
if (!e || e.length === 0) return "Session History\n\nNo task history available.\n";
|
|
@@ -10244,7 +10244,7 @@ var $n = class {
|
|
|
10244
10244
|
e.length > n && (i += `\nShowing ${n} of ${e.length} tasks\n`);
|
|
10245
10245
|
let a = [...e].reverse().slice(0, n);
|
|
10246
10246
|
for (let t = 0; t < a.length; t++) {
|
|
10247
|
-
let n = a[t], o = n.taskIndex === void 0 ? e.length - t : n.taskIndex, s =
|
|
10247
|
+
let n = a[t], o = n.taskIndex === void 0 ? e.length - t : n.taskIndex, s = $n(n.status), c = n.request ? P(n.request.split("\n")[0]) : "Untitled task";
|
|
10248
10248
|
if (i += `\n${o}. ${s} ${c}\n`, n.status === "completed") {
|
|
10249
10249
|
if (i += " Completed\n", n.changeSet && n.changeSet.files.length > 0) {
|
|
10250
10250
|
let e = n.changeSet.stats.totalFiles === 1 ? "file" : "files";
|
|
@@ -10257,7 +10257,7 @@ var $n = class {
|
|
|
10257
10257
|
let e = n.fileChanges.slice(0, r).map((e) => `${e.path} +${e.additions} -${e.deletions}`);
|
|
10258
10258
|
n.fileChanges.length > r && e.push(`+${n.fileChanges.length - r} more`), i += ` Changed: ${e.join(", ")}\n`;
|
|
10259
10259
|
} else if (n.completedFiles && n.completedFiles.length > 0) {
|
|
10260
|
-
let e =
|
|
10260
|
+
let e = Qn(n.completedFiles, r);
|
|
10261
10261
|
i += ` Changed: ${e.join(", ")}\n`;
|
|
10262
10262
|
}
|
|
10263
10263
|
n.verifiedCommands && n.verifiedCommands.length > 0 && (i += ` Verified: ${n.verifiedCommands.join(", ")}\n`), n.recovery && (i += ` ↩ Recovered ${n.recovery.checkpointId}\n`, i += ` ${n.recovery.affectedFiles.length} file${n.recovery.affectedFiles.length === 1 ? "" : "s"} restored\n`);
|
|
@@ -10266,7 +10266,7 @@ var $n = class {
|
|
|
10266
10266
|
let e = n.changeSet.stats.totalFiles === 1 ? "file" : "files";
|
|
10267
10267
|
i += ` ${n.changeSet.stats.totalFiles} ${e} · +${n.changeSet.stats.totalAdditions} -${n.changeSet.stats.totalDeletions}\n`, n.changeSet.areas.length > 0 && (i += ` ${n.changeSet.areas.join(", ")}\n`);
|
|
10268
10268
|
}
|
|
10269
|
-
n.blockedReason && (i += ` ${
|
|
10269
|
+
n.blockedReason && (i += ` ${P(n.blockedReason)}\n`);
|
|
10270
10270
|
} else n.status === "cancelled" ? i += " Cancelled\n" : i += " In Progress\n";
|
|
10271
10271
|
}
|
|
10272
10272
|
return i + "\n";
|
|
@@ -10278,14 +10278,14 @@ var $n = class {
|
|
|
10278
10278
|
e.length > n && (r += `\nShowing ${n} of ${e.length} tasks\n`);
|
|
10279
10279
|
let i = e.slice(0, n);
|
|
10280
10280
|
for (let e = 0; e < i.length; e++) {
|
|
10281
|
-
let t = i[e], n = t.taskIndex === void 0 ? e + 1 : t.taskIndex, a =
|
|
10281
|
+
let t = i[e], n = t.taskIndex === void 0 ? e + 1 : t.taskIndex, a = $n(t.status), o = t.request ? P(t.request.split("\n")[0]) : "Untitled task";
|
|
10282
10282
|
r += `\n${a} ${n} ${o}`;
|
|
10283
10283
|
}
|
|
10284
10284
|
return r + "\n";
|
|
10285
10285
|
}
|
|
10286
10286
|
static formatTaskDetail(e, t, n = {}) {
|
|
10287
10287
|
let r = n.maxChangedFiles || 10, i = `Task ${t === void 0 ? e.taskIndex === void 0 ? 1 : e.taskIndex : t}\n\n`;
|
|
10288
|
-
if (i += `Status:\n ${e.status}\n\n`, e.request && (i += `Request:\n ${
|
|
10288
|
+
if (i += `Status:\n ${e.status}\n\n`, e.request && (i += `Request:\n ${P(e.request)}\n\n`), e.checkpointId && (i += `Checkpoint:\n ${e.checkpointId}\n\n`), e.recovery && (i += `Recovery:\n ${e.recovery.affectedFiles.length} file${e.recovery.affectedFiles.length === 1 ? "" : "s"} restored\n ${e.recovery.preservedFiles.length} pre-existing file${e.recovery.preservedFiles.length === 1 ? "" : "s"} preserved\n\n`), e.status === "completed") {
|
|
10289
10289
|
if (e.changeSet && e.changeSet.files.length > 0) {
|
|
10290
10290
|
let t = e.changeSet.stats.totalFiles === 1 ? "file" : "files";
|
|
10291
10291
|
i += `Changes:\n ${e.changeSet.stats.totalFiles} ${t}\n +${e.changeSet.stats.totalAdditions} -${e.changeSet.stats.totalDeletions}\n\n`, e.gitAttribution && (i += `Pre-existing before task:\n ${e.gitAttribution.preExistingFiles.length} file${e.gitAttribution.preExistingFiles.length === 1 ? "" : "s"}\n\n`, i += `FeCode-attributed:\n ${e.gitAttribution.fecodeFiles.length} file${e.gitAttribution.fecodeFiles.length === 1 ? "" : "s"}\n\n`, i += `Unattributed:\n ${e.gitAttribution.unattributedFiles.length} file${e.gitAttribution.unattributedFiles.length === 1 ? "" : "s"}\n\n`), e.changeSet.areas.length > 0 && (i += `Areas:\n${e.changeSet.areas.map((e) => ` ${e}`).join("\n")}\n\n`);
|
|
@@ -10293,27 +10293,27 @@ var $n = class {
|
|
|
10293
10293
|
let t = e.fileChanges.slice(0, r);
|
|
10294
10294
|
i += `Changed:\n${t.map((e) => ` ${e.path}\n +${e.additions} -${e.deletions}`).join("\n\n")}\n\n`, e.fileChanges.length > r && (i += ` ... (+${e.fileChanges.length - r} more files)\n\n`);
|
|
10295
10295
|
} else if (e.completedFiles && e.completedFiles.length > 0) {
|
|
10296
|
-
let t =
|
|
10296
|
+
let t = Qn(e.completedFiles, r);
|
|
10297
10297
|
i += `Changed:\n${t.map((e) => ` ${e}`).join("\n")}\n\n`;
|
|
10298
10298
|
}
|
|
10299
10299
|
if (e.changeSet?.verification?.attempted) {
|
|
10300
10300
|
i += "Verification:\n";
|
|
10301
|
-
for (let t of e.changeSet.verification.commands) i += ` ✓ ${
|
|
10302
|
-
for (let t of e.changeSet.verification.failedCommands) i += ` ✗ ${
|
|
10301
|
+
for (let t of e.changeSet.verification.commands) i += ` ✓ ${P(t)}\n`;
|
|
10302
|
+
for (let t of e.changeSet.verification.failedCommands) i += ` ✗ ${P(t)}\n`;
|
|
10303
10303
|
i += "\n";
|
|
10304
10304
|
} else e.verifiedCommands && e.verifiedCommands.length > 0 && (i += `Verification:\n${e.verifiedCommands.map((e) => ` ${e}`).join("\n")}\n\n`);
|
|
10305
10305
|
} else if (e.status === "blocked") {
|
|
10306
|
-
if (e.completedRequirements && e.completedRequirements.length > 0 && (i += `Completed:\n${e.completedRequirements.map((e) => ` ✓ ${
|
|
10306
|
+
if (e.completedRequirements && e.completedRequirements.length > 0 && (i += `Completed:\n${e.completedRequirements.map((e) => ` ✓ ${P(e)}`).join("\n")}\n\n`), e.remainingRequirements && e.remainingRequirements.length > 0 && (i += `Remaining:\n${e.remainingRequirements.map((e) => ` ⚠ ${P(e)}`).join("\n")}\n\n`), e.blockedReason && (i += `Reason:\n ${P(e.blockedReason)}\n\n`), e.changeSet && e.changeSet.files.length > 0) {
|
|
10307
10307
|
let t = e.changeSet.stats.totalFiles === 1 ? "file" : "files";
|
|
10308
10308
|
i += `Changes:\n ${e.changeSet.stats.totalFiles} ${t}\n +${e.changeSet.stats.totalAdditions} -${e.changeSet.stats.totalDeletions}\n\n`, e.changeSet.areas.length > 0 && (i += `Areas:\n${e.changeSet.areas.map((e) => ` ${e}`).join("\n")}\n\n`);
|
|
10309
10309
|
} else if (e.fileChanges && e.fileChanges.length > 0) {
|
|
10310
10310
|
let t = e.fileChanges.slice(0, r);
|
|
10311
10311
|
i += `Changed:\n${t.map((e) => ` ${e.path}\n +${e.additions} -${e.deletions}`).join("\n\n")}\n\n`, e.fileChanges.length > r && (i += ` ... (+${e.fileChanges.length - r} more files)\n\n`);
|
|
10312
10312
|
} else if (e.completedFiles && e.completedFiles.length > 0) {
|
|
10313
|
-
let t =
|
|
10313
|
+
let t = Qn(e.completedFiles, r);
|
|
10314
10314
|
i += `Changed:\n${t.map((e) => ` ${e}`).join("\n")}\n\n`;
|
|
10315
10315
|
}
|
|
10316
|
-
} else e.status === "cancelled" && (e.completedRequirements && e.completedRequirements.length > 0 && (i += `Completed:\n${e.completedRequirements.map((e) => ` ✓ ${
|
|
10316
|
+
} else e.status === "cancelled" && (e.completedRequirements && e.completedRequirements.length > 0 && (i += `Completed:\n${e.completedRequirements.map((e) => ` ✓ ${P(e)}`).join("\n")}\n\n`), e.remainingRequirements && e.remainingRequirements.length > 0 && (i += `Remaining:\n${e.remainingRequirements.map((e) => ` ⚠ ${P(e)}`).join("\n")}\n\n`));
|
|
10317
10317
|
return i.trimEnd() + "\n";
|
|
10318
10318
|
}
|
|
10319
10319
|
static formatCurrentTask(e, t) {
|
|
@@ -10321,7 +10321,7 @@ var $n = class {
|
|
|
10321
10321
|
let n = "Current Task\n\n";
|
|
10322
10322
|
n += `Status:\n ${e.status}\n\n`;
|
|
10323
10323
|
let r = e.request || t;
|
|
10324
|
-
return r && (n += `Request:\n ${
|
|
10324
|
+
return r && (n += `Request:\n ${P(r)}\n\n`), e.completedRequirements && e.completedRequirements.length > 0 && (n += `Completed:\n${e.completedRequirements.map((e) => ` ✓ ${P(e)}`).join("\n")}\n\n`), e.remainingRequirements && e.remainingRequirements.length > 0 && (n += `Remaining:\n${e.remainingRequirements.map((e) => ` ⚠ ${P(e)}`).join("\n")}\n\n`), e.blockedReason && (n += `Reason:\n ${P(e.blockedReason)}\n\n`), n.trimEnd() + "\n";
|
|
10325
10325
|
}
|
|
10326
10326
|
static formatSessionStatus(e) {
|
|
10327
10327
|
let t = "FeCode\n\n";
|
|
@@ -10335,8 +10335,8 @@ var $n = class {
|
|
|
10335
10335
|
let n = e.lastChangeSet.stats.totalFiles === 1 ? "file" : "files";
|
|
10336
10336
|
if (t += `\nLast change:\n ${e.lastChangeSet.stats.totalFiles} ${n} · +${e.lastChangeSet.stats.totalAdditions} -${e.lastChangeSet.stats.totalDeletions}\n`, e.lastChangeSet.verification.attempted) {
|
|
10337
10337
|
t += "\nVerification:\n";
|
|
10338
|
-
for (let n of e.lastChangeSet.verification.commands) t += ` ✓ ${
|
|
10339
|
-
for (let n of e.lastChangeSet.verification.failedCommands) t += ` ✗ ${
|
|
10338
|
+
for (let n of e.lastChangeSet.verification.commands) t += ` ✓ ${P(n)}\n`;
|
|
10339
|
+
for (let n of e.lastChangeSet.verification.failedCommands) t += ` ✗ ${P(n)}\n`;
|
|
10340
10340
|
}
|
|
10341
10341
|
}
|
|
10342
10342
|
return t;
|
|
@@ -10347,10 +10347,10 @@ var $n = class {
|
|
|
10347
10347
|
for (let n = 0; n < e.length; n++) {
|
|
10348
10348
|
let r = e[n];
|
|
10349
10349
|
if (t += `${n + 1}. ${r.sessionId}\n`, t += ` ${r.workingDirectory}\n`, t += ` ${r.model}\n`, t += ` ${r.taskCount} task${r.taskCount === 1 ? "" : "s"}\n`, r.latestTaskSummary) {
|
|
10350
|
-
let e =
|
|
10350
|
+
let e = $n(r.latestTaskSummary.status), n = r.latestTaskSummary.request ? P(r.latestTaskSummary.request.split("\n")[0]) : "Task";
|
|
10351
10351
|
t += ` ${e} ${n}\n`;
|
|
10352
10352
|
}
|
|
10353
|
-
r.updatedAt && (t += ` Last active: ${
|
|
10353
|
+
r.updatedAt && (t += ` Last active: ${Zn(r.updatedAt)}\n`), t += "\n";
|
|
10354
10354
|
}
|
|
10355
10355
|
return t;
|
|
10356
10356
|
}
|
|
@@ -10361,19 +10361,19 @@ var $n = class {
|
|
|
10361
10361
|
if (n.length > 0) {
|
|
10362
10362
|
t += "Previous tasks:\n";
|
|
10363
10363
|
for (let e of n) {
|
|
10364
|
-
let n =
|
|
10364
|
+
let n = $n(e.status), r = e.request ? P(e.request.split("\n")[0]) : "Task";
|
|
10365
10365
|
t += ` ${n} ${r}\n`;
|
|
10366
10366
|
}
|
|
10367
10367
|
t += "\n";
|
|
10368
10368
|
}
|
|
10369
10369
|
return t += `${e.taskCount} task${e.taskCount === 1 ? "" : "s"}\n`, t;
|
|
10370
10370
|
}
|
|
10371
|
-
},
|
|
10371
|
+
}, tr = class {
|
|
10372
10372
|
static formatGitStatus(e, t) {
|
|
10373
10373
|
if (!e.gitAvailable) return "Git\n\nGit executable not available\n";
|
|
10374
10374
|
if (!e.isRepository) return "Git\n\nNot a Git repository\n";
|
|
10375
10375
|
let n = "Git\n\n";
|
|
10376
|
-
e.root && (n += `Repository:\n ${
|
|
10376
|
+
e.root && (n += `Repository:\n ${P(e.root)}\n\n`), n += `Branch:\n ${e.branch || "unknown"}\n\n`;
|
|
10377
10377
|
let r = e.files.length;
|
|
10378
10378
|
if (n += `Status:\n ${r} changed file${r === 1 ? "" : "s"}\n\n`, t) {
|
|
10379
10379
|
let e = t.preExistingFiles.length;
|
|
@@ -10396,14 +10396,14 @@ var $n = class {
|
|
|
10396
10396
|
let s = t.unattributedFiles.length;
|
|
10397
10397
|
if (r += `\nUnattributed:\n ${s} file${s === 1 ? "" : "s"}\n`, t.preservedUserFiles.length > 0) {
|
|
10398
10398
|
r += "\nUser changes preserved:\n";
|
|
10399
|
-
for (let e of t.preservedUserFiles) r += ` ✓ ${
|
|
10399
|
+
for (let e of t.preservedUserFiles) r += ` ✓ ${P(e)}\n`;
|
|
10400
10400
|
}
|
|
10401
10401
|
return r;
|
|
10402
10402
|
}
|
|
10403
10403
|
};
|
|
10404
10404
|
//#endregion
|
|
10405
10405
|
//#region ../../packages/agent/src/checkpoints/formatter.ts
|
|
10406
|
-
function
|
|
10406
|
+
function nr(e) {
|
|
10407
10407
|
try {
|
|
10408
10408
|
let t = new Date(e).getTime();
|
|
10409
10409
|
if (isNaN(t)) return "unknown";
|
|
@@ -10419,10 +10419,10 @@ function tr(e) {
|
|
|
10419
10419
|
return "unknown";
|
|
10420
10420
|
}
|
|
10421
10421
|
}
|
|
10422
|
-
var
|
|
10422
|
+
var rr = class {
|
|
10423
10423
|
static formatRiskPrompt(e) {
|
|
10424
10424
|
let t = "⚠ Risky task detected\n\nReasons:\n";
|
|
10425
|
-
for (let n of e.reasons) t += ` • ${
|
|
10425
|
+
for (let n of e.reasons) t += ` • ${P(n)}\n`;
|
|
10426
10426
|
return t += "\nFeCode can create a recovery checkpoint before continuing.\n\nCreate checkpoint? [y/N]", t;
|
|
10427
10427
|
}
|
|
10428
10428
|
static formatCheckpointCreated(e) {
|
|
@@ -10437,7 +10437,7 @@ var nr = class {
|
|
|
10437
10437
|
if (!e || e.length === 0) return "Checkpoints\n\nNo checkpoints found.\n";
|
|
10438
10438
|
let t = "Checkpoints\n\n";
|
|
10439
10439
|
for (let n = 0; n < e.length; n++) {
|
|
10440
|
-
let r = e[n], i =
|
|
10440
|
+
let r = e[n], i = nr(r.createdAt);
|
|
10441
10441
|
t += `${n + 1}. ${r.id}\n`, r.branch && (t += ` ${r.branch}\n`), t += ` ${r.totalFiles} file${r.totalFiles === 1 ? "" : "s"}\n`, t += ` ${i}\n\n`;
|
|
10442
10442
|
}
|
|
10443
10443
|
return t.trimEnd() + "\n";
|
|
@@ -10458,9 +10458,9 @@ var nr = class {
|
|
|
10458
10458
|
let n = e.totalSteps ? `/${e.totalSteps}` : "", r = e.stepTitle ? ` — ${e.stepTitle}` : "";
|
|
10459
10459
|
t.push(`Step: ${e.stepOrder}${n}${r}`);
|
|
10460
10460
|
}
|
|
10461
|
-
if (t.push(""), t.push(`Risk: ${e.riskLevel.toUpperCase()}`), t.push(""), t.push("Reason:"), t.push(
|
|
10461
|
+
if (t.push(""), t.push(`Risk: ${e.riskLevel.toUpperCase()}`), t.push(""), t.push("Reason:"), t.push(P(e.reason)), e.checkpointId && (t.push(""), t.push(`Checkpoint: ${e.checkpointId}`)), e.affectedTargets && e.affectedTargets.length > 0) {
|
|
10462
10462
|
t.push(""), t.push("Affected targets:");
|
|
10463
|
-
for (let n of e.affectedTargets) t.push(` • ${
|
|
10463
|
+
for (let n of e.affectedTargets) t.push(` • ${P(n)}`);
|
|
10464
10464
|
}
|
|
10465
10465
|
return t.push(""), t.push("This approval is valid only for this execution step."), t.push(""), t.push("Approve this operation? [y/N]:"), t.join("\n");
|
|
10466
10466
|
}
|
|
@@ -10472,7 +10472,7 @@ var nr = class {
|
|
|
10472
10472
|
}
|
|
10473
10473
|
static formatApprovalInvalidated(e, t) {
|
|
10474
10474
|
let n = ["⚠ Approval invalidated", ""];
|
|
10475
|
-
return t && n.push(`Checkpoint: ${t}`, ""), n.push("Reason:"), n.push(
|
|
10475
|
+
return t && n.push(`Checkpoint: ${t}`, ""), n.push("Reason:"), n.push(P(e)), n.push(""), n.push("A new approval is required."), n.push(""), n.push("Create a new approval? [y/N]:"), n.join("\n") + "\n";
|
|
10476
10476
|
}
|
|
10477
10477
|
static formatBlockedContinuation(e) {
|
|
10478
10478
|
return [
|
|
@@ -10481,7 +10481,7 @@ var nr = class {
|
|
|
10481
10481
|
`Step: ${e.stepOrder}/${e.totalSteps} — ${e.stepTitle}`,
|
|
10482
10482
|
"",
|
|
10483
10483
|
"Reason:",
|
|
10484
|
-
|
|
10484
|
+
P(e.reason),
|
|
10485
10485
|
"",
|
|
10486
10486
|
"[c] Continue after re-validation",
|
|
10487
10487
|
"[r] Create replacement plan",
|
|
@@ -10490,13 +10490,13 @@ var nr = class {
|
|
|
10490
10490
|
"Choice [x]:"
|
|
10491
10491
|
].join("\n");
|
|
10492
10492
|
}
|
|
10493
|
-
},
|
|
10493
|
+
}, ir = class {
|
|
10494
10494
|
static formatRecoveryPreview(e) {
|
|
10495
10495
|
let t = "Recovery Preview\n\n";
|
|
10496
10496
|
if (t += `Checkpoint:\n ${e.checkpointId}\n\n`, e.currentBranch && (t += `Current branch:\n ${e.currentBranch}\n\n`), e.checkpointBranch && (t += `Checkpoint branch:\n ${e.checkpointBranch}\n\n`), !e.safe) {
|
|
10497
10497
|
t += "⚠ Recovery blocked\n\n";
|
|
10498
|
-
for (let n of e.reasons) t += `Reason:\n ${
|
|
10499
|
-
for (let n of e.conflicts) t += `Conflict in ${n.path}:\n ${
|
|
10498
|
+
for (let n of e.reasons) t += `Reason:\n ${P(n)}\n\n`;
|
|
10499
|
+
for (let n of e.conflicts) t += `Conflict in ${n.path}:\n ${P(n.reason)}\n\n`;
|
|
10500
10500
|
return t += "No files were modified.\n", t;
|
|
10501
10501
|
}
|
|
10502
10502
|
if (e.files.length === 0) t += "Changes since checkpoint:\n No changes detected.\n\n";
|
|
@@ -10518,7 +10518,7 @@ var nr = class {
|
|
|
10518
10518
|
}
|
|
10519
10519
|
static formatRecoveryRecommendation(e, t) {
|
|
10520
10520
|
let n = "⚠ Recovery requested\n\n";
|
|
10521
|
-
return n += "The verification process failed after changes were made.\n\n", n += `Checkpoint:\n ${e}\n\n`, n += `Reason:\n ${
|
|
10521
|
+
return n += "The verification process failed after changes were made.\n\n", n += `Checkpoint:\n ${e}\n\n`, n += `Reason:\n ${P(t)}\n\n`, n += "This may discard changes made by the agent.\n\n", n += "Proceed with recovery? [y/N]", n;
|
|
10522
10522
|
}
|
|
10523
10523
|
static formatRecoveryResult(e) {
|
|
10524
10524
|
if (e.status === "completed") {
|
|
@@ -10529,25 +10529,25 @@ var nr = class {
|
|
|
10529
10529
|
let t = "✗ Recovery blocked\n\n";
|
|
10530
10530
|
if (t += `Checkpoint:\n ${e.checkpointId}\n\n`, e.conflicts.length > 0) {
|
|
10531
10531
|
t += `Conflicts:\n ${e.conflicts.length}\n\n`;
|
|
10532
|
-
for (let n of e.conflicts) t += ` • ${n.path}: ${
|
|
10532
|
+
for (let n of e.conflicts) t += ` • ${n.path}: ${P(n.reason)}\n`;
|
|
10533
10533
|
t += "\n";
|
|
10534
10534
|
}
|
|
10535
|
-
return e.error && (t += `Reason:\n ${
|
|
10535
|
+
return e.error && (t += `Reason:\n ${P(e.error)}\n\n`), t += "No files were modified.\n", t;
|
|
10536
10536
|
}
|
|
10537
10537
|
if (e.status === "cancelled") return "⚠ Recovery cancelled\n\nNo files were modified.\n";
|
|
10538
10538
|
let t = "✗ Recovery failed\n\n";
|
|
10539
|
-
return t += `Checkpoint:\n ${e.checkpointId}\n\n`, e.error && (t += `Error:\n ${
|
|
10539
|
+
return t += `Checkpoint:\n ${e.checkpointId}\n\n`, e.error && (t += `Error:\n ${P(e.error)}\n\n`), e.emergencySnapshotPath && (t += `Emergency snapshot preserved at:\n ${e.emergencySnapshotPath}\n\n`), t += "Attempted pre-recovery rollback.\n", t;
|
|
10540
10540
|
}
|
|
10541
10541
|
static formatRecoveryStatus(e, t) {
|
|
10542
10542
|
let n = "Recovery\n\n";
|
|
10543
10543
|
if (t && (n += `Last checkpoint:\n ${t}\n\n`), !e) return n += "Last recovery:\n No recovery operations recorded.\n", n;
|
|
10544
10544
|
let r = e.status === "completed" ? "Completed" : e.status === "blocked" ? "Blocked" : e.status === "cancelled" ? "Cancelled" : "Failed";
|
|
10545
|
-
return n += `Last recovery:\n ${r}\n\n`, e.status === "completed" ? n += `Recovered:\n ${e.affectedFiles.length} file${e.affectedFiles.length === 1 ? "" : "s"}\n` : e.conflicts.length > 0 && (n += `Reason:\n ${
|
|
10545
|
+
return n += `Last recovery:\n ${r}\n\n`, e.status === "completed" ? n += `Recovered:\n ${e.affectedFiles.length} file${e.affectedFiles.length === 1 ? "" : "s"}\n` : e.conflicts.length > 0 && (n += `Reason:\n ${P(e.conflicts.join("; "))}\n`), n.trimEnd() + "\n";
|
|
10546
10546
|
}
|
|
10547
10547
|
};
|
|
10548
10548
|
//#endregion
|
|
10549
10549
|
//#region ../../packages/agent/src/diagnostics/formatter.ts
|
|
10550
|
-
function
|
|
10550
|
+
function ar(e) {
|
|
10551
10551
|
let t = [], n = e.durationMs === void 0 ? "in progress" : `${(e.durationMs / 1e3).toFixed(1)}s`;
|
|
10552
10552
|
if (t.push(`Run: ${e.runId}`), t.push(`Status: ${e.finalStatus}`), t.push(`Duration: ${n}`), (e.failureReason || e.failureCode) && t.push(`Failure: [${e.failureCode || "FAILED"}] ${e.failureReason || "Unknown failure"}`), e.cancellationReason && t.push(`Cancellation: ${e.cancellationReason}`), e.planId) {
|
|
10553
10553
|
if (t.push(""), t.push(`Plan: ${e.planId} [${(e.planStatus || "ready").toUpperCase()}]`), e.planSummary && t.push(` Objective: ${e.planSummary}`), e.totalPlanSteps !== void 0) {
|
|
@@ -10608,7 +10608,7 @@ function ir(e) {
|
|
|
10608
10608
|
}
|
|
10609
10609
|
//#endregion
|
|
10610
10610
|
//#region ../../packages/agent/src/history/formatter.ts
|
|
10611
|
-
function
|
|
10611
|
+
function or(e) {
|
|
10612
10612
|
let t = Math.max(0, Math.floor((Date.now() - e) / 1e3));
|
|
10613
10613
|
if (t < 60) return "just now";
|
|
10614
10614
|
let n = Math.floor(t / 60);
|
|
@@ -10618,22 +10618,22 @@ function ar(e) {
|
|
|
10618
10618
|
let i = Math.floor(r / 24);
|
|
10619
10619
|
return `${i} day${i === 1 ? "" : "s"} ago`;
|
|
10620
10620
|
}
|
|
10621
|
-
var
|
|
10621
|
+
var sr = class {
|
|
10622
10622
|
static formatRunsList(e) {
|
|
10623
10623
|
if (!e || e.length === 0) return "No historical runs found for this project.\n";
|
|
10624
10624
|
let t = ["Persisted Runs:", ""];
|
|
10625
10625
|
return e.forEach((e, n) => {
|
|
10626
|
-
let r = n + 1, i = e.finalStatus === "completed" ? "✓ completed" : e.finalStatus === "cancelled" ? "⊘ cancelled" : e.finalStatus === "interrupted" ? "⚠ interrupted" : "✗ failed", a =
|
|
10626
|
+
let r = n + 1, i = e.finalStatus === "completed" ? "✓ completed" : e.finalStatus === "cancelled" ? "⊘ cancelled" : e.finalStatus === "interrupted" ? "⚠ interrupted" : "✗ failed", a = or(e.startedAt), o = e.durationMs === void 0 ? "in progress" : `${(e.durationMs / 1e3).toFixed(1)}s`;
|
|
10627
10627
|
t.push(`${r}. ${e.runId}`), t.push(` Status: ${i}`), t.push(` Time: ${a} (${o})`), t.push(` Project: ${e.projectId}`), e.parentRunId && t.push(` Resumed: from ${e.parentRunId}`), t.push(` Request: ${e.userRequestSummary.slice(0, 80)}`), e.failureReason && t.push(` Failure: ${e.failureReason.slice(0, 80)}`), t.push("");
|
|
10628
10628
|
}), t.push("Use `/run <id>` to inspect details or `/resume <id>` to resume an incomplete task."), t.join("\n");
|
|
10629
10629
|
}
|
|
10630
10630
|
static formatRunDetail(e) {
|
|
10631
|
-
let t =
|
|
10631
|
+
let t = ar(e), n = [];
|
|
10632
10632
|
return n.push(`Project: ${e.projectId}`), e.parentRunId && n.push(`ParentRun: ${e.parentRunId}`), e.workspaceFingerprint && (e.workspaceFingerprint.gitBranch && n.push(`Branch: ${e.workspaceFingerprint.gitBranch}`), e.workspaceFingerprint.isGitDirty !== void 0 && n.push(`Dirty: ${e.workspaceFingerprint.isGitDirty ? "yes" : "no"}`)), `${t}\n\n${n.join("\n")}`;
|
|
10633
10633
|
}
|
|
10634
10634
|
static formatResumePrompt(e) {
|
|
10635
10635
|
let t = ["Resume Task Request:", ""], n = e.originalRun;
|
|
10636
|
-
return t.push(` Original Run ID: ${n.runId}`), t.push(` Original Status: ${n.finalStatus}`), t.push(` Original Time: ${
|
|
10636
|
+
return t.push(` Original Run ID: ${n.runId}`), t.push(` Original Status: ${n.finalStatus}`), t.push(` Original Time: ${or(n.startedAt)}`), t.push(` Project: ${n.projectId}`), t.push(` Resume Depth: ${e.resumeDepth}`), t.push(` Request: ${n.userRequestSummary}`), n.failureReason ? t.push(` Failure Reason: ${n.failureReason}`) : n.cancellationReason && t.push(` Cancel Reason: ${n.cancellationReason}`), t.push(""), t.push(` New Run ID: ${e.newRunId}`), t.push(` Parent Run ID: ${e.suggestedParentRunId}`), t.push(` Reassessed Risk: ${e.reassessedRisk.level}`), e.reassessedSkills.length > 0 && t.push(` Active Skills: ${e.reassessedSkills.join(", ")}`), e.workspaceChanged && (t.push(""), t.push(" ⚠ Workspace Changes Detected:"), e.workspaceDiffReasons.forEach((e) => {
|
|
10637
10637
|
t.push(` - ${e}`);
|
|
10638
10638
|
})), t.push(""), t.push("Resume Safety Summary:"), t.push(" • A fresh execution identity will be started without modifying the original run record."), t.push(" • Previous permissions and checkpoint approvals do NOT carry over; fresh approval will be requested."), t.push(" • Previous commands and tool calls will NOT be replayed."), t.push(" • The agent will inspect current workspace files using read tools before taking action."), t.join("\n");
|
|
10639
10639
|
}
|
|
@@ -10751,7 +10751,7 @@ var or = class {
|
|
|
10751
10751
|
}
|
|
10752
10752
|
return t.push(""), t.push("Continue remaining plan steps? [y/N]:"), t.join("\n");
|
|
10753
10753
|
}
|
|
10754
|
-
},
|
|
10754
|
+
}, cr = [
|
|
10755
10755
|
{
|
|
10756
10756
|
command: "/help",
|
|
10757
10757
|
description: "Show available commands & keyboard shortcuts"
|
|
@@ -10833,15 +10833,15 @@ var or = class {
|
|
|
10833
10833
|
description: "Persist session and exit FeCode"
|
|
10834
10834
|
}
|
|
10835
10835
|
];
|
|
10836
|
-
function
|
|
10836
|
+
function lr(e) {
|
|
10837
10837
|
if (!e || !e.trim().startsWith("/")) return [];
|
|
10838
10838
|
let t = e.trim().toLowerCase();
|
|
10839
|
-
return
|
|
10839
|
+
return cr.filter((e) => e.command.toLowerCase().startsWith(t));
|
|
10840
10840
|
}
|
|
10841
10841
|
//#endregion
|
|
10842
10842
|
//#region src/ui/Header.tsx
|
|
10843
|
-
var
|
|
10844
|
-
let
|
|
10843
|
+
var ur = ({ projectName: n = "fecode", providerName: r, modelName: i, cwd: a = process.cwd(), status: o = "idle", gitBranch: s, isGitClean: c = !0, runId: l, elapsedMs: u, sessionId: d }) => {
|
|
10844
|
+
let f = () => {
|
|
10845
10845
|
switch (o.toLowerCase()) {
|
|
10846
10846
|
case "in_progress":
|
|
10847
10847
|
case "generating":
|
|
@@ -10897,7 +10897,7 @@ var lr = ({ projectName: n = "fecode", providerName: r, modelName: i, cwd: a = p
|
|
|
10897
10897
|
children: "○ IDLE"
|
|
10898
10898
|
});
|
|
10899
10899
|
}
|
|
10900
|
-
},
|
|
10900
|
+
}, p = r && i ? `${r}:${i}` : void 0;
|
|
10901
10901
|
return /* @__PURE__ */ S(e, {
|
|
10902
10902
|
flexDirection: "column",
|
|
10903
10903
|
borderStyle: "single",
|
|
@@ -10921,11 +10921,11 @@ var lr = ({ projectName: n = "fecode", providerName: r, modelName: i, cwd: a = p
|
|
|
10921
10921
|
color: "white",
|
|
10922
10922
|
children: n
|
|
10923
10923
|
}),
|
|
10924
|
-
|
|
10924
|
+
p && /* @__PURE__ */ S(t, {
|
|
10925
10925
|
color: "gray",
|
|
10926
10926
|
children: [
|
|
10927
10927
|
" (",
|
|
10928
|
-
|
|
10928
|
+
p,
|
|
10929
10929
|
")"
|
|
10930
10930
|
]
|
|
10931
10931
|
}),
|
|
@@ -10954,8 +10954,8 @@ var lr = ({ projectName: n = "fecode", providerName: r, modelName: i, cwd: a = p
|
|
|
10954
10954
|
let t = Math.round(e / 1e3);
|
|
10955
10955
|
return t < 60 ? `${t}s` : `${Math.floor(t / 60)}m ${t % 60}s`;
|
|
10956
10956
|
})(u), " "]
|
|
10957
|
-
}),
|
|
10958
|
-
}), (a || l) && /* @__PURE__ */ S(e, {
|
|
10957
|
+
}), f()] })]
|
|
10958
|
+
}), (a || l || d) && /* @__PURE__ */ S(e, {
|
|
10959
10959
|
justifyContent: "space-between",
|
|
10960
10960
|
marginTop: 0,
|
|
10961
10961
|
children: [/* @__PURE__ */ S(e, { children: [/* @__PURE__ */ x(t, {
|
|
@@ -10964,16 +10964,22 @@ var lr = ({ projectName: n = "fecode", providerName: r, modelName: i, cwd: a = p
|
|
|
10964
10964
|
}), /* @__PURE__ */ x(t, {
|
|
10965
10965
|
color: "white",
|
|
10966
10966
|
children: a
|
|
10967
|
-
})] }), l
|
|
10967
|
+
})] }), l ? /* @__PURE__ */ S(e, { children: [/* @__PURE__ */ x(t, {
|
|
10968
10968
|
color: "gray",
|
|
10969
10969
|
children: "Run: "
|
|
10970
10970
|
}), /* @__PURE__ */ x(t, {
|
|
10971
10971
|
color: "cyan",
|
|
10972
10972
|
children: l.slice(0, 16)
|
|
10973
|
-
})] })
|
|
10973
|
+
})] }) : d ? /* @__PURE__ */ S(e, { children: [/* @__PURE__ */ x(t, {
|
|
10974
|
+
color: "gray",
|
|
10975
|
+
children: "Session: "
|
|
10976
|
+
}), /* @__PURE__ */ x(t, {
|
|
10977
|
+
color: "gray",
|
|
10978
|
+
children: d.slice(0, 16)
|
|
10979
|
+
})] }) : null]
|
|
10974
10980
|
})]
|
|
10975
10981
|
});
|
|
10976
|
-
},
|
|
10982
|
+
}, dr = [
|
|
10977
10983
|
"⠋",
|
|
10978
10984
|
"⠙",
|
|
10979
10985
|
"⠹",
|
|
@@ -10984,21 +10990,21 @@ var lr = ({ projectName: n = "fecode", providerName: r, modelName: i, cwd: a = p
|
|
|
10984
10990
|
"⠧",
|
|
10985
10991
|
"⠇",
|
|
10986
10992
|
"⠏"
|
|
10987
|
-
],
|
|
10993
|
+
], fr = 80, pr = /* @__PURE__ */ new Set([
|
|
10988
10994
|
"executing",
|
|
10989
10995
|
"planning",
|
|
10990
10996
|
"verifying",
|
|
10991
10997
|
"recovering"
|
|
10992
|
-
]),
|
|
10993
|
-
let [p, m] = b(0), h = o ||
|
|
10998
|
+
]), mr = ({ status: n = "idle", activeStep: r, totalSteps: i, activeStepTitle: a, isGenerating: o = !1, hasModal: s = !1, modalType: c, customMessage: l, isReconciliation: u = !1, recoveryMode: d = "confirm", activeView: f = "main" }) => {
|
|
10999
|
+
let [p, m] = b(0), h = o || pr.has(n.toLowerCase());
|
|
10994
11000
|
v(() => {
|
|
10995
11001
|
if (!h) return;
|
|
10996
11002
|
let e = setInterval(() => {
|
|
10997
|
-
m((e) => (e + 1) %
|
|
10998
|
-
},
|
|
11003
|
+
m((e) => (e + 1) % dr.length);
|
|
11004
|
+
}, fr);
|
|
10999
11005
|
return () => clearInterval(e);
|
|
11000
11006
|
}, [h]);
|
|
11001
|
-
let g = h ? `${
|
|
11007
|
+
let g = h ? `${dr[p]} ` : "";
|
|
11002
11008
|
return /* @__PURE__ */ x(e, {
|
|
11003
11009
|
flexDirection: "column",
|
|
11004
11010
|
borderStyle: "single",
|
|
@@ -11330,11 +11336,11 @@ var lr = ({ projectName: n = "fecode", providerName: r, modelName: i, cwd: a = p
|
|
|
11330
11336
|
};
|
|
11331
11337
|
//#endregion
|
|
11332
11338
|
//#region src/ui/AppShell.tsx
|
|
11333
|
-
function
|
|
11339
|
+
function hr(e = 80) {
|
|
11334
11340
|
return e >= 100 ? "wide" : e >= 70 ? "medium" : e >= 50 ? "narrow" : "very_narrow";
|
|
11335
11341
|
}
|
|
11336
|
-
var
|
|
11337
|
-
let { stdout: c } = a(), l =
|
|
11342
|
+
var gr = ({ header: t, children: n, sidebar: r, modal: i, footer: o, columns: s }) => {
|
|
11343
|
+
let { stdout: c } = a(), l = hr(s ?? c?.columns ?? 80);
|
|
11338
11344
|
return /* @__PURE__ */ S(e, {
|
|
11339
11345
|
flexDirection: "column",
|
|
11340
11346
|
padding: 0,
|
|
@@ -11368,7 +11374,7 @@ var hr = ({ header: t, children: n, sidebar: r, modal: i, footer: o, columns: s
|
|
|
11368
11374
|
o
|
|
11369
11375
|
]
|
|
11370
11376
|
});
|
|
11371
|
-
},
|
|
11377
|
+
}, _r = ({ completed: n, total: r, width: i = 20, showFraction: a = !0, showPercentage: o = !0 }) => {
|
|
11372
11378
|
let s = Math.max(r, 1), c = Math.min(Math.max(n, 0), s), l = c / s, u = Math.round(l * 100), d = Math.round(l * i), f = Math.max(0, i - d), p = "█".repeat(d), m = "░".repeat(f);
|
|
11373
11379
|
return /* @__PURE__ */ S(e, {
|
|
11374
11380
|
flexDirection: "row",
|
|
@@ -11411,7 +11417,7 @@ var hr = ({ header: t, children: n, sidebar: r, modal: i, footer: o, columns: s
|
|
|
11411
11417
|
})
|
|
11412
11418
|
]
|
|
11413
11419
|
});
|
|
11414
|
-
},
|
|
11420
|
+
}, vr = ({ stepOrder: n, totalSteps: r, title: i, objective: a, riskLevel: o = "normal", checkpointRequired: s = !1, verificationRequired: c = !1, toolName: l, target: u, command: d, durationMs: f }) => {
|
|
11415
11421
|
if (!i && !l && !d) return null;
|
|
11416
11422
|
let p = (e) => {
|
|
11417
11423
|
switch (e.toLowerCase()) {
|
|
@@ -11523,47 +11529,59 @@ var hr = ({ header: t, children: n, sidebar: r, modal: i, footer: o, columns: s
|
|
|
11523
11529
|
})
|
|
11524
11530
|
]
|
|
11525
11531
|
});
|
|
11526
|
-
},
|
|
11532
|
+
}, yr = ({ suggestions: n, selectedIndex: r, maxVisible: i }) => {
|
|
11527
11533
|
if (n.length === 0) return null;
|
|
11528
|
-
let i = Math.max(0, Math.min(r, n.length - 1)),
|
|
11534
|
+
let { stdout: o } = a(), s = i ?? (o?.rows ? o.rows <= 24 ? 4 : o.rows <= 32 ? 5 : 6 : 8), c = Math.max(0, Math.min(r, n.length - 1)), l = c >= s ? Math.min(c - s + 1, Math.max(0, n.length - s)) : 0, u = n.slice(l, l + s), d = n.length - (l + u.length);
|
|
11529
11535
|
return /* @__PURE__ */ S(e, {
|
|
11530
11536
|
flexDirection: "column",
|
|
11531
11537
|
borderStyle: "round",
|
|
11532
11538
|
borderColor: "cyan",
|
|
11533
11539
|
paddingX: 1,
|
|
11534
11540
|
marginBottom: 0,
|
|
11535
|
-
children: [
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11541
|
+
children: [
|
|
11542
|
+
l > 0 && /* @__PURE__ */ x(e, { children: /* @__PURE__ */ S(t, {
|
|
11543
|
+
color: "gray",
|
|
11544
|
+
dimColor: !0,
|
|
11545
|
+
children: [
|
|
11546
|
+
" ▲ …",
|
|
11547
|
+
l,
|
|
11548
|
+
" more"
|
|
11549
|
+
]
|
|
11550
|
+
}) }),
|
|
11551
|
+
u.map((n, r) => {
|
|
11552
|
+
let i = l + r === c;
|
|
11553
|
+
return /* @__PURE__ */ S(e, { children: [
|
|
11554
|
+
/* @__PURE__ */ x(t, {
|
|
11555
|
+
color: "cyan",
|
|
11556
|
+
bold: !0,
|
|
11557
|
+
children: i ? "› " : " "
|
|
11558
|
+
}),
|
|
11559
|
+
/* @__PURE__ */ x(e, {
|
|
11560
|
+
width: 16,
|
|
11561
|
+
children: /* @__PURE__ */ x(t, {
|
|
11562
|
+
color: i ? "whiteBright" : "white",
|
|
11563
|
+
bold: i,
|
|
11564
|
+
children: n.command
|
|
11565
|
+
})
|
|
11566
|
+
}),
|
|
11567
|
+
/* @__PURE__ */ x(t, {
|
|
11568
|
+
color: "gray",
|
|
11569
|
+
children: n.description
|
|
11549
11570
|
})
|
|
11550
|
-
})
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
|
|
11554
|
-
|
|
11555
|
-
|
|
11556
|
-
|
|
11557
|
-
|
|
11558
|
-
|
|
11559
|
-
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
" more"
|
|
11563
|
-
]
|
|
11564
|
-
}) })]
|
|
11571
|
+
] }, n.command);
|
|
11572
|
+
}),
|
|
11573
|
+
d > 0 && /* @__PURE__ */ x(e, { children: /* @__PURE__ */ S(t, {
|
|
11574
|
+
color: "gray",
|
|
11575
|
+
dimColor: !0,
|
|
11576
|
+
children: [
|
|
11577
|
+
" …",
|
|
11578
|
+
d,
|
|
11579
|
+
" more"
|
|
11580
|
+
]
|
|
11581
|
+
}) })
|
|
11582
|
+
]
|
|
11565
11583
|
});
|
|
11566
|
-
}, br = ({ value: n, onChange: r, onSubmit: i, isDisabled: a = !1, placeholder: o = "Describe task or type /help...", label: s, pendingQuery: c, suggestions: l, selectedSuggestion: u = 0 }) => /* @__PURE__ */ S(e, {
|
|
11584
|
+
}, br = ({ value: n, onChange: r, onSubmit: i, isDisabled: a = !1, placeholder: o = "Describe task or type /help...", label: s, pendingQuery: c, suggestions: l, selectedSuggestion: u = 0, maxSuggestionsVisible: d }) => /* @__PURE__ */ S(e, {
|
|
11567
11585
|
flexDirection: "column",
|
|
11568
11586
|
marginY: 0,
|
|
11569
11587
|
children: [
|
|
@@ -11583,10 +11601,6 @@ var hr = ({ header: t, children: n, sidebar: r, modal: i, footer: o, columns: s
|
|
|
11583
11601
|
children: s
|
|
11584
11602
|
})
|
|
11585
11603
|
}),
|
|
11586
|
-
l && l.length > 0 && /* @__PURE__ */ x(yr, {
|
|
11587
|
-
suggestions: l,
|
|
11588
|
-
selectedIndex: u
|
|
11589
|
-
}),
|
|
11590
11604
|
/* @__PURE__ */ S(e, { children: [/* @__PURE__ */ x(t, {
|
|
11591
11605
|
color: "cyan",
|
|
11592
11606
|
bold: !0,
|
|
@@ -11600,6 +11614,14 @@ var hr = ({ header: t, children: n, sidebar: r, modal: i, footer: o, columns: s
|
|
|
11600
11614
|
onSubmit: i,
|
|
11601
11615
|
placeholder: o
|
|
11602
11616
|
})] }),
|
|
11617
|
+
l && l.length > 0 && /* @__PURE__ */ x(e, {
|
|
11618
|
+
marginTop: 0,
|
|
11619
|
+
children: /* @__PURE__ */ x(yr, {
|
|
11620
|
+
suggestions: l,
|
|
11621
|
+
selectedIndex: u,
|
|
11622
|
+
maxVisible: d
|
|
11623
|
+
})
|
|
11624
|
+
}),
|
|
11603
11625
|
a && c && /* @__PURE__ */ S(e, {
|
|
11604
11626
|
marginTop: 0,
|
|
11605
11627
|
children: [
|
|
@@ -11781,8 +11803,26 @@ var hr = ({ header: t, children: n, sidebar: r, modal: i, footer: o, columns: s
|
|
|
11781
11803
|
})
|
|
11782
11804
|
})
|
|
11783
11805
|
]
|
|
11784
|
-
}), Sr = ({ planId: n, objective: r, summary: i, status: a = "ready", riskLevel: o, steps: s = [], completedCount: c, totalCount: l }) => {
|
|
11785
|
-
|
|
11806
|
+
}), Sr = ({ planId: n, objective: r, summary: i, status: a = "ready", riskLevel: o, steps: s = [], completedCount: c, totalCount: l, formattedOutput: u }) => {
|
|
11807
|
+
if (u) return /* @__PURE__ */ S(e, {
|
|
11808
|
+
flexDirection: "column",
|
|
11809
|
+
borderStyle: "round",
|
|
11810
|
+
borderColor: "blue",
|
|
11811
|
+
paddingX: 1,
|
|
11812
|
+
marginY: 1,
|
|
11813
|
+
children: [/* @__PURE__ */ x(e, {
|
|
11814
|
+
marginBottom: 0,
|
|
11815
|
+
children: /* @__PURE__ */ x(t, {
|
|
11816
|
+
bold: !0,
|
|
11817
|
+
color: "blue",
|
|
11818
|
+
children: "Task Plan"
|
|
11819
|
+
})
|
|
11820
|
+
}), /* @__PURE__ */ x(t, {
|
|
11821
|
+
color: "white",
|
|
11822
|
+
children: u
|
|
11823
|
+
})]
|
|
11824
|
+
});
|
|
11825
|
+
let d = l ?? s.length, f = c ?? s.filter((e) => e.status === "completed").length;
|
|
11786
11826
|
return /* @__PURE__ */ S(e, {
|
|
11787
11827
|
flexDirection: "column",
|
|
11788
11828
|
borderStyle: "round",
|
|
@@ -11835,9 +11875,9 @@ var hr = ({ header: t, children: n, sidebar: r, modal: i, footer: o, columns: s
|
|
|
11835
11875
|
color: "gray",
|
|
11836
11876
|
children: [
|
|
11837
11877
|
"[",
|
|
11838
|
-
|
|
11878
|
+
f,
|
|
11839
11879
|
"/",
|
|
11840
|
-
|
|
11880
|
+
d,
|
|
11841
11881
|
"] Status:",
|
|
11842
11882
|
" "
|
|
11843
11883
|
]
|
|
@@ -11851,9 +11891,9 @@ var hr = ({ header: t, children: n, sidebar: r, modal: i, footer: o, columns: s
|
|
|
11851
11891
|
}),
|
|
11852
11892
|
/* @__PURE__ */ x(e, {
|
|
11853
11893
|
marginY: 0,
|
|
11854
|
-
children: /* @__PURE__ */ x(
|
|
11855
|
-
completed:
|
|
11856
|
-
total:
|
|
11894
|
+
children: /* @__PURE__ */ x(_r, {
|
|
11895
|
+
completed: f,
|
|
11896
|
+
total: d,
|
|
11857
11897
|
width: 24
|
|
11858
11898
|
})
|
|
11859
11899
|
}),
|
|
@@ -11862,7 +11902,7 @@ var hr = ({ header: t, children: n, sidebar: r, modal: i, footer: o, columns: s
|
|
|
11862
11902
|
marginTop: 1,
|
|
11863
11903
|
children: s.map((e, t) => /* @__PURE__ */ x(xr, {
|
|
11864
11904
|
stepIndex: e.order || t + 1,
|
|
11865
|
-
totalSteps:
|
|
11905
|
+
totalSteps: d,
|
|
11866
11906
|
title: e.title,
|
|
11867
11907
|
status: e.status,
|
|
11868
11908
|
riskLevel: e.riskLevel,
|
|
@@ -13275,6 +13315,10 @@ var hr = ({ header: t, children: n, sidebar: r, modal: i, footer: o, columns: s
|
|
|
13275
13315
|
cmd: "/task <num>",
|
|
13276
13316
|
desc: "View task details by index"
|
|
13277
13317
|
},
|
|
13318
|
+
{
|
|
13319
|
+
cmd: "/sessions",
|
|
13320
|
+
desc: "List past sessions"
|
|
13321
|
+
},
|
|
13278
13322
|
{
|
|
13279
13323
|
cmd: "/git",
|
|
13280
13324
|
desc: "Inspect git repository status and branch"
|
|
@@ -13572,159 +13616,207 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
13572
13616
|
})
|
|
13573
13617
|
]
|
|
13574
13618
|
});
|
|
13575
|
-
}, Br = ({ agent: n, productRuntime: a, cwd: o = process.cwd(), providerName: s, modelName: c, approvalResolver: l, onExit: u, configError: d, projectContext: f, sessionStore: p, initialSessionData: m,
|
|
13576
|
-
let
|
|
13577
|
-
|
|
13619
|
+
}, Br = ({ agent: n, productRuntime: a, cwd: o = process.cwd(), providerName: s, modelName: c, approvalResolver: l, onExit: u, configError: d, projectContext: f, sessionStore: p, initialSessionData: m, sessionId: h, gitRepository: g, checkpointManager: C, recoveryManager: te, executionPolicy: ne }) => {
|
|
13620
|
+
let re = g || new ke(), ie = C || (n && "getCheckpointManager" in n && typeof n.getCheckpointManager == "function" ? n.getCheckpointManager() : new qe(void 0, re)), ae = te || (n && "getRecoveryManager" in n && typeof n.getRecoveryManager == "function" ? n.getRecoveryManager() : new Ze(void 0, re));
|
|
13621
|
+
ne || (n && "getExecutionPolicy" in n && typeof n.getExecutionPolicy == "function" ? n.getExecutionPolicy() : new nt());
|
|
13578
13622
|
let [w] = b(() => {
|
|
13579
13623
|
if (a) return a;
|
|
13580
|
-
if (n && "run" in n && "assessTaskRisk" in n) return new
|
|
13624
|
+
if (n && "run" in n && "assessTaskRisk" in n) return new Pe({
|
|
13581
13625
|
agentRuntime: n,
|
|
13582
|
-
gitRepository:
|
|
13626
|
+
gitRepository: re,
|
|
13583
13627
|
approvalResolver: l,
|
|
13584
13628
|
initialCwd: o,
|
|
13585
|
-
initialSessionId: m?.sessionId
|
|
13629
|
+
initialSessionId: h || m?.sessionId
|
|
13586
13630
|
});
|
|
13587
|
-
}), { exit:
|
|
13631
|
+
}), { exit: oe } = r(), [T, E] = b(""), [D, O] = b("main"), [se, ce] = b([]), [le, ue] = b(void 0), [k, de] = b(void 0), [fe, pe] = b(void 0);
|
|
13632
|
+
v(() => {
|
|
13633
|
+
D === "git" && (async () => {
|
|
13634
|
+
try {
|
|
13635
|
+
let e = await re.getStatus(o), t = tr.formatGitStatus(e);
|
|
13636
|
+
pe(t);
|
|
13637
|
+
} catch (e) {
|
|
13638
|
+
let t = e instanceof Error ? e.message : String(e);
|
|
13639
|
+
pe(`✗ Git error: ${t}\n`);
|
|
13640
|
+
}
|
|
13641
|
+
})();
|
|
13642
|
+
}, [
|
|
13643
|
+
D,
|
|
13644
|
+
o,
|
|
13645
|
+
re
|
|
13646
|
+
]), v(() => {
|
|
13647
|
+
if (D === "runs") (async () => {
|
|
13648
|
+
try {
|
|
13649
|
+
let e = [];
|
|
13650
|
+
n && "listHistoricalRuns" in n && typeof n.listHistoricalRuns == "function" ? e = await n.listHistoricalRuns() : w && w.getHistoricalRuns && (e = await w.getHistoricalRuns()), e && e.length > 0 && ce(e.map((e) => ({
|
|
13651
|
+
runId: e.runId,
|
|
13652
|
+
status: e.finalStatus || e.executionState || "unknown",
|
|
13653
|
+
userRequestSummary: e.userRequestSummary,
|
|
13654
|
+
durationMs: e.durationMs,
|
|
13655
|
+
startedAt: e.startedAt,
|
|
13656
|
+
projectId: e.projectId
|
|
13657
|
+
})));
|
|
13658
|
+
} catch {}
|
|
13659
|
+
})();
|
|
13660
|
+
else if (D === "diagnostics") try {
|
|
13661
|
+
let e;
|
|
13662
|
+
n && "getRunSummary" in n && typeof n.getRunSummary == "function" ? e = n.getRunSummary() : w && w.getDiagnosticsSummary && (e = w.getDiagnosticsSummary()), e && ue(e);
|
|
13663
|
+
} catch {}
|
|
13664
|
+
}, [
|
|
13665
|
+
D,
|
|
13666
|
+
n,
|
|
13667
|
+
w
|
|
13668
|
+
]);
|
|
13669
|
+
let [me] = b(() => p || new Xn()), [he] = b(() => h || m?.sessionId || `session-${Date.now()}-${Math.random().toString(36).substring(2, 7)}`), [ge, A] = b(() => m?.taskCount || 0), [j, _e] = b(() => m?.completedTaskSummaries || []), ve = y(m?.completedTaskSummaries || []);
|
|
13588
13670
|
v(() => {
|
|
13589
|
-
|
|
13590
|
-
}, [
|
|
13591
|
-
let [
|
|
13671
|
+
ve.current = j;
|
|
13672
|
+
}, [j]);
|
|
13673
|
+
let [M, N] = b(() => m?.status || "idle"), [P, ye] = b(void 0), be = y(m?.startedAt ? new Date(m.startedAt) : /* @__PURE__ */ new Date()), [xe, F] = b(() => m ? [{
|
|
13592
13674
|
id: `init-${Date.now()}`,
|
|
13593
13675
|
prompt: `--resume ${m.sessionId}`,
|
|
13594
|
-
response:
|
|
13676
|
+
response: er.formatResumeSummary(m),
|
|
13595
13677
|
status: "done"
|
|
13596
|
-
}] : []), [
|
|
13597
|
-
if (!G && !
|
|
13598
|
-
O("help"), E(""),
|
|
13678
|
+
}] : []), [I, Se] = b(!1), [Ce, we] = b(void 0), [Te, Ee] = b(void 0), [De, Oe] = b(null), [Ae, L] = b(0), Me = y(!1), [R, Fe] = b(null), [Ie, Le] = b(""), [Re, ze] = b(""), [Be, Ve] = b(""), [He, Ue] = b(""), [We, Ge] = b(""), [z, Ke] = b(null), [B, V] = b(null), [H, Je] = b(null), [U, Ye] = b(null), [W, Xe] = b(null), G = !!R || !!H || !!U || !!W || !!B || !!z, K = !I && !G && T.startsWith("/") && !T.includes(" ") ? lr(T) : [], Qe = (e) => {
|
|
13679
|
+
if (!G && !I && D === "main" && T === "" && e === "?") {
|
|
13680
|
+
O("help"), E(""), L(0);
|
|
13599
13681
|
return;
|
|
13600
13682
|
}
|
|
13601
|
-
if (!G && !
|
|
13683
|
+
if (!G && !I && D !== "main" && !e.startsWith("/") && e.length === 1) {
|
|
13602
13684
|
let t = e.toLowerCase();
|
|
13603
13685
|
if (t === "p") {
|
|
13604
|
-
O(D === "plan" ? "main" : "plan"), E(""),
|
|
13686
|
+
O(D === "plan" ? "main" : "plan"), E(""), L(0);
|
|
13605
13687
|
return;
|
|
13606
13688
|
}
|
|
13607
13689
|
if (t === "r") {
|
|
13608
|
-
O(D === "runs" ? "main" : "runs"), E(""),
|
|
13690
|
+
O(D === "runs" ? "main" : "runs"), E(""), L(0);
|
|
13609
13691
|
return;
|
|
13610
13692
|
}
|
|
13611
13693
|
if (t === "d") {
|
|
13612
|
-
O(D === "diagnostics" ? "main" : "diagnostics"), E(""),
|
|
13694
|
+
O(D === "diagnostics" ? "main" : "diagnostics"), E(""), L(0);
|
|
13613
13695
|
return;
|
|
13614
13696
|
}
|
|
13615
13697
|
if (t === "?" || t === "h") {
|
|
13616
|
-
O(D === "help" ? "main" : "help"), E(""),
|
|
13698
|
+
O(D === "help" ? "main" : "help"), E(""), L(0);
|
|
13617
13699
|
return;
|
|
13618
13700
|
}
|
|
13619
13701
|
}
|
|
13620
|
-
E(e),
|
|
13621
|
-
}, [q,
|
|
13702
|
+
E(e), L(0);
|
|
13703
|
+
}, [q, $e] = b(() => w?.getUIState?.());
|
|
13622
13704
|
v(() => {
|
|
13623
13705
|
if (!w || !w.subscribe) return;
|
|
13624
13706
|
let e = w.subscribe((e) => {
|
|
13625
|
-
|
|
13707
|
+
$e(e);
|
|
13626
13708
|
});
|
|
13627
13709
|
return () => {
|
|
13628
13710
|
e();
|
|
13629
13711
|
};
|
|
13630
13712
|
}, [w]), v(() => {
|
|
13631
13713
|
l && (l.onRequest = (e) => {
|
|
13632
|
-
|
|
13714
|
+
Fe((t) => t && t.id === e.id ? {
|
|
13633
13715
|
...e,
|
|
13634
13716
|
changeReview: e.changeReview || t.changeReview,
|
|
13635
13717
|
reason: e.reason || t.reason
|
|
13636
13718
|
} : e);
|
|
13637
13719
|
});
|
|
13638
13720
|
}, [l]), v(() => {
|
|
13639
|
-
if (
|
|
13640
|
-
let e =
|
|
13641
|
-
|
|
13721
|
+
if (Me.current && !I && De) {
|
|
13722
|
+
let e = De;
|
|
13723
|
+
Oe(null), J(e);
|
|
13724
|
+
}
|
|
13725
|
+
Me.current = I;
|
|
13726
|
+
}, [I, De]), v(() => {
|
|
13727
|
+
if (!I || !Ce) {
|
|
13728
|
+
Ee(void 0);
|
|
13729
|
+
return;
|
|
13642
13730
|
}
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13731
|
+
Ee(Date.now() - Ce);
|
|
13732
|
+
let e = setInterval(() => {
|
|
13733
|
+
Ee(Date.now() - Ce);
|
|
13734
|
+
}, 500);
|
|
13735
|
+
return () => clearInterval(e);
|
|
13736
|
+
}, [I, Ce]);
|
|
13737
|
+
let et = _(async (e, t, r) => {
|
|
13646
13738
|
try {
|
|
13647
|
-
let i = t ? [...
|
|
13648
|
-
t && (
|
|
13739
|
+
let i = t ? [...ve.current, t] : ve.current;
|
|
13740
|
+
t && (ve.current = i, _e(i));
|
|
13649
13741
|
let a = n?.getState?.()?.messages || [], l = i.filter((e) => e && (e.request || e.status || e.taskId)), u = a.filter((e) => e ? typeof e.content != "string" || e.content.trim().length > 0 || !!(e.toolCalls && e.toolCalls.length > 0) : !1);
|
|
13650
|
-
await
|
|
13742
|
+
await me.save({
|
|
13651
13743
|
version: 1,
|
|
13652
|
-
sessionId:
|
|
13744
|
+
sessionId: he,
|
|
13653
13745
|
workingDirectory: o,
|
|
13654
13746
|
provider: s || "unknown",
|
|
13655
13747
|
model: c || "unknown",
|
|
13656
|
-
startedAt:
|
|
13748
|
+
startedAt: be.current.toISOString(),
|
|
13657
13749
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13658
|
-
taskCount: r === void 0 ?
|
|
13750
|
+
taskCount: r === void 0 ? ge : r,
|
|
13659
13751
|
status: e,
|
|
13660
13752
|
completedTaskSummaries: l,
|
|
13661
13753
|
messages: u
|
|
13662
13754
|
});
|
|
13663
13755
|
} catch {}
|
|
13664
13756
|
}, [
|
|
13665
|
-
|
|
13666
|
-
|
|
13757
|
+
me,
|
|
13758
|
+
he,
|
|
13667
13759
|
o,
|
|
13668
13760
|
s,
|
|
13669
13761
|
c,
|
|
13670
|
-
|
|
13762
|
+
ge,
|
|
13671
13763
|
n
|
|
13672
|
-
]),
|
|
13764
|
+
]), tt = _(async () => {
|
|
13673
13765
|
try {
|
|
13674
|
-
await
|
|
13766
|
+
await et(M);
|
|
13675
13767
|
} catch {}
|
|
13676
|
-
u ? u() :
|
|
13768
|
+
u ? u() : oe();
|
|
13677
13769
|
}, [
|
|
13678
13770
|
u,
|
|
13679
|
-
|
|
13680
|
-
|
|
13681
|
-
|
|
13771
|
+
oe,
|
|
13772
|
+
et,
|
|
13773
|
+
M
|
|
13682
13774
|
]);
|
|
13683
13775
|
i((e, t) => {
|
|
13684
13776
|
if (t.tab && K.length > 0) {
|
|
13685
|
-
let e = Math.max(0, Math.min(
|
|
13686
|
-
t && (E(t.command + " "),
|
|
13777
|
+
let e = Math.max(0, Math.min(Ae, K.length - 1)), t = K[e];
|
|
13778
|
+
t && (E(t.command + " "), L(0));
|
|
13687
13779
|
return;
|
|
13688
13780
|
}
|
|
13689
13781
|
if (t.downArrow && K.length > 0) {
|
|
13690
|
-
|
|
13782
|
+
L((e) => (e + 1) % K.length);
|
|
13691
13783
|
return;
|
|
13692
13784
|
}
|
|
13693
13785
|
if (t.upArrow && K.length > 0) {
|
|
13694
|
-
|
|
13786
|
+
L((e) => e <= 0 ? K.length - 1 : e - 1);
|
|
13695
13787
|
return;
|
|
13696
13788
|
}
|
|
13697
13789
|
let r = () => {
|
|
13698
|
-
if (
|
|
13790
|
+
if (R) return l && l.cancelPending("Approval request cancelled via Ctrl+C"), Fe(null), Le(""), !0;
|
|
13699
13791
|
if (H) {
|
|
13700
13792
|
let e = H;
|
|
13701
|
-
|
|
13793
|
+
Je(null), ze("");
|
|
13702
13794
|
try {
|
|
13703
13795
|
n && "resolveExecutionDecision" in n && n.resolveExecutionDecision(e.plan.planId, "cancel", { cwd: o }).catch(() => {}), n && "cancel" in n && n.cancel().catch(() => {});
|
|
13704
13796
|
} catch {}
|
|
13705
|
-
return
|
|
13797
|
+
return F((e) => [...e, {
|
|
13706
13798
|
id: `cmd-${Date.now()}`,
|
|
13707
13799
|
prompt: "",
|
|
13708
13800
|
response: `${$.formatCancelNotice()}\n`,
|
|
13709
13801
|
status: "done"
|
|
13710
13802
|
}]), !0;
|
|
13711
13803
|
}
|
|
13712
|
-
return U ? (
|
|
13804
|
+
return U ? (Ye(null), Ve(""), F((e) => [...e, {
|
|
13713
13805
|
id: `cmd-${Date.now()}`,
|
|
13714
13806
|
prompt: "",
|
|
13715
13807
|
response: "✓ Recovery cancelled\n",
|
|
13716
13808
|
status: "done"
|
|
13717
|
-
}]), !0) : W ? (
|
|
13809
|
+
}]), !0) : W ? (Xe(null), Ve(""), F((e) => [...e, {
|
|
13718
13810
|
id: `cmd-${Date.now()}`,
|
|
13719
13811
|
prompt: "",
|
|
13720
13812
|
response: "Continuation cancelled.\n",
|
|
13721
13813
|
status: "done"
|
|
13722
|
-
}]), !0) :
|
|
13814
|
+
}]), !0) : B ? (V(null), Ue(""), F((e) => [...e, {
|
|
13723
13815
|
id: `cmd-${Date.now()}`,
|
|
13724
13816
|
prompt: "",
|
|
13725
13817
|
response: "Replanning cancelled.\n",
|
|
13726
13818
|
status: "done"
|
|
13727
|
-
}]), !0) :
|
|
13819
|
+
}]), !0) : z ? (Ke(null), Ge(""), F((e) => [...e, {
|
|
13728
13820
|
id: `cmd-${Date.now()}`,
|
|
13729
13821
|
prompt: "",
|
|
13730
13822
|
response: "✗ Resume cancelled by user.\n",
|
|
@@ -13732,23 +13824,23 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
13732
13824
|
}]), !0) : !1;
|
|
13733
13825
|
};
|
|
13734
13826
|
if (t.ctrl && e === "c") {
|
|
13735
|
-
if (
|
|
13736
|
-
|
|
13827
|
+
if (De) {
|
|
13828
|
+
Oe(null);
|
|
13737
13829
|
return;
|
|
13738
13830
|
}
|
|
13739
13831
|
if (r()) return;
|
|
13740
|
-
if (
|
|
13741
|
-
n.cancel().catch(() => {}),
|
|
13832
|
+
if (I && n) {
|
|
13833
|
+
n.cancel().catch(() => {}), Se(!1), Oe(null), N("cancelled"), ye(void 0);
|
|
13742
13834
|
let e = {
|
|
13743
|
-
taskIndex:
|
|
13744
|
-
request:
|
|
13835
|
+
taskIndex: ge,
|
|
13836
|
+
request: P || "Task",
|
|
13745
13837
|
status: "cancelled",
|
|
13746
13838
|
completedFiles: [],
|
|
13747
13839
|
verifiedCommands: [],
|
|
13748
13840
|
completedRequirements: [],
|
|
13749
13841
|
remainingRequirements: []
|
|
13750
13842
|
};
|
|
13751
|
-
|
|
13843
|
+
_e((t) => [...t, e]), et("cancelled", e).catch(() => {}), F((e) => {
|
|
13752
13844
|
if (e.length === 0) return e;
|
|
13753
13845
|
let t = [...e], n = t.length - 1;
|
|
13754
13846
|
return t[n] = {
|
|
@@ -13757,10 +13849,10 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
13757
13849
|
error: "Generation cancelled."
|
|
13758
13850
|
}, t;
|
|
13759
13851
|
});
|
|
13760
|
-
} else
|
|
13852
|
+
} else tt();
|
|
13761
13853
|
return;
|
|
13762
13854
|
}
|
|
13763
|
-
if (!G && !
|
|
13855
|
+
if (!G && !I && D !== "main" && !T.startsWith("/")) {
|
|
13764
13856
|
if (e === "p" || e === "P") {
|
|
13765
13857
|
O(D === "plan" ? "main" : "plan"), E("");
|
|
13766
13858
|
return;
|
|
@@ -13778,35 +13870,35 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
13778
13870
|
return;
|
|
13779
13871
|
}
|
|
13780
13872
|
}
|
|
13781
|
-
if (!G && !
|
|
13873
|
+
if (!G && !I && D === "main" && T === "" && e === "?") {
|
|
13782
13874
|
O("help"), E("");
|
|
13783
13875
|
return;
|
|
13784
13876
|
}
|
|
13785
13877
|
if (t.escape) {
|
|
13786
13878
|
if (r()) return;
|
|
13787
|
-
O("main"), E("");
|
|
13879
|
+
O("main"), de(void 0), E("");
|
|
13788
13880
|
return;
|
|
13789
13881
|
}
|
|
13790
13882
|
}, { isActive: !0 });
|
|
13791
|
-
let
|
|
13883
|
+
let rt = (e) => {
|
|
13792
13884
|
let t = e.trim();
|
|
13793
|
-
|
|
13885
|
+
Le(""), Fe(null), l && l.submitDecision(t);
|
|
13794
13886
|
}, J = async (e) => {
|
|
13795
|
-
let t = e.trim(), r = !!
|
|
13887
|
+
let t = e.trim(), r = !!R || !!H || !!U || !!W || !!B || !!z;
|
|
13796
13888
|
if (!t && !r) return;
|
|
13797
|
-
if (!t && r && (t = H ? "x" : "n"),
|
|
13798
|
-
|
|
13889
|
+
if (!t && r && (t = H ? "x" : "n"), I && !r) {
|
|
13890
|
+
Oe(t), E("");
|
|
13799
13891
|
return;
|
|
13800
13892
|
}
|
|
13801
|
-
if (
|
|
13893
|
+
if (I) return;
|
|
13802
13894
|
if (W) {
|
|
13803
|
-
E(""),
|
|
13895
|
+
E(""), Ve("");
|
|
13804
13896
|
let e = W;
|
|
13805
|
-
|
|
13897
|
+
Xe(null);
|
|
13806
13898
|
let r = t.toLowerCase();
|
|
13807
13899
|
if (r === "y" || r === "yes" || r === "c" || r === "continue") {
|
|
13808
13900
|
let r = `turn-${Date.now()}`;
|
|
13809
|
-
if (
|
|
13901
|
+
if (F((e) => [...e, {
|
|
13810
13902
|
id: r,
|
|
13811
13903
|
prompt: t,
|
|
13812
13904
|
response: "Starting continuation...\n",
|
|
@@ -13818,34 +13910,34 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
13818
13910
|
decision: "continue",
|
|
13819
13911
|
approved: !0,
|
|
13820
13912
|
cwd: o
|
|
13821
|
-
})) t.type === "plan_step_started" ?
|
|
13913
|
+
})) t.type === "plan_step_started" ? F((n) => n.map((n) => n.id === r ? {
|
|
13822
13914
|
...n,
|
|
13823
13915
|
response: n.response + `[${t.stepIndex + 1}/${e.plan.steps.length}] ${t.title || "Step"} ...\n`
|
|
13824
|
-
} : n)) : t.type === "plan_step_completed" ?
|
|
13916
|
+
} : n)) : t.type === "plan_step_completed" ? F((e) => e.map((e) => e.id === r ? {
|
|
13825
13917
|
...e,
|
|
13826
13918
|
response: e.response + "✓ COMPLETED\n\n"
|
|
13827
|
-
} : e)) : t.type === "recovery_continuation_completed" || t.type === "plan_execution_completed" ?
|
|
13919
|
+
} : e)) : t.type === "recovery_continuation_completed" || t.type === "plan_execution_completed" ? F((e) => e.map((e) => e.id === r ? {
|
|
13828
13920
|
...e,
|
|
13829
13921
|
status: "done",
|
|
13830
13922
|
response: e.response.includes("✓ Plan completed") ? e.response : e.response + "✓ Plan completed\n"
|
|
13831
|
-
} : e)) : t.type === "recovery_continuation_blocked" ?
|
|
13923
|
+
} : e)) : t.type === "recovery_continuation_blocked" ? F((e) => e.map((e) => e.id === r ? {
|
|
13832
13924
|
...e,
|
|
13833
13925
|
status: "done",
|
|
13834
13926
|
response: e.response + `⚠ Continuation blocked: ${t.blockingReasons.join("; ")}\n`
|
|
13835
|
-
} : e)) : t.type === "recovery_continuation_cancelled" &&
|
|
13927
|
+
} : e)) : t.type === "recovery_continuation_cancelled" && F((e) => e.map((e) => e.id === r ? {
|
|
13836
13928
|
...e,
|
|
13837
13929
|
status: "done",
|
|
13838
13930
|
response: e.response + "Continuation cancelled.\n"
|
|
13839
13931
|
} : e));
|
|
13840
13932
|
} catch (e) {
|
|
13841
13933
|
let t = e instanceof Error ? e.message : String(e);
|
|
13842
|
-
|
|
13934
|
+
F((e) => e.map((e) => e.id === r ? {
|
|
13843
13935
|
...e,
|
|
13844
13936
|
status: "error",
|
|
13845
13937
|
response: e.response + `✗ Continuation error: ${t}\n`
|
|
13846
13938
|
} : e));
|
|
13847
13939
|
}
|
|
13848
|
-
} else
|
|
13940
|
+
} else F((e) => [...e, {
|
|
13849
13941
|
id: `cmd-${Date.now()}`,
|
|
13850
13942
|
prompt: t,
|
|
13851
13943
|
response: "Continuation cancelled.\n",
|
|
@@ -13854,13 +13946,13 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
13854
13946
|
return;
|
|
13855
13947
|
}
|
|
13856
13948
|
if (U) {
|
|
13857
|
-
E(""),
|
|
13949
|
+
E(""), Ve("");
|
|
13858
13950
|
let e = U;
|
|
13859
|
-
|
|
13951
|
+
Ye(null);
|
|
13860
13952
|
let r = t.toLowerCase();
|
|
13861
13953
|
if (r === "y" || r === "yes" || r === "p" || r === "proceed") {
|
|
13862
13954
|
let r = `turn-${Date.now()}`;
|
|
13863
|
-
|
|
13955
|
+
F((e) => [...e, {
|
|
13864
13956
|
id: r,
|
|
13865
13957
|
prompt: t,
|
|
13866
13958
|
response: "Recovery started\n",
|
|
@@ -13870,27 +13962,27 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
13870
13962
|
if (n && "executeExecutionRecovery" in n) for await (let t of n.executeExecutionRecovery(e.assessment, {
|
|
13871
13963
|
cwd: o,
|
|
13872
13964
|
approved: !0
|
|
13873
|
-
})) if (t.type === "recovery_step_started")
|
|
13965
|
+
})) if (t.type === "recovery_step_started") F((e) => e.map((e) => e.id === r ? {
|
|
13874
13966
|
...e,
|
|
13875
13967
|
response: e.response + `[${t.stepIndex}/${t.totalSteps}] ${t.title} ... `
|
|
13876
13968
|
} : e));
|
|
13877
|
-
else if (t.type === "recovery_step_completed")
|
|
13969
|
+
else if (t.type === "recovery_step_completed") F((e) => e.map((e) => e.id === r ? {
|
|
13878
13970
|
...e,
|
|
13879
13971
|
response: e.response + `${t.success ? "✓" : "✗"}\n`
|
|
13880
13972
|
} : e));
|
|
13881
|
-
else if (t.type === "recovery_verification_started")
|
|
13973
|
+
else if (t.type === "recovery_verification_started") F((e) => e.map((e) => e.id === r ? {
|
|
13882
13974
|
...e,
|
|
13883
13975
|
response: e.response + "\nVerification\n"
|
|
13884
13976
|
} : e));
|
|
13885
|
-
else if (t.type === "recovery_verification_completed")
|
|
13977
|
+
else if (t.type === "recovery_verification_completed") F((e) => e.map((e) => e.id === r ? {
|
|
13886
13978
|
...e,
|
|
13887
13979
|
response: e.response + `${t.success ? "✓" : "✗"} ${t.command}\n\n`
|
|
13888
13980
|
} : e));
|
|
13889
|
-
else if (t.type === "recovery_reconciliation_started")
|
|
13981
|
+
else if (t.type === "recovery_reconciliation_started") F((e) => e.map((e) => e.id === r ? {
|
|
13890
13982
|
...e,
|
|
13891
13983
|
response: e.response + "Workspace reconciliation\n"
|
|
13892
13984
|
} : e));
|
|
13893
|
-
else if (t.type === "recovery_reconciliation_completed")
|
|
13985
|
+
else if (t.type === "recovery_reconciliation_completed") F((e) => e.map((e) => e.id === r ? {
|
|
13894
13986
|
...e,
|
|
13895
13987
|
response: e.response + `${t.result.consistent ? "✓ Workspace consistent" : "⚠ Inconsistent"}\n\n`
|
|
13896
13988
|
} : e));
|
|
@@ -13906,12 +13998,12 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
13906
13998
|
});
|
|
13907
13999
|
} catch {}
|
|
13908
14000
|
if (a && a.canContinue) {
|
|
13909
|
-
|
|
14001
|
+
Xe({
|
|
13910
14002
|
plan: e.plan,
|
|
13911
14003
|
preparation: a
|
|
13912
14004
|
});
|
|
13913
14005
|
let t = $.formatRecoveryContinuationPrompt(a);
|
|
13914
|
-
|
|
14006
|
+
F((e) => e.map((e) => e.id === r ? {
|
|
13915
14007
|
...e,
|
|
13916
14008
|
status: "done",
|
|
13917
14009
|
response: `${i}\n\n${t}\n`
|
|
@@ -13931,17 +14023,17 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
13931
14023
|
reconciliationConsistent: !0,
|
|
13932
14024
|
requiresExplicitApproval: !0
|
|
13933
14025
|
};
|
|
13934
|
-
|
|
14026
|
+
Xe({
|
|
13935
14027
|
plan: e.plan,
|
|
13936
14028
|
preparation: a
|
|
13937
14029
|
});
|
|
13938
14030
|
let o = $.formatRecoveryContinuationPrompt(a);
|
|
13939
|
-
|
|
14031
|
+
F((e) => e.map((e) => e.id === r ? {
|
|
13940
14032
|
...e,
|
|
13941
14033
|
status: "done",
|
|
13942
14034
|
response: `${i}\n\n${o}\n`
|
|
13943
14035
|
} : e));
|
|
13944
|
-
} else
|
|
14036
|
+
} else F((e) => e.map((e) => e.id === r ? {
|
|
13945
14037
|
...e,
|
|
13946
14038
|
status: "done",
|
|
13947
14039
|
response: `${i}\n\n✓ Plan completed\n`
|
|
@@ -13960,34 +14052,34 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
13960
14052
|
requiresUserConfirmation: !0,
|
|
13961
14053
|
recommendedAction: "replan"
|
|
13962
14054
|
};
|
|
13963
|
-
|
|
14055
|
+
Je({
|
|
13964
14056
|
plan: e.plan,
|
|
13965
14057
|
assessment: n,
|
|
13966
14058
|
reconciliationResult: t.result.reconciliationResult
|
|
13967
|
-
}),
|
|
14059
|
+
}), F((e) => e.map((e) => e.id === r ? {
|
|
13968
14060
|
...e,
|
|
13969
14061
|
status: "done",
|
|
13970
14062
|
response: `${i}\n`
|
|
13971
14063
|
} : e));
|
|
13972
|
-
} else
|
|
14064
|
+
} else F((e) => e.map((e) => e.id === r ? {
|
|
13973
14065
|
...e,
|
|
13974
14066
|
status: "done",
|
|
13975
14067
|
response: `${i}\n`
|
|
13976
14068
|
} : e));
|
|
13977
|
-
} else t.type === "recovery_completed" &&
|
|
14069
|
+
} else t.type === "recovery_completed" && F((e) => e.map((e) => e.id === r ? {
|
|
13978
14070
|
...e,
|
|
13979
14071
|
status: "done",
|
|
13980
14072
|
response: e.response.includes("Recovery completed") ? e.response : e.response + "✓ Recovery completed\n"
|
|
13981
14073
|
} : e));
|
|
13982
14074
|
} catch (e) {
|
|
13983
14075
|
let t = e instanceof Error ? e.message : String(e);
|
|
13984
|
-
|
|
14076
|
+
F((e) => e.map((e) => e.id === r ? {
|
|
13985
14077
|
...e,
|
|
13986
14078
|
status: "error",
|
|
13987
14079
|
response: e.response + `✗ Recovery error: ${t}\n`
|
|
13988
14080
|
} : e));
|
|
13989
14081
|
}
|
|
13990
|
-
} else
|
|
14082
|
+
} else F((e) => [...e, {
|
|
13991
14083
|
id: `cmd-${Date.now()}`,
|
|
13992
14084
|
prompt: t,
|
|
13993
14085
|
response: "✓ Recovery cancelled\n",
|
|
@@ -13996,9 +14088,9 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
13996
14088
|
return;
|
|
13997
14089
|
}
|
|
13998
14090
|
if (H) {
|
|
13999
|
-
E("");
|
|
14091
|
+
E(""), ze("");
|
|
14000
14092
|
let e = H;
|
|
14001
|
-
|
|
14093
|
+
Je(null);
|
|
14002
14094
|
let r = t.toLowerCase(), i = !!e.reconciliationResult;
|
|
14003
14095
|
if (i && (r === "r" || r === "recover" || r === "recovery")) try {
|
|
14004
14096
|
if (n && "assessExecutionRecovery" in n) {
|
|
@@ -14006,12 +14098,12 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14006
14098
|
cwd: o,
|
|
14007
14099
|
reconciliationResult: e.reconciliationResult
|
|
14008
14100
|
});
|
|
14009
|
-
|
|
14101
|
+
Ye({
|
|
14010
14102
|
assessment: r,
|
|
14011
14103
|
plan: e.plan
|
|
14012
14104
|
});
|
|
14013
14105
|
let i = $.formatRecoveryAssessment(r);
|
|
14014
|
-
|
|
14106
|
+
F((e) => [...e, {
|
|
14015
14107
|
id: `cmd-${Date.now()}`,
|
|
14016
14108
|
prompt: t,
|
|
14017
14109
|
response: `${i}\n`,
|
|
@@ -14021,7 +14113,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14021
14113
|
}
|
|
14022
14114
|
} catch (e) {
|
|
14023
14115
|
let n = e instanceof Error ? e.message : String(e);
|
|
14024
|
-
|
|
14116
|
+
F((e) => [...e, {
|
|
14025
14117
|
id: `cmd-${Date.now()}`,
|
|
14026
14118
|
prompt: t,
|
|
14027
14119
|
response: `✗ Recovery assessment error: ${n}\n`,
|
|
@@ -14032,19 +14124,19 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14032
14124
|
if (!i && (r === "r" || r === "replan") || i && (r === "p" || r === "replan")) try {
|
|
14033
14125
|
if (n && "resolveExecutionDecision" in n && await n.resolveExecutionDecision(e.plan.planId, "replan", { cwd: o }), n && "prepareReplan" in n) {
|
|
14034
14126
|
let r = await n.prepareReplan(e.plan.planId, { cwd: o });
|
|
14035
|
-
if (!r.eligible)
|
|
14127
|
+
if (!r.eligible) F((e) => [...e, {
|
|
14036
14128
|
id: `cmd-${Date.now()}`,
|
|
14037
14129
|
prompt: t,
|
|
14038
14130
|
response: `✗ Replanning not eligible: ${r.reason}\n`,
|
|
14039
14131
|
status: "done"
|
|
14040
14132
|
}]);
|
|
14041
14133
|
else {
|
|
14042
|
-
|
|
14134
|
+
V({
|
|
14043
14135
|
planId: e.plan.planId,
|
|
14044
14136
|
assessment: r
|
|
14045
14137
|
});
|
|
14046
14138
|
let n = $.formatReplanPrompt(r), i = $.formatReplanNotice();
|
|
14047
|
-
|
|
14139
|
+
F((e) => [...e, {
|
|
14048
14140
|
id: `cmd-${Date.now()}`,
|
|
14049
14141
|
prompt: t,
|
|
14050
14142
|
response: `${i}\n\n${n}\n`,
|
|
@@ -14054,7 +14146,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14054
14146
|
}
|
|
14055
14147
|
} catch (e) {
|
|
14056
14148
|
let n = e instanceof Error ? e.message : String(e);
|
|
14057
|
-
|
|
14149
|
+
F((e) => [...e, {
|
|
14058
14150
|
id: `cmd-${Date.now()}`,
|
|
14059
14151
|
prompt: t,
|
|
14060
14152
|
response: `✗ Replanning error: ${n}\n`,
|
|
@@ -14068,9 +14160,9 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14068
14160
|
let t = await n.resolveExecutionDecision(e.plan.planId, "continue", { cwd: o }), i = e.plan.steps.find((e) => e.stepId === t.resumedStepId) || e.plan.steps[0];
|
|
14069
14161
|
i && (r = `${$.formatResumeNotice(e.plan.planId, i.order, e.plan.steps.length, i.title)}\n`);
|
|
14070
14162
|
}
|
|
14071
|
-
n && "getTaskPlan" in n &&
|
|
14163
|
+
n && "getTaskPlan" in n && Z(e.plan, "executing");
|
|
14072
14164
|
} catch {}
|
|
14073
|
-
|
|
14165
|
+
F((e) => [...e, {
|
|
14074
14166
|
id: `cmd-${Date.now()}`,
|
|
14075
14167
|
prompt: t,
|
|
14076
14168
|
response: r,
|
|
@@ -14080,7 +14172,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14080
14172
|
try {
|
|
14081
14173
|
n && "resolveExecutionDecision" in n && await n.resolveExecutionDecision(e.plan.planId, "cancel", { cwd: o }), n && "cancel" in n && await n.cancel();
|
|
14082
14174
|
} catch {}
|
|
14083
|
-
|
|
14175
|
+
F((e) => [...e, {
|
|
14084
14176
|
id: `cmd-${Date.now()}`,
|
|
14085
14177
|
prompt: t,
|
|
14086
14178
|
response: `${$.formatCancelNotice()}\n`,
|
|
@@ -14089,10 +14181,10 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14089
14181
|
}
|
|
14090
14182
|
return;
|
|
14091
14183
|
}
|
|
14092
|
-
if (
|
|
14093
|
-
E("");
|
|
14094
|
-
let e =
|
|
14095
|
-
if (
|
|
14184
|
+
if (B) {
|
|
14185
|
+
E(""), Ue("");
|
|
14186
|
+
let e = B;
|
|
14187
|
+
if (V(null), t.toLowerCase() === "y" || t.toLowerCase() === "yes") try {
|
|
14096
14188
|
if (n && "executeReplan" in n) {
|
|
14097
14189
|
let r = await n.executeReplan({
|
|
14098
14190
|
runId: `run-replan-${Date.now()}`,
|
|
@@ -14106,13 +14198,13 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14106
14198
|
});
|
|
14107
14199
|
if (r.status === "created" && r.newPlan) {
|
|
14108
14200
|
let e = $.formatPlanDetail(r.newPlan);
|
|
14109
|
-
|
|
14201
|
+
F((n) => [...n, {
|
|
14110
14202
|
id: `cmd-${Date.now()}`,
|
|
14111
14203
|
prompt: t,
|
|
14112
14204
|
response: `✓ Created replacement plan: ${r.newPlanId}\n\n${e}\n\nType /plan to inspect or approve when ready.\n`,
|
|
14113
14205
|
status: "done"
|
|
14114
14206
|
}]);
|
|
14115
|
-
} else
|
|
14207
|
+
} else F((e) => [...e, {
|
|
14116
14208
|
id: `cmd-${Date.now()}`,
|
|
14117
14209
|
prompt: t,
|
|
14118
14210
|
response: `✗ Replanning failed: ${r.reason}\n`,
|
|
@@ -14121,14 +14213,14 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14121
14213
|
}
|
|
14122
14214
|
} catch (e) {
|
|
14123
14215
|
let n = e instanceof Error ? e.message : String(e);
|
|
14124
|
-
|
|
14216
|
+
F((e) => [...e, {
|
|
14125
14217
|
id: `cmd-${Date.now()}`,
|
|
14126
14218
|
prompt: t,
|
|
14127
14219
|
response: `✗ Error creating replan: ${n}\n`,
|
|
14128
14220
|
status: "done"
|
|
14129
14221
|
}]);
|
|
14130
14222
|
}
|
|
14131
|
-
else
|
|
14223
|
+
else F((e) => [...e, {
|
|
14132
14224
|
id: `cmd-${Date.now()}`,
|
|
14133
14225
|
prompt: t,
|
|
14134
14226
|
response: "Replanning cancelled.\n",
|
|
@@ -14136,46 +14228,46 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14136
14228
|
}]);
|
|
14137
14229
|
return;
|
|
14138
14230
|
}
|
|
14139
|
-
if (
|
|
14140
|
-
E("");
|
|
14141
|
-
let e =
|
|
14142
|
-
if (
|
|
14143
|
-
if (
|
|
14231
|
+
if (z) {
|
|
14232
|
+
E(""), Ge("");
|
|
14233
|
+
let e = z;
|
|
14234
|
+
if (Ke(null), t.toLowerCase() === "y" || t.toLowerCase() === "yes") {
|
|
14235
|
+
if (F((n) => [...n, {
|
|
14144
14236
|
id: `cmd-${Date.now()}`,
|
|
14145
14237
|
prompt: t,
|
|
14146
14238
|
response: `✓ Resuming run ${e.runId} as ${e.prep.newRunId}...\n`,
|
|
14147
14239
|
status: "done"
|
|
14148
14240
|
}]), n && "resumeRun" in n) {
|
|
14149
|
-
|
|
14150
|
-
let t =
|
|
14151
|
-
|
|
14241
|
+
Se(!0);
|
|
14242
|
+
let t = ge + 1;
|
|
14243
|
+
A(t), ye(e.prep.originalRun.userRequestSummary), N("in_progress");
|
|
14152
14244
|
let r = `turn-${Date.now()}`, i = {
|
|
14153
14245
|
id: r,
|
|
14154
14246
|
prompt: `Resume task: ${e.prep.originalRun.userRequestSummary}`,
|
|
14155
14247
|
response: "",
|
|
14156
14248
|
status: "streaming"
|
|
14157
14249
|
};
|
|
14158
|
-
|
|
14250
|
+
F((e) => [...e, i]);
|
|
14159
14251
|
try {
|
|
14160
|
-
for await (let t of n.resumeRun(e.runId, { cwd: o })) t.type === "text" ?
|
|
14252
|
+
for await (let t of n.resumeRun(e.runId, { cwd: o })) t.type === "text" ? F((e) => e.map((e) => e.id === r ? {
|
|
14161
14253
|
...e,
|
|
14162
14254
|
response: e.response + t.content
|
|
14163
|
-
} : e)) : t.type === "done" &&
|
|
14255
|
+
} : e)) : t.type === "done" && F((e) => e.map((e) => e.id === r ? {
|
|
14164
14256
|
...e,
|
|
14165
14257
|
status: "done"
|
|
14166
14258
|
} : e));
|
|
14167
14259
|
} catch (e) {
|
|
14168
14260
|
let t = e instanceof Error ? e.message : String(e);
|
|
14169
|
-
|
|
14261
|
+
F((e) => e.map((e) => e.id === r ? {
|
|
14170
14262
|
...e,
|
|
14171
14263
|
status: "error",
|
|
14172
14264
|
error: `✗ ${t}`
|
|
14173
14265
|
} : e));
|
|
14174
14266
|
} finally {
|
|
14175
|
-
|
|
14267
|
+
Se(!1);
|
|
14176
14268
|
}
|
|
14177
14269
|
}
|
|
14178
|
-
} else
|
|
14270
|
+
} else F((e) => [...e, {
|
|
14179
14271
|
id: `cmd-${Date.now()}`,
|
|
14180
14272
|
prompt: t,
|
|
14181
14273
|
response: "✗ Resume cancelled by user.\n",
|
|
@@ -14187,25 +14279,20 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14187
14279
|
E("");
|
|
14188
14280
|
let [e, ...r] = t.split(/\s+/), i = (e ?? "").toLowerCase(), a = r.join(" ").trim();
|
|
14189
14281
|
if (i === "/help") {
|
|
14190
|
-
O("help")
|
|
14191
|
-
id: `cmd-${Date.now()}`,
|
|
14192
|
-
prompt: t,
|
|
14193
|
-
response: "Available commands:\n /help - Show this help message\n /status - Show provider, model, and session status\n /history - Show task history in this session\n /tasks - List completed tasks\n /task <num> - View details of a specific task\n /sessions - List past sessions\n /clear - Clear conversation history\n /exit - Exit FeCode\n",
|
|
14194
|
-
status: "done"
|
|
14195
|
-
}]);
|
|
14282
|
+
O("help");
|
|
14196
14283
|
return;
|
|
14197
14284
|
}
|
|
14198
14285
|
if (i === "/status") {
|
|
14199
|
-
|
|
14286
|
+
F((e) => [...e, {
|
|
14200
14287
|
id: `cmd-${Date.now()}`,
|
|
14201
14288
|
prompt: t,
|
|
14202
|
-
response: `FeCode\n\nProvider: ${s || "unknown"}\nModel: ${c || "unknown"}\nWorking directory: ${o}\nSession: ${
|
|
14289
|
+
response: `FeCode\n\nProvider: ${s || "unknown"}\nModel: ${c || "unknown"}\nWorking directory: ${o}\nSession: ${he}\n`,
|
|
14203
14290
|
status: "done"
|
|
14204
14291
|
}]);
|
|
14205
14292
|
return;
|
|
14206
14293
|
}
|
|
14207
14294
|
if (i === "/clear") {
|
|
14208
|
-
|
|
14295
|
+
F([]), F([{
|
|
14209
14296
|
id: `cmd-${Date.now()}`,
|
|
14210
14297
|
prompt: t,
|
|
14211
14298
|
response: "✓ Conversation cleared\n\nSession history remains available through:\n /history - View completed tasks\n /tasks - List task summaries\n /status - Session details\n",
|
|
@@ -14214,12 +14301,12 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14214
14301
|
return;
|
|
14215
14302
|
}
|
|
14216
14303
|
if (i === "/exit" || i === "/quit") {
|
|
14217
|
-
await
|
|
14304
|
+
await tt();
|
|
14218
14305
|
return;
|
|
14219
14306
|
}
|
|
14220
14307
|
if (i === "/history") {
|
|
14221
|
-
let e =
|
|
14222
|
-
|
|
14308
|
+
let e = er.formatHistory(j);
|
|
14309
|
+
F((n) => [...n, {
|
|
14223
14310
|
id: `cmd-${Date.now()}`,
|
|
14224
14311
|
prompt: t,
|
|
14225
14312
|
response: e,
|
|
@@ -14228,8 +14315,8 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14228
14315
|
return;
|
|
14229
14316
|
}
|
|
14230
14317
|
if (i === "/tasks") {
|
|
14231
|
-
let e =
|
|
14232
|
-
|
|
14318
|
+
let e = er.formatTaskList(j);
|
|
14319
|
+
F((n) => [...n, {
|
|
14233
14320
|
id: `cmd-${Date.now()}`,
|
|
14234
14321
|
prompt: t,
|
|
14235
14322
|
response: e,
|
|
@@ -14239,7 +14326,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14239
14326
|
}
|
|
14240
14327
|
if (i === "/task") {
|
|
14241
14328
|
if (!a) {
|
|
14242
|
-
|
|
14329
|
+
F((e) => [...e, {
|
|
14243
14330
|
id: `cmd-${Date.now()}`,
|
|
14244
14331
|
prompt: t,
|
|
14245
14332
|
response: "Current Task\n\nNo active task.\n\nUse /tasks to see completed tasks in this session.\n",
|
|
@@ -14247,47 +14334,37 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14247
14334
|
}]);
|
|
14248
14335
|
return;
|
|
14249
14336
|
}
|
|
14250
|
-
let e = parseInt(a, 10), n =
|
|
14337
|
+
let e = parseInt(a, 10), n = j.find((t) => t.taskIndex === e);
|
|
14251
14338
|
if (n) {
|
|
14252
|
-
let e =
|
|
14253
|
-
|
|
14339
|
+
let e = er.formatTaskDetail(n);
|
|
14340
|
+
F((n) => [...n, {
|
|
14254
14341
|
id: `cmd-${Date.now()}`,
|
|
14255
14342
|
prompt: t,
|
|
14256
14343
|
response: e,
|
|
14257
14344
|
status: "done"
|
|
14258
14345
|
}]);
|
|
14259
|
-
} else
|
|
14346
|
+
} else F((e) => [...e, {
|
|
14260
14347
|
id: `cmd-${Date.now()}`,
|
|
14261
14348
|
prompt: t,
|
|
14262
|
-
response: `✗ Task not found: ${a}\n\nUse /tasks to see available tasks (1-${
|
|
14349
|
+
response: `✗ Task not found: ${a}\n\nUse /tasks to see available tasks (1-${j.length}).\n`,
|
|
14263
14350
|
status: "done"
|
|
14264
14351
|
}]);
|
|
14265
14352
|
return;
|
|
14266
14353
|
}
|
|
14267
14354
|
if (i === "/git") {
|
|
14268
14355
|
try {
|
|
14269
|
-
let e = await
|
|
14270
|
-
|
|
14271
|
-
id: `cmd-${Date.now()}`,
|
|
14272
|
-
prompt: t,
|
|
14273
|
-
response: n,
|
|
14274
|
-
status: "done"
|
|
14275
|
-
}]);
|
|
14356
|
+
let e = await re.getStatus(o), t = tr.formatGitStatus(e);
|
|
14357
|
+
pe(t), O("git");
|
|
14276
14358
|
} catch (e) {
|
|
14277
|
-
let
|
|
14278
|
-
|
|
14279
|
-
id: `cmd-${Date.now()}`,
|
|
14280
|
-
prompt: t,
|
|
14281
|
-
response: `✗ Git error: ${n}\n`,
|
|
14282
|
-
status: "done"
|
|
14283
|
-
}]);
|
|
14359
|
+
let t = e instanceof Error ? e.message : String(e);
|
|
14360
|
+
pe(`✗ Git error: ${t}\n`), O("git");
|
|
14284
14361
|
}
|
|
14285
14362
|
return;
|
|
14286
14363
|
}
|
|
14287
14364
|
if (i === "/checkpoints") {
|
|
14288
14365
|
try {
|
|
14289
|
-
let e = await
|
|
14290
|
-
|
|
14366
|
+
let e = await ie.list(), n = rr.formatCheckpointsList(e);
|
|
14367
|
+
F((e) => [...e, {
|
|
14291
14368
|
id: `cmd-${Date.now()}`,
|
|
14292
14369
|
prompt: t,
|
|
14293
14370
|
response: n,
|
|
@@ -14295,7 +14372,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14295
14372
|
}]);
|
|
14296
14373
|
} catch (e) {
|
|
14297
14374
|
let n = e instanceof Error ? e.message : String(e);
|
|
14298
|
-
|
|
14375
|
+
F((e) => [...e, {
|
|
14299
14376
|
id: `cmd-${Date.now()}`,
|
|
14300
14377
|
prompt: t,
|
|
14301
14378
|
response: `✗ Checkpoints error: ${n}\n`,
|
|
@@ -14306,11 +14383,11 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14306
14383
|
}
|
|
14307
14384
|
if (i === "/checkpoint") {
|
|
14308
14385
|
try {
|
|
14309
|
-
let e = await
|
|
14386
|
+
let e = await ie.create({
|
|
14310
14387
|
cwd: o,
|
|
14311
14388
|
reason: a || "Manual checkpoint"
|
|
14312
|
-
}), n = e.checkpoint ?
|
|
14313
|
-
|
|
14389
|
+
}), n = e.checkpoint ? rr.formatCheckpointCreated(e.checkpoint) : "✓ Checkpoint created\n";
|
|
14390
|
+
F((e) => [...e, {
|
|
14314
14391
|
id: `cmd-${Date.now()}`,
|
|
14315
14392
|
prompt: t,
|
|
14316
14393
|
response: n,
|
|
@@ -14318,7 +14395,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14318
14395
|
}]);
|
|
14319
14396
|
} catch (e) {
|
|
14320
14397
|
let n = e instanceof Error ? e.message : String(e);
|
|
14321
|
-
|
|
14398
|
+
F((e) => [...e, {
|
|
14322
14399
|
id: `cmd-${Date.now()}`,
|
|
14323
14400
|
prompt: t,
|
|
14324
14401
|
response: `✗ Checkpoint error: ${n}\n`,
|
|
@@ -14330,8 +14407,8 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14330
14407
|
if (i === "/recover") {
|
|
14331
14408
|
if (!a || a === "status") {
|
|
14332
14409
|
try {
|
|
14333
|
-
let e =
|
|
14334
|
-
|
|
14410
|
+
let e = ae.getLastRecord(), n = ir.formatRecoveryStatus(e);
|
|
14411
|
+
F((e) => [...e, {
|
|
14335
14412
|
id: `cmd-${Date.now()}`,
|
|
14336
14413
|
prompt: t,
|
|
14337
14414
|
response: n,
|
|
@@ -14339,7 +14416,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14339
14416
|
}]);
|
|
14340
14417
|
} catch (e) {
|
|
14341
14418
|
let n = e instanceof Error ? e.message : String(e);
|
|
14342
|
-
|
|
14419
|
+
F((e) => [...e, {
|
|
14343
14420
|
id: `cmd-${Date.now()}`,
|
|
14344
14421
|
prompt: t,
|
|
14345
14422
|
response: `✗ Recovery error: ${n}\n`,
|
|
@@ -14351,7 +14428,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14351
14428
|
if (a.startsWith("preview")) {
|
|
14352
14429
|
let e = a.replace("preview", "").trim();
|
|
14353
14430
|
if (!e) {
|
|
14354
|
-
|
|
14431
|
+
F((e) => [...e, {
|
|
14355
14432
|
id: `cmd-${Date.now()}`,
|
|
14356
14433
|
prompt: t,
|
|
14357
14434
|
response: "✗ Please specify a checkpoint ID for preview.\n",
|
|
@@ -14360,8 +14437,8 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14360
14437
|
return;
|
|
14361
14438
|
}
|
|
14362
14439
|
try {
|
|
14363
|
-
let n = await
|
|
14364
|
-
|
|
14440
|
+
let n = await ae.preview(e, o), r = ir.formatRecoveryPreview(n);
|
|
14441
|
+
F((e) => [...e, {
|
|
14365
14442
|
id: `cmd-${Date.now()}`,
|
|
14366
14443
|
prompt: t,
|
|
14367
14444
|
response: r,
|
|
@@ -14369,7 +14446,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14369
14446
|
}]);
|
|
14370
14447
|
} catch (e) {
|
|
14371
14448
|
let n = e instanceof Error ? e.message : String(e);
|
|
14372
|
-
|
|
14449
|
+
F((e) => [...e, {
|
|
14373
14450
|
id: `cmd-${Date.now()}`,
|
|
14374
14451
|
prompt: t,
|
|
14375
14452
|
response: `✗ Recovery preview error: ${n}\n`,
|
|
@@ -14380,40 +14457,25 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14380
14457
|
}
|
|
14381
14458
|
}
|
|
14382
14459
|
if (i === "/debug" || i === "/diagnostics") {
|
|
14383
|
-
O("diagnostics");
|
|
14384
14460
|
let e;
|
|
14385
|
-
|
|
14386
|
-
let n = ir(e);
|
|
14387
|
-
M((e) => [...e, {
|
|
14388
|
-
id: `cmd-${Date.now()}`,
|
|
14389
|
-
prompt: t,
|
|
14390
|
-
response: n,
|
|
14391
|
-
status: "done"
|
|
14392
|
-
}]);
|
|
14393
|
-
} else M((e) => [...e, {
|
|
14394
|
-
id: `cmd-${Date.now()}`,
|
|
14395
|
-
prompt: t,
|
|
14396
|
-
response: "No run diagnostics available.\n",
|
|
14397
|
-
status: "done"
|
|
14398
|
-
}]);
|
|
14461
|
+
n && "getRunSummary" in n ? e = n.getRunSummary(a || void 0) : w && w.getDiagnosticsSummary && (e = w.getDiagnosticsSummary(a || void 0)), ue(e), O("diagnostics");
|
|
14399
14462
|
return;
|
|
14400
14463
|
}
|
|
14401
14464
|
if (i === "/runs") {
|
|
14402
|
-
O("runs");
|
|
14403
14465
|
let e = [];
|
|
14404
|
-
n && "listHistoricalRuns" in n ? e = await n.listHistoricalRuns() : w && w.getHistoricalRuns && (e = await w.getHistoricalRuns())
|
|
14405
|
-
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
}
|
|
14466
|
+
n && "listHistoricalRuns" in n ? e = await n.listHistoricalRuns() : w && w.getHistoricalRuns && (e = await w.getHistoricalRuns()), ce(e.map((e) => ({
|
|
14467
|
+
runId: e.runId,
|
|
14468
|
+
status: e.finalStatus || e.executionState || "unknown",
|
|
14469
|
+
userRequestSummary: e.userRequestSummary,
|
|
14470
|
+
durationMs: e.durationMs,
|
|
14471
|
+
startedAt: e.startedAt,
|
|
14472
|
+
projectId: e.projectId
|
|
14473
|
+
}))), O("runs");
|
|
14412
14474
|
return;
|
|
14413
14475
|
}
|
|
14414
14476
|
if (i === "/run") {
|
|
14415
|
-
if (!a) {
|
|
14416
|
-
|
|
14477
|
+
if (O("main"), !a) {
|
|
14478
|
+
F((e) => [...e, {
|
|
14417
14479
|
id: `cmd-${Date.now()}`,
|
|
14418
14480
|
prompt: t,
|
|
14419
14481
|
response: "✗ Please specify a run ID: /run <id>\n",
|
|
@@ -14423,14 +14485,14 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14423
14485
|
}
|
|
14424
14486
|
let e = null;
|
|
14425
14487
|
if (n && "getHistoricalRun" in n ? e = await n.getHistoricalRun(a) : w && w.getHistoricalRun && (e = await w.getHistoricalRun(a)), e) {
|
|
14426
|
-
let n =
|
|
14427
|
-
|
|
14488
|
+
let n = sr.formatRunDetail(e);
|
|
14489
|
+
F((e) => [...e, {
|
|
14428
14490
|
id: `cmd-${Date.now()}`,
|
|
14429
14491
|
prompt: t,
|
|
14430
14492
|
response: n,
|
|
14431
14493
|
status: "done"
|
|
14432
14494
|
}]);
|
|
14433
|
-
} else
|
|
14495
|
+
} else F((e) => [...e, {
|
|
14434
14496
|
id: `cmd-${Date.now()}`,
|
|
14435
14497
|
prompt: t,
|
|
14436
14498
|
response: `✗ Run not found: ${a}\n`,
|
|
@@ -14440,8 +14502,8 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14440
14502
|
}
|
|
14441
14503
|
if (i === "/sessions") {
|
|
14442
14504
|
try {
|
|
14443
|
-
let e = await
|
|
14444
|
-
|
|
14505
|
+
let e = await me.list(), n = er.formatSessionsList(e);
|
|
14506
|
+
F((e) => [...e, {
|
|
14445
14507
|
id: `cmd-${Date.now()}`,
|
|
14446
14508
|
prompt: t,
|
|
14447
14509
|
response: n,
|
|
@@ -14449,7 +14511,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14449
14511
|
}]);
|
|
14450
14512
|
} catch (e) {
|
|
14451
14513
|
let n = e instanceof Error ? e.message : String(e);
|
|
14452
|
-
|
|
14514
|
+
F((e) => [...e, {
|
|
14453
14515
|
id: `cmd-${Date.now()}`,
|
|
14454
14516
|
prompt: t,
|
|
14455
14517
|
response: `✗ Error listing sessions: ${n}\n`,
|
|
@@ -14460,7 +14522,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14460
14522
|
}
|
|
14461
14523
|
if (i === "/delete-session") {
|
|
14462
14524
|
if (!a) {
|
|
14463
|
-
|
|
14525
|
+
F((e) => [...e, {
|
|
14464
14526
|
id: `cmd-${Date.now()}`,
|
|
14465
14527
|
prompt: t,
|
|
14466
14528
|
response: "✗ Please specify a session ID to delete.\n",
|
|
@@ -14469,8 +14531,8 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14469
14531
|
return;
|
|
14470
14532
|
}
|
|
14471
14533
|
try {
|
|
14472
|
-
let e = await
|
|
14473
|
-
|
|
14534
|
+
let e = await me.delete(a);
|
|
14535
|
+
F((n) => [...n, {
|
|
14474
14536
|
id: `cmd-${Date.now()}`,
|
|
14475
14537
|
prompt: t,
|
|
14476
14538
|
response: e ? `✓ Deleted session: ${a}\n` : `✗ Session not found: ${a}\n`,
|
|
@@ -14478,7 +14540,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14478
14540
|
}]);
|
|
14479
14541
|
} catch (e) {
|
|
14480
14542
|
let n = e instanceof Error ? e.message : String(e);
|
|
14481
|
-
|
|
14543
|
+
F((e) => [...e, {
|
|
14482
14544
|
id: `cmd-${Date.now()}`,
|
|
14483
14545
|
prompt: t,
|
|
14484
14546
|
response: `✗ Error deleting session: ${n}\n`,
|
|
@@ -14489,7 +14551,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14489
14551
|
}
|
|
14490
14552
|
if (i === "/resume") {
|
|
14491
14553
|
if (!a) {
|
|
14492
|
-
|
|
14554
|
+
F((e) => [...e, {
|
|
14493
14555
|
id: `cmd-${Date.now()}`,
|
|
14494
14556
|
prompt: t,
|
|
14495
14557
|
response: "✗ Please specify a session or run ID to resume.\n",
|
|
@@ -14498,12 +14560,12 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14498
14560
|
return;
|
|
14499
14561
|
}
|
|
14500
14562
|
try {
|
|
14501
|
-
let e = await
|
|
14563
|
+
let e = await me.load(a);
|
|
14502
14564
|
if (e) {
|
|
14503
14565
|
try {
|
|
14504
14566
|
await (await import("fs/promises")).stat(e.workingDirectory);
|
|
14505
14567
|
} catch {
|
|
14506
|
-
|
|
14568
|
+
F((n) => [...n, {
|
|
14507
14569
|
id: `cmd-${Date.now()}`,
|
|
14508
14570
|
prompt: t,
|
|
14509
14571
|
response: `⚠ Working directory no longer exists\n\nPath:\n ${e.workingDirectory}\n`,
|
|
@@ -14512,8 +14574,8 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14512
14574
|
return;
|
|
14513
14575
|
}
|
|
14514
14576
|
n && "restoreSession" in n && n.restoreSession(e);
|
|
14515
|
-
let r =
|
|
14516
|
-
|
|
14577
|
+
let r = er.formatResumeSummary(e);
|
|
14578
|
+
F((e) => [...e, {
|
|
14517
14579
|
id: `cmd-${Date.now()}`,
|
|
14518
14580
|
prompt: t,
|
|
14519
14581
|
response: r,
|
|
@@ -14524,19 +14586,19 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14524
14586
|
} catch {}
|
|
14525
14587
|
if (n && "prepareResume" in n) try {
|
|
14526
14588
|
let e = await n.prepareResume(a, o);
|
|
14527
|
-
if (!e.canResume)
|
|
14589
|
+
if (!e.canResume) F((n) => [...n, {
|
|
14528
14590
|
id: `cmd-${Date.now()}`,
|
|
14529
14591
|
prompt: t,
|
|
14530
14592
|
response: `✗ Cannot resume run: ${e.explanation}\n`,
|
|
14531
14593
|
status: "done"
|
|
14532
14594
|
}]);
|
|
14533
14595
|
else {
|
|
14534
|
-
|
|
14596
|
+
Ke({
|
|
14535
14597
|
runId: a,
|
|
14536
14598
|
prep: e
|
|
14537
14599
|
});
|
|
14538
|
-
let n =
|
|
14539
|
-
|
|
14600
|
+
let n = sr.formatResumePrompt(e);
|
|
14601
|
+
F((e) => [...e, {
|
|
14540
14602
|
id: `cmd-${Date.now()}`,
|
|
14541
14603
|
prompt: t,
|
|
14542
14604
|
response: `${n}\n`,
|
|
@@ -14545,7 +14607,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14545
14607
|
}
|
|
14546
14608
|
} catch (e) {
|
|
14547
14609
|
let n = e instanceof Error ? e.message : String(e);
|
|
14548
|
-
|
|
14610
|
+
F((e) => [...e, {
|
|
14549
14611
|
id: `cmd-${Date.now()}`,
|
|
14550
14612
|
prompt: t,
|
|
14551
14613
|
response: `✗ Resume error: ${n}\n`,
|
|
@@ -14557,19 +14619,19 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14557
14619
|
if (i === "/replan") {
|
|
14558
14620
|
if (n && "prepareReplan" in n) try {
|
|
14559
14621
|
let e = await n.prepareReplan(a || void 0, { cwd: o });
|
|
14560
|
-
if (!e.eligible)
|
|
14622
|
+
if (!e.eligible) F((n) => [...n, {
|
|
14561
14623
|
id: `cmd-${Date.now()}`,
|
|
14562
14624
|
prompt: t,
|
|
14563
14625
|
response: `✗ Replanning not eligible: ${e.reason}\n`,
|
|
14564
14626
|
status: "done"
|
|
14565
14627
|
}]);
|
|
14566
14628
|
else {
|
|
14567
|
-
|
|
14629
|
+
V({
|
|
14568
14630
|
planId: a || "active-plan",
|
|
14569
14631
|
assessment: e
|
|
14570
14632
|
});
|
|
14571
14633
|
let n = $.formatReplanPrompt(e), r = $.formatReplanNotice();
|
|
14572
|
-
|
|
14634
|
+
F((e) => [...e, {
|
|
14573
14635
|
id: `cmd-${Date.now()}`,
|
|
14574
14636
|
prompt: t,
|
|
14575
14637
|
response: `${r}\n\n${n}\n`,
|
|
@@ -14578,7 +14640,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14578
14640
|
}
|
|
14579
14641
|
} catch (e) {
|
|
14580
14642
|
let n = e instanceof Error ? e.message : String(e);
|
|
14581
|
-
|
|
14643
|
+
F((e) => [...e, {
|
|
14582
14644
|
id: `cmd-${Date.now()}`,
|
|
14583
14645
|
prompt: t,
|
|
14584
14646
|
response: `✗ Replan error: ${n}\n`,
|
|
@@ -14591,43 +14653,28 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14591
14653
|
if (O("plan"), a) {
|
|
14592
14654
|
let e;
|
|
14593
14655
|
if (n && "getRunSummary" in n && typeof n.getRunSummary == "function" ? e = n.getRunSummary(a) : w && w.getDiagnosticsSummary && (e = w.getDiagnosticsSummary(a)), e) {
|
|
14594
|
-
let
|
|
14656
|
+
let t = [
|
|
14595
14657
|
`Task Plan for Run: ${e.runId}`,
|
|
14596
14658
|
`Plan ID: ${e.planId || "unknown"}`,
|
|
14597
14659
|
`Status: ${e.planStatus || "unknown"}`,
|
|
14598
14660
|
`Progress: ${e.completedPlanSteps ?? 0}/${e.totalPlanSteps ?? 0} completed`
|
|
14599
14661
|
];
|
|
14600
|
-
e.planSummary &&
|
|
14601
|
-
id: `cmd-${Date.now()}`,
|
|
14602
|
-
prompt: t,
|
|
14603
|
-
response: n.join("\n") + "\n",
|
|
14604
|
-
status: "done"
|
|
14605
|
-
}]);
|
|
14662
|
+
e.planSummary && t.push(`Summary: ${e.planSummary}`), de(t.join("\n") + "\n");
|
|
14606
14663
|
return;
|
|
14607
14664
|
}
|
|
14608
14665
|
}
|
|
14609
14666
|
let e;
|
|
14610
14667
|
if (n && "getTaskPlan" in n && typeof n.getTaskPlan == "function" && (e = n.getTaskPlan()), e) {
|
|
14611
|
-
let
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
prompt: t,
|
|
14615
|
-
response: n,
|
|
14616
|
-
status: "done"
|
|
14617
|
-
}]);
|
|
14618
|
-
} else M((e) => [...e, {
|
|
14619
|
-
id: `cmd-${Date.now()}`,
|
|
14620
|
-
prompt: t,
|
|
14621
|
-
response: "No active plan found.\n",
|
|
14622
|
-
status: "done"
|
|
14623
|
-
}]);
|
|
14668
|
+
let t = $.formatPlanDetail(e);
|
|
14669
|
+
de(t);
|
|
14670
|
+
} else de("No active plan found.\n");
|
|
14624
14671
|
return;
|
|
14625
14672
|
}
|
|
14626
14673
|
if (i === "/clear") {
|
|
14627
|
-
|
|
14674
|
+
F([]), E("");
|
|
14628
14675
|
return;
|
|
14629
14676
|
}
|
|
14630
|
-
|
|
14677
|
+
F((e) => [...e, {
|
|
14631
14678
|
id: `cmd-${Date.now()}`,
|
|
14632
14679
|
prompt: t,
|
|
14633
14680
|
response: `✗ Unknown command: ${i}. Type /help for available commands.\n`,
|
|
@@ -14635,9 +14682,9 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14635
14682
|
}]);
|
|
14636
14683
|
return;
|
|
14637
14684
|
}
|
|
14638
|
-
E(""),
|
|
14639
|
-
let i =
|
|
14640
|
-
|
|
14685
|
+
O("main"), de(void 0), E(""), Se(!0);
|
|
14686
|
+
let i = ge + 1;
|
|
14687
|
+
A(i), ye(t), N("in_progress");
|
|
14641
14688
|
let a = "", l;
|
|
14642
14689
|
if (n && "assessTaskRisk" in n && typeof n.assessTaskRisk == "function") try {
|
|
14643
14690
|
l = n.assessTaskRisk({
|
|
@@ -14655,30 +14702,32 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14655
14702
|
requiresExplicitApproval: !0
|
|
14656
14703
|
});
|
|
14657
14704
|
l && (l.level === "elevated" || l.level === "critical") && (a = `${`${l.level === "critical" ? "Critical" : "Elevated"}-risk task\n`}${l.requiresCheckpoint ? "Checkpoint required\n" : ""}\n`);
|
|
14658
|
-
let u = `turn-${Date.now()}`, f = Date.now()
|
|
14705
|
+
let u = `turn-${Date.now()}`, f = Date.now();
|
|
14706
|
+
we(f);
|
|
14707
|
+
let p = {
|
|
14659
14708
|
id: u,
|
|
14660
14709
|
prompt: t,
|
|
14661
14710
|
response: a,
|
|
14662
14711
|
status: "streaming"
|
|
14663
14712
|
};
|
|
14664
|
-
|
|
14713
|
+
F((e) => [...e, p]);
|
|
14665
14714
|
try {
|
|
14666
14715
|
if (!n) throw Error(d || "Agent runtime is not initialized.");
|
|
14667
14716
|
let e = n.run({
|
|
14668
14717
|
message: t,
|
|
14669
14718
|
cwd: o,
|
|
14670
|
-
sessionId:
|
|
14719
|
+
sessionId: he
|
|
14671
14720
|
}), r = "", s = /* @__PURE__ */ new Map();
|
|
14672
|
-
for await (let t of e) if (
|
|
14721
|
+
for await (let t of e) if ($e((e) => Ne(e || je({
|
|
14673
14722
|
cwd: o,
|
|
14674
|
-
sessionId:
|
|
14723
|
+
sessionId: he
|
|
14675
14724
|
}), t)), t.type === "text") {
|
|
14676
14725
|
let e = t.content;
|
|
14677
14726
|
r += e;
|
|
14678
14727
|
let n = Date.now() - f, i = r.match(/<(?:think|thinking)>([\s\S]*?)<\/(?:think|thinking)>/), o = !i && (r.includes("<think>") || r.includes("<thinking>") || r.startsWith("<think"));
|
|
14679
14728
|
if (i) {
|
|
14680
14729
|
let e = i[1].trim().split("\n")[0]?.trim() || "", t = r.replace(/<(?:think|thinking)>[\s\S]*?<\/(?:think|thinking)>/g, "").replace(/<\/?(?:think|thinking)>/g, "").trim();
|
|
14681
|
-
|
|
14730
|
+
F((r) => r.map((r) => r.id === u ? {
|
|
14682
14731
|
...r,
|
|
14683
14732
|
thinkingMs: r.thinkingMs === void 0 ? n > 0 ? n : 1e3 : r.thinkingMs,
|
|
14684
14733
|
thinkingSummary: e,
|
|
@@ -14686,12 +14735,12 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14686
14735
|
} : r));
|
|
14687
14736
|
} else if (o) {
|
|
14688
14737
|
let e = r.replace(/[\s\S]*<(?:think|thinking)>/, "").trim().split("\n")[0]?.trim() || "Thinking...";
|
|
14689
|
-
|
|
14738
|
+
F((t) => t.map((t) => t.id === u ? {
|
|
14690
14739
|
...t,
|
|
14691
14740
|
thinkingMs: n > 0 ? n : 1e3,
|
|
14692
14741
|
thinkingSummary: e
|
|
14693
14742
|
} : t));
|
|
14694
|
-
} else
|
|
14743
|
+
} else F((t) => {
|
|
14695
14744
|
let r = t.find((e) => e.id === u), i = !r?.response || r.response === a, o = e.replace(/<\/?(?:think|thinking)>/g, "");
|
|
14696
14745
|
return t.map((e) => e.id === u ? {
|
|
14697
14746
|
...e,
|
|
@@ -14699,17 +14748,17 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14699
14748
|
response: e.response + o
|
|
14700
14749
|
} : e);
|
|
14701
14750
|
});
|
|
14702
|
-
} else if (t.type === "skills_activated") t.skills && t.skills.length > 0 &&
|
|
14751
|
+
} else if (t.type === "skills_activated") t.skills && t.skills.length > 0 && F((e) => e.map((e) => e.id === u ? {
|
|
14703
14752
|
...e,
|
|
14704
14753
|
response: e.response + `⚡ Skills: ${t.skills.join(", ")}\n`
|
|
14705
14754
|
} : e));
|
|
14706
|
-
else if (t.type === "error")
|
|
14755
|
+
else if (t.type === "error") F((e) => e.map((e) => e.id === u ? {
|
|
14707
14756
|
...e,
|
|
14708
14757
|
status: "error",
|
|
14709
14758
|
error: `✗ ${t.error.message}`
|
|
14710
|
-
} : e)),
|
|
14711
|
-
else if (t.type === "approval_required")
|
|
14712
|
-
else if (t.type === "checkpoint_approval_requested" || t.type === "execution_handoff_waiting_approval")
|
|
14759
|
+
} : e)), N("blocked");
|
|
14760
|
+
else if (t.type === "approval_required") Fe(t.request);
|
|
14761
|
+
else if (t.type === "checkpoint_approval_requested" || t.type === "execution_handoff_waiting_approval") Fe({
|
|
14713
14762
|
id: "checkpointId" in t ? t.checkpointId : "req-cp",
|
|
14714
14763
|
toolName: "checkpoint",
|
|
14715
14764
|
category: "write",
|
|
@@ -14719,20 +14768,20 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14719
14768
|
else if (t.type === "tool_call") s.set(t.call.id, t.call.name);
|
|
14720
14769
|
else if (t.type === "tool_result") {
|
|
14721
14770
|
let e = s.get(t.callId) || "tool";
|
|
14722
|
-
if (t.result.success)
|
|
14771
|
+
if (t.result.success) F((t) => t.map((t) => t.id === u ? {
|
|
14723
14772
|
...t,
|
|
14724
14773
|
response: t.response.includes(`✓ ${e}`) ? t.response : t.response + `✓ ${e} executed\n`
|
|
14725
14774
|
} : t));
|
|
14726
14775
|
else if (t.result.error) {
|
|
14727
14776
|
let n = t.result.error.code, r = "";
|
|
14728
|
-
r = n === "NOT_FOUND" ? `⚠ ${e}: File not found — searching again\n` : n === "EDIT_CONFLICT" ? `⚠ ${e}: Edit conflict — refreshing file context\n` : n === "REPEATED_CALL_LOOP" ? `⚠ ${e}: Repeated call loop detected — adapting strategy\n` : n === "COMMAND_TIMEOUT" ? `⚠ ${e}: Command timed out\n` : `✗ ${e}: ${t.result.error.message || "Execution error"}\n`, r &&
|
|
14777
|
+
r = n === "NOT_FOUND" ? `⚠ ${e}: File not found — searching again\n` : n === "EDIT_CONFLICT" ? `⚠ ${e}: Edit conflict — refreshing file context\n` : n === "REPEATED_CALL_LOOP" ? `⚠ ${e}: Repeated call loop detected — adapting strategy\n` : n === "COMMAND_TIMEOUT" ? `⚠ ${e}: Command timed out\n` : `✗ ${e}: ${t.result.error.message || "Execution error"}\n`, r && F((e) => e.map((e) => e.id === u ? {
|
|
14729
14778
|
...e,
|
|
14730
14779
|
response: e.response + r
|
|
14731
14780
|
} : e));
|
|
14732
14781
|
}
|
|
14733
14782
|
} else if (t.type === "plan_created") {
|
|
14734
14783
|
let e = `Plan: ${t.plan.objective}\n\n`, n = $.formatPlanDetail(t.plan);
|
|
14735
|
-
|
|
14784
|
+
F((t) => t.map((t) => t.id === u ? {
|
|
14736
14785
|
...t,
|
|
14737
14786
|
response: (t.response ? t.response + "\n\n" : "") + e + n + "\n"
|
|
14738
14787
|
} : t));
|
|
@@ -14758,13 +14807,13 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14758
14807
|
requiresUserConfirmation: !0,
|
|
14759
14808
|
recommendedAction: "replan"
|
|
14760
14809
|
};
|
|
14761
|
-
|
|
14810
|
+
Je({
|
|
14762
14811
|
plan: e,
|
|
14763
14812
|
assessment: r,
|
|
14764
14813
|
reconciliationResult: t.result
|
|
14765
14814
|
});
|
|
14766
14815
|
let i = $.formatReconciliationBlockedPrompt(e, t.result);
|
|
14767
|
-
|
|
14816
|
+
F((e) => e.map((e) => e.id === u ? {
|
|
14768
14817
|
...e,
|
|
14769
14818
|
response: (e.response ? e.response + "\n\n" : "") + i + "\n"
|
|
14770
14819
|
} : e));
|
|
@@ -14801,110 +14850,133 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14801
14850
|
requiresUserConfirmation: !0,
|
|
14802
14851
|
recommendedAction: "replan"
|
|
14803
14852
|
};
|
|
14804
|
-
|
|
14853
|
+
Je({
|
|
14805
14854
|
plan: e,
|
|
14806
14855
|
assessment: a
|
|
14807
14856
|
});
|
|
14808
14857
|
let o = $.formatPlanBlockedPrompt(e, a);
|
|
14809
|
-
|
|
14858
|
+
F((e) => e.map((e) => e.id === u ? {
|
|
14810
14859
|
...e,
|
|
14811
14860
|
response: (e.response ? e.response + "\n\n" : "") + o + "\n"
|
|
14812
14861
|
} : e));
|
|
14813
|
-
} else if (t.type === "plan_execution_started")
|
|
14862
|
+
} else if (t.type === "plan_execution_started") F((e) => e.map((e) => e.id === u ? {
|
|
14814
14863
|
...e,
|
|
14815
14864
|
response: e.response + `Plan approved. Executing ${t.totalSteps} steps...\n\n`
|
|
14816
14865
|
} : e));
|
|
14817
|
-
else if (t.type === "plan_step_started")
|
|
14866
|
+
else if (t.type === "plan_step_started") F((e) => e.map((e) => e.id === u ? {
|
|
14818
14867
|
...e,
|
|
14819
14868
|
response: e.response + `[${t.stepIndex + 1}] ${t.title || "Step"}\nEXECUTING\n`
|
|
14820
14869
|
} : e));
|
|
14821
|
-
else if (t.type === "plan_step_completed")
|
|
14870
|
+
else if (t.type === "plan_step_completed") F((e) => e.map((e) => e.id === u ? {
|
|
14822
14871
|
...e,
|
|
14823
14872
|
response: e.response + "✓ COMPLETED\n\n"
|
|
14824
14873
|
} : e));
|
|
14825
|
-
else if (t.type === "plan_step_skipped")
|
|
14874
|
+
else if (t.type === "plan_step_skipped") F((e) => e.map((e) => e.id === u ? {
|
|
14826
14875
|
...e,
|
|
14827
14876
|
response: e.response + `⊘ SKIPPED (${t.reason || "Skipped"})\n\n`
|
|
14828
14877
|
} : e));
|
|
14829
|
-
else if (t.type === "plan_execution_completed")
|
|
14878
|
+
else if (t.type === "plan_execution_completed") F((e) => e.map((e) => e.id === u ? {
|
|
14830
14879
|
...e,
|
|
14831
14880
|
response: e.response + `✓ Plan completed (${t.completedSteps}/${t.totalSteps} steps).\n`
|
|
14832
14881
|
} : e));
|
|
14833
|
-
else if (t.type === "execution_feedback_detected")
|
|
14882
|
+
else if (t.type === "execution_feedback_detected") F((e) => e.map((e) => e.id === u ? {
|
|
14834
14883
|
...e,
|
|
14835
14884
|
response: e.response + `⚠ Feedback: ${t.summary}\n`
|
|
14836
14885
|
} : e));
|
|
14837
|
-
else if (t.type === "step_retry_started")
|
|
14886
|
+
else if (t.type === "step_retry_started") F((e) => e.map((e) => e.id === u ? {
|
|
14838
14887
|
...e,
|
|
14839
14888
|
response: e.response + `⟳ Retrying Step ${t.stepId} (attempt ${t.attempt}/${t.maxAttempts}): ${t.reason}\n`
|
|
14840
14889
|
} : e));
|
|
14841
|
-
else if (t.type === "step_retry_completed")
|
|
14890
|
+
else if (t.type === "step_retry_completed") F((e) => e.map((e) => e.id === u ? {
|
|
14842
14891
|
...e,
|
|
14843
14892
|
response: e.response + (t.success ? `✓ Step retry succeeded on attempt ${t.attempt}\n` : `✗ Step retry failed on attempt ${t.attempt}\n`)
|
|
14844
14893
|
} : e));
|
|
14845
|
-
else if (t.type === "plan_step_failed")
|
|
14894
|
+
else if (t.type === "plan_step_failed") F((e) => e.map((e) => e.id === u ? {
|
|
14846
14895
|
...e,
|
|
14847
14896
|
response: e.response + `✗ Step ${t.stepId} failed${t.error ? `: ${t.error}` : ""}\n`
|
|
14848
14897
|
} : e));
|
|
14849
|
-
else if (t.type === "plan_execution_failed")
|
|
14898
|
+
else if (t.type === "plan_execution_failed") F((e) => e.map((e) => e.id === u ? {
|
|
14850
14899
|
...e,
|
|
14851
14900
|
status: "error",
|
|
14852
14901
|
error: t.reason,
|
|
14853
14902
|
response: e.response + `\n✗ Plan execution failed: ${t.reason || "Unknown error"}\n`
|
|
14854
|
-
} : e)),
|
|
14855
|
-
else if (t.type === "plan_execution_cancelled")
|
|
14903
|
+
} : e)), N("blocked");
|
|
14904
|
+
else if (t.type === "plan_execution_cancelled") F((e) => e.map((e) => e.id === u ? {
|
|
14856
14905
|
...e,
|
|
14857
14906
|
status: "cancelled",
|
|
14858
14907
|
response: e.response + `\n⊘ Plan execution cancelled: ${t.reason || "Cancelled by user"}\n`
|
|
14859
|
-
} : e)),
|
|
14908
|
+
} : e)), N("cancelled");
|
|
14860
14909
|
else if (t.type === "task_summary") {
|
|
14861
14910
|
let e = "";
|
|
14862
14911
|
t.summary.status === "completed" ? e = "✓ Task completed\n\n" : t.summary.status === "blocked" ? e = "⚠ Task blocked\n\n" : t.summary.status === "cancelled" && (e = "⊘ Task cancelled\n\n");
|
|
14863
|
-
let n =
|
|
14912
|
+
let n = er.formatTaskDetail(t.summary);
|
|
14864
14913
|
t.summary.verifiedCommands && t.summary.verifiedCommands.length > 0 && (n = n.replace("Verification:", "Verified:"));
|
|
14865
14914
|
let r = e + n;
|
|
14866
|
-
|
|
14915
|
+
F((e) => e.map((e) => e.id === u ? {
|
|
14867
14916
|
...e,
|
|
14868
14917
|
response: (e.response ? e.response + "\n\n" : "") + r + "\n"
|
|
14869
|
-
} : e)),
|
|
14870
|
-
} else t.type === "done" &&
|
|
14918
|
+
} : e)), _e((e) => [...e, t.summary]), N(t.summary.status), et(t.summary.status, t.summary, i).catch(() => {});
|
|
14919
|
+
} else t.type === "done" && F((e) => e.map((e) => e.id === u ? {
|
|
14871
14920
|
...e,
|
|
14872
14921
|
status: "done",
|
|
14873
14922
|
response: e.response && e.response.trim().length > 0 ? e.response : "Completed (no output returned by the model)."
|
|
14874
14923
|
} : e));
|
|
14875
14924
|
} catch (e) {
|
|
14876
14925
|
let t = e instanceof Error ? e.message : String(e);
|
|
14877
|
-
|
|
14926
|
+
F((e) => e.map((e) => e.id === u ? {
|
|
14878
14927
|
...e,
|
|
14879
14928
|
status: "error",
|
|
14880
14929
|
error: `✗ ${t}`
|
|
14881
|
-
} : e)),
|
|
14930
|
+
} : e)), N("blocked");
|
|
14882
14931
|
} finally {
|
|
14883
|
-
|
|
14932
|
+
Se(!1), we(void 0), Ee(void 0), ye(void 0);
|
|
14884
14933
|
}
|
|
14885
|
-
};
|
|
14886
|
-
|
|
14887
|
-
|
|
14934
|
+
}, it, Y, at, X = q?.activePlan;
|
|
14935
|
+
if (!X && n && "getTaskPlan" in n && typeof n.getTaskPlan == "function") {
|
|
14936
|
+
let e = n.getTaskPlan();
|
|
14937
|
+
e && (X = {
|
|
14938
|
+
planId: e.planId,
|
|
14939
|
+
runId: e.runId,
|
|
14940
|
+
objective: e.objective,
|
|
14941
|
+
userRequestSummary: e.userRequestSummary,
|
|
14942
|
+
status: e.status,
|
|
14943
|
+
steps: e.steps,
|
|
14944
|
+
createdAt: e.createdAt,
|
|
14945
|
+
completedStepsCount: e.steps ? e.steps.filter((e) => e.status === "completed").length : 0,
|
|
14946
|
+
totalStepsCount: e.steps ? e.steps.length : 0
|
|
14947
|
+
});
|
|
14948
|
+
}
|
|
14949
|
+
if (X && X.status !== "completed" && X.steps && X.steps.length > 0) {
|
|
14950
|
+
Y = X.totalStepsCount || X.steps.length;
|
|
14951
|
+
let e = q?.activeStepId ? X.steps.find((e) => e.stepId === q.activeStepId) : void 0;
|
|
14952
|
+
if (e ||= X.steps.find((e) => e.status === "in_progress") || X.steps.find((e) => e.status !== "completed" && e.status !== "skipped"), e) {
|
|
14953
|
+
let t = X.steps.findIndex((t) => t.stepId === e.stepId);
|
|
14954
|
+
it = e.order || (t >= 0 ? t + 1 : 1), at = e.title;
|
|
14955
|
+
}
|
|
14956
|
+
}
|
|
14957
|
+
return /* @__PURE__ */ S(gr, {
|
|
14958
|
+
header: /* @__PURE__ */ x(ur, {
|
|
14888
14959
|
projectName: "fecode",
|
|
14889
14960
|
providerName: s,
|
|
14890
14961
|
modelName: c,
|
|
14891
14962
|
cwd: o,
|
|
14892
|
-
status: q?.status ||
|
|
14963
|
+
status: q?.status || M,
|
|
14893
14964
|
gitBranch: q?.workspace?.gitBranch,
|
|
14894
14965
|
isGitClean: !q?.workspace || !q.workspace.isGitDirty,
|
|
14895
14966
|
runId: q?.runId,
|
|
14896
|
-
sessionId:
|
|
14967
|
+
sessionId: he,
|
|
14968
|
+
elapsedMs: Te
|
|
14897
14969
|
}),
|
|
14898
14970
|
modal: G ? /* @__PURE__ */ S(e, {
|
|
14899
14971
|
flexDirection: "column",
|
|
14900
14972
|
children: [
|
|
14901
|
-
|
|
14902
|
-
toolName:
|
|
14903
|
-
reason:
|
|
14904
|
-
changeReview:
|
|
14905
|
-
value:
|
|
14906
|
-
onChange:
|
|
14907
|
-
onSubmit:
|
|
14973
|
+
R && /* @__PURE__ */ x(Cr, {
|
|
14974
|
+
toolName: R.toolName,
|
|
14975
|
+
reason: R.reason,
|
|
14976
|
+
changeReview: R.changeReview,
|
|
14977
|
+
value: Ie,
|
|
14978
|
+
onChange: Le,
|
|
14979
|
+
onSubmit: rt
|
|
14908
14980
|
}),
|
|
14909
14981
|
H && /* @__PURE__ */ x(wr, {
|
|
14910
14982
|
planId: H.plan.planId,
|
|
@@ -14912,50 +14984,53 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14912
14984
|
reason: H.assessment.feedback[0]?.summary,
|
|
14913
14985
|
affectedSteps: H.assessment.affectedSteps,
|
|
14914
14986
|
isReconciliation: !!H.reconciliationResult,
|
|
14915
|
-
value:
|
|
14916
|
-
onChange:
|
|
14987
|
+
value: Re,
|
|
14988
|
+
onChange: ze,
|
|
14917
14989
|
onSubmit: J
|
|
14918
14990
|
}),
|
|
14919
14991
|
U && /* @__PURE__ */ x(Tr, {
|
|
14920
14992
|
strategy: U.assessment.strategy,
|
|
14921
14993
|
outcome: U.assessment.eligible ? "ELIGIBLE" : "NOT_ELIGIBLE",
|
|
14922
|
-
value:
|
|
14923
|
-
onChange:
|
|
14994
|
+
value: Be,
|
|
14995
|
+
onChange: Ve,
|
|
14924
14996
|
onSubmit: J
|
|
14925
14997
|
}),
|
|
14926
14998
|
W && /* @__PURE__ */ x(Tr, {
|
|
14927
14999
|
isAwaitingContinuation: !0,
|
|
14928
15000
|
remainingStepsCount: W.preparation.remainingSteps.length,
|
|
14929
|
-
value:
|
|
14930
|
-
onChange:
|
|
15001
|
+
value: Be,
|
|
15002
|
+
onChange: Ve,
|
|
14931
15003
|
onSubmit: J
|
|
14932
15004
|
}),
|
|
14933
|
-
|
|
14934
|
-
originalPlanId:
|
|
14935
|
-
reason:
|
|
14936
|
-
replanDepth:
|
|
14937
|
-
value:
|
|
14938
|
-
onChange:
|
|
15005
|
+
B && /* @__PURE__ */ x(Er, {
|
|
15006
|
+
originalPlanId: B.planId,
|
|
15007
|
+
reason: B.assessment.reason,
|
|
15008
|
+
replanDepth: B.assessment.replanDepth,
|
|
15009
|
+
value: He,
|
|
15010
|
+
onChange: Ue,
|
|
14939
15011
|
onSubmit: J
|
|
14940
15012
|
}),
|
|
14941
|
-
|
|
14942
|
-
runId:
|
|
14943
|
-
originalRequest:
|
|
14944
|
-
riskLevel:
|
|
14945
|
-
value:
|
|
14946
|
-
onChange:
|
|
15013
|
+
z && /* @__PURE__ */ x(Dr, {
|
|
15014
|
+
runId: z.runId,
|
|
15015
|
+
originalRequest: z.prep.originalRun.userRequestSummary,
|
|
15016
|
+
riskLevel: z.prep.reassessedRisk.level,
|
|
15017
|
+
value: We,
|
|
15018
|
+
onChange: Ge,
|
|
14947
15019
|
onSubmit: J
|
|
14948
15020
|
})
|
|
14949
15021
|
]
|
|
14950
15022
|
}) : null,
|
|
14951
|
-
footer: /* @__PURE__ */ x(
|
|
14952
|
-
status: q?.status ||
|
|
14953
|
-
isGenerating:
|
|
15023
|
+
footer: /* @__PURE__ */ x(mr, {
|
|
15024
|
+
status: q?.status || M,
|
|
15025
|
+
isGenerating: I,
|
|
14954
15026
|
hasModal: G,
|
|
15027
|
+
activeStep: it,
|
|
15028
|
+
totalSteps: Y,
|
|
15029
|
+
activeStepTitle: at,
|
|
14955
15030
|
activeView: D,
|
|
14956
15031
|
isReconciliation: !!H?.reconciliationResult,
|
|
14957
15032
|
recoveryMode: W ? "continuation" : U ? "confirm" : void 0,
|
|
14958
|
-
modalType:
|
|
15033
|
+
modalType: R ? "approval" : H ? "blocked" : U || W ? "recovery" : B ? "replan" : z ? "resume" : void 0
|
|
14959
15034
|
}),
|
|
14960
15035
|
children: [
|
|
14961
15036
|
d && /* @__PURE__ */ S(e, {
|
|
@@ -14990,61 +15065,59 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
14990
15065
|
stagedFiles: q?.workspace?.stagedFiles,
|
|
14991
15066
|
untrackedFiles: q?.workspace?.untrackedFiles,
|
|
14992
15067
|
hasDrift: q?.workspace?.hasDrift,
|
|
14993
|
-
driftReason: q?.workspace?.driftReason
|
|
15068
|
+
driftReason: q?.workspace?.driftReason,
|
|
15069
|
+
formattedOutput: fe
|
|
14994
15070
|
}),
|
|
14995
|
-
D === "runs" && /* @__PURE__ */ x(kr, { runs: q?.diagnostics ? [{
|
|
15071
|
+
D === "runs" && /* @__PURE__ */ x(kr, { runs: se.length > 0 ? se : q?.diagnostics ? [{
|
|
14996
15072
|
runId: q.diagnostics.runId,
|
|
14997
15073
|
status: q.diagnostics.finalStatus || "executing",
|
|
14998
15074
|
userRequestSummary: q.diagnostics.userRequestSummary,
|
|
14999
15075
|
durationMs: q.diagnostics.durationMs
|
|
15000
15076
|
}] : [] }),
|
|
15001
|
-
D === "diagnostics" && /* @__PURE__ */ x(Or, { summary: q?.diagnostics }),
|
|
15002
|
-
D === "plan" &&
|
|
15003
|
-
planId: q
|
|
15004
|
-
objective: q
|
|
15005
|
-
summary: q
|
|
15006
|
-
status: q
|
|
15007
|
-
steps: q
|
|
15008
|
-
completedCount: q
|
|
15009
|
-
totalCount: q
|
|
15077
|
+
D === "diagnostics" && /* @__PURE__ */ x(Or, { summary: le || q?.diagnostics }),
|
|
15078
|
+
D === "plan" && /* @__PURE__ */ x(Sr, {
|
|
15079
|
+
planId: q?.activePlan?.planId,
|
|
15080
|
+
objective: q?.activePlan?.objective,
|
|
15081
|
+
summary: q?.activePlan?.userRequestSummary,
|
|
15082
|
+
status: q?.activePlan?.status,
|
|
15083
|
+
steps: q?.activePlan?.steps,
|
|
15084
|
+
completedCount: q?.activePlan?.completedStepsCount,
|
|
15085
|
+
totalCount: q?.activePlan?.totalStepsCount,
|
|
15086
|
+
formattedOutput: k
|
|
15010
15087
|
}),
|
|
15011
|
-
|
|
15088
|
+
I && q?.activeTool && /* @__PURE__ */ x(vr, {
|
|
15012
15089
|
toolName: q.activeTool.toolName,
|
|
15013
15090
|
target: q.activeTool.target,
|
|
15014
15091
|
riskLevel: q.riskLevel
|
|
15015
15092
|
}),
|
|
15016
15093
|
/* @__PURE__ */ S(e, {
|
|
15017
15094
|
flexDirection: "column",
|
|
15018
|
-
children: [
|
|
15019
|
-
|
|
15020
|
-
|
|
15021
|
-
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
-
|
|
15028
|
-
|
|
15029
|
-
|
|
15030
|
-
|
|
15031
|
-
|
|
15032
|
-
isActive: N,
|
|
15033
|
-
label: "Agent is working..."
|
|
15034
|
-
})
|
|
15035
|
-
}),
|
|
15036
|
-
!G && /* @__PURE__ */ x(br, {
|
|
15037
|
-
value: T,
|
|
15038
|
-
onChange: Ie,
|
|
15039
|
-
onSubmit: J,
|
|
15040
|
-
isDisabled: !!P,
|
|
15041
|
-
placeholder: N ? "Type next task (will be queued)..." : "Describe task or type /help...",
|
|
15042
|
-
label: j.length === 0 ? "Task" : void 0,
|
|
15043
|
-
pendingQuery: P,
|
|
15044
|
-
suggestions: K,
|
|
15045
|
-
selectedSuggestion: F
|
|
15095
|
+
children: [D === "main" && /* @__PURE__ */ S(ee, { children: [xe.map((e, t) => /* @__PURE__ */ x(zr, {
|
|
15096
|
+
prompt: e.prompt,
|
|
15097
|
+
response: e.response,
|
|
15098
|
+
status: e.status,
|
|
15099
|
+
error: e.error,
|
|
15100
|
+
isLast: t === xe.length - 1,
|
|
15101
|
+
thinkingMs: e.thinkingMs,
|
|
15102
|
+
thinkingTokens: e.thinkingTokens,
|
|
15103
|
+
thinkingSummary: e.thinkingSummary
|
|
15104
|
+
}, e.id)), I && /* @__PURE__ */ x(e, {
|
|
15105
|
+
marginTop: 0,
|
|
15106
|
+
children: /* @__PURE__ */ x(Pr, {
|
|
15107
|
+
isActive: I,
|
|
15108
|
+
label: "Agent is working..."
|
|
15046
15109
|
})
|
|
15047
|
-
]
|
|
15110
|
+
})] }), !G && /* @__PURE__ */ x(br, {
|
|
15111
|
+
value: T,
|
|
15112
|
+
onChange: Qe,
|
|
15113
|
+
onSubmit: J,
|
|
15114
|
+
isDisabled: !!De,
|
|
15115
|
+
placeholder: I ? "Type next task (will be queued)..." : "Describe task or type /help...",
|
|
15116
|
+
label: xe.length === 0 ? "Task" : void 0,
|
|
15117
|
+
pendingQuery: De,
|
|
15118
|
+
suggestions: K,
|
|
15119
|
+
selectedSuggestion: Ae
|
|
15120
|
+
})]
|
|
15048
15121
|
})
|
|
15049
15122
|
]
|
|
15050
15123
|
});
|
|
@@ -15090,8 +15163,8 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
|
|
|
15090
15163
|
//#region src/index.tsx
|
|
15091
15164
|
async function Hr() {
|
|
15092
15165
|
let e, t, r, i, a = process.argv.slice(2);
|
|
15093
|
-
(a.includes("--version") || a.includes("-v")) && (console.log("1.0.
|
|
15094
|
-
let o = new
|
|
15166
|
+
(a.includes("--version") || a.includes("-v")) && (console.log("1.0.2"), process.exit(0)), (a.includes("--help") || a.includes("-h")) && (console.log("FeCode - Interactive Terminal Coding Assistant (v1.0.2)\n\nUsage:\n fe [options]\n fecode [options]\n\nOptions:\n -v, --version Display FeCode version\n -h, --help Display this help message\n -r, --resume <id> Resume a previous session or historical run by ID\n\nEnvironment Variables:\n FE_PROVIDER LLM provider ('gemini', 'openai', 'ollama') [default: gemini]\n FE_MODEL Model name [default: gemini-2.5-flash / gpt-4o / qwen2.5-coder]\n GEMINI_API_KEY API key for Google Gemini provider\n OPENAI_API_KEY API key for OpenAI provider\n OLLAMA_BASE_URL Base URL for Ollama provider [default: http://localhost:11434/v1]\n\nInteractive Commands (inside TUI):\n /help Show in-terminal command list\n /plan [id] Display active plan or details for a run\n /replan Trigger plan re-evaluation and adaptation\n /resume <id> Prepare resume for historical run\n /diagnostics [id] Show diagnostics and telemetry for active/specified run\n /runs [limit] List historical runs for current project\n /git Inspect Git workspace status and modified files\n /clear Clear conversation turns\n /exit Exit FeCode"), process.exit(0));
|
|
15167
|
+
let o = new Xn(), s = process.cwd(), c;
|
|
15095
15168
|
for (let e = 0; e < a.length; e++) if ((a[e] === "--resume" || a[e] === "-r") && e + 1 < a.length) {
|
|
15096
15169
|
c = a[e + 1];
|
|
15097
15170
|
break;
|
|
@@ -15126,17 +15199,17 @@ async function Hr() {
|
|
|
15126
15199
|
}
|
|
15127
15200
|
}
|
|
15128
15201
|
try {
|
|
15129
|
-
r = await new
|
|
15202
|
+
r = await new _n().detect(s);
|
|
15130
15203
|
} catch {}
|
|
15131
|
-
let l =
|
|
15204
|
+
let l = ie(), u = process.env.FE_PROVIDER || i?.provider || l.provider || "gemini", f = process.env.FE_MODEL || i?.model || (u === "openai" ? "gpt-4o" : u === "ollama" ? "qwen2.5-coder" : "gemini-2.5-flash"), p = new Vr();
|
|
15132
15205
|
try {
|
|
15133
|
-
let t =
|
|
15206
|
+
let t = T({
|
|
15134
15207
|
provider: u,
|
|
15135
15208
|
model: f,
|
|
15136
15209
|
apiKey: u === "gemini" ? l.geminiApiKey : u === "openai" ? l.openaiApiKey : void 0,
|
|
15137
15210
|
baseUrl: l.ollamaBaseUrl
|
|
15138
|
-
}), n = fn(), a = new
|
|
15139
|
-
|
|
15211
|
+
}), n = fn(), a = new Tn(), o = new vn(), s = new qn();
|
|
15212
|
+
Dn(o);
|
|
15140
15213
|
let c = await a.discoverSkills(a.getBuiltinSkillsDir());
|
|
15141
15214
|
for (let e of c) o.register(e);
|
|
15142
15215
|
e = new Jt(t, {
|
|
@@ -15150,13 +15223,13 @@ async function Hr() {
|
|
|
15150
15223
|
} catch (e) {
|
|
15151
15224
|
t = e instanceof Error ? e.message : String(e);
|
|
15152
15225
|
}
|
|
15153
|
-
let m = e ? new
|
|
15226
|
+
let m = e ? new Pe({
|
|
15154
15227
|
agentRuntime: e,
|
|
15155
15228
|
approvalResolver: p,
|
|
15156
15229
|
initialCwd: s,
|
|
15157
15230
|
initialSessionId: i?.sessionId
|
|
15158
15231
|
}) : void 0;
|
|
15159
|
-
!process.stdin.isTTY && !process.env.VITEST && !process.env.CI_TEST_MODE && (console.error("✗ FeCode requires an interactive terminal (TTY).\nRun with --help for available options."), process.exit(1)), n(/* @__PURE__ */ x(Br, {
|
|
15232
|
+
!process.stdin.isTTY && !process.env.VITEST && !process.env.CI_TEST_MODE && (console.error("✗ FeCode requires an interactive terminal (TTY).\nRun with --help for available options."), process.exit(1)), process.stdout.isTTY && !process.env.VITEST && !process.env.CI_TEST_MODE && process.stdout.write("\x1B[2J\x1B[H"), n(/* @__PURE__ */ x(Br, {
|
|
15160
15233
|
agent: e,
|
|
15161
15234
|
productRuntime: m,
|
|
15162
15235
|
cwd: s,
|