var __legacyDecorateClassTS = function(decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
    r = Reflect.decorate(decorators, target, key, desc);
  else
    for (var i = decorators.length - 1;i >= 0; i--)
      if (d = decorators[i])
        r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};

// src/angular/ai/ai-stream.service.ts
import { computed, Injectable, signal } from "@angular/core";

// src/ai/client/actions.ts
var serverMessageToAction = (msg) => {
  switch (msg.type) {
    case "chunk":
      return {
        content: msg.content,
        conversationId: msg.conversationId,
        messageId: msg.messageId,
        type: "chunk"
      };
    case "thinking":
      return {
        content: msg.content,
        conversationId: msg.conversationId,
        messageId: msg.messageId,
        type: "thinking"
      };
    case "tool_status":
      return {
        conversationId: msg.conversationId,
        input: msg.input,
        messageId: msg.messageId,
        name: msg.name,
        result: msg.result,
        status: msg.status,
        type: "tool_status"
      };
    case "image":
      return {
        conversationId: msg.conversationId,
        data: msg.data,
        format: msg.format,
        imageId: msg.imageId,
        isPartial: msg.isPartial,
        messageId: msg.messageId,
        revisedPrompt: msg.revisedPrompt,
        type: "image"
      };
    case "complete":
      return {
        conversationId: msg.conversationId,
        durationMs: msg.durationMs,
        messageId: msg.messageId,
        model: msg.model,
        sources: msg.sources,
        type: "complete",
        usage: msg.usage
      };
    case "rag_retrieved":
      return {
        conversationId: msg.conversationId,
        messageId: msg.messageId,
        sources: msg.sources,
        type: "rag_retrieved"
      };
    case "error":
      return { message: msg.message, type: "error" };
    default:
      return null;
  }
};

// types/typeGuards.ts
var isValidAIServerMessage = (data) => {
  if (!data || typeof data !== "object") {
    return false;
  }
  if (!("type" in data) || typeof data.type !== "string") {
    return false;
  }
  switch (data.type) {
    case "chunk":
      return "content" in data && typeof data.content === "string" && "messageId" in data && "conversationId" in data;
    case "thinking":
      return "content" in data && typeof data.content === "string" && "messageId" in data && "conversationId" in data;
    case "tool_status":
      return "name" in data && "status" in data && "messageId" in data && "conversationId" in data;
    case "image":
      return "data" in data && typeof data.data === "string" && "format" in data && typeof data.format === "string" && "isPartial" in data && typeof data.isPartial === "boolean" && "messageId" in data && "conversationId" in data;
    case "complete":
      return "messageId" in data && "conversationId" in data;
    case "rag_retrieved":
      return "conversationId" in data && "messageId" in data && "sources" in data && Array.isArray(data.sources);
    case "error":
      return "message" in data && typeof data.message === "string";
    default:
      return false;
  }
};

