Commit Graph

61 Commits

Author SHA1 Message Date
wangxiaolei 35825a7925 feat: support opentelemetry (#583) 2026-01-27 13:36:13 +08:00
Byron.wang ca3d00229e Feat/Implement structured logging and Trace ID propagation (#552)
* use slog instead of log package and format to new log schema

* update the environment name to LOG_OUTPUT_FORMAT

* add the env to .env.example

* fix log reference error

* change the order of milldlewares

* delete unused code

* fix the concurrently session potential race condition

* fix the log format in tests

* update the duplicate code

* refactor: convert log functions to slog structured format

- Change log.Error/Info/Warn/Debug/Panic to accept msg + key-value pairs
- Remove printf-style formatting from log functions
- Update log calls in internal/cluster, internal/db, internal/core/session_manager
- Remove unused 'initialized' variable from log package
- Remaining files will be updated in follow-up commits

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor: update all log call sites to use slog structured format

Convert all log.Error, log.Info, log.Warn, log.Debug, and log.Panic
calls from printf-style formatting to slog key-value pairs.

Before: log.Error("failed to do something: %s", err.Error())
After:  log.Error("failed to do something", "error", err)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor: update cmd/ log calls to use slog structured format

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: implement GnetLogger for structured logging in gnet

* refactor: remove deprecated log visibility functions and related calls

* feat: enhance session management with trace and identity context propagation

* feat: implement serverless transaction handler and writer for plugin runtime

* refactor: rename context field to traceCtx in RealBackwardsInvocation

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Yeuoly <admin@srmxy.cn>
2025-12-30 11:00:48 +08:00
Yeuoly 0d282de6a1 feat: support multimodal rerank and embedding (#503)
* fix: align multimodal permission mapping

* fix: implement mock interface for multimodal embeddings

* fix: support multimodal embedding

* fix: incorrect reference
2025-12-09 14:56:11 +08:00
Yeuoly 888ad788bc refactor: plugin lifecycle control panel (#499)
* refactor: introduce local plugin control panel and cleanup environment setup process

* fix: args

* refactor: new local runtime

* temp: stash work for refactor on RemotePluginServer

* refactor: unify local runtime lifetime and sperate init environment process

* chore: add missing files

* stash

* refactor: local plugin lifetime control

* refactor: complete installation process of control panel

* refactor: adapt service layer to new controlpanel

* refactor: pluginManager.Install

* fix: add routine wrap to InstallServerless, avoid blocking main thread

* feat: reinstall serverless runtime

* chore: add comments to Reinstall and update confusing naming

* refactor: unify install plugin service

* refactor: add labels to debugging runtime

* refactor: add getters to plugin manager

* refactor: split install service to decode/install_task/install service

* ???

* refactor: adapt controllers

* refactor: session write

* refactor: session runtime

* Refine install task orchestration (#501)

* refactor: installing task

* refactor cluster management, decouple lifetime management and cluster

* fix cli test command

* fix: cleanup TODO comments and implement GracefulStop for instance

* feat: add logger to control panel

* fix: multiple nil references

* refactor: better lifetime control

* refactor: better cycle interval

* fix(LocalPluginRuntime): prevent returning err when it's not  error

* fix: avoid adding empty PipExtraArgs

* fix: missing errors in Environment init

* fix: add truncateMessage to avoid db explosion

* cleanup: better lifecycle management

* fix: init status at the beginning of installation

* optimize: GracefulStop for pluginInstance

* refactor: tests

* refactor: centralize routine labels (#504)

* cleanup: RoutineKey

* fix: init routine pool

* fix: correctly handle cluster register error

* fix: memory leak

* fix: add \n to instance write

* fix(installer.go): set success to true after succeed for defer func

* refactor

* fix: missing cwd in testutils

* fix: scaleup default runtime nums to 1 when testing

* fix: localruntime appconfig in testing module

* Update internal/core/local_runtime/load_balancing.go

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

* fix: more efficiency implement in installer_local.go

* fix: returns after failing in onDebuggingRuntimeDisconnected

* fix: returns after failing in onDebuggingRuntimeDisconnected

* fix: splits tests

* refactor: naming

* refactor: manifest.VersionX

* fix: adapt SetDefault to tests

* fix: enforce use constants in DBType

* fix: generate

* fix: linter

* cleanup tests

* refactor: change  package to

* cleanup: useless codes

* Update internal/cluster/plugin.go

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

* cleanup

* refactor: decouple connection_key management from debugging_time

* refactor: confused naming

* feat: recycle resources to adapt to https://github.com/langgenius/dify-plugin-daemon/pull/500

* refactor: confusing redirecting

* fix: support get serverless runtime

* fix: race condition in Launching

* fix: avoid ManifestValidate in first step of debugging handshake

* fix: adding ReleaseAllLocks to finalizers

* wtf: what a beautiful code

* refactor: rename Stream.Async to Stream.Process

* fix: kill process if daed instance was detected

* fix: correctly handle failures

* fix: consistence of difference interfaces

* fix: add stacktrace to panic

* fix: only trigger once  event

* fix: ensure plugin runtime was shutdown

* feat: cleanup install tasks

* fix: add scale logs

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-18 17:28:02 +08:00
Betula-L 21015d4474 fix credential type (#419) 2025-08-08 21:56:34 +08:00
Maries a0414b30e6 0.2.0 (#402)
* feat(oauth): add RedirectURI field to OAuth request structures

* feat(oauth): update OAuthSchema validation

* feat: add Context field to request and session structures

* feat: add CredentialType field to Credentials and InvokeToolRequest structures

* fix: handle unhandled default case in basic_type.go

* feat: add support for build branches in build-push.yml
2025-07-17 16:28:43 +08:00
Yeuoly 6d6fb3892e feat: add InvokeLLMWithStructuredOutput functionality (#369)
* feat: add InvokeLLMWithStructuredOutput functionality

- Introduced a new method InvokeLLMWithStructuredOutput to the BackwardsInvocation interface for handling structured output requests.
- Added corresponding request and response types to support structured output.
- Implemented the method in both RealBackwardsInvocation and MockedDifyInvocation for testing purposes.
- Updated permission handling and task execution for the new structured output invocation type.

This enhancement allows for more flexible and detailed responses from the LLM, improving the overall functionality of the invocation system.

* refactor: enhance LLMResultChunkWithStructuredOutput structure

- Updated the LLMResultChunkWithStructuredOutput type to include additional fields: Model, SystemFingerprint, and Delta.
- Added comments to clarify the reasoning behind the structure and the use of type embedding for JSON marshaling.

This change improves the clarity and functionality of the LLMResultChunkWithStructuredOutput type, ensuring proper JSON serialization.

* refactor: streamline LLMResultChunk construction in InvokeLLMWithStructuredOutput

- Simplified the construction of LLMResultChunk and LLMResultChunkWithStructuredOutput by removing unnecessary type embedding.
- Enhanced readability and maintainability of the code while preserving functionality.

This change contributes to cleaner code and improved clarity in the handling of structured output responses.
2025-06-30 12:07:46 +08:00
Yeuoly 1e260eedf4 refactor: using length-prefixed chunking for Backwards invocations (#342)
- Adjusted the header byte manipulation in chunking functions to correctly use the first four bytes for data length.
- Modified the HTTP request streaming function to include the length-prefixed option for improved data handling.
2025-06-11 16:01:53 +08:00
Good Wood 977665e73b feat: add read & write timeout config (#259)
* feat: add read & write timeout config

* refactor: update Dify invocation configuration to use structured payload

- Changed the Dify invocation daemon to accept a structured payload for initialization, improving clarity and maintainability.
- Updated related configuration variables in the .env.example file to reflect the new naming convention for backwards invocation timeouts.
- Adjusted tests and plugin manager to accommodate the new payload structure.

---------

Co-authored-by: Yeuoly <admin@srmxy.cn>
2025-05-06 13:08:02 +08:00
Yeuoly 9730b7dc63 tests: enhance integration testing for specific plugins (#242)
* feat: enhance integration testing for specific plugins

- Added integration tests for the official agent, including test data for agent strategy invocation.
- Introduced JSON schema generation and validation utilities to ensure proper request formatting.
- Enhanced mock invocation handling in the plugin manager to support tool parameters.
- Added new test utilities for simulating OpenAI server responses and managing plugin runtime.

* fix: update RunOnce function to return response stream and enhance integration test

- Modified the RunOnce function to return a response stream instead of an error, allowing for better handling of streamed responses.
- Updated the integration test for the official agent to read from the response stream, ensuring proper validation of the agent strategy invocation.
2025-04-24 16:33:50 +08:00
Yeuoly 7c0db82d8c feat(invocation): add FetchApp method to backwards invocations (#213)
- Introduced FetchApp method in BackwardsInvocation interface to retrieve application data.
- Implemented FetchAppRequest type for request payload with required AppId field.
- Updated RealBackwardsInvocation to handle FetchApp requests and return application data.
- Added mock implementation for FetchApp in the testing suite.
- Enhanced task handling in plugin daemon to support FetchApp invocation.
2025-04-16 18:13:06 +08:00
非法操作 e9cd678fad add exist for self.session.storage (#195) 2025-04-11 17:49:30 +08:00
Yeuoly d74cfea892 enhancement(llm): remove non-required PromptMessages field from LLMResultChunk (#194) 2025-04-11 14:52:11 +08:00
Yeuoly 15060ee312 refactor: move entities to pkg 2025-01-06 14:52:02 +08:00
Yeuoly a1bbaf109b fix: replace break with continue when handling streaming response 2024-12-14 00:19:56 +08:00
Yeuoly 548adf4c0c refactor: rename agent to agent strategy 2024-12-12 18:26:55 +08:00
Yeuoly 83f0876190 fix: invoke llm 2024-12-12 14:13:52 +08:00
Yeuoly 9377e4b28c fix: add tenant_id to InvokeTTSSchema 2024-12-06 17:15:38 +08:00
Yeuoly 407fb941ca feat: support for pprof 2024-12-04 14:15:16 +08:00
Yeuoly d8252c3971 fix: system summarize 2024-12-02 14:26:53 +08:00
Yeuoly 47950efc55 fix: panic if there is a object type in endpoint settings 2024-11-19 13:35:39 +08:00
Yeuoly 80c8077f49 fix: failed on pointer type validation 2024-11-18 18:09:15 +08:00
Yeuoly 5c6f5f2ecd fix: skip validation on map 2024-11-18 17:46:12 +08:00
Yeuoly 6230ce4f7f feat: support request uploading files 2024-11-14 18:33:38 +08:00
Yeuoly 26fd94ebcd refactor: convert snakecase to camelcase 2024-11-12 21:24:41 +08:00
Yeuoly eab2d1b58b fix: missing workdir settings 2024-10-23 17:47:21 +08:00
Yeuoly a55f6f507f refactor: install plugin from local 2024-10-18 20:29:02 +08:00
Yeuoly 9f561c63e3 feat: backwards invoke summary 2024-10-17 19:46:51 +08:00
Yeuoly fd82d23584 fix: ci 2024-09-30 19:42:35 +08:00
Yeuoly 3307c82af3 fix: clear endpoint credentials cache 2024-09-27 17:56:19 +08:00
Yeuoly 56fc00257b feat: add mock data 2024-09-27 17:03:54 +08:00
Yeuoly fc0f567bbc fix: tests 2024-09-26 17:50:58 +08:00
Yeuoly 9cc4a5bef2 fix: tts 2024-09-26 17:40:43 +08:00
Yeuoly 5306940fa2 fix: missing error message while invoke to dify 2024-09-26 17:23:17 +08:00
Yeuoly 14feb2852a fix: remove required field 2024-09-26 14:50:36 +08:00
Yeuoly dd67f65a04 fix: using validators to validate a map 2024-09-26 14:48:53 +08:00
Yeuoly b69398ce4b feat: backwards invoke to nodes 2024-09-24 20:15:46 +08:00
Yeuoly 755f3f1bb5 feat: support inner key 2024-09-20 13:32:46 +08:00
Yeuoly 93f1d3b75a fix: ci 2024-09-18 17:35:28 +08:00
Yeuoly fefd3ef53e feat: support cli testing 2024-09-18 17:04:40 +08:00
Yeuoly 8971b9864d fix: aws 2024-09-12 16:31:59 +08:00
Yeuoly b397e73e95 feat: support aws installer 2024-09-10 14:52:21 +08:00
Yeuoly 8bacfb6841 tests: encrypt 2024-09-02 10:26:16 +08:00
Yeuoly 303124f8f9 feat: support settings for endpoints 2024-08-30 22:40:21 +08:00
Yeuoly 13ab7d7f1f fix: unmarshal map 2024-08-30 13:12:28 +08:00
Yeuoly ccf1b6e1d2 fix: backwards invocation can not unmarshal nil map 2024-08-29 21:51:34 +08:00
Yeuoly 7322d50a5d refactor 2024-08-29 21:19:13 +08:00
Yeuoly e139f38c1f feat: service support persistence 2024-08-28 23:37:55 +08:00
Yeuoly 24836759f2 feat: invoke app 2024-08-26 21:06:49 +08:00
Yeuoly d1ab9878f5 feat: backwards invoke llm 2024-07-29 22:06:23 +08:00