patches / p0-toolsProvider.patch
patches / p0-toolsProvider.patch
--- a/src/toolsProvider.ts
+++ b/src/toolsProvider.ts
@@ -383,11 +383,23 @@
let currentSystemPrompt = "You are a helpful assistant.";
// Load Instructions
- const instructionsPath = join(currentWorkingDirectory, "SUB_AGENT_INSTRUCTIONS.md");
- try {
- const instructions = await readFile(instructionsPath, "utf-8");
- if (instructions.trim()) currentSystemPrompt = instructions;
- } catch (e) { }
+ // Prefer packaged plugin instructions, then workspace copies.
+ const subAgentInstructionCandidates = [
+ join(__dirname, "..", "instructions", "SUB_AGENT_INSTRUCTIONS.md"),
+ join(__dirname, "instructions", "SUB_AGENT_INSTRUCTIONS.md"),
+ join(dirname(__dirname), "instructions", "SUB_AGENT_INSTRUCTIONS.md"),
+ join(currentWorkingDirectory, "instructions", "SUB_AGENT_INSTRUCTIONS.md"),
+ join(currentWorkingDirectory, "SUB_AGENT_INSTRUCTIONS.md"),
+ ];
+ for (const instructionsPath of subAgentInstructionCandidates) {
+ try {
+ const instructions = await readFile(instructionsPath, "utf-8");
+ if (instructions.trim()) {
+ currentSystemPrompt = instructions;
+ break;
+ }
+ } catch (e) { /* try next */ }
+ }
currentSystemPrompt += `\n\n## Current Workspace\nYour current working directory is: ${currentWorkingDirectory}\nAlways assume relative paths are from this directory.`;
@@ -687,21 +699,32 @@
const neo4jConfig = {
- uri: pluginConfig.get("neo4j.uri").trim(),
- username: pluginConfig.get("neo4j.username").trim(),
- password: pluginConfig.get("neo4j.password"),
+ uri: (pluginConfig.get("neo4j.uri") || "").trim(),
+ username: (pluginConfig.get("neo4j.username") || "neo4j").trim(),
+ password: pluginConfig.get("neo4j.password") ?? "",
};
+ /** Prefer plugin settings; optional connection_string is an override only. */
const resolveNeo4jConnection = (connectionString?: string) => {
- const uri = connectionString?.trim() || neo4jConfig.uri;
+ const uri = (connectionString?.trim() || neo4jConfig.uri).trim();
if (!uri) {
throw new Error(
- "Neo4j URI is not configured. Set neo4j.uri in plugin settings or provide connection_string.",
+ "Neo4j is not configured. Set neo4j.uri (and neo4j.password) in Timbers Toolbox plugin settings, or pass connection_string as an override.",
);
}
+ if (!connectionString?.trim() && !neo4jConfig.password) {
+ throw new Error(
+ "Neo4j password is empty. Set neo4j.password in Timbers Toolbox plugin settings.",
+ );
+ }
return {
connection_string: uri,
- username: neo4jConfig.username || undefined,
- password: neo4jConfig.password || undefined,
+ username: neo4jConfig.username || "neo4j",
+ password: neo4jConfig.password || undefined,
};
};
Also replace in tool group metadata strings:
"neo4j_create_rel" -> "neo4j_create_relationship"
"neo4j_delete_rel" -> "neo4j_delete_relationship"
Apply with:
cd /path/to/timbers-toolbox && patch -p1 < patches/p0-toolsProvider.patch
Or apply the two hunks manually in src/toolsProvider.ts.
--- a/src/toolsProvider.ts
+++ b/src/toolsProvider.ts
@@ -383,11 +383,23 @@
let currentSystemPrompt = "You are a helpful assistant.";
// Load Instructions
- const instructionsPath = join(currentWorkingDirectory, "SUB_AGENT_INSTRUCTIONS.md");
- try {
- const instructions = await readFile(instructionsPath, "utf-8");
- if (instructions.trim()) currentSystemPrompt = instructions;
- } catch (e) { }
+ // Prefer packaged plugin instructions, then workspace copies.
+ const subAgentInstructionCandidates = [
+ join(__dirname, "..", "instructions", "SUB_AGENT_INSTRUCTIONS.md"),
+ join(__dirname, "instructions", "SUB_AGENT_INSTRUCTIONS.md"),
+ join(dirname(__dirname), "instructions", "SUB_AGENT_INSTRUCTIONS.md"),
+ join(currentWorkingDirectory, "instructions", "SUB_AGENT_INSTRUCTIONS.md"),
+ join(currentWorkingDirectory, "SUB_AGENT_INSTRUCTIONS.md"),
+ ];
+ for (const instructionsPath of subAgentInstructionCandidates) {
+ try {
+ const instructions = await readFile(instructionsPath, "utf-8");
+ if (instructions.trim()) {
+ currentSystemPrompt = instructions;
+ break;
+ }
+ } catch (e) { /* try next */ }
+ }
currentSystemPrompt += `\n\n## Current Workspace\nYour current working directory is: ${currentWorkingDirectory}\nAlways assume relative paths are from this directory.`;
@@ -687,21 +699,32 @@
const neo4jConfig = {
- uri: pluginConfig.get("neo4j.uri").trim(),
- username: pluginConfig.get("neo4j.username").trim(),
- password: pluginConfig.get("neo4j.password"),
+ uri: (pluginConfig.get("neo4j.uri") || "").trim(),
+ username: (pluginConfig.get("neo4j.username") || "neo4j").trim(),
+ password: pluginConfig.get("neo4j.password") ?? "",
};
+ /** Prefer plugin settings; optional connection_string is an override only. */
const resolveNeo4jConnection = (connectionString?: string) => {
- const uri = connectionString?.trim() || neo4jConfig.uri;
+ const uri = (connectionString?.trim() || neo4jConfig.uri).trim();
if (!uri) {
throw new Error(
- "Neo4j URI is not configured. Set neo4j.uri in plugin settings or provide connection_string.",
+ "Neo4j is not configured. Set neo4j.uri (and neo4j.password) in Timbers Toolbox plugin settings, or pass connection_string as an override.",
);
}
+ if (!connectionString?.trim() && !neo4jConfig.password) {
+ throw new Error(
+ "Neo4j password is empty. Set neo4j.password in Timbers Toolbox plugin settings.",
+ );
+ }
return {
connection_string: uri,
- username: neo4jConfig.username || undefined,
- password: neo4jConfig.password || undefined,
+ username: neo4jConfig.username || "neo4j",
+ password: neo4jConfig.password || undefined,
};
};
Also replace in tool group metadata strings:
"neo4j_create_rel" -> "neo4j_create_relationship"
"neo4j_delete_rel" -> "neo4j_delete_relationship"
Apply with:
cd /path/to/timbers-toolbox && patch -p1 < patches/p0-toolsProvider.patch
Or apply the two hunks manually in src/toolsProvider.ts.