@sogni-ai/sogni-intelligence-client 3.7.0 → 3.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import type { SogniChatMessage } from '../runtime/chatTypes.js';
2
- import type { ToolDefinition } from '../tools/definitions/types.js';
3
- export type ImagePromptingType = 'flux' | 'sdxl' | 'sd15' | 'pony' | 'fast' | 'krea2' | 'sd3' | 'editing' | 'video';
1
+ import type { SogniChatMessage } from "../runtime/chatTypes.js";
2
+ import type { ToolDefinition } from "../tools/definitions/types.js";
3
+ export type ImagePromptingType = "flux" | "sdxl" | "sd15" | "pony" | "fast" | "sd3" | "editing" | "video";
4
4
  export interface BuildImagePromptMessagesInput {
5
5
  prompt: string;
6
6
  stylePrompt?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"imagePrompt.d.ts","sourceRoot":"","sources":["../../src/contracts/imagePrompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGpE,MAAM,MAAM,kBAAkB,GAC1B,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,KAAK,GACL,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAoG5C,eAAO,MAAM,iBAAiB,EAAE,cAgB/B,CAAC;AA0BF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,GAAG,gBAAgB,EAAE,CAAC;AACnG,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,kBAAkB,EACjC,UAAU,EAAE,MAAM,GACjB,gBAAgB,EAAE,CAAC;AA4BtB,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAEzE"}
1
+ {"version":3,"file":"imagePrompt.d.ts","sourceRoot":"","sources":["../../src/contracts/imagePrompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGpE,MAAM,MAAM,kBAAkB,GAC5B,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3E,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAkG5C,eAAO,MAAM,iBAAiB,EAAE,cAiB/B,CAAC;AA0BF,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,6BAA6B,GACnC,gBAAgB,EAAE,CAAC;AACtB,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,kBAAkB,EACjC,UAAU,EAAE,MAAM,GACjB,gBAAgB,EAAE,CAAC;AAoCtB,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAEzE"}
@@ -5,12 +5,15 @@ exports.buildImagePromptMessages = buildImagePromptMessages;
5
5
  exports.parseToolCallPrompt = parseToolCallPrompt;
6
6
  const randomThemes_js_1 = require("./randomThemes.js");
7
7
  exports.IMAGE_PROMPT_MAX_TOKENS = 1024;
8
- const FLUX_GUIDE = `FLUX & Next-Gen models use natural language descriptions, not keyword lists.
9
- - Write flowing, descriptive prose: subject, environment, lighting, mood.
10
- - Be specific about what you want rather than using abstract quality boosters.
11
- - You can mix descriptive phrases with comma-separated keywords, but lean toward sentences.
8
+ const FLUX_GUIDE = `FLUX and advanced next-gen image models use detailed natural-language descriptions, not keyword lists.
9
+ - Plan internally before writing: identify the subject, mood, best-fitting medium/style, composition/framing, lighting, and grounded details.
10
+ - Preserve the user's original subjects, actions, colors, spatial relationships, and requested medium. Do not add new objects, props, characters, or animals unless clearly implied.
11
+ - Write one cohesive paragraph with practical T2I structure: subject and attributes first, then action/pose, spatial layout, environment, composition/framing, lighting, and medium/style.
12
12
  - Camera/lens terms and lighting descriptions work well.
13
- - Keep guidance context in mind: these models use very low guidance (1-5), so prompts should be clear and direct.`;
13
+ - Be specific and concrete instead of using abstract quality boosters. Add detail that improves the image, but avoid inventing unsupported clothing, materials, colors, or scene details.
14
+ - If the user requests visible text, labels, typography, or signage, specify the exact words and wrap them in quotes.
15
+ - If the user's prompt is already detailed, lightly polish and finalize it rather than heavily expanding or changing direction.
16
+ - Keep low-guidance behavior in mind: prompts should be clear, direct, faithful, and parseable.`;
14
17
  const SDXL_GUIDE = `SDXL models work well with a hybrid approach: natural language descriptions combined with comma-separated quality/style keywords.
15
18
  Prompt structure (in this order):
16
19
  1. Subject — what/who is in the image
@@ -45,12 +48,6 @@ const FAST_GUIDE = `Turbo, Lightning, and LCM models are optimized for speed (2-
45
48
  - Don't overload with quality boosters — at very low guidance they have minimal effect.
46
49
  - Don't use extremely long, multi-sentence prompts.
47
50
  Example: "a majestic lion in golden savanna, sunset, cinematic"`;
48
- const KREA2_GUIDE = `Krea 2 is a next-gen model that responds best to natural-language descriptions, not keyword lists.
49
- - Write flowing, descriptive prose: the subject and its attributes first, then environment, composition/framing, lighting, and the medium or art style.
50
- - Long, detailed prompts yield the best results — but the model also handles short prompts well, so add detail that matters and skip empty quality boosters.
51
- - It runs at very low / no guidance (distilled turbo), so be clear and direct; negative prompts have little effect.
52
- - For text in the image, spell out the exact words and wrap them in quotes, e.g. a sign reading "OPEN".
53
- - Supports high resolution (up to ~2K); describe fine texture and detail when you want it.`;
54
51
  const SD3_GUIDE = `SD3 has improved natural language understanding, multi-subject composition, and typography rendering.
55
52
  - Write clear, descriptive natural language prompts — not keyword lists.
56
53
  - You can be specific about spatial relationships: "on the left", "in the background", "above".
@@ -71,10 +68,9 @@ const PROMPTING_GUIDES = {
71
68
  sd15: SD15_GUIDE,
72
69
  pony: PONY_GUIDE,
73
70
  fast: FAST_GUIDE,
74
- krea2: KREA2_GUIDE,
75
71
  sd3: SD3_GUIDE,
76
72
  editing: EDITING_GUIDE,
77
- video: '',
73
+ video: "",
78
74
  };
79
75
  function buildSystemPrompt(promptingType, modelTitle) {
80
76
  const guide = PROMPTING_GUIDES[promptingType] || PROMPTING_GUIDES.sdxl;
@@ -93,44 +89,47 @@ RULES:
93
89
  - Output only the prompt text — no explanations, no preamble.`;
94
90
  }
95
91
  exports.IMAGE_PROMPT_TOOL = {
96
- type: 'function',
92
+ type: "function",
97
93
  function: {
98
- name: 'enhance_prompt',
99
- description: 'Output the enhanced image generation prompt',
94
+ name: "enhance_prompt",
95
+ description: "Output the enhanced image generation prompt",
100
96
  parameters: {
101
- type: 'object',
97
+ type: "object",
102
98
  properties: {
103
99
  prompt: {
104
- type: 'string',
105
- description: 'The enhanced image generation prompt optimized for the target model',
100
+ type: "string",
101
+ description: "The enhanced image generation prompt optimized for the target model",
106
102
  },
107
103
  },
108
- required: ['prompt'],
104
+ required: ["prompt"],
109
105
  },
110
106
  },
111
107
  };
112
- function normalizeBuildImagePromptInput(inputOrPrompt, stylePrompt = '', promptingType = 'sdxl', modelTitle = 'Unknown Model') {
113
- if (typeof inputOrPrompt === 'string') {
108
+ function normalizeBuildImagePromptInput(inputOrPrompt, stylePrompt = "", promptingType = "sdxl", modelTitle = "Unknown Model") {
109
+ if (typeof inputOrPrompt === "string") {
114
110
  return {
115
111
  prompt: inputOrPrompt,
116
112
  stylePrompt,
117
113
  promptingType,
118
114
  modelTitle,
119
- randomTheme: '',
115
+ randomTheme: "",
120
116
  };
121
117
  }
122
118
  return {
123
119
  prompt: inputOrPrompt.prompt,
124
- stylePrompt: inputOrPrompt.stylePrompt ?? '',
125
- promptingType: inputOrPrompt.promptingType ?? 'sdxl',
126
- modelTitle: inputOrPrompt.modelTitle ?? 'Unknown Model',
127
- randomTheme: inputOrPrompt.randomTheme ?? '',
120
+ stylePrompt: inputOrPrompt.stylePrompt ?? "",
121
+ promptingType: inputOrPrompt.promptingType ?? "sdxl",
122
+ modelTitle: inputOrPrompt.modelTitle ?? "Unknown Model",
123
+ randomTheme: inputOrPrompt.randomTheme ?? "",
128
124
  };
129
125
  }
130
- function buildImagePromptMessages(inputOrPrompt, stylePrompt = '', promptingType = 'sdxl', modelTitle = 'Unknown Model') {
126
+ function buildImagePromptMessages(inputOrPrompt, stylePrompt = "", promptingType = "sdxl", modelTitle = "Unknown Model") {
131
127
  const input = normalizeBuildImagePromptInput(inputOrPrompt, stylePrompt, promptingType, modelTitle);
132
128
  const messages = [
133
- { role: 'system', content: buildSystemPrompt(input.promptingType, input.modelTitle) },
129
+ {
130
+ role: "system",
131
+ content: buildSystemPrompt(input.promptingType, input.modelTitle),
132
+ },
134
133
  ];
135
134
  let userMessage;
136
135
  if (input.prompt.trim()) {
@@ -146,10 +145,10 @@ function buildImagePromptMessages(inputOrPrompt, stylePrompt = '', promptingType
146
145
  userMessage += `\n\nUse this style as inspiration: ${input.stylePrompt}`;
147
146
  }
148
147
  }
149
- messages.push({ role: 'user', content: userMessage });
148
+ messages.push({ role: "user", content: userMessage });
150
149
  return messages;
151
150
  }
152
151
  function parseToolCallPrompt(args) {
153
- return String(args.prompt || '').trim();
152
+ return String(args.prompt || "").trim();
154
153
  }
155
154
  //# sourceMappingURL=imagePrompt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"imagePrompt.js","sourceRoot":"","sources":["../../src/contracts/imagePrompt.ts"],"names":[],"mappings":";;;AA4KA,4DAyBC;AAED,kDAEC;AAvMD,uDAAmD;AAqBtC,QAAA,uBAAuB,GAAG,IAAI,CAAC;AAE5C,MAAM,UAAU,GAAG;;;;;kHAK+F,CAAC;AAEnH,MAAM,UAAU,GAAG;;;;;;;;+GAQ4F,CAAC;AAEhH,MAAM,UAAU,GAAG;;;;;;;;;sDASmC,CAAC;AAEvD,MAAM,UAAU,GAAG;;;;;;;yIAOsH,CAAC;AAE1I,MAAM,UAAU,GAAG;;;;;;gEAM6C,CAAC;AAEjE,MAAM,WAAW,GAAG;;;;;2FAKuE,CAAC;AAE5F,MAAM,SAAS,GAAG;;;;;;qDAMmC,CAAC;AAEtD,MAAM,aAAa,GAAG;;;;;;8DAMwC,CAAC;AAE/D,MAAM,gBAAgB,GAAuC;IAC3D,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,WAAW;IAClB,GAAG,EAAE,SAAS;IACd,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,EAAE;CACV,CAAC;AAEF,SAAS,iBAAiB,CAAC,aAAiC,EAAE,UAAkB;IAC9E,MAAM,KAAK,GAAG,gBAAgB,CAAC,aAAa,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC;IAEvE,OAAO,iMAAiM,UAAU;;;EAGlN,KAAK;;;;;;;;;8DASuD,CAAC;AAC/D,CAAC;AAEY,QAAA,iBAAiB,GAAmB;IAC/C,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,6CAA6C;QAC1D,UAAU,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EAAE,EAChB,gBAAoC,MAAM,EAC1C,UAAU,GAAG,eAAe;IAE5B,MAAM,KAAK,GAAG,8BAA8B,CAC1C,aAAa,EACb,WAAW,EACX,aAAa,EACb,UAAU,CACX,CAAC;IACF,MAAM,QAAQ,GAAuB;QACnC;YACE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,UAAU,CAAC;SAClE;KACF,CAAC;IACF,IAAI,WAAmB,CAAC;IACxB,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QACxB,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACtB,WAAW,IAAI,8DAA8D,KAAK,CAAC,WAAW,EAAE,CAAC;QACnG,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,IAAI,IAAA,gCAAc,GAAE,CAAC;QACpD,WAAW,GAAG,sDAAsD,KAAK,+CAA+C,CAAC;QACzH,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACtB,WAAW,IAAI,sCAAsC,KAAK,CAAC,WAAW,EAAE,CAAC;QAC3E,CAAC;IACH,CAAC;IACD,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;IACtD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAgB,mBAAmB,CAAC,IAA6B;IAC/D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1C,CAAC"}
@@ -1,11 +1,14 @@
1
- import { getRandomTheme } from './randomThemes.js';
1
+ import { getRandomTheme } from "./randomThemes.js";
2
2
  export const IMAGE_PROMPT_MAX_TOKENS = 1024;
3
- const FLUX_GUIDE = `FLUX & Next-Gen models use natural language descriptions, not keyword lists.
4
- - Write flowing, descriptive prose: subject, environment, lighting, mood.
5
- - Be specific about what you want rather than using abstract quality boosters.
6
- - You can mix descriptive phrases with comma-separated keywords, but lean toward sentences.
3
+ const FLUX_GUIDE = `FLUX and advanced next-gen image models use detailed natural-language descriptions, not keyword lists.
4
+ - Plan internally before writing: identify the subject, mood, best-fitting medium/style, composition/framing, lighting, and grounded details.
5
+ - Preserve the user's original subjects, actions, colors, spatial relationships, and requested medium. Do not add new objects, props, characters, or animals unless clearly implied.
6
+ - Write one cohesive paragraph with practical T2I structure: subject and attributes first, then action/pose, spatial layout, environment, composition/framing, lighting, and medium/style.
7
7
  - Camera/lens terms and lighting descriptions work well.
8
- - Keep guidance context in mind: these models use very low guidance (1-5), so prompts should be clear and direct.`;
8
+ - Be specific and concrete instead of using abstract quality boosters. Add detail that improves the image, but avoid inventing unsupported clothing, materials, colors, or scene details.
9
+ - If the user requests visible text, labels, typography, or signage, specify the exact words and wrap them in quotes.
10
+ - If the user's prompt is already detailed, lightly polish and finalize it rather than heavily expanding or changing direction.
11
+ - Keep low-guidance behavior in mind: prompts should be clear, direct, faithful, and parseable.`;
9
12
  const SDXL_GUIDE = `SDXL models work well with a hybrid approach: natural language descriptions combined with comma-separated quality/style keywords.
10
13
  Prompt structure (in this order):
11
14
  1. Subject — what/who is in the image
@@ -40,12 +43,6 @@ const FAST_GUIDE = `Turbo, Lightning, and LCM models are optimized for speed (2-
40
43
  - Don't overload with quality boosters — at very low guidance they have minimal effect.
41
44
  - Don't use extremely long, multi-sentence prompts.
42
45
  Example: "a majestic lion in golden savanna, sunset, cinematic"`;
43
- const KREA2_GUIDE = `Krea 2 is a next-gen model that responds best to natural-language descriptions, not keyword lists.
44
- - Write flowing, descriptive prose: the subject and its attributes first, then environment, composition/framing, lighting, and the medium or art style.
45
- - Long, detailed prompts yield the best results — but the model also handles short prompts well, so add detail that matters and skip empty quality boosters.
46
- - It runs at very low / no guidance (distilled turbo), so be clear and direct; negative prompts have little effect.
47
- - For text in the image, spell out the exact words and wrap them in quotes, e.g. a sign reading "OPEN".
48
- - Supports high resolution (up to ~2K); describe fine texture and detail when you want it.`;
49
46
  const SD3_GUIDE = `SD3 has improved natural language understanding, multi-subject composition, and typography rendering.
50
47
  - Write clear, descriptive natural language prompts — not keyword lists.
51
48
  - You can be specific about spatial relationships: "on the left", "in the background", "above".
@@ -66,10 +63,9 @@ const PROMPTING_GUIDES = {
66
63
  sd15: SD15_GUIDE,
67
64
  pony: PONY_GUIDE,
68
65
  fast: FAST_GUIDE,
69
- krea2: KREA2_GUIDE,
70
66
  sd3: SD3_GUIDE,
71
67
  editing: EDITING_GUIDE,
72
- video: '',
68
+ video: "",
73
69
  };
74
70
  function buildSystemPrompt(promptingType, modelTitle) {
75
71
  const guide = PROMPTING_GUIDES[promptingType] || PROMPTING_GUIDES.sdxl;
@@ -88,44 +84,47 @@ RULES:
88
84
  - Output only the prompt text — no explanations, no preamble.`;
89
85
  }
90
86
  export const IMAGE_PROMPT_TOOL = {
91
- type: 'function',
87
+ type: "function",
92
88
  function: {
93
- name: 'enhance_prompt',
94
- description: 'Output the enhanced image generation prompt',
89
+ name: "enhance_prompt",
90
+ description: "Output the enhanced image generation prompt",
95
91
  parameters: {
96
- type: 'object',
92
+ type: "object",
97
93
  properties: {
98
94
  prompt: {
99
- type: 'string',
100
- description: 'The enhanced image generation prompt optimized for the target model',
95
+ type: "string",
96
+ description: "The enhanced image generation prompt optimized for the target model",
101
97
  },
102
98
  },
103
- required: ['prompt'],
99
+ required: ["prompt"],
104
100
  },
105
101
  },
106
102
  };
107
- function normalizeBuildImagePromptInput(inputOrPrompt, stylePrompt = '', promptingType = 'sdxl', modelTitle = 'Unknown Model') {
108
- if (typeof inputOrPrompt === 'string') {
103
+ function normalizeBuildImagePromptInput(inputOrPrompt, stylePrompt = "", promptingType = "sdxl", modelTitle = "Unknown Model") {
104
+ if (typeof inputOrPrompt === "string") {
109
105
  return {
110
106
  prompt: inputOrPrompt,
111
107
  stylePrompt,
112
108
  promptingType,
113
109
  modelTitle,
114
- randomTheme: '',
110
+ randomTheme: "",
115
111
  };
116
112
  }
117
113
  return {
118
114
  prompt: inputOrPrompt.prompt,
119
- stylePrompt: inputOrPrompt.stylePrompt ?? '',
120
- promptingType: inputOrPrompt.promptingType ?? 'sdxl',
121
- modelTitle: inputOrPrompt.modelTitle ?? 'Unknown Model',
122
- randomTheme: inputOrPrompt.randomTheme ?? '',
115
+ stylePrompt: inputOrPrompt.stylePrompt ?? "",
116
+ promptingType: inputOrPrompt.promptingType ?? "sdxl",
117
+ modelTitle: inputOrPrompt.modelTitle ?? "Unknown Model",
118
+ randomTheme: inputOrPrompt.randomTheme ?? "",
123
119
  };
124
120
  }
125
- export function buildImagePromptMessages(inputOrPrompt, stylePrompt = '', promptingType = 'sdxl', modelTitle = 'Unknown Model') {
121
+ export function buildImagePromptMessages(inputOrPrompt, stylePrompt = "", promptingType = "sdxl", modelTitle = "Unknown Model") {
126
122
  const input = normalizeBuildImagePromptInput(inputOrPrompt, stylePrompt, promptingType, modelTitle);
127
123
  const messages = [
128
- { role: 'system', content: buildSystemPrompt(input.promptingType, input.modelTitle) },
124
+ {
125
+ role: "system",
126
+ content: buildSystemPrompt(input.promptingType, input.modelTitle),
127
+ },
129
128
  ];
130
129
  let userMessage;
131
130
  if (input.prompt.trim()) {
@@ -141,10 +140,10 @@ export function buildImagePromptMessages(inputOrPrompt, stylePrompt = '', prompt
141
140
  userMessage += `\n\nUse this style as inspiration: ${input.stylePrompt}`;
142
141
  }
143
142
  }
144
- messages.push({ role: 'user', content: userMessage });
143
+ messages.push({ role: "user", content: userMessage });
145
144
  return messages;
146
145
  }
147
146
  export function parseToolCallPrompt(args) {
148
- return String(args.prompt || '').trim();
147
+ return String(args.prompt || "").trim();
149
148
  }
150
149
  //# sourceMappingURL=imagePrompt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"imagePrompt.js","sourceRoot":"","sources":["../../src/contracts/imagePrompt.ts"],"names":[],"mappings":"A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EACX,aAAa,EACb,UAAU,CACX,CAAC;IACF,MAAM,QAAQ,GAAuB;QACnC;YACE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,UAAU,CAAC;SAClE;KACF,CAAC;IACF,IAAI,WAAmB,CAAC;IACxB,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QACxB,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACtB,WAAW,IAAI,8DAA8D,KAAK,CAAC,WAAW,EAAE,CAAC;QACnG,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,IAAI,cAAc,EAAE,CAAC;QACpD,WAAW,GAAG,sDAAsD,KAAK,+CAA+C,CAAC;QACzH,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACtB,WAAW,IAAI,sCAAsC,KAAK,CAAC,WAAW,EAAE,CAAC;QAC3E,CAAC;IACH,CAAC;IACD,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;IACtD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAA6B;IAC/D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sogni-ai/sogni-intelligence-client",
3
- "version": "3.7.0",
3
+ "version": "3.7.2",
4
4
  "description": "Public Sogni Intelligence client — Node.js convenience wrapper for the Sogni SDK plus the public-safe subset of @sogni/creative-agent contracts (ContractRegistry, AssetManifest, RunRecord, tool envelopes). For agent builders, third-party integrations, and downstream SDKs.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -205,7 +205,7 @@
205
205
  },
206
206
  "homepage": "https://github.com/Sogni-AI/sogni-intelligence-client#readme",
207
207
  "dependencies": {
208
- "@sogni-ai/sogni-client": "5.1.0-alpha.16",
208
+ "@sogni-ai/sogni-client": "5.1.0-alpha.19",
209
209
  "@sogni-ai/sogni-protocol": "1.0.0-alpha.9",
210
210
  "sharp": "^0.34.5"
211
211
  },