@almadar/integrations 2.34.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  import { e as IntegrationLogger, c as IntegrationErrorCode, a as IntegrationConfig, B as BaseIntegration, d as IntegrationFactory, g as IntegrationParams, h as IntegrationResult, I as IntegrationCallContext } from './BaseIntegration-BYlbMFlf.js';
2
2
  export { b as IntegrationError, f as IntegrationParamValue, U as UnknownActionError, V as ValidationError, i as ValidationResult, j as getIntegrationFactory, r as resetIntegrationFactory, v as validateParams } from './BaseIntegration-BYlbMFlf.js';
3
- import { e as CredentialStore, d as CredentialPersistence, H as HookDeclaration } from './store-DaPuMedl.js';
4
- export { A as ArxivActions, C as CLIActions, a as CREDENTIAL_ENTITY_TYPE, b as CREDENTIAL_MASTER_KEY_ENV, c as CredentialEntry, D as DatabaseActions, f as DatabaseDriver, g as DatabaseQueryParamValue, h as DatabaseQueryParams, i as DatabaseQueryResult, j as DatabaseRow, k as DeepAgentActions, l as DockerActions, E as EmailActions, G as GitHubActions, I as IconifyActions, m as IntegrationActionName, n as IntegrationContracts, o as IntegrationName, L as LLMIntegrationActions, M as MLActions, O as OAuthActions, p as OtelActions, Q as QueueActions, R as RedisActions, S as StorageActions, q as StripeActions, T as TwilioActions, W as WebhookActions, r as WikimediaActions, Y as YouTubeActions, s as allCredentialEnvVars, t as declaredCredentialEnvVars, u as serviceHooks } from './store-DaPuMedl.js';
3
+ import { e as CredentialStore, d as CredentialPersistence, H as HookDeclaration } from './store-BGNfuoFd.js';
4
+ export { A as ArxivActions, C as CLIActions, a as CREDENTIAL_ENTITY_TYPE, b as CREDENTIAL_MASTER_KEY_ENV, c as CredentialEntry, D as DatabaseActions, f as DatabaseDriver, g as DatabaseQueryParamValue, h as DatabaseQueryParams, i as DatabaseQueryResult, j as DatabaseRow, k as DeepAgentActions, l as DockerActions, E as EmailActions, G as GitHubActions, I as IconifyActions, m as IntegrationActionName, n as IntegrationContracts, o as IntegrationName, L as LLMIntegrationActions, M as MLActions, O as OAuthActions, p as OtelActions, Q as QueueActions, R as RedisActions, S as StorageActions, q as StripeActions, T as TwilioActions, W as WebhookActions, r as WikimediaActions, Y as YouTubeActions, s as allCredentialEnvVars, t as declaredCredentialEnvVars, u as serviceHooks } from './store-BGNfuoFd.js';
5
5
  import { LogMeta, EntityRow, EventPayload } from '@almadar/core';
6
6
  export { GitHubIntegration } from './integrations/github/index.js';
7
7
 
