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
ksadk/studio/api.py
CHANGED
|
@@ -4,18 +4,24 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import asyncio
|
|
6
6
|
import base64
|
|
7
|
+
import hashlib
|
|
7
8
|
import hmac
|
|
8
9
|
import json
|
|
10
|
+
import logging
|
|
9
11
|
import os
|
|
10
12
|
import secrets
|
|
13
|
+
import shutil
|
|
14
|
+
import subprocess
|
|
15
|
+
import sys
|
|
11
16
|
from collections.abc import AsyncIterator
|
|
12
17
|
from contextlib import asynccontextmanager
|
|
13
18
|
from pathlib import Path
|
|
14
19
|
from typing import Any, Literal
|
|
20
|
+
from urllib.parse import quote
|
|
15
21
|
|
|
16
22
|
from fastapi import FastAPI, File, Header, Query, Request, Response, UploadFile
|
|
17
23
|
from fastapi.exceptions import RequestValidationError
|
|
18
|
-
from fastapi.responses import FileResponse, JSONResponse, StreamingResponse
|
|
24
|
+
from fastapi.responses import FileResponse, JSONResponse, RedirectResponse, StreamingResponse
|
|
19
25
|
from fastapi.staticfiles import StaticFiles
|
|
20
26
|
from starlette.background import BackgroundTask
|
|
21
27
|
|
|
@@ -42,6 +48,7 @@ from ksadk.studio.api_contracts import (
|
|
|
42
48
|
CreateAgentRequest,
|
|
43
49
|
ImportRootRequest,
|
|
44
50
|
InteractionSubmitRequest,
|
|
51
|
+
LinkedDirectoryRequest,
|
|
45
52
|
ProjectInspectRequest,
|
|
46
53
|
PromptCompileRequest,
|
|
47
54
|
QuickAuthoringRequest,
|
|
@@ -79,6 +86,11 @@ from ksadk.studio.api_helpers import (
|
|
|
79
86
|
from ksadk.studio.api_memory_routes import register_memory_routes
|
|
80
87
|
from ksadk.studio.api_plugin_routes import register_plugin_routes
|
|
81
88
|
from ksadk.studio.api_resource_connections import register_resource_connection_routes
|
|
89
|
+
from ksadk.studio.channel_connections import (
|
|
90
|
+
CHANNEL_ACTIONS,
|
|
91
|
+
ChannelAgentConnectionInput,
|
|
92
|
+
ChannelConnectionSettings,
|
|
93
|
+
)
|
|
82
94
|
from ksadk.studio.cloud_shared_web import CloudSharedWebBridge, cloud_chat_target, is_cloud_agent_id
|
|
83
95
|
from ksadk.studio.codex_manifest import CodexAgentManifest
|
|
84
96
|
from ksadk.studio.contracts import (
|
|
@@ -90,8 +102,23 @@ from ksadk.studio.contracts import (
|
|
|
90
102
|
OperationStatus,
|
|
91
103
|
)
|
|
92
104
|
from ksadk.studio.errors import StudioError
|
|
105
|
+
from ksadk.studio.native_documents import (
|
|
106
|
+
NativeDocumentActionRequest,
|
|
107
|
+
document_metadata,
|
|
108
|
+
is_local_desktop_request,
|
|
109
|
+
perform_document_action,
|
|
110
|
+
)
|
|
111
|
+
from ksadk.studio.run_activity import register_activity_routes
|
|
112
|
+
from ksadk.studio.run_documents import read_document
|
|
93
113
|
from ksadk.studio.service import StudioService
|
|
94
114
|
from ksadk.studio.shared_web import StudioSharedWebBridge
|
|
115
|
+
from ksadk.studio.workspace_registry import (
|
|
116
|
+
LinkedDirectoryPolicy,
|
|
117
|
+
WorkspaceRegistry,
|
|
118
|
+
WorkspaceRuntimeManager,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
logger = logging.getLogger(__name__)
|
|
95
122
|
|
|
96
123
|
_WRITE_METHODS = {"POST", "PUT", "PATCH", "DELETE"}
|
|
97
124
|
_PUBLIC_API_PATHS = {
|
|
@@ -208,6 +235,21 @@ def _cloud_event_conversation_item(
|
|
|
208
235
|
return item.model_dump(by_alias=True, exclude_none=True, mode="json")
|
|
209
236
|
|
|
210
237
|
|
|
238
|
+
import re as _re
|
|
239
|
+
|
|
240
|
+
# 内容 hash 文件名(如 index-CQj_Jm9z.js)可安全 immutable 强缓存;
|
|
241
|
+
# index.html 与动态 HTML 仍需每次校验。
|
|
242
|
+
_HASHED_ASSET_RE = _re.compile(r"-[A-Za-z0-9_]{8,}\.(js|css|woff2?|ttf|png|svg|webp|mp4|wasm)$")
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def _cache_control_for(path: str, response: Any) -> str:
|
|
246
|
+
if path.startswith(("/api/", "/v1/")):
|
|
247
|
+
return "no-store"
|
|
248
|
+
if _HASHED_ASSET_RE.search(path) and 200 <= response.status_code < 300:
|
|
249
|
+
return "public, max-age=31536000, immutable"
|
|
250
|
+
return response.headers.get("Cache-Control", "no-cache")
|
|
251
|
+
|
|
252
|
+
|
|
211
253
|
def create_studio_app(
|
|
212
254
|
root: Path | str,
|
|
213
255
|
*,
|
|
@@ -216,21 +258,114 @@ def create_studio_app(
|
|
|
216
258
|
csrf_token: str | None = None,
|
|
217
259
|
security_enabled: bool = True,
|
|
218
260
|
) -> FastAPI:
|
|
219
|
-
|
|
261
|
+
initial_service = service or StudioService(root)
|
|
262
|
+
studio = WorkspaceRuntimeManager(
|
|
263
|
+
initial_service, lambda workspace_root: StudioService(workspace_root)
|
|
264
|
+
)
|
|
220
265
|
session_secret = session_token or secrets.token_urlsafe(32)
|
|
221
266
|
csrf_secret = csrf_token or secrets.token_urlsafe(24)
|
|
267
|
+
session_cookie_name = "agentkit_studio_session_" + hashlib.sha256(
|
|
268
|
+
session_secret.encode("utf-8")
|
|
269
|
+
).hexdigest()[:16]
|
|
270
|
+
legacy_session_cookie_name = "agentkit_studio_session"
|
|
222
271
|
|
|
223
272
|
@asynccontextmanager
|
|
224
273
|
async def lifespan(_app: FastAPI) -> AsyncIterator[None]:
|
|
274
|
+
lazy_desktop_start = os.environ.get("KSADK_STUDIO_LAZY_START") == "1"
|
|
275
|
+
warmups: set[asyncio.Task[None]] = set()
|
|
276
|
+
|
|
277
|
+
def schedule_runtime_warmup(runtime: StudioService) -> None:
|
|
278
|
+
async def warm_runtime() -> None:
|
|
279
|
+
try:
|
|
280
|
+
await runtime.start()
|
|
281
|
+
except Exception:
|
|
282
|
+
# Runtime warmup is best effort; core Studio remains usable
|
|
283
|
+
# while optional DSH capability discovery is unavailable.
|
|
284
|
+
return
|
|
285
|
+
# The Channel UI is a wheel-owned client bundle. Bootstrap it
|
|
286
|
+
# after the listener is available and through the same Profile
|
|
287
|
+
# maintenance fence used by other DSH mutations.
|
|
288
|
+
if (
|
|
289
|
+
os.environ.get("KSADK_STUDIO_CHANNEL_DEFAULT", "1")
|
|
290
|
+
.strip()
|
|
291
|
+
.lower()
|
|
292
|
+
not in {"0", "false", "no", "off"}
|
|
293
|
+
and not os.environ.get("KSADK_DSH_HOME", "").strip()
|
|
294
|
+
and not os.environ.get("KSADK_DSH_PROFILE", "").strip()
|
|
295
|
+
):
|
|
296
|
+
try:
|
|
297
|
+
from ksadk.plugins.dsh_channels import (
|
|
298
|
+
channel_default_bootstrap_needed,
|
|
299
|
+
configure_channel_profile,
|
|
300
|
+
)
|
|
301
|
+
from ksadk.studio.api_plugin_routes import _studio_dsh_options
|
|
302
|
+
|
|
303
|
+
home, profile, command, _ = _studio_dsh_options(runtime)
|
|
304
|
+
# 可选 bootstrap 必须先确认 DSH 命令真实可用:无工具链的
|
|
305
|
+
# 环境进入 Profile 维护栅栏后,恢复失败会按契约保持
|
|
306
|
+
# admission 关闭,导致整个会话面永久 503(回归过)。
|
|
307
|
+
if command and shutil.which(str(command[0])) is None:
|
|
308
|
+
logger.info(
|
|
309
|
+
"Channel 默认激活跳过:DSH 命令不可用 (%s)",
|
|
310
|
+
command[0],
|
|
311
|
+
)
|
|
312
|
+
elif profile == "web" and command and channel_default_bootstrap_needed(home):
|
|
313
|
+
async def configure_channel():
|
|
314
|
+
await asyncio.to_thread(
|
|
315
|
+
configure_channel_profile,
|
|
316
|
+
workspace=runtime.workspace.root,
|
|
317
|
+
dsh_home=home,
|
|
318
|
+
dsh_command=command,
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
await runtime.reconfigure_dsh_profile(configure_channel)
|
|
322
|
+
except Exception as error:
|
|
323
|
+
logger.info("Channel 默认激活未完成(可手动启用): %s", error)
|
|
324
|
+
|
|
325
|
+
if os.environ.get(
|
|
326
|
+
"KSADK_STUDIO_TEAMS_DEFAULT", "1"
|
|
327
|
+
).strip().lower() not in {"0", "false", "no", "off"}:
|
|
328
|
+
installation = getattr(runtime, "teams_installation", None)
|
|
329
|
+
if installation is not None and not installation.status().get("enabled"):
|
|
330
|
+
try:
|
|
331
|
+
await installation.enable()
|
|
332
|
+
except Exception as error:
|
|
333
|
+
# 默认启用是预期行为,但 DSH 工具链/权威不可用时必须静默
|
|
334
|
+
# 降级,核心 Studio 与其他插件不受影响;页面仍保留手动入口。
|
|
335
|
+
logger.info(
|
|
336
|
+
"Teams 默认激活未完成(可手动启用): %s", error
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
task = asyncio.create_task(warm_runtime())
|
|
340
|
+
warmups.add(task)
|
|
341
|
+
task.add_done_callback(warmups.discard)
|
|
342
|
+
|
|
225
343
|
try:
|
|
226
|
-
|
|
227
|
-
await studio.
|
|
344
|
+
app.state.runtime_warmups = schedule_runtime_warmup
|
|
345
|
+
await studio.start(wait_for_dsh=not lazy_desktop_start)
|
|
346
|
+
# Optional plugin activation must not hold the HTTP listener closed
|
|
347
|
+
# while DSH starts subprocesses or acquires an authority lease.
|
|
348
|
+
schedule_runtime_warmup(studio.active)
|
|
349
|
+
# Pre-resolve the entry redirect choice once off the request path;
|
|
350
|
+
# failures are swallowed and ``index()`` has its own bounded wait.
|
|
351
|
+
probe_warmup = getattr(
|
|
352
|
+
studio.active.dsh_capabilities, "schedule_plugin_probe_warmup", None
|
|
353
|
+
)
|
|
354
|
+
if callable(probe_warmup):
|
|
355
|
+
probe_warmup()
|
|
356
|
+
await studio.run_service.recover_interrupted(studio.resolve_run_spec)
|
|
228
357
|
await studio.scheduler.start_if_available()
|
|
229
358
|
yield
|
|
230
359
|
finally:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
360
|
+
app.state.runtime_warmups = None
|
|
361
|
+
for task in tuple(warmups):
|
|
362
|
+
task.cancel()
|
|
363
|
+
if warmups:
|
|
364
|
+
await asyncio.gather(*warmups, return_exceptions=True)
|
|
365
|
+
for runtime in studio.services():
|
|
366
|
+
await runtime.scheduler.stop()
|
|
367
|
+
await runtime.aclose()
|
|
368
|
+
runtime.credentials.clear_session()
|
|
234
369
|
|
|
235
370
|
app = FastAPI(
|
|
236
371
|
title="AgentKit Local Studio",
|
|
@@ -324,7 +459,8 @@ def create_studio_app(
|
|
|
324
459
|
|
|
325
460
|
static_root = Path(__file__).with_name("static")
|
|
326
461
|
shared_web = StudioSharedWebBridge(studio)
|
|
327
|
-
|
|
462
|
+
register_activity_routes(app, studio, resolve_run_id=shared_web.resolve_run_reference)
|
|
463
|
+
cloud_web = CloudSharedWebBridge(studio)
|
|
328
464
|
app.state.shared_web_bridge = shared_web
|
|
329
465
|
app.mount("/static", StaticFiles(directory=static_root), name="studio-static")
|
|
330
466
|
|
|
@@ -379,8 +515,10 @@ def create_studio_app(
|
|
|
379
515
|
or shared_web_api
|
|
380
516
|
or responses_api
|
|
381
517
|
):
|
|
382
|
-
supplied =
|
|
383
|
-
|
|
518
|
+
supplied = (
|
|
519
|
+
request.cookies.get(session_cookie_name)
|
|
520
|
+
or request.cookies.get(legacy_session_cookie_name)
|
|
521
|
+
or request.headers.get("X-AgentKit-Session")
|
|
384
522
|
)
|
|
385
523
|
if not supplied or not hmac.compare_digest(supplied, session_secret):
|
|
386
524
|
return _error_response(
|
|
@@ -391,7 +529,8 @@ def create_studio_app(
|
|
|
391
529
|
),
|
|
392
530
|
request,
|
|
393
531
|
)
|
|
394
|
-
|
|
532
|
+
channel_api = shared_web_api and request.url.path.rsplit("/", 1)[-1] in CHANNEL_ACTIONS
|
|
533
|
+
if (studio_api or responses_api or channel_api) and request.method in _WRITE_METHODS:
|
|
395
534
|
csrf = request.headers.get("X-CSRF-Token")
|
|
396
535
|
if not csrf or not hmac.compare_digest(csrf, csrf_secret):
|
|
397
536
|
return _error_response(
|
|
@@ -404,11 +543,7 @@ def create_studio_app(
|
|
|
404
543
|
)
|
|
405
544
|
response = await call_next(request)
|
|
406
545
|
response.headers["X-Request-Id"] = request.state.request_id
|
|
407
|
-
response.headers["Cache-Control"] = (
|
|
408
|
-
"no-store"
|
|
409
|
-
if request.url.path.startswith(("/api/", "/v1/"))
|
|
410
|
-
else response.headers.get("Cache-Control", "no-cache")
|
|
411
|
-
)
|
|
546
|
+
response.headers["Cache-Control"] = _cache_control_for(request.url.path, response)
|
|
412
547
|
response.headers["X-Content-Type-Options"] = "nosniff"
|
|
413
548
|
response.headers["X-Frame-Options"] = "DENY"
|
|
414
549
|
response.headers["Referrer-Policy"] = "no-referrer"
|
|
@@ -466,18 +601,23 @@ def create_studio_app(
|
|
|
466
601
|
)
|
|
467
602
|
|
|
468
603
|
@app.get("/")
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
# module again when a lazy chunk imports the unversioned URL.
|
|
476
|
-
response = Response(content=html, media_type="text/html")
|
|
477
|
-
response.headers["Cache-Control"] = "no-store"
|
|
604
|
+
@app.get("/studio-recovery/")
|
|
605
|
+
@app.get("/studio-shell/")
|
|
606
|
+
async def index(request: Request):
|
|
607
|
+
from ksadk.studio.entry import studio_entry_response
|
|
608
|
+
|
|
609
|
+
response = await studio_entry_response(studio, request, static_root)
|
|
478
610
|
if security_enabled:
|
|
479
611
|
response.set_cookie(
|
|
480
|
-
|
|
612
|
+
session_cookie_name,
|
|
613
|
+
session_secret,
|
|
614
|
+
httponly=True,
|
|
615
|
+
samesite="strict",
|
|
616
|
+
secure=False,
|
|
617
|
+
path="/",
|
|
618
|
+
)
|
|
619
|
+
response.set_cookie(
|
|
620
|
+
legacy_session_cookie_name,
|
|
481
621
|
session_secret,
|
|
482
622
|
httponly=True,
|
|
483
623
|
samesite="strict",
|
|
@@ -486,6 +626,42 @@ def create_studio_app(
|
|
|
486
626
|
)
|
|
487
627
|
return response
|
|
488
628
|
|
|
629
|
+
@app.get("/api/v1/plugin-ecosystems/dsh/recovery")
|
|
630
|
+
async def dsh_recovery_status():
|
|
631
|
+
# This endpoint must remain a read-only snapshot: no Core startup, Profile
|
|
632
|
+
# projection, credential resolution, or filesystem repair is attempted.
|
|
633
|
+
return studio.dsh_capabilities.startup_status
|
|
634
|
+
|
|
635
|
+
@app.get("/api/v1/plugins/workspace-contributions")
|
|
636
|
+
async def workspace_contributions():
|
|
637
|
+
"""Expose enabled UI contributions without booting the DSH Core."""
|
|
638
|
+
from ksadk.plugins.dsh_channels import channel_workspace_contributions
|
|
639
|
+
from ksadk.plugins.dsh_home import studio_dsh_home
|
|
640
|
+
|
|
641
|
+
runtime = studio.active
|
|
642
|
+
contributions = await asyncio.to_thread(
|
|
643
|
+
channel_workspace_contributions,
|
|
644
|
+
studio_dsh_home(runtime.workspace.root),
|
|
645
|
+
os.environ.get("KSADK_DSH_PROFILE", "").strip() or "web",
|
|
646
|
+
)
|
|
647
|
+
# Teams remains served by its existing lifecycle endpoint; this endpoint
|
|
648
|
+
# only adds client-only contributions that have no domain lifecycle.
|
|
649
|
+
return {"items": contributions}
|
|
650
|
+
|
|
651
|
+
@app.get("/api/v1/channels/connection")
|
|
652
|
+
async def channel_connection_status():
|
|
653
|
+
return studio.channel_connections.status()
|
|
654
|
+
|
|
655
|
+
@app.put("/api/v1/channels/connection")
|
|
656
|
+
async def configure_channel_connection(payload: ChannelConnectionSettings):
|
|
657
|
+
return await studio.channel_connections.configure(payload)
|
|
658
|
+
|
|
659
|
+
@app.put("/api/v1/channels/agents/{agent_id}/connection")
|
|
660
|
+
async def configure_channel_agent_connection(
|
|
661
|
+
agent_id: str, payload: ChannelAgentConnectionInput
|
|
662
|
+
):
|
|
663
|
+
return await studio.channel_connections.configure_agent(agent_id, payload)
|
|
664
|
+
|
|
489
665
|
@app.get("/favicon.ico")
|
|
490
666
|
async def favicon():
|
|
491
667
|
return Response(status_code=204)
|
|
@@ -617,7 +793,7 @@ def create_studio_app(
|
|
|
617
793
|
|
|
618
794
|
@app.post("/v1/responses/{response_id}/cancel")
|
|
619
795
|
async def cancel_openai_response(response_id: str):
|
|
620
|
-
result = shared_web.cancel_run(response_id)
|
|
796
|
+
result = await shared_web.cancel_run(response_id)
|
|
621
797
|
return {
|
|
622
798
|
"id": response_id,
|
|
623
799
|
"object": "response",
|
|
@@ -721,7 +897,15 @@ def create_studio_app(
|
|
|
721
897
|
)
|
|
722
898
|
return {"Code": 0, "Message": "OK", "Data": data}
|
|
723
899
|
if action == "GetAgentUiBootstrap":
|
|
724
|
-
|
|
900
|
+
bootstrap_agent_id = shared_web.resolve_agent_id(
|
|
901
|
+
requested_agent_id or None
|
|
902
|
+
)
|
|
903
|
+
# 冷启动时 provider 模型描述符尚未发现;绑定 model:provider:*
|
|
904
|
+
# 的 Agent(尤其 Harness)若直接解析会 RESOURCE_NOT_FOUND,
|
|
905
|
+
# 前端只能无限转圈。访问资源库不应该是打开对话的前置条件。
|
|
906
|
+
if not bootstrap_agent_id.startswith(("ar-", "account:")):
|
|
907
|
+
await runtime_model_catalog()
|
|
908
|
+
data = shared_web.bootstrap(bootstrap_agent_id)
|
|
725
909
|
elif action == "ListAgentModels":
|
|
726
910
|
model_agent_id = shared_web.resolve_agent_id(requested_agent_id or None)
|
|
727
911
|
# A cold Studio process has no discovered provider descriptors.
|
|
@@ -771,9 +955,10 @@ def create_studio_app(
|
|
|
771
955
|
},
|
|
772
956
|
)
|
|
773
957
|
elif action == "CancelRun":
|
|
774
|
-
data = shared_web.cancel_run(str(payload.get("InvocationId") or ""))
|
|
958
|
+
data = await shared_web.cancel_run(str(payload.get("InvocationId") or ""))
|
|
775
959
|
elif action == "SubmitInteraction":
|
|
776
960
|
run_id = str(payload.get("RunId") or "")
|
|
961
|
+
studio._require_direct_run(run_id)
|
|
777
962
|
interaction_id = str(payload.get("InteractionId") or "")
|
|
778
963
|
resolved = await studio.run_service.submit_interaction(
|
|
779
964
|
run_id,
|
|
@@ -810,6 +995,10 @@ def create_studio_app(
|
|
|
810
995
|
elif action == "ListToolReceipts":
|
|
811
996
|
data = {"ToolReceipts": []}
|
|
812
997
|
else:
|
|
998
|
+
# Channel-related actions: proxy to channel backend
|
|
999
|
+
if action in CHANNEL_ACTIONS:
|
|
1000
|
+
status, body = await studio.channel_connections.proxy(action, payload)
|
|
1001
|
+
return JSONResponse(status_code=status, content=body)
|
|
813
1002
|
return JSONResponse(
|
|
814
1003
|
status_code=404,
|
|
815
1004
|
content={
|
|
@@ -882,7 +1071,15 @@ def create_studio_app(
|
|
|
882
1071
|
status_code=401,
|
|
883
1072
|
)
|
|
884
1073
|
response.set_cookie(
|
|
885
|
-
|
|
1074
|
+
session_cookie_name,
|
|
1075
|
+
session_secret,
|
|
1076
|
+
httponly=True,
|
|
1077
|
+
samesite="strict",
|
|
1078
|
+
secure=False,
|
|
1079
|
+
path="/",
|
|
1080
|
+
)
|
|
1081
|
+
response.set_cookie(
|
|
1082
|
+
legacy_session_cookie_name,
|
|
886
1083
|
session_secret,
|
|
887
1084
|
httponly=True,
|
|
888
1085
|
samesite="strict",
|
|
@@ -901,13 +1098,15 @@ def create_studio_app(
|
|
|
901
1098
|
"workspace": {
|
|
902
1099
|
"name": studio.workspace.root.name,
|
|
903
1100
|
"path": str(studio.workspace.root),
|
|
1101
|
+
"workspaceId": studio.workspace_record.workspace_id,
|
|
904
1102
|
},
|
|
905
1103
|
"operationScope": studio.deployment_operation_scope(),
|
|
1104
|
+
"frontend": studio.frontend_assets(),
|
|
906
1105
|
"features": {
|
|
907
1106
|
"build": True,
|
|
908
1107
|
"run": True,
|
|
909
1108
|
"runtimeRegistry": True,
|
|
910
|
-
"runtimeTypes": ["codex", "adk", "langgraph"],
|
|
1109
|
+
"runtimeTypes": ["harness", "codex", "adk", "langgraph"],
|
|
911
1110
|
"evaluation": True,
|
|
912
1111
|
"deployment": True,
|
|
913
1112
|
"cloudRebuild": False,
|
|
@@ -924,7 +1123,7 @@ def create_studio_app(
|
|
|
924
1123
|
|
|
925
1124
|
@app.put("/api/v1/system/settings")
|
|
926
1125
|
async def update_settings(payload: dict[str, Any]):
|
|
927
|
-
return studio.
|
|
1126
|
+
return await studio.apply_settings(payload)
|
|
928
1127
|
|
|
929
1128
|
@app.get("/api/v1/schedules")
|
|
930
1129
|
async def list_schedules():
|
|
@@ -1036,23 +1235,222 @@ def create_studio_app(
|
|
|
1036
1235
|
studio.get_agent_schedule(agent_id, task_id)
|
|
1037
1236
|
return {"items": studio.scheduler.list_occurrences(task_id, limit=limit)}
|
|
1038
1237
|
|
|
1238
|
+
def _decode_text_file(path: Path) -> str:
|
|
1239
|
+
"""Decode with an encoding fallback chain so legacy GBK/GB18030 files
|
|
1240
|
+
written by agents preview correctly instead of turning into mojibake."""
|
|
1241
|
+
raw = path.read_bytes()
|
|
1242
|
+
for encoding in ("utf-8-sig", "utf-8", "gb18030"):
|
|
1243
|
+
try:
|
|
1244
|
+
return raw.decode(encoding)
|
|
1245
|
+
except UnicodeDecodeError:
|
|
1246
|
+
continue
|
|
1247
|
+
return raw.decode("utf-8", errors="replace")
|
|
1248
|
+
|
|
1249
|
+
@app.get("/api/v1/workspace/file")
|
|
1250
|
+
async def read_workspace_file(path: str = Query(...), download: bool = Query(default=False)):
|
|
1251
|
+
"""Read one file inside the workspace (or a linked directory) for preview.
|
|
1252
|
+
|
|
1253
|
+
Absolute paths outside the workspace and its linked directories are
|
|
1254
|
+
rejected, as are oversized files; preview clients render the payload
|
|
1255
|
+
according to the returned contentType.
|
|
1256
|
+
"""
|
|
1257
|
+
import mimetypes
|
|
1258
|
+
from urllib.parse import quote
|
|
1259
|
+
|
|
1260
|
+
raw = Path(path).expanduser()
|
|
1261
|
+
candidate = raw if raw.is_absolute() else studio.workspace.root / raw
|
|
1262
|
+
try:
|
|
1263
|
+
resolved = candidate.resolve()
|
|
1264
|
+
except OSError as error:
|
|
1265
|
+
raise StudioError("WORKSPACE_FILE_INVALID", "文件路径无效", status_code=422) from error
|
|
1266
|
+
|
|
1267
|
+
allowed_roots = [studio.workspace.root.resolve()]
|
|
1268
|
+
for item in LinkedDirectoryPolicy(studio.workspace.root).list():
|
|
1269
|
+
linked = Path(item.path).expanduser().resolve()
|
|
1270
|
+
if linked.is_dir():
|
|
1271
|
+
allowed_roots.append(linked)
|
|
1272
|
+
if not any(
|
|
1273
|
+
resolved == root or resolved.is_relative_to(root) for root in allowed_roots
|
|
1274
|
+
):
|
|
1275
|
+
raise StudioError(
|
|
1276
|
+
"WORKSPACE_FILE_FORBIDDEN", "路径不在工作区(或链接目录)内", status_code=403
|
|
1277
|
+
)
|
|
1278
|
+
if not resolved.is_file():
|
|
1279
|
+
raise StudioError("WORKSPACE_FILE_NOT_FOUND", "文件不存在", status_code=404)
|
|
1280
|
+
size = resolved.stat().st_size
|
|
1281
|
+
if size > 2 * 1024 * 1024:
|
|
1282
|
+
raise StudioError(
|
|
1283
|
+
"WORKSPACE_FILE_TOO_LARGE", "文件超过 2MB 预览上限", status_code=413
|
|
1284
|
+
)
|
|
1285
|
+
suffix = resolved.suffix.lower()
|
|
1286
|
+
if suffix in {
|
|
1287
|
+
".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg", ".bmp", ".ico",
|
|
1288
|
+
}:
|
|
1289
|
+
content_type = mimetypes.guess_type(resolved.name)[0] or "application/octet-stream"
|
|
1290
|
+
media_category = "image"
|
|
1291
|
+
payload: bytes | str = resolved.read_bytes()
|
|
1292
|
+
elif suffix in {".md", ".markdown"}:
|
|
1293
|
+
content_type, media_category = "text/markdown", "markdown"
|
|
1294
|
+
payload = _decode_text_file(resolved)
|
|
1295
|
+
else:
|
|
1296
|
+
text_types = {
|
|
1297
|
+
".txt", ".json", ".csv", ".tsv", ".log", ".py", ".js", ".ts", ".tsx",
|
|
1298
|
+
".jsx", ".html", ".css", ".yaml", ".yml", ".toml", ".xml", ".sh",
|
|
1299
|
+
".sql", ".rs", ".go", ".java", ".c", ".cpp", ".h", ".diff", ".ini",
|
|
1300
|
+
}
|
|
1301
|
+
if suffix not in text_types:
|
|
1302
|
+
raise StudioError(
|
|
1303
|
+
"WORKSPACE_FILE_UNSUPPORTED", "该文件类型暂不支持预览", status_code=415
|
|
1304
|
+
)
|
|
1305
|
+
content_type, media_category = "text/plain", "text"
|
|
1306
|
+
payload = _decode_text_file(resolved)
|
|
1307
|
+
response = {
|
|
1308
|
+
"path": str(resolved),
|
|
1309
|
+
"name": resolved.name,
|
|
1310
|
+
"sizeBytes": size,
|
|
1311
|
+
"contentType": content_type,
|
|
1312
|
+
"mediaCategory": media_category,
|
|
1313
|
+
}
|
|
1314
|
+
if download:
|
|
1315
|
+
quoted = quote(resolved.name)
|
|
1316
|
+
return Response(
|
|
1317
|
+
content=payload if isinstance(payload, bytes) else payload.encode("utf-8"),
|
|
1318
|
+
media_type=content_type,
|
|
1319
|
+
headers={"Content-Disposition": f"attachment; filename*=UTF-8''{quoted}"},
|
|
1320
|
+
)
|
|
1321
|
+
if media_category == "image":
|
|
1322
|
+
import base64
|
|
1323
|
+
|
|
1324
|
+
response["dataBase64"] = base64.b64encode(payload).decode("ascii")
|
|
1325
|
+
else:
|
|
1326
|
+
response["content"] = payload
|
|
1327
|
+
return response
|
|
1328
|
+
|
|
1039
1329
|
@app.post("/api/v1/workspaces:open")
|
|
1040
1330
|
async def open_workspace(payload: WorkspaceOpenRequest):
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1331
|
+
try:
|
|
1332
|
+
# A user-selected directory is itself the workspace. The registry
|
|
1333
|
+
# entry is created as part of opening it; callers do not need to
|
|
1334
|
+
# pre-register paths in a separate settings screen.
|
|
1335
|
+
record = studio.switch(payload.path, create=True)
|
|
1336
|
+
# Start local state immediately, but keep optional DSH/Profile
|
|
1337
|
+
# discovery off the workspace-switch response path.
|
|
1338
|
+
runtime = studio.active
|
|
1339
|
+
await runtime.start(wait_for_dsh=False)
|
|
1340
|
+
schedule_runtime_warmup = getattr(app.state, "runtime_warmups", None)
|
|
1341
|
+
if schedule_runtime_warmup is not None:
|
|
1342
|
+
schedule_runtime_warmup(runtime)
|
|
1343
|
+
except FileNotFoundError as error:
|
|
1344
|
+
raise StudioError("WORKSPACE_NOT_FOUND", "工作区目录不存在", status_code=404) from error
|
|
1345
|
+
response = {
|
|
1346
|
+
"name": record.name,
|
|
1347
|
+
"path": record.path,
|
|
1348
|
+
"workspaceId": record.workspace_id,
|
|
1349
|
+
}
|
|
1350
|
+
# Preserve the legacy reconnect response shape for the daemon root;
|
|
1351
|
+
# switched workspaces include the stable identity for scoped clients.
|
|
1352
|
+
if os.path.normcase(record.path) == os.path.normcase(str(initial_service.workspace.root)):
|
|
1353
|
+
response.pop("workspaceId", None)
|
|
1354
|
+
return response
|
|
1355
|
+
|
|
1356
|
+
@app.post("/api/v1/workspaces:choose")
|
|
1357
|
+
async def choose_workspace_directory():
|
|
1358
|
+
"""Open the host folder chooser for a local Web Studio session."""
|
|
1359
|
+
if sys.platform != "darwin":
|
|
1046
1360
|
raise StudioError(
|
|
1047
|
-
"
|
|
1048
|
-
"
|
|
1049
|
-
status_code=
|
|
1361
|
+
"WORKSPACE_PICKER_UNAVAILABLE",
|
|
1362
|
+
"当前系统没有可用的原生目录选择器,请输入目录路径",
|
|
1363
|
+
status_code=501,
|
|
1364
|
+
)
|
|
1365
|
+
script = (
|
|
1366
|
+
'tell application "System Events" to set selectedFolder to choose folder '
|
|
1367
|
+
'with prompt "选择 AgentKit Studio 工作区"\n'
|
|
1368
|
+
'POSIX path of selectedFolder'
|
|
1369
|
+
)
|
|
1370
|
+
result = await asyncio.to_thread(
|
|
1371
|
+
subprocess.run,
|
|
1372
|
+
["osascript", "-e", script],
|
|
1373
|
+
capture_output=True,
|
|
1374
|
+
text=True,
|
|
1375
|
+
check=False,
|
|
1376
|
+
)
|
|
1377
|
+
if result.returncode != 0:
|
|
1378
|
+
return {"path": None, "cancelled": True}
|
|
1379
|
+
path = result.stdout.strip()
|
|
1380
|
+
return {"path": path or None, "cancelled": not bool(path)}
|
|
1381
|
+
|
|
1382
|
+
@app.get("/api/v1/workspaces")
|
|
1383
|
+
async def list_workspaces():
|
|
1384
|
+
active_path = os.path.normcase(str(studio.workspace.root))
|
|
1385
|
+
items = []
|
|
1386
|
+
for record in WorkspaceRegistry().list():
|
|
1387
|
+
item = record.__dict__.copy()
|
|
1388
|
+
item["active"] = os.path.normcase(record.path) == active_path
|
|
1389
|
+
items.append(item)
|
|
1390
|
+
return {"items": items}
|
|
1391
|
+
|
|
1392
|
+
@app.post("/api/v1/workspaces/{workspace_id}/linked-directories")
|
|
1393
|
+
async def add_linked_directory(workspace_id: str, payload: LinkedDirectoryRequest):
|
|
1394
|
+
record = next(
|
|
1395
|
+
(r for r in WorkspaceRegistry().list() if r.workspace_id == workspace_id), None
|
|
1396
|
+
)
|
|
1397
|
+
if record is None or os.path.normcase(record.path) != os.path.normcase(
|
|
1398
|
+
str(studio.workspace.root)
|
|
1399
|
+
):
|
|
1400
|
+
raise StudioError(
|
|
1401
|
+
"WORKSPACE_NOT_FOUND", "工作区不存在或不属于当前 Studio", status_code=404
|
|
1402
|
+
)
|
|
1403
|
+
item = LinkedDirectoryPolicy(studio.workspace.root).set(
|
|
1404
|
+
payload.path, payload.mode, payload.label
|
|
1405
|
+
)
|
|
1406
|
+
return item.__dict__
|
|
1407
|
+
|
|
1408
|
+
@app.get("/api/v1/workspaces/{workspace_id}/linked-directories")
|
|
1409
|
+
async def list_linked_directories(workspace_id: str):
|
|
1410
|
+
record = next(
|
|
1411
|
+
(r for r in WorkspaceRegistry().list() if r.workspace_id == workspace_id), None
|
|
1412
|
+
)
|
|
1413
|
+
if record is None or os.path.normcase(record.path) != os.path.normcase(
|
|
1414
|
+
str(studio.workspace.root)
|
|
1415
|
+
):
|
|
1416
|
+
raise StudioError(
|
|
1417
|
+
"WORKSPACE_NOT_FOUND", "工作区不存在或不属于当前 Studio", status_code=404
|
|
1050
1418
|
)
|
|
1051
1419
|
return {
|
|
1052
|
-
"
|
|
1053
|
-
"path": str(studio.workspace.root),
|
|
1420
|
+
"items": [item.__dict__ for item in LinkedDirectoryPolicy(studio.workspace.root).list()]
|
|
1054
1421
|
}
|
|
1055
1422
|
|
|
1423
|
+
@app.delete("/api/v1/workspaces/{workspace_id}/linked-directories")
|
|
1424
|
+
async def remove_linked_directory(workspace_id: str, path: str):
|
|
1425
|
+
record = next(
|
|
1426
|
+
(r for r in WorkspaceRegistry().list() if r.workspace_id == workspace_id), None
|
|
1427
|
+
)
|
|
1428
|
+
if record is None or os.path.normcase(record.path) != os.path.normcase(
|
|
1429
|
+
str(studio.workspace.root)
|
|
1430
|
+
):
|
|
1431
|
+
raise StudioError(
|
|
1432
|
+
"WORKSPACE_NOT_FOUND", "工作区不存在或不属于当前 Studio", status_code=404
|
|
1433
|
+
)
|
|
1434
|
+
return {"removed": LinkedDirectoryPolicy(studio.workspace.root).remove(path)}
|
|
1435
|
+
|
|
1436
|
+
@app.get("/api/v1/workspaces/{workspace_id}/linked-directories/authorize")
|
|
1437
|
+
async def authorize_linked_directory(
|
|
1438
|
+
workspace_id: str,
|
|
1439
|
+
path: str,
|
|
1440
|
+
operation: Literal["read", "write"] = "read",
|
|
1441
|
+
):
|
|
1442
|
+
record = next(
|
|
1443
|
+
(r for r in WorkspaceRegistry().list() if r.workspace_id == workspace_id), None
|
|
1444
|
+
)
|
|
1445
|
+
if record is None or os.path.normcase(record.path) != os.path.normcase(
|
|
1446
|
+
str(studio.workspace.root)
|
|
1447
|
+
):
|
|
1448
|
+
raise StudioError(
|
|
1449
|
+
"WORKSPACE_NOT_FOUND", "工作区不存在或不属于当前 Studio", status_code=404
|
|
1450
|
+
)
|
|
1451
|
+
allowed = LinkedDirectoryPolicy(studio.workspace.root).authorize(path, operation)
|
|
1452
|
+
return {"path": path, "operation": operation, "allowed": allowed}
|
|
1453
|
+
|
|
1056
1454
|
@app.get("/api/v1/codex/manifest")
|
|
1057
1455
|
async def get_codex_manifest():
|
|
1058
1456
|
return studio.codex_manifest_state()
|
|
@@ -1377,6 +1775,48 @@ def create_studio_app(
|
|
|
1377
1775
|
async def get_agent(agent_id: str):
|
|
1378
1776
|
return studio.agent_detail(agent_id)
|
|
1379
1777
|
|
|
1778
|
+
@app.post("/api/v1/agents/{agent_id}/runtime:prewarm", status_code=202)
|
|
1779
|
+
async def prewarm_agent_runtime(agent_id: str, payload: dict[str, Any]):
|
|
1780
|
+
"""后台预热当前 Build 的 Provider 激活(MCP/图编译),不执行任何 turn。
|
|
1781
|
+
|
|
1782
|
+
首 token 延迟的主因是首轮 open_activation 时的 MCP spawn/health/list
|
|
1783
|
+
(实测 ~12s)。前端在进入会话时 fire-and-forget 调用本端点,把这段
|
|
1784
|
+
开销移到用户输入之前;失败静默(首轮照旧现场预热)。
|
|
1785
|
+
"""
|
|
1786
|
+
session_id = str(payload.get("sessionId") or "")
|
|
1787
|
+
if not session_id:
|
|
1788
|
+
raise StudioError(
|
|
1789
|
+
"SESSION_ID_REQUIRED", "缺少 sessionId", status_code=422
|
|
1790
|
+
)
|
|
1791
|
+
try:
|
|
1792
|
+
build = await studio.ensure_current_build(agent_id)
|
|
1793
|
+
except StudioError as exc:
|
|
1794
|
+
raise StudioError(
|
|
1795
|
+
"BUILD_NOT_FOUND", f"Agent 尚无可运行的 Build:{exc.message}",
|
|
1796
|
+
status_code=404,
|
|
1797
|
+
) from exc
|
|
1798
|
+
|
|
1799
|
+
async def warm() -> None:
|
|
1800
|
+
try:
|
|
1801
|
+
spec = studio.resolve_run_spec(build.id)
|
|
1802
|
+
runtime = studio.run_service.plugin_runtime
|
|
1803
|
+
if runtime is None:
|
|
1804
|
+
return
|
|
1805
|
+
kernel_adapter = getattr(runtime, "kernel_adapter", None)
|
|
1806
|
+
if kernel_adapter is None:
|
|
1807
|
+
return
|
|
1808
|
+
# 打开并保留激活(以 session 为 key);下一轮 RunAgent 直接复用,
|
|
1809
|
+
# 不再现场 spawn/health/list MCP。
|
|
1810
|
+
await kernel_adapter(spec, session_id=session_id)
|
|
1811
|
+
except Exception as error:
|
|
1812
|
+
logger.info("runtime prewarm for %s skipped: %s", agent_id, error)
|
|
1813
|
+
|
|
1814
|
+
task = asyncio.create_task(warm())
|
|
1815
|
+
app.state.runtime_prewarms = getattr(app.state, "runtime_prewarms", set())
|
|
1816
|
+
app.state.runtime_prewarms.add(task)
|
|
1817
|
+
task.add_done_callback(app.state.runtime_prewarms.discard)
|
|
1818
|
+
return {"status": "prewarming", "buildId": build.id}
|
|
1819
|
+
|
|
1380
1820
|
@app.get("/api/v1/agents/{agent_id}/models")
|
|
1381
1821
|
async def get_agent_models(agent_id: str):
|
|
1382
1822
|
model_agent_id = shared_web.resolve_agent_id(agent_id)
|
|
@@ -1535,19 +1975,34 @@ def create_studio_app(
|
|
|
1535
1975
|
|
|
1536
1976
|
@app.get("/api/v1/runs/{run_id}")
|
|
1537
1977
|
async def get_run(run_id: str):
|
|
1538
|
-
|
|
1978
|
+
runtime = studio.runtime_for_run(run_id)
|
|
1979
|
+
if runtime is None:
|
|
1980
|
+
raise StudioError("RUN_NOT_FOUND", "运行不存在", status_code=404)
|
|
1981
|
+
return runtime.event_store.get(run_id)
|
|
1539
1982
|
|
|
1540
1983
|
@app.post("/api/v1/runs/{run_id}:cancel", status_code=202)
|
|
1541
1984
|
async def cancel_run(run_id: str):
|
|
1542
|
-
|
|
1985
|
+
runtime = studio.runtime_for_run(run_id)
|
|
1986
|
+
if runtime is None:
|
|
1987
|
+
raise StudioError("RUN_NOT_FOUND", "运行不存在", status_code=404)
|
|
1988
|
+
runtime._require_direct_run(run_id)
|
|
1989
|
+
return await runtime.run_service.cancel_run(run_id)
|
|
1543
1990
|
|
|
1544
1991
|
@app.post("/api/v1/runs/{run_id}:pause", status_code=202)
|
|
1545
1992
|
async def pause_run(run_id: str):
|
|
1546
|
-
|
|
1993
|
+
runtime = studio.runtime_for_run(run_id)
|
|
1994
|
+
if runtime is None:
|
|
1995
|
+
raise StudioError("RUN_NOT_FOUND", "运行不存在", status_code=404)
|
|
1996
|
+
runtime._require_direct_run(run_id)
|
|
1997
|
+
return await runtime.run_service.pause_run(run_id)
|
|
1547
1998
|
|
|
1548
1999
|
@app.post("/api/v1/runs/{run_id}:resume", status_code=202)
|
|
1549
2000
|
async def resume_run(run_id: str):
|
|
1550
|
-
|
|
2001
|
+
runtime = studio.runtime_for_run(run_id)
|
|
2002
|
+
if runtime is None:
|
|
2003
|
+
raise StudioError("RUN_NOT_FOUND", "运行不存在", status_code=404)
|
|
2004
|
+
runtime._require_direct_run(run_id)
|
|
2005
|
+
return await runtime.run_service.resume_run(run_id)
|
|
1551
2006
|
|
|
1552
2007
|
@app.post("/api/v1/runs/{run_id}/interactions/{interaction_id}:submit")
|
|
1553
2008
|
async def submit_run_interaction(
|
|
@@ -1555,7 +2010,10 @@ def create_studio_app(
|
|
|
1555
2010
|
interaction_id: str,
|
|
1556
2011
|
payload: InteractionSubmitRequest,
|
|
1557
2012
|
):
|
|
1558
|
-
|
|
2013
|
+
runtime = studio.runtime_for_run(run_id)
|
|
2014
|
+
if runtime is None:
|
|
2015
|
+
raise StudioError("RUN_NOT_FOUND", "运行不存在", status_code=404)
|
|
2016
|
+
return await runtime.run_service.submit_interaction(
|
|
1559
2017
|
run_id,
|
|
1560
2018
|
interaction_id,
|
|
1561
2019
|
name=payload.name,
|
|
@@ -1567,7 +2025,10 @@ def create_studio_app(
|
|
|
1567
2025
|
@app.get("/api/v1/runs/{run_id}/context")
|
|
1568
2026
|
async def get_run_context(run_id: str):
|
|
1569
2027
|
"""Runtime Context Evidence:planned/projected/actual + 精度 + ownership。"""
|
|
1570
|
-
|
|
2028
|
+
runtime = studio.runtime_for_run(run_id)
|
|
2029
|
+
if runtime is None:
|
|
2030
|
+
raise StudioError("RUN_NOT_FOUND", "运行不存在", status_code=404)
|
|
2031
|
+
record = runtime.event_store.get(run_id)
|
|
1571
2032
|
plan = record.context_plan or {}
|
|
1572
2033
|
evidence = record.prompt_evidence or {}
|
|
1573
2034
|
return {
|
|
@@ -1621,7 +2082,10 @@ def create_studio_app(
|
|
|
1621
2082
|
|
|
1622
2083
|
@app.delete("/api/v1/sessions/{session_id}", status_code=204)
|
|
1623
2084
|
async def delete_studio_session(session_id: str):
|
|
1624
|
-
await studio.
|
|
2085
|
+
runtime = await studio.runtime_for_session(session_id)
|
|
2086
|
+
if runtime is None:
|
|
2087
|
+
raise StudioError("SESSION_NOT_FOUND", "会话不存在", status_code=404)
|
|
2088
|
+
await runtime.delete_session(session_id)
|
|
1625
2089
|
return Response(status_code=204)
|
|
1626
2090
|
|
|
1627
2091
|
@app.get("/api/v1/sessions/{session_id}/events")
|
|
@@ -1631,7 +2095,10 @@ def create_studio_app(
|
|
|
1631
2095
|
invocation_id: str | None = Query(default=None, alias="invocationId"),
|
|
1632
2096
|
limit: int = Query(default=100, ge=1, le=500),
|
|
1633
2097
|
):
|
|
1634
|
-
|
|
2098
|
+
runtime = await studio.runtime_for_session(session_id)
|
|
2099
|
+
if runtime is None:
|
|
2100
|
+
raise StudioError("SESSION_NOT_FOUND", "会话不存在", status_code=404)
|
|
2101
|
+
return await runtime.trajectory_page(
|
|
1635
2102
|
session_id,
|
|
1636
2103
|
before_seq_id=before_seq_id,
|
|
1637
2104
|
invocation_id=invocation_id,
|
|
@@ -1645,10 +2112,13 @@ def create_studio_app(
|
|
|
1645
2112
|
after_seq_id: int = Query(default=0, ge=0, alias="afterSeqId"),
|
|
1646
2113
|
invocation_id: str | None = Query(default=None, alias="invocationId"),
|
|
1647
2114
|
):
|
|
1648
|
-
await studio.
|
|
2115
|
+
runtime = await studio.runtime_for_session(session_id)
|
|
2116
|
+
if runtime is None:
|
|
2117
|
+
raise StudioError("SESSION_NOT_FOUND", "会话不存在", status_code=404)
|
|
2118
|
+
await runtime._require_runtime_session(session_id)
|
|
1649
2119
|
last = request.headers.get("Last-Event-ID")
|
|
1650
2120
|
cursor = int(last) if last and last.isdigit() else after_seq_id
|
|
1651
|
-
stream =
|
|
2121
|
+
stream = runtime.stream_trajectory(
|
|
1652
2122
|
session_id,
|
|
1653
2123
|
cursor,
|
|
1654
2124
|
invocation_id=invocation_id,
|
|
@@ -1719,6 +2189,44 @@ def create_studio_app(
|
|
|
1719
2189
|
async def list_runs(session_id: str | None = Query(default=None, alias="sessionId")):
|
|
1720
2190
|
return {"items": studio.event_store.list_runs(session_id=session_id)}
|
|
1721
2191
|
|
|
2192
|
+
@app.get("/api/v1/workspaces/runs")
|
|
2193
|
+
async def list_workspace_runs():
|
|
2194
|
+
"""后台入口:聚合所有已打开 workspace 的运行,并保留归属。"""
|
|
2195
|
+
return {"items": studio.all_runs()}
|
|
2196
|
+
|
|
2197
|
+
@app.get("/api/v1/workspaces/operations")
|
|
2198
|
+
async def list_workspace_operations():
|
|
2199
|
+
return {"items": studio.all_operations()}
|
|
2200
|
+
|
|
2201
|
+
@app.get("/api/v1/runs/{run_id}/documents/metadata")
|
|
2202
|
+
def run_document_metadata(run_id: str, path: str, request: Request):
|
|
2203
|
+
return document_metadata(studio, run_id, path, local=is_local_desktop_request(request))
|
|
2204
|
+
|
|
2205
|
+
@app.post("/api/v1/runs/{run_id}/documents/actions")
|
|
2206
|
+
def run_document_action(run_id: str, payload: NativeDocumentActionRequest, request: Request):
|
|
2207
|
+
return perform_document_action(
|
|
2208
|
+
studio, run_id, payload, local=is_local_desktop_request(request)
|
|
2209
|
+
)
|
|
2210
|
+
|
|
2211
|
+
@app.get("/api/v1/runs/{run_id}/documents/content")
|
|
2212
|
+
def run_document(run_id: str, path: str, preview: bool = False):
|
|
2213
|
+
file_path, content = read_document(studio, run_id, path)
|
|
2214
|
+
if preview:
|
|
2215
|
+
return JSONResponse(
|
|
2216
|
+
{"name": file_path.name, "content": content},
|
|
2217
|
+
headers={"Cache-Control": "no-store"},
|
|
2218
|
+
)
|
|
2219
|
+
return Response(
|
|
2220
|
+
content,
|
|
2221
|
+
media_type="text/markdown",
|
|
2222
|
+
headers={
|
|
2223
|
+
"Content-Disposition": "attachment; filename*=UTF-8''"
|
|
2224
|
+
+ quote(file_path.name),
|
|
2225
|
+
"X-Content-Type-Options": "nosniff",
|
|
2226
|
+
"Cache-Control": "no-store",
|
|
2227
|
+
},
|
|
2228
|
+
)
|
|
2229
|
+
|
|
1722
2230
|
@app.get("/api/v1/runs/{run_id}/events")
|
|
1723
2231
|
async def run_events(
|
|
1724
2232
|
run_id: str,
|
|
@@ -1727,7 +2235,10 @@ def create_studio_app(
|
|
|
1727
2235
|
):
|
|
1728
2236
|
last = request.headers.get("Last-Event-ID")
|
|
1729
2237
|
cursor = int(last) if last and last.isdigit() else after
|
|
1730
|
-
|
|
2238
|
+
runtime = studio.runtime_for_run(run_id)
|
|
2239
|
+
if runtime is None:
|
|
2240
|
+
raise StudioError("RUN_NOT_FOUND", "运行不存在", status_code=404)
|
|
2241
|
+
events = await runtime.run_service.events(run_id, after=cursor)
|
|
1731
2242
|
return _sse(events)
|
|
1732
2243
|
|
|
1733
2244
|
@app.get("/api/v1/traces/overview")
|
|
@@ -1742,6 +2253,10 @@ def create_studio_app(
|
|
|
1742
2253
|
status=status,
|
|
1743
2254
|
)
|
|
1744
2255
|
|
|
2256
|
+
@app.get("/api/v1/workspaces/traces")
|
|
2257
|
+
async def list_workspace_traces():
|
|
2258
|
+
return {"items": studio.all_traces()}
|
|
2259
|
+
|
|
1745
2260
|
@app.get("/api/v1/traces")
|
|
1746
2261
|
async def list_traces(
|
|
1747
2262
|
agent_id: str | None = Query(default=None, alias="agentId"),
|
|
@@ -2185,11 +2700,17 @@ def create_studio_app(
|
|
|
2185
2700
|
|
|
2186
2701
|
@app.get("/api/v1/operations/{operation_id}")
|
|
2187
2702
|
async def get_operation(operation_id: str):
|
|
2188
|
-
|
|
2703
|
+
runtime = studio.runtime_for_operation(operation_id)
|
|
2704
|
+
if runtime is None:
|
|
2705
|
+
raise StudioError("OPERATION_NOT_FOUND", "操作不存在", status_code=404)
|
|
2706
|
+
return runtime.operations.get(operation_id)
|
|
2189
2707
|
|
|
2190
2708
|
@app.post("/api/v1/operations/{operation_id}:cancel")
|
|
2191
2709
|
async def cancel_operation(operation_id: str):
|
|
2192
|
-
|
|
2710
|
+
runtime = studio.runtime_for_operation(operation_id)
|
|
2711
|
+
if runtime is None:
|
|
2712
|
+
raise StudioError("OPERATION_NOT_FOUND", "操作不存在", status_code=404)
|
|
2713
|
+
return runtime.operations.cancel(operation_id)
|
|
2193
2714
|
|
|
2194
2715
|
@app.get("/api/v1/operations/{operation_id}/events")
|
|
2195
2716
|
async def operation_events(
|
|
@@ -2199,7 +2720,10 @@ def create_studio_app(
|
|
|
2199
2720
|
):
|
|
2200
2721
|
last = request.headers.get("Last-Event-ID")
|
|
2201
2722
|
cursor = int(last) if last and last.isdigit() else after
|
|
2202
|
-
|
|
2723
|
+
runtime = studio.runtime_for_operation(operation_id)
|
|
2724
|
+
if runtime is None:
|
|
2725
|
+
raise StudioError("OPERATION_NOT_FOUND", "操作不存在", status_code=404)
|
|
2726
|
+
events = runtime.operations.events(operation_id, after=cursor)
|
|
2203
2727
|
if "application/json" in request.headers.get("Accept", ""):
|
|
2204
2728
|
return {"items": events}
|
|
2205
2729
|
return _sse(events)
|
|
@@ -2212,11 +2736,22 @@ def create_studio_app(
|
|
|
2212
2736
|
register_memory_routes(app, studio)
|
|
2213
2737
|
register_resource_connection_routes(app, studio)
|
|
2214
2738
|
register_plugin_routes(app, studio)
|
|
2739
|
+
async def workspace_plugin_api(scope, receive, send):
|
|
2740
|
+
# The plugin registry belongs to the active workspace. Mounting the
|
|
2741
|
+
# initial service registry directly would keep lifecycle/routes pinned
|
|
2742
|
+
# to the first folder after a workspace switch.
|
|
2743
|
+
await studio.active.workspace_plugins.api(scope, receive, send)
|
|
2744
|
+
|
|
2745
|
+
app.mount("/api/v1", workspace_plugin_api, name="workspace-plugin-api")
|
|
2215
2746
|
|
|
2216
2747
|
from ksadk.studio.dsh_application import register_dsh_application
|
|
2217
2748
|
|
|
2218
2749
|
register_dsh_application(
|
|
2219
|
-
app,
|
|
2750
|
+
app,
|
|
2751
|
+
studio,
|
|
2752
|
+
session_secret=session_secret,
|
|
2753
|
+
security_enabled=security_enabled,
|
|
2754
|
+
fallback_url="/studio-shell/",
|
|
2220
2755
|
)
|
|
2221
2756
|
|
|
2222
2757
|
return app
|