@triedotdev/mcp 1.0.112 → 1.0.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-fix-apply-PCAHWLXF.js +10 -0
- package/dist/autonomy-config-O4H3Z7YV.js +30 -0
- package/dist/chunk-2GIAROBF.js +173 -0
- package/dist/chunk-2GIAROBF.js.map +1 -0
- package/dist/{chunk-33WL3D7A.js → chunk-2SIFK7OW.js} +7 -419
- package/dist/chunk-2SIFK7OW.js.map +1 -0
- package/dist/chunk-43X6JBEM.js +36 -0
- package/dist/chunk-43X6JBEM.js.map +1 -0
- package/dist/{chunk-WBAWHEYX.js → chunk-4SBZXIMG.js} +191 -601
- package/dist/chunk-4SBZXIMG.js.map +1 -0
- package/dist/chunk-55DOQNHJ.js +772 -0
- package/dist/chunk-55DOQNHJ.js.map +1 -0
- package/dist/chunk-6LXSA2OZ.js +425 -0
- package/dist/chunk-6LXSA2OZ.js.map +1 -0
- package/dist/{chunk-SDS3UVFY.js → chunk-AOFYU6T3.js} +113 -559
- package/dist/chunk-AOFYU6T3.js.map +1 -0
- package/dist/{chunk-6QR6QZIX.js → chunk-D3EXBJE2.js} +25 -658
- package/dist/chunk-D3EXBJE2.js.map +1 -0
- package/dist/chunk-DJ2YAGHK.js +50 -0
- package/dist/chunk-DJ2YAGHK.js.map +1 -0
- package/dist/chunk-DRDEEF6G.js +328 -0
- package/dist/chunk-DRDEEF6G.js.map +1 -0
- package/dist/chunk-DZREHOGW.js +706 -0
- package/dist/chunk-DZREHOGW.js.map +1 -0
- package/dist/chunk-KRH642MT.js +947 -0
- package/dist/chunk-KRH642MT.js.map +1 -0
- package/dist/{chunk-QYOACM2C.js → chunk-MVNJPJBK.js} +22 -252
- package/dist/chunk-MVNJPJBK.js.map +1 -0
- package/dist/chunk-NS2MSZMB.js +394 -0
- package/dist/chunk-NS2MSZMB.js.map +1 -0
- package/dist/chunk-SWSK7ANT.js +340 -0
- package/dist/chunk-SWSK7ANT.js.map +1 -0
- package/dist/chunk-VRLMTOB6.js +566 -0
- package/dist/chunk-VRLMTOB6.js.map +1 -0
- package/dist/chunk-YR4BMGYO.js +130 -0
- package/dist/chunk-YR4BMGYO.js.map +1 -0
- package/dist/chunk-ZV2K6M7T.js +74 -0
- package/dist/chunk-ZV2K6M7T.js.map +1 -0
- package/dist/cli/main.js +107 -375
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +18 -8
- package/dist/cli/yolo-daemon.js.map +1 -1
- package/dist/client-7XZHCMD3.js +28 -0
- package/dist/client-7XZHCMD3.js.map +1 -0
- package/dist/{goal-manager-AP4LTE6U.js → goal-manager-LMS6ZJB7.js} +7 -3
- package/dist/goal-manager-LMS6ZJB7.js.map +1 -0
- package/dist/goal-validator-7UPLOVAZ.js +184 -0
- package/dist/goal-validator-7UPLOVAZ.js.map +1 -0
- package/dist/graph-U5JWSAB5.js +10 -0
- package/dist/graph-U5JWSAB5.js.map +1 -0
- package/dist/guardian-agent-EXP7APLC.js +25 -0
- package/dist/guardian-agent-EXP7APLC.js.map +1 -0
- package/dist/hypothesis-KGC3P54C.js +19 -0
- package/dist/hypothesis-KGC3P54C.js.map +1 -0
- package/dist/incident-index-PNIVT47T.js +11 -0
- package/dist/incident-index-PNIVT47T.js.map +1 -0
- package/dist/index.js +285 -16
- package/dist/index.js.map +1 -1
- package/dist/ledger-SR6OEBLO.js +15 -0
- package/dist/ledger-SR6OEBLO.js.map +1 -0
- package/dist/output-manager-BOTMXSND.js +13 -0
- package/dist/output-manager-BOTMXSND.js.map +1 -0
- package/dist/pattern-discovery-F7LU5K6E.js +8 -0
- package/dist/pattern-discovery-F7LU5K6E.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-33WL3D7A.js.map +0 -1
- package/dist/chunk-6JPPYG7F.js +0 -1813
- package/dist/chunk-6JPPYG7F.js.map +0 -1
- package/dist/chunk-6QR6QZIX.js.map +0 -1
- package/dist/chunk-QYOACM2C.js.map +0 -1
- package/dist/chunk-SDS3UVFY.js.map +0 -1
- package/dist/chunk-WBAWHEYX.js.map +0 -1
- package/dist/guardian-agent-XEYNG7RH.js +0 -18
- /package/dist/{goal-manager-AP4LTE6U.js.map → auto-fix-apply-PCAHWLXF.js.map} +0 -0
- /package/dist/{guardian-agent-XEYNG7RH.js.map → autonomy-config-O4H3Z7YV.js.map} +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getGuardian
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AOFYU6T3.js";
|
|
4
4
|
import {
|
|
5
|
-
IncidentIndex,
|
|
6
5
|
LearningEngine,
|
|
7
6
|
exportToJson,
|
|
8
7
|
formatFriendlyError,
|
|
@@ -11,20 +10,30 @@ import {
|
|
|
11
10
|
perceiveCurrentChanges,
|
|
12
11
|
reasonAboutChangesHumanReadable,
|
|
13
12
|
saveCheckpoint
|
|
14
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-MVNJPJBK.js";
|
|
15
14
|
import {
|
|
16
|
-
ContextGraph,
|
|
17
15
|
TieredStorage,
|
|
18
16
|
findCrossProjectPatterns,
|
|
17
|
+
getStorage
|
|
18
|
+
} from "./chunk-D3EXBJE2.js";
|
|
19
|
+
import {
|
|
19
20
|
getKeyFromKeychain,
|
|
20
|
-
getStorage,
|
|
21
21
|
isAIAvailable,
|
|
22
22
|
runAIWithTools,
|
|
23
23
|
setAPIKey
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-SWSK7ANT.js";
|
|
25
25
|
import {
|
|
26
26
|
getGuardianState
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-KRH642MT.js";
|
|
28
|
+
import {
|
|
29
|
+
ContextGraph
|
|
30
|
+
} from "./chunk-NS2MSZMB.js";
|
|
31
|
+
import {
|
|
32
|
+
IncidentIndex
|
|
33
|
+
} from "./chunk-2GIAROBF.js";
|
|
34
|
+
import {
|
|
35
|
+
getOutputManager
|
|
36
|
+
} from "./chunk-VRLMTOB6.js";
|
|
28
37
|
import {
|
|
29
38
|
getTrieDirectory,
|
|
30
39
|
getWorkingDirectory
|
|
@@ -750,560 +759,10 @@ function useDashboard() {
|
|
|
750
759
|
return ctx;
|
|
751
760
|
}
|
|
752
761
|
|
|
753
|
-
// src/utils/output-manager.ts
|
|
754
|
-
import pc from "picocolors";
|
|
755
|
-
var OutputManagerImpl = class {
|
|
756
|
-
mode = "console";
|
|
757
|
-
streamingManager;
|
|
758
|
-
markdownBuffer = [];
|
|
759
|
-
jsonBuffer = [];
|
|
760
|
-
rawLogBuffer = [];
|
|
761
|
-
// Callbacks for TUI integration (explicitly allow undefined for exactOptionalPropertyTypes)
|
|
762
|
-
onBanner = void 0;
|
|
763
|
-
onSnippet = void 0;
|
|
764
|
-
onCost = void 0;
|
|
765
|
-
onReadiness = void 0;
|
|
766
|
-
onSemantic = void 0;
|
|
767
|
-
onAttack = void 0;
|
|
768
|
-
onActivity = void 0;
|
|
769
|
-
onLog = void 0;
|
|
770
|
-
onNudge = void 0;
|
|
771
|
-
/**
|
|
772
|
-
* Set the output mode
|
|
773
|
-
*/
|
|
774
|
-
setMode(mode) {
|
|
775
|
-
this.mode = mode;
|
|
776
|
-
}
|
|
777
|
-
/**
|
|
778
|
-
* Get current output mode
|
|
779
|
-
*/
|
|
780
|
-
getMode() {
|
|
781
|
-
return this.mode;
|
|
782
|
-
}
|
|
783
|
-
/**
|
|
784
|
-
* Set streaming manager for TUI updates
|
|
785
|
-
*/
|
|
786
|
-
setStreamingManager(manager) {
|
|
787
|
-
this.streamingManager = manager;
|
|
788
|
-
}
|
|
789
|
-
/**
|
|
790
|
-
* Register TUI callbacks for rich content
|
|
791
|
-
*/
|
|
792
|
-
registerTUICallbacks(callbacks) {
|
|
793
|
-
this.onBanner = callbacks.onBanner;
|
|
794
|
-
this.onSnippet = callbacks.onSnippet;
|
|
795
|
-
this.onCost = callbacks.onCost;
|
|
796
|
-
this.onReadiness = callbacks.onReadiness;
|
|
797
|
-
this.onSemantic = callbacks.onSemantic;
|
|
798
|
-
this.onAttack = callbacks.onAttack;
|
|
799
|
-
this.onActivity = callbacks.onActivity;
|
|
800
|
-
this.onLog = callbacks.onLog;
|
|
801
|
-
this.onNudge = callbacks.onNudge;
|
|
802
|
-
}
|
|
803
|
-
/**
|
|
804
|
-
* Clear TUI callbacks (when dashboard stops)
|
|
805
|
-
*/
|
|
806
|
-
clearTUICallbacks() {
|
|
807
|
-
this.onBanner = void 0;
|
|
808
|
-
this.onSnippet = void 0;
|
|
809
|
-
this.onCost = void 0;
|
|
810
|
-
this.onReadiness = void 0;
|
|
811
|
-
this.onSemantic = void 0;
|
|
812
|
-
this.onAttack = void 0;
|
|
813
|
-
this.onActivity = void 0;
|
|
814
|
-
this.onLog = void 0;
|
|
815
|
-
this.onNudge = void 0;
|
|
816
|
-
}
|
|
817
|
-
/**
|
|
818
|
-
* Emit content - routes to appropriate handler based on mode
|
|
819
|
-
*/
|
|
820
|
-
emit(content) {
|
|
821
|
-
content.timestamp = content.timestamp ?? Date.now();
|
|
822
|
-
switch (this.mode) {
|
|
823
|
-
case "tui":
|
|
824
|
-
this.routeToTUI(content);
|
|
825
|
-
break;
|
|
826
|
-
case "console":
|
|
827
|
-
this.routeToConsole(content);
|
|
828
|
-
break;
|
|
829
|
-
case "mcp":
|
|
830
|
-
this.routeToMarkdown(content);
|
|
831
|
-
break;
|
|
832
|
-
case "json":
|
|
833
|
-
this.routeToJson(content);
|
|
834
|
-
break;
|
|
835
|
-
case "silent":
|
|
836
|
-
break;
|
|
837
|
-
}
|
|
838
|
-
this.captureRawLog(content);
|
|
839
|
-
}
|
|
840
|
-
/**
|
|
841
|
-
* Route content to TUI (dashboard callbacks)
|
|
842
|
-
*/
|
|
843
|
-
routeToTUI(content) {
|
|
844
|
-
switch (content.type) {
|
|
845
|
-
case "banner":
|
|
846
|
-
this.onBanner?.(content.content);
|
|
847
|
-
break;
|
|
848
|
-
case "snippet":
|
|
849
|
-
this.onSnippet?.(content.content);
|
|
850
|
-
break;
|
|
851
|
-
case "cost":
|
|
852
|
-
this.onCost?.(content.content);
|
|
853
|
-
break;
|
|
854
|
-
case "readiness":
|
|
855
|
-
this.onReadiness?.(content.content);
|
|
856
|
-
break;
|
|
857
|
-
case "semantic":
|
|
858
|
-
this.onSemantic?.(content.content);
|
|
859
|
-
break;
|
|
860
|
-
case "attack":
|
|
861
|
-
this.onAttack?.(content.content);
|
|
862
|
-
break;
|
|
863
|
-
case "activity":
|
|
864
|
-
this.onActivity?.(content.content);
|
|
865
|
-
break;
|
|
866
|
-
case "log":
|
|
867
|
-
const level = content.metadata?.severity ?? "info";
|
|
868
|
-
this.onLog?.(level, content.content);
|
|
869
|
-
break;
|
|
870
|
-
case "issue":
|
|
871
|
-
this.streamingManager?.reportIssue(content.content);
|
|
872
|
-
break;
|
|
873
|
-
case "progress":
|
|
874
|
-
break;
|
|
875
|
-
case "report":
|
|
876
|
-
break;
|
|
877
|
-
case "nudge":
|
|
878
|
-
this.onNudge?.(content.content);
|
|
879
|
-
break;
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
/**
|
|
883
|
-
* Route content to console (ANSI formatted)
|
|
884
|
-
*/
|
|
885
|
-
routeToConsole(content) {
|
|
886
|
-
switch (content.type) {
|
|
887
|
-
case "banner":
|
|
888
|
-
const banner = content.content;
|
|
889
|
-
console.error("\n" + "=".repeat(60));
|
|
890
|
-
console.error(banner.art);
|
|
891
|
-
if (banner.version) {
|
|
892
|
-
console.error(` ${banner.skill} v${banner.version}`);
|
|
893
|
-
}
|
|
894
|
-
console.error("");
|
|
895
|
-
if (banner.quote) {
|
|
896
|
-
console.error(` "${banner.quote}"`);
|
|
897
|
-
}
|
|
898
|
-
console.error("=".repeat(60) + "\n");
|
|
899
|
-
break;
|
|
900
|
-
case "snippet":
|
|
901
|
-
const snippet = content.content;
|
|
902
|
-
console.error(`
|
|
903
|
-
${pc.dim("File:")} ${snippet.file}`);
|
|
904
|
-
for (let i = 0; i < snippet.lines.length; i++) {
|
|
905
|
-
const lineNum = snippet.startLine + i;
|
|
906
|
-
const isHighlight = lineNum === snippet.highlightLine;
|
|
907
|
-
const prefix = isHighlight ? pc.red("\u2192") : " ";
|
|
908
|
-
const lineNumStr = pc.dim(lineNum.toString().padStart(4));
|
|
909
|
-
const line = isHighlight ? pc.yellow(snippet.lines[i]) : snippet.lines[i];
|
|
910
|
-
console.error(`${prefix} ${lineNumStr} | ${line}`);
|
|
911
|
-
}
|
|
912
|
-
console.error("");
|
|
913
|
-
break;
|
|
914
|
-
case "cost":
|
|
915
|
-
const cost = content.content;
|
|
916
|
-
console.error("\n" + pc.cyan("[$] Cost Estimate:"));
|
|
917
|
-
console.error(` Fix now: ${pc.green(this.formatCurrency(cost.fixNowCost))}`);
|
|
918
|
-
console.error(` If production: ${pc.red(this.formatCurrency(cost.productionCost))}`);
|
|
919
|
-
console.error(` Savings: ${pc.yellow(this.formatCurrency(cost.savings))}`);
|
|
920
|
-
console.error("");
|
|
921
|
-
break;
|
|
922
|
-
case "readiness":
|
|
923
|
-
const readiness = content.content;
|
|
924
|
-
const statusColor = readiness.status === "ready" ? pc.green : readiness.status === "caution" ? pc.yellow : pc.red;
|
|
925
|
-
console.error("\n" + pc.cyan("[%] Production Readiness:"));
|
|
926
|
-
console.error(` Score: ${statusColor(readiness.score + "/100")}`);
|
|
927
|
-
console.error(` Requirements: ${readiness.requirementsMet}/${readiness.total}`);
|
|
928
|
-
console.error(` Status: ${statusColor(readiness.status.toUpperCase())}`);
|
|
929
|
-
console.error("");
|
|
930
|
-
break;
|
|
931
|
-
case "semantic":
|
|
932
|
-
const semantic = content.content;
|
|
933
|
-
console.error("\n" + pc.cyan("[?] Semantic Analysis:"));
|
|
934
|
-
if (semantic.dataFlowIssues > 0) {
|
|
935
|
-
console.error(` ${pc.red("[!]")} ${semantic.dataFlowIssues} data flow vulnerabilities`);
|
|
936
|
-
}
|
|
937
|
-
if (semantic.raceConditions > 0) {
|
|
938
|
-
console.error(` ${pc.yellow("[~]")} ${semantic.raceConditions} race conditions`);
|
|
939
|
-
}
|
|
940
|
-
if (semantic.authIssues > 0) {
|
|
941
|
-
console.error(` ${pc.red("[!]")} ${semantic.authIssues} authentication issues`);
|
|
942
|
-
}
|
|
943
|
-
console.error("");
|
|
944
|
-
break;
|
|
945
|
-
case "attack":
|
|
946
|
-
const attack = content.content;
|
|
947
|
-
console.error("\n" + pc.cyan("[>] Attack Surface:"));
|
|
948
|
-
console.error(` Endpoints: ${attack.totalEndpoints}`);
|
|
949
|
-
if (attack.unprotected > 0) {
|
|
950
|
-
console.error(` ${pc.red("Unprotected:")} ${attack.unprotected}`);
|
|
951
|
-
}
|
|
952
|
-
console.error(` Risk Score: ${attack.riskScore}/100`);
|
|
953
|
-
console.error("");
|
|
954
|
-
break;
|
|
955
|
-
case "activity":
|
|
956
|
-
console.error(pc.dim(`[${this.formatTime()}]`) + ` ${content.content}`);
|
|
957
|
-
break;
|
|
958
|
-
case "log":
|
|
959
|
-
const logLevel = String(content.metadata?.severity ?? "info");
|
|
960
|
-
const levelColor = logLevel === "error" || logLevel === "critical" ? pc.red : logLevel === "warn" || logLevel === "serious" ? pc.yellow : logLevel === "info" || logLevel === "moderate" ? pc.blue : pc.dim;
|
|
961
|
-
console.error(levelColor(`[${logLevel.toUpperCase()}]`) + ` ${content.content}`);
|
|
962
|
-
break;
|
|
963
|
-
case "issue":
|
|
964
|
-
const issue = content.content;
|
|
965
|
-
const sevColor = issue.severity === "critical" ? pc.red : issue.severity === "serious" ? pc.yellow : issue.severity === "moderate" ? pc.blue : pc.dim;
|
|
966
|
-
console.error(`${sevColor(`[${issue.severity.toUpperCase()}]`)} ${issue.issue}`);
|
|
967
|
-
console.error(` ${pc.dim("File:")} ${issue.file}:${issue.line ?? "?"}`);
|
|
968
|
-
break;
|
|
969
|
-
case "report":
|
|
970
|
-
console.error(content.content);
|
|
971
|
-
break;
|
|
972
|
-
case "nudge":
|
|
973
|
-
const nudge = content.content;
|
|
974
|
-
const nudgeColor = nudge.severity === "critical" ? pc.red : nudge.severity === "warning" ? pc.yellow : pc.cyan;
|
|
975
|
-
const nudgeIcon = nudge.severity === "critical" ? "[!!!]" : nudge.severity === "warning" ? "[!]" : "[>]";
|
|
976
|
-
console.error("");
|
|
977
|
-
console.error(nudgeColor("\u2501".repeat(60)));
|
|
978
|
-
console.error(nudgeColor(`${nudgeIcon} TRIE AGENT SAYS:`));
|
|
979
|
-
console.error(nudgeColor("\u2501".repeat(60)));
|
|
980
|
-
console.error("");
|
|
981
|
-
console.error(` ${pc.bold(nudge.message)}`);
|
|
982
|
-
if (nudge.file) {
|
|
983
|
-
console.error(` ${pc.dim("File:")} ${nudge.file}`);
|
|
984
|
-
}
|
|
985
|
-
console.error("");
|
|
986
|
-
console.error(nudgeColor("\u2501".repeat(60)));
|
|
987
|
-
console.error("");
|
|
988
|
-
break;
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
/**
|
|
992
|
-
* Route content to markdown buffer
|
|
993
|
-
*/
|
|
994
|
-
routeToMarkdown(content) {
|
|
995
|
-
switch (content.type) {
|
|
996
|
-
case "banner":
|
|
997
|
-
const banner = content.content;
|
|
998
|
-
this.markdownBuffer.push(`## ${banner.skill}
|
|
999
|
-
`);
|
|
1000
|
-
if (banner.quote) {
|
|
1001
|
-
this.markdownBuffer.push(`> ${banner.quote}
|
|
1002
|
-
`);
|
|
1003
|
-
}
|
|
1004
|
-
break;
|
|
1005
|
-
case "snippet":
|
|
1006
|
-
const snippet = content.content;
|
|
1007
|
-
this.markdownBuffer.push(`
|
|
1008
|
-
**File:** \`${snippet.file}\`
|
|
1009
|
-
`);
|
|
1010
|
-
this.markdownBuffer.push("```\n");
|
|
1011
|
-
for (let i = 0; i < snippet.lines.length; i++) {
|
|
1012
|
-
const lineNum = snippet.startLine + i;
|
|
1013
|
-
const prefix = lineNum === snippet.highlightLine ? "\u2192" : " ";
|
|
1014
|
-
this.markdownBuffer.push(`${prefix} ${lineNum.toString().padStart(4)} | ${snippet.lines[i]}
|
|
1015
|
-
`);
|
|
1016
|
-
}
|
|
1017
|
-
this.markdownBuffer.push("```\n");
|
|
1018
|
-
break;
|
|
1019
|
-
case "cost":
|
|
1020
|
-
const cost = content.content;
|
|
1021
|
-
this.markdownBuffer.push(`
|
|
1022
|
-
### Cost Estimate
|
|
1023
|
-
`);
|
|
1024
|
-
this.markdownBuffer.push(`- Fix now: ${this.formatCurrency(cost.fixNowCost)}
|
|
1025
|
-
`);
|
|
1026
|
-
this.markdownBuffer.push(`- If production: ${this.formatCurrency(cost.productionCost)}
|
|
1027
|
-
`);
|
|
1028
|
-
this.markdownBuffer.push(`- Savings: ${this.formatCurrency(cost.savings)}
|
|
1029
|
-
`);
|
|
1030
|
-
break;
|
|
1031
|
-
case "readiness":
|
|
1032
|
-
const readiness = content.content;
|
|
1033
|
-
this.markdownBuffer.push(`
|
|
1034
|
-
### Production Readiness
|
|
1035
|
-
`);
|
|
1036
|
-
this.markdownBuffer.push(`- Score: ${readiness.score}/100
|
|
1037
|
-
`);
|
|
1038
|
-
this.markdownBuffer.push(`- Requirements: ${readiness.requirementsMet}/${readiness.total}
|
|
1039
|
-
`);
|
|
1040
|
-
this.markdownBuffer.push(`- Status: **${readiness.status.toUpperCase()}**
|
|
1041
|
-
`);
|
|
1042
|
-
break;
|
|
1043
|
-
case "semantic":
|
|
1044
|
-
const semantic = content.content;
|
|
1045
|
-
this.markdownBuffer.push(`
|
|
1046
|
-
### Semantic Analysis
|
|
1047
|
-
`);
|
|
1048
|
-
if (semantic.dataFlowIssues > 0) {
|
|
1049
|
-
this.markdownBuffer.push(`- [CRITICAL] ${semantic.dataFlowIssues} data flow vulnerabilities
|
|
1050
|
-
`);
|
|
1051
|
-
}
|
|
1052
|
-
if (semantic.raceConditions > 0) {
|
|
1053
|
-
this.markdownBuffer.push(`- [WARN] ${semantic.raceConditions} race conditions
|
|
1054
|
-
`);
|
|
1055
|
-
}
|
|
1056
|
-
if (semantic.authIssues > 0) {
|
|
1057
|
-
this.markdownBuffer.push(`- [CRITICAL] ${semantic.authIssues} authentication issues
|
|
1058
|
-
`);
|
|
1059
|
-
}
|
|
1060
|
-
break;
|
|
1061
|
-
case "attack":
|
|
1062
|
-
const attack = content.content;
|
|
1063
|
-
this.markdownBuffer.push(`
|
|
1064
|
-
### Attack Surface
|
|
1065
|
-
`);
|
|
1066
|
-
this.markdownBuffer.push(`- Endpoints: ${attack.totalEndpoints}
|
|
1067
|
-
`);
|
|
1068
|
-
this.markdownBuffer.push(`- Unprotected: ${attack.unprotected}
|
|
1069
|
-
`);
|
|
1070
|
-
this.markdownBuffer.push(`- Risk Score: ${attack.riskScore}/100
|
|
1071
|
-
`);
|
|
1072
|
-
break;
|
|
1073
|
-
case "report":
|
|
1074
|
-
this.markdownBuffer.push(content.content);
|
|
1075
|
-
break;
|
|
1076
|
-
default:
|
|
1077
|
-
this.jsonBuffer.push(content);
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
/**
|
|
1081
|
-
* Route content to JSON buffer
|
|
1082
|
-
*/
|
|
1083
|
-
routeToJson(content) {
|
|
1084
|
-
this.jsonBuffer.push(content);
|
|
1085
|
-
}
|
|
1086
|
-
/**
|
|
1087
|
-
* Capture content in raw log buffer
|
|
1088
|
-
*/
|
|
1089
|
-
captureRawLog(content) {
|
|
1090
|
-
const time = this.formatTime(content.timestamp);
|
|
1091
|
-
const level = content.metadata?.severity ?? content.type;
|
|
1092
|
-
let message = "";
|
|
1093
|
-
switch (content.type) {
|
|
1094
|
-
case "banner":
|
|
1095
|
-
message = `[BANNER] ${content.content.skill}`;
|
|
1096
|
-
break;
|
|
1097
|
-
case "activity":
|
|
1098
|
-
case "log":
|
|
1099
|
-
message = content.content;
|
|
1100
|
-
break;
|
|
1101
|
-
case "issue":
|
|
1102
|
-
const issue = content.content;
|
|
1103
|
-
message = `[${issue.severity.toUpperCase()}] ${issue.issue}`;
|
|
1104
|
-
break;
|
|
1105
|
-
default:
|
|
1106
|
-
message = `[${content.type.toUpperCase()}] Content received`;
|
|
1107
|
-
}
|
|
1108
|
-
this.rawLogBuffer.push({ time, level, message });
|
|
1109
|
-
if (this.rawLogBuffer.length > 500) {
|
|
1110
|
-
this.rawLogBuffer = this.rawLogBuffer.slice(-500);
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
/**
|
|
1114
|
-
* Get raw log buffer for display
|
|
1115
|
-
*/
|
|
1116
|
-
getRawLog() {
|
|
1117
|
-
return [...this.rawLogBuffer];
|
|
1118
|
-
}
|
|
1119
|
-
/**
|
|
1120
|
-
* Get accumulated markdown output
|
|
1121
|
-
*/
|
|
1122
|
-
getMarkdown() {
|
|
1123
|
-
return this.markdownBuffer.join("\n");
|
|
1124
|
-
}
|
|
1125
|
-
/**
|
|
1126
|
-
* Get accumulated JSON output
|
|
1127
|
-
*/
|
|
1128
|
-
getJson() {
|
|
1129
|
-
return [...this.jsonBuffer];
|
|
1130
|
-
}
|
|
1131
|
-
/**
|
|
1132
|
-
* Clear buffers
|
|
1133
|
-
*/
|
|
1134
|
-
clearBuffers() {
|
|
1135
|
-
this.markdownBuffer = [];
|
|
1136
|
-
this.jsonBuffer = [];
|
|
1137
|
-
}
|
|
1138
|
-
// ============================================
|
|
1139
|
-
// Convenience methods for common output types
|
|
1140
|
-
// ============================================
|
|
1141
|
-
/**
|
|
1142
|
-
* Display a skill banner
|
|
1143
|
-
*/
|
|
1144
|
-
banner(skill, art, options) {
|
|
1145
|
-
this.emit({
|
|
1146
|
-
type: "banner",
|
|
1147
|
-
content: { skill, art, quote: options?.quote, version: options?.version },
|
|
1148
|
-
metadata: { agent: skill }
|
|
1149
|
-
});
|
|
1150
|
-
}
|
|
1151
|
-
/**
|
|
1152
|
-
* Display a code snippet
|
|
1153
|
-
*/
|
|
1154
|
-
snippet(file, lines, startLine, highlightLine) {
|
|
1155
|
-
this.emit({
|
|
1156
|
-
type: "snippet",
|
|
1157
|
-
content: { file, lines, startLine, highlightLine },
|
|
1158
|
-
metadata: { file }
|
|
1159
|
-
});
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
* Display cost estimate
|
|
1163
|
-
*/
|
|
1164
|
-
cost(fixNowCost, productionCost, savings, perIssue) {
|
|
1165
|
-
this.emit({
|
|
1166
|
-
type: "cost",
|
|
1167
|
-
content: { fixNowCost, productionCost, savings, perIssue }
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1170
|
-
/**
|
|
1171
|
-
* Display production readiness
|
|
1172
|
-
*/
|
|
1173
|
-
readiness(score, requirementsMet, total, status, requirements) {
|
|
1174
|
-
const content = { score, requirementsMet, total, status };
|
|
1175
|
-
if (requirements) {
|
|
1176
|
-
content.requirements = requirements;
|
|
1177
|
-
}
|
|
1178
|
-
this.emit({
|
|
1179
|
-
type: "readiness",
|
|
1180
|
-
content
|
|
1181
|
-
});
|
|
1182
|
-
}
|
|
1183
|
-
/**
|
|
1184
|
-
* Display semantic analysis results
|
|
1185
|
-
*/
|
|
1186
|
-
semantic(dataFlowIssues, raceConditions, authIssues) {
|
|
1187
|
-
this.emit({
|
|
1188
|
-
type: "semantic",
|
|
1189
|
-
content: { dataFlowIssues, raceConditions, authIssues }
|
|
1190
|
-
});
|
|
1191
|
-
}
|
|
1192
|
-
/**
|
|
1193
|
-
* Display attack surface analysis
|
|
1194
|
-
*/
|
|
1195
|
-
attack(totalEndpoints, unprotected, riskScore) {
|
|
1196
|
-
this.emit({
|
|
1197
|
-
type: "attack",
|
|
1198
|
-
content: { totalEndpoints, unprotected, riskScore }
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
|
-
/**
|
|
1202
|
-
* Log an activity message
|
|
1203
|
-
*/
|
|
1204
|
-
activity(message) {
|
|
1205
|
-
this.emit({
|
|
1206
|
-
type: "activity",
|
|
1207
|
-
content: message
|
|
1208
|
-
});
|
|
1209
|
-
}
|
|
1210
|
-
/**
|
|
1211
|
-
* Log a message at specified level
|
|
1212
|
-
*/
|
|
1213
|
-
log(level, message) {
|
|
1214
|
-
this.emit({
|
|
1215
|
-
type: "log",
|
|
1216
|
-
content: message,
|
|
1217
|
-
metadata: { severity: level }
|
|
1218
|
-
});
|
|
1219
|
-
}
|
|
1220
|
-
/**
|
|
1221
|
-
* Log info message
|
|
1222
|
-
*/
|
|
1223
|
-
info(message) {
|
|
1224
|
-
this.log("info", message);
|
|
1225
|
-
}
|
|
1226
|
-
/**
|
|
1227
|
-
* Log warning message
|
|
1228
|
-
*/
|
|
1229
|
-
warn(message) {
|
|
1230
|
-
this.log("warn", message);
|
|
1231
|
-
}
|
|
1232
|
-
/**
|
|
1233
|
-
* Log error message
|
|
1234
|
-
*/
|
|
1235
|
-
error(message) {
|
|
1236
|
-
this.log("error", message);
|
|
1237
|
-
}
|
|
1238
|
-
/**
|
|
1239
|
-
* Log debug message
|
|
1240
|
-
*/
|
|
1241
|
-
debug(message) {
|
|
1242
|
-
this.log("debug", message);
|
|
1243
|
-
}
|
|
1244
|
-
/**
|
|
1245
|
-
* Report an issue
|
|
1246
|
-
*/
|
|
1247
|
-
issue(issue) {
|
|
1248
|
-
this.emit({
|
|
1249
|
-
type: "issue",
|
|
1250
|
-
content: issue,
|
|
1251
|
-
metadata: { severity: issue.severity, agent: issue.agent, file: issue.file }
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1254
|
-
/**
|
|
1255
|
-
* Add a report section
|
|
1256
|
-
*/
|
|
1257
|
-
report(content) {
|
|
1258
|
-
this.emit({
|
|
1259
|
-
type: "report",
|
|
1260
|
-
content
|
|
1261
|
-
});
|
|
1262
|
-
}
|
|
1263
|
-
/**
|
|
1264
|
-
* Send a proactive notification/nudge to the user
|
|
1265
|
-
* This creates a prominent popup in TUI mode or a boxed message in console mode
|
|
1266
|
-
*/
|
|
1267
|
-
nudge(message, severity = "warning", file, autoHideMs) {
|
|
1268
|
-
const metadata = {};
|
|
1269
|
-
if (severity === "critical") metadata.severity = "critical";
|
|
1270
|
-
else if (severity === "warning") metadata.severity = "moderate";
|
|
1271
|
-
else metadata.severity = "low";
|
|
1272
|
-
if (file !== void 0) metadata.file = file;
|
|
1273
|
-
this.emit({
|
|
1274
|
-
type: "nudge",
|
|
1275
|
-
content: { message, severity, file, autoHideMs },
|
|
1276
|
-
metadata
|
|
1277
|
-
});
|
|
1278
|
-
}
|
|
1279
|
-
// ============================================
|
|
1280
|
-
// Helpers
|
|
1281
|
-
// ============================================
|
|
1282
|
-
formatCurrency(amount) {
|
|
1283
|
-
if (amount >= 1e6) return `$${(amount / 1e6).toFixed(2)}M`;
|
|
1284
|
-
if (amount >= 1e3) return `$${(amount / 1e3).toFixed(1)}k`;
|
|
1285
|
-
return `$${amount}`;
|
|
1286
|
-
}
|
|
1287
|
-
formatTime(timestamp) {
|
|
1288
|
-
const date = timestamp ? new Date(timestamp) : /* @__PURE__ */ new Date();
|
|
1289
|
-
return date.toLocaleTimeString("en-US", { hour12: false, hour: "2-digit", minute: "2-digit", second: "2-digit" });
|
|
1290
|
-
}
|
|
1291
|
-
};
|
|
1292
|
-
var instance = null;
|
|
1293
|
-
function getOutputManager() {
|
|
1294
|
-
if (!instance) {
|
|
1295
|
-
instance = new OutputManagerImpl();
|
|
1296
|
-
if (isInteractiveMode()) {
|
|
1297
|
-
instance.setMode("tui");
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
return instance;
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
762
|
// src/cli/dashboard/App.tsx
|
|
1304
|
-
import { existsSync as
|
|
763
|
+
import { existsSync as existsSync3 } from "fs";
|
|
1305
764
|
import { readFile as readFile2, writeFile, mkdir } from "fs/promises";
|
|
1306
|
-
import { join } from "path";
|
|
765
|
+
import { join as join2 } from "path";
|
|
1307
766
|
|
|
1308
767
|
// src/cli/dashboard/components/Header.tsx
|
|
1309
768
|
import { useState, useEffect } from "react";
|
|
@@ -1322,9 +781,8 @@ function Header() {
|
|
|
1322
781
|
}, [watch.watching]);
|
|
1323
782
|
let statusLabel;
|
|
1324
783
|
if (watch.watching) {
|
|
1325
|
-
const spinner = WATCH_FRAMES[frame] || "\u25D0";
|
|
1326
784
|
statusLabel = totalExtracted > 0 ? /* @__PURE__ */ jsxs(Text, { children: [
|
|
1327
|
-
/* @__PURE__ */ jsx2(Text, { color: "green", children:
|
|
785
|
+
/* @__PURE__ */ jsx2(Text, { color: "green", children: "\u25C9" }),
|
|
1328
786
|
" ",
|
|
1329
787
|
/* @__PURE__ */ jsx2(Text, { color: "green", bold: true, children: "Learning" }),
|
|
1330
788
|
" ",
|
|
@@ -1333,7 +791,7 @@ function Header() {
|
|
|
1333
791
|
" signals"
|
|
1334
792
|
] })
|
|
1335
793
|
] }) : /* @__PURE__ */ jsxs(Text, { children: [
|
|
1336
|
-
/* @__PURE__ */ jsx2(Text, { color: "green", children:
|
|
794
|
+
/* @__PURE__ */ jsx2(Text, { color: "green", children: "\u25C9" }),
|
|
1337
795
|
" ",
|
|
1338
796
|
/* @__PURE__ */ jsx2(Text, { bold: true, children: "Watching" })
|
|
1339
797
|
] });
|
|
@@ -1345,10 +803,10 @@ function Header() {
|
|
|
1345
803
|
] });
|
|
1346
804
|
}
|
|
1347
805
|
return /* @__PURE__ */ jsxs(Box, { paddingX: 1, justifyContent: "space-between", children: [
|
|
1348
|
-
/* @__PURE__ */ jsx2(Text, { color: "green", bold: true, children: "
|
|
806
|
+
/* @__PURE__ */ jsx2(Text, { color: "green", bold: true, children: "\u2B21 Trie" }),
|
|
1349
807
|
/* @__PURE__ */ jsxs(Box, { gap: 2, children: [
|
|
1350
808
|
statusLabel,
|
|
1351
|
-
alerts.hasCritical && /* @__PURE__ */ jsx2(Text, { color: "red", bold: true, children: "\
|
|
809
|
+
alerts.hasCritical && /* @__PURE__ */ jsx2(Text, { color: "red", bold: true, children: "\u2B22 Alert" })
|
|
1352
810
|
] })
|
|
1353
811
|
] });
|
|
1354
812
|
}
|
|
@@ -1421,6 +879,9 @@ function Notification() {
|
|
|
1421
879
|
// src/cli/dashboard/components/ConfigDialog.tsx
|
|
1422
880
|
import { useState as useState2 } from "react";
|
|
1423
881
|
import { Box as Box4, Text as Text4, useInput } from "ink";
|
|
882
|
+
import { existsSync } from "fs";
|
|
883
|
+
import { rm } from "fs/promises";
|
|
884
|
+
import { join } from "path";
|
|
1424
885
|
import { Fragment, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1425
886
|
function maskKey(key) {
|
|
1426
887
|
if (!key || key.length < 12) return "Not set";
|
|
@@ -1433,13 +894,16 @@ function ConfigDialog({ onClose }) {
|
|
|
1433
894
|
const [editing, setEditing] = useState2(false);
|
|
1434
895
|
const [editBuffer, setEditBuffer] = useState2("");
|
|
1435
896
|
const [editIsText, setEditIsText] = useState2(false);
|
|
897
|
+
const [showConfirmClear, setShowConfirmClear] = useState2(false);
|
|
898
|
+
const [clearingMemory, setClearingMemory] = useState2(false);
|
|
1436
899
|
const config = state.agentConfig;
|
|
1437
900
|
const currentKeyDisplay = isAIAvailable() ? maskKey(getKeyFromKeychain() || process.env.ANTHROPIC_API_KEY || null) : "Not set";
|
|
1438
901
|
const keyActive = isAIAvailable();
|
|
1439
902
|
const mainMenu = [
|
|
1440
903
|
{ label: "API Keys", key: "apiKeys", value: keyActive ? "Active" : "Not set", section: "main" },
|
|
1441
904
|
{ label: "Performance Settings", key: "performance", value: `${config.performance.maxConcurrency} concurrent`, section: "main" },
|
|
1442
|
-
{ label: "Risk Thresholds", key: "riskThresholds", value: `critical: ${config.riskThresholds.critical}%`, section: "main" }
|
|
905
|
+
{ label: "Risk Thresholds", key: "riskThresholds", value: `critical: ${config.riskThresholds.critical}%`, section: "main" },
|
|
906
|
+
{ label: "Memory Management", key: "memory", value: "Clear & Reset", section: "main" }
|
|
1443
907
|
];
|
|
1444
908
|
const apiKeysItems = [
|
|
1445
909
|
{ label: "Anthropic", key: "anthropic", value: currentKeyDisplay, section: "apiKeys" }
|
|
@@ -1456,8 +920,29 @@ function ConfigDialog({ onClose }) {
|
|
|
1456
920
|
{ label: "High Threshold", key: "high", value: String(config.riskThresholds.high), section: "riskThresholds" },
|
|
1457
921
|
{ label: "Medium Threshold", key: "medium", value: String(config.riskThresholds.medium), section: "riskThresholds" }
|
|
1458
922
|
];
|
|
1459
|
-
const
|
|
923
|
+
const memoryItems = [
|
|
924
|
+
{ label: "Clear All Memory", key: "clearAll", value: "Reset ledger, context graph", section: "memory" }
|
|
925
|
+
];
|
|
926
|
+
const items = section === "main" ? mainMenu : section === "apiKeys" ? apiKeysItems : section === "performance" ? performanceItems : section === "riskThresholds" ? riskItems : section === "memory" ? memoryItems : mainMenu;
|
|
1460
927
|
useInput((_input, key) => {
|
|
928
|
+
if (showConfirmClear) {
|
|
929
|
+
if (_input === "y" || _input === "Y") {
|
|
930
|
+
setClearingMemory(true);
|
|
931
|
+
clearMemory().then(() => {
|
|
932
|
+
dispatch({ type: "ADD_ACTIVITY", message: "Memory cleared successfully" });
|
|
933
|
+
setShowConfirmClear(false);
|
|
934
|
+
setClearingMemory(false);
|
|
935
|
+
setSection("main");
|
|
936
|
+
}).catch(() => {
|
|
937
|
+
dispatch({ type: "ADD_ACTIVITY", message: "Failed to clear memory" });
|
|
938
|
+
setShowConfirmClear(false);
|
|
939
|
+
setClearingMemory(false);
|
|
940
|
+
});
|
|
941
|
+
} else if (_input === "n" || _input === "N" || key.escape) {
|
|
942
|
+
setShowConfirmClear(false);
|
|
943
|
+
}
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
1461
946
|
if (editing) {
|
|
1462
947
|
if (key.escape) {
|
|
1463
948
|
setEditing(false);
|
|
@@ -1524,6 +1009,11 @@ function ConfigDialog({ onClose }) {
|
|
|
1524
1009
|
setEditing(true);
|
|
1525
1010
|
setEditBuffer("");
|
|
1526
1011
|
setEditIsText(true);
|
|
1012
|
+
} else if (section === "memory") {
|
|
1013
|
+
const item = items[selectedIndex];
|
|
1014
|
+
if (item && item.key === "clearAll") {
|
|
1015
|
+
setShowConfirmClear(true);
|
|
1016
|
+
}
|
|
1527
1017
|
} else {
|
|
1528
1018
|
const item = items[selectedIndex];
|
|
1529
1019
|
if (item) {
|
|
@@ -1540,11 +1030,60 @@ function ConfigDialog({ onClose }) {
|
|
|
1540
1030
|
}
|
|
1541
1031
|
}
|
|
1542
1032
|
});
|
|
1543
|
-
const sectionTitle = section === "main" ? "TRIE CONFIGURATION" : section === "apiKeys" ? "API KEYS" : section === "performance" ? "PERFORMANCE SETTINGS" : section === "riskThresholds" ? "RISK THRESHOLDS" : "CONFIGURATION";
|
|
1033
|
+
const sectionTitle = section === "main" ? "TRIE CONFIGURATION" : section === "apiKeys" ? "API KEYS" : section === "performance" ? "PERFORMANCE SETTINGS" : section === "riskThresholds" ? "RISK THRESHOLDS" : section === "memory" ? "MEMORY MANAGEMENT" : "CONFIGURATION";
|
|
1034
|
+
async function clearMemory() {
|
|
1035
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
1036
|
+
const trieDir = getTrieDirectory(workDir);
|
|
1037
|
+
const filesToDelete = [
|
|
1038
|
+
join(trieDir, "context-graph.json"),
|
|
1039
|
+
join(trieDir, "incident-trie.json"),
|
|
1040
|
+
join(trieDir, "memory", "ledger.json"),
|
|
1041
|
+
join(trieDir, "memory", "issue-store.db"),
|
|
1042
|
+
join(trieDir, "memory", "insights.json")
|
|
1043
|
+
];
|
|
1044
|
+
for (const file of filesToDelete) {
|
|
1045
|
+
if (existsSync(file)) {
|
|
1046
|
+
await rm(file, { force: true });
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1544
1050
|
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 1, paddingY: 0, children: [
|
|
1545
1051
|
/* @__PURE__ */ jsx5(Text4, { bold: true, children: sectionTitle }),
|
|
1546
1052
|
/* @__PURE__ */ jsx5(Text4, { children: " " }),
|
|
1547
|
-
|
|
1053
|
+
showConfirmClear && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", borderStyle: "round", borderColor: "red", paddingX: 1, paddingY: 0, children: [
|
|
1054
|
+
/* @__PURE__ */ jsx5(Text4, { children: " " }),
|
|
1055
|
+
/* @__PURE__ */ jsx5(Text4, { bold: true, color: "red", children: "\u2B22 CONFIRM MEMORY CLEAR" }),
|
|
1056
|
+
/* @__PURE__ */ jsx5(Text4, { children: " " }),
|
|
1057
|
+
/* @__PURE__ */ jsx5(Text4, { children: "This will permanently delete:" }),
|
|
1058
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Risk Hotspots (context graph)" }),
|
|
1059
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Decisions ledger" }),
|
|
1060
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Incidents" }),
|
|
1061
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Issue store" }),
|
|
1062
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Guardian insights" }),
|
|
1063
|
+
/* @__PURE__ */ jsx5(Text4, { children: " " }),
|
|
1064
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: "Preserved: Goals, hypotheses, and config" }),
|
|
1065
|
+
/* @__PURE__ */ jsx5(Text4, { children: " " }),
|
|
1066
|
+
clearingMemory ? /* @__PURE__ */ jsx5(Text4, { color: "yellow", children: "\u25C9 Clearing memory..." }) : /* @__PURE__ */ jsx5(Text4, { children: /* @__PURE__ */ jsx5(Text4, { bold: true, children: "Type 'y' to confirm, 'n' to cancel" }) }),
|
|
1067
|
+
/* @__PURE__ */ jsx5(Text4, { children: " " })
|
|
1068
|
+
] }),
|
|
1069
|
+
!showConfirmClear && section === "memory" && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
1070
|
+
/* @__PURE__ */ jsxs4(Text4, { children: [
|
|
1071
|
+
" ",
|
|
1072
|
+
/* @__PURE__ */ jsx5(Text4, { bold: true, children: "Clear All Memory" })
|
|
1073
|
+
] }),
|
|
1074
|
+
/* @__PURE__ */ jsx5(Text4, { children: " " }),
|
|
1075
|
+
/* @__PURE__ */ jsx5(Text4, { children: "Reset your Trie memory to start fresh:" }),
|
|
1076
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Risk hotspots" }),
|
|
1077
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Decisions ledger" }),
|
|
1078
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Incidents" }),
|
|
1079
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Issue database" }),
|
|
1080
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Insights" }),
|
|
1081
|
+
/* @__PURE__ */ jsx5(Text4, { children: " " }),
|
|
1082
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: "Preserves: Goals, hypotheses, config, API keys" }),
|
|
1083
|
+
/* @__PURE__ */ jsx5(Text4, { children: " " }),
|
|
1084
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter clear memory esc back" })
|
|
1085
|
+
] }),
|
|
1086
|
+
!showConfirmClear && section === "apiKeys" && !editing && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
1548
1087
|
/* @__PURE__ */ jsxs4(Text4, { children: [
|
|
1549
1088
|
" ",
|
|
1550
1089
|
/* @__PURE__ */ jsx5(Text4, { bold: true, children: "Anthropic:" }),
|
|
@@ -1556,7 +1095,7 @@ function ConfigDialog({ onClose }) {
|
|
|
1556
1095
|
/* @__PURE__ */ jsx5(Text4, { children: " " }),
|
|
1557
1096
|
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter to update esc back" })
|
|
1558
1097
|
] }),
|
|
1559
|
-
section === "apiKeys" && editing && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
1098
|
+
!showConfirmClear && section === "apiKeys" && editing && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
1560
1099
|
/* @__PURE__ */ jsx5(Box4, { borderStyle: "round", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs4(Text4, { children: [
|
|
1561
1100
|
editBuffer || /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: "sk-ant-..." }),
|
|
1562
1101
|
/* @__PURE__ */ jsx5(Text4, { bold: true, color: "green", children: "|" })
|
|
@@ -1567,7 +1106,7 @@ function ConfigDialog({ onClose }) {
|
|
|
1567
1106
|
") esc cancel"
|
|
1568
1107
|
] })
|
|
1569
1108
|
] }),
|
|
1570
|
-
section !== "apiKeys" && items.map((item, idx) => {
|
|
1109
|
+
!showConfirmClear && section !== "apiKeys" && section !== "memory" && items.map((item, idx) => {
|
|
1571
1110
|
const isSelected = selectedIndex === idx;
|
|
1572
1111
|
return /* @__PURE__ */ jsxs4(Text4, { children: [
|
|
1573
1112
|
isSelected ? /* @__PURE__ */ jsxs4(Text4, { bold: true, color: "green", children: [
|
|
@@ -1584,7 +1123,7 @@ function ConfigDialog({ onClose }) {
|
|
|
1584
1123
|
] }) : /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: item.value })
|
|
1585
1124
|
] }, item.key);
|
|
1586
1125
|
}),
|
|
1587
|
-
section !== "apiKeys" && /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1126
|
+
!showConfirmClear && section !== "apiKeys" && section !== "memory" && /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1588
1127
|
/* @__PURE__ */ jsx5(Text4, { children: " " }),
|
|
1589
1128
|
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: section === "main" ? "enter select \xB7 esc close" : "enter edit \xB7 esc/b back" })
|
|
1590
1129
|
] })
|
|
@@ -1678,23 +1217,23 @@ import { useEffect as useEffect2, useCallback } from "react";
|
|
|
1678
1217
|
import { Box as Box6, Text as Text6, useInput as useInput2 } from "ink";
|
|
1679
1218
|
|
|
1680
1219
|
// src/cli/dashboard/theme.ts
|
|
1681
|
-
import
|
|
1220
|
+
import pc from "picocolors";
|
|
1682
1221
|
var colors = {
|
|
1683
|
-
border: (s) =>
|
|
1684
|
-
header: (s) =>
|
|
1685
|
-
brand: (s) =>
|
|
1686
|
-
dim: (s) =>
|
|
1687
|
-
critical: (s) =>
|
|
1688
|
-
serious: (s) =>
|
|
1689
|
-
moderate: (s) =>
|
|
1690
|
-
low: (s) =>
|
|
1691
|
-
success: (s) =>
|
|
1692
|
-
running: (s) =>
|
|
1693
|
-
waiting: (s) =>
|
|
1694
|
-
alert: (s) =>
|
|
1695
|
-
selected: (s) =>
|
|
1696
|
-
highlight: (s) =>
|
|
1697
|
-
yellow: (s) =>
|
|
1222
|
+
border: (s) => pc.dim(s),
|
|
1223
|
+
header: (s) => pc.bold(pc.white(s)),
|
|
1224
|
+
brand: (s) => pc.bold(pc.green(s)),
|
|
1225
|
+
dim: (s) => pc.dim(s),
|
|
1226
|
+
critical: (s) => pc.bold(pc.red(s)),
|
|
1227
|
+
serious: (s) => pc.yellow(s),
|
|
1228
|
+
moderate: (s) => pc.blue(s),
|
|
1229
|
+
low: (s) => pc.dim(s),
|
|
1230
|
+
success: (s) => pc.green(s),
|
|
1231
|
+
running: (s) => pc.yellow(s),
|
|
1232
|
+
waiting: (s) => pc.dim(s),
|
|
1233
|
+
alert: (s) => pc.bold(pc.red(s)),
|
|
1234
|
+
selected: (s) => pc.bold(pc.green(s)),
|
|
1235
|
+
highlight: (s) => pc.bold(pc.white(s)),
|
|
1236
|
+
yellow: (s) => pc.yellow(s)
|
|
1698
1237
|
};
|
|
1699
1238
|
function formatTimeAgo(timestamp) {
|
|
1700
1239
|
const seconds = Math.floor((Date.now() - timestamp) / 1e3);
|
|
@@ -2499,11 +2038,6 @@ function MemoryTreeView() {
|
|
|
2499
2038
|
n.data.changeCount,
|
|
2500
2039
|
" changes"
|
|
2501
2040
|
] }),
|
|
2502
|
-
n.data.incidentCount > 0 && /* @__PURE__ */ jsxs9(Text9, { color: "red", children: [
|
|
2503
|
-
" ",
|
|
2504
|
-
n.data.incidentCount,
|
|
2505
|
-
" incidents"
|
|
2506
|
-
] }),
|
|
2507
2041
|
n.data.whyRisky && /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
2508
2042
|
" ",
|
|
2509
2043
|
n.data.whyRisky
|
|
@@ -3318,7 +2852,7 @@ var TrieCheckTool = class {
|
|
|
3318
2852
|
|
|
3319
2853
|
// src/tools/explain.ts
|
|
3320
2854
|
import { readFile } from "fs/promises";
|
|
3321
|
-
import { existsSync } from "fs";
|
|
2855
|
+
import { existsSync as existsSync2 } from "fs";
|
|
3322
2856
|
import { extname, relative, resolve, isAbsolute } from "path";
|
|
3323
2857
|
|
|
3324
2858
|
// src/ai/prompts.ts
|
|
@@ -4247,7 +3781,7 @@ var TrieExplainTool = class {
|
|
|
4247
3781
|
let language;
|
|
4248
3782
|
const workDir = getWorkingDirectory(void 0, true);
|
|
4249
3783
|
const resolvedPath = isAbsolute(target) ? target : resolve(workDir, target);
|
|
4250
|
-
if (
|
|
3784
|
+
if (existsSync2(resolvedPath)) {
|
|
4251
3785
|
code = await readFile(resolvedPath, "utf-8");
|
|
4252
3786
|
filePath = relative(workDir, resolvedPath);
|
|
4253
3787
|
language = this.detectLanguage(resolvedPath);
|
|
@@ -4356,7 +3890,7 @@ ${"\u2500".repeat(60)}
|
|
|
4356
3890
|
else if (/moderate|warning/i.test(issue)) severity = "moderate";
|
|
4357
3891
|
else severity = "low";
|
|
4358
3892
|
let codeContext = "";
|
|
4359
|
-
if (file &&
|
|
3893
|
+
if (file && existsSync2(file)) {
|
|
4360
3894
|
const content = await readFile(file, "utf-8");
|
|
4361
3895
|
const lines = content.split("\n");
|
|
4362
3896
|
const start = Math.max(0, line - 5);
|
|
@@ -4469,7 +4003,7 @@ ${"\u2501".repeat(60)}
|
|
|
4469
4003
|
output += `${"\u2501".repeat(60)}
|
|
4470
4004
|
|
|
4471
4005
|
`;
|
|
4472
|
-
if (
|
|
4006
|
+
if (existsSync2(resolvedPath)) {
|
|
4473
4007
|
const code = await readFile(resolvedPath, "utf-8");
|
|
4474
4008
|
const filePath = relative(workDir, resolvedPath);
|
|
4475
4009
|
const riskIndicators = this.detectRiskIndicators(code);
|
|
@@ -5050,6 +4584,17 @@ var CHAT_TOOLS = [
|
|
|
5050
4584
|
required: ["statement"]
|
|
5051
4585
|
}
|
|
5052
4586
|
},
|
|
4587
|
+
{
|
|
4588
|
+
name: "trie_delete_incident",
|
|
4589
|
+
description: "Delete an incident from the ledger. Use when the user says an incident was logged by mistake, is misclassified, or should be removed.",
|
|
4590
|
+
input_schema: {
|
|
4591
|
+
type: "object",
|
|
4592
|
+
properties: {
|
|
4593
|
+
search: { type: "string", description: "Text to match against incident descriptions to find the one to delete" }
|
|
4594
|
+
},
|
|
4595
|
+
required: ["search"]
|
|
4596
|
+
}
|
|
4597
|
+
},
|
|
5053
4598
|
{
|
|
5054
4599
|
name: "trie_add_decision",
|
|
5055
4600
|
description: "Record an architectural or coding decision. Use when the user makes, announces, or wants to log a decision about the codebase.",
|
|
@@ -5153,6 +4698,22 @@ async function executeTool(name, input) {
|
|
|
5153
4698
|
await agentState.addHypothesis(hypothesis);
|
|
5154
4699
|
return `Hypothesis created: "${stmt}" [${category}]`;
|
|
5155
4700
|
}
|
|
4701
|
+
case "trie_delete_incident": {
|
|
4702
|
+
const search = String(input.search || "").trim().toLowerCase();
|
|
4703
|
+
if (!search) return "Search text is required to find the incident.";
|
|
4704
|
+
const graph = new ContextGraph(directory);
|
|
4705
|
+
const nodes = await graph.listNodes();
|
|
4706
|
+
const incidents = nodes.filter(
|
|
4707
|
+
(n) => n.type === "incident" && n.data.description?.toLowerCase().includes(search)
|
|
4708
|
+
);
|
|
4709
|
+
if (incidents.length === 0) return `No incidents found matching "${search}".`;
|
|
4710
|
+
for (const inc of incidents) {
|
|
4711
|
+
await graph.deleteNode("incident", inc.id);
|
|
4712
|
+
}
|
|
4713
|
+
await exportToJson(graph);
|
|
4714
|
+
const descs = incidents.map((i) => `"${i.data.description.slice(0, 60)}"`);
|
|
4715
|
+
return `Deleted ${incidents.length} incident(s): ${descs.join(", ")}`;
|
|
4716
|
+
}
|
|
5156
4717
|
case "trie_add_decision": {
|
|
5157
4718
|
const dec = String(input.decision || "").trim();
|
|
5158
4719
|
const ctx = String(input.context || "").trim();
|
|
@@ -5308,7 +4869,37 @@ ${contextBlock}`;
|
|
|
5308
4869
|
role: "assistant",
|
|
5309
4870
|
content: result.content
|
|
5310
4871
|
};
|
|
5311
|
-
if (result.toolCalls && result.toolCalls.length > 0)
|
|
4872
|
+
if (result.toolCalls && result.toolCalls.length > 0) {
|
|
4873
|
+
action.toolCalls = result.toolCalls;
|
|
4874
|
+
const toolNames = new Set(result.toolCalls.map((tc) => tc.name));
|
|
4875
|
+
if (toolNames.has("trie_add_goal") || toolNames.has("trie_add_hypothesis")) {
|
|
4876
|
+
try {
|
|
4877
|
+
const agentState = getGuardianState(workDir);
|
|
4878
|
+
await agentState.load();
|
|
4879
|
+
if (toolNames.has("trie_add_goal")) {
|
|
4880
|
+
const goals = agentState.getAllGoals();
|
|
4881
|
+
dispatch({
|
|
4882
|
+
type: "SET_GOALS",
|
|
4883
|
+
goals: goals.map((g) => {
|
|
4884
|
+
const base = { id: g.id, description: g.description, type: g.type, target: g.target, currentValue: g.currentValue, status: g.status, autoGenerated: g.autoGenerated, updatedAt: g.updatedAt };
|
|
4885
|
+
return g.category ? { ...base, category: g.category } : base;
|
|
4886
|
+
})
|
|
4887
|
+
});
|
|
4888
|
+
}
|
|
4889
|
+
if (toolNames.has("trie_add_hypothesis")) {
|
|
4890
|
+
const hypotheses = agentState.getAllHypotheses();
|
|
4891
|
+
dispatch({
|
|
4892
|
+
type: "SET_HYPOTHESES",
|
|
4893
|
+
hypotheses: hypotheses.map((h) => {
|
|
4894
|
+
const base = { id: h.id, statement: h.statement, confidence: h.confidence, status: h.status, evidenceCount: h.evidence.length, updatedAt: h.updatedAt };
|
|
4895
|
+
return h.category ? { ...base, category: h.category } : base;
|
|
4896
|
+
})
|
|
4897
|
+
});
|
|
4898
|
+
}
|
|
4899
|
+
} catch {
|
|
4900
|
+
}
|
|
4901
|
+
}
|
|
4902
|
+
}
|
|
5312
4903
|
dispatch(action);
|
|
5313
4904
|
} else {
|
|
5314
4905
|
dispatch({
|
|
@@ -5433,9 +5024,9 @@ function DashboardApp({ onReady }) {
|
|
|
5433
5024
|
dispatchRef.current = dispatch;
|
|
5434
5025
|
const stateRef = useRef2(state);
|
|
5435
5026
|
stateRef.current = state;
|
|
5436
|
-
const configPath =
|
|
5027
|
+
const configPath = join2(getTrieDirectory(getWorkingDirectory(void 0, true)), "agent.json");
|
|
5437
5028
|
const loadConfig = useCallback6(async () => {
|
|
5438
|
-
if (!
|
|
5029
|
+
if (!existsSync3(configPath)) return;
|
|
5439
5030
|
try {
|
|
5440
5031
|
const raw = await readFile2(configPath, "utf-8");
|
|
5441
5032
|
const parsed = JSON.parse(raw);
|
|
@@ -5693,7 +5284,6 @@ export {
|
|
|
5693
5284
|
getSystemPrompt,
|
|
5694
5285
|
TrieExplainTool,
|
|
5695
5286
|
StreamingManager,
|
|
5696
|
-
getOutputManager,
|
|
5697
5287
|
ExtractionPipeline,
|
|
5698
5288
|
TrieTellTool,
|
|
5699
5289
|
TrieFeedbackTool,
|
|
@@ -5705,4 +5295,4 @@ export {
|
|
|
5705
5295
|
handleCheckpointTool,
|
|
5706
5296
|
InteractiveDashboard
|
|
5707
5297
|
};
|
|
5708
|
-
//# sourceMappingURL=chunk-
|
|
5298
|
+
//# sourceMappingURL=chunk-4SBZXIMG.js.map
|