march-cli 0.1.0 → 0.1.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "march-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "March CLI — terminal-native coding agent with context reconstruction",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/main.mjs",
|
|
@@ -18,12 +18,14 @@
|
|
|
18
18
|
"test:shell-runtime-real": "node test/shell-real-runtime.acceptance.mjs",
|
|
19
19
|
"test:shell-tui-real": "node test/shell-tui-real.acceptance.mjs",
|
|
20
20
|
"test:tui-key-real": "node test/tui-key-real.acceptance.mjs",
|
|
21
|
-
"context": "cd .. && node march-cli/bin/march.mjs --dump-context"
|
|
21
|
+
"context": "cd .. && node march-cli/bin/march.mjs --dump-context",
|
|
22
|
+
"publish:env": "node scripts/npm-publish-from-env.mjs"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"@earendil-works/pi-ai": "^0.74.0",
|
|
25
26
|
"@earendil-works/pi-coding-agent": "^0.74.0",
|
|
26
27
|
"@earendil-works/pi-tui": "^0.74.0",
|
|
28
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
27
29
|
"@xterm/headless": "^5.5.0",
|
|
28
30
|
"marked": "^18.0.3",
|
|
29
31
|
"node-pty": "^1.1.0",
|
|
@@ -24,12 +24,11 @@ export async function runRunnerTurn({
|
|
|
24
24
|
|
|
25
25
|
const unsubscribe = activeSession.subscribe((event) => {
|
|
26
26
|
handleRunnerSessionEvent(event, { ui, engine, state: turnState });
|
|
27
|
-
if (event.type === "
|
|
28
|
-
const hints =
|
|
27
|
+
if (event.type === "tool_execution_start") {
|
|
28
|
+
const hints = flushAssistantRecall({ memoryStore, engine, turnState, currentProject });
|
|
29
29
|
if (hints.length > 0) {
|
|
30
30
|
midTurnRecallHints.push(...hints);
|
|
31
31
|
onMidTurnRecallHints?.(hints);
|
|
32
|
-
ui.memoryHint?.({ source: "assistant", hints });
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
});
|
|
@@ -51,9 +50,9 @@ export async function runRunnerTurn({
|
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
closeAssistantReply({ ui, state: turnState });
|
|
54
|
-
const assistantRecallHints =
|
|
55
|
-
ui.memoryHint?.({ source: "assistant", hints: assistantRecallHints });
|
|
53
|
+
const assistantRecallHints = flushAssistantRecall({ memoryStore, engine, turnState, currentProject });
|
|
56
54
|
const recordedAssistantRecallHints = uniqueHints([...midTurnRecallHints, ...assistantRecallHints]);
|
|
55
|
+
ui.memoryHint?.({ source: "assistant", hints: recordedAssistantRecallHints });
|
|
57
56
|
|
|
58
57
|
engine.recordTurn({
|
|
59
58
|
userMessage: userMessage ?? prompt.slice(0, 300),
|
|
@@ -71,20 +70,39 @@ export async function runRunnerTurn({
|
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
|
|
74
|
-
function
|
|
73
|
+
function flushAssistantRecall({ memoryStore, engine, turnState, currentProject }) {
|
|
75
74
|
if (!memoryStore) return [];
|
|
76
|
-
|
|
75
|
+
const text = assistantRecallDeltaText(turnState);
|
|
76
|
+
advanceAssistantRecallCursor(turnState);
|
|
77
|
+
if (!text.trim()) return [];
|
|
78
|
+
return memoryStore.recallForAssistant(text, {
|
|
77
79
|
currentProject,
|
|
78
80
|
excludedIds: engine.getRecentRecallMemoryIds?.() ?? [],
|
|
79
81
|
});
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
+
function assistantRecallDeltaText(turnState) {
|
|
85
|
+
const cursor = turnState.recallCursor ?? { draftLength: 0, thinkingLength: 0 };
|
|
86
|
+
const thinking = assistantThinkingText(turnState);
|
|
87
|
+
return [
|
|
88
|
+
turnState.draft.slice(cursor.draftLength),
|
|
89
|
+
thinking.slice(cursor.thinkingLength),
|
|
90
|
+
]
|
|
84
91
|
.filter(Boolean)
|
|
85
92
|
.join("\n");
|
|
86
93
|
}
|
|
87
94
|
|
|
95
|
+
function advanceAssistantRecallCursor(turnState) {
|
|
96
|
+
turnState.recallCursor = {
|
|
97
|
+
draftLength: turnState.draft.length,
|
|
98
|
+
thinkingLength: assistantThinkingText(turnState).length,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function assistantThinkingText(turnState) {
|
|
103
|
+
return `${turnState.thinkingAccumulator}${turnState.thinkingText}`;
|
|
104
|
+
}
|
|
105
|
+
|
|
88
106
|
function uniqueHints(hints) {
|
|
89
107
|
const seen = new Set();
|
|
90
108
|
const unique = [];
|