mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
docs: document acpx entry contracts
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* ACPX runtime plugin entry. It registers the embedded ACP backend service and
|
||||
* wires reply-dispatch hooks into the plugin SDK runtime.
|
||||
*/
|
||||
import { tryDispatchAcpReplyHook } from "openclaw/plugin-sdk/acp-runtime-backend";
|
||||
import { createAcpxRuntimeService } from "./register.runtime.js";
|
||||
import type { OpenClawPluginApi } from "./runtime-api.js";
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Lazy ACPX runtime service registration. The plugin exposes an ACP backend
|
||||
* immediately, then imports the heavier service only when a session needs it.
|
||||
*/
|
||||
import {
|
||||
getAcpRuntimeBackend,
|
||||
registerAcpRuntimeBackend,
|
||||
@@ -62,6 +66,7 @@ function createDeferredRuntime(state: DeferredServiceState): AcpRuntime {
|
||||
return createLazyAcpRuntimeProxy(resolveRuntime);
|
||||
}
|
||||
|
||||
/** Creates the plugin service that registers ACPX as an ACP runtime backend. */
|
||||
export function createAcpxRuntimeService(
|
||||
params: CreateAcpxRuntimeServiceParams = {},
|
||||
): OpenClawPluginService {
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Public runtime API barrel for ACPX. Core and plugin consumers import these
|
||||
* SDK-facing ACP runtime contracts instead of reaching into ACPX internals.
|
||||
*/
|
||||
export type { AcpRuntimeErrorCode } from "openclaw/plugin-sdk/acp-runtime-backend";
|
||||
export {
|
||||
AcpRuntimeError,
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* ACPX setup plugin entry. It auto-enables setup when ACP config already points
|
||||
* at the embedded ACPX runtime backend.
|
||||
*/
|
||||
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
||||
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
/**
|
||||
* Small shell-command helpers for ACPX-launched processes. Splitting supports
|
||||
* simple quoted command strings from config without invoking a shell parser.
|
||||
*/
|
||||
/** Quote one command argument for display or config serialization. */
|
||||
export function quoteCommandPart(value: string): string {
|
||||
return JSON.stringify(value);
|
||||
}
|
||||
|
||||
/** Split a command string into argv-like parts using simple quote/backslash rules. */
|
||||
export function splitCommandParts(value: string): string[] {
|
||||
const parts: string[] = [];
|
||||
let current = "";
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
/**
|
||||
* ACPX plugin configuration schema and public config types. Runtime setup uses
|
||||
* this file as the single source of truth for validation and defaulting.
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
const ACPX_PERMISSION_MODES = ["approve-all", "approve-reads", "deny-all"] as const;
|
||||
/** Permission policy applied to interactive ACPX tool requests. */
|
||||
export type AcpxPermissionMode = (typeof ACPX_PERMISSION_MODES)[number];
|
||||
|
||||
const ACPX_NON_INTERACTIVE_POLICIES = ["deny", "fail"] as const;
|
||||
/** Permission policy applied when ACPX cannot ask a human for approval. */
|
||||
export type AcpxNonInteractivePermissionPolicy = (typeof ACPX_NON_INTERACTIVE_POLICIES)[number];
|
||||
|
||||
/** Default session timeout for ACPX runtime turns. */
|
||||
export const DEFAULT_ACPX_TIMEOUT_SECONDS = 120;
|
||||
|
||||
/** Raw MCP server command config accepted from plugin configuration. */
|
||||
export type McpServerConfig = {
|
||||
command: string;
|
||||
args?: string[];
|
||||
env?: Record<string, string>;
|
||||
};
|
||||
|
||||
/** Normalized MCP server config emitted to the ACPX runtime process. */
|
||||
export type AcpxMcpServer = {
|
||||
name: string;
|
||||
command: string;
|
||||
@@ -21,6 +30,7 @@ export type AcpxMcpServer = {
|
||||
env: Array<{ name: string; value: string }>;
|
||||
};
|
||||
|
||||
/** User-provided ACPX plugin configuration before defaults are resolved. */
|
||||
export type AcpxPluginConfig = {
|
||||
cwd?: string;
|
||||
stateDir?: string;
|
||||
@@ -36,6 +46,7 @@ export type AcpxPluginConfig = {
|
||||
agents?: Record<string, { command: string; args?: string[] }>;
|
||||
};
|
||||
|
||||
/** Fully resolved ACPX config consumed by the runtime service. */
|
||||
export type ResolvedAcpxPluginConfig = {
|
||||
cwd: string;
|
||||
stateDir: string;
|
||||
@@ -76,6 +87,7 @@ const McpServerConfigSchema = z.object({
|
||||
.describe("Environment variables for the MCP server"),
|
||||
});
|
||||
|
||||
/** Zod schema for validating raw ACPX plugin config from OpenClaw config. */
|
||||
export const AcpxPluginConfigSchema = z.strictObject({
|
||||
cwd: nonEmptyTrimmedString("cwd must be a non-empty string").optional(),
|
||||
stateDir: nonEmptyTrimmedString("stateDir must be a non-empty string").optional(),
|
||||
|
||||
Reference in New Issue
Block a user