Files
openclaw/src/plugin-sdk/acp-runtime.ts
2026-04-04 15:24:50 +09:00

57 lines
1.9 KiB
TypeScript

// Public ACP runtime helpers for plugins that integrate with ACP control/session state.
import { __testing as managerTesting, getAcpSessionManager } from "../acp/control-plane/manager.js";
import { __testing as registryTesting } from "../acp/runtime/registry.js";
export { getAcpSessionManager };
export { AcpRuntimeError, isAcpRuntimeError } from "../acp/runtime/errors.js";
export type { AcpRuntimeErrorCode } from "../acp/runtime/errors.js";
export {
getAcpRuntimeBackend,
registerAcpRuntimeBackend,
requireAcpRuntimeBackend,
unregisterAcpRuntimeBackend,
} from "../acp/runtime/registry.js";
export type {
AcpRuntime,
AcpRuntimeCapabilities,
AcpRuntimeDoctorReport,
AcpRuntimeEnsureInput,
AcpRuntimeEvent,
AcpRuntimeHandle,
AcpRuntimeStatus,
AcpRuntimeTurnInput,
AcpSessionUpdateTag,
} from "../acp/runtime/types.js";
export { readAcpSessionEntry } from "../acp/runtime/session-meta.js";
export type { AcpSessionStoreEntry } from "../acp/runtime/session-meta.js";
// Keep test helpers off the hot init path. Eagerly merging them here can
// create a back-edge through the bundled ACP runtime chunk before the imported
// testing bindings finish initialization.
export const __testing = new Proxy({} as typeof managerTesting & typeof registryTesting, {
get(_target, prop, receiver) {
if (Reflect.has(managerTesting, prop)) {
return Reflect.get(managerTesting, prop, receiver);
}
return Reflect.get(registryTesting, prop, receiver);
},
has(_target, prop) {
return Reflect.has(managerTesting, prop) || Reflect.has(registryTesting, prop);
},
ownKeys() {
return Array.from(
new Set([...Reflect.ownKeys(managerTesting), ...Reflect.ownKeys(registryTesting)]),
);
},
getOwnPropertyDescriptor(_target, prop) {
if (Reflect.has(managerTesting, prop) || Reflect.has(registryTesting, prop)) {
return {
configurable: true,
enumerable: true,
};
}
return undefined;
},
});