@powerhousedao/pieces-framework 6.2.3-staging.0 → 6.3.0-dev.1

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.js CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as ErrorHandlingOptionsParam, a as ObjectProperty, c as DynamicProp, d as ArrayProperty, f as ArraySubProps, g as MultiSelectDropdownProperty, h as DropdownProperty, i as RichTextProperty, l as DynamicProperties, m as JsonProperty, n as Property, o as assertNotNullOrUndefined, p as DateTimeProperty, r as CustomProperty, s as isNotUndefined, t as InputProperty, u as DynamicPropsValue, v as IAction, y as createAction } from "./input-BHkj_oP5.js";
1
+ import { _ as ErrorHandlingOptionsParam, a as ObjectProperty, c as DynamicProp, d as ArrayProperty, f as ArraySubProps, g as MultiSelectDropdownProperty, h as DropdownProperty, i as RichTextProperty, l as DynamicProperties, m as JsonProperty, n as Property$1, o as assertNotNullOrUndefined, p as DateTimeProperty, r as CustomProperty, s as isNotUndefined, t as InputProperty, u as DynamicPropsValue, v as IAction, y as createAction$1 } from "./input-BHkj_oP5.js";
2
2
  import { A as PropertyType, C as CheckboxProperty, D as DropdownState, E as DropdownOption, O as LongTextProperty, S as NumberProperty, T as StaticMultiSelectDropdownProperty, _ as DateRangeProperty, a as chunk, b as ApFile, c as isNil, f as pickBy, g as DateRangePreset, h as MarkdownVariant, i as camelCase, j as BasePropertySchema, k as ShortTextProperty, l as isString, m as unique, n as tryCatch, p as startCase, s as isEmpty, u as kebabCase, v as DateRangeValue, w as StaticDropdownProperty, x as FileProperty, y as dateRangeUtils } from "./markdown-property-DMfHjEiL.js";
3
- import { _ as TriggerStrategy, a as OAuth2AuthorizationMethod, b as AppConnectionType, c as OAuth2Props, d as SecretTextProperty, f as BasicAuthProperty, g as AUTHENTICATION_PROPERTY_NAME, h as spreadIfDefined, i as getAuthPropertyForValue, l as OIDCProperty, n as PieceAuth, o as OAuth2Property, p as BasicAuthPropertyValue, r as PieceAuthProperty, s as OAuth2PropertyValue, t as DEFAULT_CONNECTION_DISPLAY_NAME, u as CustomAuthProperty, v as TriggerTestStrategy, x as OAuth2GrantType, y as WebhookHandshakeStrategy } from "./authentication-o-4CdAPR.js";
3
+ import { S as OAuth2GrantType, _ as AUTHENTICATION_PROPERTY_NAME, a as OAuth2AuthorizationMethod, b as WebhookHandshakeStrategy, c as OAuth2PropertyValue, d as CustomAuthProperty, f as SecretTextProperty, g as spreadIfDefined, i as getAuthPropertyForValue, l as OAuth2Props, m as BasicAuthPropertyValue, n as PieceAuth, o as OAuth2Discovery, p as BasicAuthProperty, r as PieceAuthProperty, s as OAuth2Property, t as DEFAULT_CONNECTION_DISPLAY_NAME, u as OIDCProperty, v as TriggerStrategy, x as AppConnectionType, y as TriggerTestStrategy } from "./authentication-f4cep7Po.js";
4
4
  import * as z from "zod/mini";
5
5
  import { customAlphabet } from "nanoid";
6
6
  import path from "node:path";
@@ -92,6 +92,7 @@ function NullableEnum(enumObj) {
92
92
  return z.optional(z.nullable(z.enum(enumObj)));
93
93
  }
94
94
  const OptionalBooleanFromQuery = z.pipe(z.transform((val) => val === "true" || val === true ? true : val === "false" || val === false ? false : void 0), z.optional(z.boolean()));
95
+ const OptionalIsoDateTimeQuery = z.optional(z.iso.datetime({ offset: true }).check(z.refine((val) => val.slice(0, 4) !== "0000")));
95
96
  const OptionalArrayFromQuery = (schema) => z.pipe(z.transform((val) => Array.isArray(val) ? val : val !== void 0 ? [val] : void 0), z.optional(z.array(schema)));
96
97
 
97
98
  //#endregion
@@ -141,6 +142,28 @@ let AIProviderName = /* @__PURE__ */ function(AIProviderName) {
141
142
  return AIProviderName;
142
143
  }({});
143
144
 
