march-cli 0.1.27 → 0.1.29
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 +1 -1
- package/src/agent/runner.mjs +1 -1
- package/src/agent/runtime/remote-ui-client.mjs +1 -1
- package/src/agent/runtime/runner-runtime-host.mjs +1 -0
- package/src/agent/runtime/ui-event-bridge.mjs +2 -2
- package/src/agent/session/session-options.mjs +2 -1
- package/src/agent/tools.mjs +3 -1
- package/src/agent/turn/turn-runner.mjs +2 -2
- package/src/browser/cli/command.mjs +61 -0
- package/src/browser/cli/open-url.mjs +21 -0
- package/src/browser/client/http.mjs +18 -0
- package/src/browser/client/lifecycle.mjs +57 -0
- package/src/browser/client/rpc.mjs +8 -0
- package/src/browser/client/state.mjs +35 -0
- package/src/browser/daemon/constants.mjs +3 -0
- package/src/browser/daemon/entry.mjs +28 -0
- package/src/browser/daemon/server.mjs +146 -0
- package/src/browser/extension/background.js +225 -0
- package/src/browser/extension/errors.js +19 -0
- package/src/browser/extension/execute-code.js +53 -0
- package/src/browser/extension/manifest.json +15 -0
- package/src/browser/extension-install.mjs +21 -0
- package/src/browser/tools/index.mjs +89 -0
- package/src/cli/args.mjs +4 -1
- package/src/cli/fallback-ui.mjs +4 -4
- package/src/cli/repl-loop.mjs +5 -5
- package/src/cli/tui/layout/main-pane-layout.mjs +2 -1
- package/src/cli/tui/output/tool-card-renderer.mjs +8 -2
- package/src/cli/tui/recall-rendering.mjs +6 -7
- package/src/cli/tui/status/status-bar.mjs +11 -3
- package/src/cli/tui/tui-input-controller.mjs +2 -1
- package/src/cli/ui.mjs +9 -10
- package/src/context/system-core/base.md +4 -3
- package/src/main.mjs +14 -10
- package/src/memory/markdown/markdown-recall.mjs +1 -1
- package/src/memory/markdown-store.mjs +1 -1
- package/src/memory/markdown-tools.mjs +5 -5
- package/src/memory/root.mjs +7 -0
|
@@ -91,13 +91,14 @@ The user primarily asks for software engineering work: fixing bugs, adding behav
|
|
|
91
91
|
</git_contract>
|
|
92
92
|
|
|
93
93
|
<memory_system>
|
|
94
|
-
- [
|
|
95
|
-
-
|
|
94
|
+
- [recall source="..."] blocks in recent_chat are lightweight recall hints matched from prior thinking output. Treat them as possibly relevant pointers, not as complete facts.
|
|
95
|
+
- A recall hint's description may record key operational constraints, including when the full memory must be opened; factor those constraints into relevance before acting.
|
|
96
|
+
- If a recall hint may help the current task, use memory_open(id) to read the full memory before relying on it. Ignore hints that are clearly unrelated or too low-value for the task.
|
|
96
97
|
- Use memory_search(query) for full-text search across all memories.
|
|
97
98
|
- To edit an existing memory, use memory_open(id) to get its path, then edit_file with mode="patch" for targeted edits.
|
|
98
99
|
- Use memory_save() to create memories or update whole fields. Before creating a new memory, first search/open related memories and merge updates into an existing memory when they share the same topic, project, or decision thread; prefer modifying the existing memory file over creating a scattered new one. Tags are the primary retrieval key for future recall. Prefer lowercase kebab-case tags like 'march-cli', 'tooling', 'permissions'.
|
|
99
100
|
- When learning multiple related external workflows or skills, maintain memory as an evolving domain library: start with the specific source name when only one item exists, then rename and rewrite the memory title/description as the scope grows; merge new related learnings into the same memory, preserving each source's unique traits while distilling reusable principles.
|
|
100
101
|
- Distinguish "migrating a Skill to memory" from "learning a Skill": migration preserves the complete Skill folder under memory_root/skills/ and creates a memory entry as its index; that memory should describe what the Skill is for and reference the copied Skill folder path so future recall knows how to use it. Learning only reads and internalizes the Skill's methods, scenarios, and principles into ordinary memory without copying source files. Infer the action from the user's wording, and ask when ambiguous.
|
|
101
|
-
- Unlike
|
|
102
|
+
- Unlike recall blocks, this system-core center is always visible in every model call. Only update the center for instructions that must always be followed; use memory for contextual, project-specific, or recall-dependent knowledge.
|
|
102
103
|
- If execution takes a meaningful detour, create or update a memory after the task. A detour means the initial plan or assumption failed, multiple approaches were tried, and the final successful path contains reusable project knowledge. Record the failed assumption, what was tried, and the successful approach. Prefer updating an existing related memory over creating a new one.
|
|
103
104
|
</memory_system>
|
package/src/main.mjs
CHANGED
|
@@ -37,6 +37,9 @@ import { registerSuperGrokOAuthProvider } from "./supergrok/oauth-provider.mjs";
|
|
|
37
37
|
import { installNetworkEnvironment } from "./network/environment.mjs";
|
|
38
38
|
import { runMemoryCommand } from "./memory/command.mjs";
|
|
39
39
|
import { normalizeRemoteMemorySources } from "./memory/remote/config.mjs";
|
|
40
|
+
import { resolveMemoryRoot } from "./memory/root.mjs";
|
|
41
|
+
import { runBrowserCommand } from "./browser/cli/command.mjs";
|
|
42
|
+
import { ensureBrowserDaemon } from "./browser/client/lifecycle.mjs";
|
|
40
43
|
export async function run(argv) {
|
|
41
44
|
const cwd = process.cwd();
|
|
42
45
|
loadDotEnv(cwd);
|
|
@@ -49,6 +52,7 @@ export async function run(argv) {
|
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
const config = loadConfig(cwd);
|
|
55
|
+
const stateRoot = join(homedir(), ".march");
|
|
52
56
|
const useRuntimeProcess = process.env.MARCH_RUNTIME_PROCESS !== "0";
|
|
53
57
|
installNetworkEnvironment(config.network);
|
|
54
58
|
if (args.command?.name === "login") {
|
|
@@ -70,11 +74,19 @@ export async function run(argv) {
|
|
|
70
74
|
return 1;
|
|
71
75
|
}
|
|
72
76
|
if (args.command?.name === "memory") {
|
|
73
|
-
args.memoryRoot = resolveMemoryRoot(config.memoryRoot,
|
|
77
|
+
args.memoryRoot = resolveMemoryRoot(config.memoryRoot, stateRoot);
|
|
74
78
|
return await runMemoryCommand(args, { homeDir: homedir() });
|
|
75
79
|
}
|
|
76
|
-
|
|
80
|
+
if (args.command?.name === "browser") {
|
|
81
|
+
try {
|
|
82
|
+
return await runBrowserCommand(args, { stateRoot });
|
|
83
|
+
} catch (err) {
|
|
84
|
+
process.stderr.write(`Error: ${err.message}\n`);
|
|
85
|
+
return 1;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
77
88
|
if (!existsSync(stateRoot)) mkdirSync(stateRoot, { recursive: true });
|
|
89
|
+
await ensureBrowserDaemon({ stateRoot }).catch(() => {});
|
|
78
90
|
const logger = createLogger({ logDir: join(stateRoot, "logs") });
|
|
79
91
|
installProcessLogHandlers(logger);
|
|
80
92
|
logger.event("process.start", {
|
|
@@ -223,7 +235,6 @@ export async function run(argv) {
|
|
|
223
235
|
modeState,
|
|
224
236
|
});
|
|
225
237
|
|
|
226
|
-
|
|
227
238
|
const startupResume = await resumeStartupSession({
|
|
228
239
|
resumeId: args.resume,
|
|
229
240
|
runner,
|
|
@@ -233,7 +244,6 @@ export async function run(argv) {
|
|
|
233
244
|
});
|
|
234
245
|
refreshStatusBar();
|
|
235
246
|
|
|
236
|
-
|
|
237
247
|
if (args.prompt) {
|
|
238
248
|
turnRunning = true;
|
|
239
249
|
try {
|
|
@@ -285,10 +295,4 @@ export async function run(argv) {
|
|
|
285
295
|
return 0;
|
|
286
296
|
}
|
|
287
297
|
|
|
288
|
-
function resolveMemoryRoot(configured, stateRoot) {
|
|
289
|
-
if (configured) return resolve(String(configured));
|
|
290
|
-
if (process.env.MARCH_MEMORY_ROOT) return resolve(process.env.MARCH_MEMORY_ROOT);
|
|
291
|
-
return resolve(stateRoot, "March Memories");
|
|
292
|
-
}
|
|
293
|
-
|
|
294
298
|
if (process.argv[1] === fileURLToPath(import.meta.url)) process.exitCode = await run(process.argv.slice(2));
|
|
@@ -2,7 +2,7 @@ import { expandTags, normalizeText } from "./markdown-format.mjs";
|
|
|
2
2
|
|
|
3
3
|
export function formatRecallHints(source, hints = []) {
|
|
4
4
|
if (!hints.length) return "";
|
|
5
|
-
const lines = [`[
|
|
5
|
+
const lines = [`[recall source="${source}"]`];
|
|
6
6
|
for (const hint of hints) {
|
|
7
7
|
lines.push(`- ${hint.id} | ${hint.name} | ${hint.description}`);
|
|
8
8
|
}
|
|
@@ -59,7 +59,7 @@ export class MarkdownMemoryStore {
|
|
|
59
59
|
continue;
|
|
60
60
|
}
|
|
61
61
|
if (!parsed.frontmatter.description) {
|
|
62
|
-
diagnostics.push({ type: "warning", path, message: "Memory file is missing description; excluded from
|
|
62
|
+
diagnostics.push({ type: "warning", path, message: "Memory file is missing description; excluded from passive recall" });
|
|
63
63
|
}
|
|
64
64
|
const tags = normalizeTags(parsed.frontmatter.tags ?? []);
|
|
65
65
|
const entry = {
|
|
@@ -37,9 +37,9 @@ export function createMarkdownMemoryTools(store, { remoteSources = [] } = {}) {
|
|
|
37
37
|
defineTool({
|
|
38
38
|
name: "memory_open",
|
|
39
39
|
label: "Memory Open",
|
|
40
|
-
description: "Open a Markdown memory by id or by path. Use this after
|
|
40
|
+
description: "Open a Markdown memory by id or by path. Use this after recall hint or memory_search when you need more context. Local memories may be edited with edit_file; remote memories are read-only.",
|
|
41
41
|
parameters: Type.Object({
|
|
42
|
-
id: Type.Optional(Type.String({ description: "Local memory id from
|
|
42
|
+
id: Type.Optional(Type.String({ description: "Local memory id from recall hint, e.g. mem_..." })),
|
|
43
43
|
source: Type.Optional(Type.String({ description: "Memory source: omitted/local or a remote memory name" })),
|
|
44
44
|
path: Type.Optional(Type.String({ description: "Path returned by memory_search" })),
|
|
45
45
|
line: Type.Optional(Type.Number({ description: "Open around this 1-based line number" })),
|
|
@@ -70,13 +70,13 @@ export function createMarkdownMemoryTools(store, { remoteSources = [] } = {}) {
|
|
|
70
70
|
name: "memory_save",
|
|
71
71
|
label: "Memory Save",
|
|
72
72
|
description:
|
|
73
|
-
"Create a Markdown memory or update whole fields on an existing memory. For targeted edits to an existing memory body or frontmatter, use memory_open to get the path, then edit_file. Before creating a new memory, merge related updates into an existing memory when they share the same topic or decision thread. New memories require name, description, body, and at least one tag because
|
|
73
|
+
"Create a Markdown memory or update whole fields on an existing memory. For targeted edits to an existing memory body or frontmatter, use memory_open to get the path, then edit_file. Before creating a new memory, merge related updates into an existing memory when they share the same topic or decision thread. New memories require name, description, body, and at least one tag because recall hints only use tags. When updating by id, omitted fields keep their existing values; passing tags replaces the full tag list.",
|
|
74
74
|
parameters: Type.Object({
|
|
75
75
|
id: Type.Optional(Type.String({ description: "Existing memory id to update. Omit to create a new memory." })),
|
|
76
76
|
name: Type.Optional(Type.String({ description: "Memory name. Required when creating." })),
|
|
77
|
-
description: Type.Optional(Type.String({ description: "Short natural-language summary shown in
|
|
77
|
+
description: Type.Optional(Type.String({ description: "Short natural-language summary shown in recall hint. Required when creating." })),
|
|
78
78
|
body: Type.Optional(Type.String({ description: "Markdown memory body. Required when creating." })),
|
|
79
|
-
tags: Type.Optional(Type.Array(Type.String(), { description: "Tags used for
|
|
79
|
+
tags: Type.Optional(Type.Array(Type.String(), { description: "Tags used for recall hint. Required and non-empty when creating; replaces tags when updating. Prefer stable retrieval keys: project name, technology, feature/domain, user/person, and decision topic. Use lowercase kebab-case when possible. Examples: ['march-cli', 'tooling', 'permissions'], ['memory', 'sqlite-index']." })),
|
|
80
80
|
}),
|
|
81
81
|
execute: async (_toolCallId, params) => {
|
|
82
82
|
try {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
|
|
3
|
+
export function resolveMemoryRoot(configured, stateRoot) {
|
|
4
|
+
if (configured) return resolve(String(configured));
|
|
5
|
+
if (process.env.MARCH_MEMORY_ROOT) return resolve(process.env.MARCH_MEMORY_ROOT);
|
|
6
|
+
return resolve(stateRoot, "March Memories");
|
|
7
|
+
}
|