// src/ai/client/connection.ts
var WS_OPEN = 1;
var WS_NORMAL_CLOSURE = 1000;
var WS_CLOSED = 3;
var DEFAULT_PING_INTERVAL = 30000;
var RECONNECT_INITIAL_DELAY = 500;
var RECONNECT_POLL_INTERVAL = 300;
var DEFAULT_MAX_RECONNECT_ATTEMPTS = 60;
var noop = () => {};
var noopUnsubscribe = () => noop;
var NOOP_CONNECTION = {
  close: noop,
  send: noop,
  subscribe: noopUnsubscribe,
  getReadyState: () => WS_CLOSED
};
var buildWsUrl = (path) => {
  const { hostname, port, protocol } = window.location;
  const wsProtocol = protocol === "https:" ? "wss:" : "ws:";
  const portSuffix = port ? `:${port}` : "";
  return `${wsProtocol}//${hostname}${portSuffix}${path}`;
};
var parseServerMessage = (event) => {
  let data;
  try {
    data = JSON.parse(String(event.data));
  } catch {
    return null;
  }
  if (data && typeof data === "object" && "type" in data && data.type === "pong") {
    return null;
  }
  if (!isValidAIServerMessage(data)) {
    return null;
  }
  return data;
};
var createAIConnection = (path, options = {}) => {
  if (typeof window === "undefined") {
    return NOOP_CONNECTION;
  }
  const shouldReconnect = options.reconnect !== false;
  const pingInterval = options.pingInterval ?? DEFAULT_PING_INTERVAL;
  const maxReconnectAttempts = options.maxReconnectAttempts ?? DEFAULT_MAX_RECONNECT_ATTEMPTS;
  const listeners = new Set;
  const connState = {
    isConnected: false,
    pingInterval: null,
    reconnectAttempts: 0,
    reconnectTimeout: null,
    ws: null
  };
  const clearTimers = () => {
    if (connState.pingInterval) {
      clearInterval(connState.pingInterval);
      connState.pingInterval = null;
    }
    if (connState.reconnectTimeout) {
      clearTimeout(connState.reconnectTimeout);
      connState.reconnectTimeout = null;
    }
  };
  const scheduleReconnect = () => {
    connState.reconnectAttempts++;
    const delay = connState.reconnectAttempts === 1 ? RECONNECT_INITIAL_DELAY : RECONNECT_POLL_INTERVAL;
    connState.reconnectTimeout = setTimeout(() => {
      if (connState.reconnectAttempts > maxReconnectAttempts) {
        return;
      }
      connect();
    }, delay);
  };
  const connect = () => {
    const url = buildWsUrl(path);
    const wsInstance = new WebSocket(url, options.protocols);
    wsInstance.onopen = () => {
      connState.isConnected = true;
      connState.reconnectAttempts = 0;
      connState.pingInterval = setInterval(() => {
        if (wsInstance.readyState === WS_OPEN && connState.isConnected) {
          wsInstance.send(JSON.stringify({ type: "ping" }));
        }
      }, pingInterval);
    };
    wsInstance.onmessage = (event) => {
      const message = parseServerMessage(event);
      if (!message) {
        return;
      }
      listeners.forEach((listener) => listener(message));
    };
    wsInstance.onclose = (event) => {
      connState.isConnected = false;
      clearTimers();
      const shouldAttemptReconnect = shouldReconnect && event.code !== WS_NORMAL_CLOSURE && connState.reconnectAttempts < maxReconnectAttempts;
      if (shouldAttemptReconnect) {
        scheduleReconnect();
      }
    };
    wsInstance.onerror = () => {};
    connState.ws = wsInstance;
  };
  const send = (msg) => {
    if (connState.ws?.readyState === WS_OPEN) {
      connState.ws.send(JSON.stringify(msg));
    }
  };
  const subscribe = (callback) => {
    listeners.add(callback);
    return () => {
      listeners.delete(callback);
    };
  };
  const close = () => {
    clearTimers();
    if (connState.ws) {
      connState.ws.close(WS_NORMAL_CLOSURE);
      connState.ws = null;
    }
    connState.isConnected = false;
    listeners.clear();
  };
  const getReadyState = () => connState.ws?.readyState ?? WS_CLOSED;
  connect();
  return { close, getReadyState, send, subscribe };
};

