agentengine-sdk-python 0.8.4__py3-none-any.whl → 0.8.5__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.4.dist-info → agentengine_sdk_python-0.8.5.dist-info}/METADATA +6 -3
- {agentengine_sdk_python-0.8.4.dist-info → agentengine_sdk_python-0.8.5.dist-info}/RECORD +591 -365
- ksadk/_build_provenance.json +1 -1
- ksadk/_process.py +83 -0
- ksadk/_str_enum.py +17 -0
- ksadk/a2ui/core.py +3 -3
- ksadk/api/client.py +6 -0
- ksadk/builders/code_builder.py +38 -12
- ksadk/builders/framework_requirements.py +20 -2
- ksadk/cli/__init__.py +36 -0
- ksadk/cli/cmd_config.py +4 -4
- ksadk/cli/cmd_create.py +12 -12
- ksadk/cli/cmd_hermes.py +24 -2
- ksadk/cli/cmd_invoke.py +28 -5
- ksadk/cli/cmd_openclaw.py +26 -1
- ksadk/cli/cmd_plugin.py +70 -12
- ksadk/cli/cmd_studio.py +64 -16
- ksadk/cli/openclaw_env.py +1 -1
- ksadk/cli/resource_common.py +26 -0
- ksadk/codex/client.py +3 -2
- ksadk/configs/__init__.py +1 -1
- ksadk/configs/env_registry.py +125 -31
- ksadk/configs/env_registry_studio.py +86 -0
- ksadk/configs/global_config.py +1 -1
- ksadk/configs/settings.py +3 -3
- ksadk/connector/__init__.py +17 -0
- ksadk/connector/channel.py +477 -0
- ksadk/context_engine/capabilities.py +52 -4
- ksadk/conversations/attachment_storage.py +10 -3
- ksadk/conversations/attachments.py +16 -5
- ksadk/conversations/message_projection.py +23 -32
- ksadk/conversations/normalize.py +28 -10
- ksadk/conversations/runtime_baseline.py +37 -0
- ksadk/conversations/runtime_invocation.py +17 -4
- ksadk/conversations/runtime_observability.py +39 -10
- ksadk/conversations/runtime_payloads.py +8 -0
- ksadk/conversations/runtime_persistence.py +105 -9
- ksadk/conversations/runtime_preparation.py +13 -7
- ksadk/conversations/runtime_stream_events.py +29 -35
- ksadk/conversations/runtime_streaming.py +8 -0
- ksadk/events/adapters/_codex_items.py +16 -8
- ksadk/events/adapters/_langgraph_support.py +34 -0
- ksadk/events/session_event.py +2 -2
- ksadk/harness/__init__.py +14 -0
- ksadk/harness/app.py +11 -0
- ksadk/harness/artifact_store.py +213 -0
- ksadk/harness/capabilities.py +115 -0
- ksadk/harness/capability_runtime.py +237 -0
- ksadk/harness/closure_contract.py +92 -0
- ksadk/harness/compaction_record.py +122 -0
- ksadk/harness/compiler.py +284 -0
- ksadk/harness/conformance/__init__.py +33 -0
- ksadk/harness/conformance/contract.py +506 -0
- ksadk/harness/conformance/fixtures.py +102 -0
- ksadk/harness/context_engine.py +403 -0
- ksadk/harness/context_maintenance.py +259 -0
- ksadk/harness/context_manifest.py +188 -0
- ksadk/harness/context_tuning.py +168 -0
- ksadk/harness/draft_runtime.py +322 -0
- ksadk/harness/engine/__init__.py +40 -0
- ksadk/harness/engine/base.py +122 -0
- ksadk/harness/engine/budgets.py +108 -0
- ksadk/harness/engine/capability_declarations.py +59 -0
- ksadk/harness/engine/completion_guard.py +42 -0
- ksadk/harness/engine/context_pipeline.py +579 -0
- ksadk/harness/engine/graph_builder.py +859 -0
- ksadk/harness/engine/langgraph.py +931 -0
- ksadk/harness/engine/mcp_disclosure.py +750 -0
- ksadk/harness/engine/policy_runtime.py +70 -0
- ksadk/harness/engine/postgres_checkpointer.py +63 -0
- ksadk/harness/engine/run_control_bridge.py +80 -0
- ksadk/harness/engine/run_types.py +88 -0
- ksadk/harness/engine/skill_disclosure.py +189 -0
- ksadk/harness/engine/spans.py +41 -0
- ksadk/harness/engine/subagents.py +343 -0
- ksadk/harness/engine/thread_ids.py +112 -0
- ksadk/harness/engine/tool_dispatch.py +144 -0
- ksadk/harness/event_tree.py +212 -0
- ksadk/harness/events.py +461 -0
- ksadk/harness/execution_policy.py +94 -0
- ksadk/harness/insights.py +210 -0
- ksadk/harness/lifecycle.py +578 -0
- ksadk/harness/lifecycle_conformance.py +233 -0
- ksadk/harness/lifecycle_local_plane.py +104 -0
- ksadk/harness/loop/__init__.py +44 -0
- ksadk/harness/loop/reason.py +454 -0
- ksadk/harness/loop/tools.py +762 -0
- ksadk/harness/managed_runtime.py +884 -0
- ksadk/harness/mcp_matrix.py +474 -0
- ksadk/harness/mcp_runtime.py +471 -0
- ksadk/harness/memory_consolidation.py +157 -0
- ksadk/harness/memory_loop.py +156 -0
- ksadk/harness/memory_runtime.py +541 -0
- ksadk/harness/metrics.py +90 -0
- ksadk/harness/model_capability.py +253 -0
- ksadk/harness/model_provider.py +220 -0
- ksadk/harness/observability/__init__.py +29 -0
- ksadk/harness/observability/inspection.py +528 -0
- ksadk/harness/observability/metrics.py +167 -0
- ksadk/harness/observability/otel_exporter.py +218 -0
- ksadk/harness/prompt_cache.py +70 -0
- ksadk/harness/public_activity.py +154 -0
- ksadk/harness/readiness.py +249 -0
- ksadk/harness/reasoner.py +466 -13
- ksadk/harness/release_readiness.py +140 -0
- ksadk/harness/resource_ref.py +69 -0
- ksadk/harness/run_control.py +668 -0
- ksadk/harness/runtime.py +146 -111
- ksadk/harness/runtime_capabilities.py +158 -0
- ksadk/harness/runtime_server.py +514 -0
- ksadk/harness/sandbox_adapters.py +739 -0
- ksadk/harness/sandbox_backend.py +530 -0
- ksadk/harness/sandbox_conformance.py +288 -0
- ksadk/harness/sandbox_lease.py +77 -0
- ksadk/harness/sandbox_lease_conformance.py +259 -0
- ksadk/harness/sandbox_matrix.py +170 -0
- ksadk/harness/sandbox_reconciliation.py +140 -0
- ksadk/harness/sandbox_recovery.py +586 -0
- ksadk/harness/sandbox_recovery_conformance.py +246 -0
- ksadk/harness/session_store.py +243 -0
- ksadk/harness/skill_composition.py +212 -0
- ksadk/harness/skill_feedback.py +123 -0
- ksadk/harness/skill_matrix.py +233 -0
- ksadk/harness/skill_runtime.py +259 -0
- ksadk/harness/spec.py +332 -0
- ksadk/harness/state.py +153 -0
- ksadk/harness/strategies.py +149 -0
- ksadk/harness/subagent.py +253 -0
- ksadk/harness/tool_policy.py +131 -0
- ksadk/harness/tool_receipts.py +96 -0
- ksadk/harness/tool_reliability.py +81 -0
- ksadk/harness/user_errors.py +69 -0
- ksadk/harness/working_context.py +81 -0
- ksadk/harness/working_context_patch.py +99 -0
- ksadk/identity/resolver.py +18 -0
- ksadk/interaction/__init__.py +1 -1
- ksadk/interaction/ledger.py +1 -1
- ksadk/interaction/provider.py +1 -1
- ksadk/interaction/providers/__init__.py +3 -1
- ksadk/interaction/providers/adk.py +1 -1
- ksadk/interaction/providers/codex.py +1 -1
- ksadk/interaction/providers/harness.py +50 -0
- ksadk/interaction/providers/langgraph.py +1 -1
- ksadk/kernel/__init__.py +10 -0
- ksadk/kernel/approval_presentation.py +91 -0
- ksadk/kernel/authorization.py +1 -1
- ksadk/kernel/bootstrap.py +86 -102
- ksadk/kernel/contract_fingerprints.py +1 -1
- ksadk/kernel/contracts.py +5 -0
- ksadk/kernel/control.py +32 -1
- ksadk/kernel/execution_grants.py +221 -0
- ksadk/kernel/execution_grants_memory.py +133 -0
- ksadk/kernel/execution_grants_postgres.py +217 -0
- ksadk/kernel/execution_grants_sqlite.py +209 -0
- ksadk/kernel/ingress.py +27 -27
- ksadk/kernel/mapping.py +1 -1
- ksadk/kernel/memory_store.py +24 -11
- ksadk/kernel/postgres_store.py +63 -33
- ksadk/kernel/recovery.py +78 -14
- ksadk/kernel/sql/001_agent_kernel.sql +23 -0
- ksadk/kernel/sqlite_store.py +304 -25
- ksadk/kernel/state.py +2 -3
- ksadk/kernel/store.py +69 -2
- ksadk/kernel/worker.py +79 -41
- ksadk/kernel/worker_history.py +72 -0
- ksadk/kernel/worker_identity.py +47 -0
- ksadk/memory/coordinator.py +22 -6
- ksadk/memory/extraction.py +40 -1
- ksadk/memory/models.py +77 -1
- ksadk/memory/provider_resolver.py +5 -0
- ksadk/memory/providers/local_postgres.py +200 -0
- ksadk/memory/providers/local_sqlite.py +42 -3
- ksadk/memory/retrieval.py +189 -0
- ksadk/memory/store_adapter.py +150 -0
- ksadk/model_policy.py +2 -2
- ksadk/model_proxy/detect.py +254 -0
- ksadk/model_proxy/server.py +4 -2
- ksadk/model_proxy/transform.py +40 -2
- ksadk/plugins/__init__.py +1 -1
- ksadk/plugins/bridges/dsh.py +11 -0
- ksadk/plugins/builtins.py +40 -2
- ksadk/plugins/companion_artifacts.py +83 -0
- ksadk/plugins/companions.py +368 -0
- ksadk/plugins/contracts.py +1 -1
- ksadk/plugins/dsh_channels.py +156 -0
- ksadk/plugins/dsh_home.py +140 -0
- ksadk/plugins/dsh_teams.py +105 -0
- ksadk/plugins/dsh_toolchain.py +101 -19
- ksadk/plugins/execution_host.py +99 -0
- ksadk/plugins/providers/bundles/dsh-channels-client/client.js +19 -0
- ksadk/plugins/providers/bundles/dsh-channels-client/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-channels-client/index.mjs +7 -0
- ksadk/plugins/providers/bundles/dsh-channels-client/package.json +12 -0
- ksadk/plugins/providers/bundles/dsh-knowledge/package.json +1 -1
- ksadk/plugins/providers/bundles/dsh-memory/package.json +1 -1
- ksadk/plugins/providers/bundles/dsh-skill-center/package.json +1 -1
- ksadk/plugins/providers/bundles/dsh-teams-client/client.js +29 -0
- ksadk/plugins/providers/bundles/dsh-teams-client/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-teams-client/index.mjs +11 -0
- ksadk/plugins/providers/bundles/dsh-teams-client/package.json +35 -0
- ksadk/plugins/providers/bundles/dsh-teams-leader-policy/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-teams-leader-policy/index.mjs +13 -0
- ksadk/plugins/providers/bundles/dsh-teams-leader-policy/package.json +27 -0
- ksadk/plugins/providers/bundles/dsh-teams-profile/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-teams-profile/index.mjs +12 -0
- ksadk/plugins/providers/bundles/dsh-teams-profile/package.json +26 -0
- ksadk/plugins/providers/bundles/dsh-teams-router/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-teams-router/index.mjs +16 -0
- ksadk/plugins/providers/bundles/dsh-teams-router/package.json +27 -0
- ksadk/plugins/providers/bundles/dsh-teams-tasks/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-teams-tasks/index.mjs +16 -0
- ksadk/plugins/providers/bundles/dsh-teams-tasks/package.json +27 -0
- ksadk/plugins/providers/bundles/dsh-teams-tools/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-teams-tools/index.mjs +25 -0
- ksadk/plugins/providers/bundles/dsh-teams-tools/package.json +29 -0
- ksadk/plugins/providers/bundles/dsh-teams-tools/tools.json +235 -0
- ksadk/plugins/providers/bundles/ksadk-codex/index.mjs +1 -1
- ksadk/plugins/providers/bundles/ksadk-dsh-capability-host/index.mjs +51 -1
- ksadk/plugins/providers/bundles/ksadk-dsh-capability-host/package.json +2 -2
- ksadk/plugins/providers/bundles/ksadk-dsh-companion-host/client.mjs +133 -0
- ksadk/plugins/providers/bundles/ksadk-dsh-companion-host/index.mjs +14 -0
- ksadk/plugins/providers/bundles/ksadk-dsh-studio/client.js +27 -4
- ksadk/plugins/providers/bundles/ksadk-dsh-studio/index.mjs +9 -5
- ksadk/plugins/providers/bundles/ksadk-harness/index.mjs +1 -1
- ksadk/plugins/providers/codex.py +10 -2
- ksadk/plugins/providers/dsh_capabilities.py +61 -0
- ksadk/plugins/providers/harness.py +181 -33
- ksadk/plugins/providers/harness_delegation.py +593 -0
- ksadk/plugins/providers/harness_managed.py +456 -0
- ksadk/plugins/providers/harness_tools.py +326 -0
- ksadk/plugins/providers/shipped_dsh.py +4 -1
- ksadk/plugins/subagent_providers/codex.py +28 -6
- ksadk/plugins/teams/__init__.py +5 -0
- ksadk/plugins/teams/api.py +405 -0
- ksadk/plugins/teams/application.py +680 -0
- ksadk/plugins/teams/artifacts.py +60 -0
- ksadk/plugins/teams/context.py +96 -0
- ksadk/plugins/teams/contracts.py +136 -0
- ksadk/plugins/teams/domain.py +1427 -0
- ksadk/plugins/teams/domain_values.py +24 -0
- ksadk/plugins/teams/errors.py +13 -0
- ksadk/plugins/teams/migration.py +311 -0
- ksadk/plugins/teams/migration_cli.py +322 -0
- ksadk/plugins/teams/postgres_store.py +138 -0
- ksadk/plugins/teams/runtime.py +777 -0
- ksadk/plugins/teams/source_projection.py +84 -0
- ksadk/plugins/teams/store.py +311 -0
- ksadk/plugins/teams/task_decisions.py +423 -0
- ksadk/plugins/teams/transport.py +91 -0
- ksadk/plugins/teams/workspaces.py +255 -0
- ksadk/runners/_langgraph_runner_streams.py +121 -45
- ksadk/runners/_langgraph_state_reader.py +106 -0
- ksadk/runners/_session_identity.py +285 -0
- ksadk/runners/adk_runner.py +25 -60
- ksadk/runners/langgraph_runner.py +128 -111
- ksadk/runners/patch_langchain.py +47 -0
- ksadk/runners/usage_accumulator.py +11 -3
- ksadk/runtime/_runner_adapter/stream_mapping.py +52 -2
- ksadk/runtime/conversation_execution.py +25 -1
- ksadk/runtime/executor.py +9 -1
- ksadk/runtime/factory.py +36 -1
- ksadk/runtime/preprocessing.py +11 -3
- ksadk/runtime/runner_adapter.py +38 -9
- ksadk/runtime/skill_eval_result.py +36 -0
- ksadk/runtime/timing.py +46 -0
- ksadk/runtime/usage.py +49 -18
- ksadk/runtime_context.py +103 -1
- ksadk/sandbox/backends/e2b.py +245 -23
- ksadk/sandbox/backends/local_process.py +63 -39
- ksadk/sandbox/base.py +62 -1
- ksadk/sandbox/diagnostics.py +82 -0
- ksadk/sandbox/local_controls.py +746 -0
- ksadk/sandbox/local_launcher.py +90 -0
- ksadk/scheduler/dispatcher.py +1 -1
- ksadk/server/invocation_identity.py +118 -0
- ksadk/server/routes/common.py +32 -3
- ksadk/server/routes/control.py +64 -9
- ksadk/server/routes/dependencies.py +2 -1
- ksadk/server/routes/kernel_ingress.py +9 -1
- ksadk/server/routes/misc.py +233 -25
- ksadk/server/routes/models.py +3 -3
- ksadk/server/routes/openai_compat.py +76 -13
- ksadk/server/routes/run.py +106 -35
- ksadk/server/routes/sessions.py +244 -68
- ksadk/server/routes/workspace.py +130 -21
- ksadk/server/static/assets/{ArtifactsPanel-CGbWlMNh.js → ArtifactsPanel-C1YoaKhx.js} +1 -1
- ksadk/server/static/assets/{CodeBlock-b4C7upmO.js → CodeBlock-DHuAWfr5.js} +10 -7
- ksadk/server/static/assets/MathMessageMarkdown-cvdrBwYr.js +8 -0
- ksadk/server/static/assets/{MermaidBlock-BEBN4Ksz.js → MermaidBlock-DeBkbJvI.js} +9 -9
- ksadk/server/static/assets/{NativeTerminalPanel-zvL-WpAn.js → NativeTerminalPanel-oJj44_sV.js} +1 -1
- ksadk/server/static/assets/{abnfDiagram-VCTEODGH-BYafW7Za.js → abnfDiagram-VCTEODGH-Dhfv25o2.js} +1 -1
- ksadk/server/static/assets/{arc-bTohInsS.js → arc-C35w-pn1.js} +1 -1
- ksadk/server/static/assets/architecture-7GRP2DOG-BCsa26zi.js +1 -0
- ksadk/server/static/assets/{architectureDiagram-5GKGNRK7-Ch5Lbzsi.js → architectureDiagram-5GKGNRK7-FoMY_u6D.js} +1 -1
- ksadk/server/static/assets/{blockDiagram-NRAW4CY4-kqF4MDOG.js → blockDiagram-NRAW4CY4-zD4Rt7oE.js} +1 -1
- ksadk/server/static/assets/{c4Diagram-UCG6FXSJ-8uSRIODv.js → c4Diagram-UCG6FXSJ-BCtGGkhN.js} +1 -1
- ksadk/server/static/assets/channel-_KDifNys.js +1 -0
- ksadk/server/static/assets/chunk-2Q5K7J3B-HdVkJ9F0.js +1 -0
- ksadk/server/static/assets/{chunk-5VM5RSS4-DkhehZDr.js → chunk-5VM5RSS4-C2Ms13_k.js} +1 -1
- ksadk/server/static/assets/{chunk-F27PBJKO-BdXhtPe9.js → chunk-F27PBJKO-BoTj-qgx.js} +1 -1
- ksadk/server/static/assets/{chunk-G27WJ6UU-DPTpvpwi.js → chunk-G27WJ6UU-DOMyyjHH.js} +1 -1
- ksadk/server/static/assets/{chunk-JWPE2WC7-Pqoh38el.js → chunk-JWPE2WC7-DbJJqDli.js} +1 -1
- ksadk/server/static/assets/{chunk-LCL6LL3I-DeU00qC-.js → chunk-LCL6LL3I-CLuRCt_W.js} +1 -1
- ksadk/server/static/assets/{chunk-POPQ4Y6H-CzxScFkr.js → chunk-POPQ4Y6H-D0Dz847e.js} +1 -1
- ksadk/server/static/assets/{chunk-RHFEMEQ7-DpqMx-ux.js → chunk-RHFEMEQ7-BWSRzEcd.js} +1 -1
- ksadk/server/static/assets/{chunk-SVP7TREG-C6t0SypQ.js → chunk-SVP7TREG-CPoHqkCY.js} +1 -1
- ksadk/server/static/assets/{chunk-XXDRQBXY-DVaeafZk.js → chunk-XXDRQBXY-Bx1jS-X-.js} +1 -1
- ksadk/server/static/assets/classDiagram-DTDB5LWJ-BVCW3ZqZ.js +1 -0
- ksadk/server/static/assets/classDiagram-v2-JRS7N3AN-BVCW3ZqZ.js +1 -0
- ksadk/server/static/assets/{cose-bilkent-JH36ORCC-Bf9D3tzJ.js → cose-bilkent-JH36ORCC-LzyWm4m0.js} +1 -1
- ksadk/server/static/assets/cynefin-OW5HDTMX-CNXjFctL.js +1 -0
- ksadk/server/static/assets/{cynefinDiagram-5FMLGOSQ-B9cY3iTz.js → cynefinDiagram-5FMLGOSQ-BlW_bHED.js} +1 -1
- ksadk/server/static/assets/{dagre-3AP2YEHR-CSwlx3CB.js → dagre-3AP2YEHR-Bu_S86_i.js} +1 -1
- ksadk/server/static/assets/{dagre-UBpgon5q.js → dagre-B7nCawed.js} +1 -1
- ksadk/server/static/assets/{diagram-S7CK7UJ4-C9akhN9a.js → diagram-S7CK7UJ4-W_Zow2Km.js} +1 -1
- ksadk/server/static/assets/{diagram-UQ7AKVKN-CgedhTPI.js → diagram-UQ7AKVKN-CLIKAHON.js} +1 -1
- ksadk/server/static/assets/{diagram-VSXAHHWV-Cjucz5BY.js → diagram-VSXAHHWV-Dv6_QAlN.js} +1 -1
- ksadk/server/static/assets/{diagram-VX7I27RA-Dd4Vleyn.js → diagram-VX7I27RA-BWAWRDtZ.js} +1 -1
- ksadk/server/static/assets/{diagram-Z3DM3KII-CZ2jGtYW.js → diagram-Z3DM3KII-XA_rWMss.js} +1 -1
- ksadk/server/static/assets/dist-0X_j2Rcc.js +1 -0
- ksadk/server/static/assets/{dist-DiixqL0J.js → dist-1nXCdsej.js} +1 -1
- ksadk/server/static/assets/{dist-BIr4DSRq.js → dist-2vL2sAdF.js} +1 -1
- ksadk/server/static/assets/{dist-D_ctSS2i.js → dist-B3bA05-e.js} +1 -1
- ksadk/server/static/assets/{dist-ClYUxfeK.js → dist-BLpRy_Yx.js} +1 -1
- ksadk/server/static/assets/{dist-QfkEHOlb.js → dist-BO_UwatH.js} +1 -1
- ksadk/server/static/assets/{dist-B3FR1SKK.js → dist-BdNFAney.js} +1 -1
- ksadk/server/static/assets/{dist-BnaTiyzN.js → dist-C0J5_3qM.js} +1 -1
- ksadk/server/static/assets/{dist-Bj730Ib4.js → dist-CGt_UGeO.js} +1 -1
- ksadk/server/static/assets/{dist-CFzsn6BG.js → dist-CIRMvUM4.js} +1 -1
- ksadk/server/static/assets/{dist-BgV_owcB.js → dist-CIpWk_5f.js} +1 -1
- ksadk/server/static/assets/{dist-C5_ZAZsG.js → dist-CPyieXEf.js} +1 -1
- ksadk/server/static/assets/{dist-btbmmX5O.js → dist-D-92S-Fd.js} +1 -1
- ksadk/server/static/assets/{dist-fBO2v5Kt.js → dist-DNKuMzWc.js} +1 -1
- ksadk/server/static/assets/{dist-ufY3F5p6.js → dist-DWfdmz9s.js} +2 -2
- ksadk/server/static/assets/{dist-DVCOWtha.js → dist-DppE_r-D.js} +1 -1
- ksadk/server/static/assets/{dist-C1NMAY5a.js → dist-DyG6Ya-z.js} +1 -1
- ksadk/server/static/assets/{dist-CB9iJrvg.js → dist-M-SrdhhZ.js} +1 -1
- ksadk/server/static/assets/{dist-DvFK7p5S.js → dist-mqD5TZup.js} +1 -1
- ksadk/server/static/assets/{dist-Cf125P_m.js → dist-n3n6t_FO.js} +1 -1
- ksadk/server/static/assets/{dist-DFD6Qa6T.js → dist-qe8xjesy.js} +1 -1
- ksadk/server/static/assets/{dist-DoVSwoDb.js → dist-t6MzE0jU.js} +1 -1
- ksadk/server/static/assets/{ebnfDiagram-PWID7BFC-Ci8NqqZu.js → ebnfDiagram-PWID7BFC-BfCzF1Xi.js} +1 -1
- ksadk/server/static/assets/{erDiagram-SSCWMZ5O-CCIOhLZG.js → erDiagram-SSCWMZ5O-Dpz9_0zn.js} +1 -1
- ksadk/server/static/assets/eventmodeling-NTZA5JFV-B5-8RH9c.js +1 -0
- ksadk/server/static/assets/flowDiagram-A5DVABFB-BppFxEKw.js +1 -0
- ksadk/server/static/assets/{ganttDiagram-EL5Y4UJY-Cp_r9Hb6.js → ganttDiagram-EL5Y4UJY-DDaG1f4_.js} +1 -1
- ksadk/server/static/assets/gitGraph-4MIJSDKK-B-AhYj4C.js +1 -0
- ksadk/server/static/assets/{gitGraphDiagram-WWUBYQGX-Dlhc8Wr8.js → gitGraphDiagram-WWUBYQGX-DcxzRwYC.js} +1 -1
- ksadk/server/static/assets/index-BMd2mucF.css +2 -0
- ksadk/server/static/assets/index-D5qyyhTH.js +244 -0
- ksadk/server/static/assets/info-A6RAGUB7-0uiKrC35.js +1 -0
- ksadk/server/static/assets/{infoDiagram-RXCK75RN-CO0rRTRA.js → infoDiagram-RXCK75RN-CYMdn6lQ.js} +1 -1
- ksadk/server/static/assets/{ishikawaDiagram-5VMMS53U-CHiaedSS.js → ishikawaDiagram-5VMMS53U-CLHFAD6c.js} +1 -1
- ksadk/server/static/assets/{journeyDiagram-EYS64GPL-CHcCIB09.js → journeyDiagram-EYS64GPL-BHSKQGAl.js} +1 -1
- ksadk/server/static/assets/{kanban-definition-3QL26DDD-CJ_ebBZf.js → kanban-definition-3QL26DDD-D5W3tjTT.js} +1 -1
- ksadk/server/static/assets/{katex-B4weu383.js → katex-mtjOi4KM.js} +1 -1
- ksadk/server/static/assets/{linear-V-MgYHW1.js → linear-BETqsxE_.js} +1 -1
- ksadk/server/static/assets/{mermaid-parser.core-CBijEX_c.js → mermaid-parser.core-DPWrvs90.js} +2 -2
- ksadk/server/static/assets/{mindmap-definition-FBJOCRG2-Bc-pQvpp.js → mindmap-definition-FBJOCRG2-CJG2mfBP.js} +1 -1
- ksadk/server/static/assets/packet-AYTQ26CC-BVTmZ_cw.js +1 -0
- ksadk/server/static/assets/{pegDiagram-XKGWAZYB-D7genGLl.js → pegDiagram-XKGWAZYB-GjAPNaqn.js} +1 -1
- ksadk/server/static/assets/pie-WAS4IAKB-DyfxBU7V.js +1 -0
- ksadk/server/static/assets/{pieDiagram-E7YTZNPT-Bxj32zwD.js → pieDiagram-E7YTZNPT-ToIewrqr.js} +1 -1
- ksadk/server/static/assets/{quadrantDiagram-AXDQQJYC-BURv2mGh.js → quadrantDiagram-AXDQQJYC-4d78KiEY.js} +1 -1
- ksadk/server/static/assets/radar-RG4KPBEZ-FFontjL2.js +1 -0
- ksadk/server/static/assets/railroad-74A4TZTK-D0Uidzen.js +1 -0
- ksadk/server/static/assets/railroad-abnf-HS5TGJTU-BOo_9T2h.js +1 -0
- ksadk/server/static/assets/railroad-ebnf-LZEXJU2U-D6-BjW7Z.js +1 -0
- ksadk/server/static/assets/railroad-peg-WCYAUIDC-CXx__yMm.js +1 -0
- ksadk/server/static/assets/{railroadDiagram-O6MQD6OU-CCsh3avW.js → railroadDiagram-O6MQD6OU-DKzx4xfv.js} +1 -1
- ksadk/server/static/assets/{requirementDiagram-EFPCY7ZU-_FRRBKEd.js → requirementDiagram-EFPCY7ZU-CJYljxQS.js} +1 -1
- ksadk/server/static/assets/{sankeyDiagram-P5KCCOFB-C-gr2o9M.js → sankeyDiagram-P5KCCOFB-DLU2fV1w.js} +1 -1
- ksadk/server/static/assets/{sequenceDiagram-WJ2MYXX4-D97NmfKg.js → sequenceDiagram-WJ2MYXX4-CVqysrA9.js} +1 -1
- ksadk/server/static/assets/{sizeCapture-X5ZJPWSS-DjrPC5FX.js → sizeCapture-X5ZJPWSS-BUxfmTHc.js} +1 -1
- ksadk/server/static/assets/{stateDiagram-HBIQ2CUA-DzMNg1hh.js → stateDiagram-HBIQ2CUA-CNFgYI9E.js} +1 -1
- ksadk/server/static/assets/stateDiagram-v2-4QOOHH4V-BXAFScz8.js +1 -0
- ksadk/server/static/assets/{swimlanes-XN3QIQJK-Cssf_CsU.js → swimlanes-XN3QIQJK-B6qCMe8N.js} +1 -1
- ksadk/server/static/assets/swimlanesDiagram-VK2B7HYN-uIQ2lJKH.js +8 -0
- ksadk/server/static/assets/{timeline-definition-24CTP7MA-BWTHzyS1.js → timeline-definition-24CTP7MA-CMD3x_U_.js} +1 -1
- ksadk/server/static/assets/treeView-Q6P3EWNA-CK5GgucZ.js +1 -0
- ksadk/server/static/assets/treemap-WGGIJYW6-Bq1u1SpG.js +1 -0
- ksadk/server/static/assets/{vennDiagram-4TSXK5OY-BSKgJsmR.js → vennDiagram-4TSXK5OY-BqtUqvXM.js} +1 -1
- ksadk/server/static/assets/wardley-WFR3VGLG-QAt06uEz.js +1 -0
- ksadk/server/static/assets/{wardleyDiagram-VM6X3IG4-eflHNoaZ.js → wardleyDiagram-VM6X3IG4-B5KfDjI-.js} +1 -1
- ksadk/server/static/assets/{xychartDiagram-S5SC5T6Z-eYqrQ-v4.js → xychartDiagram-S5SC5T6Z-BaUlSZrn.js} +1 -1
- ksadk/server/static/index.html +2 -2
- ksadk/server/terminal_sessions.py +34 -2
- ksadk/sessions/invocation_identity.py +235 -0
- ksadk/skills/__init__.py +26 -0
- ksadk/skills/events.py +464 -0
- ksadk/skills/manifest_cache.py +263 -0
- ksadk/skills/mcp_server/__init__.py +0 -0
- ksadk/skills/mcp_server/_registry.py +33 -0
- ksadk/skills/mcp_server/_routing.py +26 -0
- ksadk/skills/mcp_server/_workspace_files.py +160 -0
- ksadk/skills/mcp_server/register.py +415 -0
- ksadk/skills/mcp_server/server.py +218 -0
- ksadk/skills/models.py +11 -0
- ksadk/skills/observability.py +132 -0
- ksadk/skills/package_store.py +75 -2
- ksadk/skills/runtime/agent.py +38 -5
- ksadk/skills/runtime/artifacts.py +87 -0
- ksadk/skills/runtime/backends/e2b.py +393 -52
- ksadk/skills/runtime/backends/local.py +621 -119
- ksadk/skills/runtime/base.py +78 -7
- ksadk/skills/runtime/executor.py +266 -1
- ksadk/skills/runtime/loader.py +108 -3
- ksadk/skills/runtime/request.py +18 -0
- ksadk/skills/tool_defs.py +108 -3
- ksadk/studio/api.py +592 -57
- ksadk/studio/api_contracts.py +8 -2
- ksadk/studio/api_plugin_routes.py +39 -12
- ksadk/studio/api_resource_connections.py +79 -41
- ksadk/studio/authoring.py +12 -6
- ksadk/studio/authoring_coordinator.py +4 -2
- ksadk/studio/builder.py +12 -0
- ksadk/studio/capabilities.py +23 -6
- ksadk/studio/channel_connections.py +333 -0
- ksadk/studio/cloud.py +30 -10
- ksadk/studio/cloud_shared_web.py +75 -2
- ksadk/studio/codex_agent_service.py +2 -2
- ksadk/studio/codex_builder.py +1 -1
- ksadk/studio/codex_run.py +6 -1
- ksadk/studio/compiler.py +10 -0
- ksadk/studio/configuration.py +182 -0
- ksadk/studio/contracts.py +33 -5
- ksadk/studio/dsh_application.py +135 -25
- ksadk/studio/dsh_capability_service.py +287 -20
- ksadk/studio/dsh_lifecycle.py +58 -0
- ksadk/studio/dsh_provider_registration.py +55 -16
- ksadk/studio/entry.py +53 -0
- ksadk/studio/event_store.py +36 -5
- ksadk/studio/execution_host.py +525 -0
- ksadk/studio/framework_run.py +32 -10
- ksadk/studio/hosted_kernel.py +1 -1
- ksadk/studio/kernel_registry.py +418 -0
- ksadk/studio/kernel_sqlite_migration.py +181 -0
- ksadk/studio/model_client.py +1178 -64
- ksadk/studio/model_profile_service.py +26 -11
- ksadk/studio/native_documents.py +172 -0
- ksadk/studio/plugin_composition.py +13 -2
- ksadk/studio/plugin_kernel_adapter.py +15 -0
- ksadk/studio/plugin_lifecycle.py +80 -0
- ksadk/studio/plugin_runtime.py +230 -17
- ksadk/studio/provider_recovery.py +59 -0
- ksadk/studio/recovery_page.py +70 -0
- ksadk/studio/resource_authority.py +59 -32
- ksadk/studio/resource_catalog.py +6 -0
- ksadk/studio/run_activity.py +895 -0
- ksadk/studio/run_documents.py +127 -0
- ksadk/studio/run_service.py +329 -33
- ksadk/studio/runtime_catalog.py +53 -10
- ksadk/studio/runtime_source.py +1 -1
- ksadk/studio/scheduler_runtime.py +32 -289
- ksadk/studio/service.py +398 -103
- ksadk/studio/shared_web.py +149 -36
- ksadk/studio/static/assets/ChannelsPage-D_PGmKVq.js +8 -0
- ksadk/studio/static/assets/CodeBlock-DMIf4h33-UIqo-BPW.js +44 -0
- ksadk/studio/static/assets/ExecutionTree-v3HexvPo-Bk8wzGSy.js +1 -0
- ksadk/studio/static/assets/MathMessageMarkdown-BesSeCYl-OhNwH4K9.js +8 -0
- ksadk/studio/static/assets/MermaidBlock-H_0qzQDf-BdXtxug_.js +11 -0
- ksadk/studio/static/assets/MessageMarkdown-CwMTvgFj-g0I-I4dD.js +59 -0
- ksadk/studio/static/assets/PrismRenderer-5pK6tUdb.js +3 -0
- ksadk/studio/static/assets/TeamsPage-DqX4HWKQ.js +3 -0
- ksadk/studio/static/assets/abnfDiagram-VCTEODGH-Bnb1O3tA.js +1 -0
- ksadk/studio/static/assets/architecture-7GRP2DOG-BMOPAkUC.js +1 -0
- ksadk/studio/static/assets/architectureDiagram-5GKGNRK7-5Zn1gqJv.js +36 -0
- ksadk/studio/static/assets/{blockDiagram-I7D4REHJ-CFmPl1de.js → blockDiagram-I7D4REHJ-CLB4L11u.js} +6 -6
- ksadk/studio/static/assets/{c4Diagram-7LVT6UL2-BRrGu8qt.js → c4Diagram-7LVT6UL2-BOma_Z_F.js} +7 -7
- ksadk/studio/static/assets/channel-r8itPEik.js +1 -0
- ksadk/studio/static/assets/chunk-2E4U76K2-BFf_huql.js +2 -0
- ksadk/studio/static/assets/chunk-2ZTRR5NV-C2qZJila.js +2 -0
- ksadk/studio/static/assets/chunk-3Z5EZCMW-DMniOlPd.js +1 -0
- ksadk/studio/static/assets/{chunk-4HAMMTFA-D220vUtq.js → chunk-4HAMMTFA-DVtDP4rm.js} +7 -7
- ksadk/studio/static/assets/chunk-5V3GS4D5-i-ZDOEnP.js +1 -0
- ksadk/studio/static/assets/chunk-6AZGARVD-BB6FqMl-.js +1 -0
- ksadk/studio/static/assets/chunk-6EIED4P4-DdUJkP0f.js +1 -0
- ksadk/studio/static/assets/chunk-6K3QC6MW-CqVsVn-y.js +1 -0
- ksadk/studio/static/assets/chunk-6TQVIW2G-DKlLbNIP.js +1 -0
- ksadk/studio/static/assets/chunk-747NJXEK-BFkZPlab.js +2 -0
- ksadk/studio/static/assets/chunk-75Z2AOVW-BZNhM4vB.js +2 -0
- ksadk/studio/static/assets/chunk-CLGD4ZFX-D-GTtyKs.js +1 -0
- ksadk/studio/static/assets/{chunk-DU6HZSFF-C4DtVpCu.js → chunk-DU6HZSFF-CpEZCUgg.js} +1 -1
- ksadk/studio/static/assets/chunk-F27PBJKO-D7pvKf0C.js +1 -0
- ksadk/studio/static/assets/{chunk-GMAD6QVW-DiQA-u2N.js → chunk-GMAD6QVW-DE_8H717.js} +6 -6
- ksadk/studio/static/assets/chunk-GVQU2GXP-BfEB0lNv.js +1 -0
- ksadk/studio/static/assets/chunk-I5DQTOEV-Hm2LfiYI.js +1 -0
- ksadk/studio/static/assets/chunk-ICYGCRZG-749o-pGJ.js +1 -0
- ksadk/studio/static/assets/chunk-IH6LHLGP-CC6I9F3i.js +1 -0
- ksadk/studio/static/assets/{chunk-IMKFNOWR-BSlbjT_b.js → chunk-IMKFNOWR-D38axYOR.js} +5 -5
- ksadk/studio/static/assets/chunk-KI3K4JFJ-Rma-0k_M.js +1 -0
- ksadk/studio/static/assets/chunk-L3NEJ4N5-Dq5xn7aL.js +1 -0
- ksadk/studio/static/assets/chunk-LNGE3PJU-DWpGwHrW.js +34 -0
- ksadk/studio/static/assets/{chunk-OSK3NFVY-M2m6G3j4.js → chunk-OSK3NFVY-DiCQjx9b.js} +5 -5
- ksadk/studio/static/assets/chunk-OUJLGHUK-D0j2JRSg.js +2 -0
- ksadk/studio/static/assets/{chunk-P2QGCYS3-DezaQxiK.js → chunk-P2QGCYS3-VdhKmfYq.js} +1 -1
- ksadk/studio/static/assets/chunk-POPQ4Y6H-C1_rzO5M.js +1 -0
- ksadk/studio/static/assets/chunk-PWAF6VOD-B45HvflI.js +1 -0
- ksadk/studio/static/assets/{chunk-SHT3W25Y-DAyIVp5H.js → chunk-SHT3W25Y-DsCFnRVE.js} +9 -9
- ksadk/studio/static/assets/{chunk-SVP7TREG-DulomOrS.js → chunk-SVP7TREG-DljApgRX.js} +1 -1
- ksadk/studio/static/assets/{chunk-TICWLB2K-bHJYoflj.js → chunk-TICWLB2K-DWqRtyqa.js} +6 -6
- ksadk/studio/static/assets/chunk-TLUHSLCS-DUeGgnD5.js +2 -0
- ksadk/studio/static/assets/chunk-UY3FDG6J-CnmaAkG5.js +1 -0
- ksadk/studio/static/assets/chunk-XHIXRSVI-BFQ6B8BE.js +1 -0
- ksadk/studio/static/assets/chunk-XXDRQBXY-DqAYeljN.js +1 -0
- ksadk/studio/static/assets/classDiagram-ZZMXUADV-DjeMNJmu.js +1 -0
- ksadk/studio/static/assets/classDiagram-v2-VYDZK3BY-DjeMNJmu.js +1 -0
- ksadk/studio/static/assets/clsx-DB0hHKMi.js +1 -0
- ksadk/studio/static/assets/cose-bilkent-JH36ORCC-om8AY0Mc.js +1 -0
- ksadk/studio/static/assets/createLucideIcon-DR0LGTP5.js +1 -0
- ksadk/studio/static/assets/cynefin-OW5HDTMX-7tP7QfM3.js +1 -0
- ksadk/studio/static/assets/cynefinDiagram-5FMLGOSQ-6BrmK52S.js +62 -0
- ksadk/studio/static/assets/dagre-GXQ25YYZ-buZBRlwz.js +4 -0
- ksadk/studio/static/assets/{diagram-S7CK7UJ4-0BZ98mya.js → diagram-S7CK7UJ4-C6aH78c4.js} +3 -3
- ksadk/studio/static/assets/diagram-UQ7AKVKN-DY_tQ6C_.js +41 -0
- ksadk/studio/static/assets/diagram-VSXAHHWV-DX9p5cQT.js +3 -0
- ksadk/studio/static/assets/diagram-VX7I27RA-DB2WSH8X.js +24 -0
- ksadk/studio/static/assets/diagram-Z3DM3KII-Ce1BJwHE.js +24 -0
- ksadk/studio/static/assets/ebnfDiagram-PWID7BFC-Daukxwqf.js +1 -0
- ksadk/studio/static/assets/{erDiagram-RLTQ6QDP-DLGry2Ap.js → erDiagram-RLTQ6QDP-CGthTMmJ.js} +6 -6
- ksadk/studio/static/assets/eventmodeling-NTZA5JFV-BR2FzK4R.js +1 -0
- ksadk/studio/static/assets/flowDiagram-HODETNUW-CZ1tEenp.js +1 -0
- ksadk/studio/static/assets/ganttDiagram-EL5Y4UJY-BfoAZW9X.js +292 -0
- ksadk/studio/static/assets/gitGraph-4MIJSDKK-DYlXv_yJ.js +1 -0
- ksadk/studio/static/assets/gitGraphDiagram-WWUBYQGX-S985OIJF.js +106 -0
- ksadk/studio/static/assets/iconfont-4HN3C9Pg.woff2 +0 -0
- ksadk/studio/static/assets/index-CfEnms6Y.css +2 -0
- ksadk/studio/static/assets/index-Dp61rOWZ.js +0 -0
- ksadk/studio/static/assets/index.dom-BQenBtFm.js +1 -0
- ksadk/studio/static/assets/info-A6RAGUB7-BlU-8_xu.js +1 -0
- ksadk/studio/static/assets/infoDiagram-27XIBGKW-CO3W8tFn.js +2 -0
- ksadk/studio/static/assets/{ishikawaDiagram-5VMMS53U-CljI2wyf.js → ishikawaDiagram-5VMMS53U-BUGEl8cO.js} +2 -2
- ksadk/studio/static/assets/{journeyDiagram-3NMN7TZE-D50Fo2sL.js → journeyDiagram-3NMN7TZE-Ch2ZYxvr.js} +6 -6
- ksadk/studio/static/assets/{kanban-definition-UXKFOSKX-DimfOTam.js → kanban-definition-UXKFOSKX-Da-Fp4vC.js} +3 -3
- ksadk/studio/static/assets/kingsoft-cloud-BOcLiQ3e.ico +0 -0
- ksadk/studio/static/assets/{line-CX5BOOUP.js → line-BDaeq300.js} +1 -1
- ksadk/studio/static/assets/linear-DmucvK78.js +1 -0
- ksadk/studio/static/assets/mermaid-parser.core-Cj5mYdBi.js +4 -0
- ksadk/studio/static/assets/{mindmap-definition-YA3MSWOX-Bizzqy5R.js → mindmap-definition-YA3MSWOX-CvlsVQ38.js} +1 -1
- ksadk/studio/static/assets/packet-AYTQ26CC-BSJEH9Lb.js +1 -0
- ksadk/studio/static/assets/pegDiagram-XKGWAZYB-BuHuNgT5.js +1 -0
- ksadk/studio/static/assets/pie-WAS4IAKB-qxv01Y8W.js +1 -0
- ksadk/studio/static/assets/{pieDiagram-E7YTZNPT-B9mrFSDF.js → pieDiagram-E7YTZNPT-DlrWiSOv.js} +1 -1
- ksadk/studio/static/assets/preload-helper-CO68xz6u.js +1 -0
- ksadk/studio/static/assets/presentation-yYw7xK60-BmcZriri.js +1 -0
- ksadk/studio/static/assets/{quadrantDiagram-AXDQQJYC-NzUfCbMR.js → quadrantDiagram-AXDQQJYC-BA3hpUZM.js} +6 -6
- ksadk/studio/static/assets/radar-RG4KPBEZ-B6h6pWOs.js +1 -0
- ksadk/studio/static/assets/railroad-74A4TZTK-CGtTWdGc.js +1 -0
- ksadk/studio/static/assets/railroad-abnf-HS5TGJTU-Cq7y22IA.js +1 -0
- ksadk/studio/static/assets/railroad-ebnf-LZEXJU2U-V0aQVv9m.js +1 -0
- ksadk/studio/static/assets/railroad-peg-WCYAUIDC-BQiIsX_p.js +1 -0
- ksadk/studio/static/assets/railroadDiagram-O6MQD6OU-BxpAazym.js +1 -0
- ksadk/studio/static/assets/{requirementDiagram-BXWQKSXE-BF3d103U.js → requirementDiagram-BXWQKSXE-E-Ge0FcV.js} +1 -1
- ksadk/studio/static/assets/sankeyDiagram-P5KCCOFB-CA6YKhQ3.js +40 -0
- ksadk/studio/static/assets/{sequenceDiagram-WJ2MYXX4-Dh4wZtUm.js → sequenceDiagram-WJ2MYXX4-CcElXGg4.js} +9 -9
- ksadk/studio/static/assets/src-B6xuSHsQ.js +1 -0
- ksadk/studio/static/assets/stateDiagram-D77RDMKH-DdXZOFqY.js +1 -0
- ksadk/studio/static/assets/stateDiagram-v2-MP3YSRHH-CJbOM-QK.js +1 -0
- ksadk/studio/static/assets/swimlanes-42K2YHIH-NtgEEHLY.js +1 -0
- ksadk/studio/static/assets/swimlanesDiagram-VR7AAH4N-D-AVlW8B.js +8 -0
- ksadk/studio/static/assets/{timeline-definition-24CTP7MA-DxmSSjRB.js → timeline-definition-24CTP7MA-CIuYhNy3.js} +7 -7
- ksadk/studio/static/assets/treeView-Q6P3EWNA-BTTYcvrF.js +1 -0
- ksadk/studio/static/assets/treemap-WGGIJYW6-Cg7tyfH8.js +1 -0
- ksadk/studio/static/assets/vennDiagram-4TSXK5OY-7HbApbrv.js +34 -0
- ksadk/studio/static/assets/wardley-WFR3VGLG-C6N1rULY.js +1 -0
- ksadk/studio/static/assets/{wardleyDiagram-VM6X3IG4-Ba1AOWoe.js → wardleyDiagram-VM6X3IG4-CMJiaedy.js} +1 -1
- ksadk/studio/static/assets/{xychartDiagram-S5SC5T6Z-Cr5pt5Y-.js → xychartDiagram-S5SC5T6Z-BdgtMvW2.js} +6 -6
- ksadk/studio/static/index.html +8 -2
- ksadk/studio/teams_catalog.py +133 -0
- ksadk/studio/teams_installation.py +214 -0
- ksadk/studio/teams_node.py +545 -0
- ksadk/studio/teams_node_runner.py +69 -0
- ksadk/studio/teams_remote.py +274 -0
- ksadk/studio/templates.py +40 -19
- ksadk/studio/validator.py +13 -0
- ksadk/studio/workspace.py +19 -4
- ksadk/studio/workspace_plugins.py +136 -0
- ksadk/studio/workspace_registry.py +286 -0
- ksadk/toolsets/__init__.py +11 -0
- ksadk/toolsets/skills.py +446 -378
- ksadk/toolsets/workspace.py +3 -3
- ksadk/toolsets/workspace_identity.py +15 -0
- ksadk/version.py +1 -1
- ksadk_runtime_common/memory_backend/providers/lancedb.py +56 -2
- ksadk_runtime_common/schemas/memory_backend_manifest.schema.json +148 -148
- ksadk_runtime_common/workspace_files/router.py +26 -13
- ksadk/server/static/assets/MathMessageMarkdown-DbdW5A4_.js +0 -8
- ksadk/server/static/assets/architecture-7GRP2DOG-BW5UtSnx.js +0 -1
- ksadk/server/static/assets/channel-CF5Up3hQ.js +0 -1
- ksadk/server/static/assets/chunk-2Q5K7J3B-KkXX47WI.js +0 -1
- ksadk/server/static/assets/classDiagram-DTDB5LWJ-Cz81acRQ.js +0 -1
- ksadk/server/static/assets/classDiagram-v2-JRS7N3AN-Cz81acRQ.js +0 -1
- ksadk/server/static/assets/cynefin-OW5HDTMX-DVWs8a2t.js +0 -1
- ksadk/server/static/assets/dist-B2_CVgKv.js +0 -1
- ksadk/server/static/assets/eventmodeling-NTZA5JFV-CQqR2hg3.js +0 -1
- ksadk/server/static/assets/flowDiagram-A5DVABFB-DDRRbGPm.js +0 -1
- ksadk/server/static/assets/gitGraph-4MIJSDKK-fgWEf7UD.js +0 -1
- ksadk/server/static/assets/index-DcTML1Up.css +0 -2
- ksadk/server/static/assets/index-Dh2XHqPK.js +0 -244
- ksadk/server/static/assets/info-A6RAGUB7-BUecLTdt.js +0 -1
- ksadk/server/static/assets/packet-AYTQ26CC-BeW-btFv.js +0 -1
- ksadk/server/static/assets/pie-WAS4IAKB-X0xh4SaT.js +0 -1
- ksadk/server/static/assets/radar-RG4KPBEZ-DzRMSqjd.js +0 -1
- ksadk/server/static/assets/railroad-74A4TZTK-Cc44icX-.js +0 -1
- ksadk/server/static/assets/railroad-abnf-HS5TGJTU-D6S4BdV-.js +0 -1
- ksadk/server/static/assets/railroad-ebnf-LZEXJU2U-vD3aVE2o.js +0 -1
- ksadk/server/static/assets/railroad-peg-WCYAUIDC-CYbW_b4T.js +0 -1
- ksadk/server/static/assets/stateDiagram-v2-4QOOHH4V-BIcjKFhF.js +0 -1
- ksadk/server/static/assets/swimlanesDiagram-VK2B7HYN-tq3K3Ybl.js +0 -8
- ksadk/server/static/assets/treeView-Q6P3EWNA-DBXt3GdU.js +0 -1
- ksadk/server/static/assets/treemap-WGGIJYW6-DrCy4E_l.js +0 -1
- ksadk/server/static/assets/wardley-WFR3VGLG-CefhOliM.js +0 -1
- ksadk/studio/static/assets/CodeBlock-DCUUY0PL-BLjA7kbS.js +0 -41
- ksadk/studio/static/assets/MathMessageMarkdown-CBcDrAw--CUYIXwgI.js +0 -8
- ksadk/studio/static/assets/MermaidBlock-DBFTztfQ-BTYKWEbD.js +0 -44
- ksadk/studio/static/assets/PrismRenderer-wiXRHURw.js +0 -3
- ksadk/studio/static/assets/abnfDiagram-VCTEODGH-CLETGjKq.js +0 -1
- ksadk/studio/static/assets/architecture-7GRP2DOG-hXMiO_AU.js +0 -1
- ksadk/studio/static/assets/architectureDiagram-5GKGNRK7-B5EQysk6.js +0 -36
- ksadk/studio/static/assets/channel-BqO-gtEw.js +0 -1
- ksadk/studio/static/assets/chunk-75Z2AOVW-C8lLv_qc.js +0 -2
- ksadk/studio/static/assets/chunk-F27PBJKO-Cpw14SNG.js +0 -1
- ksadk/studio/static/assets/chunk-GVQU2GXP-DUdNBUCi.js +0 -1
- ksadk/studio/static/assets/chunk-L3NEJ4N5-Db8Ab22W.js +0 -1
- ksadk/studio/static/assets/chunk-POPQ4Y6H-DOpufJ3t.js +0 -1
- ksadk/studio/static/assets/chunk-PWAF6VOD-CfLb1gSc.js +0 -1
- ksadk/studio/static/assets/chunk-XXDRQBXY-7PcdR2B1.js +0 -1
- ksadk/studio/static/assets/classDiagram-ZZMXUADV-D_bW8JjA.js +0 -1
- ksadk/studio/static/assets/classDiagram-v2-VYDZK3BY-D_bW8JjA.js +0 -1
- ksadk/studio/static/assets/cose-bilkent-JH36ORCC-snL88wkX.js +0 -1
- ksadk/studio/static/assets/cynefin-OW5HDTMX-Bd1YhRo1.js +0 -1
- ksadk/studio/static/assets/cynefinDiagram-5FMLGOSQ-BBrIG_mI.js +0 -62
- ksadk/studio/static/assets/dagre-GXQ25YYZ-DtF1nGdY.js +0 -4
- ksadk/studio/static/assets/diagram-UQ7AKVKN-6mLKEo6L.js +0 -41
- ksadk/studio/static/assets/diagram-VSXAHHWV-CJBIaiZ2.js +0 -3
- ksadk/studio/static/assets/diagram-VX7I27RA-BohLEE1C.js +0 -24
- ksadk/studio/static/assets/diagram-Z3DM3KII-D8KIGonG.js +0 -24
- ksadk/studio/static/assets/ebnfDiagram-PWID7BFC-C99HU61t.js +0 -1
- ksadk/studio/static/assets/eventmodeling-NTZA5JFV-B1_5Ac8j.js +0 -1
- ksadk/studio/static/assets/flowDiagram-HODETNUW-DD5hmicn.js +0 -1
- ksadk/studio/static/assets/ganttDiagram-EL5Y4UJY-BPJrVLSG.js +0 -292
- ksadk/studio/static/assets/gitGraph-4MIJSDKK-Cy_ZQBGi.js +0 -1
- ksadk/studio/static/assets/gitGraphDiagram-WWUBYQGX-CZCUz4MT.js +0 -106
- ksadk/studio/static/assets/index-CeHL9ARV.css +0 -2
- ksadk/studio/static/assets/index-D9QEcVpL.js +0 -320
- ksadk/studio/static/assets/info-A6RAGUB7-DBzDQB_I.js +0 -1
- ksadk/studio/static/assets/infoDiagram-27XIBGKW-B-sq07Hi.js +0 -2
- ksadk/studio/static/assets/linear-BCxN9JLv.js +0 -1
- ksadk/studio/static/assets/mermaid-parser.core-BdCz8fkS.js +0 -7
- ksadk/studio/static/assets/packet-AYTQ26CC-gPln-_kG.js +0 -1
- ksadk/studio/static/assets/pegDiagram-XKGWAZYB-Dy3fB-gW.js +0 -1
- ksadk/studio/static/assets/pie-WAS4IAKB-qZdHMr7B.js +0 -1
- ksadk/studio/static/assets/radar-RG4KPBEZ-BZlnaea9.js +0 -1
- ksadk/studio/static/assets/railroad-74A4TZTK-Ce3__H9c.js +0 -1
- ksadk/studio/static/assets/railroad-abnf-HS5TGJTU-DqQn7EzD.js +0 -1
- ksadk/studio/static/assets/railroad-ebnf-LZEXJU2U-B55kCA8F.js +0 -1
- ksadk/studio/static/assets/railroad-peg-WCYAUIDC-DfQnvkHd.js +0 -1
- ksadk/studio/static/assets/railroadDiagram-O6MQD6OU-DnhMjZCk.js +0 -1
- ksadk/studio/static/assets/sankeyDiagram-P5KCCOFB-Bo-JTwt0.js +0 -40
- ksadk/studio/static/assets/src-SFn9St9H.js +0 -1
- ksadk/studio/static/assets/stateDiagram-D77RDMKH-DH774G6d.js +0 -1
- ksadk/studio/static/assets/stateDiagram-v2-MP3YSRHH-DZvVWPBo.js +0 -1
- ksadk/studio/static/assets/swimlanes-42K2YHIH-Bl13OvTX.js +0 -1
- ksadk/studio/static/assets/swimlanesDiagram-VR7AAH4N-BnFOTALJ.js +0 -8
- ksadk/studio/static/assets/treeView-Q6P3EWNA-D5Nn9Swz.js +0 -1
- ksadk/studio/static/assets/treemap-WGGIJYW6-CgHgnQhE.js +0 -1
- ksadk/studio/static/assets/vennDiagram-4TSXK5OY-B9QEXcJq.js +0 -34
- ksadk/studio/static/assets/wardley-WFR3VGLG-DXrK2RRY.js +0 -1
- {agentengine_sdk_python-0.8.4.dist-info → agentengine_sdk_python-0.8.5.dist-info}/WHEEL +0 -0
- {agentengine_sdk_python-0.8.4.dist-info → agentengine_sdk_python-0.8.5.dist-info}/entry_points.txt +0 -0
- {agentengine_sdk_python-0.8.4.dist-info → agentengine_sdk_python-0.8.5.dist-info}/licenses/LICENSE +0 -0
- {agentengine_sdk_python-0.8.4.dist-info → agentengine_sdk_python-0.8.5.dist-info}/top_level.txt +0 -0
- /ksadk/studio/static/assets/{MathMessageMarkdown-CBcDrAw--BEOyPC3w.css → MathMessageMarkdown-BesSeCYl-BEOyPC3w.css} +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""Read-only links to documents referenced by a run in its isolated tool workspace.
|
|
2
|
+
|
|
3
|
+
These are current workspace files, not immutable ArtifactStore versions. Never
|
|
4
|
+
resolve model-supplied absolute paths or traverse outside the owning agent root.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import os
|
|
10
|
+
import re
|
|
11
|
+
import stat
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from urllib.parse import quote
|
|
14
|
+
|
|
15
|
+
from ksadk.studio.errors import StudioError, not_found
|
|
16
|
+
|
|
17
|
+
MAX_DOCUMENT_BYTES = 2 * 1024 * 1024
|
|
18
|
+
_REFERENCE = re.compile(r"(?<![\w/])([\w\u4e00-\u9fff][\w\u4e00-\u9fff .()/\-]*\.md)\b", re.I)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _run_studio(studio, run_id: str):
|
|
22
|
+
"""Pin document reads to the run owner, not the currently selected workspace."""
|
|
23
|
+
resolve = getattr(studio, "runtime_for_run", None)
|
|
24
|
+
if callable(resolve):
|
|
25
|
+
owner = resolve(run_id)
|
|
26
|
+
if owner is None:
|
|
27
|
+
raise not_found("run", run_id)
|
|
28
|
+
return owner
|
|
29
|
+
return studio
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def document_root(studio, run) -> Path:
|
|
33
|
+
"""Harness 内置文件工具在 Studio 工作区下的受控落盘根。
|
|
34
|
+
|
|
35
|
+
``assemble_python_tools`` 会将 builtin workspace 能力限定在
|
|
36
|
+
``.harness-tools/workspace``;文档链接必须与真实写入根一致,
|
|
37
|
+
不能扫描整个代码库来猜测文件。
|
|
38
|
+
"""
|
|
39
|
+
studio = _run_studio(studio, run.id)
|
|
40
|
+
return studio.workspace.root / ".harness-tools" / "workspace"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def referenced_documents(studio, run) -> list[dict]:
|
|
44
|
+
if run.runtime_type != "harness":
|
|
45
|
+
return []
|
|
46
|
+
root = document_root(studio, run)
|
|
47
|
+
if root.resolve() != root:
|
|
48
|
+
return []
|
|
49
|
+
# Prefer quoted Markdown/code references; unquoted filenames are supported
|
|
50
|
+
# too. Existence is verified before advertising a link.
|
|
51
|
+
candidates = re.findall(r"`([^`\n]+\.md)`", run.output, re.I)
|
|
52
|
+
candidates += _REFERENCE.findall(run.output)
|
|
53
|
+
result = []
|
|
54
|
+
seen = set()
|
|
55
|
+
for name in candidates:
|
|
56
|
+
name = name.strip()
|
|
57
|
+
if name in seen or "\\" in name:
|
|
58
|
+
continue
|
|
59
|
+
relative = Path(name)
|
|
60
|
+
if relative.is_absolute() or any(part in {"..", "."} for part in relative.parts):
|
|
61
|
+
continue
|
|
62
|
+
path = root / relative
|
|
63
|
+
# Reject symlinks even when they point back into this workspace.
|
|
64
|
+
if any(
|
|
65
|
+
(root / Path(*relative.parts[:i])).is_symlink()
|
|
66
|
+
for i in range(1, len(relative.parts) + 1)
|
|
67
|
+
):
|
|
68
|
+
continue
|
|
69
|
+
if not path.resolve().is_relative_to(root.resolve()) or not path.is_file():
|
|
70
|
+
continue
|
|
71
|
+
if path.stat().st_size > MAX_DOCUMENT_BYTES:
|
|
72
|
+
continue
|
|
73
|
+
seen.add(name)
|
|
74
|
+
result.append(
|
|
75
|
+
{
|
|
76
|
+
"path": name,
|
|
77
|
+
"name": relative.name,
|
|
78
|
+
"href": (
|
|
79
|
+
f"/api/v1/runs/{quote(run.id, safe='')}/documents/content"
|
|
80
|
+
f"?path={quote(name, safe='')}"
|
|
81
|
+
),
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
return result
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def read_document(studio, run_id: str, name: str) -> tuple[Path, str]:
|
|
88
|
+
studio = _run_studio(studio, run_id)
|
|
89
|
+
run = studio.event_store.get(run_id)
|
|
90
|
+
if not any(item["path"] == name for item in referenced_documents(studio, run)):
|
|
91
|
+
raise not_found("document", name)
|
|
92
|
+
path = document_root(studio, run) / name
|
|
93
|
+
# Open every component relative to a held directory fd. A concurrently
|
|
94
|
+
# changed symlink must not turn a document request into an arbitrary read.
|
|
95
|
+
descriptors = []
|
|
96
|
+
try:
|
|
97
|
+
current = os.open(studio.workspace.root, os.O_RDONLY | os.O_DIRECTORY)
|
|
98
|
+
descriptors.append(current)
|
|
99
|
+
parts = path.relative_to(studio.workspace.root).parts
|
|
100
|
+
for part in parts[:-1]:
|
|
101
|
+
current = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=current)
|
|
102
|
+
descriptors.append(current)
|
|
103
|
+
file_fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=current)
|
|
104
|
+
with os.fdopen(file_fd, "rb") as stream:
|
|
105
|
+
if not stat.S_ISREG(os.fstat(stream.fileno()).st_mode):
|
|
106
|
+
raise not_found("document", name)
|
|
107
|
+
content = stream.read(MAX_DOCUMENT_BYTES + 1)
|
|
108
|
+
if len(content) > MAX_DOCUMENT_BYTES:
|
|
109
|
+
raise StudioError("DOCUMENT_TOO_LARGE", "文档超过预览上限", status_code=413)
|
|
110
|
+
return path, content.decode("utf-8")
|
|
111
|
+
except (OSError, UnicodeError) as error:
|
|
112
|
+
raise not_found("document", name) from error
|
|
113
|
+
finally:
|
|
114
|
+
for descriptor in reversed(descriptors):
|
|
115
|
+
os.close(descriptor)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def link_run_documents(studio, run, text: str) -> str:
|
|
119
|
+
for item in referenced_documents(studio, run):
|
|
120
|
+
label = item["name"].replace("[", "\\[").replace("]", "\\]")
|
|
121
|
+
link = f"[{label}]({item['href']})"
|
|
122
|
+
quoted = f"`{item['path']}`"
|
|
123
|
+
if quoted in text:
|
|
124
|
+
text = text.replace(quoted, link)
|
|
125
|
+
elif item["href"] not in text:
|
|
126
|
+
text += f"\n\n打开文档:{link}"
|
|
127
|
+
return text
|
ksadk/studio/run_service.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import asyncio
|
|
6
|
+
import copy
|
|
6
7
|
import hashlib
|
|
7
8
|
import json
|
|
8
9
|
import logging
|
|
@@ -68,6 +69,7 @@ from ksadk.sessions.local_service import LocalSessionService
|
|
|
68
69
|
from ksadk.studio.contracts import RunEvent, RunRecord, RunStatus, Usage
|
|
69
70
|
from ksadk.studio.errors import StudioError
|
|
70
71
|
from ksadk.studio.event_store import RunEventStore
|
|
72
|
+
from ksadk.studio.run_activity import project_run_activities
|
|
71
73
|
from ksadk.studio.workspace import Workspace
|
|
72
74
|
|
|
73
75
|
_CANCEL_TIMEOUT_SECONDS = 2.0
|
|
@@ -90,6 +92,129 @@ class StudioRunSpec:
|
|
|
90
92
|
plugin_bundle_root: Path | None = None
|
|
91
93
|
|
|
92
94
|
|
|
95
|
+
class _ProjectedRunEventWriter:
|
|
96
|
+
"""Batch high-frequency text deltas before rewriting a Run JSON file.
|
|
97
|
+
|
|
98
|
+
Canonical RuntimeEvents are already durable in the session store. The
|
|
99
|
+
RunEvent JSON is a presentation projection, so writing and retaining one
|
|
100
|
+
copy of the full projection envelope per token is unnecessary and becomes
|
|
101
|
+
quadratic as the response grows. A short batching window keeps live chat
|
|
102
|
+
responsive and coalesces adjacent chunks for the same projected item.
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
_STREAM_TYPES = frozenset({"message.delta", "thinking.delta"})
|
|
106
|
+
|
|
107
|
+
def __init__(
|
|
108
|
+
self,
|
|
109
|
+
event_store: RunEventStore,
|
|
110
|
+
run_id: str,
|
|
111
|
+
on_event: Callable[[RunEvent], None] | None,
|
|
112
|
+
*,
|
|
113
|
+
flush_interval: float = 0.5,
|
|
114
|
+
) -> None:
|
|
115
|
+
self._event_store = event_store
|
|
116
|
+
self._run_id = run_id
|
|
117
|
+
self._on_event = on_event
|
|
118
|
+
self._flush_interval = flush_interval
|
|
119
|
+
self._pending: list[tuple[str, dict[str, Any]]] = []
|
|
120
|
+
# Publish the first chunk immediately so the UI can enter streaming
|
|
121
|
+
# state without waiting for the batching window. Subsequent chunks are
|
|
122
|
+
# coalesced into short durable writes.
|
|
123
|
+
self._last_flush = 0.0
|
|
124
|
+
self._flush_handle: asyncio.TimerHandle | None = None
|
|
125
|
+
|
|
126
|
+
def append(self, event_type: str, data: dict[str, Any]) -> RunEvent | None:
|
|
127
|
+
if event_type in self._STREAM_TYPES:
|
|
128
|
+
self._pending.append((event_type, data))
|
|
129
|
+
elapsed = time.monotonic() - self._last_flush
|
|
130
|
+
if elapsed < self._flush_interval:
|
|
131
|
+
if self._flush_handle is None:
|
|
132
|
+
self._flush_handle = asyncio.get_running_loop().call_later(
|
|
133
|
+
self._flush_interval - elapsed, self.flush
|
|
134
|
+
)
|
|
135
|
+
return None
|
|
136
|
+
return self.flush()[-1]
|
|
137
|
+
self.flush()
|
|
138
|
+
stored = self._event_store.append(self._run_id, event_type, data)
|
|
139
|
+
self._notify((stored,))
|
|
140
|
+
return stored
|
|
141
|
+
|
|
142
|
+
def flush(self) -> list[RunEvent]:
|
|
143
|
+
if self._flush_handle is not None:
|
|
144
|
+
self._flush_handle.cancel()
|
|
145
|
+
self._flush_handle = None
|
|
146
|
+
if not self._pending:
|
|
147
|
+
return []
|
|
148
|
+
pending, self._pending = self._pending, []
|
|
149
|
+
stored = self._event_store.append_many(
|
|
150
|
+
self._run_id,
|
|
151
|
+
self._coalesce_stream_entries(pending),
|
|
152
|
+
)
|
|
153
|
+
self._last_flush = time.monotonic()
|
|
154
|
+
self._notify(stored)
|
|
155
|
+
return stored
|
|
156
|
+
|
|
157
|
+
@staticmethod
|
|
158
|
+
def _coalesce_stream_entries(
|
|
159
|
+
entries: list[tuple[str, dict[str, Any]]],
|
|
160
|
+
) -> list[tuple[str, dict[str, Any]]]:
|
|
161
|
+
"""Collapse adjacent chunks without changing the rendered transcript."""
|
|
162
|
+
|
|
163
|
+
coalesced: list[tuple[str, dict[str, Any]]] = []
|
|
164
|
+
for event_type, data in entries:
|
|
165
|
+
if not coalesced:
|
|
166
|
+
coalesced.append((event_type, copy.deepcopy(data)))
|
|
167
|
+
continue
|
|
168
|
+
previous_type, previous = coalesced[-1]
|
|
169
|
+
if not _same_projected_stream(previous_type, previous, event_type, data):
|
|
170
|
+
coalesced.append((event_type, copy.deepcopy(data)))
|
|
171
|
+
continue
|
|
172
|
+
|
|
173
|
+
operation = str(data.get("operation") or "append")
|
|
174
|
+
if operation == "append":
|
|
175
|
+
merged_text = str(previous.get("text") or "") + str(data.get("text") or "")
|
|
176
|
+
merged = copy.deepcopy(data)
|
|
177
|
+
_set_projected_stream_text(merged, merged_text)
|
|
178
|
+
coalesced[-1] = (event_type, merged)
|
|
179
|
+
else:
|
|
180
|
+
coalesced[-1] = (event_type, copy.deepcopy(data))
|
|
181
|
+
return coalesced
|
|
182
|
+
|
|
183
|
+
def _notify(self, events: tuple[RunEvent, ...] | list[RunEvent]) -> None:
|
|
184
|
+
if self._on_event is None:
|
|
185
|
+
return
|
|
186
|
+
for event in events:
|
|
187
|
+
self._on_event(event)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def _same_projected_stream(
|
|
191
|
+
previous_type: str,
|
|
192
|
+
previous: dict[str, Any],
|
|
193
|
+
event_type: str,
|
|
194
|
+
data: dict[str, Any],
|
|
195
|
+
) -> bool:
|
|
196
|
+
return (
|
|
197
|
+
previous_type == event_type
|
|
198
|
+
and previous.get("itemId") == data.get("itemId")
|
|
199
|
+
and previous.get("partId") == data.get("partId")
|
|
200
|
+
and previous.get("operation") == data.get("operation")
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def _set_projected_stream_text(data: dict[str, Any], text: str) -> None:
|
|
205
|
+
data["text"] = text
|
|
206
|
+
conversation_item = data.get("conversationItem")
|
|
207
|
+
if isinstance(conversation_item, dict):
|
|
208
|
+
payload = conversation_item.get("payload")
|
|
209
|
+
if isinstance(payload, dict):
|
|
210
|
+
payload["text"] = text
|
|
211
|
+
runtime_event = data.get("runtimeEvent")
|
|
212
|
+
if isinstance(runtime_event, dict):
|
|
213
|
+
update = runtime_event.get("update")
|
|
214
|
+
if isinstance(update, dict):
|
|
215
|
+
update["text"] = text
|
|
216
|
+
|
|
217
|
+
|
|
93
218
|
class StudioRunService:
|
|
94
219
|
"""Persist Studio state without selecting or wrapping a RuntimeAdapter."""
|
|
95
220
|
|
|
@@ -125,18 +250,63 @@ class StudioRunService:
|
|
|
125
250
|
# every decision for that run, not only identical interaction ids, so
|
|
126
251
|
# two concurrently visible cards cannot overwrite each other's receipt.
|
|
127
252
|
self._interaction_locks: dict[str, asyncio.Lock] = {}
|
|
253
|
+
self._recovery_tasks: set[asyncio.Task] = set()
|
|
254
|
+
self._detaching_recoveries = False
|
|
255
|
+
|
|
256
|
+
def has_active_runs(self) -> bool:
|
|
257
|
+
return bool(self._active_sessions or self._active_handles)
|
|
258
|
+
|
|
259
|
+
def is_run_executing(self, run_id: str) -> bool:
|
|
260
|
+
"""该 run 是否仍在本进程内实际执行(内存态判定)。
|
|
261
|
+
|
|
262
|
+
磁盘 record 停在 RUNNING 的 run 若不在这里,说明是进程崩溃/重启
|
|
263
|
+
遗留的僵尸状态,允许删除会话时将其收尾为 canceled。
|
|
264
|
+
"""
|
|
265
|
+
return run_id in self._active_handles or run_id in self._active_sessions
|
|
266
|
+
|
|
267
|
+
async def reap_stale_running_run(self, run_id: str) -> bool:
|
|
268
|
+
"""把不在执行的僵尸 RUNNING run 收尾为 canceled(幂等)。"""
|
|
269
|
+
from ksadk.events.canonical import RunCanceled
|
|
270
|
+
|
|
271
|
+
record = self.event_store.get(run_id)
|
|
272
|
+
if record.status != RunStatus.RUNNING or self.is_run_executing(run_id):
|
|
273
|
+
return False
|
|
274
|
+
record.status = RunStatus.CANCELLED
|
|
275
|
+
record.error = {"code": "RUN_CANCELLED", "message": "会话删除时回收未完成的运行"}
|
|
276
|
+
record.completed_at = datetime.now(timezone.utc)
|
|
277
|
+
self.event_store.save(record)
|
|
278
|
+
await self.runtime_events.append_one(
|
|
279
|
+
record.session_id,
|
|
280
|
+
RunCanceled(
|
|
281
|
+
schema_version=2,
|
|
282
|
+
event_id=f"evt_reap_{uuid4().hex}",
|
|
283
|
+
seq=len(self.event_store.events(run_id)) + 1,
|
|
284
|
+
timestamp=time.time(),
|
|
285
|
+
run_id=run_id,
|
|
286
|
+
scope_id=run_id,
|
|
287
|
+
source=SourceRef(framework="ksadk", metadata={"reason": "session_deleted"}),
|
|
288
|
+
status="canceled",
|
|
289
|
+
reason="session deleted",
|
|
290
|
+
),
|
|
291
|
+
)
|
|
292
|
+
return True
|
|
128
293
|
|
|
129
|
-
async def recover_interrupted(self) -> None:
|
|
294
|
+
async def recover_interrupted(self, resolve_spec=None) -> None:
|
|
130
295
|
"""Settle local runs left active across a Studio restart.
|
|
131
296
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
297
|
+
Reattach approval-paused providers only when their pinned Build and
|
|
298
|
+
durable-restore capability can be verified. Other in-process runs are
|
|
299
|
+
explicitly interrupted; active execution takeover remains Kernel-owned.
|
|
135
300
|
"""
|
|
136
301
|
active = {RunStatus.RUNNING, RunStatus.WAITING_INPUT}
|
|
137
302
|
for record in self.event_store.list_runs():
|
|
138
303
|
if record.status not in active:
|
|
139
304
|
continue
|
|
305
|
+
if record.status == RunStatus.WAITING_INPUT and resolve_spec is not None:
|
|
306
|
+
from ksadk.studio.provider_recovery import restore_waiting_provider_run
|
|
307
|
+
|
|
308
|
+
if await restore_waiting_provider_run(self, record, resolve_spec):
|
|
309
|
+
continue
|
|
140
310
|
record.status = RunStatus.INTERRUPTED
|
|
141
311
|
record.completed_at = datetime.now(timezone.utc)
|
|
142
312
|
record.error = {
|
|
@@ -270,12 +440,28 @@ class StudioRunService:
|
|
|
270
440
|
on_event=on_event,
|
|
271
441
|
)
|
|
272
442
|
|
|
443
|
+
return await self._execute_runtime_record(
|
|
444
|
+
spec, user_input, record=record, runtime_input=runtime_input,
|
|
445
|
+
on_event=on_event, prepared_turn=prepared_turn,
|
|
446
|
+
provider_runtime_adapter=provider_runtime_adapter,
|
|
447
|
+
)
|
|
448
|
+
|
|
449
|
+
async def _execute_runtime_record(
|
|
450
|
+
self, spec, user_input, *, record, runtime_input=None, on_event=None,
|
|
451
|
+
prepared_turn=None, provider_runtime_adapter=False, restored_handle=None,
|
|
452
|
+
) -> RunRecord:
|
|
453
|
+
run_id, session = record.id, record.session_id
|
|
454
|
+
runtime_type = record.runtime_type
|
|
273
455
|
started = time.monotonic()
|
|
274
|
-
|
|
275
|
-
|
|
456
|
+
if restored_handle is None:
|
|
457
|
+
record.status = RunStatus.RUNNING
|
|
458
|
+
record.started_at = datetime.now(timezone.utc)
|
|
276
459
|
self.event_store.save(record)
|
|
460
|
+
projected_writer = _ProjectedRunEventWriter(self.event_store, run_id, on_event)
|
|
277
461
|
|
|
278
|
-
async def persist(runtime_event: RuntimeEvent) -> RunEvent:
|
|
462
|
+
async def persist(runtime_event: RuntimeEvent) -> RunEvent | None:
|
|
463
|
+
if _is_private_harness_delta(runtime_event):
|
|
464
|
+
return None
|
|
279
465
|
persisted = await self.runtime_events.append_one(record.session_id, runtime_event)
|
|
280
466
|
event_type, data = project_runtime_event(
|
|
281
467
|
persisted,
|
|
@@ -289,10 +475,7 @@ class StudioRunService:
|
|
|
289
475
|
item_payload = conversation_item.get("payload")
|
|
290
476
|
if isinstance(item_payload, dict):
|
|
291
477
|
item_payload["revision"] = 1
|
|
292
|
-
|
|
293
|
-
if on_event is not None:
|
|
294
|
-
on_event(stored)
|
|
295
|
-
return stored
|
|
478
|
+
return projected_writer.append(event_type, data)
|
|
296
479
|
|
|
297
480
|
handle = None
|
|
298
481
|
completed_text_by_item: dict[tuple[str, str], str] = {}
|
|
@@ -349,7 +532,7 @@ class StudioRunService:
|
|
|
349
532
|
)
|
|
350
533
|
adapter = self.plugin_runtime.kernel_adapter_provider(spec)()
|
|
351
534
|
preparation = RuntimeStartPreparation(context=spec.launch_context, adapter=adapter)
|
|
352
|
-
handle = await self.executor.start(
|
|
535
|
+
handle = restored_handle or await self.executor.start(
|
|
353
536
|
spec.launch_context, request, preparation=preparation,
|
|
354
537
|
)
|
|
355
538
|
record.runtime_handle = handle.model_dump(mode="json")
|
|
@@ -357,7 +540,10 @@ class StudioRunService:
|
|
|
357
540
|
self._active_handles[run_id] = handle
|
|
358
541
|
while True:
|
|
359
542
|
terminal_seen = False
|
|
360
|
-
should_resume =
|
|
543
|
+
should_resume = restored_handle is not None
|
|
544
|
+
if restored_handle is not None:
|
|
545
|
+
self._waiting_modes[run_id] = "resume"
|
|
546
|
+
restored_handle = None
|
|
361
547
|
async for event in self.executor.stream(handle):
|
|
362
548
|
if (
|
|
363
549
|
isinstance(event, RunInterrupted)
|
|
@@ -524,6 +710,8 @@ class StudioRunService:
|
|
|
524
710
|
fallback_parts = [part for part in streamed_text_by_item.values() if part]
|
|
525
711
|
record.output = "\n\n".join(completed_parts or fallback_parts)
|
|
526
712
|
except asyncio.CancelledError:
|
|
713
|
+
if self._detaching_recoveries and record.status == RunStatus.WAITING_INPUT:
|
|
714
|
+
raise
|
|
527
715
|
cancel_result = "task_cancelled"
|
|
528
716
|
if handle is not None and self.executor.is_attached(handle):
|
|
529
717
|
try:
|
|
@@ -577,6 +765,7 @@ class StudioRunService:
|
|
|
577
765
|
)
|
|
578
766
|
await persist(failure)
|
|
579
767
|
finally:
|
|
768
|
+
projected_writer.flush()
|
|
580
769
|
if handle is not None and self.executor.is_attached(handle):
|
|
581
770
|
try:
|
|
582
771
|
await asyncio.shield(self.executor.close(handle))
|
|
@@ -589,8 +778,12 @@ class StudioRunService:
|
|
|
589
778
|
self._control_queues.pop(run_id, None)
|
|
590
779
|
self._waiting_modes.pop(run_id, None)
|
|
591
780
|
self._submitted_interactions.pop(run_id, None)
|
|
592
|
-
|
|
593
|
-
|
|
781
|
+
preserve_waiting = (
|
|
782
|
+
self._detaching_recoveries and record.status == RunStatus.WAITING_INPUT
|
|
783
|
+
)
|
|
784
|
+
if not preserve_waiting:
|
|
785
|
+
record.completed_at = datetime.now(timezone.utc)
|
|
786
|
+
self._expire_unresolved_interactions(record, on_event=on_event)
|
|
594
787
|
if runtime_duration_ms is not None:
|
|
595
788
|
record.duration_ms = runtime_duration_ms
|
|
596
789
|
record.duration_source = "runtime"
|
|
@@ -802,18 +995,61 @@ class StudioRunService:
|
|
|
802
995
|
"activationKey": record.session_id,
|
|
803
996
|
}
|
|
804
997
|
self.event_store.save(record)
|
|
998
|
+
projected_writer = _ProjectedRunEventWriter(self.event_store, record.id, on_event)
|
|
805
999
|
rows_before = await self.session_service.get_events(record.session_id)
|
|
806
1000
|
after_seq = max((int(row.seq_id or 0) for row in rows_before), default=0)
|
|
1001
|
+
published_seq = after_seq
|
|
807
1002
|
|
|
808
1003
|
async def publish(events: list[RuntimeEvent]) -> None:
|
|
1004
|
+
nonlocal published_seq
|
|
809
1005
|
for runtime_event in events:
|
|
1006
|
+
# Harness keeps token-level child output in the canonical
|
|
1007
|
+
# session trace for diagnostics. It is deliberately not part
|
|
1008
|
+
# of Studio's public run timeline: the activity projection
|
|
1009
|
+
# never consumes these private deltas, and persisting each one
|
|
1010
|
+
# rewrites the growing run JSON file. Long-running delegated
|
|
1011
|
+
# research can otherwise turn a few useful activity rows into
|
|
1012
|
+
# thousands of O(n²) file writes and make the page appear
|
|
1013
|
+
# frozen. Advance the cursor so final catch-up will not replay
|
|
1014
|
+
# an omitted delta.
|
|
1015
|
+
if _is_private_harness_delta(runtime_event):
|
|
1016
|
+
published_seq = max(published_seq, int(runtime_event.seq or 0))
|
|
1017
|
+
continue
|
|
810
1018
|
event_type, data = project_runtime_event(
|
|
811
1019
|
runtime_event,
|
|
812
1020
|
session_id=record.session_id,
|
|
813
1021
|
)
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
1022
|
+
projected_writer.append(event_type, data)
|
|
1023
|
+
published_seq = max(published_seq, int(runtime_event.seq or 0))
|
|
1024
|
+
|
|
1025
|
+
async def tail_live_events() -> None:
|
|
1026
|
+
# Kernel worker 会把 harness 的增量事实(TEXT_DELTA/ItemUpdated 等)
|
|
1027
|
+
# 在执行期间逐条写入 canonical session store;这里实时转发给 SSE
|
|
1028
|
+
# 订阅端,避免整轮结束后一次性爆发。终态事件会自然结束订阅。
|
|
1029
|
+
async for event in self.runtime_events.subscribe_run(
|
|
1030
|
+
record.session_id,
|
|
1031
|
+
record.id,
|
|
1032
|
+
after_seq=published_seq,
|
|
1033
|
+
poll_interval=0.1,
|
|
1034
|
+
timeout=600,
|
|
1035
|
+
):
|
|
1036
|
+
try:
|
|
1037
|
+
await publish([event])
|
|
1038
|
+
except asyncio.CancelledError:
|
|
1039
|
+
raise
|
|
1040
|
+
except Exception:
|
|
1041
|
+
logger.exception(
|
|
1042
|
+
"failed to publish live plugin event for run %s", record.id
|
|
1043
|
+
)
|
|
1044
|
+
|
|
1045
|
+
tail_task: asyncio.Task[None] | None = None
|
|
1046
|
+
|
|
1047
|
+
async def stop_tail() -> None:
|
|
1048
|
+
nonlocal tail_task
|
|
1049
|
+
if tail_task is not None:
|
|
1050
|
+
tail_task.cancel()
|
|
1051
|
+
await asyncio.gather(tail_task, return_exceptions=True)
|
|
1052
|
+
tail_task = None
|
|
817
1053
|
|
|
818
1054
|
try:
|
|
819
1055
|
if self.plugin_runtime is None:
|
|
@@ -832,18 +1068,22 @@ class StudioRunService:
|
|
|
832
1068
|
}.items()
|
|
833
1069
|
if value not in {None, ""}
|
|
834
1070
|
}
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
1071
|
+
tail_task = asyncio.create_task(tail_live_events())
|
|
1072
|
+
try:
|
|
1073
|
+
result = await self.plugin_runtime.execute(
|
|
1074
|
+
spec,
|
|
1075
|
+
{
|
|
1076
|
+
"user_id": "local-user",
|
|
1077
|
+
"session_id": record.session_id,
|
|
1078
|
+
"invocation_id": record.id,
|
|
1079
|
+
"messages": [{"role": "user", "content": user_input}],
|
|
1080
|
+
"model": spec.model,
|
|
1081
|
+
"request_metadata": request_metadata,
|
|
1082
|
+
},
|
|
1083
|
+
session_id=record.session_id,
|
|
1084
|
+
)
|
|
1085
|
+
finally:
|
|
1086
|
+
await stop_tail()
|
|
847
1087
|
if result.session_id != record.session_id:
|
|
848
1088
|
raise StudioError(
|
|
849
1089
|
"PLUGIN_SESSION_MISMATCH",
|
|
@@ -856,7 +1096,7 @@ class StudioRunService:
|
|
|
856
1096
|
)
|
|
857
1097
|
canonical = await self._plugin_events_after(
|
|
858
1098
|
record.session_id,
|
|
859
|
-
after_seq=
|
|
1099
|
+
after_seq=published_seq,
|
|
860
1100
|
run_id=record.id,
|
|
861
1101
|
)
|
|
862
1102
|
if not canonical:
|
|
@@ -870,6 +1110,7 @@ class StudioRunService:
|
|
|
870
1110
|
record.status = RunStatus.COMPLETED
|
|
871
1111
|
_apply_plugin_usage(record, result.usage)
|
|
872
1112
|
except asyncio.CancelledError:
|
|
1113
|
+
await stop_tail()
|
|
873
1114
|
record.status = RunStatus.CANCELLED
|
|
874
1115
|
record.error = {"code": "RUN_CANCELLED", "message": "运行已取消"}
|
|
875
1116
|
cancelled = await self.runtime_events.append_one(
|
|
@@ -883,12 +1124,13 @@ class StudioRunService:
|
|
|
883
1124
|
await publish([cancelled])
|
|
884
1125
|
raise
|
|
885
1126
|
except Exception as exc: # noqa: BLE001 - plugin boundary is typed below
|
|
1127
|
+
await stop_tail()
|
|
886
1128
|
record.status = RunStatus.FAILED
|
|
887
1129
|
code = str(getattr(exc, "code", "PLUGIN_RUNTIME_FAILED"))
|
|
888
1130
|
record.error = {"code": code, "message": str(exc)}
|
|
889
1131
|
canonical = await self._plugin_events_after(
|
|
890
1132
|
record.session_id,
|
|
891
|
-
after_seq=
|
|
1133
|
+
after_seq=published_seq,
|
|
892
1134
|
run_id=record.id,
|
|
893
1135
|
)
|
|
894
1136
|
if canonical:
|
|
@@ -909,6 +1151,7 @@ class StudioRunService:
|
|
|
909
1151
|
)
|
|
910
1152
|
await publish([failed])
|
|
911
1153
|
finally:
|
|
1154
|
+
projected_writer.flush()
|
|
912
1155
|
record.completed_at = datetime.now(timezone.utc)
|
|
913
1156
|
record.duration_ms = int((time.monotonic() - started) * 1000)
|
|
914
1157
|
record.duration_source = "studio"
|
|
@@ -1684,7 +1927,41 @@ class StudioRunService:
|
|
|
1684
1927
|
if previous.agent_id != agent_id or previous.status != RunStatus.COMPLETED:
|
|
1685
1928
|
continue
|
|
1686
1929
|
messages.append({"role": "user", "content": previous.input})
|
|
1687
|
-
|
|
1930
|
+
assistant_content = previous.output
|
|
1931
|
+
if previous.runtime_type == "harness":
|
|
1932
|
+
projection = project_run_activities(
|
|
1933
|
+
previous,
|
|
1934
|
+
self.event_store.events(previous.id),
|
|
1935
|
+
)
|
|
1936
|
+
children = [
|
|
1937
|
+
activity
|
|
1938
|
+
for activity in projection.get("activities", [])
|
|
1939
|
+
if activity.get("kind") == "subagent"
|
|
1940
|
+
][:8]
|
|
1941
|
+
if children:
|
|
1942
|
+
status_text = {
|
|
1943
|
+
"completed": "已完成",
|
|
1944
|
+
"failed": "失败",
|
|
1945
|
+
"cancelled": "已取消",
|
|
1946
|
+
"running": "仍在运行",
|
|
1947
|
+
"unknown": "状态未确认",
|
|
1948
|
+
}
|
|
1949
|
+
facts = ";".join(
|
|
1950
|
+
f"子智能体“{child.get('label') or '未命名'}”"
|
|
1951
|
+
f"{status_text.get(str(child.get('status')), '状态未确认')}"
|
|
1952
|
+
for child in children
|
|
1953
|
+
)
|
|
1954
|
+
# Lifecycle evidence belongs to the completed assistant turn.
|
|
1955
|
+
# A standalone system message inserted between historical turns
|
|
1956
|
+
# can outweigh the next user request on some providers and make
|
|
1957
|
+
# a new turn answer an old child result instead (conversation
|
|
1958
|
+
# "cross-talk"). Keep the evidence attached to the turn it
|
|
1959
|
+
# describes so the newest user message remains authoritative.
|
|
1960
|
+
assistant_content = (
|
|
1961
|
+
f"{assistant_content}\n\n"
|
|
1962
|
+
f"[Harness 执行记录] {facts}。"
|
|
1963
|
+
)
|
|
1964
|
+
messages.append({"role": "assistant", "content": assistant_content})
|
|
1688
1965
|
messages.append({"role": "user", "content": user_input})
|
|
1689
1966
|
return messages
|
|
1690
1967
|
|
|
@@ -1801,6 +2078,25 @@ def _apply_plugin_usage(record: RunRecord, usage: Mapping[str, Any]) -> None:
|
|
|
1801
2078
|
)
|
|
1802
2079
|
|
|
1803
2080
|
|
|
2081
|
+
def _is_private_harness_delta(event: RuntimeEvent) -> bool:
|
|
2082
|
+
"""Return whether *event* is an internal token delta, not a UI activity.
|
|
2083
|
+
|
|
2084
|
+
Managed Harness projects its rich event stream to canonical status items.
|
|
2085
|
+
``text.delta`` and ``reasoning.delta`` contain private token fragments,
|
|
2086
|
+
are intentionally ignored by ``run_activity``, and must not be copied into
|
|
2087
|
+
Studio's durable session or run stores. User-visible parent answer
|
|
2088
|
+
streaming uses canonical ``message`` items and therefore remains
|
|
2089
|
+
unaffected.
|
|
2090
|
+
"""
|
|
2091
|
+
|
|
2092
|
+
if not isinstance(event, ItemCompleted) or event.item_kind != "status":
|
|
2093
|
+
return False
|
|
2094
|
+
if event.source.framework != "ksadk":
|
|
2095
|
+
return False
|
|
2096
|
+
native_event_type = str(event.source.metadata.get("native_event_type") or "")
|
|
2097
|
+
return native_event_type in {"reasoning.delta", "text.delta"}
|
|
2098
|
+
|
|
2099
|
+
|
|
1804
2100
|
def project_runtime_event(
|
|
1805
2101
|
event: RuntimeEvent,
|
|
1806
2102
|
*,
|