"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var session_commands_exports = {};
__export(session_commands_exports, {
  forkCommand: () => forkCommand,
  renameCommand: () => renameCommand,
  resumeCommand: () => resumeCommand,
  searchCommand: () => searchCommand
});
module.exports = __toCommonJS(session_commands_exports);
const resumeCommand = {
  name: "resume",
  description: "Switch to a different session (interactive selector)",
  usage: "/resume",
  category: "General",
  aliases: ["r"],
  handler: async (_args, _agent, _ctx) => {
    const helpText = [
      "\u{1F4CB} Resume Session",
      "\nType /resume to show the session selector\n"
    ].join("\n");
    return helpText;
  }
};
const searchCommand = {
  name: "search",
  description: "Search messages across all sessions",
  usage: "/search",
  category: "General",
  aliases: ["find"],
  handler: async (_args, _agent, _ctx) => {
    return true;
  }
};
const renameCommand = {
  name: "rename",
  description: "Rename the current session",
  usage: "/rename",
  category: "General",
  handler: async (_args, _agent, _ctx) => {
    return true;
  }
};
const forkCommand = {
  name: "fork",
  description: "Fork a session and create a child session with copied history",
  usage: "/fork",
  category: "General",
  handler: async (_args, agent, ctx) => {
    const parentSessionId = ctx.sessionId;
    if (!parentSessionId) {
      return ["\u274C No active session to fork.", "Start a session first, then run /fork."].join(
        "\n"
      );
    }
    const childSession = await agent.forkSession(parentSessionId);
    const childMetadata = await agent.getSessionMetadata(childSession.id);
    const title = childMetadata?.title ? ` (${childMetadata.title})` : "";
    return [
      "\u{1F374} Session forked",
      `Parent: ${parentSessionId}`,
      `Child: ${childSession.id}${title}`,
      "",
      "Use /resume to switch to the new session."
    ].join("\n");
  }
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  forkCommand,
  renameCommand,
  resumeCommand,
  searchCommand
});