// src/ai/client/messageStore.ts
var EMPTY_STATE = {
  activeConversationId: null,
  conversations: new Map,
  error: null,
  isStreaming: false
};
var initialActiveConversationId = null;
var initialError = null;
var freshState = () => ({
  activeConversationId: initialActiveConversationId,
  conversations: new Map,
  error: initialError,
  isStreaming: false
});
var findAssistantMessage = (conversation, messageId) => conversation.messages.find((msg) => msg.id === messageId && msg.role === "assistant");
var getOrCreate = (state, conversationId) => {
  let conversation = state.conversations.get(conversationId);
  if (!conversation) {
    conversation = {
      createdAt: Date.now(),
      id: conversationId,
      messages: []
    };
    state.conversations.set(conversationId, conversation);
  }
  return conversation;
};
var handleSend = (state, action) => {
  const conversation = getOrCreate(state, action.conversationId);
  const message = {
    attachments: action.attachments,
    content: action.content,
    conversationId: action.conversationId,
    id: action.messageId,
    role: "user",
    timestamp: Date.now()
  };
  conversation.messages = [...conversation.messages, message];
  state.activeConversationId = action.conversationId;
  state.error = null;
  state.isStreaming = true;
};
var handleChunk = (state, action) => {
  const conversation = getOrCreate(state, action.conversationId);
  const existingIdx = conversation.messages.findIndex((msg) => msg.id === action.messageId && msg.role === "assistant");
  if (existingIdx >= 0) {
    const prevContent = conversation.messages[existingIdx]?.content ?? "";
    conversation.messages = conversation.messages.map((msg, idx) => idx === existingIdx ? { ...msg, content: prevContent + action.content } : msg);
    return;
  }
  const message = {
    content: action.content,
    conversationId: action.conversationId,
    id: action.messageId,
    isStreaming: true,
    role: "assistant",
    timestamp: Date.now()
  };
  conversation.messages = [...conversation.messages, message];
};
var handleThinking = (state, action) => {
  const conversation = getOrCreate(state, action.conversationId);
  const existingIdx = conversation.messages.findIndex((msg) => msg.id === action.messageId && msg.role === "assistant");
  if (existingIdx >= 0) {
    const prevThinking = conversation.messages[existingIdx]?.thinking ?? "";
    conversation.messages = conversation.messages.map((msg, idx) => idx === existingIdx ? { ...msg, thinking: prevThinking + action.content } : msg);
    return;
  }
  const message = {
    content: "",
    conversationId: action.conversationId,
    id: action.messageId,
    isStreaming: true,
    role: "assistant",
    thinking: action.content,
    timestamp: Date.now()
  };
  conversation.messages = [...conversation.messages, message];
};
var upsertToolCall = (message, toolCall) => {
  if (!message.toolCalls) {
    message.toolCalls = [toolCall];
    return;
  }
  const existingIdx = message.toolCalls.findIndex((existing) => existing.name === toolCall.name);
  if (existingIdx >= 0) {
    message.toolCalls[existingIdx] = toolCall;
  } else {
    message.toolCalls = [...message.toolCalls, toolCall];
  }
};
var getOrCreateAssistantMessage = (conversation, messageId, conversationId) => {
  const existing = findAssistantMessage(conversation, messageId);
  if (existing) {
    return existing;
  }
  const message = {
    content: "",
    conversationId,
    id: messageId,
    isStreaming: true,
    role: "assistant",
    timestamp: Date.now()
  };
  conversation.messages = [...conversation.messages, message];
  return message;
};
var handleRAGRetrieved = (state, action) => {
  const conversation = getOrCreate(state, action.conversationId);
  const message = getOrCreateAssistantMessage(conversation, action.messageId, action.conversationId);
  message.sources = action.sources;
  message.retrievedAt = Date.now();
  conversation.messages = [...conversation.messages];
};
var handleToolStatus = (state, action) => {
  const conversation = getOrCreate(state, action.conversationId);
  const message = getOrCreateAssistantMessage(conversation, action.messageId, action.conversationId);
  const toolCall = {
    id: action.messageId,
    input: action.input,
    name: action.name,
    result: action.status === "complete" ? action.result ?? "" : undefined
  };
  upsertToolCall(message, toolCall);
  conversation.messages = [...conversation.messages];
};
var markMessageComplete = (conversation, messageId, usage, durationMs, model, sources) => {
  conversation.messages = conversation.messages.map((msg) => msg.id === messageId && msg.role === "assistant" ? {
    ...msg,
    durationMs,
    isStreaming: false,
    model,
    sources: sources ?? msg.sources,
    usage
  } : msg);
};
var NOT_FOUND = -1;
var findExistingImageById = (images, imageId) => {
  if (!imageId)
    return NOT_FOUND;
  return images.findIndex((img) => img.imageId === imageId);
};
var findReplaceablePartialIndex = (images) => {
  const lastIdx = images.length - 1;
  if (lastIdx >= 0 && images[lastIdx]?.isPartial) {
    return lastIdx;
  }
  return NOT_FOUND;
};
var upsertImage = (message, imageData) => {
  if (!message.images) {
    message.images = [imageData];
    return;
  }
  const existingIdx = findExistingImageById(message.images, imageData.imageId);
  if (existingIdx >= 0) {
    message.images[existingIdx] = imageData;
    return;
  }
  const replaceableIdx = findReplaceablePartialIndex(message.images);
  if (replaceableIdx >= 0) {
    message.images[replaceableIdx] = imageData;
    return;
  }
  message.images = [...message.images, imageData];
};
var handleImage = (state, action) => {
  const conversation = getOrCreate(state, action.conversationId);
  const message = getOrCreateAssistantMessage(conversation, action.messageId, action.conversationId);
  upsertImage(message, {
    data: action.data,
    format: action.format,
    imageId: action.imageId,
    isPartial: action.isPartial,
    revisedPrompt: action.revisedPrompt
  });
  conversation.messages = [...conversation.messages];
};
var handleComplete = (state, action) => {
  const conversation = state.conversations.get(action.conversationId);
  if (conversation) {
    markMessageComplete(conversation, action.messageId, action.usage, action.durationMs, action.model, action.sources);
  }
  state.isStreaming = false;
};
var markConversationStreamsComplete = (conversation) => {
  const streamingMessages = conversation.messages.filter((msg) => msg.isStreaming);
  if (streamingMessages.length === 0) {
    return;
  }
  for (const msg of streamingMessages) {
    msg.isStreaming = false;
  }
  conversation.messages = [...conversation.messages];
};
var markAllStreamsComplete = (state) => {
  for (const [, conversation] of state.conversations) {
    markConversationStreamsComplete(conversation);
  }
};
var handleBranch = (state, action) => {
  const source = state.conversations.get(action.oldConversationId);
  if (!source) {
    return;
  }
  const cutoffIndex = source.messages.findIndex((msg) => msg.id === action.fromMessageId);
  if (cutoffIndex < 0) {
    return;
  }
  const branchedMessages = source.messages.slice(0, cutoffIndex + 1).map((msg) => ({ ...msg, conversationId: action.newConversationId }));
  const newConversation = {
    createdAt: Date.now(),
    id: action.newConversationId,
    messages: branchedMessages
  };
  state.conversations.set(action.newConversationId, newConversation);
  state.activeConversationId = action.newConversationId;
};
var applyAction = (state, action) => {
  switch (action.type) {
    case "send":
      handleSend(state, action);
      break;
    case "chunk":
      handleChunk(state, action);
      break;
    case "thinking":
      handleThinking(state, action);
      break;
    case "tool_status":
      handleToolStatus(state, action);
      break;
    case "image":
      handleImage(state, action);
      break;
    case "complete":
      handleComplete(state, action);
      break;
    case "error":
      state.error = action.message;
      state.isStreaming = false;
      break;
    case "rag_retrieved":
      handleRAGRetrieved(state, action);
      break;
    case "cancel":
      state.isStreaming = false;
      markAllStreamsComplete(state);
      break;
    case "branch":
      handleBranch(state, action);
      break;
    case "set_conversation":
      state.activeConversationId = action.conversationId;
      break;
  }
};
var createAIMessageStore = () => {
  let state = freshState();
  const subscribers = new Set;
  return {
    dispatch: (action) => {
      applyAction(state, action);
      state = { ...state, conversations: new Map(state.conversations) };
      subscribers.forEach((callback) => callback());
    },
    getServerSnapshot: () => EMPTY_STATE,
    getSnapshot: () => state,
    subscribe: (callback) => {
      subscribers.add(callback);
      return () => {
        subscribers.delete(callback);
      };
    }
  };
};

