refactor: restructure to plugin/ + services/ layout and add per-turn bootstrap injection

- Migrate src/ → plugin/ (plugin/core/, plugin/web/, plugin/commands/)
  and src/mcp/ → services/ per OpenClaw plugin dev spec
- Add Gemini CLI backend (plugin/core/gemini/sdk-adapter.ts) with GEMINI.md
  system-prompt injection
- Inject bootstrap as stateless system prompt on every turn instead of
  first turn only: Claude via --system-prompt, Gemini via workspace/GEMINI.md;
  eliminates isFirstTurn branch, keeps skills in sync with OpenClaw snapshots
- Fix session-map-store defensive parsing (sessions ?? []) to handle bare {}
  reset files without crashing on .find()
- Add docs/TEST_FLOW.md with E2E test scenarios and expected outcomes
- Add docs/claude/BRIDGE_MODEL_FINDINGS.md with contractor-probe results

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
h z
2026-04-11 21:21:32 +01:00
parent eee62efbf1
commit 07a0f06e2e
30 changed files with 1239 additions and 172 deletions

View File

@@ -46,31 +46,16 @@ function install() {
}
fs.mkdirSync(PLUGIN_INSTALL_DIR, { recursive: true });
// OpenClaw expects the plugin entry (index.ts) at the plugin root,
// matching the convention used by existing plugins like dirigent.
// We flatten src/ to the plugin root and copy supporting files alongside it.
// Copy plugin/ contents to the install root.
// plugin/ contains index.ts, openclaw.plugin.json, package.json, and subdirs.
const pluginDir = path.join(PROJECT_ROOT, "plugin");
fs.cpSync(pluginDir, PLUGIN_INSTALL_DIR, { recursive: true });
// Flatten src/ → plugin root
const srcDir = path.join(PROJECT_ROOT, "src");
fs.cpSync(srcDir, PLUGIN_INSTALL_DIR, { recursive: true });
// Copy package.json (update main to point to index.ts at root)
const pkg = JSON.parse(fs.readFileSync(path.join(PROJECT_ROOT, "package.json"), "utf8"));
pkg.main = "index.ts";
fs.writeFileSync(
path.join(PLUGIN_INSTALL_DIR, "package.json"),
JSON.stringify(pkg, null, 2) + "\n",
);
// Copy openclaw.plugin.json — set main to root index.ts
const manifest = JSON.parse(
fs.readFileSync(path.join(PROJECT_ROOT, "openclaw.plugin.json"), "utf8"),
);
manifest.main = "index.ts";
fs.writeFileSync(
path.join(PLUGIN_INSTALL_DIR, "openclaw.plugin.json"),
JSON.stringify(manifest, null, 2) + "\n",
);
// Copy services/ (standalone processes used by the plugin) into the install root.
const servicesDir = path.join(PROJECT_ROOT, "services");
if (fs.existsSync(servicesDir)) {
fs.cpSync(servicesDir, path.join(PLUGIN_INSTALL_DIR, "services"), { recursive: true });
}
// 2. Install npm dependencies inside the plugin dir
console.log(`[install] Installing npm dependencies...`);
@@ -99,6 +84,15 @@ function install() {
contextWindow: 200000,
maxTokens: 16000,
},
{
id: "contractor-gemini-bridge",
name: "Contractor Gemini Bridge",
reasoning: false,
input: ["text"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 200000,
maxTokens: 16000,
},
],
};