Add Activepieces integration for workflow automation

- Add Activepieces fork with SmoothSchedule custom piece
- Create integrations app with Activepieces service layer
- Add embed token endpoint for iframe integration
- Create Automations page with embedded workflow builder
- Add sidebar visibility fix for embed mode
- Add list inactive customers endpoint to Public API
- Include SmoothSchedule triggers: event created/updated/cancelled
- Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
poduck
2025-12-18 22:59:37 -05:00
parent 9848268d34
commit 3aa7199503
16292 changed files with 1284892 additions and 4708 deletions

View File

@@ -0,0 +1,33 @@
{
"extends": [
"../../../../.eslintrc.base.json"
],
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {}
},
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"rules": {}
}
]
}

View File

@@ -0,0 +1,7 @@
# pieces-prompthub
This library was generated with [Nx](https://nx.dev).
## Building
Run `nx build pieces-prompthub` to build the library.

View File

@@ -0,0 +1,11 @@
{
"name": "@activepieces/piece-prompthub",
"version": "0.0.2",
"type": "commonjs",
"main": "./src/index.js",
"types": "./src/index.d.ts",
"dependencies": {
"tslib": "^2.3.0",
"zod": "^3.22.4"
}
}

View File

@@ -0,0 +1,65 @@
{
"name": "pieces-prompthub",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/pieces/community/prompthub/src",
"projectType": "library",
"release": {
"version": {
"manifestRootsToUpdate": [
"dist/{projectRoot}"
],
"currentVersionResolver": "git-tag",
"fallbackCurrentVersionResolver": "disk"
}
},
"tags": [],
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": [
"{options.outputPath}"
],
"options": {
"outputPath": "dist/packages/pieces/community/prompthub",
"tsConfig": "packages/pieces/community/prompthub/tsconfig.lib.json",
"packageJson": "packages/pieces/community/prompthub/package.json",
"main": "packages/pieces/community/prompthub/src/index.ts",
"assets": [
"packages/pieces/community/prompthub/*.md",
{
"input": "packages/pieces/community/prompthub/src/i18n",
"output": "./src/i18n",
"glob": "**/!(i18n.json)"
}
],
"buildableProjectDepsInPackageJsonType": "dependencies",
"updateBuildableProjectDepsInPackageJson": true
},
"dependsOn": [
"^build",
"prebuild"
]
},
"nx-release-publish": {
"options": {
"packageRoot": "dist/{projectRoot}"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": [
"{options.outputFile}"
]
},
"prebuild": {
"executor": "nx:run-commands",
"options": {
"cwd": "packages/pieces/community/prompthub",
"command": "bun install --no-save --silent"
},
"dependsOn": [
"^build"
]
}
}
}

View File