// src/ai/protocol.ts
var generateId = () => crypto.randomUUID();

// src/angular/ai/ai-stream.service.ts
class AIStreamService {
  connections = new Map;
  connect(path, conversationId) {
    const existing = this.connections.get(path);
    if (existing) {
      return this.createHandle(existing, conversationId);
    }
    const connection = createAIConnection(path);
    const store = createAIMessageStore();
    const messagesSignal = signal([]);
    const isStreamingSignal = signal(false);
    const errorSignal = signal(null);
    const activeConversationIdSignal = signal(conversationId ?? null);
    const syncState = () => {
      const snapshot = store.getSnapshot();
      const convId = activeConversationIdSignal() ?? snapshot.activeConversationId;
      const conversation = convId ? snapshot.conversations.get(convId) : undefined;
      messagesSignal.set(conversation?.messages ?? []);
      isStreamingSignal.set(snapshot.isStreaming);
      errorSignal.set(snapshot.error);
      if (convId) {
        activeConversationIdSignal.set(convId);
      }
    };
    const unsubscribeStore = store.subscribe(syncState);
    const unsubscribeConnection = connection.subscribe((msg) => {
      const action = serverMessageToAction(msg);
      if (action) {
        store.dispatch(action);
      }
    });
    const entry = {
      connection,
      store,
      unsubscribeConnection,
      unsubscribeStore
    };
    this.connections.set(path, entry);
    const send = (content, attachments) => {
      const convId = activeConversationIdSignal() ?? generateId();
      const msgId = generateId();
      store.dispatch({
        attachments,
        content,
        conversationId: convId,
        messageId: msgId,
        type: "send"
      });
      connection.send({
        attachments,
        content,
        conversationId: convId,
        type: "message"
      });
    };
    const cancel = () => {
      const convId = activeConversationIdSignal();
      if (convId) {
        store.dispatch({ type: "cancel" });
        connection.send({ conversationId: convId, type: "cancel" });
      }
    };
    const branch = (messageId, content) => {
      const convId = activeConversationIdSignal();
      if (convId) {
        connection.send({
          content,
          conversationId: convId,
          messageId,
          type: "branch"
        });
      }
    };
    return {
      branch,
      cancel,
      error: computed(() => errorSignal()),
      isStreaming: computed(() => isStreamingSignal()),
      messages: computed(() => messagesSignal()),
      send
    };
  }
  createHandle(entry, conversationId) {
    const { connection, store } = entry;
    const messagesSignal = signal([]);
    const isStreamingSignal = signal(false);
    const errorSignal = signal(null);
    const activeConversationIdSignal = signal(conversationId ?? null);
    store.subscribe(() => {
      const snapshot = store.getSnapshot();
      const convId = activeConversationIdSignal() ?? snapshot.activeConversationId;
      const conversation = convId ? snapshot.conversations.get(convId) : undefined;
      messagesSignal.set(conversation?.messages ?? []);
      isStreamingSignal.set(snapshot.isStreaming);
      errorSignal.set(snapshot.error);
      if (convId) {
        activeConversationIdSignal.set(convId);
      }
    });
    const send = (content, attachments) => {
      const convId = activeConversationIdSignal() ?? generateId();
      const msgId = generateId();
      store.dispatch({
        attachments,
        content,
        conversationId: convId,
        messageId: msgId,
        type: "send"
      });
      connection.send({
        attachments,
        content,
        conversationId: convId,
        type: "message"
      });
    };
    const cancel = () => {
      const convId = activeConversationIdSignal();
      if (convId) {
        store.dispatch({ type: "cancel" });
        connection.send({ conversationId: convId, type: "cancel" });
      }
    };
    const branch = (messageId, content) => {
      const convId = activeConversationIdSignal();
      if (convId) {
        connection.send({
          content,
          conversationId: convId,
          messageId,
          type: "branch"
        });
      }
    };
    return {
      branch,
      cancel,
      error: computed(() => errorSignal()),
      isStreaming: computed(() => isStreamingSignal()),
      messages: computed(() => messagesSignal()),
      send
    };
  }
  ngOnDestroy() {
    for (const [, entry] of this.connections) {
      entry.unsubscribeConnection();
      entry.unsubscribeStore();
      entry.connection.close();
    }
    this.connections.clear();
  }
}
AIStreamService = __legacyDecorateClassTS([
  Injectable({ providedIn: "root" })
], AIStreamService);
// src/angular/ai/rag-client.service.ts
import { Injectable as Injectable2 } from "@angular/core";

