march-cli 0.1.12 → 0.1.14

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.
Files changed (50) hide show
  1. package/package.json +2 -1
  2. package/src/agent/command-exec-tool.mjs +42 -8
  3. package/src/agent/{read-file-tool.mjs → file-tools/read-file-tool.mjs} +2 -2
  4. package/src/agent/file-tools/read-image-tool.mjs +76 -0
  5. package/src/agent/runner/runner-utils.mjs +6 -0
  6. package/src/agent/runner.mjs +17 -16
  7. package/src/agent/runtime/ipc/ipc-peer.mjs +99 -0
  8. package/src/agent/runtime/ipc/process-ipc-transport.mjs +16 -0
  9. package/src/agent/runtime/remote-runner-client.mjs +73 -0
  10. package/src/agent/runtime/remote-ui-client.mjs +19 -0
  11. package/src/agent/runtime/runner-ipc-target.mjs +126 -0
  12. package/src/agent/runtime/runner-process-client.mjs +47 -0
  13. package/src/agent/runtime/runner-process-entry.mjs +93 -0
  14. package/src/agent/runtime/runner-runtime-host.mjs +1 -0
  15. package/src/agent/runtime/ui-event-bridge.mjs +85 -0
  16. package/src/agent/screen-tools/list-windows-tool.mjs +39 -0
  17. package/src/agent/screen-tools/screen-tool.mjs +49 -0
  18. package/src/agent/screen-tools/windows-screen.mjs +133 -0
  19. package/src/agent/session/session-options.mjs +2 -1
  20. package/src/agent/tool-summary.mjs +112 -0
  21. package/src/agent/tools.mjs +12 -5
  22. package/src/agent/turn/turn-events.mjs +46 -0
  23. package/src/agent/turn/turn-runner.mjs +2 -1
  24. package/src/agent/vision-capability.mjs +14 -0
  25. package/src/cli/args.mjs +8 -0
  26. package/src/cli/commands/copy-command.mjs +16 -2
  27. package/src/cli/commands/status-command.mjs +7 -4
  28. package/src/cli/commands/thinking-command.mjs +10 -3
  29. package/src/cli/repl-loop.mjs +3 -1
  30. package/src/cli/startup/create-runtime-runner.mjs +61 -0
  31. package/src/cli/startup/startup-banner.mjs +64 -10
  32. package/src/cli/tui/layout/main-pane-layout.mjs +16 -7
  33. package/src/cli/tui/selection-screen.mjs +83 -34
  34. package/src/cli/tui/status/status-bar.mjs +155 -18
  35. package/src/cli/tui/tool-rendering.mjs +3 -113
  36. package/src/cli/tui/tui-handlers.mjs +1 -1
  37. package/src/cli/tui/ui-theme.mjs +14 -5
  38. package/src/cli/ui.mjs +1 -1
  39. package/src/config/config-json.mjs +11 -0
  40. package/src/context/engine.mjs +10 -9
  41. package/src/context/profiles.mjs +39 -0
  42. package/src/context/system-core/base.md +2 -1
  43. package/src/main.mjs +42 -35
  44. package/src/provider/accept-command.mjs +89 -0
  45. package/src/provider/command.mjs +21 -0
  46. package/src/provider/custom-provider.mjs +5 -4
  47. package/src/provider/share-command.mjs +79 -0
  48. package/src/provider/share-payload.mjs +52 -0
  49. package/src/supergrok/tool.mjs +6 -6
  50. package/src/context/center-memory.mjs +0 -14
package/src/main.mjs CHANGED
@@ -15,7 +15,7 @@ import { createStatusLineUpdater } from "./cli/status-line-updater.mjs";
15
15
  import { wireTuiHandlers } from "./cli/tui/tui-handlers.mjs";
16
16
  import { createMarchAuthStorage } from "./auth/storage.mjs";
17
17
  import { runLoginCommand } from "./auth/login-command.mjs";
18
- import { createRunner } from "./agent/runner.mjs";
18
+ import { createRuntimeRunner } from "./cli/startup/create-runtime-runner.mjs";
19
19
  import { createCliShellRuntime } from "./shell/cli-runtime.mjs";
20
20
  import { MarkdownMemoryStore } from "./memory/markdown-store.mjs";
21
21
  import { createMarkdownMemoryTools } from "./memory/markdown-tools.mjs";
@@ -23,15 +23,14 @@ import { loadDotEnv } from "./config/dotenv.mjs";
23
23
  import { loadConfig } from "./config/loader.mjs";
