@triedotdev/mcp 1.0.136 → 1.0.137
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/{chunk-DFHMB44X.js → chunk-4JQ6W7LW.js} +3 -4
- package/dist/chunk-4JQ6W7LW.js.map +1 -0
- package/dist/{chunk-WS6OA7H6.js → chunk-4MJ52WBH.js} +2 -3
- package/dist/chunk-4MJ52WBH.js.map +1 -0
- package/dist/{chunk-UHMMANC2.js → chunk-6EP2VTHC.js} +15 -15
- package/dist/chunk-6EP2VTHC.js.map +1 -0
- package/dist/{chunk-T4THB2OR.js → chunk-A6PWS6ZV.js} +38 -27
- package/dist/chunk-A6PWS6ZV.js.map +1 -0
- package/dist/{chunk-POHBQUG7.js → chunk-AXYNWBME.js} +272 -187
- package/dist/chunk-AXYNWBME.js.map +1 -0
- package/dist/{chunk-AJ34GCMD.js → chunk-DPZLABUC.js} +32 -32
- package/dist/chunk-DPZLABUC.js.map +1 -0
- package/dist/{chunk-UHX4462X.js → chunk-G74XEI7K.js} +13 -14
- package/dist/chunk-G74XEI7K.js.map +1 -0
- package/dist/{goal-validator-PDKYZSNP.js → chunk-HUR67JXG.js} +71 -33
- package/dist/chunk-HUR67JXG.js.map +1 -0
- package/dist/{chunk-6OUWNVLX.js → chunk-K6NTRSDF.js} +4 -4
- package/dist/{chunk-G5PRBQIQ.js → chunk-QM5VIDFN.js} +75 -71
- package/dist/chunk-QM5VIDFN.js.map +1 -0
- package/dist/{chunk-4YJ6KLGI.js → chunk-QNKBXOIQ.js} +7 -5
- package/dist/chunk-QNKBXOIQ.js.map +1 -0
- package/dist/{chunk-JAKMZI5S.js → chunk-R3WZI6QZ.js} +290 -179
- package/dist/chunk-R3WZI6QZ.js.map +1 -0
- package/dist/{chunk-VRLMTOB6.js → chunk-TIMIKBY2.js} +1 -1
- package/dist/chunk-TIMIKBY2.js.map +1 -0
- package/dist/cli/main.js +104 -100
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +13 -13
- package/dist/cli/yolo-daemon.js.map +1 -1
- package/dist/{goal-manager-FAK7H4RR.js → goal-manager-62IL6WGY.js} +6 -7
- package/dist/goal-validator-HPPBSDXD.js +22 -0
- package/dist/guardian-agent-YKG5XURG.js +30 -0
- package/dist/{hypothesis-L5446W36.js → hypothesis-W37VG6DA.js} +6 -7
- package/dist/index.js +265 -259
- package/dist/index.js.map +1 -1
- package/dist/{insight-store-F5KDBY5Y.js → insight-store-U3NYTOJE.js} +5 -3
- package/dist/issue-store-EZMBHOVN.js +32 -0
- package/dist/{output-manager-BOTMXSND.js → output-manager-DZO5LGSG.js} +2 -2
- package/dist/output-manager-DZO5LGSG.js.map +1 -0
- package/dist/ui/chat.html +1 -1
- package/package.json +1 -1
- package/dist/chunk-4YJ6KLGI.js.map +0 -1
- package/dist/chunk-AJ34GCMD.js.map +0 -1
- package/dist/chunk-DFHMB44X.js.map +0 -1
- package/dist/chunk-G5PRBQIQ.js.map +0 -1
- package/dist/chunk-JAKMZI5S.js.map +0 -1
- package/dist/chunk-PEJEYWVR.js +0 -135
- package/dist/chunk-PEJEYWVR.js.map +0 -1
- package/dist/chunk-POHBQUG7.js.map +0 -1
- package/dist/chunk-T4THB2OR.js.map +0 -1
- package/dist/chunk-UHMMANC2.js.map +0 -1
- package/dist/chunk-UHX4462X.js.map +0 -1
- package/dist/chunk-VRLMTOB6.js.map +0 -1
- package/dist/chunk-WS6OA7H6.js.map +0 -1
- package/dist/goal-validator-PDKYZSNP.js.map +0 -1
- package/dist/guardian-agent-4RHGIXUD.js +0 -27
- package/dist/ledger-WKVJWHBX.js +0 -17
- /package/dist/{chunk-6OUWNVLX.js.map → chunk-K6NTRSDF.js.map} +0 -0
- /package/dist/{goal-manager-FAK7H4RR.js.map → goal-manager-62IL6WGY.js.map} +0 -0
- /package/dist/{guardian-agent-4RHGIXUD.js.map → goal-validator-HPPBSDXD.js.map} +0 -0
- /package/dist/{hypothesis-L5446W36.js.map → guardian-agent-YKG5XURG.js.map} +0 -0
- /package/dist/{insight-store-F5KDBY5Y.js.map → hypothesis-W37VG6DA.js.map} +0 -0
- /package/dist/{ledger-WKVJWHBX.js.map → insight-store-U3NYTOJE.js.map} +0 -0
- /package/dist/{output-manager-BOTMXSND.js.map → issue-store-EZMBHOVN.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
getTrieAgent
|
|
3
|
+
} from "./chunk-QM5VIDFN.js";
|
|
4
4
|
import {
|
|
5
5
|
getChatStore
|
|
6
6
|
} from "./chunk-DFPVUMVE.js";
|
|
@@ -13,13 +13,16 @@ import {
|
|
|
13
13
|
perceiveCurrentChanges,
|
|
14
14
|
reasonAboutChangesHumanReadable,
|
|
15
15
|
saveCheckpoint
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-K6NTRSDF.js";
|
|
17
17
|
import {
|
|
18
18
|
IncidentIndex
|
|
19
19
|
} from "./chunk-WHIQAGB7.js";
|
|
20
20
|
import {
|
|
21
21
|
findCrossProjectPatterns
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-G74XEI7K.js";
|
|
23
|
+
import {
|
|
24
|
+
measureInitialGoalValue
|
|
25
|
+
} from "./chunk-HUR67JXG.js";
|
|
23
26
|
import {
|
|
24
27
|
getKeyFromKeychain,
|
|
25
28
|
isAIAvailable,
|
|
@@ -27,8 +30,8 @@ import {
|
|
|
27
30
|
setAPIKey
|
|
28
31
|
} from "./chunk-O6OTJI3W.js";
|
|
29
32
|
import {
|
|
30
|
-
|
|
31
|
-
} from "./chunk-
|
|
33
|
+
getProjectState
|
|
34
|
+
} from "./chunk-6EP2VTHC.js";
|
|
32
35
|
import {
|
|
33
36
|
TieredStorage,
|
|
34
37
|
getStorage
|
|
@@ -38,10 +41,10 @@ import {
|
|
|
38
41
|
} from "./chunk-55CBWOEZ.js";
|
|
39
42
|
import {
|
|
40
43
|
getOutputManager
|
|
41
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-TIMIKBY2.js";
|
|
42
45
|
import {
|
|
43
46
|
getLedgerBlocks
|
|
44
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-R3WZI6QZ.js";
|
|
45
48
|
import {
|
|
46
49
|
getTrieDirectory,
|
|
47
50
|
getWorkingDirectory
|
|
@@ -1478,7 +1481,7 @@ function ConfigDialog({ onClose }) {
|
|
|
1478
1481
|
}
|
|
1479
1482
|
|
|
1480
1483
|
// src/cli/dashboard/components/HelpDialog.tsx
|
|
1481
|
-
import { Box as Box5, Text as Text5 } from "ink";
|
|
1484
|
+
import { Box as Box5, Text as Text5, useStdout as useStdout4 } from "ink";
|
|
1482
1485
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1483
1486
|
var VIEW_HELP = {
|
|
1484
1487
|
overview: [
|
|
@@ -1568,34 +1571,36 @@ var VIEW_HELP = {
|
|
|
1568
1571
|
function HelpDialog({ view }) {
|
|
1569
1572
|
const shortcuts = VIEW_HELP[view] || VIEW_HELP.overview;
|
|
1570
1573
|
const viewName = view.charAt(0).toUpperCase() + view.slice(1);
|
|
1574
|
+
const { stdout } = useStdout4();
|
|
1575
|
+
const cols = stdout?.columns || 80;
|
|
1576
|
+
const narrow = cols < 70;
|
|
1577
|
+
const dialogWidth = narrow ? "95%" : "80%";
|
|
1578
|
+
const keyWidth = narrow ? 10 : 12;
|
|
1571
1579
|
return /* @__PURE__ */ jsxs5(
|
|
1572
1580
|
Box5,
|
|
1573
1581
|
{
|
|
1574
1582
|
flexDirection: "column",
|
|
1575
1583
|
borderStyle: "round",
|
|
1576
1584
|
borderColor: "cyan",
|
|
1577
|
-
paddingX: 2,
|
|
1585
|
+
paddingX: narrow ? 1 : 2,
|
|
1578
1586
|
paddingY: 1,
|
|
1579
|
-
width:
|
|
1587
|
+
width: dialogWidth,
|
|
1580
1588
|
alignSelf: "center",
|
|
1581
|
-
marginTop: 2,
|
|
1589
|
+
marginTop: narrow ? 1 : 2,
|
|
1582
1590
|
children: [
|
|
1583
|
-
/* @__PURE__ */
|
|
1584
|
-
|
|
1585
|
-
"
|
|
1586
|
-
] }),
|
|
1587
|
-
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, flexDirection: "column", gap: 0, children: shortcuts.map(({ key, description }, idx) => /* @__PURE__ */ jsxs5(Box5, { gap: 2, children: [
|
|
1588
|
-
/* @__PURE__ */ jsx6(Box5, { width: 12, children: /* @__PURE__ */ jsx6(Text5, { color: "yellow", children: key }) }),
|
|
1591
|
+
/* @__PURE__ */ jsx6(Text5, { bold: true, color: "cyan", children: narrow ? `${viewName} Keys` : `${viewName} View - Keyboard Shortcuts` }),
|
|
1592
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, flexDirection: "column", gap: 0, children: shortcuts.map(({ key, description }, idx) => /* @__PURE__ */ jsxs5(Box5, { gap: narrow ? 1 : 2, children: [
|
|
1593
|
+
/* @__PURE__ */ jsx6(Box5, { width: keyWidth, children: /* @__PURE__ */ jsx6(Text5, { color: "yellow", children: key }) }),
|
|
1589
1594
|
/* @__PURE__ */ jsx6(Text5, { children: description })
|
|
1590
1595
|
] }, idx)) }),
|
|
1591
|
-
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: "Press / or ? again to close" }) })
|
|
1596
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: narrow ? "/ or ? to close" : "Press / or ? again to close" }) })
|
|
1592
1597
|
]
|
|
1593
1598
|
}
|
|
1594
1599
|
);
|
|
1595
1600
|
}
|
|
1596
1601
|
|
|
1597
1602
|
// src/cli/dashboard/views/OverviewView.tsx
|
|
1598
|
-
import { Box as Box6, Text as Text6, useInput as useInput2, useStdout as
|
|
1603
|
+
import { Box as Box6, Text as Text6, useInput as useInput2, useStdout as useStdout5 } from "ink";
|
|
1599
1604
|
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1600
1605
|
function truncate(str, max) {
|
|
1601
1606
|
return str.length > max ? str.slice(0, max - 1) + "..." : str;
|
|
@@ -1604,7 +1609,7 @@ function OverviewView() {
|
|
|
1604
1609
|
const { state, dispatch } = useDashboard();
|
|
1605
1610
|
const { progress, signalExtraction, watch, issues, activityLog, activityPage, pendingFixes, selectedFixIndex } = state;
|
|
1606
1611
|
const { totalIssues } = progress;
|
|
1607
|
-
const { stdout } =
|
|
1612
|
+
const { stdout } = useStdout5();
|
|
1608
1613
|
const cols = stdout?.columns || 80;
|
|
1609
1614
|
const narrow = cols < 60;
|
|
1610
1615
|
const contentWidth = Math.max(20, cols - 4);
|
|
@@ -1721,7 +1726,7 @@ function OverviewView() {
|
|
|
1721
1726
|
|
|
1722
1727
|
// src/cli/dashboard/views/AgentView.tsx
|
|
1723
1728
|
import { useEffect, useCallback } from "react";
|
|
1724
|
-
import { Box as Box7, Text as Text7, useInput as useInput3, useStdout as
|
|
1729
|
+
import { Box as Box7, Text as Text7, useInput as useInput3, useStdout as useStdout6 } from "ink";
|
|
1725
1730
|
|
|
1726
1731
|
// src/cli/dashboard/theme.ts
|
|
1727
1732
|
import pc from "picocolors";
|
|
@@ -1760,7 +1765,7 @@ function progressBar(current, total, width = 10) {
|
|
|
1760
1765
|
}
|
|
1761
1766
|
|
|
1762
1767
|
// src/cli/dashboard/views/AgentView.tsx
|
|
1763
|
-
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1768
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1764
1769
|
function timeAgo(iso) {
|
|
1765
1770
|
const ms = Date.now() - new Date(iso).getTime();
|
|
1766
1771
|
const mins = Math.floor(ms / 6e4);
|
|
@@ -1772,8 +1777,9 @@ function timeAgo(iso) {
|
|
|
1772
1777
|
function AgentView() {
|
|
1773
1778
|
const { state, dispatch } = useDashboard();
|
|
1774
1779
|
const { agentInsights, agentBrain, selectedInsight, expandedInsight } = state;
|
|
1775
|
-
const { stdout } =
|
|
1780
|
+
const { stdout } = useStdout6();
|
|
1776
1781
|
const cols = stdout?.columns || 80;
|
|
1782
|
+
const narrow = cols < 60;
|
|
1777
1783
|
const msgLen = Math.max(20, cols - 25);
|
|
1778
1784
|
const visibleInsights = getVisibleInsights(state);
|
|
1779
1785
|
const alerts = visibleInsights.filter((i) => i.type === "warning");
|
|
@@ -1809,7 +1815,7 @@ function AgentView() {
|
|
|
1809
1815
|
if (!insight) return;
|
|
1810
1816
|
try {
|
|
1811
1817
|
const workDir = getWorkingDirectory(void 0, true);
|
|
1812
|
-
const { getInsightStore } = await import("./insight-store-
|
|
1818
|
+
const { getInsightStore } = await import("./insight-store-U3NYTOJE.js");
|
|
1813
1819
|
const store = getInsightStore(workDir);
|
|
1814
1820
|
await store.dismissInsight(insight.id);
|
|
1815
1821
|
const { getStorage: getStorage2 } = await import("./tiered-storage-QW2G7GSG.js");
|
|
@@ -1881,7 +1887,10 @@ function AgentView() {
|
|
|
1881
1887
|
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 1, children: [
|
|
1882
1888
|
/* @__PURE__ */ jsxs7(Text7, { children: [
|
|
1883
1889
|
/* @__PURE__ */ jsx8(Text7, { bold: true, children: "Nudges" }),
|
|
1884
|
-
/* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1890
|
+
narrow ? /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1891
|
+
" ",
|
|
1892
|
+
alertCount
|
|
1893
|
+
] }) : /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1885
1894
|
" ",
|
|
1886
1895
|
alertCount,
|
|
1887
1896
|
" alerts \xB7 ",
|
|
@@ -1903,7 +1912,7 @@ function AgentView() {
|
|
|
1903
1912
|
riskColor ? /* @__PURE__ */ jsx8(Text7, { color: riskColor, children: "\u25CF" }) : /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: "\u25CB" }),
|
|
1904
1913
|
" ",
|
|
1905
1914
|
isSelected ? /* @__PURE__ */ jsx8(Text7, { bold: true, children: msg }) : /* @__PURE__ */ jsx8(Text7, { children: msg }),
|
|
1906
|
-
/* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1915
|
+
narrow ? null : /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1907
1916
|
" ",
|
|
1908
1917
|
insight.category,
|
|
1909
1918
|
" \xB7 ",
|
|
@@ -1925,13 +1934,14 @@ function AgentView() {
|
|
|
1925
1934
|
decisions.slice(0, 10).map((dec) => {
|
|
1926
1935
|
const ago = timeAgo(dec.when);
|
|
1927
1936
|
const active = dec.status === "active";
|
|
1928
|
-
|
|
1937
|
+
const decWidth = Math.max(20, cols - 18);
|
|
1938
|
+
return /* @__PURE__ */ jsxs7(Text7, { wrap: "truncate", children: [
|
|
1929
1939
|
" ",
|
|
1930
1940
|
active ? /* @__PURE__ */ jsx8(Text7, { color: "green", children: "\u25CF" }) : /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: "\u25CB" }),
|
|
1931
1941
|
" ",
|
|
1932
|
-
dec.decision.slice(0,
|
|
1933
|
-
dec.decision.length >
|
|
1934
|
-
/* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1942
|
+
dec.decision.slice(0, decWidth),
|
|
1943
|
+
dec.decision.length > decWidth ? "..." : "",
|
|
1944
|
+
narrow ? null : /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1935
1945
|
" ",
|
|
1936
1946
|
ago
|
|
1937
1947
|
] })
|
|
@@ -1943,19 +1953,22 @@ function AgentView() {
|
|
|
1943
1953
|
patterns.slice(0, 8).map((pat, idx) => {
|
|
1944
1954
|
const conf = Math.round(pat.confidence * 100);
|
|
1945
1955
|
const confColor = conf > 70 ? "green" : conf > 40 ? "yellow" : void 0;
|
|
1946
|
-
|
|
1956
|
+
const patWidth = Math.max(20, cols - 18);
|
|
1957
|
+
return /* @__PURE__ */ jsxs7(Text7, { wrap: "truncate", children: [
|
|
1947
1958
|
" ",
|
|
1948
1959
|
pat.isAntiPattern ? /* @__PURE__ */ jsx8(Text7, { color: "red", children: "\u25CF" }) : /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: "\u25CB" }),
|
|
1949
1960
|
" ",
|
|
1950
|
-
pat.description.slice(0,
|
|
1951
|
-
pat.description.length >
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1961
|
+
pat.description.slice(0, patWidth),
|
|
1962
|
+
pat.description.length > patWidth ? "..." : "",
|
|
1963
|
+
narrow ? null : /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1964
|
+
" ",
|
|
1965
|
+
confColor ? /* @__PURE__ */ jsxs7(Text7, { color: confColor, children: [
|
|
1966
|
+
conf,
|
|
1967
|
+
"%"
|
|
1968
|
+
] }) : /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1969
|
+
conf,
|
|
1970
|
+
"%"
|
|
1971
|
+
] })
|
|
1959
1972
|
] })
|
|
1960
1973
|
] }, idx);
|
|
1961
1974
|
})
|
|
@@ -1980,13 +1993,14 @@ function AgentView() {
|
|
|
1980
1993
|
|
|
1981
1994
|
// src/cli/dashboard/views/GoalsView.tsx
|
|
1982
1995
|
import { useCallback as useCallback2 } from "react";
|
|
1983
|
-
import { Box as Box8, Text as Text8, useInput as useInput4 } from "ink";
|
|
1984
|
-
import { Fragment as
|
|
1996
|
+
import { Box as Box8, Text as Text8, useInput as useInput4, useStdout as useStdout7 } from "ink";
|
|
1997
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1985
1998
|
function calculateGoalProgress(goal) {
|
|
1986
1999
|
if (goal.target <= 0) return 0;
|
|
1987
2000
|
const startValue = goal.startValue ?? goal.currentValue;
|
|
1988
2001
|
if (startValue > goal.target) {
|
|
1989
2002
|
const totalReduction = startValue - goal.target;
|
|
2003
|
+
if (totalReduction === 0) return 100;
|
|
1990
2004
|
const actualReduction = startValue - goal.currentValue;
|
|
1991
2005
|
return Math.round(actualReduction / totalReduction * 100);
|
|
1992
2006
|
}
|
|
@@ -1995,13 +2009,17 @@ function calculateGoalProgress(goal) {
|
|
|
1995
2009
|
function GoalsView() {
|
|
1996
2010
|
const { state, dispatch } = useDashboard();
|
|
1997
2011
|
const { goalsPanel } = state;
|
|
2012
|
+
const { stdout } = useStdout7();
|
|
2013
|
+
const cols = stdout?.columns || 80;
|
|
2014
|
+
const narrow = cols < 60;
|
|
2015
|
+
const contentWidth = Math.max(20, cols - 4);
|
|
1998
2016
|
const activeGoals = goalsPanel.goals.filter((g) => g.status === "active");
|
|
1999
2017
|
const achievedGoals = goalsPanel.goals.filter((g) => g.status === "achieved");
|
|
2000
2018
|
const otherGoals = goalsPanel.goals.filter((g) => g.status !== "active" && g.status !== "achieved" && g.status !== "rejected");
|
|
2001
2019
|
const refreshGoals = useCallback2(async () => {
|
|
2002
2020
|
try {
|
|
2003
2021
|
const workDir = getWorkingDirectory(void 0, true);
|
|
2004
|
-
const agentState =
|
|
2022
|
+
const agentState = getProjectState(workDir);
|
|
2005
2023
|
await agentState.load();
|
|
2006
2024
|
const goals = agentState.getAllGoals();
|
|
2007
2025
|
dispatch({
|
|
@@ -2011,23 +2029,25 @@ function GoalsView() {
|
|
|
2011
2029
|
return g.category ? { ...base, category: g.category } : base;
|
|
2012
2030
|
})
|
|
2013
2031
|
});
|
|
2014
|
-
} catch {
|
|
2032
|
+
} catch (err) {
|
|
2033
|
+
console.debug("[GoalsView] refreshGoals failed:", err);
|
|
2015
2034
|
}
|
|
2016
2035
|
}, [dispatch]);
|
|
2017
2036
|
const addGoal = useCallback2(async (description) => {
|
|
2018
2037
|
if (!description.trim()) return;
|
|
2019
2038
|
try {
|
|
2020
2039
|
const workDir = getWorkingDirectory(void 0, true);
|
|
2021
|
-
const agentState =
|
|
2040
|
+
const agentState = getProjectState(workDir);
|
|
2022
2041
|
await agentState.load();
|
|
2042
|
+
const initialValue = await measureInitialGoalValue(description.trim(), workDir);
|
|
2023
2043
|
const goal = {
|
|
2024
2044
|
id: `goal-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
2025
2045
|
description: description.trim(),
|
|
2026
2046
|
type: "reduction",
|
|
2027
2047
|
metric: "semantic",
|
|
2028
2048
|
target: 0,
|
|
2029
|
-
currentValue:
|
|
2030
|
-
startValue:
|
|
2049
|
+
currentValue: initialValue,
|
|
2050
|
+
startValue: initialValue,
|
|
2031
2051
|
status: "active",
|
|
2032
2052
|
autoGenerated: false,
|
|
2033
2053
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -2037,13 +2057,14 @@ function GoalsView() {
|
|
|
2037
2057
|
await agentState.addGoal(goal);
|
|
2038
2058
|
dispatch({ type: "ADD_ACTIVITY", message: `Goal added: ${description.slice(0, 40)}` });
|
|
2039
2059
|
await refreshGoals();
|
|
2040
|
-
} catch {
|
|
2060
|
+
} catch (err) {
|
|
2061
|
+
console.debug("[GoalsView] addGoal failed:", err);
|
|
2041
2062
|
}
|
|
2042
2063
|
}, [dispatch, refreshGoals]);
|
|
2043
2064
|
const completeGoal = useCallback2(async (goalId) => {
|
|
2044
2065
|
try {
|
|
2045
2066
|
const workDir = getWorkingDirectory(void 0, true);
|
|
2046
|
-
const agentState =
|
|
2067
|
+
const agentState = getProjectState(workDir);
|
|
2047
2068
|
await agentState.load();
|
|
2048
2069
|
const goals = agentState.getAllGoals();
|
|
2049
2070
|
const goal = goals.find((g) => g.id === goalId);
|
|
@@ -2052,35 +2073,38 @@ function GoalsView() {
|
|
|
2052
2073
|
dispatch({ type: "ADD_ACTIVITY", message: `Goal achieved: ${goal.description.slice(0, 30)}` });
|
|
2053
2074
|
await refreshGoals();
|
|
2054
2075
|
}
|
|
2055
|
-
} catch {
|
|
2076
|
+
} catch (err) {
|
|
2077
|
+
console.debug("[GoalsView] completeGoal failed:", err);
|
|
2056
2078
|
}
|
|
2057
2079
|
}, [dispatch, refreshGoals]);
|
|
2058
2080
|
const deleteGoal = useCallback2(async (goalId) => {
|
|
2059
2081
|
try {
|
|
2060
2082
|
const workDir = getWorkingDirectory(void 0, true);
|
|
2061
|
-
const agentState =
|
|
2083
|
+
const agentState = getProjectState(workDir);
|
|
2062
2084
|
await agentState.load();
|
|
2063
2085
|
await agentState.updateGoal(goalId, { status: "rejected" });
|
|
2064
2086
|
dispatch({ type: "ADD_ACTIVITY", message: "Goal removed" });
|
|
2065
2087
|
await refreshGoals();
|
|
2066
|
-
} catch {
|
|
2088
|
+
} catch (err) {
|
|
2089
|
+
console.debug("[GoalsView] deleteGoal failed:", err);
|
|
2067
2090
|
}
|
|
2068
2091
|
}, [dispatch, refreshGoals]);
|
|
2069
2092
|
const reactivateGoal = useCallback2(async (goalId) => {
|
|
2070
2093
|
try {
|
|
2071
2094
|
const workDir = getWorkingDirectory(void 0, true);
|
|
2072
|
-
const agentState =
|
|
2095
|
+
const agentState = getProjectState(workDir);
|
|
2073
2096
|
await agentState.load();
|
|
2074
2097
|
await agentState.updateGoal(goalId, { status: "active", achievedAt: void 0 });
|
|
2075
2098
|
dispatch({ type: "ADD_ACTIVITY", message: "Goal reactivated" });
|
|
2076
2099
|
await refreshGoals();
|
|
2077
|
-
} catch {
|
|
2100
|
+
} catch (err) {
|
|
2101
|
+
console.debug("[GoalsView] reactivateGoal failed:", err);
|
|
2078
2102
|
}
|
|
2079
2103
|
}, [dispatch, refreshGoals]);
|
|
2080
2104
|
const clearAchievedGoals = useCallback2(async () => {
|
|
2081
2105
|
try {
|
|
2082
2106
|
const workDir = getWorkingDirectory(void 0, true);
|
|
2083
|
-
const agentState =
|
|
2107
|
+
const agentState = getProjectState(workDir);
|
|
2084
2108
|
await agentState.load();
|
|
2085
2109
|
const achieved = goalsPanel.goals.filter((g) => g.status === "achieved");
|
|
2086
2110
|
if (achieved.length === 0) {
|
|
@@ -2102,14 +2126,21 @@ function GoalsView() {
|
|
|
2102
2126
|
const checkGoalNow = useCallback2(async (goalId) => {
|
|
2103
2127
|
try {
|
|
2104
2128
|
const workDir = getWorkingDirectory(void 0, true);
|
|
2105
|
-
const
|
|
2106
|
-
if (!
|
|
2107
|
-
dispatch({ type: "ADD_ACTIVITY", message: `Checking goal: ${
|
|
2129
|
+
const goalSummary = goalsPanel.goals.find((g) => g.id === goalId);
|
|
2130
|
+
if (!goalSummary) return;
|
|
2131
|
+
dispatch({ type: "ADD_ACTIVITY", message: `Checking goal: ${goalSummary.description.slice(0, 30)}...` });
|
|
2108
2132
|
dispatch({ type: "SHOW_NOTIFICATION", message: `Scanning files...`, severity: "info", autoHideMs: 5e3 });
|
|
2109
|
-
const { checkFilesForGoalViolations } = await import("./goal-validator-
|
|
2110
|
-
const
|
|
2133
|
+
const { checkFilesForGoalViolations } = await import("./goal-validator-HPPBSDXD.js");
|
|
2134
|
+
const agentState = getProjectState(workDir);
|
|
2135
|
+
await agentState.load();
|
|
2136
|
+
const fullGoal = agentState.getAllGoals().find((g) => g.id === goalId);
|
|
2137
|
+
if (!fullGoal) {
|
|
2138
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: `Goal not found: ${goalId}`, severity: "warning", autoHideMs: 5e3 });
|
|
2139
|
+
return;
|
|
2140
|
+
}
|
|
2141
|
+
const violations = await checkFilesForGoalViolations([fullGoal], workDir);
|
|
2111
2142
|
if (violations.length === 0) {
|
|
2112
|
-
dispatch({ type: "SHOW_NOTIFICATION", message: `\u2713 No violations found for: ${
|
|
2143
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: `\u2713 No violations found for: ${goalSummary.description.slice(0, 40)}`, severity: "info", autoHideMs: 5e3 });
|
|
2113
2144
|
dispatch({ type: "ADD_ACTIVITY", message: `No violations found` });
|
|
2114
2145
|
} else {
|
|
2115
2146
|
dispatch({ type: "SHOW_NOTIFICATION", message: `Found ${violations.length} violation(s) - check Nudges tab`, severity: "warning", autoHideMs: 5e3 });
|
|
@@ -2174,7 +2205,7 @@ function GoalsView() {
|
|
|
2174
2205
|
/* @__PURE__ */ jsx9(Text8, { bold: true, color: "green", children: "|" })
|
|
2175
2206
|
] }) }),
|
|
2176
2207
|
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " enter save \xB7 esc cancel" })
|
|
2177
|
-
] }) : /* @__PURE__ */ jsx9(
|
|
2208
|
+
] }) : /* @__PURE__ */ jsx9(Fragment4, { children: goalsPanel.goals.length === 0 ? /* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " No goals yet. Press a to add one." }) : /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
2178
2209
|
activeGoals.length === 0 && goalsPanel.goals.length > 0 && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginBottom: 1, paddingX: 1, borderStyle: "round", borderColor: "yellow", children: [
|
|
2179
2210
|
/* @__PURE__ */ jsx9(Text8, { color: "yellow", bold: true, children: "\u26A0 No Active Goals" }),
|
|
2180
2211
|
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: "Goals exist but none are active. Violations won't be detected." }),
|
|
@@ -2183,13 +2214,15 @@ function GoalsView() {
|
|
|
2183
2214
|
activeGoals.map((goal, idx) => {
|
|
2184
2215
|
const isSelected = goalsPanel.selectedIndex === idx;
|
|
2185
2216
|
const progress = calculateGoalProgress(goal);
|
|
2186
|
-
const
|
|
2217
|
+
const barWidth = narrow ? 6 : Math.min(12, Math.floor(contentWidth / 8));
|
|
2218
|
+
const bar = progressBar(progress, 100, barWidth);
|
|
2187
2219
|
const source = goal.autoGenerated ? "auto" : "";
|
|
2188
|
-
|
|
2220
|
+
const descWidth = Math.max(20, contentWidth - barWidth - 20);
|
|
2221
|
+
return /* @__PURE__ */ jsxs8(Text8, { wrap: "truncate", children: [
|
|
2189
2222
|
isSelected ? /* @__PURE__ */ jsx9(Text8, { bold: true, color: "green", children: "> " }) : " ",
|
|
2190
2223
|
/* @__PURE__ */ jsx9(Text8, { color: "green", children: "\u25CB" }),
|
|
2191
2224
|
" ",
|
|
2192
|
-
goal.description.slice(0,
|
|
2225
|
+
goal.description.slice(0, descWidth),
|
|
2193
2226
|
/* @__PURE__ */ jsxs8(Text8, { dimColor: true, children: [
|
|
2194
2227
|
" ",
|
|
2195
2228
|
bar,
|
|
@@ -2202,12 +2235,15 @@ function GoalsView() {
|
|
|
2202
2235
|
}),
|
|
2203
2236
|
achievedGoals.length > 0 && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginTop: 1, children: [
|
|
2204
2237
|
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " Achieved" }),
|
|
2205
|
-
achievedGoals.slice(0, 5).map((g) =>
|
|
2206
|
-
|
|
2207
|
-
/* @__PURE__ */
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2238
|
+
achievedGoals.slice(0, 5).map((g) => {
|
|
2239
|
+
const goalWidth = Math.max(30, contentWidth - 4);
|
|
2240
|
+
return /* @__PURE__ */ jsxs8(Text8, { wrap: "truncate", children: [
|
|
2241
|
+
" ",
|
|
2242
|
+
/* @__PURE__ */ jsx9(Text8, { color: "green", children: "\u25CF" }),
|
|
2243
|
+
" ",
|
|
2244
|
+
g.description.slice(0, goalWidth)
|
|
2245
|
+
] }, g.id);
|
|
2246
|
+
}),
|
|
2211
2247
|
achievedGoals.length > 5 && /* @__PURE__ */ jsxs8(Text8, { dimColor: true, children: [
|
|
2212
2248
|
" +",
|
|
2213
2249
|
achievedGoals.length - 5,
|
|
@@ -2216,14 +2252,17 @@ function GoalsView() {
|
|
|
2216
2252
|
] }),
|
|
2217
2253
|
otherGoals.length > 0 && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginTop: 1, children: [
|
|
2218
2254
|
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " Other" }),
|
|
2219
|
-
otherGoals.slice(0, 2).map((g) =>
|
|
2220
|
-
|
|
2221
|
-
/* @__PURE__ */
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2255
|
+
otherGoals.slice(0, 2).map((g) => {
|
|
2256
|
+
const goalWidth = Math.max(30, contentWidth - 15);
|
|
2257
|
+
return /* @__PURE__ */ jsxs8(Text8, { wrap: "truncate", children: [
|
|
2258
|
+
" ",
|
|
2259
|
+
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: "\u25CB" }),
|
|
2260
|
+
" ",
|
|
2261
|
+
g.description.slice(0, goalWidth),
|
|
2262
|
+
" ",
|
|
2263
|
+
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: g.status })
|
|
2264
|
+
] }, g.id);
|
|
2265
|
+
})
|
|
2227
2266
|
] })
|
|
2228
2267
|
] }) })
|
|
2229
2268
|
] });
|
|
@@ -2231,18 +2270,22 @@ function GoalsView() {
|
|
|
2231
2270
|
|
|
2232
2271
|
// src/cli/dashboard/views/HypothesesView.tsx
|
|
2233
2272
|
import { useCallback as useCallback3 } from "react";
|
|
2234
|
-
import { Box as Box9, Text as Text9, useInput as useInput5 } from "ink";
|
|
2235
|
-
import { Fragment as
|
|
2273
|
+
import { Box as Box9, Text as Text9, useInput as useInput5, useStdout as useStdout8 } from "ink";
|
|
2274
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2236
2275
|
function HypothesesView() {
|
|
2237
2276
|
const { state, dispatch } = useDashboard();
|
|
2238
2277
|
const { hypothesesPanel } = state;
|
|
2278
|
+
const { stdout } = useStdout8();
|
|
2279
|
+
const cols = stdout?.columns || 80;
|
|
2280
|
+
const narrow = cols < 60;
|
|
2281
|
+
const contentWidth = Math.max(20, cols - 4);
|
|
2239
2282
|
const testing = hypothesesPanel.hypotheses.filter((h) => h.status === "testing");
|
|
2240
2283
|
const validated = hypothesesPanel.hypotheses.filter((h) => h.status === "validated");
|
|
2241
2284
|
const invalidated = hypothesesPanel.hypotheses.filter((h) => h.status === "invalidated");
|
|
2242
2285
|
const refreshHypotheses = useCallback3(async () => {
|
|
2243
2286
|
try {
|
|
2244
2287
|
const workDir = getWorkingDirectory(void 0, true);
|
|
2245
|
-
const agentState =
|
|
2288
|
+
const agentState = getProjectState(workDir);
|
|
2246
2289
|
await agentState.load();
|
|
2247
2290
|
const hypotheses = agentState.getAllHypotheses();
|
|
2248
2291
|
dispatch({
|
|
@@ -2252,14 +2295,15 @@ function HypothesesView() {
|
|
|
2252
2295
|
return h.category ? { ...base, category: h.category } : base;
|
|
2253
2296
|
})
|
|
2254
2297
|
});
|
|
2255
|
-
} catch {
|
|
2298
|
+
} catch (err) {
|
|
2299
|
+
console.debug("[HypothesesView] refreshHypotheses failed:", err);
|
|
2256
2300
|
}
|
|
2257
2301
|
}, [dispatch]);
|
|
2258
2302
|
const addHypothesis = useCallback3(async (statement) => {
|
|
2259
2303
|
if (!statement.trim()) return;
|
|
2260
2304
|
try {
|
|
2261
2305
|
const workDir = getWorkingDirectory(void 0, true);
|
|
2262
|
-
const agentState =
|
|
2306
|
+
const agentState = getProjectState(workDir);
|
|
2263
2307
|
await agentState.load();
|
|
2264
2308
|
const hypothesis = {
|
|
2265
2309
|
id: `hypo-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
@@ -2274,31 +2318,34 @@ function HypothesesView() {
|
|
|
2274
2318
|
await agentState.addHypothesis(hypothesis);
|
|
2275
2319
|
dispatch({ type: "ADD_ACTIVITY", message: `Hypothesis added: ${statement.slice(0, 40)}` });
|
|
2276
2320
|
await refreshHypotheses();
|
|
2277
|
-
} catch {
|
|
2321
|
+
} catch (err) {
|
|
2322
|
+
console.debug("[HypothesesView] addHypothesis failed:", err);
|
|
2278
2323
|
}
|
|
2279
2324
|
}, [dispatch, refreshHypotheses]);
|
|
2280
2325
|
const updateHypothesis = useCallback3(async (hypoId, action) => {
|
|
2281
2326
|
try {
|
|
2282
2327
|
const workDir = getWorkingDirectory(void 0, true);
|
|
2283
|
-
const agentState =
|
|
2328
|
+
const agentState = getProjectState(workDir);
|
|
2284
2329
|
await agentState.load();
|
|
2285
2330
|
if (action === "validate") await agentState.updateHypothesis(hypoId, { status: "validated", confidence: 0.9 });
|
|
2286
2331
|
else if (action === "invalidate") await agentState.updateHypothesis(hypoId, { status: "invalidated", confidence: 0.1 });
|
|
2287
2332
|
else await agentState.updateHypothesis(hypoId, { status: "retired" });
|
|
2288
2333
|
dispatch({ type: "ADD_ACTIVITY", message: `Hypothesis ${action === "validate" ? "validated" : action === "invalidate" ? "invalidated" : "removed"}` });
|
|
2289
2334
|
await refreshHypotheses();
|
|
2290
|
-
} catch {
|
|
2335
|
+
} catch (err) {
|
|
2336
|
+
console.debug("[HypothesesView] updateHypothesis failed:", err);
|
|
2291
2337
|
}
|
|
2292
2338
|
}, [dispatch, refreshHypotheses]);
|
|
2293
2339
|
const reactivateHypothesis = useCallback3(async (hypoId) => {
|
|
2294
2340
|
try {
|
|
2295
2341
|
const workDir = getWorkingDirectory(void 0, true);
|
|
2296
|
-
const agentState =
|
|
2342
|
+
const agentState = getProjectState(workDir);
|
|
2297
2343
|
await agentState.load();
|
|
2298
2344
|
await agentState.updateHypothesis(hypoId, { status: "testing", confidence: 0.5, validatedAt: void 0 });
|
|
2299
2345
|
dispatch({ type: "ADD_ACTIVITY", message: "Hypothesis reactivated" });
|
|
2300
2346
|
await refreshHypotheses();
|
|
2301
|
-
} catch {
|
|
2347
|
+
} catch (err) {
|
|
2348
|
+
console.debug("[HypothesesView] reactivateHypothesis failed:", err);
|
|
2302
2349
|
}
|
|
2303
2350
|
}, [dispatch, refreshHypotheses]);
|
|
2304
2351
|
const checkHypothesisNow = useCallback3(async (hypoId) => {
|
|
@@ -2308,7 +2355,7 @@ function HypothesesView() {
|
|
|
2308
2355
|
if (!hypo) return;
|
|
2309
2356
|
dispatch({ type: "ADD_ACTIVITY", message: `Testing hypothesis: ${hypo.statement.slice(0, 30)}...` });
|
|
2310
2357
|
dispatch({ type: "SHOW_NOTIFICATION", message: `Gathering evidence for hypothesis...`, severity: "info", autoHideMs: 3e3 });
|
|
2311
|
-
const { gatherEvidenceForHypothesis } = await import("./hypothesis-
|
|
2358
|
+
const { gatherEvidenceForHypothesis } = await import("./hypothesis-W37VG6DA.js");
|
|
2312
2359
|
const evidence = await gatherEvidenceForHypothesis(hypoId, workDir);
|
|
2313
2360
|
if (evidence.length === 0) {
|
|
2314
2361
|
dispatch({ type: "SHOW_NOTIFICATION", message: `No evidence found for: ${hypo.statement.slice(0, 40)}`, severity: "info", autoHideMs: 5e3 });
|
|
@@ -2353,7 +2400,7 @@ function HypothesesView() {
|
|
|
2353
2400
|
} else if (_input === "d") {
|
|
2354
2401
|
const selected = testing[hypothesesPanel.selectedIndex];
|
|
2355
2402
|
if (selected) void updateHypothesis(selected.id, "delete");
|
|
2356
|
-
} else if (_input === "
|
|
2403
|
+
} else if (_input === "c") {
|
|
2357
2404
|
const completed = hypothesesPanel.hypotheses.filter((h) => h.status === "validated" || h.status === "invalidated");
|
|
2358
2405
|
if (completed[0]) void updateHypothesis(completed[0].id, "delete");
|
|
2359
2406
|
} else if (_input === "u") {
|
|
@@ -2369,7 +2416,7 @@ function HypothesesView() {
|
|
|
2369
2416
|
/* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "|" })
|
|
2370
2417
|
] }) }),
|
|
2371
2418
|
/* @__PURE__ */ jsx10(Text9, { dimColor: true, children: " enter save \xB7 esc cancel" })
|
|
2372
|
-
] }) : /* @__PURE__ */ jsx10(
|
|
2419
|
+
] }) : /* @__PURE__ */ jsx10(Fragment5, { children: hypothesesPanel.hypotheses.length === 0 ? /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: " No hypotheses yet. Press a to add one." }) : /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
|
|
2373
2420
|
testing.length === 0 && hypothesesPanel.hypotheses.length > 0 && /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", marginBottom: 1, paddingX: 1, borderStyle: "round", borderColor: "yellow", children: [
|
|
2374
2421
|
/* @__PURE__ */ jsx10(Text9, { color: "yellow", bold: true, children: "\u26A0 No Active Hypotheses" }),
|
|
2375
2422
|
/* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "Hypotheses exist but none are being tested. Evidence won't be gathered." }),
|
|
@@ -2378,28 +2425,31 @@ function HypothesesView() {
|
|
|
2378
2425
|
testing.map((hypo, idx) => {
|
|
2379
2426
|
const isSelected = hypothesesPanel.selectedIndex === idx;
|
|
2380
2427
|
const conf = Math.round(hypo.confidence * 100);
|
|
2381
|
-
|
|
2428
|
+
const statementWidth = Math.max(25, contentWidth - 20);
|
|
2429
|
+
return /* @__PURE__ */ jsxs9(Text9, { wrap: "truncate", children: [
|
|
2382
2430
|
isSelected ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
|
|
2383
2431
|
/* @__PURE__ */ jsx10(Text9, { color: "yellow", children: "\u25CB" }),
|
|
2384
2432
|
" ",
|
|
2385
|
-
hypo.statement.slice(0,
|
|
2433
|
+
hypo.statement.slice(0, statementWidth),
|
|
2386
2434
|
/* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
2387
2435
|
" ",
|
|
2388
2436
|
conf,
|
|
2389
|
-
"%
|
|
2390
|
-
hypo.evidenceCount
|
|
2391
|
-
" evidence"
|
|
2437
|
+
"%",
|
|
2438
|
+
narrow ? "" : ` \xB7 ${hypo.evidenceCount} evidence`
|
|
2392
2439
|
] })
|
|
2393
2440
|
] }, hypo.id);
|
|
2394
2441
|
}),
|
|
2395
2442
|
validated.length > 0 && /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", marginTop: 1, children: [
|
|
2396
2443
|
/* @__PURE__ */ jsx10(Text9, { dimColor: true, children: " Validated" }),
|
|
2397
|
-
validated.slice(0, 3).map((h) =>
|
|
2398
|
-
|
|
2399
|
-
/* @__PURE__ */
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2444
|
+
validated.slice(0, 3).map((h) => {
|
|
2445
|
+
const statementWidth = Math.max(30, contentWidth - 4);
|
|
2446
|
+
return /* @__PURE__ */ jsxs9(Text9, { wrap: "truncate", children: [
|
|
2447
|
+
" ",
|
|
2448
|
+
/* @__PURE__ */ jsx10(Text9, { color: "green", children: "\u25CF" }),
|
|
2449
|
+
" ",
|
|
2450
|
+
h.statement.slice(0, statementWidth)
|
|
2451
|
+
] }, h.id);
|
|
2452
|
+
}),
|
|
2403
2453
|
validated.length > 3 && /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
2404
2454
|
" +",
|
|
2405
2455
|
validated.length - 3,
|
|
@@ -2408,12 +2458,15 @@ function HypothesesView() {
|
|
|
2408
2458
|
] }),
|
|
2409
2459
|
invalidated.length > 0 && /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", marginTop: 1, children: [
|
|
2410
2460
|
/* @__PURE__ */ jsx10(Text9, { dimColor: true, children: " Invalidated" }),
|
|
2411
|
-
invalidated.slice(0, 2).map((h) =>
|
|
2412
|
-
|
|
2413
|
-
/* @__PURE__ */
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2461
|
+
invalidated.slice(0, 2).map((h) => {
|
|
2462
|
+
const statementWidth = Math.max(30, contentWidth - 4);
|
|
2463
|
+
return /* @__PURE__ */ jsxs9(Text9, { wrap: "truncate", children: [
|
|
2464
|
+
" ",
|
|
2465
|
+
/* @__PURE__ */ jsx10(Text9, { color: "red", children: "\u25CF" }),
|
|
2466
|
+
" ",
|
|
2467
|
+
/* @__PURE__ */ jsx10(Text9, { dimColor: true, children: h.statement.slice(0, statementWidth) })
|
|
2468
|
+
] }, h.id);
|
|
2469
|
+
}),
|
|
2417
2470
|
invalidated.length > 2 && /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
2418
2471
|
" +",
|
|
2419
2472
|
invalidated.length - 2,
|
|
@@ -2426,8 +2479,8 @@ function HypothesesView() {
|
|
|
2426
2479
|
|
|
2427
2480
|
// src/cli/dashboard/views/MemoryTreeView.tsx
|
|
2428
2481
|
import { useEffect as useEffect2, useCallback as useCallback4 } from "react";
|
|
2429
|
-
import { Box as Box10, Text as Text10, useInput as useInput6 } from "ink";
|
|
2430
|
-
import { Fragment as
|
|
2482
|
+
import { Box as Box10, Text as Text10, useInput as useInput6, useStdout as useStdout9 } from "ink";
|
|
2483
|
+
import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2431
2484
|
function timeAgo2(iso) {
|
|
2432
2485
|
const ms = Date.now() - new Date(iso).getTime();
|
|
2433
2486
|
const mins = Math.floor(ms / 6e4);
|
|
@@ -2440,6 +2493,10 @@ function MemoryTreeView() {
|
|
|
2440
2493
|
const { state, dispatch } = useDashboard();
|
|
2441
2494
|
const { memoryTree } = state;
|
|
2442
2495
|
const { snapshot, globalPatterns, storageDecisions, ledgerBlocks, expandedNodes, expandedItemId, selectedNode, loaded } = memoryTree;
|
|
2496
|
+
const { stdout } = useStdout9();
|
|
2497
|
+
const cols = stdout?.columns || 80;
|
|
2498
|
+
const narrow = cols < 60;
|
|
2499
|
+
const contentWidth = Math.max(20, cols - 4);
|
|
2443
2500
|
const loadData = useCallback4(async () => {
|
|
2444
2501
|
try {
|
|
2445
2502
|
const workDir = getWorkingDirectory(void 0, true);
|
|
@@ -2452,7 +2509,8 @@ function MemoryTreeView() {
|
|
|
2452
2509
|
getLedgerBlocks(workDir).catch(() => [])
|
|
2453
2510
|
]);
|
|
2454
2511
|
dispatch({ type: "SET_MEMORY_TREE", snapshot: snap, patterns, storageDecisions: decisions2, ledgerBlocks: blocks });
|
|
2455
|
-
} catch {
|
|
2512
|
+
} catch (err) {
|
|
2513
|
+
console.debug("[MemoryTreeView] loadData failed:", err);
|
|
2456
2514
|
dispatch({ type: "ADD_ACTIVITY", message: "Context graph load error" });
|
|
2457
2515
|
}
|
|
2458
2516
|
}, [dispatch]);
|
|
@@ -2560,24 +2618,25 @@ function MemoryTreeView() {
|
|
|
2560
2618
|
renderHeader("decisions", "Decisions", decisions.length, "-- use trie tell or chat"),
|
|
2561
2619
|
expandedNodes.has("decisions") && decisions.slice(0, 10).map((d) => {
|
|
2562
2620
|
const nodeId = `decision-${d.id}`;
|
|
2563
|
-
const
|
|
2621
|
+
const decWidth = Math.max(30, contentWidth - 25);
|
|
2622
|
+
const dec = d.decision.length > decWidth ? d.decision.slice(0, decWidth - 3) + "..." : d.decision;
|
|
2564
2623
|
const outcomeColor = d.outcome === "good" ? "green" : d.outcome === "bad" ? "red" : void 0;
|
|
2565
|
-
return /* @__PURE__ */ jsxs10(Text10, { children: [
|
|
2624
|
+
return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
|
|
2566
2625
|
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
|
|
2567
2626
|
" ",
|
|
2568
2627
|
outcomeColor ? /* @__PURE__ */ jsx11(Text10, { color: outcomeColor, children: "\u25CF" }) : /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "\u25CB" }),
|
|
2569
2628
|
" ",
|
|
2570
2629
|
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: dec }) : /* @__PURE__ */ jsx11(Text10, { children: dec }),
|
|
2571
|
-
d.hash ? /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2630
|
+
!narrow && d.hash ? /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2572
2631
|
" [",
|
|
2573
2632
|
d.hash.slice(0, 8),
|
|
2574
2633
|
"]"
|
|
2575
2634
|
] }) : null,
|
|
2576
|
-
/* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2635
|
+
narrow ? null : /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2577
2636
|
" ",
|
|
2578
2637
|
timeAgo2(d.when)
|
|
2579
2638
|
] }),
|
|
2580
|
-
outcomeColor ? /* @__PURE__ */ jsxs10(Text10, { color: outcomeColor, children: [
|
|
2639
|
+
outcomeColor && !narrow ? /* @__PURE__ */ jsxs10(Text10, { color: outcomeColor, children: [
|
|
2581
2640
|
" ",
|
|
2582
2641
|
d.outcome
|
|
2583
2642
|
] }) : null
|
|
@@ -2588,19 +2647,22 @@ function MemoryTreeView() {
|
|
|
2588
2647
|
expandedNodes.has("incidents") && incidentNodes.slice(0, 10).map((n) => {
|
|
2589
2648
|
const nodeId = `incident-${n.id}`;
|
|
2590
2649
|
const sevColor = n.data.severity === "critical" ? "red" : n.data.severity === "major" ? "yellow" : void 0;
|
|
2591
|
-
const
|
|
2592
|
-
|
|
2650
|
+
const descWidth = Math.max(30, contentWidth - 20);
|
|
2651
|
+
const desc = n.data.description.length > descWidth ? n.data.description.slice(0, descWidth - 3) + "..." : n.data.description;
|
|
2652
|
+
return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
|
|
2593
2653
|
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
|
|
2594
2654
|
" ",
|
|
2595
2655
|
sevColor ? /* @__PURE__ */ jsx11(Text10, { color: sevColor, children: "\u25CF" }) : /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "\u25CB" }),
|
|
2596
2656
|
" ",
|
|
2597
2657
|
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx11(Text10, { children: desc }),
|
|
2598
|
-
/* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2658
|
+
narrow ? null : /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2599
2659
|
" ",
|
|
2600
2660
|
timeAgo2(n.data.timestamp)
|
|
2601
2661
|
] }),
|
|
2602
|
-
|
|
2603
|
-
|
|
2662
|
+
narrow ? null : /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
2663
|
+
" ",
|
|
2664
|
+
n.data.resolved ? /* @__PURE__ */ jsx11(Text10, { color: "green", children: "resolved" }) : /* @__PURE__ */ jsx11(Text10, { color: "yellow", children: "open" })
|
|
2665
|
+
] })
|
|
2604
2666
|
] }, n.id);
|
|
2605
2667
|
}),
|
|
2606
2668
|
renderHeader("patterns", "Learned Patterns", patternNodes.length, "-- Trie learns as you work"),
|
|
@@ -2608,57 +2670,65 @@ function MemoryTreeView() {
|
|
|
2608
2670
|
const nodeId = `pattern-${n.id}`;
|
|
2609
2671
|
const conf = Math.round(n.data.confidence * 100);
|
|
2610
2672
|
const confColor = conf > 70 ? "green" : conf > 40 ? "yellow" : void 0;
|
|
2611
|
-
const
|
|
2612
|
-
|
|
2673
|
+
const descWidth = Math.max(30, contentWidth - 15);
|
|
2674
|
+
const desc = n.data.description.length > descWidth ? n.data.description.slice(0, descWidth - 3) + "..." : n.data.description;
|
|
2675
|
+
return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
|
|
2613
2676
|
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
|
|
2614
2677
|
" ",
|
|
2615
2678
|
n.data.isAntiPattern ? /* @__PURE__ */ jsx11(Text10, { color: "red", children: "!" }) : /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "\u25CB" }),
|
|
2616
2679
|
" ",
|
|
2617
2680
|
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx11(Text10, { children: desc }),
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2681
|
+
narrow ? null : /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
2682
|
+
" ",
|
|
2683
|
+
confColor ? /* @__PURE__ */ jsxs10(Text10, { color: confColor, children: [
|
|
2684
|
+
conf,
|
|
2685
|
+
"%"
|
|
2686
|
+
] }) : /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2687
|
+
conf,
|
|
2688
|
+
"%"
|
|
2689
|
+
] })
|
|
2625
2690
|
] })
|
|
2626
2691
|
] }, n.id);
|
|
2627
2692
|
}),
|
|
2628
2693
|
renderHeader("cross-project", "Cross-Project", globalPatterns.length),
|
|
2629
2694
|
expandedNodes.has("cross-project") && globalPatterns.slice(0, 8).map((pattern) => {
|
|
2630
2695
|
const patternId = `global-${pattern.id}`;
|
|
2631
|
-
const
|
|
2632
|
-
|
|
2696
|
+
const descWidth = Math.max(25, contentWidth - 35);
|
|
2697
|
+
const desc = pattern.pattern.length > descWidth ? pattern.pattern.slice(0, descWidth - 3) + "..." : pattern.pattern;
|
|
2698
|
+
return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
|
|
2633
2699
|
sel(patternId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
|
|
2634
2700
|
" ",
|
|
2635
2701
|
/* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "\u25CB" }),
|
|
2636
2702
|
" ",
|
|
2637
2703
|
sel(patternId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx11(Text10, { children: desc }),
|
|
2638
|
-
/* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2704
|
+
narrow ? null : /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2639
2705
|
" ",
|
|
2640
2706
|
pattern.projects.length,
|
|
2641
|
-
"
|
|
2707
|
+
"p \xB7 ",
|
|
2642
2708
|
pattern.occurrences,
|
|
2643
|
-
"
|
|
2709
|
+
"x"
|
|
2644
2710
|
] })
|
|
2645
2711
|
] }, pattern.id);
|
|
2646
2712
|
}),
|
|
2647
|
-
hotspots.length > 0 && /* @__PURE__ */ jsxs10(
|
|
2713
|
+
hotspots.length > 0 && /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
2648
2714
|
renderHeader("hotspots", "Risk Hotspots", hotspots.length),
|
|
2649
2715
|
expandedNodes.has("hotspots") && hotspots.slice(0, 10).map((n) => {
|
|
2650
2716
|
const nodeId = `file-${n.id}`;
|
|
2651
2717
|
const path2 = n.data.path.split("/").slice(-2).join("/");
|
|
2652
2718
|
const isCritical = n.data.riskLevel === "critical";
|
|
2653
|
-
|
|
2719
|
+
const pathWidth = Math.max(20, contentWidth - 30);
|
|
2720
|
+
const displayPath = path2.length > pathWidth ? path2.slice(-pathWidth) : path2;
|
|
2721
|
+
return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
|
|
2654
2722
|
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
|
|
2655
2723
|
" ",
|
|
2656
2724
|
/* @__PURE__ */ jsx11(Text10, { color: isCritical ? "red" : "yellow", children: "\u25CF" }),
|
|
2657
2725
|
" ",
|
|
2658
|
-
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children:
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2726
|
+
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: displayPath }) : /* @__PURE__ */ jsx11(Text10, { children: displayPath }),
|
|
2727
|
+
narrow ? null : /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
2728
|
+
" ",
|
|
2729
|
+
/* @__PURE__ */ jsx11(Text10, { color: isCritical ? "red" : "yellow", children: n.data.riskLevel })
|
|
2730
|
+
] }),
|
|
2731
|
+
narrow ? null : /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2662
2732
|
" ",
|
|
2663
2733
|
n.data.changeCount,
|
|
2664
2734
|
" changes"
|
|
@@ -2666,11 +2736,11 @@ function MemoryTreeView() {
|
|
|
2666
2736
|
] }, n.id);
|
|
2667
2737
|
})
|
|
2668
2738
|
] }),
|
|
2669
|
-
ledgerBlocks.length > 0 && /* @__PURE__ */ jsxs10(
|
|
2739
|
+
ledgerBlocks.length > 0 && /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
2670
2740
|
renderHeader("ledger-chain", "Ledger Chain (hashes)", ledgerBlocks.length),
|
|
2671
2741
|
expandedNodes.has("ledger-chain") && ledgerBlocks.map((block, i) => {
|
|
2672
2742
|
const nodeId = `ledger-block-${i}`;
|
|
2673
|
-
return /* @__PURE__ */ jsxs10(Text10, { children: [
|
|
2743
|
+
return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
|
|
2674
2744
|
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
|
|
2675
2745
|
" ",
|
|
2676
2746
|
/* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "\u25CF" }),
|
|
@@ -2682,27 +2752,32 @@ function MemoryTreeView() {
|
|
|
2682
2752
|
"Block ",
|
|
2683
2753
|
i + 1
|
|
2684
2754
|
] }),
|
|
2685
|
-
/* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2755
|
+
narrow ? null : /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2686
2756
|
" ",
|
|
2687
2757
|
block.date
|
|
2688
2758
|
] }),
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2759
|
+
narrow ? null : /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
2760
|
+
" ",
|
|
2761
|
+
/* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2762
|
+
"blk:",
|
|
2763
|
+
(block.blockHash || "-").slice(0, 8),
|
|
2764
|
+
"\u2026"
|
|
2765
|
+
] })
|
|
2695
2766
|
] }),
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2767
|
+
narrow ? null : /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
2768
|
+
" ",
|
|
2769
|
+
/* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2770
|
+
"mk:",
|
|
2771
|
+
(block.merkleRoot || "-").slice(0, 6),
|
|
2772
|
+
"\u2026"
|
|
2773
|
+
] })
|
|
2701
2774
|
] }),
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2775
|
+
narrow ? null : /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
2776
|
+
" ",
|
|
2777
|
+
/* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2778
|
+
block.entries.length,
|
|
2779
|
+
" entries"
|
|
2780
|
+
] })
|
|
2706
2781
|
] })
|
|
2707
2782
|
] }, nodeId);
|
|
2708
2783
|
})
|
|
@@ -2711,11 +2786,14 @@ function MemoryTreeView() {
|
|
|
2711
2786
|
}
|
|
2712
2787
|
|
|
2713
2788
|
// src/cli/dashboard/views/RawLogView.tsx
|
|
2714
|
-
import { Box as Box11, Text as Text11, useInput as useInput7 } from "ink";
|
|
2789
|
+
import { Box as Box11, Text as Text11, useInput as useInput7, useStdout as useStdout10 } from "ink";
|
|
2715
2790
|
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2716
2791
|
function RawLogView() {
|
|
2717
2792
|
const { state, dispatch } = useDashboard();
|
|
2718
2793
|
const { rawLog, rawLogPage } = state;
|
|
2794
|
+
const { stdout } = useStdout10();
|
|
2795
|
+
const cols = stdout?.columns || 80;
|
|
2796
|
+
const msgWidth = Math.max(30, cols - 18);
|
|
2719
2797
|
const pageSize = Math.max(10, (process.stdout.rows || 40) - 10);
|
|
2720
2798
|
const totalPages = Math.max(1, Math.ceil(rawLog.length / pageSize));
|
|
2721
2799
|
useInput7((input, _key) => {
|
|
@@ -2738,13 +2816,14 @@ function RawLogView() {
|
|
|
2738
2816
|
] }),
|
|
2739
2817
|
rawLog.length === 0 ? /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: " No log entries yet" }) : logs.map((entry, i) => {
|
|
2740
2818
|
const dot = entry.level === "error" ? /* @__PURE__ */ jsx12(Text11, { color: "red", children: "\u25CF" }) : entry.level === "warn" ? /* @__PURE__ */ jsx12(Text11, { color: "yellow", children: "\u25CF" }) : entry.level === "info" ? /* @__PURE__ */ jsx12(Text11, { color: "green", children: "\u25CF" }) : /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: "\u25CB" });
|
|
2741
|
-
|
|
2819
|
+
const msg = entry.message.length > msgWidth ? entry.message.slice(0, msgWidth - 3) + "..." : entry.message;
|
|
2820
|
+
return /* @__PURE__ */ jsxs11(Text11, { wrap: "truncate", children: [
|
|
2742
2821
|
" ",
|
|
2743
2822
|
/* @__PURE__ */ jsx12(Text11, { dimColor: true, children: entry.time }),
|
|
2744
2823
|
" ",
|
|
2745
2824
|
dot,
|
|
2746
2825
|
" ",
|
|
2747
|
-
|
|
2826
|
+
msg
|
|
2748
2827
|
] }, i);
|
|
2749
2828
|
})
|
|
2750
2829
|
] });
|
|
@@ -5389,16 +5468,17 @@ async function executeTool(name, input, onProgress) {
|
|
|
5389
5468
|
const desc = String(input.description || "").trim();
|
|
5390
5469
|
if (!desc) return "Goal description is required.";
|
|
5391
5470
|
const category = input.category || "general";
|
|
5392
|
-
const agentState =
|
|
5471
|
+
const agentState = getProjectState(directory);
|
|
5393
5472
|
await agentState.load();
|
|
5473
|
+
const initialValue = await measureInitialGoalValue(desc, directory);
|
|
5394
5474
|
const goal = {
|
|
5395
5475
|
id: `goal-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
5396
5476
|
description: desc,
|
|
5397
5477
|
type: "custom",
|
|
5398
5478
|
metric: "progress",
|
|
5399
5479
|
target: 100,
|
|
5400
|
-
currentValue:
|
|
5401
|
-
startValue:
|
|
5480
|
+
currentValue: initialValue,
|
|
5481
|
+
startValue: initialValue,
|
|
5402
5482
|
status: "active",
|
|
5403
5483
|
autoGenerated: false,
|
|
5404
5484
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -5407,13 +5487,13 @@ async function executeTool(name, input, onProgress) {
|
|
|
5407
5487
|
category
|
|
5408
5488
|
};
|
|
5409
5489
|
await agentState.addGoal(goal);
|
|
5410
|
-
return `Goal created: "${desc}" [${category}]`;
|
|
5490
|
+
return `Goal created: "${desc}" [${category}]${initialValue > 0 ? ` (starting at ${initialValue} issues)` : ""}`;
|
|
5411
5491
|
}
|
|
5412
5492
|
case "trie_add_hypothesis": {
|
|
5413
5493
|
const stmt = String(input.statement || "").trim();
|
|
5414
5494
|
if (!stmt) return "Hypothesis statement is required.";
|
|
5415
5495
|
const category = input.category || "general";
|
|
5416
|
-
const agentState =
|
|
5496
|
+
const agentState = getProjectState(directory);
|
|
5417
5497
|
await agentState.load();
|
|
5418
5498
|
const hypothesis = {
|
|
5419
5499
|
id: `hyp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
@@ -5620,8 +5700,8 @@ ${truncated}`;
|
|
|
5620
5700
|
const goalId = input.goalId ? String(input.goalId).trim() : void 0;
|
|
5621
5701
|
try {
|
|
5622
5702
|
onProgress?.("Loading goals...");
|
|
5623
|
-
const { checkFilesForGoalViolations, getActiveGoals } = await import("./goal-validator-
|
|
5624
|
-
const agentState =
|
|
5703
|
+
const { checkFilesForGoalViolations, getActiveGoals } = await import("./goal-validator-HPPBSDXD.js");
|
|
5704
|
+
const agentState = getProjectState(directory);
|
|
5625
5705
|
await agentState.load();
|
|
5626
5706
|
const allGoals = await getActiveGoals(directory);
|
|
5627
5707
|
const goalsToCheck = goalId ? allGoals.filter((g) => g.id === goalId) : allGoals;
|
|
@@ -5659,7 +5739,7 @@ ${truncated}`;
|
|
|
5659
5739
|
}
|
|
5660
5740
|
|
|
5661
5741
|
// src/cli/dashboard/views/ChatView.tsx
|
|
5662
|
-
import { Fragment as
|
|
5742
|
+
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5663
5743
|
var VISIBLE_MESSAGES = 8;
|
|
5664
5744
|
async function buildContext(workDir, dashboardState) {
|
|
5665
5745
|
const parts = [];
|
|
@@ -5678,9 +5758,9 @@ async function buildContext(workDir, dashboardState) {
|
|
|
5678
5758
|
}
|
|
5679
5759
|
}
|
|
5680
5760
|
try {
|
|
5681
|
-
const
|
|
5682
|
-
await
|
|
5683
|
-
const activeGoals =
|
|
5761
|
+
const projectState = getProjectState(workDir);
|
|
5762
|
+
await projectState.load();
|
|
5763
|
+
const activeGoals = projectState.getAllGoals().filter((g) => g.status === "active");
|
|
5684
5764
|
if (activeGoals.length > 0) {
|
|
5685
5765
|
parts.push("Active goals:\n" + activeGoals.map((g) => {
|
|
5686
5766
|
const metadata = g.metadata || {};
|
|
@@ -5999,7 +6079,7 @@ ${contextBlock}`;
|
|
|
5999
6079
|
const toolNames = new Set(result.toolCalls.map((tc) => tc.name));
|
|
6000
6080
|
if (toolNames.has("trie_add_goal") || toolNames.has("trie_add_hypothesis")) {
|
|
6001
6081
|
try {
|
|
6002
|
-
const agentState =
|
|
6082
|
+
const agentState = getProjectState(workDir);
|
|
6003
6083
|
await agentState.load();
|
|
6004
6084
|
if (toolNames.has("trie_add_goal")) {
|
|
6005
6085
|
const goals = agentState.getAllGoals();
|
|
@@ -6155,10 +6235,10 @@ ${contextBlock}`;
|
|
|
6155
6235
|
/* @__PURE__ */ jsx13(Text12, { dimColor: true, children: " (Esc to cancel)" })
|
|
6156
6236
|
] })
|
|
6157
6237
|
] }),
|
|
6158
|
-
/* @__PURE__ */ jsx13(Box12, { borderStyle: "single", borderColor: "green", paddingX: 1, flexShrink: 0, flexGrow: 0, children: /* @__PURE__ */ jsx13(Text12, { children: inputBuffer ? /* @__PURE__ */ jsxs12(
|
|
6238
|
+
/* @__PURE__ */ jsx13(Box12, { borderStyle: "single", borderColor: "green", paddingX: 1, flexShrink: 0, flexGrow: 0, children: /* @__PURE__ */ jsx13(Text12, { children: inputBuffer ? /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
6159
6239
|
inputBuffer,
|
|
6160
6240
|
/* @__PURE__ */ jsx13(Text12, { bold: true, color: "green", children: cursor })
|
|
6161
|
-
] }) : /* @__PURE__ */ jsxs12(
|
|
6241
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
6162
6242
|
/* @__PURE__ */ jsx13(Text12, { bold: true, color: "green", children: cursor }),
|
|
6163
6243
|
/* @__PURE__ */ jsx13(Text12, { dimColor: true, children: "Ask a question..." })
|
|
6164
6244
|
] }) }) })
|
|
@@ -6185,7 +6265,7 @@ function formatToolInput(input) {
|
|
|
6185
6265
|
|
|
6186
6266
|
// src/cli/dashboard/views/ChatArchiveView.tsx
|
|
6187
6267
|
import { useEffect as useEffect4, useCallback as useCallback6 } from "react";
|
|
6188
|
-
import { Box as Box13, Text as Text13, useInput as useInput9 } from "ink";
|
|
6268
|
+
import { Box as Box13, Text as Text13, useInput as useInput9, useStdout as useStdout11 } from "ink";
|
|
6189
6269
|
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6190
6270
|
function formatTimeAgo2(timestamp) {
|
|
6191
6271
|
const seconds = Math.floor((Date.now() - timestamp) / 1e3);
|
|
@@ -6300,6 +6380,10 @@ function ChatArchiveView() {
|
|
|
6300
6380
|
dispatch({ type: "SHOW_NOTIFICATION", message: `Failed to export: ${error instanceof Error ? error.message : "unknown"}`, severity: "warning", autoHideMs: 3e3 });
|
|
6301
6381
|
}
|
|
6302
6382
|
}, [sessions, selectedIndex, dispatch]);
|
|
6383
|
+
const { stdout } = useStdout11();
|
|
6384
|
+
const cols = stdout?.columns || 80;
|
|
6385
|
+
const narrow = cols < 60;
|
|
6386
|
+
const contentWidth = Math.max(20, cols - 4);
|
|
6303
6387
|
useInput9((input, key) => {
|
|
6304
6388
|
if (inputMode === "rename") {
|
|
6305
6389
|
if (key.return) {
|
|
@@ -6379,11 +6463,12 @@ function ChatArchiveView() {
|
|
|
6379
6463
|
/* @__PURE__ */ jsx14(Box13, { flexDirection: "column", marginTop: 1, children: sessions.map((session, idx) => {
|
|
6380
6464
|
const isSelected = idx === selectedIndex;
|
|
6381
6465
|
const ago = formatTimeAgo2(session.updatedAt);
|
|
6382
|
-
const
|
|
6383
|
-
|
|
6466
|
+
const titleWidth = Math.max(30, contentWidth - 20);
|
|
6467
|
+
const titleDisplay = session.title.length > titleWidth ? session.title.slice(0, titleWidth) + "..." : session.title;
|
|
6468
|
+
return /* @__PURE__ */ jsx14(Box13, { flexDirection: "column", children: /* @__PURE__ */ jsxs13(Text13, { wrap: "truncate", children: [
|
|
6384
6469
|
isSelected ? /* @__PURE__ */ jsx14(Text13, { bold: true, color: "green", children: "> " }) : " ",
|
|
6385
6470
|
isSelected ? /* @__PURE__ */ jsx14(Text13, { bold: true, children: titleDisplay }) : /* @__PURE__ */ jsx14(Text13, { children: titleDisplay }),
|
|
6386
|
-
/* @__PURE__ */ jsxs13(Text13, { dimColor: true, children: [
|
|
6471
|
+
narrow ? null : /* @__PURE__ */ jsxs13(Text13, { dimColor: true, children: [
|
|
6387
6472
|
" ",
|
|
6388
6473
|
session.messageCount,
|
|
6389
6474
|
" msgs \xB7 ",
|
|
@@ -6434,7 +6519,7 @@ ${content}
|
|
|
6434
6519
|
fixedContent = fixedContent.replace(/^```\w*\n?/, "").replace(/\n?```$/, "");
|
|
6435
6520
|
}
|
|
6436
6521
|
await writeFile(fullPath, fixedContent, "utf-8");
|
|
6437
|
-
const { recordGoalViolationFixed, getActiveGoals } = await import("./goal-validator-
|
|
6522
|
+
const { recordGoalViolationFixed, getActiveGoals } = await import("./goal-validator-HPPBSDXD.js");
|
|
6438
6523
|
const goals = await getActiveGoals(projectPath);
|
|
6439
6524
|
const matchedGoal = goals.find((g) => g.description === fix.goalDescription);
|
|
6440
6525
|
if (matchedGoal) {
|
|
@@ -6481,7 +6566,7 @@ function DashboardApp({ onReady }) {
|
|
|
6481
6566
|
const processInsights = useCallback7(async (issues) => {
|
|
6482
6567
|
try {
|
|
6483
6568
|
const workDir = getWorkingDirectory(void 0, true);
|
|
6484
|
-
const trieAgent =
|
|
6569
|
+
const trieAgent = getTrieAgent(workDir);
|
|
6485
6570
|
if (!stateRef.current.agentInitialized) {
|
|
6486
6571
|
await trieAgent.initialize();
|
|
6487
6572
|
dispatchRef.current({ type: "SET_AGENT_INITIALIZED", initialized: true });
|
|
@@ -6507,7 +6592,7 @@ function DashboardApp({ onReady }) {
|
|
|
6507
6592
|
const refreshGoals = useCallback7(async () => {
|
|
6508
6593
|
try {
|
|
6509
6594
|
const workDir = getWorkingDirectory(void 0, true);
|
|
6510
|
-
const agentState =
|
|
6595
|
+
const agentState = getProjectState(workDir);
|
|
6511
6596
|
await agentState.load();
|
|
6512
6597
|
const goals = agentState.getAllGoals();
|
|
6513
6598
|
dispatchRef.current({
|
|
@@ -6523,7 +6608,7 @@ function DashboardApp({ onReady }) {
|
|
|
6523
6608
|
const refreshHypotheses = useCallback7(async () => {
|
|
6524
6609
|
try {
|
|
6525
6610
|
const workDir = getWorkingDirectory(void 0, true);
|
|
6526
|
-
const agentState =
|
|
6611
|
+
const agentState = getProjectState(workDir);
|
|
6527
6612
|
await agentState.load();
|
|
6528
6613
|
const hypotheses = agentState.getAllHypotheses();
|
|
6529
6614
|
dispatchRef.current({
|
|
@@ -6821,4 +6906,4 @@ export {
|
|
|
6821
6906
|
handleCheckpointTool,
|
|
6822
6907
|
InteractiveDashboard
|
|
6823
6908
|
};
|
|
6824
|
-
//# sourceMappingURL=chunk-
|
|
6909
|
+
//# sourceMappingURL=chunk-AXYNWBME.js.map
|