Commit Graph

265 Commits

Author SHA1 Message Date
Yeuoly 242e58790c plugin example: telegram (#219)
* chore: switch telegram trigger icon to svg

* fix: inline telegram trigger schemas

* chore: expand telegram trigger schemas
2025-10-17 17:16:01 +08:00
Yeuoly b9ac72257e Expand Slack trigger to full Events API catalog (#217)
* Expand Slack trigger to full Events API catalog

* Remove Slack trigger subscription constructor

* Remove Slack event selection from subscription schema

* Use official Slack icon asset

* Stop reading Slack signing secret from constructor parameters

* chore: remove tead_id
2025-10-17 16:44:43 +08:00
Harry 14ad64b064 chore: bump GitHub trigger plugin version to 1.3.5
- Updated version in manifest.yaml from 1.3.1 to 1.3.5 to reflect recent changes.
2025-10-16 17:41:08 +08:00
Harry 6220b50946 chore: update GitHub trigger plugin version and remove deprecated issue comment events
- Bumped version from 1.3.0 to 1.3.1 in the manifest.
- Removed deprecated issue comment events: issue_comment_created, issue_comment_edited, issue_comment_deleted.
- Consolidated issue comment handling into a unified structure for better maintainability.
- Updated README to reflect changes in event handling and provide clearer setup instructions.
2025-10-16 17:39:50 +08:00
Harry 7dcaee5bc4 refactor: remove star created and deleted events from GitHub trigger
- Deleted the StarCreatedEvent and StarDeletedEvent classes along with their corresponding YAML configurations.
- Updated the GitHub trigger provider to simplify star event handling by consolidating to a single star event type.

These changes streamline the event structure and improve maintainability.
2025-10-15 17:31:48 +08:00
Yeuoly 199affa82b lark readme 2025-10-15 13:25:08 +08:00
Yeuoly a9230eeecc fix 2025-10-14 20:57:50 +08:00
Yeuoly ea2542fe9a feat: add comprehensive Lark event support (VC, meeting room, tasks)
- Added video conference (VC) events:
  - meeting_started_v1, meeting_ended_v1
  - join_meeting_v1, leave_meeting_v1
  - recording_started_v1, recording_ended_v1, recording_ready_v1
- Added meeting room events:
  - meeting_room_created_v1
  - meeting_room_status_changed_v1
- Added task events:
  - task_updated_v1
  - task_comment_updated_v1
- Added calendar and contact events:
  - calendar_changed_v4
  - scope_updated_v3
- Added Bitable events:
  - file_bitable_record_changed_v1
  - file_bitable_field_changed_v1

All events properly check SDK fields and use correct data structures.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 16:42:03 +08:00
Yeuoly 83cd0ee184 feat: implement 11 new Lark trigger events and convert JSON outputs to proper data structures
- Add IM/Chat events: message_receive_v1, message_reaction_deleted_v1, chat_member_user_withdrawn_v1, chat_member_bot_added_v1, chat_member_bot_deleted_v1
- Add Drive events: file_read_v1, file_title_updated_v1
- Convert all JSON string outputs to proper arrays/objects across all events
- Update YAML schemas to use proper data types (array, object, number) instead of strings
- Fix data structure handling for department_ids, user lists, and complex nested objects
- Register all new events in provider with appropriate handlers

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 16:16:50 +08:00
Yeuoly e7314cc0b2 feat: implement additional Lark trigger events
- Add P2ImMessageRecalledV1 event for message recall notifications
- Add P2ContactUserDeletedV3 event for employee deletion/departure
- Add P2DriveFileTrashedV1 event for file trash operations
- Fix department_ids to be array type instead of string in user_deleted_v3
- Register all new events in provider and add handler methods
- Check actual Lark SDK fields for proper data extraction

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 15:53:58 +08:00
Yeuoly 5f90901bd5 feat: implement new Lark trigger events for chat disbanded and updated
- Add P2ImChatDisbandedV1 event handler for when chats are disbanded
- Add P2ImChatUpdatedV1 event handler for chat information updates
- Register new events in provider and add to event list
- Check and use actual Lark SDK fields for proper data extraction

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 15:47:58 +08:00
Yeuoly a42c364266 fix: remove leaked and unimplemented event registrations from Lark provider
- Remove p2p_chat_entered event registration (no handler file exists)
- Remove p2p_im_chat_member_bot_added_v1 event registration (no handler file exists)
- Fix calendar event name to match file naming (event_changed_v4 instead of calendar_event_changed_v4)
- Clean up unused imports for removed event types

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 15:41:00 +08:00
Yeuoly bf745c933e refactor: update Lark trigger YAML descriptions to use I18nObject format
- Remove human/llm nested structure from description fields
- Convert to direct I18nObject format with language codes as keys
- Update all 19 event YAML files across approval, calendar, contact, drive, and IM events
- Align with new SDK trigger description format requirements

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 15:38:13 +08:00
Yeuoly 076f4864bc refactor: update Lark trigger events to use new dispatch_single_event interface
- Replace direct lark.EventDispatcherHandler.builder usage with dispatch_single_event helper
- Update lambda syntax from callback pattern to direct method reference
- Change department_created_v3 YAML to use array types instead of JSON strings
- Remove redundant imports and boilerplate code across all event handlers
- Improve consistency across IM, contact, calendar, approval, and drive events

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 15:21:51 +08:00
Yeuoly 78cf1aab39 refactor: add generics to lark dispatch helper (#216) 2025-10-14 14:50:44 +08:00
Harry 5fd7b4676f chore: bump GitHub trigger plugin version to 1.3.0 and update dify_plugin version to 0.6.0b11
- Updated the version in manifest.yaml from 1.2.2 to 1.3.0.
- Updated the version of dify_plugin from 0.6.0b9 to 0.6.0b11 in requirements.txt.

These changes ensure the plugin is up-to-date with the latest versions.
2025-10-14 11:30:36 +08:00
Yeuoly 2d32c0feaa refactor: de-duplicate lark event dispatcher setup (#215)
* refactor: reuse lark event dispatch setup

* fix: expose structured lark trigger payloads

* Update python/examples/lark_trigger/events/contact/user_updated_v3.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update python/examples/lark_trigger/events/contact/user_updated_v3.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update python/examples/lark_trigger/events/contact/user_updated_v3.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update python/examples/lark_trigger/events/contact/user_updated_v3.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update python/examples/lark_trigger/events/contact/user_updated_v3.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-10-14 11:23:05 +08:00
Harry 9bbbf70423 refactor: update event description type and clean up YAML files
- Changed the type of the event description in EventConfiguration from EventDescription to I18nObject for better internationalization support.
- Updated related test cases to reflect this change.
- Simplified the description fields in various issue and star event YAML files by removing redundant human and llm sections, retaining only the essential translations.

These changes enhance the clarity and maintainability of event configurations and improve support for multiple languages.
2025-10-13 20:48:51 +08:00
Yeuoly c0c30d9378 feat: add comprehensive Lark trigger events implementation
Add Lark/Feishu webhook trigger with 10 event handlers:
- IM events: messages, member changes, reactions, read receipts
- Calendar events: event changes
- Approval events: approval status updates
- Drive events: file creation
- Contact events: employee onboarding, department creation

All events properly extract fields from Lark SDK models with:
- Explicit field declarations (no __dict__ usage)
- Correct data types (integers/booleans preserved)
- Human-friendly labels in EN/ZH/JA languages
- Organized subdirectory structure by domain

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-13 19:10:15 +08:00
Harry e526acc498 refactor: enhance subscription handling in PluginExecutor and related classes
- Added subscription handling to the EventRuntime and TriggerInvokeEventRequest classes, improving the management of event subscriptions.
- Updated the PluginExecutor to include subscription details when invoking events, ensuring better integration with subscription-based workflows.
- Modified test cases to reflect the new subscription structure, enhancing test coverage and reliability.

These changes improve the overall functionality and clarity of the subscription system within the plugin.
2025-10-13 18:12:54 +08:00
Harry 0f7d824c66 refactor: update OAuth provider instance retrieval and enhance type annotations
- Modified the `_get_oauth_provider_instance` method in `PluginExecutor` to accept a `Session` parameter and return the appropriate OAuth provider instance.
- Updated the `get_supported_oauth_provider_cls` method in `PluginRegistration` to `get_supported_oauth_provider`, improving its signature and functionality.
- Enhanced type annotations across methods to improve clarity and type safety.

These changes streamline the OAuth provider handling and improve code maintainability.
2025-10-11 21:55:36 +08:00
Harry 8103c9e6ac chore: bump GitHub trigger plugin version to 1.2.1 and add time_range parameter
- Updated the version in manifest.yaml from 1.1.3 to 1.2.1.
- Added a new optional parameter 'time_range' in star_created.yaml to allow triggering based on a specified time range for stars.

These changes ensure the plugin is up-to-date and enhance the configurability of the star event trigger.
2025-10-11 21:19:46 +08:00
Harry 8cdd62509d refactor: enhance trigger subscription handling and improve type annotations
- Updated the PluginExecutor and related classes to improve type annotations and clarity, particularly in methods handling OAuth credentials and trigger subscriptions.
- Refactored the PluginRegistration and TriggerFactory classes to streamline the retrieval of trigger providers and event handlers, ensuring better type safety and consistency.
- Adjusted the YAML loader function to specify return types, enhancing code readability and maintainability.

These changes improve the overall structure and usability of the trigger subscription system, making it more robust and easier to understand.
2025-10-11 21:09:12 +08:00
Harry d6fa7bfb7e chore: bump dify_plugin version to 0.6.0b7 and update trigger event handling
- Updated the version in pyproject.toml from 0.6.0b6 to 0.6.0b7.
- Renamed trigger-related methods and classes for clarity, changing invoke_trigger to invoke_trigger_event and updating associated request and response classes.
- Adjusted event handling in the GithubTrigger class to improve event dispatching.

These changes ensure the plugin is up-to-date and enhance the clarity and functionality of event handling.
2025-10-10 19:31:28 +08:00
Harry fa3af0641d chore: bump GitHub trigger plugin version to 1.1.2 and fix event naming
- Updated the version in manifest.yaml from 1.1.1 to 1.1.2.
- Changed the event naming in GithubTrigger class from 'issues_{action}' to 'issue_{action}' for consistency.

These changes ensure the plugin version is up-to-date and improve the clarity of event handling.
2025-10-10 18:49:00 +08:00
Harry ec9bb73fbe refactor: streamline trigger imports and enhance plugin registration logic
- Simplified import statements across various files by reordering and consolidating imports for better readability.
- Refactored the PluginRegistration class to improve the clarity of the configuration handling logic, ensuring more concise checks for subscription constructors.

These changes enhance code maintainability and readability throughout the plugin structure.
2025-10-10 14:31:49 +08:00
Harry db8d26ba3d refactor: enhance GitHub trigger event handling and configuration
- Updated the GitHub trigger implementation to improve type annotations and clarity in the GithubSubscriptionConstructor class.
- Removed the obsolete _resolve_webhook_events method to streamline event resolution.
- Expanded the YAML configuration to include a comprehensive list of available GitHub events for subscriptions, enhancing user configurability.

These changes improve the maintainability and usability of the GitHub trigger functionality.
2025-10-10 14:29:09 +08:00
Harry 656037254e chore: bump dify_plugin version to 0.6.0b6 in pyproject.toml
- Updated the version of dify_plugin from 0.6.0b5 to 0.6.0b6 in pyproject.toml.

This change ensures that the project dependencies are aligned with the latest plugin version.
2025-10-10 13:10:44 +08:00
Harry 2cdfedd73a chore: bump dify_plugin version to 0.6.0b5 in pyproject.toml and requirements.txt
- Updated the version of dify_plugin from 0.6.0b4 to 0.6.0b5 in both pyproject.toml and requirements.txt.

This change ensures that the project dependencies are aligned with the latest plugin version.
2025-10-09 17:45:15 +08:00
Harry aba2f88492 refactor: update event handling and parameter types in GitHub trigger
- Introduced new event mappings for issue comments in the GithubTrigger class, enhancing event handling capabilities.
- Updated the TriggerSubscribeRequest to allow for optional selected_events.
- Modified the YAML configuration to change the 'triggers' parameter to 'events' and added options for issue comments.

These changes improve the flexibility and clarity of event handling in the GitHub trigger implementation.
2025-10-09 17:44:44 +08:00
Harry 644b76ba6e feat: expand GitHub issue trigger events in provider
- Added new event mappings for issue closed, reopened, edited, labeled, unlabeled, assigned, and unassigned in the GithubTrigger class.
- Updated the YAML configuration to include the new events for subscription.

These changes enhance the GitHub trigger functionality by supporting a broader range of issue events, improving responsiveness to user interactions.
2025-10-09 16:52:45 +08:00
Harry c472010000 chore: update manifest and requirements for plugin version bump
- Adjusted the indentation in manifest.yaml for better YAML formatting.
- Bumped the dify_plugin version from 0.6.0b4 to 0.6.0b5 in requirements.txt.

These changes ensure the project reflects the latest plugin version and maintains proper configuration formatting.
2025-10-09 15:40:04 +08:00
Harry 3fe764c6d2 refactor: update terminology in PluginExecutor and TriggerDispatchResponse
- Renamed the 'triggers' attribute to 'events' in TriggerDispatchResponse for consistency with event terminology.
- Updated method signatures in IssueOpenedEvent to use Mapping instead of dict for better type clarity.

These changes enhance the coherence of the codebase and align with the recent terminology updates across the project.
2025-10-09 14:48:44 +08:00
Harry a9b6abf9fc refactor: update trigger and event terminology across the codebase
- Renamed classes and methods related to triggers to use "Event" terminology for consistency and clarity.
- Updated the PluginExecutor, PluginRegistration, and TriggerFactory to reflect the new event handling structure.
- Adjusted YAML configurations and example implementations to align with the new event definitions.
- Enhanced the .gitignore file to include .DS_Store and ensure cleaner project management.

These changes improve the overall coherence of the codebase and enhance the clarity of event-driven functionality.
2025-09-30 20:10:16 +08:00
Harry 891e678e3a fix: no argument when provider created for oauth & credential validation 2025-09-29 23:11:38 +08:00
Harry 641b27e76a chore: bump version to 0.6.0b2 in pyproject.toml and update requirements
- Updated the version of the dify_plugin from 0.6.0b1 to 0.6.0b2 in pyproject.toml.
- Adjusted the requirements.txt file to reflect the new plugin version.

These changes ensure that the project dependencies are aligned with the latest plugin version.
2025-09-29 19:00:01 +08:00
Harry 46b1ef471a refactor: streamline GitHub issue trigger implementation
- Removed the deprecated IssuesTrigger class and replaced it with a more focused IssueOpenedTrigger class to handle specific events when a new issue is opened.
- Updated the GitHub trigger YAML configuration to reflect changes in the subscription schema and parameters.
- Enhanced the validation logic for issue parameters, including title patterns, labels, assignees, authors, milestones, and body content.
- Improved the overall structure and clarity of the trigger implementation, ensuring better maintainability and functionality.

These changes contribute to a more efficient and organized handling of GitHub issue events, enhancing the plugin's responsiveness to user interactions.
2025-09-29 18:31:39 +08:00
Harry d75f734b7d feat: add checkbox parameter type to provider configuration
- Introduced a new CHECKBOX type in CommonParameterType to enhance parameter options.
- Updated ToolParameter and TriggerParameter classes to include the new CHECKBOX type.
- Modified the GitHub trigger manifest version to 1.1.0 and changed parameter type from select to checkbox in issues.yaml.

These changes improve the flexibility of parameter types available in the plugin, allowing for more diverse user interactions.
2025-09-29 14:29:38 +08:00
Yeuoly 420b2b6db1 refactor: improve code readability and organization
- Adjusted import order in request.py for consistency.
- Enhanced the description formatting in trigger.py for better clarity.
- Streamlined exception handling and method signatures in github.py for improved readability.
- Simplified dictionary construction in message_delivered.py to enhance clarity.
- Consolidated return statements in test_trigger_factory.py for better organization.

These changes contribute to a cleaner and more maintainable codebase, improving overall readability and consistency across the project.
2025-09-26 23:23:38 +08:00
Yeuoly 8d83234b83 fix: update GitHub trigger plugin configuration
- Removed the MAX_REQUEST_TIMEOUT parameter from the Plugin initialization for default behavior.
- Added a new section in the GitHub provider YAML file to specify the source of the Python implementation.

These changes simplify the plugin setup and enhance the configuration clarity for the GitHub trigger integration.
2025-09-26 23:17:40 +08:00
Yeuoly 3254019ec6 Add documentation and tests for trigger factory (#212) 2025-09-26 23:08:29 +08:00
Yeuoly fac16a49d2 feat: enhance trigger subscription management and introduce new runtime classes
- Added TriggerSubscriptionConstructorRuntime for managing subscription credentials and session data.
- Refactored PluginExecutor to utilize the new trigger subscription constructor for improved event handling.
- Updated PluginRegistration to support the new trigger subscription constructor interface.
- Introduced example-lark-trigger dependency in pyproject.toml for enhanced functionality.
- Cleaned up and standardized trigger-related classes and interfaces for better maintainability.

These changes improve the overall structure and functionality of the trigger subscription system, ensuring a more robust and flexible event handling process.
2025-09-26 22:20:23 +08:00
Yeuoly 76d1820205 feat: introduce UnsubscribeError for improved error handling in GitHub provider
- Added UnsubscribeError class to handle errors during unsubscribe operations, providing detailed error messages and codes.
- Updated GithubProvider to raise UnsubscribeError in various failure scenarios, enhancing error reporting and debugging.
- Minor adjustments in the IssuesTrigger class to prepare for future enhancements.

These changes improve the robustness of the GitHub trigger integration by ensuring clearer error management during webhook unsubscription processes.
2025-09-26 20:15:04 +08:00
Yeuoly 3adbc5c291 refactor: rename Unsubscription class to UnsubscribeResult for clarity
- Updated the class name from Unsubscription to UnsubscribeResult to better reflect its purpose.
- Adjusted related type hints and return types in the TriggerProvider interface and example implementations to maintain consistency.

These changes enhance code readability and improve the understanding of the unsubscription process in the trigger system.
2025-09-26 20:08:29 +08:00
Harry 26b1324c59 Merge remote-tracking branch 'origin/main' into feat/trigger
# Conflicts:
#	python/dify_plugin/core/entities/message.py
#	python/dify_plugin/core/entities/plugin/request.py
#	python/dify_plugin/core/entities/plugin/setup.py
#	python/dify_plugin/core/plugin_registration.py
#	python/dify_plugin/plugin.py
#	python/examples/github/tools/github_repositories.yaml
#	python/pyproject.toml
2025-09-26 14:18:06 +08:00
Harry ebe4c89bea feat(github_trigger): enhance GitHub trigger functionality and update configurations
- Updated type hints in `setup.py` and `__init__.py` for better clarity and compatibility with newer Python versions.
- Improved descriptions in `trigger.py` for better understanding of output variables.
- Added new dynamic options fetching for repositories in `github.py`, enhancing user experience.
- Updated `manifest.yaml` to reflect the new version 100.1.1 and included additional localization for Japanese.
- Cleaned up and standardized code in various files for improved readability and maintainability.

These changes enhance the overall functionality and usability of the GitHub trigger integration, ensuring a more robust event handling process.
2025-09-25 17:20:16 +08:00
Harry 65da31647c feat(github_trigger): remove deprecated trigger files and add new issue trigger
- Deleted obsolete trigger files for various GitHub events including commit comments, create, delete, deployment, discussion, and others to streamline the trigger set.
- Introduced a new `issues.py` trigger to handle GitHub issue events, enhancing event handling capabilities.
- Added corresponding `issues.yaml` configuration to define the new trigger's properties and behavior.

These changes improve the overall functionality and maintainability of the GitHub trigger integration, ensuring a more efficient event handling process.
2025-09-25 17:18:29 +08:00
Harry 64d1f8fdde refactor: update type hints and improve error handling in datasource examples 2025-09-24 14:48:36 +08:00
Harry 4821ef2552 feat: add datasource plugin examples 2025-09-24 14:34:21 +08:00
Harry 736d178485 feat(github_trigger): update trigger configurations and remove deprecated files
- Added a new trigger configuration for `pull_request_merged.yaml` to enhance event handling.
- Updated the `deployment_status_created.py` to return event variables correctly.
- Expanded the `deployment_status_created.yaml` with additional properties for better event context.
- Removed obsolete trigger files related to discussions and issues, streamlining the trigger set.

These changes improve the overall functionality and maintainability of the GitHub trigger integration.
2025-09-19 17:22:49 +08:00