- 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>
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
import { spawn } from "node:child_process";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
|
|
const _G = globalThis as Record<string, unknown>;
|
|
const LIFECYCLE_KEY = "_contractorProbeLifecycleRegistered";
|
|
const SIDECAR_KEY = "_contractorProbeSidecarProcess";
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
function startSidecar(logger: OpenClawPluginApi["logger"]): void {
|
|
const serverPath = path.join(__dirname, "server.mjs");
|
|
const child = spawn(process.execPath, [serverPath], {
|
|
env: { ...process.env, PROBE_PORT: "8799" },
|
|
stdio: ["ignore", "pipe", "pipe"],
|
|
detached: false,
|
|
});
|
|
|
|
child.stdout?.on("data", (d: Buffer) =>
|
|
logger.info(`[contractor-probe-sidecar] ${d.toString().trim()}`)
|
|
);
|
|
child.stderr?.on("data", (d: Buffer) =>
|
|
logger.warn(`[contractor-probe-sidecar] ${d.toString().trim()}`)
|
|
);
|
|
child.on("exit", (code: number | null) =>
|
|
logger.info(`[contractor-probe-sidecar] exited code=${code}`)
|
|
);
|
|
|
|
_G[SIDECAR_KEY] = child;
|
|
logger.info("[contractor-probe] sidecar started");
|
|
}
|
|
|
|
function stopSidecar(logger: OpenClawPluginApi["logger"]): void {
|
|
const child = _G[SIDECAR_KEY] as import("node:child_process").ChildProcess | undefined;
|
|
if (child && !child.killed) {
|
|
child.kill("SIGTERM");
|
|
logger.info("[contractor-probe] sidecar stopped");
|
|
}
|
|
}
|
|
|
|
export default {
|
|
id: "contractor-probe",
|
|
name: "Contractor Probe",
|
|
register(api: OpenClawPluginApi) {
|
|
if (!_G[LIFECYCLE_KEY]) {
|
|
_G[LIFECYCLE_KEY] = true;
|
|
startSidecar(api.logger);
|
|
api.on("gateway_stop", () => stopSidecar(api.logger));
|
|
}
|
|
|
|
api.logger.info("[contractor-probe] plugin registered");
|
|
},
|
|
};
|