agentengine-sdk-python 0.7.0__py3-none-any.whl → 0.8.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {agentengine_sdk_python-0.7.0.dist-info → agentengine_sdk_python-0.8.1.dist-info}/METADATA +52 -20
- agentengine_sdk_python-0.8.1.dist-info/RECORD +644 -0
- {agentengine_sdk_python-0.7.0.dist-info → agentengine_sdk_python-0.8.1.dist-info}/WHEEL +1 -1
- ksadk/a2a/__init__.py +180 -11
- ksadk/a2a/bootstrap.py +332 -0
- ksadk/a2a/card.py +15 -0
- ksadk/a2a/context_store.py +203 -0
- ksadk/a2a/control_plane.py +1056 -0
- ksadk/a2a/credential.py +99 -0
- ksadk/a2a/event_adapter.py +149 -0
- ksadk/a2a/executor.py +361 -137
- ksadk/a2a/external_transport.py +516 -0
- ksadk/a2a/identity.py +304 -0
- ksadk/a2a/ids.py +22 -0
- ksadk/a2a/langgraph.py +285 -0
- ksadk/a2a/resume_store.py +201 -0
- ksadk/a2a/routes.py +112 -0
- ksadk/a2a/server.py +102 -62
- ksadk/a2a/service_env.py +33 -0
- ksadk/a2a/space_client.py +1122 -0
- ksadk/a2a/task_adapter.py +423 -0
- ksadk/a2a/task_event_dispatcher.py +167 -0
- ksadk/a2a/task_event_outbox.py +326 -0
- ksadk/a2a/task_store.py +206 -0
- ksadk/a2a_card.py +101 -0
- ksadk/a2ui/__init__.py +27 -0
- ksadk/a2ui/core.py +186 -0
- ksadk/a2ui/models.py +166 -0
- ksadk/a2ui/renderer.py +198 -0
- ksadk/agui/__init__.py +9 -0
- ksadk/agui/a2ui_projection.py +92 -0
- ksadk/agui/agent.py +872 -0
- ksadk/agui/config.py +92 -0
- ksadk/agui/routes.py +47 -0
- ksadk/api/client.py +238 -204
- ksadk/api/environment.py +27 -0
- ksadk/builders/__init__.py +2 -0
- ksadk/builders/base.py +16 -14
- ksadk/builders/code_builder.py +375 -270
- ksadk/builders/container_builder.py +240 -200
- ksadk/builders/framework_requirements.py +31 -12
- ksadk/builders/ks3_uploader.py +60 -29
- ksadk/builders/managed_runtime_builder.py +173 -0
- ksadk/builders/mcp_builder.py +91 -92
- ksadk/builders/requirements_utils.py +1 -5
- ksadk/cli/__init__.py +97 -171
- ksadk/cli/cmd_a2a.py +255 -84
- ksadk/cli/cmd_agent.py +19 -5
- ksadk/cli/cmd_build.py +158 -29
- ksadk/cli/cmd_completion.py +47 -35
- ksadk/cli/cmd_config.py +267 -198
- ksadk/cli/cmd_create.py +507 -740
- ksadk/cli/cmd_dashboard.py +120 -45
- ksadk/cli/cmd_deploy.py +135 -59
- ksadk/cli/cmd_destroy.py +44 -14
- ksadk/cli/cmd_eval.py +386 -0
- ksadk/cli/cmd_files.py +63 -24
- ksadk/cli/cmd_hermes.py +313 -135
- ksadk/cli/cmd_invoke.py +184 -122
- ksadk/cli/cmd_launch.py +76 -28
- ksadk/cli/cmd_mcp.py +98 -64
- ksadk/cli/cmd_model.py +14 -5
- ksadk/cli/cmd_openclaw.py +564 -268
- ksadk/cli/cmd_replay.py +71 -0
- ksadk/cli/cmd_run.py +58 -73
- ksadk/cli/cmd_status.py +80 -31
- ksadk/cli/cmd_studio.py +110 -0
- ksadk/cli/cmd_version.py +20 -13
- ksadk/cli/cmd_web.py +95 -18
- ksadk/cli/deploy_utils.py +20 -20
- ksadk/cli/dry_run.py +7 -4
- ksadk/cli/env_options.py +83 -0
- ksadk/cli/error_utils.py +37 -12
- ksadk/cli/global_options.py +4 -3
- ksadk/cli/local_runtime.py +1 -2
- ksadk/cli/model_catalog.py +6 -2
- ksadk/cli/network_options.py +41 -19
- ksadk/cli/resource_common.py +6 -2
- ksadk/cli/runtime_bootstrap.py +51 -0
- ksadk/cli/storage.py +0 -1
- ksadk/cli/ui.py +11 -3
- ksadk/cli/workflow_common.py +52 -18
- ksadk/codex/__init__.py +12 -0
- ksadk/codex/client.py +1042 -0
- ksadk/codex/phase.py +143 -0
- ksadk/codex/runtime.py +940 -0
- ksadk/common/aicp_env.py +0 -1
- ksadk/common/auth.py +2 -2
- ksadk/common/constants.py +1 -3
- ksadk/common/kop_client.py +232 -0
- ksadk/common/llm_utils.py +17 -13
- ksadk/compat/__init__.py +5 -0
- ksadk/compat/adk_compat.py +200 -0
- ksadk/compat/copilotkit_a2ui.py +330 -0
- ksadk/configs/__init__.py +12 -14
- ksadk/configs/env_registry.py +661 -116
- ksadk/configs/global_config.py +3 -2
- ksadk/configs/settings.py +133 -209
- ksadk/conversations/__init__.py +85 -92
- ksadk/conversations/attachment_storage.py +16 -11
- ksadk/conversations/attachments.py +44 -36
- ksadk/conversations/compaction_pipeline.py +12 -12
- ksadk/conversations/compaction_prompt.py +9 -5
- ksadk/conversations/context.py +221 -6
- ksadk/conversations/message_projection.py +438 -51
- ksadk/conversations/model_context.py +12 -6
- ksadk/conversations/model_options.py +0 -1
- ksadk/conversations/normalize.py +20 -16
- ksadk/conversations/reasoning_markup.py +1 -1
- ksadk/conversations/runtime.py +339 -5255
- ksadk/conversations/runtime_compaction.py +333 -0
- ksadk/conversations/runtime_constants.py +27 -0
- ksadk/conversations/runtime_governance.py +185 -0
- ksadk/conversations/runtime_input.py +660 -0
- ksadk/conversations/runtime_invocation.py +395 -0
- ksadk/conversations/runtime_metadata.py +475 -0
- ksadk/conversations/runtime_observability.py +367 -0
- ksadk/conversations/runtime_payloads.py +272 -0
- ksadk/conversations/runtime_persistence.py +440 -0
- ksadk/conversations/runtime_preparation.py +426 -0
- ksadk/conversations/runtime_resume.py +836 -0
- ksadk/conversations/runtime_stream_events.py +902 -0
- ksadk/conversations/runtime_streaming.py +700 -0
- ksadk/conversations/semantic_summary.py +17 -5
- ksadk/conversations/session_title.py +6 -3
- ksadk/deployment/__init__.py +15 -16
- ksadk/deployment/agent_access.py +12 -23
- ksadk/deployment/base.py +51 -38
- ksadk/deployment/managed_runtime.py +33 -0
- ksadk/deployment/manager.py +85 -71
- ksadk/deployment/providers/serverless.py +379 -210
- ksadk/deployment/registry.py +38 -32
- ksadk/deployment/state.py +11 -11
- ksadk/deployment/ui_config.py +1 -1
- ksadk/detection/__init__.py +1 -1
- ksadk/detection/detector.py +146 -83
- ksadk/detection/mcp_detector.py +9 -6
- ksadk/evaluation/__init__.py +84 -0
- ksadk/evaluation/a2a_adapter.py +444 -0
- ksadk/evaluation/adapters.py +54 -0
- ksadk/evaluation/contracts.py +409 -0
- ksadk/evaluation/evalset.py +351 -0
- ksadk/evaluation/evaluators.py +461 -0
- ksadk/evaluation/executor.py +118 -0
- ksadk/evaluation/storage.py +68 -0
- ksadk/evaluation/target.py +73 -0
- ksadk/events/__init__.py +25 -0
- ksadk/events/parser.py +191 -0
- ksadk/events/replay.py +37 -0
- ksadk/events/runtime_event.py +273 -0
- ksadk/events/store.py +317 -0
- ksadk/harness/__init__.py +35 -0
- ksadk/harness/app.py +269 -0
- ksadk/harness/config.py +181 -0
- ksadk/harness/reasoner.py +105 -0
- ksadk/harness/runtime.py +364 -0
- ksadk/harness/sandbox.py +141 -0
- ksadk/harness/tools.py +222 -0
- ksadk/hermes_terminal.py +28 -12
- ksadk/identity/resolver.py +15 -9
- ksadk/ids.py +32 -0
- ksadk/knowledge_base/adk_tool.py +1 -1
- ksadk/knowledge_base/client.py +38 -33
- ksadk/managed_a2a_card.py +160 -0
- ksadk/managed_runtime.py +195 -0
- ksadk/markdown.py +5 -2
- ksadk/mcp_runtime/__init__.py +9 -6
- ksadk/memory/__init__.py +1 -1
- ksadk/memory/adk/__init__.py +2 -0
- ksadk/memory/adk/backends/base_ltm_backend.py +2 -6
- ksadk/memory/adk/backends/http_ltm_backend.py +13 -21
- ksadk/memory/adk/backends/inmemory_ltm_backend.py +7 -13
- ksadk/memory/adk/backends/sdk_ltm_backend.py +36 -36
- ksadk/memory/adk/long_term_memory.py +34 -37
- ksadk/memory/adk/resilient_session_service.py +4 -5
- ksadk/memory/adk/short_term_memory.py +12 -21
- ksadk/memory/adk_tool.py +3 -2
- ksadk/memory/backends/base.py +19 -19
- ksadk/memory/backends/memory.py +24 -25
- ksadk/memory/backends/redis.py +31 -30
- ksadk/memory/langchain_tool.py +2 -1
- ksadk/memory/manager.py +52 -47
- ksadk/memory/service.py +16 -6
- ksadk/memory/tool.py +4 -0
- ksadk/model_policy.py +15 -7
- ksadk/model_proxy/__init__.py +51 -0
- ksadk/model_proxy/bootstrap.py +80 -0
- ksadk/model_proxy/cache.py +165 -0
- ksadk/model_proxy/config.py +66 -0
- ksadk/model_proxy/demo_webui.py +115 -0
- ksadk/model_proxy/detect.py +145 -0
- ksadk/model_proxy/gate.py +68 -0
- ksadk/model_proxy/namespace.py +201 -0
- ksadk/model_proxy/protocol_proxy.py +22 -0
- ksadk/model_proxy/server.py +443 -0
- ksadk/model_proxy/transform.py +735 -0
- ksadk/openclaw_gateway.py +29 -14
- ksadk/runners/adk_runner.py +354 -146
- ksadk/runners/base_runner.py +71 -29
- ksadk/runners/deepagents_runner.py +0 -1
- ksadk/runners/factory.py +18 -5
- ksadk/runners/langchain_runner.py +29 -742
- ksadk/runners/langgraph_runner.py +417 -97
- ksadk/runners/patch_langchain.py +16 -16
- ksadk/runners/remote_runner.py +134 -33
- ksadk/runners/usage_accumulator.py +1 -0
- ksadk/runners/utils/__init__.py +0 -10
- ksadk/runners/utils/loader.py +23 -7
- ksadk/runtime/__init__.py +67 -0
- ksadk/runtime/adapter.py +412 -0
- ksadk/runtime/conversation_execution.py +553 -0
- ksadk/runtime/executor.py +251 -0
- ksadk/runtime/factory.py +156 -0
- ksadk/runtime/framework_adapters.py +118 -0
- ksadk/runtime/launch.py +48 -0
- ksadk/runtime/preprocessing.py +131 -0
- ksadk/runtime/runner_adapter.py +1032 -0
- ksadk/runtime/runner_loading.py +36 -0
- ksadk/runtime_context.py +18 -3
- ksadk/runtime_state.py +0 -1
- ksadk/sandbox/__init__.py +4 -1
- ksadk/sandbox/backends/__init__.py +4 -1
- ksadk/sandbox/backends/e2b.py +13 -5
- ksadk/sandbox/backends/local_process.py +11 -3
- ksadk/sandbox/base.py +10 -15
- ksadk/sandbox/factory.py +14 -4
- ksadk/sandbox/registry.py +57 -6
- ksadk/server/__init__.py +39 -4
- ksadk/server/api_models.py +15 -5
- ksadk/server/app.py +24 -3928
- ksadk/server/composition.py +47 -0
- ksadk/server/factory.py +622 -0
- ksadk/server/routes/__init__.py +1 -0
- ksadk/server/routes/checkpoint_resolution.py +116 -0
- ksadk/server/routes/common.py +682 -0
- ksadk/server/routes/control.py +331 -0
- ksadk/server/routes/dependencies.py +98 -0
- ksadk/server/routes/misc.py +425 -0
- ksadk/server/routes/models.py +451 -0
- ksadk/server/routes/openai_compat.py +229 -0
- ksadk/server/routes/projection.py +848 -0
- ksadk/server/routes/routers.py +52 -0
- ksadk/server/routes/run.py +519 -0
- ksadk/server/routes/sessions.py +644 -0
- ksadk/server/routes/streaming.py +265 -0
- ksadk/server/routes/workspace.py +414 -0
- ksadk/server/static/assets/{ArtifactsPanel-D-SSn2ee.js → ArtifactsPanel-CakCqxEN.js} +1 -1
- ksadk/server/static/assets/CodeBlock-CynLknyO.js +9 -0
- ksadk/server/static/assets/MathMessageMarkdown-3sQdOysS.js +8 -0
- ksadk/server/static/assets/MermaidBlock-NERD_ef7.js +303 -0
- ksadk/server/static/assets/NativeTerminalPanel-CiHWf82q.js +1 -0
- ksadk/server/static/assets/{arc-BA13sHc9.js → arc-DrgjcKhl.js} +1 -1
- ksadk/server/static/assets/architecture-7EHR7CIX-CpZLRCcY.js +1 -0
- ksadk/server/static/assets/{architectureDiagram-3BPJPVTR-DzJzgVoL.js → architectureDiagram-3BPJPVTR-BXoVRbQ6.js} +1 -1
- ksadk/server/static/assets/{blockDiagram-GPEHLZMM-UTdVcZhn.js → blockDiagram-GPEHLZMM-BnaB3Ywv.js} +1 -1
- ksadk/server/static/assets/{c4Diagram-AAUBKEIU-Dix0GD4m.js → c4Diagram-AAUBKEIU-Dw4weZcp.js} +1 -1
- ksadk/server/static/assets/channel-Dt3rQTFI.js +1 -0
- ksadk/server/static/assets/{chunk-2J33WTMH-C2JxuZ42.js → chunk-2J33WTMH-ChjpLK7j.js} +1 -1
- ksadk/server/static/assets/{chunk-4BX2VUAB-Be57QPgD.js → chunk-4BX2VUAB-B9drTgOW.js} +1 -1
- ksadk/server/static/assets/{chunk-55IACEB6-WjSuy4nv.js → chunk-55IACEB6-CK4ROATy.js} +1 -1
- ksadk/server/static/assets/{chunk-727SXJPM-BOovP-b5.js → chunk-727SXJPM-B9KtTTgw.js} +1 -1
- ksadk/server/static/assets/{chunk-AQP2D5EJ-DOmZNmWj.js → chunk-AQP2D5EJ-1O1mki3m.js} +1 -1
- ksadk/server/static/assets/{chunk-FMBD7UC4-DzwlodkU.js → chunk-FMBD7UC4-B_fH2YuH.js} +1 -1
- ksadk/server/static/assets/{chunk-ND2GUHAM-DMqAikEU.js → chunk-ND2GUHAM-D6rFLaVV.js} +1 -1
- ksadk/server/static/assets/chunk-QZHKN3VN-iXEZtKQc.js +1 -0
- ksadk/server/static/assets/classDiagram-4FO5ZUOK-DIveV17Q.js +1 -0
- ksadk/server/static/assets/classDiagram-v2-Q7XG4LA2-DIveV17Q.js +1 -0
- ksadk/server/static/assets/{cose-bilkent-S5V4N54A-Zhy2GBnP.js → cose-bilkent-S5V4N54A-ChNs_Mdk.js} +1 -1
- ksadk/server/static/assets/{dagre-BM42HDAG-CbKrtIUz.js → dagre-BM42HDAG-D0QXg_MQ.js} +1 -1
- ksadk/server/static/assets/{diagram-2AECGRRQ-BRApgQRK.js → diagram-2AECGRRQ-DBDDKwBQ.js} +1 -1
- ksadk/server/static/assets/{diagram-5GNKFQAL-D0xbnDiK.js → diagram-5GNKFQAL-BkwDOxmO.js} +1 -1
- ksadk/server/static/assets/{diagram-KO2AKTUF-CVugVI9L.js → diagram-KO2AKTUF-Bv8waYvY.js} +1 -1
- ksadk/server/static/assets/{diagram-LMA3HP47-DozUGgee.js → diagram-LMA3HP47-e1VECDdu.js} +1 -1
- ksadk/server/static/assets/{diagram-OG6HWLK6-ZOYsKlru.js → diagram-OG6HWLK6-Ds9adfRl.js} +1 -1
- ksadk/server/static/assets/{dist-DpKtt4Bo.js → dist-4N2NMVYg.js} +1 -1
- ksadk/server/static/assets/{dist-CkEKJFtk.js → dist-B-jNR6Vn.js} +1 -1
- ksadk/server/static/assets/{dist-D57wnGWd.js → dist-B5J2uhNk.js} +1 -1
- ksadk/server/static/assets/{dist-8_SfK1IP.js → dist-B5oS1zcj.js} +1 -1
- ksadk/server/static/assets/{dist-DMezvBGJ.js → dist-BB3-OwTQ.js} +1 -1
- ksadk/server/static/assets/{dist-2hInLS_J.js → dist-BIlKoW0k.js} +1 -1
- ksadk/server/static/assets/{dist-BrCcQ47T.js → dist-BjOdlDjj.js} +1 -1
- ksadk/server/static/assets/{dist-BmlMPsCc.js → dist-C1sz5Eo3.js} +1 -1
- ksadk/server/static/assets/{dist-B0NP_Z0z.js → dist-CWV4lDr1.js} +1 -1
- ksadk/server/static/assets/{dist-D-xOD048.js → dist-CmZHzlwZ.js} +1 -1
- ksadk/server/static/assets/{dist-DL_NKc_z.js → dist-D6MpCZtz.js} +1 -1
- ksadk/server/static/assets/{dist-DyOkZmze.js → dist-DJN_6Y39.js} +1 -1
- ksadk/server/static/assets/{dist-DmFaq_Iy.js → dist-DQU9EWw-.js} +1 -1
- ksadk/server/static/assets/{dist-gX6GOLKq.js → dist-DWKByxWV.js} +1 -1
- ksadk/server/static/assets/{dist-DyWsb78Q.js → dist-Dli7qW-B.js} +1 -1
- ksadk/server/static/assets/{dist-BIJVDMuB.js → dist-DsHPdk3W.js} +1 -1
- ksadk/server/static/assets/{dist-Dp0k7bWI.js → dist-X4TnqwOK.js} +1 -1
- ksadk/server/static/assets/{dist-8EEyGgDx.js → dist-_pHPTyZ-.js} +1 -1
- ksadk/server/static/assets/{dist-CPBtqRTW.js → dist-fhOuWds5.js} +1 -1
- ksadk/server/static/assets/{dist-D-JMdWPQ.js → dist-gLnrGsoU.js} +1 -1
- ksadk/server/static/assets/{dist-BssVmjIo.js → dist-j6Dxmf_j.js} +1 -1
- ksadk/server/static/assets/{dist-C3HIIaN5.js → dist-o2OVmKvt.js} +1 -1
- ksadk/server/static/assets/{erDiagram-TEJ5UH35-Bk-9bgE5.js → erDiagram-TEJ5UH35-BPItFKH6.js} +1 -1
- ksadk/server/static/assets/eventmodeling-FCH6USID-DYFSxbqr.js +1 -0
- ksadk/server/static/assets/{flowDiagram-I6XJVG4X-Dn9kZVuZ.js → flowDiagram-I6XJVG4X-BbYB9w5Y.js} +1 -1
- ksadk/server/static/assets/{ganttDiagram-6RSMTGT7-BGxXlJqm.js → ganttDiagram-6RSMTGT7-TQXa0KXv.js} +1 -1
- ksadk/server/static/assets/gitGraph-WXDBUCRP-DyNYp6BN.js +1 -0
- ksadk/server/static/assets/{gitGraphDiagram-PVQCEYII-C7Q0X-wi.js → gitGraphDiagram-PVQCEYII-bKblCnpa.js} +1 -1
- ksadk/server/static/assets/index-R52pJJvg.js +177 -0
- ksadk/server/static/assets/index-jJr3_955.css +2 -0
- ksadk/server/static/assets/info-J43DQDTF-WUx7qTde.js +1 -0
- ksadk/server/static/assets/{infoDiagram-5YYISTIA-BO_CSqq5.js → infoDiagram-5YYISTIA-BGVT7J_i.js} +1 -1
- ksadk/server/static/assets/{ishikawaDiagram-YF4QCWOH-eYLPLd46.js → ishikawaDiagram-YF4QCWOH-K0OOfVna.js} +1 -1
- ksadk/server/static/assets/{journeyDiagram-JHISSGLW-De9geSb0.js → journeyDiagram-JHISSGLW-8LeOJaZp.js} +1 -1
- ksadk/server/static/assets/{kanban-definition-UN3LZRKU-Cs80kQto.js → kanban-definition-UN3LZRKU-C6uCgZrW.js} +1 -1
- ksadk/server/static/assets/{katex-DSrCFD8n.js → katex-CYWseY5E.js} +1 -1
- ksadk/server/static/assets/{linear-CN9sbKTF.js → linear-hdBcYzM8.js} +1 -1
- ksadk/server/static/assets/{mermaid-parser.core-DlgSBU8l.js → mermaid-parser.core-BWrDjSZM.js} +2 -2
- ksadk/server/static/assets/{mindmap-definition-RKZ34NQL-9afz7Oug.js → mindmap-definition-RKZ34NQL-Bjy_2v4_.js} +1 -1
- ksadk/server/static/assets/packet-YPE3B663-BN13y_xl.js +1 -0
- ksadk/server/static/assets/pie-LRSECV5Y-ftSLXhhc.js +1 -0
- ksadk/server/static/assets/{pieDiagram-4H26LBE5-DPv_VstN.js → pieDiagram-4H26LBE5-GmmqNiVH.js} +1 -1
- ksadk/server/static/assets/{quadrantDiagram-W4KKPZXB-o77wZ1XK.js → quadrantDiagram-W4KKPZXB-BmkRbwCg.js} +1 -1
- ksadk/server/static/assets/radar-GUYGQ44K-jaICkIeO.js +1 -0
- ksadk/server/static/assets/{requirementDiagram-4Y6WPE33-BYVw81VC.js → requirementDiagram-4Y6WPE33-DSWFqL7c.js} +1 -1
- ksadk/server/static/assets/{sankeyDiagram-5OEKKPKP-B7nZFMKT.js → sankeyDiagram-5OEKKPKP-l6iXmU65.js} +1 -1
- ksadk/server/static/assets/{sequenceDiagram-3UESZ5HK-BGRRrFw5.js → sequenceDiagram-3UESZ5HK-Cq6UBeQB.js} +1 -1
- ksadk/server/static/assets/{stateDiagram-AJRCARHV-BUfHCoPs.js → stateDiagram-AJRCARHV-qzTQpg3Y.js} +1 -1
- ksadk/server/static/assets/stateDiagram-v2-BHNVJYJU-BYCoYGAN.js +1 -0
- ksadk/server/static/assets/{timeline-definition-PNZ67QCA-FbCTGrf9.js → timeline-definition-PNZ67QCA-DEz24vV0.js} +1 -1
- ksadk/server/static/assets/treeView-BLDUP644-Cpib_vlz.js +1 -0
- ksadk/server/static/assets/treemap-LRROVOQU-DQxfmVHK.js +1 -0
- ksadk/server/static/assets/{vennDiagram-CIIHVFJN-DWgwtPsJ.js → vennDiagram-CIIHVFJN-CMCixki2.js} +1 -1
- ksadk/server/static/assets/wardley-L42UT6IY-BQYHnnkU.js +1 -0
- ksadk/server/static/assets/{wardleyDiagram-YWT4CUSO-2x8G-tTM.js → wardleyDiagram-YWT4CUSO-CVzB8F9K.js} +1 -1
- ksadk/server/static/assets/{xychartDiagram-2RQKCTM6-Drma3AYl.js → xychartDiagram-2RQKCTM6-BFBqBLc1.js} +1 -1
- ksadk/server/static/index.html +2 -2
- ksadk/server/terminal_sessions.py +111 -58
- ksadk/sessions/__init__.py +69 -19
- ksadk/sessions/base.py +31 -11
- ksadk/sessions/continuity.py +2 -3
- ksadk/sessions/in_memory.py +46 -2
- ksadk/sessions/local_service.py +148 -17
- ksadk/sessions/postgres_service.py +143 -25
- ksadk/sessions/resilient.py +36 -8
- ksadk/skills/models.py +17 -5
- ksadk/skills/package_store.py +5 -2
- ksadk/skills/runtime/agent.py +20 -5
- ksadk/skills/runtime/artifacts.py +1 -5
- ksadk/skills/runtime/backends/e2b.py +10 -4
- ksadk/skills/runtime/backends/local.py +15 -3
- ksadk/skills/runtime/base.py +1 -2
- ksadk/skills/runtime/executor.py +10 -3
- ksadk/skills/runtime/factory.py +4 -2
- ksadk/skills/runtime/loader.py +1 -2
- ksadk/skills/runtime/registry.py +15 -10
- ksadk/skills/runtime/request.py +3 -1
- ksadk/skills/service_client.py +47 -16
- ksadk/skills/tool_defs.py +15 -10
- ksadk/studio/__init__.py +5 -0
- ksadk/studio/agent_avatar_assets.py +120 -0
- ksadk/studio/agent_lifecycle.py +51 -0
- ksadk/studio/api.py +1046 -0
- ksadk/studio/api_catalog_routes.py +324 -0
- ksadk/studio/api_contracts.py +177 -0
- ksadk/studio/api_helpers.py +132 -0
- ksadk/studio/authoring.py +524 -0
- ksadk/studio/authoring_coordinator.py +285 -0
- ksadk/studio/builder.py +320 -0
- ksadk/studio/capabilities.py +351 -0
- ksadk/studio/cloud.py +278 -0
- ksadk/studio/codex_agent_service.py +583 -0
- ksadk/studio/codex_builder.py +324 -0
- ksadk/studio/codex_manifest.py +278 -0
- ksadk/studio/codex_run.py +352 -0
- ksadk/studio/compiler.py +189 -0
- ksadk/studio/contracts.py +644 -0
- ksadk/studio/errors.py +47 -0
- ksadk/studio/evaluation.py +192 -0
- ksadk/studio/event_store.py +284 -0
- ksadk/studio/framework_run.py +114 -0
- ksadk/studio/identifiers.py +33 -0
- ksadk/studio/mcp_runtime.py +229 -0
- ksadk/studio/model_client.py +543 -0
- ksadk/studio/model_profile_service.py +214 -0
- ksadk/studio/operations.py +243 -0
- ksadk/studio/otel_trace.py +754 -0
- ksadk/studio/pagination.py +182 -0
- ksadk/studio/python_tool_inspection.py +183 -0
- ksadk/studio/repository.py +306 -0
- ksadk/studio/resource_catalog.py +1217 -0
- ksadk/studio/run_service.py +707 -0
- ksadk/studio/runtime_catalog.py +74 -0
- ksadk/studio/runtime_source.py +339 -0
- ksadk/studio/service.py +1141 -0
- ksadk/studio/shared_web.py +994 -0
- ksadk/studio/skill_discovery.py +628 -0
- ksadk/studio/static/assets/PrismRenderer-IYN-ffww.js +3 -0
- ksadk/studio/static/assets/index-CaEN0eTR.css +1 -0
- ksadk/studio/static/assets/index-DI2eY_NH.js +252 -0
- ksadk/studio/static/assets/react-vendor-BNmTiJ-I.js +9 -0
- ksadk/studio/static/assets/rolldown-runtime-hePW80VL.js +1 -0
- ksadk/studio/static/index.html +15 -0
- ksadk/studio/templates.py +630 -0
- ksadk/studio/validator.py +246 -0
- ksadk/studio/workspace.py +137 -0
- ksadk/terminal_exec_policy.py +3 -4
- ksadk/tools/gateway.py +101 -15
- ksadk/tools/result_budget.py +12 -4
- ksadk/toolsets/__init__.py +161 -37
- ksadk/toolsets/a2a.py +426 -0
- ksadk/toolsets/platform.py +21 -5
- ksadk/toolsets/sandbox.py +82 -16
- ksadk/toolsets/skills.py +200 -39
- ksadk/toolsets/web.py +123 -26
- ksadk/toolsets/workspace.py +212 -101
- ksadk/tracing/__init__.py +19 -21
- ksadk/tracing/exporters/inmemory_exporter.py +62 -51
- ksadk/tracing/setup.py +135 -506
- ksadk/tracing/span_utils.py +0 -41
- ksadk/tui/loop.py +78 -30
- ksadk/tui/stream_render.py +1 -0
- ksadk/ui_config.py +5 -3
- ksadk/version.py +1 -1
- ksadk_runtime_common/memory_backend/registry.py +56 -56
- ksadk_runtime_common/schemas/runtime_event_v1.json +95 -0
- ksadk_runtime_common/workspace_files/router.py +8 -2
- agentengine_sdk_python-0.7.0.dist-info/RECORD +0 -482
- ksadk/a2a/card_builder.py +0 -64
- ksadk/a2a/client.py +0 -309
- ksadk/runners/utils/langfuse.py +0 -230
- ksadk/server/static/assets/CodeBlock-P16VOLYi.js +0 -9
- ksadk/server/static/assets/MathMessageMarkdown-CdGiQWHR.js +0 -8
- ksadk/server/static/assets/MermaidBlock-IOcal8cm.js +0 -303
- ksadk/server/static/assets/NativeTerminalPanel-DGSDWsei.js +0 -1
- ksadk/server/static/assets/architecture-7EHR7CIX-BvUlsA6l.js +0 -1
- ksadk/server/static/assets/channel-CTuydARX.js +0 -1
- ksadk/server/static/assets/chunk-QZHKN3VN-BnCydivS.js +0 -1
- ksadk/server/static/assets/classDiagram-4FO5ZUOK-BNHg45Be.js +0 -1
- ksadk/server/static/assets/classDiagram-v2-Q7XG4LA2-BNHg45Be.js +0 -1
- ksadk/server/static/assets/eventmodeling-FCH6USID-DsAgWnlf.js +0 -1
- ksadk/server/static/assets/gitGraph-WXDBUCRP-BIao9Yjg.js +0 -1
- ksadk/server/static/assets/index-C00Lwg3L.js +0 -165
- ksadk/server/static/assets/index-DAURbCsP.css +0 -1
- ksadk/server/static/assets/info-J43DQDTF-CyipqGxU.js +0 -1
- ksadk/server/static/assets/packet-YPE3B663-CGkyRxlg.js +0 -1
- ksadk/server/static/assets/pie-LRSECV5Y-M0uWAf4n.js +0 -1
- ksadk/server/static/assets/radar-GUYGQ44K-Bdbm24-x.js +0 -1
- ksadk/server/static/assets/stateDiagram-v2-BHNVJYJU-8xBN_gLM.js +0 -1
- ksadk/server/static/assets/treeView-BLDUP644-npMo0ak1.js +0 -1
- ksadk/server/static/assets/treemap-LRROVOQU-CHdzrrdo.js +0 -1
- ksadk/server/static/assets/wardley-L42UT6IY-BEQz7wyy.js +0 -1
- ksadk/tracing/exporters/langfuse_exporter.py +0 -445
- {agentengine_sdk_python-0.7.0.dist-info → agentengine_sdk_python-0.8.1.dist-info}/entry_points.txt +0 -0
- {agentengine_sdk_python-0.7.0.dist-info → agentengine_sdk_python-0.8.1.dist-info}/licenses/LICENSE +0 -0
- {agentengine_sdk_python-0.7.0.dist-info → agentengine_sdk_python-0.8.1.dist-info}/top_level.txt +0 -0
ksadk/cli/cmd_eval.py
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
"""agentengine eval - stable CLI shell for local evaluation."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
import click
|
|
9
|
+
from rich.markup import escape
|
|
10
|
+
from rich.padding import Padding
|
|
11
|
+
from rich.table import Table
|
|
12
|
+
|
|
13
|
+
from ksadk.cli.ui import (
|
|
14
|
+
configure_ui_runtime,
|
|
15
|
+
emit_json,
|
|
16
|
+
get_console,
|
|
17
|
+
is_json_output,
|
|
18
|
+
new_table,
|
|
19
|
+
print_info,
|
|
20
|
+
print_kv,
|
|
21
|
+
print_success,
|
|
22
|
+
print_title,
|
|
23
|
+
status_rich_style,
|
|
24
|
+
)
|
|
25
|
+
from ksadk.evaluation import (
|
|
26
|
+
EvaluationConfig,
|
|
27
|
+
EvaluationExecutionError,
|
|
28
|
+
EvaluationNotImplementedError,
|
|
29
|
+
EvaluationRequest,
|
|
30
|
+
TargetRef,
|
|
31
|
+
execute_evaluation,
|
|
32
|
+
load_evalset,
|
|
33
|
+
)
|
|
34
|
+
from ksadk.evaluation.contracts import (
|
|
35
|
+
DataPolicy,
|
|
36
|
+
EvalRunReport,
|
|
37
|
+
EvalRunStatus,
|
|
38
|
+
EvalRunSummary,
|
|
39
|
+
MetricResult,
|
|
40
|
+
MetricStatus,
|
|
41
|
+
TargetKind,
|
|
42
|
+
TargetRunStatus,
|
|
43
|
+
)
|
|
44
|
+
from ksadk.evaluation.evalset import EvalSetParseError
|
|
45
|
+
from ksadk.evaluation.evaluators import DEFAULT_EVALUATORS, SUPPORTED_EVALUATORS
|
|
46
|
+
from ksadk.evaluation.storage import EvaluationStorage
|
|
47
|
+
|
|
48
|
+
_DEFAULT_EVALUATORS = tuple(DEFAULT_EVALUATORS)
|
|
49
|
+
_DATA_POLICIES = tuple(policy.value for policy in DataPolicy)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class EvaluationCliError(click.ClickException):
|
|
53
|
+
exit_code = 2
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@click.command(context_settings=dict(help_option_names=["-h", "--help"]))
|
|
57
|
+
@click.option(
|
|
58
|
+
"--evalset-file",
|
|
59
|
+
required=True,
|
|
60
|
+
type=click.Path(exists=True, dir_okay=False, path_type=Path),
|
|
61
|
+
help="本地 EvalSet YAML/JSON 文件",
|
|
62
|
+
)
|
|
63
|
+
@click.option(
|
|
64
|
+
"--agent-dir",
|
|
65
|
+
type=click.Path(exists=True, file_okay=False, path_type=Path),
|
|
66
|
+
help="本地 Agent 项目目录",
|
|
67
|
+
)
|
|
68
|
+
@click.option("--a2a-url", type=str, help="远端 A2A Agent Card URL")
|
|
69
|
+
@click.option(
|
|
70
|
+
"--codex-worktree",
|
|
71
|
+
type=click.Path(exists=True, file_okay=False, path_type=Path),
|
|
72
|
+
help="Codex 评测使用的 Git worktree",
|
|
73
|
+
)
|
|
74
|
+
@click.option("--entrypoint", type=str, help="本地 Agent 入口;缺省时由 target adapter 检测")
|
|
75
|
+
@click.option("--credential-ref", type=str, help="A2A 鉴权引用;不会写入凭据值")
|
|
76
|
+
@click.option("--codex-profile", type=str, help="Codex 受信评测 profile 名称")
|
|
77
|
+
@click.option(
|
|
78
|
+
"--evaluator",
|
|
79
|
+
"evaluators",
|
|
80
|
+
multiple=True,
|
|
81
|
+
type=click.Choice(SUPPORTED_EVALUATORS),
|
|
82
|
+
help="启用评估器;可重复指定",
|
|
83
|
+
)
|
|
84
|
+
@click.option("--judge-model", type=str, help="LLM Judge 模型名")
|
|
85
|
+
@click.option("--judge-api-base", type=str, help="LLM Judge OpenAI 兼容 API 地址")
|
|
86
|
+
@click.option(
|
|
87
|
+
"--judge-api-key-env",
|
|
88
|
+
default="KSADK_EVAL_JUDGE_API_KEY",
|
|
89
|
+
show_default=True,
|
|
90
|
+
type=str,
|
|
91
|
+
help="保存 Judge API Key 的环境变量名",
|
|
92
|
+
)
|
|
93
|
+
@click.option(
|
|
94
|
+
"--timeout-seconds",
|
|
95
|
+
default=120,
|
|
96
|
+
show_default=True,
|
|
97
|
+
type=click.IntRange(1, 3600),
|
|
98
|
+
help="单个 Case 超时时间(秒)",
|
|
99
|
+
)
|
|
100
|
+
@click.option("--fail-fast", is_flag=True, help="首个失败 Case 后停止")
|
|
101
|
+
@click.option(
|
|
102
|
+
"--data-policy",
|
|
103
|
+
type=click.Choice(_DATA_POLICIES),
|
|
104
|
+
default="local_only",
|
|
105
|
+
show_default=True,
|
|
106
|
+
help="评测数据策略",
|
|
107
|
+
)
|
|
108
|
+
@click.option(
|
|
109
|
+
"--report-dir",
|
|
110
|
+
type=click.Path(file_okay=False, path_type=Path),
|
|
111
|
+
help="报告目录;缺省为项目 .agentkit/evaluations",
|
|
112
|
+
)
|
|
113
|
+
@click.option("--validate-only", is_flag=True, help="只识别并校验 EvalSet 和 CLI 参数")
|
|
114
|
+
@click.option(
|
|
115
|
+
"--format",
|
|
116
|
+
"output_format",
|
|
117
|
+
type=click.Choice(["pretty", "json"]),
|
|
118
|
+
help="终端输出格式",
|
|
119
|
+
)
|
|
120
|
+
def eval(
|
|
121
|
+
evalset_file: Path,
|
|
122
|
+
agent_dir: Path | None,
|
|
123
|
+
a2a_url: str | None,
|
|
124
|
+
codex_worktree: Path | None,
|
|
125
|
+
entrypoint: str | None,
|
|
126
|
+
credential_ref: str | None,
|
|
127
|
+
codex_profile: str | None,
|
|
128
|
+
evaluators: tuple[str, ...],
|
|
129
|
+
judge_model: str | None,
|
|
130
|
+
judge_api_base: str | None,
|
|
131
|
+
judge_api_key_env: str,
|
|
132
|
+
timeout_seconds: int,
|
|
133
|
+
fail_fast: bool,
|
|
134
|
+
data_policy: str,
|
|
135
|
+
report_dir: Path | None,
|
|
136
|
+
validate_only: bool,
|
|
137
|
+
output_format: str | None,
|
|
138
|
+
) -> None:
|
|
139
|
+
"""校验 EvalSet,并通过统一入口发起 Agent 评测。"""
|
|
140
|
+
|
|
141
|
+
if output_format:
|
|
142
|
+
configure_ui_runtime(output_mode=output_format)
|
|
143
|
+
target = _target_ref(
|
|
144
|
+
agent_dir=agent_dir,
|
|
145
|
+
a2a_url=a2a_url,
|
|
146
|
+
codex_worktree=codex_worktree,
|
|
147
|
+
entrypoint=entrypoint,
|
|
148
|
+
credential_ref=credential_ref,
|
|
149
|
+
codex_profile=codex_profile,
|
|
150
|
+
)
|
|
151
|
+
request = _build_request(
|
|
152
|
+
evalset_file=evalset_file,
|
|
153
|
+
target=target,
|
|
154
|
+
evaluators=evaluators,
|
|
155
|
+
judge_model=judge_model,
|
|
156
|
+
judge_api_base=judge_api_base,
|
|
157
|
+
judge_api_key_env=judge_api_key_env,
|
|
158
|
+
timeout_seconds=timeout_seconds,
|
|
159
|
+
fail_fast=fail_fast,
|
|
160
|
+
data_policy=data_policy,
|
|
161
|
+
report_dir=report_dir,
|
|
162
|
+
)
|
|
163
|
+
if validate_only:
|
|
164
|
+
_render_validation(request)
|
|
165
|
+
return
|
|
166
|
+
|
|
167
|
+
report = _execute_request(request)
|
|
168
|
+
exit_code = _report_exit_code(report)
|
|
169
|
+
_render_report(report, report_dir=request.report_dir)
|
|
170
|
+
if exit_code:
|
|
171
|
+
raise click.exceptions.Exit(exit_code)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def _build_request(
|
|
175
|
+
*,
|
|
176
|
+
evalset_file: Path,
|
|
177
|
+
target: TargetRef,
|
|
178
|
+
evaluators: tuple[str, ...],
|
|
179
|
+
judge_model: str | None,
|
|
180
|
+
judge_api_base: str | None,
|
|
181
|
+
judge_api_key_env: str,
|
|
182
|
+
timeout_seconds: int,
|
|
183
|
+
fail_fast: bool,
|
|
184
|
+
data_policy: str,
|
|
185
|
+
report_dir: Path | None,
|
|
186
|
+
) -> EvaluationRequest:
|
|
187
|
+
try:
|
|
188
|
+
evalset = load_evalset(evalset_file)
|
|
189
|
+
except EvalSetParseError as exc:
|
|
190
|
+
raise click.UsageError(f"{exc.code}: {exc}") from exc
|
|
191
|
+
|
|
192
|
+
return EvaluationRequest(
|
|
193
|
+
evalset=evalset,
|
|
194
|
+
target=target,
|
|
195
|
+
config=EvaluationConfig(
|
|
196
|
+
timeout_seconds=timeout_seconds,
|
|
197
|
+
fail_fast=fail_fast,
|
|
198
|
+
evaluators=list(evaluators) or list(_DEFAULT_EVALUATORS),
|
|
199
|
+
data_policy=data_policy,
|
|
200
|
+
judge_model=judge_model,
|
|
201
|
+
judge_api_base=judge_api_base,
|
|
202
|
+
judge_api_key_env=judge_api_key_env,
|
|
203
|
+
),
|
|
204
|
+
report_dir=str((report_dir or Path.cwd() / ".agentkit/evaluations").resolve()),
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def _execute_request(request: EvaluationRequest) -> EvalRunReport:
|
|
209
|
+
on_case_started = None
|
|
210
|
+
if not is_json_output():
|
|
211
|
+
_render_start(request)
|
|
212
|
+
on_case_started = _render_case_started
|
|
213
|
+
try:
|
|
214
|
+
return asyncio.run(execute_evaluation(request, on_case_started=on_case_started))
|
|
215
|
+
except (EvaluationNotImplementedError, EvaluationExecutionError) as exc:
|
|
216
|
+
raise EvaluationCliError(str(exc)) from exc
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def _render_report(report: EvalRunReport, *, report_dir: str | None = None) -> None:
|
|
220
|
+
if is_json_output():
|
|
221
|
+
emit_json(report.model_dump(mode="json", by_alias=True, exclude_none=True))
|
|
222
|
+
else:
|
|
223
|
+
print_title("Agent 评测完成")
|
|
224
|
+
get_console().print("[title][i]评测摘要[/i][/]")
|
|
225
|
+
print_kv("运行状态", report.status.value)
|
|
226
|
+
print_kv("Run ID", report.spec.id)
|
|
227
|
+
if report_dir:
|
|
228
|
+
print_kv(
|
|
229
|
+
"报告文件",
|
|
230
|
+
str(EvaluationStorage(report_dir).report_path(report.spec.id)),
|
|
231
|
+
value_style="#58a6ff",
|
|
232
|
+
)
|
|
233
|
+
_render_report_preview(report)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def _render_start(request: EvaluationRequest) -> None:
|
|
238
|
+
print_info(
|
|
239
|
+
"开始评测:"
|
|
240
|
+
f"{request.evalset.name},{len(request.evalset.cases)} 个 Case,"
|
|
241
|
+
f"Target: {request.target.kind.value}"
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def _render_case_started(case_id: str, index: int, total_cases: int) -> None:
|
|
246
|
+
print_info(f"[{index}/{total_cases}] 执行 Case: {case_id}")
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def _render_report_preview(report: EvalRunReport) -> None:
|
|
250
|
+
_render_summary(report.summary)
|
|
251
|
+
_render_case_table(report)
|
|
252
|
+
remaining_cases = len(report.case_runs) - 5
|
|
253
|
+
if remaining_cases > 0:
|
|
254
|
+
print_info(f"其余 {remaining_cases} 个 Case 已省略")
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def _render_summary(summary: EvalRunSummary) -> None:
|
|
258
|
+
items = (
|
|
259
|
+
("总计", summary.total_cases, "white"),
|
|
260
|
+
("通过", summary.passed_cases, "ok"),
|
|
261
|
+
("失败", summary.failed_cases, "err"),
|
|
262
|
+
("错误", summary.error_cases, "err"),
|
|
263
|
+
("不可用", summary.unavailable_cases, "warn"),
|
|
264
|
+
("取消", summary.cancelled_cases, "warn"),
|
|
265
|
+
)
|
|
266
|
+
table = Table.grid(padding=(0, 2))
|
|
267
|
+
for _label, _count, style in items:
|
|
268
|
+
table.add_column(justify="center", style=style, no_wrap=True)
|
|
269
|
+
table.add_row(*(label for label, _count, _style in items), style="muted")
|
|
270
|
+
table.add_row(*(f"[{style if count else 'muted'}]{count}[/]" for _label, count, style in items))
|
|
271
|
+
print_info(" 结果统计")
|
|
272
|
+
get_console().print(Padding(table, (0, 0, 0, 4)))
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def _render_case_table(report: EvalRunReport) -> None:
|
|
276
|
+
table = new_table(" 评测集列表")
|
|
277
|
+
table.add_column("Case", style="#58a6ff", no_wrap=True)
|
|
278
|
+
table.add_column("目标状态", no_wrap=True)
|
|
279
|
+
table.add_column("耗时", justify="right", no_wrap=True)
|
|
280
|
+
table.add_column("指标")
|
|
281
|
+
for case_run in report.case_runs[:5]:
|
|
282
|
+
target_status = case_run.target_run.status.value
|
|
283
|
+
table.add_row(
|
|
284
|
+
escape(case_run.case_id),
|
|
285
|
+
f"[{status_rich_style(target_status)}]{target_status}[/]",
|
|
286
|
+
_format_duration(case_run.target_run.duration_ms),
|
|
287
|
+
_metric_summary(case_run.metrics),
|
|
288
|
+
)
|
|
289
|
+
get_console().print(table)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def _format_duration(duration_ms: int | None) -> str:
|
|
293
|
+
return f"{duration_ms} ms" if duration_ms is not None else "-"
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
def _metric_summary(metrics: list[MetricResult]) -> str:
|
|
297
|
+
if not metrics:
|
|
298
|
+
return "无指标"
|
|
299
|
+
counts = {status: sum(metric.status is status for metric in metrics) for status in MetricStatus}
|
|
300
|
+
return ",".join(f"{status.value} {count}" for status, count in counts.items() if count)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def _report_exit_code(report: EvalRunReport) -> int:
|
|
304
|
+
if report.status in {
|
|
305
|
+
EvalRunStatus.ERROR,
|
|
306
|
+
EvalRunStatus.CANCELLED,
|
|
307
|
+
EvalRunStatus.PENDING,
|
|
308
|
+
EvalRunStatus.RUNNING,
|
|
309
|
+
}:
|
|
310
|
+
return 2
|
|
311
|
+
if any(
|
|
312
|
+
case_run.target_run.status is TargetRunStatus.UNAVAILABLE
|
|
313
|
+
or any(
|
|
314
|
+
metric.required and metric.status is MetricStatus.UNAVAILABLE
|
|
315
|
+
for metric in case_run.metrics
|
|
316
|
+
)
|
|
317
|
+
for case_run in report.case_runs
|
|
318
|
+
):
|
|
319
|
+
return 3
|
|
320
|
+
return 1 if report.status is EvalRunStatus.FAILED else 0
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def _target_ref(
|
|
324
|
+
agent_dir: Path | None,
|
|
325
|
+
a2a_url: str | None,
|
|
326
|
+
codex_worktree: Path | None,
|
|
327
|
+
entrypoint: str | None,
|
|
328
|
+
credential_ref: str | None,
|
|
329
|
+
codex_profile: str | None,
|
|
330
|
+
) -> TargetRef:
|
|
331
|
+
targets = [agent_dir is not None, bool(a2a_url), codex_worktree is not None]
|
|
332
|
+
if sum(targets) != 1:
|
|
333
|
+
raise click.UsageError("--agent-dir、--a2a-url、--codex-worktree 必须且只能指定一个")
|
|
334
|
+
if credential_ref and not a2a_url:
|
|
335
|
+
raise click.UsageError("--credential-ref 只能与 --a2a-url 一起使用")
|
|
336
|
+
if entrypoint and not agent_dir:
|
|
337
|
+
raise click.UsageError("--entrypoint 只能与 --agent-dir 一起使用")
|
|
338
|
+
if codex_profile and not codex_worktree:
|
|
339
|
+
raise click.UsageError("--codex-profile 只能与 --codex-worktree 一起使用")
|
|
340
|
+
if agent_dir:
|
|
341
|
+
return TargetRef(
|
|
342
|
+
kind=TargetKind.LOCAL_SOURCE,
|
|
343
|
+
locator=str(agent_dir.resolve()),
|
|
344
|
+
entrypoint=entrypoint,
|
|
345
|
+
)
|
|
346
|
+
if a2a_url:
|
|
347
|
+
return TargetRef(
|
|
348
|
+
kind=TargetKind.A2A,
|
|
349
|
+
locator=a2a_url,
|
|
350
|
+
credential_ref=credential_ref,
|
|
351
|
+
)
|
|
352
|
+
assert codex_worktree is not None
|
|
353
|
+
return TargetRef(
|
|
354
|
+
kind=TargetKind.CODEX_WORKTREE,
|
|
355
|
+
locator=str(codex_worktree.resolve()),
|
|
356
|
+
profile=codex_profile,
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
def _render_validation(request: EvaluationRequest) -> None:
|
|
361
|
+
payload = {
|
|
362
|
+
"valid": True,
|
|
363
|
+
"evalset": {
|
|
364
|
+
"name": request.evalset.name,
|
|
365
|
+
"sourceFormat": request.evalset.source_format,
|
|
366
|
+
"caseCount": len(request.evalset.cases),
|
|
367
|
+
"contentDigest": request.evalset.content_digest,
|
|
368
|
+
},
|
|
369
|
+
"target": request.target.model_dump(mode="json", by_alias=True, exclude_none=True),
|
|
370
|
+
"config": request.config.model_dump(mode="json", by_alias=True),
|
|
371
|
+
"reportDir": request.report_dir,
|
|
372
|
+
}
|
|
373
|
+
if is_json_output():
|
|
374
|
+
emit_json(payload)
|
|
375
|
+
return
|
|
376
|
+
print_title("评测配置校验")
|
|
377
|
+
print_kv("EvalSet", request.evalset.name)
|
|
378
|
+
print_kv("格式", request.evalset.source_format)
|
|
379
|
+
print_kv("Case 数量", str(len(request.evalset.cases)))
|
|
380
|
+
print_kv("内容摘要", request.evalset.content_digest)
|
|
381
|
+
print_kv("Target", f"{request.target.kind.value}: {request.target.locator}")
|
|
382
|
+
print_success("EvalSet 与 CLI 参数有效")
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
# Eval reports use --report-dir exclusively; do not inject the generic child --output.
|
|
386
|
+
eval.disable_global_output_option = True
|
ksadk/cli/cmd_files.py
CHANGED
|
@@ -54,7 +54,7 @@ def _format_size(size_bytes: object | None) -> str:
|
|
|
54
54
|
if size_bytes is None:
|
|
55
55
|
return "-"
|
|
56
56
|
try:
|
|
57
|
-
value = int(size_bytes)
|
|
57
|
+
value = int(str(size_bytes))
|
|
58
58
|
except (TypeError, ValueError):
|
|
59
59
|
return str(size_bytes)
|
|
60
60
|
if value < 1024:
|
|
@@ -110,7 +110,9 @@ def _echo_section_title(title: str, *, fg: str = "bright_blue") -> None:
|
|
|
110
110
|
click.secho(title, fg=fg, bold=True)
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
def _normalize_entry_payload(
|
|
113
|
+
def _normalize_entry_payload(
|
|
114
|
+
entry: dict, *, root_label: str, workspace_real_root: str | None = None
|
|
115
|
+
) -> dict:
|
|
114
116
|
normalized = dict(entry or {})
|
|
115
117
|
path = str(normalized.get("path") or "").strip()
|
|
116
118
|
normalized["display_path"] = _workspace_display_path(path, root_label=root_label)
|
|
@@ -125,7 +127,10 @@ def _normalize_entry_payload(entry: dict, *, root_label: str, workspace_real_roo
|
|
|
125
127
|
|
|
126
128
|
def _build_list_payload(payload: dict) -> dict:
|
|
127
129
|
root_label = _workspace_root_label(payload)
|
|
128
|
-
workspace_real_root =
|
|
130
|
+
workspace_real_root = (
|
|
131
|
+
str(payload.get("workspace_real_root") or payload.get("workspace_path") or "").strip()
|
|
132
|
+
or None
|
|
133
|
+
)
|
|
129
134
|
entries = [
|
|
130
135
|
_normalize_entry_payload(
|
|
131
136
|
entry,
|
|
@@ -142,7 +147,9 @@ def _build_list_payload(payload: dict) -> dict:
|
|
|
142
147
|
"ok": True,
|
|
143
148
|
"action": "list",
|
|
144
149
|
"workspace_root": root_label,
|
|
145
|
-
"workspace_display_path": _workspace_display_path(
|
|
150
|
+
"workspace_display_path": _workspace_display_path(
|
|
151
|
+
payload.get("path", "."), root_label=root_label
|
|
152
|
+
),
|
|
146
153
|
"workspace_real_root": workspace_real_root,
|
|
147
154
|
"workspace_real_path": _workspace_real_path(
|
|
148
155
|
payload.get("path", "."),
|
|
@@ -182,7 +189,9 @@ def _build_upload_payload(payload: dict, *, local_path: Path, remote_path: str)
|
|
|
182
189
|
"local_path": str(local_path),
|
|
183
190
|
"requested_remote_path": remote_path,
|
|
184
191
|
"remote_path": resolved_remote_path,
|
|
185
|
-
"remote_display_path": _workspace_display_path(
|
|
192
|
+
"remote_display_path": _workspace_display_path(
|
|
193
|
+
resolved_remote_path, root_label=root_label
|
|
194
|
+
),
|
|
186
195
|
"entry": normalized_entry,
|
|
187
196
|
"summary": {
|
|
188
197
|
"uploaded": 1,
|
|
@@ -268,7 +277,9 @@ def _build_sync_payload(payload: dict) -> dict:
|
|
|
268
277
|
"ok": True,
|
|
269
278
|
"action": str(payload.get("direction", "sync")).strip().lower() or "sync",
|
|
270
279
|
"workspace_root": root_label,
|
|
271
|
-
"remote_display_path": _workspace_display_path(
|
|
280
|
+
"remote_display_path": _workspace_display_path(
|
|
281
|
+
payload.get("remote_path", "."), root_label=root_label
|
|
282
|
+
),
|
|
272
283
|
"transport_mode": transport_mode or None,
|
|
273
284
|
"transport_hint": transport_hint,
|
|
274
285
|
"summary": {
|
|
@@ -304,20 +315,27 @@ def _emit_payload(payload, output_mode: str | None) -> None:
|
|
|
304
315
|
if not entries:
|
|
305
316
|
click.secho("当前目录为空。", fg="bright_black")
|
|
306
317
|
return
|
|
307
|
-
directories = payload.get("directories") or [
|
|
308
|
-
|
|
318
|
+
directories = payload.get("directories") or [
|
|
319
|
+
entry for entry in entries if entry.get("type") == "directory"
|
|
320
|
+
]
|
|
321
|
+
files = payload.get("files") or [
|
|
322
|
+
entry for entry in entries if entry.get("type") != "directory"
|
|
323
|
+
]
|
|
309
324
|
if directories:
|
|
310
325
|
_echo_section_title(f"目录({len(directories)})", fg="cyan")
|
|
311
326
|
for entry in directories:
|
|
312
|
-
|
|
327
|
+
display_path = entry.get("display_path") or _workspace_display_path(
|
|
328
|
+
entry.get("path", ""), root_label=root_label
|
|
329
|
+
)
|
|
330
|
+
click.secho(f" {display_path}", fg="cyan")
|
|
313
331
|
if files:
|
|
314
332
|
_echo_section_title(f"文件({len(files)})", fg="green")
|
|
315
333
|
for entry in files:
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
f" {entry.get('size_human') or _format_size(entry.get('size_bytes'))}",
|
|
319
|
-
fg="green",
|
|
334
|
+
display_path = entry.get("display_path") or _workspace_display_path(
|
|
335
|
+
entry.get("path", ""), root_label=root_label
|
|
320
336
|
)
|
|
337
|
+
size_text = entry.get("size_human") or _format_size(entry.get("size_bytes"))
|
|
338
|
+
click.secho(f" {display_path} {size_text}", fg="green")
|
|
321
339
|
return
|
|
322
340
|
click.echo(str(payload))
|
|
323
341
|
|
|
@@ -469,11 +487,13 @@ def _collect_local_files(
|
|
|
469
487
|
ignore_dev_artifacts: bool = False,
|
|
470
488
|
ignore_git_artifacts: bool = True,
|
|
471
489
|
) -> list[tuple[str, Path]]:
|
|
472
|
-
|
|
490
|
+
report = _collect_local_files_report(
|
|
473
491
|
local_dir,
|
|
474
492
|
ignore_dev_artifacts=ignore_dev_artifacts,
|
|
475
493
|
ignore_git_artifacts=ignore_git_artifacts,
|
|
476
|
-
)
|
|
494
|
+
)
|
|
495
|
+
files = report.get("files")
|
|
496
|
+
return list(files) if isinstance(files, list) else []
|
|
477
497
|
|
|
478
498
|
|
|
479
499
|
def _workspace_client_kwargs(
|
|
@@ -505,7 +525,12 @@ def _state_prefers_action_proxy(state: dict) -> bool:
|
|
|
505
525
|
|
|
506
526
|
|
|
507
527
|
def _resolve_workspace_region(region: str | None, state: dict) -> str:
|
|
508
|
-
return
|
|
528
|
+
return (
|
|
529
|
+
_normalize(region)
|
|
530
|
+
or _normalize(state.get("region"))
|
|
531
|
+
or os.getenv("KSYUN_REGION")
|
|
532
|
+
or DEFAULT_REGION
|
|
533
|
+
)
|
|
509
534
|
|
|
510
535
|
|
|
511
536
|
def _resolve_workspace_agent_ref(explicit_ref: str | None, cwd: Path) -> str | None:
|
|
@@ -674,7 +699,7 @@ async def _download_workspace_file(
|
|
|
674
699
|
kwargs["endpoint"] = endpoint
|
|
675
700
|
if api_key:
|
|
676
701
|
kwargs["api_key"] = api_key
|
|
677
|
-
return await client.download_workspace_file(**kwargs)
|
|
702
|
+
return bytes(await client.download_workspace_file(**kwargs))
|
|
678
703
|
|
|
679
704
|
|
|
680
705
|
async def _delete_workspace_file(
|
|
@@ -917,7 +942,9 @@ def files():
|
|
|
917
942
|
@click.option("--api-key", help="Runtime API Key (与 --endpoint 搭配使用)")
|
|
918
943
|
@click.option("--path", default=".", show_default=True, help="Workspace 目录路径")
|
|
919
944
|
@click.option("--recursive", is_flag=True, help="递归列出目录")
|
|
920
|
-
@click.option(
|
|
945
|
+
@click.option(
|
|
946
|
+
"--region", "-r", default=None, envvar=None, help="区域 (默认优先读取 .agentengine.state)"
|
|
947
|
+
)
|
|
921
948
|
@cli_output_option()
|
|
922
949
|
def list_files(
|
|
923
950
|
agent_ref: str | None,
|
|
@@ -965,7 +992,9 @@ def list_files(
|
|
|
965
992
|
help="本地文件路径",
|
|
966
993
|
)
|
|
967
994
|
@click.option("--remote-path", required=True, help="Workspace 目标路径")
|
|
968
|
-
@click.option(
|
|
995
|
+
@click.option(
|
|
996
|
+
"--region", "-r", default=None, envvar=None, help="区域 (默认优先读取 .agentengine.state)"
|
|
997
|
+
)
|
|
969
998
|
@cli_output_option()
|
|
970
999
|
def upload_file(
|
|
971
1000
|
agent_ref: str | None,
|
|
@@ -1029,7 +1058,9 @@ def upload_file(
|
|
|
1029
1058
|
required=True,
|
|
1030
1059
|
help="本地输出文件路径",
|
|
1031
1060
|
)
|
|
1032
|
-
@click.option(
|
|
1061
|
+
@click.option(
|
|
1062
|
+
"--region", "-r", default=None, envvar=None, help="区域 (默认优先读取 .agentengine.state)"
|
|
1063
|
+
)
|
|
1033
1064
|
@cli_output_option()
|
|
1034
1065
|
def download_file(
|
|
1035
1066
|
agent_ref: str | None,
|
|
@@ -1083,7 +1114,9 @@ def download_file(
|
|
|
1083
1114
|
@click.option("--api-key", help="Runtime API Key (与 --endpoint 搭配使用)")
|
|
1084
1115
|
@click.option("--remote-path", required=True, help="Workspace 文件路径")
|
|
1085
1116
|
@click.option("--yes", is_flag=True, help="跳过确认")
|
|
1086
|
-
@click.option(
|
|
1117
|
+
@click.option(
|
|
1118
|
+
"--region", "-r", default=None, envvar=None, help="区域 (默认优先读取 .agentengine.state)"
|
|
1119
|
+
)
|
|
1087
1120
|
@cli_output_option()
|
|
1088
1121
|
def delete_file(
|
|
1089
1122
|
agent_ref: str | None,
|
|
@@ -1105,7 +1138,9 @@ def delete_file(
|
|
|
1105
1138
|
api_key=api_key,
|
|
1106
1139
|
region=region,
|
|
1107
1140
|
)
|
|
1108
|
-
if not yes and not click.confirm(
|
|
1141
|
+
if not yes and not click.confirm(
|
|
1142
|
+
f"删除 workspace 文件 {normalized_remote_path}?", default=False
|
|
1143
|
+
):
|
|
1109
1144
|
raise click.Abort()
|
|
1110
1145
|
payload = asyncio.run(
|
|
1111
1146
|
_delete_workspace_file(
|
|
@@ -1137,7 +1172,9 @@ def delete_file(
|
|
|
1137
1172
|
)
|
|
1138
1173
|
@click.option("--remote-path", default=".", show_default=True, help="Workspace 目标目录")
|
|
1139
1174
|
@click.option("--force", is_flag=True, help="覆盖远端已存在的同名文件")
|
|
1140
|
-
@click.option(
|
|
1175
|
+
@click.option(
|
|
1176
|
+
"--region", "-r", default=None, envvar=None, help="区域 (默认优先读取 .agentengine.state)"
|
|
1177
|
+
)
|
|
1141
1178
|
@cli_output_option()
|
|
1142
1179
|
def push_files(
|
|
1143
1180
|
agent_ref: str | None,
|
|
@@ -1188,7 +1225,9 @@ def push_files(
|
|
|
1188
1225
|
help="本地输出目录",
|
|
1189
1226
|
)
|
|
1190
1227
|
@click.option("--force", is_flag=True, help="覆盖本地已存在的同名文件")
|
|
1191
|
-
@click.option(
|
|
1228
|
+
@click.option(
|
|
1229
|
+
"--region", "-r", default=None, envvar=None, help="区域 (默认优先读取 .agentengine.state)"
|
|
1230
|
+
)
|
|
1192
1231
|
@cli_output_option()
|
|
1193
1232
|
def pull_files(
|
|
1194
1233
|
agent_ref: str | None,
|