// @bun
import {
  init_debug,
  logForDebugging
} from "./chunk-s3hafnk3.js";
import"./chunk-kb3758f7.js";
import"./chunk-9h9k5vz3.js";
import"./chunk-xmpgmeb8.js";
import"./chunk-2kz09j2s.js";
import"./chunk-c0k7b0jw.js";
import {
  __require
} from "./chunk-hhsxm2yr.js";

// src/assistant/sessionDiscovery.ts
init_debug();
async function discoverAssistantSessions() {
  const { fetchCodeSessionsFromSessionsAPI } = await import("./chunk-j1ezfpjx.js");
  let allSessions;
  try {
    allSessions = await fetchCodeSessionsFromSessionsAPI();
  } catch (err) {
    logForDebugging(`[assistant:discovery] fetchCodeSessionsFromSessionsAPI failed: ${err}`);
    throw err;
  }
  return allSessions.filter((s) => s.status === "idle" || s.status === "working" || s.status === "waiting").map((s) => ({
    id: s.id,
    title: s.title || "Untitled",
    status: s.status,
    created_at: s.created_at ?? ""
  }));
}
export {
  discoverAssistantSessions
};