@@ -1024,11 +1024,17 @@ declare class ArxivIntegration extends BaseIntegration {
1024
1024
  declare class RiggerIntegration extends BaseIntegration {
1025
1025
  private readonly baseUrl;
1026
1026
  private readonly timeoutMs;
1027
+ private readonly generateTimeoutMs;
1027
1028
  constructor(config: IntegrationConfig);
1028
1029
  execute(action: string, params: IntegrationParams): Promise<IntegrationResult>;
1029
1030
  private health;
1030
1031
  private buildMesh;
1031
1032
  private render;
1033
+ private listPresets;
1034
+ private loadRig;
1035
+ private saveRig;
1036
+ private ownership;
1037
+ private generate;
1032
1038
  }
1033
1039
 
1034
1040
  export { AccountingIntegration, type AlmadarCheckoutSession, type AlmadarCustomer, type AlmadarInvoiceFailure, type AlmadarInvoicePayment, type AlmadarPortalSession, type AlmadarStripeEvent, type AlmadarStripeEventOk, type AlmadarSubscription, type AlmadarSubscriptionStatus, type AlmadarTier, ArxivIntegration, type ArxivResult, BankingIntegration, BaseIntegration, CLIIntegration, CREDENTIALS_FILE_ENV, CalendarIntegration, type CancelSubscriptionInput, ConsoleLogger, type CreateCheckoutInput, type CreateCustomerInput, type CreatePortalInput, CredentialPersistence, CredentialStore, CredentialsIntegration, DatabaseIntegration, DeepAgentIntegration, DockerIntegration, DriveIntegration, EmailIntegration, EsignIntegration, FileCredentialPersistence, HookDeclaration, type HookProviderInput, type HookProviderResult, IconifyIntegration, InMemoryPendingGrantStore, IntegrationCallContext, IntegrationConfig, type IntegrationConstructor, IntegrationErrorCode, IntegrationFactory, IntegrationLogger, IntegrationParams, IntegrationResult, LLMIntegration, MLIntegration, MetaAdsIntegration, OAuthIntegration, OtelIntegration, type PendingGrantStore, PushIntegration, QueueIntegration, RedisIntegration, type RegisteredHookProvider, type RetryConfig, RiggerIntegration, type SqlGuardResult, StorageIntegration, StripeIntegration, type StripePriceMap, TwilioIntegration, type UpdateSubscriptionInput, type VerifyAndParseInput, WebhookIntegration, WikimediaIntegration, YouTubeIntegration, allHookDeclarations, assertReadOnlySelect, getActiveFactory, getInstalledCredentialStore, getIntegration, getRegisteredIntegrations, googleCalendarHookProvider, installActiveFactory, installCredentialStore, installPendingGrantStore, isKnownIntegration, parseCalendarPushNotification, registerIntegration, registeredHookProviders, resolveCredentialRef, uninstallCredentialStore, verifyAndParseStripeEvent, withRetry };
package/dist/index.js CHANGED
@@ -161,7 +161,8 @@ var serviceCredentials = {
161
161
  ],
162
162
  rigger: [
163
163
  { envVar: "RIGGER_BASE_URL", required: false, description: "Local rigger service base URL (default http://127.0.0.1:8181)" },
164
- { envVar: "RIGGER_TIMEOUT_MS", required: false, description: "Per-request timeout (ms)" }
164
+ { envVar: "RIGGER_TIMEOUT_MS", required: false, description: "Per-request timeout (ms)" },
165
+ { 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)" }
165
166
  ]
166
167
  };
