@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 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-C5nb44iS.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-C5nb44iS.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
 
@@ -1021,4 +1021,20 @@ declare class ArxivIntegration extends BaseIntegration {
1021
1021
  private search;
1022
1022
  }
1023
1023
 
1024
- 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, 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 };
1024
+ declare class RiggerIntegration extends BaseIntegration {
1025
+ private readonly baseUrl;
1026
+ private readonly timeoutMs;
1027
+ private readonly generateTimeoutMs;
1028
+ constructor(config: IntegrationConfig);
1029
+ execute(action: string, params: IntegrationParams): Promise<IntegrationResult>;
1030
+ private health;
1031
+ private buildMesh;
1032
+ private render;
1033
+ private listPresets;
1034
+ private loadRig;
1035
+ private saveRig;
1036
+ private ownership;
1037
+ private generate;
1038
+ }
1039
+
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
@@ -158,6 +158,11 @@ var serviceCredentials = {
158
158
  ],
159
159
  arxiv: [
160
160
  { envVar: "ARXIV_TIMEOUT_MS", required: false, description: "Per-request timeout (ms)" }
161
+ ],
162
+ rigger: [
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)" },
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)" }
161
166
  ]
162
167
  };
163
168
  function allCredentialEnvVars() {
@@ -5829,6 +5834,179 @@ var ArxivIntegration = class extends BaseIntegration {
5829
5834
  };
5830
5835
  registerIntegration("arxiv", ArxivIntegration);
5831
5836
 
5832
- export { AccountingIntegration, ArxivIntegration, BankingIntegration, BaseIntegration, CLIIntegration, CREDENTIALS_FILE_ENV, CREDENTIAL_ENTITY_TYPE, CREDENTIAL_MASTER_KEY_ENV, CalendarIntegration, ConsoleLogger, CredentialStore, CredentialsIntegration, DatabaseIntegration, DeepAgentIntegration, DockerIntegration, DriveIntegration, EmailIntegration, EsignIntegration, FileCredentialPersistence, GitHubIntegration, IconifyIntegration, InMemoryPendingGrantStore, IntegrationError, IntegrationFactory, LLMIntegration, MLIntegration, MetaAdsIntegration, OAuthIntegration, OtelIntegration, PushIntegration, QueueIntegration, RedisIntegration, StorageIntegration, StripeIntegration, TwilioIntegration, UnknownActionError, WebhookIntegration, WikimediaIntegration, YouTubeIntegration, allCredentialEnvVars, allHookDeclarations, assertReadOnlySelect, declaredCredentialEnvVars, getActiveFactory, getInstalledCredentialStore, getIntegration, getIntegrationFactory, getRegisteredIntegrations, googleCalendarHookProvider, installActiveFactory, installCredentialStore, installPendingGrantStore, isKnownIntegration, parseCalendarPushNotification, registerIntegration, registeredHookProviders, resetIntegrationFactory, resolveCredentialRef, serviceHooks, uninstallCredentialStore, validateParams, verifyAndParseStripeEvent, withRetry };
5837
+ // src/integrations/rigger/index.ts
5838
+ var DEFAULT_BASE_URL = "http://127.0.0.1:8181";
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
+ }
5852
+ var RiggerIntegration = class extends BaseIntegration {
5853
+ constructor(config) {
5854
+ super(config);
5855
+ this.baseUrl = config.env.RIGGER_BASE_URL || DEFAULT_BASE_URL;
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;
5858
+ this.logger.info("Rigger integration initialized", { baseUrl: this.baseUrl });
5859
+ }
5860
+ async execute(action, params) {
5861
+ const validation = this.validateParams(action, params);
5862
+ if (!validation.valid) {
5863
+ return {
5864
+ success: false,
5865
+ error: {
5866
+ name: "IntegrationError",
5867
+ message: "Validation failed",
5868
+ code: "VALIDATION_ERROR",
5869
+ details: validation.errors
5870
+ },
5871
+ metadata: this.createMetadata(action, 0)
5872
+ };
5873
+ }
5874
+ const startTime = Date.now();
5875
+ try {
5876
+ let data;
5877
+ switch (action) {
5878
+ case "health":
5879
+ data = await this.health();
5880
+ break;
5881
+ case "buildMesh":
5882
+ data = await this.executeWithRetry(() => this.buildMesh(params));
5883
+ break;
5884
+ case "render":
5885
+ data = await this.executeWithRetry(() => this.render(params));
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;
5902
+ default:
5903
+ throw new UnknownActionError(this.config.name, action);
5904
+ }
5905
+ return {
5906
+ success: true,
5907
+ data,
5908
+ metadata: this.createMetadata(action, Date.now() - startTime)
5909
+ };
5910
+ } catch (error) {
5911
+ return this.handleError(action, error);
5912
+ }
5913
+ }
5914
+ async health() {
5915
+ const response = await fetch(`${this.baseUrl}/health`, {
5916
+ signal: AbortSignal.timeout(this.timeoutMs)
5917
+ });
5918
+ return { ok: response.ok };
5919
+ }
5920
+ async buildMesh(params) {
5921
+ const { imagePath, rig } = params;
5922
+ const response = await fetch(`${this.baseUrl}/mesh/build`, {
5923
+ method: "POST",
5924
+ headers: { "Content-Type": "application/json" },
5925
+ body: JSON.stringify({ imagePath, rig }),
5926
+ signal: AbortSignal.timeout(this.timeoutMs)
5927
+ });
5928
+ if (!response.ok) {
5929
+ throw await riggerError("/mesh/build", response);
5930
+ }
5931
+ return await response.json();
5932
+ }
5933
+ async render(params) {
5934
+ const { imagePath, rig, preset, outDir, mode, supersample } = params;
5935
+ const response = await fetch(`${this.baseUrl}/render`, {
5936
+ method: "POST",
5937
+ headers: { "Content-Type": "application/json" },
5938
+ body: JSON.stringify({ imagePath, rig, preset, outDir, mode, supersample }),
5939
+ signal: AbortSignal.timeout(this.timeoutMs)
5940
+ });
5941
+ if (!response.ok) {
5942
+ throw await riggerError("/render", response);
5943
+ }
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();
6006
+ }
6007
+ };
6008
+ registerIntegration("rigger", RiggerIntegration);
6009
+
6010
+ export { AccountingIntegration, ArxivIntegration, BankingIntegration, BaseIntegration, CLIIntegration, CREDENTIALS_FILE_ENV, CREDENTIAL_ENTITY_TYPE, CREDENTIAL_MASTER_KEY_ENV, CalendarIntegration, ConsoleLogger, CredentialStore, CredentialsIntegration, DatabaseIntegration, DeepAgentIntegration, DockerIntegration, DriveIntegration, EmailIntegration, EsignIntegration, FileCredentialPersistence, GitHubIntegration, IconifyIntegration, InMemoryPendingGrantStore, IntegrationError, IntegrationFactory, LLMIntegration, MLIntegration, MetaAdsIntegration, OAuthIntegration, OtelIntegration, PushIntegration, QueueIntegration, RedisIntegration, RiggerIntegration, StorageIntegration, StripeIntegration, TwilioIntegration, UnknownActionError, WebhookIntegration, WikimediaIntegration, YouTubeIntegration, allCredentialEnvVars, allHookDeclarations, assertReadOnlySelect, declaredCredentialEnvVars, getActiveFactory, getInstalledCredentialStore, getIntegration, getIntegrationFactory, getRegisteredIntegrations, googleCalendarHookProvider, installActiveFactory, installCredentialStore, installPendingGrantStore, isKnownIntegration, parseCalendarPushNotification, registerIntegration, registeredHookProviders, resetIntegrationFactory, resolveCredentialRef, serviceHooks, uninstallCredentialStore, validateParams, verifyAndParseStripeEvent, withRetry };
5833
6011
  //# sourceMappingURL=index.js.map
5834
6012
  //# sourceMappingURL=index.js.map