@almadar/integrations 2.33.0 → 2.35.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/index.d.ts +19 -3
- package/dist/index.js +179 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +184 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/{store-C5nb44iS.d.ts → store-BGNfuoFd.d.ts} +136 -0
- package/package.json +3 -3
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-BGNfuoFd.js';
|
|
3
3
|
import '@almadar/core';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/runtime/index.js
CHANGED
|
@@ -159,6 +159,11 @@ var serviceCredentials = {
|
|
|
159
159
|
],
|
|
160
160
|
arxiv: [
|
|
161
161
|
{ envVar: "ARXIV_TIMEOUT_MS", required: false, description: "Per-request timeout (ms)" }
|
|
162
|
+
],
|
|
163
|
+
rigger: [
|
|
164
|
+
{ envVar: "RIGGER_BASE_URL", required: false, description: "Local rigger service base URL (default http://127.0.0.1:8181)" },
|
|
165
|
+
{ envVar: "RIGGER_TIMEOUT_MS", required: false, description: "Per-request timeout (ms)" },
|
|
166
|
+
{ envVar: "RIGGER_GENERATE_TIMEOUT_MS", required: false, description: "Timeout (ms) for the 'generate' action; a local z-image-turbo run takes ~60-90 s and a kontext edit at 1024px several minutes (default 600000)" }
|
|
162
167
|
]
|
|
163
168
|
};
|
|
164
169
|
function allCredentialEnvVars() {
|
|
@@ -5340,6 +5345,179 @@ var ArxivIntegration = class extends BaseIntegration {
|
|
|
5340
5345
|
};
|
|
5341
5346
|
registerIntegration("arxiv", ArxivIntegration);
|
|
5342
5347
|
|
|
5348
|
+
// src/integrations/rigger/index.ts
|
|
5349
|
+
var DEFAULT_BASE_URL = "http://127.0.0.1:8181";
|
|
5350
|
+
var DEFAULT_TIMEOUT_MS5 = 3e4;
|
|
5351
|
+
var DEFAULT_GENERATE_TIMEOUT_MS = 6e5;
|
|
5352
|
+
async function riggerError(path, response) {
|
|
5353
|
+
let detail = "";
|
|
5354
|
+
try {
|
|
5355
|
+
const body = await response.json();
|
|
5356
|
+
if (typeof body.detail === "string") detail = body.detail;
|
|
5357
|
+
else if (body.detail !== void 0) detail = JSON.stringify(body.detail);
|
|
5358
|
+
} catch {
|
|
5359
|
+
detail = "";
|
|
5360
|
+
}
|
|
5361
|
+
return new Error(`Rigger ${path} returned ${response.status}${detail ? `: ${detail}` : ""}`);
|
|
5362
|
+
}
|
|
5363
|
+
var RiggerIntegration = class extends BaseIntegration {
|
|
5364
|
+
constructor(config) {
|
|
5365
|
+
super(config);
|
|
5366
|
+
this.baseUrl = config.env.RIGGER_BASE_URL || DEFAULT_BASE_URL;
|
|
5367
|
+
this.timeoutMs = Number(config.env.RIGGER_TIMEOUT_MS) || DEFAULT_TIMEOUT_MS5;
|
|
5368
|
+
this.generateTimeoutMs = Number(config.env.RIGGER_GENERATE_TIMEOUT_MS) || DEFAULT_GENERATE_TIMEOUT_MS;
|
|
5369
|
+
this.logger.info("Rigger integration initialized", { baseUrl: this.baseUrl });
|
|
5370
|
+
}
|
|
5371
|
+
async execute(action, params) {
|
|
5372
|
+
const validation = this.validateParams(action, params);
|
|
5373
|
+
if (!validation.valid) {
|
|
5374
|
+
return {
|
|
5375
|
+
success: false,
|
|
5376
|
+
error: {
|
|
5377
|
+
name: "IntegrationError",
|
|
5378
|
+
message: "Validation failed",
|
|
5379
|
+
code: "VALIDATION_ERROR",
|
|
5380
|
+
details: validation.errors
|
|
5381
|
+
},
|
|
5382
|
+
metadata: this.createMetadata(action, 0)
|
|
5383
|
+
};
|
|
5384
|
+
}
|
|
5385
|
+
const startTime = Date.now();
|
|
5386
|
+
try {
|
|
5387
|
+
let data;
|
|
5388
|
+
switch (action) {
|
|
5389
|
+
case "health":
|
|
5390
|
+
data = await this.health();
|
|
5391
|
+
break;
|
|
5392
|
+
case "buildMesh":
|
|
5393
|
+
data = await this.executeWithRetry(() => this.buildMesh(params));
|
|
5394
|
+
break;
|
|
5395
|
+
case "render":
|
|
5396
|
+
data = await this.executeWithRetry(() => this.render(params));
|
|
5397
|
+
break;
|
|
5398
|
+
case "listPresets":
|
|
5399
|
+
data = await this.executeWithRetry(() => this.listPresets());
|
|
5400
|
+
break;
|
|
5401
|
+
case "loadRig":
|
|
5402
|
+
data = await this.executeWithRetry(() => this.loadRig(params));
|
|
5403
|
+
break;
|
|
5404
|
+
case "saveRig":
|
|
5405
|
+
data = await this.executeWithRetry(() => this.saveRig(params));
|
|
5406
|
+
break;
|
|
5407
|
+
case "ownership":
|
|
5408
|
+
data = await this.executeWithRetry(() => this.ownership(params));
|
|
5409
|
+
break;
|
|
5410
|
+
case "generate":
|
|
5411
|
+
data = await this.executeWithRetry(() => this.generate(params));
|
|
5412
|
+
break;
|
|
5413
|
+
default:
|
|
5414
|
+
throw new UnknownActionError(this.config.name, action);
|
|
5415
|
+
}
|
|
5416
|
+
return {
|
|
5417
|
+
success: true,
|
|
5418
|
+
data,
|
|
5419
|
+
metadata: this.createMetadata(action, Date.now() - startTime)
|
|
5420
|
+
};
|
|
5421
|
+
} catch (error) {
|
|
5422
|
+
return this.handleError(action, error);
|
|
5423
|
+
}
|
|
5424
|
+
}
|
|
5425
|
+
async health() {
|
|
5426
|
+
const response = await fetch(`${this.baseUrl}/health`, {
|
|
5427
|
+
signal: AbortSignal.timeout(this.timeoutMs)
|
|
5428
|
+
});
|
|
5429
|
+
return { ok: response.ok };
|
|
5430
|
+
}
|
|
5431
|
+
async buildMesh(params) {
|
|
5432
|
+
const { imagePath, rig } = params;
|
|
5433
|
+
const response = await fetch(`${this.baseUrl}/mesh/build`, {
|
|
5434
|
+
method: "POST",
|
|
5435
|
+
headers: { "Content-Type": "application/json" },
|
|
5436
|
+
body: JSON.stringify({ imagePath, rig }),
|
|
5437
|
+
signal: AbortSignal.timeout(this.timeoutMs)
|
|
5438
|
+
});
|
|
5439
|
+
if (!response.ok) {
|
|
5440
|
+
throw await riggerError("/mesh/build", response);
|
|
5441
|
+
}
|
|
5442
|
+
return await response.json();
|
|
5443
|
+
}
|
|
5444
|
+
async render(params) {
|
|
5445
|
+
const { imagePath, rig, preset, outDir, mode, supersample } = params;
|
|
5446
|
+
const response = await fetch(`${this.baseUrl}/render`, {
|
|
5447
|
+
method: "POST",
|
|
5448
|
+
headers: { "Content-Type": "application/json" },
|
|
5449
|
+
body: JSON.stringify({ imagePath, rig, preset, outDir, mode, supersample }),
|
|
5450
|
+
signal: AbortSignal.timeout(this.timeoutMs)
|
|
5451
|
+
});
|
|
5452
|
+
if (!response.ok) {
|
|
5453
|
+
throw await riggerError("/render", response);
|
|
5454
|
+
}
|
|
5455
|
+
return await response.json();
|
|
5456
|
+
}
|
|
5457
|
+
async listPresets() {
|
|
5458
|
+
const response = await fetch(`${this.baseUrl}/presets`, {
|
|
5459
|
+
signal: AbortSignal.timeout(this.timeoutMs)
|
|
5460
|
+
});
|
|
5461
|
+
if (!response.ok) {
|
|
5462
|
+
throw await riggerError("/presets", response);
|
|
5463
|
+
}
|
|
5464
|
+
return await response.json();
|
|
5465
|
+
}
|
|
5466
|
+
async loadRig(params) {
|
|
5467
|
+
const { rigPath } = params;
|
|
5468
|
+
const response = await fetch(`${this.baseUrl}/rig/load`, {
|
|
5469
|
+
method: "POST",
|
|
5470
|
+
headers: { "Content-Type": "application/json" },
|
|
5471
|
+
body: JSON.stringify({ rigPath }),
|
|
5472
|
+
signal: AbortSignal.timeout(this.timeoutMs)
|
|
5473
|
+
});
|
|
5474
|
+
if (!response.ok) {
|
|
5475
|
+
throw await riggerError("/rig/load", response);
|
|
5476
|
+
}
|
|
5477
|
+
return await response.json();
|
|
5478
|
+
}
|
|
5479
|
+
async saveRig(params) {
|
|
5480
|
+
const { rigPath, rig } = params;
|
|
5481
|
+
const response = await fetch(`${this.baseUrl}/rig/save`, {
|
|
5482
|
+
method: "POST",
|
|
5483
|
+
headers: { "Content-Type": "application/json" },
|
|
5484
|
+
body: JSON.stringify({ rigPath, rig }),
|
|
5485
|
+
signal: AbortSignal.timeout(this.timeoutMs)
|
|
5486
|
+
});
|
|
5487
|
+
if (!response.ok) {
|
|
5488
|
+
throw await riggerError("/rig/save", response);
|
|
5489
|
+
}
|
|
5490
|
+
return await response.json();
|
|
5491
|
+
}
|
|
5492
|
+
async ownership(params) {
|
|
5493
|
+
const { imagePath, rig, outPath } = params;
|
|
5494
|
+
const response = await fetch(`${this.baseUrl}/ownership`, {
|
|
5495
|
+
method: "POST",
|
|
5496
|
+
headers: { "Content-Type": "application/json" },
|
|
5497
|
+
body: JSON.stringify({ imagePath, rig, outPath }),
|
|
5498
|
+
signal: AbortSignal.timeout(this.timeoutMs)
|
|
5499
|
+
});
|
|
5500
|
+
if (!response.ok) {
|
|
5501
|
+
throw await riggerError("/ownership", response);
|
|
5502
|
+
}
|
|
5503
|
+
return await response.json();
|
|
5504
|
+
}
|
|
5505
|
+
async generate(params) {
|
|
5506
|
+
const { model, prompt, seed, size, steps, sourcePath, outDir } = params;
|
|
5507
|
+
const response = await fetch(`${this.baseUrl}/generate`, {
|
|
5508
|
+
method: "POST",
|
|
5509
|
+
headers: { "Content-Type": "application/json" },
|
|
5510
|
+
body: JSON.stringify({ model, prompt, seed, size, steps, sourcePath, outDir }),
|
|
5511
|
+
signal: AbortSignal.timeout(this.generateTimeoutMs)
|
|
5512
|
+
});
|
|
5513
|
+
if (!response.ok) {
|
|
5514
|
+
throw await riggerError("/generate", response);
|
|
5515
|
+
}
|
|
5516
|
+
return await response.json();
|
|
5517
|
+
}
|
|
5518
|
+
};
|
|
5519
|
+
registerIntegration("rigger", RiggerIntegration);
|
|
5520
|
+
|
|
5343
5521
|
// src/mocks/MockIntegration.ts
|
|
5344
5522
|
var MockIntegration = class extends BaseIntegration {
|
|
5345
5523
|
constructor(config) {
|
|
@@ -5667,6 +5845,12 @@ var RuntimeIntegrationManager = class {
|
|
|
5667
5845
|
WEBHOOK_TIMEOUT_MS: env.WEBHOOK_TIMEOUT_MS || ""
|
|
5668
5846
|
}
|
|
5669
5847
|
});
|
|
5848
|
+
this.factory.configure("rigger", {
|
|
5849
|
+
env: {
|
|
5850
|
+
RIGGER_BASE_URL: env.RIGGER_BASE_URL || "",
|
|
5851
|
+
RIGGER_TIMEOUT_MS: env.RIGGER_TIMEOUT_MS || ""
|
|
5852
|
+
}
|
|
5853
|
+
});
|
|
5670
5854
|
const llmEnv = {};
|
|
5671
5855
|
for (const k of ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "DEEPSEEK_API_KEY", "KIMI_API_KEY", "OPEN_ROUTER_API_KEY"]) {
|
|
5672
5856
|
if (env[k]) llmEnv[k] = env[k];
|