@almadar/integrations 2.35.0 → 2.36.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/runtime/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as IntegrationParams, I as IntegrationCallContext, d as IntegrationFactory } from '../BaseIntegration-BYlbMFlf.js';
|
|
2
|
-
import { o as IntegrationName, m as IntegrationActionName, n as IntegrationContracts, e as CredentialStore } from '../store-
|
|
2
|
+
import { o as IntegrationName, m as IntegrationActionName, n as IntegrationContracts, e as CredentialStore } from '../store-OiFX0Tkn.js';
|
|
3
3
|
import '@almadar/core';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/runtime/index.js
CHANGED
|
@@ -5349,6 +5349,18 @@ registerIntegration("arxiv", ArxivIntegration);
|
|
|
5349
5349
|
var DEFAULT_BASE_URL = "http://127.0.0.1:8181";
|
|
5350
5350
|
var DEFAULT_TIMEOUT_MS5 = 3e4;
|
|
5351
5351
|
var DEFAULT_GENERATE_TIMEOUT_MS = 6e5;
|
|
5352
|
+
var GENERATE_MODELS = ["z-image-turbo", "kontext"];
|
|
5353
|
+
function generateParamErrors(params) {
|
|
5354
|
+
const errors = [];
|
|
5355
|
+
const model = params.model;
|
|
5356
|
+
if (typeof model !== "string" || !GENERATE_MODELS.includes(model)) {
|
|
5357
|
+
errors.push(`model must be one of ${GENERATE_MODELS.join(", ")}`);
|
|
5358
|
+
}
|
|
5359
|
+
if (model === "kontext" && (typeof params.sourcePath !== "string" || params.sourcePath === "")) {
|
|
5360
|
+
errors.push("sourcePath is required when model is kontext");
|
|
5361
|
+
}
|
|
5362
|
+
return errors;
|
|
5363
|
+
}
|
|
5352
5364
|
async function riggerError(path, response) {
|
|
5353
5365
|
let detail = "";
|
|
5354
5366
|
try {
|
|
@@ -5382,6 +5394,21 @@ var RiggerIntegration = class extends BaseIntegration {
|
|
|
5382
5394
|
metadata: this.createMetadata(action, 0)
|
|
5383
5395
|
};
|
|
5384
5396
|
}
|
|
5397
|
+
if (action === "generate") {
|
|
5398
|
+
const invalid = generateParamErrors(params);
|
|
5399
|
+
if (invalid.length > 0) {
|
|
5400
|
+
return {
|
|
5401
|
+
success: false,
|
|
5402
|
+
error: {
|
|
5403
|
+
name: "IntegrationError",
|
|
5404
|
+
message: "Validation failed",
|
|
5405
|
+
code: "VALIDATION_ERROR",
|
|
5406
|
+
details: invalid
|
|
5407
|
+
},
|
|
5408
|
+
metadata: this.createMetadata(action, 0)
|
|
5409
|
+
};
|
|
5410
|
+
}
|
|
5411
|
+
}
|
|
5385
5412
|
const startTime = Date.now();
|
|
5386
5413
|
try {
|
|
5387
5414
|
let data;
|
|
@@ -5407,6 +5434,12 @@ var RiggerIntegration = class extends BaseIntegration {
|
|
|
5407
5434
|
case "ownership":
|
|
5408
5435
|
data = await this.executeWithRetry(() => this.ownership(params));
|
|
5409
5436
|
break;
|
|
5437
|
+
case "buildLayers":
|
|
5438
|
+
data = await this.executeWithRetry(() => this.buildLayers(params));
|
|
5439
|
+
break;
|
|
5440
|
+
case "pose":
|
|
5441
|
+
data = await this.executeWithRetry(() => this.pose(params));
|
|
5442
|
+
break;
|
|
5410
5443
|
case "generate":
|
|
5411
5444
|
data = await this.executeWithRetry(() => this.generate(params));
|
|
5412
5445
|
break;
|
|
@@ -5502,6 +5535,32 @@ var RiggerIntegration = class extends BaseIntegration {
|
|
|
5502
5535
|
}
|
|
5503
5536
|
return await response.json();
|
|
5504
5537
|
}
|
|
5538
|
+
async buildLayers(params) {
|
|
5539
|
+
const { imagePath, rig, outDir } = params;
|
|
5540
|
+
const response = await fetch(`${this.baseUrl}/layers`, {
|
|
5541
|
+
method: "POST",
|
|
5542
|
+
headers: { "Content-Type": "application/json" },
|
|
5543
|
+
body: JSON.stringify({ imagePath, rig, outDir }),
|
|
5544
|
+
signal: AbortSignal.timeout(this.timeoutMs)
|
|
5545
|
+
});
|
|
5546
|
+
if (!response.ok) {
|
|
5547
|
+
throw await riggerError("/layers", response);
|
|
5548
|
+
}
|
|
5549
|
+
return await response.json();
|
|
5550
|
+
}
|
|
5551
|
+
async pose(params) {
|
|
5552
|
+
const { imagePath, rig, roles, preset, overrides } = params;
|
|
5553
|
+
const response = await fetch(`${this.baseUrl}/pose`, {
|
|
5554
|
+
method: "POST",
|
|
5555
|
+
headers: { "Content-Type": "application/json" },
|
|
5556
|
+
body: JSON.stringify({ imagePath, rig, roles, preset, overrides }),
|
|
5557
|
+
signal: AbortSignal.timeout(this.timeoutMs)
|
|
5558
|
+
});
|
|
5559
|
+
if (!response.ok) {
|
|
5560
|
+
throw await riggerError("/pose", response);
|
|
5561
|
+
}
|
|
5562
|
+
return await response.json();
|
|
5563
|
+
}
|
|
5505
5564
|
async generate(params) {
|
|
5506
5565
|
const { model, prompt, seed, size, steps, sourcePath, outDir } = params;
|
|
5507
5566
|
const response = await fetch(`${this.baseUrl}/generate`, {
|
|
@@ -5577,28 +5636,41 @@ function createCallServiceHandler(factory) {
|
|
|
5577
5636
|
}
|
|
5578
5637
|
|
|
5579
5638
|
// src/runtime/RuntimeIntegrationManager.ts
|
|
5580
|
-
function
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
switch (
|
|
5639
|
+
function mockValueForDescriptor(key, descriptor) {
|
|
5640
|
+
if (typeof descriptor === "string") {
|
|
5641
|
+
if (descriptor.endsWith("[]")) return [];
|
|
5642
|
+
switch (descriptor) {
|
|
5584
5643
|
case "string":
|
|
5585
|
-
|
|
5586
|
-
break;
|
|
5644
|
+
return `mock_${key}`;
|
|
5587
5645
|
case "number":
|
|
5588
|
-
|
|
5589
|
-
break;
|
|
5646
|
+
return 42;
|
|
5590
5647
|
case "boolean":
|
|
5591
|
-
|
|
5592
|
-
break;
|
|
5648
|
+
return true;
|
|
5593
5649
|
case "object":
|
|
5594
|
-
|
|
5595
|
-
break;
|
|
5596
|
-
case "string[]":
|
|
5597
|
-
data[key] = [];
|
|
5598
|
-
break;
|
|
5650
|
+
return {};
|
|
5599
5651
|
default:
|
|
5600
|
-
|
|
5652
|
+
return `mock_${key}`;
|
|
5653
|
+
}
|
|
5654
|
+
}
|
|
5655
|
+
if (descriptor.type === "array") {
|
|
5656
|
+
return descriptor.items ? [mockValueForDescriptor(`${key}Item`, descriptor.items)] : [];
|
|
5657
|
+
}
|
|
5658
|
+
if (descriptor.properties) {
|
|
5659
|
+
const obj = {};
|
|
5660
|
+
for (const [propKey, propDescriptor] of Object.entries(descriptor.properties)) {
|
|
5661
|
+
obj[propKey] = mockValueForDescriptor(propKey, propDescriptor);
|
|
5601
5662
|
}
|
|
5663
|
+
return obj;
|
|
5664
|
+
}
|
|
5665
|
+
if (descriptor.mapValue) {
|
|
5666
|
+
return { sample: mockValueForDescriptor("sample", descriptor.mapValue) };
|
|
5667
|
+
}
|
|
5668
|
+
return {};
|
|
5669
|
+
}
|
|
5670
|
+
function generateMockFromShape(shape) {
|
|
5671
|
+
const data = {};
|
|
5672
|
+
for (const [key, descriptor] of Object.entries(shape)) {
|
|
5673
|
+
data[key] = mockValueForDescriptor(key, descriptor);
|
|
5602
5674
|
}
|
|
5603
5675
|
return data;
|
|
5604
5676
|
}
|