// src/constants.ts
var HOURS_IN_DAY = 24;
var MILLISECONDS_IN_A_SECOND = 1000;
var MINUTES_IN_AN_HOUR = 60;
var SECONDS_IN_A_MINUTE = 60;
var MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
var MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR * HOURS_IN_DAY;
var TWO_THIRDS = 2 / 3;
var UNFOUND_INDEX = -1;

// src/ai/client/ragClient.ts
var jsonHeaders = {
  "Content-Type": "application/json"
};
var normalizeBasePath = (path) => path.endsWith("/") ? path.slice(0, UNFOUND_INDEX) : path;
var parseJson = async (response) => {
  const payload = await response.json();
  return payload;
};
var toErrorMessage = async (response) => {
  try {
    const payload = await response.json();
    if (typeof payload.error === "string" && payload.error) {
      return payload.error;
    }
  } catch {}
  return `Request failed with status ${response.status}`;
};
var createRAGClient = (options) => {
  const basePath = normalizeBasePath(options.path);
  const fetchImpl = options.fetch ?? fetch;
  return {
    async backends() {
      const response = await fetchImpl(`${basePath}/backends`);
      if (!response.ok) {
        throw new Error(await toErrorMessage(response));
      }
      return parseJson(response);
    },
    async clearIndex() {
      const response = await fetchImpl(`${basePath}/index`, {
        method: "DELETE"
      });
      if (!response.ok) {
        throw new Error(await toErrorMessage(response));
      }
      return parseJson(response);
    },
    async createDocument(input) {
      const response = await fetchImpl(`${basePath}/documents`, {
        body: JSON.stringify(input),
        headers: jsonHeaders,
        method: "POST"
      });
      if (!response.ok) {
        return {
          error: await toErrorMessage(response),
          ok: false
        };
      }
      return parseJson(response);
    },
    async deleteDocument(id) {
      const response = await fetchImpl(`${basePath}/documents/${encodeURIComponent(id)}`, {
        method: "DELETE"
      });
      if (!response.ok) {
        return {
          error: await toErrorMessage(response),
          ok: false
        };
      }
      return parseJson(response);
    },
    async documentChunks(id) {
      const response = await fetchImpl(`${basePath}/documents/${encodeURIComponent(id)}/chunks`);
      if (!response.ok) {
        const error = await toErrorMessage(response);
        return { error, ok: false };
      }
      return parseJson(response);
    },
    async documents(kind) {
      const query = kind ? `?kind=${encodeURIComponent(kind)}` : "";
      const response = await fetchImpl(`${basePath}/documents${query}`);
      if (!response.ok) {
        throw new Error(await toErrorMessage(response));
      }
      return parseJson(response);
    },
    async ingest(chunks) {
      const response = await fetchImpl(`${basePath}/ingest`, {
        body: JSON.stringify({ chunks }),
        headers: jsonHeaders,
        method: "POST"
      });
      if (!response.ok) {
        return {
          error: await toErrorMessage(response),
          ok: false
        };
      }
      return parseJson(response);
    },
    async ingestDocuments(input) {
      const response = await fetchImpl(`${basePath}/ingest`, {
        body: JSON.stringify(input),
        headers: jsonHeaders,
        method: "POST"
      });
      if (!response.ok) {
        return {
          error: await toErrorMessage(response),
          ok: false
        };
      }
      return parseJson(response);
    },
    async reseed() {
      const response = await fetchImpl(`${basePath}/reseed`, {
        method: "POST"
      });
      if (!response.ok) {
        return {
          error: await toErrorMessage(response),
          ok: false
        };
      }
      return parseJson(response);
    },
    async reset() {
      const response = await fetchImpl(`${basePath}/reset`, {
        method: "POST"
      });
      if (!response.ok) {
        return {
          error: await toErrorMessage(response),
          ok: false
        };
      }
      return parseJson(response);
    },
    async search(input) {
      const response = await fetchImpl(`${basePath}/search`, {
        body: JSON.stringify(input),
        headers: jsonHeaders,
        method: "POST"
      });
      if (!response.ok) {
        throw new Error(await toErrorMessage(response));
      }
      const payload = await parseJson(response);
      if (!payload.ok) {
        throw new Error(payload.error ?? "RAG search failed");
      }
      return payload.results ?? [];
    },
    async status() {
      const response = await fetchImpl(`${basePath}/status`);
      if (!response.ok) {
        throw new Error(await toErrorMessage(response));
      }
      return parseJson(response);
    }
  };
};

