mindweave 2.5.0 → 3.0.0
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 +81 -145
- package/dist/cli/App.js +579 -304
- package/dist/cli/App.js.map +1 -1
- package/dist/cli/analytics.js +27 -18
- package/dist/cli/analytics.js.map +1 -1
- package/dist/cli/attachments.js +34 -0
- package/dist/cli/attachments.js.map +1 -1
- package/dist/cli/bannerFit.js +70 -0
- package/dist/cli/bannerFit.js.map +1 -0
- package/dist/cli/bootstrap.js +41 -3
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/cli/commands.js +4 -1
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/components/ApprovalBox.js +3 -2
- package/dist/cli/components/ApprovalBox.js.map +1 -1
- package/dist/cli/components/BlockView.js +27 -6
- package/dist/cli/components/BlockView.js.map +1 -1
- package/dist/cli/components/FirstRunFrame.js +2 -1
- package/dist/cli/components/FirstRunFrame.js.map +1 -1
- package/dist/cli/components/KeyManager.js +5 -4
- package/dist/cli/components/KeyManager.js.map +1 -1
- package/dist/cli/components/KeySetup.js +29 -13
- package/dist/cli/components/KeySetup.js.map +1 -1
- package/dist/cli/components/MarathonBox.js +64 -0
- package/dist/cli/components/MarathonBox.js.map +1 -0
- package/dist/cli/components/McpMinitabs.js +8 -7
- package/dist/cli/components/McpMinitabs.js.map +1 -1
- package/dist/cli/components/Picker.js +4 -3
- package/dist/cli/components/Picker.js.map +1 -1
- package/dist/cli/components/PromptInput.js +47 -8
- package/dist/cli/components/PromptInput.js.map +1 -1
- package/dist/cli/components/PulseDot.js +42 -0
- package/dist/cli/components/PulseDot.js.map +1 -0
- package/dist/cli/components/SubagentView.js +9 -6
- package/dist/cli/components/SubagentView.js.map +1 -1
- package/dist/cli/components/TipLine.js +2 -1
- package/dist/cli/components/TipLine.js.map +1 -1
- package/dist/cli/components/ToolGroup.js +65 -49
- package/dist/cli/components/ToolGroup.js.map +1 -1
- package/dist/cli/components/ToolLine.js +20 -19
- package/dist/cli/components/ToolLine.js.map +1 -1
- package/dist/cli/components/TrustGate.js +2 -1
- package/dist/cli/components/TrustGate.js.map +1 -1
- package/dist/cli/components/minitabs.js +3 -2
- package/dist/cli/components/minitabs.js.map +1 -1
- package/dist/cli/desktopApp.js +45 -0
- package/dist/cli/desktopApp.js.map +1 -0
- package/dist/cli/help.js +1 -0
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/inkOutputPatch.js +285 -0
- package/dist/cli/inkOutputPatch.js.map +1 -0
- package/dist/cli/inkSpeed.js +29 -0
- package/dist/cli/inkSpeed.js.map +1 -0
- package/dist/cli/inkSpeedLoader.js +47 -0
- package/dist/cli/inkSpeedLoader.js.map +1 -0
- package/dist/cli/inputText.js +30 -0
- package/dist/cli/inputText.js.map +1 -0
- package/dist/cli/keyManager.js +2 -1
- package/dist/cli/keyManager.js.map +1 -1
- package/dist/cli/keyPrefs.js +90 -0
- package/dist/cli/keyPrefs.js.map +1 -0
- package/dist/cli/keySetup.js +5 -2
- package/dist/cli/keySetup.js.map +1 -1
- package/dist/cli/marathonUi.js +113 -0
- package/dist/cli/marathonUi.js.map +1 -0
- package/dist/cli/markdown.js +63 -11
- package/dist/cli/markdown.js.map +1 -1
- package/dist/cli/modes.js +3 -3
- package/dist/cli/modes.js.map +1 -1
- package/dist/cli/prodEnv.js +43 -0
- package/dist/cli/prodEnv.js.map +1 -0
- package/dist/cli/revealPace.js +5 -5
- package/dist/cli/revealPace.js.map +1 -1
- package/dist/cli/revealQueue.js +120 -0
- package/dist/cli/revealQueue.js.map +1 -0
- package/dist/cli/theme.js +47 -0
- package/dist/cli/theme.js.map +1 -0
- package/dist/cli/toolDisplay.js +112 -18
- package/dist/cli/toolDisplay.js.map +1 -1
- package/dist/cli/transcript.js +1 -1
- package/dist/cli/transcript.js.map +1 -1
- package/dist/cli/virtualWindow.js +14 -2
- package/dist/cli/virtualWindow.js.map +1 -1
- package/dist/cli/wheelAccel.js +73 -0
- package/dist/cli/wheelAccel.js.map +1 -0
- package/dist/cli/widestLinePatch.js +48 -0
- package/dist/cli/widestLinePatch.js.map +1 -0
- package/dist/cli/workingVerb.js +88 -28
- package/dist/cli/workingVerb.js.map +1 -1
- package/dist/cli/wrap.js +1 -1
- package/dist/cli/wrap.js.map +1 -1
- package/dist/core/contextSettings.js +84 -0
- package/dist/core/contextSettings.js.map +1 -0
- package/dist/core/limitsView.js +40 -0
- package/dist/core/limitsView.js.map +1 -0
- package/dist/core/mcpServers.js +164 -0
- package/dist/core/mcpServers.js.map +1 -0
- package/dist/core/permissions.js +209 -0
- package/dist/core/permissions.js.map +1 -0
- package/dist/core/providerKeys.js +187 -0
- package/dist/core/providerKeys.js.map +1 -0
- package/dist/core/rulesSkills.js +142 -0
- package/dist/core/rulesSkills.js.map +1 -0
- package/dist/core/spendView.js +90 -0
- package/dist/core/spendView.js.map +1 -0
- package/dist/core/turnRunner.js +759 -0
- package/dist/core/turnRunner.js.map +1 -0
- package/dist/drivers/anthropic/client.js +101 -26
- package/dist/drivers/anthropic/client.js.map +1 -1
- package/dist/drivers/anthropic/manifest.js +43 -13
- package/dist/drivers/anthropic/manifest.js.map +1 -1
- package/dist/drivers/cerebras/manifest.js +13 -3
- package/dist/drivers/cerebras/manifest.js.map +1 -1
- package/dist/drivers/deepseek/manifest.js +24 -34
- package/dist/drivers/deepseek/manifest.js.map +1 -1
- package/dist/drivers/glm/manifest.js +21 -6
- package/dist/drivers/glm/manifest.js.map +1 -1
- package/dist/drivers/groq/manifest.js +5 -2
- package/dist/drivers/groq/manifest.js.map +1 -1
- package/dist/drivers/kimi/manifest.js +13 -10
- package/dist/drivers/kimi/manifest.js.map +1 -1
- package/dist/drivers/meta/manifest.js +21 -16
- package/dist/drivers/meta/manifest.js.map +1 -1
- package/dist/drivers/minimax/manifest.js +15 -12
- package/dist/drivers/minimax/manifest.js.map +1 -1
- package/dist/drivers/ollama/catalog.js +71 -0
- package/dist/drivers/ollama/catalog.js.map +1 -0
- package/dist/drivers/ollama/client.js +164 -0
- package/dist/drivers/ollama/client.js.map +1 -0
- package/dist/drivers/ollama/endpoint.js +42 -0
- package/dist/drivers/ollama/endpoint.js.map +1 -0
- package/dist/drivers/ollama/index.js +5 -0
- package/dist/drivers/ollama/index.js.map +1 -0
- package/dist/drivers/ollama/manifest.js +64 -0
- package/dist/drivers/ollama/manifest.js.map +1 -0
- package/dist/drivers/openai/client.js +10 -4
- package/dist/drivers/openai/client.js.map +1 -1
- package/dist/drivers/openai/manifest.js +69 -18
- package/dist/drivers/openai/manifest.js.map +1 -1
- package/dist/drivers/qwen/manifest.js +19 -6
- package/dist/drivers/qwen/manifest.js.map +1 -1
- package/dist/drivers/registry.js +11 -0
- package/dist/drivers/registry.js.map +1 -1
- package/dist/drivers/retryPolicy.js +26 -1
- package/dist/drivers/retryPolicy.js.map +1 -1
- package/dist/drivers/xai/client.js +12 -10
- package/dist/drivers/xai/client.js.map +1 -1
- package/dist/drivers/xai/manifest.js +62 -25
- package/dist/drivers/xai/manifest.js.map +1 -1
- package/dist/dynamo/auxModel.js +54 -0
- package/dist/dynamo/auxModel.js.map +1 -0
- package/dist/dynamo/engine.js +407 -99
- package/dist/dynamo/engine.js.map +1 -1
- package/dist/dynamo/guard.js +10 -0
- package/dist/dynamo/guard.js.map +1 -1
- package/dist/dynamo/liveMeter.js +25 -6
- package/dist/dynamo/liveMeter.js.map +1 -1
- package/dist/dynamo/marathon.js +409 -0
- package/dist/dynamo/marathon.js.map +1 -0
- package/dist/dynamo/marathonPrompt.js +45 -0
- package/dist/dynamo/marathonPrompt.js.map +1 -0
- package/dist/dynamo/model.js +6 -2
- package/dist/dynamo/model.js.map +1 -1
- package/dist/dynamo/toolBatches.js +58 -0
- package/dist/dynamo/toolBatches.js.map +1 -0
- package/dist/dynamo/usageLimits.js +446 -0
- package/dist/dynamo/usageLimits.js.map +1 -0
- package/dist/governor/freshness.js +10 -7
- package/dist/governor/freshness.js.map +1 -1
- package/dist/governor/index.js +76 -9
- package/dist/governor/index.js.map +1 -1
- package/dist/governor/write.js +43 -14
- package/dist/governor/write.js.map +1 -1
- package/dist/index.js +18 -151
- package/dist/index.js.map +1 -1
- package/dist/main.js +162 -0
- package/dist/main.js.map +1 -0
- package/dist/mcp/manager.js +18 -0
- package/dist/mcp/manager.js.map +1 -1
- package/dist/memory/allMetas.js +69 -0
- package/dist/memory/allMetas.js.map +1 -0
- package/dist/memory/compaction.js +70 -15
- package/dist/memory/compaction.js.map +1 -1
- package/dist/memory/earlier.js +15 -0
- package/dist/memory/earlier.js.map +1 -0
- package/dist/memory/profile.js +93 -0
- package/dist/memory/profile.js.map +1 -0
- package/dist/memory/rewind.js +262 -0
- package/dist/memory/rewind.js.map +1 -0
- package/dist/memory/session.js +42 -10
- package/dist/memory/session.js.map +1 -1
- package/dist/memory/sessionMemory.js +48 -13
- package/dist/memory/sessionMemory.js.map +1 -1
- package/dist/memory/sessionMemoryCompact.js +1 -1
- package/dist/memory/sessionMemoryCompact.js.map +1 -1
- package/dist/memory/sessionTitle.js +50 -0
- package/dist/memory/sessionTitle.js.map +1 -0
- package/dist/memory/store.js +42 -1
- package/dist/memory/store.js.map +1 -1
- package/dist/memory/types.js.map +1 -1
- package/dist/tools/askUser.js +14 -0
- package/dist/tools/askUser.js.map +1 -1
- package/dist/tools/backgroundShells.js +208 -5
- package/dist/tools/backgroundShells.js.map +1 -1
- package/dist/tools/browser.js +176 -0
- package/dist/tools/browser.js.map +1 -0
- package/dist/tools/cdp.js +165 -0
- package/dist/tools/cdp.js.map +1 -0
- package/dist/tools/checkpoints.js +208 -5
- package/dist/tools/checkpoints.js.map +1 -1
- package/dist/tools/deferredNative.js +2 -0
- package/dist/tools/deferredNative.js.map +1 -1
- package/dist/tools/detail.js +9 -6
- package/dist/tools/detail.js.map +1 -1
- package/dist/tools/edit.js +2 -1
- package/dist/tools/edit.js.map +1 -1
- package/dist/tools/exitPlan.js +4 -0
- package/dist/tools/exitPlan.js.map +1 -1
- package/dist/tools/hiddenDesktop.js +273 -0
- package/dist/tools/hiddenDesktop.js.map +1 -0
- package/dist/tools/listeningPorts.js +134 -0
- package/dist/tools/listeningPorts.js.map +1 -0
- package/dist/tools/mcpSearch.js +8 -0
- package/dist/tools/mcpSearch.js.map +1 -1
- package/dist/tools/mindweaveStatus.js +1 -1
- package/dist/tools/mindweaveStatus.js.map +1 -1
- package/dist/tools/registry.js +3 -0
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/replaceSymbol.js +2 -1
- package/dist/tools/replaceSymbol.js.map +1 -1
- package/dist/tools/runCommand.js +113 -9
- package/dist/tools/runCommand.js.map +1 -1
- package/dist/tools/screenshot.js +4 -6
- package/dist/tools/screenshot.js.map +1 -1
- package/dist/tools/screenshotWin.js +26 -9
- package/dist/tools/screenshotWin.js.map +1 -1
- package/dist/tools/stateCheckpoint.js +128 -0
- package/dist/tools/stateCheckpoint.js.map +1 -0
- package/dist/tools/todo.js +6 -0
- package/dist/tools/todo.js.map +1 -1
- package/dist/tools/ui.js +1295 -0
- package/dist/tools/ui.js.map +1 -0
- package/dist/tools/uiHide.js +356 -0
- package/dist/tools/uiHide.js.map +1 -0
- package/dist/tools/uiPage.js +861 -0
- package/dist/tools/uiPage.js.map +1 -0
- package/dist/tools/uiWin.js +506 -0
- package/dist/tools/uiWin.js.map +1 -0
- package/dist/tools/webFetch.js +32 -25
- package/dist/tools/webFetch.js.map +1 -1
- package/dist/tools/webSearch.js +12 -0
- package/dist/tools/webSearch.js.map +1 -1
- package/dist/tools/writeFile.js +2 -1
- package/dist/tools/writeFile.js.map +1 -1
- package/package.json +78 -75
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/governor/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/governor/index.ts"],"names":[],"mappings":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"../memory/store.js";
|
|
13
13
|
import { parseForbidden, parseForbiddenCommands } from "./forbidden.js";
|
|
14
|
+
import { governanceDir } from "./index.js";
|
|
14
15
|
/** A filesystem-safe slug from a human name/phrase (kebab, ≤50 chars). */
|
|
15
16
|
export function slugify(text) {
|
|
16
17
|
return (text
|
|
@@ -110,11 +111,11 @@ export async function writeSkill(cwd, skill) {
|
|
|
110
111
|
* returns `{ added: false }` if it was already forbidden. The pattern is
|
|
111
112
|
* normalized the same way the loader normalizes (drop leading `./`, trailing `/`).
|
|
112
113
|
*/
|
|
113
|
-
export async function appendForbidden(cwd, pattern) {
|
|
114
|
+
export async function appendForbidden(cwd, pattern, scope = "project") {
|
|
114
115
|
const normalized = pattern.trim().replace(/^\.?\//, "").replace(/\/+$/, "");
|
|
115
116
|
if (!normalized)
|
|
116
117
|
return { added: false, pattern: normalized };
|
|
117
|
-
const base =
|
|
118
|
+
const base = governanceDir(cwd, scope);
|
|
118
119
|
const file = join(base, "forbidden.md");
|
|
119
120
|
let text = "";
|
|
120
121
|
try {
|
|
@@ -134,11 +135,11 @@ export async function appendForbidden(cwd, pattern) {
|
|
|
134
135
|
* Append an MCP tool name to `forbidden-mcp-tools.md`. Sibling of
|
|
135
136
|
* appendForbiddenCommand; tool names are identifiers, kept verbatim.
|
|
136
137
|
*/
|
|
137
|
-
export async function appendForbiddenMcpTool(cwd, name) {
|
|
138
|
+
export async function appendForbiddenMcpTool(cwd, name, scope = "project") {
|
|
138
139
|
const normalized = name.trim();
|
|
139
140
|
if (!normalized)
|
|
140
141
|
return { added: false, pattern: normalized };
|
|
141
|
-
const base =
|
|
142
|
+
const base = governanceDir(cwd, scope);
|
|
142
143
|
const file = join(base, "forbidden-mcp-tools.md");
|
|
143
144
|
let text = "";
|
|
144
145
|
try {
|
|
@@ -159,11 +160,11 @@ export async function appendForbiddenMcpTool(cwd, name) {
|
|
|
159
160
|
* Idempotent — `{ added: false }` if it was already forbidden. Sibling of
|
|
160
161
|
* appendForbidden; command patterns are kept verbatim (trimmed), not path-normalized.
|
|
161
162
|
*/
|
|
162
|
-
export async function appendForbiddenCommand(cwd, pattern) {
|
|
163
|
+
export async function appendForbiddenCommand(cwd, pattern, scope = "project") {
|
|
163
164
|
const normalized = pattern.trim();
|
|
164
165
|
if (!normalized)
|
|
165
166
|
return { added: false, pattern: normalized };
|
|
166
|
-
const base =
|
|
167
|
+
const base = governanceDir(cwd, scope);
|
|
167
168
|
const file = join(base, "forbidden-commands.md");
|
|
168
169
|
let text = "";
|
|
169
170
|
try {
|
|
@@ -209,11 +210,11 @@ export async function removeSkill(cwd, name) {
|
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
212
|
/** Drop one line from one of the `forbidden*.md` lists. False when it was not listed. */
|
|
212
|
-
async function removeForbiddenLine(cwd, fileName, value) {
|
|
213
|
+
async function removeForbiddenLine(cwd, fileName, value, scope = "project") {
|
|
213
214
|
const wanted = value.trim();
|
|
214
215
|
if (!wanted)
|
|
215
216
|
return false;
|
|
216
|
-
const file = join(
|
|
217
|
+
const file = join(governanceDir(cwd, scope), fileName);
|
|
217
218
|
let text = "";
|
|
218
219
|
try {
|
|
219
220
|
text = await fs.readFile(file, "utf8");
|
|
@@ -230,14 +231,42 @@ async function removeForbiddenLine(cwd, fileName, value) {
|
|
|
230
231
|
await fs.writeFile(file, kept.join("\n"), "utf8");
|
|
231
232
|
return true;
|
|
232
233
|
}
|
|
233
|
-
export async function removeForbiddenPath(cwd, pattern) {
|
|
234
|
+
export async function removeForbiddenPath(cwd, pattern, scope = "project") {
|
|
234
235
|
const normalized = pattern.trim().replace(/^\.\//, "").replace(/\/$/, "");
|
|
235
|
-
return removeForbiddenLine(cwd, "forbidden.md", normalized);
|
|
236
|
+
return removeForbiddenLine(cwd, "forbidden.md", normalized, scope);
|
|
236
237
|
}
|
|
237
|
-
export async function removeForbiddenCommand(cwd, pattern) {
|
|
238
|
-
return removeForbiddenLine(cwd, "forbidden-commands.md", pattern);
|
|
238
|
+
export async function removeForbiddenCommand(cwd, pattern, scope = "project") {
|
|
239
|
+
return removeForbiddenLine(cwd, "forbidden-commands.md", pattern, scope);
|
|
239
240
|
}
|
|
240
|
-
export async function removeForbiddenMcpTool(cwd, name) {
|
|
241
|
-
return removeForbiddenLine(cwd, "forbidden-mcp-tools.md", name);
|
|
241
|
+
export async function removeForbiddenMcpTool(cwd, name, scope = "project") {
|
|
242
|
+
return removeForbiddenLine(cwd, "forbidden-mcp-tools.md", name, scope);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Save a kind of action (a tool name) that Sentinel mode will not ask about, in this
|
|
246
|
+
* project or everywhere. Same one-per-line format as the deny-lists, so it reads and
|
|
247
|
+
* edits the same way by hand. Idempotent.
|
|
248
|
+
*/
|
|
249
|
+
export async function appendSentinelAllow(cwd, tool, scope = "project") {
|
|
250
|
+
const normalized = tool.trim();
|
|
251
|
+
if (!normalized)
|
|
252
|
+
return { added: false, pattern: normalized };
|
|
253
|
+
const base = governanceDir(cwd, scope);
|
|
254
|
+
const file = join(base, "sentinel-allow.md");
|
|
255
|
+
let text = "";
|
|
256
|
+
try {
|
|
257
|
+
text = await fs.readFile(file, "utf8");
|
|
258
|
+
}
|
|
259
|
+
catch {
|
|
260
|
+
/* none yet */
|
|
261
|
+
}
|
|
262
|
+
if (parseForbiddenCommands(text).includes(normalized))
|
|
263
|
+
return { added: false, pattern: normalized };
|
|
264
|
+
await fs.mkdir(base, { recursive: true });
|
|
265
|
+
const separator = text && !text.endsWith("\n") ? "\n" : "";
|
|
266
|
+
await fs.writeFile(file, `${text}${separator}${normalized}\n`, "utf8");
|
|
267
|
+
return { added: true, pattern: normalized };
|
|
268
|
+
}
|
|
269
|
+
export async function removeSentinelAllow(cwd, tool, scope = "project") {
|
|
270
|
+
return removeForbiddenLine(cwd, "sentinel-allow.md", tool, scope);
|
|
242
271
|
}
|
|
243
272
|
//# sourceMappingURL=write.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/governor/write.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/governor/write.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EAAE,aAAa,EAAwB,MAAM,YAAY,CAAC;AAEjE,0EAA0E;AAC1E,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,OAAO,CACL,IAAI;SACD,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,MAAM,CAC1B,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,OAAO,CAAC,KAAa;IAC5B,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,WAAW,CAAC,MAA0C;IAC7D,MAAM,KAAK,GAAa,CAAC,KAAK,CAAC,CAAC;IAChC,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAA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index.js
CHANGED
|
@@ -2,157 +2,24 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Mindweave — entry point.
|
|
4
4
|
*
|
|
5
|
-
* This file
|
|
6
|
-
*
|
|
7
|
-
* so
|
|
5
|
+
* This file only prepares the process, then starts the real program in `main.ts`. The split is
|
|
6
|
+
* not cosmetic: two things have to happen before React and Ink are LOADED, and ES imports are
|
|
7
|
+
* all loaded before any code runs, so they cannot happen inside the program that imports them.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* 1. React picks its production or development build when it first loads, from NODE_ENV
|
|
10
|
+
* (see cli/prodEnv.ts). Nothing set it, so the app ran on the slow development build.
|
|
11
|
+
* 2. The faster Ink renderer is installed by a loader hook, which only sees modules loaded
|
|
12
|
+
* after it is registered (see cli/inkSpeed.ts).
|
|
13
|
+
*
|
|
14
|
+
* Node's on-disk compile cache (`module.enableCompileCache`) is deliberately NOT used. Measured
|
|
15
|
+
* here it made every launch slower, about 1.0s to a usable prompt against 0.82s without it, warm
|
|
16
|
+
* cache included: reading and checking the cache cost more than recompiling saved.
|
|
17
|
+
*
|
|
18
|
+
* The shebang above + the `bin` entry in package.json make this the `mindweave` command.
|
|
13
19
|
*/
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import
|
|
19
|
-
import { parseStartupArgs, hasInteractiveInput, NO_TERMINAL_MESSAGE } from "./cli/startupArgs.js";
|
|
20
|
-
import { enterAltScreen, exitAltScreen } from "./cli/altScreen.js";
|
|
21
|
-
import { TERMINAL_RESTORE } from "./cli/terminalRestore.js";
|
|
22
|
-
import { instrumentStdout, flush as flushPerf, perf, perfEnabled } from "./cli/perfLog.js";
|
|
23
|
-
import { MAX_FPS } from "./cli/frameRate.js";
|
|
24
|
-
import { framebufferStdout, setFramebufferEnabled } from "./cli/framebuffer/writer.js";
|
|
25
|
-
import { startupMode } from "./cli/screenMode.js";
|
|
26
|
-
import { loadScreenMode } from "./cli/screenStore.js";
|
|
27
|
-
import { silenceConsole } from "./cli/quietConsole.js";
|
|
28
|
-
import { nameSession } from "./cli/appIdentity.js";
|
|
29
|
-
import { tuneMemory } from "./cli/memoryTuning.js";
|
|
30
|
-
import { spawn } from "node:child_process";
|
|
31
|
-
import { relaunch } from "./cli/restart.js";
|
|
32
|
-
import { takePendingRestart } from "./cli/updateRunner.js";
|
|
33
|
-
// --help / --version answer and exit, BEFORE anything reads config, sweeps a
|
|
34
|
-
// directory, or starts the UI. They used to fall through to the interactive app,
|
|
35
|
-
// which then hung forever with no TTY to render into — the one thing a packaging
|
|
36
|
-
// tool or a script does with a new CLI.
|
|
37
|
-
const startup = parseStartupArgs(process.argv.slice(2));
|
|
38
|
-
if (startup.kind === "print") {
|
|
39
|
-
process.stdout.write(startup.text + "\n");
|
|
40
|
-
process.exit(0);
|
|
41
|
-
}
|
|
42
|
-
// Nothing below this point can run without a terminal to read from, and the failure
|
|
43
|
-
// without one is a stack trace through React internals on a process that exits 0.
|
|
44
|
-
// --help, --version and --reset-terminal are answered above, so they still work
|
|
45
|
-
// wherever they are called from.
|
|
46
|
-
if (!hasInteractiveInput(process.stdin)) {
|
|
47
|
-
process.stderr.write(NO_TERMINAL_MESSAGE);
|
|
48
|
-
process.exit(1);
|
|
49
|
-
}
|
|
50
|
-
if (startup.kind === "reset") {
|
|
51
|
-
// Repairing a terminal a dead run left in mouse-reporting mode. Nothing else may run
|
|
52
|
-
// first: this is typed when the terminal is already misbehaving, and loading config or
|
|
53
|
-
// sweeping temp would only add ways for it to fail before it writes the one thing it
|
|
54
|
-
// came to write. Escapes go out only to a real terminal, since into a pipe they would
|
|
55
|
-
// be corruption rather than repair.
|
|
56
|
-
if (process.stdout.isTTY) {
|
|
57
|
-
process.stdout.write(TERMINAL_RESTORE);
|
|
58
|
-
process.stdout.write("terminal restored\n");
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
process.stdout.write("not a terminal, nothing to restore\n");
|
|
62
|
-
}
|
|
63
|
-
process.exit(0);
|
|
64
|
-
}
|
|
65
|
-
// Bias V8 toward a smaller footprint before anything heavy allocates. See memoryTuning.ts.
|
|
66
|
-
tuneMemory();
|
|
67
|
-
// Load config (global ~/.mindweave/.env + project .env) so provider API keys are
|
|
68
|
-
// available no matter which project we're launched in.
|
|
69
|
-
loadConfig();
|
|
70
|
-
// Clear out the temp files and directories earlier runs left behind: screenshots past
|
|
71
|
-
// their retention window, and the scratch (cwd hand-off files, command wrappers, test
|
|
72
|
-
// fixtures) that every call site removes on its way out and nothing removes when a run
|
|
73
|
-
// ends badly. Startup rather than shutdown precisely because that catches what a crash
|
|
74
|
-
// left behind, and detached so a slow or unreadable temp directory cannot delay the UI.
|
|
75
|
-
sweepTempInBackground();
|
|
76
|
-
// Times every frame the renderer writes to the real terminal. No-op unless
|
|
77
|
-
// MINDWEAVE_PERF names a file — see cli/perfLog.ts for why this cannot be measured
|
|
78
|
-
// from a test probe.
|
|
79
|
-
instrumentStdout(process.stdout);
|
|
80
|
-
process.on("exit", flushPerf);
|
|
81
|
-
// The shell the session starts in decides whether we take the screen at all. Applied
|
|
82
|
-
// HERE rather than being left to the app to correct on its first effect: entering and
|
|
83
|
-
// then immediately leaving is a visible flash of an empty alternate screen, and one
|
|
84
|
-
// frame of Ink output diffed by a framebuffer that is about to stand down.
|
|
85
|
-
// The saved choice is read here, not in the app, because the same answer decides whether
|
|
86
|
-
// to take the alternate screen at all — which happens before the first render.
|
|
87
|
-
const startupShell = startupMode(process.env["MINDWEAVE_SCREEN"], await loadScreenMode(process.cwd()));
|
|
88
|
-
// Name the session in the terminal tab and the process list, before the screen is taken
|
|
89
|
-
// (the title is a plain control write; doing it first keeps it out of the framebuffer's
|
|
90
|
-
// frame parsing). See appIdentity.ts.
|
|
91
|
-
nameSession();
|
|
92
|
-
enterAltScreen({ buffer: startupShell === "fullscreen" });
|
|
93
|
-
setFramebufferEnabled(startupShell === "fullscreen");
|
|
94
|
-
// Ink renders into a FRAMEBUFFER rather than straight to the terminal: each frame is
|
|
95
|
-
// parsed into a cell grid, diffed against what is already on screen, and only the
|
|
96
|
-
// cells that actually differ are written. Measured on a transcript-shaped screen,
|
|
97
|
-
// that is ~13x fewer bytes per frame (2,345 -> 178). See `cli/framebuffer/`.
|
|
98
|
-
//
|
|
99
|
-
// `incrementalRendering` is deliberately NOT enabled alongside it, and this is load
|
|
100
|
-
// bearing rather than a preference: that mode makes Ink emit only the LINES it thinks
|
|
101
|
-
// changed, interleaved with its own cursor movements, instead of a complete frame.
|
|
102
|
-
// The framebuffer's parser expects a whole frame — a partial one would be read as a
|
|
103
|
-
// full screen and everything it omitted would be blanked. One diff or the other, and
|
|
104
|
-
// ours is per-cell where Ink's is per-line.
|
|
105
|
-
// The frame-rate cap is what sets typing latency — see `cli/frameRate.ts` for the
|
|
106
|
-
// measurements and for why it is a timer rather than a cost.
|
|
107
|
-
// Nothing but the renderer may write to the screen while the UI owns it.
|
|
108
|
-
const restoreConsole = silenceConsole();
|
|
109
|
-
const instance = render(createElement(App, { resumeSessionId: startup.resumeSessionId, initialScreen: startupShell }), {
|
|
110
|
-
maxFps: MAX_FPS,
|
|
111
|
-
// Ctrl+C is handled by the app, not by Ink.
|
|
112
|
-
//
|
|
113
|
-
// Raw mode is on, so Ctrl+C arrives as a BYTE rather than as SIGINT — none of the
|
|
114
|
-
// signal handlers in altScreen.ts ever see it. Ink's default was then to unmount and
|
|
115
|
-
// nothing else: painting stopped, the process stayed alive with the turn still running,
|
|
116
|
-
// and because nothing exited, neither the terminal restore nor the synchronous kill of
|
|
117
|
-
// background shells (both `exit` hooks) ever ran. What that left on screen was a window
|
|
118
|
-
// that was no longer the app and not yet the shell, over work that was still going.
|
|
119
|
-
exitOnCtrlC: false,
|
|
120
|
-
// Console output is NOT a frame, and must not be routed into the stream of them.
|
|
121
|
-
//
|
|
122
|
-
// Ink offers to capture it and write it above the UI. Through the framebuffer that
|
|
123
|
-
// means the parser reads a log line as a frame and stamps foreign text into the model
|
|
124
|
-
// of the screen — and a cell the model has wrong is never revisited, because as far as
|
|
125
|
-
// a diff can see nothing about it changed. See `cli/quietConsole.ts`, which stops the
|
|
126
|
-
// output at the source instead.
|
|
127
|
-
patchConsole: false,
|
|
128
|
-
stdout: framebufferStdout(process.stdout, perfEnabled() ? (s) => perf(`frame in=${s.inBytes} out=${s.outBytes}`) : undefined),
|
|
129
|
-
});
|
|
130
|
-
// `/update` cannot hand the terminal over from inside the UI: the handover has to happen
|
|
131
|
-
// after Ink has unmounted, and unmounting is what ends the render. So the command records
|
|
132
|
-
// what it wants and the app closes the way it always closes; this is where the intention
|
|
133
|
-
// is read, with the screen already given back.
|
|
134
|
-
await instance.waitUntilExit();
|
|
135
|
-
restoreConsole();
|
|
136
|
-
const restart = takePendingRestart();
|
|
137
|
-
if (restart) {
|
|
138
|
-
process.exit(await relaunch(restart.packageRoot, restart.sessionId, restart.previousVersion, restart.prefix, {
|
|
139
|
-
// The order here is the whole risk. Both processes can write to this terminal and
|
|
140
|
-
// both can want raw mode, so the old one is completely out — alternate screen left,
|
|
141
|
-
// mouse reporting off, cursor and autowrap restored, stdin no longer raw — before
|
|
142
|
-
// the new one is allowed to start. `exitAltScreen` is idempotent, so the exit hook
|
|
143
|
-
// that also calls it later changes nothing.
|
|
144
|
-
teardown: () => {
|
|
145
|
-
exitAltScreen();
|
|
146
|
-
if (process.stdin.isTTY)
|
|
147
|
-
process.stdin.setRawMode(false);
|
|
148
|
-
process.stdin.pause();
|
|
149
|
-
},
|
|
150
|
-
spawn: (command, args) => new Promise((resolve) => {
|
|
151
|
-
const child = spawn(command, args, { stdio: "inherit" });
|
|
152
|
-
child.on("error", () => resolve({ code: 1, signal: null }));
|
|
153
|
-
child.on("close", (code, signal) => resolve({ code, signal }));
|
|
154
|
-
}),
|
|
155
|
-
report: (text) => process.stdout.write(text + "\n"),
|
|
156
|
-
}));
|
|
157
|
-
}
|
|
20
|
+
import { loadWithProductionEnv } from "./cli/prodEnv.js";
|
|
21
|
+
import { registerInkSpeedups } from "./cli/inkSpeed.js";
|
|
22
|
+
registerInkSpeedups();
|
|
23
|
+
await loadWithProductionEnv();
|
|
24
|
+
await import("./main.js");
|
|
158
25
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,mBAAmB,EAAE,CAAC;AACtB,MAAM,qBAAqB,EAAE,CAAC;AAC9B,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC"}
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mindweave — the program. Started by index.ts, which prepares the process first.
|
|
3
|
+
*
|
|
4
|
+
* This file does one thing: start the terminal UI. It deliberately stays tiny.
|
|
5
|
+
* All real logic lives in its own lane (cli / dynamo / tools / memory / alternator)
|
|
6
|
+
* so the project stays easy to understand as it grows.
|
|
7
|
+
*
|
|
8
|
+
* The shebang above + the `bin` entry in package.json make this the `mindweave`
|
|
9
|
+
* command: install once (`npm link` / `npm i -g`), then `cd` into any project and
|
|
10
|
+
* type `mindweave`. The session roots at the current directory (process.cwd()), so it
|
|
11
|
+
* just works wherever you run it.
|
|
12
|
+
*/
|
|
13
|
+
import { render } from "ink";
|
|
14
|
+
import { createElement } from "react";
|
|
15
|
+
import { App } from "./cli/App.js";
|
|
16
|
+
import { loadConfig } from "./cli/bootstrap.js";
|
|
17
|
+
import { sweepTempInBackground } from "./tools/tempSweep.js";
|
|
18
|
+
import { parseStartupArgs, hasInteractiveInput, NO_TERMINAL_MESSAGE } from "./cli/startupArgs.js";
|
|
19
|
+
import { enterAltScreen, exitAltScreen } from "./cli/altScreen.js";
|
|
20
|
+
import { TERMINAL_RESTORE } from "./cli/terminalRestore.js";
|
|
21
|
+
import { instrumentStdout, flush as flushPerf, perf, perfEnabled } from "./cli/perfLog.js";
|
|
22
|
+
import { MAX_FPS } from "./cli/frameRate.js";
|
|
23
|
+
import { framebufferStdout, setFramebufferEnabled } from "./cli/framebuffer/writer.js";
|
|
24
|
+
import { startupMode } from "./cli/screenMode.js";
|
|
25
|
+
import { loadScreenMode } from "./cli/screenStore.js";
|
|
26
|
+
import { silenceConsole } from "./cli/quietConsole.js";
|
|
27
|
+
import { nameSession } from "./cli/appIdentity.js";
|
|
28
|
+
import { tuneMemory } from "./cli/memoryTuning.js";
|
|
29
|
+
import { spawn } from "node:child_process";
|
|
30
|
+
import { relaunch } from "./cli/restart.js";
|
|
31
|
+
import { takePendingRestart } from "./cli/updateRunner.js";
|
|
32
|
+
// --help / --version answer and exit, BEFORE anything reads config, sweeps a
|
|
33
|
+
// directory, or starts the UI. They used to fall through to the interactive app,
|
|
34
|
+
// which then hung forever with no TTY to render into — the one thing a packaging
|
|
35
|
+
// tool or a script does with a new CLI.
|
|
36
|
+
const startup = parseStartupArgs(process.argv.slice(2));
|
|
37
|
+
if (startup.kind === "print") {
|
|
38
|
+
process.stdout.write(startup.text + "\n");
|
|
39
|
+
process.exit(0);
|
|
40
|
+
}
|
|
41
|
+
// Nothing below this point can run without a terminal to read from, and the failure
|
|
42
|
+
// without one is a stack trace through React internals on a process that exits 0.
|
|
43
|
+
// --help, --version and --reset-terminal are answered above, so they still work
|
|
44
|
+
// wherever they are called from.
|
|
45
|
+
if (!hasInteractiveInput(process.stdin)) {
|
|
46
|
+
process.stderr.write(NO_TERMINAL_MESSAGE);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
if (startup.kind === "reset") {
|
|
50
|
+
// Repairing a terminal a dead run left in mouse-reporting mode. Nothing else may run
|
|
51
|
+
// first: this is typed when the terminal is already misbehaving, and loading config or
|
|
52
|
+
// sweeping temp would only add ways for it to fail before it writes the one thing it
|
|
53
|
+
// came to write. Escapes go out only to a real terminal, since into a pipe they would
|
|
54
|
+
// be corruption rather than repair.
|
|
55
|
+
if (process.stdout.isTTY) {
|
|
56
|
+
process.stdout.write(TERMINAL_RESTORE);
|
|
57
|
+
process.stdout.write("terminal restored\n");
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
process.stdout.write("not a terminal, nothing to restore\n");
|
|
61
|
+
}
|
|
62
|
+
process.exit(0);
|
|
63
|
+
}
|
|
64
|
+
// Bias V8 toward a smaller footprint before anything heavy allocates. See memoryTuning.ts.
|
|
65
|
+
tuneMemory();
|
|
66
|
+
// Load config (global ~/.mindweave/.env + project .env) so provider API keys are
|
|
67
|
+
// available no matter which project we're launched in.
|
|
68
|
+
loadConfig();
|
|
69
|
+
// Clear out the temp files and directories earlier runs left behind: screenshots past
|
|
70
|
+
// their retention window, and the scratch (cwd hand-off files, command wrappers, test
|
|
71
|
+
// fixtures) that every call site removes on its way out and nothing removes when a run
|
|
72
|
+
// ends badly. Startup rather than shutdown precisely because that catches what a crash
|
|
73
|
+
// left behind, and detached so a slow or unreadable temp directory cannot delay the UI.
|
|
74
|
+
sweepTempInBackground();
|
|
75
|
+
// Times every frame the renderer writes to the real terminal. No-op unless
|
|
76
|
+
// MINDWEAVE_PERF names a file — see cli/perfLog.ts for why this cannot be measured
|
|
77
|
+
// from a test probe.
|
|
78
|
+
instrumentStdout(process.stdout);
|
|
79
|
+
process.on("exit", flushPerf);
|
|
80
|
+
// The shell the session starts in decides whether we take the screen at all. Applied
|
|
81
|
+
// HERE rather than being left to the app to correct on its first effect: entering and
|
|
82
|
+
// then immediately leaving is a visible flash of an empty alternate screen, and one
|
|
83
|
+
// frame of Ink output diffed by a framebuffer that is about to stand down.
|
|
84
|
+
// The saved choice is read here, not in the app, because the same answer decides whether
|
|
85
|
+
// to take the alternate screen at all — which happens before the first render.
|
|
86
|
+
const startupShell = startupMode(process.env["MINDWEAVE_SCREEN"], await loadScreenMode(process.cwd()));
|
|
87
|
+
// Name the session in the terminal tab and the process list, before the screen is taken
|
|
88
|
+
// (the title is a plain control write; doing it first keeps it out of the framebuffer's
|
|
89
|
+
// frame parsing). See appIdentity.ts.
|
|
90
|
+
nameSession();
|
|
91
|
+
enterAltScreen({ buffer: startupShell === "fullscreen" });
|
|
92
|
+
setFramebufferEnabled(startupShell === "fullscreen");
|
|
93
|
+
// Ink renders into a FRAMEBUFFER rather than straight to the terminal: each frame is
|
|
94
|
+
// parsed into a cell grid, diffed against what is already on screen, and only the
|
|
95
|
+
// cells that actually differ are written. Measured on a transcript-shaped screen,
|
|
96
|
+
// that is ~13x fewer bytes per frame (2,345 -> 178). See `cli/framebuffer/`.
|
|
97
|
+
//
|
|
98
|
+
// `incrementalRendering` is deliberately NOT enabled alongside it, and this is load
|
|
99
|
+
// bearing rather than a preference: that mode makes Ink emit only the LINES it thinks
|
|
100
|
+
// changed, interleaved with its own cursor movements, instead of a complete frame.
|
|
101
|
+
// The framebuffer's parser expects a whole frame — a partial one would be read as a
|
|
102
|
+
// full screen and everything it omitted would be blanked. One diff or the other, and
|
|
103
|
+
// ours is per-cell where Ink's is per-line.
|
|
104
|
+
// The frame-rate cap is what sets typing latency — see `cli/frameRate.ts` for the
|
|
105
|
+
// measurements and for why it is a timer rather than a cost.
|
|
106
|
+
// Nothing but the renderer may write to the screen while the UI owns it.
|
|
107
|
+
const restoreConsole = silenceConsole();
|
|
108
|
+
const instance = render(createElement(App, { resumeSessionId: startup.resumeSessionId, initialScreen: startupShell }), {
|
|
109
|
+
maxFps: MAX_FPS,
|
|
110
|
+
// Ink decides it is not talking to a person whenever CI is set in the environment, and then
|
|
111
|
+
// draws nothing until exit: a developer with CI=1 in their shell profile got a blank screen.
|
|
112
|
+
// This process has already checked that stdin is a real terminal (hasInteractiveInput above),
|
|
113
|
+
// which is the only thing that question should be asking.
|
|
114
|
+
interactive: true,
|
|
115
|
+
// Ctrl+C is handled by the app, not by Ink.
|
|
116
|
+
//
|
|
117
|
+
// Raw mode is on, so Ctrl+C arrives as a BYTE rather than as SIGINT — none of the
|
|
118
|
+
// signal handlers in altScreen.ts ever see it. Ink's default was then to unmount and
|
|
119
|
+
// nothing else: painting stopped, the process stayed alive with the turn still running,
|
|
120
|
+
// and because nothing exited, neither the terminal restore nor the synchronous kill of
|
|
121
|
+
// background shells (both `exit` hooks) ever ran. What that left on screen was a window
|
|
122
|
+
// that was no longer the app and not yet the shell, over work that was still going.
|
|
123
|
+
exitOnCtrlC: false,
|
|
124
|
+
// Console output is NOT a frame, and must not be routed into the stream of them.
|
|
125
|
+
//
|
|
126
|
+
// Ink offers to capture it and write it above the UI. Through the framebuffer that
|
|
127
|
+
// means the parser reads a log line as a frame and stamps foreign text into the model
|
|
128
|
+
// of the screen — and a cell the model has wrong is never revisited, because as far as
|
|
129
|
+
// a diff can see nothing about it changed. See `cli/quietConsole.ts`, which stops the
|
|
130
|
+
// output at the source instead.
|
|
131
|
+
patchConsole: false,
|
|
132
|
+
stdout: framebufferStdout(process.stdout, perfEnabled() ? (s) => perf(`frame in=${s.inBytes} out=${s.outBytes}`) : undefined),
|
|
133
|
+
});
|
|
134
|
+
// `/update` cannot hand the terminal over from inside the UI: the handover has to happen
|
|
135
|
+
// after Ink has unmounted, and unmounting is what ends the render. So the command records
|
|
136
|
+
// what it wants and the app closes the way it always closes; this is where the intention
|
|
137
|
+
// is read, with the screen already given back.
|
|
138
|
+
await instance.waitUntilExit();
|
|
139
|
+
restoreConsole();
|
|
140
|
+
const restart = takePendingRestart();
|
|
141
|
+
if (restart) {
|
|
142
|
+
process.exit(await relaunch(restart.packageRoot, restart.sessionId, restart.previousVersion, restart.prefix, {
|
|
143
|
+
// The order here is the whole risk. Both processes can write to this terminal and
|
|
144
|
+
// both can want raw mode, so the old one is completely out — alternate screen left,
|
|
145
|
+
// mouse reporting off, cursor and autowrap restored, stdin no longer raw — before
|
|
146
|
+
// the new one is allowed to start. `exitAltScreen` is idempotent, so the exit hook
|
|
147
|
+
// that also calls it later changes nothing.
|
|
148
|
+
teardown: () => {
|
|
149
|
+
exitAltScreen();
|
|
150
|
+
if (process.stdin.isTTY)
|
|
151
|
+
process.stdin.setRawMode(false);
|
|
152
|
+
process.stdin.pause();
|
|
153
|
+
},
|
|
154
|
+
spawn: (command, args) => new Promise((resolve) => {
|
|
155
|
+
const child = spawn(command, args, { stdio: "inherit" });
|
|
156
|
+
child.on("error", () => resolve({ code: 1, signal: null }));
|
|
157
|
+
child.on("close", (code, signal) => resolve({ code, signal }));
|
|
158
|
+
}),
|
|
159
|
+
report: (text) => process.stdout.write(text + "\n"),
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,KAAK,IAAI,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3F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AM,EAAE;QAC9F,kFAAkF;QAClF,oFAAoF;QACpF,kFAAkF;QAClF,mFAAmF;QACnF,4CAA4C;QAC5C,QAAQ,EAAE,GAAG,EAAE;YACb,aAAa,EAAE,CAAC;YAChB,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK;gBAAE,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACzD,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;QACD,KAAK,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CACvB,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACtB,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YACzD,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YAC5D,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC;QACJ,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;KACpD,CAAC,CACH,CAAC;AACJ,CAAC"}
|
package/dist/mcp/manager.js
CHANGED
|
@@ -661,6 +661,24 @@ export class McpManager {
|
|
|
661
661
|
return !this.quarantined.has(name) && !this.forbidden.has(name);
|
|
662
662
|
});
|
|
663
663
|
}
|
|
664
|
+
/**
|
|
665
|
+
* One server's tools as a manage screen lists them: every tool it offers, each marked
|
|
666
|
+
* with whether the user's governance is holding it back (changed since it was trusted,
|
|
667
|
+
* or forbidden). A listing only; dispatch still goes through `allowedCatalog`.
|
|
668
|
+
*/
|
|
669
|
+
toolsFor(server) {
|
|
670
|
+
return this.catalog()
|
|
671
|
+
.filter((d) => d.server === server)
|
|
672
|
+
.map((def) => {
|
|
673
|
+
const name = mcpToolName(def.server, def.name);
|
|
674
|
+
return { def, blocked: this.quarantined.has(name) ? "changed" : this.forbidden.has(name) ? "forbidden" : null };
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
/** Accept every changed (quarantined) tool without asking, for a UI that has
|
|
678
|
+
* already asked the user itself. Same effect as answering "Allow" to `reviewQuarantine`. */
|
|
679
|
+
async allowChanged() {
|
|
680
|
+
return this.reviewQuarantine(async () => ALLOW_CHANGED);
|
|
681
|
+
}
|
|
664
682
|
/** How many tools are currently offered (for status lines and budgeting). */
|
|
665
683
|
toolCount() {
|
|
666
684
|
return this.allowedCatalog().length;
|