mono-pilot 0.2.10 → 0.2.13
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 +260 -2
- package/dist/src/agents-paths.js +36 -0
- package/dist/src/brief/blocks.js +83 -0
- package/dist/src/brief/defaults.js +60 -0
- package/dist/src/brief/frontmatter.js +53 -0
- package/dist/src/brief/paths.js +10 -0
- package/dist/src/brief/reflection.js +27 -0
- package/dist/src/cli.js +62 -5
- package/dist/src/cluster/bus.js +102 -0
- package/dist/src/cluster/follower.js +137 -0
- package/dist/src/cluster/init.js +182 -0
- package/dist/src/cluster/leader.js +97 -0
- package/dist/src/cluster/log.js +49 -0
- package/dist/src/cluster/protocol.js +34 -0
- package/dist/src/cluster/services/bus.js +243 -0
- package/dist/src/cluster/services/embedding.js +12 -0
- package/dist/src/cluster/socket.js +86 -0
- package/dist/src/cluster/test-bus.js +175 -0
- package/dist/src/cluster_v2/connection-lifecycle.js +31 -0
- package/dist/src/cluster_v2/connection-lifecycle.test.js +24 -0
- package/dist/src/cluster_v2/connection.js +159 -0
- package/dist/src/cluster_v2/connection.test.js +55 -0
- package/dist/src/cluster_v2/events.js +102 -0
- package/dist/src/cluster_v2/index.js +2 -0
- package/dist/src/cluster_v2/observability.js +99 -0
- package/dist/src/cluster_v2/observability.test.js +46 -0
- package/dist/src/cluster_v2/rpc.js +389 -0
- package/dist/src/cluster_v2/rpc.test.js +110 -0
- package/dist/src/cluster_v2/runtime.failover.integration.test.js +156 -0
- package/dist/src/cluster_v2/runtime.js +531 -0
- package/dist/src/cluster_v2/runtime.lease-compromise.integration.test.js +91 -0
- package/dist/src/cluster_v2/runtime.lifecycle.integration.test.js +225 -0
- package/dist/src/cluster_v2/services/bus.integration.test.js +140 -0
- package/dist/src/cluster_v2/services/bus.js +450 -0
- package/dist/src/cluster_v2/services/discord/auth-store.js +82 -0
- package/dist/src/cluster_v2/services/discord/collector.js +569 -0
- package/dist/src/cluster_v2/services/discord/index.js +1 -0
- package/dist/src/cluster_v2/services/discord/oauth.js +87 -0
- package/dist/src/cluster_v2/services/discord/rpc-client.js +325 -0
- package/dist/src/cluster_v2/services/embedding.js +66 -0
- package/dist/src/cluster_v2/services/registry-cache.js +107 -0
- package/dist/src/cluster_v2/services/registry-cache.test.js +66 -0
- package/dist/src/cluster_v2/services/registry.js +36 -0
- package/dist/src/cluster_v2/services/twitter/collector.js +1055 -0
- package/dist/src/cluster_v2/services/twitter/index.js +1 -0
- package/dist/src/config/digest.js +78 -0
- package/dist/src/config/discord.js +143 -0
- package/dist/src/config/image-gen.js +48 -0
- package/dist/src/config/mono-pilot.js +31 -0
- package/dist/src/config/twitter.js +100 -0
- package/dist/src/extensions/cluster.js +311 -0
- package/dist/src/extensions/commands/build-memory.js +76 -0
- package/dist/src/extensions/commands/digest/backfill.js +779 -0
- package/dist/src/extensions/commands/digest/index.js +1133 -0
- package/dist/src/extensions/commands/image-model.js +214 -0
- package/dist/src/extensions/game/bus-injection.js +47 -0
- package/dist/src/extensions/game/identity.js +83 -0
- package/dist/src/extensions/game/mailbox.js +61 -0
- package/dist/src/extensions/game/system-prompt.js +134 -0
- package/dist/src/extensions/game/tools.js +28 -0
- package/dist/src/extensions/lifecycle.js +337 -0
- package/dist/src/extensions/mode-runtime.js +26 -2
- package/dist/src/extensions/mono-game.js +66 -0
- package/dist/src/extensions/mono-pilot.js +100 -18
- package/dist/src/extensions/nvim.js +47 -0
- package/dist/src/extensions/session-hints.js +1 -2
- package/dist/src/extensions/sftp.js +897 -0
- package/dist/src/extensions/status.js +676 -0
- package/dist/src/extensions/system-events.js +478 -0
- package/dist/src/extensions/system-prompt.js +24 -14
- package/dist/src/extensions/user-message.js +70 -1
- package/dist/src/lsp/client.js +235 -0
- package/dist/src/lsp/index.js +165 -0
- package/dist/src/lsp/runtime.js +67 -0
- package/dist/src/lsp/server.js +242 -0
- package/dist/src/memory/build-memory.js +103 -0
- package/dist/src/memory/config/defaults.js +55 -0
- package/dist/src/memory/config/loader.js +29 -0
- package/dist/src/memory/config/paths.js +9 -0
- package/dist/src/memory/config/resolve.js +90 -0
- package/dist/src/memory/config/types.js +1 -0
- package/dist/src/memory/embeddings/batch-runner.js +39 -0
- package/dist/src/memory/embeddings/cache.js +47 -0
- package/dist/src/memory/embeddings/chunk-limits.js +26 -0
- package/dist/src/memory/embeddings/input-limits.js +48 -0
- package/dist/src/memory/embeddings/local.js +108 -0
- package/dist/src/memory/embeddings/types.js +1 -0
- package/dist/src/memory/index-manager.js +552 -0
- package/dist/src/memory/indexing/embeddings.js +67 -0
- package/dist/src/memory/indexing/files.js +180 -0
- package/dist/src/memory/indexing/index-file.js +105 -0
- package/dist/src/memory/log.js +38 -0
- package/dist/src/memory/paths.js +15 -0
- package/dist/src/memory/runtime/index.js +299 -0
- package/dist/src/memory/runtime/thread.js +116 -0
- package/dist/src/memory/search/fts.js +57 -0
- package/dist/src/memory/search/hybrid.js +50 -0
- package/dist/src/memory/search/text.js +30 -0
- package/dist/src/memory/search/vector.js +43 -0
- package/dist/src/memory/session/content-hash.js +7 -0
- package/dist/src/memory/session/entry.js +33 -0
- package/dist/src/memory/session/flush-policy.js +34 -0
- package/dist/src/memory/session/hook.js +191 -0
- package/dist/src/memory/session/paths.js +15 -0
- package/dist/src/memory/session/session-reader.js +88 -0
- package/dist/src/memory/session/transcript/content-hash.js +7 -0
- package/dist/src/memory/session/transcript/entry.js +28 -0
- package/dist/src/memory/session/transcript/flush.js +56 -0
- package/dist/src/memory/session/transcript/paths.js +28 -0
- package/dist/src/memory/session/transcript/reader.js +112 -0
- package/dist/src/memory/session/transcript/state.js +31 -0
- package/dist/src/memory/store/schema.js +89 -0
- package/dist/src/memory/store/sqlite.js +89 -0
- package/dist/src/memory/types.js +1 -0
- package/dist/src/memory/warm.js +25 -0
- package/dist/{tools → src/tools}/README.md +28 -2
- package/dist/{tools → src/tools}/apply-patch-description.md +8 -2
- package/dist/{tools → src/tools}/apply-patch.js +174 -104
- package/dist/{tools → src/tools}/apply-patch.test.js +52 -1
- package/dist/{tools/ask-question.js → src/tools/ask-user-question.js} +3 -3
- package/dist/src/tools/ast-grep.js +357 -0
- package/dist/src/tools/brief-write.js +122 -0
- package/dist/src/tools/bus-send.js +100 -0
- package/dist/{tools → src/tools}/call-mcp-tool.js +20 -24
- package/dist/src/tools/codex-apply-patch-description.md +52 -0
- package/dist/src/tools/codex-apply-patch.js +540 -0
- package/dist/{tools → src/tools}/delete.js +24 -0
- package/dist/src/tools/exit-plan-mode.js +83 -0
- package/dist/{tools → src/tools}/fetch-mcp-resource.js +31 -3
- package/dist/src/tools/generate-image.js +567 -0
- package/dist/{tools → src/tools}/glob.js +55 -1
- package/dist/{tools → src/tools}/list-mcp-resources.js +32 -3
- package/dist/{tools → src/tools}/list-mcp-tools.js +38 -3
- package/dist/src/tools/ls.js +48 -0
- package/dist/src/tools/lsp-diagnostics.js +67 -0
- package/dist/src/tools/lsp-symbols.js +54 -0
- package/dist/src/tools/mailbox.js +85 -0
- package/dist/src/tools/memory-get.js +90 -0
- package/dist/src/tools/memory-search.js +180 -0
- package/dist/{tools → src/tools}/plan-mode-reminder.md +3 -4
- package/dist/{tools → src/tools}/read-file.js +8 -19
- package/dist/{tools → src/tools}/rg.js +10 -20
- package/dist/{tools → src/tools}/shell.js +19 -42
- package/dist/{tools → src/tools}/subagent.js +255 -6
- package/dist/{tools → src/tools}/switch-mode.js +37 -6
- package/dist/{tools → src/tools}/web-fetch.js +105 -7
- package/dist/{tools → src/tools}/web-search.js +29 -1
- package/package.json +21 -9
- package/dist/src/utils/mcp-client.js +0 -282
- /package/dist/{tools → src/tools}/ask-mode-reminder.md +0 -0
- /package/dist/{tools → src/tools}/rg.test.js +0 -0
- /package/dist/{tools → src/tools}/semantic-search-description.md +0 -0
- /package/dist/{tools → src/tools}/semantic-search.js +0 -0
- /package/dist/{tools → src/tools}/shell-description.md +0 -0
- /package/dist/{tools → src/tools}/subagent-description.md +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { createModeStateData, modeRuntimeStore, MODE_STATE_ENTRY_TYPE, } from "../extensions/mode-runtime.js";
|
|
3
|
+
const MODE_STATUS_KEY = "mono-pilot-mode";
|
|
4
|
+
const DESCRIPTION = `
|
|
5
|
+
Use this tool when you are in Plan mode, have finished updating the plan file, and are ready to leave Plan mode.
|
|
6
|
+
|
|
7
|
+
## How This Tool Works
|
|
8
|
+
- You should have already written your plan to the plan file specified in the plan mode system message
|
|
9
|
+
- This tool does NOT take plan content as input
|
|
10
|
+
- This tool switches the runtime mode from Plan to Agent
|
|
11
|
+
- This tool should be called only after the user explicitly approves the plan or asks to proceed with execution
|
|
12
|
+
|
|
13
|
+
## When to Use This Tool
|
|
14
|
+
IMPORTANT: Only use this tool when the task requires planning implementation steps for code changes. For research-only tasks where you're gathering information, searching files, or reading files, do NOT use this tool.
|
|
15
|
+
|
|
16
|
+
## Before Using This Tool
|
|
17
|
+
Ensure your plan is complete and unambiguous:
|
|
18
|
+
- If you have unresolved questions about requirements or approach, use AskQuestion first
|
|
19
|
+
- If you do not see a plan file path in system_reminder, do NOT call this tool because there is no concrete plan artifact to finalize and no need to exit Plan mode for execution.
|
|
20
|
+
- Present the finalized plan to the user and wait for explicit approval before calling this tool
|
|
21
|
+
- Once your plan is finalized, use THIS tool to exit Plan mode
|
|
22
|
+
|
|
23
|
+
**Important:** Do NOT call this tool immediately after drafting a plan. Wait for explicit user approval in the conversation first.
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
1. Initial task: "Search for and understand the implementation of vim mode in the codebase" - Do not use the exit plan mode tool because you are not planning the implementation steps of a task.
|
|
28
|
+
2. Initial task: "Help me implement yank mode for vim" - Draft and present the plan, wait for user approval, then use this tool.
|
|
29
|
+
3. Initial task: "Add a new feature to handle user authentication" - If unsure about auth method (OAuth, JWT, etc.), use AskQuestion first, present the finalized plan, then call this tool only after user approval.
|
|
30
|
+
`.trim();
|
|
31
|
+
const exitPlanModeSchema = Type.Object({});
|
|
32
|
+
function updateModeStatus(ctx) {
|
|
33
|
+
if (!ctx.hasUI)
|
|
34
|
+
return;
|
|
35
|
+
const { activeMode } = modeRuntimeStore.getSnapshot();
|
|
36
|
+
const statusText = activeMode === "plan"
|
|
37
|
+
? ctx.ui.theme.fg("warning", "mode:plan")
|
|
38
|
+
: activeMode === "ask"
|
|
39
|
+
? ctx.ui.theme.fg("borderAccent", "mode:ask")
|
|
40
|
+
: ctx.ui.theme.fg("muted", "mode:agent");
|
|
41
|
+
ctx.ui.setStatus(MODE_STATUS_KEY, statusText);
|
|
42
|
+
}
|
|
43
|
+
function persistModeState(pi) {
|
|
44
|
+
pi.appendEntry(MODE_STATE_ENTRY_TYPE, createModeStateData(modeRuntimeStore.getSnapshot()));
|
|
45
|
+
}
|
|
46
|
+
export default function exitPlanModeExtension(pi) {
|
|
47
|
+
pi.registerTool({
|
|
48
|
+
name: "ExitPlanMode",
|
|
49
|
+
label: "ExitPlanMode",
|
|
50
|
+
description: DESCRIPTION,
|
|
51
|
+
parameters: exitPlanModeSchema,
|
|
52
|
+
async execute(_toolCallId, _params, _signal, _onUpdate, ctx) {
|
|
53
|
+
const before = modeRuntimeStore.getSnapshot();
|
|
54
|
+
if (before.activeMode !== "plan") {
|
|
55
|
+
const details = {
|
|
56
|
+
previous_mode: before.activeMode,
|
|
57
|
+
active_mode: before.activeMode,
|
|
58
|
+
changed: false,
|
|
59
|
+
plan_file: before.planFilePath,
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
content: [{ type: "text", text: "Plan mode is not active." }],
|
|
63
|
+
details,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const { changed, snapshot } = modeRuntimeStore.setMode("agent");
|
|
67
|
+
if (changed) {
|
|
68
|
+
persistModeState(pi);
|
|
69
|
+
}
|
|
70
|
+
updateModeStatus(ctx);
|
|
71
|
+
const details = {
|
|
72
|
+
previous_mode: before.activeMode,
|
|
73
|
+
active_mode: snapshot.activeMode,
|
|
74
|
+
changed,
|
|
75
|
+
plan_file: snapshot.planFilePath,
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
content: [{ type: "text", text: "Exited Plan mode. Switched to Agent mode." }],
|
|
79
|
+
details,
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
2
|
import { dirname, isAbsolute, resolve } from "node:path";
|
|
3
|
+
import { keyHint } from "@mariozechner/pi-coding-agent";
|
|
4
|
+
import { Text } from "@mariozechner/pi-tui";
|
|
3
5
|
import { Type } from "@sinclair/typebox";
|
|
4
|
-
import { McpServerError, resolveTargetServer } from "../
|
|
5
|
-
import { createRpcRequestId, formatJsonRpcError, initializeMcpSession, postJsonRpcRequest } from "../
|
|
6
|
-
import { formatErrorMessage, isRecord, toNonEmptyString } from "../
|
|
6
|
+
import { McpServerError, resolveTargetServer } from "../mcp/servers.js";
|
|
7
|
+
import { createRpcRequestId, formatJsonRpcError, initializeMcpSession, postJsonRpcRequest } from "../mcp/protocol.js";
|
|
8
|
+
import { formatErrorMessage, isRecord, toNonEmptyString } from "../mcp/config.js";
|
|
7
9
|
const DESCRIPTION = `Reads a specific resource from an MCP server, identified by server name and resource URI. Optionally, set downloadPath (relative to the workspace) to save the resource to disk; when set, the resource will be downloaded and not returned to the model.`;
|
|
8
10
|
const fetchMcpResourceSchema = Type.Object({
|
|
9
11
|
server: Type.String({ description: "The MCP server identifier" }),
|
|
@@ -83,6 +85,32 @@ export default function fetchMcpResourceExtension(pi) {
|
|
|
83
85
|
label: "FetchMcpResource",
|
|
84
86
|
description: DESCRIPTION,
|
|
85
87
|
parameters: fetchMcpResourceSchema,
|
|
88
|
+
renderCall(args, theme) {
|
|
89
|
+
const input = args;
|
|
90
|
+
const server = typeof input.server === "string" && input.server.trim().length > 0 ? input.server : "(missing server)";
|
|
91
|
+
const uri = typeof input.uri === "string" && input.uri.trim().length > 0 ? input.uri : "(missing uri)";
|
|
92
|
+
let text = theme.fg("toolTitle", theme.bold("FetchMcpResource"));
|
|
93
|
+
text += ` ${theme.fg("toolOutput", `${server} :: ${uri}`)}`;
|
|
94
|
+
return new Text(text, 0, 0);
|
|
95
|
+
},
|
|
96
|
+
renderResult(result, { expanded, isPartial }, theme) {
|
|
97
|
+
if (isPartial) {
|
|
98
|
+
return new Text(theme.fg("muted", "Fetching resource..."), 0, 0);
|
|
99
|
+
}
|
|
100
|
+
const textBlock = result.content.find((entry) => entry.type === "text" && typeof entry.text === "string");
|
|
101
|
+
if (!textBlock) {
|
|
102
|
+
return new Text(theme.fg("error", "No text result returned."), 0, 0);
|
|
103
|
+
}
|
|
104
|
+
const fullText = textBlock.text;
|
|
105
|
+
const lineCount = fullText.split("\n").length;
|
|
106
|
+
if (!expanded) {
|
|
107
|
+
const summary = `${lineCount} lines (click or ${keyHint("expandTools", "to expand")})`;
|
|
108
|
+
return new Text(theme.fg("muted", summary), 0, 0);
|
|
109
|
+
}
|
|
110
|
+
let text = fullText.split("\n").map((line) => theme.fg("toolOutput", line)).join("\n");
|
|
111
|
+
text += theme.fg("muted", `\n(click or ${keyHint("expandTools", "to collapse")})`);
|
|
112
|
+
return new Text(text, 0, 0);
|
|
113
|
+
},
|
|
86
114
|
async execute(toolCallId, params, signal, _onUpdate, ctx) {
|
|
87
115
|
let serverName;
|
|
88
116
|
let uri;
|