@@ -0,0 +1,61 @@
{
"Integrate with PromptHub projects, retrieve heads, and run prompts.": "Integrieren Sie mit PromptHub Projekten, holen Sie Heads, und starten Sie Prompts.",
"PromptHub API token": "PromptHub API token",
"List Projects": "Projekte auflisten",
"Get Project Head": "Projektleiter holen",
"Run Prompt": "Aufforderung ausführen",
"Custom API Call": "Eigener API-Aufruf",
"List PromptHub projects for a team. Returns information about each project's head revision and groups.": "Liste die Projekte von PromptHub für ein Team auf. Gibt Informationen über die Hauptversionen und Gruppen jedes Projekts zurück.",
"Get the production-ready version of a PromptHub project (typically the last commit on master/main branch). Useful for integrating prompts into your application.": "Holen Sie sich die produktionsfertige Version eines PromptHub Projekts (typischerweise der letzte Commit im Hauptbereich). Nützlich für die Integration von Eingaben in Ihre Anwendung.",
"Run a PromptHub project with optional variables, branch/hash, and chat payload": "Führen Sie ein PromptHub-Projekt mit optionalen Variablen, Branch/Hash und Chat-Payload aus",
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
"Team ID": "Team-ID",
"Group Name": "Gruppenname",
"Model": "Modell",
"Provider": "Anbieter",
"Project ID": "Projekt-ID",
"Branch": "Zweig",
"Use Fallback": "Fallback verwenden",
"Variables": "Variablen",
"Hash": "Hash",
"Messages": "Nachrichten",
"Prompt": "Prompt",
"Metadata": "Metadaten",
"Timeout Seconds": "Timeout Sekunden",
"Method": "Methode",
"Headers": "Kopfzeilen",
"Query Parameters": "Abfrageparameter",
"Body": "Körper",
"Response is Binary ?": "Antwort ist binär?",
"No Error on Failure": "Kein Fehler bei Fehler",
"Timeout (in seconds)": "Timeout (in Sekunden)",
"The ID of the team. Can be found in your browser's URL bar when viewing Team Settings, or use current_team_id from /me endpoint.": "Die ID des Teams. Kann in der URL-Leiste Ihres Browsers gefunden werden, wenn Sie die Team-Einstellungen ansehen, oder verwenden Sie current_team_id von /me Endpunkt.",
"Filter projects from a specific group. Must be URL-encoded if the group name contains spaces.": "Projekte aus einer bestimmten Gruppe filtern. Muss URL-kodiert sein, wenn der Gruppenname Leerzeichen enthält.",
"Filter projects where the head uses a specific model (e.g., gpt-4, claude-2, etc.).": "Projekte filtern, bei denen der Kopf ein bestimmtes Modell verwendet (z.B. gpt-4, claude-2, etc.).",
"Filter projects where the head uses a specific model provider.": "Projekte filtern, bei denen der Kopf einen bestimmten Modellanbieter verwendet.",
"The ID of the project. Can be found in your browser's URL bar when viewing that project.": "Die ID des Projekts. Kann in der URL-Leiste Ihres Browsers gefunden werden, wenn dieses Projekt angezeigt wird.",
"Use the head of a specific branch. Defaults to your project's master/main branch. Must be URL-encoded if the branch name contains spaces or special characters.": "Verwenden Sie den Kopf eines bestimmten Zweigs. Standard ist der Master/Hauptzweig Ihres Projekts. Muss URL-kodiert sein, wenn der Branchenname Leerzeichen oder Sonderzeichen enthält.",
"When enabled, any placeholders not provided in variables will fall back to your Project/Team defaults. Your variable overrides always take precedence.": "Wenn diese Option aktiviert ist, werden alle Platzhalter, die nicht in Variablen angegeben sind, auf Ihre Projekt/Team-Standardwerte zurückfallen. Die Überschreibungen der Variablen haben immer Vorrang.",
"Key-value pairs to override placeholders in the prompt. Both keys and values will be URL-encoded automatically.": "Schlüssel-Wert-Paare, um Platzhalter in der Prompt zu überschreiben. Sowohl Schlüssel als auch Werte werden automatisch URL-kodiert.",
"The ID of the project to run.": "Die ID des zu ausführenden Projekts.",
"The branch name to run from (defaults to main/master).": "Der zu verwendende Branchenname (Standardeinstellung für main/master).",
"Specific commit hash to run from.": "Spezifischer Commit-Hash, von dem aus ausgeführt werden soll.",
"Key-value pairs to pass as variables to the prompt.": "Schlüssel-Wert-Paare, die als Variablen an die Eingabeaufforderung übergeben werden.",
"Chat messages for chat-based projects.": "Chat-Nachrichten für Chat-basierte Projekte.",
"Override prompt text for the project.": "Text für das Projekt überschreiben.",
"Additional metadata to include with the run.": "Zusätzliche Metadaten, die dem Run hinzugefügt werden sollen.",
"Request timeout in seconds (max 600).": "Timeout in Sekunden (max 600).",
"Authorization headers are injected automatically from your connection.": "Autorisierungs-Header werden automatisch von Ihrer Verbindung injiziert.",
"Enable for files like PDFs, images, etc..": "Aktivieren für Dateien wie PDFs, Bilder, etc..",
"OpenAI": "OpenAI",
"Anthropic": "Anthropisch",
"Azure": "Azure",
"Google": "Google",
"Amazon": "Amazonas",
"GET": "ERHALTEN",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "LÖSCHEN",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,61 @@
{
"Integrate with PromptHub projects, retrieve heads, and run prompts.": "Integre con proyectos PromptHub, recupere cabeceras y ejecute indicaciones.",
"PromptHub API token": "PromptHub API token",
"List Projects": "Lista de proyectos",
"Get Project Head": "Obtener jefe de proyecto",
"Run Prompt": "Ejecutar aviso",
"Custom API Call": "Llamada API personalizada",
"List PromptHub projects for a team. Returns information about each project's head revision and groups.": "Listar proyectos PromptHub para un equipo. Devuelve información sobre la revisión principal de cada proyecto y grupos.",
"Get the production-ready version of a PromptHub project (typically the last commit on master/main branch). Useful for integrating prompts into your application.": "Obtenga la versión lista de producción de un proyecto PromptHub (normalmente el último commit en la rama maestro/principal). Útil para integrar peticiones en su aplicación.",
"Run a PromptHub project with optional variables, branch/hash, and chat payload": "Ejecutar un proyecto PromptHub con variables opcionales, rama/hash y payload de chat",
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
"Team ID": "ID de equipo",
"Group Name": "Nombre del grupo",
"Model": "Modelo",
"Provider": "Proveedor",
"Project ID": "ID del proyecto",
"Branch": "Rama",
"Use Fallback": "Usar Fallback",
"Variables": "Variables",
"Hash": "Hash",
"Messages": "Mensajes",
"Prompt": "Petición",
"Metadata": "Metadatos",
"Timeout Seconds": "Segundos de tiempo agotado",
"Method": "Método",
"Headers": "Encabezados",
"Query Parameters": "Parámetros de consulta",
"Body": "Cuerpo",
"Response is Binary ?": "¿Respuesta es binaria?",
"No Error on Failure": "No hay ningún error en fallo",
"Timeout (in seconds)": "Tiempo de espera (en segundos)",
"The ID of the team. Can be found in your browser's URL bar when viewing Team Settings, or use current_team_id from /me endpoint.": "El ID del equipo. Se puede encontrar en la barra de URL de tu navegador al ver Configuración del equipo, o usar current_team_id desde el extremo /me.",
"Filter projects from a specific group. Must be URL-encoded if the group name contains spaces.": "Filtrar proyectos de un grupo específico. Debe ser una URL codificada si el nombre del grupo contiene espacios.",
"Filter projects where the head uses a specific model (e.g., gpt-4, claude-2, etc.).": "Filtrar proyectos donde el jefe utiliza un modelo específico (por ejemplo, gpt-4, claude-2, etc.).",
"Filter projects where the head uses a specific model provider.": "Proyectos de filtro donde el jefe utiliza un proveedor de modelos específico.",
"The ID of the project. Can be found in your browser's URL bar when viewing that project.": "El ID del proyecto. Se puede encontrar en la barra de URL de tu navegador al ver ese proyecto.",
"Use the head of a specific branch. Defaults to your project's master/main branch. Must be URL-encoded if the branch name contains spaces or special characters.": "Utilice la cabeza de una rama específica. Por defecto en la rama maestra/principal de su proyecto. Debe estar codificado en URL si el nombre de la rama contiene espacios o caracteres especiales.",
"When enabled, any placeholders not provided in variables will fall back to your Project/Team defaults. Your variable overrides always take precedence.": "Cuando está habilitado, cualquier marcador de posición no proporcionado en las variables caerá de nuevo a los valores predeterminados de Project/Team. Su sobreescritura de variables siempre tiene precedencia.",
"Key-value pairs to override placeholders in the prompt. Both keys and values will be URL-encoded automatically.": "Pares de valor de clave para anular los marcadores de posición en la indicación. Tanto las claves como los valores serán codificados automáticamente por URL.",
"The ID of the project to run.": "El ID del proyecto a ejecutar.",
"The branch name to run from (defaults to main/master).": "El nombre de la rama desde la que se ejecutará (por defecto en main/master).",
"Specific commit hash to run from.": "Hashh de commit específico desde donde correr.",
"Key-value pairs to pass as variables to the prompt.": "Los pares clave y valor para pasar como variables al intérprete.",
"Chat messages for chat-based projects.": "Mensajes de chat para proyectos basados en chat.",
"Override prompt text for the project.": "Anular el texto del prompt para el proyecto.",
"Additional metadata to include with the run.": "Metadatos adicionales a incluir con la ejecución.",
"Request timeout in seconds (max 600).": "Tiempo de espera de solicitud en segundos (máx. 600).",
"Authorization headers are injected automatically from your connection.": "Las cabeceras de autorización se inyectan automáticamente desde tu conexión.",
"Enable for files like PDFs, images, etc..": "Activar para archivos como PDFs, imágenes, etc.",
"OpenAI": "OpenAI",
"Anthropic": "Antrópico",
"Azure": "Azure",
"Google": "Google",
"Amazon": "Amazonas",
"GET": "RECOGER",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "BORRAR",
"HEAD": "LIMPIO"
}

View File

@@ -0,0 +1,61 @@
{
"Integrate with PromptHub projects, retrieve heads, and run prompts.": "Intégrez des projets PromptHub, récupérez des têtes et exécutez des invite de commandes.",
"PromptHub API token": "PromptHub API token",
"List Projects": "Lister les projets",
"Get Project Head": "Obtenir le responsable du projet",
"Run Prompt": "Exécuter la requête",
"Custom API Call": "Appel d'API personnalisé",
"List PromptHub projects for a team. Returns information about each project's head revision and groups.": "Liste des projets PromptHub pour une équipe. Renvoie des informations sur la révision et les groupes du chef de chaque projet.",
"Get the production-ready version of a PromptHub project (typically the last commit on master/main branch). Useful for integrating prompts into your application.": "Récupère la version prête à la production d'un projet PromptHub (généralement le dernier commit sur la branche maître/principale). Utile pour intégrer les invites dans votre application.",
"Run a PromptHub project with optional variables, branch/hash, and chat payload": "Exécutez un projet PromptHub avec des variables optionnelles, une branche/hash et une charge utile de chat",
"Make a custom API call to a specific endpoint": "Passer un appel API personnalisé à un endpoint spécifique",
"Team ID": "ID d'équipe",
"Group Name": "Nom du groupe",
"Model": "Modélisation",
"Provider": "Fournisseur",
"Project ID": "ID du projet",
"Branch": "Branch",
"Use Fallback": "Utiliser la fonction de repli",
"Variables": "Variables",
"Hash": "Hachage",
"Messages": "Messages",
"Prompt": "Prompt",
"Metadata": "Métadonnées",
"Timeout Seconds": "Délai d'attente des secondes",
"Method": "Méthode",
"Headers": "Headers",
"Query Parameters": "Paramètres de requête",
"Body": "Body",
"Response is Binary ?": "La réponse est Binaire ?",
"No Error on Failure": "Aucune erreur en cas d'échec",
"Timeout (in seconds)": "Délai d'expiration (en secondes)",
"The ID of the team. Can be found in your browser's URL bar when viewing Team Settings, or use current_team_id from /me endpoint.": "L'ID de l'équipe. Peut être trouvé dans la barre d'URL de votre navigateur lors de l'affichage des paramètres de l'équipe, ou utiliser current_team_id depuis /me terminal.",
"Filter projects from a specific group. Must be URL-encoded if the group name contains spaces.": "Filtrer les projets d'un groupe spécifique. Doit être encodé en URL si le nom du groupe contient des espaces.",
"Filter projects where the head uses a specific model (e.g., gpt-4, claude-2, etc.).": "Filtrer les projets où le propriétaire utilise un modèle spécifique (par exemple, gpt-4, claude-2, etc.).",
"Filter projects where the head uses a specific model provider.": "Filtrer les projets où la tête utilise un fournisseur de modèle spécifique.",
"The ID of the project. Can be found in your browser's URL bar when viewing that project.": "L'ID du projet. Peut être trouvé dans la barre d'URL de votre navigateur lors de la visualisation de ce projet.",
"Use the head of a specific branch. Defaults to your project's master/main branch. Must be URL-encoded if the branch name contains spaces or special characters.": "Utilisez la tête d'une branche spécifique. Par défaut, la branche maître/principale de votre projet. Elle doit être encodée en URL si le nom de la branche contient des espaces ou des caractères spéciaux.",
"When enabled, any placeholders not provided in variables will fall back to your Project/Team defaults. Your variable overrides always take precedence.": "Lorsque cette option est activée, tous les espaces réservés qui ne sont pas fournis dans les variables tomberont à la valeur par défaut de votre projet/équipe. Votre variable remplace toujours la priorité.",
"Key-value pairs to override placeholders in the prompt. Both keys and values will be URL-encoded automatically.": "Paires de valeur clé pour remplacer les espaces réservés dans l'invite de commande. Les clés et les valeurs seront encodées automatiquement par l'URL.",
"The ID of the project to run.": "L'ID du projet à exécuter.",
"The branch name to run from (defaults to main/master).": "Le nom de la branche à exécuter (valeur par défaut vers main/master).",
"Specific commit hash to run from.": "Hachage spécifique de la validation à partir duquel s'exécuter.",
"Key-value pairs to pass as variables to the prompt.": "Paires de valeur clé à passer comme variables à l'invite.",
"Chat messages for chat-based projects.": "Messages de chat pour les projets basés sur le chat.",
"Override prompt text for the project.": "Remplacer le texte de l'invite du projet.",
"Additional metadata to include with the run.": "Métadonnées supplémentaires à inclure dans l'exécution.",
"Request timeout in seconds (max 600).": "Délai d'attente de la requête en secondes (max 600).",
"Authorization headers are injected automatically from your connection.": "Les Headers d'autorisation sont injectés automatiquement à partir de votre connexion.",
"Enable for files like PDFs, images, etc..": "Activer pour les fichiers comme les PDFs, les images, etc.",
"OpenAI": "OpenAI",
"Anthropic": "Anthropique",
"Azure": "Azure",
"Google": "Google",
"Amazon": "Amazon",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,61 @@
{
"Integrate with PromptHub projects, retrieve heads, and run prompts.": "PromptHubプロジェクトと統合し、ヘッドを取得し、プロンプトを実行します。",
"PromptHub API token": "PromptHub API token",
"List Projects": "プロジェクト一覧",
"Get Project Head": "プロジェクトヘッドを取得",
"Run Prompt": "プロンプトの実行",
"Custom API Call": "カスタムAPI通話",
"List PromptHub projects for a team. Returns information about each project's head revision and groups.": "チームの PromptHub プロジェクトのリスト。各プロジェクトのリビジョンとグループに関する情報を返します。",
"Get the production-ready version of a PromptHub project (typically the last commit on master/main branch). Useful for integrating prompts into your application.": "PromptHub プロジェクトのプロダクション対応バージョンを取得します (通常はマスター/メインブランチの最後のコミットです)。アプリケーションにプロンプトを統合する際に便利です。",
"Run a PromptHub project with optional variables, branch/hash, and chat payload": "オプションの変数、ブランチ/ハッシュ、チャットペイロードを使用して PromptHub プロジェクトを実行します。",
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
"Team ID": "チームID",
"Group Name": "グループ名",
"Model": "モデル",
"Provider": "プロバイダー",
"Project ID": "プロジェクトID",
"Branch": "ブランチ",
"Use Fallback": "フォールバックを使用",
"Variables": "変数",
"Hash": "ハッシュ",
"Messages": "メッセージ",
"Prompt": "Prompt",
"Metadata": "メタデータ",
"Timeout Seconds": "タイムアウト秒",
"Method": "方法",
"Headers": "ヘッダー",
"Query Parameters": "クエリパラメータ",
"Body": "本文",
"Response is Binary ?": "応答はバイナリですか?",
"No Error on Failure": "失敗時にエラーはありません",
"Timeout (in seconds)": "タイムアウト(秒)",
"The ID of the team. Can be found in your browser's URL bar when viewing Team Settings, or use current_team_id from /me endpoint.": "チームのID。チーム設定を表示するときにブラウザのURLバーに表示されるか、/me エンドポイントから current_team_id を使用してください。",
"Filter projects from a specific group. Must be URL-encoded if the group name contains spaces.": "特定のグループからプロジェクトをフィルタリングします。グループ名にスペースが含まれている場合はURLエンコードされる必要があります。",
"Filter projects where the head uses a specific model (e.g., gpt-4, claude-2, etc.).": "ヘッドが特定のモデル (gpt-4、claude-2など) を使用するプロジェクトをフィルタリングします。",
"Filter projects where the head uses a specific model provider.": "ヘッドが特定のモデルプロバイダを使用するプロジェクトをフィルタリングします。",
"The ID of the project. Can be found in your browser's URL bar when viewing that project.": "プロジェクトのID。プロジェクトを表示するときにブラウザのURLバーに表示されます。",
"Use the head of a specific branch. Defaults to your project's master/main branch. Must be URL-encoded if the branch name contains spaces or special characters.": "特定のブランチの先頭を使用します。デフォルトはプロジェクトのmaster/main ブランチです。ブランチ名にスペースまたは特殊文字が含まれている場合は URL エンコードされている必要があります。",
"When enabled, any placeholders not provided in variables will fall back to your Project/Team defaults. Your variable overrides always take precedence.": "有効にすると、変数に指定されていないプレースホルダがプロジェクト/チームのデフォルトに戻ります。変数のオーバーライドは常に優先されます。",
"Key-value pairs to override placeholders in the prompt. Both keys and values will be URL-encoded automatically.": "キーと値のペアは、プロンプト内のプレースホルダを上書きします。キーと値の両方は、自動的にURLエンコードされます。",
"The ID of the project to run.": "実行するプロジェクトの ID。",
"The branch name to run from (defaults to main/master).": "実行するブランチ名 (デフォルトは main/master)。",
"Specific commit hash to run from.": "実行する特定のコミットハッシュ。",
"Key-value pairs to pass as variables to the prompt.": "キーと値をペアとして変数としてプロンプトに渡します。",
"Chat messages for chat-based projects.": "チャットベースのプロジェクトのチャットメッセージ。",
"Override prompt text for the project.": "プロジェクトのプロンプトテキストを上書きします。",
"Additional metadata to include with the run.": "実行に含める追加のメタデータ。",
"Request timeout in seconds (max 600).": "リクエストタイムアウト秒最大600",
"Authorization headers are injected automatically from your connection.": "認証ヘッダは接続から自動的に注入されます。",
"Enable for files like PDFs, images, etc..": "PDF、画像などのファイルを有効にします。",
"OpenAI": "OpenAI",
"Anthropic": "Anthropic",
"Azure": "Azure",
"Google": "Google",
"Amazon": "Amazon",
"GET": "取得",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "削除",
"HEAD": "頭"
}

View File

@@ -0,0 +1,61 @@
{
"Integrate with PromptHub projects, retrieve heads, and run prompts.": "Integreer met PromptHub projecten, haal hoofden op en voer aanwijzingen uit.",
"PromptHub API token": "PromptHub API token",
"List Projects": "Projecten weergeven",
"Get Project Head": "Project Hoofd verkrijgen",
"Run Prompt": "Voer vraag uit",
"Custom API Call": "Custom API Call",
"List PromptHub projects for a team. Returns information about each project's head revision and groups.": "Lijst van PromptHub projecten voor een team. Retourneert informatie over de hoofdherziening en groepen van elk project.",
"Get the production-ready version of a PromptHub project (typically the last commit on master/main branch). Useful for integrating prompts into your application.": "Krijg de productie-klaar versie van een PromptHub project (meestal de laatste commit voor meester/hoofdbranch). Handig voor het integreren van aanwijzingen in je applicatie.",
"Run a PromptHub project with optional variables, branch/hash, and chat payload": "Voer een PromptHub project uit met optionele variabelen, branch/hash en chat payload",
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
"Team ID": "Team ID",
"Group Name": "Groep Naam",
"Model": "Model",
"Provider": "Leverancier",
"Project ID": "Project ID",
"Branch": "Filiaal",
"Use Fallback": "Gebruik Terugval",
"Variables": "Variabelen",
"Hash": "Toegangssleutel",
"Messages": "berichten",
"Prompt": "Prompt",
"Metadata": "Metagegevens",
"Timeout Seconds": "Time-out seconden",
"Method": "Methode",
"Headers": "Kopteksten",
"Query Parameters": "Query parameters",
"Body": "Lichaam",
"Response is Binary ?": "Antwoord is binair?",
"No Error on Failure": "Geen fout bij fout",
"Timeout (in seconds)": "Time-out (in seconden)",
"The ID of the team. Can be found in your browser's URL bar when viewing Team Settings, or use current_team_id from /me endpoint.": "De ID van het team. Kan worden gevonden in de URL-balk van uw browser tijdens het bekijken van teaminstellingen, of gebruik current_team_id van /me eindpunt.",
"Filter projects from a specific group. Must be URL-encoded if the group name contains spaces.": "Projecten filteren vanuit een specifieke groep. Moet een URL-gecodeerd zijn als de groepsnaam spaties bevat.",
"Filter projects where the head uses a specific model (e.g., gpt-4, claude-2, etc.).": "Filter projecten waar de kop een specifiek model gebruikt (bijv. gpt-4, claude-2, etc.).",
"Filter projects where the head uses a specific model provider.": "Projecten filteren waar de kop een specifieke modelaanbieder gebruikt.",
"The ID of the project. Can be found in your browser's URL bar when viewing that project.": "De ID van het project. Kan worden gevonden in de URL-balk van uw browser tijdens het bekijken van dat project.",
"Use the head of a specific branch. Defaults to your project's master/main branch. Must be URL-encoded if the branch name contains spaces or special characters.": "Gebruik het hoofd van een specifieke branch. Standaard ingesteld op de meester/hoofdtak van uw project. Moet een URL-gecodeerd zijn als de branchnaam spaties of speciale tekens bevat.",
"When enabled, any placeholders not provided in variables will fall back to your Project/Team defaults. Your variable overrides always take precedence.": "Wanneer ingeschakeld, vallen alle tijdelijke aanduidingen die niet zijn opgegeven in variabelen terug naar uw Project/Team standaarden. Uw variabele overschrijft krijgt altijd voorrang.",
"Key-value pairs to override placeholders in the prompt. Both keys and values will be URL-encoded automatically.": "Key-waarde paren om placeholders in de prompte overschrijven. Zowel sleutels als waarden worden automatisch URL-gecodeerd.",
"The ID of the project to run.": "De ID van het uit te voeren project.",
"The branch name to run from (defaults to main/master).": "De branchnaam om uit te voeren (standaard op main/master).",
"Specific commit hash to run from.": "Specifieke commit hash om vanuit uit te voeren.",
"Key-value pairs to pass as variables to the prompt.": "Sleutelwaarde paren om als variabelen door te geven aan de prompt.",
"Chat messages for chat-based projects.": "Chat berichten voor chat-gebaseerde projecten.",
"Override prompt text for the project.": "Overschrijf prompte tekst voor het project.",
"Additional metadata to include with the run.": "Aanvullende metadata om op te nemen met de run.",
"Request timeout in seconds (max 600).": "Verzoek time-out in seconden (max 600).",
"Authorization headers are injected automatically from your connection.": "Autorisatie headers worden automatisch geïnjecteerd vanuit uw verbinding.",
"Enable for files like PDFs, images, etc..": "Inschakelen voor bestanden zoals PDF's, afbeeldingen etc..",
"OpenAI": "OpenAI",
"Anthropic": "Anthropische",
"Azure": "Azure",
"Google": "Google",
"Amazon": "Amazone",
"GET": "KRIJG",
"POST": "POSTE",
"PATCH": "BEKIJK",
"PUT": "PUT",
"DELETE": "VERWIJDEREN",
"HEAD": "HOOFD"
}

View File

@@ -0,0 +1,61 @@
{
"Integrate with PromptHub projects, retrieve heads, and run prompts.": "Integrar com projetos do PromptHub, recuperar cabeçalhos e executar avisos.",
"PromptHub API token": "PromptHub API token",
"List Projects": "Listar Projetos",
"Get Project Head": "Obter Cabeça do Projeto",
"Run Prompt": "Executar Confirmação",
"Custom API Call": "Chamada de API personalizada",
"List PromptHub projects for a team. Returns information about each project's head revision and groups.": "Listar projetos do PromptHub para uma equipe. Retorna informações sobre a revisão e grupos frontais de cada projeto.",
"Get the production-ready version of a PromptHub project (typically the last commit on master/main branch). Useful for integrating prompts into your application.": "Obtém a versão pronta para produção de um projeto PromptHub (normalmente o último commit no ramo master/principal). Útil para integração de prompts em seu aplicativo.",
"Run a PromptHub project with optional variables, branch/hash, and chat payload": "Execute um projeto PromptHub com variáveis opcionais, ramificação/hash e carregamento de bate-papo",
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
"Team ID": "ID da Equipe",
"Group Name": "Nome do Grupo",
"Model": "Modelo",
"Provider": "Fornecedor",
"Project ID": "ID do Projeto",
"Branch": "Ramificação",
"Use Fallback": "Usar Fallback",
"Variables": "Variáveis",
"Hash": "Hash",
"Messages": "mensagens",
"Prompt": "Aviso",
"Metadata": "Metadados",
"Timeout Seconds": "Tempo limite secundário",
"Method": "Método",
"Headers": "Cabeçalhos",
"Query Parameters": "Parâmetros da consulta",
"Body": "Conteúdo",
"Response is Binary ?": "A resposta é binária ?",
"No Error on Failure": "Nenhum erro no Failure",
"Timeout (in seconds)": "Tempo limite (em segundos)",
"The ID of the team. Can be found in your browser's URL bar when viewing Team Settings, or use current_team_id from /me endpoint.": "A ID da equipe. Pode ser encontrada na barra de URL do seu navegador quando estiver visualizando as Configurações da Equipe, ou use o current_team_id do terminal /me.",
"Filter projects from a specific group. Must be URL-encoded if the group name contains spaces.": "Filtrar projetos de um grupo específico. Deve ser codificado em URL se o nome do grupo conter espaços.",
"Filter projects where the head uses a specific model (e.g., gpt-4, claude-2, etc.).": "Filtrar projetos onde a cabeça usa um modelo específico (por exemplo, gpt-4, claude-2, etc.).",
"Filter projects where the head uses a specific model provider.": "Filtra projetos onde a cabeça usa um provedor modelo específico.",
"The ID of the project. Can be found in your browser's URL bar when viewing that project.": "A ID do projeto. Pode ser encontrada na barra de URL do navegador ao visualizar este projeto.",
"Use the head of a specific branch. Defaults to your project's master/main branch. Must be URL-encoded if the branch name contains spaces or special characters.": "Use o cabeçalho de um ramo específico. O padrão é o master/principal do seu projeto. Deve ser codificado em URL se o nome do ramo conter espaços ou caracteres especiais.",
"When enabled, any placeholders not provided in variables will fall back to your Project/Team defaults. Your variable overrides always take precedence.": "Quando ativado, quaisquer espaços reservados não fornecidos em variáveis voltarão para o padrão do seu Projeto/Equipe. Sua variável substitui sempre tem prioridade.",
"Key-value pairs to override placeholders in the prompt. Both keys and values will be URL-encoded automatically.": "Pares chave-valor para substituir espaços reservados no prompt. Ambas chaves e valores serão codificados automaticamente na URL.",
"The ID of the project to run.": "O ID do projeto a ser executado.",
"The branch name to run from (defaults to main/master).": "O nome da branch a ser executado (o padrão é main/master).",
"Specific commit hash to run from.": "Hash específico do commit para ser executado.",
"Key-value pairs to pass as variables to the prompt.": "Pares chave-valor para passar como variáveis para a prompt.",
"Chat messages for chat-based projects.": "Mensagens de bate-papo para projetos baseados em chat.",
"Override prompt text for the project.": "Substituir o texto do prompt para o projeto.",
"Additional metadata to include with the run.": "Metadados adicionais para incluir na execução.",
"Request timeout in seconds (max 600).": "Tempo limite do pedido em segundos (máx. 600).",
"Authorization headers are injected automatically from your connection.": "Os cabeçalhos de autorização são inseridos automaticamente a partir da sua conexão.",
"Enable for files like PDFs, images, etc..": "Habilitar para arquivos como PDFs, imagens, etc..",
"OpenAI": "OpenAI",
"Anthropic": "Antrópica",
"Azure": "Azure",
"Google": "Google",
"Amazon": "Amazônia",
"GET": "OBTER",
"POST": "POSTAR",
"PATCH": "COMPRAR",
"PUT": "COLOCAR",
"DELETE": "EXCLUIR",
"HEAD": "CABEÇA"
}

View File

@@ -0,0 +1,61 @@
{
"Integrate with PromptHub projects, retrieve heads, and run prompts.": "Integrate with PromptHub projects, retrieve heads, and run prompts.",
"PromptHub API token": "PromptHub API token",
"List Projects": "List Projects",
"Get Project Head": "Get Project Head",
"Run Prompt": "Run Prompt",
"Custom API Call": "Custom API Call",
"List PromptHub projects for a team. Returns information about each project's head revision and groups.": "List PromptHub projects for a team. Returns information about each project's head revision and groups.",
"Get the production-ready version of a PromptHub project (typically the last commit on master/main branch). Useful for integrating prompts into your application.": "Get the production-ready version of a PromptHub project (typically the last commit on master/main branch). Useful for integrating prompts into your application.",
"Run a PromptHub project with optional variables, branch/hash, and chat payload": "Run a PromptHub project with optional variables, branch/hash, and chat payload",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Team ID": "Team ID",
"Group Name": "Group Name",
"Model": "Model",
"Provider": "Provider",
"Project ID": "Project ID",
"Branch": "Branch",
"Use Fallback": "Use Fallback",
"Variables": "Variables",
"Hash": "Hash",
"Messages": "Messages",
"Prompt": "Prompt",
"Metadata": "Metadata",
"Timeout Seconds": "Timeout Seconds",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"The ID of the team. Can be found in your browser's URL bar when viewing Team Settings, or use current_team_id from /me endpoint.": "The ID of the team. Can be found in your browser's URL bar when viewing Team Settings, or use current_team_id from /me endpoint.",
"Filter projects from a specific group. Must be URL-encoded if the group name contains spaces.": "Filter projects from a specific group. Must be URL-encoded if the group name contains spaces.",
"Filter projects where the head uses a specific model (e.g., gpt-4, claude-2, etc.).": "Filter projects where the head uses a specific model (e.g., gpt-4, claude-2, etc.).",
"Filter projects where the head uses a specific model provider.": "Filter projects where the head uses a specific model provider.",
"The ID of the project. Can be found in your browser's URL bar when viewing that project.": "The ID of the project. Can be found in your browser's URL bar when viewing that project.",
"Use the head of a specific branch. Defaults to your project's master/main branch. Must be URL-encoded if the branch name contains spaces or special characters.": "Use the head of a specific branch. Defaults to your project's master/main branch. Must be URL-encoded if the branch name contains spaces or special characters.",
"When enabled, any placeholders not provided in variables will fall back to your Project/Team defaults. Your variable overrides always take precedence.": "When enabled, any placeholders not provided in variables will fall back to your Project/Team defaults. Your variable overrides always take precedence.",
"Key-value pairs to override placeholders in the prompt. Both keys and values will be URL-encoded automatically.": "Key-value pairs to override placeholders in the prompt. Both keys and values will be URL-encoded automatically.",
"The ID of the project to run.": "The ID of the project to run.",
"The branch name to run from (defaults to main/master).": "The branch name to run from (defaults to main/master).",
"Specific commit hash to run from.": "Specific commit hash to run from.",
"Key-value pairs to pass as variables to the prompt.": "Key-value pairs to pass as variables to the prompt.",
"Chat messages for chat-based projects.": "Chat messages for chat-based projects.",
"Override prompt text for the project.": "Override prompt text for the project.",
"Additional metadata to include with the run.": "Additional metadata to include with the run.",
"Request timeout in seconds (max 600).": "Request timeout in seconds (max 600).",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"OpenAI": "OpenAI",
"Anthropic": "Anthropic",
"Azure": "Azure",
"Google": "Google",
"Amazon": "Amazon",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,61 @@
{
"Integrate with PromptHub projects, retrieve heads, and run prompts.": "Integrate with PromptHub projects, retrieve heads, and run prompts.",
"PromptHub API token": "PromptHub API token",
"List Projects": "List Projects",
"Get Project Head": "Get Project Head",
"Run Prompt": "Run Prompt",
"Custom API Call": "自定义 API 呼叫",
"List PromptHub projects for a team. Returns information about each project's head revision and groups.": "List PromptHub projects for a team. Returns information about each project's head revision and groups.",
"Get the production-ready version of a PromptHub project (typically the last commit on master/main branch). Useful for integrating prompts into your application.": "Get the production-ready version of a PromptHub project (typically the last commit on master/main branch). Useful for integrating prompts into your application.",
"Run a PromptHub project with optional variables, branch/hash, and chat payload": "Run a PromptHub project with optional variables, branch/hash, and chat payload",
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
"Team ID": "Team ID",
"Group Name": "Group Name",
"Model": "Model",
"Provider": "Provider",
"Project ID": "Project ID",
"Branch": "分支",
"Use Fallback": "Use Fallback",
"Variables": "Variables",
"Hash": "Hash",
"Messages": "Messages",
"Prompt": "Prompt",
"Metadata": "Metadata",
"Timeout Seconds": "Timeout Seconds",
"Method": "方法",
"Headers": "信头",
"Query Parameters": "查询参数",
"Body": "正文内容",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "失败时没有错误",
"Timeout (in seconds)": "超时(秒)",
"The ID of the team. Can be found in your browser's URL bar when viewing Team Settings, or use current_team_id from /me endpoint.": "The ID of the team. Can be found in your browser's URL bar when viewing Team Settings, or use current_team_id from /me endpoint.",
"Filter projects from a specific group. Must be URL-encoded if the group name contains spaces.": "Filter projects from a specific group. Must be URL-encoded if the group name contains spaces.",
"Filter projects where the head uses a specific model (e.g., gpt-4, claude-2, etc.).": "Filter projects where the head uses a specific model (e.g., gpt-4, claude-2, etc.).",
"Filter projects where the head uses a specific model provider.": "Filter projects where the head uses a specific model provider.",
"The ID of the project. Can be found in your browser's URL bar when viewing that project.": "The ID of the project. Can be found in your browser's URL bar when viewing that project.",
"Use the head of a specific branch. Defaults to your project's master/main branch. Must be URL-encoded if the branch name contains spaces or special characters.": "Use the head of a specific branch. Defaults to your project's master/main branch. Must be URL-encoded if the branch name contains spaces or special characters.",
"When enabled, any placeholders not provided in variables will fall back to your Project/Team defaults. Your variable overrides always take precedence.": "When enabled, any placeholders not provided in variables will fall back to your Project/Team defaults. Your variable overrides always take precedence.",
"Key-value pairs to override placeholders in the prompt. Both keys and values will be URL-encoded automatically.": "Key-value pairs to override placeholders in the prompt. Both keys and values will be URL-encoded automatically.",
"The ID of the project to run.": "The ID of the project to run.",
"The branch name to run from (defaults to main/master).": "The branch name to run from (defaults to main/master).",
"Specific commit hash to run from.": "Specific commit hash to run from.",
"Key-value pairs to pass as variables to the prompt.": "Key-value pairs to pass as variables to the prompt.",
"Chat messages for chat-based projects.": "Chat messages for chat-based projects.",
"Override prompt text for the project.": "Override prompt text for the project.",
"Additional metadata to include with the run.": "Additional metadata to include with the run.",
"Request timeout in seconds (max 600).": "Request timeout in seconds (max 600).",
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"OpenAI": "OpenAI",
"Anthropic": "Anthropic",
"Azure": "Azure",
"Google": "Google",
"Amazon": "Amazon",
"GET": "获取",
"POST": "帖子",
"PATCH": "PATCH",
"PUT": "弹出",
"DELETE": "删除",
"HEAD": "黑色"
}

View File

@@ -0,0 +1,60 @@
import {
AuthenticationType,
HttpMethod,
createCustomApiCallAction,
httpClient,
} from '@activepieces/pieces-common';
import { PieceAuth, createPiece } from '@activepieces/pieces-framework';
import { listProjects } from './lib/actions/list-projects';
import { getProjectHead } from './lib/actions/get-project-head';
import { runPrompt } from './lib/actions/run-prompt';
export const prompthubAuth = PieceAuth.SecretText({
displayName: 'API Key',
description: 'PromptHub API token',
required: true,
validate: async (auth) => {
try {
await httpClient.sendRequest({
url: 'https://app.prompthub.us/api/v1/me',
method: HttpMethod.GET,
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: auth.auth as string,
},
timeout: 10000,
});
return { valid: true };
} catch (e) {
return {
valid: false,
error: 'Invalid API key or insufficient permissions',
};
}
},
});
export const prompthub = createPiece({
displayName: 'PromptHub',
description:
'Integrate with PromptHub projects, retrieve heads, and run prompts.',
auth: prompthubAuth,
minimumSupportedRelease: '0.63.0',
logoUrl: 'https://cdn.activepieces.com/pieces/prompthub.png',
authors: ['sparkybug'],
actions: [
listProjects,
getProjectHead,
runPrompt,
createCustomApiCallAction({
auth: prompthubAuth,
baseUrl: () => 'https://app.prompthub.us/api/v1',
authMapping: async (auth) => {
return {
authorization: `Bearer ${auth.secret_text}`,
};
},
}),
],
triggers: [],
});

View File

@@ -0,0 +1,52 @@
import { propsValidation } from '@activepieces/pieces-common';
import { createAction } from '@activepieces/pieces-framework';
import { PromptHubClient } from '../common/client';
import { getProjectHeadProps, getProjectHeadSchema, sanitizeVariables } from '../common/props';
import { prompthubAuth } from '../..';
export const getProjectHead = createAction({
name: 'get_project_head',
displayName: 'Get Project Head',
description: 'Get the production-ready version of a PromptHub project (typically the last commit on master/main branch). Useful for integrating prompts into your application.',
props: getProjectHeadProps,
auth: prompthubAuth,
async run({ auth, propsValue }) {
await propsValidation.validateZod(propsValue, getProjectHeadSchema);
const client = new PromptHubClient(auth.secret_text);
const q: Record<string, any> = {};
if (propsValue['branch']) {
q['branch'] = propsValue['branch'];
}
if (propsValue['fallback'] !== undefined) {
q['fallback'] = propsValue['fallback'] ? 1 : 0;
}
const vars = sanitizeVariables(propsValue['variables'] ?? {});
for (const [k, v] of Object.entries(vars)) {
q[`variables[${encodeURIComponent(k)}]`] = encodeURIComponent(String(v));
}
const result = await client.getProjectHead(propsValue['projectId'], q);
const data = result?.data ?? result;
return {
id: data?.id,
provider: data?.provider,
model: data?.model,
prompt: data?.prompt,
system_message: data?.system_message,
formatted_request: data?.formatted_request,
hash: data?.hash,
commit_title: data?.commit_title,
commit_description: data?.commit_description,
variables: data?.variables,
project: data?.project,
branch: data?.branch,
configuration: data?.configuration,
};
},
});

View File

@@ -0,0 +1,47 @@
import { propsValidation } from '@activepieces/pieces-common';
import { createAction } from '@activepieces/pieces-framework';
import { PromptHubClient } from '../common/client';
import { listProjectsProps, listProjectsSchema } from '../common/props';
import { prompthubAuth } from '../..';
export const listProjects = createAction({
name: 'list_projects',
displayName: 'List Projects',
description: 'List PromptHub projects for a team. Returns information about each project\'s head revision and groups.',
props: listProjectsProps,
auth: prompthubAuth,
async run({ auth, propsValue }) {
await propsValidation.validateZod(propsValue, listProjectsSchema);
const client = new PromptHubClient(auth.secret_text);
const result = await client.listProjects(propsValue['teamId'], {
group: propsValue['group'],
model: propsValue['model'],
provider: propsValue['provider'],
});
const data = result?.data ?? result;
return Array.isArray(data)
? data.map((p: any) => ({
id: p.id,
name: p.name,
description: p.description,
head: p.head ? {
provider: p.head.provider,
model: p.head.model,
prompt: p.head.prompt,
system_message: p.head.system_message,
formatted_request: p.head.formatted_request,
hash: p.head.hash,
commit_title: p.head.commit_title,
commit_description: p.head.commit_description,
variables: p.head.variables,
branch: p.head.branch,
configuration: p.head.configuration,
} : null,
groups: p.groups || [],
}))
: data;
},
});

View File

@@ -0,0 +1,29 @@
import { propsValidation } from '@activepieces/pieces-common';
import { createAction } from '@activepieces/pieces-framework';
import { PromptHubClient } from '../common/client';
import { runPromptProps, runPromptSchema, sanitizeVariables } from '../common/props';
import { prompthubAuth } from '../..';
export const runPrompt = createAction({
name: 'run_prompt',
displayName: 'Run Prompt',
description: 'Run a PromptHub project with optional variables, branch/hash, and chat payload',
props: runPromptProps,
auth: prompthubAuth,
async run({ auth, propsValue }) {
await propsValidation.validateZod(propsValue, runPromptSchema);
const client = new PromptHubClient(auth.secret_text);
const body: Record<string, any> = {};
if (propsValue['branch']) body['branch'] = propsValue['branch'];
if (propsValue['hash']) body['hash'] = propsValue['hash'];
if (propsValue['variables']) body['variables'] = sanitizeVariables(propsValue['variables']);
if (propsValue['messages']) body['messages'] = propsValue['messages'];
if (propsValue['prompt']) body['prompt'] = propsValue['prompt'];
if (propsValue['metadata']) body['metadata'] = propsValue['metadata'];
const timeoutMs = propsValue['timeoutSeconds'] ? propsValue['timeoutSeconds'] * 1000 : undefined;
const result = await client.runProject(propsValue['projectId'], body, timeoutMs);
return result?.data ?? result;
},
});

View File

@@ -0,0 +1,139 @@
import { httpClient, HttpMethod, HttpRequest, AuthenticationType } from '@activepieces/pieces-common';
export interface PromptHubClientOptions {
baseUrl?: string;
timeoutMs?: number;
maxRetries?: number;
initialBackoffMs?: number;
}
export class PromptHubClient {
private readonly baseUrl: string;
private readonly timeoutMs: number;
private readonly maxRetries: number;
private readonly initialBackoffMs: number;
constructor(private readonly apiKey: string, options?: PromptHubClientOptions) {
this.baseUrl = (options?.baseUrl ?? 'https://app.prompthub.us/api/v1').replace(/\/$/, '');
this.timeoutMs = options?.timeoutMs ?? 30000;
this.maxRetries = options?.maxRetries ?? 3;
this.initialBackoffMs = options?.initialBackoffMs ?? 500;
}
async validateToken(): Promise<boolean> {
try {
await this.get('/me');
return true;
} catch (e: any) {
if (e?.statusCode === 401 || e?.statusCode === 403) return false;
throw e;
}
}
async listProjects(teamId: number, query?: Record<string, string | number | boolean | undefined>) {
return this.get(`/teams/${teamId}/projects`, query);
}
async getProjectHead(projectId: number, query?: Record<string, string | number | boolean | undefined>) {
return this.get(`/projects/${projectId}/head`, query);
}
async runProject(projectId: number, body: any, timeoutMs?: number) {
return this.post(`/projects/${projectId}/run`, body, timeoutMs);
}
private async get(path: string, query?: Record<string, string | number | boolean | undefined>) {
const url = `${this.baseUrl}${path}`;
const req: HttpRequest = {
method: HttpMethod.GET,
url,
queryParams: this.buildQuery(query),
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: this.apiKey,
},
timeout: this.timeoutMs,
headers: {
Accept: 'application/json',
},
};
return this.sendWithRetry(req);
}
private async post(path: string, body: unknown, timeoutOverrideMs?: number) {
const url = `${this.baseUrl}${path}`;
const req: HttpRequest = {
method: HttpMethod.POST,
url,
body,
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: this.apiKey,
},
timeout: timeoutOverrideMs ?? this.timeoutMs,
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
},
};
return this.sendWithRetry(req);
}
private async sendWithRetry(request: HttpRequest): Promise<any> {
let attempt = 0;
let lastError: any;
while (attempt <= this.maxRetries) {
try {
const res = await httpClient.sendRequest<any>(request);
const status = res.status ?? 200;
if (status >= 200 && status < 300) {
return res.body;
}
const error = new Error(`PromptHub API error ${status}`) as any;
error.statusCode = status;
error.body = res.body;
throw error;
} catch (err: any) {
lastError = err;
const status = err?.statusCode ?? err?.status;
const isRateLimit = status === 429;
const isAuth = status === 401 || status === 403;
const isServer = status >= 500 && status < 600;
if (isAuth) {
err.message = 'Unauthorized or forbidden. Check PromptHub token and permissions (team/project access).';
throw err;
}
if (!(isRateLimit || isServer)) {
throw err;
}
if (attempt === this.maxRetries) {
break;
}
const backoff = this.exponentialBackoffWithJitter(attempt);
await this.sleep(backoff);
attempt++;
}
}
throw lastError;
}
private buildQuery(query?: Record<string, string | number | boolean | undefined>): Record<string, string> | undefined {
if (!query) return undefined;
const out: Record<string, string> = {};
Object.entries(query).forEach(([k, v]) => {
if (v === undefined || v === null) return;
out[k] = String(v);
});
return out;
}
private exponentialBackoffWithJitter(attempt: number): number {
const base = this.initialBackoffMs * Math.pow(2, attempt);
const jitter = Math.floor(Math.random() * this.initialBackoffMs);
return base + jitter;
}
private sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
}

