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,151 @@
|
|
|
1
|
+
"""LanceDB memory backend provider."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from ksadk_runtime_common.memory_backend.manifest import MemoryBackendManifest
|
|
8
|
+
from ksadk_runtime_common.memory_backend.registry import RenderResult
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class LanceDBProvider:
|
|
12
|
+
"""Provider for the in-process LanceDB OpenClaw memory plugin."""
|
|
13
|
+
|
|
14
|
+
def render(self, manifest: MemoryBackendManifest) -> RenderResult:
|
|
15
|
+
"""Render LanceDB plugin config for OpenClaw.
|
|
16
|
+
|
|
17
|
+
Maps the platform manifest config fields onto the memory-lancedb
|
|
18
|
+
plugin schema. This must stay in sync with the inline renderer in
|
|
19
|
+
``deploy/openclaw/bootstrap.sh`` so both code paths produce the same
|
|
20
|
+
plugin entry.
|
|
21
|
+
"""
|
|
22
|
+
entry: dict[str, Any] = {"enabled": True}
|
|
23
|
+
config = self._render_plugin_config(manifest.config or {})
|
|
24
|
+
if config:
|
|
25
|
+
entry["config"] = config
|
|
26
|
+
|
|
27
|
+
return RenderResult(
|
|
28
|
+
backend_type="lancedb",
|
|
29
|
+
config_patch={
|
|
30
|
+
"plugins": {
|
|
31
|
+
"slots": {
|
|
32
|
+
"memory": "memory-lancedb",
|
|
33
|
+
},
|
|
34
|
+
"entries": {
|
|
35
|
+
"memory-lancedb": entry,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
plugin_ids=["memory-lancedb"],
|
|
40
|
+
disabled_plugin_ids=["openclaw-mem0"],
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
@staticmethod
|
|
44
|
+
def _first(config: dict[str, Any], *keys: str) -> Any:
|
|
45
|
+
for key in keys:
|
|
46
|
+
value = config.get(key)
|
|
47
|
+
if isinstance(value, str):
|
|
48
|
+
value = value.strip()
|
|
49
|
+
if value:
|
|
50
|
+
return value
|
|
51
|
+
elif value is not None:
|
|
52
|
+
return value
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def _render_plugin_config(cls, config: dict[str, Any]) -> dict[str, Any]:
|
|
57
|
+
if not config:
|
|
58
|
+
return {}
|
|
59
|
+
|
|
60
|
+
output: dict[str, Any] = {}
|
|
61
|
+
|
|
62
|
+
embedding: dict[str, Any] = {}
|
|
63
|
+
for target_key, *source_keys in (
|
|
64
|
+
("provider", "provider", "embedding_provider"),
|
|
65
|
+
("model", "model", "embedding_model"),
|
|
66
|
+
("apiKey", "apiKey", "api_key", "embedding_api_key"),
|
|
67
|
+
("baseUrl", "baseUrl", "base_url", "embedding_base_url"),
|
|
68
|
+
):
|
|
69
|
+
value = cls._first(config, *source_keys)
|
|
70
|
+
if value is not None:
|
|
71
|
+
embedding[target_key] = value
|
|
72
|
+
dimensions = cls._first(
|
|
73
|
+
config, "dimensions", "embedding_dimensions"
|
|
74
|
+
)
|
|
75
|
+
if isinstance(dimensions, int) or (
|
|
76
|
+
isinstance(dimensions, str) and dimensions.strip().isdigit()
|
|
77
|
+
):
|
|
78
|
+
embedding["dimensions"] = int(dimensions)
|
|
79
|
+
if embedding:
|
|
80
|
+
output["embedding"] = embedding
|
|
81
|
+
|
|
82
|
+
db_path = cls._first(
|
|
83
|
+
config, "dbPath", "db_path", "data_path",
|
|
84
|
+
"database_uri", "databaseUri", "database_url",
|
|
85
|
+
)
|
|
86
|
+
if db_path is not None:
|
|
87
|
+
output["dbPath"] = db_path
|
|
88
|
+
|
|
89
|
+
for target_key, *source_keys in (
|
|
90
|
+
("autoCapture", "autoCapture", "auto_capture"),
|
|
91
|
+
("autoRecall", "autoRecall", "auto_recall"),
|
|
92
|
+
):
|
|
93
|
+
value = cls._first(config, *source_keys)
|
|
94
|
+
if isinstance(value, bool):
|
|
95
|
+
output[target_key] = value
|
|
96
|
+
elif isinstance(value, str):
|
|
97
|
+
normalized = value.strip().lower()
|
|
98
|
+
if normalized in {"1", "true", "yes", "on"}:
|
|
99
|
+
output[target_key] = True
|
|
100
|
+
elif normalized in {"0", "false", "no", "off"}:
|
|
101
|
+
output[target_key] = False
|
|
102
|
+
|
|
103
|
+
for target_key, *source_keys in (
|
|
104
|
+
("captureMaxChars", "captureMaxChars", "capture_max_chars"),
|
|
105
|
+
("recallMaxChars", "recallMaxChars", "recall_max_chars"),
|
|
106
|
+
):
|
|
107
|
+
value = cls._first(config, *source_keys)
|
|
108
|
+
if isinstance(value, int) and not isinstance(value, bool):
|
|
109
|
+
output[target_key] = value
|
|
110
|
+
elif isinstance(value, str) and value.strip().lstrip("-").isdigit():
|
|
111
|
+
output[target_key] = int(value)
|
|
112
|
+
|
|
113
|
+
custom_triggers = config.get("customTriggers", config.get("custom_triggers"))
|
|
114
|
+
if isinstance(custom_triggers, list):
|
|
115
|
+
output["customTriggers"] = custom_triggers
|
|
116
|
+
|
|
117
|
+
for target_key, *source_keys in (
|
|
118
|
+
("dreaming", "dreaming"),
|
|
119
|
+
("storageOptions", "storageOptions", "storage_options"),
|
|
120
|
+
):
|
|
121
|
+
value = cls._first(config, *source_keys)
|
|
122
|
+
if isinstance(value, dict):
|
|
123
|
+
output[target_key] = value
|
|
124
|
+
|
|
125
|
+
storage_options = output.get("storageOptions")
|
|
126
|
+
if not isinstance(storage_options, dict):
|
|
127
|
+
storage_options = {}
|
|
128
|
+
for target_key, *source_keys in (
|
|
129
|
+
("endpoint", "storage_endpoint", "storageEndpoint"),
|
|
130
|
+
("region", "storage_region", "storageRegion"),
|
|
131
|
+
("bucket", "storage_bucket", "storageBucket"),
|
|
132
|
+
("prefix", "storage_prefix", "storagePrefix"),
|
|
133
|
+
("accessKeyId", "storage_access_key_id", "storageAccessKeyId"),
|
|
134
|
+
("secretAccessKey", "storage_secret_access_key", "storageSecretAccessKey"),
|
|
135
|
+
):
|
|
136
|
+
value = cls._first(config, *source_keys)
|
|
137
|
+
if value is not None:
|
|
138
|
+
storage_options[target_key] = value
|
|
139
|
+
allow_http = cls._first(config, "storage_allow_http", "storageAllowHttp")
|
|
140
|
+
if isinstance(allow_http, bool):
|
|
141
|
+
storage_options["allowHttp"] = "true" if allow_http else "false"
|
|
142
|
+
elif isinstance(allow_http, str):
|
|
143
|
+
normalized = allow_http.strip().lower()
|
|
144
|
+
if normalized in {"1", "true", "yes", "on"}:
|
|
145
|
+
storage_options["allowHttp"] = "true"
|
|
146
|
+
elif normalized in {"0", "false", "no", "off"}:
|
|
147
|
+
storage_options["allowHttp"] = "false"
|
|
148
|
+
if storage_options:
|
|
149
|
+
output["storageOptions"] = storage_options
|
|
150
|
+
|
|
151
|
+
return output
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""Mem0 memory backend provider."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from ksadk_runtime_common.memory_backend.manifest import MemoryBackendManifest
|
|
9
|
+
from ksadk_runtime_common.memory_backend.registry import RenderResult
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _resolve_env_name(secrets_env: dict[str, str], key: str, default: str) -> str:
|
|
13
|
+
"""Resolve an env var name from secrets_env, falling back to a default."""
|
|
14
|
+
return str(secrets_env.get(key) or default).strip() or default
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _require_env(name: str) -> None:
|
|
18
|
+
"""Require a non-empty environment variable in the current process."""
|
|
19
|
+
if not str(os.getenv(name) or "").strip():
|
|
20
|
+
raise ValueError(f"mem0 backend requires environment variable '{name}'")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _require_env_value(name: str) -> str:
|
|
24
|
+
"""Return a required env var value after validating it is non-empty."""
|
|
25
|
+
_require_env(name)
|
|
26
|
+
return str(os.getenv(name) or "").strip()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class Mem0Provider:
|
|
30
|
+
"""Provider for the mem0 memory backend."""
|
|
31
|
+
|
|
32
|
+
def render(self, manifest: MemoryBackendManifest) -> RenderResult:
|
|
33
|
+
"""Render mem0 config for OpenClaw."""
|
|
34
|
+
config = manifest.config
|
|
35
|
+
secrets_env = manifest.secrets_env
|
|
36
|
+
|
|
37
|
+
mem0_instance_id = config.get("mem0_instance_id")
|
|
38
|
+
if not mem0_instance_id:
|
|
39
|
+
raise ValueError("mem0 backend requires 'mem0_instance_id' in config")
|
|
40
|
+
|
|
41
|
+
api_key_env = _resolve_env_name(secrets_env, "api_key", "MEM0_API_KEY")
|
|
42
|
+
user_id_env = _resolve_env_name(secrets_env, "user_id", "MEM0_USER_ID")
|
|
43
|
+
base_url_env = _resolve_env_name(secrets_env, "base_url", "MEM0_BASE_URL")
|
|
44
|
+
|
|
45
|
+
required_env = [api_key_env, user_id_env, base_url_env]
|
|
46
|
+
api_key = _require_env_value(api_key_env)
|
|
47
|
+
user_id = _require_env_value(user_id_env)
|
|
48
|
+
base_url = _require_env_value(base_url_env)
|
|
49
|
+
|
|
50
|
+
config_patch: dict[str, Any] = {
|
|
51
|
+
"plugins": {
|
|
52
|
+
"slots": {
|
|
53
|
+
"memory": "openclaw-mem0",
|
|
54
|
+
},
|
|
55
|
+
"entries": {
|
|
56
|
+
"openclaw-mem0": {
|
|
57
|
+
"enabled": True,
|
|
58
|
+
"config": {
|
|
59
|
+
"mode": "platform",
|
|
60
|
+
"apiKey": api_key,
|
|
61
|
+
"baseUrl": base_url,
|
|
62
|
+
"userId": user_id,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return RenderResult(
|
|
70
|
+
backend_type="mem0",
|
|
71
|
+
config_patch=config_patch,
|
|
72
|
+
required_env=required_env,
|
|
73
|
+
plugin_ids=["openclaw-mem0"],
|
|
74
|
+
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""Memory backend provider registry."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Protocol
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel, Field
|
|
8
|
+
|
|
9
|
+
from ksadk_runtime_common.memory_backend.manifest import MemoryBackendManifest
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RenderResult(BaseModel):
|
|
13
|
+
"""Result from rendering a memory backend config."""
|
|
14
|
+
|
|
15
|
+
backend_type: str
|
|
16
|
+
config_patch: dict[str, Any] = Field(default_factory=dict)
|
|
17
|
+
required_env: list[str] = Field(default_factory=list)
|
|
18
|
+
plugin_ids: list[str] = Field(default_factory=list)
|
|
19
|
+
disabled_plugin_ids: list[str] = Field(default_factory=list)
|
|
20
|
+
clear_plugin_slots: list[str] = Field(default_factory=list)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ProviderProtocol(Protocol):
|
|
24
|
+
"""Protocol for memory backend providers."""
|
|
25
|
+
|
|
26
|
+
def render(self, manifest: MemoryBackendManifest) -> RenderResult: ...
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
_PROVIDERS: dict[str, ProviderProtocol] = {}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def register_provider(backend_type: str, provider: ProviderProtocol) -> None:
|
|
33
|
+
"""Register a memory backend provider."""
|
|
34
|
+
_PROVIDERS[backend_type] = provider
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_provider(backend_type: str) -> ProviderProtocol | None:
|
|
38
|
+
"""Get a registered provider by backend type."""
|
|
39
|
+
return _PROVIDERS.get(backend_type)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def list_providers() -> list[str]:
|
|
43
|
+
"""List registered backend type identifiers."""
|
|
44
|
+
return list(_PROVIDERS.keys())
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _register_builtin_providers() -> None:
|
|
48
|
+
"""Register providers shipped in this repo copy."""
|
|
49
|
+
from ksadk_runtime_common.memory_backend.providers.mem0 import Mem0Provider
|
|
50
|
+
from ksadk_runtime_common.memory_backend.providers.lancedb import LanceDBProvider
|
|
51
|
+
|
|
52
|
+
register_provider("mem0", Mem0Provider())
|
|
53
|
+
register_provider("lancedb", LanceDBProvider())
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
_register_builtin_providers()
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""Memory backend config renderer for runtime bootstrap integration."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
from collections.abc import Mapping
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from ksadk_runtime_common.memory_backend.manifest import (
|
|
11
|
+
MemoryBackendManifest,
|
|
12
|
+
parse_manifest,
|
|
13
|
+
)
|
|
14
|
+
from ksadk_runtime_common.memory_backend.registry import (
|
|
15
|
+
RenderResult,
|
|
16
|
+
get_provider,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
MANIFEST_ENV_VAR = "MEMORY_BACKEND_MANIFEST"
|
|
20
|
+
MEMORY_BACKEND_PLUGIN_IDS = ["openclaw-mem0", "memory-lancedb"]
|
|
21
|
+
MEMORY_BACKEND_PLUGIN_SLOTS = ["memory"]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def render_memory_backend_config(
|
|
25
|
+
manifest: MemoryBackendManifest | str | Mapping[str, Any] | None = None,
|
|
26
|
+
) -> RenderResult:
|
|
27
|
+
"""Render memory backend config from a manifest."""
|
|
28
|
+
if manifest is None:
|
|
29
|
+
manifest_raw = os.getenv(MANIFEST_ENV_VAR)
|
|
30
|
+
if not manifest_raw:
|
|
31
|
+
return RenderResult(
|
|
32
|
+
backend_type="openclaw_default",
|
|
33
|
+
config_patch={},
|
|
34
|
+
required_env=[],
|
|
35
|
+
plugin_ids=[],
|
|
36
|
+
)
|
|
37
|
+
manifest = manifest_raw
|
|
38
|
+
|
|
39
|
+
parsed = parse_manifest(manifest)
|
|
40
|
+
if parsed is None:
|
|
41
|
+
return RenderResult(
|
|
42
|
+
backend_type="openclaw_default",
|
|
43
|
+
config_patch={},
|
|
44
|
+
required_env=[],
|
|
45
|
+
plugin_ids=[],
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
if parsed.backend_type == "openclaw_default":
|
|
49
|
+
return RenderResult(
|
|
50
|
+
backend_type="openclaw_default",
|
|
51
|
+
config_patch={},
|
|
52
|
+
required_env=[],
|
|
53
|
+
disabled_plugin_ids=MEMORY_BACKEND_PLUGIN_IDS,
|
|
54
|
+
clear_plugin_slots=MEMORY_BACKEND_PLUGIN_SLOTS,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
provider = get_provider(parsed.backend_type)
|
|
58
|
+
if provider is None:
|
|
59
|
+
raise ValueError(f"Unknown backend_type: {parsed.backend_type}")
|
|
60
|
+
|
|
61
|
+
return provider.render(parsed)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def render_to_json(manifest: MemoryBackendManifest | str | dict[str, Any] | None = None) -> str:
|
|
65
|
+
"""Render memory backend config to a JSON string."""
|
|
66
|
+
result = render_memory_backend_config(manifest)
|
|
67
|
+
return json.dumps(result.model_dump())
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
if __name__ == "__main__":
|
|
71
|
+
print(render_to_json())
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://kingsoftcloud.github.io/ksadk-python/schemas/memory_backend_manifest/v1",
|
|
4
|
+
"title": "MemoryBackendManifest",
|
|
5
|
+
"description": "Memory backend manifest for OpenClaw runtime configuration.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_version",
|
|
9
|
+
"backend_type"
|
|
10
|
+
],
|
|
11
|
+
"additionalProperties": false,
|
|
12
|
+
"properties": {
|
|
13
|
+
"schema_version": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"const": "v1",
|
|
16
|
+
"description": "Schema version identifier. Must be 'v1'."
|
|
17
|
+
},
|
|
18
|
+
"backend_type": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"enum": [
|
|
21
|
+
"openclaw_default",
|
|
22
|
+
"mem0",
|
|
23
|
+
"lancedb"
|
|
24
|
+
],
|
|
25
|
+
"description": "Memory backend type. Supports 'openclaw_default', 'mem0', and 'lancedb'."
|
|
26
|
+
},
|
|
27
|
+
"config": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"description": "Backend-specific configuration.",
|
|
30
|
+
"additionalProperties": true,
|
|
31
|
+
"properties": {
|
|
32
|
+
"mem0_instance_id": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"format": "uuid",
|
|
35
|
+
"description": "Mem0 instance UUID (required when backend_type is 'mem0')."
|
|
36
|
+
},
|
|
37
|
+
"mem0_instance_name": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"description": "Mem0 instance display name."
|
|
40
|
+
},
|
|
41
|
+
"mem0_region": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "Mem0 instance region."
|
|
44
|
+
},
|
|
45
|
+
"dbPath": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "Optional LanceDB plugin dbPath override."
|
|
48
|
+
},
|
|
49
|
+
"database_uri": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"description": "Database URI for LanceDB storage (e.g. s3://bucket/prefix). Mapped to dbPath when dbPath is absent."
|
|
52
|
+
},
|
|
53
|
+
"embedding": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"description": "Optional LanceDB plugin embedding configuration.",
|
|
56
|
+
"additionalProperties": true
|
|
57
|
+
},
|
|
58
|
+
"embedding_provider": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"description": "Embedding provider for LanceDB (e.g. openai)."
|
|
61
|
+
},
|
|
62
|
+
"embedding_model": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "Embedding model name for LanceDB."
|
|
65
|
+
},
|
|
66
|
+
"embedding_dimensions": {
|
|
67
|
+
"type": "integer",
|
|
68
|
+
"description": "Embedding vector dimensions for LanceDB."
|
|
69
|
+
},
|
|
70
|
+
"embedding_base_url": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"description": "Embedding provider base URL for LanceDB."
|
|
73
|
+
},
|
|
74
|
+
"storageOptions": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"description": "Optional LanceDB plugin storage options.",
|
|
77
|
+
"additionalProperties": true
|
|
78
|
+
},
|
|
79
|
+
"storage_endpoint": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"description": "S3-compatible storage endpoint URL. Mapped into storageOptions.endpoint."
|
|
82
|
+
},
|
|
83
|
+
"storage_region": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"description": "S3-compatible storage region. Mapped into storageOptions.region."
|
|
86
|
+
},
|
|
87
|
+
"storage_bucket": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"description": "S3-compatible storage bucket. Mapped into storageOptions.bucket."
|
|
90
|
+
},
|
|
91
|
+
"storage_prefix": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"description": "S3-compatible storage key prefix. Mapped into storageOptions.prefix."
|
|
94
|
+
},
|
|
95
|
+
"storage_access_key_id": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"description": "S3-compatible storage access key id. Mapped into storageOptions.accessKeyId."
|
|
98
|
+
},
|
|
99
|
+
"storage_secret_access_key": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"description": "S3-compatible storage secret access key. Mapped into storageOptions.secretAccessKey."
|
|
102
|
+
},
|
|
103
|
+
"storage_allow_http": {
|
|
104
|
+
"type": ["boolean", "string"],
|
|
105
|
+
"description": "Allow plain HTTP for S3-compatible storage. Mapped into storageOptions.allowHttp as a string (\"true\"/\"false\")."
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"secrets_env": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"description": "Environment variable names for secrets. Values are env var names, not actual secrets.",
|
|
112
|
+
"additionalProperties": {
|
|
113
|
+
"type": "string"
|
|
114
|
+
},
|
|
115
|
+
"properties": {
|
|
116
|
+
"api_key": {
|
|
117
|
+
"type": "string",
|
|
118
|
+
"description": "Environment variable name for API key (e.g., 'MEM0_API_KEY')."
|
|
119
|
+
},
|
|
120
|
+
"memory_id": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"description": "Environment variable name for memory ID (e.g., 'MEM0_MEMORY_ID')."
|
|
123
|
+
},
|
|
124
|
+
"embedding_api_key": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"description": "Reserved for future LanceDB embedding secrets."
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"allOf": [
|
|
132
|
+
{
|
|
133
|
+
"if": {
|
|
134
|
+
"properties": {
|
|
135
|
+
"backend_type": { "const": "mem0" }
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"then": {
|
|
139
|
+
"required": ["config"],
|
|
140
|
+
"properties": {
|
|
141
|
+
"config": {
|
|
142
|
+
"required": ["mem0_instance_id"]
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Workspace files module shared across bundled runtimes."""
|
|
2
|
+
|
|
3
|
+
from ksadk_runtime_common.workspace_files.bootstrap import (
|
|
4
|
+
build_workspace_files_bootstrap,
|
|
5
|
+
workspace_files_enabled,
|
|
6
|
+
workspace_files_max_upload_bytes,
|
|
7
|
+
workspace_files_root_label,
|
|
8
|
+
)
|
|
9
|
+
from ksadk_runtime_common.workspace_files.constants import (
|
|
10
|
+
DEFAULT_WORKSPACE_MAX_UPLOAD_BYTES,
|
|
11
|
+
WORKSPACE_CONTENT_PATH,
|
|
12
|
+
WORKSPACE_ENTRY_ACTION,
|
|
13
|
+
WORKSPACE_PATH_ESCAPE_DETAIL,
|
|
14
|
+
WORKSPACE_UPLOAD_ACTION,
|
|
15
|
+
)
|
|
16
|
+
from ksadk_runtime_common.workspace_files.router import create_workspace_files_router
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"create_workspace_files_router",
|
|
20
|
+
"build_workspace_files_bootstrap",
|
|
21
|
+
"workspace_files_enabled",
|
|
22
|
+
"workspace_files_root_label",
|
|
23
|
+
"workspace_files_max_upload_bytes",
|
|
24
|
+
"DEFAULT_WORKSPACE_MAX_UPLOAD_BYTES",
|
|
25
|
+
"WORKSPACE_PATH_ESCAPE_DETAIL",
|
|
26
|
+
"WORKSPACE_ENTRY_ACTION",
|
|
27
|
+
"WORKSPACE_UPLOAD_ACTION",
|
|
28
|
+
"WORKSPACE_CONTENT_PATH",
|
|
29
|
+
]
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""Workspace files bootstrap configuration builder."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
from ksadk_runtime_common.workspace_files.constants import (
|
|
8
|
+
DEFAULT_WORKSPACE_MAX_UPLOAD_BYTES,
|
|
9
|
+
WORKSPACE_CONTENT_PATH,
|
|
10
|
+
WORKSPACE_ENTRY_ACTION,
|
|
11
|
+
WORKSPACE_UPLOAD_ACTION,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _env_flag(name: str, default: bool) -> bool:
|
|
16
|
+
"""Parse boolean environment variable."""
|
|
17
|
+
raw = str(os.getenv(name, "")).strip().lower()
|
|
18
|
+
if not raw:
|
|
19
|
+
return default
|
|
20
|
+
return raw in {"1", "true", "yes", "on"}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def workspace_files_enabled(*, default: bool = True) -> bool:
|
|
24
|
+
"""Check if workspace files feature is enabled."""
|
|
25
|
+
return _env_flag("KSADK_WORKSPACE_FILES_ENABLED", default)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def workspace_files_root_label() -> str:
|
|
29
|
+
"""Get workspace root label for UI display."""
|
|
30
|
+
return str(os.getenv("KSADK_WORKSPACE_ROOT_LABEL") or "workspace").strip() or "workspace"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def workspace_files_max_upload_bytes() -> int:
|
|
34
|
+
"""Get max upload size in bytes."""
|
|
35
|
+
raw = str(os.getenv("KSADK_WORKSPACE_MAX_UPLOAD_BYTES") or "").strip()
|
|
36
|
+
if not raw:
|
|
37
|
+
return DEFAULT_WORKSPACE_MAX_UPLOAD_BYTES
|
|
38
|
+
try:
|
|
39
|
+
return max(int(raw), 1)
|
|
40
|
+
except ValueError:
|
|
41
|
+
return DEFAULT_WORKSPACE_MAX_UPLOAD_BYTES
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def build_workspace_files_bootstrap(*, enabled: bool) -> dict[str, bool | int | str] | None:
|
|
45
|
+
"""Build bootstrap configuration for workspace files."""
|
|
46
|
+
if not enabled:
|
|
47
|
+
return None
|
|
48
|
+
return {
|
|
49
|
+
"Enabled": True,
|
|
50
|
+
"MaxUploadBytes": workspace_files_max_upload_bytes(),
|
|
51
|
+
"SupportsDelete": True,
|
|
52
|
+
"RootLabel": workspace_files_root_label(),
|
|
53
|
+
"EntryAction": WORKSPACE_ENTRY_ACTION,
|
|
54
|
+
"UploadAction": WORKSPACE_UPLOAD_ACTION,
|
|
55
|
+
"ContentPath": WORKSPACE_CONTENT_PATH,
|
|
56
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Workspace files constants - preserves the existing contract exactly."""
|
|
2
|
+
|
|
3
|
+
DEFAULT_WORKSPACE_MAX_UPLOAD_BYTES = 100 * 1024 * 1024
|
|
4
|
+
|
|
5
|
+
WORKSPACE_PATH_ESCAPE_DETAIL = "workspace path escapes the workspace root"
|
|
6
|
+
|
|
7
|
+
WORKSPACE_ENTRY_ACTION = "ListWorkspaceFiles"
|
|
8
|
+
WORKSPACE_UPLOAD_ACTION = "AddWorkspaceFile"
|
|
9
|
+
WORKSPACE_CONTENT_PATH = "/agentengine/api/v1/GetWorkspaceFileContent"
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""Workspace files path utilities and security helpers."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import posixpath
|
|
7
|
+
import re
|
|
8
|
+
from collections.abc import Callable
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from fastapi import HTTPException
|
|
12
|
+
|
|
13
|
+
from ksadk_runtime_common.workspace_files.constants import WORKSPACE_PATH_ESCAPE_DETAIL
|
|
14
|
+
|
|
15
|
+
_SAFE_WORKSPACE_SEGMENT_RE = re.compile(r"^[^/\x00]+$")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _env_flag(name: str, default: bool) -> bool:
|
|
19
|
+
"""Parse boolean environment variable."""
|
|
20
|
+
raw = str(os.getenv(name, "")).strip().lower()
|
|
21
|
+
if not raw:
|
|
22
|
+
return default
|
|
23
|
+
return raw in {"1", "true", "yes", "on"}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _normalize_workspace_path(raw_path: str | None, *, allow_root: bool) -> str:
|
|
27
|
+
"""Normalize and validate a workspace path."""
|
|
28
|
+
raw = str(raw_path or ".").strip().replace("\\", "/")
|
|
29
|
+
if raw in {"", "."}:
|
|
30
|
+
if allow_root:
|
|
31
|
+
return "."
|
|
32
|
+
raise HTTPException(status_code=400, detail="workspace file path must not be empty")
|
|
33
|
+
if raw.startswith("/"):
|
|
34
|
+
raise HTTPException(status_code=400, detail=WORKSPACE_PATH_ESCAPE_DETAIL)
|
|
35
|
+
|
|
36
|
+
normalized = posixpath.normpath(raw)
|
|
37
|
+
if normalized in {"", "."}:
|
|
38
|
+
if allow_root:
|
|
39
|
+
return "."
|
|
40
|
+
raise HTTPException(status_code=400, detail="workspace file path must not be empty")
|
|
41
|
+
if normalized == ".." or normalized.startswith("../"):
|
|
42
|
+
raise HTTPException(status_code=400, detail=WORKSPACE_PATH_ESCAPE_DETAIL)
|
|
43
|
+
return normalized
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _resolve_workspace_root(root_getter: Callable[[], Path]) -> Path:
|
|
47
|
+
"""Resolve and create the workspace root directory."""
|
|
48
|
+
root = Path(root_getter()).expanduser().resolve()
|
|
49
|
+
root.mkdir(parents=True, exist_ok=True)
|
|
50
|
+
return root
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _resolve_workspace_target(
|
|
54
|
+
root: Path, raw_path: str | None, *, allow_root: bool
|
|
55
|
+
) -> tuple[str, Path]:
|
|
56
|
+
"""Resolve a path within the workspace root with an escape check."""
|
|
57
|
+
normalized = _normalize_workspace_path(raw_path, allow_root=allow_root)
|
|
58
|
+
if normalized == ".":
|
|
59
|
+
target = root
|
|
60
|
+
else:
|
|
61
|
+
segments = tuple(part for part in normalized.split("/") if part)
|
|
62
|
+
if not segments or any(
|
|
63
|
+
part in {".", ".."} or not _SAFE_WORKSPACE_SEGMENT_RE.fullmatch(part)
|
|
64
|
+
for part in segments
|
|
65
|
+
):
|
|
66
|
+
raise HTTPException(status_code=400, detail=WORKSPACE_PATH_ESCAPE_DETAIL)
|
|
67
|
+
target = root.joinpath(*segments)
|
|
68
|
+
resolved_target = target.resolve(strict=False)
|
|
69
|
+
if resolved_target != root and root not in resolved_target.parents:
|
|
70
|
+
raise HTTPException(status_code=400, detail=WORKSPACE_PATH_ESCAPE_DETAIL)
|
|
71
|
+
return normalized, resolved_target
|