march-cli 0.1.16 → 0.1.17
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
package/src/agent/runner.mjs
CHANGED
|
@@ -5,8 +5,7 @@ import { createMarchLifecycleAdapter } from "../extensions/lifecycle-adapter.mjs
|
|
|
5
5
|
import { syncPiSessionSidecar } from "../session/sidecar-sync.mjs";
|
|
6
6
|
import { LspService } from "../lsp/service.mjs";
|
|
7
7
|
import { formatLspServiceEvent } from "../lsp/status-message.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import { appendProviderUserMessage, estimateProviderPayloadTokens, installModelPayloadDumper, replaceProviderContextMessages } from "./model-payload-dumper.mjs";
|
|
8
|
+
import { estimateProviderPayloadTokens, installModelPayloadDumper, replaceProviderContextMessages } from "./model-payload-dumper.mjs";
|
|
10
9
|
import { resolveInitialModel, resolveRunnerSessionManager } from "./runner/runner-init.mjs";
|
|
11
10
|
import { runRunnerCleanup } from "./runner/runner-cleanup.mjs";
|
|
12
11
|
import { createRunnerRuntimeHost } from "./runtime/runner-runtime-host.mjs";
|
|
@@ -55,7 +54,6 @@ export async function createRunner({ cwd, modelId = null, provider = null, provi
|
|
|
55
54
|
let currentModelCallKind = "model", currentTurnId = null, currentPromptForContext = "";
|
|
56
55
|
let currentTurnContextMode = "rebuild";
|
|
57
56
|
let nextTurnContextMode = "rebuild";
|
|
58
|
-
let pendingMidTurnRecallHints = [];
|
|
59
57
|
let lastNotificationResult = null, runtimeHost = null, lifecycleAdapter = null;
|
|
60
58
|
let _currentFastEntry = null;
|
|
61
59
|
if (useRuntimeHost) {
|
|
@@ -111,7 +109,6 @@ export async function createRunner({ cwd, modelId = null, provider = null, provi
|
|
|
111
109
|
const contextMode = nextTurnContextMode;
|
|
112
110
|
currentTurnContextMode = contextMode;
|
|
113
111
|
nextTurnContextMode = "rebuild";
|
|
114
|
-
pendingMidTurnRecallHints = [];
|
|
115
112
|
const turnStartedAt = Date.now();
|
|
116
113
|
const turnLog = beginLoggedTurn({ logger, engine, modelId, provider, contextMode, userMessage, userRecallHints, startedAt: turnStartedAt }); currentTurnId = turnLog.turnId;
|
|
117
114
|
try {
|
|
@@ -121,7 +118,6 @@ export async function createRunner({ cwd, modelId = null, provider = null, provi
|
|
|
121
118
|
setModelCallKind: (kind) => { currentModelCallKind = kind; },
|
|
122
119
|
logger: turnLog.logger,
|
|
123
120
|
setPhase: turnLog.setPhase,
|
|
124
|
-
onMidTurnRecallHints: (hints) => { pendingMidTurnRecallHints.push(...hints); },
|
|
125
121
|
syncCurrentPiSidecar,
|
|
126
122
|
autoNameSession,
|
|
127
123
|
contextMode,
|
|
@@ -289,10 +285,6 @@ export async function createRunner({ cwd, modelId = null, provider = null, provi
|
|
|
289
285
|
: replaceProviderContextMessages(payload, engine.buildProviderContext(currentPromptForContext));
|
|
290
286
|
nextPayload = injectHostedTools(nextPayload, model, hostedTools);
|
|
291
287
|
if (_currentFastEntry) nextPayload = { ...nextPayload, service_tier: "priority" };
|
|
292
|
-
if (pendingMidTurnRecallHints.length > 0) {
|
|
293
|
-
nextPayload = appendProviderUserMessage(nextPayload, formatRecallHints("assistant", pendingMidTurnRecallHints));
|
|
294
|
-
pendingMidTurnRecallHints = [];
|
|
295
|
-
}
|
|
296
288
|
return nextPayload;
|
|
297
289
|
}
|
|
298
290
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatRecallHints } from "../../memory/markdown-store.mjs";
|
|
1
2
|
import { resolveImageAttachmentReferences } from "../../session/attachment-references.mjs";
|
|
2
3
|
import { closeAssistantReply, compactAssistantContext, createTurnEventState, handleRunnerSessionEvent } from "./turn-events.mjs";
|
|
3
4
|
|
|
@@ -13,7 +14,6 @@ export async function runRunnerTurn({
|
|
|
13
14
|
setModelCallKind,
|
|
14
15
|
logger = null,
|
|
15
16
|
setPhase = null,
|
|
16
|
-
onMidTurnRecallHints,
|
|
17
17
|
syncCurrentPiSidecar,
|
|
18
18
|
autoNameSession,
|
|
19
19
|
contextMode = "rebuild",
|
|
@@ -41,7 +41,7 @@ export async function runRunnerTurn({
|
|
|
41
41
|
const hints = flushAssistantRecall({ memoryStore, engine, turnState, currentProject });
|
|
42
42
|
if (hints.length > 0) {
|
|
43
43
|
midTurnRecallHints.push(...hints);
|
|
44
|
-
|
|
44
|
+
queueMidTurnRecallHints(activeSession, hints, logger);
|
|
45
45
|
ui.memoryHint?.({ source: "assistant", hints });
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -89,6 +89,20 @@ export async function runRunnerTurn({
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
function queueMidTurnRecallHints(session, hints, logger) {
|
|
93
|
+
const content = formatRecallHints("assistant", hints);
|
|
94
|
+
if (!content) return;
|
|
95
|
+
const injected = session.sendCustomMessage?.({
|
|
96
|
+
customType: "march.memory_hint",
|
|
97
|
+
content,
|
|
98
|
+
display: false,
|
|
99
|
+
details: { source: "assistant" },
|
|
100
|
+
}, { deliverAs: "steer" });
|
|
101
|
+
void injected?.catch?.((err) => {
|
|
102
|
+
logger?.debug("memory.mid_turn_recall.inject_failed", { errorMessage: err?.message ?? String(err) });
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
92
106
|
function logSessionEvent(logger, event) {
|
|
93
107
|
if (!logger) return;
|
|
94
108
|
if (event.type === "message_update") {
|