@futdevpro/nts-dynamo 1.15.258 → 1.15.262
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/build/_modules/media-gen/_collections/media-gen-prompt.util.d.ts +24 -0
- package/build/_modules/media-gen/_collections/media-gen-prompt.util.d.ts.map +1 -0
- package/build/_modules/media-gen/_collections/media-gen-prompt.util.js +55 -0
- package/build/_modules/media-gen/_collections/media-gen-prompt.util.js.map +1 -0
- package/build/_modules/media-gen/_models/media-gen-operation.type.d.ts +9 -0
- package/build/_modules/media-gen/_models/media-gen-operation.type.d.ts.map +1 -0
- package/build/_modules/media-gen/_models/media-gen-operation.type.js +3 -0
- package/build/_modules/media-gen/_models/media-gen-operation.type.js.map +1 -0
- package/build/_modules/media-gen/_services/media-gen.registry.d.ts +35 -0
- package/build/_modules/media-gen/_services/media-gen.registry.d.ts.map +1 -0
- package/build/_modules/media-gen/_services/media-gen.registry.js +71 -0
- package/build/_modules/media-gen/_services/media-gen.registry.js.map +1 -0
- package/build/_modules/media-gen/_services/media-gen.service-base.d.ts +30 -0
- package/build/_modules/media-gen/_services/media-gen.service-base.d.ts.map +1 -0
- package/build/_modules/media-gen/_services/media-gen.service-base.js +43 -0
- package/build/_modules/media-gen/_services/media-gen.service-base.js.map +1 -0
- package/build/_modules/media-gen/index.d.ts +5 -0
- package/build/_modules/media-gen/index.d.ts.map +1 -0
- package/build/_modules/media-gen/index.js +17 -0
- package/build/_modules/media-gen/index.js.map +1 -0
- package/package.json +12 -3
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Placeholder handling for media-generation prompt templates.
|
|
3
|
+
*
|
|
4
|
+
* A template marks an input as `Đ{key}` - the marker the master-prompter flow runner already uses
|
|
5
|
+
* (`PromptKeys_Util`), so its templates work unchanged. A key may contain any character except `}`.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DyNTS_MediaGen_Prompt_Util {
|
|
8
|
+
/** `Đ{` + one or more non-`}` characters + `}`. Only used via `matchAll` / `replace`, which share no state. */
|
|
9
|
+
private static readonly placeholderPattern;
|
|
10
|
+
/**
|
|
11
|
+
* The distinct keys a template references, in first-appearance order.
|
|
12
|
+
*/
|
|
13
|
+
static getKeys(template: string): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Fills every placeholder of `template` from `values`, and returns the exact prompt.
|
|
16
|
+
*
|
|
17
|
+
* Refuses - naming EVERY offending key at once - when a referenced key has no own value (absent, `undefined`,
|
|
18
|
+
* `null` or an empty string) or holds an object or function. A prompt with a hole in it still costs a paid call
|
|
19
|
+
* and produces a wrong asset; and an object would silently render as `[object Object]`, which the
|
|
20
|
+
* master-prompter donor measured happening in a real prompt.
|
|
21
|
+
*/
|
|
22
|
+
static fill(template: string, values: Record<string, unknown>): string;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=media-gen-prompt.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-gen-prompt.util.d.ts","sourceRoot":"","sources":["../../../../src/_modules/media-gen/_collections/media-gen-prompt.util.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,0BAA0B;IAErC,+GAA+G;IAC/G,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAA2B;IAErE;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAY1C;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;CA8BvE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DyNTS_MediaGen_Prompt_Util = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Placeholder handling for media-generation prompt templates.
|
|
6
|
+
*
|
|
7
|
+
* A template marks an input as `Đ{key}` - the marker the master-prompter flow runner already uses
|
|
8
|
+
* (`PromptKeys_Util`), so its templates work unchanged. A key may contain any character except `}`.
|
|
9
|
+
*/
|
|
10
|
+
class DyNTS_MediaGen_Prompt_Util {
|
|
11
|
+
/** `Đ{` + one or more non-`}` characters + `}`. Only used via `matchAll` / `replace`, which share no state. */
|
|
12
|
+
static placeholderPattern = /Đ\{([^}]+)\}/g;
|
|
13
|
+
/**
|
|
14
|
+
* The distinct keys a template references, in first-appearance order.
|
|
15
|
+
*/
|
|
16
|
+
static getKeys(template) {
|
|
17
|
+
const keys = [];
|
|
18
|
+
for (const match of template.matchAll(DyNTS_MediaGen_Prompt_Util.placeholderPattern)) {
|
|
19
|
+
if (!keys.includes(match[1])) {
|
|
20
|
+
keys.push(match[1]);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return keys;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Fills every placeholder of `template` from `values`, and returns the exact prompt.
|
|
27
|
+
*
|
|
28
|
+
* Refuses - naming EVERY offending key at once - when a referenced key has no own value (absent, `undefined`,
|
|
29
|
+
* `null` or an empty string) or holds an object or function. A prompt with a hole in it still costs a paid call
|
|
30
|
+
* and produces a wrong asset; and an object would silently render as `[object Object]`, which the
|
|
31
|
+
* master-prompter donor measured happening in a real prompt.
|
|
32
|
+
*/
|
|
33
|
+
static fill(template, values) {
|
|
34
|
+
if (!template) {
|
|
35
|
+
throw new Error('DyNTS_MediaGen_Prompt_Util: the prompt template is empty.');
|
|
36
|
+
}
|
|
37
|
+
const keys = DyNTS_MediaGen_Prompt_Util.getKeys(template);
|
|
38
|
+
const missing = keys.filter((key) => {
|
|
39
|
+
const value = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : undefined;
|
|
40
|
+
return value === undefined || value === null || value === '';
|
|
41
|
+
});
|
|
42
|
+
const notText = keys.filter((key) => {
|
|
43
|
+
const value = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : undefined;
|
|
44
|
+
return value !== null && (typeof value === 'object' || typeof value === 'function');
|
|
45
|
+
});
|
|
46
|
+
if (missing.length || notText.length) {
|
|
47
|
+
throw new Error('DyNTS_MediaGen_Prompt_Util: the prompt template cannot be filled.'
|
|
48
|
+
+ (missing.length ? ` No value for: ${missing.join(', ')}.` : '')
|
|
49
|
+
+ (notText.length ? ` Not a text value (object or function): ${notText.join(', ')}.` : ''));
|
|
50
|
+
}
|
|
51
|
+
return template.replace(DyNTS_MediaGen_Prompt_Util.placeholderPattern, (placeholder, key) => String(values[key]));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.DyNTS_MediaGen_Prompt_Util = DyNTS_MediaGen_Prompt_Util;
|
|
55
|
+
//# sourceMappingURL=media-gen-prompt.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-gen-prompt.util.js","sourceRoot":"","sources":["../../../../src/_modules/media-gen/_collections/media-gen-prompt.util.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,MAAa,0BAA0B;IAErC,+GAA+G;IACvG,MAAM,CAAU,kBAAkB,GAAW,eAAe,CAAC;IAErE;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,QAAgB;QAC7B,MAAM,IAAI,GAAa,EAAE,CAAC;QAE1B,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,QAAQ,CAAC,0BAA0B,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACrF,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,CAAC,QAAgB,EAAE,MAA+B;QAC3D,IAAI,CAAC,QAAQ,EAAE,CAA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,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC,OAAO,CACrB,0BAA0B,CAAC,kBAAkB,EAC7C,CAAC,WAAmB,EAAE,GAAW,EAAU,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAClE,CAAC;IACJ,CAAC;;AAzDH,gEA0DC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a media-generation adapter can be asked to do - the registry's second key.
|
|
3
|
+
*
|
|
4
|
+
* A string union, not an enum, like `DyNTS_AI_EmbeddingProviderKey`: adapters and callers pass plain ids.
|
|
5
|
+
* The set covers the master-prompter provider table (`textToImage`, `imageTo3D`, `textTo3D`, `textToSpeech`)
|
|
6
|
+
* plus the two operations the `dc media-*` commands already serve (`image-edit`, `speech-to-text`).
|
|
7
|
+
*/
|
|
8
|
+
export type DyNTS_MediaGen_Operation = 'text-to-image' | 'image-edit' | 'text-to-speech' | 'speech-to-text' | 'image-to-3d' | 'text-to-3d';
|
|
9
|
+
//# sourceMappingURL=media-gen-operation.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-gen-operation.type.d.ts","sourceRoot":"","sources":["../../../../src/_modules/media-gen/_models/media-gen-operation.type.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,wBAAwB,GAChC,eAAe,GACf,YAAY,GACZ,gBAAgB,GAChB,gBAAgB,GAChB,aAAa,GACb,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-gen-operation.type.js","sourceRoot":"","sources":["../../../../src/_modules/media-gen/_models/media-gen-operation.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DyNTS_MediaGen_Operation } from '../_models/media-gen-operation.type';
|
|
2
|
+
import { DyNTS_MediaGen_ServiceBase } from './media-gen.service-base';
|
|
3
|
+
/** One registered pair, as `entries()` lists it. */
|
|
4
|
+
export interface DyNTS_MediaGen_RegistryEntry {
|
|
5
|
+
provider: string;
|
|
6
|
+
operation: DyNTS_MediaGen_Operation;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The two-key registry: provider × operation → adapter.
|
|
10
|
+
*
|
|
11
|
+
* Generalised from the master-prompter `generationProviders` table (`ProviderType × AiModelType`). An instance
|
|
12
|
+
* rather than a module-level constant: a product registers the adapters it ships, and a test builds its own
|
|
13
|
+
* registry without touching global state.
|
|
14
|
+
*/
|
|
15
|
+
export declare class DyNTS_MediaGen_Registry {
|
|
16
|
+
private readonly services;
|
|
17
|
+
/**
|
|
18
|
+
* Registers an adapter under every operation it declares.
|
|
19
|
+
*
|
|
20
|
+
* Refuses an adapter that declares no operation (it could never be resolved), and a second, different adapter
|
|
21
|
+
* for a pair that is already taken - a silent replacement would hide which adapter actually serves the call.
|
|
22
|
+
* Registering the same instance again is a no-op.
|
|
23
|
+
*/
|
|
24
|
+
register(service: DyNTS_MediaGen_ServiceBase<unknown, unknown>): void;
|
|
25
|
+
/**
|
|
26
|
+
* The adapter serving `operation` for `provider`. When there is none, the error says what IS available:
|
|
27
|
+
* the provider's operations if the provider is known, otherwise the providers serving the operation.
|
|
28
|
+
*/
|
|
29
|
+
resolve(provider: string, operation: DyNTS_MediaGen_Operation): DyNTS_MediaGen_ServiceBase<unknown, unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* Every registered provider × operation pair, in registration order.
|
|
32
|
+
*/
|
|
33
|
+
entries(): DyNTS_MediaGen_RegistryEntry[];
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=media-gen.registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-gen.registry.d.ts","sourceRoot":"","sources":["../../../../src/_modules/media-gen/_services/media-gen.registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAEtE,oDAAoD;AACpD,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,wBAAwB,CAAC;CACrC;AAED;;;;;;GAMG;AACH,qBAAa,uBAAuB;IAElC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CACb;IAEZ;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,0BAA0B,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,IAAI;IA2BrE;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,wBAAwB,GAAG,0BAA0B,CAAC,OAAO,EAAE,OAAO,CAAC;IA2B5G;;OAEG;IACH,OAAO,IAAI,4BAA4B,EAAE;CAW1C"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DyNTS_MediaGen_Registry = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The two-key registry: provider × operation → adapter.
|
|
6
|
+
*
|
|
7
|
+
* Generalised from the master-prompter `generationProviders` table (`ProviderType × AiModelType`). An instance
|
|
8
|
+
* rather than a module-level constant: a product registers the adapters it ships, and a test builds its own
|
|
9
|
+
* registry without touching global state.
|
|
10
|
+
*/
|
|
11
|
+
class DyNTS_MediaGen_Registry {
|
|
12
|
+
services = new Map();
|
|
13
|
+
/**
|
|
14
|
+
* Registers an adapter under every operation it declares.
|
|
15
|
+
*
|
|
16
|
+
* Refuses an adapter that declares no operation (it could never be resolved), and a second, different adapter
|
|
17
|
+
* for a pair that is already taken - a silent replacement would hide which adapter actually serves the call.
|
|
18
|
+
* Registering the same instance again is a no-op.
|
|
19
|
+
*/
|
|
20
|
+
register(service) {
|
|
21
|
+
if (!service.operations.length) {
|
|
22
|
+
throw new Error(`DyNTS_MediaGen_Registry: ${service.constructor.name} (provider '${service.provider}') declares no operations.`);
|
|
23
|
+
}
|
|
24
|
+
const byOperation = this.services.get(service.provider) ?? new Map();
|
|
25
|
+
for (const operation of service.operations) {
|
|
26
|
+
const existing = byOperation.get(operation);
|
|
27
|
+
if (existing && existing !== service) {
|
|
28
|
+
throw new Error(`DyNTS_MediaGen_Registry: '${operation}' of provider '${service.provider}' is already served by `
|
|
29
|
+
+ `${existing.constructor.name}; registering ${service.constructor.name} would silently replace it.`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
for (const operation of service.operations) {
|
|
33
|
+
byOperation.set(operation, service);
|
|
34
|
+
}
|
|
35
|
+
this.services.set(service.provider, byOperation);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The adapter serving `operation` for `provider`. When there is none, the error says what IS available:
|
|
39
|
+
* the provider's operations if the provider is known, otherwise the providers serving the operation.
|
|
40
|
+
*/
|
|
41
|
+
resolve(provider, operation) {
|
|
42
|
+
const service = this.services.get(provider)?.get(operation);
|
|
43
|
+
if (service) {
|
|
44
|
+
return service;
|
|
45
|
+
}
|
|
46
|
+
const providerOperations = [...(this.services.get(provider)?.keys() ?? [])];
|
|
47
|
+
if (providerOperations.length) {
|
|
48
|
+
throw new Error(`DyNTS_MediaGen_Registry: provider '${provider}' does not serve '${operation}'. `
|
|
49
|
+
+ `It serves: ${providerOperations.join(', ')}.`);
|
|
50
|
+
}
|
|
51
|
+
const operationProviders = this.entries()
|
|
52
|
+
.filter((entry) => entry.operation === operation)
|
|
53
|
+
.map((entry) => entry.provider);
|
|
54
|
+
throw new Error(`DyNTS_MediaGen_Registry: no provider '${provider}' is registered. `
|
|
55
|
+
+ `'${operation}' is served by: ${operationProviders.length ? operationProviders.join(', ') : 'no provider'}.`);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Every registered provider × operation pair, in registration order.
|
|
59
|
+
*/
|
|
60
|
+
entries() {
|
|
61
|
+
const entries = [];
|
|
62
|
+
for (const [provider, byOperation] of this.services) {
|
|
63
|
+
for (const operation of byOperation.keys()) {
|
|
64
|
+
entries.push({ provider: provider, operation: operation });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return entries;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.DyNTS_MediaGen_Registry = DyNTS_MediaGen_Registry;
|
|
71
|
+
//# sourceMappingURL=media-gen.registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-gen.registry.js","sourceRoot":"","sources":["../../../../src/_modules/media-gen/_services/media-gen.registry.ts"],"names":[],"mappings":";;;AASA;;;;;;GAMG;AACH,MAAa,uBAAuB;IAEjB,QAAQ,GACvB,IAAI,GAAG,EAAE,CAAC;IAEZ;;;;;;OAMG;IACH,QAAQ,CAAC,OAAqD;QAC5D,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CACb,4BAA4B,OAAO,CAAC,WAAW,CAAC,IAAI,eAAe,OAAO,CAAC,QAAQ,4BAA4B,CAChH,CAAC;QACJ,CAAC;QAED,MAAM,WAAW,GACf,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;QAEnD,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YAC3C,MAAM,QAAQ,GAA6D,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAEtG,IAAI,QAAQ,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;gBACrC,MAAM,IAAI,KAAK,CACb,6BAA6B,SAAS,kBAAkB,OAAO,CAAC,QAAQ,yBAAyB;sBAC/F,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,iBAAiB,OAAO,CAAC,WAAW,CAAC,IAAI,6BAA6B,CACrG,CAAC;YACJ,CAAC;QACH,CAAC;QAED,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC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KAAK,MAAM,CAAE,QAAQ,EAAE,WAAW,CAAE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACtD,KAAK,MAAM,SAAS,IAAI,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC;gBAC3C,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AApFD,0DAoFC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DyNTS_SingletonService } from '../../../_services/base/singleton.service';
|
|
2
|
+
import { DyNTS_MediaGen_Operation } from '../_models/media-gen-operation.type';
|
|
3
|
+
/**
|
|
4
|
+
* Base of one media-generation provider adapter (OpenAI Images, ElevenLabs, Leonardo, Meshy, Synexa, ...).
|
|
5
|
+
*
|
|
6
|
+
* Generalised from the master-prompter `Generation_ServiceBase`. Two things are left out on purpose:
|
|
7
|
+
* - the flow-run coupling (step connectors, flow nodes) - a request object replaces it;
|
|
8
|
+
* - the token-cost methods - cost accounting stays in the product that sells the credits (K-9).
|
|
9
|
+
*
|
|
10
|
+
* What remains is what every adapter needs: who it is, which operations it serves, the call itself, and
|
|
11
|
+
* prompt assembly from a `Đ{key}` template. Capability is data: `operations` is what the registry indexes,
|
|
12
|
+
* so an adapter that cannot edit simply does not list `image-edit`, and a caller asking for it is told what
|
|
13
|
+
* the adapter CAN do.
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class DyNTS_MediaGen_ServiceBase<T_Request, T_Response> extends DyNTS_SingletonService {
|
|
16
|
+
/** Stable provider id (e.g. `openai`, `elevenlabs`) - the registry's first key. */
|
|
17
|
+
abstract readonly provider: string;
|
|
18
|
+
/** The operations this adapter serves - the registry's second key. Must match what `generate` handles. */
|
|
19
|
+
abstract readonly operations: readonly DyNTS_MediaGen_Operation[];
|
|
20
|
+
/**
|
|
21
|
+
* Performs one generation.
|
|
22
|
+
*/
|
|
23
|
+
abstract generate(operation: DyNTS_MediaGen_Operation, request: T_Request, issuer: string): Promise<T_Response>;
|
|
24
|
+
/**
|
|
25
|
+
* Assembles the exact prompt from a `Đ{key}` template (see `DyNTS_MediaGen_Prompt_Util.fill`), and reports
|
|
26
|
+
* a failure with this adapter's error settings.
|
|
27
|
+
*/
|
|
28
|
+
protected assemblePrompt(template: string, values: Record<string, unknown>, issuer: string): string;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=media-gen.service-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-gen.service-base.d.ts","sourceRoot":"","sources":["../../../../src/_modules/media-gen/_services/media-gen.service-base.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAEnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE/E;;;;;;;;;;;GAWG;AACH,8BAAsB,0BAA0B,CAAC,SAAS,EAAE,UAAU,CAAE,SAAQ,sBAAsB;IAEpG,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAEnC,0GAA0G;IAC1G,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAElE;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,wBAAwB,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAE/G;;;OAGG;IACH,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAepG"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DyNTS_MediaGen_ServiceBase = void 0;
|
|
4
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
5
|
+
const global_settings_const_1 = require("../../../_collections/global-settings.const");
|
|
6
|
+
const singleton_service_1 = require("../../../_services/base/singleton.service");
|
|
7
|
+
const media_gen_prompt_util_1 = require("../_collections/media-gen-prompt.util");
|
|
8
|
+
/**
|
|
9
|
+
* Base of one media-generation provider adapter (OpenAI Images, ElevenLabs, Leonardo, Meshy, Synexa, ...).
|
|
10
|
+
*
|
|
11
|
+
* Generalised from the master-prompter `Generation_ServiceBase`. Two things are left out on purpose:
|
|
12
|
+
* - the flow-run coupling (step connectors, flow nodes) - a request object replaces it;
|
|
13
|
+
* - the token-cost methods - cost accounting stays in the product that sells the credits (K-9).
|
|
14
|
+
*
|
|
15
|
+
* What remains is what every adapter needs: who it is, which operations it serves, the call itself, and
|
|
16
|
+
* prompt assembly from a `Đ{key}` template. Capability is data: `operations` is what the registry indexes,
|
|
17
|
+
* so an adapter that cannot edit simply does not list `image-edit`, and a caller asking for it is told what
|
|
18
|
+
* the adapter CAN do.
|
|
19
|
+
*/
|
|
20
|
+
class DyNTS_MediaGen_ServiceBase extends singleton_service_1.DyNTS_SingletonService {
|
|
21
|
+
/**
|
|
22
|
+
* Assembles the exact prompt from a `Đ{key}` template (see `DyNTS_MediaGen_Prompt_Util.fill`), and reports
|
|
23
|
+
* a failure with this adapter's error settings.
|
|
24
|
+
*/
|
|
25
|
+
assemblePrompt(template, values, issuer) {
|
|
26
|
+
try {
|
|
27
|
+
return media_gen_prompt_util_1.DyNTS_MediaGen_Prompt_Util.fill(template, values);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
31
|
+
...this.getDefaultErrorSettings('assemblePrompt', error, issuer),
|
|
32
|
+
errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-MG-AP0`,
|
|
33
|
+
additionalContent: {
|
|
34
|
+
provider: this.provider,
|
|
35
|
+
keys: media_gen_prompt_util_1.DyNTS_MediaGen_Prompt_Util.getKeys(template ?? ''),
|
|
36
|
+
providedKeys: Object.keys(values ?? {}),
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.DyNTS_MediaGen_ServiceBase = DyNTS_MediaGen_ServiceBase;
|
|
43
|
+
//# sourceMappingURL=media-gen.service-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-gen.service-base.js","sourceRoot":"","sources":["../../../../src/_modules/media-gen/_services/media-gen.service-base.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AAEnD,uFAAoF;AACpF,iFAAmF;AACnF,iFAAmF;AAGnF;;;;;;;;;;;GAWG;AACH,MAAsB,0BAAkD,SAAQ,0CAAsB;IAapG;;;OAGG;IACO,cAAc,CAAC,QAAgB,EAAE,MAA+B,EAAE,MAAc;QACxF,IAAI,CAAC;YACH,OAAO,kDAA0B,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,uBAAU,CAAC;gBACnB,GAAG,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,EAAE,KAAK,EAAE,MAAM,CAAC;gBAChE,SAAS,EAAE,GAAG,6CAAqB,CAAC,mBAAmB,eAAe;gBACtE,iBAAiB,EAAE;oBACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,IAAI,EAAE,kDAA0B,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;oBACxD,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;iBACxC;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAhCD,gEAgCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_modules/media-gen/index.ts"],"names":[],"mappings":"AAUA,cAAc,oCAAoC,CAAC;AAGnD,cAAc,sCAAsC,CAAC;AAGrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Media generation module (media-generation hyperplan, MP-5)
|
|
4
|
+
//
|
|
5
|
+
// The provider-independent generation engine: an adapter base class and the provider × operation registry.
|
|
6
|
+
// Cost accounting is deliberately NOT here - it stays in the product that sells the credits.
|
|
7
|
+
//
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
10
|
+
// MODELS
|
|
11
|
+
tslib_1.__exportStar(require("./_models/media-gen-operation.type"), exports);
|
|
12
|
+
// COLLECTIONS
|
|
13
|
+
tslib_1.__exportStar(require("./_collections/media-gen-prompt.util"), exports);
|
|
14
|
+
// SERVICES
|
|
15
|
+
tslib_1.__exportStar(require("./_services/media-gen.service-base"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./_services/media-gen.registry"), exports);
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/_modules/media-gen/index.ts"],"names":[],"mappings":";AACA,EAAE;AACF,6DAA6D;AAC7D,EAAE;AACF,2GAA2G;AAC3G,6FAA6F;AAC7F,EAAE;;;AAGF,SAAS;AACT,6EAAmD;AAEnD,cAAc;AACd,+EAAqD;AAErD,WAAW;AACX,6EAAmD;AACnD,yEAA+C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/nts-dynamo",
|
|
3
|
-
"version": "01.15.
|
|
3
|
+
"version": "01.15.262",
|
|
4
4
|
"description": "Dynamic NodeTS (NodeJS-Typescript), MongoDB Backend System Framework by Future Development Program Ltd.",
|
|
5
5
|
"DyBu_settings": {
|
|
6
6
|
"packageType": "server-package",
|
|
@@ -294,6 +294,12 @@
|
|
|
294
294
|
"module": "./build/_modules/test-email-sink/index.js",
|
|
295
295
|
"types": "./build/_modules/test-email-sink/index.d.ts",
|
|
296
296
|
"typings": "./build/_modules/test-email-sink/index.d.ts"
|
|
297
|
+
},
|
|
298
|
+
"./media-gen": {
|
|
299
|
+
"default": "./build/_modules/media-gen/index.js",
|
|
300
|
+
"module": "./build/_modules/media-gen/index.js",
|
|
301
|
+
"types": "./build/_modules/media-gen/index.d.ts",
|
|
302
|
+
"typings": "./build/_modules/media-gen/index.d.ts"
|
|
297
303
|
}
|
|
298
304
|
},
|
|
299
305
|
"typesVersions": {
|
|
@@ -399,6 +405,9 @@
|
|
|
399
405
|
],
|
|
400
406
|
"test-email-sink": [
|
|
401
407
|
"build/_modules/test-email-sink/index.d.ts"
|
|
408
|
+
],
|
|
409
|
+
"media-gen": [
|
|
410
|
+
"build/_modules/media-gen/index.d.ts"
|
|
402
411
|
]
|
|
403
412
|
}
|
|
404
413
|
},
|
|
@@ -415,7 +424,7 @@
|
|
|
415
424
|
"@anthropic-ai/sdk": "~0.39.0",
|
|
416
425
|
"@modelcontextprotocol/sdk": "~1.29.0",
|
|
417
426
|
"better-sqlite3": "~12.4.1",
|
|
418
|
-
"@futdevpro/fsm-dynamo": "1.20.
|
|
427
|
+
"@futdevpro/fsm-dynamo": "1.20.42",
|
|
419
428
|
"@types/express": "4.17.21",
|
|
420
429
|
"@types/geoip-lite": "~1.4.4",
|
|
421
430
|
"@types/node": "~24.1.0",
|
|
@@ -454,7 +463,7 @@
|
|
|
454
463
|
}
|
|
455
464
|
},
|
|
456
465
|
"devDependencies": {
|
|
457
|
-
"@futdevpro/fsm-dynamo": "1.20.
|
|
466
|
+
"@futdevpro/fsm-dynamo": "1.20.42",
|
|
458
467
|
"@futdevpro/dynamo-eslint": "1.20.18",
|
|
459
468
|
"@discordjs/opus": "^0.10.0",
|
|
460
469
|
"@discordjs/voice": "^0.18.0",
|