24
24
  import { discoverProjectExtensionPaths } from "./extensions/discovery.mjs";
25
25
  import { loadProjectLifecycleHookManifests } from "./extensions/lifecycle-manifest.mjs";
26
- import { resolvePiSessionManager } from "./session/pi-manager.mjs";
27
26
  import { loadOrCreateProjectId, resumeStartupSession } from "./cli/startup/startup-session.mjs";
28
27
  import { formatStartupBanner } from "./cli/startup/startup-banner.mjs";
29
28
  import { initializeMcp } from "./mcp/index.mjs";
30
29
  import { createWebToolsFromConfig } from "./web/tools.mjs";
31
30
  import { createModelContextDumper } from "./debug/model-context-dumper.mjs";
32
31
  import { createLogger, installProcessLogHandlers } from "./debug/logger.mjs";
33
- import { defaultCenterMemoryPath } from "./context/center-memory.mjs";
34
- import { runProviderConfigCommand } from "./provider/config-command.mjs";
32
+ import { defaultProfilePaths, ensureProfileFiles } from "./context/profiles.mjs";
33
+ import { runProviderCommand } from "./provider/command.mjs";
35
34
  import { runWebSearchConfigCommand } from "./web/config-command.mjs";
36
35
  import { createDesktopTurnNotifier } from "./notification/desktop-notifier.mjs";
37
36
  import { registerSuperGrokOAuthProvider } from "./supergrok/oauth-provider.mjs";
@@ -49,6 +48,7 @@ export async function run(argv) {
49
48
  }
50
49
 
51
50
  const config = loadConfig(cwd);
51
+ const useRuntimeProcess = process.env.MARCH_RUNTIME_PROCESS !== "0";
52
52
  installNetworkEnvironment(config.network);
