@cmdop/bot 2026.2.28 → 2026.3.101

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
@@ -16354,7 +16354,7 @@ var init_channel3 = __esm({
16354
16354
  { title: "Get help", message: "/help" }
16355
16355
  ]
16356
16356
  });
16357
- await say("Hello! Use `/exec`, `/agent`, `/files`, or `/help`.");
16357
+ await say("Hello! Use `/exec`, `/agent`, `/skills`, `/files`, or `/help`.");
16358
16358
  },
16359
16359
  threadContextChanged: async ({ saveThreadContext }) => {
16360
16360
  await saveThreadContext();
@@ -16886,6 +16886,103 @@ ${lines.join("\n\n")}`;
16886
16886
  }
16887
16887
  };
16888
16888
 
16889
+ // src/handlers/skills.ts
16890
+ init_errors();
16891
+ var SkillsHandler = class extends BaseHandler {
16892
+ name = "skills";
16893
+ description = "List, show, or run skills on the remote machine";
16894
+ usage = "/skills list | /skills show <name> | /skills run <name> <prompt>";
16895
+ requiredPermission = "EXECUTE";
16896
+ maxOutput;
16897
+ constructor(client, logger, config = {}) {
16898
+ super(client, logger);
16899
+ this.maxOutput = config.maxOutputLength ?? 4e3;
16900
+ }
16901
+ async handle(ctx) {
16902
+ const subcommand = ctx.args[0]?.toLowerCase();
16903
+ if (!subcommand) {
16904
+ return err(new CommandArgsError("skills", "Subcommand required. Usage: /skills list | /skills show <name> | /skills run <name> <prompt>"));
16905
+ }
16906
+ try {
16907
+ if (ctx.machine) {
16908
+ await this.client.skills.setMachine(ctx.machine);
16909
+ }
16910
+ switch (subcommand) {
16911
+ case "list":
16912
+ return await this.handleList();
16913
+ case "show":
16914
+ return await this.handleShow(ctx);
16915
+ case "run":
16916
+ return await this.handleRun(ctx);
16917
+ default:
16918
+ return err(new CommandArgsError("skills", `Unknown subcommand "${subcommand}". Usage: /skills list | /skills show <name> | /skills run <name> <prompt>`));
16919
+ }
16920
+ } catch (e3) {
16921
+ const errMsg = e3 instanceof Error ? e3.message : String(e3);
16922
+ this.logger.error("Skills operation failed", { error: errMsg });
16923
+ if (errMsg.includes("session_id") || errMsg.includes("No active session")) {
16924
+ return err(new CMDOPError("Machine is offline or CMDOP agent is not running.\nhttps://cmdop.com/downloads/"));
16925
+ }
16926
+ if (errMsg.includes("DEADLINE_EXCEEDED") || errMsg.includes("timeout")) {
16927
+ return err(new CMDOPError("Request timed out. The skill may be too complex \u2014 try a simpler prompt."));
16928
+ }
16929
+ if (errMsg.includes("UNAVAILABLE") || errMsg.includes("Connection refused")) {
16930
+ return err(new CMDOPError("Server unavailable. Check your connection and try again."));
16931
+ }
16932
+ return err(new CMDOPError(`Skills error: ${errMsg}`, e3 instanceof Error ? e3 : void 0));
16933
+ }
16934
+ }
16935
+ async handleList() {
16936
+ const skills = await this.client.skills.list();
16937
+ if (skills.length === 0) {
16938
+ return ok({ type: "text", text: "No skills installed." });
16939
+ }
16940
+ const lines = skills.map(
16941
+ (s4) => s4.description ? `${s4.name} \u2014 ${s4.description}` : s4.name
16942
+ );
16943
+ return ok({ type: "text", text: lines.join("\n") });
16944
+ }
16945
+ async handleShow(ctx) {
16946
+ const name = ctx.args[1];
16947
+ if (!name) {
16948
+ return err(new CommandArgsError("skills", "Skill name required. Usage: /skills show <name>"));
16949
+ }
16950
+ const detail = await this.client.skills.show(name);
16951
+ if (!detail.found) {
16952
+ return err(new CMDOPError(detail.error ?? `Skill "${name}" not found`));
16953
+ }
16954
+ const parts = [];
16955
+ if (detail.info) {
16956
+ parts.push(`Skill: ${detail.info.name}`);
16957
+ if (detail.info.description) parts.push(`Description: ${detail.info.description}`);
16958
+ if (detail.info.author) parts.push(`Author: ${detail.info.author}`);
16959
+ if (detail.info.version) parts.push(`Version: ${detail.info.version}`);
16960
+ if (detail.info.origin) parts.push(`Origin: ${detail.info.origin}`);
16961
+ }
16962
+ if (detail.source) parts.push(`Source: ${detail.source}`);
16963
+ if (detail.content) {
16964
+ const preview = detail.content.length > this.maxOutput ? detail.content.slice(0, this.maxOutput) + "\n...(truncated)" : detail.content;
16965
+ parts.push(`
16966
+ System prompt:
16967
+ ${preview}`);
16968
+ }
16969
+ return ok({ type: "code", code: parts.join("\n") });
16970
+ }
16971
+ async handleRun(ctx) {
16972
+ const name = ctx.args[1];
16973
+ if (!name) {
16974
+ return err(new CommandArgsError("skills", "Skill name and prompt required. Usage: /skills run <name> <prompt>"));
16975
+ }
16976
+ const prompt = ctx.args.slice(2).join(" ").trim();
16977
+ if (!prompt) {
16978
+ return err(new CommandArgsError("skills", "Prompt required. Usage: /skills run <name> <prompt>"));
16979
+ }
16980
+ const result = await this.client.skills.run(name, prompt);
16981
+ const code = result.text.length > this.maxOutput ? result.text.slice(0, this.maxOutput) + "\n...(truncated)" : result.text;
16982
+ return ok({ type: "code", code });
16983
+ }
16984
+ };
16985
+
16889
16986
  // src/config.ts
16890
16987
  init_errors();
16891
16988
  var BotSettingsSchema = z.object({
@@ -17005,6 +17102,7 @@ var IntegrationHub = class _IntegrationHub {
17005
17102
  const hub = new _IntegrationHub(client, logger, settings2, permissions, dispatcher, mode);
17006
17103
  hub.registerHandler(new TerminalHandler(client, logger, { maxOutputLength: settings2.maxOutputLength }));
17007
17104
  hub.registerHandler(new AgentHandler(client, logger, { maxOutputLength: settings2.maxOutputLength }));
17105
+ hub.registerHandler(new SkillsHandler(client, logger, { maxOutputLength: settings2.maxOutputLength }));
17008
17106
  hub.registerHandler(new FilesHandler(client, logger));
17009
17107
  hub.registerHandler(new HelpHandler(client, logger, {
17010
17108
  getCommands: () => dispatcher.getCommandList()