mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-23 16:30:12 +00:00
* feat(codex): add plugin enable disable list commands * fix(codex): escape plugin management output * test(codex): narrow plugin command coverage * fix(codex): gate plugin management writes * test(codex): type command plugin context * fix(codex): recover plugin app bindings * fix(codex): fail closed on missing app inventory * fix(codex): restore plugin thread config log signal * revert(codex): drop plugin management commands * fix(codex): warn on missing plugin app inventory * fix(codex): trim plugin binding debug logs * fix(codex): restore thread lifecycle json import * chore(codex): remove plugin app debug logs * fix(codex): redact plugin thread config logs
73 lines
2.6 KiB
TypeScript
73 lines
2.6 KiB
TypeScript
import type { AgentHarness } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
import type {
|
|
CodexAppServerListModelsOptions,
|
|
CodexAppServerModel,
|
|
CodexAppServerModelListResult,
|
|
} from "./src/app-server/models.js";
|
|
|
|
const DEFAULT_CODEX_HARNESS_PROVIDER_IDS = new Set(["codex"]);
|
|
|
|
export type { CodexAppServerListModelsOptions, CodexAppServerModel, CodexAppServerModelListResult };
|
|
|
|
export function createCodexAppServerAgentHarness(options?: {
|
|
id?: string;
|
|
label?: string;
|
|
providerIds?: Iterable<string>;
|
|
pluginConfig?: unknown;
|
|
resolvePluginConfig?: () => unknown;
|
|
}): AgentHarness {
|
|
const providerIds = new Set(
|
|
[...(options?.providerIds ?? DEFAULT_CODEX_HARNESS_PROVIDER_IDS)].map((id) =>
|
|
id.trim().toLowerCase(),
|
|
),
|
|
);
|
|
return {
|
|
id: options?.id ?? "codex",
|
|
label: options?.label ?? "Codex agent harness",
|
|
deliveryDefaults: {
|
|
sourceVisibleReplies: "message_tool",
|
|
},
|
|
supports: (ctx) => {
|
|
const provider = ctx.provider.trim().toLowerCase();
|
|
if (providerIds.has(provider)) {
|
|
return { supported: true, priority: 100 };
|
|
}
|
|
return {
|
|
supported: false,
|
|
reason: `provider is not one of: ${[...providerIds].toSorted().join(", ")}`,
|
|
};
|
|
},
|
|
runAttempt: async (params) => {
|
|
const { runCodexAppServerAttempt } = await import("./src/app-server/run-attempt.js");
|
|
return runCodexAppServerAttempt(params, {
|
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
nativeHookRelay: { enabled: true },
|
|
});
|
|
},
|
|
runSideQuestion: async (params) => {
|
|
const { runCodexAppServerSideQuestion } = await import("./src/app-server/side-question.js");
|
|
return runCodexAppServerSideQuestion(params, {
|
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
nativeHookRelay: { enabled: true },
|
|
});
|
|
},
|
|
compact: async (params) => {
|
|
const { maybeCompactCodexAppServerSession } = await import("./src/app-server/compact.js");
|
|
return maybeCompactCodexAppServerSession(params, {
|
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
});
|
|
},
|
|
reset: async (params) => {
|
|
if (params.sessionFile) {
|
|
const { clearCodexAppServerBinding } = await import("./src/app-server/session-binding.js");
|
|
await clearCodexAppServerBinding(params.sessionFile);
|
|
}
|
|
},
|
|
dispose: async () => {
|
|
const { clearSharedCodexAppServerClientAndWait } =
|
|
await import("./src/app-server/shared-client.js");
|
|
await clearSharedCodexAppServerClientAndWait();
|
|
},
|
|
};
|
|
}
|