agentengine-sdk-python 0.8.1__py3-none-any.whl → 0.8.3__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.1.dist-info → agentengine_sdk_python-0.8.3.dist-info}/METADATA +25 -12
- {agentengine_sdk_python-0.8.1.dist-info → agentengine_sdk_python-0.8.3.dist-info}/RECORD +421 -232
- ksadk/_build_provenance.json +1 -0
- ksadk/a2a/_space_client_events.py +381 -0
- ksadk/a2a/event_adapter.py +156 -64
- ksadk/a2a/executor.py +179 -63
- ksadk/a2a/space_client.py +6 -333
- ksadk/a2ui/core.py +222 -53
- ksadk/agui/_agent_helpers.py +247 -0
- ksadk/agui/a2ui_projection.py +12 -5
- ksadk/agui/agent.py +443 -259
- ksadk/api/client.py +528 -27
- ksadk/builders/code_builder.py +284 -8
- ksadk/builders/container_builder.py +8 -1
- ksadk/builders/managed_runtime_builder.py +42 -35
- ksadk/cli/__init__.py +23 -0
- ksadk/cli/cmd_dashboard.py +15 -1
- ksadk/cli/cmd_deploy.py +10 -2
- ksadk/cli/cmd_eval.py +66 -9
- ksadk/cli/cmd_evalset.py +284 -0
- ksadk/cli/cmd_files.py +5 -1
- ksadk/cli/cmd_hermes.py +1 -126
- ksadk/cli/cmd_invoke.py +28 -38
- ksadk/cli/cmd_managed_runtime.py +95 -0
- ksadk/cli/cmd_observe.py +85 -0
- ksadk/cli/cmd_openclaw.py +1 -435
- ksadk/cli/cmd_plugin.py +657 -0
- ksadk/cli/cmd_replay.py +28 -4
- ksadk/cli/cmd_studio.py +99 -8
- ksadk/cli/cmd_web.py +10 -2
- ksadk/cli/hermes_env.py +151 -0
- ksadk/cli/invoke_payload.py +49 -0
- ksadk/cli/openclaw_env.py +458 -0
- ksadk/codex/client.py +180 -30
- ksadk/codex/runtime.py +475 -331
- ksadk/configs/env_registry.py +94 -12
- ksadk/configs/env_registry_pcm.py +181 -0
- ksadk/configs/env_var_spec.py +18 -0
- ksadk/configs/global_config.py +5 -0
- ksadk/configs/settings.py +9 -0
- ksadk/context_engine/__init__.py +98 -0
- ksadk/context_engine/assembler.py +176 -0
- ksadk/context_engine/baseline.py +419 -0
- ksadk/context_engine/cache_observability.py +228 -0
- ksadk/context_engine/capabilities.py +443 -0
- ksadk/context_engine/contributors.py +409 -0
- ksadk/context_engine/hosted_pipeline.py +417 -0
- ksadk/context_engine/models.py +117 -0
- ksadk/context_engine/planner.py +698 -0
- ksadk/context_engine/policies.py +319 -0
- ksadk/context_engine/projection.py +31 -0
- ksadk/context_engine/shadow_plan.py +266 -0
- ksadk/context_engine/tokenizer.py +164 -0
- ksadk/conversations/__init__.py +19 -0
- ksadk/conversations/context.py +230 -30
- ksadk/conversations/contracts.py +266 -0
- ksadk/conversations/message_projection.py +308 -26
- ksadk/conversations/model_context.py +49 -3
- ksadk/conversations/projector.py +616 -0
- ksadk/conversations/reducer.py +98 -0
- ksadk/conversations/runtime_compaction.py +207 -5
- ksadk/conversations/runtime_input.py +184 -2
- ksadk/conversations/runtime_invocation.py +81 -3
- ksadk/conversations/runtime_observability.py +141 -0
- ksadk/conversations/runtime_payloads.py +42 -0
- ksadk/conversations/runtime_preparation.py +272 -2
- ksadk/conversations/runtime_resume.py +20 -1
- ksadk/conversations/runtime_stream_events.py +94 -9
- ksadk/conversations/semantic_summary.py +311 -1
- ksadk/conversations/session_lock.py +51 -0
- ksadk/deployment/env_forward.py +72 -0
- ksadk/deployment/managed_runtime.py +5 -0
- ksadk/deployment/providers/serverless.py +143 -69
- ksadk/evaluation/__init__.py +32 -0
- ksadk/evaluation/a2a_adapter.py +9 -1
- ksadk/evaluation/adapters.py +18 -5
- ksadk/evaluation/agent_eval_client.py +395 -0
- ksadk/evaluation/cloud_binding.py +80 -0
- ksadk/evaluation/cloud_converter.py +194 -0
- ksadk/evaluation/cloud_service.py +199 -0
- ksadk/evaluation/contracts.py +73 -4
- ksadk/evaluation/evaluators.py +183 -17
- ksadk/evaluation/evidence.py +258 -0
- ksadk/evaluation/executor.py +31 -6
- ksadk/evaluation/local_adapter.py +550 -0
- ksadk/evaluation/service_env.py +27 -0
- ksadk/evaluation/studio_build_adapter.py +253 -0
- ksadk/evaluation/target.py +15 -6
- ksadk/events/__init__.py +13 -13
- ksadk/events/_v1_compat/__init__.py +1 -0
- ksadk/events/_v1_compat/models.py +299 -0
- ksadk/events/_v1_compat/parser.py +247 -0
- ksadk/events/_v1_compat/projection.py +755 -0
- ksadk/events/adapters/__init__.py +34 -0
- ksadk/events/adapters/_a2a_snapshot.py +622 -0
- ksadk/events/adapters/_a2a_support.py +275 -0
- ksadk/events/adapters/_codex_interactions.py +375 -0
- ksadk/events/adapters/_codex_items.py +801 -0
- ksadk/events/adapters/_codex_validators.py +311 -0
- ksadk/events/adapters/_langgraph_support.py +785 -0
- ksadk/events/adapters/a2a.py +841 -0
- ksadk/events/adapters/adk.py +503 -0
- ksadk/events/adapters/codex.py +907 -0
- ksadk/events/adapters/langgraph.py +745 -0
- ksadk/events/canonical.py +440 -0
- ksadk/events/canonical_replay.py +497 -0
- ksadk/events/canonical_store.py +468 -0
- ksadk/events/cold_recovery.py +257 -0
- ksadk/events/content.py +89 -0
- ksadk/events/identity.py +86 -0
- ksadk/events/pipeline.py +455 -0
- ksadk/events/projections.py +66 -0
- ksadk/events/reducer.py +661 -0
- ksadk/events/replay.py +3 -36
- ksadk/events/runtime_event.py +20 -265
- ksadk/events/session_event.py +324 -0
- ksadk/events/store.py +3 -316
- ksadk/events/v1_compat.py +41 -0
- ksadk/harness/__init__.py +45 -35
- ksadk/harness/runtime.py +220 -58
- ksadk/identity/resolver.py +4 -3
- ksadk/interaction/__init__.py +28 -0
- ksadk/interaction/contracts.py +136 -0
- ksadk/interaction/ledger.py +189 -0
- ksadk/interaction/provider.py +122 -0
- ksadk/interaction/providers/__init__.py +52 -0
- ksadk/interaction/providers/adk.py +40 -0
- ksadk/interaction/providers/codex.py +94 -0
- ksadk/interaction/providers/langgraph.py +58 -0
- ksadk/kernel/__init__.py +117 -0
- ksadk/kernel/authorization.py +258 -0
- ksadk/kernel/bootstrap.py +1074 -0
- ksadk/kernel/contract_fingerprints.py +62 -0
- ksadk/kernel/contracts.py +370 -0
- ksadk/kernel/control.py +220 -0
- ksadk/kernel/errors.py +79 -0
- ksadk/kernel/ingress.py +1123 -0
- ksadk/kernel/mapping.py +111 -0
- ksadk/kernel/memory_store.py +1134 -0
- ksadk/kernel/postgres_store.py +1757 -0
- ksadk/kernel/recovery.py +452 -0
- ksadk/kernel/runtime_identity.py +103 -0
- ksadk/kernel/sql/001_agent_kernel.sql +120 -0
- ksadk/kernel/sqlite_store.py +1411 -0
- ksadk/kernel/state.py +145 -0
- ksadk/kernel/store.py +232 -0
- ksadk/kernel/worker.py +964 -0
- ksadk/knowledge_base/client.py +7 -0
- ksadk/knowledge_base/service.py +32 -5
- ksadk/memory/__init__.py +61 -0
- ksadk/memory/adk/backends/base_ltm_backend.py +96 -1
- ksadk/memory/adk/backends/http_ltm_backend.py +14 -5
- ksadk/memory/adk/backends/inmemory_ltm_backend.py +136 -3
- ksadk/memory/adk/backends/sdk_ltm_backend.py +384 -2
- ksadk/memory/adk/backends/sqlite_ltm_backend.py +95 -0
- ksadk/memory/coordinator.py +461 -0
- ksadk/memory/events.py +202 -0
- ksadk/memory/extraction.py +228 -0
- ksadk/memory/ltm_backend_factory.py +16 -3
- ksadk/memory/models.py +316 -0
- ksadk/memory/policy.py +215 -0
- ksadk/memory/provider.py +47 -0
- ksadk/memory/provider_adapter.py +159 -0
- ksadk/memory/provider_resolver.py +71 -0
- ksadk/memory/providers/__init__.py +5 -0
- ksadk/memory/providers/local_sqlite.py +497 -0
- ksadk/memory/resolved_policy.py +145 -0
- ksadk/memory/service.py +188 -6
- ksadk/model_proxy/bootstrap.py +16 -9
- ksadk/model_proxy/detect.py +202 -9
- ksadk/model_proxy/namespace.py +39 -15
- ksadk/model_proxy/server.py +24 -5
- ksadk/model_proxy/transform.py +60 -2
- ksadk/observability/__init__.py +25 -0
- ksadk/observability/session_log.py +420 -0
- ksadk/observability/trajectory.py +105 -0
- ksadk/plugins/__init__.py +167 -0
- ksadk/plugins/bridges/__init__.py +45 -0
- ksadk/plugins/bridges/codex.py +552 -0
- ksadk/plugins/bridges/dsh.py +1116 -0
- ksadk/plugins/builtins.py +747 -0
- ksadk/plugins/bundle.py +246 -0
- ksadk/plugins/bundle_security.py +167 -0
- ksadk/plugins/composition.py +529 -0
- ksadk/plugins/context_contributor.py +437 -0
- ksadk/plugins/contracts.py +451 -0
- ksadk/plugins/dsh_toolchain.py +935 -0
- ksadk/plugins/ecosystem_bridge.py +1105 -0
- ksadk/plugins/ecosystem_probe.py +191 -0
- ksadk/plugins/host.py +724 -0
- ksadk/plugins/providers/__init__.py +85 -0
- ksadk/plugins/providers/bundles/ksadk-codex/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/ksadk-codex/index.mjs +18 -0
- ksadk/plugins/providers/bundles/ksadk-codex/package.json +19 -0
- ksadk/plugins/providers/bundles/ksadk-harness/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/ksadk-harness/index.mjs +19 -0
- ksadk/plugins/providers/bundles/ksadk-harness/package.json +19 -0
- ksadk/plugins/providers/codex.py +722 -0
- ksadk/plugins/providers/codex_dsh.py +83 -0
- ksadk/plugins/providers/dsh.py +951 -0
- ksadk/plugins/providers/dsh_descriptor_host.py +226 -0
- ksadk/plugins/providers/harness.py +627 -0
- ksadk/plugins/providers/harness_dsh.py +91 -0
- ksadk/plugins/providers/legacy.py +215 -0
- ksadk/plugins/providers/legacy_catalog.py +100 -0
- ksadk/plugins/providers/shipped_dsh.py +370 -0
- ksadk/plugins/resolver.py +331 -0
- ksadk/plugins/subagent_providers/__init__.py +12 -0
- ksadk/plugins/subagent_providers/codex.py +443 -0
- ksadk/plugins/subagents.py +333 -0
- ksadk/prompts/__init__.py +71 -0
- ksadk/prompts/compiler.py +215 -0
- ksadk/prompts/models.py +82 -0
- ksadk/prompts/projection.py +89 -0
- ksadk/prompts/resolved.py +137 -0
- ksadk/prompts/sources.py +233 -0
- ksadk/runners/_langgraph_runner_streams.py +822 -0
- ksadk/runners/adk_runner.py +5 -5
- ksadk/runners/base_runner.py +16 -0
- ksadk/runners/factory.py +1 -2
- ksadk/runners/langgraph_runner.py +198 -437
- ksadk/runtime/_runner_adapter/__init__.py +1 -0
- ksadk/runtime/_runner_adapter/stream_mapping.py +797 -0
- ksadk/runtime/adapter.py +119 -2
- ksadk/runtime/conversation_execution.py +316 -182
- ksadk/runtime/executor.py +144 -3
- ksadk/runtime/factory.py +268 -8
- ksadk/runtime/framework_adapters.py +18 -0
- ksadk/runtime/hosted_finalizer.py +268 -0
- ksadk/runtime/launch.py +14 -1
- ksadk/runtime/preprocessing.py +25 -3
- ksadk/runtime/runner_adapter.py +293 -508
- ksadk/runtime/usage.py +33 -0
- ksadk/sandbox/__init__.py +2 -1
- ksadk/sandbox/backends/e2b.py +35 -2
- ksadk/sandbox/factory.py +72 -0
- ksadk/scheduler/__init__.py +18 -0
- ksadk/scheduler/calendar.py +102 -0
- ksadk/scheduler/contracts.py +254 -0
- ksadk/scheduler/dispatcher.py +129 -0
- ksadk/scheduler/engine.py +416 -0
- ksadk/scheduler/sqlite_store.py +563 -0
- ksadk/server/composition.py +8 -0
- ksadk/server/factory.py +69 -6
- ksadk/server/routes/kernel_ingress.py +258 -0
- ksadk/server/routes/openai_compat.py +88 -8
- ksadk/server/routes/projection.py +35 -20
- ksadk/server/routes/run.py +94 -0
- ksadk/server/routes/sessions.py +2 -0
- ksadk/server/routes/streaming.py +5 -2
- ksadk/server/static/assets/{ArtifactsPanel-CakCqxEN.js → ArtifactsPanel-10GPXIJ6.js} +1 -1
- ksadk/server/static/assets/{CodeBlock-CynLknyO.js → CodeBlock-BXk1l-G1.js} +4 -4
- ksadk/server/static/assets/MathMessageMarkdown-BorAY7qD.css +1 -0
- ksadk/server/static/assets/{MathMessageMarkdown-3sQdOysS.js → MathMessageMarkdown-D9uB55Oh.js} +4 -4
- ksadk/server/static/assets/MermaidBlock--OEYoXIJ.js +312 -0
- ksadk/server/static/assets/NativeTerminalPanel-DrEe1syq.js +1 -0
- ksadk/server/static/assets/abnfDiagram-VCTEODGH-eeTFJLvo.js +1 -0
- ksadk/server/static/assets/arc-S3ZNbIAd.js +1 -0
- ksadk/server/static/assets/architecture-7GRP2DOG-Dk9nRQ6-.js +1 -0
- ksadk/server/static/assets/architectureDiagram-5GKGNRK7-CRjgEJDX.js +36 -0
- ksadk/server/static/assets/blockDiagram-NRAW4CY4-C7bsBoNH.js +129 -0
- ksadk/server/static/assets/c4Diagram-UCG6FXSJ-BX3c33Ob.js +38 -0
- ksadk/server/static/assets/channel-s354Yo6o.js +1 -0
- ksadk/server/static/assets/chunk-2Q5K7J3B-CDpPpKR5.js +1 -0
- ksadk/server/static/assets/{chunk-FMBD7UC4-B_fH2YuH.js → chunk-5VM5RSS4-bZ7ws-8m.js} +1 -1
- ksadk/server/static/assets/{chunk-ND2GUHAM-D6rFLaVV.js → chunk-F27PBJKO-D2r0pvhY.js} +1 -1
- ksadk/server/static/assets/chunk-G27WJ6UU-CZwF3oUP.js +231 -0
- ksadk/server/static/assets/{chunk-4BX2VUAB-B9drTgOW.js → chunk-JWPE2WC7-DigFYCML.js} +1 -1
- ksadk/server/static/assets/chunk-LCL6LL3I-CnorGV5q.js +206 -0
- ksadk/server/static/assets/chunk-POPQ4Y6H-CexntQA-.js +1 -0
- ksadk/server/static/assets/chunk-RHFEMEQ7-CHTC7UxA.js +168 -0
- ksadk/server/static/assets/chunk-SVP7TREG-BC1EWt_-.js +88 -0
- ksadk/server/static/assets/chunk-XXDRQBXY-BTG24xN0.js +1 -0
- ksadk/server/static/assets/classDiagram-DTDB5LWJ-Dd0nucl9.js +1 -0
- ksadk/server/static/assets/classDiagram-v2-JRS7N3AN-Dd0nucl9.js +1 -0
- ksadk/server/static/assets/{cose-bilkent-S5V4N54A-ChNs_Mdk.js → cose-bilkent-JH36ORCC-CkonRdAS.js} +1 -1
- ksadk/server/static/assets/cynefin-OW5HDTMX-BBlT4uMf.js +1 -0
- ksadk/server/static/assets/cynefinDiagram-5FMLGOSQ-DEOCBe15.js +62 -0
- ksadk/server/static/assets/cytoscape.esm-CyCl8rPi.js +321 -0
- ksadk/server/static/assets/dagre-3AP2YEHR-DBThPuLa.js +4 -0
- ksadk/server/static/assets/dagre-ClTPrTht.js +1 -0
- ksadk/server/static/assets/diagram-S7CK7UJ4-DsZHrnpJ.js +30 -0
- ksadk/server/static/assets/diagram-UQ7AKVKN-BJR4nhVr.js +41 -0
- ksadk/server/static/assets/diagram-VSXAHHWV-xzcERX0a.js +3 -0
- ksadk/server/static/assets/diagram-VX7I27RA-tn2xM1xu.js +24 -0
- ksadk/server/static/assets/diagram-Z3DM3KII-BZPGBkw5.js +24 -0
- ksadk/server/static/assets/{dist-gLnrGsoU.js → dist-4zN1_tq5.js} +1 -1
- ksadk/server/static/assets/{dist-C1sz5Eo3.js → dist-8VWI-2bZ.js} +1 -1
- ksadk/server/static/assets/{dist-BjOdlDjj.js → dist-B-46q3Hk.js} +1 -1
- ksadk/server/static/assets/{dist-o2OVmKvt.js → dist-B0gdk4rl.js} +1 -1
- ksadk/server/static/assets/{dist-4N2NMVYg.js → dist-B1oWRmrH.js} +1 -1
- ksadk/server/static/assets/{dist-CmZHzlwZ.js → dist-BI1qQH4n.js} +1 -1
- ksadk/server/static/assets/{dist-X4TnqwOK.js → dist-BJLUwH6W.js} +1 -1
- ksadk/server/static/assets/{dist-B5oS1zcj.js → dist-Bbwqa8TG.js} +1 -1
- ksadk/server/static/assets/{dist-j6Dxmf_j.js → dist-Btyo4vX4.js} +1 -1
- ksadk/server/static/assets/{dist-DQU9EWw-.js → dist-C71CsujO.js} +1 -1
- ksadk/server/static/assets/{dist-BIlKoW0k.js → dist-CXpH_Rdd.js} +1 -1
- ksadk/server/static/assets/{dist-DJN_6Y39.js → dist-Cq4OL6nO.js} +1 -1
- ksadk/server/static/assets/{dist-Dli7qW-B.js → dist-D1V3f1B4.js} +1 -1
- ksadk/server/static/assets/{dist-fhOuWds5.js → dist-DJmCPRVB.js} +1 -1
- ksadk/server/static/assets/{dist-CWV4lDr1.js → dist-DQAB0qn_.js} +2 -2
- ksadk/server/static/assets/{dist-D6MpCZtz.js → dist-DUwKa_l6.js} +1 -1
- ksadk/server/static/assets/dist-DdRBIceA.js +1 -0
- ksadk/server/static/assets/{dist-DWKByxWV.js → dist-DfGFrb0v.js} +1 -1
- ksadk/server/static/assets/{dist-DsHPdk3W.js → dist-DjhwGUgZ.js} +1 -1
- ksadk/server/static/assets/{dist-B-jNR6Vn.js → dist-DyqV4fL4.js} +1 -1
- ksadk/server/static/assets/{dist-BB3-OwTQ.js → dist-M67Hwu0n.js} +1 -1
- ksadk/server/static/assets/{dist-_pHPTyZ-.js → dist-u8tVH5Ak.js} +1 -1
- ksadk/server/static/assets/ebnfDiagram-PWID7BFC-DVfMsLge.js +1 -0
- ksadk/server/static/assets/erDiagram-SSCWMZ5O-CWEZSYaw.js +99 -0
- ksadk/server/static/assets/eventmodeling-NTZA5JFV-Dr5okd8V.js +1 -0
- ksadk/server/static/assets/flowDiagram-A5DVABFB-VEO-cVcO.js +1 -0
- ksadk/server/static/assets/ganttDiagram-EL5Y4UJY-TWIxoyYL.js +292 -0
- ksadk/server/static/assets/gitGraph-4MIJSDKK-CKiKY9Cf.js +1 -0
- ksadk/server/static/assets/gitGraphDiagram-WWUBYQGX-DDh2hd2S.js +106 -0
- ksadk/server/static/assets/index-B2k_urY8.js +241 -0
- ksadk/server/static/assets/index-ILPt6IWF.css +2 -0
- ksadk/server/static/assets/info-A6RAGUB7-ubA4Nm_p.js +1 -0
- ksadk/server/static/assets/infoDiagram-RXCK75RN-CgoyWiDR.js +2 -0
- ksadk/server/static/assets/{ishikawaDiagram-YF4QCWOH-K0OOfVna.js → ishikawaDiagram-5VMMS53U-CyRIu_om.js} +6 -6
- ksadk/server/static/assets/{journeyDiagram-JHISSGLW-8LeOJaZp.js → journeyDiagram-EYS64GPL-DN5JXHzN.js} +6 -6
- ksadk/server/static/assets/{kanban-definition-UN3LZRKU-C6uCgZrW.js → kanban-definition-3QL26DDD-CNP3ui66.js} +10 -10
- ksadk/server/static/assets/katex-DWEzQy1d.js +257 -0
- ksadk/server/static/assets/{linear-hdBcYzM8.js → linear-C-qHp7d2.js} +1 -1
- ksadk/server/static/assets/mermaid-parser.core-Cl-K943T.js +166 -0
- ksadk/server/static/assets/{mindmap-definition-RKZ34NQL-Bjy_2v4_.js → mindmap-definition-FBJOCRG2-D5DB5mYm.js} +29 -29
- ksadk/server/static/assets/packet-AYTQ26CC-C7R3NUlK.js +1 -0
- ksadk/server/static/assets/pegDiagram-XKGWAZYB-BQVc9ia_.js +1 -0
- ksadk/server/static/assets/pie-WAS4IAKB-BIT6qjr3.js +1 -0
- ksadk/server/static/assets/pieDiagram-E7YTZNPT-B6UCAvtY.js +39 -0
- ksadk/server/static/assets/{quadrantDiagram-W4KKPZXB-BmkRbwCg.js → quadrantDiagram-AXDQQJYC-mIr2d3eb.js} +6 -6
- ksadk/server/static/assets/radar-RG4KPBEZ-l5noef9X.js +1 -0
- ksadk/server/static/assets/railroad-74A4TZTK-Baea6ZvM.js +1 -0
- ksadk/server/static/assets/railroad-abnf-HS5TGJTU-OKn8zZnU.js +1 -0
- ksadk/server/static/assets/railroad-ebnf-LZEXJU2U-DdKAKC4l.js +1 -0
- ksadk/server/static/assets/railroad-peg-WCYAUIDC-Bds8udlG.js +1 -0
- ksadk/server/static/assets/railroadDiagram-O6MQD6OU-Dt3FFDmK.js +1 -0
- ksadk/server/static/assets/requirementDiagram-EFPCY7ZU-Cz_vQtgF.js +84 -0
- ksadk/server/static/assets/{sankeyDiagram-5OEKKPKP-l6iXmU65.js → sankeyDiagram-P5KCCOFB-wlO1TsH5.js} +7 -7
- ksadk/server/static/assets/{sequenceDiagram-3UESZ5HK-Cq6UBeQB.js → sequenceDiagram-WJ2MYXX4-CHRbElYq.js} +10 -10
- ksadk/server/static/assets/sizeCapture-X5ZJPWSS-DXX54iyO.js +1 -0
- ksadk/server/static/assets/stateDiagram-HBIQ2CUA-Dp_lw9II.js +1 -0
- ksadk/server/static/assets/stateDiagram-v2-4QOOHH4V-5b-8o2iS.js +1 -0
- ksadk/server/static/assets/swimlanes-XN3QIQJK-D8O5UlLG.js +1 -0
- ksadk/server/static/assets/swimlanesDiagram-VK2B7HYN-uf6WPRA4.js +8 -0
- ksadk/server/static/assets/{timeline-definition-PNZ67QCA-DEz24vV0.js → timeline-definition-24CTP7MA-8mfKcxvG.js} +7 -7
- ksadk/server/static/assets/treeView-Q6P3EWNA-CK5CSrSO.js +1 -0
- ksadk/server/static/assets/treemap-WGGIJYW6-Ch2BKgAM.js +1 -0
- ksadk/server/static/assets/vennDiagram-4TSXK5OY-EnNl0DE7.js +34 -0
- ksadk/server/static/assets/wardley-WFR3VGLG-YW3Q0ml_.js +1 -0
- ksadk/server/static/assets/wardleyDiagram-VM6X3IG4-DBu5fbYr.js +78 -0
- ksadk/server/static/assets/xychartDiagram-S5SC5T6Z-BSVXs4IY.js +7 -0
- ksadk/server/static/index.html +2 -2
- ksadk/sessions/__init__.py +26 -9
- ksadk/sessions/_local_service_sync.py +688 -0
- ksadk/sessions/_local_tables.py +21 -0
- ksadk/sessions/_postgres_schema.py +305 -0
- ksadk/sessions/_postgres_tables.py +15 -0
- ksadk/sessions/base.py +80 -1
- ksadk/sessions/in_memory.py +53 -2
- ksadk/sessions/local_service.py +63 -604
- ksadk/sessions/postgres_service.py +58 -148
- ksadk/sessions/resilient.py +35 -1
- ksadk/skills/service_client.py +48 -0
- ksadk/studio/agent_lifecycle.py +26 -20
- ksadk/studio/api.py +1063 -69
- ksadk/studio/api_catalog_routes.py +5 -0
- ksadk/studio/api_contracts.py +148 -6
- ksadk/studio/api_memory_routes.py +82 -0
- ksadk/studio/api_plugin_routes.py +480 -0
- ksadk/studio/attachment_store.py +187 -0
- ksadk/studio/authoring.py +259 -28
- ksadk/studio/authoring_coordinator.py +809 -67
- ksadk/studio/builder.py +197 -40
- ksadk/studio/capabilities.py +17 -0
- ksadk/studio/cloud.py +1920 -95
- ksadk/studio/codex_agent_service.py +137 -15
- ksadk/studio/codex_authoring.py +469 -0
- ksadk/studio/codex_builder.py +177 -25
- ksadk/studio/codex_manifest.py +71 -22
- ksadk/studio/codex_run.py +59 -4
- ksadk/studio/compatibility_report.py +445 -0
- ksadk/studio/compiler.py +7 -1
- ksadk/studio/contracts.py +234 -4
- ksadk/studio/dsh_provider_registration.py +768 -0
- ksadk/studio/event_store.py +79 -101
- ksadk/studio/framework_run.py +264 -3
- ksadk/studio/hosted_kernel.py +317 -0
- ksadk/studio/manifest_resolver.py +131 -0
- ksadk/studio/model_client.py +95 -9
- ksadk/studio/model_profile_service.py +1 -1
- ksadk/studio/operations.py +47 -5
- ksadk/studio/otel_trace.py +348 -42
- ksadk/studio/pcm_memory.py +85 -0
- ksadk/studio/plugin_composition.py +301 -0
- ksadk/studio/plugin_kernel_adapter.py +128 -0
- ksadk/studio/plugin_runtime.py +652 -0
- ksadk/studio/repository.py +23 -2
- ksadk/studio/resource_catalog.py +49 -1
- ksadk/studio/run_service.py +1266 -202
- ksadk/studio/runtime_source.py +51 -17
- ksadk/studio/scheduler_runtime.py +374 -0
- ksadk/studio/scheduler_service.py +211 -0
- ksadk/studio/service.py +1815 -117
- ksadk/studio/shared_web.py +199 -50
- ksadk/studio/soul.py +52 -0
- ksadk/studio/static/assets/index-DXs1Eq4M.css +1 -0
- ksadk/studio/static/assets/index-DeDqwTsD.js +283 -0
- ksadk/studio/static/index.html +2 -2
- ksadk/studio/templates.py +100 -8
- ksadk/studio/validator.py +20 -1
- ksadk/studio/workspace.py +31 -32
- ksadk/tracing/setup.py +304 -3
- ksadk/version.py +1 -1
- ksadk_runtime_common/schemas/runtime_event_v1.json +37 -0
- ksadk_runtime_common/schemas/runtime_event_v2.json +271 -0
- ksadk_runtime_common/workspace_files/path_utils.py +41 -0
- ksadk/events/parser.py +0 -191
- ksadk/server/static/assets/MathMessageMarkdown-DeYh8QPr.css +0 -1
- ksadk/server/static/assets/MermaidBlock-NERD_ef7.js +0 -303
- ksadk/server/static/assets/NativeTerminalPanel-CiHWf82q.js +0 -1
- ksadk/server/static/assets/arc-DrgjcKhl.js +0 -1
- ksadk/server/static/assets/architecture-7EHR7CIX-CpZLRCcY.js +0 -1
- ksadk/server/static/assets/architectureDiagram-3BPJPVTR-BXoVRbQ6.js +0 -36
- ksadk/server/static/assets/blockDiagram-GPEHLZMM-BnaB3Ywv.js +0 -132
- ksadk/server/static/assets/c4Diagram-AAUBKEIU-Dw4weZcp.js +0 -10
- ksadk/server/static/assets/channel-Dt3rQTFI.js +0 -1
- ksadk/server/static/assets/chunk-2J33WTMH-ChjpLK7j.js +0 -1
- ksadk/server/static/assets/chunk-55IACEB6-CK4ROATy.js +0 -1
- ksadk/server/static/assets/chunk-727SXJPM-B9KtTTgw.js +0 -206
- ksadk/server/static/assets/chunk-AQP2D5EJ-1O1mki3m.js +0 -231
- ksadk/server/static/assets/chunk-QZHKN3VN-iXEZtKQc.js +0 -1
- ksadk/server/static/assets/classDiagram-4FO5ZUOK-DIveV17Q.js +0 -1
- ksadk/server/static/assets/classDiagram-v2-Q7XG4LA2-DIveV17Q.js +0 -1
- ksadk/server/static/assets/cytoscape.esm-DelgaX4f.js +0 -321
- ksadk/server/static/assets/dagre-BM42HDAG-D0QXg_MQ.js +0 -4
- ksadk/server/static/assets/dagre-Bx709z4p.js +0 -1
- ksadk/server/static/assets/diagram-2AECGRRQ-DBDDKwBQ.js +0 -43
- ksadk/server/static/assets/diagram-5GNKFQAL-BkwDOxmO.js +0 -10
- ksadk/server/static/assets/diagram-KO2AKTUF-Bv8waYvY.js +0 -3
- ksadk/server/static/assets/diagram-LMA3HP47-e1VECDdu.js +0 -24
- ksadk/server/static/assets/diagram-OG6HWLK6-Ds9adfRl.js +0 -24
- ksadk/server/static/assets/dist-B5J2uhNk.js +0 -1
- ksadk/server/static/assets/erDiagram-TEJ5UH35-BPItFKH6.js +0 -85
- ksadk/server/static/assets/eventmodeling-FCH6USID-DYFSxbqr.js +0 -1
- ksadk/server/static/assets/flowDiagram-I6XJVG4X-BbYB9w5Y.js +0 -162
- ksadk/server/static/assets/ganttDiagram-6RSMTGT7-TQXa0KXv.js +0 -292
- ksadk/server/static/assets/gitGraph-WXDBUCRP-DyNYp6BN.js +0 -1
- ksadk/server/static/assets/gitGraphDiagram-PVQCEYII-bKblCnpa.js +0 -106
- ksadk/server/static/assets/graphlib-B8gBHxth.js +0 -1
- ksadk/server/static/assets/index-R52pJJvg.js +0 -177
- ksadk/server/static/assets/index-jJr3_955.css +0 -2
- ksadk/server/static/assets/info-J43DQDTF-WUx7qTde.js +0 -1
- ksadk/server/static/assets/infoDiagram-5YYISTIA-BGVT7J_i.js +0 -2
- ksadk/server/static/assets/katex-CYWseY5E.js +0 -265
- ksadk/server/static/assets/mermaid-parser.core-BWrDjSZM.js +0 -161
- ksadk/server/static/assets/packet-YPE3B663-BN13y_xl.js +0 -1
- ksadk/server/static/assets/pie-LRSECV5Y-ftSLXhhc.js +0 -1
- ksadk/server/static/assets/pieDiagram-4H26LBE5-GmmqNiVH.js +0 -30
- ksadk/server/static/assets/radar-GUYGQ44K-jaICkIeO.js +0 -1
- ksadk/server/static/assets/requirementDiagram-4Y6WPE33-DSWFqL7c.js +0 -84
- ksadk/server/static/assets/stateDiagram-AJRCARHV-qzTQpg3Y.js +0 -1
- ksadk/server/static/assets/stateDiagram-v2-BHNVJYJU-BYCoYGAN.js +0 -1
- ksadk/server/static/assets/treeView-BLDUP644-Cpib_vlz.js +0 -1
- ksadk/server/static/assets/treemap-LRROVOQU-DQxfmVHK.js +0 -1
- ksadk/server/static/assets/vennDiagram-CIIHVFJN-CMCixki2.js +0 -34
- ksadk/server/static/assets/wardley-L42UT6IY-BQYHnnkU.js +0 -1
- ksadk/server/static/assets/wardleyDiagram-YWT4CUSO-CVzB8F9K.js +0 -78
- ksadk/server/static/assets/xychartDiagram-2RQKCTM6-BFBqBLc1.js +0 -7
- ksadk/studio/evaluation.py +0 -192
- ksadk/studio/static/assets/index-CaEN0eTR.css +0 -1
- ksadk/studio/static/assets/index-DI2eY_NH.js +0 -252
- {agentengine_sdk_python-0.8.1.dist-info → agentengine_sdk_python-0.8.3.dist-info}/WHEEL +0 -0
- {agentengine_sdk_python-0.8.1.dist-info → agentengine_sdk_python-0.8.3.dist-info}/entry_points.txt +0 -0
- {agentengine_sdk_python-0.8.1.dist-info → agentengine_sdk_python-0.8.3.dist-info}/licenses/LICENSE +0 -0
- {agentengine_sdk_python-0.8.1.dist-info → agentengine_sdk_python-0.8.3.dist-info}/top_level.txt +0 -0
ksadk/cli/cmd_plugin.py
ADDED
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
"""``agentengine plugin`` - DSH-native and Codex-compatible plugin management.
|
|
2
|
+
|
|
3
|
+
The stable CLI deliberately exposes only two ecosystems. Top-level lifecycle
|
|
4
|
+
commands manage the active DeepSeek Harness Profile; ``plugin dsh`` remains a
|
|
5
|
+
compatibility alias for scripts that adopted the earlier explicit namespace.
|
|
6
|
+
Codex plugins stay under ``plugin codex`` because their lifecycle is owned by
|
|
7
|
+
Codex App Server.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import asyncio
|
|
13
|
+
import os
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Any
|
|
16
|
+
|
|
17
|
+
import click
|
|
18
|
+
|
|
19
|
+
from ksadk.cli.error_utils import (
|
|
20
|
+
EXIT_CODE_RESOLUTION,
|
|
21
|
+
EXIT_CODE_VALIDATION,
|
|
22
|
+
CLIError,
|
|
23
|
+
abort_with_cli_error,
|
|
24
|
+
)
|
|
25
|
+
from ksadk.cli.resource_common import CONTEXT_SETTINGS
|
|
26
|
+
from ksadk.cli.ui import emit_json, is_json_output, print_info, print_kv, print_success
|
|
27
|
+
|
|
28
|
+
CODEX_HOME_ENV = "KSADK_CODEX_HOME"
|
|
29
|
+
DSH_HOME_ENV = "KSADK_DSH_HOME"
|
|
30
|
+
DSH_BIN_ENV = "KSADK_DSH_BIN"
|
|
31
|
+
DSH_PROFILE_ENV = "KSADK_DSH_PROFILE"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _codex_home() -> Path:
|
|
35
|
+
"""Use the same workspace-isolated Codex home as the local Runtime."""
|
|
36
|
+
|
|
37
|
+
configured = os.environ.get(CODEX_HOME_ENV, "").strip()
|
|
38
|
+
if configured:
|
|
39
|
+
return Path(configured).expanduser()
|
|
40
|
+
return Path.cwd() / ".agentkit" / "codex-home"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _dsh_home() -> Path:
|
|
44
|
+
configured = os.environ.get(DSH_HOME_ENV, "").strip()
|
|
45
|
+
if configured:
|
|
46
|
+
return Path(configured).expanduser()
|
|
47
|
+
return Path.cwd() / ".agentkit" / "dsh-home"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _dsh_command() -> tuple[str, ...] | None:
|
|
51
|
+
configured = os.environ.get(DSH_BIN_ENV, "").strip()
|
|
52
|
+
from ksadk.plugins.dsh_toolchain import DshToolchainManager
|
|
53
|
+
|
|
54
|
+
return DshToolchainManager().require_command(configured or None)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _dsh_profile() -> str:
|
|
58
|
+
return os.environ.get(DSH_PROFILE_ENV, "").strip() or "ksadk"
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _codex_inventory_payload(value: Any) -> dict[str, Any]:
|
|
62
|
+
"""Project Codex host inventory without leaking marketplace filesystem paths."""
|
|
63
|
+
|
|
64
|
+
raw = value.model_dump(mode="json", by_alias=True, exclude_none=True)
|
|
65
|
+
return {
|
|
66
|
+
"ecosystem": "codex",
|
|
67
|
+
"integrationMode": "bridged",
|
|
68
|
+
"pluginId": raw["pluginId"],
|
|
69
|
+
"name": raw["name"],
|
|
70
|
+
"marketplaceName": raw["marketplaceName"],
|
|
71
|
+
"version": raw.get("version"),
|
|
72
|
+
"installed": raw["installed"],
|
|
73
|
+
"enabled": raw["enabled"],
|
|
74
|
+
"availability": raw["availability"],
|
|
75
|
+
"permissionsDeclared": False,
|
|
76
|
+
"riskDisclosures": raw.get("riskDisclosures", []),
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _dsh_inventory_payload(value: Any) -> dict[str, Any]:
|
|
81
|
+
return value.model_dump(mode="json", by_alias=True, exclude_none=True)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
async def _with_codex_bridge(operation):
|
|
85
|
+
from ksadk.plugins.bridges.codex import CodexAppServerPluginBridge
|
|
86
|
+
|
|
87
|
+
async with CodexAppServerPluginBridge(codex_home=_codex_home()) as bridge:
|
|
88
|
+
return bridge.host, await operation(bridge)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _call_codex(operation):
|
|
92
|
+
"""Run one bounded App Server lifecycle request from the synchronous CLI."""
|
|
93
|
+
|
|
94
|
+
try:
|
|
95
|
+
return asyncio.run(_with_codex_bridge(operation))
|
|
96
|
+
except (KeyboardInterrupt, SystemExit):
|
|
97
|
+
raise
|
|
98
|
+
except Exception as err:
|
|
99
|
+
code = (
|
|
100
|
+
"codex_plugin_not_found"
|
|
101
|
+
if type(err).__name__ == "CodexPluginNotFoundError"
|
|
102
|
+
else (
|
|
103
|
+
"codex_plugin_permission_confirmation_required"
|
|
104
|
+
if type(err).__name__ == "CodexPluginApprovalRequired"
|
|
105
|
+
else "codex_plugin_host_unavailable"
|
|
106
|
+
)
|
|
107
|
+
)
|
|
108
|
+
abort_with_cli_error(
|
|
109
|
+
CLIError(
|
|
110
|
+
code=code,
|
|
111
|
+
message=(
|
|
112
|
+
"Codex 插件不存在或来源不唯一"
|
|
113
|
+
if code == "codex_plugin_not_found"
|
|
114
|
+
else "安装前必须确认 Codex App Server 宿主权限风险"
|
|
115
|
+
if code == "codex_plugin_permission_confirmation_required"
|
|
116
|
+
else "Codex 插件宿主当前不可用"
|
|
117
|
+
),
|
|
118
|
+
exit_code=(
|
|
119
|
+
EXIT_CODE_RESOLUTION
|
|
120
|
+
if code == "codex_plugin_not_found"
|
|
121
|
+
else EXIT_CODE_VALIDATION
|
|
122
|
+
),
|
|
123
|
+
),
|
|
124
|
+
context="Plugin",
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _call_dsh(operation):
|
|
129
|
+
"""Run one bounded DSH Profile lifecycle request from the synchronous CLI."""
|
|
130
|
+
|
|
131
|
+
from ksadk.plugins.bridges.dsh import DshProfilePluginBridge
|
|
132
|
+
|
|
133
|
+
try:
|
|
134
|
+
with DshProfilePluginBridge(
|
|
135
|
+
dsh_home=_dsh_home(),
|
|
136
|
+
profile=_dsh_profile(),
|
|
137
|
+
dsh_command=_dsh_command(),
|
|
138
|
+
) as bridge:
|
|
139
|
+
return bridge.host, operation(bridge)
|
|
140
|
+
except (KeyboardInterrupt, SystemExit):
|
|
141
|
+
raise
|
|
142
|
+
except Exception as err:
|
|
143
|
+
name = type(err).__name__
|
|
144
|
+
code = (
|
|
145
|
+
"dsh_plugin_not_found"
|
|
146
|
+
if name == "DshPluginNotFoundError"
|
|
147
|
+
else "dsh_plugin_permission_confirmation_required"
|
|
148
|
+
if name == "DshPluginApprovalRequired"
|
|
149
|
+
else "dsh_plugin_operation_failed"
|
|
150
|
+
if name in {"DshPluginMutationError", "ValueError"}
|
|
151
|
+
else "dsh_plugin_host_unavailable"
|
|
152
|
+
)
|
|
153
|
+
messages = {
|
|
154
|
+
"dsh_plugin_not_found": "DSH 插件未安装",
|
|
155
|
+
"dsh_plugin_permission_confirmation_required": (
|
|
156
|
+
"安装或升级前必须确认 DSH 宿主权限风险"
|
|
157
|
+
),
|
|
158
|
+
"dsh_plugin_operation_failed": "DSH 插件操作失败,原 Profile 已保留",
|
|
159
|
+
"dsh_plugin_host_unavailable": "DSH 插件宿主当前不可用",
|
|
160
|
+
}
|
|
161
|
+
abort_with_cli_error(
|
|
162
|
+
CLIError(
|
|
163
|
+
code=code,
|
|
164
|
+
message=messages[code],
|
|
165
|
+
exit_code=(
|
|
166
|
+
EXIT_CODE_RESOLUTION if code == "dsh_plugin_not_found" else EXIT_CODE_VALIDATION
|
|
167
|
+
),
|
|
168
|
+
),
|
|
169
|
+
context="Plugin",
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def _call_dsh_developer(operation):
|
|
174
|
+
"""Run one bounded standard DSH bundle development operation."""
|
|
175
|
+
|
|
176
|
+
from ksadk.plugins.dsh_toolchain import (
|
|
177
|
+
DshPluginPackError,
|
|
178
|
+
DshPluginSourceError,
|
|
179
|
+
DshPluginValidationError,
|
|
180
|
+
DshToolchainInstallError,
|
|
181
|
+
DshToolchainUnavailableError,
|
|
182
|
+
DshToolchainVersionMismatchError,
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
try:
|
|
186
|
+
return operation()
|
|
187
|
+
except (KeyboardInterrupt, SystemExit):
|
|
188
|
+
raise
|
|
189
|
+
except Exception as err:
|
|
190
|
+
if isinstance(err, DshToolchainVersionMismatchError):
|
|
191
|
+
code = "dsh_toolchain_version_mismatch"
|
|
192
|
+
message = "DSH 或 pnpm 版本与受支持工具链不一致"
|
|
193
|
+
elif isinstance(err, DshToolchainUnavailableError):
|
|
194
|
+
code = "dsh_toolchain_unavailable"
|
|
195
|
+
message = "DSH 插件开发工具链不可用"
|
|
196
|
+
elif isinstance(err, DshToolchainInstallError):
|
|
197
|
+
code = "dsh_toolchain_install_failed"
|
|
198
|
+
message = "DSH 插件开发工具链安装失败"
|
|
199
|
+
elif isinstance(err, DshPluginSourceError):
|
|
200
|
+
code = "dsh_plugin_source_invalid"
|
|
201
|
+
message = "DSH 插件源码不是有效的标准 Bundle"
|
|
202
|
+
elif isinstance(err, DshPluginValidationError):
|
|
203
|
+
code = "dsh_plugin_validation_failed"
|
|
204
|
+
message = "DSH 插件生命周期校验失败"
|
|
205
|
+
elif isinstance(err, DshPluginPackError):
|
|
206
|
+
code = "dsh_plugin_pack_failed"
|
|
207
|
+
message = "DSH 插件 npm 打包失败"
|
|
208
|
+
else:
|
|
209
|
+
raise
|
|
210
|
+
details = {}
|
|
211
|
+
stage = getattr(err, "stage", None)
|
|
212
|
+
if isinstance(stage, str) and stage:
|
|
213
|
+
details["stage"] = stage
|
|
214
|
+
abort_with_cli_error(
|
|
215
|
+
CLIError(
|
|
216
|
+
code=code,
|
|
217
|
+
message=message,
|
|
218
|
+
exit_code=EXIT_CODE_VALIDATION,
|
|
219
|
+
details=details,
|
|
220
|
+
),
|
|
221
|
+
context="Plugin",
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
@click.group("plugin", context_settings=CONTEXT_SETTINGS)
|
|
226
|
+
def plugin() -> None:
|
|
227
|
+
"""管理 DSH 插件,并兼容 Codex App Server 插件。"""
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
@plugin.group("toolchain", context_settings=CONTEXT_SETTINGS)
|
|
231
|
+
def plugin_toolchain() -> None:
|
|
232
|
+
"""管理固定版本、隔离安装的 DSH 插件开发工具链。"""
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
@plugin_toolchain.command("status", context_settings=CONTEXT_SETTINGS)
|
|
236
|
+
def plugin_toolchain_status() -> None:
|
|
237
|
+
"""检查受管理 DSH CLI、实际版本、pnpm 和锁文件。"""
|
|
238
|
+
|
|
239
|
+
from ksadk.plugins.dsh_toolchain import DshToolchainManager
|
|
240
|
+
|
|
241
|
+
state = DshToolchainManager().status()
|
|
242
|
+
payload = state.model_dump(mode="json", by_alias=True, exclude_none=True)
|
|
243
|
+
if is_json_output():
|
|
244
|
+
emit_json(payload)
|
|
245
|
+
return
|
|
246
|
+
print_kv("DSH", state.actual_version or state.expected_version)
|
|
247
|
+
print_kv("状态", "可用" if state.usable else "未安装或不完整")
|
|
248
|
+
print_kv("目录", state.root)
|
|
249
|
+
if state.problem:
|
|
250
|
+
print_kv("问题", state.problem)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
@plugin_toolchain.command("install", context_settings=CONTEXT_SETTINGS)
|
|
254
|
+
def install_plugin_toolchain() -> None:
|
|
255
|
+
"""从 npm 安装受支持的 DSH CLI;不需要 DSH 源码仓。"""
|
|
256
|
+
|
|
257
|
+
from ksadk.plugins.dsh_toolchain import DshToolchainManager
|
|
258
|
+
|
|
259
|
+
state = _call_dsh_developer(lambda: DshToolchainManager().install())
|
|
260
|
+
payload = state.model_dump(mode="json", by_alias=True, exclude_none=True)
|
|
261
|
+
if is_json_output():
|
|
262
|
+
emit_json(payload)
|
|
263
|
+
else:
|
|
264
|
+
print_success(f"DSH 插件开发工具链已就绪: {state.actual_version}")
|
|
265
|
+
print_kv("目录", state.root)
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
@plugin.command("create", context_settings=CONTEXT_SETTINGS)
|
|
269
|
+
@click.argument("target", type=click.Path(path_type=Path))
|
|
270
|
+
@click.option("--name", "package_name", default=None, help="标准 npm 包名。")
|
|
271
|
+
def create_dsh_plugin(target: Path, package_name: str | None) -> None:
|
|
272
|
+
"""创建标准 DSH Bundle;不会生成 KsADK 私有 manifest。"""
|
|
273
|
+
|
|
274
|
+
from ksadk.plugins.dsh_toolchain import DshPluginDeveloper
|
|
275
|
+
|
|
276
|
+
result = _call_dsh_developer(
|
|
277
|
+
lambda: DshPluginDeveloper().create(target, package_name=package_name)
|
|
278
|
+
)
|
|
279
|
+
payload = result.model_dump(mode="json", by_alias=True)
|
|
280
|
+
if is_json_output():
|
|
281
|
+
emit_json(payload)
|
|
282
|
+
else:
|
|
283
|
+
print_success(f"DSH 插件已创建: {result.package_name}")
|
|
284
|
+
print_kv("目录", result.target)
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
@plugin.command("validate", context_settings=CONTEXT_SETTINGS)
|
|
288
|
+
@click.argument("source")
|
|
289
|
+
def validate_dsh_plugin(source: str) -> None:
|
|
290
|
+
"""在临时 Profile 验证安装、投射、启停与卸载生命周期。"""
|
|
291
|
+
|
|
292
|
+
from ksadk.plugins.dsh_toolchain import DshPluginDeveloper
|
|
293
|
+
|
|
294
|
+
configured = os.environ.get(DSH_BIN_ENV, "").strip() or None
|
|
295
|
+
result = _call_dsh_developer(
|
|
296
|
+
lambda: DshPluginDeveloper(explicit_dsh=configured).validate(source)
|
|
297
|
+
)
|
|
298
|
+
payload = result.model_dump(mode="json", by_alias=True)
|
|
299
|
+
if is_json_output():
|
|
300
|
+
emit_json(payload)
|
|
301
|
+
else:
|
|
302
|
+
print_success(f"DSH 插件生命周期已通过: {result.package_name}")
|
|
303
|
+
print_kv("DSH", result.host_version)
|
|
304
|
+
print_kv("Profile 摘要", result.profile_digest)
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
@plugin.command("test", context_settings=CONTEXT_SETTINGS)
|
|
308
|
+
@click.argument("source")
|
|
309
|
+
def test_dsh_plugin(source: str) -> None:
|
|
310
|
+
"""运行真实 DSH 生命周期 smoke;不冒充 Provider conformance。"""
|
|
311
|
+
|
|
312
|
+
validate_dsh_plugin.callback(source) # type: ignore[attr-defined]
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
@plugin.command("pack", context_settings=CONTEXT_SETTINGS)
|
|
316
|
+
@click.argument("source", type=click.Path(path_type=Path))
|
|
317
|
+
@click.option(
|
|
318
|
+
"--output-dir",
|
|
319
|
+
type=click.Path(path_type=Path),
|
|
320
|
+
default=None,
|
|
321
|
+
help="npm tarball 输出目录,默认 SOURCE/dist。",
|
|
322
|
+
)
|
|
323
|
+
def pack_dsh_plugin(source: Path, output_dir: Path | None) -> None:
|
|
324
|
+
"""委托固定 pnpm 将标准 DSH Bundle 打包成 npm tgz。"""
|
|
325
|
+
|
|
326
|
+
from ksadk.plugins.dsh_toolchain import DshPluginDeveloper
|
|
327
|
+
|
|
328
|
+
result = _call_dsh_developer(
|
|
329
|
+
lambda: DshPluginDeveloper().pack(source, output_dir=output_dir)
|
|
330
|
+
)
|
|
331
|
+
payload = result.model_dump(mode="json", by_alias=True)
|
|
332
|
+
if is_json_output():
|
|
333
|
+
emit_json(payload)
|
|
334
|
+
else:
|
|
335
|
+
print_success(f"DSH 插件已打包: {result.package_name}@{result.package_version}")
|
|
336
|
+
print_kv("产物", result.artifact)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
@plugin.group("codex", context_settings=CONTEXT_SETTINGS)
|
|
340
|
+
def codex_plugins() -> None:
|
|
341
|
+
"""通过 Codex App Server 管理 Codex 官方插件。"""
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
@codex_plugins.command("list", context_settings=CONTEXT_SETTINGS)
|
|
345
|
+
@click.option("--installed-only", is_flag=True, help="只显示已安装插件。")
|
|
346
|
+
@click.option("--force-refetch", is_flag=True, help="请求宿主刷新插件目录。")
|
|
347
|
+
def list_codex_plugins(installed_only: bool, force_refetch: bool) -> None:
|
|
348
|
+
"""列出 Codex 宿主可见的官方插件。"""
|
|
349
|
+
|
|
350
|
+
async def operation(bridge):
|
|
351
|
+
return await bridge.list_plugins(force_refetch=force_refetch)
|
|
352
|
+
|
|
353
|
+
host, items = _call_codex(operation)
|
|
354
|
+
visible = [item for item in items if item.installed or not installed_only]
|
|
355
|
+
payload = {
|
|
356
|
+
"ecosystem": "codex",
|
|
357
|
+
"integrationMode": "bridged",
|
|
358
|
+
"host": {"id": "codex-app-server", "version": host.version, "available": True},
|
|
359
|
+
"items": [_codex_inventory_payload(item) for item in visible],
|
|
360
|
+
}
|
|
361
|
+
if is_json_output():
|
|
362
|
+
emit_json(payload)
|
|
363
|
+
return
|
|
364
|
+
print_info(f"Codex App Server {host.version} · {len(visible)} 个插件")
|
|
365
|
+
for item in payload["items"]:
|
|
366
|
+
state = "已安装" if item["installed"] else "可安装"
|
|
367
|
+
click.echo(f"{item['pluginId']} {item.get('version') or '-'} {state}")
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
@codex_plugins.command("info", context_settings=CONTEXT_SETTINGS)
|
|
371
|
+
@click.argument("plugin_id")
|
|
372
|
+
@click.option("--marketplace", "marketplace_name", default=None)
|
|
373
|
+
def codex_plugin_info(plugin_id: str, marketplace_name: str | None) -> None:
|
|
374
|
+
"""显示一个 Codex 插件的宿主 inventory 和能力。"""
|
|
375
|
+
|
|
376
|
+
async def operation(bridge):
|
|
377
|
+
return await bridge.read_plugin(plugin_id, marketplace_name=marketplace_name)
|
|
378
|
+
|
|
379
|
+
host, detail = _call_codex(operation)
|
|
380
|
+
payload = {
|
|
381
|
+
"item": _codex_inventory_payload(detail.inventory),
|
|
382
|
+
"host": {"id": "codex-app-server", "version": host.version, "available": True},
|
|
383
|
+
"description": detail.description,
|
|
384
|
+
"capabilities": {
|
|
385
|
+
"skills": list(detail.skills),
|
|
386
|
+
"mcpServers": list(detail.mcp_servers),
|
|
387
|
+
"hooks": list(detail.hooks),
|
|
388
|
+
"apps": list(detail.apps),
|
|
389
|
+
"scheduledTasks": list(detail.scheduled_tasks),
|
|
390
|
+
},
|
|
391
|
+
}
|
|
392
|
+
if is_json_output():
|
|
393
|
+
emit_json(payload)
|
|
394
|
+
else:
|
|
395
|
+
print_success(f"Codex 插件: {plugin_id}")
|
|
396
|
+
print_kv("宿主", f"Codex App Server {host.version}")
|
|
397
|
+
print_kv("状态", "已安装" if detail.inventory.installed else "可安装")
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
@codex_plugins.command("install", context_settings=CONTEXT_SETTINGS)
|
|
401
|
+
@click.argument("plugin_id")
|
|
402
|
+
@click.option("--marketplace", "marketplace_name", default=None)
|
|
403
|
+
@click.option(
|
|
404
|
+
"--accept-host-permissions",
|
|
405
|
+
is_flag=True,
|
|
406
|
+
help="确认插件权限由 Codex 宿主管理并以当前系统用户权限运行。",
|
|
407
|
+
)
|
|
408
|
+
def install_codex_plugin(
|
|
409
|
+
plugin_id: str,
|
|
410
|
+
marketplace_name: str | None,
|
|
411
|
+
accept_host_permissions: bool,
|
|
412
|
+
) -> None:
|
|
413
|
+
"""安装一个 Codex 官方插件;必须显式确认宿主权限风险。"""
|
|
414
|
+
|
|
415
|
+
if not accept_host_permissions:
|
|
416
|
+
abort_with_cli_error(
|
|
417
|
+
CLIError(
|
|
418
|
+
code="codex_plugin_permission_confirmation_required",
|
|
419
|
+
message="安装前必须传入 --accept-host-permissions 确认宿主权限风险",
|
|
420
|
+
exit_code=EXIT_CODE_VALIDATION,
|
|
421
|
+
),
|
|
422
|
+
context="Plugin",
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
async def operation(bridge):
|
|
426
|
+
return await bridge.install_plugin(
|
|
427
|
+
plugin_id,
|
|
428
|
+
marketplace_name=marketplace_name,
|
|
429
|
+
accept_undeclared_permissions=True,
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
host, result = _call_codex(operation)
|
|
433
|
+
payload = {
|
|
434
|
+
"item": _codex_inventory_payload(result.inventory),
|
|
435
|
+
"host": {"id": "codex-app-server", "version": host.version, "available": True},
|
|
436
|
+
"authPolicy": result.auth_policy,
|
|
437
|
+
"appsNeedingAuth": list(result.apps_needing_auth),
|
|
438
|
+
}
|
|
439
|
+
if is_json_output():
|
|
440
|
+
emit_json(payload)
|
|
441
|
+
else:
|
|
442
|
+
print_success(f"Codex 插件已安装: {result.inventory.plugin_id}")
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
@codex_plugins.command("uninstall", context_settings=CONTEXT_SETTINGS)
|
|
446
|
+
@click.argument("plugin_id")
|
|
447
|
+
def uninstall_codex_plugin(plugin_id: str) -> None:
|
|
448
|
+
"""请求 Codex App Server 卸载插件。"""
|
|
449
|
+
|
|
450
|
+
async def operation(bridge):
|
|
451
|
+
return await bridge.uninstall_plugin(plugin_id)
|
|
452
|
+
|
|
453
|
+
host, result = _call_codex(operation)
|
|
454
|
+
payload = {
|
|
455
|
+
"ecosystem": "codex",
|
|
456
|
+
"integrationMode": "bridged",
|
|
457
|
+
"pluginId": result.plugin_id,
|
|
458
|
+
"installed": False,
|
|
459
|
+
"enabled": False,
|
|
460
|
+
"host": {"id": "codex-app-server", "version": host.version, "available": True},
|
|
461
|
+
}
|
|
462
|
+
if is_json_output():
|
|
463
|
+
emit_json(payload)
|
|
464
|
+
else:
|
|
465
|
+
print_success(f"Codex 插件已卸载: {plugin_id}")
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
@plugin.group("dsh", context_settings=CONTEXT_SETTINGS)
|
|
469
|
+
def dsh_plugins() -> None:
|
|
470
|
+
"""通过原生 DeepSeek Harness Profile 管理 DSH 插件。"""
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
@dsh_plugins.command("list", context_settings=CONTEXT_SETTINGS)
|
|
474
|
+
def list_dsh_plugins() -> None:
|
|
475
|
+
"""列出当前隔离 Profile 中的 DSH bundle。"""
|
|
476
|
+
|
|
477
|
+
host, items = _call_dsh(lambda bridge: bridge.list_plugins())
|
|
478
|
+
payload = {
|
|
479
|
+
"ecosystem": "dsh",
|
|
480
|
+
"integrationMode": "bridged",
|
|
481
|
+
"profile": _dsh_profile(),
|
|
482
|
+
"host": {"id": host.host_id, "version": host.version, "available": True},
|
|
483
|
+
"items": [_dsh_inventory_payload(item) for item in items],
|
|
484
|
+
}
|
|
485
|
+
if is_json_output():
|
|
486
|
+
emit_json(payload)
|
|
487
|
+
return
|
|
488
|
+
print_info(f"DeepSeek Harness {host.version} · {len(items)} 个 Profile 插件")
|
|
489
|
+
for item in payload["items"]:
|
|
490
|
+
state = "已启用" if item["enabled"] else "已停用"
|
|
491
|
+
click.echo(f"{item['name']} {item.get('version') or '-'} {state}")
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
@dsh_plugins.command("info", context_settings=CONTEXT_SETTINGS)
|
|
495
|
+
@click.argument("plugin_name")
|
|
496
|
+
def dsh_plugin_info(plugin_name: str) -> None:
|
|
497
|
+
"""显示一个 DSH 插件的原生 Profile inventory。"""
|
|
498
|
+
|
|
499
|
+
host, item = _call_dsh(lambda bridge: bridge.get_plugin(plugin_name))
|
|
500
|
+
payload = {
|
|
501
|
+
"item": _dsh_inventory_payload(item),
|
|
502
|
+
"host": {"id": host.host_id, "version": host.version, "available": True},
|
|
503
|
+
}
|
|
504
|
+
if is_json_output():
|
|
505
|
+
emit_json(payload)
|
|
506
|
+
else:
|
|
507
|
+
print_success(f"DSH 插件: {plugin_name}")
|
|
508
|
+
print_kv("状态", "已启用" if item.enabled else "已停用")
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
@dsh_plugins.command("install", context_settings=CONTEXT_SETTINGS)
|
|
512
|
+
@click.argument("source")
|
|
513
|
+
@click.option(
|
|
514
|
+
"--accept-host-permissions",
|
|
515
|
+
is_flag=True,
|
|
516
|
+
help="确认 DSH 包与安装脚本会以当前宿主用户权限运行。",
|
|
517
|
+
)
|
|
518
|
+
def install_dsh_plugin(source: str, accept_host_permissions: bool) -> None:
|
|
519
|
+
"""把一个 DSH bundle 安装到隔离 Profile;安装后默认停用。"""
|
|
520
|
+
|
|
521
|
+
if not accept_host_permissions:
|
|
522
|
+
abort_with_cli_error(
|
|
523
|
+
CLIError(
|
|
524
|
+
code="dsh_plugin_permission_confirmation_required",
|
|
525
|
+
message="安装前必须传入 --accept-host-permissions 确认宿主权限风险",
|
|
526
|
+
exit_code=EXIT_CODE_VALIDATION,
|
|
527
|
+
),
|
|
528
|
+
context="Plugin",
|
|
529
|
+
)
|
|
530
|
+
host, item = _call_dsh(
|
|
531
|
+
lambda bridge: bridge.install_plugin(source, accept_host_permissions=True)
|
|
532
|
+
)
|
|
533
|
+
payload = {
|
|
534
|
+
"item": _dsh_inventory_payload(item),
|
|
535
|
+
"host": {"id": host.host_id, "version": host.version, "available": True},
|
|
536
|
+
}
|
|
537
|
+
if is_json_output():
|
|
538
|
+
emit_json(payload)
|
|
539
|
+
else:
|
|
540
|
+
print_success(f"DSH 插件已安装并保持停用: {item.name};请显式执行 enable")
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
@dsh_plugins.command("enable", context_settings=CONTEXT_SETTINGS)
|
|
544
|
+
@click.argument("plugin_name")
|
|
545
|
+
def enable_dsh_plugin(plugin_name: str) -> None:
|
|
546
|
+
"""在 DSH Profile 中启用已安装的 bundle。"""
|
|
547
|
+
|
|
548
|
+
host, item = _call_dsh(lambda bridge: bridge.set_enabled(plugin_name, enabled=True))
|
|
549
|
+
payload = {
|
|
550
|
+
"item": _dsh_inventory_payload(item),
|
|
551
|
+
"host": {"id": host.host_id, "version": host.version, "available": True},
|
|
552
|
+
}
|
|
553
|
+
if is_json_output():
|
|
554
|
+
emit_json(payload)
|
|
555
|
+
else:
|
|
556
|
+
print_success(f"DSH 插件已启用: {plugin_name}")
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
@dsh_plugins.command("disable", context_settings=CONTEXT_SETTINGS)
|
|
560
|
+
@click.argument("plugin_name")
|
|
561
|
+
def disable_dsh_plugin(plugin_name: str) -> None:
|
|
562
|
+
"""从 DSH Profile 组合中停用 bundle,但保留已安装包。"""
|
|
563
|
+
|
|
564
|
+
host, item = _call_dsh(lambda bridge: bridge.set_enabled(plugin_name, enabled=False))
|
|
565
|
+
payload = {
|
|
566
|
+
"item": _dsh_inventory_payload(item),
|
|
567
|
+
"host": {"id": host.host_id, "version": host.version, "available": True},
|
|
568
|
+
}
|
|
569
|
+
if is_json_output():
|
|
570
|
+
emit_json(payload)
|
|
571
|
+
else:
|
|
572
|
+
print_success(f"DSH 插件已停用: {plugin_name}")
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
@dsh_plugins.command("update", context_settings=CONTEXT_SETTINGS)
|
|
576
|
+
@click.argument("plugin_name")
|
|
577
|
+
@click.option(
|
|
578
|
+
"--accept-host-permissions",
|
|
579
|
+
is_flag=True,
|
|
580
|
+
help="确认升级后的包与安装脚本会以当前宿主用户权限运行。",
|
|
581
|
+
)
|
|
582
|
+
def update_dsh_plugin(plugin_name: str, accept_host_permissions: bool) -> None:
|
|
583
|
+
"""由 DSH/pnpm 更新一个插件;失败时恢复旧 Profile。"""
|
|
584
|
+
|
|
585
|
+
if not accept_host_permissions:
|
|
586
|
+
abort_with_cli_error(
|
|
587
|
+
CLIError(
|
|
588
|
+
code="dsh_plugin_permission_confirmation_required",
|
|
589
|
+
message="升级前必须传入 --accept-host-permissions 确认宿主权限风险",
|
|
590
|
+
exit_code=EXIT_CODE_VALIDATION,
|
|
591
|
+
),
|
|
592
|
+
context="Plugin",
|
|
593
|
+
)
|
|
594
|
+
host, item = _call_dsh(
|
|
595
|
+
lambda bridge: bridge.update_plugin(plugin_name, accept_host_permissions=True)
|
|
596
|
+
)
|
|
597
|
+
payload = {
|
|
598
|
+
"item": _dsh_inventory_payload(item),
|
|
599
|
+
"host": {"id": host.host_id, "version": host.version, "available": True},
|
|
600
|
+
}
|
|
601
|
+
if is_json_output():
|
|
602
|
+
emit_json(payload)
|
|
603
|
+
else:
|
|
604
|
+
print_success(f"DSH 插件已更新: {plugin_name}")
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
@dsh_plugins.command("uninstall", context_settings=CONTEXT_SETTINGS)
|
|
608
|
+
@click.argument("plugin_name")
|
|
609
|
+
def uninstall_dsh_plugin(plugin_name: str) -> None:
|
|
610
|
+
"""从 DSH Profile 卸载一个 bundle。"""
|
|
611
|
+
|
|
612
|
+
host, _ = _call_dsh(lambda bridge: bridge.uninstall_plugin(plugin_name))
|
|
613
|
+
payload = {
|
|
614
|
+
"ecosystem": "dsh",
|
|
615
|
+
"integrationMode": "bridged",
|
|
616
|
+
"profile": _dsh_profile(),
|
|
617
|
+
"name": plugin_name,
|
|
618
|
+
"installed": False,
|
|
619
|
+
"enabled": False,
|
|
620
|
+
"host": {"id": host.host_id, "version": host.version, "available": True},
|
|
621
|
+
}
|
|
622
|
+
if is_json_output():
|
|
623
|
+
emit_json(payload)
|
|
624
|
+
else:
|
|
625
|
+
print_success(f"DSH 插件已卸载: {plugin_name}")
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
@dsh_plugins.command("profile", context_settings=CONTEXT_SETTINGS)
|
|
629
|
+
def dsh_profile_info() -> None:
|
|
630
|
+
"""预检并显示当前 DSH Profile 的无 Secret 配置摘要。"""
|
|
631
|
+
|
|
632
|
+
host, projection = _call_dsh(lambda bridge: bridge.project_profile())
|
|
633
|
+
payload = {
|
|
634
|
+
"profile": projection.model_dump(mode="json", by_alias=True),
|
|
635
|
+
"host": {"id": host.host_id, "version": host.version, "available": True},
|
|
636
|
+
}
|
|
637
|
+
if is_json_output():
|
|
638
|
+
emit_json(payload)
|
|
639
|
+
else:
|
|
640
|
+
print_success(f"DSH Profile 已通过预检: {projection.profile}")
|
|
641
|
+
print_kv("配置摘要", projection.config_digest)
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
# DSH is the canonical plugin ecosystem. Reuse the exact same Click command
|
|
645
|
+
# objects at the top level so output, validation and typed errors cannot drift
|
|
646
|
+
# between ``plugin list`` and the compatibility alias ``plugin dsh list``.
|
|
647
|
+
for _dsh_command_alias in (
|
|
648
|
+
list_dsh_plugins,
|
|
649
|
+
dsh_plugin_info,
|
|
650
|
+
install_dsh_plugin,
|
|
651
|
+
enable_dsh_plugin,
|
|
652
|
+
disable_dsh_plugin,
|
|
653
|
+
update_dsh_plugin,
|
|
654
|
+
uninstall_dsh_plugin,
|
|
655
|
+
dsh_profile_info,
|
|
656
|
+
):
|
|
657
|
+
plugin.add_command(_dsh_command_alias)
|