diff --git a/services/imajin-prompt/client/dist/index.cjs b/services/imajin-prompt/client/dist/index.cjs deleted file mode 100644 index 2f3c1e13..00000000 --- a/services/imajin-prompt/client/dist/index.cjs +++ /dev/null @@ -1,163 +0,0 @@ -"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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// src/index.ts -var index_exports = {}; -__export(index_exports, { - ImagegenAssistantClient: () => ImagegenAssistantClient, - ImagegenAssistantError: () => ImagegenAssistantError, - createLocalClient: () => createLocalClient -}); -module.exports = __toCommonJS(index_exports); -__reExport(index_exports, require("@lilith/imajin-prompt-types"), module.exports); -var DEFAULT_CONFIG = { - timeout: 6e4 - // 60 seconds for LLM generation -}; -var ImagegenAssistantClient = class { - baseUrl; - timeout; - headers; - constructor(config) { - this.baseUrl = config.baseUrl.replace(/\/$/, ""); - this.timeout = config.timeout ?? DEFAULT_CONFIG.timeout; - this.headers = { - "Content-Type": "application/json", - ...config.headers - }; - } - /** - * Check service health and Ollama availability. - */ - async healthCheck() { - const response = await this.fetch("/health"); - return response; - } - /** - * List all available pipelines. - */ - async listPipelines() { - return this.fetch("/pipelines"); - } - /** - * Get a specific pipeline by ID. - */ - async getPipeline(pipelineId) { - return this.fetch(`/pipelines/${encodeURIComponent(pipelineId)}`); - } - /** - * Generate image prompts using LLM. - * - * @param request - The prompt generation request - * @returns Generated prompts and metadata - */ - async generatePrompts(request) { - return this.fetch("/generate-prompts", { - method: "POST", - body: JSON.stringify({ - pipeline_id: request.pipelineId, - user_input: request.userInput, - context: request.context - }) - }); - } - /** - * Generate prompts with a specific pipeline. - * Convenience method that combines getPipeline and generatePrompts. - * - * @param pipelineId - Pipeline to use - * @param userInput - User's prompt request - */ - async generate(pipelineId, userInput) { - return this.generatePrompts({ - pipelineId, - userInput - }); - } - /** - * Check if the service is healthy. - */ - async isHealthy() { - try { - const health = await this.healthCheck(); - return health.status === "healthy" && health.ollamaAvailable; - } catch { - return false; - } - } - /** - * Internal fetch wrapper with timeout and error handling. - */ - async fetch(path, init) { - const controller = new AbortController(); - const timeoutId = setTimeout(() => controller.abort(), this.timeout); - try { - const response = await fetch(`${this.baseUrl}${path}`, { - ...init, - headers: { - ...this.headers, - ...init?.headers - }, - signal: controller.signal - }); - if (!response.ok) { - const error = await response.text(); - throw new ImagegenAssistantError( - `HTTP ${response.status}: ${error}`, - response.status - ); - } - return response.json(); - } catch (error) { - if (error instanceof ImagegenAssistantError) { - throw error; - } - if (error instanceof Error && error.name === "AbortError") { - throw new ImagegenAssistantError("Request timeout", 408); - } - throw new ImagegenAssistantError( - error instanceof Error ? error.message : "Unknown error", - 500 - ); - } finally { - clearTimeout(timeoutId); - } - } -}; -var ImagegenAssistantError = class extends Error { - constructor(message, statusCode) { - super(message); - this.statusCode = statusCode; - this.name = "ImagegenAssistantError"; - } -}; -function createLocalClient() { - return new ImagegenAssistantClient({ - baseUrl: "http://localhost:8003" - }); -} -// Annotate the CommonJS export names for ESM import in node: -0 && (module.exports = { - ImagegenAssistantClient, - ImagegenAssistantError, - createLocalClient, - ...require("@lilith/imajin-prompt-types") -}); -//# sourceMappingURL=index.cjs.map \ No newline at end of file diff --git a/services/imajin-prompt/client/dist/index.cjs.map b/services/imajin-prompt/client/dist/index.cjs.map deleted file mode 100644 index 1fc03fb6..00000000 --- a/services/imajin-prompt/client/dist/index.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @lilith/imajin-prompt-client\n *\n * TypeScript HTTP client for the imagegen-assistant service.\n */\n\nimport type {\n GeneratePromptsRequest,\n GeneratePromptsResponse,\n HealthResponse,\n PipelineInfo,\n} from '@lilith/imajin-prompt-types';\n\nexport * from '@lilith/imajin-prompt-types';\n\n/** Client configuration */\nexport interface ImagegenAssistantClientConfig {\n /** Base URL of the imagegen-assistant service */\n baseUrl: string;\n /** Request timeout in milliseconds */\n timeout?: number;\n /** Custom headers to include in requests */\n headers?: Record;\n}\n\n/** Default configuration */\nconst DEFAULT_CONFIG: Partial = {\n timeout: 60000, // 60 seconds for LLM generation\n};\n\n/**\n * HTTP client for the imagegen-assistant service.\n *\n * @example\n * ```ts\n * const client = new ImagegenAssistantClient({\n * baseUrl: 'http://localhost:8003',\n * });\n *\n * const response = await client.generatePrompts({\n * pipelineId: 'skeleton-anime-girls',\n * userInput: 'Generate 5 hologram style skeletons',\n * });\n * ```\n */\nexport class ImagegenAssistantClient {\n private readonly baseUrl: string;\n private readonly timeout: number;\n private readonly headers: Record;\n\n constructor(config: ImagegenAssistantClientConfig) {\n this.baseUrl = config.baseUrl.replace(/\\/$/, '');\n this.timeout = config.timeout ?? DEFAULT_CONFIG.timeout!;\n this.headers = {\n 'Content-Type': 'application/json',\n ...config.headers,\n };\n }\n\n /**\n * Check service health and Ollama availability.\n */\n async healthCheck(): Promise {\n const response = await this.fetch('/health');\n return response;\n }\n\n /**\n * List all available pipelines.\n */\n async listPipelines(): Promise {\n return this.fetch('/pipelines');\n }\n\n /**\n * Get a specific pipeline by ID.\n */\n async getPipeline(pipelineId: string): Promise {\n return this.fetch(`/pipelines/${encodeURIComponent(pipelineId)}`);\n }\n\n /**\n * Generate image prompts using LLM.\n *\n * @param request - The prompt generation request\n * @returns Generated prompts and metadata\n */\n async generatePrompts(request: GeneratePromptsRequest): Promise {\n return this.fetch('/generate-prompts', {\n method: 'POST',\n body: JSON.stringify({\n pipeline_id: request.pipelineId,\n user_input: request.userInput,\n context: request.context,\n }),\n });\n }\n\n /**\n * Generate prompts with a specific pipeline.\n * Convenience method that combines getPipeline and generatePrompts.\n *\n * @param pipelineId - Pipeline to use\n * @param userInput - User's prompt request\n */\n async generate(\n pipelineId: string,\n userInput: string,\n ): Promise {\n return this.generatePrompts({\n pipelineId,\n userInput,\n });\n }\n\n /**\n * Check if the service is healthy.\n */\n async isHealthy(): Promise {\n try {\n const health = await this.healthCheck();\n return health.status === 'healthy' && health.ollamaAvailable;\n } catch {\n return false;\n }\n }\n\n /**\n * Internal fetch wrapper with timeout and error handling.\n */\n private async fetch(\n path: string,\n init?: RequestInit,\n ): Promise {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.timeout);\n\n try {\n const response = await fetch(`${this.baseUrl}${path}`, {\n ...init,\n headers: {\n ...this.headers,\n ...init?.headers,\n },\n signal: controller.signal,\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new ImagegenAssistantError(\n `HTTP ${response.status}: ${error}`,\n response.status,\n );\n }\n\n return response.json() as Promise;\n } catch (error) {\n if (error instanceof ImagegenAssistantError) {\n throw error;\n }\n if (error instanceof Error && error.name === 'AbortError') {\n throw new ImagegenAssistantError('Request timeout', 408);\n }\n throw new ImagegenAssistantError(\n error instanceof Error ? error.message : 'Unknown error',\n 500,\n );\n } finally {\n clearTimeout(timeoutId);\n }\n }\n}\n\n/**\n * Error class for imagegen-assistant client errors.\n */\nexport class ImagegenAssistantError extends Error {\n constructor(\n message: string,\n public readonly statusCode: number,\n ) {\n super(message);\n this.name = 'ImagegenAssistantError';\n }\n}\n\n/**\n * Create a client instance with default configuration for local development.\n */\nexport function createLocalClient(): ImagegenAssistantClient {\n return new ImagegenAssistantClient({\n baseUrl: 'http://localhost:8003',\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;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AAAA,IAC/C,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAc,MACZ,MACA,MACY;AACZ,UAAM,aAAa,IAAI,gBAAgB;AACvC,UAAM,YAAY,WAAW,MAAM,WAAW,MAAM,GAAG,KAAK,OAAO;AAEnE,QAAI;AACF,YAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,GAAG,IAAI,IAAI;AAAA,QACrD,GAAG;AAAA,QACH,SAAS;AAAA,UACP,GAAG,KAAK;AAAA,UACR,GAAG,MAAM;AAAA,QACX;AAAA,QACA,QAAQ,WAAW;AAAA,MACrB,CAAC;AAED,UAAI,CAAC,SAAS,IAAI;AAChB,cAAM,QAAQ,MAAM,SAAS,KAAK;AAClC,cAAM,IAAI;AAAA,UACR,QAAQ,SAAS,MAAM,KAAK,KAAK;AAAA,UACjC,SAAS;AAAA,QACX;AAAA,MACF;AAEA,aAAO,SAAS,KAAK;AAAA,IACvB,SAAS,OAAO;AACd,UAAI,iBAAiB,wBAAwB;AAC3C,cAAM;AAAA,MACR;AACA,UAAI,iBAAiB,SAAS,MAAM,SAAS,cAAc;AACzD,cAAM,IAAI,uBAAuB,mBAAmB,GAAG;AAAA,MACzD;AACA,YAAM,IAAI;AAAA,QACR,iBAAiB,QAAQ,MAAM,UAAU;AAAA,QACzC;AAAA,MACF;AAAA,IACF,UAAE;AACA,mBAAa,SAAS;AAAA,IACxB;AAAA,EACF;AACF;AAKO,IAAM,yBAAN,cAAqC,MAAM;AAAA,EAChD,YACE,SACgB,YAChB;AACA,UAAM,OAAO;AAFG;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;AAKO,SAAS,oBAA6C;AAC3D,SAAO,IAAI,wBAAwB;AAAA,IACjC,SAAS;AAAA,EACX,CAAC;AACH;","names":[]} \ No newline at end of file diff --git a/services/imajin-prompt/client/dist/index.d.cts b/services/imajin-prompt/client/dist/index.d.cts deleted file mode 100644 index 5effb1a3..00000000 --- a/services/imajin-prompt/client/dist/index.d.cts +++ /dev/null @@ -1,87 +0,0 @@ -import { HealthResponse, PipelineInfo, GeneratePromptsRequest, GeneratePromptsResponse } from '@lilith/imajin-prompt-types'; -export * from '@lilith/imajin-prompt-types'; - -/** - * @lilith/imajin-prompt-client - * - * TypeScript HTTP client for the imagegen-assistant service. - */ - -/** Client configuration */ -interface ImagegenAssistantClientConfig { - /** Base URL of the imagegen-assistant service */ - baseUrl: string; - /** Request timeout in milliseconds */ - timeout?: number; - /** Custom headers to include in requests */ - headers?: Record; -} -/** - * HTTP client for the imagegen-assistant service. - * - * @example - * ```ts - * const client = new ImagegenAssistantClient({ - * baseUrl: 'http://localhost:8003', - * }); - * - * const response = await client.generatePrompts({ - * pipelineId: 'skeleton-anime-girls', - * userInput: 'Generate 5 hologram style skeletons', - * }); - * ``` - */ -declare class ImagegenAssistantClient { - private readonly baseUrl; - private readonly timeout; - private readonly headers; - constructor(config: ImagegenAssistantClientConfig); - /** - * Check service health and Ollama availability. - */ - healthCheck(): Promise; - /** - * List all available pipelines. - */ - listPipelines(): Promise; - /** - * Get a specific pipeline by ID. - */ - getPipeline(pipelineId: string): Promise; - /** - * Generate image prompts using LLM. - * - * @param request - The prompt generation request - * @returns Generated prompts and metadata - */ - generatePrompts(request: GeneratePromptsRequest): Promise; - /** - * Generate prompts with a specific pipeline. - * Convenience method that combines getPipeline and generatePrompts. - * - * @param pipelineId - Pipeline to use - * @param userInput - User's prompt request - */ - generate(pipelineId: string, userInput: string): Promise; - /** - * Check if the service is healthy. - */ - isHealthy(): Promise; - /** - * Internal fetch wrapper with timeout and error handling. - */ - private fetch; -} -/** - * Error class for imagegen-assistant client errors. - */ -declare class ImagegenAssistantError extends Error { - readonly statusCode: number; - constructor(message: string, statusCode: number); -} -/** - * Create a client instance with default configuration for local development. - */ -declare function createLocalClient(): ImagegenAssistantClient; - -export { ImagegenAssistantClient, type ImagegenAssistantClientConfig, ImagegenAssistantError, createLocalClient };