53
53
  if (args.command?.name === "login") {
54
54
  try {
@@ -60,11 +60,12 @@ export async function run(argv) {
60
60
  return 1;
61
61
  }
62
62
  }
63
-
64
- if (args.command?.name === "provider" || args.command?.name === "websearch") {
65
- const command = args.command.name === "provider" ? runProviderConfigCommand : runWebSearchConfigCommand;
66
- if (args.providerConfig) return await command({ homeDir: homedir() });
67
- process.stderr.write(`Usage: march ${args.command.name} --config\n`);
63
+ if (args.command?.name === "provider") {
64
+ return await runProviderCommand(args);
65
+ }
66
+ if (args.command?.name === "websearch") {
67
+ if (args.providerConfig) return await runWebSearchConfigCommand({ homeDir: homedir() });
68
+ process.stderr.write("Usage: march websearch --config\n");
68
69
  return 1;
69
70
  }
70
71
 
@@ -103,14 +104,16 @@ export async function run(argv) {
103
104
  const modeState = createModeState();
104
105
  const namespace = loadOrCreateProjectId(projectMarchDir);
105
106
  const memoryRoot = resolveMemoryRoot(config.memoryRoot, stateRoot);
106
- const centerMemoryPath = defaultCenterMemoryPath();
107
+ const profilePaths = defaultProfilePaths();
108
+ ensureProfileFiles(profilePaths);
107
109
  const memoryStore = new MarkdownMemoryStore({ root: memoryRoot });
108
110
  const memoryTools = createMarkdownMemoryTools(memoryStore);
109
111
  const currentProject = basename(cwd);
110
112
  const shellRuntime = args.shellRuntime ? createCliShellRuntime({ cwd }) : null;
111
113
 
112
- // MCP: connect to configured MCP servers
113
- const mcpInit = await initializeMcp({ projectDir: cwd });
114
+ const mcpInit = useRuntimeProcess
115
+ ? { clientManager: null, mcpTools: [], mcpInjections: [], errors: [] }
116
+ : await initializeMcp({ projectDir: cwd });
114
117
  const { clientManager: mcpClientManager, mcpTools, mcpInjections } = mcpInit;
115
118
  for (const { server, error } of mcpInit.errors) {
116
119
  if (args.json) {
@@ -159,17 +162,33 @@ export async function run(argv) {
159
162
  let turnRunning = false;
160
163
  let refreshStatusBar = null;
161
164
 
162
- const runner = await createRunner({
165
+ const runnerOptions = {
163
166
  cwd,
164
167
  modelId: model,
165
168
  provider,
166
169
  serviceTier,
167
-
168
170
  providers: config.providers,
171
+ config,
169
172
  stateRoot,
170
- ui,
171
173
  memoryRoot,
172
- centerMemoryPath,
174
+ profilePaths,
175
+ namespace,
176
+ projectMarchDir,
177
+ extensionPaths,
178
+ permissionMode,
179
+ shellRuntime: Boolean(shellRuntime),
180
+ lifecycleHooks: lifecycleManifests.hooks,
181
+ lifecycleDiagnostics: lifecycleManifests.diagnostics,
182
+ modelContextDumper: {
183
+ enabled: args.dumpContext,
184
+ rootDir: contextDumpRoot,
185
+ },
186
+ };
187
+
188
+ const runner = await createRuntimeRunner({
189
+ useRuntimeProcess,
190
+ runnerOptions,
191
+ ui,
173
192
  memoryStore,
174
193
  memoryTools,
175
194
  shellRuntime,
@@ -177,29 +196,14 @@ export async function run(argv) {
177
196
  mcpInjections,
178
197
  mcpClientManager,
179
198
  webTools,
180
- namespace,
181
- projectMarchDir,
182
- extensionPaths,
183
- sessionManager: resolvePiSessionManager({
184
- cwd,
185
- projectMarchDir,
186
- enabled: usePiSessions,
187
- }),
188
- useRuntimeHost: usePiRuntimeHost,
189
- syncPiSidecar: usePiSessions || usePiRuntimeHost,
190
- lifecycleHooks: lifecycleManifests.hooks,
191
- lifecycleDiagnostics: lifecycleManifests.diagnostics,
199
+ usePiSessions,
200
+ usePiRuntimeHost,
192
201
  authStorage: authConfig.authStorage,
193
- maxTurns: config.maxTurns ?? undefined,
194
- trimBatch: config.trimBatch ?? undefined,
195
- hostedTools: config.hostedTools,
196
202
  permissionController,
197
203
  modelContextDumper,
198
204
  turnNotifier,
199
205
  logger,
200
- onModelPayload: ({ estimatedTokens }) => {
201
- refreshStatusBar?.({ contextTokens: estimatedTokens });
202
- },
206
+ refreshStatusBar: (...args) => refreshStatusBar?.(...args),
203
207
  });
204
208
 
205
209
  refreshStatusBar = createStatusLineUpdater({
@@ -209,7 +213,10 @@ export async function run(argv) {
209
213
  sessionSource,
210
214
  getMode: () => modeState.get(),
211
215
  });
212
- refreshStatusBar();
216
+ const initialContextTokens = typeof runner.estimateContextTokens === "function"
217
+ ? await runner.estimateContextTokens("")
218
+ : null;
219
+ refreshStatusBar(initialContextTokens ? { contextTokens: initialContextTokens } : undefined);
213
220
 
214
221
  wireTuiHandlers({
215
222
  ui,
@@ -0,0 +1,89 @@
1
+ import { globalConfigJsonPath, readConfigJson, upsertSharedProviderProfile } from "../config/config-json.mjs";
2
+ import { selectWithKeyboard } from "../cli/input/select-with-keyboard.mjs";
3
+ import { hasApiKey, parseProviderShareToken } from "./share-payload.mjs";
4
+
5
+ export async function runProviderAcceptCommand({
6
+ homeDir,
7
+ token,
8
+ input = process.stdin,
9
+ output = process.stdout,
10
+ select = selectWithKeyboard,
11
+ } = {}) {
12
+ if (!token) {
13
+ output.write("Usage: march provider accept <march-provider-v1-token>\n");
14
+ return 1;
15
+ }
16
+
17
+ let payload;
18
+ try {
19
+ payload = parseProviderShareToken(token);
20
+ } catch (error) {
21
+ output.write(`Invalid provider share token: ${error.message}\n`);
22
+ return 1;
23
+ }
24
+
25
+ output.write(formatImportPreview(payload));
26
+ const path = globalConfigJsonPath(homeDir);
27
+ const config = readConfigJson(path);
28
+ const providers = config.providers && typeof config.providers === "object" && !Array.isArray(config.providers) ? config.providers : {};
29
+ if (providers[payload.providerId]) {
30
+ const action = await select({
31
+ input,
32
+ output,
33
+ message: `Provider "${payload.providerId}" already exists`,
34
+ items: [
35
+ { label: "Overwrite existing provider", value: "overwrite" },
36
+ { label: "Cancel", value: "cancel" },
37
+ ],
38
+ });
39
+ if (action !== "overwrite") {
40
+ output.write("Provider import cancelled.\n");
41
+ return 1;
42
+ }
43
+ } else {
44
+ const action = await select({
45
+ input,
46
+ output,
47
+ message: "Import provider?",
48
+ items: [
49
+ { label: "Import", value: "import" },
50
+ { label: "Cancel", value: "cancel" },
51
+ ],
52
+ });
53
+ if (action !== "import") {
54
+ output.write("Provider import cancelled.\n");
55
+ return 1;
56
+ }
57
+ }
58
+
59
+ upsertSharedProviderProfile({ path, id: payload.providerId, provider: payload.provider });
60
+ output.write(`Imported provider: ${payload.providerId}\n`);
61
+ output.write(`Config: ${path}\n`);
62
+ return 0;
63
+ }
64
+
65
+ export function formatImportPreview(payload) {
66
+ const provider = payload.provider;
67
+ const models = Array.isArray(provider.models) ? provider.models : [];
68
+ const lines = [
69
+ "Provider to import:",
70
+ ` Id: ${payload.providerId}`,
71
+ ` Name: ${typeof provider.name === "string" && provider.name ? provider.name : "-"}`,
72
+ ` Type: ${provider.type}`,
73
+ ];
74
+ if (typeof provider.baseUrl === "string" && provider.baseUrl) lines.push(` Base URL: ${provider.baseUrl}`);
75
+ if (typeof provider.api === "string" && provider.api) lines.push(` API: ${provider.api}`);
76
+ if (models.length) {
77
+ lines.push(` Models: ${models.length}`);
78
+ for (const model of models.slice(0, 5)) lines.push(` - ${formatModel(model)}`);
79
+ if (models.length > 5) lines.push(` ... ${models.length - 5} more`);
80
+ }
81
+ lines.push(` API key: ${hasApiKey(provider) ? "included" : "not included"}`);
82
+ lines.push("");
83
+ return `${lines.join("\n")}\n`;
84
+ }
85
+
86
+ function formatModel(model) {
87
+ if (model && typeof model === "object" && !Array.isArray(model)) return model.name || model.id || "<unnamed>";
88
+ return String(model);
89
+ }
@@ -0,0 +1,21 @@
1
+ import { homedir } from "node:os";
2
+ import { runProviderConfigCommand } from "./config-command.mjs";
3
+ import { runProviderShareCommand } from "./share-command.mjs";
4
+ import { runProviderAcceptCommand } from "./accept-command.mjs";
5
+
6
+ export async function runProviderCommand(args, { homeDir = homedir(), stderr = process.stderr } = {}) {
7
+ if (args.providerConfig) return await runProviderConfigCommand({ homeDir });
8
+ if (args.command.args[0] === "share") {
9
+ return await runProviderShareCommand({
10
+ homeDir,
11
+ providerId: args.command.args[1],
12
+ includeKey: args.includeKey,
13
+ profileOnly: args.profileOnly,
14
+ });
15
+ }
16
+ if (args.command.args[0] === "accept") {
17
+ return await runProviderAcceptCommand({ homeDir, token: args.command.args[1] });
18
+ }
19
+ stderr.write("Usage: march provider --config | march provider share [id] | march provider accept <token>\n");
20
+ return 1;
21
+ }
@@ -52,7 +52,7 @@ function normalizeModels(providerId, models, { api, baseUrl }) {
52
52
  api: normalizeApi(providerId, model.api ?? api),
53
53
  baseUrl: typeof model.baseUrl === "string" && model.baseUrl.trim() ? model.baseUrl : baseUrl,
54
54
  reasoning: typeof model.reasoning === "boolean" ? model.reasoning : false,
55
- input: normalizeInput(model.input),
55
+ input: normalizeInput(model.input, model.capabilities),
56
56
  cost: normalizeCost(model.cost),
57
57
  contextWindow: normalizePositiveNumber(model.contextWindow, 128000),
58
58
  maxTokens: normalizePositiveNumber(model.maxTokens, 4096),
@@ -75,9 +75,10 @@ function requireString(providerId, field, value) {
75
75
  return value;
76
76
  }
77
77
 
78
- function normalizeInput(input) {
79
- if (!Array.isArray(input) || input.length === 0) return ["text"];
80
- const normalized = input.filter((item) => item === "text" || item === "image");
78
+ function normalizeInput(input, capabilities = null) {
79
+ const normalized = Array.isArray(input) ? input.filter((item) => item === "text" || item === "image") : [];
80
+ if ((capabilities?.images === true || capabilities?.vision === true) && !normalized.includes("image")) normalized.push("image");
81
+ if (!normalized.includes("text")) normalized.unshift("text");
81
82
  return normalized.length > 0 ? normalized : ["text"];
82
83
  }
83
84
 
@@ -0,0 +1,79 @@
1
+ import { globalConfigJsonPath, readConfigJson } from "../config/config-json.mjs";
2
+ import { selectWithKeyboard } from "../cli/input/select-with-keyboard.mjs";
3
+ import { cloneProviderForShare, createProviderShareToken, hasApiKey } from "./share-payload.mjs";
4
+
5
+ export async function runProviderShareCommand({
6
+ homeDir,
7
+ providerId,
8
+ includeKey = false,
9
+ profileOnly = false,
10
+ input = process.stdin,
11
+ output = process.stdout,
12
+ select = selectWithKeyboard,
13
+ } = {}) {
14
+ if (includeKey && profileOnly) {
15
+ output.write("Choose either --include-key or --profile-only, not both.\n");
16
+ return 1;
17
+ }
18
+
19
+ const config = readConfigJson(globalConfigJsonPath(homeDir));
20
+ const providers = normalizeProviders(config.providers);
21
+ const selectedProviderId = providerId ?? await selectProvider({ providers, input, output, select });
22
+ if (!selectedProviderId) {
23
+ output.write(Object.keys(providers).length ? "Provider share cancelled.\n" : "No providers configured. Run: march provider --config\n");
24
+ return 1;
25
+ }
26
+
27
+ const provider = providers[selectedProviderId];
28
+ if (!provider) {
29
+ output.write(`Provider not found: ${selectedProviderId}\n`);
30
+ return 1;
31
+ }
32
+
33
+ const includeApiKey = includeKey || (!profileOnly && await selectShareMode({ input, output, select }));
34
+ const sharedProvider = cloneProviderForShare(provider, { includeApiKey });
35
+ const token = createProviderShareToken({
36
+ providerId: selectedProviderId,
37
+ provider: sharedProvider,
38
+ mode: includeApiKey ? "full" : "profile-only",
39
+ });
40
+
41
+ output.write(`Provider: ${selectedProviderId}\n`);
42
+ output.write(`Mode: ${includeApiKey ? "Full config, including API key" : "Profile only, without API key"}\n`);
43
+ output.write(`API key: ${hasApiKey(sharedProvider) ? "included" : "not included"}\n\n`);
44
+ output.write(`march provider accept ${token}\n`);
45
+ return 0;
46
+ }
47
+
48
+ function normalizeProviders(providers) {
49
+ return providers && typeof providers === "object" && !Array.isArray(providers) ? providers : {};
50
+ }
51
+
52
+ async function selectProvider({ providers, input, output, select }) {
53
+ const items = Object.entries(providers).map(([id, provider]) => ({
54
+ value: id,
55
+ label: formatProviderLabel(id, provider),
56
+ }));
57
+ return await select({ input, output, message: "Choose provider to share", items });
58
+ }
59
+
60
+ async function selectShareMode({ input, output, select }) {
61
+ const mode = await select({
62
+ input,
63
+ output,
64
+ message: "Choose share mode",
65
+ items: [
66
+ { label: "Full config, including API key", value: "full" },
67
+ { label: "Profile only, without API key", value: "profile-only" },
68
+ ],
69
+ });
70
+ return mode === "full";
71
+ }
72
+
73
+ function formatProviderLabel(id, provider) {
74
+ const name = typeof provider?.name === "string" && provider.name ? provider.name : "-";
75
+ const type = typeof provider?.type === "string" && provider.type ? provider.type : "unknown";
76
+ const modelCount = Array.isArray(provider?.models) ? `${provider.models.length} model${provider.models.length === 1 ? "" : "s"}` : "built-in";
77
+ const key = hasApiKey(provider) ? "API key configured" : "no API key";
78
+ return `${id} ${name} ${type} ${modelCount} ${key}`;
79
+ }
@@ -0,0 +1,52 @@
1
+ const KIND = "march.provider.share";
2
+ const VERSION = 1;
3
+ const PREFIX = "march-provider-v1.";
4
+
5
+ export function createProviderShareToken({ providerId, provider, mode }) {
6
+ const payload = {
7
+ kind: KIND,
8
+ version: VERSION,
9
+ mode,
10
+ containsApiKey: hasApiKey(provider),
11
+ providerId,
12
+ provider,
13
+ };
14
+ return `${PREFIX}${Buffer.from(JSON.stringify(payload), "utf8").toString("base64url")}`;
15
+ }
16
+
17
+ export function parseProviderShareToken(token) {
18
+ const text = String(token ?? "").trim();
19
+ if (!text.startsWith(PREFIX)) throw new Error(`Provider share token must start with ${PREFIX}`);
20
+ let payload;
21
+ try {
22
+ payload = JSON.parse(Buffer.from(text.slice(PREFIX.length), "base64url").toString("utf8"));
23
+ } catch {
24
+ throw new Error("Invalid provider share token");
25
+ }
26
+ validateProviderSharePayload(payload);
27
+ return payload;
28
+ }
29
+
30
+ export function cloneProviderForShare(provider, { includeApiKey }) {
31
+ const clone = structuredClone(provider);
32
+ if (!includeApiKey && clone.auth && typeof clone.auth === "object" && !Array.isArray(clone.auth)) {
33
+ delete clone.auth.apiKey;
34
+ }
35
+ return clone;
36
+ }
37
+
38
+ export function hasApiKey(provider) {
39
+ return typeof provider?.auth?.apiKey === "string" && provider.auth.apiKey.length > 0;
40
+ }
41
+
42
+ export function validateProviderSharePayload(payload) {
43
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) throw new Error("Invalid provider share payload");
44
+ if (payload.kind !== KIND || payload.version !== VERSION) throw new Error("Unsupported provider share token");
45
+ if (typeof payload.providerId !== "string" || !payload.providerId.trim()) throw new Error("Provider share token is missing providerId");
46
+ validateProviderProfile(payload.provider);
47
+ }
48
+
49
+ function validateProviderProfile(provider) {
50
+ if (!provider || typeof provider !== "object" || Array.isArray(provider)) throw new Error("Provider share token is missing provider config");
51
+ if (typeof provider.type !== "string" || !provider.type.trim()) throw new Error("Provider config is missing type");
52
+ }
@@ -13,14 +13,14 @@ export function createSuperGrokTool({ authStorage, projectMarchDir, resolveCrede
13
13
  name: "supergrok",
14
14
  label: "SuperGrok",
15
15
  description:
16
- "Use SuperGrok capabilities through xAI: realtime web search, X/Twitter search, and Grok image generation. " +
17
- "Default search behavior is broad and enables image/video understanding where supported. Requires SuperGrok OAuth or XAI_API_KEY.",
18
- promptSnippet: "supergrok(action, query, options?) - Use SuperGrok web_search, x_search, or image_generate",
16
+ "Use SuperGrok for complex research tasks that would otherwise require multiple searches or source comparison. " +
17
+ "It is backed by an agent team that can search repeatedly, verify across sources, and synthesize an answer.",
18
+ promptSnippet: "supergrok(action, query, options?) - Prefer SuperGrok for complex web/X research or Grok image generation",
19
19
  promptGuidelines: [
20
- "Use action=web_search for current web/news/documentation facts.",
21
- "Use action=x_search for current X/Twitter posts, reactions, profiles, and threads.",
20
+ "Prefer action=web_search for broad, ambiguous, current, or multi-step research.",
21
+ "Use action=x_search for targeted X/Twitter posts, reactions, profiles, and threads.",
22
22
  "Use action=image_generate when the user asks Grok/SuperGrok to create an image.",
23
- "Do not add domain, handle, or date filters unless the user asks for that narrower scope.",
23
+ "Use narrower tools instead for simple lookups, exact URL fetching, targeted X search, or non-Grok image generation.",
24
24
  ],
25
25
  parameters: Type.Object({
26
26
  action: Type.String({ enum: ACTIONS, description: "SuperGrok capability to invoke" }),
@@ -1,14 +0,0 @@
1
- import { existsSync, readFileSync } from "node:fs";
2
- import { homedir } from "node:os";
3
- import { join } from "node:path";
4
-
5
- export function defaultCenterMemoryPath() {
6
- return join(homedir(), ".march", "memory", "center.md");
7
- }
8
-
9
- export function buildCenterMemory(path = defaultCenterMemoryPath()) {
10
- if (!path || !existsSync(path)) return null;
11
- const content = readFileSync(path, "utf8").trimEnd();
12
- if (!content.trim()) return null;
13
- return `[center_memory]\n--- ${path} ---\n${content}`;
14
- }