jinzd-ai-cli 0.4.241 → 0.4.243
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{batch-K66BLTLJ.js → batch-CUVZUPRK.js} +2 -2
- package/dist/{chat-index-7HXBWQFH.js → chat-index-ALUHFJKI.js} +3 -2
- package/dist/{chat-index-WYXYD7YP.js → chat-index-ML5FF5L6.js} +2 -1
- package/dist/{chunk-SMQHEJSH.js → chunk-66CE3E6X.js} +1 -1
- package/dist/chunk-B5TYJO7V.js +123 -0
- package/dist/{chunk-PGHTAKIA.js → chunk-DJGCG7SF.js} +1 -1
- package/dist/{chunk-2QQKS56X.js → chunk-DT77O33T.js} +1 -1
- package/dist/{chunk-2LLQOMMW.js → chunk-EMFCHE2B.js} +1 -1
- package/dist/chunk-GEWPLNKA.js +164 -0
- package/dist/{chunk-LXSUPLCK.js → chunk-H3ARWBYR.js} +2 -2
- package/dist/{chunk-3AIR7N5M.js → chunk-HNJX3N2V.js} +5 -5
- package/dist/{chunk-5MYPIQ3Y.js → chunk-IGPFYNZA.js} +4 -2
- package/dist/{chunk-GORPFFV4.js → chunk-KILKF2VN.js} +97 -254
- package/dist/{chunk-JMP3LJC2.js → chunk-KWQKQVPH.js} +4 -2
- package/dist/{chunk-NAQPP3GZ.js → chunk-L5IRDRWG.js} +1 -1
- package/dist/{chunk-UO3XWZFE.js → chunk-NV63EYFL.js} +3 -119
- package/dist/{chunk-KCEO2XJ4.js → chunk-PJ3ONBWZ.js} +0 -119
- package/dist/{chunk-ZPXMT2B6.js → chunk-PLEXBFCR.js} +4 -163
- package/dist/chunk-PNNZRJ67.js +523 -0
- package/dist/{chunk-CHFFEVVT.js → chunk-QNK7GUUB.js} +3 -3
- package/dist/chunk-TY4FSEZS.js +432 -0
- package/dist/{chunk-IV6GCDVR.js → chunk-X73Y4JZI.js} +7 -1
- package/dist/chunk-YVTASHS5.js +121 -0
- package/dist/{ci-T2ABDMMQ.js → ci-3O3JR6FX.js} +4 -4
- package/dist/{ci-format-S2PPU27O.js → ci-format-KGWF6KOU.js} +2 -2
- package/dist/{constants-RS7OUU7X.js → constants-NMFRZ5LW.js} +1 -1
- package/dist/{doctor-cli-TGAW6RAP.js → doctor-cli-4QUHTJZ4.js} +4 -4
- package/dist/electron-server.js +446 -579
- package/dist/{hub-GL5ZU6WS.js → hub-2GXFPWOR.js} +2 -2
- package/dist/index.js +273 -62
- package/dist/{persist-AMH5SQ4W.js → persist-WGIJ6RXY.js} +4 -3
- package/dist/persistent-memory-VFBRMKGG.js +65 -0
- package/dist/persistent-memory-ZCQKLIC5.js +63 -0
- package/dist/{pr-TJFKUZ4B.js → pr-GIDFO4KP.js} +5 -5
- package/dist/{run-tests-KEI7IXTB.js → run-tests-BMH6QJN2.js} +2 -2
- package/dist/{run-tests-EWMU34A4.js → run-tests-WCZBWQFS.js} +2 -1
- package/dist/{server-UVS2D4M6.js → server-A5NGGDMP.js} +130 -47
- package/dist/{server-E545UIX7.js → server-FEFIFJDA.js} +8 -6
- package/dist/{task-orchestrator-PWXV2EBN.js → task-orchestrator-J2H6OV6R.js} +8 -6
- package/dist/{usage-EDJ6QOWB.js → usage-7WJC234G.js} +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
addMemoryEntry,
|
|
4
|
+
backupMemoryStore,
|
|
5
|
+
clearMemoryEntries,
|
|
6
|
+
countPendingMemories,
|
|
7
|
+
deleteMemoryEntry,
|
|
8
|
+
detectStaleLegacyMarkdownEdit,
|
|
9
|
+
expireMemoryEntry,
|
|
10
|
+
exportMemoryEntries,
|
|
11
|
+
findSimilarMemory,
|
|
12
|
+
formatMemoryForPrompt,
|
|
13
|
+
getProjectKey,
|
|
14
|
+
isMemoryExpired,
|
|
15
|
+
isMemoryStale,
|
|
16
|
+
isMemoryVisibleInProject,
|
|
17
|
+
listMemoryEntries,
|
|
18
|
+
listOrphanedProjectMemories,
|
|
19
|
+
loadMemoryEntries,
|
|
20
|
+
memoryMarkdownPath,
|
|
21
|
+
memoryStorePath,
|
|
22
|
+
parseWritableScope,
|
|
23
|
+
rebindMemoryProject,
|
|
24
|
+
renderMemoryMarkdown,
|
|
25
|
+
restoreMemoryEntries,
|
|
26
|
+
searchPersistentMemories,
|
|
27
|
+
syncLegacyMarkdown,
|
|
28
|
+
touchMemoryReferences,
|
|
29
|
+
updateMemoryApproval,
|
|
30
|
+
updateMemoryEntry
|
|
31
|
+
} from "./chunk-TY4FSEZS.js";
|
|
32
|
+
import "./chunk-HOSJZMQS.js";
|
|
33
|
+
import "./chunk-66CE3E6X.js";
|
|
34
|
+
import "./chunk-B5TYJO7V.js";
|
|
35
|
+
import "./chunk-IW3Q7AE5.js";
|
|
36
|
+
export {
|
|
37
|
+
addMemoryEntry,
|
|
38
|
+
backupMemoryStore,
|
|
39
|
+
clearMemoryEntries,
|
|
40
|
+
countPendingMemories,
|
|
41
|
+
deleteMemoryEntry,
|
|
42
|
+
detectStaleLegacyMarkdownEdit,
|
|
43
|
+
expireMemoryEntry,
|
|
44
|
+
exportMemoryEntries,
|
|
45
|
+
findSimilarMemory,
|
|
46
|
+
formatMemoryForPrompt,
|
|
47
|
+
getProjectKey,
|
|
48
|
+
isMemoryExpired,
|
|
49
|
+
isMemoryStale,
|
|
50
|
+
isMemoryVisibleInProject,
|
|
51
|
+
listMemoryEntries,
|
|
52
|
+
listOrphanedProjectMemories,
|
|
53
|
+
loadMemoryEntries,
|
|
54
|
+
memoryMarkdownPath,
|
|
55
|
+
memoryStorePath,
|
|
56
|
+
parseWritableScope,
|
|
57
|
+
rebindMemoryProject,
|
|
58
|
+
renderMemoryMarkdown,
|
|
59
|
+
restoreMemoryEntries,
|
|
60
|
+
searchPersistentMemories,
|
|
61
|
+
syncLegacyMarkdown,
|
|
62
|
+
touchMemoryReferences,
|
|
63
|
+
updateMemoryApproval,
|
|
64
|
+
updateMemoryEntry
|
|
65
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addMemoryEntry,
|
|
3
|
+
backupMemoryStore,
|
|
4
|
+
clearMemoryEntries,
|
|
5
|
+
countPendingMemories,
|
|
6
|
+
deleteMemoryEntry,
|
|
7
|
+
detectStaleLegacyMarkdownEdit,
|
|
8
|
+
expireMemoryEntry,
|
|
9
|
+
exportMemoryEntries,
|
|
10
|
+
findSimilarMemory,
|
|
11
|
+
formatMemoryForPrompt,
|
|
12
|
+
getProjectKey,
|
|
13
|
+
isMemoryExpired,
|
|
14
|
+
isMemoryStale,
|
|
15
|
+
isMemoryVisibleInProject,
|
|
16
|
+
listMemoryEntries,
|
|
17
|
+
listOrphanedProjectMemories,
|
|
18
|
+
loadMemoryEntries,
|
|
19
|
+
memoryMarkdownPath,
|
|
20
|
+
memoryStorePath,
|
|
21
|
+
parseWritableScope,
|
|
22
|
+
rebindMemoryProject,
|
|
23
|
+
renderMemoryMarkdown,
|
|
24
|
+
restoreMemoryEntries,
|
|
25
|
+
searchPersistentMemories,
|
|
26
|
+
syncLegacyMarkdown,
|
|
27
|
+
touchMemoryReferences,
|
|
28
|
+
updateMemoryApproval,
|
|
29
|
+
updateMemoryEntry
|
|
30
|
+
} from "./chunk-PNNZRJ67.js";
|
|
31
|
+
import "./chunk-YVTASHS5.js";
|
|
32
|
+
import "./chunk-GEWPLNKA.js";
|
|
33
|
+
import "./chunk-6BUTA5VW.js";
|
|
34
|
+
export {
|
|
35
|
+
addMemoryEntry,
|
|
36
|
+
backupMemoryStore,
|
|
37
|
+
clearMemoryEntries,
|
|
38
|
+
countPendingMemories,
|
|
39
|
+
deleteMemoryEntry,
|
|
40
|
+
detectStaleLegacyMarkdownEdit,
|
|
41
|
+
expireMemoryEntry,
|
|
42
|
+
exportMemoryEntries,
|
|
43
|
+
findSimilarMemory,
|
|
44
|
+
formatMemoryForPrompt,
|
|
45
|
+
getProjectKey,
|
|
46
|
+
isMemoryExpired,
|
|
47
|
+
isMemoryStale,
|
|
48
|
+
isMemoryVisibleInProject,
|
|
49
|
+
listMemoryEntries,
|
|
50
|
+
listOrphanedProjectMemories,
|
|
51
|
+
loadMemoryEntries,
|
|
52
|
+
memoryMarkdownPath,
|
|
53
|
+
memoryStorePath,
|
|
54
|
+
parseWritableScope,
|
|
55
|
+
rebindMemoryProject,
|
|
56
|
+
renderMemoryMarkdown,
|
|
57
|
+
restoreMemoryEntries,
|
|
58
|
+
searchPersistentMemories,
|
|
59
|
+
syncLegacyMarkdown,
|
|
60
|
+
touchMemoryReferences,
|
|
61
|
+
updateMemoryApproval,
|
|
62
|
+
updateMemoryEntry
|
|
63
|
+
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
countSeverity,
|
|
4
4
|
runCi
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-QNK7GUUB.js";
|
|
6
|
+
import "./chunk-DJGCG7SF.js";
|
|
7
7
|
import {
|
|
8
8
|
buildReviewPrompt,
|
|
9
9
|
buildSecurityReviewPrompt,
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
ProviderRegistry
|
|
14
14
|
} from "./chunk-QYQI7ZWK.js";
|
|
15
|
-
import "./chunk-O3XSFPYH.js";
|
|
16
15
|
import {
|
|
17
16
|
ConfigManager
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-X73Y4JZI.js";
|
|
18
|
+
import "./chunk-O3XSFPYH.js";
|
|
19
19
|
import "./chunk-5ULLIOVC.js";
|
|
20
20
|
import {
|
|
21
21
|
VERSION
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-66CE3E6X.js";
|
|
23
23
|
import "./chunk-IW3Q7AE5.js";
|
|
24
24
|
|
|
25
25
|
// src/cli/pr.ts
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import "./chunk-3ARPAVNV.js";
|
|
8
8
|
import {
|
|
9
9
|
persistDiscussion
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DT77O33T.js";
|
|
11
11
|
import {
|
|
12
12
|
AuthManager,
|
|
13
13
|
TOKEN_EXPIRY_MS
|
|
@@ -23,7 +23,12 @@ import {
|
|
|
23
23
|
scanDirTree,
|
|
24
24
|
scanProject,
|
|
25
25
|
setupProxy
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-H3ARWBYR.js";
|
|
27
|
+
import {
|
|
28
|
+
computeCost,
|
|
29
|
+
formatCost,
|
|
30
|
+
getPricing
|
|
31
|
+
} from "./chunk-E44DTERW.js";
|
|
27
32
|
import {
|
|
28
33
|
buildReviewPrompt,
|
|
29
34
|
buildSecurityReviewPrompt
|
|
@@ -31,7 +36,6 @@ import {
|
|
|
31
36
|
import {
|
|
32
37
|
ToolExecutor,
|
|
33
38
|
ToolRegistry,
|
|
34
|
-
addMemoryEntry,
|
|
35
39
|
askUserContext,
|
|
36
40
|
checkNetworkPolicy,
|
|
37
41
|
checkPermissionWithProfile,
|
|
@@ -39,21 +43,14 @@ import {
|
|
|
39
43
|
clearBashSession,
|
|
40
44
|
clearRecentlyDeniedAutoActions,
|
|
41
45
|
defaultActionClassifier,
|
|
42
|
-
deleteMemoryEntry,
|
|
43
46
|
estimateTokens,
|
|
44
|
-
expireMemoryEntry,
|
|
45
|
-
exportMemoryEntries,
|
|
46
|
-
formatMemoryForPrompt,
|
|
47
47
|
formatPermissionProfileWarning,
|
|
48
48
|
getPreferredAgentName,
|
|
49
49
|
getRecentlyDeniedAutoActions,
|
|
50
50
|
googleSearchContext,
|
|
51
51
|
groupCallsByPhase,
|
|
52
|
-
isMemoryExpired,
|
|
53
52
|
listAgentConfigs,
|
|
54
53
|
listAgentRuns,
|
|
55
|
-
listMemoryEntries,
|
|
56
|
-
memoryStorePath,
|
|
57
54
|
recordRecentlyDeniedAutoAction,
|
|
58
55
|
renderDiff,
|
|
59
56
|
requestAgentStop,
|
|
@@ -65,9 +62,22 @@ import {
|
|
|
65
62
|
setPreferredAgentName,
|
|
66
63
|
spawnAgentContext,
|
|
67
64
|
truncateOutput,
|
|
68
|
-
undoStack
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
undoStack
|
|
66
|
+
} from "./chunk-KILKF2VN.js";
|
|
67
|
+
import {
|
|
68
|
+
addMemoryEntry,
|
|
69
|
+
clearMemoryEntries,
|
|
70
|
+
deleteMemoryEntry,
|
|
71
|
+
expireMemoryEntry,
|
|
72
|
+
exportMemoryEntries,
|
|
73
|
+
formatMemoryForPrompt,
|
|
74
|
+
isMemoryExpired,
|
|
75
|
+
listMemoryEntries,
|
|
76
|
+
memoryStorePath,
|
|
77
|
+
parseWritableScope,
|
|
78
|
+
updateMemoryApproval,
|
|
79
|
+
updateMemoryEntry
|
|
80
|
+
} from "./chunk-TY4FSEZS.js";
|
|
71
81
|
import "./chunk-K3CF65QH.js";
|
|
72
82
|
import "./chunk-UUSRWSSX.js";
|
|
73
83
|
import "./chunk-CKH4KQ4E.js";
|
|
@@ -75,20 +85,18 @@ import "./chunk-BXP6YZ2P.js";
|
|
|
75
85
|
import {
|
|
76
86
|
SessionManager,
|
|
77
87
|
getContentText
|
|
78
|
-
} from "./chunk-
|
|
79
|
-
import {
|
|
80
|
-
computeCost,
|
|
81
|
-
formatCost,
|
|
82
|
-
getPricing
|
|
83
|
-
} from "./chunk-E44DTERW.js";
|
|
88
|
+
} from "./chunk-KWQKQVPH.js";
|
|
84
89
|
import {
|
|
85
90
|
buildDoctorReport,
|
|
86
91
|
formatDoctorReport,
|
|
87
92
|
loadContextFiles
|
|
88
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-HNJX3N2V.js";
|
|
89
94
|
import {
|
|
90
95
|
ProviderRegistry
|
|
91
96
|
} from "./chunk-QYQI7ZWK.js";
|
|
97
|
+
import {
|
|
98
|
+
ConfigManager
|
|
99
|
+
} from "./chunk-X73Y4JZI.js";
|
|
92
100
|
import {
|
|
93
101
|
describePlugin,
|
|
94
102
|
getActivePluginAssets,
|
|
@@ -103,7 +111,7 @@ import {
|
|
|
103
111
|
runTool,
|
|
104
112
|
setPluginEnabled,
|
|
105
113
|
trustPlugin
|
|
106
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-EMFCHE2B.js";
|
|
107
115
|
import {
|
|
108
116
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
109
117
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -120,9 +128,6 @@ import {
|
|
|
120
128
|
stripToolCallReminder,
|
|
121
129
|
teeStreamErrorSummary
|
|
122
130
|
} from "./chunk-O3XSFPYH.js";
|
|
123
|
-
import {
|
|
124
|
-
ConfigManager
|
|
125
|
-
} from "./chunk-IV6GCDVR.js";
|
|
126
131
|
import "./chunk-5ULLIOVC.js";
|
|
127
132
|
import {
|
|
128
133
|
formatGitContextForPrompt,
|
|
@@ -130,7 +135,7 @@ import {
|
|
|
130
135
|
getGitRoot
|
|
131
136
|
} from "./chunk-HOSJZMQS.js";
|
|
132
137
|
import "./chunk-4BKXL7SM.js";
|
|
133
|
-
import "./chunk-
|
|
138
|
+
import "./chunk-L5IRDRWG.js";
|
|
134
139
|
import {
|
|
135
140
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
136
141
|
AUTHOR,
|
|
@@ -140,19 +145,19 @@ import {
|
|
|
140
145
|
DEFAULT_MAX_TOOL_ROUNDS,
|
|
141
146
|
DESCRIPTION,
|
|
142
147
|
MCP_PROJECT_CONFIG_NAME,
|
|
143
|
-
MEMORY_FILE_NAME,
|
|
144
148
|
PLAN_MODE_READONLY_TOOLS,
|
|
145
149
|
PLAN_MODE_SYSTEM_ADDON,
|
|
146
150
|
PLUGINS_DIR_NAME,
|
|
147
151
|
SKILLS_DIR_NAME,
|
|
148
152
|
VERSION,
|
|
149
153
|
buildUserIdentityPrompt
|
|
150
|
-
} from "./chunk-
|
|
151
|
-
import "./chunk-
|
|
154
|
+
} from "./chunk-66CE3E6X.js";
|
|
155
|
+
import "./chunk-IGPFYNZA.js";
|
|
152
156
|
import "./chunk-KHYD3WXE.js";
|
|
157
|
+
import "./chunk-PJ3ONBWZ.js";
|
|
153
158
|
import {
|
|
154
159
|
scanString
|
|
155
|
-
} from "./chunk-
|
|
160
|
+
} from "./chunk-B5TYJO7V.js";
|
|
156
161
|
import {
|
|
157
162
|
atomicWriteFileSync
|
|
158
163
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -633,7 +638,7 @@ Working directory: ${process.cwd()}`;
|
|
|
633
638
|
}
|
|
634
639
|
stableParts.push(AGENTIC_BEHAVIOR_GUIDELINE);
|
|
635
640
|
if (ctx.configDir) {
|
|
636
|
-
const memory = loadMemoryContent(ctx.configDir);
|
|
641
|
+
const memory = loadMemoryContent(ctx.configDir, ctx.memoryMaxChars);
|
|
637
642
|
if (memory) stableParts.push(`# Persistent Memory
|
|
638
643
|
|
|
639
644
|
${memory.content}`);
|
|
@@ -665,13 +670,13 @@ ${ctx.activeSkill.content}`);
|
|
|
665
670
|
if (ctx.planMode) stableParts.push(PLAN_MODE_SYSTEM_ADDON);
|
|
666
671
|
return { stable: stableParts.join("\n\n---\n\n"), volatile };
|
|
667
672
|
}
|
|
668
|
-
function loadMemoryContent(configDir) {
|
|
669
|
-
return formatMemoryForPrompt(configDir, process.cwd());
|
|
673
|
+
function loadMemoryContent(configDir, maxChars) {
|
|
674
|
+
return formatMemoryForPrompt(configDir, process.cwd(), maxChars);
|
|
670
675
|
}
|
|
671
676
|
|
|
672
677
|
// src/web/session-handler.ts
|
|
673
678
|
import { mkdirSync as mkdirSync2, createWriteStream as createWriteStream2 } from "fs";
|
|
674
|
-
import {
|
|
679
|
+
import { dirname as dirname2 } from "path";
|
|
675
680
|
|
|
676
681
|
// src/web/commands/provider-commands.ts
|
|
677
682
|
async function handleProvider(args, ctx) {
|
|
@@ -796,12 +801,20 @@ async function handleStatus(_args, ctx) {
|
|
|
796
801
|
Cache: write=${cacheCreate} read=${cacheRead}` : "";
|
|
797
802
|
const costLine = cost != null ? `
|
|
798
803
|
Cost: ${formatCost(cost)}` : "";
|
|
804
|
+
let memoryLine = "";
|
|
805
|
+
try {
|
|
806
|
+
const { countPendingMemories } = await import("./persistent-memory-VFBRMKGG.js");
|
|
807
|
+
const pending = countPendingMemories(ctx.config.getConfigDir());
|
|
808
|
+
if (pending > 0) memoryLine = `
|
|
809
|
+
Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
|
|
810
|
+
} catch {
|
|
811
|
+
}
|
|
799
812
|
ctx.send({
|
|
800
813
|
type: "info",
|
|
801
814
|
message: `Provider: ${ctx.currentProvider}
|
|
802
815
|
Model: ${ctx.currentModel}
|
|
803
816
|
Session: ${session?.id ?? "none"} (${session?.messages.length ?? 0} messages)
|
|
804
|
-
Tokens: in=${ctx.sessionTokenUsage.inputTokens} out=${ctx.sessionTokenUsage.outputTokens}${cacheLine}${costLine}`
|
|
817
|
+
Tokens: in=${ctx.sessionTokenUsage.inputTokens} out=${ctx.sessionTokenUsage.outputTokens}${cacheLine}${costLine}${memoryLine}`
|
|
805
818
|
});
|
|
806
819
|
}
|
|
807
820
|
async function handleSession(args, ctx) {
|
|
@@ -1599,7 +1612,7 @@ async function handleSecurityReview(args, ctx) {
|
|
|
1599
1612
|
async function handleTest(args, ctx) {
|
|
1600
1613
|
ctx.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
1601
1614
|
try {
|
|
1602
|
-
const { executeTests } = await import("./run-tests-
|
|
1615
|
+
const { executeTests } = await import("./run-tests-BMH6QJN2.js");
|
|
1603
1616
|
const argStr = args.join(" ").trim();
|
|
1604
1617
|
let testArgs = {};
|
|
1605
1618
|
if (argStr) {
|
|
@@ -1830,9 +1843,58 @@ async function handleIndex(args, ctx) {
|
|
|
1830
1843
|
async function handleMemory(args, ctx) {
|
|
1831
1844
|
const sub = args[0];
|
|
1832
1845
|
if (sub === "add" && args.length > 1) {
|
|
1833
|
-
|
|
1846
|
+
const rest = args.slice(1);
|
|
1847
|
+
const opts = {};
|
|
1848
|
+
const text = [];
|
|
1849
|
+
for (let i = 0; i < rest.length; i++) {
|
|
1850
|
+
if (rest[i] === "--scope" && rest[i + 1]) {
|
|
1851
|
+
opts.scope = rest[++i];
|
|
1852
|
+
} else if (rest[i] === "--sensitivity" && rest[i + 1]) {
|
|
1853
|
+
opts.sensitivity = rest[++i];
|
|
1854
|
+
} else if (rest[i] === "--expires-at" && rest[i + 1]) {
|
|
1855
|
+
opts.expiresAt = rest[++i];
|
|
1856
|
+
} else text.push(rest[i]);
|
|
1857
|
+
}
|
|
1858
|
+
if (text.length === 0) {
|
|
1859
|
+
ctx.send({ type: "info", message: "Usage: /memory add [--scope personal|project] [--sensitivity low|medium|high] [--expires-at ISO] <text>" });
|
|
1860
|
+
return;
|
|
1861
|
+
}
|
|
1862
|
+
ctx.memoryAdd(text.join(" "), opts);
|
|
1863
|
+
} else if (sub === "edit") {
|
|
1864
|
+
const id = args[1];
|
|
1865
|
+
const text = args.slice(2).join(" ").trim();
|
|
1866
|
+
if (!id || !text) {
|
|
1867
|
+
ctx.send({ type: "info", message: "Usage: /memory edit <id> <new text>" });
|
|
1868
|
+
return;
|
|
1869
|
+
}
|
|
1870
|
+
ctx.memoryEdit(id, text);
|
|
1871
|
+
} else if (sub === "approve" || sub === "reject" || sub === "delete" || sub === "expire") {
|
|
1872
|
+
if (!args[1]) {
|
|
1873
|
+
ctx.send({ type: "info", message: `Usage: /memory ${sub} <id>` });
|
|
1874
|
+
return;
|
|
1875
|
+
}
|
|
1876
|
+
ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
|
|
1877
|
+
} else if (sub === "export") {
|
|
1878
|
+
if (args[1] === "md") {
|
|
1879
|
+
const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-VFBRMKGG.js");
|
|
1880
|
+
ctx.send({
|
|
1881
|
+
type: "export_data",
|
|
1882
|
+
format: "md",
|
|
1883
|
+
filename: `aicli-memory-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}.md`,
|
|
1884
|
+
content: exportMemoryEntries2(ctx.config.getConfigDir(), process.cwd(), "md")
|
|
1885
|
+
});
|
|
1886
|
+
} else {
|
|
1887
|
+
ctx.handleMemoryManage("export");
|
|
1888
|
+
}
|
|
1834
1889
|
} else if (sub === "clear") {
|
|
1835
|
-
|
|
1890
|
+
if (args[1] === "confirm") {
|
|
1891
|
+
ctx.memoryClear();
|
|
1892
|
+
} else {
|
|
1893
|
+
ctx.send({
|
|
1894
|
+
type: "info",
|
|
1895
|
+
message: "\u26A0 This permanently clears ALL persistent memory (a timestamped .bak backup is kept next to memory.jsonl).\nRun `/memory clear confirm` to proceed, or manage individual entries in the Memory panel."
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1836
1898
|
} else {
|
|
1837
1899
|
ctx.memoryShow();
|
|
1838
1900
|
}
|
|
@@ -3378,7 +3440,11 @@ ${summaryContent}`,
|
|
|
3378
3440
|
const entries = listMemoryEntries(configDir, { includeExpired: true, includeRejected: true });
|
|
3379
3441
|
const content = entries.length === 0 ? "(empty \u2014 no persistent memory entries yet)" : entries.map((entry) => {
|
|
3380
3442
|
const status = isMemoryExpired(entry) ? "expired" : entry.approved ? "approved" : "pending";
|
|
3381
|
-
const source =
|
|
3443
|
+
const source = [
|
|
3444
|
+
entry.source ?? "unknown",
|
|
3445
|
+
entry.sourceSession ? `session ${entry.sourceSession.slice(0, 8)}` : "",
|
|
3446
|
+
entry.sourceProject ? `project ${entry.sourceProject}` : ""
|
|
3447
|
+
].filter(Boolean).join(" \xB7 ");
|
|
3382
3448
|
return `## ${entry.id.slice(0, 8)} \xB7 ${status} \xB7 scope:${entry.scope} \xB7 sensitivity:${entry.sensitivity}
|
|
3383
3449
|
Source: ${source}
|
|
3384
3450
|
${entry.content}`;
|
|
@@ -3390,26 +3456,41 @@ ${entry.content}`;
|
|
|
3390
3456
|
});
|
|
3391
3457
|
this.sendMemoryEntries();
|
|
3392
3458
|
}
|
|
3393
|
-
memoryAdd(text) {
|
|
3459
|
+
memoryAdd(text, opts) {
|
|
3460
|
+
const asSensitivity = (v) => v === "low" || v === "medium" || v === "high" ? v : void 0;
|
|
3394
3461
|
try {
|
|
3395
3462
|
const entry = addMemoryEntry(this.config.getConfigDir(), text, {
|
|
3396
|
-
scope: "personal",
|
|
3463
|
+
scope: parseWritableScope(opts?.scope) ?? "personal",
|
|
3464
|
+
source: "manual",
|
|
3465
|
+
sensitivity: asSensitivity(opts?.sensitivity),
|
|
3466
|
+
expiresAt: opts?.expiresAt,
|
|
3397
3467
|
cwd: process.cwd(),
|
|
3398
3468
|
redact: true
|
|
3399
3469
|
});
|
|
3400
3470
|
const status = entry.approved ? "approved" : "pending approval";
|
|
3401
|
-
this.send({ type: "info", message: `\u{1F4DD} Memory entry ${entry.id.slice(0, 8)} added (${status}).` });
|
|
3471
|
+
this.send({ type: "info", message: `\u{1F4DD} Memory entry ${entry.id.slice(0, 8)} added (${status}, scope:${entry.scope}).` });
|
|
3402
3472
|
this.sendMemoryEntries();
|
|
3403
3473
|
} catch (err) {
|
|
3404
3474
|
this.send({ type: "error", message: `Failed to write memory: ${err.message}` });
|
|
3405
3475
|
}
|
|
3406
3476
|
}
|
|
3477
|
+
memoryEdit(id, text) {
|
|
3478
|
+
try {
|
|
3479
|
+
const entry = updateMemoryEntry(this.config.getConfigDir(), id, text, { source: "manual", redact: true });
|
|
3480
|
+
const status = entry.approved ? "approved" : `pending approval \u2014 approve it in the Memory panel or /memory approve ${entry.id.slice(0, 8)}`;
|
|
3481
|
+
this.send({ type: "info", message: `\u{1F4DD} Memory ${entry.id.slice(0, 8)} updated (${status}).` });
|
|
3482
|
+
this.sendMemoryEntries();
|
|
3483
|
+
} catch (err) {
|
|
3484
|
+
this.send({ type: "error", message: `Failed to update memory: ${err.message}` });
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
3407
3487
|
memoryClear() {
|
|
3408
3488
|
const configDir = this.config.getConfigDir();
|
|
3409
3489
|
try {
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3490
|
+
const result = clearMemoryEntries(configDir);
|
|
3491
|
+
const backupNote = result.backupPath ? `
|
|
3492
|
+
Backup saved: ${result.backupPath}` : "";
|
|
3493
|
+
this.send({ type: "info", message: `\u{1F5D1}\uFE0F Persistent memory cleared (${result.cleared} entries).${backupNote}` });
|
|
3413
3494
|
this.sendMemoryEntries();
|
|
3414
3495
|
} catch (err) {
|
|
3415
3496
|
this.send({ type: "error", message: `Failed to clear memory: ${err.message}` });
|
|
@@ -3425,6 +3506,7 @@ ${entry.content}`;
|
|
|
3425
3506
|
id: entry.id,
|
|
3426
3507
|
content: entry.content,
|
|
3427
3508
|
scope: entry.scope,
|
|
3509
|
+
source: entry.source,
|
|
3428
3510
|
sourceSession: entry.sourceSession,
|
|
3429
3511
|
sourceProject: entry.sourceProject,
|
|
3430
3512
|
createdAt: entry.createdAt,
|
|
@@ -3474,7 +3556,7 @@ ${entry.content}`;
|
|
|
3474
3556
|
return;
|
|
3475
3557
|
}
|
|
3476
3558
|
try {
|
|
3477
|
-
const { searchChatMemory, loadChatIndex } = await import("./chat-index-
|
|
3559
|
+
const { searchChatMemory, loadChatIndex } = await import("./chat-index-ALUHFJKI.js");
|
|
3478
3560
|
const loaded = loadChatIndex();
|
|
3479
3561
|
if (!loaded || loaded.idx.chunks.length === 0) {
|
|
3480
3562
|
this.send({ type: "memory_hits", query: q, hits: [], indexMissing: true });
|
|
@@ -3510,7 +3592,7 @@ ${entry.content}`;
|
|
|
3510
3592
|
}
|
|
3511
3593
|
async handleMemoryStatus() {
|
|
3512
3594
|
try {
|
|
3513
|
-
const { getChatIndexStatus } = await import("./chat-index-
|
|
3595
|
+
const { getChatIndexStatus } = await import("./chat-index-ALUHFJKI.js");
|
|
3514
3596
|
const s = getChatIndexStatus();
|
|
3515
3597
|
this.send({
|
|
3516
3598
|
type: "memory_status",
|
|
@@ -3535,7 +3617,7 @@ ${entry.content}`;
|
|
|
3535
3617
|
type: "info",
|
|
3536
3618
|
message: full ? "\u{1F9E0} Rebuilding chat memory index (this may take a while on first run \u2014 ~117 MB embedder)." : "\u{1F9E0} Refreshing chat memory index (incremental)\u2026"
|
|
3537
3619
|
});
|
|
3538
|
-
const { buildChatIndex } = await import("./chat-index-
|
|
3620
|
+
const { buildChatIndex } = await import("./chat-index-ALUHFJKI.js");
|
|
3539
3621
|
const stats = await buildChatIndex({
|
|
3540
3622
|
full,
|
|
3541
3623
|
onProgress: (p) => {
|
|
@@ -3609,6 +3691,7 @@ ${entry.content}`;
|
|
|
3609
3691
|
activeSkill,
|
|
3610
3692
|
planMode: this.planMode,
|
|
3611
3693
|
configDir: this.config.getConfigDir(),
|
|
3694
|
+
memoryMaxChars: this.config.get("memory")?.maxChars,
|
|
3612
3695
|
userProfile: this.config.get("userProfile")
|
|
3613
3696
|
});
|
|
3614
3697
|
let stable = baseStable;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ToolRegistry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KILKF2VN.js";
|
|
5
|
+
import "./chunk-TY4FSEZS.js";
|
|
5
6
|
import "./chunk-K3CF65QH.js";
|
|
6
7
|
import "./chunk-UUSRWSSX.js";
|
|
7
8
|
import "./chunk-CKH4KQ4E.js";
|
|
8
9
|
import "./chunk-BXP6YZ2P.js";
|
|
9
10
|
import {
|
|
10
11
|
runTool
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EMFCHE2B.js";
|
|
12
13
|
import {
|
|
13
14
|
getDangerLevel,
|
|
14
15
|
schemaToJsonSchema
|
|
@@ -16,13 +17,14 @@ import {
|
|
|
16
17
|
import "./chunk-5ULLIOVC.js";
|
|
17
18
|
import "./chunk-HOSJZMQS.js";
|
|
18
19
|
import "./chunk-4BKXL7SM.js";
|
|
19
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-L5IRDRWG.js";
|
|
20
21
|
import {
|
|
21
22
|
VERSION
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-66CE3E6X.js";
|
|
24
|
+
import "./chunk-IGPFYNZA.js";
|
|
24
25
|
import "./chunk-KHYD3WXE.js";
|
|
25
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-PJ3ONBWZ.js";
|
|
27
|
+
import "./chunk-B5TYJO7V.js";
|
|
26
28
|
import "./chunk-IW3Q7AE5.js";
|
|
27
29
|
|
|
28
30
|
// src/mcp/server.ts
|
|
@@ -3,14 +3,15 @@ import {
|
|
|
3
3
|
ToolRegistry,
|
|
4
4
|
googleSearchContext,
|
|
5
5
|
truncateOutput
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KILKF2VN.js";
|
|
7
|
+
import "./chunk-TY4FSEZS.js";
|
|
7
8
|
import "./chunk-K3CF65QH.js";
|
|
8
9
|
import "./chunk-UUSRWSSX.js";
|
|
9
10
|
import "./chunk-CKH4KQ4E.js";
|
|
10
11
|
import "./chunk-BXP6YZ2P.js";
|
|
11
12
|
import {
|
|
12
13
|
runTool
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-EMFCHE2B.js";
|
|
14
15
|
import {
|
|
15
16
|
getDangerLevel,
|
|
16
17
|
runLeanAgentLoop
|
|
@@ -18,13 +19,14 @@ import {
|
|
|
18
19
|
import "./chunk-5ULLIOVC.js";
|
|
19
20
|
import "./chunk-HOSJZMQS.js";
|
|
20
21
|
import "./chunk-4BKXL7SM.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-L5IRDRWG.js";
|
|
22
23
|
import {
|
|
23
24
|
SUBAGENT_ALLOWED_TOOLS
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-66CE3E6X.js";
|
|
26
|
+
import "./chunk-IGPFYNZA.js";
|
|
26
27
|
import "./chunk-KHYD3WXE.js";
|
|
27
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-PJ3ONBWZ.js";
|
|
29
|
+
import "./chunk-B5TYJO7V.js";
|
|
28
30
|
import {
|
|
29
31
|
atomicWriteFileSync
|
|
30
32
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
} from "./chunk-E44DTERW.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigManager
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-X73Y4JZI.js";
|
|
12
12
|
import "./chunk-5ULLIOVC.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-66CE3E6X.js";
|
|
14
14
|
import "./chunk-IW3Q7AE5.js";
|
|
15
15
|
|
|
16
16
|
// src/cli/usage.ts
|