openclaw-app 1.1.3 → 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 CHANGED
@@ -910,21 +910,75 @@ async function handleRpc(ctx: any, accountId: string, msg: any): Promise<boolean
910
910
  };
911
911
 
912
912
  try {
913
- if (method === "agents.list") {
914
- const agents = runtime.agents?.list?.() ?? runtime.config?.loadConfig()?.agents?.agents ?? [];
915
- // Normalize to [{id, name, emoji, workspace, createdAt}]
916
- const list = Array.isArray(agents) ? agents.map((a: any) => ({
913
+ if (method === "runtime.inspect") {
914
+ // Debug: return top-level keys of runtime object
915
+ const keys = Object.keys(runtime ?? {});
916
+ const cfgKeys = runtime?.config ? Object.keys(runtime.config) : [];
917
+ const cfg = runtime?.config?.loadConfig?.() ?? {};
918
+ const cfgTopKeys = Object.keys(cfg);
919
+ // Try to find agents in config
920
+ const agentsCfg = cfg.agents ?? cfg.agent ?? {};
921
+ const agentsListKeys = Object.keys(agentsCfg);
922
+ const agentsList = agentsCfg.list ?? agentsCfg.agents ?? agentsCfg ?? [];
923
+ await sendRpcReply({
924
+ runtimeKeys: keys,
925
+ configKeys: cfgKeys,
926
+ cfgTopKeys,
927
+ agentsCfgKeys: agentsListKeys,
928
+ agentsListType: Array.isArray(agentsList) ? `array[${agentsList.length}]` : typeof agentsList,
929
+ agentsSample: Array.isArray(agentsList) ? agentsList.slice(0, 3) : agentsList,
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 });
938
+ } else if (method === "agents.list") {
939
+ const cfg = runtime.config.loadConfig();
940
+ // cfg.agents structure: { defaults: {...}, list: [{id, name, workspace, ...}], ... }
941
+ const agentsCfg = cfg.agents ?? {};
942
+ let raw: any[] = [];
943
+ if (Array.isArray(agentsCfg.list)) {
944
+ raw = agentsCfg.list;
945
+ } else if (Array.isArray(agentsCfg.agents)) {
946
+ raw = agentsCfg.agents;
947
+ } else if (Array.isArray(agentsCfg)) {
948
+ raw = agentsCfg;
949
+ }
950
+ ctx.log?.info?.(`[${CHANNEL_ID}] agents raw count: ${raw.length}`);
951
+ const list = raw.map((a: any) => ({
917
952
  id: a.id ?? a.agentId ?? '',
918
953
  name: a.name ?? a.id ?? '',
919
954
  emoji: a.emoji ?? null,
920
955
  workspace: a.workspace ?? null,
921
956
  createdAt: a.createdAt ?? null,
922
- })).filter((a: any) => a.id) : [];
957
+ })).filter((a: any) => a.id);
923
958
  await sendRpcReply({ agents: list });
924
959
  } else if (method === "sessions.list") {
925
960
  const cfg = runtime.config.loadConfig();
926
961
  const sessions = runtime.session?.listSessions?.({ cfg, accountId }) ?? [];
927
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
+ }
928
982
  } else {
929
983
  await sendRpcReply(null, `Unknown RPC method: ${method}`);
930
984
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "openclaw-app",
3
3
  "name": "OpenClaw App",
4
- "version": "1.1.3",
4
+ "version": "1.1.5",
5
5
  "description": "Mobile app channel for OpenClaw — chat via the OpenClaw App app through a Cloudflare Worker relay.",
6
6
  "channels": [
7
7
  "openclaw-app"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-app",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "OpenClaw App channel plugin — relay bridge for the OpenClaw App app",
5
5
  "main": "index.ts",
6
6
  "type": "module",