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/a2a/executor.py
CHANGED
|
@@ -23,7 +23,18 @@ from a2a.types import Part, Task, TaskState, TaskStatus
|
|
|
23
23
|
from a2a.utils.errors import TaskNotCancelableError
|
|
24
24
|
|
|
25
25
|
from ksadk.a2a.resume_store import A2AResumePayloadKind
|
|
26
|
-
from ksadk.events import
|
|
26
|
+
from ksadk.events.canonical import (
|
|
27
|
+
ContinuationCreated,
|
|
28
|
+
EventEnvelope,
|
|
29
|
+
InteractionRequested,
|
|
30
|
+
ItemCompleted,
|
|
31
|
+
ItemUpdated,
|
|
32
|
+
RunCanceled,
|
|
33
|
+
RunFailed,
|
|
34
|
+
RunInterrupted,
|
|
35
|
+
RuntimeEvent,
|
|
36
|
+
)
|
|
37
|
+
from ksadk.events.content import TextContent
|
|
27
38
|
from ksadk.runtime import CancelResult, RunHandle
|
|
28
39
|
|
|
29
40
|
logger = logging.getLogger(__name__)
|
|
@@ -143,6 +154,30 @@ class _RunCanceled(Exception):
|
|
|
143
154
|
"""Runtime 已取消本次执行,executor 不得再发 completed。"""
|
|
144
155
|
|
|
145
156
|
|
|
157
|
+
def _require_resume_capability(task_adapter: Any) -> None:
|
|
158
|
+
"""当 runtime adapter 显式声明 typed capability matrix 时,校验 resume 是否 supported。
|
|
159
|
+
|
|
160
|
+
只有 adapter **覆写**了 ``capabilities()`` 才执行强校验(声明 unsupported 必须
|
|
161
|
+
fail-closed);沿用基类默认矩阵的旧版/第三方 adapter 不受影响,避免把
|
|
162
|
+
"未迁移到 v1 matrix" 误判为 "声明不支持"。
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
from ksadk.runtime.adapter import RuntimeAdapter
|
|
166
|
+
|
|
167
|
+
runtime_adapter = getattr(task_adapter, "runtime_adapter", None)
|
|
168
|
+
declared = getattr(type(runtime_adapter), "capabilities", None)
|
|
169
|
+
if declared is None or declared is RuntimeAdapter.capabilities:
|
|
170
|
+
return
|
|
171
|
+
matrix = declared(runtime_adapter)
|
|
172
|
+
if not matrix.resume.supported:
|
|
173
|
+
from ksadk.kernel.errors import UnsupportedControlError
|
|
174
|
+
|
|
175
|
+
raise UnsupportedControlError(
|
|
176
|
+
"runtime capability matrix declares resume unsupported: "
|
|
177
|
+
f"{matrix.resume.reason}"
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
|
|
146
181
|
class A2ARuntimeExecutor(AgentExecutor):
|
|
147
182
|
"""在 A2A 请求生命周期内执行 RuntimeAdapter。
|
|
148
183
|
|
|
@@ -175,6 +210,12 @@ class A2ARuntimeExecutor(AgentExecutor):
|
|
|
175
210
|
and getattr(getattr(current_task, "status", None), "state", None)
|
|
176
211
|
== TaskState.TASK_STATE_INPUT_REQUIRED
|
|
177
212
|
)
|
|
213
|
+
from ksadk.kernel.ingress import kernel_route_active
|
|
214
|
+
|
|
215
|
+
if kernel_route_active() and not is_resume:
|
|
216
|
+
await self._kernel_execute(context, updater)
|
|
217
|
+
return
|
|
218
|
+
|
|
178
219
|
interaction_response: Any = None
|
|
179
220
|
# Third-party/local adapters written before durable context mapping do not
|
|
180
221
|
# necessarily provide this optional lifecycle hook.
|
|
@@ -190,6 +231,9 @@ class A2ARuntimeExecutor(AgentExecutor):
|
|
|
190
231
|
context,
|
|
191
232
|
answer=interaction_response,
|
|
192
233
|
)
|
|
234
|
+
# 诚实 capability:runtime 声明 resume unsupported 时 fail-closed,
|
|
235
|
+
# 不允许协议层吞掉 matrix 并假装续跑成功。
|
|
236
|
+
_require_resume_capability(self.task_adapter)
|
|
193
237
|
|
|
194
238
|
handle: RunHandle | None = None
|
|
195
239
|
try:
|
|
@@ -237,6 +281,70 @@ class A2ARuntimeExecutor(AgentExecutor):
|
|
|
237
281
|
)
|
|
238
282
|
await self._forget_task(context, handle)
|
|
239
283
|
|
|
284
|
+
async def _kernel_execute(self, context: RequestContext, updater: TaskUpdater) -> None:
|
|
285
|
+
"""kernel 路径(灰度 opt-in):A2A task -> AgentControlCommand -> receipt。
|
|
286
|
+
|
|
287
|
+
mutation 只走 kernel.submit;A2A task 事件 shape 保留,cursor 源自同一
|
|
288
|
+
Session seq(SessionEventSubscription.after_seq)。
|
|
289
|
+
"""
|
|
290
|
+
from ksadk.kernel import ingress as _kernel_ingress
|
|
291
|
+
|
|
292
|
+
task_id = str(context.task_id or "")
|
|
293
|
+
session_id = str(context.context_id or task_id)
|
|
294
|
+
try:
|
|
295
|
+
trusted = _kernel_ingress.trusted_context(
|
|
296
|
+
source_kind="a2a",
|
|
297
|
+
source_ref=task_id,
|
|
298
|
+
session_id=session_id,
|
|
299
|
+
operations=("enqueue",),
|
|
300
|
+
)
|
|
301
|
+
command = _kernel_ingress.map_a2a_task(
|
|
302
|
+
session_id=session_id,
|
|
303
|
+
idempotency_key=task_id,
|
|
304
|
+
content={"input": context.get_user_input()},
|
|
305
|
+
task_id=task_id,
|
|
306
|
+
trusted=trusted,
|
|
307
|
+
)
|
|
308
|
+
receipt = await _kernel_ingress.submit_command(command, permit=trusted.permit)
|
|
309
|
+
if receipt.status not in ("accepted", "duplicate"):
|
|
310
|
+
await updater.failed(
|
|
311
|
+
message=updater.new_agent_message(
|
|
312
|
+
parts=[Part(text=f"agent kernel rejected command: {receipt.status}")]
|
|
313
|
+
)
|
|
314
|
+
)
|
|
315
|
+
return
|
|
316
|
+
await updater.update_status(
|
|
317
|
+
TaskState.TASK_STATE_WORKING,
|
|
318
|
+
metadata=dict(ADK_V2_INTEGRATION_METADATA),
|
|
319
|
+
)
|
|
320
|
+
output_text = ""
|
|
321
|
+
async for _seq, projected in _kernel_ingress.subscribe_projected(
|
|
322
|
+
session_id,
|
|
323
|
+
trusted=trusted,
|
|
324
|
+
after_seq=int(receipt.accepted_seq or 0),
|
|
325
|
+
projector=_a2a_envelope_projection,
|
|
326
|
+
):
|
|
327
|
+
if projected is None:
|
|
328
|
+
continue
|
|
329
|
+
kind, value = projected
|
|
330
|
+
if kind == "delta":
|
|
331
|
+
output_text += value
|
|
332
|
+
elif kind == "completed":
|
|
333
|
+
output_text = value or output_text
|
|
334
|
+
completion = (
|
|
335
|
+
updater.new_agent_message(parts=[Part(text=output_text)])
|
|
336
|
+
if output_text
|
|
337
|
+
else None
|
|
338
|
+
)
|
|
339
|
+
await updater.complete(message=completion)
|
|
340
|
+
except Exception as exc: # noqa: BLE001
|
|
341
|
+
logger.error("A2A kernel ingress failed (%s)", type(exc).__name__)
|
|
342
|
+
await updater.failed(
|
|
343
|
+
message=updater.new_agent_message(
|
|
344
|
+
parts=[Part(text="A2A task execution failed")]
|
|
345
|
+
)
|
|
346
|
+
)
|
|
347
|
+
|
|
240
348
|
async def cancel(self, context: RequestContext, event_queue: EventQueue) -> None:
|
|
241
349
|
# §7.4:cancel 统一由 adapter 提供。有 RuntimeAdapter → 尊重其 CancelResult,
|
|
242
350
|
# 只有底层真取消(CANCELLED)才把协议 Task 置 canceled;其余状态如实抛
|
|
@@ -278,7 +386,6 @@ class A2ARuntimeExecutor(AgentExecutor):
|
|
|
278
386
|
) -> str:
|
|
279
387
|
output_text = ""
|
|
280
388
|
artifacts = _ArtifactStreamEmitter(updater, str(context.task_id))
|
|
281
|
-
reasoning_text = ""
|
|
282
389
|
input_required = False
|
|
283
390
|
input_prompt = "Input required"
|
|
284
391
|
checkpoint_id: str | None = None
|
|
@@ -286,92 +393,81 @@ class A2ARuntimeExecutor(AgentExecutor):
|
|
|
286
393
|
payload_kind: A2AResumePayloadKind = "hitl_answer"
|
|
287
394
|
|
|
288
395
|
async for event in self.task_adapter.stream_task(handle):
|
|
289
|
-
if not isinstance(event,
|
|
396
|
+
if not isinstance(event, EventEnvelope):
|
|
290
397
|
raise TypeError("RuntimeAdapter.stream must yield RuntimeEvent")
|
|
291
|
-
if event
|
|
292
|
-
raise RuntimeError(self._coerce_text(event.
|
|
293
|
-
if event
|
|
398
|
+
if isinstance(event, RunFailed):
|
|
399
|
+
raise RuntimeError(self._coerce_text(event.error.message))
|
|
400
|
+
if isinstance(event, RunCanceled):
|
|
294
401
|
await artifacts.close()
|
|
295
402
|
if not self._cancel_was_accepted(context, handle):
|
|
296
403
|
await updater.cancel(
|
|
297
404
|
message=updater.new_agent_message(parts=[Part(text="Request canceled")])
|
|
298
405
|
)
|
|
299
406
|
raise _RunCanceled()
|
|
300
|
-
if event
|
|
407
|
+
if isinstance(event, InteractionRequested):
|
|
301
408
|
input_required = True
|
|
302
409
|
payload_kind = "approval_decision"
|
|
303
410
|
call_id = (
|
|
304
|
-
str(event.
|
|
411
|
+
str(event.request.call_id or event.interaction_id or "")
|
|
305
412
|
or None
|
|
306
413
|
)
|
|
307
|
-
detail = event.
|
|
414
|
+
detail = event.request.detail
|
|
308
415
|
if isinstance(detail, dict):
|
|
309
416
|
input_prompt = self._coerce_text(
|
|
310
417
|
detail.get("prompt") or detail.get("message") or input_prompt
|
|
311
418
|
)
|
|
312
419
|
continue
|
|
313
|
-
if event
|
|
314
|
-
checkpoint_id =
|
|
420
|
+
if isinstance(event, ContinuationCreated):
|
|
421
|
+
checkpoint_id = event.continuation_id
|
|
315
422
|
continue
|
|
316
|
-
if event
|
|
423
|
+
if isinstance(event, RunInterrupted):
|
|
317
424
|
input_required = True
|
|
318
|
-
input_prompt = self._coerce_text(
|
|
319
|
-
event.payload.get("prompt") or event.payload.get("message") or input_prompt
|
|
320
|
-
)
|
|
321
|
-
continue
|
|
322
|
-
if event.event_type not in {
|
|
323
|
-
EventType.TEXT_DELTA,
|
|
324
|
-
EventType.TEXT_COMPLETED,
|
|
325
|
-
EventType.REASONING_DELTA,
|
|
326
|
-
EventType.REASONING_COMPLETED,
|
|
327
|
-
}:
|
|
425
|
+
input_prompt = self._coerce_text(event.reason or input_prompt)
|
|
328
426
|
continue
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
427
|
+
if isinstance(event, ItemUpdated):
|
|
428
|
+
if event.item_kind == "reasoning":
|
|
429
|
+
if not self.include_reasoning:
|
|
430
|
+
continue
|
|
431
|
+
if not isinstance(event.update, TextContent):
|
|
432
|
+
continue
|
|
433
|
+
text = event.update.text
|
|
434
|
+
if not text:
|
|
435
|
+
continue
|
|
436
|
+
await artifacts.push(
|
|
437
|
+
"thinking", text, replace_snapshot=(event.op == "replace")
|
|
438
|
+
)
|
|
334
439
|
continue
|
|
335
|
-
if
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
if event.event_type == EventType.REASONING_DELTA:
|
|
348
|
-
if not self.include_reasoning:
|
|
440
|
+
if event.item_kind == "message":
|
|
441
|
+
if not isinstance(event.update, TextContent):
|
|
442
|
+
continue
|
|
443
|
+
text = event.update.text
|
|
444
|
+
if not text:
|
|
445
|
+
continue
|
|
446
|
+
replace_snapshot = event.op == "replace"
|
|
447
|
+
if replace_snapshot:
|
|
448
|
+
output_text = text
|
|
449
|
+
else:
|
|
450
|
+
output_text += text
|
|
451
|
+
await artifacts.push("text", text, replace_snapshot=replace_snapshot)
|
|
349
452
|
continue
|
|
350
|
-
reasoning_text += text
|
|
351
|
-
await artifacts.push("thinking", text)
|
|
352
453
|
continue
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
454
|
+
if isinstance(event, ItemCompleted):
|
|
455
|
+
if event.item_kind == "reasoning":
|
|
456
|
+
if not self.include_reasoning:
|
|
457
|
+
continue
|
|
458
|
+
text = self._snapshot_text(event)
|
|
459
|
+
if not text:
|
|
460
|
+
continue
|
|
461
|
+
await artifacts.push("thinking", text, replace_snapshot=True)
|
|
462
|
+
continue
|
|
463
|
+
if event.item_kind == "message":
|
|
464
|
+
text = self._snapshot_text(event)
|
|
465
|
+
if not text:
|
|
466
|
+
continue
|
|
366
467
|
output_text = text
|
|
367
|
-
replace_snapshot
|
|
368
|
-
|
|
369
|
-
delta = text
|
|
370
|
-
replace_snapshot = bool(event.payload.get("replace"))
|
|
371
|
-
output_text = text if replace_snapshot else output_text + text
|
|
372
|
-
if not delta:
|
|
468
|
+
await artifacts.push("text", text, replace_snapshot=True)
|
|
469
|
+
continue
|
|
373
470
|
continue
|
|
374
|
-
await artifacts.push("text", delta, replace_snapshot=replace_snapshot)
|
|
375
471
|
if self._cancel_was_accepted(context, handle):
|
|
376
472
|
await artifacts.close()
|
|
377
473
|
raise _RunCanceled()
|
|
@@ -407,6 +503,14 @@ class A2ARuntimeExecutor(AgentExecutor):
|
|
|
407
503
|
if inspect.isawaitable(result):
|
|
408
504
|
await result
|
|
409
505
|
|
|
506
|
+
@staticmethod
|
|
507
|
+
def _snapshot_text(event: ItemCompleted) -> str:
|
|
508
|
+
"""Extract text from the first TextContent part of an ItemCompleted snapshot."""
|
|
509
|
+
if not event.snapshot.parts:
|
|
510
|
+
return ""
|
|
511
|
+
part = event.snapshot.parts[0]
|
|
512
|
+
return part.text if isinstance(part, TextContent) else ""
|
|
513
|
+
|
|
410
514
|
@classmethod
|
|
411
515
|
def _coerce_text(cls, payload: Any) -> str:
|
|
412
516
|
if payload is None:
|
|
@@ -423,3 +527,15 @@ class A2ARuntimeExecutor(AgentExecutor):
|
|
|
423
527
|
|
|
424
528
|
|
|
425
529
|
__all__ = ["A2ARuntimeExecutor"]
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
def _a2a_envelope_projection(envelope) -> tuple[str, str] | None:
|
|
533
|
+
"""Session envelope -> A2A 文本投影;cursor 仍用 envelope.seq。"""
|
|
534
|
+
|
|
535
|
+
payload = envelope.payload or {}
|
|
536
|
+
if envelope.event_type == "run.completed":
|
|
537
|
+
return "completed", str(payload.get("output_text") or "")
|
|
538
|
+
text = str(payload.get("delta") or payload.get("text") or "")
|
|
539
|
+
if text:
|
|
540
|
+
return "delta", text
|
|
541
|
+
return None
|