145
+ //#endregion
146
+ //#region upstream/core-utils/lib/ai-step.ts
147
+ let AiStepAction = /* @__PURE__ */ function(AiStepAction) {
148
+ AiStepAction["ASK_AI"] = "ASK_AI";
149
+ AiStepAction["SUMMARIZE_TEXT"] = "SUMMARIZE_TEXT";
150
+ AiStepAction["CLASSIFY_TEXT"] = "CLASSIFY_TEXT";
151
+ AiStepAction["EXTRACT_STRUCTURED_DATA"] = "EXTRACT_STRUCTURED_DATA";
152
+ AiStepAction["GENERATE_IMAGE"] = "GENERATE_IMAGE";
153
+ AiStepAction["ROUTE"] = "ROUTE";
154
+ return AiStepAction;
155
+ }({});
156
+
157
+ //#endregion
158
+ //#region upstream/core-utils/lib/http-header-utils.ts
159
+ function sanitizeHttpHeaderName(name) {
160
+ return name.trim().replace(/[^!#$%&'*+\-.^_`|~0-9A-Za-z]/g, "");
161
+ }
162
+ function sanitizeHttpHeaders(headers) {
163
+ if (!headers) return {};
164
+ return Object.fromEntries(Object.entries(headers).map(([key, value]) => [sanitizeHttpHeaderName(key), value]).filter(([key]) => key !== ""));
165
+ }
166
+
144
167
  //#endregion
145
168
  //#region upstream/core-piece-types/lib/agents.ts
146
169
  const TASK_COMPLETION_TOOL_NAME = "updateTaskStatus";
@@ -428,7 +451,8 @@ const MistralProviderAuthConfig = BaseAIProviderAuthConfig;
428
451
  const VertexProviderAuthConfig = z.object({ serviceAccountJson: z.string().check(z.minLength(1)) });
429
452
  const BedrockProviderAuthConfig = z.object({
430
453
  accessKeyId: z.string().check(z.minLength(1)),
431
- secretAccessKey: z.string().check(z.minLength(1))
454
+ secretAccessKey: z.string().check(z.minLength(1)),
455
+ sessionToken: z.optional(z.string())
432
456
  });
433
457
  const AnthropicProviderConfig = z.object({});
434
458
  const ActivePiecesProviderConfig = z.object({});
@@ -574,12 +598,20 @@ const CF_GATEWAY_SUBMODEL_TO_PROVIDER = {
574
598
  };
575
599
  const OPENAI_CHAT_MODELS = [
576
600
  "gpt-5.5",
601
+ "gpt-5.6-sol",
602
+ "gpt-5.6-terra",
603
+ "gpt-5.6-luna",
577
604
  "gpt-5.4-mini",
578
605
  "gpt-5.4-nano",
579
606
  "gpt-4.1",
580
607
  "gpt-4.1-mini"
581
608
  ];
582
609
  const ANTHROPIC_CHAT_MODELS = [
610
+ "claude-sonnet-5-5",
611
+ "claude-opus-5-5",
612
+ "claude-haiku-5-5"
613
+ ];
614
+ const DEPRECATED_ANTHROPIC_CHAT_MODELS = [
583
615
  "claude-sonnet-4-6",
584
616
  "claude-opus-4-7",
585
617
  "claude-haiku-4-5"
@@ -591,14 +623,18 @@ const ANTHROPIC_OPENROUTER_CHAT_MODELS = [
591
623
  "claude-haiku-4.5"
592
624
  ];
593
625
  const GOOGLE_CHAT_MODELS = [
594
- "gemini-2.5-pro",
595
- "gemini-2.5-flash",
596
626
  "gemini-3.7-flash",
597
627
  "gemini-3.1-pro-preview",
598
628
  "gemini-3-flash-preview"
599
629
  ];
630
+ const DEPRECATED_GOOGLE_CHAT_MODELS = ["gemini-2.5-pro", "gemini-2.5-flash"];
600
631
  const X_AI_OPENROUTER_CHAT_MODELS = ["grok-4.20"];
601
- const REASONING_OPTIONAL_CHAT_MODELS = ANTHROPIC_OPENROUTER_CHAT_MODELS.map((model) => `${"anthropic"}/${model}`);
632
+ const DEPRECATED_CHAT_MODELS_BY_PROVIDER = {
633
+ ["anthropic"]: DEPRECATED_ANTHROPIC_CHAT_MODELS,
634
+ ["google"]: DEPRECATED_GOOGLE_CHAT_MODELS,
635
+ ["vertex"]: DEPRECATED_GOOGLE_CHAT_MODELS
636
+ };
637
+ const REASONING_OPTIONAL_CHAT_MODELS = [...ANTHROPIC_OPENROUTER_CHAT_MODELS.map((model) => `${"anthropic"}/${model}`), "deepseek/deepseek-v4.1-flash"];
602
638
  const ALLOWED_CHAT_MODELS_BY_PROVIDER = {
603
639
  ["openai"]: OPENAI_CHAT_MODELS,
604
640
  ["anthropic"]: ANTHROPIC_CHAT_MODELS,
@@ -607,10 +643,109 @@ const ALLOWED_CHAT_MODELS_BY_PROVIDER = {
607
643
  ["activepieces"]: [
608
644
  ...ANTHROPIC_OPENROUTER_CHAT_MODELS.map((m) => `${"anthropic"}/${m}`),
609
645
  ...OPENAI_CHAT_MODELS.map((m) => `${"openai"}/${m}`),
610
- ...GOOGLE_CHAT_MODELS.map((m) => `${"google"}/${m}`),
646
+ ...[...GOOGLE_CHAT_MODELS, ...DEPRECATED_GOOGLE_CHAT_MODELS].map((m) => `${"google"}/${m}`),
611
647
  ...X_AI_OPENROUTER_CHAT_MODELS.map((m) => `x-ai/${m}`)
612
648
  ]
613
649
  };
650
+ const CHAT_MODEL_LABELS = {
651
+ "gpt-5.5": "GPT-5.5",
652
+ "gpt-5.6-sol": "GPT-5.6 Sol",
653
+ "gpt-5.6-terra": "GPT-5.6 Terra",
654
+ "gpt-5.6-luna": "GPT-5.6 Luna",
655
+ "gpt-5.4-mini": "GPT-5.4 mini",
656
+ "gpt-5.4-nano": "GPT-5.4 nano",
657
+ "gpt-4.1": "GPT-4.1",
658
+ "gpt-4.1-mini": "GPT-4.1 mini",
659
+ "claude-sonnet-5-5": "Claude Sonnet 5.5",
660
+ "claude-opus-5-5": "Claude Opus 5.5",
661
+ "claude-haiku-5-5": "Claude Haiku 5.5",
662
+ "claude-sonnet-4-6": "Claude Sonnet 4.6",
663
+ "claude-opus-4-7": "Claude Opus 4.7",
664
+ "claude-haiku-4-5": "Claude Haiku 4.5",
665
+ "gemini-2.5-pro": "Gemini 2.5 Pro",
666
+ "gemini-2.5-flash": "Gemini 2.5 Flash",
667
+ "gemini-3.7-flash": "Gemini 3.7 Flash",
668
+ "gemini-3.1-pro-preview": "Gemini 3.1 Pro Preview",
669
+ "gemini-3-flash-preview": "Gemini 3 Flash Preview"
670
+ };
671
+ function getCuratedChatModels({ provider }) {
672
+ const curatedIds = provider === "activepieces" ? void 0 : ALLOWED_CHAT_MODELS_BY_PROVIDER[provider];
673
+ if (isNil(curatedIds) || curatedIds.length === 0) return;
674
+ return curatedIds.map((id) => ({
675
+ id,
676
+ label: CHAT_MODEL_LABELS[id] ?? id
677
+ }));
678
+ }
679
+ function runnableChatModelIds({ provider }) {
680
+ const offered = (getCuratedChatModels({ provider }) ?? []).map((model) => model.id);
681
+ return unique([...offered, ...DEPRECATED_CHAT_MODELS_BY_PROVIDER[provider] ?? []]);
682
+ }
683
+ function canDisableReasoning({ modelId }) {
684
+ return REASONING_OPTIONAL_CHAT_MODELS.includes(modelId);
685
+ }
686
+ function managedChatModelIds() {
687
+ return unique([...ALLOWED_CHAT_MODELS_BY_PROVIDER["activepieces"] ?? [], ...ACTIVEPIECES_CHAT_TIERS.map((tier) => tier.modelId)]);
688
+ }
689
+ function isManagedChatModelId({ modelId }) {
690
+ return managedChatModelIds().includes(modelId);
691
+ }
692
+ function curatedChatModelIds() {
693
+ return unique([
694
+ ...ACTIVEPIECES_CHAT_TIERS.flatMap((tier) => [tier.id, tier.modelId]),
695
+ ...Object.values(ALLOWED_CHAT_MODELS_BY_PROVIDER).flatMap((curatedIds) => curatedIds ?? []),
696
+ ...Object.values(DEPRECATED_CHAT_MODELS_BY_PROVIDER).flatMap((deprecatedIds) => deprecatedIds ?? [])
697
+ ]);
698
+ }
699
+ function isCuratedChatModelId({ modelId }) {
700
+ return curatedChatModelIds().includes(modelId);
701
+ }
702
+ function isChatModelId({ modelId }) {
703
+ const baseModelId = fineTuneBaseModelId({ modelId: modelId.trim().toLowerCase() });
704
+ if (NON_CHAT_MODEL_IDS.includes(baseModelId)) return false;
705
+ if (NON_CHAT_MODEL_ID_PREFIXES.some((prefix) => baseModelId.startsWith(prefix))) return false;
706
+ if (NON_CHAT_MODEL_ID_FRAGMENTS.some((fragment) => baseModelId.includes(fragment))) return false;
707
+ const idTokens = baseModelId.split(MODEL_ID_TOKEN_SEPARATOR);
708
+ return !NON_CHAT_MODEL_ID_TOKENS.some((token) => idTokens.includes(token));
709
+ }
710
+ function fineTuneBaseModelId({ modelId }) {
711
+ if (modelId.startsWith(FINE_TUNE_PREFIX)) return modelId.split(FINE_TUNE_SEGMENT_SEPARATOR)[1] ?? modelId;
712
+ const azureFineTuneStart = modelId.indexOf(AZURE_FINE_TUNE_INFIX);
713
+ return azureFineTuneStart > 0 ? modelId.slice(0, azureFineTuneStart) : modelId;
714
+ }
715
+ const FINE_TUNE_PREFIX = "ft:";
716
+ const FINE_TUNE_SEGMENT_SEPARATOR = ":";
717
+ const AZURE_FINE_TUNE_INFIX = ".ft-";
718
+ const NON_CHAT_MODEL_IDS = [
719
+ "babbage-002",
720
+ "davinci-002",
721
+ "sora"
722
+ ];
723
+ const NON_CHAT_MODEL_ID_PREFIXES = [
724
+ "text-embedding-",
725
+ "text-moderation-",
726
+ "omni-moderation-",
727
+ "tts-",
728
+ "whisper-",
729
+ "dall-e-",
730
+ "sora-",
731
+ "computer-use-",
732
+ "codex-",
733
+ "gpt-image-",
734
+ "chatgpt-image-"
735
+ ];
736
+ const NON_CHAT_MODEL_ID_FRAGMENTS = [
737
+ "realtime",
738
+ "audio",
739
+ "transcribe",
740
+ "whisper",
741
+ "embed",
742
+ "rerank",
743
+ "moderation",
744
+ "speech",
745
+ "voice"
746
+ ];
747
+ const NON_CHAT_MODEL_ID_TOKENS = ["tts", "asr"];
748
+ const MODEL_ID_TOKEN_SEPARATOR = /[-_.:/]/;
614
749
  const DEFAULT_MAX_CONTEXT_TOKENS = 128e3;
615
750
  const PROVIDER_MAX_CONTEXT_TOKENS = {
616
751
  ["openai"]: 128e3,
@@ -627,12 +762,12 @@ function getMaxContextTokens({ provider }) {
627
762
  if (!provider) return DEFAULT_MAX_CONTEXT_TOKENS;
628
763
  return PROVIDER_MAX_CONTEXT_TOKENS[provider] ?? DEFAULT_MAX_CONTEXT_TOKENS;
629
764
  }
630
- const DEFAULT_EMBEDDING_MODELS = {
631
- ["openai"]: "text-embedding-3-small",
632
- ["google"]: "text-embedding-004",
633
- ["azure"]: "text-embedding-3-small",
634
- ["activepieces"]: "text-embedding-3-small",
635
- ["openrouter"]: "openai/text-embedding-3-small"
765
+ const EMBEDDING_MODELS = {
766
+ ["openai"]: ["text-embedding-3-small", "text-embedding-3-large"],
767
+ ["google"]: ["text-embedding-004", "gemini-embedding-001"],
768
+ ["azure"]: ["text-embedding-3-small", "text-embedding-3-large"],
769
+ ["activepieces"]: ["text-embedding-3-small"],
770
+ ["openrouter"]: ["openai/text-embedding-3-small", "openai/text-embedding-3-large"]
636
771
  };
637
772
  const WEB_SEARCH_MODE_BY_PROVIDER = {
638
773
  ["anthropic"]: "native",
@@ -662,9 +797,11 @@ function buildProviderCapabilities(provider) {
662
797
  return {
663
798
  chatModels: ALLOWED_CHAT_MODELS_BY_PROVIDER[provider],
664
799
  maxContextTokens: getMaxContextTokens({ provider }),
665
- defaultEmbeddingModel: DEFAULT_EMBEDDING_MODELS[provider],
666
- supportsEmbedding: DEFAULT_EMBEDDING_MODELS[provider] !== void 0,
800
+ embeddingModels: EMBEDDING_MODELS[provider] ?? [],
801
+ defaultEmbeddingModel: EMBEDDING_MODELS[provider]?.[0],
802
+ supportsEmbedding: (EMBEDDING_MODELS[provider] ?? []).length > 0,
667
803
  supportsImageGeneration: !NO_IMAGE_GENERATION_PROVIDERS.has(provider),
804
+ defaultImageModel: DEFAULT_IMAGE_MODELS[provider],
668
805
  webSearch: WEB_SEARCH_MODE_BY_PROVIDER[provider]
669
806
  };
670
807
  }
@@ -674,27 +811,47 @@ const ACTIVEPIECES_CHAT_TIERS = [
674
811
  label: "Fast",
675
812
  modelId: "anthropic/claude-haiku-4.5",
676
813
  nativeModelId: "claude-haiku-4-5",
677
- thinkingBudget: 5e3,
678
- creditWeight: 2
814
+ thinkingBudget: 5e3
679
815
  },
680
816
  {
681
817
  id: "smart",
682
818
  label: "Expert",
683
819
  modelId: "anthropic/claude-sonnet-4.6",
684
820
  nativeModelId: "claude-sonnet-4-6",
685
- thinkingBudget: 1e4,
686
- creditWeight: 10
821
+ thinkingBudget: 1e4
687
822
  },
688
823
  {
689
824
  id: "premium",
690
825
  label: "Heavy",
691
826
  modelId: "anthropic/claude-opus-4.8",
692
827
  nativeModelId: "claude-opus-4-7",
693
- thinkingBudget: 2e4,
694
- creditWeight: 20
828
+ thinkingBudget: 2e4
695
829
  }
696
830
  ];
697
831
  const DEFAULT_CHAT_TIER_ID = "smart";
832
+ const ACTIVEPIECES_IMAGE_TIERS = [
833
+ {
834
+ id: "fast",
835
+ label: "Fast",
836
+ modelId: "google/gemini-3.1-flash-lite-image"
837
+ },
838
+ {
839
+ id: "smart",
840
+ label: "Expert",
841
+ modelId: "google/gemini-3.1-flash-image"
842
+ },
843
+ {
844
+ id: "premium",
845
+ label: "Heavy",
846
+ modelId: "google/gemini-3-pro-image"
847
+ }
848
+ ];
849
+ const DEFAULT_IMAGE_MODELS = {
850
+ ["activepieces"]: ACTIVEPIECES_IMAGE_TIERS[0].modelId,
851
+ ["openrouter"]: "google/gemini-3.1-flash-lite-image",
852
+ ["openai"]: "gpt-image-1.5",
853
+ ["google"]: "gemini-3.1-flash-image"
854
+ };
698
855
  const AI_PROVIDER_CAPABILITIES = {
699
856
  ["openai"]: buildProviderCapabilities("openai"),
700
857
  ["anthropic"]: buildProviderCapabilities("anthropic"),
@@ -714,6 +871,16 @@ const AI_PROVIDER_CAPABILITIES = {
714
871
  ["minimax"]: buildProviderCapabilities("minimax"),
715
872
  ["moonshot"]: buildProviderCapabilities("moonshot")
716
873
  };
874
+ const aiProviderUtils = {
875
+ getMaxContextTokens,
876
+ getCuratedChatModels,
877
+ runnableChatModelIds,
878
+ isCuratedChatModelId,
879
+ managedChatModelIds,
880
+ isManagedChatModelId,
881
+ canDisableReasoning,
882
+ isChatModelId
883
+ };
717
884
 
718
885
  //#endregion
719
886
  //#region upstream/core-piece-types/lib/forms.ts
@@ -1143,7 +1310,7 @@ var ITrigger = class {
1143
1310
  this.propertyGroups = propertyGroups;
1144
1311
  }
1145
1312
  };
1146
- const createTrigger = (params) => {
1313
+ const createTrigger$1 = (params) => {
1147
1314
  switch (params.type) {
1148
1315
  case "WEBHOOK": return new ITrigger(params.name, params.displayName, params.description, params.requireAuth ?? true, params.props, params.type, params.handshakeConfiguration ?? { strategy: "NONE" }, params.onHandshake ?? (async () => ({ status: 200 })), params.renewConfiguration ?? { strategy: "NONE" }, params.onRenew ?? (async () => Promise.resolve()), params.onEnable, params.onDisable, params.onStart ?? (async () => Promise.resolve()), params.run, params.test ?? (() => Promise.resolve([params.sampleData])), params.sampleData, params.test ? "TEST_FUNCTION" : "SIMULATION", params.outputSchema, params.aiMetadata, params.classification, params.propertyGroups);
1149
1316
  case "POLLING": return new ITrigger(params.name, params.displayName, params.description, params.requireAuth ?? true, params.props, params.type, { strategy: "NONE" }, async () => ({ status: 200 }), { strategy: "NONE" }, async () => Promise.resolve(), params.onEnable, params.onDisable, params.onStart ?? (async () => Promise.resolve()), params.run, params.test ?? (() => Promise.resolve([params.sampleData])), params.sampleData, "TEST_FUNCTION", params.outputSchema, params.aiMetadata, params.classification, params.propertyGroups);
@@ -1440,21 +1607,17 @@ const PiecePackageInformation = z.object({
1440
1607
  //#endregion
1441
1608
  //#region upstream/framework/lib/i18n.ts
1442
1609
  const pieceTranslation = {
1443
- translatePiece: (params) => {
1444
- const { piece, locale, mutate = false } = params;
1445
- if (!locale) return piece;
1446
- try {
1447
- const target = piece.i18n?.[locale];
1448
- if (!target) return piece;
1449
- const translatedPiece = mutate ? piece : JSON.parse(JSON.stringify(piece));
1450
- pieceTranslation.pathsToValuesToTranslate.forEach((key) => {
1451
- translateProperty(translatedPiece, key, target);
1452
- });
1453
- return translatedPiece;
1454
- } catch (err) {
1455
- console.error(`error translating piece ${piece.name}:`, err);
1456
- return piece;
1457
- }
1610
+ translatePiece: ({ piece, locale }) => {
1611
+ const translations = locale ? piece.i18n?.[locale] : void 0;
1612
+ if (!translations) return piece;
1613
+ return translateNode({
1614
+ node: piece,
1615
+ tree: isCorePiece(piece.categories) ? coreTranslationTree : translationTree,
1616
+ translations
1617
+ });
1618
+ },
1619
+ pathsToTranslate: (categories) => {
1620
+ return isCorePiece(categories) ? [...pieceTranslation.pathsToValuesToTranslate, "displayName"] : pieceTranslation.pathsToValuesToTranslate;
1458
1621
  },
1459
1622
  /**Gets the piece metadata regardles of piece location (node_modules or dist), wasn't included inside piece.metadata() for backwards compatibility issues (if an old ap version installs a new piece it would fail)*/
1460
1623
  initializeI18n: async (pieceOutputPath) => {
@@ -1486,27 +1649,64 @@ const pieceTranslation = {
1486
1649
  "actions.*.props.*.displayName",
1487
1650
  "actions.*.props.*.description",
1488
1651
  "actions.*.props.*.options.options.*.label",
1652
+ "actions.*.propertyGroups.*.label",
1653
+ "actions.*.propertyGroups.*.description",
1489
1654
  "triggers.*.displayName",
1490
1655
  "triggers.*.description",
1491
1656
  "triggers.*.props.*.displayName",
1492
1657
  "triggers.*.props.*.description",
1493
- "triggers.*.props.*.options.options.*.label"
1658
+ "triggers.*.props.*.options.options.*.label",
1659
+ "triggers.*.propertyGroups.*.label",
1660
+ "triggers.*.propertyGroups.*.description"
1494
1661
  ]
1495
1662
  };
1496
- /**This function translates a property inside a piece, i.e description, displayName, etc...
1497
- *
1498
- * @param pieceModelOrProperty - The piece model or property to translate
1499
- * @param path - The path to the property to translate, i.e auth.username.displayName
1500
- * @param i18n - The i18n object
1501
- */
1502
- function translateProperty(pieceModelOrProperty, path, i18n) {
1503
- const parsedKeys = path.split(".");
1504
- if (parsedKeys[0] === "*") return Object.values(pieceModelOrProperty).forEach((item) => translateProperty(item, parsedKeys.slice(1).join("."), i18n));
1505
- const nextObject = pieceModelOrProperty[parsedKeys[0]];
1506
- if (!nextObject) return;
1507
- if (parsedKeys.length > 1) return translateProperty(nextObject, parsedKeys.slice(1).join("."), i18n);
1508
- const valueInI18n = i18n[pieceModelOrProperty[parsedKeys[0]].slice(0, 512)];
1509
- if (valueInI18n) pieceModelOrProperty[parsedKeys[0]] = valueInI18n;
1663
+ const translationTree = buildTree(pieceTranslation.pathsToTranslate());
1664
+ const coreTranslationTree = buildTree(pieceTranslation.pathsToTranslate(["CORE"]));
1665
+ function buildTree(paths) {
1666
+ return paths.reduce((tree, path) => addPath({
1667
+ tree,
1668
+ keys: path.split(".")
1669
+ }), {});
1670
+ }
1671
+ function isCorePiece(categories) {
1672
+ return categories?.includes("CORE") ?? false;
1673
+ }
1674
+ function addPath({ tree, keys: [key, ...rest] }) {
1675
+ return {
1676
+ ...tree,
1677
+ [key]: rest.length === 0 ? null : addPath({
1678
+ tree: tree[key] ?? {},
1679
+ keys: rest
1680
+ })
1681
+ };
1682
+ }
1683
+ function translateNode({ node, tree, translations }) {
1684
+ if (!isRecord(node)) return node;
1685
+ const changes = {};
1686
+ let changed = false;
1687
+ for (const [key, subtree] of Object.entries(tree)) for (const childKey of key === "*" ? Object.keys(node) : [key]) {
1688
+ const child = node[childKey];
1689
+ const translated = subtree === null ? translateValue({
1690
+ value: child,
1691
+ translations
1692
+ }) : translateNode({
1693
+ node: child,
1694
+ tree: subtree,
1695
+ translations
1696
+ });
1697
+ if (translated !== child) {
1698
+ changes[childKey] = translated;
1699
+ changed = true;
1700
+ }
1701
+ }
1702
+ return changed ? Object.assign(Array.isArray(node) ? [] : {}, node, changes) : node;
1703
+ }
1704
+ function translateValue({ value, translations }) {
1705
+ if (typeof value !== "string") return value;
1706
+ return translations[value.slice(0, 512)] || value;
1707
+ }
1708
+ function isRecord(value) {
1709
+ return typeof value === "object" && value !== null;
1510
1710
  }
1511
1711
  async function fileExists(filePath) {
1512
1712
  try {
@@ -1534,7 +1734,8 @@ const readLocaleFile = async (locale, pieceOutputPath) => {
1534
1734
  //#region upstream/framework/lib/test/index.ts
1535
1735
  function createMockActionContext(params) {
1536
1736
  return {
1537
- executionType: "BEGIN",
1737
+ executionType: params.resumePayload ? "RESUME" : "BEGIN",
1738
+ resumePayload: params.resumePayload,
1538
1739
  auth: void 0,
1539
1740
  propsValue: params.propsValue,
1540
1741
  store: {
@@ -1549,14 +1750,32 @@ function createMockActionContext(params) {
1549
1750
  publicUrl: "http://localhost:4200",
1550
1751
  token: "test-token"
1551
1752
  },
1552
- files: { write: async () => "test-file-url" },
1753
+ files: {
1754
+ write: async () => "test-file-url",
1755
+ upload: async () => ({
1756
+ id: "test-file-id",
1757
+ url: "test-file-url"
1758
+ })
1759
+ },
1553
1760
  output: { update: async () => {} },
1554
1761
  agent: { tools: async () => ({}) },
1555
1762
  run: {
1556
1763
  id: "test-run-id",
1764
+ canPause: params.canPause ?? true,
1557
1765
  stop: () => {},
1558
1766
  pause: () => {},
1559
- respond: () => {}
1767
+ respond: () => {},
1768
+ createWaitpoint: async (waitpoint) => {
1769
+ params.onCreateWaitpoint?.(waitpoint);
1770
+ return {
1771
+ id: "test-waitpoint-id",
1772
+ resumeUrl: "http://localhost:3000/resume",
1773
+ buildResumeUrl: () => "http://localhost:3000/resume"
1774
+ };
1775
+ },
1776
+ waitForWaitpoint: (waitpointId) => {
1777
+ params.onWaitForWaitpoint?.(waitpointId);
1778
+ }
1560
1779
  },
1561
1780
  project: {
1562
1781
  id: "test-project-id",
@@ -1587,13 +1806,91 @@ function createMockPollingTriggerContext(params) {
1587
1806
  }
1588
1807
 
1589
1808
  //#endregion
1590
- //#region src/powerhouse/context.ts
1591
- function reactorOf(ctx) {
1592
- const reactor = ctx !== null && typeof ctx === "object" ? ctx.reactor : void 0;
1593
- if (!reactor) throw new Error("ctx.reactor is not available: this piece is not running on a Powerhouse reactor");
1594
- return reactor;
1809
+ //#region src/powerhouse/create.ts
1810
+ function createAction(params) {
1811
+ const { requireReactor, defaultTimeoutSeconds, defaultRetry, ...rest } = params;
1812
+ return withDefaults(withDeclaration(createAction$1(rest), requireReactor), {
1813
+ defaultTimeoutSeconds,
1814
+ defaultRetry
1815
+ });
1816
+ }
1817
+ function withDefaults(action, { defaultTimeoutSeconds, defaultRetry }) {
1818
+ if (defaultTimeoutSeconds !== void 0) {
1819
+ if (!Number.isFinite(defaultTimeoutSeconds) || defaultTimeoutSeconds <= 0) throw new Error(`defaultTimeoutSeconds must be a positive number, got ${JSON.stringify(defaultTimeoutSeconds)}`);
1820
+ Object.assign(action, { defaultTimeoutSeconds });
1821
+ }
1822
+ if (defaultRetry !== void 0) {
1823
+ const attempts = defaultRetry.maxAttempts;
1824
+ if (!Number.isInteger(attempts) || attempts < 1) throw new Error(`defaultRetry.maxAttempts must be a positive integer, got ${JSON.stringify(attempts)}`);
1825
+ Object.assign(action, { defaultRetry });
1826
+ }
1827
+ return action;
1828
+ }
1829
+ function createTrigger(params) {
1830
+ const { requireReactor, ...rest } = params;
1831
+ return withDeclaration(createTrigger$1(rest), requireReactor);
1832
+ }
1833
+ function withDeclaration(block, requireReactor) {
1834
+ if (requireReactor === void 0 || requireReactor === false) return block;
1835
+ if (requireReactor !== "read" && requireReactor !== "write") throw new Error(`requireReactor must be "read", "write" or false, got ${JSON.stringify(requireReactor)}`);
1836
+ return Object.assign(block, { requireReactor });
1837
+ }
1838
+
1839
+ //#endregion
1840
+ //#region src/powerhouse/property.ts
1841
+ const Property = {
1842
+ ...Property$1,
1843
+ Dropdown(request) {
1844
+ return Property$1.Dropdown(request);
1845
+ },
1846
+ MultiSelectDropdown(request) {
1847
+ return Property$1.MultiSelectDropdown(request);
1848
+ },
1849
+ DynamicProperties(request) {
1850
+ return Property$1.DynamicProperties(request);
1851
+ }
1852
+ };
1853
+
1854
+ //#endregion
1855
+ //#region src/powerhouse/errors.ts
1856
+ const ReactorJobPendingError = "ReactorJobPendingError";
1857
+ const ReactorJobFailedError = "ReactorJobFailedError";
1858
+ const ReactorActionsFailedError = "ReactorActionsFailedError";
1859
+ const ReactorAccessDeniedError = "ReactorAccessDeniedError";
1860
+ const ReactorRequestClosedError = "ReactorRequestClosedError";
1861
+ const DocumentModelUnavailableError = "DocumentModelUnavailableError";
1862
+ const DENIED_ACTION_INDEXES = "denied action indexes: ";
1863
+ function deniedActionIndexes(error) {
1864
+ const { name, message } = error ?? {};
1865
+ if (name !== "ReactorAccessDeniedError" || typeof message !== "string") return;
1866
+ const at = message.lastIndexOf(DENIED_ACTION_INDEXES);
1867
+ if (at < 0) return void 0;
1868
+ const match = /^\[(\d+(?:,\d+)*)\]$/.exec(message.slice(at + 23));
1869
+ return match ? match[1].split(",").map(Number) : void 0;
1870
+ }
1871
+ function assertActionsApplied(job, actions) {
1872
+ const outcomes = job.result?.actions ?? [];
1873
+ const byId = new Map(outcomes.map((outcome) => [outcome.actionId, outcome]));
1874
+ const failed = (actions?.map((action) => ({
1875
+ id: action.id,
1876
+ label: action.type
1877
+ })) ?? outcomes.map(({ actionId }) => ({
1878
+ id: actionId,
1879
+ label: actionId
1880
+ }))).flatMap(({ id, label }) => {
1881
+ const outcome = byId.get(id);
1882
+ if (!outcome) return [`Action ${label} produced no operation`];
1883
+ if (outcome.kind === "reducer-error") return [`Action ${label} failed: ${outcome.message}`];
1884
+ if (outcome.kind === "denied") return [`Action ${label} was denied: ${outcome.reason}`];
1885
+ return [];
1886
+ });
1887
+ if (failed.length > 0) {
1888
+ const error = new Error(failed.join("; "));
1889
+ error.name = ReactorActionsFailedError;
1890
+ throw error;
1891
+ }
1595
1892
  }
1596
1893
 
1597
1894
  //#endregion
1598
- export { ACTIVEPIECES_CHAT_TIERS, AGENT_STEP_TEST_TIMEOUT_MS, AGENT_STEP_TIMEOUT_MS, AIProviderModel, AIProviderName, AIProviderWithoutSensitiveData, AI_PROVIDER_CAPABILITIES, ActionBase, ActionClassification, AgentFlowTool, AgentKnowledgeBaseTool, AgentMcpTool, AgentOutputField, AgentOutputFieldType, AgentPieceProps, AgentStepBlock, AgentTaskStatus, AgentTool, AgentToolType, AiMetadata, ApFile, AppConnectionType, ArrayProperty, ArraySubProps, Audience, AzureProviderConfig, BaseAIProviderAuthConfig, BasePropertySchema, BasicAuthProperty, BasicAuthPropertyValue, BedrockProviderAuthConfig, BedrockProviderConfig, ChatFormResponse, CheckboxProperty, CloudflareGatewayProviderConfig, ContentBlockType, ContextVersion, CreateRecordsRequest, CreateTableWebhookRequest, CustomAuthProperty, CustomProperty, DEDUPE_KEY_PROPERTY, DEFAULT_CHAT_TIER_ID, DEFAULT_CONNECTION_DISPLAY_NAME, DateRangePreset, DateRangeProperty, DateRangeValue, DateTimeProperty, DropdownOption, DropdownProperty, DropdownState, DynamicProp, DynamicProperties, DynamicPropsValue, ErrorHandlingOptionsParam, ExecutionToolStatus, ExecutionType, ExportTableResponse, FAIL_PARENT_ON_FAILURE_HEADER, Field, FieldType, FileProperty, FileResponseInterface, Filter, FilterOperator, FlowStatus, FlowTriggerType, GetProviderConfigResponse, HumanInputFormResult, HumanInputFormResultTypes, IAction, ITrigger, InputProperty, InputPropertyMap, JsonProperty, KnowledgeBaseSourceType, LATEST_CONTEXT_VERSION, ListRecordsRequest, ListTablesRequest, LongTextProperty, MINIMUM_SUPPORTED_RELEASE_AFTER_LATEST_CONTEXT_VERSION, MarkdownContentBlock, MarkdownVariant, McpAuthConfig, McpAuthType, McpProperty, McpPropertyType, McpProtocol, McpTrigger, MultiSelectDropdownProperty, NumberProperty, OAuth2AuthorizationMethod, OAuth2GrantType, OAuth2Property, OAuth2PropertyValue, OAuth2Props, OIDCProperty, OPENAI_COMPATIBLE_VENDOR_BASE_URLS, ObjectProperty, OpenAICompatibleProviderConfig, OpenAiCompatibleVendorConfig, PARENT_RUN_ID_HEADER, Piece, PieceAuth, PieceAuthProperty, PieceBase, PieceCategory, PieceMetadata, PieceMetadataModel, PieceMetadataModelSummary, PieceMetadataSummary, PiecePackageInformation, PieceProperty, PiecePropertyMap, PieceServerContextError, PopulatedRecord, Project, ProjectAIProvider, Property, PropertyGroup, PropertyGroupDisplay, PropertyType, RAW_PAYLOAD_HEADER, READ_ONLY_CLASSIFICATIONS, RichTextProperty, SecretTextProperty, SeekPage, ShortTextProperty, StaticDropdownEmptyOption, StaticDropdownProperty, StaticMultiSelectDropdownProperty, StopResponse, StoreScope, TASK_COMPLETION_TOOL_NAME, Table, TableWebhookEventType, ToolCallContentBlock, ToolCallStatus, ToolCallType, TriggerBase, TriggerStrategy, USE_DRAFT_QUERY_PARAM_NAME, UpdateRecordRequest, VertexProviderAuthConfig, VertexProviderConfig, WebhookHandshakeStrategy, WebhookRenewConfiguration, WebhookRenewStrategy, apId, assertNotNullOrUndefined, backwardCompatabilityContextUtils, buildAuthHeaders, camelCase, chunk, createAction, createKeyForFormInput, createMockActionContext, createMockPollingTriggerContext, createPiece, createTrigger, dateRangeUtils, getAuthPropertyForValue, getEffectiveProviderAndModel, isEmpty, isNil, isNotUndefined, isPieceServerContextError, isReadOnlyClassification, isString, kebabCase, mcpToolNameUtils, normalizeToolOutputToExecuteResponse, pickBy, piecePropertiesUtils, pieceTranslation, reactorOf, splitCloudflareGatewayModelId, spreadIfDefined, startCase, tryCatch, unique };
1895
+ export { ACTIVEPIECES_CHAT_TIERS, ACTIVEPIECES_IMAGE_TIERS, AGENT_STEP_TEST_TIMEOUT_MS, AGENT_STEP_TIMEOUT_MS, AIProviderModel, AIProviderName, AIProviderWithoutSensitiveData, AI_PROVIDER_CAPABILITIES, ActionBase, ActionClassification, AgentFlowTool, AgentKnowledgeBaseTool, AgentMcpTool, AgentOutputField, AgentOutputFieldType, AgentPieceProps, AgentStepBlock, AgentTaskStatus, AgentTool, AgentToolType, AiMetadata, AiStepAction, ApFile, AppConnectionType, ArrayProperty, ArraySubProps, Audience, AzureProviderConfig, BaseAIProviderAuthConfig, BasePropertySchema, BasicAuthProperty, BasicAuthPropertyValue, BedrockProviderAuthConfig, BedrockProviderConfig, ChatFormResponse, CheckboxProperty, CloudflareGatewayProviderConfig, ContentBlockType, ContextVersion, CreateRecordsRequest, CreateTableWebhookRequest, CustomAuthProperty, CustomProperty, DEDUPE_KEY_PROPERTY, DEFAULT_CHAT_TIER_ID, DEFAULT_CONNECTION_DISPLAY_NAME, DENIED_ACTION_INDEXES, DateRangePreset, DateRangeProperty, DateRangeValue, DateTimeProperty, DocumentModelUnavailableError, DropdownOption, DropdownProperty, DropdownState, DynamicProp, DynamicProperties, DynamicPropsValue, ErrorHandlingOptionsParam, ExecutionToolStatus, ExecutionType, ExportTableResponse, FAIL_PARENT_ON_FAILURE_HEADER, Field, FieldType, FileProperty, FileResponseInterface, Filter, FilterOperator, FlowStatus, FlowTriggerType, GetProviderConfigResponse, HumanInputFormResult, HumanInputFormResultTypes, IAction, ITrigger, InputProperty, InputPropertyMap, JsonProperty, KnowledgeBaseSourceType, LATEST_CONTEXT_VERSION, ListRecordsRequest, ListTablesRequest, LongTextProperty, MINIMUM_SUPPORTED_RELEASE_AFTER_LATEST_CONTEXT_VERSION, MarkdownContentBlock, MarkdownVariant, McpAuthConfig, McpAuthType, McpProperty, McpPropertyType, McpProtocol, McpTrigger, MultiSelectDropdownProperty, NumberProperty, OAuth2AuthorizationMethod, OAuth2Discovery, OAuth2GrantType, OAuth2Property, OAuth2PropertyValue, OAuth2Props, OIDCProperty, OPENAI_COMPATIBLE_VENDOR_BASE_URLS, ObjectProperty, OpenAICompatibleProviderConfig, OpenAiCompatibleVendorConfig, PARENT_RUN_ID_HEADER, Piece, PieceAuth, PieceAuthProperty, PieceBase, PieceCategory, PieceMetadata, PieceMetadataModel, PieceMetadataModelSummary, PieceMetadataSummary, PiecePackageInformation, PieceProperty, PiecePropertyMap, PieceServerContextError, PopulatedRecord, Project, ProjectAIProvider, Property, PropertyGroup, PropertyGroupDisplay, PropertyType, RAW_PAYLOAD_HEADER, READ_ONLY_CLASSIFICATIONS, ReactorAccessDeniedError, ReactorActionsFailedError, ReactorJobFailedError, ReactorJobPendingError, ReactorRequestClosedError, RichTextProperty, SecretTextProperty, SeekPage, ShortTextProperty, StaticDropdownEmptyOption, StaticDropdownProperty, StaticMultiSelectDropdownProperty, StopResponse, StoreScope, TASK_COMPLETION_TOOL_NAME, Table, TableWebhookEventType, ToolCallContentBlock, ToolCallStatus, ToolCallType, TriggerBase, TriggerStrategy, USE_DRAFT_QUERY_PARAM_NAME, UpdateRecordRequest, VertexProviderAuthConfig, VertexProviderConfig, WebhookHandshakeStrategy, WebhookRenewConfiguration, WebhookRenewStrategy, aiProviderUtils, apId, assertActionsApplied, assertNotNullOrUndefined, backwardCompatabilityContextUtils, buildAuthHeaders, camelCase, chunk, createAction, createKeyForFormInput, createMockActionContext, createMockPollingTriggerContext, createPiece, createTrigger, dateRangeUtils, deniedActionIndexes, getAuthPropertyForValue, getEffectiveProviderAndModel, isEmpty, isNil, isNotUndefined, isPieceServerContextError, isReadOnlyClassification, isString, kebabCase, mcpToolNameUtils, normalizeToolOutputToExecuteResponse, pickBy, piecePropertiesUtils, pieceTranslation, sanitizeHttpHeaders, splitCloudflareGatewayModelId, spreadIfDefined, startCase, tryCatch, unique };
1599
1896
  //# sourceMappingURL=index.js.map