// src/angular/ai/rag-client.service.ts
class RAGClientService {
  clients = new Map;
  client(path) {
    const existing = this.clients.get(path);
    if (existing) {
      return existing;
    }
    const created = createRAGClient({ path });
    this.clients.set(path, created);
    return created;
  }
  ingest(path, chunks) {
    return this.client(path).ingest(chunks);
  }
  ingestDocuments(path, input) {
    return this.client(path).ingestDocuments(input);
  }
  search(path, input) {
    return this.client(path).search(input);
  }
  status(path) {
    return this.client(path).status();
  }
  documents(path, kind) {
    return this.client(path).documents(kind);
  }
  documentChunks(path, id) {
    return this.client(path).documentChunks(id);
  }
  createDocument(path, input) {
    return this.client(path).createDocument(input);
  }
  deleteDocument(path, id) {
    return this.client(path).deleteDocument(id);
  }
  reseed(path) {
    return this.client(path).reseed();
  }
  reset(path) {
    return this.client(path).reset();
  }
  backends(path) {
    return this.client(path).backends();
  }
  clearIndex(path) {
    return this.client(path).clearIndex();
  }
}
RAGClientService = __legacyDecorateClassTS([
  Injectable2({ providedIn: "root" })
], RAGClientService);
// src/angular/ai/ai-rag-stream.service.ts
class RAGStreamService extends AIStreamService {
}
export {
  RAGStreamService,
  RAGClientService,
  AIStreamService
};
