@sogni-ai/sogni-intelligence-client 3.21.1 → 3.22.0
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.
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +2 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/turnAnalysis.d.ts +9 -0
- package/dist/agent/turnAnalysis.d.ts.map +1 -1
- package/dist/agent/turnAnalysis.js +30 -0
- package/dist/agent/turnAnalysis.js.map +1 -1
- package/dist/contracts/imagePrompt.d.ts +17 -1
- package/dist/contracts/imagePrompt.d.ts.map +1 -1
- package/dist/contracts/imagePrompt.js +394 -0
- package/dist/contracts/imagePrompt.js.map +1 -1
- package/dist/contracts/index.d.ts +2 -2
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +5 -2
- package/dist/contracts/index.js.map +1 -1
- package/dist/openai-tools/_manifests.generated.js +3 -3
- package/dist/openai-tools/_manifests.generated.js.map +1 -1
- package/dist/openai-tools/generation-tools.json +3 -3
- package/dist/schemas/tools/generate_video.schema.json +1 -1
- package/dist/schemas/tools/sound_to_video.schema.json +1 -1
- package/dist/schemas/tools/video_to_video.schema.json +1 -1
- package/dist/tools/definitions/generate-video/definition.js +1 -1
- package/dist/tools/definitions/generate-video/definition.js.map +1 -1
- package/dist/tools/definitions/sound-to-video/definition.js +1 -1
- package/dist/tools/definitions/sound-to-video/definition.js.map +1 -1
- package/dist/tools/shared/_catalogs.generated.js +1 -1
- package/dist-esm/agent/index.js +1 -1
- package/dist-esm/agent/index.js.map +1 -1
- package/dist-esm/agent/turnAnalysis.js +29 -0
- package/dist-esm/agent/turnAnalysis.js.map +1 -1
- package/dist-esm/contracts/imagePrompt.js +391 -0
- package/dist-esm/contracts/imagePrompt.js.map +1 -1
- package/dist-esm/contracts/index.js +1 -1
- package/dist-esm/contracts/index.js.map +1 -1
- package/dist-esm/openai-tools/_manifests.generated.js +3 -3
- package/dist-esm/openai-tools/_manifests.generated.js.map +1 -1
- package/dist-esm/openai-tools/generation-tools.json +3 -3
- package/dist-esm/schemas/tools/generate_video.schema.json +1 -1
- package/dist-esm/schemas/tools/sound_to_video.schema.json +1 -1
- package/dist-esm/schemas/tools/video_to_video.schema.json +1 -1
- package/dist-esm/tools/definitions/generate-video/definition.js +1 -1
- package/dist-esm/tools/definitions/generate-video/definition.js.map +1 -1
- package/dist-esm/tools/definitions/sound-to-video/definition.js +1 -1
- package/dist-esm/tools/definitions/sound-to-video/definition.js.map +1 -1
- package/dist-esm/tools/shared/_catalogs.generated.js +1 -1
- package/package.json +3 -3
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { type ArtifactType, type IntentInputPendingActionRef, type IntentInputLastToolResultRef, type IntentInputActiveState, type IntentInputArtifactState, type IntentInputRecentTurn, type IntentInputSurface, type IntentInputCurrentMessageDetails, type IntentInputRuntimeFlags, type IntentInput, type LegacyIntentInputV0, isArtifactType, isIntentInputPendingActionRef, isIntentInputLastToolResultRef, isIntentInputActiveState, isIntentInputArtifactState, isIntentInputRecentTurn, isIntentInputSurface, isIntentInputCurrentMessageDetails, isIntentInputRuntimeFlags, isIntentInput, validateIntentInput, type IntentInputValidationError, type IntentInputValidationResult, } from './intentInput.js';
|
|
2
|
-
export { type TurnKind, type TurnIntent, type TurnExecutionMode, type SignalProvenance, type TurnAnalysis, isTurnKind, isTurnIntent, isTurnExecutionMode, isSignalProvenance, isTurnAnalysis, validateTurnAnalysis, type TurnAnalysisValidationError, type TurnAnalysisValidationResult, } from './turnAnalysis.js';
|
|
2
|
+
export { type TurnKind, type TurnIntent, type TurnExecutionMode, type SignalProvenance, type TurnTextArtifact, type TurnAnalysis, isTurnKind, isTurnIntent, isTurnExecutionMode, isSignalProvenance, isTurnTextArtifact, isTurnAnalysis, validateTurnAnalysis, type TurnAnalysisValidationError, type TurnAnalysisValidationResult, } from './turnAnalysis.js';
|
|
3
3
|
export { type PlannerArtifactRef, type PlannerProposedWorkflow, type PlannerSpendEstimate, type TurnPlan, isPlannerArtifactRef, isPlannerProposedWorkflow, isPlannerSpendEstimate, isTurnPlan, validateTurnPlan, type TurnPlanValidationError, type TurnPlanValidationResult, } from './turnPlan.js';
|
|
4
4
|
export { type ToolFamily, type ToolExecutionMode, type ToolCostClass, type ToolLatencyClass, type ToolConfirmationPolicy, type ToolRetrySafety, type ToolMetadata, isToolFamily, isToolExecutionMode, isToolCostClass, isToolLatencyClass, isToolConfirmationPolicy, isToolRetrySafety, isToolMetadata, validateToolMetadata, type ToolMetadataValidationError, type ToolMetadataValidationResult, } from './toolMetadata.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,gCAAgC,EACrC,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,cAAc,EACd,6BAA6B,EAC7B,8BAA8B,EAC9B,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,kCAAkC,EAClC,yBAAyB,EACzB,aAAa,EACb,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,GACjC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,GAClC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EACb,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,UAAU,EACV,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,GAClC,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,gCAAgC,EACrC,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,cAAc,EACd,6BAA6B,EAC7B,8BAA8B,EAC9B,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,kCAAkC,EAClC,yBAAyB,EACzB,aAAa,EACb,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,GACjC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,GAClC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EACb,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,UAAU,EACV,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,GAClC,MAAM,mBAAmB,CAAC"}
|
package/dist/agent/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateToolMetadata = exports.isToolMetadata = exports.isToolRetrySafety = exports.isToolConfirmationPolicy = exports.isToolLatencyClass = exports.isToolCostClass = exports.isToolExecutionMode = exports.isToolFamily = exports.validateTurnPlan = exports.isTurnPlan = exports.isPlannerSpendEstimate = exports.isPlannerProposedWorkflow = exports.isPlannerArtifactRef = exports.validateTurnAnalysis = exports.isTurnAnalysis = exports.isSignalProvenance = exports.isTurnExecutionMode = exports.isTurnIntent = exports.isTurnKind = exports.validateIntentInput = exports.isIntentInput = exports.isIntentInputRuntimeFlags = exports.isIntentInputCurrentMessageDetails = exports.isIntentInputSurface = exports.isIntentInputRecentTurn = exports.isIntentInputArtifactState = exports.isIntentInputActiveState = exports.isIntentInputLastToolResultRef = exports.isIntentInputPendingActionRef = exports.isArtifactType = void 0;
|
|
3
|
+
exports.validateToolMetadata = exports.isToolMetadata = exports.isToolRetrySafety = exports.isToolConfirmationPolicy = exports.isToolLatencyClass = exports.isToolCostClass = exports.isToolExecutionMode = exports.isToolFamily = exports.validateTurnPlan = exports.isTurnPlan = exports.isPlannerSpendEstimate = exports.isPlannerProposedWorkflow = exports.isPlannerArtifactRef = exports.validateTurnAnalysis = exports.isTurnAnalysis = exports.isTurnTextArtifact = exports.isSignalProvenance = exports.isTurnExecutionMode = exports.isTurnIntent = exports.isTurnKind = exports.validateIntentInput = exports.isIntentInput = exports.isIntentInputRuntimeFlags = exports.isIntentInputCurrentMessageDetails = exports.isIntentInputSurface = exports.isIntentInputRecentTurn = exports.isIntentInputArtifactState = exports.isIntentInputActiveState = exports.isIntentInputLastToolResultRef = exports.isIntentInputPendingActionRef = exports.isArtifactType = void 0;
|
|
4
4
|
var intentInput_js_1 = require("./intentInput.js");
|
|
5
5
|
Object.defineProperty(exports, "isArtifactType", { enumerable: true, get: function () { return intentInput_js_1.isArtifactType; } });
|
|
6
6
|
Object.defineProperty(exports, "isIntentInputPendingActionRef", { enumerable: true, get: function () { return intentInput_js_1.isIntentInputPendingActionRef; } });
|
|
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "isTurnKind", { enumerable: true, get: function (
|
|
|
18
18
|
Object.defineProperty(exports, "isTurnIntent", { enumerable: true, get: function () { return turnAnalysis_js_1.isTurnIntent; } });
|
|
19
19
|
Object.defineProperty(exports, "isTurnExecutionMode", { enumerable: true, get: function () { return turnAnalysis_js_1.isTurnExecutionMode; } });
|
|
20
20
|
Object.defineProperty(exports, "isSignalProvenance", { enumerable: true, get: function () { return turnAnalysis_js_1.isSignalProvenance; } });
|
|
21
|
+
Object.defineProperty(exports, "isTurnTextArtifact", { enumerable: true, get: function () { return turnAnalysis_js_1.isTurnTextArtifact; } });
|
|
21
22
|
Object.defineProperty(exports, "isTurnAnalysis", { enumerable: true, get: function () { return turnAnalysis_js_1.isTurnAnalysis; } });
|
|
22
23
|
Object.defineProperty(exports, "validateTurnAnalysis", { enumerable: true, get: function () { return turnAnalysis_js_1.validateTurnAnalysis; } });
|
|
23
24
|
var turnPlan_js_1 = require("./turnPlan.js");
|
package/dist/agent/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":";;;AAKA,mDAyB0B;AAbxB,gHAAA,cAAc,OAAA;AACd,+HAAA,6BAA6B,OAAA;AAC7B,gIAAA,8BAA8B,OAAA;AAC9B,0HAAA,wBAAwB,OAAA;AACxB,4HAAA,0BAA0B,OAAA;AAC1B,yHAAA,uBAAuB,OAAA;AACvB,sHAAA,oBAAoB,OAAA;AACpB,oIAAA,kCAAkC,OAAA;AAClC,2HAAA,yBAAyB,OAAA;AACzB,+GAAA,aAAa,OAAA;AACb,qHAAA,mBAAmB,OAAA;AAKrB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":";;;AAKA,mDAyB0B;AAbxB,gHAAA,cAAc,OAAA;AACd,+HAAA,6BAA6B,OAAA;AAC7B,gIAAA,8BAA8B,OAAA;AAC9B,0HAAA,wBAAwB,OAAA;AACxB,4HAAA,0BAA0B,OAAA;AAC1B,yHAAA,uBAAuB,OAAA;AACvB,sHAAA,oBAAoB,OAAA;AACpB,oIAAA,kCAAkC,OAAA;AAClC,2HAAA,yBAAyB,OAAA;AACzB,+GAAA,aAAa,OAAA;AACb,qHAAA,mBAAmB,OAAA;AAKrB,qDAgB2B;AATzB,6GAAA,UAAU,OAAA;AACV,+GAAA,YAAY,OAAA;AACZ,sHAAA,mBAAmB,OAAA;AACnB,qHAAA,kBAAkB,OAAA;AAClB,qHAAA,kBAAkB,OAAA;AAClB,iHAAA,cAAc,OAAA;AACd,uHAAA,oBAAoB,OAAA;AAKtB,6CAYuB;AAPrB,mHAAA,oBAAoB,OAAA;AACpB,wHAAA,yBAAyB,OAAA;AACzB,qHAAA,sBAAsB,OAAA;AACtB,yGAAA,UAAU,OAAA;AACV,+GAAA,gBAAgB,OAAA;AAKlB,qDAkB2B;AAVzB,+GAAA,YAAY,OAAA;AACZ,sHAAA,mBAAmB,OAAA;AACnB,kHAAA,eAAe,OAAA;AACf,qHAAA,kBAAkB,OAAA;AAClB,2HAAA,wBAAwB,OAAA;AACxB,oHAAA,iBAAiB,OAAA;AACjB,iHAAA,cAAc,OAAA;AACd,uHAAA,oBAAoB,OAAA"}
|
|
@@ -2,6 +2,13 @@ export type TurnKind = 'chat' | 'image' | 'video' | 'audio' | 'analysis' | 'work
|
|
|
2
2
|
export type TurnIntent = 'generate' | 'edit' | 'analyze' | 'transform' | 'question' | 'capability' | 'continue' | 'reference' | 'configure' | 'clarify' | 'unknown';
|
|
3
3
|
export type TurnExecutionMode = 'none' | 'tool' | 'multi_tool' | 'workflow';
|
|
4
4
|
export type SignalProvenance = 'classifier' | 'planner' | 'runtime_state' | 'artifact_graph' | 'user_explicit';
|
|
5
|
+
export interface TurnTextArtifact {
|
|
6
|
+
kind: 'model_prompt';
|
|
7
|
+
modality: 'image' | 'video';
|
|
8
|
+
targetModel: string | null;
|
|
9
|
+
workflow: string | null;
|
|
10
|
+
durationSeconds: number | null;
|
|
11
|
+
}
|
|
5
12
|
export interface TurnAnalysis {
|
|
6
13
|
domain: TurnKind;
|
|
7
14
|
intent: TurnIntent;
|
|
@@ -15,12 +22,14 @@ export interface TurnAnalysis {
|
|
|
15
22
|
requiredCapabilities: string[];
|
|
16
23
|
needsClarification: boolean;
|
|
17
24
|
confidence: number;
|
|
25
|
+
textArtifact?: TurnTextArtifact | null;
|
|
18
26
|
provenance: SignalProvenance;
|
|
19
27
|
}
|
|
20
28
|
export declare function isTurnKind(value: unknown): value is TurnKind;
|
|
21
29
|
export declare function isTurnIntent(value: unknown): value is TurnIntent;
|
|
22
30
|
export declare function isTurnExecutionMode(value: unknown): value is TurnExecutionMode;
|
|
23
31
|
export declare function isSignalProvenance(value: unknown): value is SignalProvenance;
|
|
32
|
+
export declare function isTurnTextArtifact(value: unknown): value is TurnTextArtifact;
|
|
24
33
|
export declare function isTurnAnalysis(value: unknown): value is TurnAnalysis;
|
|
25
34
|
export interface TurnAnalysisValidationError {
|
|
26
35
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turnAnalysis.d.ts","sourceRoot":"","sources":["../../src/agent/turnAnalysis.ts"],"names":[],"mappings":"AAqBA,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,UAAU,GACV,UAAU,GACV,QAAQ,GACR,UAAU,GACV,SAAS,CAAC;AAGd,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,MAAM,GACN,SAAS,GACT,WAAW,GACX,UAAU,GACV,YAAY,GACZ,UAAU,GACV,WAAW,GACX,WAAW,GACX,SAAS,GACT,SAAS,CAAC;AAGd,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU,CAAC;AAS5E,MAAM,MAAM,gBAAgB,GACxB,YAAY,GACZ,SAAS,GACT,eAAe,GACf,gBAAgB,GAChB,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"turnAnalysis.d.ts","sourceRoot":"","sources":["../../src/agent/turnAnalysis.ts"],"names":[],"mappings":"AAqBA,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,UAAU,GACV,UAAU,GACV,QAAQ,GACR,UAAU,GACV,SAAS,CAAC;AAGd,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,MAAM,GACN,SAAS,GACT,WAAW,GACX,UAAU,GACV,YAAY,GACZ,UAAU,GACV,WAAW,GACX,WAAW,GACX,SAAS,GACT,SAAS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IAAI,gBAAgB,CAE5E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAgB5E;AAmBD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAqBpE;AAGD,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,2BAA2B,EAAE,CAAC;CACvC;AAgBD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,4BAA4B,CAkEjF"}
|
|
@@ -4,6 +4,7 @@ exports.isTurnKind = isTurnKind;
|
|
|
4
4
|
exports.isTurnIntent = isTurnIntent;
|
|
5
5
|
exports.isTurnExecutionMode = isTurnExecutionMode;
|
|
6
6
|
exports.isSignalProvenance = isSignalProvenance;
|
|
7
|
+
exports.isTurnTextArtifact = isTurnTextArtifact;
|
|
7
8
|
exports.isTurnAnalysis = isTurnAnalysis;
|
|
8
9
|
exports.validateTurnAnalysis = validateTurnAnalysis;
|
|
9
10
|
const TURN_KINDS = new Set([
|
|
@@ -55,6 +56,25 @@ function isTurnExecutionMode(value) {
|
|
|
55
56
|
function isSignalProvenance(value) {
|
|
56
57
|
return typeof value === 'string' && SIGNAL_PROVENANCES.has(value);
|
|
57
58
|
}
|
|
59
|
+
function isTurnTextArtifact(value) {
|
|
60
|
+
return isRecord(value)
|
|
61
|
+
&& value.kind === 'model_prompt'
|
|
62
|
+
&& (value.modality === 'image' || value.modality === 'video')
|
|
63
|
+
&& isNullableBoundedString(value.targetModel, 160)
|
|
64
|
+
&& isNullableBoundedString(value.workflow, 80)
|
|
65
|
+
&& (value.modality === 'video' || value.durationSeconds === null)
|
|
66
|
+
&& (value.durationSeconds === null
|
|
67
|
+
|| (typeof value.durationSeconds === 'number'
|
|
68
|
+
&& Number.isFinite(value.durationSeconds)
|
|
69
|
+
&& value.durationSeconds > 0
|
|
70
|
+
&& value.durationSeconds <= 3600));
|
|
71
|
+
}
|
|
72
|
+
function isNullableBoundedString(value, maxLength) {
|
|
73
|
+
return value === null
|
|
74
|
+
|| (typeof value === 'string'
|
|
75
|
+
&& value.trim().length > 0
|
|
76
|
+
&& value.length <= maxLength);
|
|
77
|
+
}
|
|
58
78
|
function isStringArray(value) {
|
|
59
79
|
return Array.isArray(value) && value.every((item) => typeof item === 'string');
|
|
60
80
|
}
|
|
@@ -88,6 +108,10 @@ function isTurnAnalysis(value) {
|
|
|
88
108
|
return false;
|
|
89
109
|
if (typeof value.confidence !== 'number' || !Number.isFinite(value.confidence))
|
|
90
110
|
return false;
|
|
111
|
+
if (value.textArtifact !== undefined
|
|
112
|
+
&& value.textArtifact !== null
|
|
113
|
+
&& !isTurnTextArtifact(value.textArtifact))
|
|
114
|
+
return false;
|
|
91
115
|
if (!isSignalProvenance(value.provenance))
|
|
92
116
|
return false;
|
|
93
117
|
return true;
|
|
@@ -147,6 +171,12 @@ function validateTurnAnalysis(value) {
|
|
|
147
171
|
if (typeof conf !== 'number' || !Number.isFinite(conf)) {
|
|
148
172
|
pushError(errors, '/confidence', 'must be a finite number');
|
|
149
173
|
}
|
|
174
|
+
const textArtifact = value.textArtifact;
|
|
175
|
+
if (textArtifact !== undefined
|
|
176
|
+
&& textArtifact !== null
|
|
177
|
+
&& !isTurnTextArtifact(textArtifact)) {
|
|
178
|
+
pushError(errors, '/textArtifact', 'must be null or a valid TurnTextArtifact');
|
|
179
|
+
}
|
|
150
180
|
if (!isSignalProvenance(value.provenance)) {
|
|
151
181
|
pushError(errors, '/provenance', 'must be a valid SignalProvenance');
|
|
152
182
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turnAnalysis.js","sourceRoot":"","sources":["../../src/agent/turnAnalysis.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"turnAnalysis.js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SAAS;WACvB,YAAY,KAAK,IAAI;WACrB,CAAC,kBAAkB,CAAC,YAAY,CAAC,EACpC,CAAC;QACD,SAAS,CACP,MAAM,EACN,eAAe,EACf,0CAA0C,CAC3C,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,kBAAkB,CAAE,KAAkC,CAAC,UAAU,CAAC,EAAE,CAAC;QACxE,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,kCAAkC,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import type { SogniChatMessage } from "../runtime/chatTypes.js";
|
|
2
2
|
import type { ToolDefinition } from "../tools/definitions/types.js";
|
|
3
|
-
export type ImagePromptingType = "flux" | "sdxl" | "sd15" | "pony" | "fast" | "sd3" | "editing" | "video";
|
|
3
|
+
export type ImagePromptingType = "flux" | "sdxl" | "sd15" | "pony" | "fast" | "sd3" | "editing" | "krea2" | "qwen" | "z-image" | "gpt-image" | "qwen-edit" | "krea2-edit" | "gpt-image-edit" | "flux-edit" | "video";
|
|
4
|
+
export type ImagePromptAuthoringOperation = "generate" | "edit";
|
|
5
|
+
export type ImagePromptAuthoringOutputFormat = "prompt" | "positive_negative";
|
|
6
|
+
export interface ImagePromptAuthoringProfile {
|
|
7
|
+
id: string;
|
|
8
|
+
modelTitle: string;
|
|
9
|
+
promptingType: ImagePromptingType;
|
|
10
|
+
operation: ImagePromptAuthoringOperation;
|
|
11
|
+
outputFormat: ImagePromptAuthoringOutputFormat;
|
|
12
|
+
}
|
|
13
|
+
export interface BuildImagePromptAuthoringMessagesInput {
|
|
14
|
+
prompt: string;
|
|
15
|
+
profile: ImagePromptAuthoringProfile;
|
|
16
|
+
}
|
|
4
17
|
export interface BuildImagePromptMessagesInput {
|
|
5
18
|
prompt: string;
|
|
6
19
|
stylePrompt?: string;
|
|
@@ -13,4 +26,7 @@ export declare const IMAGE_PROMPT_TOOL: ToolDefinition;
|
|
|
13
26
|
export declare function buildImagePromptMessages(input: BuildImagePromptMessagesInput): SogniChatMessage[];
|
|
14
27
|
export declare function buildImagePromptMessages(prompt: string, stylePrompt: string, promptingType: ImagePromptingType, modelTitle: string): SogniChatMessage[];
|
|
15
28
|
export declare function parseToolCallPrompt(args: Record<string, unknown>): string;
|
|
29
|
+
export declare function resolveImagePromptAuthoringProfile(targetModel: string, requestedOperation?: string | null): ImagePromptAuthoringProfile | null;
|
|
30
|
+
export declare function buildImagePromptAuthoringMessages(input: BuildImagePromptAuthoringMessagesInput): SogniChatMessage[];
|
|
31
|
+
export declare function assertImagePromptAuthoringOutput(profile: ImagePromptAuthoringProfile, output: string): void;
|
|
16
32
|
//# sourceMappingURL=imagePrompt.d.ts.map
|
|
@@ -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,
|
|
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,KAAK,GACL,SAAS,GACT,OAAO,GACP,MAAM,GACN,SAAS,GACT,WAAW,GACX,WAAW,GACX,YAAY,GACZ,gBAAgB,GAChB,WAAW,GACX,OAAO,CAAC;AAEZ,MAAM,MAAM,6BAA6B,GAAG,UA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2BAA2B,EACpC,MAAM,EAAE,MAAM,GACb,IAAI,CAsBN"}
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.IMAGE_PROMPT_TOOL = exports.IMAGE_PROMPT_MAX_TOKENS = void 0;
|
|
4
4
|
exports.buildImagePromptMessages = buildImagePromptMessages;
|
|
5
5
|
exports.parseToolCallPrompt = parseToolCallPrompt;
|
|
6
|
+
exports.resolveImagePromptAuthoringProfile = resolveImagePromptAuthoringProfile;
|
|
7
|
+
exports.buildImagePromptAuthoringMessages = buildImagePromptAuthoringMessages;
|
|
8
|
+
exports.assertImagePromptAuthoringOutput = assertImagePromptAuthoringOutput;
|
|
6
9
|
const randomThemes_js_1 = require("./randomThemes.js");
|
|
7
10
|
exports.IMAGE_PROMPT_MAX_TOKENS = 1024;
|
|
8
11
|
const FLUX_GUIDE = `FLUX and advanced next-gen image models use detailed natural-language descriptions, not keyword lists.
|
|
@@ -55,6 +58,52 @@ const SD3_GUIDE = `SD3 has improved natural language understanding, multi-subjec
|
|
|
55
58
|
- For text in images, spell out exactly what to render in quotes.
|
|
56
59
|
- Don't over-tag with "masterpiece, best quality" etc. — just describe what you want.
|
|
57
60
|
- SD3 handles complex scenes better than SD1.5/SDXL.`;
|
|
61
|
+
const KREA2_GUIDE = `Krea 2 and Krea 2 Turbo are caption-conditioned image models built for aesthetic exploration and precise creative steering.
|
|
62
|
+
- Write one dense but fluent visual caption, usually 50-120 words. Krea 2 was trained on rich captions; do not reduce the request to SD-style keyword soup.
|
|
63
|
+
- Preserve ambiguity when the user wants exploration. When the user specifies a direction, make subject, action, composition, medium, palette, lighting, texture, and atmosphere concrete enough to narrow the output deliberately.
|
|
64
|
+
- Describe observable visual qualities instead of generic quality boosters such as "masterpiece" or "8K".
|
|
65
|
+
- Keep the subject and requested content dominant. Do not bury a simple idea under invented props, wardrobe, characters, symbols, or narrative beats.
|
|
66
|
+
- If visible text is requested, reproduce the exact wording in double quotes and state its placement and treatment.
|
|
67
|
+
- Krea 2 Turbo is distilled for few-step generation; use a cohesive caption with strong nouns and visual relationships rather than repeated emphasis tokens or prompt weights.`;
|
|
68
|
+
const QWEN_GUIDE = `Qwen Image 2512 uses detailed natural-language image descriptions and is especially strong at instruction following, spatial composition, human realism, fine natural detail, and visible text.
|
|
69
|
+
- Write a cohesive descriptive prompt with the subject and action first, followed by spatial layout, environment, composition, lighting, materials, and style.
|
|
70
|
+
- State poses, relative positions, viewing angle, and important geometric relationships explicitly.
|
|
71
|
+
- For any requested visible text, preserve the exact wording in double quotes and specify carrier, placement, layout direction, typography, color, and scale. Do not invent visible text when none was requested.
|
|
72
|
+
- Add concrete detail where the request is sparse, but never alter proper nouns or invent new subjects, objects, actions, labels, or story events.
|
|
73
|
+
- Avoid SD-style score tags and repeated quality tokens.`;
|
|
74
|
+
const Z_IMAGE_GUIDE = `Z-Image and Z-Image Turbo use instruction-aware natural-language captions and are strong at photorealism, bilingual text rendering, and precise prompt adherence.
|
|
75
|
+
- Use a compact, information-dense description: subject and appearance, action or pose, environment, composition, lighting, material detail, and requested style.
|
|
76
|
+
- Prefer concrete visual nouns and relationships over abstract quality claims or comma-separated SD tag piles.
|
|
77
|
+
- Quote exact visible text and preserve its language, capitalization, and punctuation.
|
|
78
|
+
- For Turbo, keep the prompt direct and avoid repeated emphasis or weighting syntax; its distilled low-guidance path should receive one clear visual direction.
|
|
79
|
+
- Do not invent subjects, props, labels, or narrative events that the user did not request.`;
|
|
80
|
+
const GPT_IMAGE_GUIDE = `GPT Image 2 follows direct natural-language creative direction for both simple scenes and complex layouts.
|
|
81
|
+
- State the intended artifact and composition clearly, then describe subjects, actions, spatial layout, style, palette, lighting, materials, and finishing details in priority order.
|
|
82
|
+
- For typography, diagrams, panels, packaging, signs, or UI, provide exact visible copy in double quotes and specify placement, hierarchy, alignment, and visual treatment.
|
|
83
|
+
- Preserve every requested constraint and proper noun exactly. Do not add labels, slogans, logos, panels, or decorative copy unless requested.
|
|
84
|
+
- Use explicit relationships and layout instructions instead of diffusion-model weighting syntax, score tags, or generic quality-token piles.`;
|
|
85
|
+
const QWEN_EDIT_GUIDE = `Qwen Image Edit 2511 follows direct natural-language edit instructions and can combine up to three ordered context images.
|
|
86
|
+
- Describe the requested transformation, not a fresh standalone scene caption. Name what changes and what remains fixed.
|
|
87
|
+
- When multiple references are part of the request, assign each one an explicit role using context_image_0, context_image_1, and context_image_2 in attachment order.
|
|
88
|
+
- Keep identity, composition, lighting, materials, and untouched regions stable when the user asks to preserve them.
|
|
89
|
+
- For added or replaced visible text, quote the exact wording and specify its placement and treatment.
|
|
90
|
+
- Prefer short, concrete instructions; use longer structured prose only for multi-element layouts or complex compositing.`;
|
|
91
|
+
const KREA2_EDIT_GUIDE = `Krea 2 Identity Edit performs best with a concise delta instruction grounded in one or two ordered context images.
|
|
92
|
+
- For one reference, state the requested change in 1-4 concrete sentences. Name only the details that change and the few details that must remain fixed; do not restate the full source image or dump a facial-feature inventory.
|
|
93
|
+
- For two references, assign roles explicitly: context_image_0 is the base scene/image and context_image_1 is the person, outfit, pose, detail, or style reference.
|
|
94
|
+
- End with a short preservation clause only when useful. Keep likeness, source composition, or untouched regions stable exactly when requested.
|
|
95
|
+
- Longer structured prompts are appropriate only for character sheets, grids, editorial layouts, or exact visible text.`;
|
|
96
|
+
const GPT_IMAGE_EDIT_GUIDE = `GPT Image 2 editing follows precise natural-language transformation instructions and ordered image references.
|
|
97
|
+
- Say exactly what to add, remove, replace, restyle, reposition, or preserve. Treat unmentioned source content as unchanged when that matches the request.
|
|
98
|
+
- Refer to ordered inputs as Image 1, Image 2, and so on, assigning each a clear role when multiple references are involved.
|
|
99
|
+
- For visible text edits, preserve exact wording in double quotes and specify placement, hierarchy, typography, and treatment.
|
|
100
|
+
- Use explicit layout and preservation requirements rather than diffusion weights, score tags, or a negative-prompt list.`;
|
|
101
|
+
const FLUX_EDIT_GUIDE = `FLUX editing models use direct natural-language transformation instructions with explicit reference roles.
|
|
102
|
+
- State the edit goal first, then name the source elements to preserve and the concrete visual changes to make.
|
|
103
|
+
- Refer to multiple images by their ordered role when supplied; do not merge identities, styles, or objects implicitly.
|
|
104
|
+
- Use positive desired-state language. FLUX.2 does not support negative prompts.
|
|
105
|
+
- Quote exact visible text and describe its placement when typography is requested.
|
|
106
|
+
- Keep simple edits concise; use detailed spatial and material direction only when the edit requires it.`;
|
|
58
107
|
const EDITING_GUIDE = `Image editing models accept reference images alongside text prompts. The prompt acts as an instruction for how to modify or build upon the input image(s).
|
|
59
108
|
- Write prompts as transformation instructions referencing the existing image.
|
|
60
109
|
- Describe changes as transformations: "is now wearing", "now has", "the background changes to".
|
|
@@ -70,6 +119,14 @@ const PROMPTING_GUIDES = {
|
|
|
70
119
|
fast: FAST_GUIDE,
|
|
71
120
|
sd3: SD3_GUIDE,
|
|
72
121
|
editing: EDITING_GUIDE,
|
|
122
|
+
krea2: KREA2_GUIDE,
|
|
123
|
+
qwen: QWEN_GUIDE,
|
|
124
|
+
"z-image": Z_IMAGE_GUIDE,
|
|
125
|
+
"gpt-image": GPT_IMAGE_GUIDE,
|
|
126
|
+
"qwen-edit": QWEN_EDIT_GUIDE,
|
|
127
|
+
"krea2-edit": KREA2_EDIT_GUIDE,
|
|
128
|
+
"gpt-image-edit": GPT_IMAGE_EDIT_GUIDE,
|
|
129
|
+
"flux-edit": FLUX_EDIT_GUIDE,
|
|
73
130
|
video: "",
|
|
74
131
|
};
|
|
75
132
|
function buildSystemPrompt(promptingType, modelTitle) {
|
|
@@ -164,4 +221,341 @@ function buildImagePromptMessages(inputOrPrompt, stylePrompt = "", promptingType
|
|
|
164
221
|
function parseToolCallPrompt(args) {
|
|
165
222
|
return String(args.prompt || "").trim();
|
|
166
223
|
}
|
|
224
|
+
const SDXL_MODEL_NAMES = new Set([
|
|
225
|
+
"sdxl",
|
|
226
|
+
"stable-diffusion-xl",
|
|
227
|
+
"stable-diffusion-xl-1-0",
|
|
228
|
+
"albedo-xl",
|
|
229
|
+
"animagine-xl",
|
|
230
|
+
"anima-pencil-xl",
|
|
231
|
+
"art-universe-xl",
|
|
232
|
+
"hyphoria-real",
|
|
233
|
+
"analog-madness-xl",
|
|
234
|
+
"cyberrealistic-xl",
|
|
235
|
+
"real-dream-xl",
|
|
236
|
+
"faetastic-xl",
|
|
237
|
+
"zavychroma-xl",
|
|
238
|
+
"dreamshaper-xl",
|
|
239
|
+
]);
|
|
240
|
+
const PONY_MODEL_NAMES = new Set([
|
|
241
|
+
"pony",
|
|
242
|
+
"pony-xl",
|
|
243
|
+
"pony-v7",
|
|
244
|
+
"pony-faetality",
|
|
245
|
+
"one-obsession-v22",
|
|
246
|
+
"cyberrealistic-pony-v7",
|
|
247
|
+
]);
|
|
248
|
+
const FLUX_MODEL_NAMES = new Set([
|
|
249
|
+
"flux",
|
|
250
|
+
"flux-1",
|
|
251
|
+
"flux-1-schnell",
|
|
252
|
+
"flux-schnell",
|
|
253
|
+
"flux1-krea",
|
|
254
|
+
"flux-1-krea",
|
|
255
|
+
"flux2",
|
|
256
|
+
"flux-2",
|
|
257
|
+
"flux-2-dev",
|
|
258
|
+
"chroma-v46-flash",
|
|
259
|
+
"chroma1-hd",
|
|
260
|
+
"chroma-detail",
|
|
261
|
+
]);
|
|
262
|
+
const KREA2_MODEL_NAMES = new Set([
|
|
263
|
+
"krea-2",
|
|
264
|
+
"krea2",
|
|
265
|
+
"krea-2-turbo",
|
|
266
|
+
"krea2-turbo",
|
|
267
|
+
"krea2-turbo-fp8-scaled",
|
|
268
|
+
"dark-beast-krea2",
|
|
269
|
+
"dark-beast-krea-2",
|
|
270
|
+
"dark-beast-krea2-fp8",
|
|
271
|
+
]);
|
|
272
|
+
const QWEN_GENERATE_MODEL_NAMES = new Set([
|
|
273
|
+
"qwen-image",
|
|
274
|
+
"qwen-image-2512",
|
|
275
|
+
"qwen-2512",
|
|
276
|
+
"qwen-2512-lightning",
|
|
277
|
+
"qwen-image-2512-lightning",
|
|
278
|
+
]);
|
|
279
|
+
const QWEN_EDIT_MODEL_NAMES = new Set([
|
|
280
|
+
"qwen",
|
|
281
|
+
"qwen-edit",
|
|
282
|
+
"qwen-lightning",
|
|
283
|
+
"qwen-image-edit",
|
|
284
|
+
"qwen-image-edit-2511",
|
|
285
|
+
"qwen-image-edit-2511-lightning",
|
|
286
|
+
]);
|
|
287
|
+
const KREA2_EDIT_MODEL_NAMES = new Set([
|
|
288
|
+
"krea-identity-edit",
|
|
289
|
+
"krea-2-identity-edit",
|
|
290
|
+
"krea2-identity-edit",
|
|
291
|
+
"krea2-identity-edit-v1-2",
|
|
292
|
+
"dark-beast-krea2-identity-edit",
|
|
293
|
+
"dark-beast-krea-2-identity-edit",
|
|
294
|
+
]);
|
|
295
|
+
const GPT_IMAGE_MODEL_NAMES = new Set([
|
|
296
|
+
"gpt-image-2",
|
|
297
|
+
"gpt-image2",
|
|
298
|
+
"gpt-2-image",
|
|
299
|
+
"openai-gpt-image-2",
|
|
300
|
+
"chatgpt-image-2",
|
|
301
|
+
]);
|
|
302
|
+
const FLUX_EDIT_MODEL_NAMES = new Set([
|
|
303
|
+
"flux2",
|
|
304
|
+
"flux-2",
|
|
305
|
+
"flux-2-dev",
|
|
306
|
+
]);
|
|
307
|
+
function normalizeImagePromptModelName(value) {
|
|
308
|
+
return value
|
|
309
|
+
.trim()
|
|
310
|
+
.toLowerCase()
|
|
311
|
+
.replace(/\b(?:model|renderer)\b/g, " ")
|
|
312
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
313
|
+
.replace(/^-+|-+$/g, "")
|
|
314
|
+
.replace(/-+/g, "-");
|
|
315
|
+
}
|
|
316
|
+
function normalizeImagePromptOperation(value) {
|
|
317
|
+
if (!value)
|
|
318
|
+
return null;
|
|
319
|
+
const normalized = value.trim().toLowerCase().replace(/[\s_]+/g, "-");
|
|
320
|
+
if (normalized === "generate"
|
|
321
|
+
|| normalized === "generation"
|
|
322
|
+
|| normalized === "t2i"
|
|
323
|
+
|| normalized === "txt2img"
|
|
324
|
+
|| normalized === "text-to-image") {
|
|
325
|
+
return "generate";
|
|
326
|
+
}
|
|
327
|
+
if (normalized === "edit"
|
|
328
|
+
|| normalized === "editing"
|
|
329
|
+
|| normalized === "image-edit"
|
|
330
|
+
|| normalized === "instruction-edit"
|
|
331
|
+
|| normalized === "i2i"
|
|
332
|
+
|| normalized === "img2img"
|
|
333
|
+
|| normalized === "image-to-image") {
|
|
334
|
+
return "edit";
|
|
335
|
+
}
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
function imageProfile(args) {
|
|
339
|
+
return {
|
|
340
|
+
id: args.id,
|
|
341
|
+
modelTitle: args.modelTitle,
|
|
342
|
+
promptingType: args.promptingType,
|
|
343
|
+
operation: args.operation,
|
|
344
|
+
outputFormat: args.outputFormat ?? "prompt",
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
function resolveImagePromptAuthoringProfile(targetModel, requestedOperation) {
|
|
348
|
+
const model = normalizeImagePromptModelName(targetModel);
|
|
349
|
+
const intrinsicEdit = QWEN_EDIT_MODEL_NAMES.has(model) || KREA2_EDIT_MODEL_NAMES.has(model);
|
|
350
|
+
const normalizedRequestedOperation = normalizeImagePromptOperation(requestedOperation);
|
|
351
|
+
if (requestedOperation && !normalizedRequestedOperation)
|
|
352
|
+
return null;
|
|
353
|
+
const operation = normalizedRequestedOperation ?? (intrinsicEdit ? "edit" : "generate");
|
|
354
|
+
if (intrinsicEdit && operation !== "edit")
|
|
355
|
+
return null;
|
|
356
|
+
if (GPT_IMAGE_MODEL_NAMES.has(model)) {
|
|
357
|
+
return imageProfile({
|
|
358
|
+
id: operation === "edit" ? "gpt-image-2-edit" : "gpt-image-2-generate",
|
|
359
|
+
modelTitle: "GPT Image 2",
|
|
360
|
+
promptingType: operation === "edit" ? "gpt-image-edit" : "gpt-image",
|
|
361
|
+
operation,
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
if (QWEN_EDIT_MODEL_NAMES.has(model)) {
|
|
365
|
+
return imageProfile({
|
|
366
|
+
id: "qwen-image-edit-2511",
|
|
367
|
+
modelTitle: "Qwen Image Edit 2511",
|
|
368
|
+
promptingType: "qwen-edit",
|
|
369
|
+
operation: "edit",
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
if (KREA2_EDIT_MODEL_NAMES.has(model)) {
|
|
373
|
+
return imageProfile({
|
|
374
|
+
id: "krea-2-identity-edit",
|
|
375
|
+
modelTitle: "Krea 2 Identity Edit",
|
|
376
|
+
promptingType: "krea2-edit",
|
|
377
|
+
operation: "edit",
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
if (FLUX_MODEL_NAMES.has(model)) {
|
|
381
|
+
if (operation === "edit" && !FLUX_EDIT_MODEL_NAMES.has(model))
|
|
382
|
+
return null;
|
|
383
|
+
return imageProfile({
|
|
384
|
+
id: operation === "edit" ? "flux-edit" : "flux-generate",
|
|
385
|
+
modelTitle: model.startsWith("chroma") ? "Chroma" : "FLUX",
|
|
386
|
+
promptingType: operation === "edit" ? "flux-edit" : "flux",
|
|
387
|
+
operation,
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
if (KREA2_MODEL_NAMES.has(model)) {
|
|
391
|
+
if (operation !== "generate")
|
|
392
|
+
return null;
|
|
393
|
+
return imageProfile({
|
|
394
|
+
id: "krea-2-generate",
|
|
395
|
+
modelTitle: model.startsWith("dark-beast") ? "Dark Beast Krea 2" : "Krea 2 Turbo",
|
|
396
|
+
promptingType: "krea2",
|
|
397
|
+
operation: "generate",
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
if (QWEN_GENERATE_MODEL_NAMES.has(model)) {
|
|
401
|
+
if (operation === "edit")
|
|
402
|
+
return null;
|
|
403
|
+
return imageProfile({
|
|
404
|
+
id: "qwen-image-2512",
|
|
405
|
+
modelTitle: "Qwen Image 2512",
|
|
406
|
+
promptingType: "qwen",
|
|
407
|
+
operation: "generate",
|
|
408
|
+
outputFormat: "positive_negative",
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
if (model === "z-image" || model === "zimage") {
|
|
412
|
+
if (operation !== "generate")
|
|
413
|
+
return null;
|
|
414
|
+
return imageProfile({
|
|
415
|
+
id: "z-image-generate",
|
|
416
|
+
modelTitle: "Z-Image",
|
|
417
|
+
promptingType: "z-image",
|
|
418
|
+
operation: "generate",
|
|
419
|
+
outputFormat: "positive_negative",
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
if (model === "z-turbo"
|
|
423
|
+
|| model === "z-image-turbo"
|
|
424
|
+
|| model === "zimage-turbo"
|
|
425
|
+
|| model === "dark-beast-z-turbo"
|
|
426
|
+
|| model === "dark-beast-z-image-turbo") {
|
|
427
|
+
if (operation !== "generate")
|
|
428
|
+
return null;
|
|
429
|
+
return imageProfile({
|
|
430
|
+
id: "z-image-turbo-generate",
|
|
431
|
+
modelTitle: model.startsWith("dark-beast") ? "Dark Beast Z-Image Turbo" : "Z-Image Turbo",
|
|
432
|
+
promptingType: "z-image",
|
|
433
|
+
operation: "generate",
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
if (PONY_MODEL_NAMES.has(model)) {
|
|
437
|
+
if (operation !== "generate")
|
|
438
|
+
return null;
|
|
439
|
+
return imageProfile({
|
|
440
|
+
id: "pony-generate",
|
|
441
|
+
modelTitle: "Pony Diffusion XL",
|
|
442
|
+
promptingType: "pony",
|
|
443
|
+
operation: "generate",
|
|
444
|
+
outputFormat: "positive_negative",
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
if (SDXL_MODEL_NAMES.has(model)) {
|
|
448
|
+
if (operation !== "generate")
|
|
449
|
+
return null;
|
|
450
|
+
return imageProfile({
|
|
451
|
+
id: "sdxl-generate",
|
|
452
|
+
modelTitle: "Stable Diffusion XL",
|
|
453
|
+
promptingType: "sdxl",
|
|
454
|
+
operation: "generate",
|
|
455
|
+
outputFormat: "positive_negative",
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
if (model === "sd-1-5"
|
|
459
|
+
|| model === "sd15"
|
|
460
|
+
|| model === "stable-diffusion-1-5"
|
|
461
|
+
|| model === "stable-diffusion-v1-5") {
|
|
462
|
+
if (operation !== "generate")
|
|
463
|
+
return null;
|
|
464
|
+
return imageProfile({
|
|
465
|
+
id: "sd15-generate",
|
|
466
|
+
modelTitle: "Stable Diffusion 1.5",
|
|
467
|
+
promptingType: "sd15",
|
|
468
|
+
operation: "generate",
|
|
469
|
+
outputFormat: "positive_negative",
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
if (model === "sdxl-turbo"
|
|
473
|
+
|| model === "sdxl-lightning"
|
|
474
|
+
|| model === "stable-diffusion-xl-turbo"
|
|
475
|
+
|| model === "lcm") {
|
|
476
|
+
if (operation !== "generate")
|
|
477
|
+
return null;
|
|
478
|
+
return imageProfile({
|
|
479
|
+
id: "fast-diffusion-generate",
|
|
480
|
+
modelTitle: "Fast distilled Stable Diffusion",
|
|
481
|
+
promptingType: "fast",
|
|
482
|
+
operation: "generate",
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
if (model === "sd3" || model === "stable-diffusion-3" || model === "stable-diffusion-3-5") {
|
|
486
|
+
if (operation !== "generate")
|
|
487
|
+
return null;
|
|
488
|
+
return imageProfile({
|
|
489
|
+
id: "sd3-generate",
|
|
490
|
+
modelTitle: "Stable Diffusion 3",
|
|
491
|
+
promptingType: "sd3",
|
|
492
|
+
operation: "generate",
|
|
493
|
+
outputFormat: "positive_negative",
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
return null;
|
|
497
|
+
}
|
|
498
|
+
function imageAuthoringOutputInstruction(profile) {
|
|
499
|
+
if (profile.outputFormat === "positive_negative") {
|
|
500
|
+
return `OUTPUT CONTRACT: Return exactly two single-line fields in this order:
|
|
501
|
+
positive_prompt: <the model-ready positive prompt>
|
|
502
|
+
negative_prompt: <a concise model-native negative prompt>
|
|
503
|
+
Use the negative field for explicit exclusions and relevant rendering failure modes only. Never contradict or weaken requested content. Do not add any other line, heading, explanation, Markdown fence, or preamble.`;
|
|
504
|
+
}
|
|
505
|
+
return "OUTPUT CONTRACT: Return only the directly runnable prompt text. Do not add field labels, a preamble, explanation, Markdown fence, tips, or a render offer.";
|
|
506
|
+
}
|
|
507
|
+
function buildImagePromptAuthoringMessages(input) {
|
|
508
|
+
const guide = PROMPTING_GUIDES[input.profile.promptingType];
|
|
509
|
+
const operationLabel = input.profile.operation === "edit"
|
|
510
|
+
? "image editing"
|
|
511
|
+
: "text-to-image generation";
|
|
512
|
+
const system = `You author directly runnable prompts for ${input.profile.modelTitle} ${operationLabel}.
|
|
513
|
+
|
|
514
|
+
MODEL-SPECIFIC PROMPTING GUIDE:
|
|
515
|
+
${guide}
|
|
516
|
+
|
|
517
|
+
AUTHORING RULES:
|
|
518
|
+
- Preserve every user-specified subject, action, setting, style, color, spatial relationship, exact quoted text, proper noun, and constraint.
|
|
519
|
+
- Treat the user's request as source material. Meta-language asking you to write a prompt is not visual content for the image.
|
|
520
|
+
- Add only concrete visual detail that supports the requested image or edit. Never invent extra subjects, props, labels, slogans, symbols, panels, or story events.
|
|
521
|
+
- Preserve emotional polarity, audience, genre, intensity, and content boundaries exactly.
|
|
522
|
+
- Commit to one observable composition or one precise edit. Do not hedge with alternatives.
|
|
523
|
+
- If the request is already production-ready, polish it lightly instead of replacing its direction.
|
|
524
|
+
- Never claim to have inspected a reference image that is not attached to this authoring request.
|
|
525
|
+
|
|
526
|
+
${imageAuthoringOutputInstruction(input.profile)}`;
|
|
527
|
+
return [
|
|
528
|
+
{ role: "system", content: system },
|
|
529
|
+
{
|
|
530
|
+
role: "user",
|
|
531
|
+
content: [
|
|
532
|
+
`Target model: ${input.profile.modelTitle}`,
|
|
533
|
+
`Operation: ${input.profile.operation}`,
|
|
534
|
+
"<request>",
|
|
535
|
+
input.prompt,
|
|
536
|
+
"</request>",
|
|
537
|
+
].join("\n"),
|
|
538
|
+
},
|
|
539
|
+
];
|
|
540
|
+
}
|
|
541
|
+
function assertImagePromptAuthoringOutput(profile, output) {
|
|
542
|
+
const trimmed = output.trim();
|
|
543
|
+
if (!trimmed)
|
|
544
|
+
throw new Error("image-prompt authoring returned an empty prompt");
|
|
545
|
+
if (/```|^\s*(?:here(?:'s| is)|prompt\s+for\b)/i.test(trimmed)) {
|
|
546
|
+
throw new Error("image-prompt authoring added a wrapper or preamble");
|
|
547
|
+
}
|
|
548
|
+
if (profile.outputFormat === "positive_negative") {
|
|
549
|
+
const lines = trimmed.split(/\r?\n/);
|
|
550
|
+
if (lines.length !== 2
|
|
551
|
+
|| !/^positive_prompt:\s*\S.+$/i.test(lines[0])
|
|
552
|
+
|| !/^negative_prompt:\s*\S.+$/i.test(lines[1])) {
|
|
553
|
+
throw new Error("image-prompt authoring must return exactly positive_prompt and negative_prompt single-line fields");
|
|
554
|
+
}
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if (/^(?:positive_prompt|negative_prompt):/im.test(trimmed)) {
|
|
558
|
+
throw new Error("this image model expects prompt text without positive/negative field wrappers");
|
|
559
|
+
}
|
|
560
|
+
}
|
|
167
561
|
//# sourceMappingURL=imagePrompt.js.map
|