167
168
  function allCredentialEnvVars() {
@@ -5836,11 +5837,24 @@ registerIntegration("arxiv", ArxivIntegration);
5836
5837
  // src/integrations/rigger/index.ts
5837
5838
  var DEFAULT_BASE_URL = "http://127.0.0.1:8181";
5838
5839
  var DEFAULT_TIMEOUT_MS5 = 3e4;
5840
+ var DEFAULT_GENERATE_TIMEOUT_MS = 6e5;
5841
+ async function riggerError(path, response) {
5842
+ let detail = "";
5843
+ try {
5844
+ const body = await response.json();
5845
+ if (typeof body.detail === "string") detail = body.detail;
5846
+ else if (body.detail !== void 0) detail = JSON.stringify(body.detail);
5847
+ } catch {
5848
+ detail = "";
5849
+ }
5850
+ return new Error(`Rigger ${path} returned ${response.status}${detail ? `: ${detail}` : ""}`);
5851
+ }
5839
5852
  var RiggerIntegration = class extends BaseIntegration {
5840
5853
  constructor(config) {
5841
5854
  super(config);
5842
5855
  this.baseUrl = config.env.RIGGER_BASE_URL || DEFAULT_BASE_URL;
5843
5856
  this.timeoutMs = Number(config.env.RIGGER_TIMEOUT_MS) || DEFAULT_TIMEOUT_MS5;
5857
+ this.generateTimeoutMs = Number(config.env.RIGGER_GENERATE_TIMEOUT_MS) || DEFAULT_GENERATE_TIMEOUT_MS;
5844
5858
  this.logger.info("Rigger integration initialized", { baseUrl: this.baseUrl });
5845
5859
  }
5846
5860
  async execute(action, params) {
@@ -5870,6 +5884,21 @@ var RiggerIntegration = class extends BaseIntegration {
5870
5884
  case "render":
5871
5885
  data = await this.executeWithRetry(() => this.render(params));
5872
5886
  break;
5887
+ case "listPresets":
5888
+ data = await this.executeWithRetry(() => this.listPresets());
5889
+ break;
5890
+ case "loadRig":
5891
+ data = await this.executeWithRetry(() => this.loadRig(params));
5892
+ break;
5893
+ case "saveRig":
5894
+ data = await this.executeWithRetry(() => this.saveRig(params));
5895
+ break;
5896
+ case "ownership":
5897
+ data = await this.executeWithRetry(() => this.ownership(params));
5898
+ break;
5899
+ case "generate":
5900
+ data = await this.executeWithRetry(() => this.generate(params));
5901
+ break;
5873
5902
  default:
5874
5903
  throw new UnknownActionError(this.config.name, action);
5875
5904
  }
@@ -5897,22 +5926,83 @@ var RiggerIntegration = class extends BaseIntegration {
5897
5926
  signal: AbortSignal.timeout(this.timeoutMs)
5898
5927
  });
5899
5928
  if (!response.ok) {
5900
- throw new Error(`Rigger /mesh/build returned ${response.status}`);
5929
+ throw await riggerError("/mesh/build", response);
5901
5930
  }
5902
5931
  return await response.json();
5903
5932
  }
5904
5933
  async render(params) {
5905
- const { imagePath, rig, preset, outDir } = params;
5934
+ const { imagePath, rig, preset, outDir, mode, supersample } = params;
5906
5935
  const response = await fetch(`${this.baseUrl}/render`, {
5907
5936
  method: "POST",
5908
5937
  headers: { "Content-Type": "application/json" },
5909
- body: JSON.stringify({ imagePath, rig, preset, outDir }),
5938
+ body: JSON.stringify({ imagePath, rig, preset, outDir, mode, supersample }),
5910
5939
  signal: AbortSignal.timeout(this.timeoutMs)
5911
5940
  });
5912
5941
  if (!response.ok) {
5913
- throw new Error(`Rigger /render returned ${response.status}`);
5942
+ throw await riggerError("/render", response);
5914
5943
  }
5915
- return response.json();
5944
+ return await response.json();
5945
+ }
5946
+ async listPresets() {
5947
+ const response = await fetch(`${this.baseUrl}/presets`, {
5948
+ signal: AbortSignal.timeout(this.timeoutMs)
5949
+ });
5950
+ if (!response.ok) {
5951
+ throw await riggerError("/presets", response);
5952
+ }
5953
+ return await response.json();
5954
+ }
5955
+ async loadRig(params) {
5956
+ const { rigPath } = params;
5957
+ const response = await fetch(`${this.baseUrl}/rig/load`, {
5958
+ method: "POST",
5959
+ headers: { "Content-Type": "application/json" },
5960
+ body: JSON.stringify({ rigPath }),
5961
+ signal: AbortSignal.timeout(this.timeoutMs)
5962
+ });
5963
+ if (!response.ok) {
5964
+ throw await riggerError("/rig/load", response);
5965
+ }
5966
+ return await response.json();
5967
+ }
5968
+ async saveRig(params) {
5969
+ const { rigPath, rig } = params;
5970
+ const response = await fetch(`${this.baseUrl}/rig/save`, {
5971
+ method: "POST",
5972
+ headers: { "Content-Type": "application/json" },
5973
+ body: JSON.stringify({ rigPath, rig }),
5974
+ signal: AbortSignal.timeout(this.timeoutMs)
5975
+ });
5976
+ if (!response.ok) {
5977
+ throw await riggerError("/rig/save", response);
5978
+ }
5979
+ return await response.json();
5980
+ }
5981
+ async ownership(params) {
5982
+ const { imagePath, rig, outPath } = params;
5983
+ const response = await fetch(`${this.baseUrl}/ownership`, {
5984
+ method: "POST",
5985
+ headers: { "Content-Type": "application/json" },
5986
+ body: JSON.stringify({ imagePath, rig, outPath }),
5987
+ signal: AbortSignal.timeout(this.timeoutMs)
5988
+ });
5989
+ if (!response.ok) {
5990
+ throw await riggerError("/ownership", response);
5991
+ }
5992
+ return await response.json();
5993
+ }
5994
+ async generate(params) {
5995
+ const { model, prompt, seed, size, steps, sourcePath, outDir } = params;
5996
+ const response = await fetch(`${this.baseUrl}/generate`, {
5997
+ method: "POST",
5998
+ headers: { "Content-Type": "application/json" },
5999
+ body: JSON.stringify({ model, prompt, seed, size, steps, sourcePath, outDir }),
6000
+ signal: AbortSignal.timeout(this.generateTimeoutMs)
6001
+ });
6002
+ if (!response.ok) {
6003
+ throw await riggerError("/generate", response);
6004
+ }
6005
+ return await response.json();
5916
6006
  }
5917
6007
  };
5918
6008
  registerIntegration("rigger", RiggerIntegration);