fastclaw-cli 0.3.0 → 0.3.2

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/dist/index.js CHANGED
@@ -434,6 +434,9 @@ var FastClawClient = class {
434
434
  async getBotConnect(id) {
435
435
  return this.request("GET", `/bots/${id}/connect`);
436
436
  }
437
+ async getBotResources(id) {
438
+ return this.request("GET", `/bots/${id}/resources`);
439
+ }
437
440
  async resetBotToken(id) {
438
441
  return this.request("POST", `/bots/${id}/reset-token`);
439
442
  }
@@ -997,6 +1000,29 @@ function registerBotLifecycleCommands(bot) {
997
1000
  }
998
1001
  })
999
1002
  );
1003
+ bot.command("resources <id>").description("Show bot pod resource usage (CPU/memory)").action(
1004
+ withErrorHandler(async (id) => {
1005
+ const { client, cfg } = await resolveClientForBot(bot, id);
1006
+ const res = await client.getBotResources(id);
1007
+ if (cfg.json) {
1008
+ printJson(res);
1009
+ } else {
1010
+ printKeyValue({ "Bot ID": res.bot_id, Pod: res.pod_name });
1011
+ console.log();
1012
+ const headers = ["Container", "CPU Req", "CPU Limit", "CPU Usage", "Mem Req", "Mem Limit", "Mem Usage"];
1013
+ const rows = Object.entries(res.containers).map(([name, c]) => [
1014
+ name,
1015
+ c.requests?.cpu ?? "-",
1016
+ c.limits?.cpu ?? "-",
1017
+ c.usage?.cpu ?? "-",
1018
+ c.requests?.memory ?? "-",
1019
+ c.limits?.memory ?? "-",
1020
+ c.usage?.memory ?? "-"
1021
+ ]);
1022
+ printTable(headers, rows);
1023
+ }
1024
+ })
1025
+ );
1000
1026
  bot.command("reset-token <id>").description("Reset bot access token").action(
1001
1027
  withErrorHandler(async (id) => {
1002
1028
  const { client, cfg } = await resolveClientForBot(bot, id);
@@ -1040,27 +1066,14 @@ function registerBotRuntimeCommands(bot) {
1040
1066
  const runtime = bot.command("runtime").description("OpenClaw runtime introspection (requires running bot)");
1041
1067
  runtime.command("status <id>").description("Get OpenClaw runtime status").option("--all", "Include all status sections").option("--usage", "Include usage info").option("--deep", "Deep connectivity check").option("--timeout <ms>", "Timeout for deep checks").action(
1042
1068
  withErrorHandler(async (id, cmdOpts) => {
1043
- const { client, cfg } = await resolveClientForBot(bot, id);
1069
+ const { client } = await resolveClientForBot(bot, id);
1044
1070
  const res = await client.getRuntimeStatus(id, {
1045
1071
  all: cmdOpts.all,
1046
1072
  usage: cmdOpts.usage,
1047
1073
  deep: cmdOpts.deep,
1048
1074
  timeout: cmdOpts.timeout
1049
1075
  });
1050
- if (cfg.json) {
1051
- printJson(res);
1052
- } else {
1053
- const data = res;
1054
- const gw = data.gateway;
1055
- const os = data.os;
1056
- const sessions = data.sessions;
1057
- printKeyValue({
1058
- "OS": os?.label ?? "unknown",
1059
- "Gateway": gw?.reachable ? `reachable (${gw.mode})` : `${gw?.error ?? "unreachable"}`,
1060
- "Sessions": String(sessions?.count ?? "?"),
1061
- "Update Channel": data.updateChannel ?? "unknown"
1062
- });
1063
- }
1076
+ printJson(res);
1064
1077
  })
1065
1078
  );
1066
1079
  runtime.command("sessions <id>").description("List OpenClaw sessions").option("--agent <name>", "Filter by agent").option("--all-agents", "Show sessions from all agents").option("--active", "Show only active sessions").action(
@@ -1171,7 +1184,7 @@ function registerBotRuntimeCommands(bot) {
1171
1184
  }
1172
1185
  })
1173
1186
  );
1174
- runtime.command("exec <id>").description("Execute arbitrary openclaw CLI command (e.g. --cmd 'status --all --json')").requiredOption("-c, --cmd <command>", "The openclaw CLI command to execute").action(
1187
+ runtime.command("exec <id>").description("Execute arbitrary command in bot pod (e.g. --cmd 'id -un')").requiredOption("-c, --cmd <command>", "The command to execute in the pod").action(
1175
1188
  withErrorHandler(async (id, cmdOpts) => {
1176
1189
  const { client } = await resolveClientForBot(bot, id);
1177
1190
  const res = await client.runtimeExec(id, { command: cmdOpts.cmd });
package/dist/sdk.d.ts CHANGED
@@ -84,6 +84,20 @@ interface BotConnectResponse {
84
84
  ws_url: string;
85
85
  webchat_url: string;
86
86
  }
87
+ interface ResourceInfo {
88
+ cpu: string;
89
+ memory: string;
90
+ }
91
+ interface ContainerResources {
92
+ requests?: ResourceInfo;
93
+ limits?: ResourceInfo;
94
+ usage?: ResourceInfo;
95
+ }
96
+ interface BotResourcesResponse {
97
+ bot_id: string;
98
+ pod_name: string;
99
+ containers: Record<string, ContainerResources>;
100
+ }
87
101
  interface ResetTokenResponse {
88
102
  id: string;
89
103
  access_token: string;
@@ -235,6 +249,7 @@ declare class FastClawClient {
235
249
  restartBot(id: string): Promise<Bot>;
236
250
  getBotStatus(id: string): Promise<BotStatusResponse>;
237
251
  getBotConnect(id: string): Promise<BotConnectResponse>;
252
+ getBotResources(id: string): Promise<BotResourcesResponse>;
238
253
  resetBotToken(id: string): Promise<ResetTokenResponse>;
239
254
  listProviders(botId: string): Promise<Record<string, ModelProvider>>;
240
255
  addProvider(botId: string, provider: ModelProvider): Promise<ModelProvider>;
@@ -348,4 +363,4 @@ declare function isValidSlug(slug: string): boolean;
348
363
  declare function isValidUrl(url: string): boolean;
349
364
  declare function slugify(name: string): string;
350
365
 
351
- export { API_BASE, type AddChannelRequest, ApiError, type ApiResponse, type App, type Bot, type BotConnectResponse, type BotLogsResponse, type BotStatus, type BotStatusResponse, type BulkUpgradeResponse, CHANNEL_FIELDS, type ChannelResponse, type ChannelsMap, type ClientOptions, type CreateAppRequest, type CreateBotRequest, DEFAULT_URL, DM_POLICIES, type DeviceInfo, type DeviceListResponse, FastClawClient, type FastClawConfig, GROUP_POLICIES, MODEL_PRESETS, type ModelDefaults, type ModelProvider, PROVIDER_DEFAULTS, type PairedUsersResponse, type PairingApproveRequest, type PairingRequest, type PairingRevokeRequest, type ProviderModel, type ResetTokenResponse, type ResolvedConfig, type RuntimeExecRequest, type SetSkillRequest, type SkillInfo, type UpdateAppRequest, type UpdateBotRequest, type UpgradeRequest, type UpgradeResponse, getConfigPath, isValidSlug, isValidUrl, loadConfig, resolveConfig, saveConfig, slugify, updateConfig };
366
+ export { API_BASE, type AddChannelRequest, ApiError, type ApiResponse, type App, type Bot, type BotConnectResponse, type BotLogsResponse, type BotResourcesResponse, type BotStatus, type BotStatusResponse, type BulkUpgradeResponse, CHANNEL_FIELDS, type ChannelResponse, type ChannelsMap, type ClientOptions, type ContainerResources, type CreateAppRequest, type CreateBotRequest, DEFAULT_URL, DM_POLICIES, type DeviceInfo, type DeviceListResponse, FastClawClient, type FastClawConfig, GROUP_POLICIES, MODEL_PRESETS, type ModelDefaults, type ModelProvider, PROVIDER_DEFAULTS, type PairedUsersResponse, type PairingApproveRequest, type PairingRequest, type PairingRevokeRequest, type ProviderModel, type ResetTokenResponse, type ResolvedConfig, type ResourceInfo, type RuntimeExecRequest, type SetSkillRequest, type SkillInfo, type UpdateAppRequest, type UpdateBotRequest, type UpgradeRequest, type UpgradeResponse, getConfigPath, isValidSlug, isValidUrl, loadConfig, resolveConfig, saveConfig, slugify, updateConfig };
package/dist/sdk.js CHANGED
@@ -240,6 +240,9 @@ var FastClawClient = class {
240
240
  async getBotConnect(id) {
241
241
  return this.request("GET", `/bots/${id}/connect`);
242
242
  }
243
+ async getBotResources(id) {
244
+ return this.request("GET", `/bots/${id}/resources`);
245
+ }
243
246
  async resetBotToken(id) {
244
247
  return this.request("POST", `/bots/${id}/reset-token`);
245
248
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastclaw-cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "CLI and SDK for managing FastClaw bots",
5
5
  "type": "module",
6
6
  "main": "dist/sdk.js",