agentengine-sdk-python 0.8.3__py3-none-any.whl → 0.8.4__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.8.3.dist-info → agentengine_sdk_python-0.8.4.dist-info}/METADATA +9 -8
- {agentengine_sdk_python-0.8.3.dist-info → agentengine_sdk_python-0.8.4.dist-info}/RECORD +482 -245
- ksadk/_build_provenance.json +1 -1
- ksadk/api/client.py +105 -91
- ksadk/builders/code_builder.py +36 -9
- ksadk/builders/framework_requirements.py +2 -1
- ksadk/builders/ks3_uploader.py +36 -7
- ksadk/builders/managed_runtime_builder.py +1 -0
- ksadk/cli/__init__.py +32 -3
- ksadk/cli/cmd_managed_runtime.py +13 -1
- ksadk/cli/cmd_plugin.py +6 -1
- ksadk/cli/cmd_web.py +2 -5
- ksadk/cli/runtime_bootstrap.py +23 -1
- ksadk/codex/client.py +424 -96
- ksadk/codex/projection.py +24 -0
- ksadk/codex/runtime.py +56 -298
- ksadk/common/auth.py +16 -10
- ksadk/configs/env_registry.py +29 -1
- ksadk/conversations/message_projection.py +135 -14
- ksadk/conversations/projector.py +4 -6
- ksadk/conversations/runtime_invocation.py +5 -0
- ksadk/conversations/runtime_payloads.py +1 -0
- ksadk/conversations/runtime_preparation.py +30 -27
- ksadk/conversations/runtime_resume.py +50 -2
- ksadk/conversations/runtime_stream_events.py +5 -0
- ksadk/conversations/runtime_streaming.py +25 -7
- ksadk/deployment/env_forward.py +2 -2
- ksadk/deployment/providers/serverless.py +1 -1
- ksadk/events/adapters/_codex_validators.py +18 -7
- ksadk/events/adapters/langgraph.py +15 -1
- ksadk/events/canonical_store.py +3 -1
- ksadk/events/projections.py +1 -1
- ksadk/harness/config.py +2 -2
- ksadk/harness/runtime.py +27 -27
- ksadk/harness/tools.py +38 -13
- ksadk/interaction/provider.py +1 -0
- ksadk/interaction/providers/langgraph.py +1 -0
- ksadk/kernel/bootstrap.py +28 -4
- ksadk/kernel/ingress.py +15 -2
- ksadk/kernel/sqlite_store.py +27 -0
- ksadk/kernel/store.py +3 -0
- ksadk/kernel/worker.py +65 -10
- ksadk/knowledge_base/client.py +57 -27
- ksadk/mcp_runtime/__init__.py +12 -4
- ksadk/memory/adk/backends/sdk_ltm_backend.py +161 -41
- ksadk/memory/adk/resilient_session_service.py +25 -17
- ksadk/memory/adk/short_term_memory.py +26 -9
- ksadk/memory/models.py +7 -4
- ksadk/memory/provider_resolver.py +3 -0
- ksadk/model_proxy/server.py +10 -5
- ksadk/plugins/__init__.py +4 -0
- ksadk/plugins/artifacts.py +275 -0
- ksadk/plugins/bridges/__init__.py +4 -2
- ksadk/plugins/bridges/codex.py +120 -13
- ksadk/plugins/bridges/dsh.py +340 -156
- ksadk/plugins/builtins.py +35 -36
- ksadk/plugins/bundle_security.py +28 -4
- ksadk/plugins/codex_manifest.py +983 -0
- ksadk/plugins/composition.py +8 -0
- ksadk/plugins/contracts.py +118 -0
- ksadk/plugins/delivery.py +153 -0
- ksadk/plugins/dsh_installation_digest.py +71 -0
- ksadk/plugins/dsh_toolchain.py +110 -21
- ksadk/plugins/ecosystem_probe.py +6 -6
- ksadk/plugins/host.py +102 -39
- ksadk/plugins/kernel_adapter.py +205 -0
- ksadk/plugins/providers/__init__.py +23 -0
- ksadk/plugins/providers/bundles/dsh-knowledge/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-knowledge/index.mjs +53 -0
- ksadk/plugins/providers/bundles/dsh-knowledge/package.json +16 -0
- ksadk/plugins/providers/bundles/dsh-memory/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-memory/index.mjs +175 -0
- ksadk/plugins/providers/bundles/dsh-memory/package.json +16 -0
- ksadk/plugins/providers/bundles/dsh-platform-resources/client.mjs +166 -0
- ksadk/plugins/providers/bundles/dsh-platform-resources/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-platform-resources/index.mjs +9 -0
- ksadk/plugins/providers/bundles/dsh-platform-resources/package.json +12 -0
- ksadk/plugins/providers/bundles/dsh-skill-center/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-skill-center/index.mjs +125 -0
- ksadk/plugins/providers/bundles/dsh-skill-center/package.json +16 -0
- ksadk/plugins/providers/bundles/ksadk-dsh-capability-host/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/ksadk-dsh-capability-host/index.mjs +870 -0
- ksadk/plugins/providers/bundles/ksadk-dsh-capability-host/package.json +27 -0
- ksadk/plugins/providers/bundles/ksadk-dsh-studio/client.js +92 -0
- ksadk/plugins/providers/bundles/ksadk-dsh-studio/index.mjs +15 -0
- ksadk/plugins/providers/bundles/ksadk-dsh-studio/package.json +7 -0
- ksadk/plugins/providers/codex.py +335 -69
- ksadk/plugins/providers/codex_native.py +368 -0
- ksadk/plugins/providers/codex_turn.py +301 -0
- ksadk/plugins/providers/dsh_capabilities.py +1389 -0
- ksadk/plugins/providers/dsh_mcp.py +467 -0
- ksadk/plugins/providers/harness.py +118 -113
- ksadk/plugins/providers/mcp_projection.py +150 -0
- ksadk/plugins/providers/platform_resources.py +657 -0
- ksadk/plugins/resolver.py +8 -1
- ksadk/resource_runtime/__init__.py +4 -0
- ksadk/resource_runtime/broker.py +616 -0
- ksadk/resource_runtime/build_artifacts.py +165 -0
- ksadk/resource_runtime/contracts.py +138 -0
- ksadk/resource_runtime/discovery_receipts.py +100 -0
- ksadk/resource_runtime/discovery_skills.py +172 -0
- ksadk/resource_runtime/errors.py +6 -0
- ksadk/resource_runtime/ipc.py +142 -0
- ksadk/resource_runtime/kernel_approval.py +165 -0
- ksadk/resource_runtime/knowledge.py +114 -0
- ksadk/resource_runtime/langgraph.py +94 -0
- ksadk/resource_runtime/leases.py +191 -0
- ksadk/resource_runtime/managed_projection.py +186 -0
- ksadk/resource_runtime/mcp_server.py +138 -0
- ksadk/resource_runtime/memory_provider.py +318 -0
- ksadk/resource_runtime/memory_receipts.py +34 -0
- ksadk/resource_runtime/operation_ledger.py +211 -0
- ksadk/resource_runtime/plugin_config.py +48 -0
- ksadk/resource_runtime/policy_authorization.py +54 -0
- ksadk/resource_runtime/process.py +110 -0
- ksadk/resource_runtime/skill_artifacts.py +153 -0
- ksadk/resource_runtime/skill_runtime.py +42 -0
- ksadk/resource_runtime/skill_workspace.py +118 -0
- ksadk/resource_runtime/skills.py +215 -0
- ksadk/resource_runtime/snapshots.py +180 -0
- ksadk/resource_runtime/socket_server.py +103 -0
- ksadk/resource_runtime/supervisor.py +380 -0
- ksadk/resource_runtime/worker.py +504 -0
- ksadk/runners/_langgraph_runner_streams.py +74 -6
- ksadk/runners/adk_runner.py +149 -11
- ksadk/runners/base_runner.py +29 -1
- ksadk/runners/langgraph_runner.py +475 -145
- ksadk/runtime/_runner_adapter/stream_mapping.py +142 -18
- ksadk/runtime/adapter.py +2 -0
- ksadk/runtime/conversation_execution.py +92 -16
- ksadk/runtime/executor.py +78 -2
- ksadk/runtime/factory.py +29 -273
- ksadk/runtime/framework_adapters.py +23 -0
- ksadk/runtime/preprocessing.py +10 -2
- ksadk/runtime/runner_adapter.py +73 -14
- ksadk/runtime_context.py +40 -2
- ksadk/sandbox/backends/e2b.py +52 -11
- ksadk/sandbox/backends/local_process.py +9 -0
- ksadk/sandbox/base.py +2 -0
- ksadk/sandbox/e2b_connection.py +66 -0
- ksadk/scheduler/sqlite_store.py +18 -0
- ksadk/server/composition.py +2 -0
- ksadk/server/factory.py +5 -0
- ksadk/server/persistence_capability.py +516 -0
- ksadk/server/routes/control.py +210 -46
- ksadk/server/routes/dependencies.py +15 -0
- ksadk/server/routes/models.py +47 -4
- ksadk/server/routes/projection.py +252 -12
- ksadk/server/routes/sessions.py +284 -107
- ksadk/server/routes/streaming.py +43 -9
- ksadk/server/static/assets/{ArtifactsPanel-10GPXIJ6.js → ArtifactsPanel-CGbWlMNh.js} +1 -1
- ksadk/server/static/assets/{CodeBlock-BXk1l-G1.js → CodeBlock-b4C7upmO.js} +3 -3
- ksadk/server/static/assets/{MathMessageMarkdown-D9uB55Oh.js → MathMessageMarkdown-DbdW5A4_.js} +4 -4
- ksadk/server/static/assets/{MermaidBlock--OEYoXIJ.js → MermaidBlock-BEBN4Ksz.js} +6 -6
- ksadk/server/static/assets/{NativeTerminalPanel-DrEe1syq.js → NativeTerminalPanel-zvL-WpAn.js} +1 -1
- ksadk/server/static/assets/{abnfDiagram-VCTEODGH-eeTFJLvo.js → abnfDiagram-VCTEODGH-BYafW7Za.js} +1 -1
- ksadk/server/static/assets/{arc-S3ZNbIAd.js → arc-bTohInsS.js} +1 -1
- ksadk/server/static/assets/architecture-7GRP2DOG-BW5UtSnx.js +1 -0
- ksadk/server/static/assets/{architectureDiagram-5GKGNRK7-CRjgEJDX.js → architectureDiagram-5GKGNRK7-Ch5Lbzsi.js} +1 -1
- ksadk/server/static/assets/{blockDiagram-NRAW4CY4-C7bsBoNH.js → blockDiagram-NRAW4CY4-kqF4MDOG.js} +1 -1
- ksadk/server/static/assets/{c4Diagram-UCG6FXSJ-BX3c33Ob.js → c4Diagram-UCG6FXSJ-8uSRIODv.js} +1 -1
- ksadk/server/static/assets/channel-CF5Up3hQ.js +1 -0
- ksadk/server/static/assets/chunk-2Q5K7J3B-KkXX47WI.js +1 -0
- ksadk/server/static/assets/{chunk-5VM5RSS4-bZ7ws-8m.js → chunk-5VM5RSS4-DkhehZDr.js} +1 -1
- ksadk/server/static/assets/{chunk-F27PBJKO-D2r0pvhY.js → chunk-F27PBJKO-BdXhtPe9.js} +1 -1
- ksadk/server/static/assets/{chunk-G27WJ6UU-CZwF3oUP.js → chunk-G27WJ6UU-DPTpvpwi.js} +1 -1
- ksadk/server/static/assets/{chunk-JWPE2WC7-DigFYCML.js → chunk-JWPE2WC7-Pqoh38el.js} +1 -1
- ksadk/server/static/assets/{chunk-LCL6LL3I-CnorGV5q.js → chunk-LCL6LL3I-DeU00qC-.js} +1 -1
- ksadk/server/static/assets/{chunk-POPQ4Y6H-CexntQA-.js → chunk-POPQ4Y6H-CzxScFkr.js} +1 -1
- ksadk/server/static/assets/{chunk-RHFEMEQ7-CHTC7UxA.js → chunk-RHFEMEQ7-DpqMx-ux.js} +1 -1
- ksadk/server/static/assets/{chunk-SVP7TREG-BC1EWt_-.js → chunk-SVP7TREG-C6t0SypQ.js} +1 -1
- ksadk/server/static/assets/{chunk-XXDRQBXY-BTG24xN0.js → chunk-XXDRQBXY-DVaeafZk.js} +1 -1
- ksadk/server/static/assets/classDiagram-DTDB5LWJ-Cz81acRQ.js +1 -0
- ksadk/server/static/assets/classDiagram-v2-JRS7N3AN-Cz81acRQ.js +1 -0
- ksadk/server/static/assets/{cose-bilkent-JH36ORCC-CkonRdAS.js → cose-bilkent-JH36ORCC-Bf9D3tzJ.js} +1 -1
- ksadk/server/static/assets/cynefin-OW5HDTMX-DVWs8a2t.js +1 -0
- ksadk/server/static/assets/{cynefinDiagram-5FMLGOSQ-DEOCBe15.js → cynefinDiagram-5FMLGOSQ-B9cY3iTz.js} +1 -1
- ksadk/server/static/assets/{dagre-3AP2YEHR-DBThPuLa.js → dagre-3AP2YEHR-CSwlx3CB.js} +1 -1
- ksadk/server/static/assets/{dagre-ClTPrTht.js → dagre-UBpgon5q.js} +1 -1
- ksadk/server/static/assets/{diagram-S7CK7UJ4-DsZHrnpJ.js → diagram-S7CK7UJ4-C9akhN9a.js} +1 -1
- ksadk/server/static/assets/{diagram-UQ7AKVKN-BJR4nhVr.js → diagram-UQ7AKVKN-CgedhTPI.js} +1 -1
- ksadk/server/static/assets/{diagram-VSXAHHWV-xzcERX0a.js → diagram-VSXAHHWV-Cjucz5BY.js} +1 -1
- ksadk/server/static/assets/{diagram-VX7I27RA-tn2xM1xu.js → diagram-VX7I27RA-Dd4Vleyn.js} +1 -1
- ksadk/server/static/assets/{diagram-Z3DM3KII-BZPGBkw5.js → diagram-Z3DM3KII-CZ2jGtYW.js} +1 -1
- ksadk/server/static/assets/{dist-DdRBIceA.js → dist-B2_CVgKv.js} +1 -1
- ksadk/server/static/assets/{dist-Cq4OL6nO.js → dist-B3FR1SKK.js} +1 -1
- ksadk/server/static/assets/{dist-M67Hwu0n.js → dist-BIr4DSRq.js} +1 -1
- ksadk/server/static/assets/{dist-B1oWRmrH.js → dist-BgV_owcB.js} +1 -1
- ksadk/server/static/assets/{dist-DyqV4fL4.js → dist-Bj730Ib4.js} +1 -1
- ksadk/server/static/assets/{dist-DfGFrb0v.js → dist-BnaTiyzN.js} +1 -1
- ksadk/server/static/assets/{dist-C71CsujO.js → dist-C1NMAY5a.js} +1 -1
- ksadk/server/static/assets/{dist-CXpH_Rdd.js → dist-C5_ZAZsG.js} +1 -1
- ksadk/server/static/assets/{dist-DJmCPRVB.js → dist-CB9iJrvg.js} +1 -1
- ksadk/server/static/assets/{dist-DjhwGUgZ.js → dist-CFzsn6BG.js} +1 -1
- ksadk/server/static/assets/{dist-BI1qQH4n.js → dist-Cf125P_m.js} +1 -1
- ksadk/server/static/assets/{dist-8VWI-2bZ.js → dist-ClYUxfeK.js} +1 -1
- ksadk/server/static/assets/{dist-DUwKa_l6.js → dist-DFD6Qa6T.js} +1 -1
- ksadk/server/static/assets/{dist-B-46q3Hk.js → dist-DVCOWtha.js} +1 -1
- ksadk/server/static/assets/{dist-BJLUwH6W.js → dist-D_ctSS2i.js} +1 -1
- ksadk/server/static/assets/{dist-4zN1_tq5.js → dist-DiixqL0J.js} +1 -1
- ksadk/server/static/assets/{dist-B0gdk4rl.js → dist-DoVSwoDb.js} +1 -1
- ksadk/server/static/assets/{dist-Bbwqa8TG.js → dist-DvFK7p5S.js} +1 -1
- ksadk/server/static/assets/{dist-D1V3f1B4.js → dist-QfkEHOlb.js} +1 -1
- ksadk/server/static/assets/{dist-Btyo4vX4.js → dist-btbmmX5O.js} +1 -1
- ksadk/server/static/assets/{dist-u8tVH5Ak.js → dist-fBO2v5Kt.js} +1 -1
- ksadk/server/static/assets/{dist-DQAB0qn_.js → dist-ufY3F5p6.js} +1 -1
- ksadk/server/static/assets/{ebnfDiagram-PWID7BFC-DVfMsLge.js → ebnfDiagram-PWID7BFC-Ci8NqqZu.js} +1 -1
- ksadk/server/static/assets/{erDiagram-SSCWMZ5O-CWEZSYaw.js → erDiagram-SSCWMZ5O-CCIOhLZG.js} +1 -1
- ksadk/server/static/assets/eventmodeling-NTZA5JFV-CQqR2hg3.js +1 -0
- ksadk/server/static/assets/flowDiagram-A5DVABFB-DDRRbGPm.js +1 -0
- ksadk/server/static/assets/{ganttDiagram-EL5Y4UJY-TWIxoyYL.js → ganttDiagram-EL5Y4UJY-Cp_r9Hb6.js} +1 -1
- ksadk/server/static/assets/gitGraph-4MIJSDKK-fgWEf7UD.js +1 -0
- ksadk/server/static/assets/{gitGraphDiagram-WWUBYQGX-DDh2hd2S.js → gitGraphDiagram-WWUBYQGX-Dlhc8Wr8.js} +1 -1
- ksadk/server/static/assets/index-DcTML1Up.css +2 -0
- ksadk/server/static/assets/index-Dh2XHqPK.js +244 -0
- ksadk/server/static/assets/info-A6RAGUB7-BUecLTdt.js +1 -0
- ksadk/server/static/assets/{infoDiagram-RXCK75RN-CgoyWiDR.js → infoDiagram-RXCK75RN-CO0rRTRA.js} +1 -1
- ksadk/server/static/assets/{ishikawaDiagram-5VMMS53U-CyRIu_om.js → ishikawaDiagram-5VMMS53U-CHiaedSS.js} +1 -1
- ksadk/server/static/assets/{journeyDiagram-EYS64GPL-DN5JXHzN.js → journeyDiagram-EYS64GPL-CHcCIB09.js} +1 -1
- ksadk/server/static/assets/{kanban-definition-3QL26DDD-CNP3ui66.js → kanban-definition-3QL26DDD-CJ_ebBZf.js} +1 -1
- ksadk/server/static/assets/{katex-DWEzQy1d.js → katex-B4weu383.js} +1 -1
- ksadk/server/static/assets/{linear-C-qHp7d2.js → linear-V-MgYHW1.js} +1 -1
- ksadk/server/static/assets/{mermaid-parser.core-Cl-K943T.js → mermaid-parser.core-CBijEX_c.js} +2 -2
- ksadk/server/static/assets/{mindmap-definition-FBJOCRG2-D5DB5mYm.js → mindmap-definition-FBJOCRG2-Bc-pQvpp.js} +1 -1
- ksadk/server/static/assets/packet-AYTQ26CC-BeW-btFv.js +1 -0
- ksadk/server/static/assets/{pegDiagram-XKGWAZYB-BQVc9ia_.js → pegDiagram-XKGWAZYB-D7genGLl.js} +1 -1
- ksadk/server/static/assets/pie-WAS4IAKB-X0xh4SaT.js +1 -0
- ksadk/server/static/assets/{pieDiagram-E7YTZNPT-B6UCAvtY.js → pieDiagram-E7YTZNPT-Bxj32zwD.js} +1 -1
- ksadk/server/static/assets/{quadrantDiagram-AXDQQJYC-mIr2d3eb.js → quadrantDiagram-AXDQQJYC-BURv2mGh.js} +1 -1
- ksadk/server/static/assets/radar-RG4KPBEZ-DzRMSqjd.js +1 -0
- ksadk/server/static/assets/railroad-74A4TZTK-Cc44icX-.js +1 -0
- ksadk/server/static/assets/railroad-abnf-HS5TGJTU-D6S4BdV-.js +1 -0
- ksadk/server/static/assets/railroad-ebnf-LZEXJU2U-vD3aVE2o.js +1 -0
- ksadk/server/static/assets/railroad-peg-WCYAUIDC-CYbW_b4T.js +1 -0
- ksadk/server/static/assets/{railroadDiagram-O6MQD6OU-Dt3FFDmK.js → railroadDiagram-O6MQD6OU-CCsh3avW.js} +1 -1
- ksadk/server/static/assets/{requirementDiagram-EFPCY7ZU-Cz_vQtgF.js → requirementDiagram-EFPCY7ZU-_FRRBKEd.js} +1 -1
- ksadk/server/static/assets/{sankeyDiagram-P5KCCOFB-wlO1TsH5.js → sankeyDiagram-P5KCCOFB-C-gr2o9M.js} +1 -1
- ksadk/server/static/assets/{sequenceDiagram-WJ2MYXX4-CHRbElYq.js → sequenceDiagram-WJ2MYXX4-D97NmfKg.js} +1 -1
- ksadk/server/static/assets/{sizeCapture-X5ZJPWSS-DXX54iyO.js → sizeCapture-X5ZJPWSS-DjrPC5FX.js} +1 -1
- ksadk/server/static/assets/{stateDiagram-HBIQ2CUA-Dp_lw9II.js → stateDiagram-HBIQ2CUA-DzMNg1hh.js} +1 -1
- ksadk/server/static/assets/stateDiagram-v2-4QOOHH4V-BIcjKFhF.js +1 -0
- ksadk/server/static/assets/{swimlanes-XN3QIQJK-D8O5UlLG.js → swimlanes-XN3QIQJK-Cssf_CsU.js} +1 -1
- ksadk/server/static/assets/swimlanesDiagram-VK2B7HYN-tq3K3Ybl.js +8 -0
- ksadk/server/static/assets/{timeline-definition-24CTP7MA-8mfKcxvG.js → timeline-definition-24CTP7MA-BWTHzyS1.js} +1 -1
- ksadk/server/static/assets/treeView-Q6P3EWNA-DBXt3GdU.js +1 -0
- ksadk/server/static/assets/treemap-WGGIJYW6-DrCy4E_l.js +1 -0
- ksadk/server/static/assets/{vennDiagram-4TSXK5OY-EnNl0DE7.js → vennDiagram-4TSXK5OY-BSKgJsmR.js} +1 -1
- ksadk/server/static/assets/wardley-WFR3VGLG-CefhOliM.js +1 -0
- ksadk/server/static/assets/{wardleyDiagram-VM6X3IG4-DBu5fbYr.js → wardleyDiagram-VM6X3IG4-eflHNoaZ.js} +1 -1
- ksadk/server/static/assets/{xychartDiagram-S5SC5T6Z-BSVXs4IY.js → xychartDiagram-S5SC5T6Z-eYqrQ-v4.js} +1 -1
- ksadk/server/static/index.html +2 -2
- ksadk/session_context.py +66 -0
- ksadk/sessions/__init__.py +11 -21
- ksadk/sessions/_local_service_sync.py +263 -1
- ksadk/sessions/base.py +176 -0
- ksadk/sessions/errors.py +4 -0
- ksadk/sessions/in_memory.py +309 -19
- ksadk/sessions/local_service.py +83 -1
- ksadk/sessions/persistence.py +275 -0
- ksadk/sessions/postgres_service.py +358 -0
- ksadk/sessions/resilience.py +8 -0
- ksadk/sessions/resilient.py +362 -4
- ksadk/sessions/topology.py +135 -0
- ksadk/skills/models.py +26 -4
- ksadk/skills/package_store.py +186 -38
- ksadk/skills/runtime/agent.py +31 -6
- ksadk/skills/runtime/artifact_delivery.py +139 -0
- ksadk/skills/runtime/backends/e2b.py +98 -6
- ksadk/skills/runtime/backends/local.py +73 -8
- ksadk/skills/runtime/base.py +3 -0
- ksadk/skills/runtime/executor.py +2 -0
- ksadk/skills/runtime/loader.py +10 -2
- ksadk/skills/runtime/pinned.py +114 -0
- ksadk/skills/runtime/request.py +31 -0
- ksadk/skills/service_client.py +167 -28
- ksadk/studio/api.py +224 -42
- ksadk/studio/api_catalog_routes.py +18 -0
- ksadk/studio/api_plugin_routes.py +526 -95
- ksadk/studio/api_resource_connections.py +183 -0
- ksadk/studio/authoring_coordinator.py +19 -14
- ksadk/studio/builder.py +76 -0
- ksadk/studio/cloud.py +342 -104
- ksadk/studio/cloud_shared_web.py +565 -0
- ksadk/studio/codex_agent_service.py +128 -26
- ksadk/studio/codex_builder.py +241 -2
- ksadk/studio/codex_credentials.py +90 -0
- ksadk/studio/codex_manifest.py +31 -4
- ksadk/studio/codex_plugin_store.py +746 -0
- ksadk/studio/codex_provider_build.py +231 -0
- ksadk/studio/codex_run.py +184 -25
- ksadk/studio/compatibility_report.py +12 -1
- ksadk/studio/compiler.py +78 -14
- ksadk/studio/contracts.py +132 -6
- ksadk/studio/dsh_application.py +137 -0
- ksadk/studio/dsh_capability_service.py +1107 -0
- ksadk/studio/dsh_models.py +59 -0
- ksadk/studio/dsh_provider_registration.py +320 -13
- ksadk/studio/hosted_kernel.py +88 -13
- ksadk/studio/mcp_runtime.py +11 -3
- ksadk/studio/model_client.py +2 -2
- ksadk/studio/plugin_composition.py +190 -23
- ksadk/studio/plugin_kernel_adapter.py +12 -112
- ksadk/studio/plugin_runtime.py +224 -45
- ksadk/studio/resource_authority.py +637 -0
- ksadk/studio/resource_binding_validation.py +77 -0
- ksadk/studio/resource_build_admission.py +196 -0
- ksadk/studio/resource_build_materializer.py +149 -0
- ksadk/studio/resource_catalog.py +143 -2
- ksadk/studio/resource_connections.py +220 -0
- ksadk/studio/run_service.py +462 -52
- ksadk/studio/runtime_source.py +15 -7
- ksadk/studio/scheduler_assistant.py +317 -0
- ksadk/studio/scheduler_runtime.py +9 -0
- ksadk/studio/scheduler_service.py +3 -0
- ksadk/studio/service.py +490 -44
- ksadk/studio/shared_web.py +446 -62
- ksadk/studio/static/assets/CodeBlock-DCUUY0PL-BLjA7kbS.js +41 -0
- ksadk/studio/static/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- ksadk/studio/static/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- ksadk/studio/static/assets/MathMessageMarkdown-CBcDrAw--BEOyPC3w.css +1 -0
- ksadk/studio/static/assets/MathMessageMarkdown-CBcDrAw--CUYIXwgI.js +8 -0
- ksadk/studio/static/assets/MermaidBlock-DBFTztfQ-BTYKWEbD.js +44 -0
- ksadk/studio/static/assets/PrismRenderer-wiXRHURw.js +3 -0
- ksadk/studio/static/assets/abnfDiagram-VCTEODGH-CLETGjKq.js +1 -0
- ksadk/studio/static/assets/arc-Pry-7G1_.js +1 -0
- ksadk/studio/static/assets/architecture-7GRP2DOG-hXMiO_AU.js +1 -0
- ksadk/studio/static/assets/architectureDiagram-5GKGNRK7-B5EQysk6.js +36 -0
- ksadk/studio/static/assets/array-BifhSqXX.js +1 -0
- ksadk/studio/static/assets/blockDiagram-I7D4REHJ-CFmPl1de.js +129 -0
- ksadk/studio/static/assets/c4Diagram-7LVT6UL2-BRrGu8qt.js +38 -0
- ksadk/studio/static/assets/channel-BqO-gtEw.js +1 -0
- ksadk/studio/static/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- ksadk/studio/static/assets/chunk-4HAMMTFA-D220vUtq.js +62 -0
- ksadk/studio/static/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- ksadk/studio/static/assets/chunk-75Z2AOVW-C8lLv_qc.js +2 -0
- ksadk/studio/static/assets/chunk-DU6HZSFF-C4DtVpCu.js +128 -0
- ksadk/studio/static/assets/chunk-F27PBJKO-Cpw14SNG.js +1 -0
- ksadk/studio/static/assets/chunk-FOHPRMQF-DHwB1DNv.js +161 -0
- ksadk/studio/static/assets/chunk-GMAD6QVW-DiQA-u2N.js +72 -0
- ksadk/studio/static/assets/chunk-GVQU2GXP-DUdNBUCi.js +1 -0
- ksadk/studio/static/assets/chunk-IMKFNOWR-BSlbjT_b.js +231 -0
- ksadk/studio/static/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- ksadk/studio/static/assets/chunk-L3NEJ4N5-Db8Ab22W.js +1 -0
- ksadk/studio/static/assets/chunk-OSK3NFVY-M2m6G3j4.js +10 -0
- ksadk/studio/static/assets/chunk-P2QGCYS3-DezaQxiK.js +1 -0
- ksadk/studio/static/assets/chunk-POPQ4Y6H-DOpufJ3t.js +1 -0
- ksadk/studio/static/assets/chunk-PWAF6VOD-CfLb1gSc.js +1 -0
- ksadk/studio/static/assets/chunk-SHT3W25Y-DAyIVp5H.js +168 -0
- ksadk/studio/static/assets/chunk-SVP7TREG-DulomOrS.js +88 -0
- ksadk/studio/static/assets/chunk-TICWLB2K-bHJYoflj.js +206 -0
- ksadk/studio/static/assets/chunk-XXDRQBXY-7PcdR2B1.js +1 -0
- ksadk/studio/static/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- ksadk/studio/static/assets/classDiagram-ZZMXUADV-D_bW8JjA.js +1 -0
- ksadk/studio/static/assets/classDiagram-v2-VYDZK3BY-D_bW8JjA.js +1 -0
- ksadk/studio/static/assets/cose-bilkent-JH36ORCC-snL88wkX.js +1 -0
- ksadk/studio/static/assets/cynefin-OW5HDTMX-Bd1YhRo1.js +1 -0
- ksadk/studio/static/assets/cynefinDiagram-5FMLGOSQ-BBrIG_mI.js +62 -0
- ksadk/studio/static/assets/cytoscape.esm-CGd-uY3x.js +321 -0
- ksadk/studio/static/assets/dagre-GXQ25YYZ-DtF1nGdY.js +4 -0
- ksadk/studio/static/assets/dagre-PrKaheQc.js +1 -0
- ksadk/studio/static/assets/defaultLocale-BFoDCU3G.js +1 -0
- ksadk/studio/static/assets/diagram-S7CK7UJ4-0BZ98mya.js +30 -0
- ksadk/studio/static/assets/diagram-UQ7AKVKN-6mLKEo6L.js +41 -0
- ksadk/studio/static/assets/diagram-VSXAHHWV-CJBIaiZ2.js +3 -0
- ksadk/studio/static/assets/diagram-VX7I27RA-BohLEE1C.js +24 -0
- ksadk/studio/static/assets/diagram-Z3DM3KII-D8KIGonG.js +24 -0
- ksadk/studio/static/assets/dist-v5Q1xZ2K.js +1 -0
- ksadk/studio/static/assets/ebnfDiagram-PWID7BFC-C99HU61t.js +1 -0
- ksadk/studio/static/assets/erDiagram-RLTQ6QDP-DLGry2Ap.js +99 -0
- ksadk/studio/static/assets/eventmodeling-NTZA5JFV-B1_5Ac8j.js +1 -0
- ksadk/studio/static/assets/flowDiagram-HODETNUW-DD5hmicn.js +1 -0
- ksadk/studio/static/assets/ganttDiagram-EL5Y4UJY-BPJrVLSG.js +292 -0
- ksadk/studio/static/assets/gitGraph-4MIJSDKK-Cy_ZQBGi.js +1 -0
- ksadk/studio/static/assets/gitGraphDiagram-WWUBYQGX-CZCUz4MT.js +106 -0
- ksadk/studio/static/assets/graphlib-DS17s2tU.js +1 -0
- ksadk/studio/static/assets/index-CeHL9ARV.css +2 -0
- ksadk/studio/static/assets/index-D9QEcVpL.js +320 -0
- ksadk/studio/static/assets/info-A6RAGUB7-DBzDQB_I.js +1 -0
- ksadk/studio/static/assets/infoDiagram-27XIBGKW-B-sq07Hi.js +2 -0
- ksadk/studio/static/assets/init-C-OQMol4.js +1 -0
- ksadk/studio/static/assets/ishikawaDiagram-5VMMS53U-CljI2wyf.js +70 -0
- ksadk/studio/static/assets/journeyDiagram-3NMN7TZE-D50Fo2sL.js +139 -0
- ksadk/studio/static/assets/kanban-definition-UXKFOSKX-DimfOTam.js +89 -0
- ksadk/studio/static/assets/katex-DhON-x74.js +257 -0
- ksadk/studio/static/assets/line-CX5BOOUP.js +1 -0
- ksadk/studio/static/assets/linear-BCxN9JLv.js +1 -0
- ksadk/studio/static/assets/mermaid-parser.core-BdCz8fkS.js +7 -0
- ksadk/studio/static/assets/mindmap-definition-YA3MSWOX-Bizzqy5R.js +96 -0
- ksadk/studio/static/assets/ordinal-BDEzSJ7C.js +1 -0
- ksadk/studio/static/assets/packet-AYTQ26CC-gPln-_kG.js +1 -0
- ksadk/studio/static/assets/path-fybaL0A-.js +1 -0
- ksadk/studio/static/assets/pegDiagram-XKGWAZYB-Dy3fB-gW.js +1 -0
- ksadk/studio/static/assets/pie-WAS4IAKB-qZdHMr7B.js +1 -0
- ksadk/studio/static/assets/pieDiagram-E7YTZNPT-B9mrFSDF.js +39 -0
- ksadk/studio/static/assets/quadrantDiagram-AXDQQJYC-NzUfCbMR.js +7 -0
- ksadk/studio/static/assets/radar-RG4KPBEZ-BZlnaea9.js +1 -0
- ksadk/studio/static/assets/railroad-74A4TZTK-Ce3__H9c.js +1 -0
- ksadk/studio/static/assets/railroad-abnf-HS5TGJTU-DqQn7EzD.js +1 -0
- ksadk/studio/static/assets/railroad-ebnf-LZEXJU2U-B55kCA8F.js +1 -0
- ksadk/studio/static/assets/railroad-peg-WCYAUIDC-DfQnvkHd.js +1 -0
- ksadk/studio/static/assets/railroadDiagram-O6MQD6OU-DnhMjZCk.js +1 -0
- ksadk/studio/static/assets/requirementDiagram-BXWQKSXE-BF3d103U.js +84 -0
- ksadk/studio/static/assets/rolldown-runtime-Dy4uBu1J-DK3Fl9T5.js +1 -0
- ksadk/studio/static/assets/rough.esm-Dy-Kn_BL.js +1 -0
- ksadk/studio/static/assets/sankeyDiagram-P5KCCOFB-Bo-JTwt0.js +40 -0
- ksadk/studio/static/assets/sequenceDiagram-WJ2MYXX4-Dh4wZtUm.js +162 -0
- ksadk/studio/static/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
- ksadk/studio/static/assets/src-SFn9St9H.js +1 -0
- ksadk/studio/static/assets/stateDiagram-D77RDMKH-DH774G6d.js +1 -0
- ksadk/studio/static/assets/stateDiagram-v2-MP3YSRHH-DZvVWPBo.js +1 -0
- ksadk/studio/static/assets/swimlanes-42K2YHIH-Bl13OvTX.js +1 -0
- ksadk/studio/static/assets/swimlanesDiagram-VR7AAH4N-BnFOTALJ.js +8 -0
- ksadk/studio/static/assets/timeline-definition-24CTP7MA-DxmSSjRB.js +120 -0
- ksadk/studio/static/assets/treeView-Q6P3EWNA-D5Nn9Swz.js +1 -0
- ksadk/studio/static/assets/treemap-WGGIJYW6-CgHgnQhE.js +1 -0
- ksadk/studio/static/assets/vennDiagram-4TSXK5OY-B9QEXcJq.js +34 -0
- ksadk/studio/static/assets/wardley-WFR3VGLG-DXrK2RRY.js +1 -0
- ksadk/studio/static/assets/wardleyDiagram-VM6X3IG4-Ba1AOWoe.js +78 -0
- ksadk/studio/static/assets/xychartDiagram-S5SC5T6Z-Cr5pt5Y-.js +7 -0
- ksadk/studio/static/index.html +2 -2
- ksadk/version.py +1 -1
- ksadk/server/static/assets/architecture-7GRP2DOG-Dk9nRQ6-.js +0 -1
- ksadk/server/static/assets/channel-s354Yo6o.js +0 -1
- ksadk/server/static/assets/chunk-2Q5K7J3B-CDpPpKR5.js +0 -1
- ksadk/server/static/assets/classDiagram-DTDB5LWJ-Dd0nucl9.js +0 -1
- ksadk/server/static/assets/classDiagram-v2-JRS7N3AN-Dd0nucl9.js +0 -1
- ksadk/server/static/assets/cynefin-OW5HDTMX-BBlT4uMf.js +0 -1
- ksadk/server/static/assets/eventmodeling-NTZA5JFV-Dr5okd8V.js +0 -1
- ksadk/server/static/assets/flowDiagram-A5DVABFB-VEO-cVcO.js +0 -1
- ksadk/server/static/assets/gitGraph-4MIJSDKK-CKiKY9Cf.js +0 -1
- ksadk/server/static/assets/index-B2k_urY8.js +0 -241
- ksadk/server/static/assets/index-ILPt6IWF.css +0 -2
- ksadk/server/static/assets/info-A6RAGUB7-ubA4Nm_p.js +0 -1
- ksadk/server/static/assets/packet-AYTQ26CC-C7R3NUlK.js +0 -1
- ksadk/server/static/assets/pie-WAS4IAKB-BIT6qjr3.js +0 -1
- ksadk/server/static/assets/radar-RG4KPBEZ-l5noef9X.js +0 -1
- ksadk/server/static/assets/railroad-74A4TZTK-Baea6ZvM.js +0 -1
- ksadk/server/static/assets/railroad-abnf-HS5TGJTU-OKn8zZnU.js +0 -1
- ksadk/server/static/assets/railroad-ebnf-LZEXJU2U-DdKAKC4l.js +0 -1
- ksadk/server/static/assets/railroad-peg-WCYAUIDC-Bds8udlG.js +0 -1
- ksadk/server/static/assets/stateDiagram-v2-4QOOHH4V-5b-8o2iS.js +0 -1
- ksadk/server/static/assets/swimlanesDiagram-VK2B7HYN-uf6WPRA4.js +0 -8
- ksadk/server/static/assets/treeView-Q6P3EWNA-CK5CSrSO.js +0 -1
- ksadk/server/static/assets/treemap-WGGIJYW6-Ch2BKgAM.js +0 -1
- ksadk/server/static/assets/wardley-WFR3VGLG-YW3Q0ml_.js +0 -1
- ksadk/studio/static/assets/PrismRenderer-IYN-ffww.js +0 -3
- ksadk/studio/static/assets/index-DXs1Eq4M.css +0 -1
- ksadk/studio/static/assets/index-DeDqwTsD.js +0 -283
- {agentengine_sdk_python-0.8.3.dist-info → agentengine_sdk_python-0.8.4.dist-info}/WHEEL +0 -0
- {agentengine_sdk_python-0.8.3.dist-info → agentengine_sdk_python-0.8.4.dist-info}/entry_points.txt +0 -0
- {agentengine_sdk_python-0.8.3.dist-info → agentengine_sdk_python-0.8.4.dist-info}/licenses/LICENSE +0 -0
- {agentengine_sdk_python-0.8.3.dist-info → agentengine_sdk_python-0.8.4.dist-info}/top_level.txt +0 -0
ksadk/_build_provenance.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schemaVersion":1,"sourceCommit":"
|
|
1
|
+
{"schemaVersion":1,"sourceCommit":"8e37106d1faed44c2de8b7f72a0d8cd2f1fbddd5","sourceTree":"clean","version":"0.8.4"}
|
ksadk/api/client.py
CHANGED
|
@@ -162,8 +162,30 @@ class AgentEngineClient:
|
|
|
162
162
|
timeout: float = 60.0,
|
|
163
163
|
dry_run: bool = False,
|
|
164
164
|
extra_headers: Optional[Dict[str, str]] = None,
|
|
165
|
+
allow_env_fallback: bool = True,
|
|
166
|
+
api_version: Optional[str] = None,
|
|
165
167
|
):
|
|
166
|
-
|
|
168
|
+
if type(allow_env_fallback) is not bool:
|
|
169
|
+
raise ValueError("allow_env_fallback must be a boolean")
|
|
170
|
+
self._allow_env_fallback = allow_env_fallback
|
|
171
|
+
self._explicit_api_version = api_version
|
|
172
|
+
if not allow_env_fallback:
|
|
173
|
+
parsed = urlsplit(base_url or "")
|
|
174
|
+
parsed.port # validate malformed or out-of-range ports before any transport
|
|
175
|
+
if (
|
|
176
|
+
parsed.scheme not in {"http", "https"} or not parsed.hostname
|
|
177
|
+
or parsed.username is not None or parsed.password is not None
|
|
178
|
+
or parsed.query or parsed.fragment or "\\" in (base_url or "")
|
|
179
|
+
or any(char.isspace() for char in (base_url or ""))
|
|
180
|
+
or not access_key or not secret_key or not region
|
|
181
|
+
or region.strip().lower() == "pre-online"
|
|
182
|
+
):
|
|
183
|
+
raise ValueError(
|
|
184
|
+
"Explicit control clients require endpoint, credentials and region"
|
|
185
|
+
)
|
|
186
|
+
resolved_base_url = base_url or (
|
|
187
|
+
os.getenv("AGENTENGINE_SERVER_URL") if allow_env_fallback else None
|
|
188
|
+
)
|
|
167
189
|
self.base_url: str = resolved_base_url or self._detect_default_base_url()
|
|
168
190
|
|
|
169
191
|
# 本地调试覆盖 (如果需要)
|
|
@@ -172,10 +194,12 @@ class AgentEngineClient:
|
|
|
172
194
|
self.logical_region = region
|
|
173
195
|
self.region = self._normalize_control_region(region)
|
|
174
196
|
self.custom_source = self._resolve_custom_source(region)
|
|
175
|
-
self.dry_run = bool(dry_run or self._is_global_dry_run_enabled())
|
|
197
|
+
self.dry_run = bool(dry_run or (allow_env_fallback and self._is_global_dry_run_enabled()))
|
|
176
198
|
self.extra_headers = extra_headers or {}
|
|
177
199
|
# 签名 service 可通过环境变量覆盖(例如 aicp)
|
|
178
|
-
self.service: str = service or
|
|
200
|
+
self.service: str = service or (
|
|
201
|
+
os.getenv("AGENTENGINE_SIGN_SERVICE") if allow_env_fallback else None
|
|
202
|
+
) or "aicp"
|
|
179
203
|
|
|
180
204
|
# AWS V4 签名
|
|
181
205
|
self._auth = AWSV4Auth(
|
|
@@ -183,6 +207,7 @@ class AgentEngineClient:
|
|
|
183
207
|
secret_access_key=secret_key or "",
|
|
184
208
|
region=self.region,
|
|
185
209
|
service=self.service,
|
|
210
|
+
allow_env_fallback=allow_env_fallback,
|
|
186
211
|
)
|
|
187
212
|
|
|
188
213
|
if self._auth.is_enabled:
|
|
@@ -197,10 +222,6 @@ class AgentEngineClient:
|
|
|
197
222
|
# requests.Session must not be used by several worker threads at once.
|
|
198
223
|
self._async_action_lock = asyncio.Lock()
|
|
199
224
|
self._http_error_log_suppressors: list[HttpErrorLogSuppressor] = []
|
|
200
|
-
# A Server Action can be deployed before the external KOP publication
|
|
201
|
-
# finishes. Remember that result per client so an approval retry does
|
|
202
|
-
# not repeatedly hit the known-unpublished control-plane route.
|
|
203
|
-
self._unpublished_kop_actions: set[str] = set()
|
|
204
225
|
# 反查身份的实例缓存(避免同会话重复调 IAM);None=未尝试,ResolvedIdentity|None=已反查
|
|
205
226
|
self._resolved_identity: Any = None
|
|
206
227
|
self._identity_resolve_attempted: bool = False
|
|
@@ -217,6 +238,15 @@ class AgentEngineClient:
|
|
|
217
238
|
return False
|
|
218
239
|
return True
|
|
219
240
|
|
|
241
|
+
def _request_ssl_verify(self) -> bool:
|
|
242
|
+
return True if not self._allow_env_fallback else self._ssl_verify_enabled()
|
|
243
|
+
|
|
244
|
+
def _request_api_version(self) -> str:
|
|
245
|
+
return self._explicit_api_version or (
|
|
246
|
+
os.getenv("AGENTENGINE_API_VERSION", "2024-06-12")
|
|
247
|
+
if self._allow_env_fallback else "2024-06-12"
|
|
248
|
+
)
|
|
249
|
+
|
|
220
250
|
@staticmethod
|
|
221
251
|
def _is_global_dry_run_enabled() -> bool:
|
|
222
252
|
"""根命令 --dry-run 开关:支持未显式透传 dry_run 参数的命令。"""
|
|
@@ -259,6 +289,7 @@ class AgentEngineClient:
|
|
|
259
289
|
def _get_session(self) -> requests.Session:
|
|
260
290
|
if self._session is None:
|
|
261
291
|
self._session = requests.Session()
|
|
292
|
+
self._session.trust_env = self._allow_env_fallback
|
|
262
293
|
return self._session
|
|
263
294
|
|
|
264
295
|
def _get_host(self) -> str:
|
|
@@ -421,6 +452,8 @@ class AgentEngineClient:
|
|
|
421
452
|
)
|
|
422
453
|
|
|
423
454
|
def _can_retry_with_inner_aicp_endpoint(self, details: Dict[str, Any]) -> bool:
|
|
455
|
+
if not self._allow_env_fallback:
|
|
456
|
+
return False
|
|
424
457
|
if not self._is_inner_account_intranet_error(details):
|
|
425
458
|
return False
|
|
426
459
|
parsed = urlparse(self.base_url or "")
|
|
@@ -439,7 +472,7 @@ class AgentEngineClient:
|
|
|
439
472
|
kop_mode = self._is_kop_mode()
|
|
440
473
|
headers = self._build_headers(action=action, kop_mode=kop_mode)
|
|
441
474
|
if kop_mode:
|
|
442
|
-
version =
|
|
475
|
+
version = self._request_api_version()
|
|
443
476
|
full_url = f"{self.base_url.rstrip('/')}/?Action={action}&Version={version}"
|
|
444
477
|
else:
|
|
445
478
|
full_url = f"{self.base_url}{path}"
|
|
@@ -453,7 +486,7 @@ class AgentEngineClient:
|
|
|
453
486
|
headers["Accept"] = accept
|
|
454
487
|
if has_files:
|
|
455
488
|
headers.pop("Content-Type", None)
|
|
456
|
-
version =
|
|
489
|
+
version = self._request_api_version()
|
|
457
490
|
full_url = (
|
|
458
491
|
f"{self.base_url.rstrip('/')}/?Action={action}&Version={version}"
|
|
459
492
|
if kop_mode
|
|
@@ -532,7 +565,7 @@ class AgentEngineClient:
|
|
|
532
565
|
}
|
|
533
566
|
if kop_mode and action:
|
|
534
567
|
headers["X-Action"] = action
|
|
535
|
-
headers["X-Version"] =
|
|
568
|
+
headers["X-Version"] = self._request_api_version()
|
|
536
569
|
if self.custom_source:
|
|
537
570
|
headers["X-KSC-CUSTOM-SOURCE"] = self.custom_source
|
|
538
571
|
|
|
@@ -579,6 +612,10 @@ class AgentEngineClient:
|
|
|
579
612
|
|
|
580
613
|
def _get_resolved_identity(self) -> Any:
|
|
581
614
|
"""反查身份并缓存到实例。dry-run 只读文件缓存不联网。"""
|
|
615
|
+
if not self._allow_env_fallback:
|
|
616
|
+
# Explicit resource admission owns identity resolution and its target.
|
|
617
|
+
# Never consult a global identity cache or contact an implicit service.
|
|
618
|
+
return None
|
|
582
619
|
if self._identity_resolve_attempted:
|
|
583
620
|
return self._resolved_identity
|
|
584
621
|
self._identity_resolve_attempted = True
|
|
@@ -606,7 +643,9 @@ class AgentEngineClient:
|
|
|
606
643
|
if key.lower() == "x-ksc-account-id" and str(value or "").strip():
|
|
607
644
|
return str(value).strip()
|
|
608
645
|
# 2. env KSYUN_ACCOUNT_ID
|
|
609
|
-
account_id =
|
|
646
|
+
account_id = (
|
|
647
|
+
os.getenv("KSYUN_ACCOUNT_ID", "").strip() if self._allow_env_fallback else ""
|
|
648
|
+
)
|
|
610
649
|
if account_id:
|
|
611
650
|
return account_id
|
|
612
651
|
# 3. 反查主账号 ID(复用 _get_resolved_identity 的反查,不重复调)
|
|
@@ -734,11 +773,17 @@ class AgentEngineClient:
|
|
|
734
773
|
headers=headers,
|
|
735
774
|
auth=self._auth.get_auth(), # AWS V4 签名
|
|
736
775
|
timeout=self.timeout,
|
|
737
|
-
verify=self.
|
|
776
|
+
verify=self._request_ssl_verify(),
|
|
777
|
+
allow_redirects=self._allow_env_fallback,
|
|
738
778
|
)
|
|
739
779
|
|
|
740
780
|
logger.debug(f"Response: {response.status_code}")
|
|
741
781
|
|
|
782
|
+
if not self._allow_env_fallback and 300 <= response.status_code < 400:
|
|
783
|
+
raise AgentEngineAPIError(
|
|
784
|
+
response.status_code, "Explicit connection redirect refused"
|
|
785
|
+
)
|
|
786
|
+
|
|
742
787
|
if response.status_code < 400:
|
|
743
788
|
break
|
|
744
789
|
|
|
@@ -996,24 +1041,6 @@ class AgentEngineClient:
|
|
|
996
1041
|
)
|
|
997
1042
|
return AgentEngineAPIError(response.status_code, message)
|
|
998
1043
|
|
|
999
|
-
@staticmethod
|
|
1000
|
-
def _is_unregistered_kop_action(error: AgentEngineAPIError, action: str) -> bool:
|
|
1001
|
-
"""Return whether KOP rejected an otherwise valid Server Action.
|
|
1002
|
-
|
|
1003
|
-
Public Action publication is an infrastructure step independent of a
|
|
1004
|
-
Server rollout. During that window the per-Agent Gateway route is
|
|
1005
|
-
already authenticated and still forwards the exact same Action to
|
|
1006
|
-
Server admission, so callers can safely use it as the data-plane
|
|
1007
|
-
fallback instead of losing an approval response.
|
|
1008
|
-
"""
|
|
1009
|
-
|
|
1010
|
-
message = str(error.message or "").strip().lower()
|
|
1011
|
-
return (
|
|
1012
|
-
error.code == 400
|
|
1013
|
-
and f"action {action.lower()}" in message
|
|
1014
|
-
and "not valid for this web service" in message
|
|
1015
|
-
)
|
|
1016
|
-
|
|
1017
1044
|
def _runtime_action(
|
|
1018
1045
|
self,
|
|
1019
1046
|
*,
|
|
@@ -1031,7 +1058,8 @@ class AgentEngineClient:
|
|
|
1031
1058
|
headers={"Authorization": f"Bearer {api_key}"},
|
|
1032
1059
|
json=params,
|
|
1033
1060
|
timeout=self.timeout,
|
|
1034
|
-
verify=self.
|
|
1061
|
+
verify=self._request_ssl_verify(),
|
|
1062
|
+
allow_redirects=self._allow_env_fallback,
|
|
1035
1063
|
)
|
|
1036
1064
|
if response.status_code >= 400:
|
|
1037
1065
|
raise self._workspace_runtime_error(response)
|
|
@@ -1057,22 +1085,6 @@ class AgentEngineClient:
|
|
|
1057
1085
|
raise AgentEngineAPIError(502, "Runtime Action returned non-object Data")
|
|
1058
1086
|
return normalized
|
|
1059
1087
|
|
|
1060
|
-
async def _runtime_action_for_agent(
|
|
1061
|
-
self,
|
|
1062
|
-
*,
|
|
1063
|
-
agent_id: str,
|
|
1064
|
-
action: str,
|
|
1065
|
-
params: Dict[str, Any],
|
|
1066
|
-
) -> Dict[str, Any]:
|
|
1067
|
-
detail = await self.get_agent(agent_id, include_api_key=True)
|
|
1068
|
-
access = self._extract_runtime_access(detail)
|
|
1069
|
-
return await asyncio.to_thread(
|
|
1070
|
-
self._runtime_action,
|
|
1071
|
-
access=access,
|
|
1072
|
-
action=action,
|
|
1073
|
-
params=params,
|
|
1074
|
-
)
|
|
1075
|
-
|
|
1076
1088
|
@staticmethod
|
|
1077
1089
|
def _compact_params(params: Dict[str, Any] | None) -> Dict[str, Any]:
|
|
1078
1090
|
return {key: value for key, value in (params or {}).items() if value is not None}
|
|
@@ -1164,7 +1176,8 @@ class AgentEngineClient:
|
|
|
1164
1176
|
headers=headers,
|
|
1165
1177
|
auth=self._auth.get_auth(),
|
|
1166
1178
|
timeout=self.timeout,
|
|
1167
|
-
verify=self.
|
|
1179
|
+
verify=self._request_ssl_verify(),
|
|
1180
|
+
allow_redirects=self._allow_env_fallback,
|
|
1168
1181
|
)
|
|
1169
1182
|
if response.status_code < 400:
|
|
1170
1183
|
return response
|
|
@@ -1238,7 +1251,8 @@ class AgentEngineClient:
|
|
|
1238
1251
|
files=files,
|
|
1239
1252
|
stream=False,
|
|
1240
1253
|
timeout=self.timeout,
|
|
1241
|
-
verify=self.
|
|
1254
|
+
verify=self._request_ssl_verify(),
|
|
1255
|
+
allow_redirects=self._allow_env_fallback,
|
|
1242
1256
|
)
|
|
1243
1257
|
setattr(response, "_ksadk_workspace_url", url)
|
|
1244
1258
|
if response.status_code >= 400:
|
|
@@ -1501,8 +1515,13 @@ class AgentEngineClient:
|
|
|
1501
1515
|
}
|
|
1502
1516
|
if manifest_sha256:
|
|
1503
1517
|
payload["ManifestSHA256"] = manifest_sha256
|
|
1518
|
+
if isinstance(declaration, dict) and declaration.get("plugin_artifacts"):
|
|
1519
|
+
payload["PluginArtifacts"] = declaration["plugin_artifacts"]
|
|
1504
1520
|
return payload
|
|
1505
1521
|
|
|
1522
|
+
async def get_plugin_delivery_capabilities(self) -> Dict[str, Any]:
|
|
1523
|
+
return await self._action_async("GetPluginDeliveryCapabilities", {})
|
|
1524
|
+
|
|
1506
1525
|
async def create_agent(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
|
1507
1526
|
"""Create an Agent through the established order workflow.
|
|
1508
1527
|
|
|
@@ -1604,21 +1623,10 @@ class AgentEngineClient:
|
|
|
1604
1623
|
advanced["ProjectId"] = project_id
|
|
1605
1624
|
params["Advanced"] = advanced
|
|
1606
1625
|
|
|
1607
|
-
#
|
|
1608
|
-
#
|
|
1609
|
-
#
|
|
1610
|
-
|
|
1611
|
-
action = (
|
|
1612
|
-
"CreateAgent"
|
|
1613
|
-
if params["DeploymentType"] == "ManagedRuntime"
|
|
1614
|
-
else "CreateAgentProduct"
|
|
1615
|
-
)
|
|
1616
|
-
if action == "CreateAgent":
|
|
1617
|
-
# CreateAgent is also used as an order callback and therefore
|
|
1618
|
-
# requires an InstanceId. A declarative runtime has no order to
|
|
1619
|
-
# allocate one for us, so the SDK supplies a stable request UUID.
|
|
1620
|
-
params["InstanceId"] = str(data.get("instance_id") or uuid.uuid4())
|
|
1621
|
-
return self._action(action, params)
|
|
1626
|
+
# CreateAgentProduct is the established public Action. The Server
|
|
1627
|
+
# handles ManagedRuntime synchronously without involving Ding, while
|
|
1628
|
+
# Code and Container retain their existing order/callback lifecycle.
|
|
1629
|
+
return self._action("CreateAgentProduct", params)
|
|
1622
1630
|
|
|
1623
1631
|
async def get_agent(
|
|
1624
1632
|
self,
|
|
@@ -1686,6 +1694,33 @@ class AgentEngineClient:
|
|
|
1686
1694
|
params["Name"] = name
|
|
1687
1695
|
return self._action("ListAgentModels", params)
|
|
1688
1696
|
|
|
1697
|
+
async def list_knowledge_bases(self) -> Dict[str, Any]:
|
|
1698
|
+
"""List knowledge bases visible to the current signed cloud identity."""
|
|
1699
|
+
|
|
1700
|
+
result = await self._action_async("ListKnowledgeBases", {})
|
|
1701
|
+
return {
|
|
1702
|
+
"knowledge_bases": result.get("knowledge_bases", []),
|
|
1703
|
+
"total_count": result.get("total_count", 0),
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
async def list_memory_instances(self) -> Dict[str, Any]:
|
|
1707
|
+
"""List long-term memory instances visible to the signed identity."""
|
|
1708
|
+
|
|
1709
|
+
result = await self._action_async("ListMemoryInstances", {})
|
|
1710
|
+
return {
|
|
1711
|
+
"memory_instances": result.get("memory_instances", []),
|
|
1712
|
+
"total_count": result.get("total_count", 0),
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
async def list_skill_workspaces(self) -> Dict[str, Any]:
|
|
1716
|
+
"""List Skill Center workspaces visible to the signed identity."""
|
|
1717
|
+
|
|
1718
|
+
result = await self._action_async("ListSkillWorkspaces", {})
|
|
1719
|
+
return {
|
|
1720
|
+
"skill_workspaces": result.get("skill_workspaces", []),
|
|
1721
|
+
"total_count": result.get("total_count", 0),
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1689
1724
|
async def create_dashboard_access_link(
|
|
1690
1725
|
self,
|
|
1691
1726
|
*,
|
|
@@ -2060,24 +2095,7 @@ class AgentEngineClient:
|
|
|
2060
2095
|
"Response": response or {},
|
|
2061
2096
|
"IdempotencyKey": idempotency_key,
|
|
2062
2097
|
}
|
|
2063
|
-
|
|
2064
|
-
try:
|
|
2065
|
-
return await self._action_async("SubmitInteraction", params)
|
|
2066
|
-
except AgentEngineAPIError as exc:
|
|
2067
|
-
if not self._is_unregistered_kop_action(exc, "SubmitInteraction"):
|
|
2068
|
-
raise
|
|
2069
|
-
self._unpublished_kop_actions.add("SubmitInteraction")
|
|
2070
|
-
if "SubmitInteraction" in self._unpublished_kop_actions:
|
|
2071
|
-
# KOP publication can lag the Server/Gateway rollout. The
|
|
2072
|
-
# per-Agent endpoint is authenticated with the API key returned by
|
|
2073
|
-
# signed GetAgent and still traverses Gateway -> Server admission;
|
|
2074
|
-
# it never submits directly to Runtime.
|
|
2075
|
-
return await self._runtime_action_for_agent(
|
|
2076
|
-
agent_id=agent_id,
|
|
2077
|
-
action="SubmitInteraction",
|
|
2078
|
-
params=params,
|
|
2079
|
-
)
|
|
2080
|
-
raise AssertionError("unreachable SubmitInteraction transport state")
|
|
2098
|
+
return await self._action_async("SubmitInteraction", params)
|
|
2081
2099
|
|
|
2082
2100
|
async def list_workspace_files(
|
|
2083
2101
|
self,
|
|
@@ -2582,6 +2600,7 @@ class AgentEngineClient:
|
|
|
2582
2600
|
raise AssertionError("dry-run request unexpectedly returned")
|
|
2583
2601
|
|
|
2584
2602
|
session = requests.Session()
|
|
2603
|
+
session.trust_env = self._allow_env_fallback
|
|
2585
2604
|
response: requests.Response | None = None
|
|
2586
2605
|
retried_inner_endpoint = False
|
|
2587
2606
|
try:
|
|
@@ -2596,7 +2615,8 @@ class AgentEngineClient:
|
|
|
2596
2615
|
# reasoning before its next SSE chunk. Bound connection
|
|
2597
2616
|
# establishment, not the lifetime of an admitted stream.
|
|
2598
2617
|
timeout=(self.timeout, None),
|
|
2599
|
-
verify=self.
|
|
2618
|
+
verify=self._request_ssl_verify(),
|
|
2619
|
+
allow_redirects=self._allow_env_fallback,
|
|
2600
2620
|
stream=True,
|
|
2601
2621
|
)
|
|
2602
2622
|
content_type = str(response.headers.get("content-type") or "").lower()
|
|
@@ -2622,9 +2642,7 @@ class AgentEngineClient:
|
|
|
2622
2642
|
)
|
|
2623
2643
|
message = (
|
|
2624
2644
|
str(
|
|
2625
|
-
details.get("remote_error_message")
|
|
2626
|
-
or details.get("message")
|
|
2627
|
-
or ""
|
|
2645
|
+
details.get("remote_error_message") or details.get("message") or ""
|
|
2628
2646
|
).strip()
|
|
2629
2647
|
or "RunAgent stream did not return text/event-stream"
|
|
2630
2648
|
)
|
|
@@ -2650,11 +2668,7 @@ class AgentEngineClient:
|
|
|
2650
2668
|
details=details,
|
|
2651
2669
|
)
|
|
2652
2670
|
message = (
|
|
2653
|
-
str(
|
|
2654
|
-
details.get("remote_error_message")
|
|
2655
|
-
or details.get("message")
|
|
2656
|
-
or ""
|
|
2657
|
-
).strip()
|
|
2671
|
+
str(details.get("remote_error_message") or details.get("message") or "").strip()
|
|
2658
2672
|
or resp_text
|
|
2659
2673
|
)
|
|
2660
2674
|
raise AgentEngineAPIError(
|
ksadk/builders/code_builder.py
CHANGED
|
@@ -280,7 +280,15 @@ class CodeBuilder(BaseBuilder):
|
|
|
280
280
|
"mcp>=1.1.0",
|
|
281
281
|
"langchain-mcp-adapters>=0.0.1",
|
|
282
282
|
)
|
|
283
|
-
BUNDLED_KSADK_POSTGRES_SESSION_REQUIREMENTS = (
|
|
283
|
+
BUNDLED_KSADK_POSTGRES_SESSION_REQUIREMENTS = (
|
|
284
|
+
"asyncpg>=0.30.0,<1.0.0",
|
|
285
|
+
"greenlet>=1.0.0",
|
|
286
|
+
)
|
|
287
|
+
BUNDLED_KSADK_LANGGRAPH_POSTGRES_REQUIREMENTS = (
|
|
288
|
+
"langgraph-checkpoint-postgres>=3.1.0",
|
|
289
|
+
"psycopg[binary]>=3.2,<4.0",
|
|
290
|
+
"psycopg-pool>=3.2,<4.0",
|
|
291
|
+
)
|
|
284
292
|
BUNDLED_KSADK_ATTACHMENT_RUNTIME_REQUIREMENTS = (
|
|
285
293
|
"pypdf>=6.0.0",
|
|
286
294
|
"beautifulsoup4>=4.12.0",
|
|
@@ -584,8 +592,14 @@ class CodeBuilder(BaseBuilder):
|
|
|
584
592
|
value = os.getenv("KSADK_BUILD_ENABLE_ATTACHMENT_OCR", "")
|
|
585
593
|
return value.strip().lower() in {"1", "true", "yes", "on"}
|
|
586
594
|
|
|
587
|
-
def _bundled_runtime_requirements(self) -> tuple[str, ...]:
|
|
595
|
+
def _bundled_runtime_requirements(self, detection_result: Any = None) -> tuple[str, ...]:
|
|
588
596
|
requirements = list(self.BUNDLED_KSADK_RUNTIME_REQUIREMENTS)
|
|
597
|
+
detection_type = getattr(detection_result, "type", None)
|
|
598
|
+
framework = str(
|
|
599
|
+
getattr(detection_type, "value", detection_type) or ""
|
|
600
|
+
).strip().lower()
|
|
601
|
+
if framework in {"langgraph", "langchain", "deepagents"}:
|
|
602
|
+
requirements.extend(self.BUNDLED_KSADK_LANGGRAPH_POSTGRES_REQUIREMENTS)
|
|
589
603
|
if self._attachment_ocr_runtime_enabled():
|
|
590
604
|
requirements.extend(self.BUNDLED_KSADK_ATTACHMENT_OCR_RUNTIME_REQUIREMENTS)
|
|
591
605
|
if self._mcp_runtime_enabled():
|
|
@@ -612,16 +626,26 @@ class CodeBuilder(BaseBuilder):
|
|
|
612
626
|
if self._env_flag_enabled("KSADK_BUILD_ENABLE_POSTGRES_SESSION"):
|
|
613
627
|
return True
|
|
614
628
|
backend = (
|
|
615
|
-
self.
|
|
616
|
-
or self.
|
|
617
|
-
or self.
|
|
629
|
+
self._project_file_env_value("KSADK_SESSION_BACKEND")
|
|
630
|
+
or self._project_file_env_value("AGENTENGINE_SESSION_BACKEND")
|
|
631
|
+
or self._project_file_env_value("KSADK_STM_BACKEND")
|
|
632
|
+
or os.getenv("KSADK_SESSION_BACKEND")
|
|
633
|
+
or os.getenv("AGENTENGINE_SESSION_BACKEND")
|
|
634
|
+
or os.getenv("KSADK_STM_BACKEND")
|
|
635
|
+
or ""
|
|
618
636
|
)
|
|
619
637
|
if backend.strip().lower() == "postgres":
|
|
620
638
|
return True
|
|
621
639
|
dsn = (
|
|
622
|
-
self.
|
|
623
|
-
or self.
|
|
624
|
-
or self.
|
|
640
|
+
self._project_file_env_value("KSADK_CHECKPOINT_DSN")
|
|
641
|
+
or self._project_file_env_value("KSADK_SESSION_DSN")
|
|
642
|
+
or self._project_file_env_value("KSADK_STM_URL")
|
|
643
|
+
or self._project_file_env_value("KSADK_STM_DB_URL")
|
|
644
|
+
or os.getenv("KSADK_CHECKPOINT_DSN")
|
|
645
|
+
or os.getenv("KSADK_SESSION_DSN")
|
|
646
|
+
or os.getenv("KSADK_STM_URL")
|
|
647
|
+
or os.getenv("KSADK_STM_DB_URL")
|
|
648
|
+
or ""
|
|
625
649
|
)
|
|
626
650
|
return self._looks_like_postgres_dsn(dsn)
|
|
627
651
|
|
|
@@ -642,6 +666,9 @@ class CodeBuilder(BaseBuilder):
|
|
|
642
666
|
value = os.getenv(name)
|
|
643
667
|
if value:
|
|
644
668
|
return value
|
|
669
|
+
return self._project_file_env_value(name)
|
|
670
|
+
|
|
671
|
+
def _project_file_env_value(self, name: str) -> str:
|
|
645
672
|
for env_file in (self.project_dir / ".env", self.project_dir / "agentengine.env"):
|
|
646
673
|
if not env_file.is_file():
|
|
647
674
|
continue
|
|
@@ -942,7 +969,7 @@ class CodeBuilder(BaseBuilder):
|
|
|
942
969
|
def _build_requirements_list(self, detection_result) -> List[str]:
|
|
943
970
|
final_deps = merge_requirement_lists(
|
|
944
971
|
self._get_base_requirements(detection_result),
|
|
945
|
-
self._bundled_runtime_requirements(),
|
|
972
|
+
self._bundled_runtime_requirements(detection_result),
|
|
946
973
|
)
|
|
947
974
|
|
|
948
975
|
user_requirements = self.project_dir / "requirements.txt"
|
|
@@ -8,8 +8,9 @@ FASTAPI_REQUIREMENT = "fastapi>=0.136.0,<0.137.0"
|
|
|
8
8
|
STARLETTE_REQUIREMENT = "starlette>=1.0,<1.4"
|
|
9
9
|
|
|
10
10
|
ADK_REQUIREMENTS = (
|
|
11
|
-
#
|
|
11
|
+
# 与 ksadk 自身 adk extra 对齐,支持 1.x 与 2.x。
|
|
12
12
|
"google-adk>=1.34.0,<3.0.0",
|
|
13
|
+
"greenlet>=1.0.0",
|
|
13
14
|
"litellm>=1.0.0",
|
|
14
15
|
)
|
|
15
16
|
|
ksadk/builders/ks3_uploader.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
KS3 上传模块 - 金山云对象存储上传
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
import logging
|
|
5
6
|
import os
|
|
6
7
|
import socket
|
|
7
8
|
import time
|
|
@@ -27,7 +28,15 @@ class KS3Uploader:
|
|
|
27
28
|
UPLOAD_TIMEOUT_PER_MB_SECONDS = 4.0
|
|
28
29
|
UPLOAD_TIMEOUT_MAX_SECONDS = 3600
|
|
29
30
|
|
|
30
|
-
def __init__(
|
|
31
|
+
def __init__(
|
|
32
|
+
self,
|
|
33
|
+
region: str = "cn-beijing-6",
|
|
34
|
+
bucket: Optional[str] = None,
|
|
35
|
+
*,
|
|
36
|
+
access_key: Optional[str] = None,
|
|
37
|
+
secret_key: Optional[str] = None,
|
|
38
|
+
public_read: bool = True,
|
|
39
|
+
):
|
|
31
40
|
"""初始化 KS3 上传器
|
|
32
41
|
|
|
33
42
|
Args:
|
|
@@ -37,7 +46,15 @@ class KS3Uploader:
|
|
|
37
46
|
- 如果未指定,优先从环境变量 KS3_BUCKET 读取
|
|
38
47
|
- 如果环境变量也未设置,默认使用 agentengine-{region}
|
|
39
48
|
"""
|
|
49
|
+
# ks3sdk logs the signed Authorization header at INFO. Studio uploads
|
|
50
|
+
# run inside a long-lived server process, so keep that transport logger
|
|
51
|
+
# above INFO before any request can be emitted.
|
|
52
|
+
logging.getLogger("ks3.http").setLevel(logging.WARNING)
|
|
53
|
+
|
|
40
54
|
self.region = region
|
|
55
|
+
self.access_key = access_key
|
|
56
|
+
self.secret_key = secret_key
|
|
57
|
+
self.public_read = public_read
|
|
41
58
|
|
|
42
59
|
# 确定 bucket 名称 (优先级: 参数 > 环境变量 > 默认值)
|
|
43
60
|
if bucket:
|
|
@@ -260,8 +277,12 @@ class KS3Uploader:
|
|
|
260
277
|
def _upload_via_host(self, file_path: Path, object_key: str, host: str) -> bool:
|
|
261
278
|
from ks3.connection import Connection # type: ignore[import-untyped]
|
|
262
279
|
|
|
263
|
-
ak = os.environ.get("KSYUN_ACCESS_KEY") or os.environ.get(
|
|
264
|
-
|
|
280
|
+
ak = self.access_key or os.environ.get("KSYUN_ACCESS_KEY") or os.environ.get(
|
|
281
|
+
"KS3_ACCESS_KEY"
|
|
282
|
+
)
|
|
283
|
+
sk = self.secret_key or os.environ.get("KSYUN_SECRET_KEY") or os.environ.get(
|
|
284
|
+
"KS3_SECRET_KEY"
|
|
285
|
+
)
|
|
265
286
|
|
|
266
287
|
conn = Connection(
|
|
267
288
|
ak,
|
|
@@ -291,10 +312,14 @@ class KS3Uploader:
|
|
|
291
312
|
resumable=True,
|
|
292
313
|
resumable_filename=str(resume_path),
|
|
293
314
|
)
|
|
294
|
-
|
|
315
|
+
headers = {"x-kss-acl": "public-read"} if self.public_read else {}
|
|
316
|
+
result = upload_task.upload(headers=headers)
|
|
295
317
|
else:
|
|
296
318
|
click.echo(f" 普通上传: {file_path.stat().st_size / (1024 * 1024):.2f} MB")
|
|
297
|
-
|
|
319
|
+
if self.public_read:
|
|
320
|
+
result = key.set_contents_from_filename(str(file_path), policy="public-read")
|
|
321
|
+
else:
|
|
322
|
+
result = key.set_contents_from_filename(str(file_path))
|
|
298
323
|
|
|
299
324
|
status = getattr(result, "status", None)
|
|
300
325
|
if status is None:
|
|
@@ -313,8 +338,12 @@ class KS3Uploader:
|
|
|
313
338
|
成功返回 ks3:// URI, 失败返回 None
|
|
314
339
|
"""
|
|
315
340
|
# 检查环境变量 (优先使用 KSYUN_* 金山云 IAM 凭证)
|
|
316
|
-
ak = os.environ.get("KSYUN_ACCESS_KEY") or os.environ.get(
|
|
317
|
-
|
|
341
|
+
ak = self.access_key or os.environ.get("KSYUN_ACCESS_KEY") or os.environ.get(
|
|
342
|
+
"KS3_ACCESS_KEY"
|
|
343
|
+
)
|
|
344
|
+
sk = self.secret_key or os.environ.get("KSYUN_SECRET_KEY") or os.environ.get(
|
|
345
|
+
"KS3_SECRET_KEY"
|
|
346
|
+
)
|
|
318
347
|
|
|
319
348
|
if not ak or not sk:
|
|
320
349
|
click.secho("❌ 请在 .env 文件中设置金山云 IAM 凭证:", fg="red")
|
ksadk/cli/__init__.py
CHANGED
|
@@ -339,16 +339,33 @@ def _register_optional_command(cli: click.Group, module_path: str, *cmd_names: s
|
|
|
339
339
|
|
|
340
340
|
|
|
341
341
|
def _register_commands():
|
|
342
|
+
# Runtime fast path: when the hosted entrypoint runs ``ksadk web`` the
|
|
343
|
+
# process only needs the web command. Importing the other commands here
|
|
344
|
+
# pulls in deploy/create/run deps (ks3, questionary, ...) that the hosted
|
|
345
|
+
# Python runtime image does not ship, so a full register crashes the
|
|
346
|
+
# runtime before the server starts. Only import what argv actually needs;
|
|
347
|
+
# ``--help`` and other exploratory invocations still register everything.
|
|
348
|
+
import sys as _sys
|
|
349
|
+
|
|
350
|
+
_argv = [a for a in _sys.argv[1:] if not a.startswith("-")]
|
|
351
|
+
_runtime_only = bool(_argv) and _argv[0] == "web"
|
|
352
|
+
|
|
353
|
+
from ksadk.cli.cmd_web import web
|
|
354
|
+
|
|
355
|
+
_add_command_once(cli, web)
|
|
356
|
+
|
|
357
|
+
if _runtime_only:
|
|
358
|
+
# Skip create/deploy/run/managed_runtime imports on the runtime path.
|
|
359
|
+
return
|
|
360
|
+
|
|
342
361
|
from ksadk.cli.cmd_create import create
|
|
343
362
|
from ksadk.cli.cmd_deploy import deploy
|
|
344
363
|
from ksadk.cli.cmd_managed_runtime import managed_runtime
|
|
345
364
|
from ksadk.cli.cmd_run import run
|
|
346
|
-
from ksadk.cli.cmd_web import web
|
|
347
365
|
|
|
348
366
|
# 注册现有命令
|
|
349
367
|
_add_command_once(cli, run)
|
|
350
368
|
_add_command_once(cli, deploy)
|
|
351
|
-
_add_command_once(cli, web)
|
|
352
369
|
_add_command_once(cli, managed_runtime)
|
|
353
370
|
|
|
354
371
|
# init 作为主命令 (PRD 规范)
|
|
@@ -391,7 +408,7 @@ def _register_commands():
|
|
|
391
408
|
_register_optional_command(cli, "ksadk.cli.cmd_hermes", "hermes")
|
|
392
409
|
|
|
393
410
|
|
|
394
|
-
def
|
|
411
|
+
def _main():
|
|
395
412
|
# 全局加载 .env 文件
|
|
396
413
|
try:
|
|
397
414
|
from dotenv import find_dotenv, load_dotenv
|
|
@@ -476,5 +493,17 @@ def main():
|
|
|
476
493
|
raise SystemExit(cli_error.exit_code) from None
|
|
477
494
|
|
|
478
495
|
|
|
496
|
+
def main():
|
|
497
|
+
"""Run the CLI without exposing a traceback for an operator interrupt."""
|
|
498
|
+
|
|
499
|
+
try:
|
|
500
|
+
return _main()
|
|
501
|
+
except KeyboardInterrupt:
|
|
502
|
+
# Ctrl+C can arrive while optional commands are still importing, before
|
|
503
|
+
# Click or Uvicorn installs its own signal handling. Treat it as the
|
|
504
|
+
# same clean operator stop and preserve the conventional exit status.
|
|
505
|
+
raise SystemExit(130) from None
|
|
506
|
+
|
|
507
|
+
|
|
479
508
|
if __name__ == "__main__":
|
|
480
509
|
main()
|
ksadk/cli/cmd_managed_runtime.py
CHANGED
|
@@ -83,8 +83,20 @@ def managed_runtime(manifest_path: Path, port: int, host: str) -> None:
|
|
|
83
83
|
"""Serve one mounted, declarative ``agentengine.yaml`` in hosted mode."""
|
|
84
84
|
|
|
85
85
|
manifest_path = manifest_path.resolve()
|
|
86
|
-
_load_managed_runtime_manifest(manifest_path)
|
|
86
|
+
manifest = _load_managed_runtime_manifest(manifest_path)
|
|
87
87
|
work_dir = _prepare_writable_runtime_dir(manifest_path)
|
|
88
|
+
from ksadk.plugins.delivery import prepare_cloud_plugins
|
|
89
|
+
|
|
90
|
+
try:
|
|
91
|
+
prepare_cloud_plugins(manifest, work_dir)
|
|
92
|
+
except Exception as exc:
|
|
93
|
+
# Transport exceptions can contain signed URLs; keep startup logs secret-free.
|
|
94
|
+
import httpx
|
|
95
|
+
|
|
96
|
+
detail = "artifact transport failed" if isinstance(exc, httpx.HTTPError) else str(exc)
|
|
97
|
+
raise click.ClickException(
|
|
98
|
+
"plugin delivery failed before runtime startup: " + detail
|
|
99
|
+
) from None
|
|
88
100
|
# The command is a production process entrypoint, never a local UI action.
|
|
89
101
|
# ``web`` owns the RuntimeAdapter composition, while no_open prevents an
|
|
90
102
|
# accidental browser launch if this container is ever run with a display.
|