pybao-cli 1.4.96 → 1.4.98
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/REPL-HSLBK5NZ.js +49 -0
- package/dist/{acp-DSHGC42G.js → acp-OYNDAMUG.js} +30 -30
- package/dist/{agentsValidate-XCGG77GS.js → agentsValidate-CSJFTPMF.js} +7 -7
- package/dist/{ask-BTEWFWX7.js → ask-RUL7DBVW.js} +29 -29
- package/dist/{autoUpdater-2JPYTHJU.js → autoUpdater-2US37QCD.js} +3 -3
- package/dist/{chunk-5ZRN3ED2.js → chunk-277MFG2S.js} +2 -2
- package/dist/{chunk-BABSJ55B.js → chunk-45KNYAUE.js} +3 -3
- package/dist/{chunk-BZJ63VLB.js → chunk-57TUHQTK.js} +1 -1
- package/dist/{chunk-XJEOCTTA.js → chunk-5FPVUG76.js} +1 -1
- package/dist/{chunk-IAFDLMER.js → chunk-5SASDPJI.js} +326 -16
- package/dist/chunk-5SASDPJI.js.map +7 -0
- package/dist/{chunk-37Z4UJE7.js → chunk-6CFLL7MP.js} +3 -3
- package/dist/{chunk-VYTXJQMG.js → chunk-6CZGZTTR.js} +4 -4
- package/dist/{chunk-NUVWA6CG.js → chunk-6W4QXF5T.js} +2 -2
- package/dist/{chunk-WFTCIKRP.js → chunk-736LB6QF.js} +3 -3
- package/dist/{chunk-V3I6BY55.js → chunk-7HPC6NEL.js} +4 -4
- package/dist/{chunk-ZWWEN5JT.js → chunk-7YOXNCGC.js} +2 -2
- package/dist/{chunk-C63QE2JE.js → chunk-AQDHWNHO.js} +1 -1
- package/dist/{chunk-GDYCFPX7.js → chunk-EKCV6FAR.js} +3 -3
- package/dist/{chunk-SWUVTC7Q.js → chunk-ELZOI2EN.js} +1 -1
- package/dist/{chunk-KXGXMSPS.js → chunk-FTXV6D26.js} +1 -1
- package/dist/{chunk-CKY2L3QE.js → chunk-FUO4GQ7W.js} +1 -1
- package/dist/{chunk-CKY2L3QE.js.map → chunk-FUO4GQ7W.js.map} +1 -1
- package/dist/{chunk-T4LDHDO5.js → chunk-G2NDX3AE.js} +1 -1
- package/dist/{chunk-MMICBXP5.js → chunk-HIRKT55M.js} +3 -3
- package/dist/{chunk-AZOP5QKF.js → chunk-JN7LIP22.js} +2 -2
- package/dist/{chunk-2KWRWCZO.js → chunk-KJLAOYAB.js} +399 -146
- package/dist/chunk-KJLAOYAB.js.map +7 -0
- package/dist/{chunk-73JVPKCJ.js → chunk-MSUD3TJP.js} +71 -35
- package/dist/chunk-MSUD3TJP.js.map +7 -0
- package/dist/{chunk-IZPWMY6H.js → chunk-N6RZW54E.js} +1 -1
- package/dist/{chunk-NPLYGSR3.js → chunk-NFCKELD5.js} +2 -2
- package/dist/{chunk-LYAYIYBK.js → chunk-NJY725BV.js} +3 -3
- package/dist/chunk-O6DTZU7F.js.map +7 -0
- package/dist/{chunk-GIXD4Z4O.js → chunk-QCPTRT42.js} +1 -1
- package/dist/{chunk-SXCGPQ3R.js → chunk-VFEFTBAX.js} +2 -2
- package/dist/{chunk-IZLBXT6P.js → chunk-WS3OA4DJ.js} +1 -1
- package/dist/{chunk-IXOS2743.js → chunk-X3S6OAMU.js} +2 -2
- package/dist/{chunk-W2YU6ZJG.js → chunk-XFAWFKEO.js} +4 -4
- package/dist/{chunk-RXJNQXGH.js → chunk-Y56ETINA.js} +4 -4
- package/dist/{chunk-65ADQNJL.js → chunk-ZT2EDUJ5.js} +1 -1
- package/dist/{cli-2YFCKDKV.js → cli-EW2FS2BF.js} +92 -90
- package/dist/{cli-2YFCKDKV.js.map → cli-EW2FS2BF.js.map} +2 -2
- package/dist/commands-ED3B27YA.js +53 -0
- package/dist/{config-BS3TSRO2.js → config-VMG22F4D.js} +4 -4
- package/dist/{context-GUWJH2XE.js → context-RCECS2MV.js} +6 -6
- package/dist/{conversationTracker-3OMO23AJ.js → conversationTracker-EDZLP7O4.js} +3 -3
- package/dist/{customCommands-O4D67KVC.js → customCommands-B6RXZMP5.js} +4 -4
- package/dist/{env-4M3GZSUS.js → env-YTAL5KRK.js} +2 -2
- package/dist/{file-FIYEKO7W.js → file-OOCDMD3U.js} +4 -4
- package/dist/index.js +3 -3
- package/dist/{llm-MXURYD2K.js → llm-R5NWZO5G.js} +31 -31
- package/dist/{llmLazy-X6M4BHF3.js → llmLazy-VWKTHJ4M.js} +1 -1
- package/dist/{loader-DDBTFUPC.js → loader-WWGN7JMY.js} +4 -4
- package/dist/{lsp-2SCBURX2.js → lsp-YT4SHOXN.js} +6 -6
- package/dist/{lspAnchor-YV4BDQJX.js → lspAnchor-B3LGI6VC.js} +6 -6
- package/dist/{mcp-CKGQUT3S.js → mcp-AIT7BP27.js} +7 -7
- package/dist/{mentionProcessor-NDVGHEEZ.js → mentionProcessor-TTRH7MSS.js} +5 -5
- package/dist/{messages-UHUC65DS.js → messages-V5YRA4WO.js} +1 -1
- package/dist/{model-RS4VTMY6.js → model-7QLTSWZV.js} +7 -5
- package/dist/{openai-QRE5RM6W.js → openai-O5UTQHNX.js} +5 -5
- package/dist/{outputStyles-UZYGNQU7.js → outputStyles-CUYPATTD.js} +4 -4
- package/dist/{pluginRuntime-4Z2SPLJI.js → pluginRuntime-Z3VUXLLL.js} +6 -6
- package/dist/{pluginValidation-GHCMPEC7.js → pluginValidation-OIFMXGZW.js} +6 -6
- package/dist/prompts-VSYX4Z3H.js +55 -0
- package/dist/{pybAgentSessionLoad-KTU6VBIE.js → pybAgentSessionLoad-YE3R7GCM.js} +4 -4
- package/dist/{pybAgentSessionResume-MKLZH2QZ.js → pybAgentSessionResume-H3X4E5WZ.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-66HVTHC4.js → pybAgentStreamJsonSession-LBTQ5QVA.js} +1 -1
- package/dist/{pybHooks-RL2D75BA.js → pybHooks-ICFUKF5J.js} +4 -4
- package/dist/query-3MCWSQFG.js +57 -0
- package/dist/{registry-HT2QIYZF.js → registry-U5KXMAQT.js} +5 -5
- package/dist/{ripgrep-Q26JLKZK.js → ripgrep-WWOPEBCI.js} +3 -3
- package/dist/{skillMarketplace-WX46FV3B.js → skillMarketplace-P7BGMBU7.js} +3 -3
- package/dist/{state-7D3EAZYW.js → state-BNEI4WAC.js} +2 -2
- package/dist/{theme-XZ67BKEX.js → theme-4JWO3G3X.js} +5 -5
- package/dist/{toolPermissionSettings-WDXG4PH5.js → toolPermissionSettings-LQLARZGN.js} +6 -6
- package/dist/tools-6AAIJTHG.js +54 -0
- package/dist/{userInput-LHXC33VV.js → userInput-GMSZGZQS.js} +31 -31
- package/package.json +1 -1
- package/dist/REPL-4XDQ5LO2.js +0 -49
- package/dist/chunk-2KWRWCZO.js.map +0 -7
- package/dist/chunk-73JVPKCJ.js.map +0 -7
- package/dist/chunk-IAFDLMER.js.map +0 -7
- package/dist/chunk-XI4LTVYT.js.map +0 -7
- package/dist/commands-QLETKRIB.js +0 -53
- package/dist/prompts-3Z364Z2H.js +0 -55
- package/dist/query-Y2PFPV5V.js +0 -57
- package/dist/tools-KP3XZFBW.js +0 -54
- /package/dist/{REPL-4XDQ5LO2.js.map → REPL-HSLBK5NZ.js.map} +0 -0
- /package/dist/{acp-DSHGC42G.js.map → acp-OYNDAMUG.js.map} +0 -0
- /package/dist/{agentsValidate-XCGG77GS.js.map → agentsValidate-CSJFTPMF.js.map} +0 -0
- /package/dist/{ask-BTEWFWX7.js.map → ask-RUL7DBVW.js.map} +0 -0
- /package/dist/{autoUpdater-2JPYTHJU.js.map → autoUpdater-2US37QCD.js.map} +0 -0
- /package/dist/{chunk-5ZRN3ED2.js.map → chunk-277MFG2S.js.map} +0 -0
- /package/dist/{chunk-BABSJ55B.js.map → chunk-45KNYAUE.js.map} +0 -0
- /package/dist/{chunk-BZJ63VLB.js.map → chunk-57TUHQTK.js.map} +0 -0
- /package/dist/{chunk-XJEOCTTA.js.map → chunk-5FPVUG76.js.map} +0 -0
- /package/dist/{chunk-37Z4UJE7.js.map → chunk-6CFLL7MP.js.map} +0 -0
- /package/dist/{chunk-VYTXJQMG.js.map → chunk-6CZGZTTR.js.map} +0 -0
- /package/dist/{chunk-NUVWA6CG.js.map → chunk-6W4QXF5T.js.map} +0 -0
- /package/dist/{chunk-WFTCIKRP.js.map → chunk-736LB6QF.js.map} +0 -0
- /package/dist/{chunk-V3I6BY55.js.map → chunk-7HPC6NEL.js.map} +0 -0
- /package/dist/{chunk-ZWWEN5JT.js.map → chunk-7YOXNCGC.js.map} +0 -0
- /package/dist/{chunk-C63QE2JE.js.map → chunk-AQDHWNHO.js.map} +0 -0
- /package/dist/{chunk-GDYCFPX7.js.map → chunk-EKCV6FAR.js.map} +0 -0
- /package/dist/{chunk-SWUVTC7Q.js.map → chunk-ELZOI2EN.js.map} +0 -0
- /package/dist/{chunk-KXGXMSPS.js.map → chunk-FTXV6D26.js.map} +0 -0
- /package/dist/{chunk-T4LDHDO5.js.map → chunk-G2NDX3AE.js.map} +0 -0
- /package/dist/{chunk-MMICBXP5.js.map → chunk-HIRKT55M.js.map} +0 -0
- /package/dist/{chunk-AZOP5QKF.js.map → chunk-JN7LIP22.js.map} +0 -0
- /package/dist/{chunk-IZPWMY6H.js.map → chunk-N6RZW54E.js.map} +0 -0
- /package/dist/{chunk-NPLYGSR3.js.map → chunk-NFCKELD5.js.map} +0 -0
- /package/dist/{chunk-LYAYIYBK.js.map → chunk-NJY725BV.js.map} +0 -0
- /package/dist/{chunk-XI4LTVYT.js → chunk-O6DTZU7F.js} +0 -0
- /package/dist/{chunk-GIXD4Z4O.js.map → chunk-QCPTRT42.js.map} +0 -0
- /package/dist/{chunk-SXCGPQ3R.js.map → chunk-VFEFTBAX.js.map} +0 -0
- /package/dist/{chunk-IZLBXT6P.js.map → chunk-WS3OA4DJ.js.map} +0 -0
- /package/dist/{chunk-IXOS2743.js.map → chunk-X3S6OAMU.js.map} +0 -0
- /package/dist/{chunk-W2YU6ZJG.js.map → chunk-XFAWFKEO.js.map} +0 -0
- /package/dist/{chunk-RXJNQXGH.js.map → chunk-Y56ETINA.js.map} +0 -0
- /package/dist/{chunk-65ADQNJL.js.map → chunk-ZT2EDUJ5.js.map} +0 -0
- /package/dist/{commands-QLETKRIB.js.map → commands-ED3B27YA.js.map} +0 -0
- /package/dist/{config-BS3TSRO2.js.map → config-VMG22F4D.js.map} +0 -0
- /package/dist/{context-GUWJH2XE.js.map → context-RCECS2MV.js.map} +0 -0
- /package/dist/{conversationTracker-3OMO23AJ.js.map → conversationTracker-EDZLP7O4.js.map} +0 -0
- /package/dist/{customCommands-O4D67KVC.js.map → customCommands-B6RXZMP5.js.map} +0 -0
- /package/dist/{env-4M3GZSUS.js.map → env-YTAL5KRK.js.map} +0 -0
- /package/dist/{file-FIYEKO7W.js.map → file-OOCDMD3U.js.map} +0 -0
- /package/dist/{llm-MXURYD2K.js.map → llm-R5NWZO5G.js.map} +0 -0
- /package/dist/{llmLazy-X6M4BHF3.js.map → llmLazy-VWKTHJ4M.js.map} +0 -0
- /package/dist/{loader-DDBTFUPC.js.map → loader-WWGN7JMY.js.map} +0 -0
- /package/dist/{lsp-2SCBURX2.js.map → lsp-YT4SHOXN.js.map} +0 -0
- /package/dist/{lspAnchor-YV4BDQJX.js.map → lspAnchor-B3LGI6VC.js.map} +0 -0
- /package/dist/{mcp-CKGQUT3S.js.map → mcp-AIT7BP27.js.map} +0 -0
- /package/dist/{mentionProcessor-NDVGHEEZ.js.map → mentionProcessor-TTRH7MSS.js.map} +0 -0
- /package/dist/{messages-UHUC65DS.js.map → messages-V5YRA4WO.js.map} +0 -0
- /package/dist/{model-RS4VTMY6.js.map → model-7QLTSWZV.js.map} +0 -0
- /package/dist/{openai-QRE5RM6W.js.map → openai-O5UTQHNX.js.map} +0 -0
- /package/dist/{outputStyles-UZYGNQU7.js.map → outputStyles-CUYPATTD.js.map} +0 -0
- /package/dist/{pluginRuntime-4Z2SPLJI.js.map → pluginRuntime-Z3VUXLLL.js.map} +0 -0
- /package/dist/{pluginValidation-GHCMPEC7.js.map → pluginValidation-OIFMXGZW.js.map} +0 -0
- /package/dist/{prompts-3Z364Z2H.js.map → prompts-VSYX4Z3H.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-KTU6VBIE.js.map → pybAgentSessionLoad-YE3R7GCM.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-MKLZH2QZ.js.map → pybAgentSessionResume-H3X4E5WZ.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-66HVTHC4.js.map → pybAgentStreamJsonSession-LBTQ5QVA.js.map} +0 -0
- /package/dist/{pybHooks-RL2D75BA.js.map → pybHooks-ICFUKF5J.js.map} +0 -0
- /package/dist/{query-Y2PFPV5V.js.map → query-3MCWSQFG.js.map} +0 -0
- /package/dist/{registry-HT2QIYZF.js.map → registry-U5KXMAQT.js.map} +0 -0
- /package/dist/{ripgrep-Q26JLKZK.js.map → ripgrep-WWOPEBCI.js.map} +0 -0
- /package/dist/{skillMarketplace-WX46FV3B.js.map → skillMarketplace-P7BGMBU7.js.map} +0 -0
- /package/dist/{state-7D3EAZYW.js.map → state-BNEI4WAC.js.map} +0 -0
- /package/dist/{theme-XZ67BKEX.js.map → theme-4JWO3G3X.js.map} +0 -0
- /package/dist/{toolPermissionSettings-WDXG4PH5.js.map → toolPermissionSettings-LQLARZGN.js.map} +0 -0
- /package/dist/{tools-KP3XZFBW.js.map → tools-6AAIJTHG.js.map} +0 -0
- /package/dist/{userInput-LHXC33VV.js.map → userInput-GMSZGZQS.js.map} +0 -0
|
@@ -21,8 +21,10 @@ import {
|
|
|
21
21
|
createTask,
|
|
22
22
|
findTaskCycles,
|
|
23
23
|
generateTaskListId,
|
|
24
|
+
getAgentMemoryDir,
|
|
24
25
|
getAgentPrompt,
|
|
25
26
|
getMaxThinkingTokens,
|
|
27
|
+
getProjectMemoryDir,
|
|
26
28
|
getTask,
|
|
27
29
|
getTaskListPaths,
|
|
28
30
|
hasPermissionsToUseTool,
|
|
@@ -30,62 +32,67 @@ import {
|
|
|
30
32
|
hasWritePermission,
|
|
31
33
|
listTasks,
|
|
32
34
|
query,
|
|
35
|
+
recordFileEdit,
|
|
36
|
+
resolveAutoMemoryFlags,
|
|
37
|
+
resolveMemoryPath,
|
|
38
|
+
resolveProjectId,
|
|
33
39
|
runWithTaskListEnv,
|
|
34
40
|
runWithTaskListId,
|
|
35
41
|
updateTask
|
|
36
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-KJLAOYAB.js";
|
|
37
43
|
import {
|
|
38
44
|
queryLLM
|
|
39
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-XFAWFKEO.js";
|
|
40
46
|
import {
|
|
41
47
|
FallbackToolUseRejectedMessage,
|
|
42
48
|
MCPTool,
|
|
43
49
|
getClients,
|
|
44
50
|
getMCPTools
|
|
45
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-7HPC6NEL.js";
|
|
46
52
|
import {
|
|
47
53
|
emitReminderEvent
|
|
48
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-7YOXNCGC.js";
|
|
49
55
|
import {
|
|
50
56
|
getActiveAgents,
|
|
51
57
|
getAgentByType,
|
|
52
58
|
getAvailableAgentTypes
|
|
53
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-6W4QXF5T.js";
|
|
54
60
|
import {
|
|
55
61
|
INTERRUPT_MESSAGE,
|
|
56
62
|
createAssistantMessage,
|
|
57
63
|
createUserMessage,
|
|
58
64
|
getLastAssistantMessageId
|
|
59
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-5FPVUG76.js";
|
|
60
66
|
import {
|
|
61
67
|
formatDuration,
|
|
62
68
|
formatNumber
|
|
63
69
|
} from "./chunk-OUXHGDLH.js";
|
|
64
70
|
import {
|
|
65
71
|
getAbsolutePath
|
|
66
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-VFEFTBAX.js";
|
|
67
73
|
import {
|
|
68
74
|
LspFacade,
|
|
69
75
|
formatDiagnosticsPretty
|
|
70
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-Y56ETINA.js";
|
|
71
77
|
import {
|
|
72
78
|
getModelManager
|
|
73
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-MSUD3TJP.js";
|
|
74
80
|
import {
|
|
75
81
|
getContext
|
|
76
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-6CZGZTTR.js";
|
|
77
83
|
import {
|
|
78
84
|
filesToTree,
|
|
79
85
|
ripGrepWithStatus
|
|
80
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-ZT2EDUJ5.js";
|
|
81
87
|
import {
|
|
82
88
|
getTheme
|
|
83
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-ELZOI2EN.js";
|
|
84
90
|
import {
|
|
85
91
|
debug
|
|
86
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-G2NDX3AE.js";
|
|
87
93
|
import {
|
|
88
94
|
BunShell,
|
|
95
|
+
MEMORY_DIR,
|
|
89
96
|
getCwd,
|
|
90
97
|
getMessagesPath,
|
|
91
98
|
getNextAvailableLogSidechainNumber,
|
|
@@ -94,7 +101,7 @@ import {
|
|
|
94
101
|
overwriteLog,
|
|
95
102
|
readTaskOutput,
|
|
96
103
|
resolveXdgDataPath
|
|
97
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-57TUHQTK.js";
|
|
98
105
|
|
|
99
106
|
// src/tools/index.ts
|
|
100
107
|
import { memoize as memoize2 } from "lodash-es";
|
|
@@ -773,7 +780,7 @@ async function analyzeOutputWithLsp(output, exitCode) {
|
|
|
773
780
|
if (exitCode !== 0 || errorCount > 0 || warningCount > 0) {
|
|
774
781
|
try {
|
|
775
782
|
const { isAbsolute: isAbsolute3, resolve: resolve4 } = await import("path");
|
|
776
|
-
const { getSessionRoot: getSessionRoot2 } = await import("./state-
|
|
783
|
+
const { getSessionRoot: getSessionRoot2 } = await import("./state-BNEI4WAC.js");
|
|
777
784
|
const lines = output.split("\n");
|
|
778
785
|
const uniqueFiles = /* @__PURE__ */ new Set();
|
|
779
786
|
const lspSuggestions = [];
|
|
@@ -1146,7 +1153,7 @@ var DeleteTool = {
|
|
|
1146
1153
|
}
|
|
1147
1154
|
if (!force) {
|
|
1148
1155
|
try {
|
|
1149
|
-
const { LspFacade: LspFacade2 } = await import("./lsp-
|
|
1156
|
+
const { LspFacade: LspFacade2 } = await import("./lsp-YT4SHOXN.js");
|
|
1150
1157
|
const referenceDetail = await LspFacade2.checkFileReferences(fullPath);
|
|
1151
1158
|
if (referenceDetail) {
|
|
1152
1159
|
failedItems.push(
|
|
@@ -2331,6 +2338,12 @@ import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
|
|
|
2331
2338
|
|
|
2332
2339
|
// src/utils/agent/storage.ts
|
|
2333
2340
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
2341
|
+
function getDefaultAgentId() {
|
|
2342
|
+
return "default";
|
|
2343
|
+
}
|
|
2344
|
+
function resolveAgentId(agentId) {
|
|
2345
|
+
return agentId || getDefaultAgentId();
|
|
2346
|
+
}
|
|
2334
2347
|
function generateAgentId() {
|
|
2335
2348
|
return randomUUID2();
|
|
2336
2349
|
}
|
|
@@ -2829,6 +2842,7 @@ var TaskTool = {
|
|
|
2829
2842
|
options: queryOptions,
|
|
2830
2843
|
messageId: getLastAssistantMessageId(bgMessages),
|
|
2831
2844
|
agentId,
|
|
2845
|
+
agentType: input.subagent_type,
|
|
2832
2846
|
readFileTimestamps,
|
|
2833
2847
|
setToolJSX: () => {
|
|
2834
2848
|
}
|
|
@@ -2964,6 +2978,7 @@ var TaskTool = {
|
|
|
2964
2978
|
options: queryOptions,
|
|
2965
2979
|
messageId: getLastAssistantMessageId(messagesForQuery),
|
|
2966
2980
|
agentId,
|
|
2981
|
+
agentType: input.subagent_type,
|
|
2967
2982
|
readFileTimestamps,
|
|
2968
2983
|
setToolJSX: () => {
|
|
2969
2984
|
}
|
|
@@ -3894,6 +3909,299 @@ var TaskUpdateTool = {
|
|
|
3894
3909
|
}
|
|
3895
3910
|
};
|
|
3896
3911
|
|
|
3912
|
+
// src/tools/memory/MemoryReadTool/MemoryReadTool.tsx
|
|
3913
|
+
import { existsSync as existsSync5, lstatSync, mkdirSync as mkdirSync2, readdirSync as readdirSync2, readFileSync as readFileSync4 } from "fs";
|
|
3914
|
+
import { Box as Box9, Text as Text9 } from "ink";
|
|
3915
|
+
import { join as join2 } from "path";
|
|
3916
|
+
import * as React9 from "react";
|
|
3917
|
+
import { z as z14 } from "zod";
|
|
3918
|
+
|
|
3919
|
+
// src/tools/memory/MemoryReadTool/prompt.ts
|
|
3920
|
+
var DESCRIPTION10 = "Read agent memory files from the local filesystem.";
|
|
3921
|
+
var PROMPT10 = `Reads agent memory files from the local filesystem.
|
|
3922
|
+
|
|
3923
|
+
Usage:
|
|
3924
|
+
- The file_path parameter must be a path relative to the agent's memory directory
|
|
3925
|
+
- By default, it reads a specific memory file if file_path is provided
|
|
3926
|
+
- If no file_path is specified, it returns an index of all memory files for the current agent
|
|
3927
|
+
- Memory files are stored under ~/.pyb/memory/projects/{projectId}/memory
|
|
3928
|
+
- Use this tool to access previously stored agent memories and task execution details
|
|
3929
|
+
|
|
3930
|
+
Examples:
|
|
3931
|
+
- To read a specific memory file: {"file_path": "task-123-summary.md"}
|
|
3932
|
+
- To get memory index: {} (empty input)
|
|
3933
|
+
|
|
3934
|
+
Security:
|
|
3935
|
+
- File paths are validated to ensure they are within the agent's memory directory
|
|
3936
|
+
- Only files within the agent's designated memory space can be accessed
|
|
3937
|
+
`;
|
|
3938
|
+
|
|
3939
|
+
// src/tools/memory/MemoryReadTool/MemoryReadTool.tsx
|
|
3940
|
+
var inputSchema13 = z14.strictObject({
|
|
3941
|
+
file_path: z14.string().optional().describe("Optional path to a specific memory file to read")
|
|
3942
|
+
});
|
|
3943
|
+
var MemoryReadTool = {
|
|
3944
|
+
name: "MemoryRead",
|
|
3945
|
+
async description() {
|
|
3946
|
+
return DESCRIPTION10;
|
|
3947
|
+
},
|
|
3948
|
+
async prompt() {
|
|
3949
|
+
return PROMPT10;
|
|
3950
|
+
},
|
|
3951
|
+
inputSchema: inputSchema13,
|
|
3952
|
+
userFacingName() {
|
|
3953
|
+
return "Read Memory";
|
|
3954
|
+
},
|
|
3955
|
+
async isEnabled() {
|
|
3956
|
+
return resolveAutoMemoryFlags().enabled;
|
|
3957
|
+
},
|
|
3958
|
+
isReadOnly() {
|
|
3959
|
+
return true;
|
|
3960
|
+
},
|
|
3961
|
+
isConcurrencySafe() {
|
|
3962
|
+
return true;
|
|
3963
|
+
},
|
|
3964
|
+
needsPermissions() {
|
|
3965
|
+
return false;
|
|
3966
|
+
},
|
|
3967
|
+
renderResultForAssistant({ content }) {
|
|
3968
|
+
return content;
|
|
3969
|
+
},
|
|
3970
|
+
renderToolUseMessage(input) {
|
|
3971
|
+
return Object.entries(input).map(([key, value]) => `${key}: ${JSON.stringify(value)}`).join(", ");
|
|
3972
|
+
},
|
|
3973
|
+
renderToolUseRejectedMessage() {
|
|
3974
|
+
return /* @__PURE__ */ React9.createElement(FallbackToolUseRejectedMessage, null);
|
|
3975
|
+
},
|
|
3976
|
+
renderToolResultMessage(output) {
|
|
3977
|
+
return /* @__PURE__ */ React9.createElement(Box9, { justifyContent: "space-between", overflowX: "hidden", width: "100%" }, /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "row" }, /* @__PURE__ */ React9.createElement(Text9, null, "\xA0\xA0\uFFFD?\xA0"), /* @__PURE__ */ React9.createElement(Text9, null, output.content)));
|
|
3978
|
+
},
|
|
3979
|
+
async validateInput({ file_path }, context) {
|
|
3980
|
+
const cwd = getCwd();
|
|
3981
|
+
const projectId = await resolveProjectId(cwd);
|
|
3982
|
+
const projectMemoryDir = getProjectMemoryDir(MEMORY_DIR, projectId);
|
|
3983
|
+
const agentId = resolveAgentId(context?.agentId);
|
|
3984
|
+
const agentMemoryDir = getAgentMemoryDir(projectMemoryDir, {
|
|
3985
|
+
agentId,
|
|
3986
|
+
agentType: context?.agentType
|
|
3987
|
+
});
|
|
3988
|
+
if (file_path) {
|
|
3989
|
+
const resolved = resolveMemoryPath(agentMemoryDir, file_path);
|
|
3990
|
+
if (!resolved.ok) {
|
|
3991
|
+
return { result: false, message: "Invalid memory file path" };
|
|
3992
|
+
}
|
|
3993
|
+
if (!existsSync5(resolved.fullPath)) {
|
|
3994
|
+
return { result: false, message: "Memory file does not exist" };
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3997
|
+
return { result: true };
|
|
3998
|
+
},
|
|
3999
|
+
async *call({ file_path }, context) {
|
|
4000
|
+
const cwd = getCwd();
|
|
4001
|
+
const projectId = await resolveProjectId(cwd);
|
|
4002
|
+
const projectMemoryDir = getProjectMemoryDir(MEMORY_DIR, projectId);
|
|
4003
|
+
const agentId = resolveAgentId(context?.agentId);
|
|
4004
|
+
const agentMemoryDir = getAgentMemoryDir(projectMemoryDir, {
|
|
4005
|
+
agentId,
|
|
4006
|
+
agentType: context?.agentType
|
|
4007
|
+
});
|
|
4008
|
+
mkdirSync2(agentMemoryDir, { recursive: true });
|
|
4009
|
+
if (file_path) {
|
|
4010
|
+
const resolved = resolveMemoryPath(agentMemoryDir, file_path);
|
|
4011
|
+
if (!resolved.ok) {
|
|
4012
|
+
throw new Error("Invalid memory file path");
|
|
4013
|
+
}
|
|
4014
|
+
const fullPath = resolved.fullPath;
|
|
4015
|
+
if (!existsSync5(fullPath)) {
|
|
4016
|
+
throw new Error("Memory file does not exist");
|
|
4017
|
+
}
|
|
4018
|
+
const content2 = readFileSync4(fullPath, "utf-8");
|
|
4019
|
+
yield {
|
|
4020
|
+
type: "result",
|
|
4021
|
+
data: {
|
|
4022
|
+
content: content2
|
|
4023
|
+
},
|
|
4024
|
+
resultForAssistant: this.renderResultForAssistant({ content: content2 })
|
|
4025
|
+
};
|
|
4026
|
+
return;
|
|
4027
|
+
}
|
|
4028
|
+
const files = readdirSync2(agentMemoryDir, { recursive: true }).map((f) => join2(agentMemoryDir, f.toString())).filter((f) => !lstatSync(f).isDirectory()).map((f) => `- ${f}`).join("\n");
|
|
4029
|
+
const indexPath = join2(agentMemoryDir, "index.md");
|
|
4030
|
+
const index = existsSync5(indexPath) ? readFileSync4(indexPath, "utf-8") : "";
|
|
4031
|
+
const quotes = "'''";
|
|
4032
|
+
const content = `Here are the contents of the agent memory file, \`${indexPath}\`:
|
|
4033
|
+
${quotes}
|
|
4034
|
+
${index}
|
|
4035
|
+
${quotes}
|
|
4036
|
+
|
|
4037
|
+
Files in the agent memory directory:
|
|
4038
|
+
${files}`;
|
|
4039
|
+
yield {
|
|
4040
|
+
type: "result",
|
|
4041
|
+
data: { content },
|
|
4042
|
+
resultForAssistant: this.renderResultForAssistant({ content })
|
|
4043
|
+
};
|
|
4044
|
+
}
|
|
4045
|
+
};
|
|
4046
|
+
|
|
4047
|
+
// src/tools/memory/MemoryWriteTool/MemoryWriteTool.tsx
|
|
4048
|
+
import { Box as Box10, Text as Text10 } from "ink";
|
|
4049
|
+
import * as React10 from "react";
|
|
4050
|
+
import { z as z15 } from "zod";
|
|
4051
|
+
|
|
4052
|
+
// src/services/memory/write.ts
|
|
4053
|
+
import {
|
|
4054
|
+
existsSync as existsSync6,
|
|
4055
|
+
mkdirSync as mkdirSync3,
|
|
4056
|
+
readFileSync as readFileSync5,
|
|
4057
|
+
renameSync,
|
|
4058
|
+
rmSync as rmSync2,
|
|
4059
|
+
writeFileSync as writeFileSync2
|
|
4060
|
+
} from "fs";
|
|
4061
|
+
import { dirname as dirname2 } from "path";
|
|
4062
|
+
var defaultFsDeps = {
|
|
4063
|
+
mkdirSync: mkdirSync3,
|
|
4064
|
+
existsSync: existsSync6,
|
|
4065
|
+
readFileSync: readFileSync5,
|
|
4066
|
+
writeFileSync: writeFileSync2,
|
|
4067
|
+
renameSync,
|
|
4068
|
+
rmSync: rmSync2
|
|
4069
|
+
};
|
|
4070
|
+
function mergeContent(existing, incoming, mode) {
|
|
4071
|
+
if (mode === "replace") return incoming;
|
|
4072
|
+
if (!existing) return incoming;
|
|
4073
|
+
if (!incoming) return existing;
|
|
4074
|
+
return `${existing}
|
|
4075
|
+
${incoming}`;
|
|
4076
|
+
}
|
|
4077
|
+
function writeMemoryFile(input, deps) {
|
|
4078
|
+
const fs = { ...defaultFsDeps, ...deps || {} };
|
|
4079
|
+
const mode = input.mode || "replace";
|
|
4080
|
+
const filePath = input.filePath;
|
|
4081
|
+
const tempPath = `${filePath}.tmp`;
|
|
4082
|
+
fs.mkdirSync(dirname2(filePath), { recursive: true });
|
|
4083
|
+
const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, "utf8") : "";
|
|
4084
|
+
const nextContent = mergeContent(existing, input.content, mode);
|
|
4085
|
+
fs.writeFileSync(tempPath, nextContent, "utf8");
|
|
4086
|
+
try {
|
|
4087
|
+
fs.renameSync(tempPath, filePath);
|
|
4088
|
+
} catch {
|
|
4089
|
+
fs.writeFileSync(filePath, nextContent, "utf8");
|
|
4090
|
+
if (fs.existsSync(tempPath)) {
|
|
4091
|
+
fs.rmSync(tempPath, { force: true });
|
|
4092
|
+
}
|
|
4093
|
+
}
|
|
4094
|
+
}
|
|
4095
|
+
|
|
4096
|
+
// src/tools/memory/MemoryWriteTool/prompt.ts
|
|
4097
|
+
var DESCRIPTION11 = "Write agent memory files to the local filesystem.";
|
|
4098
|
+
var PROMPT11 = `Write agent memory files to the local filesystem.
|
|
4099
|
+
|
|
4100
|
+
Usage:
|
|
4101
|
+
- The file_path parameter is required and specifies the memory file to write
|
|
4102
|
+
- The content parameter is required and contains the content to write
|
|
4103
|
+
- The optional mode parameter supports append or replace (default replace)
|
|
4104
|
+
- Memory files are stored under ~/.pyb/memory/projects/{projectId}/memory
|
|
4105
|
+
- Use this tool to store agent memories and task execution details
|
|
4106
|
+
- In replace mode existing file content is overwritten
|
|
4107
|
+
- In append mode content is appended to the existing file
|
|
4108
|
+
|
|
4109
|
+
Security:
|
|
4110
|
+
- File paths are validated to ensure they are within the agent's memory directory
|
|
4111
|
+
- Only files within the agent's designated memory space can be written
|
|
4112
|
+
- Directory structure is automatically created if it doesn't exist
|
|
4113
|
+
|
|
4114
|
+
Example:
|
|
4115
|
+
{
|
|
4116
|
+
"file_path": "task-123-summary.md",
|
|
4117
|
+
"content": "# Task Summary
|
|
4118
|
+
|
|
4119
|
+
This is the summary of the task execution...",
|
|
4120
|
+
"mode": "append"
|
|
4121
|
+
}
|
|
4122
|
+
`;
|
|
4123
|
+
|
|
4124
|
+
// src/tools/memory/MemoryWriteTool/MemoryWriteTool.tsx
|
|
4125
|
+
var inputSchema14 = z15.strictObject({
|
|
4126
|
+
file_path: z15.string().describe("Path to the memory file to write"),
|
|
4127
|
+
content: z15.string().describe("Content to write to the file"),
|
|
4128
|
+
mode: z15.enum(["append", "replace"]).optional().describe("Write mode: append adds to existing content, replace overwrites")
|
|
4129
|
+
});
|
|
4130
|
+
var MemoryWriteTool = {
|
|
4131
|
+
name: "MemoryWrite",
|
|
4132
|
+
async description() {
|
|
4133
|
+
return DESCRIPTION11;
|
|
4134
|
+
},
|
|
4135
|
+
async prompt() {
|
|
4136
|
+
return PROMPT11;
|
|
4137
|
+
},
|
|
4138
|
+
inputSchema: inputSchema14,
|
|
4139
|
+
userFacingName() {
|
|
4140
|
+
return "Write Memory";
|
|
4141
|
+
},
|
|
4142
|
+
async isEnabled() {
|
|
4143
|
+
return resolveAutoMemoryFlags().enabled;
|
|
4144
|
+
},
|
|
4145
|
+
isReadOnly() {
|
|
4146
|
+
return false;
|
|
4147
|
+
},
|
|
4148
|
+
isConcurrencySafe() {
|
|
4149
|
+
return false;
|
|
4150
|
+
},
|
|
4151
|
+
needsPermissions() {
|
|
4152
|
+
return false;
|
|
4153
|
+
},
|
|
4154
|
+
renderResultForAssistant(content) {
|
|
4155
|
+
return content;
|
|
4156
|
+
},
|
|
4157
|
+
renderToolUseMessage(input) {
|
|
4158
|
+
return Object.entries(input).map(([key, value]) => `${key}: ${JSON.stringify(value)}`).join(", ");
|
|
4159
|
+
},
|
|
4160
|
+
renderToolUseRejectedMessage() {
|
|
4161
|
+
return /* @__PURE__ */ React10.createElement(FallbackToolUseRejectedMessage, null);
|
|
4162
|
+
},
|
|
4163
|
+
renderToolResultMessage() {
|
|
4164
|
+
return /* @__PURE__ */ React10.createElement(Box10, { justifyContent: "space-between", overflowX: "hidden", width: "100%" }, /* @__PURE__ */ React10.createElement(Box10, { flexDirection: "row" }, /* @__PURE__ */ React10.createElement(Text10, null, " ", "\uFFFD?Updated memory")));
|
|
4165
|
+
},
|
|
4166
|
+
async validateInput({ file_path }, context) {
|
|
4167
|
+
const cwd = getCwd();
|
|
4168
|
+
const projectId = await resolveProjectId(cwd);
|
|
4169
|
+
const projectMemoryDir = getProjectMemoryDir(MEMORY_DIR, projectId);
|
|
4170
|
+
const agentId = resolveAgentId(context?.agentId);
|
|
4171
|
+
const agentMemoryDir = getAgentMemoryDir(projectMemoryDir, {
|
|
4172
|
+
agentId,
|
|
4173
|
+
agentType: context?.agentType
|
|
4174
|
+
});
|
|
4175
|
+
const resolved = resolveMemoryPath(agentMemoryDir, file_path);
|
|
4176
|
+
if (!resolved.ok) {
|
|
4177
|
+
return { result: false, message: "Invalid memory file path" };
|
|
4178
|
+
}
|
|
4179
|
+
return { result: true };
|
|
4180
|
+
},
|
|
4181
|
+
async *call({ file_path, content, mode }, context) {
|
|
4182
|
+
const cwd = getCwd();
|
|
4183
|
+
const projectId = await resolveProjectId(cwd);
|
|
4184
|
+
const projectMemoryDir = getProjectMemoryDir(MEMORY_DIR, projectId);
|
|
4185
|
+
const agentId = resolveAgentId(context?.agentId);
|
|
4186
|
+
const agentMemoryDir = getAgentMemoryDir(projectMemoryDir, {
|
|
4187
|
+
agentId,
|
|
4188
|
+
agentType: context?.agentType
|
|
4189
|
+
});
|
|
4190
|
+
const resolved = resolveMemoryPath(agentMemoryDir, file_path);
|
|
4191
|
+
if (!resolved.ok) {
|
|
4192
|
+
throw new Error("Invalid memory file path");
|
|
4193
|
+
}
|
|
4194
|
+
const fullPath = resolved.fullPath;
|
|
4195
|
+
writeMemoryFile({ filePath: fullPath, content, mode });
|
|
4196
|
+
recordFileEdit(fullPath, content);
|
|
4197
|
+
yield {
|
|
4198
|
+
type: "result",
|
|
4199
|
+
data: "Saved",
|
|
4200
|
+
resultForAssistant: "Saved"
|
|
4201
|
+
};
|
|
4202
|
+
}
|
|
4203
|
+
};
|
|
4204
|
+
|
|
3897
4205
|
// src/tools/index.ts
|
|
3898
4206
|
var getAllTools = () => [
|
|
3899
4207
|
TaskTool,
|
|
@@ -3919,6 +4227,8 @@ var getAllTools = () => [
|
|
|
3919
4227
|
AskUserQuestionTool,
|
|
3920
4228
|
SlashCommandTool,
|
|
3921
4229
|
SkillTool,
|
|
4230
|
+
MemoryReadTool,
|
|
4231
|
+
MemoryWriteTool,
|
|
3922
4232
|
ListMcpResourcesTool,
|
|
3923
4233
|
ReadMcpResourceTool,
|
|
3924
4234
|
MCPTool
|