openclaw-app 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +26 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -928,6 +928,13 @@ async function handleRpc(ctx: any, accountId: string, msg: any): Promise<boolean
|
|
|
928
928
|
agentsListType: Array.isArray(agentsList) ? `array[${agentsList.length}]` : typeof agentsList,
|
|
929
929
|
agentsSample: Array.isArray(agentsList) ? agentsList.slice(0, 3) : agentsList,
|
|
930
930
|
});
|
|
931
|
+
} else if (method === "runtime.inspect.deep") {
|
|
932
|
+
// Inspect sub-objects to find agents.create capability
|
|
933
|
+
const systemKeys = runtime?.system ? Object.keys(runtime.system) : [];
|
|
934
|
+
const toolsKeys = runtime?.tools ? Object.keys(runtime.tools) : [];
|
|
935
|
+
const stateKeys = runtime?.state ? Object.keys(runtime.state) : [];
|
|
936
|
+
const agentsApiKeys = runtime?.agents ? Object.keys(runtime.agents) : [];
|
|
937
|
+
await sendRpcReply({ systemKeys, toolsKeys, stateKeys, agentsApiKeys });
|
|
931
938
|
} else if (method === "agents.list") {
|
|
932
939
|
const cfg = runtime.config.loadConfig();
|
|
933
940
|
// cfg.agents structure: { defaults: {...}, list: [{id, name, workspace, ...}], ... }
|
|
@@ -953,6 +960,25 @@ async function handleRpc(ctx: any, accountId: string, msg: any): Promise<boolean
|
|
|
953
960
|
const cfg = runtime.config.loadConfig();
|
|
954
961
|
const sessions = runtime.session?.listSessions?.({ cfg, accountId }) ?? [];
|
|
955
962
|
await sendRpcReply({ sessions });
|
|
963
|
+
} else if (method === "agents.create") {
|
|
964
|
+
// Use CLI: openclaw agents add <name> --workspace <path> [--model <model>]
|
|
965
|
+
const name = params.name as string | undefined;
|
|
966
|
+
const workspace = (params.workspace as string | undefined) ?? `~/.openclaw/agents/${name}`;
|
|
967
|
+
const model = params.model as string | undefined;
|
|
968
|
+
if (!name) {
|
|
969
|
+
await sendRpcReply(null, "agents.create: missing required param 'name'");
|
|
970
|
+
} else {
|
|
971
|
+
let cmd = `openclaw agents add ${name} --workspace ${workspace}`;
|
|
972
|
+
if (model) cmd += ` --model ${model}`;
|
|
973
|
+
ctx.log?.info?.(`[${CHANNEL_ID}] agents.create cmd: ${cmd}`);
|
|
974
|
+
const result = await runtime.system.runCommandWithTimeout(cmd, 15000);
|
|
975
|
+
ctx.log?.info?.(`[${CHANNEL_ID}] agents.create result: ${JSON.stringify(result)}`);
|
|
976
|
+
if (result.exitCode !== 0) {
|
|
977
|
+
await sendRpcReply(null, `Command failed (exit ${result.exitCode}): ${result.stderr ?? result.stdout ?? ''}`);
|
|
978
|
+
} else {
|
|
979
|
+
await sendRpcReply({ name, workspace, output: result.stdout ?? '' });
|
|
980
|
+
}
|
|
981
|
+
}
|
|
956
982
|
} else {
|
|
957
983
|
await sendRpcReply(null, `Unknown RPC method: ${method}`);
|
|
958
984
|
}
|
package/openclaw.plugin.json
CHANGED