Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor(dify-agent): make config pulls direct and remove gRPC (#40044)
盐粒 Yanliadb89a8926ee
diff --git a/api/controllers/inner_api/plugin/agent_config.py b/api/controllers/inner_api/plugin/agent_config.pyindex 6f12f6e5d02..196909196bd 100644--- a/api/controllers/inner_api/plugin/agent_config.py+++ b/api/controllers/inner_api/plugin/agent_config.py@@ -2,20 +2,24 @@These endpoints are called by the dify-agent server with the inner API key.They resolve the requested Agent config version directly from Agent Soul JSON-and never expose signed download URLs or drive-owned metadata.+and authorize downloads with the existing Config target, tenant, and source+ownership semantics. Download requests return metadata plus a short-lived,+origin-free ``/files/*`` URI, never file bytes; the Sandbox fetches those bytes+directly from the Dify API data plane."""from __future__ import annotations-import io+from typing import Literal-from flask import request, send_file+from flask import requestfrom flask_restx import Resource-from pydantic import BaseModel, ValidationError+from pydantic import BaseModel, ConfigDict, ValidationError, model_validatorfrom controllers.console.wraps import setup_requiredfrom controllers.inner_api import inner_api_nsfrom controllers.inner_api.wraps import plugin_inner_api_only+from models.agent_config_entities import validate_config_name, validate_config_skill_namefrom services.agent_config_service import (AgentConfigService,AgentConfigServiceError,@@ -38,6 +42,24 @@ class _ConfigMutationRequest(BaseModel):config_version_kind: AgentConfigVersionKind+class _ConfigDownloadSource(BaseModel):+ model_config = ConfigDict(extra="forbid")++ kind: Literal["file", "skill"]+ name: str++ @model_validator(mode="after")+ def validate_name(self) -> _ConfigDownloadSource:+ self.name = validate_config_skill_name(self.name) if self.kind == "skill" else validate_config_name(self.name)+ return self+++class _ConfigDownloadRequest(_ConfigTargetQuery):+ model_config = ConfigDict(extra="forbid")++ config: _ConfigDownloadSource++class _ConfigPushRequest(_ConfigMutationRequest):files: list[dict] = []skills: list[dict] = []@@ -99,28 +121,29 @@ class AgentConfigManifestApi(Resource):return _error_response(exc)-@inner_api_ns.route("/agent-config/<string:agent_id>/skills/<string:name>/pull")-class AgentConfigSkillPullApi(Resource):+@inner_api_ns.route("/agent-config/<string:agent_id>/download-request")+class AgentConfigDownloadRequestApi(Resource):@setup_required@plugin_inner_api_only- @inner_api_ns.doc("agent_config_skill_pull")- def get(self, agent_id: str, name: str):+ @inner_api_ns.doc("agent_config_download_request")+ def post(self, agent_id: str):try:- query = _target_query_from_request()- result = AgentConfigService().pull_skill(- tenant_id=query.tenant_id,+ body = _ConfigDownloadRequest.model_validate(request.get_json(silent=True) or {})+ result = AgentConfigService().request_download(+ tenant_id=body.tenant_id,agent_id=agent_id,- user_id=query.user_id,- config_version_id=query.config_version_id,- config_version_kind=query.config_version_kind,- name=name,- )- return send_file(- io.BytesIO(result.payload),- mimetype=result.mime_type,- as_attachment=True,- download_name=result.filename,+ user_id=body.user_id,+ config_version_id=body.config_version_id,+ config_version_kind=body.config_version_kind,+ kind=body.config.kind,+ name=body.config.name,)+ return {+ "filename": result.filename,+ "mime_type": result.mime_type,+ "size": result.size,+ "download_uri": result.download_uri,+ }except ValidationError as exc:return {"code": "invalid_request", "message": str(exc)}, 400except AgentConfigServiceError as exc:@@ -149,34 +172,6 @@ class AgentConfigSkillInspectApi(Resource):return _error_response(exc)-@inner_api_ns.route("/agent-config/<string:agent_id>/files/<string:name>/pull")-class AgentConfigFilePullApi(Resource):- @setup_required- @plugin_inner_api_only- @inner_api_ns.doc("agent_config_file_pull")- def get(self, agent_id: str, name: str):- try:- query = _target_query_from_request()- result = AgentConfigService().pull_file(- tenant_id=query.tenant_id,- agent_id=agent_id,- user_id=query.user_id,- config_version_id=query.config_version_id,- config_version_kind=query.config_version_kind,- name=name,- )- return send_file(- io.BytesIO(result.payload),- mimetype=result.mime_type,- as_attachment=True,- download_name=result.filename,- )- except ValidationError as exc:- return {"code": "invalid_request", "message": str(exc)}, 400- except AgentConfigServiceError as exc:- return _error_response(exc)--@inner_api_ns.route("/agent-config/<string:agent_id>/push")class AgentConfigPushApi(Resource):@setup_requireddiff --git a/api/services/agent_config_service.py b/api/services/agent_config_service.pyindex fdc13eca2d8..76edc3b199c 100644--- a/api/services/agent_config_service.py+++ b/api/services/agent_config_service.py@@ -14,6 +14,8 @@ Soul reference only.from __future__ import annotationsimport io+import mimetypes+import os.pathimport urllib.parseimport zipfilefrom collections.abc import Callable@@ -28,11 +30,13 @@ from sqlalchemy import selectfrom sqlalchemy.exc import DataError, SQLAlchemyErrorfrom sqlalchemy.orm import Session+from configs import dify_configfrom core.app.file_access.controller import DatabaseFileAccessController+from core.app.workflow.file_runtime import DifyWorkflowFileRuntimefrom core.db.session_factory import session_factory as default_session_factory+from core.tools.signature import bind_file_uri, sign_tool_file_urifrom core.tools.tool_file_manager import ToolFileManagerfrom extensions.ext_storage import storage-from factories import file_factoryfrom models.agent import Agent, AgentConfigDraft, AgentConfigDraftType, AgentConfigSnapshotfrom models.agent_config_entities import (AgentConfigFileRefConfig,@@ -114,6 +118,16 @@ class ConfigDownload:payload: bytes+@dataclass(frozen=True, slots=True)+class ConfigDownloadRequest:+ """Short-lived data-plane metadata for one authorized Config asset."""++ filename: str+ mime_type: str+ size: int+ download_uri: str++class AgentConfigService:"""Read and update Agent Soul-backed config assets for one version target.@@ -228,16 +242,19 @@ class AgentConfigService:"items": [self._serialize_file_item(file_ref) for file_ref in target.agent_soul.config_files],}- def pull_skill(+ def request_download(self,*,tenant_id: str,agent_id: str,config_version_id: str,config_version_kind: AgentConfigVersionKind,+ kind: Literal["file", "skill"],name: str,user_id: str | None = None,- ) -> ConfigDownload:+ ) -> ConfigDownloadRequest:+ """Authorize one Config reference and return origin-free download metadata."""+target = self.resolve_target(tenant_id=tenant_id,agent_id=agent_id,@@ -245,10 +262,28 @@ class AgentConfigService:config_version_kind=config_version_kind,user_id=user_id,)- skill = self._require_skill(target.agent_soul, name=name)- file_id = self._available_skill_file_id(skill)- payload, mime_type = self._load_tool_file_bytes(tenant_id=tenant_id, file_id=file_id)- return ConfigDownload(filename=f"{skill.name}.zip", mime_type=mime_type or "application/zip", payload=payload)+ if kind == "skill":+ skill = self._require_skill(target.agent_soul, name=name)+ return self._resolve_download_request(+ tenant_id=tenant_id,+ file_kind=skill.file_kind,+ file_id=self._available_skill_file_id(skill),+ filename=f"{skill.name}.zip",+ default_mime_type="application/zip",+ missing_code="config_skill_not_found",+ missing_message="config skill payload is missing",+ )++ file_ref = self._require_file(target.agent_soul, name=name)+ return self._resolve_download_request(+ tenant_id=tenant_id,+ file_kind=file_ref.file_kind,+ file_id=self._available_file_id(file_ref),+ filename=file_ref.name,+ default_mime_type="application/octet-stream",+ missing_code="config_file_not_found",+ missing_message="config file payload is missing",+ )def download_skill_url(self,@@ -260,19 +295,16 @@ class AgentConfigService:name: str,user_id: str | None = None,) -> str:- target = self.resolve_target(+ result = self.request_download(tenant_id=tenant_id,agent_id=agent_id,config_version_id=config_version_id,config_version_kind=config_version_kind,+ kind="skill",+ name=name,user_id=user_id,)- skill = self._require_skill(target.agent_soul, name=name)- file_id = self._available_skill_file_id(skill)- url = self._resolve_download_url(tenant_id=tenant_id, file_kind=skill.file_kind, file_id=file_id)- if url is None:- raise AgentConfigServiceError("config_skill_not_found", "config skill payload is missing", status_code=404)- return url+ return bind_file_uri(result.download_uri, dify_config.FILES_URL)def inspect_skill(self,@@ -398,34 +430,6 @@ class AgentConfigService:)return member_path- def pull_file(- self,- *,- tenant_id: str,- agent_id: str,- config_version_id: str,- config_version_kind: AgentConfigVersionKind,- name: str,- user_id: str | None = None,- ) -> ConfigDownload:- target = self.resolve_target(- tenant_id=tenant_id,- agent_id=agent_id,- config_version_id=config_version_id,- config_version_kind=config_version_kind,- user_id=user_id,- )- file_ref = self._require_file(target.agent_soul, name=name)- file_id = self._available_file_id(file_ref)- payload, filename, mime_type = self._load_file_ref_bytes(- tenant_id=tenant_id,- file_kind=file_ref.file_kind,- file_id=file_id,- )- return ConfigDownload(- filename=filename or file_ref.name, mime_type=mime_type or "application/octet-stream", payload=payload- )-def download_file_url(self,*,@@ -436,19 +440,16 @@ class AgentConfigService:name: str,user_id: str | None = None,) -> str:- target = self.resolve_target(+ result = self.request_download(tenant_id=tenant_id,agent_id=agent_id,config_version_id=config_version_id,config_version_kind=config_version_kind,+ kind="file",+ name=name,user_id=user_id,)- file_ref = self._require_file(target.agent_soul, name=name)- file_id = self._available_file_id(file_ref)- url = self._resolve_download_url(tenant_id=tenant_id, file_kind=file_ref.file_kind, file_id=file_id)- if url is None:- raise AgentConfigServiceError("config_file_not_found", "config file payload is missing", status_code=404)- return url+ return bind_file_uri(result.download_uri, dify_config.FILES_URL)def upload_skill(self,@@ -1381,35 +1382,56 @@ class AgentConfigService:raise AgentConfigServiceError("config_file_not_found", "config file payload is missing", status_code=404)return storage.load_once(upload_file.key), upload_file.name, upload_file.mime_type- @staticmethod- def _resolve_download_url(- *, tenant_id: str, file_kind: Literal["upload_file", "tool_file"], file_id: str- ) -> str | None:- controller = DatabaseFileAccessController()- from core.app.workflow.file_runtime import DifyWorkflowFileRuntime-- runtime = DifyWorkflowFileRuntime(file_access_controller=controller)- try:- if file_kind == "upload_file":- return runtime.resolve_upload_file_url(- upload_file_id=file_id,- for_external=True,- as_attachment=True,+ def _resolve_download_request(+ self,+ *,+ tenant_id: str,+ file_kind: Literal["upload_file", "tool_file"],+ file_id: str,+ filename: str,+ default_mime_type: str,+ missing_code: str,+ missing_message: str,+ ) -> ConfigDownloadRequest:+ with self._session_factory() as session:+ if file_kind == "tool_file":+ tool_file = session.scalar(+ select(ToolFile).where(ToolFile.id == file_id, ToolFile.tenant_id == tenant_id))- file = file_factory.build_from_mapping(- mapping={"transfer_method": "tool_file", "tool_file_id": file_id},- tenant_id=tenant_id,- access_controller=controller,- )- url = runtime.resolve_file_url(file=file, for_external=True)- if not url:- return None- parsed = urllib.parse.urlsplit(url)+ if tool_file is None:+ raise AgentConfigServiceError(missing_code, missing_message, status_code=404)+ extension = (+ os.path.splitext(tool_file.name)[1].lower()+ or mimetypes.guess_extension(tool_file.mimetype)+ or os.path.splitext(tool_file.file_key)[1].lower()+ or ".bin"+ )+ uri = sign_tool_file_uri(tool_file_id=file_id, extension=extension)+ mime_type = tool_file.mimetype or default_mime_type+ size = tool_file.size+ else:+ upload_file = session.scalar(+ select(UploadFile).where(UploadFile.id == file_id, UploadFile.tenant_id == tenant_id)+ )+ if upload_file is None:+ raise AgentConfigServiceError(missing_code, missing_message, status_code=404)+ runtime = DifyWorkflowFileRuntime(file_access_controller=DatabaseFileAccessController())+ uri = runtime.resolve_upload_file_uri(upload_file_id=file_id, as_attachment=True)+ mime_type = upload_file.mime_type or default_mime_type+ size = upload_file.size++ if file_kind == "tool_file":+ parsed = urllib.parse.urlsplit(uri)query = urllib.parse.parse_qsl(parsed.query, keep_blank_values=True)query.append(("as_attachment", "true"))- return urllib.parse.urlunsplit(parsed._replace(query=urllib.parse.urlencode(query)))- except ValueError:- return None+ uri = urllib.parse.urlunsplit(parsed._replace(query=urllib.parse.urlencode(query)))++ return ConfigDownloadRequest(+ filename=filename,+ mime_type=mime_type,+ size=size,+ download_uri=uri,+ )__all__ = [@@ -1419,6 +1441,7 @@ __all__ = ["AgentConfigTarget","AgentConfigVersionKind","ConfigDownload",+ "ConfigDownloadRequest","ConfigPushFileItem","ConfigPushPayload","ConfigPushSkillItem",diff --git a/api/tests/unit_tests/controllers/inner_api/plugin/test_agent_config.py b/api/tests/unit_tests/controllers/inner_api/plugin/test_agent_config.pyindex eef6fdf31c0..79ecdc08cb9 100644--- a/api/tests/unit_tests/controllers/inner_api/plugin/test_agent_config.py+++ b/api/tests/unit_tests/controllers/inner_api/plugin/test_agent_config.py@@ -3,19 +3,17 @@from __future__ import annotationsimport inspect-from types import SimpleNamespacefrom unittest.mock import patchfrom flask import Flaskfrom controllers.inner_api.plugin.agent_config import (+ AgentConfigDownloadRequestApi,AgentConfigEnvApi,- AgentConfigFilePullApi,AgentConfigManifestApi,AgentConfigNoteApi,AgentConfigPushApi,AgentConfigSkillInspectApi,- AgentConfigSkillPullApi,)from services.agent_config_service import AgentConfigServiceError@@ -108,26 +106,40 @@ def test_manifest_happy_path_calls_service() -> None:assert service.return_value.manifest.call_args.kwargs["config_version_kind"].value == "build_draft"-def test_skill_pull_returns_send_file_response() -> None:- raw = _raw(AgentConfigSkillPullApi.get)+def test_download_request_returns_origin_free_metadata() -> None:+ raw = _raw(AgentConfigDownloadRequestApi.post)+ payload = {+ "tenant_id": "tenant-1",+ "user_id": "user-1",+ "config_version_id": "cfg-1",+ "config_version_kind": "build_draft",+ "config": {"kind": "skill", "name": "alpha"},+ }- with app.test_request_context(- "/?tenant_id=tenant-1&user_id=user-1&config_version_id=cfg-1&config_version_kind=build_draft"- ):+ with app.test_request_context("/", method="POST", json=payload):with patch(f"{MODULE}.AgentConfigService") as service:- service.return_value.pull_skill.return_value = SimpleNamespace(- payload=b"zip-bytes",- mime_type="application/zip",- filename="alpha.zip",- )- response = raw(AgentConfigSkillPullApi(), "agent-1", "alpha")+ service.return_value.request_download.return_value.filename = "alpha.zip"+ service.return_value.request_download.return_value.mime_type = "application/zip"+ service.return_value.request_download.return_value.size = 123+ service.return_value.request_download.return_value.download_uri = "/files/tools/skill.zip?sign=1"+ body = raw(AgentConfigDownloadRequestApi(), "agent-1")- response.direct_passthrough = False- assert response.status_code == 200- assert response.mimetype == "application/zip"- assert response.get_data() == b"zip-bytes"- assert "filename=alpha.zip" in response.headers["Content-Disposition"]- assert service.return_value.pull_skill.call_args.kwargs["user_id"] == "user-1"+ assert body == {+ "filename": "alpha.zip",+ "mime_type": "application/zip",+ "size": 123,+ "download_uri": "/files/tools/skill.zip?sign=1",+ }+ assert service.return_value.request_download.call_args.kwargs == {+ "tenant_id": "tenant-1",+ "agent_id": "agent-1",+ "user_id": "user-1",+ "config_version_id": "cfg-1",+ "config_version_kind": service.return_value.request_download.call_args.kwargs["config_version_kind"],+ "kind": "skill",+ "name": "alpha",+ }+ assert service.return_value.request_download.call_args.kwargs["config_version_kind"].value == "build_draft"def test_skill_inspect_happy_path_returns_service_payload() -> None:@@ -144,28 +156,6 @@ def test_skill_inspect_happy_path_returns_service_payload() -> None:assert service.return_value.inspect_skill.call_args.kwargs["user_id"] == "user-1"-def test_file_pull_returns_send_file_response() -> None:- raw = _raw(AgentConfigFilePullApi.get)-- with app.test_request_context(- "/?tenant_id=tenant-1&user_id=user-1&config_version_id=cfg-1&config_version_kind=build_draft"- ):- with patch(f"{MODULE}.AgentConfigService") as service:- service.return_value.pull_file.return_value = SimpleNamespace(- payload=b"file-bytes",- mime_type="text/plain",- filename="guide.txt",- )- response = raw(AgentConfigFilePullApi(), "agent-1", "guide.txt")-- response.direct_passthrough = False- assert response.status_code == 200- assert response.mimetype == "text/plain"- assert response.get_data() == b"file-bytes"- assert "filename=guide.txt" in response.headers["Content-Disposition"]- assert service.return_value.pull_file.call_args.kwargs["user_id"] == "user-1"--def test_push_happy_path_validates_body_and_preserves_execution_user() -> None:raw = _raw(AgentConfigPushApi.post)payload = {@@ -253,6 +243,22 @@ def test_manifest_invalid_query_returns_400() -> None:assert body["code"] == "invalid_request"+def test_download_request_rejects_invalid_config_name() -> None:+ raw = _raw(AgentConfigDownloadRequestApi.post)+ payload = {+ "tenant_id": "tenant-1",+ "config_version_id": "cfg-1",+ "config_version_kind": "draft",+ "config": {"kind": "file", "name": "../guide.txt"},+ }++ with app.test_request_context("/", method="POST", json=payload):+ body, status = raw(AgentConfigDownloadRequestApi(), "agent-1")++ assert status == 400+ assert body["code"] == "invalid_request"++def test_push_invalid_body_returns_400() -> None:raw = _raw(AgentConfigPushApi.post)diff --git a/api/tests/unit_tests/services/test_agent_config_service.py b/api/tests/unit_tests/services/test_agent_config_service.pyindex 09cf7d90b8c..a62faf893e5 100644--- a/api/tests/unit_tests/services/test_agent_config_service.py+++ b/api/tests/unit_tests/services/test_agent_config_service.py@@ -36,6 +36,7 @@ from services.agent_config_service import (AgentConfigServiceError,AgentConfigTarget,AgentConfigVersionKind,+ ConfigDownloadRequest,ConfigPushPayload,ConfigPushSkillItem,)@@ -223,6 +224,29 @@ def test_resolve_target_requires_user_for_build_draft(sqlite_session: Session) -assert exc_info.value.code == "missing_user_id"[email protected]("sqlite_session", [AGENT_CONFIG_TABLES], indirect=True)+def test_resolve_target_hides_build_draft_from_another_user(sqlite_session: Session) -> None:+ _persist_target(+ sqlite_session,+ _draft(+ version_id=BUILD_DRAFT,+ draft_type=AgentConfigDraftType.DEBUG_BUILD,+ account_id=USER,+ ),+ )++ with pytest.raises(AgentConfigServiceError) as exc_info:+ _service(sqlite_session).resolve_target(+ tenant_id=TENANT,+ agent_id=AGENT,+ config_version_id=BUILD_DRAFT,+ config_version_kind=AgentConfigVersionKind.BUILD_DRAFT,+ user_id=END_USER,+ )++ assert (exc_info.value.code, exc_info.value.status_code) == ("config_version_not_found", 404)++@pytest.mark.parametrize(("agent_tenant_id", "expected_code"),[@@ -373,6 +397,146 @@ def test_push_accepts_tenant_scoped_tool_file_sources_from_different_upload_owneassert persisted_source.user_id == END_USER[email protected]("sqlite_session", [(*AGENT_CONFIG_TABLES, ToolFile)], indirect=True)+def test_request_download_signs_config_tool_files_without_rechecking_end_user_owner(+ sqlite_session: Session,+) -> None:+ soul = _soul(+ config_files=[AgentConfigFileRefConfig(name="guide.txt", file_kind="tool_file", file_id=TOOL_FILE)],+ config_skills=[AgentConfigSkillRefConfig(name="alpha", file_id=SKILL_FILE)],+ )+ _persist_target(+ sqlite_session,+ _draft(+ version_id=BUILD_DRAFT,+ draft_type=AgentConfigDraftType.DEBUG_BUILD,+ account_id=USER,+ soul=soul,+ ),+ )+ guide = ToolFile(+ tenant_id=TENANT,+ user_id=END_USER,+ conversation_id=None,+ size=7,+ mimetype="text/plain",+ file_key="tool-files/guide.txt",+ name="guide.txt",+ )+ guide.id = TOOL_FILE+ skill = ToolFile(+ tenant_id=TENANT,+ user_id=END_USER,+ conversation_id=None,+ size=123,+ mimetype="application/zip",+ file_key="tool-files/alpha.zip",+ name="alpha.zip",+ )+ skill.id = SKILL_FILE+ sqlite_session.add_all([guide, skill])+ sqlite_session.commit()+ service = _service(sqlite_session)++ file_download = service.request_download(+ tenant_id=TENANT,+ agent_id=AGENT,+ config_version_id=BUILD_DRAFT,+ config_version_kind=AgentConfigVersionKind.BUILD_DRAFT,+ kind="file",+ name="guide.txt",+ user_id=USER,+ )+ skill_download = service.request_download(+ tenant_id=TENANT,+ agent_id=AGENT,+ config_version_id=BUILD_DRAFT,+ config_version_kind=AgentConfigVersionKind.BUILD_DRAFT,+ kind="skill",+ name="alpha",+ user_id=USER,+ )++ assert (file_download.filename, file_download.mime_type, file_download.size) == ("guide.txt", "text/plain", 7)+ assert file_download.download_uri.startswith(f"/files/tools/{TOOL_FILE}.txt?")+ assert "as_attachment=true" in file_download.download_uri+ assert (skill_download.filename, skill_download.mime_type, skill_download.size) == (+ "alpha.zip",+ "application/zip",+ 123,+ )+ assert skill_download.download_uri.startswith(f"/files/tools/{SKILL_FILE}.zip?")++[email protected]("sqlite_session", [(*AGENT_CONFIG_TABLES, UploadFile)], indirect=True)+def test_request_download_signs_tenant_scoped_config_upload_file(sqlite_session: Session) -> None:+ soul = _soul(+ config_files=[AgentConfigFileRefConfig(name="guide.txt", file_kind="upload_file", file_id=UPLOAD_FILE)]+ )+ _persist_target(sqlite_session, _draft(soul=soul))+ upload_file = UploadFile(+ tenant_id=TENANT,+ storage_type=StorageType.LOCAL,+ key="uploads/guide.txt",+ name="source-name.txt",+ size=7,+ extension="txt",+ mime_type="text/plain",+ created_by_role=CreatorUserRole.END_USER,+ created_by=END_USER,+ created_at=datetime(2025, 1, 1),+ used=False,+ )+ upload_file.id = UPLOAD_FILE+ sqlite_session.add(upload_file)+ sqlite_session.commit()++ result = _service(sqlite_session).request_download(+ tenant_id=TENANT,+ agent_id=AGENT,+ config_version_id=DRAFT,+ config_version_kind=AgentConfigVersionKind.DRAFT,+ kind="file",+ name="guide.txt",+ user_id=USER,+ )++ assert (result.filename, result.mime_type, result.size) == ("guide.txt", "text/plain", 7)+ assert result.download_uri.startswith(f"/files/{UPLOAD_FILE}/file-preview?")+ assert "as_attachment=true" in result.download_uri++[email protected]("sqlite_session", [(*AGENT_CONFIG_TABLES, ToolFile)], indirect=True)+def test_request_download_rejects_config_source_from_another_tenant(sqlite_session: Session) -> None:+ soul = _soul(config_files=[AgentConfigFileRefConfig(name="guide.txt", file_kind="tool_file", file_id=TOOL_FILE)])+ _persist_target(sqlite_session, _draft(soul=soul))+ source = ToolFile(+ tenant_id=OTHER_TENANT,+ user_id=END_USER,+ conversation_id=None,+ size=7,+ mimetype="text/plain",+ file_key="tool-files/guide.txt",+ name="guide.txt",+ )+ source.id = TOOL_FILE+ sqlite_session.add(source)+ sqlite_session.commit()++ with pytest.raises(AgentConfigServiceError) as exc_info:+ _service(sqlite_session).request_download(+ tenant_id=TENANT,+ agent_id=AGENT,+ config_version_id=DRAFT,+ config_version_kind=AgentConfigVersionKind.DRAFT,+ kind="file",+ name="guide.txt",+ user_id=USER,+ )++ assert (exc_info.value.code, exc_info.value.status_code) == ("config_file_not_found", 404)++@pytest.mark.parametrize("sqlite_session", [AGENT_CONFIG_TABLES], indirect=True)def test_push_file_for_console_rejects_snapshot_writes(sqlite_session: Session) -> None:_persist_target(sqlite_session, _snapshot())@@ -644,7 +808,7 @@ def test_manifest_uses_items_shape_without_download_urls() -> None:@pytest.mark.parametrize("sqlite_session", [AGENT_CONFIG_TABLES], indirect=True)-def test_manifest_preserves_missing_config_assets_and_pull_rejects_them(sqlite_session: Session) -> None:+def test_manifest_preserves_missing_config_assets_and_download_rejects_them(sqlite_session: Session) -> None:soul = _soul(config_skills=[{"name": "alpha", "file_id": "", "is_missing": True}],config_files=[{"name": "guide.txt", "file_kind": "upload_file", "file_id": "", "is_missing": True}],@@ -664,20 +828,22 @@ def test_manifest_preserves_missing_config_assets_and_pull_rejects_them(sqlite_sassert manifest["skills"]["items"][0]["is_missing"] is True # type: ignore[index]assert manifest["files"]["items"][0]["is_missing"] is True # type: ignore[index]with pytest.raises(AgentConfigServiceError) as skill_error:- service.pull_skill(+ service.request_download(tenant_id=TENANT,agent_id=AGENT,config_version_id=DRAFT,config_version_kind=AgentConfigVersionKind.DRAFT,+ kind="skill",name="alpha",user_id=USER,)with pytest.raises(AgentConfigServiceError) as file_error:- service.pull_file(+ service.request_download(tenant_id=TENANT,agent_id=AGENT,config_version_id=DRAFT,config_version_kind=AgentConfigVersionKind.DRAFT,+ kind="file",name="guide.txt",user_id=USER,)@@ -827,24 +993,19 @@ def test_resolve_skill_file_member_path_requires_existing_member() -> None:assert exc_info.value.status_code == 404-def test_download_url_helpers_use_shared_url_resolution() -> None:+def test_download_url_helpers_bind_shared_download_request_to_console_origin() -> None:service = AgentConfigService()- target = _target(- kind=AgentConfigVersionKind.BUILD_DRAFT,- writable=True,- soul=_soul(- config_skills=[AgentConfigSkillRefConfig(name="alpha", file_id="tool-file-1")],- config_files=[AgentConfigFileRefConfig(name="guide.txt", file_kind="upload_file", file_id="upload-file-1")],- ),- )with (- patch.object(service, "resolve_target", return_value=target),patch.object(service,- "_resolve_download_url",- side_effect=["https://example.com/alpha.zip", "https://example.com/guide.txt"],+ "request_download",+ side_effect=[+ ConfigDownloadRequest("alpha.zip", "application/zip", 10, "/files/alpha.zip?sign=1"),+ ConfigDownloadRequest("guide.txt", "text/plain", 20, "/files/guide.txt?sign=2"),+ ],),+ patch(f"{MODULE}.dify_config.FILES_URL", "https://example.com"),):assert (service.download_skill_url(@@ -855,7 +1016,7 @@ def test_download_url_helpers_use_shared_url_resolution() -> None:name="alpha",user_id=USER,)- == "https://example.com/alpha.zip"+ == "https://example.com/files/alpha.zip?sign=1")assert (service.download_file_url(@@ -866,5 +1027,5 @@ def test_download_url_helpers_use_shared_url_resolution() -> None:name="guide.txt",user_id=USER,)- == "https://example.com/guide.txt"+ == "https://example.com/files/guide.txt?sign=2")diff --git a/api/uv.lock b/api/uv.lockindex 24911c27bd5..38531f1d476 100644--- a/api/uv.lock+++ b/api/uv.lock@@ -1311,13 +1311,11 @@ requires-dist = [{ name = "e2b", marker = "extra == 'server'", specifier = ">=2.34.0,<3.0.0" },{ name = "fastapi", marker = "extra == 'server'", specifier = "==0.136.0" },{ name = "graphon", marker = "extra == 'server'", specifier = "==0.5.2" },- { name = "grpclib", extras = ["protobuf"], marker = "extra == 'grpc'", specifier = ">=0.4.9,<0.5.0" },{ name = "httpx", specifier = "==0.28.1" },{ name = "httpx2", specifier = ">=2.5.0,<3.0.0" },{ name = "jsonschema", marker = "extra == 'server'", specifier = ">=4.23.0,<5.0.0" },{ name = "jwcrypto", marker = "extra == 'server'", specifier = ">=1.5.6,<2" },{ name = "logfire", extras = ["fastapi", "httpx", "redis"], marker = "extra == 'server'", specifier = ">=4.37.0,<5.0.0" },- { name = "protobuf", marker = "extra == 'grpc'", specifier = ">=6.33.5,<7.0.0" },{ name = "pydantic", specifier = ">=2.12.5,<2.13" },{ name = "pydantic-ai-slim", specifier = ">=1.102.0,<2.0.0" },{ name = "pydantic-ai-slim", extras = ["anthropic", "google", "openai"], marker = "extra == 'server'", specifier = ">=1.85.1,<2.0.0" },@@ -1326,13 +1324,12 @@ requires-dist = [{ name = "typing-extensions", specifier = ">=4.12.2,<5.0.0" },{ name = "uvicorn", extras = ["standard"], marker = "extra == 'server'", specifier = "==0.46.0" },]-provides-extras = ["grpc", "server"]+provides-extras = ["server"][package.metadata.requires-dev]dev = [{ name = "basedpyright", specifier = ">=1.39.3" },{ name = "coverage", extras = ["toml"], specifier = ">=7.10.7" },- { name = "grpcio-tools", specifier = ">=1.81.0,<2.0.0" },{ name = "pytest", specifier = ">=9.0.3" },{ name = "pytest-examples", specifier = ">=0.0.18" },{ name = "pytest-mock", specifier = ">=3.14.0" },diff --git a/dify-agent-runtime/Makefile b/dify-agent-runtime/Makefileindex fffa071cc3b..76e853a03f9 100644--- a/dify-agent-runtime/Makefile+++ b/dify-agent-runtime/Makefile@@ -1,7 +1,5 @@-.PHONY: build clean test lint proto gen-cli-help integration integration-up integration-test integration-down+.PHONY: build clean test lint gen-cli-help integration integration-up integration-test integration-downBIN_DIR := bin-PROTO_SRC := ../dify-agent/proto/dify/agent/stub/v1/agent_stub.proto-PROTO_OUT := genAGENT_CLI_HELP_JSON := ../dify-agent/src/dify_agent/layers/_agent_cli_help.jsonbuild: $(BIN_DIR)/shellctl $(BIN_DIR)/shellctl-sanitize-pty $(BIN_DIR)/shellctl-runner-exit $(BIN_DIR)/shellctl-runner $(BIN_DIR)/dify-agent gen-cli-help@@ -19,7 +17,7 @@ $(BIN_DIR)/shellctl-runner: $(shell find cmd/runner internal/landlock internal/cgo build -o $@ ./cmd/runner-$(BIN_DIR)/dify-agent: $(shell find cmd/dify-agent-cli internal/agentcli internal/stubclient -name '*.go') $(shell find gen -name '*.go' 2>/dev/null)+$(BIN_DIR)/dify-agent: $(shell find cmd/dify-agent-cli internal/agentcli -name '*.go')go build -o $@ ./cmd/dify-agent-cli# Regenerate the JSON help snapshot from the Go command tree. Runs as part of@@ -33,14 +31,6 @@ test: lintlint:golangci-lint run ./...-proto:- @mkdir -p $(PROTO_OUT)- protoc \- --proto_path=../dify-agent/proto \- --go_out=$(PROTO_OUT) --go_opt=paths=source_relative \- --go-grpc_out=$(PROTO_OUT) --go-grpc_opt=paths=source_relative \- $(PROTO_SRC)-clean:rm -rf $(BIN_DIR)diff --git a/dify-agent-runtime/cmd/dify-agent-cli/main.go b/dify-agent-runtime/cmd/dify-agent-cli/main.goindex bcee7dc1fe4..176934886a1 100644--- a/dify-agent-runtime/cmd/dify-agent-cli/main.go+++ b/dify-agent-runtime/cmd/dify-agent-cli/main.go@@ -1,5 +1,5 @@// dify-agent-cli is the Go replacement for the Python dify-agent CLI.-// It communicates with the Agent Stub server via HTTP or gRPC to provide+// It communicates with the Agent Stub server via HTTP to provide// connect, file, drive, and config operations inside the sandbox container.package maindiff --git a/dify-agent-runtime/gen/dify/agent/stub/v1/agent_stub.pb.go b/dify-agent-runtime/gen/dify/agent/stub/v1/agent_stub.pb.godeleted file mode 100644index 1d67854634a..00000000000--- a/dify-agent-runtime/gen/dify/agent/stub/v1/agent_stub.pb.go+++ /dev/null@@ -1,515 +0,0 @@-// Code generated by protoc-gen-go. DO NOT EDIT.-// versions:-// protoc-gen-go v1.36.11-// protoc v5.28.3-// source: dify/agent/stub/v1/agent_stub.proto--package stubv1--import (- protoreflect "google.golang.org/protobuf/reflect/protoreflect"- protoimpl "google.golang.org/protobuf/runtime/protoimpl"- reflect "reflect"- sync "sync"- unsafe "unsafe"-)--const (- // Verify that this generated code is sufficiently up-to-date.- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)- // Verify that runtime/protoimpl is sufficiently up-to-date.- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)-)--type ConnectRequest struct {- state protoimpl.MessageState `protogen:"open.v1"`- ProtocolVersion int32 `protobuf:"varint,1,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"`- Argv []string `protobuf:"bytes,2,rep,name=argv,proto3" json:"argv,omitempty"`- MetadataJson string `protobuf:"bytes,3,opt,name=metadata_json,json=metadataJson,proto3" json:"metadata_json,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *ConnectRequest) Reset() {- *x = ConnectRequest{}- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[0]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *ConnectRequest) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*ConnectRequest) ProtoMessage() {}--func (x *ConnectRequest) ProtoReflect() protoreflect.Message {- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[0]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use ConnectRequest.ProtoReflect.Descriptor instead.-func (*ConnectRequest) Descriptor() ([]byte, []int) {- return file_dify_agent_stub_v1_agent_stub_proto_rawDescGZIP(), []int{0}-}--func (x *ConnectRequest) GetProtocolVersion() int32 {- if x != nil {- return x.ProtocolVersion- }- return 0-}--func (x *ConnectRequest) GetArgv() []string {- if x != nil {- return x.Argv- }- return nil-}--func (x *ConnectRequest) GetMetadataJson() string {- if x != nil {- return x.MetadataJson- }- return ""-}--type ConnectResponse struct {- state protoimpl.MessageState `protogen:"open.v1"`- ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"`- Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *ConnectResponse) Reset() {- *x = ConnectResponse{}- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[1]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *ConnectResponse) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*ConnectResponse) ProtoMessage() {}--func (x *ConnectResponse) ProtoReflect() protoreflect.Message {- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[1]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use ConnectResponse.ProtoReflect.Descriptor instead.-func (*ConnectResponse) Descriptor() ([]byte, []int) {- return file_dify_agent_stub_v1_agent_stub_proto_rawDescGZIP(), []int{1}-}--func (x *ConnectResponse) GetConnectionId() string {- if x != nil {- return x.ConnectionId- }- return ""-}--func (x *ConnectResponse) GetStatus() string {- if x != nil {- return x.Status- }- return ""-}--type FileUploadRequest struct {- state protoimpl.MessageState `protogen:"open.v1"`- Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"`- Mimetype string `protobuf:"bytes,2,opt,name=mimetype,proto3" json:"mimetype,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *FileUploadRequest) Reset() {- *x = FileUploadRequest{}- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[2]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *FileUploadRequest) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*FileUploadRequest) ProtoMessage() {}--func (x *FileUploadRequest) ProtoReflect() protoreflect.Message {- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[2]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use FileUploadRequest.ProtoReflect.Descriptor instead.-func (*FileUploadRequest) Descriptor() ([]byte, []int) {- return file_dify_agent_stub_v1_agent_stub_proto_rawDescGZIP(), []int{2}-}--func (x *FileUploadRequest) GetFilename() string {- if x != nil {- return x.Filename- }- return ""-}--func (x *FileUploadRequest) GetMimetype() string {- if x != nil {- return x.Mimetype- }- return ""-}--type FileUploadResponse struct {- state protoimpl.MessageState `protogen:"open.v1"`- UploadUrl string `protobuf:"bytes,1,opt,name=upload_url,json=uploadUrl,proto3" json:"upload_url,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *FileUploadResponse) Reset() {- *x = FileUploadResponse{}- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[3]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *FileUploadResponse) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*FileUploadResponse) ProtoMessage() {}--func (x *FileUploadResponse) ProtoReflect() protoreflect.Message {- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[3]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use FileUploadResponse.ProtoReflect.Descriptor instead.-func (*FileUploadResponse) Descriptor() ([]byte, []int) {- return file_dify_agent_stub_v1_agent_stub_proto_rawDescGZIP(), []int{3}-}--func (x *FileUploadResponse) GetUploadUrl() string {- if x != nil {- return x.UploadUrl- }- return ""-}--type FileMapping struct {- state protoimpl.MessageState `protogen:"open.v1"`- TransferMethod string `protobuf:"bytes,1,opt,name=transfer_method,json=transferMethod,proto3" json:"transfer_method,omitempty"`- Reference *string `protobuf:"bytes,2,opt,name=reference,proto3,oneof" json:"reference,omitempty"`- Url *string `protobuf:"bytes,3,opt,name=url,proto3,oneof" json:"url,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *FileMapping) Reset() {- *x = FileMapping{}- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[4]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *FileMapping) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*FileMapping) ProtoMessage() {}--func (x *FileMapping) ProtoReflect() protoreflect.Message {- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[4]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use FileMapping.ProtoReflect.Descriptor instead.-func (*FileMapping) Descriptor() ([]byte, []int) {- return file_dify_agent_stub_v1_agent_stub_proto_rawDescGZIP(), []int{4}-}--func (x *FileMapping) GetTransferMethod() string {- if x != nil {- return x.TransferMethod- }- return ""-}--func (x *FileMapping) GetReference() string {- if x != nil && x.Reference != nil {- return *x.Reference- }- return ""-}--func (x *FileMapping) GetUrl() string {- if x != nil && x.Url != nil {- return *x.Url- }- return ""-}--type FileDownloadRequest struct {- state protoimpl.MessageState `protogen:"open.v1"`- File *FileMapping `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"`- ForFrontend *bool `protobuf:"varint,2,opt,name=for_frontend,json=forFrontend,proto3,oneof" json:"for_frontend,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *FileDownloadRequest) Reset() {- *x = FileDownloadRequest{}- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[5]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *FileDownloadRequest) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*FileDownloadRequest) ProtoMessage() {}--func (x *FileDownloadRequest) ProtoReflect() protoreflect.Message {- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[5]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use FileDownloadRequest.ProtoReflect.Descriptor instead.-func (*FileDownloadRequest) Descriptor() ([]byte, []int) {- return file_dify_agent_stub_v1_agent_stub_proto_rawDescGZIP(), []int{5}-}--func (x *FileDownloadRequest) GetFile() *FileMapping {- if x != nil {- return x.File- }- return nil-}--func (x *FileDownloadRequest) GetForFrontend() bool {- if x != nil && x.ForFrontend != nil {- return *x.ForFrontend- }- return false-}--type FileDownloadResponse struct {- state protoimpl.MessageState `protogen:"open.v1"`- Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"`- MimeType *string `protobuf:"bytes,2,opt,name=mime_type,json=mimeType,proto3,oneof" json:"mime_type,omitempty"`- Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`- DownloadUrl string `protobuf:"bytes,4,opt,name=download_url,json=downloadUrl,proto3" json:"download_url,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *FileDownloadResponse) Reset() {- *x = FileDownloadResponse{}- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[6]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *FileDownloadResponse) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*FileDownloadResponse) ProtoMessage() {}--func (x *FileDownloadResponse) ProtoReflect() protoreflect.Message {- mi := &file_dify_agent_stub_v1_agent_stub_proto_msgTypes[6]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use FileDownloadResponse.ProtoReflect.Descriptor instead.-func (*FileDownloadResponse) Descriptor() ([]byte, []int) {- return file_dify_agent_stub_v1_agent_stub_proto_rawDescGZIP(), []int{6}-}--func (x *FileDownloadResponse) GetFilename() string {- if x != nil {- return x.Filename- }- return ""-}--func (x *FileDownloadResponse) GetMimeType() string {- if x != nil && x.MimeType != nil {- return *x.MimeType- }- return ""-}--func (x *FileDownloadResponse) GetSize() int64 {- if x != nil {- return x.Size- }- return 0-}--func (x *FileDownloadResponse) GetDownloadUrl() string {- if x != nil {- return x.DownloadUrl- }- return ""-}--var File_dify_agent_stub_v1_agent_stub_proto protoreflect.FileDescriptor--const file_dify_agent_stub_v1_agent_stub_proto_rawDesc = "" +- "\n" +- "#dify/agent/stub/v1/agent_stub.proto\x12\x12dify.agent.stub.v1\"t\n" +- "\x0eConnectRequest\x12)\n" +- "\x10protocol_version\x18\x01 \x01(\x05R\x0fprotocolVersion\x12\x12\n" +- "\x04argv\x18\x02 \x03(\tR\x04argv\x12#\n" +- "\rmetadata_json\x18\x03 \x01(\tR\fmetadataJson\"N\n" +- "\x0fConnectResponse\x12#\n" +- "\rconnection_id\x18\x01 \x01(\tR\fconnectionId\x12\x16\n" +- "\x06status\x18\x02 \x01(\tR\x06status\"K\n" +- "\x11FileUploadRequest\x12\x1a\n" +- "\bfilename\x18\x01 \x01(\tR\bfilename\x12\x1a\n" +- "\bmimetype\x18\x02 \x01(\tR\bmimetype\"3\n" +- "\x12FileUploadResponse\x12\x1d\n" +- "\n" +- "upload_url\x18\x01 \x01(\tR\tuploadUrl\"\x86\x01\n" +- "\vFileMapping\x12'\n" +- "\x0ftransfer_method\x18\x01 \x01(\tR\x0etransferMethod\x12!\n" +- "\treference\x18\x02 \x01(\tH\x00R\treference\x88\x01\x01\x12\x15\n" +- "\x03url\x18\x03 \x01(\tH\x01R\x03url\x88\x01\x01B\f\n" +- "\n" +- "_referenceB\x06\n" +- "\x04_url\"\x83\x01\n" +- "\x13FileDownloadRequest\x123\n" +- "\x04file\x18\x01 \x01(\v2\x1f.dify.agent.stub.v1.FileMappingR\x04file\x12&\n" +- "\ffor_frontend\x18\x02 \x01(\bH\x00R\vforFrontend\x88\x01\x01B\x0f\n" +- "\r_for_frontend\"\x99\x01\n" +- "\x14FileDownloadResponse\x12\x1a\n" +- "\bfilename\x18\x01 \x01(\tR\bfilename\x12 \n" +- "\tmime_type\x18\x02 \x01(\tH\x00R\bmimeType\x88\x01\x01\x12\x12\n" +- "\x04size\x18\x03 \x01(\x03R\x04size\x12!\n" +- "\fdownload_url\x18\x04 \x01(\tR\vdownloadUrlB\f\n" +- "\n" +- "_mime_type2\xc0\x02\n" +- "\x10AgentStubService\x12R\n" +- "\aConnect\x12\".dify.agent.stub.v1.ConnectRequest\x1a#.dify.agent.stub.v1.ConnectResponse\x12h\n" +- "\x17CreateFileUploadRequest\x12%.dify.agent.stub.v1.FileUploadRequest\x1a&.dify.agent.stub.v1.FileUploadResponse\x12n\n" +- "\x19CreateFileDownloadRequest\x12'.dify.agent.stub.v1.FileDownloadRequest\x1a(.dify.agent.stub.v1.FileDownloadResponseB\x1bZ\x19dify/agent/stub/v1;stubv1b\x06proto3"--var (- file_dify_agent_stub_v1_agent_stub_proto_rawDescOnce sync.Once- file_dify_agent_stub_v1_agent_stub_proto_rawDescData []byte-)--func file_dify_agent_stub_v1_agent_stub_proto_rawDescGZIP() []byte {- file_dify_agent_stub_v1_agent_stub_proto_rawDescOnce.Do(func() {- file_dify_agent_stub_v1_agent_stub_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_dify_agent_stub_v1_agent_stub_proto_rawDesc), len(file_dify_agent_stub_v1_agent_stub_proto_rawDesc)))- })- return file_dify_agent_stub_v1_agent_stub_proto_rawDescData-}--var file_dify_agent_stub_v1_agent_stub_proto_msgTypes = make([]protoimpl.MessageInfo, 7)-var file_dify_agent_stub_v1_agent_stub_proto_goTypes = []any{- (*ConnectRequest)(nil), // 0: dify.agent.stub.v1.ConnectRequest- (*ConnectResponse)(nil), // 1: dify.agent.stub.v1.ConnectResponse- (*FileUploadRequest)(nil), // 2: dify.agent.stub.v1.FileUploadRequest- (*FileUploadResponse)(nil), // 3: dify.agent.stub.v1.FileUploadResponse- (*FileMapping)(nil), // 4: dify.agent.stub.v1.FileMapping- (*FileDownloadRequest)(nil), // 5: dify.agent.stub.v1.FileDownloadRequest- (*FileDownloadResponse)(nil), // 6: dify.agent.stub.v1.FileDownloadResponse-}-var file_dify_agent_stub_v1_agent_stub_proto_depIdxs = []int32{- 4, // 0: dify.agent.stub.v1.FileDownloadRequest.file:type_name -> dify.agent.stub.v1.FileMapping- 0, // 1: dify.agent.stub.v1.AgentStubService.Connect:input_type -> dify.agent.stub.v1.ConnectRequest- 2, // 2: dify.agent.stub.v1.AgentStubService.CreateFileUploadRequest:input_type -> dify.agent.stub.v1.FileUploadRequest- 5, // 3: dify.agent.stub.v1.AgentStubService.CreateFileDownloadRequest:input_type -> dify.agent.stub.v1.FileDownloadRequest- 1, // 4: dify.agent.stub.v1.AgentStubService.Connect:output_type -> dify.agent.stub.v1.ConnectResponse- 3, // 5: dify.agent.stub.v1.AgentStubService.CreateFileUploadRequest:output_type -> dify.agent.stub.v1.FileUploadResponse- 6, // 6: dify.agent.stub.v1.AgentStubService.CreateFileDownloadRequest:output_type -> dify.agent.stub.v1.FileDownloadResponse- 4, // [4:7] is the sub-list for method output_type- 1, // [1:4] is the sub-list for method input_type- 1, // [1:1] is the sub-list for extension type_name- 1, // [1:1] is the sub-list for extension extendee- 0, // [0:1] is the sub-list for field type_name-}--func init() { file_dify_agent_stub_v1_agent_stub_proto_init() }-func file_dify_agent_stub_v1_agent_stub_proto_init() {- if File_dify_agent_stub_v1_agent_stub_proto != nil {- return- }- file_dify_agent_stub_v1_agent_stub_proto_msgTypes[4].OneofWrappers = []any{}- file_dify_agent_stub_v1_agent_stub_proto_msgTypes[5].OneofWrappers = []any{}- file_dify_agent_stub_v1_agent_stub_proto_msgTypes[6].OneofWrappers = []any{}- type x struct{}- out := protoimpl.TypeBuilder{- File: protoimpl.DescBuilder{- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),- RawDescriptor: unsafe.Slice(unsafe.StringData(file_dify_agent_stub_v1_agent_stub_proto_rawDesc), len(file_dify_agent_stub_v1_agent_stub_proto_rawDesc)),- NumEnums: 0,- NumMessages: 7,- NumExtensions: 0,- NumServices: 1,- },- GoTypes: file_dify_agent_stub_v1_agent_stub_proto_goTypes,- DependencyIndexes: file_dify_agent_stub_v1_agent_stub_proto_depIdxs,- MessageInfos: file_dify_agent_stub_v1_agent_stub_proto_msgTypes,- }.Build()- File_dify_agent_stub_v1_agent_stub_proto = out.File- file_dify_agent_stub_v1_agent_stub_proto_goTypes = nil- file_dify_agent_stub_v1_agent_stub_proto_depIdxs = nil-}diff --git a/dify-agent-runtime/gen/dify/agent/stub/v1/agent_stub_grpc.pb.go b/dify-agent-runtime/gen/dify/agent/stub/v1/agent_stub_grpc.pb.godeleted file mode 100644index f7b649df503..00000000000--- a/dify-agent-runtime/gen/dify/agent/stub/v1/agent_stub_grpc.pb.go+++ /dev/null@@ -1,197 +0,0 @@-// Code generated by protoc-gen-go-grpc. DO NOT EDIT.-// versions:-// - protoc-gen-go-grpc v1.6.2-// - protoc v5.28.3-// source: dify/agent/stub/v1/agent_stub.proto--package stubv1--import (- context "context"- grpc "google.golang.org/grpc"- codes "google.golang.org/grpc/codes"- status "google.golang.org/grpc/status"-)--// This is a compile-time assertion to ensure that this generated file-// is compatible with the grpc package it is being compiled against.-// Requires gRPC-Go v1.64.0 or later.-const _ = grpc.SupportPackageIsVersion9--const (- AgentStubService_Connect_FullMethodName = "/dify.agent.stub.v1.AgentStubService/Connect"- AgentStubService_CreateFileUploadRequest_FullMethodName = "/dify.agent.stub.v1.AgentStubService/CreateFileUploadRequest"- AgentStubService_CreateFileDownloadRequest_FullMethodName = "/dify.agent.stub.v1.AgentStubService/CreateFileDownloadRequest"-)--// AgentStubServiceClient is the client API for AgentStubService service.-//-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.-type AgentStubServiceClient interface {- Connect(ctx context.Context, in *ConnectRequest, opts ...grpc.CallOption) (*ConnectResponse, error)- CreateFileUploadRequest(ctx context.Context, in *FileUploadRequest, opts ...grpc.CallOption) (*FileUploadResponse, error)- CreateFileDownloadRequest(ctx context.Context, in *FileDownloadRequest, opts ...grpc.CallOption) (*FileDownloadResponse, error)-}--type agentStubServiceClient struct {- cc grpc.ClientConnInterface-}--func NewAgentStubServiceClient(cc grpc.ClientConnInterface) AgentStubServiceClient {- return &agentStubServiceClient{cc}-}--func (c *agentStubServiceClient) Connect(ctx context.Context, in *ConnectRequest, opts ...grpc.CallOption) (*ConnectResponse, error) {- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)- out := new(ConnectResponse)- err := c.cc.Invoke(ctx, AgentStubService_Connect_FullMethodName, in, out, cOpts...)- if err != nil {- return nil, err- }- return out, nil-}--func (c *agentStubServiceClient) CreateFileUploadRequest(ctx context.Context, in *FileUploadRequest, opts ...grpc.CallOption) (*FileUploadResponse, error) {- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)- out := new(FileUploadResponse)- err := c.cc.Invoke(ctx, AgentStubService_CreateFileUploadRequest_FullMethodName, in, out, cOpts...)- if err != nil {- return nil, err- }- return out, nil-}--func (c *agentStubServiceClient) CreateFileDownloadRequest(ctx context.Context, in *FileDownloadRequest, opts ...grpc.CallOption) (*FileDownloadResponse, error) {- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)- out := new(FileDownloadResponse)- err := c.cc.Invoke(ctx, AgentStubService_CreateFileDownloadRequest_FullMethodName, in, out, cOpts...)- if err != nil {- return nil, err- }- return out, nil-}--// AgentStubServiceServer is the server API for AgentStubService service.-// All implementations must embed UnimplementedAgentStubServiceServer-// for forward compatibility.-type AgentStubServiceServer interface {- Connect(context.Context, *ConnectRequest) (*ConnectResponse, error)- CreateFileUploadRequest(context.Context, *FileUploadRequest) (*FileUploadResponse, error)- CreateFileDownloadRequest(context.Context, *FileDownloadRequest) (*FileDownloadResponse, error)- mustEmbedUnimplementedAgentStubServiceServer()-}--// UnimplementedAgentStubServiceServer must be embedded to have-// forward compatible implementations.-//-// NOTE: this should be embedded by value instead of pointer to avoid a nil-// pointer dereference when methods are called.-type UnimplementedAgentStubServiceServer struct{}--func (UnimplementedAgentStubServiceServer) Connect(context.Context, *ConnectRequest) (*ConnectResponse, error) {- return nil, status.Error(codes.Unimplemented, "method Connect not implemented")-}-func (UnimplementedAgentStubServiceServer) CreateFileUploadRequest(context.Context, *FileUploadRequest) (*FileUploadResponse, error) {- return nil, status.Error(codes.Unimplemented, "method CreateFileUploadRequest not implemented")-}-func (UnimplementedAgentStubServiceServer) CreateFileDownloadRequest(context.Context, *FileDownloadRequest) (*FileDownloadResponse, error) {- return nil, status.Error(codes.Unimplemented, "method CreateFileDownloadRequest not implemented")-}-func (UnimplementedAgentStubServiceServer) mustEmbedUnimplementedAgentStubServiceServer() {}-func (UnimplementedAgentStubServiceServer) testEmbeddedByValue() {}--// UnsafeAgentStubServiceServer may be embedded to opt out of forward compatibility for this service.-// Use of this interface is not recommended, as added methods to AgentStubServiceServer will-// result in compilation errors.-type UnsafeAgentStubServiceServer interface {- mustEmbedUnimplementedAgentStubServiceServer()-}--func RegisterAgentStubServiceServer(s grpc.ServiceRegistrar, srv AgentStubServiceServer) {- // If the following call panics, it indicates UnimplementedAgentStubServiceServer was- // embedded by pointer and is nil. This will cause panics if an- // unimplemented method is ever invoked, so we test this at initialization- // time to prevent it from happening at runtime later due to I/O.- if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {- t.testEmbeddedByValue()- }- s.RegisterService(&AgentStubService_ServiceDesc, srv)-}--func _AgentStubService_Connect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {- in := new(ConnectRequest)- if err := dec(in); err != nil {- return nil, err- }- if interceptor == nil {- return srv.(AgentStubServiceServer).Connect(ctx, in)- }- info := &grpc.UnaryServerInfo{- Server: srv,- FullMethod: AgentStubService_Connect_FullMethodName,- }- handler := func(ctx context.Context, req interface{}) (interface{}, error) {- return srv.(AgentStubServiceServer).Connect(ctx, req.(*ConnectRequest))- }- return interceptor(ctx, in, info, handler)-}--func _AgentStubService_CreateFileUploadRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {- in := new(FileUploadRequest)- if err := dec(in); err != nil {- return nil, err- }- if interceptor == nil {- return srv.(AgentStubServiceServer).CreateFileUploadRequest(ctx, in)- }- info := &grpc.UnaryServerInfo{- Server: srv,- FullMethod: AgentStubService_CreateFileUploadRequest_FullMethodName,- }- handler := func(ctx context.Context, req interface{}) (interface{}, error) {- return srv.(AgentStubServiceServer).CreateFileUploadRequest(ctx, req.(*FileUploadRequest))- }- return interceptor(ctx, in, info, handler)-}--func _AgentStubService_CreateFileDownloadRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {- in := new(FileDownloadRequest)- if err := dec(in); err != nil {- return nil, err- }- if interceptor == nil {- return srv.(AgentStubServiceServer).CreateFileDownloadRequest(ctx, in)- }- info := &grpc.UnaryServerInfo{- Server: srv,- FullMethod: AgentStubService_CreateFileDownloadRequest_FullMethodName,- }- handler := func(ctx context.Context, req interface{}) (interface{}, error) {- return srv.(AgentStubServiceServer).CreateFileDownloadRequest(ctx, req.(*FileDownloadRequest))- }- return interceptor(ctx, in, info, handler)-}--// AgentStubService_ServiceDesc is the grpc.ServiceDesc for AgentStubService service.-// It's only intended for direct use with grpc.RegisterService,-// and not to be introspected or modified (even as a copy)-var AgentStubService_ServiceDesc = grpc.ServiceDesc{- ServiceName: "dify.agent.stub.v1.AgentStubService",- HandlerType: (*AgentStubServiceServer)(nil),- Methods: []grpc.MethodDesc{- {- MethodName: "Connect",- Handler: _AgentStubService_Connect_Handler,- },- {- MethodName: "CreateFileUploadRequest",- Handler: _AgentStubService_CreateFileUploadRequest_Handler,- },- {- MethodName: "CreateFileDownloadRequest",- Handler: _AgentStubService_CreateFileDownloadRequest_Handler,- },- },- Streams: []grpc.StreamDesc{},- Metadata: "dify/agent/stub/v1/agent_stub.proto",-}diff --git a/dify-agent-runtime/go.mod b/dify-agent-runtime/go.modindex 37f9e7b9e3c..9fa6c29ac6b 100644--- a/dify-agent-runtime/go.mod+++ b/dify-agent-runtime/go.mod@@ -5,8 +5,6 @@ go 1.26require (github.com/landlock-lsm/go-landlock v0.9.0github.com/spf13/cobra v1.10.2- google.golang.org/grpc v1.82.1- google.golang.org/protobuf v1.36.11modernc.org/sqlite v1.37.1)@@ -19,10 +17,9 @@ require (github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirectgithub.com/spf13/pflag v1.0.9 // indirectgolang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect- golang.org/x/net v0.55.0 // indirect+ golang.org/x/mod v0.35.0 // indirectgolang.org/x/sys v0.45.0 // indirect- golang.org/x/text v0.37.0 // indirect- google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 // indirect+ golang.org/x/tools v0.44.0 // indirectkernel.org/pub/linux/libs/security/libcap/psx v1.2.77 // indirectmodernc.org/libc v1.65.7 // indirectmodernc.org/mathutil v1.7.1 // indirectdiff --git a/dify-agent-runtime/go.sum b/dify-agent-runtime/go.sumindex 253a5c6f1d8..c5698692187 100644--- a/dify-agent-runtime/go.sum+++ b/dify-agent-runtime/go.sum@@ -1,16 +1,6 @@-github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=-github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=-github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=-github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=-github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=-github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=-github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=-github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=-github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=-github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=@@ -30,42 +20,18 @@ github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=-go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=-go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=-go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I=-go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0=-go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM=-go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY=-go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg=-go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg=-go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw=-go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A=-go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A=-go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0=go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM=golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0/go.mod h1:S9Xr4PYopiDyqSyp5NjCrhFrqg6A5zA2E/iPHPhqnS8=golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM=golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU=-golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8=-golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww=golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=-golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc=-golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38=golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=-gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=-gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=-google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 h1:RmoJA1ujG+/lRGNfUnOMfhCy5EipVMyvUE+KNbPbTlw=-google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=-google.golang.org/grpc v1.82.1 h1:NnAxzGRA0677vCa4BUkOAnO5+FfQqVl9iUXeD0IqcGE=-google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA=-google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=-google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=kernel.org/pub/linux/libs/security/libcap/psx v1.2.77 h1:Z06sMOzc0GNCwp6efaVrIrz4ywGJ1v+DP0pjVkOfDuA=kernel.org/pub/linux/libs/security/libcap/psx v1.2.77/go.mod h1:+l6Ee2F59XiJ2I6WR5ObpC1utCQJZ/VLsEbQCD8RG24=diff --git a/dify-agent-runtime/internal/agentcli/client.go b/dify-agent-runtime/internal/agentcli/client.goindex ecc5feb94d9..07c80515954 100644--- a/dify-agent-runtime/internal/agentcli/client.go+++ b/dify-agent-runtime/internal/agentcli/client.go@@ -2,10 +2,9 @@ package agentcliimport "context"-// StubClient abstracts Agent Stub control-plane and data-plane operations.-// Business logic depends only on this interface, never on HTTP/gRPC details.+// StubClient abstracts Agent Stub HTTP control-plane and file data-plane operations.type StubClient interface {- // Control-plane: available via gRPC or HTTP+ // HTTP control-planeConnect(ctx context.Context, argv []string, metadataJSON string) (*ConnectResponse, error)CreateFileUploadURL(ctx context.Context, filename, mimetype string) (string, error)CreateFileDownloadURL(ctx context.Context, transferMethod string, reference, url *string, forFrontend bool) (*FileDownloadResponse, error)@@ -16,8 +15,7 @@ type StubClient interface {// Config operations (HTTP-only control-plane)GetConfigManifest(ctx context.Context) ([]byte, error)- PullConfigSkill(ctx context.Context, name string) ([]byte, error)- PullConfigFile(ctx context.Context, name string) ([]byte, error)+ CreateConfigDownloadURL(ctx context.Context, kind, name string) (*FileDownloadResponse, error)PushConfig(ctx context.Context, payload any) ([]byte, error)PatchConfigEnv(ctx context.Context, envText string) ([]byte, error)PutConfigNote(ctx context.Context, note string) ([]byte, error)@@ -29,17 +27,13 @@ type StubClient interface {Close() error}-// NewStubClient creates the appropriate client based on the endpoint scheme.+// NewStubClient creates the HTTP Agent Stub client.func NewStubClient(env *Environment) (StubClient, error) {endpoint, err := ParseEndpoint(env.URL)if err != nil {return nil, err}-- httpClient := newHTTPStubClient(env)-- if endpoint.IsGRPC {- return newGRPCStubClient(endpoint, httpClient)- }- return httpClient, nil+ normalizedEnv := *env+ normalizedEnv.URL = endpoint.URL+ return newHTTPStubClient(&normalizedEnv), nil}diff --git a/dify-agent-runtime/internal/agentcli/client_grpc.go b/dify-agent-runtime/internal/agentcli/client_grpc.godeleted file mode 100644index ba6764b9d98..00000000000--- a/dify-agent-runtime/internal/agentcli/client_grpc.go+++ /dev/null@@ -1,69 +0,0 @@-package agentcli--import (- "context"- "fmt"-- "github.com/langgenius/dify/dify-agent-runtime/internal/stubclient"-)--// grpcStubClient implements StubClient with gRPC for Connect/FileUpload/FileDownload-// and delegates all other operations to the embedded HTTP client.-type grpcStubClient struct {- *httpStubClient- grpc *stubclient.Client-}--func newGRPCStubClient(endpoint *Endpoint, httpClient *httpStubClient) (*grpcStubClient, error) {- target := endpoint.Host + ":" + endpoint.Port- client, err := stubclient.Dial(target)- if err != nil {- return nil, fmt.Errorf("gRPC dial %s: %w", target, err)- }- return &grpcStubClient{- httpStubClient: httpClient,- grpc: client,- }, nil-}--func (c *grpcStubClient) Close() error {- return c.grpc.Close()-}--func (c *grpcStubClient) Connect(ctx context.Context, argv []string, metadataJSON string) (*ConnectResponse, error) {- if metadataJSON == "" {- metadataJSON = "{}"- }- result, err := c.grpc.Connect(ctx, agentStubProtocolVersion, argv, metadataJSON)- if err != nil {- return nil, err- }- return &ConnectResponse{- ConnectionID: result.ConnectionID,- Status: result.Status,- }, nil-}--func (c *grpcStubClient) CreateFileUploadURL(ctx context.Context, filename, mimetype string) (string, error) {- result, err := c.grpc.CreateFileUpload(ctx, filename, mimetype)- if err != nil {- return "", err- }- if result.UploadURL == "" {- return "", fmt.Errorf("signed file upload response is missing upload_url")- }- return result.UploadURL, nil-}--func (c *grpcStubClient) CreateFileDownloadURL(ctx context.Context, transferMethod string, reference, url *string, forFrontend bool) (*FileDownloadResponse, error) {- result, err := c.grpc.CreateFileDownload(ctx, transferMethod, reference, url, forFrontend)- if err != nil {- return nil, err- }- return &FileDownloadResponse{- Filename: result.Filename,- MimeType: result.MimeType,- Size: result.Size,- DownloadURL: result.DownloadURL,- }, nil-}diff --git a/dify-agent-runtime/internal/agentcli/client_http.go b/dify-agent-runtime/internal/agentcli/client_http.goindex c69c89b091a..fa01c818711 100644--- a/dify-agent-runtime/internal/agentcli/client_http.go+++ b/dify-agent-runtime/internal/agentcli/client_http.go@@ -152,26 +152,33 @@ func (c *httpStubClient) GetConfigManifest(_ context.Context) ([]byte, error) {return body, nil}-func (c *httpStubClient) PullConfigSkill(_ context.Context, name string) ([]byte, error) {- body, statusCode, err := c.http.getRaw(fmt.Sprintf("/config/skills/%s/pull", name), nil)+func (c *httpStubClient) CreateConfigDownloadURL(+ _ context.Context,+ kind, name string,+) (*FileDownloadResponse, error) {+ payload := map[string]any{+ "config": map[string]string{+ "kind": kind,+ "name": name,+ },+ "for_frontend": false,+ }+ body, statusCode, err := c.http.postJSON("/files/download-request", payload)if err != nil {return nil, err}- if err := checkHTTPError(body, statusCode, "config skill pull"); err != nil {+ if err := checkHTTPError(body, statusCode, "config download request"); err != nil {return nil, err}- return body, nil-}-func (c *httpStubClient) PullConfigFile(_ context.Context, name string) ([]byte, error) {- body, statusCode, err := c.http.getRaw(fmt.Sprintf("/config/files/%s/pull", name), nil)- if err != nil {- return nil, err+ var resp FileDownloadResponse+ if err := json.Unmarshal(body, &resp); err != nil {+ return nil, fmt.Errorf("parse config download response: %w", err)}- if err := checkHTTPError(body, statusCode, "config file pull"); err != nil {- return nil, err+ if resp.DownloadURL == "" {+ return nil, fmt.Errorf("signed config download response is missing download_url")}- return body, nil+ return &resp, nil}func (c *httpStubClient) PushConfig(_ context.Context, payload any) ([]byte, error) {diff --git a/dify-agent-runtime/internal/agentcli/config.go b/dify-agent-runtime/internal/agentcli/config.goindex 6b00d0147b3..d627625c542 100644--- a/dify-agent-runtime/internal/agentcli/config.go+++ b/dify-agent-runtime/internal/agentcli/config.go@@ -74,10 +74,14 @@ func RunConfigSkillsPull(env *Environment, names []string, localDir string, jsonvar items []pullItemfor _, name := range names {- archiveBytes, err := client.PullConfigSkill(ctx, name)+ download, err := client.CreateConfigDownloadURL(ctx, "skill", name)if err != nil {return err}+ archiveBytes, err := client.DownloadFromURL(download.DownloadURL)+ if err != nil {+ return fmt.Errorf("download config skill %q: %w", name, err)+ }archivePath := filepath.Join(targetDir, name+".zip")skillDir := filepath.Join(targetDir, name)@@ -168,10 +172,14 @@ func RunConfigFilesPull(env *Environment, names []string, localDir string, jsonOvar items []fileItemfor _, name := range names {- payload, err := client.PullConfigFile(ctx, name)+ download, err := client.CreateConfigDownloadURL(ctx, "file", name)if err != nil {return err}+ payload, err := client.DownloadFromURL(download.DownloadURL)+ if err != nil {+ return fmt.Errorf("download config file %q: %w", name, err)+ }targetPath := filepath.Join(targetDir, name)if err := os.MkdirAll(filepath.Dir(targetPath), 0o755); err != nil {diff --git a/dify-agent-runtime/internal/agentcli/config_test.go b/dify-agent-runtime/internal/agentcli/config_test.gonew file mode 100644index 00000000000..8f67d5c0863--- /dev/null+++ b/dify-agent-runtime/internal/agentcli/config_test.go@@ -0,0 +1,177 @@+package agentcli++import (+ "archive/zip"+ "bytes"+ "encoding/json"+ "net/http"+ "net/http/httptest"+ "os"+ "path/filepath"+ "strings"+ "testing"+)++func TestConfigPullRequestsURLThenDownloadsFromDataPlane(t *testing.T) {+ skillArchive := zipFixture(t, map[string]string{"SKILL.md": "# Alpha\n", "reference.md": "guide"})+ tests := []struct {+ name string+ kind string+ assetName string+ payload []byte+ run func(*Environment, string) error+ assertFiles func(*testing.T, string)+ }{+ {+ name: "file",+ kind: "file",+ assetName: "guide.txt",+ payload: []byte("guide"),+ run: func(env *Environment, targetDir string) error {+ return RunConfigFilesPull(env, []string{"guide.txt"}, targetDir, true)+ },+ assertFiles: func(t *testing.T, targetDir string) {+ data, err := os.ReadFile(filepath.Join(targetDir, "guide.txt"))+ if err != nil {+ t.Fatalf("read pulled config file: %v", err)+ }+ if string(data) != "guide" {+ t.Fatalf("pulled config file = %q", data)+ }+ },+ },+ {+ name: "skill",+ kind: "skill",+ assetName: "alpha",+ payload: skillArchive,+ run: func(env *Environment, targetDir string) error {+ return RunConfigSkillsPull(env, []string{"alpha"}, targetDir, true)+ },+ assertFiles: func(t *testing.T, targetDir string) {+ data, err := os.ReadFile(filepath.Join(targetDir, "alpha", "SKILL.md"))+ if err != nil {+ t.Fatalf("read pulled skill: %v", err)+ }+ if string(data) != "# Alpha\n" {+ t.Fatalf("pulled SKILL.md = %q", data)+ }+ },+ },+ }++ for _, test := range tests {+ t.Run(test.name, func(t *testing.T) {+ var controlPayload map[string]any+ dataPlaneCalls := 0+ var server *httptest.Server+ server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ switch r.URL.Path {+ case "/agent-stub/files/download-request":+ if err := json.NewDecoder(r.Body).Decode(&controlPayload); err != nil {+ http.Error(w, "bad request", http.StatusBadRequest)+ return+ }+ _ = json.NewEncoder(w).Encode(map[string]any{+ "filename": test.assetName,+ "mime_type": "application/octet-stream",+ "size": len(test.payload),+ "download_url": server.URL + "/files/config-asset",+ })+ case "/files/config-asset":+ dataPlaneCalls+++ _, _ = w.Write(test.payload)+ default:+ http.NotFound(w, r)+ }+ }))+ defer server.Close()++ targetDir := t.TempDir()+ err := test.run(&Environment{URL: server.URL + "/agent-stub", AuthJWE: "token"}, targetDir)+ if err != nil {+ t.Fatalf("pull config %s: %v", test.kind, err)+ }++ config, ok := controlPayload["config"].(map[string]any)+ if !ok {+ t.Fatalf("control payload config = %#v", controlPayload["config"])+ }+ if config["kind"] != test.kind || config["name"] != test.assetName {+ t.Fatalf("control payload config = %#v", config)+ }+ if controlPayload["for_frontend"] != false {+ t.Fatalf("for_frontend = %#v", controlPayload["for_frontend"])+ }+ if dataPlaneCalls != 1 {+ t.Fatalf("data-plane calls = %d, want 1", dataPlaneCalls)+ }+ test.assertFiles(t, targetDir)+ })+ }+}++func TestConfigPullReportsControlAndDataPlaneFailures(t *testing.T) {+ tests := []struct {+ name string+ controlStatus int+ dataStatus int+ want string+ }{+ {name: "control", controlStatus: http.StatusNotFound, dataStatus: http.StatusOK, want: "config download request failed"},+ {name: "data plane", controlStatus: http.StatusOK, dataStatus: http.StatusBadGateway, want: "download config file"},+ }++ for _, test := range tests {+ t.Run(test.name, func(t *testing.T) {+ var server *httptest.Server+ server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ switch r.URL.Path {+ case "/agent-stub/files/download-request":+ if test.controlStatus != http.StatusOK {+ w.WriteHeader(test.controlStatus)+ _, _ = w.Write([]byte(`{"detail":"missing"}`))+ return+ }+ _ = json.NewEncoder(w).Encode(map[string]any{+ "filename": "guide.txt", "size": 5, "download_url": server.URL + "/files/config-asset",+ })+ case "/files/config-asset":+ w.WriteHeader(test.dataStatus)+ default:+ http.NotFound(w, r)+ }+ }))+ defer server.Close()++ err := RunConfigFilesPull(+ &Environment{URL: server.URL + "/agent-stub", AuthJWE: "token"},+ []string{"guide.txt"},+ t.TempDir(),+ true,+ )+ if err == nil || !strings.Contains(err.Error(), test.want) {+ t.Fatalf("error = %v, want substring %q", err, test.want)+ }+ })+ }+}++func zipFixture(t *testing.T, files map[string]string) []byte {+ t.Helper()+ var buffer bytes.Buffer+ archive := zip.NewWriter(&buffer)+ for name, content := range files {+ writer, err := archive.Create(name)+ if err != nil {+ t.Fatalf("create zip member: %v", err)+ }+ if _, err := writer.Write([]byte(content)); err != nil {+ t.Fatalf("write zip member: %v", err)+ }+ }+ if err := archive.Close(); err != nil {+ t.Fatalf("close zip fixture: %v", err)+ }+ return buffer.Bytes()+}diff --git a/dify-agent-runtime/internal/agentcli/connect.go b/dify-agent-runtime/internal/agentcli/connect.goindex 6d17cc45e6f..3a81bc1155c 100644--- a/dify-agent-runtime/internal/agentcli/connect.go+++ b/dify-agent-runtime/internal/agentcli/connect.go@@ -6,8 +6,6 @@ import ("fmt")-const agentStubProtocolVersion = 1-// ConnectResponse is the JSON output for `dify-agent connect --json`.type ConnectResponse struct {ConnectionID string `json:"connection_id"`diff --git a/dify-agent-runtime/internal/agentcli/env.go b/dify-agent-runtime/internal/agentcli/env.goindex 1db58b057d2..04d6f5cf16d 100644--- a/dify-agent-runtime/internal/agentcli/env.go+++ b/dify-agent-runtime/internal/agentcli/env.go@@ -1,6 +1,5 @@// Package agentcli implements the dify-agent CLI that runs inside the sandbox-// container. It communicates with the Agent Stub server on the host via HTTP-// or gRPC to provide connect, file, drive, and config operations.+// container. It communicates with the Agent Stub server on the host via HTTP.package agentcliimport (@@ -27,13 +26,9 @@ type Environment struct {AuthJWE string}-// Endpoint represents a parsed Agent Stub endpoint with transport info.+// Endpoint represents a normalized HTTP Agent Stub endpoint.type Endpoint struct {- URL string- Scheme string // "http", "https", or "grpc"- Host string- Port string- IsGRPC bool+ URL string}var ErrMissingEnvironment = errors.New("missing required Agent Stub environment variables")@@ -90,14 +85,10 @@ func ParseEndpoint(rawURL string) (*Endpoint, error) {return nil, fmt.Errorf("invalid URL: %w", err)}- switch parsed.Scheme {- case "http", "https":- return parseHTTPEndpoint(parsed)- case "grpc":- return parseGRPCEndpoint(parsed)- default:- return nil, errors.New("agent stub URL must use http, https, or grpc")+ if parsed.Scheme != "http" && parsed.Scheme != "https" {+ return nil, errors.New("agent stub URL must use http or https")}+ return parseHTTPEndpoint(parsed)}func parseHTTPEndpoint(parsed *url.URL) (*Endpoint, error) {@@ -120,33 +111,6 @@ func parseHTTPEndpoint(parsed *url.URL) (*Endpoint, error) {normalizedURL := fmt.Sprintf("%s://%s%s", parsed.Scheme, parsed.Host, path)return &Endpoint{- URL: normalizedURL,- Scheme: parsed.Scheme,- Host: parsed.Hostname(),- Port: parsed.Port(),- IsGRPC: false,- }, nil-}--func parseGRPCEndpoint(parsed *url.URL) (*Endpoint, error) {- if parsed.Host == "" {- return nil, errors.New("gRPC agent stub URL must include a host")- }- path := strings.TrimRight(parsed.Path, "/")- if path != "" && path != "/" {- return nil, errors.New("gRPC agent stub URL must not include a path")- }- port := parsed.Port()- if port == "" {- return nil, errors.New("gRPC agent stub URL must include an explicit port")- }-- normalizedURL := fmt.Sprintf("grpc://%s:%s", parsed.Hostname(), port)- return &Endpoint{- URL: normalizedURL,- Scheme: "grpc",- Host: parsed.Hostname(),- Port: port,- IsGRPC: true,+ URL: normalizedURL,}, nil}diff --git a/dify-agent-runtime/internal/agentcli/env_test.go b/dify-agent-runtime/internal/agentcli/env_test.goindex 6d02f8014a8..d5b333c82e3 100644--- a/dify-agent-runtime/internal/agentcli/env_test.go+++ b/dify-agent-runtime/internal/agentcli/env_test.go@@ -1,6 +1,10 @@package agentcliimport (+ "context"+ "encoding/json"+ "net/http"+ "net/http/httptest""testing")@@ -58,55 +62,6 @@ func TestParseEndpoint_HTTP(t *testing.T) {if ep.URL != tc.wantURL {t.Errorf("URL = %q, want %q", ep.URL, tc.wantURL)}- if ep.IsGRPC {- t.Error("expected IsGRPC=false")- }- })- }-}--func TestParseEndpoint_GRPC(t *testing.T) {- tests := []struct {- name string- input string- wantURL string- wantErr bool- }{- {- name: "valid grpc endpoint",- input: "grpc://localhost:50051",- wantURL: "grpc://localhost:50051",- },- {- name: "grpc without port rejects",- input: "grpc://localhost",- wantErr: true,- },- {- name: "grpc with path rejects",- input: "grpc://localhost:50051/some-path",- wantErr: true,- },- }-- for _, tc := range tests {- t.Run(tc.name, func(t *testing.T) {- ep, err := ParseEndpoint(tc.input)- if tc.wantErr {- if err == nil {- t.Fatal("expected error")- }- return- }- if err != nil {- t.Fatalf("unexpected error: %v", err)- }- if ep.URL != tc.wantURL {- t.Errorf("URL = %q, want %q", ep.URL, tc.wantURL)- }- if !ep.IsGRPC {- t.Error("expected IsGRPC=true")- }})}}@@ -132,6 +87,34 @@ func TestParseEndpoint_Invalid(t *testing.T) {}}+func TestNewStubClient_NormalizesServiceRootWithoutMutatingEnvironment(t *testing.T) {+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if r.URL.Path != "/agent-stub/connections" {+ t.Errorf("request path = %q, want %q", r.URL.Path, "/agent-stub/connections")+ }+ _ = json.NewEncoder(w).Encode(ConnectResponse{ConnectionID: "connection-1", Status: "connected"})+ }))+ defer server.Close()++ env := &Environment{URL: server.URL, AuthJWE: "test-token"}+ client, err := NewStubClient(env)+ if err != nil {+ t.Fatalf("NewStubClient() error = %v", err)+ }+ defer func() { _ = client.Close() }()++ response, err := client.Connect(context.Background(), nil, "")+ if err != nil {+ t.Fatalf("Connect() error = %v", err)+ }+ if response.ConnectionID != "connection-1" {+ t.Errorf("connection ID = %q, want %q", response.ConnectionID, "connection-1")+ }+ if env.URL != server.URL {+ t.Errorf("caller environment URL = %q, want unchanged %q", env.URL, server.URL)+ }+}+func TestReadEnvironment_Missing(t *testing.T) {t.Setenv(EnvAPIBaseURL, "")t.Setenv(EnvAuthJWE, "")diff --git a/dify-agent-runtime/internal/agentcli/httpclient.go b/dify-agent-runtime/internal/agentcli/httpclient.goindex 95c3614bf1b..cc17d224657 100644--- a/dify-agent-runtime/internal/agentcli/httpclient.go+++ b/dify-agent-runtime/internal/agentcli/httpclient.go@@ -93,11 +93,6 @@ func (c *HTTPClient) getJSON(path string, params map[string]string) ([]byte, intreturn respBody, resp.StatusCode, nil}-// getRaw sends a GET request and returns raw bytes (for binary downloads).-func (c *HTTPClient) getRaw(path string, params map[string]string) ([]byte, int, error) {- return c.getJSON(path, params)-}-// patchJSON sends a PATCH request with JSON body.func (c *HTTPClient) patchJSON(path string, payload any) ([]byte, int, error) {body, err := json.Marshal(payload)diff --git a/dify-agent-runtime/internal/envvar/envvar.go b/dify-agent-runtime/internal/envvar/envvar.goindex e93af4e828c..40f9f9a97ad 100644--- a/dify-agent-runtime/internal/envvar/envvar.go+++ b/dify-agent-runtime/internal/envvar/envvar.go@@ -23,7 +23,7 @@ const (// --- Agent Stub ---const (- // EnvAgentStubAPIBaseURL is the Agent Stub HTTP/gRPC endpoint.+ // EnvAgentStubAPIBaseURL is the Agent Stub HTTP endpoint.EnvAgentStubAPIBaseURL = "DIFY_AGENT_STUB_API_BASE_URL"// EnvAgentStubAuthJWE is the per-request JWE token for Agent Stub auth.diff --git a/dify-agent-runtime/internal/stubclient/client.go b/dify-agent-runtime/internal/stubclient/client.godeleted file mode 100644index 9c3c0a659b1..00000000000--- a/dify-agent-runtime/internal/stubclient/client.go+++ /dev/null@@ -1,143 +0,0 @@-// Package stubclient provides a gRPC client for the Dify Agent Stub service.-//-// The Agent Stub service runs on the host (dify-agent backend) and exposes-// Connect, FileUpload, and FileDownload RPCs to sandbox-resident processes.-// This client is used by the dify-agent CLI binary inside the sandbox container.-package stubclient--import (- "context"- "fmt"- "time"-- "google.golang.org/grpc"- "google.golang.org/grpc/credentials/insecure"-- stubv1 "github.com/langgenius/dify/dify-agent-runtime/gen/dify/agent/stub/v1"-)--// Client wraps the gRPC AgentStubService client with connection lifecycle management.-type Client struct {- conn *grpc.ClientConn- stub stubv1.AgentStubServiceClient- timeout time.Duration-}--// Option configures a Client.-type Option func(*Client)--// WithTimeout sets the default per-call timeout. Default is 30s.-func WithTimeout(d time.Duration) Option {- return func(c *Client) {- c.timeout = d- }-}--// Dial creates a new Client connected to the given target address (host:port).-func Dial(target string, opts ...Option) (*Client, error) {- c := &Client{timeout: 30 * time.Second}- for _, o := range opts {- o(c)- }-- conn, err := grpc.NewClient(target, grpc.WithTransportCredentials(insecure.NewCredentials()))- if err != nil {- return nil, fmt.Errorf("stubclient: dial %s: %w", target, err)- }- c.conn = conn- c.stub = stubv1.NewAgentStubServiceClient(conn)- return c, nil-}--// Close closes the underlying gRPC connection.-func (c *Client) Close() error {- if c.conn != nil {- return c.conn.Close()- }- return nil-}--// ConnectResult holds the response from a Connect RPC.-type ConnectResult struct {- ConnectionID string- Status string-}--// Connect establishes a logical connection with the Agent Stub server.-func (c *Client) Connect(ctx context.Context, protocolVersion int32, argv []string, metadataJSON string) (*ConnectResult, error) {- ctx, cancel := context.WithTimeout(ctx, c.timeout)- defer cancel()-- resp, err := c.stub.Connect(ctx, &stubv1.ConnectRequest{- ProtocolVersion: protocolVersion,- Argv: argv,- MetadataJson: metadataJSON,- })- if err != nil {- return nil, fmt.Errorf("stubclient: connect: %w", err)- }- return &ConnectResult{- ConnectionID: resp.GetConnectionId(),- Status: resp.GetStatus(),- }, nil-}--// FileUploadResult holds the response from a CreateFileUploadRequest RPC.-type FileUploadResult struct {- UploadURL string-}--// CreateFileUpload requests an upload URL from the Agent Stub server.-func (c *Client) CreateFileUpload(ctx context.Context, filename, mimetype string) (*FileUploadResult, error) {- ctx, cancel := context.WithTimeout(ctx, c.timeout)- defer cancel()-- resp, err := c.stub.CreateFileUploadRequest(ctx, &stubv1.FileUploadRequest{- Filename: filename,- Mimetype: mimetype,- })- if err != nil {- return nil, fmt.Errorf("stubclient: file upload: %w", err)- }- return &FileUploadResult{- UploadURL: resp.GetUploadUrl(),- }, nil-}--// FileDownloadResult holds the response from a CreateFileDownloadRequest RPC.-type FileDownloadResult struct {- Filename string- MimeType string- Size int64- DownloadURL string-}--// CreateFileDownload requests a download URL from the Agent Stub server.-func (c *Client) CreateFileDownload(ctx context.Context, transferMethod string, reference, url *string, forFrontend bool) (*FileDownloadResult, error) {- ctx, cancel := context.WithTimeout(ctx, c.timeout)- defer cancel()-- fileMapping := &stubv1.FileMapping{- TransferMethod: transferMethod,- }- if reference != nil {- fileMapping.Reference = reference- }- if url != nil {- fileMapping.Url = url- }-- resp, err := c.stub.CreateFileDownloadRequest(ctx, &stubv1.FileDownloadRequest{- File: fileMapping,- ForFrontend: &forFrontend,- })- if err != nil {- return nil, fmt.Errorf("stubclient: file download: %w", err)- }- return &FileDownloadResult{- Filename: resp.GetFilename(),- MimeType: resp.GetMimeType(),- Size: resp.GetSize(),- DownloadURL: resp.GetDownloadUrl(),- }, nil-}diff --git a/dify-agent-runtime/internal/stubclient/client_test.go b/dify-agent-runtime/internal/stubclient/client_test.godeleted file mode 100644index 13499b67499..00000000000--- a/dify-agent-runtime/internal/stubclient/client_test.go+++ /dev/null@@ -1,114 +0,0 @@-package stubclient--import (- "context"- "net"- "testing"-- "google.golang.org/grpc"-- stubv1 "github.com/langgenius/dify/dify-agent-runtime/gen/dify/agent/stub/v1"-)--// fakeServer implements the AgentStubService for testing.-type fakeServer struct {- stubv1.UnimplementedAgentStubServiceServer-}--func (f *fakeServer) Connect(_ context.Context, req *stubv1.ConnectRequest) (*stubv1.ConnectResponse, error) {- return &stubv1.ConnectResponse{- ConnectionId: "conn-123",- Status: "connected",- }, nil-}--func (f *fakeServer) CreateFileUploadRequest(_ context.Context, req *stubv1.FileUploadRequest) (*stubv1.FileUploadResponse, error) {- return &stubv1.FileUploadResponse{- UploadUrl: "https://upload.example.com/" + req.GetFilename(),- }, nil-}--func (f *fakeServer) CreateFileDownloadRequest(_ context.Context, req *stubv1.FileDownloadRequest) (*stubv1.FileDownloadResponse, error) {- return &stubv1.FileDownloadResponse{- Filename: "downloaded.txt",- MimeType: strPtr("text/plain"),- Size: 1024,- DownloadUrl: "https://download.example.com/file",- }, nil-}--func strPtr(s string) *string { return &s }--func startFakeServer(t *testing.T) string {- t.Helper()- lis, err := net.Listen("tcp", "127.0.0.1:0")- if err != nil {- t.Fatalf("failed to listen: %v", err)- }- srv := grpc.NewServer()- stubv1.RegisterAgentStubServiceServer(srv, &fakeServer{})- go func() { _ = srv.Serve(lis) }()- t.Cleanup(srv.Stop)- return lis.Addr().String()-}--func TestConnect(t *testing.T) {- addr := startFakeServer(t)- c, err := Dial(addr)- if err != nil {- t.Fatalf("Dial failed: %v", err)- }- defer func() { _ = c.Close() }()-- result, err := c.Connect(context.Background(), 1, []string{"hello"}, `{"key":"val"}`)- if err != nil {- t.Fatalf("Connect failed: %v", err)- }- if result.ConnectionID != "conn-123" {- t.Errorf("expected conn-123, got %s", result.ConnectionID)- }- if result.Status != "connected" {- t.Errorf("expected connected, got %s", result.Status)- }-}--func TestCreateFileUpload(t *testing.T) {- addr := startFakeServer(t)- c, err := Dial(addr)- if err != nil {- t.Fatalf("Dial failed: %v", err)- }- defer func() { _ = c.Close() }()-- result, err := c.CreateFileUpload(context.Background(), "test.txt", "text/plain")- if err != nil {- t.Fatalf("CreateFileUpload failed: %v", err)- }- if result.UploadURL != "https://upload.example.com/test.txt" {- t.Errorf("unexpected upload URL: %s", result.UploadURL)- }-}--func TestCreateFileDownload(t *testing.T) {- addr := startFakeServer(t)- c, err := Dial(addr)- if err != nil {- t.Fatalf("Dial failed: %v", err)- }- defer func() { _ = c.Close() }()-- ref := "dify-file-ref:abc123"- result, err := c.CreateFileDownload(context.Background(), "local_file", &ref, nil, false)- if err != nil {- t.Fatalf("CreateFileDownload failed: %v", err)- }- if result.Filename != "downloaded.txt" {- t.Errorf("unexpected filename: %s", result.Filename)- }- if result.Size != 1024 {- t.Errorf("unexpected size: %d", result.Size)- }- if result.DownloadURL != "https://download.example.com/file" {- t.Errorf("unexpected download URL: %s", result.DownloadURL)- }-}diff --git a/dify-agent/.example.env b/dify-agent/.example.envindex e2973a0785a..d713539fe6b 100644--- a/dify-agent/.example.env+++ b/dify-agent/.example.env@@ -56,11 +56,12 @@ DIFY_AGENT_SHELL_REDACT_PATTERNS=# Agent Stub# Public Agent Stub URL reachable from shellctl-managed remote machines.-# Use http(s)://.../agent-stub for HTTP or grpc://host:port for gRPC.+# Use an HTTP(S) service root or an explicit /agent-stub API root.# Leave empty to avoid injecting DIFY_AGENT_STUB_* into shell.run jobs.DIFY_AGENT_STUB_API_BASE_URL=http://localhost:5050/agent-stub-# Optional bind override used only when DIFY_AGENT_STUB_API_BASE_URL uses grpc://.-DIFY_AGENT_STUB_GRPC_BIND_ADDRESS=+# Dify API base URL reachable from the Sandbox for the signed /files/* data plane,+# including Config file and skill pulls.+DIFY_AGENT_SANDBOX_FILES_BASE_URL=http://localhost:5001# Server-wide root secret used to derive Agent Stub JWE keys.# This is security-sensitive: it derives the JWE encryption key for Agent Stub bearer tokens.# Replace this development default in production.diff --git a/dify-agent/docs/dify-agent/guide/index.md b/dify-agent/docs/dify-agent/guide/index.mdindex 2774d4438f6..b79c0629628 100644--- a/dify-agent/docs/dify-agent/guide/index.md+++ b/dify-agent/docs/dify-agent/guide/index.md@@ -56,9 +56,8 @@ also reads `.env` and `dify-agent/.env` when present.| `DIFY_AGENT_E2B_SHELLCTL_PORT` | `5004` | shellctl port exposed by the E2B template. || `DIFY_AGENT_SANDBOX_FILE_UPLOAD_MAX_BYTES` | `52428800` | Standalone Dify Agent maximum for whole-file Workspace upload capture; 50 MiB by default. Docker Compose derives it from `PLUGIN_MAX_FILE_SIZE`. || `DIFY_AGENT_SHELL_REDACT_PATTERNS` | empty | JSON array of additional regex patterns redacted from Shell output. |-| `DIFY_AGENT_STUB_API_BASE_URL` | empty | Agent Stub API base URL reachable from the Sandbox. HTTP may be the service root or `/agent-stub`; gRPC must be `grpc://host:port`. Enables `DIFY_AGENT_STUB_*` env injection for user `shell.run` jobs. |-| `DIFY_AGENT_SANDBOX_FILES_BASE_URL` | empty | Dify API base URL reachable from the Sandbox for signed `/files/*` upload/download bytes. Required when Agent Stub file operations are enabled. May include an ingress path prefix, but not a query or fragment. |-| `DIFY_AGENT_STUB_GRPC_BIND_ADDRESS` | empty | Optional `host:port` bind override used only when `DIFY_AGENT_STUB_API_BASE_URL` uses `grpc://`. |+| `DIFY_AGENT_STUB_API_BASE_URL` | empty | HTTP(S) Agent Stub API base URL reachable from the Sandbox. It may be the service root or `/agent-stub`. Enables `DIFY_AGENT_STUB_*` env injection for user `shell.run` jobs. |+| `DIFY_AGENT_SANDBOX_FILES_BASE_URL` | empty | Dify API base URL reachable from the Sandbox for signed `/files/*` upload/download bytes, including Config file and skill pulls. Required when Agent Stub file operations are enabled. May include an ingress path prefix, but not a query or fragment. || `DIFY_AGENT_SERVER_SECRET_KEY` | empty | Security-sensitive server-wide root secret used to derive the JWE encryption key for Agent Stub bearer tokens; required when `DIFY_AGENT_STUB_API_BASE_URL` is set. The supplied default config uses a development value; set a unique unpadded base64url 32-byte secret in production. || `DIFY_AGENT_OUTBOUND_HTTP_CONNECT_TIMEOUT` | `10` | Shared outbound HTTP connect timeout in seconds. || `DIFY_AGENT_OUTBOUND_HTTP_READ_TIMEOUT` | `600` | Shared outbound HTTP read timeout in seconds. |@@ -100,6 +99,14 @@ requests use `DIFY_AGENT_STUB_API_BASE_URL`; signed file bytes use`DIFY_AGENT_SANDBOX_FILES_BASE_URL`. `DIFY_AGENT_INNER_API_URL` remains atrusted service-to-service URL and is never returned to the Sandbox.+Config file and skill pulls use the same split: Agent Stub authorizes the+Config target and returns a short-lived URL, then the Sandbox fetches the bytes+directly from the Dify API `/files/*` data plane.++Removing Agent Stub gRPC is a breaking transport migration: replace every+`grpc://` Agent Stub URL with HTTP(S), remove+`DIFY_AGENT_STUB_GRPC_BIND_ADDRESS`, and deploy without a gRPC fallback.+For a remote Sandbox, expose only `/agent-stub/*` from Agent Backend and theexisting `/files/*` Dify API data plane. The `/files/*` ingress must preservethe complete signed query string, allow the configured upload body size, anddiff --git a/dify-agent/docs/dify-agent/user-manual/shell-layer/index.md b/dify-agent/docs/dify-agent/user-manual/shell-layer/index.mdindex 0f1d923ffea..91b83927ff3 100644--- a/dify-agent/docs/dify-agent/user-manual/shell-layer/index.md+++ b/dify-agent/docs/dify-agent/user-manual/shell-layer/index.md@@ -96,7 +96,7 @@ DIFY_AGENT_SERVER_SECRET_KEY=replace-with-unpadded-base64url-for-32-random-bytesHTTP URLs may be either the service root or the explicit `/agent-stub` root.The server normalizes a service root and rejects unrelated paths. The separateSandbox file base must point to the Dify API ingress serving `/files/*`; it is-used for CLI upload/download bytes even when Agent Stub control calls use gRPC.+used for CLI upload/download bytes, including Config file and skill pulls.After `dify-agent file upload <path>` succeeds, the CLI prints JSON such as:diff --git a/dify-agent/proto/dify/agent/stub/v1/agent_stub.proto b/dify-agent/proto/dify/agent/stub/v1/agent_stub.protodeleted file mode 100644index fddd165feba..00000000000--- a/dify-agent/proto/dify/agent/stub/v1/agent_stub.proto+++ /dev/null@@ -1,49 +0,0 @@-syntax = "proto3";--package dify.agent.stub.v1;--option go_package = "dify/agent/stub/v1;stubv1";--service AgentStubService {- rpc Connect(ConnectRequest) returns (ConnectResponse);- rpc CreateFileUploadRequest(FileUploadRequest) returns (FileUploadResponse);- rpc CreateFileDownloadRequest(FileDownloadRequest) returns (FileDownloadResponse);-}--message ConnectRequest {- int32 protocol_version = 1;- repeated string argv = 2;- string metadata_json = 3;-}--message ConnectResponse {- string connection_id = 1;- string status = 2;-}--message FileUploadRequest {- string filename = 1;- string mimetype = 2;-}--message FileUploadResponse {- string upload_url = 1;-}--message FileMapping {- string transfer_method = 1;- optional string reference = 2;- optional string url = 3;-}--message FileDownloadRequest {- FileMapping file = 1;- optional bool for_frontend = 2;-}--message FileDownloadResponse {- string filename = 1;- optional string mime_type = 2;- int64 size = 3;- string download_url = 4;-}diff --git a/dify-agent/pyproject.toml b/dify-agent/pyproject.tomlindex 36757323c6b..a4512aa6c48 100644--- a/dify-agent/pyproject.toml+++ b/dify-agent/pyproject.toml@@ -17,7 +17,6 @@ dify-agent-stub-server = "dify_agent.agent_stub.server.cli:main"[project.optional-dependencies]-grpc = ["grpclib[protobuf]>=0.4.9,<0.5.0", "protobuf>=6.33.5,<7.0.0"]server = ["e2b>=2.34.0,<3.0.0","fastapi==0.136.0",@@ -59,7 +58,6 @@ include = ["src/**/*.py", "examples/**/*.py", "tests/**/*.py", "docs/**/*.py"]dev = ["basedpyright>=1.39.3","coverage[toml]>=7.10.7",- "grpcio-tools>=1.81.0,<2.0.0","pytest>=9.0.3","pytest-examples>=0.0.18","pytest-mock>=3.14.0",diff --git a/dify-agent/src/dify_agent/agent_stub/grpc/__init__.py b/dify-agent/src/dify_agent/agent_stub/grpc/__init__.pydeleted file mode 100644index d6c26981fe1..00000000000--- a/dify-agent/src/dify_agent/agent_stub/grpc/__init__.py+++ /dev/null@@ -1,3 +0,0 @@-"""Internal gRPC helpers for the optional Agent Stub transport."""--__all__: list[str] = []diff --git a/dify-agent/src/dify_agent/agent_stub/grpc/_generated/__init__.py b/dify-agent/src/dify_agent/agent_stub/grpc/_generated/__init__.pydeleted file mode 100644index 60221b58eaf..00000000000--- a/dify-agent/src/dify_agent/agent_stub/grpc/_generated/__init__.py+++ /dev/null@@ -1,3 +0,0 @@-"""Generated protobuf and grpclib code for the Agent Stub gRPC contract."""--__all__: list[str] = []diff --git a/dify-agent/src/dify_agent/agent_stub/grpc/_generated/agent_stub_grpc.py b/dify-agent/src/dify_agent/agent_stub/grpc/_generated/agent_stub_grpc.pydeleted file mode 100644index e8850813cc0..00000000000--- a/dify-agent/src/dify_agent/agent_stub/grpc/_generated/agent_stub_grpc.py+++ /dev/null@@ -1,80 +0,0 @@-# Generated by the Protocol Buffers compiler. DO NOT EDIT!-# source: dify/agent/stub/v1/agent_stub.proto-# plugin: grpclib.plugin.main-import abc-import typing--import grpclib.client-import grpclib.const--from . import agent_stub_pb2--if typing.TYPE_CHECKING:- import grpclib.server---class AgentStubServiceBase(abc.ABC):- @abc.abstractmethod- async def Connect(- self,- stream: "grpclib.server.Stream[agent_stub_pb2.ConnectRequest, agent_stub_pb2.ConnectResponse]",- ) -> None:- pass-- @abc.abstractmethod- async def CreateFileUploadRequest(- self,- stream: "grpclib.server.Stream[agent_stub_pb2.FileUploadRequest, agent_stub_pb2.FileUploadResponse]",- ) -> None:- pass-- @abc.abstractmethod- async def CreateFileDownloadRequest(- self,- stream: "grpclib.server.Stream[agent_stub_pb2.FileDownloadRequest, agent_stub_pb2.FileDownloadResponse]",- ) -> None:- pass-- def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]:- return {- "/dify.agent.stub.v1.AgentStubService/Connect": grpclib.const.Handler(- self.Connect,- grpclib.const.Cardinality.UNARY_UNARY,- agent_stub_pb2.ConnectRequest,- agent_stub_pb2.ConnectResponse,- ),- "/dify.agent.stub.v1.AgentStubService/CreateFileUploadRequest": grpclib.const.Handler(- self.CreateFileUploadRequest,- grpclib.const.Cardinality.UNARY_UNARY,- agent_stub_pb2.FileUploadRequest,- agent_stub_pb2.FileUploadResponse,- ),- "/dify.agent.stub.v1.AgentStubService/CreateFileDownloadRequest": grpclib.const.Handler(- self.CreateFileDownloadRequest,- grpclib.const.Cardinality.UNARY_UNARY,- agent_stub_pb2.FileDownloadRequest,- agent_stub_pb2.FileDownloadResponse,- ),- }---class AgentStubServiceStub:- def __init__(self, channel: grpclib.client.Channel) -> None:- self.Connect = grpclib.client.UnaryUnaryMethod(- channel,- "/dify.agent.stub.v1.AgentStubService/Connect",- agent_stub_pb2.ConnectRequest,- agent_stub_pb2.ConnectResponse,- )- self.CreateFileUploadRequest = grpclib.client.UnaryUnaryMethod(- channel,- "/dify.agent.stub.v1.AgentStubService/CreateFileUploadRequest",- agent_stub_pb2.FileUploadRequest,- agent_stub_pb2.FileUploadResponse,- )- self.CreateFileDownloadRequest = grpclib.client.UnaryUnaryMethod(- channel,- "/dify.agent.stub.v1.AgentStubService/CreateFileDownloadRequest",- agent_stub_pb2.FileDownloadRequest,- agent_stub_pb2.FileDownloadResponse,- )diff --git a/dify-agent/src/dify_agent/agent_stub/grpc/_generated/agent_stub_pb2.py b/dify-agent/src/dify_agent/agent_stub/grpc/_generated/agent_stub_pb2.pydeleted file mode 100644index 3b43456bf94..00000000000--- a/dify-agent/src/dify_agent/agent_stub/grpc/_generated/agent_stub_pb2.py+++ /dev/null@@ -1,48 +0,0 @@-# -*- coding: utf-8 -*--# Generated by the protocol buffer compiler. DO NOT EDIT!-# NO CHECKED-IN PROTOBUF GENCODE-# source: dify/agent/stub/v1/agent_stub.proto-# Protobuf Python Version: 6.33.5-"""Generated protocol buffer code."""--from google.protobuf import descriptor as _descriptor-from google.protobuf import descriptor_pool as _descriptor_pool-from google.protobuf import runtime_version as _runtime_version-from google.protobuf import symbol_database as _symbol_database-from google.protobuf.internal import builder as _builder--_runtime_version.ValidateProtobufRuntimeVersion(- _runtime_version.Domain.PUBLIC, 6, 33, 5, "", "dify/agent/stub/v1/agent_stub.proto"-)-# @@protoc_insertion_point(imports)--_sym_db = _symbol_database.Default()---DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(- b'\n#dify/agent/stub/v1/agent_stub.proto\x12\x12\x64ify.agent.stub.v1"O\n\x0e\x43onnectRequest\x12\x18\n\x10protocol_version\x18\x01 \x01(\x05\x12\x0c\n\x04\x61rgv\x18\x02 \x03(\t\x12\x15\n\rmetadata_json\x18\x03 \x01(\t"8\n\x0f\x43onnectResponse\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12\x0e\n\x06status\x18\x02 \x01(\t"7\n\x11\x46ileUploadRequest\x12\x10\n\x08\x66ilename\x18\x01 \x01(\t\x12\x10\n\x08mimetype\x18\x02 \x01(\t"(\n\x12\x46ileUploadResponse\x12\x12\n\nupload_url\x18\x01 \x01(\t"f\n\x0b\x46ileMapping\x12\x17\n\x0ftransfer_method\x18\x01 \x01(\t\x12\x16\n\treference\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x10\n\x03url\x18\x03 \x01(\tH\x01\x88\x01\x01\x42\x0c\n\n_referenceB\x06\n\x04_url"p\n\x13\x46ileDownloadRequest\x12-\n\x04\x66ile\x18\x01 \x01(\x0b\x32\x1f.dify.agent.stub.v1.FileMapping\x12\x19\n\x0c\x66or_frontend\x18\x02 \x01(\x08H\x00\x88\x01\x01\x42\x0f\n\r_for_frontend"r\n\x14\x46ileDownloadResponse\x12\x10\n\x08\x66ilename\x18\x01 \x01(\t\x12\x16\n\tmime_type\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x0c\n\x04size\x18\x03 \x01(\x03\x12\x14\n\x0c\x64ownload_url\x18\x04 \x01(\tB\x0c\n\n_mime_type2\xc0\x02\n\x10\x41gentStubService\x12R\n\x07\x43onnect\x12".dify.agent.stub.v1.ConnectRequest\x1a#.dify.agent.stub.v1.ConnectResponse\x12h\n\x17\x43reateFileUploadRequest\x12%.dify.agent.stub.v1.FileUploadRequest\x1a&.dify.agent.stub.v1.FileUploadResponse\x12n\n\x19\x43reateFileDownloadRequest\x12\'.dify.agent.stub.v1.FileDownloadRequest\x1a(.dify.agent.stub.v1.FileDownloadResponseB\x1bZ\x19\x64ify/agent/stub/v1;stubv1b\x06proto3'-)--_globals = globals()-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "dify.agent.stub.v1.agent_stub_pb2", _globals)-if not _descriptor._USE_C_DESCRIPTORS:- _globals["DESCRIPTOR"]._loaded_options = None- _globals["DESCRIPTOR"]._serialized_options = b"Z\031dify/agent/stub/v1;stubv1"- _globals["_CONNECTREQUEST"]._serialized_start = 59- _globals["_CONNECTREQUEST"]._serialized_end = 138- _globals["_CONNECTRESPONSE"]._serialized_start = 140- _globals["_CONNECTRESPONSE"]._serialized_end = 196- _globals["_FILEUPLOADREQUEST"]._serialized_start = 198- _globals["_FILEUPLOADREQUEST"]._serialized_end = 253- _globals["_FILEUPLOADRESPONSE"]._serialized_start = 255- _globals["_FILEUPLOADRESPONSE"]._serialized_end = 295- _globals["_FILEMAPPING"]._serialized_start = 297- _globals["_FILEMAPPING"]._serialized_end = 399- _globals["_FILEDOWNLOADREQUEST"]._serialized_start = 401- _globals["_FILEDOWNLOADREQUEST"]._serialized_end = 513- _globals["_FILEDOWNLOADRESPONSE"]._serialized_start = 515- _globals["_FILEDOWNLOADRESPONSE"]._serialized_end = 629- _globals["_AGENTSTUBSERVICE"]._serialized_start = 632- _globals["_AGENTSTUBSERVICE"]._serialized_end = 952-# @@protoc_insertion_point(module_scope)diff --git a/dify-agent/src/dify_agent/agent_stub/grpc/_generated/agent_stub_pb2.pyi b/dify-agent/src/dify_agent/agent_stub/grpc/_generated/agent_stub_pb2.pyideleted file mode 100644index 9f05ba759e5..00000000000--- a/dify-agent/src/dify_agent/agent_stub/grpc/_generated/agent_stub_pb2.pyi+++ /dev/null@@ -1,69 +0,0 @@-from google.protobuf.internal import containers as _containers-from google.protobuf import descriptor as _descriptor-from google.protobuf import message as _message-from collections.abc import Iterable as _Iterable, Mapping as _Mapping-from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union--DESCRIPTOR: _descriptor.FileDescriptor--class ConnectRequest(_message.Message):- __slots__ = ("protocol_version", "argv", "metadata_json")- PROTOCOL_VERSION_FIELD_NUMBER: _ClassVar[int]- ARGV_FIELD_NUMBER: _ClassVar[int]- METADATA_JSON_FIELD_NUMBER: _ClassVar[int]- protocol_version: int- argv: _containers.RepeatedScalarFieldContainer[str]- metadata_json: str- def __init__(self, protocol_version: _Optional[int] = ..., argv: _Optional[_Iterable[str]] = ..., metadata_json: _Optional[str] = ...) -> None: ...--class ConnectResponse(_message.Message):- __slots__ = ("connection_id", "status")- CONNECTION_ID_FIELD_NUMBER: _ClassVar[int]- STATUS_FIELD_NUMBER: _ClassVar[int]- connection_id: str- status: str- def __init__(self, connection_id: _Optional[str] = ..., status: _Optional[str] = ...) -> None: ...--class FileUploadRequest(_message.Message):- __slots__ = ("filename", "mimetype")- FILENAME_FIELD_NUMBER: _ClassVar[int]- MIMETYPE_FIELD_NUMBER: _ClassVar[int]- filename: str- mimetype: str- def __init__(self, filename: _Optional[str] = ..., mimetype: _Optional[str] = ...) -> None: ...--class FileUploadResponse(_message.Message):- __slots__ = ("upload_url",)- UPLOAD_URL_FIELD_NUMBER: _ClassVar[int]- upload_url: str- def __init__(self, upload_url: _Optional[str] = ...) -> None: ...--class FileMapping(_message.Message):- __slots__ = ("transfer_method", "reference", "url")- TRANSFER_METHOD_FIELD_NUMBER: _ClassVar[int]- REFERENCE_FIELD_NUMBER: _ClassVar[int]- URL_FIELD_NUMBER: _ClassVar[int]- transfer_method: str- reference: str- url: str- def __init__(self, transfer_method: _Optional[str] = ..., reference: _Optional[str] = ..., url: _Optional[str] = ...) -> None: ...--class FileDownloadRequest(_message.Message):- __slots__ = ("file", "for_frontend")- FILE_FIELD_NUMBER: _ClassVar[int]- FOR_FRONTEND_FIELD_NUMBER: _ClassVar[int]- file: FileMapping- for_frontend: bool- def __init__(self, file: _Optional[_Union[FileMapping, _Mapping]] = ..., for_frontend: _Optional[bool] = ...) -> None: ...--class FileDownloadResponse(_message.Message):- __slots__ = ("filename", "mime_type", "size", "download_url")- FILENAME_FIELD_NUMBER: _ClassVar[int]- MIME_TYPE_FIELD_NUMBER: _ClassVar[int]- SIZE_FIELD_NUMBER: _ClassVar[int]- DOWNLOAD_URL_FIELD_NUMBER: _ClassVar[int]- filename: str- mime_type: str- size: int- download_url: str- def __init__(self, filename: _Optional[str] = ..., mime_type: _Optional[str] = ..., size: _Optional[int] = ..., download_url: _Optional[str] = ...) -> None: ...diff --git a/dify-agent/src/dify_agent/agent_stub/grpc/conversions.py b/dify-agent/src/dify_agent/agent_stub/grpc/conversions.pydeleted file mode 100644index 72e5642c46e..00000000000--- a/dify-agent/src/dify_agent/agent_stub/grpc/conversions.py+++ /dev/null@@ -1,174 +0,0 @@-"""Conversions between Agent Stub protobuf messages and public DTOs."""--from __future__ import annotations--import json-from collections.abc import Mapping-from typing import TYPE_CHECKING--from pydantic import JsonValue--from dify_agent.agent_stub.protocol.agent_stub import (- AgentStubConnectRequest,- AgentStubConnectResponse,- AgentStubFileDownloadRequest,- AgentStubFileDownloadResponse,- AgentStubFileMapping,- AgentStubFileUploadRequest,- AgentStubFileUploadResponse,-)--if TYPE_CHECKING:- from dify_agent.agent_stub.grpc._generated import agent_stub_pb2---def connect_request_from_proto(message: agent_stub_pb2.ConnectRequest) -> AgentStubConnectRequest:- """Validate one protobuf connect request into the public DTO."""- metadata: object = {}- if message.metadata_json:- metadata = json.loads(message.metadata_json)- return AgentStubConnectRequest.model_validate(- {- "protocol_version": message.protocol_version,- "argv": list(message.argv),- "metadata": metadata,- }- )---def proto_connect_request(- pb2_module,- *,- argv: list[str],- metadata: Mapping[str, JsonValue] | None,-) -> agent_stub_pb2.ConnectRequest:- """Build one protobuf connect request from public client inputs."""- request = AgentStubConnectRequest(argv=argv, metadata=dict(metadata or {}))- return pb2_module.ConnectRequest(- protocol_version=request.protocol_version,- argv=request.argv,- metadata_json=json.dumps(request.metadata, separators=(",", ":")),- )---def connect_response_from_proto(message: agent_stub_pb2.ConnectResponse) -> AgentStubConnectResponse:- """Validate one protobuf connect response into the public DTO."""- return AgentStubConnectResponse.model_validate(- {- "connection_id": message.connection_id,- "status": message.status,- }- )---def proto_connect_response(response: AgentStubConnectResponse, *, pb2_module=None) -> agent_stub_pb2.ConnectResponse:- """Build one protobuf connect response from the public DTO."""- resolved_pb2 = pb2_module or _require_pb2_module()- return resolved_pb2.ConnectResponse(connection_id=response.connection_id, status=response.status)---def file_upload_request_from_proto(message: agent_stub_pb2.FileUploadRequest) -> AgentStubFileUploadRequest:- """Validate one protobuf file-upload request into the public DTO."""- return AgentStubFileUploadRequest.model_validate({"filename": message.filename, "mimetype": message.mimetype})---def proto_file_upload_request(pb2_module, *, filename: str, mimetype: str) -> agent_stub_pb2.FileUploadRequest:- """Build one protobuf file-upload request from public client inputs."""- request = AgentStubFileUploadRequest(filename=filename, mimetype=mimetype)- return pb2_module.FileUploadRequest(filename=request.filename, mimetype=request.mimetype)---def file_upload_response_from_proto(message: agent_stub_pb2.FileUploadResponse) -> AgentStubFileUploadResponse:- """Validate one protobuf file-upload response into the public DTO."""- return AgentStubFileUploadResponse.model_validate({"upload_url": message.upload_url})---def proto_file_upload_response(- response: AgentStubFileUploadResponse, *, pb2_module=None-) -> agent_stub_pb2.FileUploadResponse:- """Build one protobuf file-upload response from the public DTO."""- resolved_pb2 = pb2_module or _require_pb2_module()- return resolved_pb2.FileUploadResponse(upload_url=response.upload_url)---def file_download_request_from_proto(message: agent_stub_pb2.FileDownloadRequest) -> AgentStubFileDownloadRequest:- """Validate one protobuf file-download request into the public DTO."""- file_mapping_kwargs = {- "transfer_method": message.file.transfer_method,- "reference": message.file.reference if message.file.HasField("reference") else None,- "url": message.file.url if message.file.HasField("url") else None,- }- return AgentStubFileDownloadRequest.model_validate(- {- "file": file_mapping_kwargs,- "for_frontend": message.for_frontend if message.HasField("for_frontend") else True,- }- )---def proto_file_download_request(- pb2_module,- *,- file: AgentStubFileMapping,- for_frontend: bool = True,-) -> agent_stub_pb2.FileDownloadRequest:- """Build one protobuf file-download request from the public DTO."""- mapping = pb2_module.FileMapping(transfer_method=file.transfer_method)- if file.reference is not None:- mapping.reference = file.reference- if file.url is not None:- mapping.url = file.url- request = pb2_module.FileDownloadRequest(file=mapping)- request.for_frontend = for_frontend- return request---def file_download_response_from_proto(message: agent_stub_pb2.FileDownloadResponse) -> AgentStubFileDownloadResponse:- """Validate one protobuf file-download response into the public DTO."""- return AgentStubFileDownloadResponse.model_validate(- {- "filename": message.filename,- "mime_type": message.mime_type if message.HasField("mime_type") else None,- "size": message.size,- "download_url": message.download_url,- }- )---def proto_file_download_response(- response: AgentStubFileDownloadResponse,- *,- pb2_module=None,-) -> agent_stub_pb2.FileDownloadResponse:- """Build one protobuf file-download response from the public DTO."""- resolved_pb2 = pb2_module or _require_pb2_module()- message = resolved_pb2.FileDownloadResponse(- filename=response.filename,- size=response.size,- download_url=response.download_url,- )- if response.mime_type is not None:- message.mime_type = response.mime_type- return message---def _require_pb2_module():- from dify_agent.agent_stub.grpc._generated import agent_stub_pb2-- return agent_stub_pb2---__all__ = [- "connect_request_from_proto",- "connect_response_from_proto",- "file_download_request_from_proto",- "file_download_response_from_proto",- "file_upload_request_from_proto",- "file_upload_response_from_proto",- "proto_connect_request",- "proto_connect_response",- "proto_file_download_request",- "proto_file_download_response",- "proto_file_upload_request",- "proto_file_upload_response",-]diff --git a/dify-agent/src/dify_agent/agent_stub/protocol/__init__.py b/dify-agent/src/dify_agent/agent_stub/protocol/__init__.pyindex 6aedf24b08b..9bd7d1f994a 100644--- a/dify-agent/src/dify_agent/agent_stub/protocol/__init__.py+++ b/dify-agent/src/dify_agent/agent_stub/protocol/__init__.py@@ -8,6 +8,7 @@ from .agent_stub import (AGENT_STUB_API_BASE_URL_ENV_VAR,AgentStubConnectRequest,AgentStubConnectResponse,+ AgentStubConfigDownloadSource,AgentStubConfigEnvUpdateRequest,AgentStubConfigFileItem,AgentStubConfigFileRef,@@ -33,12 +34,10 @@ from .agent_stub import (AgentStubFileUploadResponse,AgentStubURLScheme,agent_stub_config_env_url,- agent_stub_config_file_pull_url,agent_stub_config_manifest_url,agent_stub_config_note_url,agent_stub_config_push_url,agent_stub_config_skill_inspect_url,- agent_stub_config_skill_pull_url,agent_stub_connections_url,agent_stub_drive_base_for_ref,agent_stub_drive_commit_url,@@ -58,6 +57,7 @@ __all__ = ["DEFAULT_AGENT_STUB_DRIVE_BASE","AgentStubConnectRequest","AgentStubConnectResponse",+ "AgentStubConfigDownloadSource","AgentStubConfigEnvUpdateRequest","AgentStubConfigFileItem","AgentStubConfigFileRef",@@ -83,12 +83,10 @@ __all__ = ["AgentStubFileUploadResponse","AgentStubURLScheme","agent_stub_config_env_url",- "agent_stub_config_file_pull_url","agent_stub_config_manifest_url","agent_stub_config_note_url","agent_stub_config_push_url","agent_stub_config_skill_inspect_url",- "agent_stub_config_skill_pull_url","agent_stub_connections_url","agent_stub_drive_base_for_ref","agent_stub_drive_commit_url",diff --git a/dify-agent/src/dify_agent/agent_stub/protocol/agent_stub.py b/dify-agent/src/dify_agent/agent_stub/protocol/agent_stub.pyindex 2287117bea3..3b0c8c419bb 100644--- a/dify-agent/src/dify_agent/agent_stub/protocol/agent_stub.py+++ b/dify-agent/src/dify_agent/agent_stub/protocol/agent_stub.py@@ -1,7 +1,7 @@-"""Client-safe DTOs and endpoint parsing for the Agent Stub protocol.+"""Client-safe DTOs and endpoint parsing for the Agent Stub HTTP protocol.-The Agent Stub contract is shared by the HTTP router, optional gRPC transport,-the sandbox-visible CLI, and tests. Control-plane requests always validate into+The Agent Stub contract is shared by the HTTP router, the sandbox-visible CLI,+and tests. Control-plane requests always validate intothese Pydantic DTOs before business logic runs, while token issuance and JWEvalidation stay under ``dify_agent.agent_stub.server.tokens.agent_stub`` so thedefault package remains free of server-only crypto dependencies.@@ -11,6 +11,7 @@ from __future__ import annotationsimport base64import json+import refrom dataclasses import dataclassfrom typing import ClassVar, Final, Literalfrom urllib.parse import urlsplit, urlunsplit@@ -24,7 +25,7 @@ AGENT_STUB_PROTOCOL_VERSION: Final[int] = 1AGENT_STUB_API_BASE_URL_ENV_VAR: Final[str] = "DIFY_AGENT_STUB_API_BASE_URL"AGENT_STUB_AUTH_JWE_ENV_VAR: Final[str] = "DIFY_AGENT_STUB_AUTH_JWE"-type AgentStubURLScheme = Literal["http", "https", "grpc"]+type AgentStubURLScheme = Literal["http", "https"]@dataclass(frozen=True, slots=True)@@ -37,14 +38,6 @@ class AgentStubEndpoint:port: int | Nonepath: str- @property- def is_http(self) -> bool:- return self.scheme in {"http", "https"}-- @property- def is_grpc(self) -> bool:- return self.scheme == "grpc"-def agent_stub_drive_base_for_ref(drive_ref: str | None) -> str:"""Return the fixed sandbox-local Agent Stub drive base for one drive ref."""@@ -58,20 +51,13 @@ def agent_stub_drive_base_for_ref(drive_ref: str | None) -> str:def parse_agent_stub_endpoint(url: str) -> AgentStubEndpoint:- """Parse one Agent Stub endpoint URL for HTTP or gRPC transport selection.-- HTTP(S) endpoints accept either the service root or the explicit- ``/agent-stub`` API root and normalize to the latter. gRPC endpoints must be- plain ``grpc://host:port`` targets with no path, query string, or fragment- because transport routing happens on the gRPC service name instead of an- HTTP URL path.- """+ """Parse an HTTP(S) Agent Stub endpoint and normalize its API root."""stripped = url.strip()if not stripped:raise ValueError("Agent Stub URL must not be empty")parsed = urlsplit(stripped)- if parsed.scheme not in {"http", "https", "grpc"}:- raise ValueError("Agent Stub URL must use http, https, or grpc")+ if parsed.scheme not in {"http", "https"}:+ raise ValueError("Agent Stub URL must use http or https")if not parsed.netloc:raise ValueError("Agent Stub URL must include a host")if parsed.username is not None or parsed.password is not None:@@ -82,21 +68,6 @@ def parse_agent_stub_endpoint(url: str) -> AgentStubEndpoint:raise ValueError("Agent Stub URL must include a host")scheme = parsed.scheme- if scheme == "grpc":- if parsed.path not in {"", "/"}:- raise ValueError("gRPC Agent Stub URL must not include a path")- if parsed.port is None:- raise ValueError("gRPC Agent Stub URL must include an explicit port")- host = parsed.hostname- normalized_url = f"grpc://{_format_url_host(host)}:{parsed.port}"- return AgentStubEndpoint(- url=normalized_url,- scheme="grpc",- host=host,- port=parsed.port,- path="",- )-normalized_path = parsed.path.rstrip("/")if normalized_path in {"", "/"}:normalized_path = "/agent-stub"@@ -147,18 +118,10 @@ def agent_stub_config_manifest_url(base_url: str) -> str:return f"{_require_http_base_url(base_url)}/config/manifest"-def agent_stub_config_skill_pull_url(base_url: str, name: str) -> str:- return f"{_require_http_base_url(base_url)}/config/skills/{name}/pull"--def agent_stub_config_skill_inspect_url(base_url: str, name: str) -> str:return f"{_require_http_base_url(base_url)}/config/skills/{name}/inspect"-def agent_stub_config_file_pull_url(base_url: str, name: str) -> str:- return f"{_require_http_base_url(base_url)}/config/files/{name}/pull"--def agent_stub_config_push_url(base_url: str) -> str:return f"{_require_http_base_url(base_url)}/config/push"@@ -245,6 +208,32 @@ class AgentStubFileMapping(BaseModel):return self+class AgentStubConfigDownloadSource(BaseModel):+ """Config asset selected by name within the authenticated Config target."""++ kind: Literal["file", "skill"]+ name: str++ model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")++ @model_validator(mode="after")+ def validate_name(self) -> "AgentStubConfigDownloadSource":+ normalized = self.name.strip()+ if (+ not normalized+ or normalized in {".", ".."}+ or "/" in normalized+ or "\\" in normalized+ or "\x00" in normalized+ or any(ord(char) < 0x20 for char in normalized)+ ):+ raise ValueError("config asset name must be a safe path segment")+ if self.kind == "skill" and re.fullmatch(r"[a-z0-9][a-z0-9_-]{0,63}", normalized) is None:+ raise ValueError("config skill name is invalid")+ self.name = normalized+ return self++class AgentStubFileDownloadRequest(BaseModel):"""Request one file URL for a specific consumer audience.@@ -254,7 +243,8 @@ class AgentStubFileDownloadRequest(BaseModel):``for_external`` remains accepted for one compatibility cycle."""- file: AgentStubFileMapping+ file: AgentStubFileMapping | None = None+ config: AgentStubConfigDownloadSource | None = Nonefor_frontend: bool = Field(default=True,validation_alias=AliasChoices("for_frontend", "for_external"),@@ -262,6 +252,14 @@ class AgentStubFileDownloadRequest(BaseModel):model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")+ @model_validator(mode="after")+ def validate_source(self) -> "AgentStubFileDownloadRequest":+ if (self.file is None) == (self.config is None):+ raise ValueError("exactly one of file or config is required")+ if self.config is not None and self.for_frontend:+ raise ValueError("config downloads are available only to the Sandbox data plane")+ return self+class AgentStubFileDownloadResponse(BaseModel):"""Response body containing download metadata plus the signed URL."""@@ -421,14 +419,7 @@ class AgentStubConfigNoteUpdateRequest(BaseModel):def _require_http_base_url(base_url: str) -> str:- endpoint = parse_agent_stub_endpoint(base_url)- if not endpoint.is_http:- raise ValueError("HTTP Agent Stub URLs must use http or https")- return endpoint.url---def _format_url_host(host: str) -> str:- return f"[{host}]" if ":" in host and not host.startswith("[") else host+ return parse_agent_stub_endpoint(base_url).url__all__ = [@@ -441,6 +432,7 @@ __all__ = ["AgentStubConnectResponse","AgentStubEndpoint","AgentStubConfigEnvUpdateRequest",+ "AgentStubConfigDownloadSource","AgentStubConfigFileItem","AgentStubConfigFileItemsResponse","AgentStubConfigFileRef",@@ -466,12 +458,10 @@ __all__ = ["AgentStubFileUploadResponse","AgentStubURLScheme","agent_stub_config_env_url",- "agent_stub_config_file_pull_url","agent_stub_config_manifest_url","agent_stub_config_note_url","agent_stub_config_push_url","agent_stub_config_skill_inspect_url",- "agent_stub_config_skill_pull_url","agent_stub_connections_url","agent_stub_drive_base_for_ref","agent_stub_drive_commit_url",diff --git a/dify-agent/src/dify_agent/agent_stub/server/agent_stub_config.py b/dify-agent/src/dify_agent/agent_stub/server/agent_stub_config.pyindex 46f4a13bb77..993267c8c7f 100644--- a/dify-agent/src/dify_agent/agent_stub/server/agent_stub_config.py+++ b/dify-agent/src/dify_agent/agent_stub/server/agent_stub_config.py@@ -2,8 +2,8 @@Config requests are scoped entirely by the signed execution context carried inthe Agent Stub token. Tenant, agent, user, and config-version identifiers come-only from that trusted context; sandbox request bodies contribute only mutable-content such as asset names, env text, and note text.+only from that trusted context; Sandbox request bodies provide only allowed+Config operation inputs and asset selectors."""from __future__ import annotations@@ -16,10 +16,13 @@ import httpxfrom pydantic import ValidationErrorfrom dify_agent.agent_stub.protocol.agent_stub import (+ AgentStubConfigDownloadSource,AgentStubConfigManifestResponse,AgentStubConfigPushRequest,AgentStubConfigPushResponse,+ AgentStubFileDownloadResponse,)+from dify_agent.agent_stub.server.agent_stub_files import bind_sandbox_file_urifrom dify_agent.agent_stub.server.tokens.agent_stub import AgentStubPrincipalfrom dify_agent.layers.execution_context import DifyExecutionContextLayerConfig@@ -27,12 +30,15 @@ from dify_agent.layers.execution_context import DifyExecutionContextLayerConfigclass AgentStubConfigRequestHandler(Protocol):async def manifest(self, *, principal: AgentStubPrincipal) -> AgentStubConfigManifestResponse: ...- async def pull_skill(self, *, principal: AgentStubPrincipal, name: str) -> bytes: ...+ async def create_download_request(+ self,+ *,+ principal: AgentStubPrincipal,+ source: AgentStubConfigDownloadSource,+ ) -> AgentStubFileDownloadResponse: ...async def inspect_skill(self, *, principal: AgentStubPrincipal, name: str) -> dict[str, object]: ...- async def pull_file(self, *, principal: AgentStubPrincipal, name: str) -> bytes: ...-async def push(self,*,@@ -59,13 +65,16 @@ class AgentStubConfigRequestError(RuntimeError):class DifyApiAgentStubConfigRequestHandler:"""Call Dify API inner config endpoints on behalf of authenticated sandboxes.- The sandbox never chooses tenant, agent, user, or config-version scope- directly. Those routing fields are derived from the signed execution- context, while request payloads only carry mutable config content.+ The Sandbox never chooses tenant, agent, user, or config-version scope.+ Those routing fields come from the signed execution context, while request+ payloads carry only allowed Config operation inputs or asset selectors. A+ download request forwards metadata only and binds the returned URI to the+ Sandbox files base URL; it never proxies file bytes."""inner_api_url: strinner_api_key: str+ sandbox_files_base_url: strtimeout: httpx.Timeout | float = 30.0async def manifest(self, *, principal: AgentStubPrincipal) -> AgentStubConfigManifestResponse:@@ -79,12 +88,35 @@ class DifyApiAgentStubConfigRequestHandler:except ValidationError as exc:raise AgentStubConfigRequestError(502, "Dify API config manifest response is invalid") from exc- async def pull_skill(self, *, principal: AgentStubPrincipal, name: str) -> bytes:+ async def create_download_request(+ self,+ *,+ principal: AgentStubPrincipal,+ source: AgentStubConfigDownloadSource,+ ) -> AgentStubFileDownloadResponse:execution_context = self._require_config_context(principal.execution_context)- return await self._get_inner_api_bytes(- f"/inner/api/agent-config/{execution_context.agent_id}/skills/{name}/pull",- self._config_query_params(execution_context),+ payload = await self._post_inner_api_json(+ f"/inner/api/agent-config/{execution_context.agent_id}/download-request",+ {+ **self._config_query_params(execution_context),+ "config": source.model_dump(mode="json"),+ },)+ if not isinstance(payload, dict):+ raise AgentStubConfigRequestError(502, "Dify API config download response is invalid")+ download_uri = payload.get("download_uri")+ if not isinstance(download_uri, str) or not download_uri:+ raise AgentStubConfigRequestError(502, "Dify API config download response is missing download_uri")+ try:+ download_url = bind_sandbox_file_uri(+ sandbox_files_base_url=self.sandbox_files_base_url,+ uri=download_uri,+ )+ return AgentStubFileDownloadResponse.model_validate(+ {key: value for key, value in payload.items() if key != "download_uri"} | {"download_url": download_url}+ )+ except (ValueError, ValidationError) as exc:+ raise AgentStubConfigRequestError(502, "Dify API config download response is invalid") from excasync def inspect_skill(self, *, principal: AgentStubPrincipal, name: str) -> dict[str, object]:execution_context = self._require_config_context(principal.execution_context)@@ -96,13 +128,6 @@ class DifyApiAgentStubConfigRequestHandler:raise AgentStubConfigRequestError(502, "Dify API config skill inspect response is invalid")return payload- async def pull_file(self, *, principal: AgentStubPrincipal, name: str) -> bytes:- execution_context = self._require_config_context(principal.execution_context)- return await self._get_inner_api_bytes(- f"/inner/api/agent-config/{execution_context.agent_id}/files/{name}/pull",- self._config_query_params(execution_context),- )-async def push(self,*,@@ -190,18 +215,6 @@ class DifyApiAgentStubConfigRequestHandler:response, invalid_json_detail="Dify API config request returned invalid JSON")- async def _get_inner_api_bytes(self, path: str, params: Mapping[str, str]) -> bytes:- response = await self._request("GET", path, params=dict(params))- if response.is_error:- detail = self._normalize_json_payload(- response,- invalid_json_detail="Dify API config request returned invalid JSON",- )- raise AgentStubConfigRequestError(- response.status_code, detail.get("detail", detail) if isinstance(detail, dict) else detail- )- return response.content-async def _post_inner_api_json(self, path: str, payload: Mapping[str, Any]) -> object:response = await self._request("POST", path, json=dict(payload))return self._normalize_json_payload(diff --git a/dify-agent/src/dify_agent/agent_stub/server/agent_stub_files.py b/dify-agent/src/dify_agent/agent_stub/server/agent_stub_files.pyindex 541f5f62400..5a8842665fe 100644--- a/dify-agent/src/dify_agent/agent_stub/server/agent_stub_files.py+++ b/dify-agent/src/dify_agent/agent_stub/server/agent_stub_files.py@@ -24,6 +24,7 @@ from pydantic import ValidationErrorfrom dify_agent.agent_stub.protocol.agent_stub import (AgentStubFileDownloadRequest,AgentStubFileDownloadResponse,+ AgentStubFileMapping,AgentStubFileUploadRequest,AgentStubFileUploadResponse,)@@ -72,6 +73,30 @@ class AgentStubFileRequestError(RuntimeError):super().__init__(str(detail))+def bind_sandbox_file_uri(*, sandbox_files_base_url: str, uri: str) -> str:+ """Bind one validated origin-free Dify file URI to the Sandbox audience."""++ if not is_safe_dify_file_uri(uri):+ raise ValueError("Dify API returned an unsafe Dify file URI")+ return f"{sandbox_files_base_url.rstrip('/')}{uri}"+++def is_safe_dify_file_uri(value: str) -> bool:+ """Return whether a URI stays within Dify's signed ``/files/*`` data plane."""++ parsed = urlsplit(value)+ if parsed.scheme or parsed.netloc or parsed.fragment or value.startswith("//"):+ return False++ decoded_path = parsed.path+ for _ in range(2):+ decoded_path = unquote(decoded_path)+ if "\\" in decoded_path:+ return False+ normalized_path = posixpath.normpath(decoded_path)+ return decoded_path.startswith("/files/") and normalized_path.startswith("/files/")++@dataclass(slots=True)class DifyApiAgentStubFileRequestHandler:"""Call Dify API inner file request endpoints on behalf of the sandbox.@@ -149,19 +174,26 @@ class DifyApiAgentStubFileRequestHandler:success payload does not contain safe download metadata."""execution_context = self._require_user_context(principal.execution_context)+ file_mapping = request.file+ if file_mapping is None:+ raise AgentStubFileRequestError(400, "file mapping is required for file download requests")payload: dict[str, object] = {"tenant_id": execution_context.tenant_id,"user_id": execution_context.user_id,"user_from": execution_context.user_from,"invoke_from": execution_context.invoke_from,- "file": request.file.model_dump(mode="json", exclude_none=True),+ "file": file_mapping.model_dump(mode="json", exclude_none=True),}payload["for_frontend"] = request.for_frontenddata = await self._post_inner_api("/inner/api/agent/files/download-request", payload)download_uri = data.get("download_uri")if not isinstance(download_uri, str) or not download_uri:raise AgentStubFileRequestError(502, "Dify API download request response is missing download_uri")- download_url = self._resolve_download_url(request=request, download_uri=download_uri)+ download_url = self._resolve_download_url(+ file_mapping=file_mapping,+ for_frontend=request.for_frontend,+ download_uri=download_uri,+ )try:return AgentStubFileDownloadResponse.model_validate({**data, "download_url": download_url})except ValidationError as exc:@@ -196,43 +228,36 @@ class DifyApiAgentStubFileRequestHandler:raise AgentStubFileRequestError(502, "Dify API file request response is invalid")return raw_payload- def _resolve_download_url(self, *, request: AgentStubFileDownloadRequest, download_uri: str) -> str:- if request.file.transfer_method == "remote_url":+ def _resolve_download_url(+ self,+ *,+ file_mapping: AgentStubFileMapping,+ for_frontend: bool,+ download_uri: str,+ ) -> str:+ if file_mapping.transfer_method == "remote_url":if self._is_absolute_http_url(download_uri):return download_uriraise AgentStubFileRequestError(502, "Dify API returned an invalid remote download URL")- if request.for_frontend:- if self._is_absolute_http_url(download_uri) or self._is_safe_dify_file_uri(download_uri):+ if for_frontend:+ if self._is_absolute_http_url(download_uri) or is_safe_dify_file_uri(download_uri):return download_uriraise AgentStubFileRequestError(502, "Dify API returned an unsafe frontend download URI")return self._bind_sandbox_files_base_url(download_uri)def _bind_sandbox_files_base_url(self, uri: str) -> str:- if not self._is_safe_dify_file_uri(uri):- raise AgentStubFileRequestError(502, "Dify API returned an unsafe Dify file URI")- return f"{self.sandbox_files_base_url.rstrip('/')}{uri}"+ try:+ return bind_sandbox_file_uri(sandbox_files_base_url=self.sandbox_files_base_url, uri=uri)+ except ValueError as exc:+ raise AgentStubFileRequestError(502, str(exc)) from exc@staticmethoddef _is_absolute_http_url(value: str) -> bool:parsed = urlsplit(value)return parsed.scheme in {"http", "https"} and bool(parsed.netloc)- @staticmethod- def _is_safe_dify_file_uri(value: str) -> bool:- parsed = urlsplit(value)- if parsed.scheme or parsed.netloc or parsed.fragment or value.startswith("//"):- return False-- decoded_path = parsed.path- for _ in range(2):- decoded_path = unquote(decoded_path)- if "\\" in decoded_path:- return False- normalized_path = posixpath.normpath(decoded_path)- return decoded_path.startswith("/files/") and normalized_path.startswith("/files/")-@staticmethoddef _parse_json(response: httpx.Response) -> object:try:@@ -245,4 +270,6 @@ __all__ = ["AgentStubFileRequestError","AgentStubFileRequestHandler","DifyApiAgentStubFileRequestHandler",+ "bind_sandbox_file_uri",+ "is_safe_dify_file_uri",]diff --git a/dify-agent/src/dify_agent/agent_stub/server/cli.py b/dify-agent/src/dify_agent/agent_stub/server/cli.pyindex ed16c1fc43a..1b0989d866a 100644--- a/dify-agent/src/dify_agent/agent_stub/server/cli.py+++ b/dify-agent/src/dify_agent/agent_stub/server/cli.py@@ -1,22 +1,14 @@"""Console entry point for the standalone Dify Agent stub server.-This module backs the ``dify-agent-stub-server`` console script introduced by-the stub-package move. HTTP(S) endpoints continue to run through Uvicorn while-``grpc://`` Agent Stub URLs switch the process into grpclib server mode.+This module backs the ``dify-agent-stub-server`` console script and serves the+Agent Stub HTTP API through Uvicorn."""from __future__ import annotationsimport argparse-import asyncio-import uvicorn-from dify_agent.agent_stub.protocol.agent_stub import parse_agent_stub_endpoint-from dify_agent.agent_stub.server.grpc_bind import AgentStubGRPCBindTarget, derive_agent_stub_grpc_bind_target-from dify_agent.agent_stub.server.grpc_runtime import start_agent_stub_grpc_server-from dify_agent.server.settings import ServerSettings-def main(argv: list[str] | None = None) -> None:"""Run the standalone stub server with parsed uvicorn bind options.@@ -26,22 +18,13 @@ def main(argv: list[str] | None = None) -> None:``argparse`` reads the process command line.Side effects:- Starts either ``dify_agent.agent_stub.server.app:app`` via- ``uvicorn.run`` or the grpclib Agent Stub server depending on the- configured ``DIFY_AGENT_STUB_API_BASE_URL`` scheme.+ Starts ``dify_agent.agent_stub.server.app:app`` via ``uvicorn.run``."""parser = argparse.ArgumentParser(prog="dify-agent-stub-server")parser.add_argument("--host", default=None)parser.add_argument("--port", type=int, default=None)parser.add_argument("--reload", action="store_true")args = parser.parse_args(argv)- settings = ServerSettings()- if (- settings.agent_stub_api_base_url is not None- and parse_agent_stub_endpoint(settings.agent_stub_api_base_url).is_grpc- ):- asyncio.run(_serve_grpc(settings=settings, host=args.host, port=args.port))- returnuvicorn.run("dify_agent.agent_stub.server.app:app",host=args.host or "127.0.0.1",@@ -50,24 +33,4 @@ def main(argv: list[str] | None = None) -> None:)-async def _serve_grpc(*, settings: ServerSettings, host: str | None, port: int | None) -> None:- bind_target = derive_agent_stub_grpc_bind_target(- public_url=settings.agent_stub_api_base_url or "",- bind_address=settings.agent_stub_grpc_bind_address,- )- if host is not None or port is not None:- bind_target = AgentStubGRPCBindTarget(host=host or bind_target.host, port=port or bind_target.port)-- server = await start_agent_stub_grpc_server(- public_url=settings.agent_stub_api_base_url or "",- bind_address=bind_target.address,- token_codec=settings.create_agent_stub_token_codec(),- file_request_handler=settings.create_agent_stub_file_request_handler(),- )- try:- await asyncio.Event().wait()- finally:- await server.aclose()--__all__ = ["main"]diff --git a/dify-agent/src/dify_agent/agent_stub/server/control_plane.py b/dify-agent/src/dify_agent/agent_stub/server/control_plane.pyindex 5b887af8288..05eba042288 100644--- a/dify-agent/src/dify_agent/agent_stub/server/control_plane.py+++ b/dify-agent/src/dify_agent/agent_stub/server/control_plane.py@@ -1,9 +1,7 @@-"""Shared Agent Stub control-plane service used by HTTP and gRPC transports.+"""Shared Agent Stub HTTP control-plane service.-This layer owns the authenticated control-plane delegation for file, config,-and drive operations. Transport adapters validate transport DTOs first, then-call into this service so auth, handler lookup, and error mapping stay shared-across HTTP and gRPC.+This layer owns authenticated delegation for file, config, and drive operations.+The HTTP adapter validates transport DTOs before calling into this service."""from __future__ import annotations@@ -55,9 +53,8 @@ class AgentStubConfigurationError(AgentStubControlPlaneError):class AgentStubControlPlaneService:"""Shared business service for authenticated Agent Stub control-plane calls.- HTTP and gRPC adapters validate or decode transport payloads before calling- this service, so this layer focuses only on shared auth, connection-id- generation, plus file, config, and drive request delegation.+ The HTTP adapter validates transport payloads before calling this service,+ which focuses on auth, connection-id generation, and request delegation."""token_codec: AgentStubTokenCodec | None@@ -93,6 +90,13 @@ class AgentStubControlPlaneService:) -> AgentStubFileDownloadResponse:"""Authenticate and delegate one already-validated file-download request."""principal = self._authenticate(authorization)+ if request.config is not None:+ handler = self._require_config_request_handler()+ try:+ return await handler.create_download_request(principal=principal, source=request.config)+ except AgentStubConfigRequestError as exc:+ raise AgentStubControlPlaneError(exc.status_code, exc.detail) from exc+handler = self._require_file_request_handler()try:return await handler.create_download_request(principal=principal, request=request)@@ -130,19 +134,6 @@ class AgentStubControlPlaneService:except AgentStubConfigRequestError as exc:raise AgentStubControlPlaneError(exc.status_code, exc.detail) from exc- async def pull_config_skill(- self,- *,- name: str,- authorization: str | None,- ) -> bytes:- principal = self._authenticate(authorization)- handler = self._require_config_request_handler()- try:- return await handler.pull_skill(principal=principal, name=name)- except AgentStubConfigRequestError as exc:- raise AgentStubControlPlaneError(exc.status_code, exc.detail) from exc-async def inspect_config_skill(self,*,@@ -156,19 +147,6 @@ class AgentStubControlPlaneService:except AgentStubConfigRequestError as exc:raise AgentStubControlPlaneError(exc.status_code, exc.detail) from exc- async def pull_config_file(- self,- *,- name: str,- authorization: str | None,- ) -> bytes:- principal = self._authenticate(authorization)- handler = self._require_config_request_handler()- try:- return await handler.pull_file(principal=principal, name=name)- except AgentStubConfigRequestError as exc:- raise AgentStubControlPlaneError(exc.status_code, exc.detail) from exc-async def push_config(self,*,diff --git a/dify-agent/src/dify_agent/agent_stub/server/grpc_bind.py b/dify-agent/src/dify_agent/agent_stub/server/grpc_bind.pydeleted file mode 100644index 9f4ee9e0002..00000000000--- a/dify-agent/src/dify_agent/agent_stub/server/grpc_bind.py+++ /dev/null@@ -1,69 +0,0 @@-"""Bind-address helpers for optional Agent Stub gRPC hosting."""--from __future__ import annotations--from dataclasses import dataclass-from urllib.parse import urlsplit--from dify_agent.agent_stub.protocol.agent_stub import parse_agent_stub_endpoint---@dataclass(frozen=True, slots=True)-class AgentStubGRPCBindTarget:- """Validated host/port bind target for a grpclib Agent Stub server."""-- host: str- port: int-- @property- def address(self) -> str:- return f"{_format_host(self.host)}:{self.port}"---def normalize_agent_stub_grpc_bind_address(value: str) -> str:- """Normalize one ``host:port`` gRPC bind address."""- target = parse_agent_stub_grpc_bind_address(value)- return target.address---def parse_agent_stub_grpc_bind_address(value: str) -> AgentStubGRPCBindTarget:- """Parse one explicit ``host:port`` gRPC bind override."""- stripped = value.strip()- if not stripped:- raise ValueError("Agent Stub gRPC bind address must not be empty")- parsed = urlsplit(f"grpc://{stripped}")- if not parsed.netloc or parsed.hostname is None:- raise ValueError("Agent Stub gRPC bind address must include a host")- if parsed.username is not None or parsed.password is not None:- raise ValueError("Agent Stub gRPC bind address must not include user info")- if parsed.port is None:- raise ValueError("Agent Stub gRPC bind address must include an explicit port")- if parsed.path not in {"", "/"} or parsed.query or parsed.fragment:- raise ValueError("Agent Stub gRPC bind address must be in host:port form")- return AgentStubGRPCBindTarget(host=parsed.hostname, port=parsed.port)---def derive_agent_stub_grpc_bind_target(- *,- public_url: str,- bind_address: str | None = None,-) -> AgentStubGRPCBindTarget:- """Resolve the runtime gRPC bind target from public URL plus optional override."""- if bind_address is not None:- return parse_agent_stub_grpc_bind_address(bind_address)- endpoint = parse_agent_stub_endpoint(public_url)- if not endpoint.is_grpc or endpoint.port is None:- raise ValueError("Agent Stub gRPC bind target requires a grpc://host:port public URL")- return AgentStubGRPCBindTarget(host="0.0.0.0", port=endpoint.port)---def _format_host(host: str) -> str:- return f"[{host}]" if ":" in host and not host.startswith("[") else host---__all__ = [- "AgentStubGRPCBindTarget",- "derive_agent_stub_grpc_bind_target",- "normalize_agent_stub_grpc_bind_address",- "parse_agent_stub_grpc_bind_address",-]diff --git a/dify-agent/src/dify_agent/agent_stub/server/grpc_runtime.py b/dify-agent/src/dify_agent/agent_stub/server/grpc_runtime.pydeleted file mode 100644index 0ef28ae5dc6..00000000000--- a/dify-agent/src/dify_agent/agent_stub/server/grpc_runtime.py+++ /dev/null@@ -1,59 +0,0 @@-"""Runtime helpers for starting and stopping the optional Agent Stub gRPC server."""--from __future__ import annotations--from dataclasses import dataclass--from dify_agent.agent_stub.server.agent_stub_files import AgentStubFileRequestHandler-from dify_agent.agent_stub.server.control_plane import AgentStubControlPlaneService-from dify_agent.agent_stub.server.grpc_bind import AgentStubGRPCBindTarget, derive_agent_stub_grpc_bind_target-from dify_agent.agent_stub.server.tokens.agent_stub import AgentStubTokenCodec---@dataclass(slots=True)-class RunningAgentStubGRPCServer:- """Handle for one started grpclib Agent Stub server."""-- server: object- bind_target: AgentStubGRPCBindTarget-- async def aclose(self) -> None:- """Stop accepting new requests and wait for open RPCs to close."""- close = getattr(self.server, "close")- wait_closed = getattr(self.server, "wait_closed")- close()- await wait_closed()---async def start_agent_stub_grpc_server(- *,- public_url: str,- bind_address: str | None,- token_codec: AgentStubTokenCodec | None,- file_request_handler: AgentStubFileRequestHandler | None,-) -> RunningAgentStubGRPCServer:- """Start the optional grpclib Agent Stub server for one process."""- from dify_agent.agent_stub.server.grpc_service import create_agent_stub_grpc_service-- runtime = _require_runtime()- bind_target = derive_agent_stub_grpc_bind_target(public_url=public_url, bind_address=bind_address)- service = AgentStubControlPlaneService(token_codec, file_request_handler)- server = runtime.Server([create_agent_stub_grpc_service(service)])- await server.start(bind_target.host, bind_target.port)- return RunningAgentStubGRPCServer(server=server, bind_target=bind_target)---@dataclass(frozen=True, slots=True)-class _GRPCRuntime:- Server: type---def _require_runtime() -> _GRPCRuntime:- try:- from grpclib.server import Server- except ImportError as exc:- raise RuntimeError("Agent Stub gRPC support requires the optional dify-agent[grpc] dependencies") from exc- return _GRPCRuntime(Server=Server)---__all__ = ["RunningAgentStubGRPCServer", "start_agent_stub_grpc_server"]diff --git a/dify-agent/src/dify_agent/agent_stub/server/grpc_service.py b/dify-agent/src/dify_agent/agent_stub/server/grpc_service.pydeleted file mode 100644index 48749a48436..00000000000--- a/dify-agent/src/dify_agent/agent_stub/server/grpc_service.py+++ /dev/null@@ -1,244 +0,0 @@-"""gRPC transport adapter for the Agent Stub control plane.--This module owns the gRPC-specific semantics that differ from the HTTP router:--- compact-JWE auth is read from inbound ``authorization`` metadata rather than- an HTTP header object;-- protobuf request-shape or JSON-decoding failures are mapped to- ``INVALID_ARGUMENT`` before the shared business layer runs;-- auth/configuration/downstream failures raised by- ``AgentStubControlPlaneService`` are translated into gRPC statuses;-- structured downstream error details are stringified because gRPC status- details are text, unlike the HTTP path which can preserve object-shaped- ``detail`` payloads.--The shared control-plane service still owns auth policy, connection-id-generation, and file-handler delegation so HTTP and gRPC stay semantically-aligned outside these transport-specific mappings.-"""--from __future__ import annotations--from collections.abc import Mapping, Sequence-from dataclasses import dataclass-from typing import TYPE_CHECKING--from pydantic import ValidationError--from dify_agent.agent_stub.server.control_plane import (- AgentStubAuthenticationError,- AgentStubConfigurationError,- AgentStubControlPlaneError,- AgentStubControlPlaneService,-)--if TYPE_CHECKING:- from grpclib.server import Stream-- from dify_agent.agent_stub.grpc._generated import agent_stub_pb2- from dify_agent.agent_stub.grpc._generated.agent_stub_grpc import AgentStubServiceBase---@dataclass(slots=True)-class AgentStubGRPCTransport:- """Shared gRPC adapter that converts protobuf messages around control-plane calls.-- Each method validates the protobuf request at the transport boundary,- extracts ``authorization`` metadata, and translates shared control-plane- failures into grpclib ``GRPCError`` instances.- """-- service: AgentStubControlPlaneService-- async def connect(- self,- *,- request,- metadata: object,- ):- """Handle one gRPC connect request.-- Invalid protobuf/message-shape input maps to ``INVALID_ARGUMENT``. Auth- and configuration failures raised by the shared service are translated by- ``_grpc_error_from_control_plane_error``.- """- authorization = _authorization_from_metadata(metadata)- conversions = _require_conversions()- try:- _ = conversions.connect_request_from_proto(request)- response = await self.service.connect(authorization=authorization)- return conversions.proto_connect_response(response)- except (ValidationError, ValueError, TypeError) as exc:- raise _grpc_error("INVALID_ARGUMENT", "invalid Agent Stub connect request") from exc- except AgentStubControlPlaneError as exc:- raise _grpc_error_from_control_plane_error(exc) from exc-- async def create_file_upload_request(- self,- *,- request,- metadata: object,- ):- """Handle one gRPC file-upload request.-- This transport validates the protobuf request before delegating to the- shared service, then stringifies any non-string downstream error detail- when mapping the resulting failure into gRPC status text.- """- authorization = _authorization_from_metadata(metadata)- conversions = _require_conversions()- try:- validated_request = conversions.file_upload_request_from_proto(request)- response = await self.service.create_file_upload_request(- request=validated_request,- authorization=authorization,- )- return conversions.proto_file_upload_response(response)- except (ValidationError, ValueError, TypeError) as exc:- raise _grpc_error("INVALID_ARGUMENT", "invalid Agent Stub file upload request") from exc- except AgentStubControlPlaneError as exc:- raise _grpc_error_from_control_plane_error(exc) from exc-- async def create_file_download_request(- self,- *,- request,- metadata: object,- ):- """Handle one gRPC file-download request.-- This transport validates the protobuf request before delegating to the- shared service, then stringifies any non-string downstream error detail- when mapping the resulting failure into gRPC status text.- """- authorization = _authorization_from_metadata(metadata)- conversions = _require_conversions()- try:- validated_request = conversions.file_download_request_from_proto(request)- response = await self.service.create_file_download_request(- request=validated_request,- authorization=authorization,- )- return conversions.proto_file_download_response(response)- except (ValidationError, ValueError, TypeError) as exc:- raise _grpc_error("INVALID_ARGUMENT", "invalid Agent Stub file download request") from exc- except AgentStubControlPlaneError as exc:- raise _grpc_error_from_control_plane_error(exc) from exc---def create_agent_stub_grpc_service(- service: AgentStubControlPlaneService,-) -> AgentStubServiceBase:- """Wrap the shared control-plane service in a grpclib-generated service base.-- The generated grpclib service methods are unary-only and reject missing- request messages with ``INVALID_ARGUMENT`` before handing control to the- transport adapter.- """- try:- from dify_agent.agent_stub.grpc._generated.agent_stub_grpc import AgentStubServiceBase- except ImportError as exc: # pragma: no cover - exercised via runtime import guard- raise RuntimeError("Agent Stub gRPC support requires the optional grpc dependencies") from exc-- transport = AgentStubGRPCTransport(service)-- class _Service(AgentStubServiceBase):- async def Connect(- self,- stream: Stream[agent_stub_pb2.ConnectRequest, agent_stub_pb2.ConnectResponse],- ) -> None: # type: ignore[name-defined]- request = await stream.recv_message()- if request is None:- raise _grpc_error("INVALID_ARGUMENT", "missing Agent Stub request message")- await stream.send_message(await transport.connect(request=request, metadata=stream.metadata))-- async def CreateFileUploadRequest(- self,- stream: Stream[agent_stub_pb2.FileUploadRequest, agent_stub_pb2.FileUploadResponse],- ) -> None: # type: ignore[name-defined]- request = await stream.recv_message()- if request is None:- raise _grpc_error("INVALID_ARGUMENT", "missing Agent Stub request message")- await stream.send_message(- await transport.create_file_upload_request(request=request, metadata=stream.metadata)- )-- async def CreateFileDownloadRequest(- self,- stream: Stream[agent_stub_pb2.FileDownloadRequest, agent_stub_pb2.FileDownloadResponse],- ) -> None: # type: ignore[name-defined]- request = await stream.recv_message()- if request is None:- raise _grpc_error("INVALID_ARGUMENT", "missing Agent Stub request message")- await stream.send_message(- await transport.create_file_download_request(request=request, metadata=stream.metadata)- )-- return _Service()---def _authorization_from_metadata(metadata: object) -> str | None:- """Extract the optional bearer token from grpclib metadata containers."""- if metadata is None:- return None- if isinstance(metadata, Mapping):- value = metadata.get("authorization")- return value if isinstance(value, str) else None- if isinstance(metadata, Sequence):- for item in metadata:- if isinstance(item, tuple) and len(item) == 2:- key, value = item- if isinstance(key, str) and key.lower() == "authorization" and isinstance(value, str):- return value- return None---def _grpc_error_from_control_plane_error(exc: AgentStubControlPlaneError):- """Translate shared control-plane failures into transport-visible gRPC status.-- ``detail`` is normalized to text because gRPC status details are strings;- HTTP adapters can preserve richer object payloads.- """- detail_text = _grpc_detail_text(exc.detail)- if isinstance(exc, AgentStubAuthenticationError):- return _grpc_error("UNAUTHENTICATED", detail_text)- if isinstance(exc, AgentStubConfigurationError):- return _grpc_error("UNAVAILABLE", detail_text)- if exc.status_code in {408, 504}:- return _grpc_error("DEADLINE_EXCEEDED", detail_text)- if exc.status_code == 429:- return _grpc_error("RESOURCE_EXHAUSTED", detail_text)- if exc.status_code == 404:- return _grpc_error("NOT_FOUND", detail_text)- if exc.status_code == 403:- return _grpc_error("PERMISSION_DENIED", detail_text)- if 400 <= exc.status_code < 500:- return _grpc_error("FAILED_PRECONDITION", detail_text)- if 500 <= exc.status_code < 600:- return _grpc_error("UNAVAILABLE", detail_text)- return _grpc_error("INTERNAL", "internal Agent Stub error")---def _grpc_error(status_name: str, detail: str):- from grpclib.const import Status- from grpclib.exceptions import GRPCError-- return GRPCError(getattr(Status, status_name), detail)---def _grpc_detail_text(detail: object) -> str:- """Return the text form used for gRPC status details."""- if isinstance(detail, str):- return detail- return str(detail)---def _require_conversions():- try:- from dify_agent.agent_stub.grpc import conversions- except ImportError as exc: # pragma: no cover - exercised by runtime import guard- raise RuntimeError("Agent Stub gRPC support requires the optional grpc dependencies") from exc- return conversions---__all__ = ["AgentStubGRPCTransport", "create_agent_stub_grpc_service"]diff --git a/dify-agent/src/dify_agent/agent_stub/server/routes/agent_stub.py b/dify-agent/src/dify_agent/agent_stub/server/routes/agent_stub.pyindex 411fcc4c6af..22e8fa9f94f 100644--- a/dify-agent/src/dify_agent/agent_stub/server/routes/agent_stub.py+++ b/dify-agent/src/dify_agent/agent_stub/server/routes/agent_stub.py@@ -2,13 +2,12 @@The router is a thin HTTP adapter around ``AgentStubControlPlaneService``. Itkeeps FastAPI-specific request parsing and HTTPException translation here while-sharing auth, DTO validation, connection-id generation, and file/config/drive-delegation with the gRPC transport.+the service owns auth and file/config/drive delegation."""from __future__ import annotations-from fastapi import APIRouter, Header, HTTPException, Response+from fastapi import APIRouter, Header, HTTPExceptionfrom dify_agent.agent_stub.protocol.agent_stub import (AgentStubConnectRequest,@@ -42,7 +41,10 @@ def create_agent_stub_http_router("""Create HTTP routes bound to the application's Agent Stub dependencies."""router = APIRouter(prefix="/agent-stub", tags=["agent-stub"])service = AgentStubControlPlaneService(- token_codec, file_request_handler, config_request_handler, drive_request_handler+ token_codec=token_codec,+ file_request_handler=file_request_handler,+ config_request_handler=config_request_handler,+ drive_request_handler=drive_request_handler,)@router.post("/connections", response_model=AgentStubConnectResponse)@@ -85,17 +87,6 @@ def create_agent_stub_http_router(except AgentStubControlPlaneError as exc:raise HTTPException(status_code=exc.status_code, detail=exc.detail) from exc- @router.get("/config/skills/{name}/pull")- async def pull_config_skill(- name: str,- authorization: str | None = Header(default=None, alias="Authorization"),- ) -> Response:- try:- payload = await service.pull_config_skill(name=name, authorization=authorization)- return Response(content=payload, media_type="application/zip")- except AgentStubControlPlaneError as exc:- raise HTTPException(status_code=exc.status_code, detail=exc.detail) from exc-@router.get("/config/skills/{name}/inspect")async def inspect_config_skill(name: str,@@ -106,17 +97,6 @@ def create_agent_stub_http_router(except AgentStubControlPlaneError as exc:raise HTTPException(status_code=exc.status_code, detail=exc.detail) from exc- @router.get("/config/files/{name}/pull")- async def pull_config_file(- name: str,- authorization: str | None = Header(default=None, alias="Authorization"),- ) -> Response:- try:- payload = await service.pull_config_file(name=name, authorization=authorization)- return Response(content=payload, media_type="application/octet-stream")- except AgentStubControlPlaneError as exc:- raise HTTPException(status_code=exc.status_code, detail=exc.detail) from exc-@router.post("/config/push", response_model=AgentStubConfigPushResponse)async def push_config(request: AgentStubConfigPushRequest,diff --git a/dify-agent/src/dify_agent/server/app.py b/dify-agent/src/dify_agent/server/app.pyindex e19af9a75ad..058c451fbf8 100644--- a/dify-agent/src/dify_agent/server/app.py+++ b/dify-agent/src/dify_agent/server/app.py@@ -8,11 +8,10 @@ runtime. Redis persists run records and per-run event streams with configuredretention only; it is not used as a job queue. Agenton layers and providersstay state-only: they borrow the lifespan-owned clients through the runner andreceive runtime-backend and Shell settings through provider construction rather-than reading environment variables themselves. The standard server always mounts the-HTTP Agent Stub router and additionally starts the optional grpclib Agent Stub-server when ``DIFY_AGENT_STUB_API_BASE_URL`` uses ``grpc://``. Process-level-Logfire instrumentation is configured at app construction time and only exports-remotely when Logfire's default environment configuration provides a token.+than reading environment variables themselves. The standard server mounts the+HTTP Agent Stub router. Process-level Logfire instrumentation is configured at+app construction time and only exports remotely when Logfire's default+environment configuration provides a token."""from collections.abc import AsyncGenerator@@ -23,8 +22,6 @@ from fastapi import FastAPIfrom redis.asyncio import Redisfrom dify_agent.agent_stub.shell_env import ShellAgentStubTokenFactory-from dify_agent.agent_stub.protocol.agent_stub import parse_agent_stub_endpoint-from dify_agent.agent_stub.server.grpc_runtime import start_agent_stub_grpc_serverfrom dify_agent.agent_stub.server.router import create_agent_stub_routerfrom dify_agent.layers.execution_context import DifyExecutionContextLayerConfigfrom dify_agent.runtime.compositor_factory import create_default_layer_providers@@ -48,8 +45,8 @@ def create_app(settings: ServerSettings | None = None) -> FastAPI:agent_stub_token_codec = resolved_settings.create_agent_stub_token_codec()agent_stub_token_factory: ShellAgentStubTokenFactory | None = Noneif agent_stub_token_codec is not None:- # Runtime receives only this callable boundary; router and gRPC wiring- # keep the concrete token codec on the server side.+ # Runtime receives only this callable boundary; the HTTP router keeps+ # the concrete token codec on the server side.def issue_agent_stub_token(execution_context: DifyExecutionContextLayerConfig,*,@@ -120,24 +117,11 @@ def create_app(settings: ServerSettings | None = None) -> FastAPI:shutdown_grace_seconds=resolved_settings.shutdown_grace_seconds,layer_providers=layer_providers,)- grpc_server = None- if (- resolved_settings.agent_stub_api_base_url is not None- and parse_agent_stub_endpoint(resolved_settings.agent_stub_api_base_url).is_grpc- ):- grpc_server = await start_agent_stub_grpc_server(- public_url=resolved_settings.agent_stub_api_base_url,- bind_address=resolved_settings.agent_stub_grpc_bind_address,- token_codec=agent_stub_token_codec,- file_request_handler=agent_stub_file_request_handler,- )state["store"] = storestate["scheduler"] = schedulertry:yieldfinally:- if grpc_server is not None:- await grpc_server.aclose()await scheduler.shutdown()await dify_api_inner_http_client.aclose()await plugin_daemon_http_client.aclose()diff --git a/dify-agent/src/dify_agent/server/settings.py b/dify-agent/src/dify_agent/server/settings.pyindex c8e388f275a..f793044f2ff 100644--- a/dify-agent/src/dify_agent/server/settings.py+++ b/dify-agent/src/dify_agent/server/settings.py@@ -6,8 +6,8 @@ Dify API inner calls. Layers and Agenton providers do not own those clients, sothese settings are process resource limits rather than per-run lifecycle knobs.Endpoint URLs and API keys stay service-specific. The Agent Stub also uses thissettings model directly: the public Agent Stub API base URL, server secret,-optional gRPC bind override, and optional Dify inner API bridge settings all-live here under the ``DIFY_AGENT_...`` environment-variable namespace.+and optional Dify inner API bridge settings live here under the+``DIFY_AGENT_...`` environment-variable namespace."""import httpx@@ -17,11 +17,10 @@ from typing import ClassVar, Literal, castfrom pydantic import AliasChoices, AnyHttpUrl, Field, TypeAdapter, field_validator, model_validatorfrom pydantic_settings import BaseSettings, SettingsConfigDict-from dify_agent.agent_stub.protocol.agent_stub import normalize_agent_stub_api_base_url, parse_agent_stub_endpoint+from dify_agent.agent_stub.protocol.agent_stub import normalize_agent_stub_api_base_urlfrom dify_agent.agent_stub.server.agent_stub_config import DifyApiAgentStubConfigRequestHandlerfrom dify_agent.agent_stub.server.agent_stub_drive import DifyApiAgentStubDriveRequestHandlerfrom dify_agent.agent_stub.server.agent_stub_files import DifyApiAgentStubFileRequestHandler-from dify_agent.agent_stub.server.grpc_bind import normalize_agent_stub_grpc_bind_addressfrom dify_agent.agent_stub.server.tokens.agent_stub import AgentStubTokenCodec, decode_server_secret_keyfrom dify_agent.runtime_backend import RuntimeBackendProfilefrom dify_agent.runtime_backend.e2b import E2B_MAX_ACTIVE_TIMEOUT_SECONDS@@ -78,7 +77,6 @@ class ServerSettings(BaseSettings):default=None,validation_alias="DIFY_AGENT_SANDBOX_FILES_BASE_URL",)- agent_stub_grpc_bind_address: str | None = Field(default=None, validation_alias="DIFY_AGENT_STUB_GRPC_BIND_ADDRESS")server_secret_key: str | None = Noneapi_token: str | None = Noneshell_redact_patterns: str = ""@@ -127,17 +125,6 @@ class ServerSettings(BaseSettings):raise ValueError("DIFY_AGENT_SANDBOX_FILES_BASE_URL must not include a query string or fragment")return parsed- @field_validator("agent_stub_grpc_bind_address")- @classmethod- def normalize_agent_stub_grpc_bind_address_value(cls, value: str | None) -> str | None:- """Normalize the optional explicit Agent Stub gRPC bind override."""- if value is None:- return None- stripped = value.strip()- if not stripped:- return None- return normalize_agent_stub_grpc_bind_address(stripped)-@field_validator("server_secret_key")@classmethoddef validate_server_secret_key(cls, value: str | None) -> str | None:@@ -195,15 +182,8 @@ class ServerSettings(BaseSettings):and self.sandbox_files_base_url is None):raise ValueError(- "DIFY_AGENT_SANDBOX_FILES_BASE_URL is required when Agent Stub file operations are enabled."+ "DIFY_AGENT_SANDBOX_FILES_BASE_URL is required for Agent Stub file transfers and Config downloads.")- if self.agent_stub_grpc_bind_address is not None:- if self.agent_stub_api_base_url is None:- raise ValueError(- "DIFY_AGENT_STUB_API_BASE_URL is required when DIFY_AGENT_STUB_GRPC_BIND_ADDRESS is set."- )- if not parse_agent_stub_endpoint(self.agent_stub_api_base_url).is_grpc:- raise ValueError("DIFY_AGENT_STUB_GRPC_BIND_ADDRESS requires a grpc:// DIFY_AGENT_STUB_API_BASE_URL.")return selfdef build_runtime_backend_profile(self) -> RuntimeBackendProfile | None:@@ -248,12 +228,13 @@ class ServerSettings(BaseSettings):)def create_agent_stub_config_request_handler(self) -> DifyApiAgentStubConfigRequestHandler | None:- """Return the Dify API config bridge when both Dify API settings are configured."""- if self.inner_api_key is None:+ """Return the Config bridge when inner API and Sandbox data-plane settings are configured."""+ if self.inner_api_key is None or self.sandbox_files_base_url is None:return Nonereturn DifyApiAgentStubConfigRequestHandler(inner_api_url=self.inner_api_url,inner_api_key=self.inner_api_key,+ sandbox_files_base_url=self.sandbox_files_base_url,timeout=self.create_outbound_http_timeout(),)diff --git a/dify-agent/tests/local/dify_agent/agent_stub/protocol/test_agent_stub_protocol.py b/dify-agent/tests/local/dify_agent/agent_stub/protocol/test_agent_stub_protocol.pyindex 45413319717..8a99158b20f 100644--- a/dify-agent/tests/local/dify_agent/agent_stub/protocol/test_agent_stub_protocol.py+++ b/dify-agent/tests/local/dify_agent/agent_stub/protocol/test_agent_stub_protocol.py@@ -12,6 +12,7 @@ from dify_agent.agent_stub.protocol.agent_stub import (AgentStubDriveCommitRequest,AgentStubDriveFileRef,AgentStubDriveManifestResponse,+ AgentStubConfigDownloadSource,AgentStubFileDownloadRequest,AgentStubFileMapping,agent_stub_connections_url,@@ -21,7 +22,6 @@ from dify_agent.agent_stub.protocol.agent_stub import (agent_stub_file_download_request_url,agent_stub_file_upload_request_url,normalize_agent_stub_api_base_url,- parse_agent_stub_endpoint,)@@ -101,31 +101,16 @@ def test_normalize_agent_stub_api_base_url_accepts_service_root_or_agent_stub_rodef test_parse_agent_stub_endpoint_rejects_invalid_schemes_and_missing_host() -> None:- with pytest.raises(ValueError, match="http, https, or grpc"):+ with pytest.raises(ValueError, match="http or https"):_ = normalize_agent_stub_api_base_url("not-a-url")- with pytest.raises(ValueError, match="http, https, or grpc"):+ with pytest.raises(ValueError, match="http or https"):_ = normalize_agent_stub_api_base_url("ftp://agent.example.com/agent-stub")with pytest.raises(ValueError, match="include a host"):_ = normalize_agent_stub_api_base_url("https:///agent-stub")-def test_parse_agent_stub_endpoint_accepts_grpc_host_and_port() -> None:- endpoint = parse_agent_stub_endpoint("grpc://agent.example.com:9091")-- assert endpoint.url == "grpc://agent.example.com:9091"- assert endpoint.is_grpc is True- assert endpoint.host == "agent.example.com"- assert endpoint.port == 9091--[email protected]("invalid_url", ["grpc://agent.example.com", "grpc://agent.example.com:9091/path"])-def test_parse_agent_stub_endpoint_rejects_invalid_grpc_urls(invalid_url: str) -> None:- with pytest.raises(ValueError):- _ = parse_agent_stub_endpoint(invalid_url)--def test_agent_stub_file_mapping_validates_reference_and_url_by_transfer_method() -> None:reference = _reference("tool-file-1")assert AgentStubFileMapping(transfer_method="tool_file", reference=reference).reference == reference@@ -159,6 +144,7 @@ def test_agent_stub_file_download_request_accepts_legacy_http_audience_alias() -assert request.for_frontend is Falseassert request.model_dump() == {"file": {"transfer_method": "tool_file", "reference": _reference("tool-file-1"), "url": None},+ "config": None,"for_frontend": False,}@@ -166,6 +152,44 @@ def test_agent_stub_file_download_request_accepts_legacy_http_audience_alias() -_ = AgentStubFileDownloadRequest.model_validate({"file": mapping, "for_frontend": True, "for_external": False})+def test_agent_stub_file_download_request_accepts_exactly_one_sandbox_config_source() -> None:+ request = AgentStubFileDownloadRequest(+ config=AgentStubConfigDownloadSource(kind="skill", name="alpha"),+ for_frontend=False,+ )++ assert request.config == AgentStubConfigDownloadSource(kind="skill", name="alpha")+ with pytest.raises(ValidationError, match="exactly one"):+ _ = AgentStubFileDownloadRequest(for_frontend=False)+ with pytest.raises(ValidationError, match="exactly one"):+ _ = AgentStubFileDownloadRequest(+ file=AgentStubFileMapping(transfer_method="tool_file", reference=_reference("tool-file-1")),+ config=AgentStubConfigDownloadSource(kind="file", name="guide.txt"),+ for_frontend=False,+ )+ with pytest.raises(ValidationError, match="Sandbox data plane"):+ _ = AgentStubFileDownloadRequest(+ config=AgentStubConfigDownloadSource(kind="file", name="guide.txt"),+ for_frontend=True,+ )+++ ("source", "message"),+ [+ ({"kind": "file", "name": "../guide.txt"}, "safe path segment"),+ ({"kind": "skill", "name": "Alpha"}, "skill name is invalid"),+ ({"kind": "file", "name": "guide.txt", "tenant_id": "tenant-1"}, "extra_forbidden"),+ ],+)+def test_agent_stub_config_download_source_rejects_invalid_names_and_identity_fields(+ source: dict[str, object],+ message: str,+) -> None:+ with pytest.raises(ValidationError, match=message):+ _ = AgentStubConfigDownloadSource.model_validate(source)++def test_agent_stub_drive_commit_request_validates_file_refs() -> None:request = AgentStubDriveCommitRequest(items=[diff --git a/dify-agent/tests/local/dify_agent/agent_stub/protocol/test_grpc_conversions.py b/dify-agent/tests/local/dify_agent/agent_stub/protocol/test_grpc_conversions.pydeleted file mode 100644index 504ecccc857..00000000000--- a/dify-agent/tests/local/dify_agent/agent_stub/protocol/test_grpc_conversions.py+++ /dev/null@@ -1,110 +0,0 @@-from __future__ import annotations--import base64-import json--import pytest--pytest.importorskip("google.protobuf")--from dify_agent.agent_stub.grpc._generated import agent_stub_pb2-from dify_agent.agent_stub.grpc.conversions import (- connect_request_from_proto,- connect_response_from_proto,- file_download_request_from_proto,- proto_connect_request,- proto_file_download_request,- proto_file_download_response,-)-from dify_agent.agent_stub.protocol.agent_stub import (- AgentStubConnectResponse,- AgentStubFileDownloadResponse,- AgentStubFileMapping,-)---def _reference(record_id: str) -> str:- payload = base64.urlsafe_b64encode(json.dumps({"record_id": record_id}, separators=(",", ":")).encode()).decode()- return f"dify-file-ref:{payload}"---def test_connect_request_from_proto_round_trips_metadata_json() -> None:- message = proto_connect_request(- agent_stub_pb2,- argv=["connect", "--", "echo", "hello"],- metadata={"source": "cli"},- )-- request = connect_request_from_proto(message)-- assert request.argv == ["connect", "--", "echo", "hello"]- assert request.metadata == {"source": "cli"}---def test_file_download_request_from_proto_respects_optional_reference() -> None:- message = agent_stub_pb2.FileDownloadRequest(- file=agent_stub_pb2.FileMapping(- transfer_method="tool_file",- reference=_reference("tool-file-1"),- )- )-- request = file_download_request_from_proto(message)-- assert request.file.reference == _reference("tool-file-1")- assert request.file.url is None- assert request.for_frontend is True---def test_file_download_request_from_proto_preserves_explicit_sandbox_transfer_audience() -> None:- message = agent_stub_pb2.FileDownloadRequest(- file=agent_stub_pb2.FileMapping(- transfer_method="tool_file",- reference=_reference("tool-file-1"),- ),- for_frontend=False,- )-- request = file_download_request_from_proto(message)-- assert request.for_frontend is False---def test_proto_file_download_request_preserves_selected_audience() -> None:- message = proto_file_download_request(- agent_stub_pb2,- file=AgentStubFileMapping(transfer_method="tool_file", reference=_reference("tool-file-1")),- for_frontend=False,- )-- assert message.HasField("for_frontend") is True- assert message.for_frontend is False- assert agent_stub_pb2.FileDownloadRequest.DESCRIPTOR.fields_by_name["for_frontend"].number == 2---def test_connect_request_from_proto_rejects_invalid_metadata_json() -> None:- with pytest.raises(json.JSONDecodeError):- _ = connect_request_from_proto(- agent_stub_pb2.ConnectRequest(protocol_version=1, argv=["connect"], metadata_json="not-json")- )---def test_proto_responses_preserve_optional_fields() -> None:- message = proto_file_download_response(- AgentStubFileDownloadResponse(- filename="report.pdf",- mime_type="application/pdf",- size=123,- download_url="https://files.example.com/download",- )- )-- assert message.HasField("mime_type") is True- assert (- connect_response_from_proto(- agent_stub_pb2.ConnectResponse(- **AgentStubConnectResponse(connection_id="conn-1", status="connected").model_dump()- )- ).connection_id- == "conn-1"- )diff --git a/dify-agent/tests/local/dify_agent/agent_stub/server/test_agent_stub_config.py b/dify-agent/tests/local/dify_agent/agent_stub/server/test_agent_stub_config.pyindex 7846fcded42..6215192a98b 100644--- a/dify-agent/tests/local/dify_agent/agent_stub/server/test_agent_stub_config.py+++ b/dify-agent/tests/local/dify_agent/agent_stub/server/test_agent_stub_config.py@@ -12,9 +12,12 @@ from fastapi import FastAPIfrom fastapi.testclient import TestClientfrom dify_agent.agent_stub.protocol.agent_stub import (+ AgentStubConfigDownloadSource,AgentStubConfigManifestResponse,AgentStubConfigPushRequest,AgentStubConfigPushResponse,+ AgentStubFileDownloadRequest,+ AgentStubFileDownloadResponse,)from dify_agent.agent_stub.server.agent_stub_config import (AgentStubConfigRequestError,@@ -36,7 +39,7 @@ def _token_codec() -> AgentStubTokenCodec:def _execution_context(**updates: object) -> DifyExecutionContextLayerConfig:- payload = {+ payload: dict[str, object] = {"tenant_id": "tenant-1","user_id": "user-1","user_from": "account",@@ -91,6 +94,7 @@ async def test_dify_api_handler_manifest_success(monkeypatch: pytest.MonkeyPatchresponse = await DifyApiAgentStubConfigRequestHandler(inner_api_url="https://api.example.com",inner_api_key="inner-secret",+ sandbox_files_base_url="https://sandbox-files.example.com",).manifest(principal=_principal())assert isinstance(response, AgentStubConfigManifestResponse)@@ -112,16 +116,29 @@ async def test_dify_api_handler_manifest_success(monkeypatch: pytest.MonkeyPatch@pytest.mark.anyio-async def test_dify_api_handler_pull_endpoints_return_bytes(monkeypatch: pytest.MonkeyPatch) -> None:+async def test_dify_api_handler_config_download_returns_sandbox_data_plane_url(+ monkeypatch: pytest.MonkeyPatch,+) -> None:original_async_client = httpx.AsyncClientdef handler(request: httpx.Request) -> httpx.Response:- assert request.url.params["user_id"] == "user-1"- if request.url.path.endswith("/skills/alpha/pull"):- return httpx.Response(200, content=b"zip-bytes")- if request.url.path.endswith("/files/guide.txt/pull"):- return httpx.Response(200, content=b"file-bytes")- raise AssertionError(f"unexpected path: {request.url.path}")+ assert request.url.path == "/inner/api/agent-config/agent-1/download-request"+ assert json.loads(request.content) == {+ "tenant_id": "tenant-1",+ "user_id": "user-1",+ "config_version_id": "cfg-1",+ "config_version_kind": "build_draft",+ "config": {"kind": "skill", "name": "alpha"},+ }+ return httpx.Response(+ 200,+ json={+ "filename": "alpha.zip",+ "mime_type": "application/zip",+ "size": 123,+ "download_uri": "/files/tools/alpha.zip?sign=1",+ },+ )monkeypatch.setattr("dify_agent.agent_stub.server.agent_stub_config.httpx.AsyncClient",@@ -131,10 +148,20 @@ async def test_dify_api_handler_pull_endpoints_return_bytes(monkeypatch: pytest.request_handler = DifyApiAgentStubConfigRequestHandler(inner_api_url="https://api.example.com",inner_api_key="inner-secret",+ sandbox_files_base_url="https://sandbox-files.example.com/dify",+ )++ response = await request_handler.create_download_request(+ principal=_principal(),+ source=AgentStubConfigDownloadSource(kind="skill", name="alpha"),)- assert await request_handler.pull_skill(principal=_principal(), name="alpha") == b"zip-bytes"- assert await request_handler.pull_file(principal=_principal(), name="guide.txt") == b"file-bytes"+ assert response == AgentStubFileDownloadResponse(+ filename="alpha.zip",+ mime_type="application/zip",+ size=123,+ download_url="https://sandbox-files.example.com/dify/files/tools/alpha.zip?sign=1",+ )@pytest.mark.anyio@@ -161,6 +188,7 @@ async def test_dify_api_handler_push_env_and_note_success(monkeypatch: pytest.Morequest_handler = DifyApiAgentStubConfigRequestHandler(inner_api_url="https://api.example.com",inner_api_key="inner-secret",+ sandbox_files_base_url="https://sandbox-files.example.com",)push_response = await request_handler.push(@@ -221,8 +249,8 @@ async def test_dify_api_handler_push_env_and_note_success(monkeypatch: pytest.Mo"manifest",),(- "pull_skill",- "/inner/api/agent-config/agent-1/skills/alpha/pull",+ "create_download_request",+ "/inner/api/agent-config/agent-1/download-request",httpx.Response(404, json={"detail": "missing"}),404,"missing",@@ -260,14 +288,18 @@ async def test_dify_api_handler_maps_error_cases(request_handler = DifyApiAgentStubConfigRequestHandler(inner_api_url="https://api.example.com",inner_api_key="inner-secret",+ sandbox_files_base_url="https://sandbox-files.example.com",)with pytest.raises(AgentStubConfigRequestError, match=expected_message) as exc_info:match method_name:case "manifest":await request_handler.manifest(principal=_principal())- case "pull_skill":- await request_handler.pull_skill(principal=_principal(), name="alpha")+ case "create_download_request":+ await request_handler.create_download_request(+ principal=_principal(),+ source=AgentStubConfigDownloadSource(kind="skill", name="alpha"),+ )case "push":await request_handler.push(principal=_principal(), request=AgentStubConfigPushRequest())case "update_env":@@ -297,6 +329,7 @@ async def test_dify_api_handler_validates_required_execution_context_fields(request_handler = DifyApiAgentStubConfigRequestHandler(inner_api_url="https://api.example.com",inner_api_key="inner-secret",+ sandbox_files_base_url="https://sandbox-files.example.com",)with pytest.raises(AgentStubConfigRequestError, match=expected_message) as exc_info:@@ -313,9 +346,8 @@ async def test_dify_api_handler_validates_required_execution_context_fields("method_name",["get_config_manifest",- "pull_config_skill",+ "create_file_download_request","inspect_config_skill",- "pull_config_file","push_config","update_config_env","update_config_note",@@ -330,18 +362,14 @@ async def test_control_plane_maps_config_request_errors(method_name: str) -> Nondel principalraise AgentStubConfigRequestError(409, {"code": "conflict"})- async def pull_skill(self, *, principal, name):- del principal, name+ async def create_download_request(self, *, principal, source):+ del principal, sourceraise AgentStubConfigRequestError(409, {"code": "conflict"})async def inspect_skill(self, *, principal, name):del principal, nameraise AgentStubConfigRequestError(409, {"code": "conflict"})- async def pull_file(self, *, principal, name):- del principal, name- raise AgentStubConfigRequestError(409, {"code": "conflict"})-async def push(self, *, principal, request):del principal, requestraise AgentStubConfigRequestError(409, {"code": "conflict"})@@ -362,12 +390,16 @@ async def test_control_plane_maps_config_request_errors(method_name: str) -> Nonmatch method_name:case "get_config_manifest":await service.get_config_manifest(authorization=authorization)- case "pull_config_skill":- await service.pull_config_skill(name="alpha", authorization=authorization)+ case "create_file_download_request":+ await service.create_file_download_request(+ request=AgentStubFileDownloadRequest(+ config=AgentStubConfigDownloadSource(kind="skill", name="alpha"),+ for_frontend=False,+ ),+ authorization=authorization,+ )case "inspect_config_skill":await service.inspect_config_skill(name="alpha", authorization=authorization)- case "pull_config_file":- await service.pull_config_file(name="guide.txt", authorization=authorization)case "push_config":await service.push_config(request=AgentStubConfigPushRequest(), authorization=authorization)case "update_config_env":@@ -385,9 +417,14 @@ async def test_control_plane_maps_config_request_errors(method_name: str) -> Non("path", "method", "body", "expected_status", "expected_detail"),[("/agent-stub/config/manifest", "get", None, 200, {"agent_id": "agent-1"}),- ("/agent-stub/config/skills/alpha/pull", "get", None, 200, b"zip-bytes"),+ (+ "/agent-stub/files/download-request",+ "post",+ {"config": {"kind": "skill", "name": "alpha"}, "for_frontend": False},+ 200,+ {"download_url": "https://sandbox-files.example.com/files/alpha.zip"},+ ),("/agent-stub/config/skills/alpha/inspect", "get", None, 200, {"name": "alpha", "files": ["SKILL.md"]}),- ("/agent-stub/config/files/guide.txt/pull", "get", None, 200, b"file-bytes"),("/agent-stub/config/push", "post", {"note": "hello"}, 200, {"agent_id": "agent-1"}),("/agent-stub/config/env", "patch", {"env_text": "API_KEY=value\n"}, 200, {"env_keys": ["API_KEY"]}),("/agent-stub/config/note", "put", {"note": "hello"}, 200, {"note": "hello"}),@@ -398,7 +435,7 @@ def test_http_config_routes_forward_requests(method: str,body: dict[str, object] | None,expected_status: int,- expected_detail: dict[str, object] | bytes,+ expected_detail: dict[str, object],) -> None:codec = _token_codec()token = codec.encode_connection_token(_execution_context(), now=int(time.time()) - 1)@@ -409,21 +446,21 @@ def test_http_config_routes_forward_requests(captured["manifest_agent_id"] = principal.execution_context.agent_idreturn AgentStubConfigManifestResponse.model_validate(_manifest_payload())- async def pull_skill(self, *, principal, name):- del principal- captured["skill_name"] = name- return b"zip-bytes"+ async def create_download_request(self, *, principal, source):+ captured["download_agent_id"] = principal.execution_context.agent_id+ captured["download_source"] = source.model_dump()+ return AgentStubFileDownloadResponse(+ filename="alpha.zip",+ mime_type="application/zip",+ size=123,+ download_url="https://sandbox-files.example.com/files/alpha.zip",+ )async def inspect_skill(self, *, principal, name):del principalcaptured["inspect_name"] = namereturn {"name": name, "files": ["SKILL.md"]}- async def pull_file(self, *, principal, name):- del principal- captured["file_name"] = name- return b"file-bytes"-async def push(self, *, principal, request):del principalcaptured["push_note"] = request.note@@ -441,29 +478,26 @@ def test_http_config_routes_forward_requests(app = FastAPI()app.include_router(- create_agent_stub_http_router(codec, config_request_handler=cast(AgentStubConfigRequestHandler, FakeHandler()))+ create_agent_stub_http_router(+ codec,+ config_request_handler=cast(AgentStubConfigRequestHandler, cast(object, FakeHandler())),+ ))client = TestClient(app)headers = {"Authorization": f"Bearer {token}"}response = client.request(method.upper(), path, headers=headers, json=body)assert response.status_code == expected_status- if isinstance(expected_detail, bytes):- assert response.content == expected_detail- else:- for key, value in expected_detail.items():- assert response.json()[key] == value+ for key, value in expected_detail.items():+ assert response.json()[key] == valueif path.endswith("/manifest"):assert captured["manifest_agent_id"] == "agent-1"- elif path.endswith("/skills/alpha/pull"):- assert captured["skill_name"] == "alpha"- assert response.headers["content-type"] == "application/zip"+ elif path.endswith("/files/download-request"):+ assert captured["download_agent_id"] == "agent-1"+ assert captured["download_source"] == {"kind": "skill", "name": "alpha"}elif path.endswith("/skills/alpha/inspect"):assert captured["inspect_name"] == "alpha"- elif path.endswith("/files/guide.txt/pull"):- assert captured["file_name"] == "guide.txt"- assert response.headers["content-type"] == "application/octet-stream"elif path.endswith("/config/push"):assert captured["push_note"] == "hello"elif path.endswith("/config/env"):@@ -481,18 +515,14 @@ def test_http_config_routes_map_handler_errors() -> None:del principalraise AgentStubConfigRequestError(422, {"code": "invalid_request"})- async def pull_skill(self, *, principal, name):- del principal, name+ async def create_download_request(self, *, principal, source):+ del principal, sourceraise AssertionError("unexpected route")async def inspect_skill(self, *, principal, name):del principal, nameraise AssertionError("unexpected route")- async def pull_file(self, *, principal, name):- del principal, name- raise AssertionError("unexpected route")-async def push(self, *, principal, request):del principal, requestraise AssertionError("unexpected route")diff --git a/dify-agent/tests/local/dify_agent/agent_stub/server/test_agent_stub_routes.py b/dify-agent/tests/local/dify_agent/agent_stub/server/test_agent_stub_routes.pyindex ab285cc681a..155835f5d25 100644--- a/dify-agent/tests/local/dify_agent/agent_stub/server/test_agent_stub_routes.py+++ b/dify-agent/tests/local/dify_agent/agent_stub/server/test_agent_stub_routes.py@@ -158,6 +158,7 @@ def test_agent_stub_file_download_route_forwards_authenticated_request() -> Noneclass FakeHandler:async def create_download_request(self, *, principal, request):assert principal.execution_context.user_id == "user-1"+ assert request.file is not Noneassert request.file.transfer_method == "tool_file"return AgentStubFileDownloadResponse(filename="report.pdf",diff --git a/dify-agent/tests/local/dify_agent/agent_stub/server/test_cli.py b/dify-agent/tests/local/dify_agent/agent_stub/server/test_cli.pyindex cb40a3b583b..610b5ec9d0f 100644--- a/dify-agent/tests/local/dify_agent/agent_stub/server/test_cli.py+++ b/dify-agent/tests/local/dify_agent/agent_stub/server/test_cli.py@@ -1,10 +1,6 @@from __future__ import annotations-import asyncio-from typing import cast-import dify_agent.agent_stub.server.cli as cli_module-from dify_agent.server.settings import ServerSettingsdef test_stub_server_cli_uses_default_uvicorn_settings(monkeypatch) -> None:@@ -41,101 +37,3 @@ def test_stub_server_cli_passes_explicit_uvicorn_settings(monkeypatch) -> None:"port": 9000,"reload": True,}---def test_stub_server_cli_switches_to_grpc_when_agent_stub_api_base_url_uses_grpc(monkeypatch) -> None:- captured: dict[str, object] = {}-- async def fake_serve_grpc(*, settings, host, port) -> None:- captured.update(settings=settings, host=host, port=port)-- monkeypatch.setattr(cli_module, "_serve_grpc", fake_serve_grpc)- monkeypatch.setattr(- cli_module, "ServerSettings", lambda: type("Settings", (), {"agent_stub_api_base_url": "grpc://agent:9091"})()- )-- cli_module.main(["--host", "0.0.0.0", "--port", "9092"])-- assert captured["host"] == "0.0.0.0"- assert captured["port"] == 9092---def test_serve_grpc_derives_default_bind_target_and_closes_server(monkeypatch) -> None:- captured: dict[str, object] = {}-- class FakeServer:- def __init__(self) -> None:- self.closed = False-- async def aclose(self) -> None:- self.closed = True-- fake_server = FakeServer()-- async def fake_start_agent_stub_grpc_server(**kwargs):- captured.update(kwargs)- return fake_server-- class FakeEvent:- async def wait(self) -> None:- return None-- settings = type(- "Settings",- (),- {- "agent_stub_api_base_url": "grpc://agent.example.com:9091",- "agent_stub_grpc_bind_address": None,- "create_agent_stub_token_codec": lambda self: "token-codec",- "create_agent_stub_file_request_handler": lambda self: "file-handler",- },- )()-- monkeypatch.setattr(cli_module, "start_agent_stub_grpc_server", fake_start_agent_stub_grpc_server)- monkeypatch.setattr(cli_module.asyncio, "Event", FakeEvent)-- asyncio.run(cli_module._serve_grpc(settings=cast(ServerSettings, cast(object, settings)), host=None, port=None))-- assert captured == {- "public_url": "grpc://agent.example.com:9091",- "bind_address": "0.0.0.0:9091",- "token_codec": "token-codec",- "file_request_handler": "file-handler",- }- assert fake_server.closed is True---def test_serve_grpc_applies_cli_host_port_overrides(monkeypatch) -> None:- captured: dict[str, object] = {}-- class FakeServer:- async def aclose(self) -> None:- return None-- async def fake_start_agent_stub_grpc_server(**kwargs):- captured.update(kwargs)- return FakeServer()-- class FakeEvent:- async def wait(self) -> None:- return None-- settings = type(- "Settings",- (),- {- "agent_stub_api_base_url": "grpc://agent.example.com:9091",- "agent_stub_grpc_bind_address": "127.0.0.1:9191",- "create_agent_stub_token_codec": lambda self: None,- "create_agent_stub_file_request_handler": lambda self: None,- },- )()-- monkeypatch.setattr(cli_module, "start_agent_stub_grpc_server", fake_start_agent_stub_grpc_server)- monkeypatch.setattr(cli_module.asyncio, "Event", FakeEvent)-- asyncio.run(- cli_module._serve_grpc(settings=cast(ServerSettings, cast(object, settings)), host="0.0.0.0", port=9292)- )-- assert captured["bind_address"] == "0.0.0.0:9292"diff --git a/dify-agent/tests/local/dify_agent/agent_stub/server/test_grpc_bind.py b/dify-agent/tests/local/dify_agent/agent_stub/server/test_grpc_bind.pydeleted file mode 100644index 0fe7ad36661..00000000000--- a/dify-agent/tests/local/dify_agent/agent_stub/server/test_grpc_bind.py+++ /dev/null@@ -1,37 +0,0 @@-from __future__ import annotations--import pytest--from dify_agent.agent_stub.server.grpc_bind import (- derive_agent_stub_grpc_bind_target,- parse_agent_stub_grpc_bind_address,-)---def test_derive_agent_stub_grpc_bind_target_defaults_to_all_interfaces() -> None:- target = derive_agent_stub_grpc_bind_target(public_url="grpc://agent.example.com:9091")-- assert target.host == "0.0.0.0"- assert target.port == 9091- assert target.address == "0.0.0.0:9091"---def test_derive_agent_stub_grpc_bind_target_prefers_explicit_override() -> None:- target = derive_agent_stub_grpc_bind_target(- public_url="grpc://agent.example.com:9091",- bind_address="127.0.0.1:9191",- )-- assert target.host == "127.0.0.1"- assert target.port == 9191---def test_parse_agent_stub_grpc_bind_address_rejects_missing_port() -> None:- with pytest.raises(ValueError, match="explicit port"):- _ = parse_agent_stub_grpc_bind_address("127.0.0.1")---def test_parse_agent_stub_grpc_bind_address_rejects_user_info(value: str) -> None:- with pytest.raises(ValueError, match="must not include user info"):- _ = parse_agent_stub_grpc_bind_address(value)diff --git a/dify-agent/tests/local/dify_agent/agent_stub/server/test_grpc_service.py b/dify-agent/tests/local/dify_agent/agent_stub/server/test_grpc_service.pydeleted file mode 100644index b179dc70921..00000000000--- a/dify-agent/tests/local/dify_agent/agent_stub/server/test_grpc_service.py+++ /dev/null@@ -1,279 +0,0 @@-from __future__ import annotations--import base64-import json-import secrets-from types import SimpleNamespace-from typing import cast--import pytest--pytest.importorskip("grpclib")-pytest.importorskip("google.protobuf")--from grpclib.const import Status-from grpclib.exceptions import GRPCError--from dify_agent.agent_stub.grpc._generated import agent_stub_pb2-from dify_agent.agent_stub.server.agent_stub_files import AgentStubFileRequestError, AgentStubFileRequestHandler-from dify_agent.agent_stub.server.control_plane import AgentStubControlPlaneService-from dify_agent.agent_stub.server.grpc_service import AgentStubGRPCTransport-from dify_agent.agent_stub.server.tokens.agent_stub import AgentStubTokenCodec-from dify_agent.layers.execution_context import DifyExecutionContextLayerConfig---def _base64url_secret(value: bytes) -> str:- return base64.urlsafe_b64encode(value).rstrip(b"=").decode("ascii")---def _token_codec() -> AgentStubTokenCodec:- return AgentStubTokenCodec.from_server_secret(_base64url_secret(secrets.token_bytes(32)))---def _execution_context() -> DifyExecutionContextLayerConfig:- return DifyExecutionContextLayerConfig(- tenant_id="tenant-1",- user_id="user-1",- user_from="account",- agent_mode="workflow_run",- invoke_from="service-api",- )---def _reference(record_id: str) -> str:- payload = base64.urlsafe_b64encode(json.dumps({"record_id": record_id}, separators=(",", ":")).encode()).decode()- return f"dify-file-ref:{payload}"---def test_agent_stub_grpc_transport_connects_with_bearer_metadata() -> None:- codec = _token_codec()- token = codec.encode_connection_token(_execution_context())- transport = AgentStubGRPCTransport(- AgentStubControlPlaneService(- codec,- connection_id_factory=lambda: "conn-1",- )- )-- async def scenario() -> None:- response = await transport.connect(- request=agent_stub_pb2.ConnectRequest(- protocol_version=1,- argv=["connect"],- metadata_json='{"source":"cli"}',- ),- metadata=(("authorization", f"Bearer {token}"),),- )- assert response.connection_id == "conn-1"- assert response.status == "connected"-- import asyncio-- asyncio.run(scenario())---def test_agent_stub_grpc_transport_maps_missing_authorization_to_unauthenticated() -> None:- codec = _token_codec()- transport = AgentStubGRPCTransport(AgentStubControlPlaneService(codec))-- async def scenario() -> None:- with pytest.raises(GRPCError) as exc_info:- await transport.connect(- request=agent_stub_pb2.ConnectRequest(protocol_version=1, argv=["connect"], metadata_json="{}"),- metadata=(),- )- assert exc_info.value.status == Status.UNAUTHENTICATED-- import asyncio-- asyncio.run(scenario())---def test_agent_stub_grpc_transport_delegates_file_upload_requests() -> None:- codec = _token_codec()- token = codec.encode_connection_token(_execution_context())-- class FakeHandler:- async def create_upload_request(self, *, principal, request):- assert principal.execution_context.tenant_id == "tenant-1"- assert request.filename == "report.pdf"- return type("Response", (), {"upload_url": "https://files.example.com/upload"})()-- async def create_download_request(self, *, principal, request):- del principal, request- raise AssertionError("unexpected download request")-- transport = AgentStubGRPCTransport(- AgentStubControlPlaneService(- codec,- cast(AgentStubFileRequestHandler, cast(object, FakeHandler())),- )- )-- async def scenario() -> None:- response = await transport.create_file_upload_request(- request=agent_stub_pb2.FileUploadRequest(filename="report.pdf", mimetype="application/pdf"),- metadata=(("authorization", f"Bearer {token}"),),- )- assert response.upload_url == "https://files.example.com/upload"-- import asyncio-- asyncio.run(scenario())---def test_agent_stub_grpc_transport_delegates_file_download_requests() -> None:- codec = _token_codec()- token = codec.encode_connection_token(_execution_context())-- class FakeHandler:- async def create_download_request(self, *, principal, request):- assert principal.execution_context.user_id == "user-1"- assert request.file.reference == _reference("tool-file-1")- assert request.for_frontend is False- return type(- "Response",- (),- {- "filename": "report.pdf",- "mime_type": "application/pdf",- "size": 123,- "download_url": "https://files.example.com/download",- },- )()-- async def create_upload_request(self, *, principal, request):- del principal, request- raise AssertionError("unexpected upload request")-- transport = AgentStubGRPCTransport(- AgentStubControlPlaneService(- codec,- cast(AgentStubFileRequestHandler, cast(object, FakeHandler())),- )- )-- async def scenario() -> None:- response = await transport.create_file_download_request(- request=agent_stub_pb2.FileDownloadRequest(- file=agent_stub_pb2.FileMapping(- transfer_method="tool_file",- reference=_reference("tool-file-1"),- ),- for_frontend=False,- ),- metadata=(("authorization", f"Bearer {token}"),),- )- assert response.download_url == "https://files.example.com/download"-- import asyncio-- asyncio.run(scenario())---def test_agent_stub_grpc_transport_stringifies_structured_file_error_details() -> None:- codec = _token_codec()- token = codec.encode_connection_token(_execution_context())-- class FakeHandler:- async def create_upload_request(self, *, principal, request):- del principal, request- raise AgentStubFileRequestError(400, {"detail": "bad request", "code": "inner_api_error"})-- async def create_download_request(self, *, principal, request):- del principal, request- raise AssertionError("unexpected download request")-- transport = AgentStubGRPCTransport(- AgentStubControlPlaneService(- codec,- cast(AgentStubFileRequestHandler, cast(object, FakeHandler())),- )- )-- async def scenario() -> None:- with pytest.raises(GRPCError) as exc_info:- await transport.create_file_upload_request(- request=agent_stub_pb2.FileUploadRequest(filename="report.pdf", mimetype="application/pdf"),- metadata=(("authorization", f"Bearer {token}"),),- )- assert exc_info.value.status == Status.FAILED_PRECONDITION- assert isinstance(exc_info.value.message, str)- assert "bad request" in exc_info.value.message- assert "inner_api_error" in exc_info.value.message-- import asyncio-- asyncio.run(scenario())---def test_agent_stub_grpc_transport_maps_missing_token_codec_to_unavailable() -> None:- transport = AgentStubGRPCTransport(AgentStubControlPlaneService(None))-- async def scenario() -> None:- with pytest.raises(GRPCError) as exc_info:- await transport.connect(- request=agent_stub_pb2.ConnectRequest(protocol_version=1, argv=["connect"], metadata_json="{}"),- metadata=(("authorization", "Bearer token"),),- )- assert exc_info.value.status == Status.UNAVAILABLE-- import asyncio-- asyncio.run(scenario())---def test_agent_stub_grpc_transport_maps_missing_file_handler_to_unavailable() -> None:- codec = _token_codec()- token = codec.encode_connection_token(_execution_context())- transport = AgentStubGRPCTransport(AgentStubControlPlaneService(codec, None))-- async def scenario() -> None:- with pytest.raises(GRPCError) as exc_info:- await transport.create_file_upload_request(- request=agent_stub_pb2.FileUploadRequest(filename="report.pdf", mimetype="application/pdf"),- metadata=(("authorization", f"Bearer {token}"),),- )- assert exc_info.value.status == Status.UNAVAILABLE-- import asyncio-- asyncio.run(scenario())---def test_agent_stub_grpc_transport_maps_invalid_upload_request_to_invalid_argument() -> None:- codec = _token_codec()- token = codec.encode_connection_token(_execution_context())- transport = AgentStubGRPCTransport(AgentStubControlPlaneService(codec))-- async def scenario() -> None:- with pytest.raises(GRPCError) as exc_info:- await transport.create_file_upload_request(- request=SimpleNamespace(filename=None, mimetype="application/pdf"),- metadata=(("authorization", f"Bearer {token}"),),- )- assert exc_info.value.status == Status.INVALID_ARGUMENT-- import asyncio-- asyncio.run(scenario())---def test_agent_stub_grpc_transport_maps_invalid_download_request_to_invalid_argument() -> None:- codec = _token_codec()- token = codec.encode_connection_token(_execution_context())- transport = AgentStubGRPCTransport(AgentStubControlPlaneService(codec))-- async def scenario() -> None:- with pytest.raises(GRPCError) as exc_info:- await transport.create_file_download_request(- request=agent_stub_pb2.FileDownloadRequest(- file=agent_stub_pb2.FileMapping(transfer_method="tool_file")- ),- metadata=(("authorization", f"Bearer {token}"),),- )- assert exc_info.value.status == Status.INVALID_ARGUMENT-- import asyncio-- asyncio.run(scenario())diff --git a/dify-agent/tests/local/dify_agent/server/test_app.py b/dify-agent/tests/local/dify_agent/server/test_app.pyindex 86c2f95dc63..df845519ef3 100644--- a/dify-agent/tests/local/dify_agent/server/test_app.py+++ b/dify-agent/tests/local/dify_agent/server/test_app.py@@ -116,16 +116,6 @@ class FakePluginDaemonHttpClient:self.is_closed = True-class FakeAgentStubGRPCServer:- closed: bool-- def __init__(self) -> None:- self.closed = False-- async def aclose(self) -> None:- self.closed = True--class FakeTimeout:connect: floatread: float@@ -412,34 +402,6 @@ def test_create_app_wires_authenticated_agent_stub_drive_manifest_route(monkeypaassert fake_redis.closed is True-def test_create_app_starts_and_stops_agent_stub_grpc_server_for_grpc_url(monkeypatch: pytest.MonkeyPatch) -> None:- fake_redis, fake_http_client = _patch_app_lifecycle(monkeypatch)- started: dict[str, object] = {}- fake_grpc_server = FakeAgentStubGRPCServer()-- async def fake_start_agent_stub_grpc_server(**kwargs):- started.update(kwargs)- return fake_grpc_server-- monkeypatch.setattr(app_module, "start_agent_stub_grpc_server", fake_start_agent_stub_grpc_server)-- settings = ServerSettings(- redis_url="redis://example.invalid/0",- agent_stub_api_base_url="grpc://agent.example.com:9091",- agent_stub_grpc_bind_address="0.0.0.0:9191",- server_secret_key=_base64url_secret(b"1" * 32),- )-- with TestClient(create_app(settings)):- assert started["public_url"] == "grpc://agent.example.com:9091"- assert started["bind_address"] == "0.0.0.0:9191"-- assert fake_grpc_server.closed is True- assert FakeRunScheduler.created[0].shutdown_called is True- assert fake_http_client.is_closed is True- assert fake_redis.closed is True--def test_create_plugin_daemon_http_client_uses_generic_outbound_httpx_construction_args(monkeypatch: pytest.MonkeyPatch,) -> None:diff --git a/dify-agent/tests/local/dify_agent/server/test_settings.py b/dify-agent/tests/local/dify_agent/server/test_settings.pyindex f669dc0f226..7db759feb6f 100644--- a/dify-agent/tests/local/dify_agent/server/test_settings.py+++ b/dify-agent/tests/local/dify_agent/server/test_settings.py@@ -144,26 +144,6 @@ def test_server_settings_rejects_sandbox_files_base_url_query_or_fragment() -> N_ = ServerSettings(sandbox_files_base_url="https://dify.example.com#fragment")-def test_server_settings_accepts_grpc_agent_stub_api_base_url_and_bind_override() -> None:- settings = ServerSettings(- agent_stub_api_base_url="grpc://agent.example.com:9091",- agent_stub_grpc_bind_address="0.0.0.0:9191",- server_secret_key=_base64url_secret(secrets.token_bytes(32)),- )-- assert settings.agent_stub_api_base_url == "grpc://agent.example.com:9091"- assert settings.agent_stub_grpc_bind_address == "0.0.0.0:9191"---def test_server_settings_rejects_grpc_bind_override_without_grpc_url() -> None:- with pytest.raises(ValidationError, match="grpc://"):- _ = ServerSettings(- agent_stub_api_base_url="https://agent.example.com/agent-stub",- agent_stub_grpc_bind_address="0.0.0.0:9191",- server_secret_key=_base64url_secret(secrets.token_bytes(32)),- )--def test_server_settings_rejects_invalid_server_secret_key() -> None:with pytest.raises(ValidationError, match="32 decoded bytes"):_ = ServerSettings(server_secret_key=_base64url_secret(b"short"))diff --git a/dify-agent/tests/local/dify_agent/test_client_safe_exports.py b/dify-agent/tests/local/dify_agent/test_client_safe_exports.pyindex 175eb61aa5e..3ece328472a 100644--- a/dify-agent/tests/local/dify_agent/test_client_safe_exports.py+++ b/dify-agent/tests/local/dify_agent/test_client_safe_exports.py@@ -54,11 +54,7 @@ def test_client_public_exports_work_with_default_dependencies_only(tmp_path: Patrequirement_name(requirement)for requirement in pyproject["project"].get("optional-dependencies", {}).get("server", [])}- grpc_dependency_names = {- requirement_name(requirement)- for requirement in pyproject["project"].get("optional-dependencies", {}).get("grpc", [])- }- server_only_dependency_names = (server_dependency_names | grpc_dependency_names) - default_dependency_names+ server_only_dependency_names = server_dependency_names - default_dependency_namesagenton_layers = importlib.import_module("agenton.layers")agenton_compositor = importlib.import_module("agenton.compositor")diff --git a/dify-agent/tests/local/dify_agent/test_import_boundaries.py b/dify-agent/tests/local/dify_agent/test_import_boundaries.pyindex 961dab1b8d2..4407d408f41 100644--- a/dify-agent/tests/local/dify_agent/test_import_boundaries.py+++ b/dify-agent/tests/local/dify_agent/test_import_boundaries.py@@ -152,8 +152,6 @@ def test_agent_cli_help_import_is_client_safe() -> None:"dify_agent.server","dify_agent.agent_stub.server","fastapi",- "google.protobuf",- "grpclib","jwcrypto","pydantic_settings","redis",@@ -229,8 +227,6 @@ def test_agent_cli_help_render_does_not_load_server_or_cli_modules() -> None:"dify_agent.server","dify_agent.agent_stub.server","fastapi",- "google.protobuf",- "grpclib","jwcrypto","pydantic_settings","redis",diff --git a/dify-agent/tests/local/test_packaging.py b/dify-agent/tests/local/test_packaging.pyindex d82c3f192b2..13cdc058b49 100644--- a/dify-agent/tests/local/test_packaging.py+++ b/dify-agent/tests/local/test_packaging.py@@ -27,15 +27,9 @@ SERVER_RUNTIME_DEPENDENCIES = {"uvicorn[standard]==0.46.0",}-GRPC_RUNTIME_DEPENDENCIES = {- "grpclib[protobuf]>=0.4.9,<0.5.0",- "protobuf>=6.33.5,<7.0.0",-}-DEV_DEPENDENCIES = {"basedpyright>=1.39.3","coverage[toml]>=7.10.7",- "grpcio-tools>=1.81.0,<2.0.0","pytest>=9.0.3","pytest-examples>=0.0.18","pytest-mock>=3.14.0",@@ -52,7 +46,6 @@ def test_project_dependencies_split_client_and_server_requirements() -> None:project = pyproject["project"]assert set(project["dependencies"]) == CLIENT_SHARED_DTO_DEPENDENCIES- assert set(project["optional-dependencies"]["grpc"]) == GRPC_RUNTIME_DEPENDENCIESassert set(project["optional-dependencies"]["server"]) == SERVER_RUNTIME_DEPENDENCIESassert set(pyproject["dependency-groups"]["dev"]) == DEV_DEPENDENCIESdiff --git a/dify-agent/uv.lock b/dify-agent/uv.lockindex 43f990d853f..7228694cb59 100644--- a/dify-agent/uv.lock+++ b/dify-agent/uv.lock@@ -598,10 +598,6 @@ dependencies = [][package.optional-dependencies]-grpc = [- { name = "grpclib", extra = ["protobuf"] },- { name = "protobuf" },-]server = [{ name = "e2b" },{ name = "fastapi" },@@ -619,7 +615,6 @@ server = [dev = [{ name = "basedpyright" },{ name = "coverage" },- { name = "grpcio-tools" },{ name = "pytest" },{ name = "pytest-examples" },{ name = "pytest-mock" },@@ -637,13 +632,11 @@ requires-dist = [{ name = "e2b", marker = "extra == 'server'", specifier = ">=2.34.0,<3.0.0" },{ name = "fastapi", marker = "extra == 'server'", specifier = "==0.136.0" },{ name = "graphon", marker = "extra == 'server'", specifier = "==0.5.2" },- { name = "grpclib", extras = ["protobuf"], marker = "extra == 'grpc'", specifier = ">=0.4.9,<0.5.0" },{ name = "httpx", specifier = "==0.28.1" },{ name = "httpx2", specifier = ">=2.5.0,<3.0.0" },{ name = "jsonschema", marker = "extra == 'server'", specifier = ">=4.23.0,<5.0.0" },{ name = "jwcrypto", marker = "extra == 'server'", specifier = ">=1.5.6,<2" },{ name = "logfire", extras = ["fastapi", "httpx", "redis"], marker = "extra == 'server'", specifier = ">=4.37.0,<5.0.0" },- { name = "protobuf", marker = "extra == 'grpc'", specifier = ">=6.33.5,<7.0.0" },{ name = "pydantic", specifier = ">=2.12.5,<2.13" },{ name = "pydantic-ai-slim", specifier = ">=1.102.0,<2.0.0" },{ name = "pydantic-ai-slim", extras = ["anthropic", "google", "openai"], marker = "extra == 'server'", specifier = ">=1.85.1,<2.0.0" },@@ -652,13 +645,12 @@ requires-dist = [{ name = "typing-extensions", specifier = ">=4.12.2,<5.0.0" },{ name = "uvicorn", extras = ["standard"], marker = "extra == 'server'", specifier = "==0.46.0" },]-provides-extras = ["grpc", "server"]+provides-extras = ["server"][package.metadata.requires-dev]dev = [{ name = "basedpyright", specifier = ">=1.39.3" },{ name = "coverage", extras = ["toml"], specifier = ">=7.10.7" },- { name = "grpcio-tools", specifier = ">=1.81.0,<2.0.0" },{ name = "pytest", specifier = ">=9.0.3" },{ name = "pytest-examples", specifier = ">=0.0.18" },{ name = "pytest-mock", specifier = ">=3.14.0" },@@ -903,108 +895,6 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/11/8c/c9138d881c79aa0ea9ed83cbd58d5ca75624378b38cee225dcf5c42cc91f/griffelib-2.0.2-py3-none-any.whl", hash = "sha256:925c857658fb1ba40c0772c37acbc2ab650bd794d9c1b9726922e36ea4117ea1", size = 142357, upload-time = "2026-03-27T11:34:46.275Z" },]-[[package]]-name = "grpcio"-version = "1.81.0"-source = { registry = "https://pypi.org/simple" }-dependencies = [- { name = "typing-extensions" },-]-sdist = { url = "https://files.pythonhosted.org/packages/15/f3/23f47b24f8d8c2028eba501db3acfbb2f592cbb5995eaa6e363a627b74d7/grpcio-1.81.0.tar.gz", hash = "sha256:a5acd7efd3b1fe9b4eb0bcaaa1507eed68a0ad0678b654c3f7b464df9ba9dca5", size = 13032272, upload-time = "2026-06-01T05:56:22.827Z" }-wheels = [- { url = "https://files.pythonhosted.org/packages/82/d5/896a3aaf07068d707d88b282a04914b872db4d32d3c7e6d88e43a3b911fa/grpcio-1.81.0-cp312-cp312-linux_armv7l.whl", hash = "sha256:57b3b0e73a518fa286959b40c3eddd02703504ca186e8b7b2945954519bd8b2c", size = 6053538, upload-time = "2026-06-01T05:54:58.965Z" },- { url = "https://files.pythonhosted.org/packages/68/6a/7e3eafa4727cd405ff917605ed2949e2af162f233f5cbdd773723a5fea7d/grpcio-1.81.0-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:8bb1789c94322a13336a2b6c58d9c14d68f8628b6e24205a799c69f5bf8516ce", size = 12053447, upload-time = "2026-06-01T05:55:01.862Z" },- { url = "https://files.pythonhosted.org/packages/16/79/a4302aa82428de48a922421f522b027a1a727ab4d0926368454aa953d36d/grpcio-1.81.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:e4d053900a0d24b75d7521139a3872150301b3d6bde3bed5e12318fb25791e4d", size = 6595872, upload-time = "2026-06-01T05:55:04.946Z" },- { url = "https://files.pythonhosted.org/packages/b4/1f/7ff2850eaefbecf99af3f624dbb28dd1ad6c5fd4c1d8c26909ed6482673b/grpcio-1.81.0-cp312-cp312-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:db217c2e52931719f9937bd12082cd4d7b495b35803d5760686975c285924bf8", size = 7303857, upload-time = "2026-06-01T05:55:07.205Z" },- { url = "https://files.pythonhosted.org/packages/e2/98/1f3896a9baae1f2aedf4e99c55291d6fa1f30ad9603d63bc18bda967b53e/grpcio-1.81.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:19f201da7b4e5c0559198abe5a97157e726f3abe6e8f5e832d4a50740f6dcc22", size = 6809676, upload-time = "2026-06-01T05:55:09.513Z" },- { url = "https://files.pythonhosted.org/packages/34/8b/3441983718095208c5d797fd3239882e97ea89a629f41c8df94b4eef4df9/grpcio-1.81.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:275144b0115353339dbb8a6f28a9cf8997b5bf40e37f8f66ac0b0ea57e95b43f", size = 7412654, upload-time = "2026-06-01T05:55:12.777Z" },- { url = "https://files.pythonhosted.org/packages/3c/98/1eddf07df6e4fe85cf67502a793f7b05468b2dca3d1ef35b972cf5d54468/grpcio-1.81.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:5192857589f223e5a98ff0e31f6e551b19040e647d17bfe10116c8a2ce3b8696", size = 8408026, upload-time = "2026-06-01T05:55:15.514Z" },- { url = "https://files.pythonhosted.org/packages/5c/73/3860341e6a1f5347be6ab35c6c0e1e3a8eb59d010388207fd561dcf01a88/grpcio-1.81.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c6ff087cb1f563f47b504b4e29e684129fc5ae4863faf3ebca08a327764ee6cb", size = 7849498, upload-time = "2026-06-01T05:55:18.078Z" },- { url = "https://files.pythonhosted.org/packages/ae/3f/0ea06bd85c701966aa3f8f37314f2ed83520d2b7590f42d643d445d8bc8b/grpcio-1.81.0-cp312-cp312-win32.whl", hash = "sha256:98c6240f563178fc5877bd50e6ff274463e53e1472128f4110742450739659fa", size = 4184161, upload-time = "2026-06-01T05:55:20.127Z" },- { url = "https://files.pythonhosted.org/packages/39/e3/a7c387406827a86f99ad7838b995bf9b4a182ffe2d2c439ed2873efec952/grpcio-1.81.0-cp312-cp312-win_amd64.whl", hash = "sha256:87e33b7afcfb3585121b5f007d2c52b8c534104d18f556e840d35193ca2a9141", size = 4929958, upload-time = "2026-06-01T05:55:22.736Z" },- { url = "https://files.pythonhosted.org/packages/f3/29/779ee53c931d0fd55c1d459fde43e485172caa3ac87cbd43d003a13a0185/grpcio-1.81.0-cp313-cp313-linux_armv7l.whl", hash = "sha256:62bbe463c9f0f2ff24e31bd25f8dd8b4bae78900e315915a3195a0ef1471a855", size = 6054973, upload-time = "2026-06-01T05:55:25.043Z" },- { url = "https://files.pythonhosted.org/packages/9e/b6/7211807926b5a17f8d9a5d47c739a163d6812fefe3e4714e81cf92945ed7/grpcio-1.81.0-cp313-cp313-macosx_11_0_universal2.whl", hash = "sha256:43c121e135ae44d1559b430db2b2dfad7421cbbe40e1deba506c7dc62b439719", size = 12048662, upload-time = "2026-06-01T05:55:28.453Z" },- { url = "https://files.pythonhosted.org/packages/64/89/b1b93ef6b34bd20bbaf707fa99133bc9cc302139d5ec6f77a165c7169796/grpcio-1.81.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:f345de40ef2e65f63645d53d251824e6070e07804827c5b00ec2e44555f9f901", size = 6599116, upload-time = "2026-06-01T05:55:31.185Z" },- { url = "https://files.pythonhosted.org/packages/eb/bc/c89f9b9d1c22895715356a1e009554dae66319e97826bb4d30bcda7d29e8/grpcio-1.81.0-cp313-cp313-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:8c0855a350886f713b9e458e2a10d208009dcaa849f574e39cd6067db1fe1279", size = 7307591, upload-time = "2026-06-01T05:55:33.463Z" },- { url = "https://files.pythonhosted.org/packages/65/4a/1df2a4cb4a1386e066ab7e4175e34bb884b35ccb60d3621c09c84af6aabb/grpcio-1.81.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:a524cd530900bd24511fcb7f2ed144da4ea37711c4b094475d0bceca7a93a170", size = 6811797, upload-time = "2026-06-01T05:55:36.731Z" },- { url = "https://files.pythonhosted.org/packages/8d/dc/fa189d20601a1be25b08850cfb733879bbb1047b62a8feec3a60e3e1a87b/grpcio-1.81.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:e7746ba3e6efc9e2b748eff59470a2b8684d5a9ec607c6580bcaa5be175820bc", size = 7415131, upload-time = "2026-06-01T05:55:39.451Z" },- { url = "https://files.pythonhosted.org/packages/ad/a3/5625c48cb48d23c6631b3e5294f88e4c751f22a52591ae78859fab96dca1/grpcio-1.81.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:aaaa4f7f2057d795952e4eacf3f342be8b5b156992f6ac85023c8b98794ebd47", size = 8408398, upload-time = "2026-06-01T05:55:42.219Z" },- { url = "https://files.pythonhosted.org/packages/75/34/0f8202c6809a46c2b4d69125ef3667c40b1c211f8e19930e5fa1f1197039/grpcio-1.81.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:0fba53cb96004b2b7fb758b46b2288cb49d0b658316a4e73f3ef67230616ee65", size = 7844481, upload-time = "2026-06-01T05:55:44.849Z" },- { url = "https://files.pythonhosted.org/packages/c0/95/c3366b5b5edf4c4adc90f2e29ca16e57965a8e56dc8d2ee89565ba1905bb/grpcio-1.81.0-cp313-cp313-win32.whl", hash = "sha256:c197e2ef75a442528072b29e9755da299110e8610e8bcbb59a6b4cf55384f005", size = 4182777, upload-time = "2026-06-01T05:55:47.459Z" },- { url = "https://files.pythonhosted.org/packages/a9/a7/932f2f748511a32e641a2aba0d30dded3ed6e8bc330e0924e4d5d86853e6/grpcio-1.81.0-cp313-cp313-win_amd64.whl", hash = "sha256:194eddfacc84d80f50512e9fd4ee851d5f2499f18f299c95aa8fb4748f0537e0", size = 4928085, upload-time = "2026-06-01T05:55:50.158Z" },- { url = "https://files.pythonhosted.org/packages/c5/1d/28b231333857deb840bc3d182ae087510170ea6d68f21393aeb0fe499530/grpcio-1.81.0-cp314-cp314-linux_armv7l.whl", hash = "sha256:a9351055f52660b58f3d4890ea66188b5134399f82b11aa0c55bd4b99eff5390", size = 6055712, upload-time = "2026-06-01T05:55:52.889Z" },- { url = "https://files.pythonhosted.org/packages/e8/b8/999c14f9dff0fc47549d2e827cba1343ddc18e1d1bf0d06d2cf628eecbd9/grpcio-1.81.0-cp314-cp314-macosx_11_0_universal2.whl", hash = "sha256:300f3337b6425fd16ead9a4f9b2ac25801acb64aa5bc0b99eb69901645b2b1d2", size = 12057189, upload-time = "2026-06-01T05:55:55.952Z" },- { url = "https://files.pythonhosted.org/packages/1e/3d/1fbde079572562af65351151d840525a13879eb7b481d35b55cd64c6127a/grpcio-1.81.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:97bbd623f7ded558fd4f7cb5a4f600c4d4de65c5dd364c83a5b14b2a10a2d3b5", size = 6608136, upload-time = "2026-06-01T05:55:59.069Z" },- { url = "https://files.pythonhosted.org/packages/32/89/1f17cb6882abfd8e5a303a25d5d1665abef5a8c499a96198c65a651d1b85/grpcio-1.81.0-cp314-cp314-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:ff83d889e3ebf6341c8c7864ad8031591ad5ca61599072fc511644d1eb962d2b", size = 7307045, upload-time = "2026-06-01T05:56:02.376Z" },- { url = "https://files.pythonhosted.org/packages/48/5a/f98e91b2e755652e637ea2144318b0229b290062199f761b445fe1fa6015/grpcio-1.81.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c4fe218c5a35e1d87a5a26544237f1fa41dfd9cbd3c856b0810a30061f8b0aaf", size = 6812794, upload-time = "2026-06-01T05:56:05.777Z" },- { url = "https://files.pythonhosted.org/packages/0a/0c/77892d715ac41e7ec0ace2a50080ffb64e189188056f607a66fe0014d1ee/grpcio-1.81.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:b8b025b6af43ee0ad4a70307025d77bcab5adde7c4597786010d802c203e9fc5", size = 7422767, upload-time = "2026-06-01T05:56:08.524Z" },- { url = "https://files.pythonhosted.org/packages/3f/b8/aa04590c6564714d94954515f15a236e59d4b9b3ad01e615f1b706d7792d/grpcio-1.81.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:3d4e0ce5a40a998cf608c8ba60ecfe18fdf364a9aa193ae4ac3faeecd0e86757", size = 8408551, upload-time = "2026-06-01T05:56:11.283Z" },- { url = "https://files.pythonhosted.org/packages/43/3d/4f4a3450a1973568910c6909cb74abbf2126f68aefae5976962f9f7ad50d/grpcio-1.81.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:aa948712c8e5fa40ec250870bda14bc7578e1bb832a8912d9d2a0f720518edbe", size = 7846468, upload-time = "2026-06-01T05:56:14.536Z" },- { url = "https://files.pythonhosted.org/packages/88/f4/5827fd248221ad3b44161c23ce9b5f4ee405b04fc6da5fd402a9aa87a84a/grpcio-1.81.0-cp314-cp314-win32.whl", hash = "sha256:fbbe81314a9d92156abce8b62c09364eb8bafc0ca2a19919a45ec64b5c6cb664", size = 4264427, upload-time = "2026-06-01T05:56:17.192Z" },- { url = "https://files.pythonhosted.org/packages/0c/e8/127dc2b246096ad50ef7c8d9b7b31d757787aeb796368bcdd4454e4204c4/grpcio-1.81.0-cp314-cp314-win_amd64.whl", hash = "sha256:b93cee313cae4e113fbb3a0ce1ea5633db6f63cfde2b2dc1d817429026b2a50b", size = 5070848, upload-time = "2026-06-01T05:56:19.735Z" },-]--[[package]]-name = "grpcio-tools"-version = "1.81.0"-source = { registry = "https://pypi.org/simple" }-dependencies = [- { name = "grpcio" },- { name = "protobuf" },- { name = "setuptools" },-]-sdist = { url = "https://files.pythonhosted.org/packages/f3/b5/72f688670ce56ea59b05ea13430f06cbb728dd354dac508544fc7d4b5c95/grpcio_tools-1.81.0.tar.gz", hash = "sha256:0733d773eca8cb461f4f2a1b79c64c123db9661be41b08184b81497b2b991ccb", size = 6235718, upload-time = "2026-06-01T05:58:34.191Z" }-wheels = [- { url = "https://files.pythonhosted.org/packages/1c/e3/3c4f9da489413ef3f3dc9f7bc49a270270ec99fb3a00fd4302a2f59a7be2/grpcio_tools-1.81.0-cp312-cp312-linux_armv7l.whl", hash = "sha256:374fe0435447f283e3c69f719ef1bc66f2e187a239ce25444b2de45cb3a6a744", size = 2585927, upload-time = "2026-06-01T05:57:25.397Z" },- { url = "https://files.pythonhosted.org/packages/d2/b2/de7aba18f87d722c215ae168add975b9e7729cfaf7a1292be43f87685fa1/grpcio_tools-1.81.0-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:dce33d09851bc15dead814bd9d21023bffdf0f838ecf65995a2456e5692831fd", size = 5815566, upload-time = "2026-06-01T05:57:27.714Z" },- { url = "https://files.pythonhosted.org/packages/eb/13/8f71b4830f129d896560c66964a3a8f4e33fbd59854396015e7449b75d3a/grpcio_tools-1.81.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:58e65dd13f7ffc25f5a9cd9890fddfd39b3c51e5c3c1acd987813b1dc1173704", size = 2635519, upload-time = "2026-06-01T05:57:29.848Z" },- { url = "https://files.pythonhosted.org/packages/a2/e0/3ad58f1791c346a1fefc69ef3fcd19d63e3778736d4746f12b39f900b78b/grpcio_tools-1.81.0-cp312-cp312-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:760775f79bbefa321cd327fe1019a9d6ad0d93acb1ede7b7905c712679542fd7", size = 2958250, upload-time = "2026-06-01T05:57:31.836Z" },- { url = "https://files.pythonhosted.org/packages/79/8a/3212db57815df0fa2a02e857e402c1abea15ec6b5fb63ebf306d90f2fb07/grpcio_tools-1.81.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7af4faf34376c57f4f3c42aa05f065d3b10e774b8a8d8b27d659d5cc351e5c75", size = 2698437, upload-time = "2026-06-01T05:57:33.827Z" },- { url = "https://files.pythonhosted.org/packages/ec/d5/4245bbb4c14b54ac539b5b59f5298750d75211e144e1e8b35e1af5144d6d/grpcio_tools-1.81.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e9945945edc14022abab07caec0ebc16bf51219e586b4f008d09334cc479655c", size = 3152159, upload-time = "2026-06-01T05:57:36.065Z" },- { url = "https://files.pythonhosted.org/packages/59/b1/59500d9fe41209e0887c66d80879ba80d0cc8e1327e24cc783eb879fe7a7/grpcio_tools-1.81.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:61d9ad6b5c0f3857663701bdc2cbb3da7f7d835ce9a8d597ffca443124a96894", size = 3710468, upload-time = "2026-06-01T05:57:38.367Z" },- { url = "https://files.pythonhosted.org/packages/0c/14/86fc8b64db62851bf5cb1c945b22da7ab0dec6e0b7002ec374247482d404/grpcio_tools-1.81.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ffa74b84d201bea407f22e00ac0367f12df48a0073b0ffd9f3be9d8126a55245", size = 3370795, upload-time = "2026-06-01T05:57:40.724Z" },- { url = "https://files.pythonhosted.org/packages/94/95/4fd57d9f948adadbe5b3e8e3b0d3c121ae5fe8276721097ab03361ce7adf/grpcio_tools-1.81.0-cp312-cp312-win32.whl", hash = "sha256:f1f407697873acbf1d961c6fb9223114a3e679938469d4186623b8b872dbdae0", size = 1008449, upload-time = "2026-06-01T05:57:42.491Z" },- { url = "https://files.pythonhosted.org/packages/33/94/7567ddd3a13e24bbc5e146c6ac735004ab7303048115ccb032d61b5c2305/grpcio_tools-1.81.0-cp312-cp312-win_amd64.whl", hash = "sha256:283bb3465331a4034b14dce35425c47b0cfbd287b09a6e9d15c9f26fbb17e799", size = 1174889, upload-time = "2026-06-01T05:57:44.405Z" },- { url = "https://files.pythonhosted.org/packages/f2/05/f0606a1b2e830d5fddfcd77c5d8e928f26dc221ced386fccf31a6efda57e/grpcio_tools-1.81.0-cp313-cp313-linux_armv7l.whl", hash = "sha256:33c579bf24040dbdce751e05b5bcedc13dafffa8f2dfa07193bc05960dc95b49", size = 2586070, upload-time = "2026-06-01T05:57:46.677Z" },- { url = "https://files.pythonhosted.org/packages/c4/4a/3b6817547d65d9f7a106ea6a2352125d08b44ce1d120b64ca0c565d896e6/grpcio_tools-1.81.0-cp313-cp313-macosx_11_0_universal2.whl", hash = "sha256:2a369a9e27fcb6279387744778d67a64551de82db0e9cf7e1e9451c22f719e07", size = 5813211, upload-time = "2026-06-01T05:57:49.159Z" },- { url = "https://files.pythonhosted.org/packages/bf/fc/078422558ebb337233379cdb0e4cc0d3d3218933d105003bae2790ff976f/grpcio_tools-1.81.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:b2b26111795d0e7a72fa483d377a75b57203edaac8bbbac1e9b8f174e7b01ff3", size = 2634663, upload-time = "2026-06-01T05:57:51.41Z" },- { url = "https://files.pythonhosted.org/packages/53/2b/043f2d62d6f28a0962f29f180ae24770020a06985b14a2d8f0d489531d71/grpcio_tools-1.81.0-cp313-cp313-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:a741007631248dd903f880b575a63c0662433ed4b966262ab0f437ea860c9b7e", size = 2957926, upload-time = "2026-06-01T05:57:54.103Z" },- { url = "https://files.pythonhosted.org/packages/76/d3/be8c1f7c5ca6adccba66ef787b4bba304a3247c1319a33ed330719931ba3/grpcio_tools-1.81.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:bac1c6ddc5eb3762257e773829b4e00ea7d0592f02498f27e5bdb75cd3182d69", size = 2697761, upload-time = "2026-06-01T05:57:56.494Z" },- { url = "https://files.pythonhosted.org/packages/19/9d/c1650c72059f7d20d94597430ecbe0139d92c7e409cf007d0b5d765e40ec/grpcio_tools-1.81.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:e5d241c694a226bada06dae9accc47c5c25e586f49464823498e84cff63eedea", size = 3151460, upload-time = "2026-06-01T05:57:58.756Z" },- { url = "https://files.pythonhosted.org/packages/6b/82/2aad863738dc4f749df93d97f81a8aebdd0a7c5daee7157c259ecea7dbbc/grpcio_tools-1.81.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:475286558410e4d0394fc8129559080c22835ece3c23cac194b46c5ad7d0fad1", size = 3710466, upload-time = "2026-06-01T05:58:01.327Z" },- { url = "https://files.pythonhosted.org/packages/47/7d/b79a5b132bd5db76ce48e686579ded0311bfa7ea19b8cb9ca88aea3e8d64/grpcio_tools-1.81.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:98b57a592a75553f4dd38db3993b037953245991b8df9f06927a8978962dcd82", size = 3370487, upload-time = "2026-06-01T05:58:03.769Z" },- { url = "https://files.pythonhosted.org/packages/96/6f/a6a74a51b71aca801f4dcce6bd8bb7d3fd8d556ff191f0bd0de631b97dd1/grpcio_tools-1.81.0-cp313-cp313-win32.whl", hash = "sha256:78c2514bf172b20631685840fea0c5d1bec5518b649d0a498f6dd8f91dfce56a", size = 1008234, upload-time = "2026-06-01T05:58:05.668Z" },- { url = "https://files.pythonhosted.org/packages/5a/91/02a4c529dd0a77c2d768b415ac334f6a9ea9d61c6f4c38e54d1a4394530c/grpcio_tools-1.81.0-cp313-cp313-win_amd64.whl", hash = "sha256:a87ea8056beea56b24353d27b7f0ab814daabb372aa517d2e179470e66fd8f6b", size = 1174523, upload-time = "2026-06-01T05:58:07.711Z" },- { url = "https://files.pythonhosted.org/packages/13/1f/7885e23074d813ab71ba3ea689ecf5cb3bb3c76c51cc01bd393451f10257/grpcio_tools-1.81.0-cp314-cp314-linux_armv7l.whl", hash = "sha256:bf2ffd98c754d54a5affddfe3a18d4822b972c5c37ca6a33a456c94e6f3dd82b", size = 2585943, upload-time = "2026-06-01T05:58:10.077Z" },- { url = "https://files.pythonhosted.org/packages/40/f4/a88116147d377a88fccef9b43667235835d504d60ebe0e0dcc81bc9c4b20/grpcio_tools-1.81.0-cp314-cp314-macosx_11_0_universal2.whl", hash = "sha256:4a8d9fdf42537cd1924f7e95013771aa73c89501ccf112b7517c22ca825be9f5", size = 5813367, upload-time = "2026-06-01T05:58:12.545Z" },- { url = "https://files.pythonhosted.org/packages/2a/1e/01f310f0427dcddaf0097e4101f041d437ba8199a7ed62621788f2601042/grpcio_tools-1.81.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:564624654f5a0377adc69f226f93ec5ff52715030c2f846af6c54ccc4ca2d225", size = 2634992, upload-time = "2026-06-01T05:58:14.92Z" },- { url = "https://files.pythonhosted.org/packages/fd/ee/10cec754cb89cf45039ef4a8ff500ab5c567278fc4f6333347dba20c99fb/grpcio_tools-1.81.0-cp314-cp314-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:3f1ac691debbdbf00e7635ecacf28647f48f67fb4b14120a4541c8bb0f8333ae", size = 2957912, upload-time = "2026-06-01T05:58:17.596Z" },- { url = "https://files.pythonhosted.org/packages/d2/71/cc273059fa3620d424df91a8faabd5875d4c20a0300875e721d15decd74b/grpcio_tools-1.81.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f35da7b3b9537ecce9a5cfd967b1316a815378d5a3729e9ea556b22a14f6e315", size = 2697709, upload-time = "2026-06-01T05:58:19.653Z" },- { url = "https://files.pythonhosted.org/packages/a1/d5/c72f9e7d18425586bbc5b4fba78570fab23cb9810fb34a8841f7baaef22b/grpcio_tools-1.81.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:1e21049aeedd9d62e5e58146e5d00f3b75674d8d8d3cc69709ab950082be8421", size = 3151885, upload-time = "2026-06-01T05:58:22.366Z" },- { url = "https://files.pythonhosted.org/packages/9e/f9/7a3d7b3bce72fe22611a79d3790440c16af9d524a8bd1d38a89a44c65570/grpcio_tools-1.81.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:019f05a17b5495d561603f75a74a4a76ad22456a95dc7623c7be4e4b44391b88", size = 3710403, upload-time = "2026-06-01T05:58:25.014Z" },- { url = "https://files.pythonhosted.org/packages/58/2d/b41fe47b83eb197a48fdcbf48d04f5923c5fd62d4b1a7f2820720562d7ae/grpcio_tools-1.81.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:3401d6d4668c064c9ed344825fe97ff076cd8ba719a24e3d3c7169b604cbf00f", size = 3370524, upload-time = "2026-06-01T05:58:27.096Z" },- { url = "https://files.pythonhosted.org/packages/94/d3/a4565146ab83232ddf86a3de497937662dc06649739f978763379c256311/grpcio_tools-1.81.0-cp314-cp314-win32.whl", hash = "sha256:5783b6758244f6eaceb41a0e651828824b0d0c92724ddf4b68879ced9bfd9b50", size = 1030574, upload-time = "2026-06-01T05:58:28.972Z" },- { url = "https://files.pythonhosted.org/packages/35/72/f2102f3737b94e14b8ce56394918c0a4303e80d5d8b0627fc4ee85927f79/grpcio_tools-1.81.0-cp314-cp314-win_amd64.whl", hash = "sha256:69f8355b723db7b5e26a3bff76f9deb3a407d22fe289bca486ccf95d6133cad0", size = 1207499, upload-time = "2026-06-01T05:58:31.606Z" },-]--[[package]]-name = "grpclib"-version = "0.4.9"-source = { registry = "https://pypi.org/simple" }-dependencies = [- { name = "h2" },- { name = "multidict" },-]-sdist = { url = "https://files.pythonhosted.org/packages/5b/28/5a2c299ec82a876a252c5919aa895a6f1d1d35c96417c5ce4a4660dc3a80/grpclib-0.4.9.tar.gz", hash = "sha256:cc589c330fa81004c6400a52a566407574498cb5b055fa927013361e21466c46", size = 84798, upload-time = "2025-12-14T22:23:14.349Z" }-wheels = [- { url = "https://files.pythonhosted.org/packages/5c/90/b0cbbd9efcc82816c58f31a34963071aa19fb792a212a5d9caf8e0fc3097/grpclib-0.4.9-py3-none-any.whl", hash = "sha256:7762ec1c8ed94dfad597475152dd35cbd11aecaaca2f243e29702435ca24cf0e", size = 77063, upload-time = "2025-12-14T22:23:13.224Z" },-]--[package.optional-dependencies]-protobuf = [- { name = "protobuf" },-]-[[package]]name = "h11"version = "0.16.0"@@ -1747,105 +1637,6 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/32/28/79f0f8de97cce916d5ae88a7bee1ad724855e83e6019c0b4d5b3fabc80f3/mkdocstrings_python-2.0.3-py3-none-any.whl", hash = "sha256:0b83513478bdfd803ff05aa43e9b1fca9dd22bcd9471f09ca6257f009bc5ee12", size = 104779, upload-time = "2026-02-20T10:38:34.517Z" },]-[[package]]-name = "multidict"-version = "6.7.1"-source = { registry = "https://pypi.org/simple" }-sdist = { url = "https://files.pythonhosted.org/packages/1a/c2/c2d94cbe6ac1753f3fc980da97b3d930efe1da3af3c9f5125354436c073d/multidict-6.7.1.tar.gz", hash = "sha256:ec6652a1bee61c53a3e5776b6049172c53b6aaba34f18c9ad04f82712bac623d", size = 102010, upload-time = "2026-01-26T02:46:45.979Z" }-wheels = [- { url = "https://files.pythonhosted.org/packages/8d/9c/f20e0e2cf80e4b2e4b1c365bf5fe104ee633c751a724246262db8f1a0b13/multidict-6.7.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:a90f75c956e32891a4eda3639ce6dd86e87105271f43d43442a3aedf3cddf172", size = 76893, upload-time = "2026-01-26T02:43:52.754Z" },- { url = "https://files.pythonhosted.org/packages/fe/cf/18ef143a81610136d3da8193da9d80bfe1cb548a1e2d1c775f26b23d024a/multidict-6.7.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:3fccb473e87eaa1382689053e4a4618e7ba7b9b9b8d6adf2027ee474597128cd", size = 45456, upload-time = "2026-01-26T02:43:53.893Z" },- { url = "https://files.pythonhosted.org/packages/a9/65/1caac9d4cd32e8433908683446eebc953e82d22b03d10d41a5f0fefe991b/multidict-6.7.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b0fa96985700739c4c7853a43c0b3e169360d6855780021bfc6d0f1ce7c123e7", size = 43872, upload-time = "2026-01-26T02:43:55.041Z" },- { url = "https://files.pythonhosted.org/packages/cf/3b/d6bd75dc4f3ff7c73766e04e705b00ed6dbbaccf670d9e05a12b006f5a21/multidict-6.7.1-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:cb2a55f408c3043e42b40cc8eecd575afa27b7e0b956dfb190de0f8499a57a53", size = 251018, upload-time = "2026-01-26T02:43:56.198Z" },- { url = "https://files.pythonhosted.org/packages/fd/80/c959c5933adedb9ac15152e4067c702a808ea183a8b64cf8f31af8ad3155/multidict-6.7.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:eb0ce7b2a32d09892b3dd6cc44877a0d02a33241fafca5f25c8b6b62374f8b75", size = 258883, upload-time = "2026-01-26T02:43:57.499Z" },- { url = "https://files.pythonhosted.org/packages/86/85/7ed40adafea3d4f1c8b916e3b5cc3a8e07dfcdcb9cd72800f4ed3ca1b387/multidict-6.7.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c3a32d23520ee37bf327d1e1a656fec76a2edd5c038bf43eddfa0572ec49c60b", size = 242413, upload-time = "2026-01-26T02:43:58.755Z" },- { url = "https://files.pythonhosted.org/packages/d2/57/b8565ff533e48595503c785f8361ff9a4fde4d67de25c207cd0ba3befd03/multidict-6.7.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:9c90fed18bffc0189ba814749fdcc102b536e83a9f738a9003e569acd540a733", size = 268404, upload-time = "2026-01-26T02:44:00.216Z" },- { url = "https://files.pythonhosted.org/packages/e0/50/9810c5c29350f7258180dfdcb2e52783a0632862eb334c4896ac717cebcb/multidict-6.7.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:da62917e6076f512daccfbbde27f46fed1c98fee202f0559adec8ee0de67f71a", size = 269456, upload-time = "2026-01-26T02:44:02.202Z" },- { url = "https://files.pythonhosted.org/packages/f3/8d/5e5be3ced1d12966fefb5c4ea3b2a5b480afcea36406559442c6e31d4a48/multidict-6.7.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bfde23ef6ed9db7eaee6c37dcec08524cb43903c60b285b172b6c094711b3961", size = 256322, upload-time = "2026-01-26T02:44:03.56Z" },- { url = "https://files.pythonhosted.org/packages/31/6e/d8a26d81ac166a5592782d208dd90dfdc0a7a218adaa52b45a672b46c122/multidict-6.7.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3758692429e4e32f1ba0df23219cd0b4fc0a52f476726fff9337d1a57676a582", size = 253955, upload-time = "2026-01-26T02:44:04.845Z" },- { url = "https://files.pythonhosted.org/packages/59/4c/7c672c8aad41534ba619bcd4ade7a0dc87ed6b8b5c06149b85d3dd03f0cd/multidict-6.7.1-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:398c1478926eca669f2fd6a5856b6de9c0acf23a2cb59a14c0ba5844fa38077e", size = 251254, upload-time = "2026-01-26T02:44:06.133Z" },- { url = "https://files.pythonhosted.org/packages/7b/bd/84c24de512cbafbdbc39439f74e967f19570ce7924e3007174a29c348916/multidict-6.7.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:c102791b1c4f3ab36ce4101154549105a53dc828f016356b3e3bcae2e3a039d3", size = 252059, upload-time = "2026-01-26T02:44:07.518Z" },- { url = "https://files.pythonhosted.org/packages/fa/ba/f5449385510825b73d01c2d4087bf6d2fccc20a2d42ac34df93191d3dd03/multidict-6.7.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:a088b62bd733e2ad12c50dad01b7d0166c30287c166e137433d3b410add807a6", size = 263588, upload-time = "2026-01-26T02:44:09.382Z" },- { url = "https://files.pythonhosted.org/packages/d7/11/afc7c677f68f75c84a69fe37184f0f82fce13ce4b92f49f3db280b7e92b3/multidict-6.7.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:3d51ff4785d58d3f6c91bdbffcb5e1f7ddfda557727043aa20d20ec4f65e324a", size = 259642, upload-time = "2026-01-26T02:44:10.73Z" },- { url = "https://files.pythonhosted.org/packages/2b/17/ebb9644da78c4ab36403739e0e6e0e30ebb135b9caf3440825001a0bddcb/multidict-6.7.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:fc5907494fccf3e7d3f94f95c91d6336b092b5fc83811720fae5e2765890dfba", size = 251377, upload-time = "2026-01-26T02:44:12.042Z" },- { url = "https://files.pythonhosted.org/packages/ca/a4/840f5b97339e27846c46307f2530a2805d9d537d8b8bd416af031cad7fa0/multidict-6.7.1-cp312-cp312-win32.whl", hash = "sha256:28ca5ce2fd9716631133d0e9a9b9a745ad7f60bac2bccafb56aa380fc0b6c511", size = 41887, upload-time = "2026-01-26T02:44:14.245Z" },- { url = "https://files.pythonhosted.org/packages/80/31/0b2517913687895f5904325c2069d6a3b78f66cc641a86a2baf75a05dcbb/multidict-6.7.1-cp312-cp312-win_amd64.whl", hash = "sha256:fcee94dfbd638784645b066074b338bc9cc155d4b4bffa4adce1615c5a426c19", size = 46053, upload-time = "2026-01-26T02:44:15.371Z" },- { url = "https://files.pythonhosted.org/packages/0c/5b/aba28e4ee4006ae4c7df8d327d31025d760ffa992ea23812a601d226e682/multidict-6.7.1-cp312-cp312-win_arm64.whl", hash = "sha256:ba0a9fb644d0c1a2194cf7ffb043bd852cea63a57f66fbd33959f7dae18517bf", size = 43307, upload-time = "2026-01-26T02:44:16.852Z" },- { url = "https://files.pythonhosted.org/packages/f2/22/929c141d6c0dba87d3e1d38fbdf1ba8baba86b7776469f2bc2d3227a1e67/multidict-6.7.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:2b41f5fed0ed563624f1c17630cb9941cf2309d4df00e494b551b5f3e3d67a23", size = 76174, upload-time = "2026-01-26T02:44:18.509Z" },- { url = "https://files.pythonhosted.org/packages/c7/75/bc704ae15fee974f8fccd871305e254754167dce5f9e42d88a2def741a1d/multidict-6.7.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:84e61e3af5463c19b67ced91f6c634effb89ef8bfc5ca0267f954451ed4bb6a2", size = 45116, upload-time = "2026-01-26T02:44:19.745Z" },- { url = "https://files.pythonhosted.org/packages/79/76/55cd7186f498ed080a18440c9013011eb548f77ae1b297206d030eb1180a/multidict-6.7.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:935434b9853c7c112eee7ac891bc4cb86455aa631269ae35442cb316790c1445", size = 43524, upload-time = "2026-01-26T02:44:21.571Z" },- { url = "https://files.pythonhosted.org/packages/e9/3c/414842ef8d5a1628d68edee29ba0e5bcf235dbfb3ccd3ea303a7fe8c72ff/multidict-6.7.1-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:432feb25a1cb67fe82a9680b4d65fb542e4635cb3166cd9c01560651ad60f177", size = 249368, upload-time = "2026-01-26T02:44:22.803Z" },- { url = "https://files.pythonhosted.org/packages/f6/32/befed7f74c458b4a525e60519fe8d87eef72bb1e99924fa2b0f9d97a221e/multidict-6.7.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e82d14e3c948952a1a85503817e038cba5905a3352de76b9a465075d072fba23", size = 256952, upload-time = "2026-01-26T02:44:24.306Z" },- { url = "https://files.pythonhosted.org/packages/03/d6/c878a44ba877f366630c860fdf74bfb203c33778f12b6ac274936853c451/multidict-6.7.1-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:4cfb48c6ea66c83bcaaf7e4dfa7ec1b6bbcf751b7db85a328902796dfde4c060", size = 240317, upload-time = "2026-01-26T02:44:25.772Z" },- { url = "https://files.pythonhosted.org/packages/68/49/57421b4d7ad2e9e60e25922b08ceb37e077b90444bde6ead629095327a6f/multidict-6.7.1-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:1d540e51b7e8e170174555edecddbd5538105443754539193e3e1061864d444d", size = 267132, upload-time = "2026-01-26T02:44:27.648Z" },- { url = "https://files.pythonhosted.org/packages/b7/fe/ec0edd52ddbcea2a2e89e174f0206444a61440b40f39704e64dc807a70bd/multidict-6.7.1-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:273d23f4b40f3dce4d6c8a821c741a86dec62cded82e1175ba3d99be128147ed", size = 268140, upload-time = "2026-01-26T02:44:29.588Z" },- { url = "https://files.pythonhosted.org/packages/b0/73/6e1b01cbeb458807aa0831742232dbdd1fa92bfa33f52a3f176b4ff3dc11/multidict-6.7.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9d624335fd4fa1c08a53f8b4be7676ebde19cd092b3895c421045ca87895b429", size = 254277, upload-time = "2026-01-26T02:44:30.902Z" },- { url = "https://files.pythonhosted.org/packages/6a/b2/5fb8c124d7561a4974c342bc8c778b471ebbeb3cc17df696f034a7e9afe7/multidict-6.7.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:12fad252f8b267cc75b66e8fc51b3079604e8d43a75428ffe193cd9e2195dfd6", size = 252291, upload-time = "2026-01-26T02:44:32.31Z" },- { url = "https://files.pythonhosted.org/packages/5a/96/51d4e4e06bcce92577fcd488e22600bd38e4fd59c20cb49434d054903bd2/multidict-6.7.1-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:03ede2a6ffbe8ef936b92cb4529f27f42be7f56afcdab5ab739cd5f27fb1cbf9", size = 250156, upload-time = "2026-01-26T02:44:33.734Z" },- { url = "https://files.pythonhosted.org/packages/db/6b/420e173eec5fba721a50e2a9f89eda89d9c98fded1124f8d5c675f7a0c0f/multidict-6.7.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:90efbcf47dbe33dcf643a1e400d67d59abeac5db07dc3f27d6bdeae497a2198c", size = 249742, upload-time = "2026-01-26T02:44:35.222Z" },- { url = "https://files.pythonhosted.org/packages/44/a3/ec5b5bd98f306bc2aa297b8c6f11a46714a56b1e6ef5ebda50a4f5d7c5fb/multidict-6.7.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:5c4b9bfc148f5a91be9244d6264c53035c8a0dcd2f51f1c3c6e30e30ebaa1c84", size = 262221, upload-time = "2026-01-26T02:44:36.604Z" },- { url = "https://files.pythonhosted.org/packages/cd/f7/e8c0d0da0cd1e28d10e624604e1a36bcc3353aaebdfdc3a43c72bc683a12/multidict-6.7.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:401c5a650f3add2472d1d288c26deebc540f99e2fb83e9525007a74cd2116f1d", size = 258664, upload-time = "2026-01-26T02:44:38.008Z" },- { url = "https://files.pythonhosted.org/packages/52/da/151a44e8016dd33feed44f730bd856a66257c1ee7aed4f44b649fb7edeb3/multidict-6.7.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:97891f3b1b3ffbded884e2916cacf3c6fc87b66bb0dde46f7357404750559f33", size = 249490, upload-time = "2026-01-26T02:44:39.386Z" },- { url = "https://files.pythonhosted.org/packages/87/af/a3b86bf9630b732897f6fc3f4c4714b90aa4361983ccbdcd6c0339b21b0c/multidict-6.7.1-cp313-cp313-win32.whl", hash = "sha256:e1c5988359516095535c4301af38d8a8838534158f649c05dd1050222321bcb3", size = 41695, upload-time = "2026-01-26T02:44:41.318Z" },- { url = "https://files.pythonhosted.org/packages/b2/35/e994121b0e90e46134673422dd564623f93304614f5d11886b1b3e06f503/multidict-6.7.1-cp313-cp313-win_amd64.whl", hash = "sha256:960c83bf01a95b12b08fd54324a4eb1d5b52c88932b5cba5d6e712bb3ed12eb5", size = 45884, upload-time = "2026-01-26T02:44:42.488Z" },- { url = "https://files.pythonhosted.org/packages/ca/61/42d3e5dbf661242a69c97ea363f2d7b46c567da8eadef8890022be6e2ab0/multidict-6.7.1-cp313-cp313-win_arm64.whl", hash = "sha256:563fe25c678aaba333d5399408f5ec3c383ca5b663e7f774dd179a520b8144df", size = 43122, upload-time = "2026-01-26T02:44:43.664Z" },- { url = "https://files.pythonhosted.org/packages/6d/b3/e6b21c6c4f314bb956016b0b3ef2162590a529b84cb831c257519e7fde44/multidict-6.7.1-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:c76c4bec1538375dad9d452d246ca5368ad6e1c9039dadcf007ae59c70619ea1", size = 83175, upload-time = "2026-01-26T02:44:44.894Z" },- { url = "https://files.pythonhosted.org/packages/fb/76/23ecd2abfe0957b234f6c960f4ade497f55f2c16aeb684d4ecdbf1c95791/multidict-6.7.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:57b46b24b5d5ebcc978da4ec23a819a9402b4228b8a90d9c656422b4bdd8a963", size = 48460, upload-time = "2026-01-26T02:44:46.106Z" },- { url = "https://files.pythonhosted.org/packages/c4/57/a0ed92b23f3a042c36bc4227b72b97eca803f5f1801c1ab77c8a212d455e/multidict-6.7.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:e954b24433c768ce78ab7929e84ccf3422e46deb45a4dc9f93438f8217fa2d34", size = 46930, upload-time = "2026-01-26T02:44:47.278Z" },- { url = "https://files.pythonhosted.org/packages/b5/66/02ec7ace29162e447f6382c495dc95826bf931d3818799bbef11e8f7df1a/multidict-6.7.1-cp313-cp313t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:3bd231490fa7217cc832528e1cd8752a96f0125ddd2b5749390f7c3ec8721b65", size = 242582, upload-time = "2026-01-26T02:44:48.604Z" },- { url = "https://files.pythonhosted.org/packages/58/18/64f5a795e7677670e872673aca234162514696274597b3708b2c0d276cce/multidict-6.7.1-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:253282d70d67885a15c8a7716f3a73edf2d635793ceda8173b9ecc21f2fb8292", size = 250031, upload-time = "2026-01-26T02:44:50.544Z" },- { url = "https://files.pythonhosted.org/packages/c8/ed/e192291dbbe51a8290c5686f482084d31bcd9d09af24f63358c3d42fd284/multidict-6.7.1-cp313-cp313t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:0b4c48648d7649c9335cf1927a8b87fa692de3dcb15faa676c6a6f1f1aabda43", size = 228596, upload-time = "2026-01-26T02:44:51.951Z" },- { url = "https://files.pythonhosted.org/packages/1e/7e/3562a15a60cf747397e7f2180b0a11dc0c38d9175a650e75fa1b4d325e15/multidict-6.7.1-cp313-cp313t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:98bc624954ec4d2c7cb074b8eefc2b5d0ce7d482e410df446414355d158fe4ca", size = 257492, upload-time = "2026-01-26T02:44:53.902Z" },- { url = "https://files.pythonhosted.org/packages/24/02/7d0f9eae92b5249bb50ac1595b295f10e263dd0078ebb55115c31e0eaccd/multidict-6.7.1-cp313-cp313t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:1b99af4d9eec0b49927b4402bcbb58dea89d3e0db8806a4086117019939ad3dd", size = 255899, upload-time = "2026-01-26T02:44:55.316Z" },- { url = "https://files.pythonhosted.org/packages/00/e3/9b60ed9e23e64c73a5cde95269ef1330678e9c6e34dd4eb6b431b85b5a10/multidict-6.7.1-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6aac4f16b472d5b7dc6f66a0d49dd57b0e0902090be16594dc9ebfd3d17c47e7", size = 247970, upload-time = "2026-01-26T02:44:56.783Z" },- { url = "https://files.pythonhosted.org/packages/3e/06/538e58a63ed5cfb0bd4517e346b91da32fde409d839720f664e9a4ae4f9d/multidict-6.7.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:21f830fe223215dffd51f538e78c172ed7c7f60c9b96a2bf05c4848ad49921c3", size = 245060, upload-time = "2026-01-26T02:44:58.195Z" },- { url = "https://files.pythonhosted.org/packages/b2/2f/d743a3045a97c895d401e9bd29aaa09b94f5cbdf1bd561609e5a6c431c70/multidict-6.7.1-cp313-cp313t-musllinux_1_2_armv7l.whl", hash = "sha256:f5dd81c45b05518b9aa4da4aa74e1c93d715efa234fd3e8a179df611cc85e5f4", size = 235888, upload-time = "2026-01-26T02:44:59.57Z" },- { url = "https://files.pythonhosted.org/packages/38/83/5a325cac191ab28b63c52f14f1131f3b0a55ba3b9aa65a6d0bf2a9b921a0/multidict-6.7.1-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:eb304767bca2bb92fb9c5bd33cedc95baee5bb5f6c88e63706533a1c06ad08c8", size = 243554, upload-time = "2026-01-26T02:45:01.054Z" },- { url = "https://files.pythonhosted.org/packages/20/1f/9d2327086bd15da2725ef6aae624208e2ef828ed99892b17f60c344e57ed/multidict-6.7.1-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:c9035dde0f916702850ef66460bc4239d89d08df4d02023a5926e7446724212c", size = 252341, upload-time = "2026-01-26T02:45:02.484Z" },- { url = "https://files.pythonhosted.org/packages/e8/2c/2a1aa0280cf579d0f6eed8ee5211c4f1730bd7e06c636ba2ee6aafda302e/multidict-6.7.1-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:af959b9beeb66c822380f222f0e0a1889331597e81f1ded7f374f3ecb0fd6c52", size = 246391, upload-time = "2026-01-26T02:45:03.862Z" },- { url = "https://files.pythonhosted.org/packages/e5/03/7ca022ffc36c5a3f6e03b179a5ceb829be9da5783e6fe395f347c0794680/multidict-6.7.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:41f2952231456154ee479651491e94118229844dd7226541788be783be2b5108", size = 243422, upload-time = "2026-01-26T02:45:05.296Z" },- { url = "https://files.pythonhosted.org/packages/dc/1d/b31650eab6c5778aceed46ba735bd97f7c7d2f54b319fa916c0f96e7805b/multidict-6.7.1-cp313-cp313t-win32.whl", hash = "sha256:df9f19c28adcb40b6aae30bbaa1478c389efd50c28d541d76760199fc1037c32", size = 47770, upload-time = "2026-01-26T02:45:06.754Z" },- { url = "https://files.pythonhosted.org/packages/ac/5b/2d2d1d522e51285bd61b1e20df8f47ae1a9d80839db0b24ea783b3832832/multidict-6.7.1-cp313-cp313t-win_amd64.whl", hash = "sha256:d54ecf9f301853f2c5e802da559604b3e95bb7a3b01a9c295c6ee591b9882de8", size = 53109, upload-time = "2026-01-26T02:45:08.044Z" },- { url = "https://files.pythonhosted.org/packages/3d/a3/cc409ba012c83ca024a308516703cf339bdc4b696195644a7215a5164a24/multidict-6.7.1-cp313-cp313t-win_arm64.whl", hash = "sha256:5a37ca18e360377cfda1d62f5f382ff41f2b8c4ccb329ed974cc2e1643440118", size = 45573, upload-time = "2026-01-26T02:45:09.349Z" },- { url = "https://files.pythonhosted.org/packages/91/cc/db74228a8be41884a567e88a62fd589a913708fcf180d029898c17a9a371/multidict-6.7.1-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:8f333ec9c5eb1b7105e3b84b53141e66ca05a19a605368c55450b6ba208cb9ee", size = 75190, upload-time = "2026-01-26T02:45:10.651Z" },- { url = "https://files.pythonhosted.org/packages/d5/22/492f2246bb5b534abd44804292e81eeaf835388901f0c574bac4eeec73c5/multidict-6.7.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:a407f13c188f804c759fc6a9f88286a565c242a76b27626594c133b82883b5c2", size = 44486, upload-time = "2026-01-26T02:45:11.938Z" },- { url = "https://files.pythonhosted.org/packages/f1/4f/733c48f270565d78b4544f2baddc2fb2a245e5a8640254b12c36ac7ac68e/multidict-6.7.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:0e161ddf326db5577c3a4cc2d8648f81456e8a20d40415541587a71620d7a7d1", size = 43219, upload-time = "2026-01-26T02:45:14.346Z" },- { url = "https://files.pythonhosted.org/packages/24/bb/2c0c2287963f4259c85e8bcbba9182ced8d7fca65c780c38e99e61629d11/multidict-6.7.1-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:1e3a8bb24342a8201d178c3b4984c26ba81a577c80d4d525727427460a50c22d", size = 245132, upload-time = "2026-01-26T02:45:15.712Z" },- { url = "https://files.pythonhosted.org/packages/a7/f9/44d4b3064c65079d2467888794dea218d1601898ac50222ab8a9a8094460/multidict-6.7.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:97231140a50f5d447d3164f994b86a0bed7cd016e2682f8650d6a9158e14fd31", size = 252420, upload-time = "2026-01-26T02:45:17.293Z" },- { url = "https://files.pythonhosted.org/packages/8b/13/78f7275e73fa17b24c9a51b0bd9d73ba64bb32d0ed51b02a746eb876abe7/multidict-6.7.1-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:6b10359683bd8806a200fd2909e7c8ca3a7b24ec1d8132e483d58e791d881048", size = 233510, upload-time = "2026-01-26T02:45:19.356Z" },- { url = "https://files.pythonhosted.org/packages/4b/25/8167187f62ae3cbd52da7893f58cb036b47ea3fb67138787c76800158982/multidict-6.7.1-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:283ddac99f7ac25a4acadbf004cb5ae34480bbeb063520f70ce397b281859362", size = 264094, upload-time = "2026-01-26T02:45:20.834Z" },- { url = "https://files.pythonhosted.org/packages/a1/e7/69a3a83b7b030cf283fb06ce074a05a02322359783424d7edf0f15fe5022/multidict-6.7.1-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:538cec1e18c067d0e6103aa9a74f9e832904c957adc260e61cd9d8cf0c3b3d37", size = 260786, upload-time = "2026-01-26T02:45:22.818Z" },- { url = "https://files.pythonhosted.org/packages/fe/3b/8ec5074bcfc450fe84273713b4b0a0dd47c0249358f5d82eb8104ffe2520/multidict-6.7.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7eee46ccb30ff48a1e35bb818cc90846c6be2b68240e42a78599166722cea709", size = 248483, upload-time = "2026-01-26T02:45:24.368Z" },- { url = "https://files.pythonhosted.org/packages/48/5a/d5a99e3acbca0e29c5d9cba8f92ceb15dce78bab963b308ae692981e3a5d/multidict-6.7.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:fa263a02f4f2dd2d11a7b1bb4362aa7cb1049f84a9235d31adf63f30143469a0", size = 248403, upload-time = "2026-01-26T02:45:25.982Z" },- { url = "https://files.pythonhosted.org/packages/35/48/e58cd31f6c7d5102f2a4bf89f96b9cf7e00b6c6f3d04ecc44417c00a5a3c/multidict-6.7.1-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:2e1425e2f99ec5bd36c15a01b690a1a2456209c5deed58f95469ffb46039ccbb", size = 240315, upload-time = "2026-01-26T02:45:27.487Z" },- { url = "https://files.pythonhosted.org/packages/94/33/1cd210229559cb90b6786c30676bb0c58249ff42f942765f88793b41fdce/multidict-6.7.1-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:497394b3239fc6f0e13a78a3e1b61296e72bf1c5f94b4c4eb80b265c37a131cd", size = 245528, upload-time = "2026-01-26T02:45:28.991Z" },- { url = "https://files.pythonhosted.org/packages/64/f2/6e1107d226278c876c783056b7db43d800bb64c6131cec9c8dfb6903698e/multidict-6.7.1-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:233b398c29d3f1b9676b4b6f75c518a06fcb2ea0b925119fb2c1bc35c05e1601", size = 258784, upload-time = "2026-01-26T02:45:30.503Z" },- { url = "https://files.pythonhosted.org/packages/4d/c1/11f664f14d525e4a1b5327a82d4de61a1db604ab34c6603bb3c2cc63ad34/multidict-6.7.1-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:93b1818e4a6e0930454f0f2af7dfce69307ca03cdcfb3739bf4d91241967b6c1", size = 251980, upload-time = "2026-01-26T02:45:32.603Z" },- { url = "https://files.pythonhosted.org/packages/e1/9f/75a9ac888121d0c5bbd4ecf4eead45668b1766f6baabfb3b7f66a410e231/multidict-6.7.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:f33dc2a3abe9249ea5d8360f969ec7f4142e7ac45ee7014d8f8d5acddf178b7b", size = 243602, upload-time = "2026-01-26T02:45:34.043Z" },- { url = "https://files.pythonhosted.org/packages/9a/e7/50bf7b004cc8525d80dbbbedfdc7aed3e4c323810890be4413e589074032/multidict-6.7.1-cp314-cp314-win32.whl", hash = "sha256:3ab8b9d8b75aef9df299595d5388b14530839f6422333357af1339443cff777d", size = 40930, upload-time = "2026-01-26T02:45:36.278Z" },- { url = "https://files.pythonhosted.org/packages/e0/bf/52f25716bbe93745595800f36fb17b73711f14da59ed0bb2eba141bc9f0f/multidict-6.7.1-cp314-cp314-win_amd64.whl", hash = "sha256:5e01429a929600e7dab7b166062d9bb54a5eed752384c7384c968c2afab8f50f", size = 45074, upload-time = "2026-01-26T02:45:37.546Z" },- { url = "https://files.pythonhosted.org/packages/97/ab/22803b03285fa3a525f48217963da3a65ae40f6a1b6f6cf2768879e208f9/multidict-6.7.1-cp314-cp314-win_arm64.whl", hash = "sha256:4885cb0e817aef5d00a2e8451d4665c1808378dc27c2705f1bf4ef8505c0d2e5", size = 42471, upload-time = "2026-01-26T02:45:38.889Z" },- { url = "https://files.pythonhosted.org/packages/e0/6d/f9293baa6146ba9507e360ea0292b6422b016907c393e2f63fc40ab7b7b5/multidict-6.7.1-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:0458c978acd8e6ea53c81eefaddbbee9c6c5e591f41b3f5e8e194780fe026581", size = 82401, upload-time = "2026-01-26T02:45:40.254Z" },- { url = "https://files.pythonhosted.org/packages/7a/68/53b5494738d83558d87c3c71a486504d8373421c3e0dbb6d0db48ad42ee0/multidict-6.7.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:c0abd12629b0af3cf590982c0b413b1e7395cd4ec026f30986818ab95bfaa94a", size = 48143, upload-time = "2026-01-26T02:45:41.635Z" },- { url = "https://files.pythonhosted.org/packages/37/e8/5284c53310dcdc99ce5d66563f6e5773531a9b9fe9ec7a615e9bc306b05f/multidict-6.7.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:14525a5f61d7d0c94b368a42cff4c9a4e7ba2d52e2672a7b23d84dc86fb02b0c", size = 46507, upload-time = "2026-01-26T02:45:42.99Z" },- { url = "https://files.pythonhosted.org/packages/e4/fc/6800d0e5b3875568b4083ecf5f310dcf91d86d52573160834fb4bfcf5e4f/multidict-6.7.1-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:17307b22c217b4cf05033dabefe68255a534d637c6c9b0cc8382718f87be4262", size = 239358, upload-time = "2026-01-26T02:45:44.376Z" },- { url = "https://files.pythonhosted.org/packages/41/75/4ad0973179361cdf3a113905e6e088173198349131be2b390f9fa4da5fc6/multidict-6.7.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7a7e590ff876a3eaf1c02a4dfe0724b6e69a9e9de6d8f556816f29c496046e59", size = 246884, upload-time = "2026-01-26T02:45:47.167Z" },- { url = "https://files.pythonhosted.org/packages/c3/9c/095bb28b5da139bd41fb9a5d5caff412584f377914bd8787c2aa98717130/multidict-6.7.1-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:5fa6a95dfee63893d80a34758cd0e0c118a30b8dcb46372bf75106c591b77889", size = 225878, upload-time = "2026-01-26T02:45:48.698Z" },- { url = "https://files.pythonhosted.org/packages/07/d0/c0a72000243756e8f5a277b6b514fa005f2c73d481b7d9e47cd4568aa2e4/multidict-6.7.1-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a0543217a6a017692aa6ae5cc39adb75e587af0f3a82288b1492eb73dd6cc2a4", size = 253542, upload-time = "2026-01-26T02:45:50.164Z" },- { url = "https://files.pythonhosted.org/packages/c0/6b/f69da15289e384ecf2a68837ec8b5ad8c33e973aa18b266f50fe55f24b8c/multidict-6.7.1-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f99fe611c312b3c1c0ace793f92464d8cd263cc3b26b5721950d977b006b6c4d", size = 252403, upload-time = "2026-01-26T02:45:51.779Z" },- { url = "https://files.pythonhosted.org/packages/a2/76/b9669547afa5a1a25cd93eaca91c0da1c095b06b6d2d8ec25b713588d3a1/multidict-6.7.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9004d8386d133b7e6135679424c91b0b854d2d164af6ea3f289f8f2761064609", size = 244889, upload-time = "2026-01-26T02:45:53.27Z" },- { url = "https://files.pythonhosted.org/packages/7e/a9/a50d2669e506dad33cfc45b5d574a205587b7b8a5f426f2fbb2e90882588/multidict-6.7.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:e628ef0e6859ffd8273c69412a2465c4be4a9517d07261b33334b5ec6f3c7489", size = 241982, upload-time = "2026-01-26T02:45:54.919Z" },- { url = "https://files.pythonhosted.org/packages/c5/bb/1609558ad8b456b4827d3c5a5b775c93b87878fd3117ed3db3423dfbce1b/multidict-6.7.1-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:841189848ba629c3552035a6a7f5bf3b02eb304e9fea7492ca220a8eda6b0e5c", size = 232415, upload-time = "2026-01-26T02:45:56.981Z" },- { url = "https://files.pythonhosted.org/packages/d8/59/6f61039d2aa9261871e03ab9dc058a550d240f25859b05b67fd70f80d4b3/multidict-6.7.1-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:ce1bbd7d780bb5a0da032e095c951f7014d6b0a205f8318308140f1a6aba159e", size = 240337, upload-time = "2026-01-26T02:45:58.698Z" },- { url = "https://files.pythonhosted.org/packages/a1/29/fdc6a43c203890dc2ae9249971ecd0c41deaedfe00d25cb6564b2edd99eb/multidict-6.7.1-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:b26684587228afed0d50cf804cc71062cc9c1cdf55051c4c6345d372947b268c", size = 248788, upload-time = "2026-01-26T02:46:00.862Z" },- { url = "https://files.pythonhosted.org/packages/a9/14/a153a06101323e4cf086ecee3faadba52ff71633d471f9685c42e3736163/multidict-6.7.1-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:9f9af11306994335398293f9958071019e3ab95e9a707dc1383a35613f6abcb9", size = 242842, upload-time = "2026-01-26T02:46:02.824Z" },- { url = "https://files.pythonhosted.org/packages/41/5f/604ae839e64a4a6efc80db94465348d3b328ee955e37acb24badbcd24d83/multidict-6.7.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:b4938326284c4f1224178a560987b6cf8b4d38458b113d9b8c1db1a836e640a2", size = 240237, upload-time = "2026-01-26T02:46:05.898Z" },- { url = "https://files.pythonhosted.org/packages/5f/60/c3a5187bf66f6fb546ff4ab8fb5a077cbdd832d7b1908d4365c7f74a1917/multidict-6.7.1-cp314-cp314t-win32.whl", hash = "sha256:98655c737850c064a65e006a3df7c997cd3b220be4ec8fe26215760b9697d4d7", size = 48008, upload-time = "2026-01-26T02:46:07.468Z" },- { url = "https://files.pythonhosted.org/packages/0c/f7/addf1087b860ac60e6f382240f64fb99f8bfb532bb06f7c542b83c29ca61/multidict-6.7.1-cp314-cp314t-win_amd64.whl", hash = "sha256:497bde6223c212ba11d462853cfa4f0ae6ef97465033e7dc9940cdb3ab5b48e5", size = 53542, upload-time = "2026-01-26T02:46:08.809Z" },- { url = "https://files.pythonhosted.org/packages/4c/81/4629d0aa32302ef7b2ec65c75a728cc5ff4fa410c50096174c1632e70b3e/multidict-6.7.1-cp314-cp314t-win_arm64.whl", hash = "sha256:2bbd113e0d4af5db41d5ebfe9ccaff89de2120578164f86a5d17d5a576d1e5b2", size = 44719, upload-time = "2026-01-26T02:46:11.146Z" },- { url = "https://files.pythonhosted.org/packages/81/08/7036c080d7117f28a4af526d794aab6a84463126db031b007717c1a6676e/multidict-6.7.1-py3-none-any.whl", hash = "sha256:55d97cc6dae627efa6a6e548885712d4864b81110ac76fa4e534c03819fa4a56", size = 12319, upload-time = "2026-01-26T02:46:44.004Z" },-]-[[package]]name = "murmurhash"version = "1.0.15"