types(imajin-prompt): 🏷️ Extend type definitions for imajin-prompt service with new and stricter types for improved type safety
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
4430e691e8
commit
3ff7be6314
3 changed files with 0 additions and 240 deletions
82
services/imajin-prompt/types/dist/index.cjs
vendored
82
services/imajin-prompt/types/dist/index.cjs
vendored
|
|
@ -1,82 +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
GeneratePromptsRequestSchema: () => GeneratePromptsRequestSchema,
|
||||
GeneratePromptsResponseSchema: () => GeneratePromptsResponseSchema,
|
||||
HealthResponseSchema: () => HealthResponseSchema,
|
||||
ParsedPromptSchema: () => ParsedPromptSchema,
|
||||
PipelineInfoSchema: () => PipelineInfoSchema,
|
||||
isHealthy: () => isHealthy,
|
||||
isValidPrompt: () => isValidPrompt
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
var import_zod = require("zod");
|
||||
var ParsedPromptSchema = import_zod.z.object({
|
||||
name: import_zod.z.string().min(1),
|
||||
prompt: import_zod.z.string().min(1),
|
||||
negativePrompt: import_zod.z.string().default("")
|
||||
});
|
||||
var GeneratePromptsRequestSchema = import_zod.z.object({
|
||||
pipelineId: import_zod.z.string().min(1),
|
||||
userInput: import_zod.z.string().min(1),
|
||||
context: import_zod.z.record(import_zod.z.unknown()).optional()
|
||||
});
|
||||
var GeneratePromptsResponseSchema = import_zod.z.object({
|
||||
rawResponse: import_zod.z.string(),
|
||||
prompts: import_zod.z.array(ParsedPromptSchema),
|
||||
model: import_zod.z.string(),
|
||||
durationMs: import_zod.z.number()
|
||||
});
|
||||
var PipelineInfoSchema = import_zod.z.object({
|
||||
id: import_zod.z.string(),
|
||||
name: import_zod.z.string(),
|
||||
description: import_zod.z.string(),
|
||||
category: import_zod.z.string(),
|
||||
model: import_zod.z.enum(["photorealistic", "anime"]),
|
||||
families: import_zod.z.array(import_zod.z.string()),
|
||||
examplePrompts: import_zod.z.array(import_zod.z.string())
|
||||
});
|
||||
var HealthResponseSchema = import_zod.z.object({
|
||||
status: import_zod.z.enum(["healthy", "degraded", "unhealthy"]),
|
||||
service: import_zod.z.string(),
|
||||
version: import_zod.z.string(),
|
||||
ollamaAvailable: import_zod.z.boolean(),
|
||||
model: import_zod.z.string()
|
||||
});
|
||||
function isValidPrompt(prompt) {
|
||||
const result = ParsedPromptSchema.safeParse(prompt);
|
||||
return result.success;
|
||||
}
|
||||
function isHealthy(response) {
|
||||
return response.status === "healthy" && response.ollamaAvailable;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
GeneratePromptsRequestSchema,
|
||||
GeneratePromptsResponseSchema,
|
||||
HealthResponseSchema,
|
||||
ParsedPromptSchema,
|
||||
PipelineInfoSchema,
|
||||
isHealthy,
|
||||
isValidPrompt
|
||||
});
|
||||
//# sourceMappingURL=index.cjs.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @lilith/imajin-prompt-types\n *\n * TypeScript types for the imagegen-assistant service.\n */\n\nimport { z } from 'zod';\n\n// ============================================================================\n// Core Types\n// ============================================================================\n\n/** Available image generation models */\nexport type ImageModel = 'photorealistic' | 'anime';\n\n/** Parsed prompt from LLM response */\nexport interface ParsedPrompt {\n name: string;\n prompt: string;\n negativePrompt: string;\n}\n\n/** Pipeline configuration */\nexport interface PipelineInfo {\n id: string;\n name: string;\n description: string;\n category: string;\n model: ImageModel;\n families: string[];\n examplePrompts: string[];\n}\n\n// ============================================================================\n// Request Types\n// ============================================================================\n\n/** Request to generate prompts */\nexport interface GeneratePromptsRequest {\n pipelineId: string;\n userInput: string;\n context?: Record<string, unknown>;\n}\n\n// ============================================================================\n// Response Types\n// ============================================================================\n\n/** Response from prompt generation */\nexport interface GeneratePromptsResponse {\n rawResponse: string;\n prompts: ParsedPrompt[];\n model: string;\n durationMs: number;\n}\n\n/** Health check response */\nexport interface HealthResponse {\n status: 'healthy' | 'degraded' | 'unhealthy';\n service: string;\n version: string;\n ollamaAvailable: boolean;\n model: string;\n}\n\n// ============================================================================\n// Zod Schemas\n// ============================================================================\n\nexport const ParsedPromptSchema = z.object({\n name: z.string().min(1),\n prompt: z.string().min(1),\n negativePrompt: z.string().default(''),\n});\n\nexport const GeneratePromptsRequestSchema = z.object({\n pipelineId: z.string().min(1),\n userInput: z.string().min(1),\n context: z.record(z.unknown()).optional(),\n});\n\nexport const GeneratePromptsResponseSchema = z.object({\n rawResponse: z.string(),\n prompts: z.array(ParsedPromptSchema),\n model: z.string(),\n durationMs: z.number(),\n});\n\nexport const PipelineInfoSchema = z.object({\n id: z.string(),\n name: z.string(),\n description: z.string(),\n category: z.string(),\n model: z.enum(['photorealistic', 'anime']),\n families: z.array(z.string()),\n examplePrompts: z.array(z.string()),\n});\n\nexport const HealthResponseSchema = z.object({\n status: z.enum(['healthy', 'degraded', 'unhealthy']),\n service: z.string(),\n version: z.string(),\n ollamaAvailable: z.boolean(),\n model: z.string(),\n});\n\n// ============================================================================\n// Type Guards\n// ============================================================================\n\nexport function isValidPrompt(prompt: unknown): prompt is ParsedPrompt {\n const result = ParsedPromptSchema.safeParse(prompt);\n return result.success;\n}\n\nexport function isHealthy(response: HealthResponse): boolean {\n return response.status === 'healthy' && response.ollamaAvailable;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,iBAAkB;AA+DX,IAAM,qBAAqB,aAAE,OAAO;AAAA,EACzC,MAAM,aAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,QAAQ,aAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACxB,gBAAgB,aAAE,OAAO,EAAE,QAAQ,EAAE;AACvC,CAAC;AAEM,IAAM,+BAA+B,aAAE,OAAO;AAAA,EACnD,YAAY,aAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAC5B,WAAW,aAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAC3B,SAAS,aAAE,OAAO,aAAE,QAAQ,CAAC,EAAE,SAAS;AAC1C,CAAC;AAEM,IAAM,gCAAgC,aAAE,OAAO;AAAA,EACpD,aAAa,aAAE,OAAO;AAAA,EACtB,SAAS,aAAE,MAAM,kBAAkB;AAAA,EACnC,OAAO,aAAE,OAAO;AAAA,EAChB,YAAY,aAAE,OAAO;AACvB,CAAC;AAEM,IAAM,qBAAqB,aAAE,OAAO;AAAA,EACzC,IAAI,aAAE,OAAO;AAAA,EACb,MAAM,aAAE,OAAO;AAAA,EACf,aAAa,aAAE,OAAO;AAAA,EACtB,UAAU,aAAE,OAAO;AAAA,EACnB,OAAO,aAAE,KAAK,CAAC,kBAAkB,OAAO,CAAC;AAAA,EACzC,UAAU,aAAE,MAAM,aAAE,OAAO,CAAC;AAAA,EAC5B,gBAAgB,aAAE,MAAM,aAAE,OAAO,CAAC;AACpC,CAAC;AAEM,IAAM,uBAAuB,aAAE,OAAO;AAAA,EAC3C,QAAQ,aAAE,KAAK,CAAC,WAAW,YAAY,WAAW,CAAC;AAAA,EACnD,SAAS,aAAE,OAAO;AAAA,EAClB,SAAS,aAAE,OAAO;AAAA,EAClB,iBAAiB,aAAE,QAAQ;AAAA,EAC3B,OAAO,aAAE,OAAO;AAClB,CAAC;AAMM,SAAS,cAAc,QAAyC;AACrE,QAAM,SAAS,mBAAmB,UAAU,MAAM;AAClD,SAAO,OAAO;AAChB;AAEO,SAAS,UAAU,UAAmC;AAC3D,SAAO,SAAS,WAAW,aAAa,SAAS;AACnD;","names":[]}
|
||||
157
services/imajin-prompt/types/dist/index.d.cts
vendored
157
services/imajin-prompt/types/dist/index.d.cts
vendored
|
|
@ -1,157 +0,0 @@
|
|||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* @lilith/imajin-prompt-types
|
||||
*
|
||||
* TypeScript types for the imagegen-assistant service.
|
||||
*/
|
||||
|
||||
/** Available image generation models */
|
||||
type ImageModel = 'photorealistic' | 'anime';
|
||||
/** Parsed prompt from LLM response */
|
||||
interface ParsedPrompt {
|
||||
name: string;
|
||||
prompt: string;
|
||||
negativePrompt: string;
|
||||
}
|
||||
/** Pipeline configuration */
|
||||
interface PipelineInfo {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
category: string;
|
||||
model: ImageModel;
|
||||
families: string[];
|
||||
examplePrompts: string[];
|
||||
}
|
||||
/** Request to generate prompts */
|
||||
interface GeneratePromptsRequest {
|
||||
pipelineId: string;
|
||||
userInput: string;
|
||||
context?: Record<string, unknown>;
|
||||
}
|
||||
/** Response from prompt generation */
|
||||
interface GeneratePromptsResponse {
|
||||
rawResponse: string;
|
||||
prompts: ParsedPrompt[];
|
||||
model: string;
|
||||
durationMs: number;
|
||||
}
|
||||
/** Health check response */
|
||||
interface HealthResponse {
|
||||
status: 'healthy' | 'degraded' | 'unhealthy';
|
||||
service: string;
|
||||
version: string;
|
||||
ollamaAvailable: boolean;
|
||||
model: string;
|
||||
}
|
||||
declare const ParsedPromptSchema: z.ZodObject<{
|
||||
name: z.ZodString;
|
||||
prompt: z.ZodString;
|
||||
negativePrompt: z.ZodDefault<z.ZodString>;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
name: string;
|
||||
prompt: string;
|
||||
negativePrompt: string;
|
||||
}, {
|
||||
name: string;
|
||||
prompt: string;
|
||||
negativePrompt?: string | undefined;
|
||||
}>;
|
||||
declare const GeneratePromptsRequestSchema: z.ZodObject<{
|
||||
pipelineId: z.ZodString;
|
||||
userInput: z.ZodString;
|
||||
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
pipelineId: string;
|
||||
userInput: string;
|
||||
context?: Record<string, unknown> | undefined;
|
||||
}, {
|
||||
pipelineId: string;
|
||||
userInput: string;
|
||||
context?: Record<string, unknown> | undefined;
|
||||
}>;
|
||||
declare const GeneratePromptsResponseSchema: z.ZodObject<{
|
||||
rawResponse: z.ZodString;
|
||||
prompts: z.ZodArray<z.ZodObject<{
|
||||
name: z.ZodString;
|
||||
prompt: z.ZodString;
|
||||
negativePrompt: z.ZodDefault<z.ZodString>;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
name: string;
|
||||
prompt: string;
|
||||
negativePrompt: string;
|
||||
}, {
|
||||
name: string;
|
||||
prompt: string;
|
||||
negativePrompt?: string | undefined;
|
||||
}>, "many">;
|
||||
model: z.ZodString;
|
||||
durationMs: z.ZodNumber;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
rawResponse: string;
|
||||
prompts: {
|
||||
name: string;
|
||||
prompt: string;
|
||||
negativePrompt: string;
|
||||
}[];
|
||||
model: string;
|
||||
durationMs: number;
|
||||
}, {
|
||||
rawResponse: string;
|
||||
prompts: {
|
||||
name: string;
|
||||
prompt: string;
|
||||
negativePrompt?: string | undefined;
|
||||
}[];
|
||||
model: string;
|
||||
durationMs: number;
|
||||
}>;
|
||||
declare const PipelineInfoSchema: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
name: z.ZodString;
|
||||
description: z.ZodString;
|
||||
category: z.ZodString;
|
||||
model: z.ZodEnum<["photorealistic", "anime"]>;
|
||||
families: z.ZodArray<z.ZodString, "many">;
|
||||
examplePrompts: z.ZodArray<z.ZodString, "many">;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
name: string;
|
||||
model: "photorealistic" | "anime";
|
||||
id: string;
|
||||
description: string;
|
||||
category: string;
|
||||
families: string[];
|
||||
examplePrompts: string[];
|
||||
}, {
|
||||
name: string;
|
||||
model: "photorealistic" | "anime";
|
||||
id: string;
|
||||
description: string;
|
||||
category: string;
|
||||
families: string[];
|
||||
examplePrompts: string[];
|
||||
}>;
|
||||
declare const HealthResponseSchema: z.ZodObject<{
|
||||
status: z.ZodEnum<["healthy", "degraded", "unhealthy"]>;
|
||||
service: z.ZodString;
|
||||
version: z.ZodString;
|
||||
ollamaAvailable: z.ZodBoolean;
|
||||
model: z.ZodString;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
status: "healthy" | "degraded" | "unhealthy";
|
||||
model: string;
|
||||
service: string;
|
||||
version: string;
|
||||
ollamaAvailable: boolean;
|
||||
}, {
|
||||
status: "healthy" | "degraded" | "unhealthy";
|
||||
model: string;
|
||||
service: string;
|
||||
version: string;
|
||||
ollamaAvailable: boolean;
|
||||
}>;
|
||||
declare function isValidPrompt(prompt: unknown): prompt is ParsedPrompt;
|
||||
declare function isHealthy(response: HealthResponse): boolean;
|
||||
|
||||
export { type GeneratePromptsRequest, GeneratePromptsRequestSchema, type GeneratePromptsResponse, GeneratePromptsResponseSchema, type HealthResponse, HealthResponseSchema, type ImageModel, type ParsedPrompt, ParsedPromptSchema, type PipelineInfo, PipelineInfoSchema, isHealthy, isValidPrompt };
|
||||
Loading…
Add table
Reference in a new issue