Files
ContractorAgent/plugin/core/contractor/metadata-resolver.ts
hzhang 07a0f06e2e 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>
2026-04-11 21:21:32 +01:00

34 lines
962 B
TypeScript

import type { ContractorAgentMetadata } from "../types/contractor.js";
const CONTRACTOR_MODEL = "contractor-agent/contractor-claude-bridge";
type AgentConfig = {
id: string;
workspace?: string;
model?: string;
};
/**
* Determine whether an agent is a contractor-backed Claude agent and return its metadata.
* Contractor agents are identified by their model string — we do NOT use a custom
* runtime.type because OpenClaw's schema only allows "embedded" or "acp".
* Returns null if the agent is not contractor-backed.
*/
export function resolveContractorAgentMetadata(
agentConfig: AgentConfig,
permissionMode: string,
): ContractorAgentMetadata | null {
if (agentConfig.model !== CONTRACTOR_MODEL) return null;
const workspace = agentConfig.workspace;
if (!workspace) return null;
return {
agentId: agentConfig.id,
contractor: "claude",
bridgeModel: "contractor-claude-bridge",
workspace,
permissionMode,
};
}