View File

@@ -0,0 +1,156 @@
import { Property } from '@activepieces/pieces-framework';
import z, { ZodTypeAny } from 'zod';
export const listProjectsProps = {
teamId: Property.Number({
displayName: 'Team ID',
description: 'The ID of the team. Can be found in your browser\'s URL bar when viewing Team Settings, or use current_team_id from /me endpoint.',
required: true
}),
group: Property.ShortText({
displayName: 'Group Name',
description: 'Filter projects from a specific group. Must be URL-encoded if the group name contains spaces.',
required: false
}),
model: Property.ShortText({
displayName: 'Model',
description: 'Filter projects where the head uses a specific model (e.g., gpt-4, claude-2, etc.).',
required: false,
}),
provider: Property.StaticDropdown({
displayName: 'Provider',
description: 'Filter projects where the head uses a specific model provider.',
required: false,
options: {
options: [
{ label: 'OpenAI', value: 'OpenAI' },
{ label: 'Anthropic', value: 'Anthropic' },
{ label: 'Azure', value: 'Azure' },
{ label: 'Google', value: 'Google' },
{ label: 'Amazon', value: 'Amazon' },
],
},
}),
};
export const getProjectHeadProps = {
projectId: Property.Number({
displayName: 'Project ID',
description: 'The ID of the project. Can be found in your browser\'s URL bar when viewing that project.',
required: true
}),
branch: Property.ShortText({
displayName: 'Branch',
description: 'Use the head of a specific branch. Defaults to your project\'s master/main branch. Must be URL-encoded if the branch name contains spaces or special characters.',
required: false
}),
fallback: Property.Checkbox({
displayName: 'Use Fallback',
description: 'When enabled, any placeholders not provided in variables will fall back to your Project/Team defaults. Your variable overrides always take precedence.',
required: false
}),
variables: Property.Object({
displayName: 'Variables',
description: 'Key-value pairs to override placeholders in the prompt. Both keys and values will be URL-encoded automatically.',
required: false
}),
};
export const runPromptProps = {
projectId: Property.Number({
displayName: 'Project ID',
description: 'The ID of the project to run.',
required: true
}),
branch: Property.ShortText({
displayName: 'Branch',
description: 'The branch name to run from (defaults to main/master).',
required: false
}),
hash: Property.ShortText({
displayName: 'Hash',
description: 'Specific commit hash to run from.',
required: false
}),
variables: Property.Object({
displayName: 'Variables',
description: 'Key-value pairs to pass as variables to the prompt.',
required: false
}),
messages: Property.Array({
displayName: 'Messages',
description: 'Chat messages for chat-based projects.',
required: false,
properties: {
role: Property.StaticDropdown({
displayName: 'Role',
required: true,
options: {
options: [
{ label: 'system', value: 'system' },
{ label: 'user', value: 'user' },
{ label: 'assistant', value: 'assistant' },
],
},
}),
content: Property.LongText({ displayName: 'Content', required: true }),
},
}),
prompt: Property.LongText({
displayName: 'Prompt',
description: 'Override prompt text for the project.',
required: false
}),
metadata: Property.Object({
displayName: 'Metadata',
description: 'Additional metadata to include with the run.',
required: false
}),
timeoutSeconds: Property.Number({
displayName: 'Timeout Seconds',
description: 'Request timeout in seconds (max 600).',
required: false
}),
};
export const listProjectsSchema: Record<string, ZodTypeAny> = {
teamId: z.number().int().positive(),
group: z.string().optional(),
};
export const getProjectHeadSchema: Record<string, ZodTypeAny> = {
projectId: z.number().int().positive(),
branch: z.string().optional(),
variables: z.record(z.any()).optional(),
fallback: z.boolean().optional(),
};
export const runPromptSchema: Record<string, ZodTypeAny> = {
projectId: z.number().int().positive(),
branch: z.string().optional(),
hash: z.string().optional(),
variables: z.record(z.any()).optional(),
messages: z.array(z.object({
role: z.enum(['system', 'user', 'assistant']),
content: z.string(),
})).optional(),
prompt: z.string().optional(),
metadata: z.record(z.any()).optional(),
timeoutSeconds: z.number().int().positive().max(600).optional(),
};
export function sanitizeVariables(vars: Record<string, unknown>): Record<string, string | number | boolean | null> {
const out: Record<string, string | number | boolean | null> = {};
for (const [k, v] of Object.entries(vars)) {
if (v === undefined) continue;
if (typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || v === null) {
out[k] = v;
} else if (typeof v === 'object') {
out[k] = JSON.stringify(v);
} else {
out[k] = String(v);
}
}
return out;
}

View File

@@ -0,0 +1,20 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"importHelpers": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}

View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"]
}