agentengine-sdk-python 0.6.2__py3-none-any.whl → 0.6.9__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.6.9.dist-info/METADATA +179 -0
- agentengine_sdk_python-0.6.9.dist-info/RECORD +487 -0
- {agentengine_sdk_python-0.6.2.dist-info → agentengine_sdk_python-0.6.9.dist-info}/WHEEL +1 -1
- agentengine_sdk_python-0.6.9.dist-info/entry_points.txt +3 -0
- agentengine_sdk_python-0.6.9.dist-info/licenses/LICENSE +175 -0
- agentengine_sdk_python-0.6.9.dist-info/top_level.txt +2 -0
- ksadk/__init__.py +13 -0
- ksadk/__main__.py +4 -0
- ksadk/a2a/__init__.py +15 -0
- ksadk/a2a/card_builder.py +64 -0
- ksadk/a2a/client.py +309 -0
- ksadk/a2a/executor.py +201 -0
- ksadk/a2a/server.py +79 -0
- ksadk/agents/__init__.py +20 -0
- ksadk/agents/base.py +370 -0
- ksadk/agents/context.py +38 -0
- ksadk/agents/event.py +35 -0
- ksadk/agents/loop_agent.py +71 -0
- ksadk/agents/parallel_agent.py +109 -0
- ksadk/agents/runner_adapter.py +24 -0
- ksadk/agents/sequential_agent.py +34 -0
- ksadk/api/__init__.py +3 -0
- ksadk/api/client.py +2227 -0
- ksadk/builders/__init__.py +20 -0
- ksadk/builders/base.py +66 -0
- ksadk/builders/code_builder.py +1990 -0
- ksadk/builders/container_builder.py +786 -0
- ksadk/builders/framework_requirements.py +59 -0
- ksadk/builders/ks3_uploader.py +389 -0
- ksadk/builders/mcp_builder.py +476 -0
- ksadk/builders/requirements_utils.py +75 -0
- ksadk/cli/__init__.py +531 -0
- ksadk/cli/__main__.py +4 -0
- ksadk/cli/agent_ref.py +204 -0
- ksadk/cli/cmd_a2a.py +167 -0
- ksadk/cli/cmd_agent.py +201 -0
- ksadk/cli/cmd_build.py +270 -0
- ksadk/cli/cmd_completion.py +304 -0
- ksadk/cli/cmd_config.py +758 -0
- ksadk/cli/cmd_create.py +2277 -0
- ksadk/cli/cmd_dashboard.py +900 -0
- ksadk/cli/cmd_deploy.py +704 -0
- ksadk/cli/cmd_destroy.py +345 -0
- ksadk/cli/cmd_files.py +1227 -0
- ksadk/cli/cmd_hermes.py +1259 -0
- ksadk/cli/cmd_invoke.py +1336 -0
- ksadk/cli/cmd_launch.py +564 -0
- ksadk/cli/cmd_mcp.py +1174 -0
- ksadk/cli/cmd_model.py +302 -0
- ksadk/cli/cmd_openclaw.py +3918 -0
- ksadk/cli/cmd_run.py +232 -0
- ksadk/cli/cmd_status.py +588 -0
- ksadk/cli/cmd_version.py +522 -0
- ksadk/cli/cmd_web.py +288 -0
- ksadk/cli/deploy_utils.py +87 -0
- ksadk/cli/dry_run.py +214 -0
- ksadk/cli/env_options.py +82 -0
- ksadk/cli/error_utils.py +525 -0
- ksadk/cli/global_options.py +31 -0
- ksadk/cli/local_runtime.py +97 -0
- ksadk/cli/model_catalog.py +136 -0
- ksadk/cli/network_options.py +410 -0
- ksadk/cli/resource_common.py +621 -0
- ksadk/cli/storage.py +84 -0
- ksadk/cli/ui.py +431 -0
- ksadk/cli/workflow_common.py +552 -0
- ksadk/common/__init__.py +14 -0
- ksadk/common/aicp_env.py +128 -0
- ksadk/common/auth.py +190 -0
- ksadk/common/constants.py +84 -0
- ksadk/common/llm_utils.py +61 -0
- ksadk/configs/__init__.py +61 -0
- ksadk/configs/env_registry.py +342 -0
- ksadk/configs/global_config.py +200 -0
- ksadk/configs/settings.py +706 -0
- ksadk/conversations/__init__.py +95 -0
- ksadk/conversations/attachment_storage.py +379 -0
- ksadk/conversations/attachments.py +774 -0
- ksadk/conversations/compaction_pipeline.py +387 -0
- ksadk/conversations/compaction_prompt.py +128 -0
- ksadk/conversations/context.py +303 -0
- ksadk/conversations/model_context.py +360 -0
- ksadk/conversations/model_options.py +136 -0
- ksadk/conversations/normalize.py +446 -0
- ksadk/conversations/reasoning_markup.py +91 -0
- ksadk/conversations/run_kinds.py +61 -0
- ksadk/conversations/run_status.py +53 -0
- ksadk/conversations/runtime.py +5208 -0
- ksadk/conversations/semantic_summary.py +359 -0
- ksadk/conversations/session_title.py +254 -0
- ksadk/deployment/__init__.py +83 -0
- ksadk/deployment/agent_access.py +226 -0
- ksadk/deployment/base.py +229 -0
- ksadk/deployment/manager.py +332 -0
- ksadk/deployment/providers/__init__.py +10 -0
- ksadk/deployment/providers/serverless.py +1105 -0
- ksadk/deployment/registry.py +120 -0
- ksadk/deployment/state.py +78 -0
- ksadk/deployment/ui_config.py +21 -0
- ksadk/detection/__init__.py +7 -0
- ksadk/detection/detector.py +431 -0
- ksadk/detection/mcp_detector.py +250 -0
- ksadk/hermes_terminal.py +467 -0
- ksadk/identity/__init__.py +17 -0
- ksadk/identity/resolver.py +385 -0
- ksadk/knowledge_base/__init__.py +62 -0
- ksadk/knowledge_base/adk_tool.py +47 -0
- ksadk/knowledge_base/client.py +297 -0
- ksadk/knowledge_base/langchain_tool.py +55 -0
- ksadk/knowledge_base/service.py +66 -0
- ksadk/knowledge_base/tool.py +50 -0
- ksadk/markdown.py +169 -0
- ksadk/mcp_runtime/__init__.py +231 -0
- ksadk/memory/__init__.py +57 -0
- ksadk/memory/adk/__init__.py +51 -0
- ksadk/memory/adk/backends/__init__.py +5 -0
- ksadk/memory/adk/backends/base_ltm_backend.py +52 -0
- ksadk/memory/adk/backends/http_ltm_backend.py +183 -0
- ksadk/memory/adk/backends/inmemory_ltm_backend.py +96 -0
- ksadk/memory/adk/backends/sdk_ltm_backend.py +456 -0
- ksadk/memory/adk/long_term_memory.py +273 -0
- ksadk/memory/adk/short_term_memory.py +289 -0
- ksadk/memory/adk_tool.py +31 -0
- ksadk/memory/backends/__init__.py +6 -0
- ksadk/memory/backends/base.py +103 -0
- ksadk/memory/backends/memory.py +112 -0
- ksadk/memory/backends/redis.py +146 -0
- ksadk/memory/langchain_tool.py +39 -0
- ksadk/memory/ltm_backend_factory.py +24 -0
- ksadk/memory/manager.py +215 -0
- ksadk/memory/service.py +172 -0
- ksadk/memory/tool.py +96 -0
- ksadk/model_policy.py +223 -0
- ksadk/openclaw_gateway.py +378 -0
- ksadk/runners/__init__.py +8 -0
- ksadk/runners/adk_runner.py +1135 -0
- ksadk/runners/base_runner.py +305 -0
- ksadk/runners/deepagents_runner.py +13 -0
- ksadk/runners/factory.py +73 -0
- ksadk/runners/langchain_runner.py +539 -0
- ksadk/runners/langgraph_runner.py +852 -0
- ksadk/runners/patch_langchain.py +187 -0
- ksadk/runners/remote_runner.py +667 -0
- ksadk/runners/usage_accumulator.py +38 -0
- ksadk/runners/utils/__init__.py +19 -0
- ksadk/runners/utils/langfuse.py +230 -0
- ksadk/runners/utils/loader.py +62 -0
- ksadk/runtime_context.py +166 -0
- ksadk/runtime_state.py +25 -0
- ksadk/sandbox/__init__.py +28 -0
- ksadk/sandbox/backends/__init__.py +9 -0
- ksadk/sandbox/backends/e2b.py +154 -0
- ksadk/sandbox/backends/local_process.py +131 -0
- ksadk/sandbox/base.py +101 -0
- ksadk/sandbox/factory.py +53 -0
- ksadk/sandbox/registry.py +187 -0
- ksadk/server/__init__.py +7 -0
- ksadk/server/api_models.py +73 -0
- ksadk/server/app.py +3789 -0
- ksadk/server/static/assets/ArtifactsPanel-C0meuOdi.js +1 -0
- ksadk/server/static/assets/CodeBlock-BbI4HPtJ.js +9 -0
- ksadk/server/static/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- ksadk/server/static/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- ksadk/server/static/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- ksadk/server/static/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- ksadk/server/static/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- ksadk/server/static/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- ksadk/server/static/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- ksadk/server/static/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- ksadk/server/static/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- ksadk/server/static/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- ksadk/server/static/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- ksadk/server/static/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- ksadk/server/static/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- ksadk/server/static/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- ksadk/server/static/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- ksadk/server/static/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- ksadk/server/static/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- ksadk/server/static/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- ksadk/server/static/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- ksadk/server/static/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- ksadk/server/static/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- ksadk/server/static/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- ksadk/server/static/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- ksadk/server/static/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- ksadk/server/static/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- ksadk/server/static/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- ksadk/server/static/assets/MathMessageMarkdown-DMLQYoLp.js +8 -0
- ksadk/server/static/assets/MathMessageMarkdown-DeYh8QPr.css +1 -0
- ksadk/server/static/assets/MermaidBlock-DCR8WZ17.js +303 -0
- ksadk/server/static/assets/NativeTerminalPanel-CHOd7Rch.css +1 -0
- ksadk/server/static/assets/NativeTerminalPanel-CKUvWhUz.js +1 -0
- ksadk/server/static/assets/addon-fit-DthTIhi3.js +1 -0
- ksadk/server/static/assets/apl-CnwPGSsG.js +1 -0
- ksadk/server/static/assets/arc-bj2rZnP5.js +1 -0
- ksadk/server/static/assets/architecture-7EHR7CIX-Cr6Xz1_c.js +1 -0
- ksadk/server/static/assets/architectureDiagram-3BPJPVTR-2u1ltDIj.js +36 -0
- ksadk/server/static/assets/asciiarmor-qTkVPQu6.js +1 -0
- ksadk/server/static/assets/asn1-Dr8qZg38.js +1 -0
- ksadk/server/static/assets/asterisk-Bja0s6e1.js +1 -0
- ksadk/server/static/assets/blockDiagram-GPEHLZMM-D6fvdK20.js +132 -0
- ksadk/server/static/assets/brainfuck-D5EjA2JK.js +1 -0
- ksadk/server/static/assets/c4Diagram-AAUBKEIU-BK82L5n5.js +10 -0
- ksadk/server/static/assets/channel-BSSOwFIb.js +1 -0
- ksadk/server/static/assets/chunk-2J33WTMH-DLVdkeyQ.js +1 -0
- ksadk/server/static/assets/chunk-4BX2VUAB-BbwsYcbW.js +1 -0
- ksadk/server/static/assets/chunk-55IACEB6-DOairxzw.js +1 -0
- ksadk/server/static/assets/chunk-727SXJPM-hCO487gs.js +206 -0
- ksadk/server/static/assets/chunk-AQP2D5EJ-XU8vDOuG.js +231 -0
- ksadk/server/static/assets/chunk-FMBD7UC4-PrapyfMu.js +15 -0
- ksadk/server/static/assets/chunk-ND2GUHAM-CboKhTZ3.js +1 -0
- ksadk/server/static/assets/chunk-QZHKN3VN-XXpdiwUL.js +1 -0
- ksadk/server/static/assets/classDiagram-4FO5ZUOK-C5HvGiyK.js +1 -0
- ksadk/server/static/assets/classDiagram-v2-Q7XG4LA2-C5HvGiyK.js +1 -0
- ksadk/server/static/assets/clike-DHH8Ad3s.js +1 -0
- ksadk/server/static/assets/clojure-BflJGmDX.js +1 -0
- ksadk/server/static/assets/cmake-CyVbuzPu.js +1 -0
- ksadk/server/static/assets/cobol-B_OZ4V-R.js +1 -0
- ksadk/server/static/assets/coffeescript-B2pKbFk8.js +1 -0
- ksadk/server/static/assets/commonlisp-CcllspGY.js +1 -0
- ksadk/server/static/assets/cose-bilkent-S5V4N54A-_N8bJ-EU.js +1 -0
- ksadk/server/static/assets/crystal-M5-qzICs.js +1 -0
- ksadk/server/static/assets/css-CYpP4FRV.js +1 -0
- ksadk/server/static/assets/cypher-p9eYesGn.js +1 -0
- ksadk/server/static/assets/cytoscape.esm-DelgaX4f.js +321 -0
- ksadk/server/static/assets/d-BhMjBjQP.js +1 -0
- ksadk/server/static/assets/dagre-BM42HDAG-FoDlo5J2.js +4 -0
- ksadk/server/static/assets/dagre-Bx709z4p.js +1 -0
- ksadk/server/static/assets/defaultLocale-C8Fc0cco.js +1 -0
- ksadk/server/static/assets/diagram-2AECGRRQ-BBp6ebBw.js +43 -0
- ksadk/server/static/assets/diagram-5GNKFQAL-CqOvG1PR.js +10 -0
- ksadk/server/static/assets/diagram-KO2AKTUF-O9T3t6ba.js +3 -0
- ksadk/server/static/assets/diagram-LMA3HP47-CGG8ekBO.js +24 -0
- ksadk/server/static/assets/diagram-OG6HWLK6-4BmH1EEg.js +24 -0
- ksadk/server/static/assets/diff-ChtP43wD.js +1 -0
- ksadk/server/static/assets/dist-6kSZvCZh.js +1 -0
- ksadk/server/static/assets/dist-B67uF2uK.js +1 -0
- ksadk/server/static/assets/dist-BMKM66B4.js +1 -0
- ksadk/server/static/assets/dist-BVzcWa6D.js +1 -0
- ksadk/server/static/assets/dist-Bk1l05Ni.js +1 -0
- ksadk/server/static/assets/dist-BkJjNih3.js +1 -0
- ksadk/server/static/assets/dist-BmuTWcm7.js +9 -0
- ksadk/server/static/assets/dist-C2DKRFVK.js +1 -0
- ksadk/server/static/assets/dist-CWiTDN_V.js +6 -0
- ksadk/server/static/assets/dist-CZ6C3x8B.js +23 -0
- ksadk/server/static/assets/dist-CiZHB6ZW.js +1 -0
- ksadk/server/static/assets/dist-Cp1_jKwf.js +1 -0
- ksadk/server/static/assets/dist-Cwhk4lwI.js +2 -0
- ksadk/server/static/assets/dist-D5JGcxBx.js +11 -0
- ksadk/server/static/assets/dist-D99wf6_X.js +1 -0
- ksadk/server/static/assets/dist-DCpZrjaK.js +1 -0
- ksadk/server/static/assets/dist-DI-oVAXw.js +1 -0
- ksadk/server/static/assets/dist-DLMjL01k.js +1 -0
- ksadk/server/static/assets/dist-DLeM1OCK.js +1 -0
- ksadk/server/static/assets/dist-DM0rEQPk.js +1 -0
- ksadk/server/static/assets/dist-DbaH3p5h.js +1 -0
- ksadk/server/static/assets/dist-S4klkK5W.js +1 -0
- ksadk/server/static/assets/dockerfile-BLkNEvjs.js +1 -0
- ksadk/server/static/assets/dtd-DTF72YNO.js +1 -0
- ksadk/server/static/assets/dylan-C6jEEEk-.js +1 -0
- ksadk/server/static/assets/ebnf-D4c0_ac3.js +1 -0
- ksadk/server/static/assets/ecl-BSZaIHnp.js +1 -0
- ksadk/server/static/assets/eiffel-BEjRio4Q.js +1 -0
- ksadk/server/static/assets/elm-Cshzl8qu.js +1 -0
- ksadk/server/static/assets/erDiagram-TEJ5UH35-oJhaci7S.js +85 -0
- ksadk/server/static/assets/erlang-DaB2Rkuy.js +1 -0
- ksadk/server/static/assets/eventmodeling-FCH6USID-CIgwHJLL.js +1 -0
- ksadk/server/static/assets/factor-D7LVTn2l.js +1 -0
- ksadk/server/static/assets/fcl-ClOhbFR7.js +1 -0
- ksadk/server/static/assets/flowDiagram-I6XJVG4X-DtTmUan-.js +162 -0
- ksadk/server/static/assets/forth-Cezjo90N.js +1 -0
- ksadk/server/static/assets/fortran-Bt6PBEDR.js +1 -0
- ksadk/server/static/assets/ganttDiagram-6RSMTGT7-BSsb_eij.js +292 -0
- ksadk/server/static/assets/gas-BHEdbvp9.js +1 -0
- ksadk/server/static/assets/gherkin-oBAE_ms0.js +1 -0
- ksadk/server/static/assets/gitGraph-WXDBUCRP-BVAJ7uo0.js +1 -0
- ksadk/server/static/assets/gitGraphDiagram-PVQCEYII-BR5s6Pws.js +106 -0
- ksadk/server/static/assets/graphlib-B8gBHxth.js +1 -0
- ksadk/server/static/assets/groovy-BC3IOsC8.js +1 -0
- ksadk/server/static/assets/haskell-BRsoo5mP.js +1 -0
- ksadk/server/static/assets/haxe-DIz0ZZqd.js +1 -0
- ksadk/server/static/assets/http-CLVgA2GD.js +1 -0
- ksadk/server/static/assets/idl-BUZw3wgd.js +1 -0
- ksadk/server/static/assets/index-BH7-pC0B.js +165 -0
- ksadk/server/static/assets/index-DAURbCsP.css +1 -0
- ksadk/server/static/assets/info-J43DQDTF-MT80V4ge.js +1 -0
- ksadk/server/static/assets/infoDiagram-5YYISTIA-DYPc5cvh.js +2 -0
- ksadk/server/static/assets/init-D6jRqBbL.js +1 -0
- ksadk/server/static/assets/ishikawaDiagram-YF4QCWOH-MoBdALDg.js +70 -0
- ksadk/server/static/assets/javascript-9Tg8ixDm.js +1 -0
- ksadk/server/static/assets/journeyDiagram-JHISSGLW-DgLiQT8l.js +139 -0
- ksadk/server/static/assets/julia-CQfgDRfP.js +1 -0
- ksadk/server/static/assets/kanban-definition-UN3LZRKU-CsFx112F.js +89 -0
- ksadk/server/static/assets/katex-DRsiwpM2.js +265 -0
- ksadk/server/static/assets/linear-TNRQ5Orv.js +1 -0
- ksadk/server/static/assets/livescript-BXxG0Yva.js +1 -0
- ksadk/server/static/assets/lua-CiA1ziua.js +1 -0
- ksadk/server/static/assets/mathematica-u8YMmbU0.js +1 -0
- ksadk/server/static/assets/mbox-BEMVcqjs.js +1 -0
- ksadk/server/static/assets/mermaid-parser.core-D2eMVOgo.js +161 -0
- ksadk/server/static/assets/mindmap-definition-RKZ34NQL-BtByYFhL.js +96 -0
- ksadk/server/static/assets/mirc-C9zpzAZU.js +1 -0
- ksadk/server/static/assets/mllike-B45xgp2S.js +1 -0
- ksadk/server/static/assets/modelica-CqHI_q-D.js +1 -0
- ksadk/server/static/assets/mscgen-qgSLujhx.js +1 -0
- ksadk/server/static/assets/mumps-CW_TBmxz.js +1 -0
- ksadk/server/static/assets/nginx-BMaDbqW3.js +1 -0
- ksadk/server/static/assets/nsis-AQ_alPln.js +1 -0
- ksadk/server/static/assets/ntriples-d28e9m0E.js +1 -0
- ksadk/server/static/assets/octave-D2Q8cUp1.js +1 -0
- ksadk/server/static/assets/ordinal-hYBb2elL.js +1 -0
- ksadk/server/static/assets/oz-BwTct_5T.js +1 -0
- ksadk/server/static/assets/packet-YPE3B663-BLKhbXZB.js +1 -0
- ksadk/server/static/assets/pascal-Dp_KdFgX.js +1 -0
- ksadk/server/static/assets/perl-CdEHsPfU.js +1 -0
- ksadk/server/static/assets/pie-LRSECV5Y-DFOikjSY.js +1 -0
- ksadk/server/static/assets/pieDiagram-4H26LBE5-DPnuCB8c.js +30 -0
- ksadk/server/static/assets/pig-AF4Hwhju.js +1 -0
- ksadk/server/static/assets/powershell-CzG71I4L.js +1 -0
- ksadk/server/static/assets/properties-C357ku5U.js +1 -0
- ksadk/server/static/assets/protobuf-D1ij_kNL.js +1 -0
- ksadk/server/static/assets/pug-Bugr-47h.js +1 -0
- ksadk/server/static/assets/puppet-B4hC2X4m.js +1 -0
- ksadk/server/static/assets/python-BqYw9LYJ.js +1 -0
- ksadk/server/static/assets/q-B9NhS7L_.js +1 -0
- ksadk/server/static/assets/quadrantDiagram-W4KKPZXB-miFpCPv4.js +7 -0
- ksadk/server/static/assets/r-DADKenSm.js +1 -0
- ksadk/server/static/assets/radar-GUYGQ44K-095b1Ikw.js +1 -0
- ksadk/server/static/assets/requirementDiagram-4Y6WPE33-mjB_yYkW.js +84 -0
- ksadk/server/static/assets/rpm-gpDK5sbt.js +1 -0
- ksadk/server/static/assets/ruby-DsYpTuWg.js +1 -0
- ksadk/server/static/assets/sankeyDiagram-5OEKKPKP-D7hSlZZZ.js +40 -0
- ksadk/server/static/assets/sas-C2OyD2Y6.js +1 -0
- ksadk/server/static/assets/scheme-CyDdOh7e.js +1 -0
- ksadk/server/static/assets/sequenceDiagram-3UESZ5HK-D9Cx6hC3.js +162 -0
- ksadk/server/static/assets/shell-Du5Qg9im.js +1 -0
- ksadk/server/static/assets/sieve-BAxa3IjF.js +1 -0
- ksadk/server/static/assets/simple-mode-DRpGK0lJ.js +1 -0
- ksadk/server/static/assets/smalltalk-BLp5-jwC.js +1 -0
- ksadk/server/static/assets/solr-BBopId9w.js +1 -0
- ksadk/server/static/assets/sparql-Dz-mlCAC.js +1 -0
- ksadk/server/static/assets/spreadsheet-CTIncYxj.js +1 -0
- ksadk/server/static/assets/sql-DcCJ9jop.js +1 -0
- ksadk/server/static/assets/stateDiagram-AJRCARHV-D_zrg47o.js +1 -0
- ksadk/server/static/assets/stateDiagram-v2-BHNVJYJU-J9kCb0nC.js +1 -0
- ksadk/server/static/assets/stex-sDrdk2BW.js +1 -0
- ksadk/server/static/assets/stylus-DLLZ8dgm.js +1 -0
- ksadk/server/static/assets/swift-DKB6_1j6.js +1 -0
- ksadk/server/static/assets/tcl-BGfruO1u.js +1 -0
- ksadk/server/static/assets/textile-DWBqthVk.js +1 -0
- ksadk/server/static/assets/tiddlywiki-VlUiK86J.js +1 -0
- ksadk/server/static/assets/tiki-CxVlf5KZ.js +1 -0
- ksadk/server/static/assets/timeline-definition-PNZ67QCA-CwSec0Wa.js +120 -0
- ksadk/server/static/assets/toml-LvoKBwCs.js +1 -0
- ksadk/server/static/assets/treeView-BLDUP644-yinfJEY6.js +1 -0
- ksadk/server/static/assets/treemap-LRROVOQU-DosUqN1Q.js +1 -0
- ksadk/server/static/assets/troff-C2dAgh7P.js +1 -0
- ksadk/server/static/assets/ttcn-BePYh-hG.js +1 -0
- ksadk/server/static/assets/ttcn-cfg-CY0aot7Q.js +1 -0
- ksadk/server/static/assets/turtle-BDLWE2cD.js +1 -0
- ksadk/server/static/assets/vb-BthdM_4N.js +1 -0
- ksadk/server/static/assets/vbscript-D9f6rSsU.js +1 -0
- ksadk/server/static/assets/velocity-CqftRsjg.js +1 -0
- ksadk/server/static/assets/vennDiagram-CIIHVFJN-agCVobiF.js +34 -0
- ksadk/server/static/assets/verilog-D-x6ne0Z.js +1 -0
- ksadk/server/static/assets/vhdl-CMrOq2q1.js +1 -0
- ksadk/server/static/assets/wardley-L42UT6IY-Bvp7-5uH.js +1 -0
- ksadk/server/static/assets/wardleyDiagram-YWT4CUSO-TmrlhWNt.js +78 -0
- ksadk/server/static/assets/webidl-D5jiJvOU.js +1 -0
- ksadk/server/static/assets/xquery-fj_R-kMw.js +1 -0
- ksadk/server/static/assets/xterm-DooSxjI5.js +36 -0
- ksadk/server/static/assets/xychartDiagram-2RQKCTM6-DV71V-ah.js +7 -0
- ksadk/server/static/assets/yacas-CXXgtw0p.js +1 -0
- ksadk/server/static/assets/z80-CL1naaMV.js +1 -0
- ksadk/server/static/favicon.svg +1 -0
- ksadk/server/static/icons.svg +24 -0
- ksadk/server/static/index.html +14 -0
- ksadk/server/terminal_sessions.py +551 -0
- ksadk/sessions/__init__.py +283 -0
- ksadk/sessions/base.py +354 -0
- ksadk/sessions/continuity.py +313 -0
- ksadk/sessions/errors.py +7 -0
- ksadk/sessions/in_memory.py +273 -0
- ksadk/sessions/local_service.py +949 -0
- ksadk/sessions/postgres_service.py +838 -0
- ksadk/sessions/sqlite_service.py +13 -0
- ksadk/skills/__init__.py +9 -0
- ksadk/skills/loader.py +46 -0
- ksadk/skills/models.py +120 -0
- ksadk/skills/package_store.py +104 -0
- ksadk/skills/runtime/__init__.py +17 -0
- ksadk/skills/runtime/agent.py +183 -0
- ksadk/skills/runtime/artifacts.py +39 -0
- ksadk/skills/runtime/backends/__init__.py +1 -0
- ksadk/skills/runtime/backends/disabled.py +8 -0
- ksadk/skills/runtime/backends/e2b.py +168 -0
- ksadk/skills/runtime/backends/local.py +95 -0
- ksadk/skills/runtime/base.py +103 -0
- ksadk/skills/runtime/executor.py +219 -0
- ksadk/skills/runtime/factory.py +37 -0
- ksadk/skills/runtime/loader.py +131 -0
- ksadk/skills/runtime/registry.py +150 -0
- ksadk/skills/runtime/request.py +67 -0
- ksadk/skills/service_client.py +239 -0
- ksadk/skills/service_env.py +58 -0
- ksadk/skills/tool_defs.py +221 -0
- ksadk/terminal_client.py +69 -0
- ksadk/terminal_exec_policy.py +229 -0
- ksadk/tools/__init__.py +17 -0
- ksadk/tools/gateway.py +230 -0
- ksadk/tools/result_budget.py +154 -0
- ksadk/toolsets/__init__.py +852 -0
- ksadk/toolsets/_langchain.py +11 -0
- ksadk/toolsets/platform.py +93 -0
- ksadk/toolsets/sandbox.py +310 -0
- ksadk/toolsets/skills.py +217 -0
- ksadk/toolsets/web.py +266 -0
- ksadk/toolsets/workspace.py +878 -0
- ksadk/toolsets/workspace_state.py +44 -0
- ksadk/tracing/__init__.py +37 -0
- ksadk/tracing/exporters/__init__.py +1 -0
- ksadk/tracing/exporters/inmemory_exporter.py +116 -0
- ksadk/tracing/exporters/langfuse_exporter.py +445 -0
- ksadk/tracing/setup.py +829 -0
- ksadk/tracing/span_utils.py +114 -0
- ksadk/tui/__init__.py +12 -0
- ksadk/tui/app.py +400 -0
- ksadk/tui/clipboard.py +100 -0
- ksadk/tui/widgets/__init__.py +22 -0
- ksadk/tui/widgets/assistant.py +89 -0
- ksadk/tui/widgets/base.py +54 -0
- ksadk/tui/widgets/chat_input.py +246 -0
- ksadk/tui/widgets/history.py +156 -0
- ksadk/tui/widgets/system.py +87 -0
- ksadk/tui/widgets/thinking.py +110 -0
- ksadk/tui/widgets/tool_call.py +161 -0
- ksadk/tui/widgets/user.py +37 -0
- ksadk/ui_config.py +168 -0
- ksadk/version.py +4 -0
- ksadk_runtime_common/__init__.py +20 -0
- ksadk_runtime_common/memory_backend/__init__.py +29 -0
- ksadk_runtime_common/memory_backend/manifest.py +79 -0
- ksadk_runtime_common/memory_backend/providers/__init__.py +6 -0
- ksadk_runtime_common/memory_backend/providers/lancedb.py +151 -0
- ksadk_runtime_common/memory_backend/providers/mem0.py +74 -0
- ksadk_runtime_common/memory_backend/registry.py +56 -0
- ksadk_runtime_common/memory_backend/render.py +71 -0
- ksadk_runtime_common/schemas/memory_backend_manifest.schema.json +148 -0
- ksadk_runtime_common/workspace_files/__init__.py +29 -0
- ksadk_runtime_common/workspace_files/bootstrap.py +56 -0
- ksadk_runtime_common/workspace_files/constants.py +9 -0
- ksadk_runtime_common/workspace_files/path_utils.py +71 -0
- ksadk_runtime_common/workspace_files/preview.py +96 -0
- ksadk_runtime_common/workspace_files/router.py +254 -0
- agentengine_sdk_python-0.6.2.dist-info/METADATA +0 -46
- agentengine_sdk_python-0.6.2.dist-info/RECORD +0 -4
- agentengine_sdk_python-0.6.2.dist-info/top_level.txt +0 -1
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
"""Shared helpers for resource-oriented CLI commands."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass, field
|
|
6
|
+
import re
|
|
7
|
+
from typing import Any, Callable, Iterable, Sequence, TypeVar
|
|
8
|
+
|
|
9
|
+
import click
|
|
10
|
+
|
|
11
|
+
from ksadk.cli.ui import (
|
|
12
|
+
emit_json,
|
|
13
|
+
get_console,
|
|
14
|
+
is_json_output,
|
|
15
|
+
new_table,
|
|
16
|
+
print_info,
|
|
17
|
+
print_kv,
|
|
18
|
+
print_next_steps,
|
|
19
|
+
print_title,
|
|
20
|
+
print_warn,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
F = TypeVar("F", bound=Callable)
|
|
24
|
+
|
|
25
|
+
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
|
|
26
|
+
_CONSOLE = get_console()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@dataclass(frozen=True)
|
|
30
|
+
class ResourceActionDescriptor:
|
|
31
|
+
"""Explicit resource action metadata shared by help, hints and JSON output."""
|
|
32
|
+
|
|
33
|
+
name: str
|
|
34
|
+
canonical_command: str
|
|
35
|
+
help_text: str
|
|
36
|
+
kind: str = "read"
|
|
37
|
+
supports_output: bool = True
|
|
38
|
+
supports_dry_run: bool = False
|
|
39
|
+
supports_yes: bool = False
|
|
40
|
+
examples: tuple[str, ...] = ()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass(frozen=True)
|
|
44
|
+
class ResourceActionSet:
|
|
45
|
+
"""Legacy canonical action slots kept for compatibility."""
|
|
46
|
+
|
|
47
|
+
list: str | None = None
|
|
48
|
+
status: str | None = None
|
|
49
|
+
delete: str | None = None
|
|
50
|
+
deploy: str | None = None
|
|
51
|
+
open: str | None = None
|
|
52
|
+
extra: tuple[str, ...] = ()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(frozen=True)
|
|
56
|
+
class ResourceListSchema:
|
|
57
|
+
"""Reusable list presentation contract for a resource."""
|
|
58
|
+
|
|
59
|
+
title: str
|
|
60
|
+
noun: str
|
|
61
|
+
columns: tuple[dict, ...]
|
|
62
|
+
empty_message: str
|
|
63
|
+
summary_lines: tuple[str, ...] = ()
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@dataclass(frozen=True)
|
|
67
|
+
class ResourceStatusSchema:
|
|
68
|
+
"""Reusable detail presentation contract for a resource."""
|
|
69
|
+
|
|
70
|
+
title: str
|
|
71
|
+
next_steps: tuple[str, ...] = ()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass(frozen=True)
|
|
75
|
+
class ResourceDescriptor:
|
|
76
|
+
"""Metadata used by resource groups to share help/output conventions."""
|
|
77
|
+
|
|
78
|
+
name: str
|
|
79
|
+
summary: str
|
|
80
|
+
actions: ResourceActionSet | tuple[ResourceActionDescriptor, ...]
|
|
81
|
+
resource_key: str | None = None
|
|
82
|
+
list_schema: ResourceListSchema | None = None
|
|
83
|
+
status_schema: ResourceStatusSchema | None = None
|
|
84
|
+
examples: tuple[str, ...] = ()
|
|
85
|
+
notes: tuple[str, ...] = ()
|
|
86
|
+
missing_ref_message: str | None = None
|
|
87
|
+
resolution_commands: tuple[str, ...] = ()
|
|
88
|
+
list_action_help: str | None = None
|
|
89
|
+
status_action_help: str | None = None
|
|
90
|
+
delete_action_help: str | None = None
|
|
91
|
+
open_action_help: str | None = None
|
|
92
|
+
deploy_action_help: str | None = None
|
|
93
|
+
extra_action_help: tuple[tuple[str, str], ...] = field(default_factory=tuple)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def region_option(
|
|
97
|
+
*,
|
|
98
|
+
default: str | None = "cn-beijing-6",
|
|
99
|
+
envvar: str | None = "KSYUN_REGION",
|
|
100
|
+
help_text: str = "区域",
|
|
101
|
+
):
|
|
102
|
+
"""Reusable region option."""
|
|
103
|
+
return click.option(
|
|
104
|
+
"--region",
|
|
105
|
+
"-r",
|
|
106
|
+
default=default,
|
|
107
|
+
envvar=envvar,
|
|
108
|
+
show_default=default is not None,
|
|
109
|
+
help=help_text,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def pagination_options(
|
|
114
|
+
*,
|
|
115
|
+
default_page: int = 1,
|
|
116
|
+
default_size: int = 20,
|
|
117
|
+
max_size: int = 100,
|
|
118
|
+
):
|
|
119
|
+
"""Add standard pagination options."""
|
|
120
|
+
|
|
121
|
+
def decorator(func: F) -> F:
|
|
122
|
+
func = click.option(
|
|
123
|
+
"--size",
|
|
124
|
+
default=default_size,
|
|
125
|
+
show_default=True,
|
|
126
|
+
type=click.IntRange(1, max_size),
|
|
127
|
+
help="每页数量",
|
|
128
|
+
)(func)
|
|
129
|
+
func = click.option(
|
|
130
|
+
"--page",
|
|
131
|
+
default=default_page,
|
|
132
|
+
show_default=True,
|
|
133
|
+
type=click.IntRange(1, 10_000),
|
|
134
|
+
help="页码",
|
|
135
|
+
)(func)
|
|
136
|
+
return func
|
|
137
|
+
|
|
138
|
+
return decorator
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def confirm_options(*, hidden_force_alias: bool = True):
|
|
142
|
+
"""Add canonical `--yes` with optional hidden `--force` compatibility."""
|
|
143
|
+
|
|
144
|
+
def decorator(func: F) -> F:
|
|
145
|
+
func = click.option(
|
|
146
|
+
"--force",
|
|
147
|
+
"-f",
|
|
148
|
+
"assume_yes",
|
|
149
|
+
is_flag=True,
|
|
150
|
+
hidden=hidden_force_alias,
|
|
151
|
+
help="(兼容) 跳过确认",
|
|
152
|
+
)(func)
|
|
153
|
+
func = click.option(
|
|
154
|
+
"--yes",
|
|
155
|
+
"-y",
|
|
156
|
+
"assume_yes",
|
|
157
|
+
is_flag=True,
|
|
158
|
+
help="跳过确认",
|
|
159
|
+
)(func)
|
|
160
|
+
return func
|
|
161
|
+
|
|
162
|
+
return decorator
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def confirm_destructive(
|
|
166
|
+
*,
|
|
167
|
+
assume_yes: bool,
|
|
168
|
+
dry_run: bool,
|
|
169
|
+
prompt: str,
|
|
170
|
+
cancel_text: str = "已取消",
|
|
171
|
+
) -> bool:
|
|
172
|
+
"""Run a standard destructive confirmation flow."""
|
|
173
|
+
if assume_yes or dry_run:
|
|
174
|
+
return True
|
|
175
|
+
if is_json_output():
|
|
176
|
+
from ksadk.cli.error_utils import abort_with_cli_error, usage_error
|
|
177
|
+
|
|
178
|
+
abort_with_cli_error(
|
|
179
|
+
usage_error(
|
|
180
|
+
"`--output json` 下 destructive 操作必须显式传入 `--yes`。",
|
|
181
|
+
details={"prompt": prompt},
|
|
182
|
+
)
|
|
183
|
+
)
|
|
184
|
+
if click.confirm(prompt):
|
|
185
|
+
return True
|
|
186
|
+
from ksadk.cli.error_utils import abort_with_cli_error, cancelled_error
|
|
187
|
+
|
|
188
|
+
print_info(cancel_text)
|
|
189
|
+
abort_with_cli_error(
|
|
190
|
+
cancelled_error(
|
|
191
|
+
cancel_text,
|
|
192
|
+
details={"prompt": prompt},
|
|
193
|
+
)
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def print_list_summary(*, total: int, page: int, size: int, noun: str) -> None:
|
|
198
|
+
"""Print a short unified pagination summary."""
|
|
199
|
+
print_info(f"{noun}总数: {total} 页码: {page} 每页: {size}")
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def print_compatibility_hint(*, legacy: str, canonical: str) -> None:
|
|
203
|
+
"""Print a compact compatibility hint for hidden legacy entrypoints."""
|
|
204
|
+
print_info(f"兼容入口 `{legacy}` 仍可用,推荐改用 `{canonical}`。")
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def print_next_action_hint(*commands: str, title: str = "下一步建议") -> None:
|
|
208
|
+
"""Print canonical next action hints."""
|
|
209
|
+
normalized = [f"`{cmd}`" for cmd in commands if str(cmd).strip()]
|
|
210
|
+
if normalized:
|
|
211
|
+
print_next_steps(normalized, title=title)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def print_resolution_error(message: str, *commands: str) -> None:
|
|
215
|
+
"""Print a standard resolution error with next-step hints."""
|
|
216
|
+
from ksadk.cli.error_utils import emit_cli_error, resolution_error
|
|
217
|
+
from ksadk.cli.ui import print_error
|
|
218
|
+
|
|
219
|
+
if is_json_output():
|
|
220
|
+
emit_cli_error(resolution_error(message, hints=list(commands)))
|
|
221
|
+
return
|
|
222
|
+
print_error(message)
|
|
223
|
+
print_next_action_hint(*commands)
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def print_resource_resolution_error(
|
|
227
|
+
descriptor: ResourceDescriptor,
|
|
228
|
+
*,
|
|
229
|
+
message: str | None = None,
|
|
230
|
+
commands: Sequence[str] | None = None,
|
|
231
|
+
) -> None:
|
|
232
|
+
"""Print a canonical resolution error for a resource descriptor."""
|
|
233
|
+
print_resolution_error(
|
|
234
|
+
message or descriptor.missing_ref_message or f"请指定{descriptor.name}",
|
|
235
|
+
*(commands or descriptor.resolution_commands),
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def _resource_key(text: str) -> str:
|
|
240
|
+
return re.sub(r"[^a-zA-Z0-9]+", "_", str(text or "").strip()).strip("_").lower()
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def get_descriptor_resource_key(descriptor: ResourceDescriptor) -> str:
|
|
244
|
+
return descriptor.resource_key or _resource_key(descriptor.name) or "resource"
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def _legacy_action_descriptors(descriptor: ResourceDescriptor) -> tuple[ResourceActionDescriptor, ...]:
|
|
248
|
+
action_set = descriptor.actions
|
|
249
|
+
if not isinstance(action_set, ResourceActionSet):
|
|
250
|
+
return tuple(action_set)
|
|
251
|
+
|
|
252
|
+
descriptors: list[ResourceActionDescriptor] = []
|
|
253
|
+
if action_set.list and descriptor.list_action_help:
|
|
254
|
+
descriptors.append(
|
|
255
|
+
ResourceActionDescriptor(
|
|
256
|
+
name="list",
|
|
257
|
+
canonical_command=action_set.list,
|
|
258
|
+
help_text=descriptor.list_action_help,
|
|
259
|
+
kind="read",
|
|
260
|
+
supports_output=True,
|
|
261
|
+
supports_dry_run=False,
|
|
262
|
+
)
|
|
263
|
+
)
|
|
264
|
+
if action_set.status and descriptor.status_action_help:
|
|
265
|
+
descriptors.append(
|
|
266
|
+
ResourceActionDescriptor(
|
|
267
|
+
name="status",
|
|
268
|
+
canonical_command=action_set.status,
|
|
269
|
+
help_text=descriptor.status_action_help,
|
|
270
|
+
kind="read",
|
|
271
|
+
supports_output=True,
|
|
272
|
+
supports_dry_run=False,
|
|
273
|
+
)
|
|
274
|
+
)
|
|
275
|
+
if action_set.delete and descriptor.delete_action_help:
|
|
276
|
+
descriptors.append(
|
|
277
|
+
ResourceActionDescriptor(
|
|
278
|
+
name="delete",
|
|
279
|
+
canonical_command=action_set.delete,
|
|
280
|
+
help_text=descriptor.delete_action_help,
|
|
281
|
+
kind="destructive",
|
|
282
|
+
supports_output=True,
|
|
283
|
+
supports_dry_run=True,
|
|
284
|
+
supports_yes=True,
|
|
285
|
+
)
|
|
286
|
+
)
|
|
287
|
+
if action_set.deploy and descriptor.deploy_action_help:
|
|
288
|
+
descriptors.append(
|
|
289
|
+
ResourceActionDescriptor(
|
|
290
|
+
name="deploy",
|
|
291
|
+
canonical_command=action_set.deploy,
|
|
292
|
+
help_text=descriptor.deploy_action_help,
|
|
293
|
+
kind="write",
|
|
294
|
+
supports_output=True,
|
|
295
|
+
supports_dry_run=True,
|
|
296
|
+
)
|
|
297
|
+
)
|
|
298
|
+
if action_set.open and descriptor.open_action_help:
|
|
299
|
+
descriptors.append(
|
|
300
|
+
ResourceActionDescriptor(
|
|
301
|
+
name="open",
|
|
302
|
+
canonical_command=action_set.open,
|
|
303
|
+
help_text=descriptor.open_action_help,
|
|
304
|
+
kind="interactive",
|
|
305
|
+
supports_output=True,
|
|
306
|
+
)
|
|
307
|
+
)
|
|
308
|
+
for action_name, help_text in descriptor.extra_action_help:
|
|
309
|
+
descriptors.append(
|
|
310
|
+
ResourceActionDescriptor(
|
|
311
|
+
name=action_name,
|
|
312
|
+
canonical_command=action_name,
|
|
313
|
+
help_text=help_text,
|
|
314
|
+
kind="write",
|
|
315
|
+
supports_output=True,
|
|
316
|
+
)
|
|
317
|
+
)
|
|
318
|
+
return tuple(descriptors)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def get_action_descriptors(descriptor: ResourceDescriptor) -> tuple[ResourceActionDescriptor, ...]:
|
|
322
|
+
if isinstance(descriptor.actions, ResourceActionSet):
|
|
323
|
+
return _legacy_action_descriptors(descriptor)
|
|
324
|
+
return tuple(descriptor.actions)
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def build_resource_group_help(descriptor: ResourceDescriptor) -> str:
|
|
328
|
+
"""Build shared help text for a resource-oriented command group."""
|
|
329
|
+
lines = [descriptor.summary]
|
|
330
|
+
|
|
331
|
+
actions = get_action_descriptors(descriptor)
|
|
332
|
+
if actions:
|
|
333
|
+
action_width = max(len(action.name) for action in actions) + 2
|
|
334
|
+
lines.extend(["", "\b", "标准动作:"])
|
|
335
|
+
lines.extend([f" {action.name:<{action_width}}{action.help_text}" for action in actions])
|
|
336
|
+
|
|
337
|
+
if descriptor.examples:
|
|
338
|
+
lines.extend(["", "\b", "示例:"])
|
|
339
|
+
lines.extend([f" {example}" for example in descriptor.examples])
|
|
340
|
+
|
|
341
|
+
if descriptor.notes:
|
|
342
|
+
lines.extend(["", "\b", "说明:"])
|
|
343
|
+
lines.extend([f" {note}" for note in descriptor.notes])
|
|
344
|
+
|
|
345
|
+
return "\n".join(lines)
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
def build_list_envelope(
|
|
349
|
+
*,
|
|
350
|
+
resource: str,
|
|
351
|
+
items: Sequence[dict[str, Any]],
|
|
352
|
+
page: int,
|
|
353
|
+
size: int,
|
|
354
|
+
total: int,
|
|
355
|
+
hints: Sequence[str] | None = None,
|
|
356
|
+
) -> dict[str, Any]:
|
|
357
|
+
return {
|
|
358
|
+
"ok": True,
|
|
359
|
+
"kind": "list",
|
|
360
|
+
"resource": resource,
|
|
361
|
+
"page": int(page),
|
|
362
|
+
"size": int(size),
|
|
363
|
+
"total": int(total),
|
|
364
|
+
"items": list(items),
|
|
365
|
+
"hints": list(hints or []),
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
def build_status_envelope(
|
|
370
|
+
*,
|
|
371
|
+
resource: str,
|
|
372
|
+
item: dict[str, Any],
|
|
373
|
+
hints: Sequence[str] | None = None,
|
|
374
|
+
) -> dict[str, Any]:
|
|
375
|
+
return {
|
|
376
|
+
"ok": True,
|
|
377
|
+
"kind": "status",
|
|
378
|
+
"resource": resource,
|
|
379
|
+
"item": dict(item),
|
|
380
|
+
"hints": list(hints or []),
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
def build_result_envelope(
|
|
385
|
+
*,
|
|
386
|
+
resource: str,
|
|
387
|
+
action: str,
|
|
388
|
+
result: dict[str, Any],
|
|
389
|
+
hints: Sequence[str] | None = None,
|
|
390
|
+
) -> dict[str, Any]:
|
|
391
|
+
return {
|
|
392
|
+
"ok": True,
|
|
393
|
+
"kind": "result",
|
|
394
|
+
"resource": resource,
|
|
395
|
+
"action": action,
|
|
396
|
+
"result": dict(result),
|
|
397
|
+
"hints": list(hints or []),
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def build_dry_run_envelope(
|
|
402
|
+
*,
|
|
403
|
+
resource: str,
|
|
404
|
+
action: str,
|
|
405
|
+
request: dict[str, Any],
|
|
406
|
+
hints: Sequence[str] | None = None,
|
|
407
|
+
) -> dict[str, Any]:
|
|
408
|
+
return {
|
|
409
|
+
"ok": True,
|
|
410
|
+
"kind": "dry_run",
|
|
411
|
+
"resource": resource,
|
|
412
|
+
"action": action,
|
|
413
|
+
"request": dict(request),
|
|
414
|
+
"hints": list(hints or []),
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
def _column_key(column: dict[str, Any], *, index: int) -> str:
|
|
419
|
+
explicit_key = str(column.get("key") or "").strip()
|
|
420
|
+
if explicit_key:
|
|
421
|
+
return explicit_key
|
|
422
|
+
header = str(column.get("header") or f"column_{index + 1}")
|
|
423
|
+
return _resource_key(header) or f"column_{index + 1}"
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
def _rows_to_items(columns: Sequence[dict], rows: Sequence[Sequence[str]]) -> list[dict[str, Any]]:
|
|
427
|
+
items: list[dict[str, Any]] = []
|
|
428
|
+
for row in rows:
|
|
429
|
+
item: dict[str, Any] = {}
|
|
430
|
+
for idx, cell in enumerate(row):
|
|
431
|
+
column = dict(columns[idx]) if idx < len(columns) else {}
|
|
432
|
+
item[_column_key(column, index=idx)] = cell
|
|
433
|
+
items.append(item)
|
|
434
|
+
return items
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
def _fields_to_item(fields: Sequence[tuple[str, str, str | None]]) -> dict[str, Any]:
|
|
438
|
+
item: dict[str, Any] = {}
|
|
439
|
+
for idx, (label, value, _style) in enumerate(fields):
|
|
440
|
+
item[_resource_key(label) or f"field_{idx + 1}"] = value
|
|
441
|
+
return item
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
def render_resource_list(
|
|
445
|
+
*,
|
|
446
|
+
title: str,
|
|
447
|
+
noun: str,
|
|
448
|
+
columns: Sequence[dict],
|
|
449
|
+
rows: Sequence[Sequence[str]],
|
|
450
|
+
total: int,
|
|
451
|
+
page: int,
|
|
452
|
+
size: int,
|
|
453
|
+
empty_message: str,
|
|
454
|
+
summary_lines: Iterable[str] | None = None,
|
|
455
|
+
resource: str = "resource",
|
|
456
|
+
items: Sequence[dict[str, Any]] | None = None,
|
|
457
|
+
hints: Sequence[str] | None = None,
|
|
458
|
+
) -> bool:
|
|
459
|
+
"""Render a paginated resource list with unified summary output."""
|
|
460
|
+
item_list = list(items) if items is not None else _rows_to_items(columns, rows)
|
|
461
|
+
hint_list = [str(line) for line in (summary_lines or [])]
|
|
462
|
+
if hints:
|
|
463
|
+
hint_list.extend(str(hint) for hint in hints)
|
|
464
|
+
|
|
465
|
+
if is_json_output():
|
|
466
|
+
emit_json(
|
|
467
|
+
build_list_envelope(
|
|
468
|
+
resource=resource,
|
|
469
|
+
items=item_list,
|
|
470
|
+
page=page,
|
|
471
|
+
size=size,
|
|
472
|
+
total=total,
|
|
473
|
+
hints=hint_list,
|
|
474
|
+
)
|
|
475
|
+
)
|
|
476
|
+
return bool(item_list)
|
|
477
|
+
|
|
478
|
+
if not rows:
|
|
479
|
+
print_warn(empty_message)
|
|
480
|
+
print_list_summary(total=total, page=page, size=size, noun=noun)
|
|
481
|
+
return False
|
|
482
|
+
|
|
483
|
+
table = new_table(title)
|
|
484
|
+
for column in columns:
|
|
485
|
+
options = dict(column)
|
|
486
|
+
header = str(options.pop("header"))
|
|
487
|
+
options.pop("key", None)
|
|
488
|
+
table.add_column(header, **options)
|
|
489
|
+
|
|
490
|
+
for row in rows:
|
|
491
|
+
table.add_row(*[str(cell) for cell in row])
|
|
492
|
+
|
|
493
|
+
_CONSOLE.print(table)
|
|
494
|
+
print_list_summary(total=total, page=page, size=size, noun=noun)
|
|
495
|
+
for line in summary_lines or []:
|
|
496
|
+
print_info(str(line))
|
|
497
|
+
return True
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
def render_descriptor_list(
|
|
501
|
+
descriptor: ResourceDescriptor,
|
|
502
|
+
*,
|
|
503
|
+
rows: Sequence[Sequence[str]],
|
|
504
|
+
total: int,
|
|
505
|
+
page: int,
|
|
506
|
+
size: int,
|
|
507
|
+
summary_lines: Iterable[str] | None = None,
|
|
508
|
+
items: Sequence[dict[str, Any]] | None = None,
|
|
509
|
+
hints: Sequence[str] | None = None,
|
|
510
|
+
) -> bool:
|
|
511
|
+
"""Render a resource list from descriptor metadata."""
|
|
512
|
+
if descriptor.list_schema is None:
|
|
513
|
+
raise ValueError(f"{descriptor.name} 未定义列表 schema")
|
|
514
|
+
return render_resource_list(
|
|
515
|
+
title=descriptor.list_schema.title,
|
|
516
|
+
noun=descriptor.list_schema.noun,
|
|
517
|
+
columns=descriptor.list_schema.columns,
|
|
518
|
+
rows=rows,
|
|
519
|
+
total=total,
|
|
520
|
+
page=page,
|
|
521
|
+
size=size,
|
|
522
|
+
empty_message=descriptor.list_schema.empty_message,
|
|
523
|
+
summary_lines=[*descriptor.list_schema.summary_lines, *(summary_lines or [])],
|
|
524
|
+
resource=get_descriptor_resource_key(descriptor),
|
|
525
|
+
items=items,
|
|
526
|
+
hints=hints,
|
|
527
|
+
)
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
def render_resource_status(
|
|
531
|
+
*,
|
|
532
|
+
title: str,
|
|
533
|
+
subtitle: str | None = None,
|
|
534
|
+
fields: Sequence[tuple[str, str, str | None]],
|
|
535
|
+
next_steps: Sequence[str] | None = None,
|
|
536
|
+
resource: str = "resource",
|
|
537
|
+
action: str = "status",
|
|
538
|
+
item: dict[str, Any] | None = None,
|
|
539
|
+
hints: Sequence[str] | None = None,
|
|
540
|
+
) -> None:
|
|
541
|
+
"""Render a unified resource detail/status view."""
|
|
542
|
+
hint_list = list(next_steps or [])
|
|
543
|
+
if hints:
|
|
544
|
+
hint_list.extend(str(hint) for hint in hints)
|
|
545
|
+
payload = dict(item or _fields_to_item(fields))
|
|
546
|
+
|
|
547
|
+
if is_json_output():
|
|
548
|
+
if action == "status":
|
|
549
|
+
emit_json(
|
|
550
|
+
build_status_envelope(
|
|
551
|
+
resource=resource,
|
|
552
|
+
item=payload,
|
|
553
|
+
hints=hint_list,
|
|
554
|
+
)
|
|
555
|
+
)
|
|
556
|
+
else:
|
|
557
|
+
emit_json(
|
|
558
|
+
build_result_envelope(
|
|
559
|
+
resource=resource,
|
|
560
|
+
action=action,
|
|
561
|
+
result=payload,
|
|
562
|
+
hints=hint_list,
|
|
563
|
+
)
|
|
564
|
+
)
|
|
565
|
+
return
|
|
566
|
+
|
|
567
|
+
print_title(title, subtitle)
|
|
568
|
+
for label, value, value_style in fields:
|
|
569
|
+
if value_style:
|
|
570
|
+
print_kv(label, value, value_style=value_style)
|
|
571
|
+
else:
|
|
572
|
+
print_kv(label, value)
|
|
573
|
+
if next_steps:
|
|
574
|
+
print_next_action_hint(*next_steps)
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
def render_descriptor_status(
|
|
578
|
+
descriptor: ResourceDescriptor,
|
|
579
|
+
*,
|
|
580
|
+
title: str | None = None,
|
|
581
|
+
subtitle: str | None = None,
|
|
582
|
+
fields: Sequence[tuple[str, str, str | None]],
|
|
583
|
+
next_steps: Sequence[str] | None = None,
|
|
584
|
+
action: str = "status",
|
|
585
|
+
item: dict[str, Any] | None = None,
|
|
586
|
+
hints: Sequence[str] | None = None,
|
|
587
|
+
) -> None:
|
|
588
|
+
"""Render a resource detail view from descriptor metadata."""
|
|
589
|
+
if descriptor.status_schema is None:
|
|
590
|
+
raise ValueError(f"{descriptor.name} 未定义详情 schema")
|
|
591
|
+
resolved_next_steps = (
|
|
592
|
+
descriptor.status_schema.next_steps
|
|
593
|
+
if next_steps is None and action == "status"
|
|
594
|
+
else tuple(next_steps or ())
|
|
595
|
+
)
|
|
596
|
+
render_resource_status(
|
|
597
|
+
title=title or descriptor.status_schema.title,
|
|
598
|
+
subtitle=subtitle,
|
|
599
|
+
fields=fields,
|
|
600
|
+
next_steps=resolved_next_steps,
|
|
601
|
+
resource=get_descriptor_resource_key(descriptor),
|
|
602
|
+
action=action,
|
|
603
|
+
item=item,
|
|
604
|
+
hints=hints,
|
|
605
|
+
)
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
class CompatibilityAliasCommand(click.Command):
|
|
609
|
+
"""Hidden compatibility alias that only exposes migration help."""
|
|
610
|
+
|
|
611
|
+
def __init__(self, *args, canonical_command: str, **kwargs):
|
|
612
|
+
self.canonical_command = canonical_command
|
|
613
|
+
super().__init__(*args, **kwargs)
|
|
614
|
+
|
|
615
|
+
def format_help(self, ctx: click.Context, formatter: click.HelpFormatter) -> None:
|
|
616
|
+
formatter.write_usage(ctx.command_path, " ".join(self.collect_usage_pieces(ctx)))
|
|
617
|
+
formatter.write_paragraph()
|
|
618
|
+
formatter.write_text("这是兼容入口,建议迁移到新的 canonical 命令。")
|
|
619
|
+
formatter.write_paragraph()
|
|
620
|
+
formatter.write_text(f"推荐命令: {self.canonical_command}")
|
|
621
|
+
formatter.write_text(f"查看帮助: {self.canonical_command} --help")
|
ksadk/cli/storage.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""CLI storage helpers for serverless PVC defaults."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
import click
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
DEFAULT_STORAGE_SIZE_GI = 20
|
|
11
|
+
MIN_STORAGE_SIZE_GI = 20
|
|
12
|
+
MAX_STORAGE_SIZE_GI = 500
|
|
13
|
+
SERVERLESS_TARGETS = {"serverless", "kcf", "kce"}
|
|
14
|
+
|
|
15
|
+
# 默认挂盘框架(hermes/openclaw 有持久化状态目录);其他框架需显式 --storage-mount-path。
|
|
16
|
+
DEFAULT_STORAGE_FRAMEWORKS = {"hermes", "openclaw"}
|
|
17
|
+
|
|
18
|
+
# 各框架默认挂载目录。hermes/openclaw 由 build_storage_config 默认挂载;
|
|
19
|
+
# adk/langgraph 等条目保留供 resolve_default_storage_mount_path 契约与测试,默认不挂盘。
|
|
20
|
+
_DEFAULT_MOUNT_PATHS = {
|
|
21
|
+
"adk": "/home/node/.agentengine",
|
|
22
|
+
"langchain": "/home/node/.agentengine",
|
|
23
|
+
"langgraph": "/home/node/.agentengine",
|
|
24
|
+
"deepagents": "/home/node/.agentengine",
|
|
25
|
+
"hermes": "/home/node/.hermes",
|
|
26
|
+
"openclaw": "/home/node/.openclaw",
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def resolve_default_storage_mount_path(framework: str) -> str:
|
|
31
|
+
normalized = str(framework or "").strip().lower()
|
|
32
|
+
return _DEFAULT_MOUNT_PATHS.get(normalized, "/home/node/.agentengine")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def validate_storage_size_gi(value: Optional[int]) -> int:
|
|
36
|
+
size_gi = DEFAULT_STORAGE_SIZE_GI if value is None else int(value)
|
|
37
|
+
if size_gi < MIN_STORAGE_SIZE_GI or size_gi > MAX_STORAGE_SIZE_GI:
|
|
38
|
+
raise click.BadParameter(
|
|
39
|
+
f"挂盘容量必须在 {MIN_STORAGE_SIZE_GI}Gi 到 {MAX_STORAGE_SIZE_GI}Gi 之间"
|
|
40
|
+
)
|
|
41
|
+
return size_gi
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def validate_storage_mount_path(value: Optional[str]) -> str:
|
|
45
|
+
path = str(value or "").strip()
|
|
46
|
+
if not path:
|
|
47
|
+
raise click.BadParameter("挂盘目录不能为空")
|
|
48
|
+
if not path.startswith("/") or path == "/":
|
|
49
|
+
raise click.BadParameter("挂盘目录必须是绝对路径,且不能为 /")
|
|
50
|
+
return path.rstrip("/") or path
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def should_enable_storage(*, target: Optional[str], no_storage: bool) -> bool:
|
|
54
|
+
return not no_storage and str(target or "").strip().lower() in SERVERLESS_TARGETS
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def build_storage_config(
|
|
58
|
+
framework: str,
|
|
59
|
+
*,
|
|
60
|
+
target: Optional[str] = None,
|
|
61
|
+
no_storage: bool = False,
|
|
62
|
+
mount_path: Optional[str] = None,
|
|
63
|
+
size_gi: Optional[int] = None,
|
|
64
|
+
):
|
|
65
|
+
if target is not None and not should_enable_storage(target=target, no_storage=no_storage):
|
|
66
|
+
return None
|
|
67
|
+
if no_storage:
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
normalized_framework = str(framework or "").strip().lower()
|
|
71
|
+
mount_path_explicit = mount_path is not None
|
|
72
|
+
# 仅 hermes/openclaw 默认挂盘;其他框架需用户显式指定 --storage-mount-path 才挂
|
|
73
|
+
if not mount_path_explicit and normalized_framework not in DEFAULT_STORAGE_FRAMEWORKS:
|
|
74
|
+
return None
|
|
75
|
+
|
|
76
|
+
resolved_mount_path = (
|
|
77
|
+
validate_storage_mount_path(mount_path)
|
|
78
|
+
if mount_path is not None
|
|
79
|
+
else resolve_default_storage_mount_path(framework)
|
|
80
|
+
)
|
|
81
|
+
return {
|
|
82
|
+
"mount_path": resolved_mount_path,
|
|
83
|
+
"size_gi": validate_storage_size_gi(size_gi),
|
|
84
|
+
}
|