mono-pilot 0.2.9 → 0.2.12
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 +270 -7
- 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 +60 -35
- 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 +94 -50
- 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/mcp/config.js +112 -0
- package/dist/src/{utils/mcp-client.js → mcp/protocol.js} +1 -100
- package/dist/src/mcp/servers.js +90 -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/src/rules/discovery.js +41 -0
- package/dist/{tools → src/tools}/README.md +29 -3
- 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 +40 -124
- 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 +56 -100
- 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 +46 -57
- package/dist/{tools → src/tools}/list-mcp-tools.js +52 -63
- 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/{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
|
@@ -1,49 +1,41 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { readdir } from "node:fs/promises";
|
|
3
2
|
import { homedir } from "node:os";
|
|
4
|
-
import {
|
|
3
|
+
import { dirname, resolve } from "node:path";
|
|
5
4
|
import { fileURLToPath } from "node:url";
|
|
6
5
|
import { Text } from "@mariozechner/pi-tui";
|
|
7
6
|
import { hasMessageEntries } from "./mode-runtime.js";
|
|
7
|
+
import { isServerEnabled, loadMcpConfig, toNonEmptyString } from "../mcp/config.js";
|
|
8
|
+
import { discoverRules } from "../rules/discovery.js";
|
|
8
9
|
const SESSION_HINTS_MESSAGE_TYPE = "SessionHints";
|
|
9
|
-
const RULES_RELATIVE_DIR = join(".pi", "rules");
|
|
10
10
|
const MONO_PILOT_NAME = "mono-pilot";
|
|
11
11
|
const MAX_VERSION_SEARCH_DEPTH = 6;
|
|
12
12
|
let cachedVersion = null;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (!existsSync(dirPath))
|
|
16
|
-
return [];
|
|
13
|
+
async function discoverMcpServers(cwd) {
|
|
14
|
+
let config;
|
|
17
15
|
try {
|
|
18
|
-
|
|
19
|
-
return entries
|
|
20
|
-
.filter((e) => e.isFile() && e.name.endsWith(".rule.txt"))
|
|
21
|
-
.map((e) => resolve(dirPath, e.name))
|
|
22
|
-
.sort((a, b) => a.localeCompare(b));
|
|
16
|
+
config = await loadMcpConfig(cwd);
|
|
23
17
|
}
|
|
24
18
|
catch {
|
|
25
|
-
return [];
|
|
19
|
+
return { userMcpServers: [], projectMcpServers: [] };
|
|
26
20
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const uniqueUserRules = dedupeByName(userRules);
|
|
46
|
-
return { userRules: uniqueUserRules, projectRules: uniqueWorkspaceRules };
|
|
21
|
+
if (!config)
|
|
22
|
+
return { userMcpServers: [], projectMcpServers: [] };
|
|
23
|
+
const groups = { user: [], project: [] };
|
|
24
|
+
for (const [serverName, serverConfig] of Object.entries(config.servers)) {
|
|
25
|
+
if (!isServerEnabled(serverConfig))
|
|
26
|
+
continue;
|
|
27
|
+
const source = config.sourceByServer[serverName];
|
|
28
|
+
if (!source)
|
|
29
|
+
continue;
|
|
30
|
+
groups[source.scope].push({ name: serverName, url: toNonEmptyString(serverConfig.url) });
|
|
31
|
+
}
|
|
32
|
+
for (const servers of Object.values(groups)) {
|
|
33
|
+
servers.sort((a, b) => a.name.localeCompare(b.name));
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
userMcpServers: groups.user,
|
|
37
|
+
projectMcpServers: groups.project,
|
|
38
|
+
};
|
|
47
39
|
}
|
|
48
40
|
function shortenHome(filePath) {
|
|
49
41
|
const home = homedir();
|
|
@@ -94,8 +86,14 @@ export default function sessionHintsExtension(pi) {
|
|
|
94
86
|
lines.push(theme.fg("dim", "option+m") + theme.fg("muted", " to cycle Plan/Ask/Agent mode"));
|
|
95
87
|
const userRules = details?.userRules ?? [];
|
|
96
88
|
const projectRules = details?.projectRules ?? [];
|
|
97
|
-
|
|
89
|
+
const userMcpServers = details?.userMcpServers ?? [];
|
|
90
|
+
const projectMcpServers = details?.projectMcpServers ?? [];
|
|
91
|
+
const hasRules = userRules.length > 0 || projectRules.length > 0;
|
|
92
|
+
const hasMcp = userMcpServers.length > 0 || projectMcpServers.length > 0;
|
|
93
|
+
if (hasRules || hasMcp) {
|
|
98
94
|
lines.push("");
|
|
95
|
+
}
|
|
96
|
+
if (hasRules) {
|
|
99
97
|
lines.push(theme.fg("mdHeading", "[Rules]"));
|
|
100
98
|
if (userRules.length > 0) {
|
|
101
99
|
lines.push(` ${theme.fg("accent", "user")}`);
|
|
@@ -110,6 +108,26 @@ export default function sessionHintsExtension(pi) {
|
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
110
|
}
|
|
111
|
+
if (hasRules && hasMcp) {
|
|
112
|
+
lines.push("");
|
|
113
|
+
}
|
|
114
|
+
if (hasMcp) {
|
|
115
|
+
lines.push(theme.fg("mdHeading", "[MCP Servers]"));
|
|
116
|
+
if (userMcpServers.length > 0) {
|
|
117
|
+
lines.push(` ${theme.fg("accent", "user")}`);
|
|
118
|
+
for (const server of userMcpServers) {
|
|
119
|
+
const urlPart = server.url ? ` ${theme.fg("muted", server.url)}` : "";
|
|
120
|
+
lines.push(` ${theme.fg("dim", server.name)}${urlPart}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (projectMcpServers.length > 0) {
|
|
124
|
+
lines.push(` ${theme.fg("accent", "project")}`);
|
|
125
|
+
for (const server of projectMcpServers) {
|
|
126
|
+
const urlPart = server.url ? ` ${theme.fg("muted", server.url)}` : "";
|
|
127
|
+
lines.push(` ${theme.fg("dim", server.name)}${urlPart}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
113
131
|
return new Text(lines.join("\n"), 0, 0);
|
|
114
132
|
});
|
|
115
133
|
pi.on("session_start", async (_event, ctx) => {
|
|
@@ -118,7 +136,14 @@ export default function sessionHintsExtension(pi) {
|
|
|
118
136
|
const entries = ctx.sessionManager.getEntries();
|
|
119
137
|
if (hasMessageEntries(entries))
|
|
120
138
|
return;
|
|
121
|
-
const
|
|
139
|
+
const [rulesDetails, mcpDetails] = await Promise.all([
|
|
140
|
+
discoverRules(ctx.cwd),
|
|
141
|
+
discoverMcpServers(ctx.cwd),
|
|
142
|
+
]);
|
|
143
|
+
const details = {
|
|
144
|
+
...rulesDetails,
|
|
145
|
+
...mcpDetails,
|
|
146
|
+
};
|
|
122
147
|
pi.sendMessage({
|
|
123
148
|
customType: SESSION_HINTS_MESSAGE_TYPE,
|
|
124
149
|
content: "",
|