agentengine-sdk-python 0.8.3__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.3.dist-info → agentengine_sdk_python-0.8.5.dist-info}/METADATA +13 -9
- agentengine_sdk_python-0.8.5.dist-info/RECORD +1296 -0
- 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 +111 -91
- ksadk/builders/code_builder.py +74 -21
- ksadk/builders/framework_requirements.py +22 -3
- ksadk/builders/ks3_uploader.py +36 -7
- ksadk/builders/managed_runtime_builder.py +1 -0
- ksadk/cli/__init__.py +68 -3
- 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_managed_runtime.py +13 -1
- ksadk/cli/cmd_openclaw.py +26 -1
- ksadk/cli/cmd_plugin.py +76 -13
- ksadk/cli/cmd_studio.py +64 -16
- ksadk/cli/cmd_web.py +2 -5
- ksadk/cli/openclaw_env.py +1 -1
- ksadk/cli/resource_common.py +26 -0
- ksadk/cli/runtime_bootstrap.py +23 -1
- ksadk/codex/client.py +425 -96
- ksadk/codex/projection.py +24 -0
- ksadk/codex/runtime.py +56 -298
- ksadk/common/auth.py +16 -10
- ksadk/configs/__init__.py +1 -1
- ksadk/configs/env_registry.py +153 -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 +133 -21
- ksadk/conversations/normalize.py +28 -10
- ksadk/conversations/projector.py +4 -6
- ksadk/conversations/runtime_baseline.py +37 -0
- ksadk/conversations/runtime_invocation.py +22 -4
- ksadk/conversations/runtime_observability.py +39 -10
- ksadk/conversations/runtime_payloads.py +9 -0
- ksadk/conversations/runtime_persistence.py +105 -9
- ksadk/conversations/runtime_preparation.py +42 -33
- ksadk/conversations/runtime_resume.py +50 -2
- ksadk/conversations/runtime_stream_events.py +34 -35
- ksadk/conversations/runtime_streaming.py +33 -7
- ksadk/deployment/env_forward.py +2 -2
- ksadk/deployment/providers/serverless.py +1 -1
- ksadk/events/adapters/_codex_items.py +16 -8
- ksadk/events/adapters/_codex_validators.py +18 -7
- ksadk/events/adapters/_langgraph_support.py +34 -0
- ksadk/events/adapters/langgraph.py +15 -1
- ksadk/events/canonical_store.py +3 -1
- ksadk/events/projections.py +1 -1
- 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/config.py +2 -2
- 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 +171 -136
- 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/tools.py +38 -13
- 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 +2 -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 +2 -1
- ksadk/kernel/__init__.py +10 -0
- ksadk/kernel/approval_presentation.py +91 -0
- ksadk/kernel/authorization.py +1 -1
- ksadk/kernel/bootstrap.py +114 -106
- 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 +42 -29
- 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 +331 -25
- ksadk/kernel/state.py +2 -3
- ksadk/kernel/store.py +72 -2
- ksadk/kernel/worker.py +144 -51
- ksadk/kernel/worker_history.py +72 -0
- ksadk/kernel/worker_identity.py +47 -0
- ksadk/knowledge_base/client.py +57 -27
- ksadk/mcp_runtime/__init__.py +12 -4
- ksadk/memory/adk/backends/sdk_ltm_backend.py +161 -41
- ksadk/memory/adk/resilient_session_service.py +25 -17
- ksadk/memory/adk/short_term_memory.py +26 -9
- ksadk/memory/coordinator.py +22 -6
- ksadk/memory/extraction.py +40 -1
- ksadk/memory/models.py +84 -5
- ksadk/memory/provider_resolver.py +8 -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 +14 -7
- ksadk/model_proxy/transform.py +40 -2
- ksadk/plugins/__init__.py +5 -1
- ksadk/plugins/artifacts.py +275 -0
- ksadk/plugins/bridges/__init__.py +4 -2
- ksadk/plugins/bridges/codex.py +120 -13
- ksadk/plugins/bridges/dsh.py +351 -156
- ksadk/plugins/builtins.py +72 -35
- ksadk/plugins/bundle_security.py +28 -4
- ksadk/plugins/codex_manifest.py +983 -0
- ksadk/plugins/companion_artifacts.py +83 -0
- ksadk/plugins/companions.py +368 -0
- ksadk/plugins/composition.py +8 -0
- ksadk/plugins/contracts.py +119 -1
- ksadk/plugins/delivery.py +153 -0
- ksadk/plugins/dsh_channels.py +156 -0
- ksadk/plugins/dsh_home.py +140 -0
- ksadk/plugins/dsh_installation_digest.py +71 -0
- ksadk/plugins/dsh_teams.py +105 -0
- ksadk/plugins/dsh_toolchain.py +203 -32
- ksadk/plugins/ecosystem_probe.py +6 -6
- ksadk/plugins/execution_host.py +99 -0
- ksadk/plugins/host.py +102 -39
- ksadk/plugins/kernel_adapter.py +205 -0
- ksadk/plugins/providers/__init__.py +23 -0
- ksadk/plugins/providers/bundles/dsh-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/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-knowledge/index.mjs +53 -0
- ksadk/plugins/providers/bundles/dsh-knowledge/package.json +16 -0
- ksadk/plugins/providers/bundles/dsh-memory/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-memory/index.mjs +175 -0
- ksadk/plugins/providers/bundles/dsh-memory/package.json +16 -0
- ksadk/plugins/providers/bundles/dsh-platform-resources/client.mjs +166 -0
- ksadk/plugins/providers/bundles/dsh-platform-resources/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-platform-resources/index.mjs +9 -0
- ksadk/plugins/providers/bundles/dsh-platform-resources/package.json +12 -0
- ksadk/plugins/providers/bundles/dsh-skill-center/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/dsh-skill-center/index.mjs +125 -0
- ksadk/plugins/providers/bundles/dsh-skill-center/package.json +16 -0
- ksadk/plugins/providers/bundles/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/cordis.patch.yml +3 -0
- ksadk/plugins/providers/bundles/ksadk-dsh-capability-host/index.mjs +920 -0
- ksadk/plugins/providers/bundles/ksadk-dsh-capability-host/package.json +27 -0
- 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 +115 -0
- ksadk/plugins/providers/bundles/ksadk-dsh-studio/index.mjs +19 -0
- ksadk/plugins/providers/bundles/ksadk-dsh-studio/package.json +7 -0
- ksadk/plugins/providers/bundles/ksadk-harness/index.mjs +1 -1
- ksadk/plugins/providers/codex.py +344 -70
- ksadk/plugins/providers/codex_native.py +368 -0
- ksadk/plugins/providers/codex_turn.py +301 -0
- ksadk/plugins/providers/dsh_capabilities.py +1450 -0
- ksadk/plugins/providers/dsh_mcp.py +467 -0
- ksadk/plugins/providers/harness.py +294 -141
- 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/mcp_projection.py +150 -0
- ksadk/plugins/providers/platform_resources.py +657 -0
- ksadk/plugins/providers/shipped_dsh.py +4 -1
- ksadk/plugins/resolver.py +8 -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/resource_runtime/__init__.py +4 -0
- ksadk/resource_runtime/broker.py +616 -0
- ksadk/resource_runtime/build_artifacts.py +165 -0
- ksadk/resource_runtime/contracts.py +138 -0
- ksadk/resource_runtime/discovery_receipts.py +100 -0
- ksadk/resource_runtime/discovery_skills.py +172 -0
- ksadk/resource_runtime/errors.py +6 -0
- ksadk/resource_runtime/ipc.py +142 -0
- ksadk/resource_runtime/kernel_approval.py +165 -0
- ksadk/resource_runtime/knowledge.py +114 -0
- ksadk/resource_runtime/langgraph.py +94 -0
- ksadk/resource_runtime/leases.py +191 -0
- ksadk/resource_runtime/managed_projection.py +186 -0
- ksadk/resource_runtime/mcp_server.py +138 -0
- ksadk/resource_runtime/memory_provider.py +318 -0
- ksadk/resource_runtime/memory_receipts.py +34 -0
- ksadk/resource_runtime/operation_ledger.py +211 -0
- ksadk/resource_runtime/plugin_config.py +48 -0
- ksadk/resource_runtime/policy_authorization.py +54 -0
- ksadk/resource_runtime/process.py +110 -0
- ksadk/resource_runtime/skill_artifacts.py +153 -0
- ksadk/resource_runtime/skill_runtime.py +42 -0
- ksadk/resource_runtime/skill_workspace.py +118 -0
- ksadk/resource_runtime/skills.py +215 -0
- ksadk/resource_runtime/snapshots.py +180 -0
- ksadk/resource_runtime/socket_server.py +103 -0
- ksadk/resource_runtime/supervisor.py +380 -0
- ksadk/resource_runtime/worker.py +504 -0
- ksadk/runners/_langgraph_runner_streams.py +182 -38
- ksadk/runners/_langgraph_state_reader.py +106 -0
- ksadk/runners/_session_identity.py +285 -0
- ksadk/runners/adk_runner.py +166 -63
- ksadk/runners/base_runner.py +29 -1
- ksadk/runners/langgraph_runner.py +542 -195
- ksadk/runners/patch_langchain.py +47 -0
- ksadk/runners/usage_accumulator.py +11 -3
- ksadk/runtime/_runner_adapter/stream_mapping.py +194 -20
- ksadk/runtime/adapter.py +2 -0
- ksadk/runtime/conversation_execution.py +117 -17
- ksadk/runtime/executor.py +87 -3
- ksadk/runtime/factory.py +65 -274
- ksadk/runtime/framework_adapters.py +23 -0
- ksadk/runtime/preprocessing.py +21 -5
- ksadk/runtime/runner_adapter.py +106 -18
- ksadk/runtime/skill_eval_result.py +36 -0
- ksadk/runtime/timing.py +46 -0
- ksadk/runtime/usage.py +49 -18
- ksadk/runtime_context.py +142 -2
- ksadk/sandbox/backends/e2b.py +288 -25
- ksadk/sandbox/backends/local_process.py +72 -39
- ksadk/sandbox/base.py +64 -1
- ksadk/sandbox/diagnostics.py +82 -0
- ksadk/sandbox/e2b_connection.py +66 -0
- ksadk/sandbox/local_controls.py +746 -0
- ksadk/sandbox/local_launcher.py +90 -0
- ksadk/scheduler/dispatcher.py +1 -1
- ksadk/scheduler/sqlite_store.py +18 -0
- ksadk/server/composition.py +2 -0
- ksadk/server/factory.py +5 -0
- ksadk/server/invocation_identity.py +118 -0
- ksadk/server/persistence_capability.py +516 -0
- ksadk/server/routes/common.py +32 -3
- ksadk/server/routes/control.py +271 -52
- ksadk/server/routes/dependencies.py +16 -0
- ksadk/server/routes/kernel_ingress.py +9 -1
- ksadk/server/routes/misc.py +233 -25
- ksadk/server/routes/models.py +47 -4
- ksadk/server/routes/openai_compat.py +76 -13
- ksadk/server/routes/projection.py +252 -12
- ksadk/server/routes/run.py +106 -35
- ksadk/server/routes/sessions.py +491 -138
- ksadk/server/routes/streaming.py +43 -9
- ksadk/server/routes/workspace.py +130 -21
- ksadk/server/static/assets/{ArtifactsPanel-10GPXIJ6.js → ArtifactsPanel-C1YoaKhx.js} +1 -1
- ksadk/server/static/assets/{CodeBlock-BXk1l-G1.js → CodeBlock-DHuAWfr5.js} +10 -7
- ksadk/server/static/assets/MathMessageMarkdown-cvdrBwYr.js +8 -0
- ksadk/server/static/assets/{MermaidBlock--OEYoXIJ.js → MermaidBlock-DeBkbJvI.js} +9 -9
- ksadk/server/static/assets/{NativeTerminalPanel-DrEe1syq.js → NativeTerminalPanel-oJj44_sV.js} +1 -1
- ksadk/server/static/assets/{abnfDiagram-VCTEODGH-eeTFJLvo.js → abnfDiagram-VCTEODGH-Dhfv25o2.js} +1 -1
- ksadk/server/static/assets/{arc-S3ZNbIAd.js → arc-C35w-pn1.js} +1 -1
- ksadk/server/static/assets/architecture-7GRP2DOG-BCsa26zi.js +1 -0
- ksadk/server/static/assets/{architectureDiagram-5GKGNRK7-CRjgEJDX.js → architectureDiagram-5GKGNRK7-FoMY_u6D.js} +1 -1
- ksadk/server/static/assets/{blockDiagram-NRAW4CY4-C7bsBoNH.js → blockDiagram-NRAW4CY4-zD4Rt7oE.js} +1 -1
- ksadk/server/static/assets/{c4Diagram-UCG6FXSJ-BX3c33Ob.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-bZ7ws-8m.js → chunk-5VM5RSS4-C2Ms13_k.js} +1 -1
- ksadk/server/static/assets/{chunk-F27PBJKO-D2r0pvhY.js → chunk-F27PBJKO-BoTj-qgx.js} +1 -1
- ksadk/server/static/assets/{chunk-G27WJ6UU-CZwF3oUP.js → chunk-G27WJ6UU-DOMyyjHH.js} +1 -1
- ksadk/server/static/assets/{chunk-JWPE2WC7-DigFYCML.js → chunk-JWPE2WC7-DbJJqDli.js} +1 -1
- ksadk/server/static/assets/{chunk-LCL6LL3I-CnorGV5q.js → chunk-LCL6LL3I-CLuRCt_W.js} +1 -1
- ksadk/server/static/assets/{chunk-POPQ4Y6H-CexntQA-.js → chunk-POPQ4Y6H-D0Dz847e.js} +1 -1
- ksadk/server/static/assets/{chunk-RHFEMEQ7-CHTC7UxA.js → chunk-RHFEMEQ7-BWSRzEcd.js} +1 -1
- ksadk/server/static/assets/{chunk-SVP7TREG-BC1EWt_-.js → chunk-SVP7TREG-CPoHqkCY.js} +1 -1
- ksadk/server/static/assets/{chunk-XXDRQBXY-BTG24xN0.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-CkonRdAS.js → cose-bilkent-JH36ORCC-LzyWm4m0.js} +1 -1
- ksadk/server/static/assets/cynefin-OW5HDTMX-CNXjFctL.js +1 -0
- ksadk/server/static/assets/{cynefinDiagram-5FMLGOSQ-DEOCBe15.js → cynefinDiagram-5FMLGOSQ-BlW_bHED.js} +1 -1
- ksadk/server/static/assets/{dagre-3AP2YEHR-DBThPuLa.js → dagre-3AP2YEHR-Bu_S86_i.js} +1 -1
- ksadk/server/static/assets/{dagre-ClTPrTht.js → dagre-B7nCawed.js} +1 -1
- ksadk/server/static/assets/{diagram-S7CK7UJ4-DsZHrnpJ.js → diagram-S7CK7UJ4-W_Zow2Km.js} +1 -1
- ksadk/server/static/assets/{diagram-UQ7AKVKN-BJR4nhVr.js → diagram-UQ7AKVKN-CLIKAHON.js} +1 -1
- ksadk/server/static/assets/{diagram-VSXAHHWV-xzcERX0a.js → diagram-VSXAHHWV-Dv6_QAlN.js} +1 -1
- ksadk/server/static/assets/{diagram-VX7I27RA-tn2xM1xu.js → diagram-VX7I27RA-BWAWRDtZ.js} +1 -1
- ksadk/server/static/assets/{diagram-Z3DM3KII-BZPGBkw5.js → diagram-Z3DM3KII-XA_rWMss.js} +1 -1
- ksadk/server/static/assets/dist-0X_j2Rcc.js +1 -0
- ksadk/server/static/assets/{dist-4zN1_tq5.js → dist-1nXCdsej.js} +1 -1
- ksadk/server/static/assets/{dist-M67Hwu0n.js → dist-2vL2sAdF.js} +1 -1
- ksadk/server/static/assets/{dist-BJLUwH6W.js → dist-B3bA05-e.js} +1 -1
- ksadk/server/static/assets/{dist-8VWI-2bZ.js → dist-BLpRy_Yx.js} +1 -1
- ksadk/server/static/assets/{dist-D1V3f1B4.js → dist-BO_UwatH.js} +1 -1
- ksadk/server/static/assets/{dist-Cq4OL6nO.js → dist-BdNFAney.js} +1 -1
- ksadk/server/static/assets/{dist-DfGFrb0v.js → dist-C0J5_3qM.js} +1 -1
- ksadk/server/static/assets/{dist-DyqV4fL4.js → dist-CGt_UGeO.js} +1 -1
- ksadk/server/static/assets/{dist-DjhwGUgZ.js → dist-CIRMvUM4.js} +1 -1
- ksadk/server/static/assets/{dist-B1oWRmrH.js → dist-CIpWk_5f.js} +1 -1
- ksadk/server/static/assets/{dist-CXpH_Rdd.js → dist-CPyieXEf.js} +1 -1
- ksadk/server/static/assets/{dist-Btyo4vX4.js → dist-D-92S-Fd.js} +1 -1
- ksadk/server/static/assets/{dist-u8tVH5Ak.js → dist-DNKuMzWc.js} +1 -1
- ksadk/server/static/assets/{dist-DQAB0qn_.js → dist-DWfdmz9s.js} +2 -2
- ksadk/server/static/assets/{dist-B-46q3Hk.js → dist-DppE_r-D.js} +1 -1
- ksadk/server/static/assets/{dist-C71CsujO.js → dist-DyG6Ya-z.js} +1 -1
- ksadk/server/static/assets/{dist-DJmCPRVB.js → dist-M-SrdhhZ.js} +1 -1
- ksadk/server/static/assets/{dist-Bbwqa8TG.js → dist-mqD5TZup.js} +1 -1
- ksadk/server/static/assets/{dist-BI1qQH4n.js → dist-n3n6t_FO.js} +1 -1
- ksadk/server/static/assets/{dist-DUwKa_l6.js → dist-qe8xjesy.js} +1 -1
- ksadk/server/static/assets/{dist-B0gdk4rl.js → dist-t6MzE0jU.js} +1 -1
- ksadk/server/static/assets/{ebnfDiagram-PWID7BFC-DVfMsLge.js → ebnfDiagram-PWID7BFC-BfCzF1Xi.js} +1 -1
- ksadk/server/static/assets/{erDiagram-SSCWMZ5O-CWEZSYaw.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-TWIxoyYL.js → ganttDiagram-EL5Y4UJY-DDaG1f4_.js} +1 -1
- ksadk/server/static/assets/gitGraph-4MIJSDKK-B-AhYj4C.js +1 -0
- ksadk/server/static/assets/{gitGraphDiagram-WWUBYQGX-DDh2hd2S.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-CgoyWiDR.js → infoDiagram-RXCK75RN-CYMdn6lQ.js} +1 -1
- ksadk/server/static/assets/{ishikawaDiagram-5VMMS53U-CyRIu_om.js → ishikawaDiagram-5VMMS53U-CLHFAD6c.js} +1 -1
- ksadk/server/static/assets/{journeyDiagram-EYS64GPL-DN5JXHzN.js → journeyDiagram-EYS64GPL-BHSKQGAl.js} +1 -1
- ksadk/server/static/assets/{kanban-definition-3QL26DDD-CNP3ui66.js → kanban-definition-3QL26DDD-D5W3tjTT.js} +1 -1
- ksadk/server/static/assets/{katex-DWEzQy1d.js → katex-mtjOi4KM.js} +1 -1
- ksadk/server/static/assets/{linear-C-qHp7d2.js → linear-BETqsxE_.js} +1 -1
- ksadk/server/static/assets/{mermaid-parser.core-Cl-K943T.js → mermaid-parser.core-DPWrvs90.js} +2 -2
- ksadk/server/static/assets/{mindmap-definition-FBJOCRG2-D5DB5mYm.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-BQVc9ia_.js → pegDiagram-XKGWAZYB-GjAPNaqn.js} +1 -1
- ksadk/server/static/assets/pie-WAS4IAKB-DyfxBU7V.js +1 -0
- ksadk/server/static/assets/{pieDiagram-E7YTZNPT-B6UCAvtY.js → pieDiagram-E7YTZNPT-ToIewrqr.js} +1 -1
- ksadk/server/static/assets/{quadrantDiagram-AXDQQJYC-mIr2d3eb.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-Dt3FFDmK.js → railroadDiagram-O6MQD6OU-DKzx4xfv.js} +1 -1
- ksadk/server/static/assets/{requirementDiagram-EFPCY7ZU-Cz_vQtgF.js → requirementDiagram-EFPCY7ZU-CJYljxQS.js} +1 -1
- ksadk/server/static/assets/{sankeyDiagram-P5KCCOFB-wlO1TsH5.js → sankeyDiagram-P5KCCOFB-DLU2fV1w.js} +1 -1
- ksadk/server/static/assets/{sequenceDiagram-WJ2MYXX4-CHRbElYq.js → sequenceDiagram-WJ2MYXX4-CVqysrA9.js} +1 -1
- ksadk/server/static/assets/{sizeCapture-X5ZJPWSS-DXX54iyO.js → sizeCapture-X5ZJPWSS-BUxfmTHc.js} +1 -1
- ksadk/server/static/assets/{stateDiagram-HBIQ2CUA-Dp_lw9II.js → stateDiagram-HBIQ2CUA-CNFgYI9E.js} +1 -1
- ksadk/server/static/assets/stateDiagram-v2-4QOOHH4V-BXAFScz8.js +1 -0
- ksadk/server/static/assets/{swimlanes-XN3QIQJK-D8O5UlLG.js → swimlanes-XN3QIQJK-B6qCMe8N.js} +1 -1
- ksadk/server/static/assets/swimlanesDiagram-VK2B7HYN-uIQ2lJKH.js +8 -0
- ksadk/server/static/assets/{timeline-definition-24CTP7MA-8mfKcxvG.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-EnNl0DE7.js → vennDiagram-4TSXK5OY-BqtUqvXM.js} +1 -1
- ksadk/server/static/assets/wardley-WFR3VGLG-QAt06uEz.js +1 -0
- ksadk/server/static/assets/{wardleyDiagram-VM6X3IG4-DBu5fbYr.js → wardleyDiagram-VM6X3IG4-B5KfDjI-.js} +1 -1
- ksadk/server/static/assets/{xychartDiagram-S5SC5T6Z-BSVXs4IY.js → xychartDiagram-S5SC5T6Z-BaUlSZrn.js} +1 -1
- ksadk/server/static/index.html +2 -2
- ksadk/server/terminal_sessions.py +34 -2
- ksadk/session_context.py +66 -0
- ksadk/sessions/__init__.py +11 -21
- ksadk/sessions/_local_service_sync.py +263 -1
- ksadk/sessions/base.py +176 -0
- ksadk/sessions/errors.py +4 -0
- ksadk/sessions/in_memory.py +309 -19
- ksadk/sessions/invocation_identity.py +235 -0
- ksadk/sessions/local_service.py +83 -1
- ksadk/sessions/persistence.py +275 -0
- ksadk/sessions/postgres_service.py +358 -0
- ksadk/sessions/resilience.py +8 -0
- ksadk/sessions/resilient.py +362 -4
- ksadk/sessions/topology.py +135 -0
- ksadk/skills/__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 +37 -4
- ksadk/skills/observability.py +132 -0
- ksadk/skills/package_store.py +261 -40
- ksadk/skills/runtime/agent.py +67 -9
- ksadk/skills/runtime/artifact_delivery.py +139 -0
- ksadk/skills/runtime/artifacts.py +87 -0
- ksadk/skills/runtime/backends/e2b.py +460 -27
- ksadk/skills/runtime/backends/local.py +629 -62
- ksadk/skills/runtime/base.py +81 -7
- ksadk/skills/runtime/executor.py +268 -1
- ksadk/skills/runtime/loader.py +118 -5
- ksadk/skills/runtime/pinned.py +114 -0
- ksadk/skills/runtime/request.py +49 -0
- ksadk/skills/service_client.py +167 -28
- ksadk/skills/tool_defs.py +108 -3
- ksadk/studio/api.py +810 -93
- ksadk/studio/api_catalog_routes.py +18 -0
- ksadk/studio/api_contracts.py +8 -2
- ksadk/studio/api_plugin_routes.py +562 -104
- ksadk/studio/api_resource_connections.py +221 -0
- ksadk/studio/authoring.py +12 -6
- ksadk/studio/authoring_coordinator.py +23 -16
- ksadk/studio/builder.py +88 -0
- ksadk/studio/capabilities.py +23 -6
- ksadk/studio/channel_connections.py +333 -0
- ksadk/studio/cloud.py +370 -112
- ksadk/studio/cloud_shared_web.py +638 -0
- ksadk/studio/codex_agent_service.py +130 -28
- ksadk/studio/codex_builder.py +242 -3
- ksadk/studio/codex_credentials.py +90 -0
- ksadk/studio/codex_manifest.py +31 -4
- ksadk/studio/codex_plugin_store.py +746 -0
- ksadk/studio/codex_provider_build.py +231 -0
- ksadk/studio/codex_run.py +190 -26
- ksadk/studio/compatibility_report.py +12 -1
- ksadk/studio/compiler.py +88 -14
- ksadk/studio/configuration.py +182 -0
- ksadk/studio/contracts.py +165 -11
- ksadk/studio/dsh_application.py +247 -0
- ksadk/studio/dsh_capability_service.py +1374 -0
- ksadk/studio/dsh_lifecycle.py +58 -0
- ksadk/studio/dsh_models.py +59 -0
- ksadk/studio/dsh_provider_registration.py +367 -21
- 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 +89 -14
- ksadk/studio/kernel_registry.py +418 -0
- ksadk/studio/kernel_sqlite_migration.py +181 -0
- ksadk/studio/mcp_runtime.py +11 -3
- ksadk/studio/model_client.py +1180 -66
- ksadk/studio/model_profile_service.py +26 -11
- ksadk/studio/native_documents.py +172 -0
- ksadk/studio/plugin_composition.py +202 -24
- ksadk/studio/plugin_kernel_adapter.py +21 -106
- ksadk/studio/plugin_lifecycle.py +80 -0
- ksadk/studio/plugin_runtime.py +448 -56
- ksadk/studio/provider_recovery.py +59 -0
- ksadk/studio/recovery_page.py +70 -0
- ksadk/studio/resource_authority.py +664 -0
- ksadk/studio/resource_binding_validation.py +77 -0
- ksadk/studio/resource_build_admission.py +196 -0
- ksadk/studio/resource_build_materializer.py +149 -0
- ksadk/studio/resource_catalog.py +149 -2
- ksadk/studio/resource_connections.py +220 -0
- ksadk/studio/run_activity.py +895 -0
- ksadk/studio/run_documents.py +127 -0
- ksadk/studio/run_service.py +789 -83
- ksadk/studio/runtime_catalog.py +53 -10
- ksadk/studio/runtime_source.py +16 -8
- ksadk/studio/scheduler_assistant.py +317 -0
- ksadk/studio/scheduler_runtime.py +32 -280
- ksadk/studio/scheduler_service.py +3 -0
- ksadk/studio/service.py +861 -120
- ksadk/studio/shared_web.py +579 -82
- 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/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- ksadk/studio/static/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- ksadk/studio/static/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- ksadk/studio/static/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- ksadk/studio/static/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- ksadk/studio/static/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- ksadk/studio/static/assets/MathMessageMarkdown-BesSeCYl-BEOyPC3w.css +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/arc-Pry-7G1_.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/array-BifhSqXX.js +1 -0
- ksadk/studio/static/assets/blockDiagram-I7D4REHJ-CLB4L11u.js +129 -0
- ksadk/studio/static/assets/c4Diagram-7LVT6UL2-BOma_Z_F.js +38 -0
- 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-2Q5K7J3B-C1jixKkw.js +1 -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-DVtDP4rm.js +62 -0
- ksadk/studio/static/assets/chunk-5V3GS4D5-i-ZDOEnP.js +1 -0
- ksadk/studio/static/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -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-CpEZCUgg.js +128 -0
- ksadk/studio/static/assets/chunk-F27PBJKO-D7pvKf0C.js +1 -0
- ksadk/studio/static/assets/chunk-FOHPRMQF-DHwB1DNv.js +161 -0
- ksadk/studio/static/assets/chunk-GMAD6QVW-DE_8H717.js +72 -0
- 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-D38axYOR.js +231 -0
- ksadk/studio/static/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- 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-DiCQjx9b.js +10 -0
- ksadk/studio/static/assets/chunk-OUJLGHUK-D0j2JRSg.js +2 -0
- ksadk/studio/static/assets/chunk-P2QGCYS3-VdhKmfYq.js +1 -0
- 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-DsCFnRVE.js +168 -0
- ksadk/studio/static/assets/chunk-SVP7TREG-DljApgRX.js +88 -0
- ksadk/studio/static/assets/chunk-TICWLB2K-DWqRtyqa.js +206 -0
- 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/chunk-Y2CYZVJY-DsF7k-Jl.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/cytoscape.esm-CGd-uY3x.js +321 -0
- ksadk/studio/static/assets/dagre-GXQ25YYZ-buZBRlwz.js +4 -0
- ksadk/studio/static/assets/dagre-PrKaheQc.js +1 -0
- ksadk/studio/static/assets/defaultLocale-BFoDCU3G.js +1 -0
- ksadk/studio/static/assets/diagram-S7CK7UJ4-C6aH78c4.js +30 -0
- 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/dist-v5Q1xZ2K.js +1 -0
- ksadk/studio/static/assets/ebnfDiagram-PWID7BFC-Daukxwqf.js +1 -0
- ksadk/studio/static/assets/erDiagram-RLTQ6QDP-CGthTMmJ.js +99 -0
- 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/graphlib-DS17s2tU.js +1 -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/init-C-OQMol4.js +1 -0
- ksadk/studio/static/assets/ishikawaDiagram-5VMMS53U-BUGEl8cO.js +70 -0
- ksadk/studio/static/assets/journeyDiagram-3NMN7TZE-Ch2ZYxvr.js +139 -0
- ksadk/studio/static/assets/kanban-definition-UXKFOSKX-Da-Fp4vC.js +89 -0
- ksadk/studio/static/assets/katex-DhON-x74.js +257 -0
- ksadk/studio/static/assets/kingsoft-cloud-BOcLiQ3e.ico +0 -0
- ksadk/studio/static/assets/line-BDaeq300.js +1 -0
- 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-CvlsVQ38.js +96 -0
- ksadk/studio/static/assets/ordinal-BDEzSJ7C.js +1 -0
- ksadk/studio/static/assets/packet-AYTQ26CC-BSJEH9Lb.js +1 -0
- ksadk/studio/static/assets/path-fybaL0A-.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-DlrWiSOv.js +39 -0
- 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-BA3hpUZM.js +7 -0
- 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-E-Ge0FcV.js +84 -0
- ksadk/studio/static/assets/rolldown-runtime-Dy4uBu1J-DK3Fl9T5.js +1 -0
- ksadk/studio/static/assets/rough.esm-Dy-Kn_BL.js +1 -0
- ksadk/studio/static/assets/sankeyDiagram-P5KCCOFB-CA6YKhQ3.js +40 -0
- ksadk/studio/static/assets/sequenceDiagram-WJ2MYXX4-CcElXGg4.js +162 -0
- ksadk/studio/static/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
- 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-CIuYhNy3.js +120 -0
- 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-CMJiaedy.js +78 -0
- ksadk/studio/static/assets/xychartDiagram-S5SC5T6Z-BdgtMvW2.js +7 -0
- 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
- agentengine_sdk_python-0.8.3.dist-info/RECORD +0 -833
- ksadk/server/static/assets/MathMessageMarkdown-D9uB55Oh.js +0 -8
- ksadk/server/static/assets/architecture-7GRP2DOG-Dk9nRQ6-.js +0 -1
- ksadk/server/static/assets/channel-s354Yo6o.js +0 -1
- ksadk/server/static/assets/chunk-2Q5K7J3B-CDpPpKR5.js +0 -1
- ksadk/server/static/assets/classDiagram-DTDB5LWJ-Dd0nucl9.js +0 -1
- ksadk/server/static/assets/classDiagram-v2-JRS7N3AN-Dd0nucl9.js +0 -1
- ksadk/server/static/assets/cynefin-OW5HDTMX-BBlT4uMf.js +0 -1
- ksadk/server/static/assets/dist-DdRBIceA.js +0 -1
- ksadk/server/static/assets/eventmodeling-NTZA5JFV-Dr5okd8V.js +0 -1
- ksadk/server/static/assets/flowDiagram-A5DVABFB-VEO-cVcO.js +0 -1
- ksadk/server/static/assets/gitGraph-4MIJSDKK-CKiKY9Cf.js +0 -1
- ksadk/server/static/assets/index-B2k_urY8.js +0 -241
- ksadk/server/static/assets/index-ILPt6IWF.css +0 -2
- ksadk/server/static/assets/info-A6RAGUB7-ubA4Nm_p.js +0 -1
- ksadk/server/static/assets/packet-AYTQ26CC-C7R3NUlK.js +0 -1
- ksadk/server/static/assets/pie-WAS4IAKB-BIT6qjr3.js +0 -1
- ksadk/server/static/assets/radar-RG4KPBEZ-l5noef9X.js +0 -1
- ksadk/server/static/assets/railroad-74A4TZTK-Baea6ZvM.js +0 -1
- ksadk/server/static/assets/railroad-abnf-HS5TGJTU-OKn8zZnU.js +0 -1
- ksadk/server/static/assets/railroad-ebnf-LZEXJU2U-DdKAKC4l.js +0 -1
- ksadk/server/static/assets/railroad-peg-WCYAUIDC-Bds8udlG.js +0 -1
- ksadk/server/static/assets/stateDiagram-v2-4QOOHH4V-5b-8o2iS.js +0 -1
- ksadk/server/static/assets/swimlanesDiagram-VK2B7HYN-uf6WPRA4.js +0 -8
- ksadk/server/static/assets/treeView-Q6P3EWNA-CK5CSrSO.js +0 -1
- ksadk/server/static/assets/treemap-WGGIJYW6-Ch2BKgAM.js +0 -1
- ksadk/server/static/assets/wardley-WFR3VGLG-YW3Q0ml_.js +0 -1
- ksadk/studio/static/assets/PrismRenderer-IYN-ffww.js +0 -3
- ksadk/studio/static/assets/index-DXs1Eq4M.css +0 -1
- ksadk/studio/static/assets/index-DeDqwTsD.js +0 -283
- {agentengine_sdk_python-0.8.3.dist-info → agentengine_sdk_python-0.8.5.dist-info}/WHEEL +0 -0
- {agentengine_sdk_python-0.8.3.dist-info → agentengine_sdk_python-0.8.5.dist-info}/entry_points.txt +0 -0
- {agentengine_sdk_python-0.8.3.dist-info → agentengine_sdk_python-0.8.5.dist-info}/licenses/LICENSE +0 -0
- {agentengine_sdk_python-0.8.3.dist-info → agentengine_sdk_python-0.8.5.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,884 @@
|
|
|
1
|
+
"""Canonical RuntimeAdapter for the managed KsADK Harness engine.
|
|
2
|
+
|
|
3
|
+
Studio and the platform persist canonical RuntimeEvent v2 values, while the
|
|
4
|
+
managed engine intentionally owns a richer, engine-internal event vocabulary.
|
|
5
|
+
This adapter is the boundary between the two contracts: it keeps the managed
|
|
6
|
+
Agent Loop behind the stable ``runtime_type=harness`` product name and projects
|
|
7
|
+
the execution tree into canonical status items without teaching Studio about
|
|
8
|
+
engine-private Python objects.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Any, AsyncIterator
|
|
16
|
+
|
|
17
|
+
from ksadk.events.canonical import (
|
|
18
|
+
ApprovalRequest,
|
|
19
|
+
ErrorInfo,
|
|
20
|
+
InteractionRequested,
|
|
21
|
+
ItemCompleted,
|
|
22
|
+
ItemStarted,
|
|
23
|
+
ItemUpdated,
|
|
24
|
+
OutputRef,
|
|
25
|
+
RunCanceled,
|
|
26
|
+
RunCompleted,
|
|
27
|
+
RunFailed,
|
|
28
|
+
RunInterrupted,
|
|
29
|
+
RunStarted,
|
|
30
|
+
SourceRef,
|
|
31
|
+
UsageReported,
|
|
32
|
+
)
|
|
33
|
+
from ksadk.events.content import ContentSnapshot, TextContent
|
|
34
|
+
from ksadk.events.identity import stable_event_id, stable_item_id, stable_scope_id
|
|
35
|
+
from ksadk.harness.context_engine import HarnessContextEngine
|
|
36
|
+
from ksadk.harness.engine.langgraph import ManagedLangGraphEngine, memory_checkpointer
|
|
37
|
+
from ksadk.harness.events import EventType
|
|
38
|
+
from ksadk.harness.events import RuntimeEvent as HarnessEvent
|
|
39
|
+
from ksadk.harness.execution_policy import ExecutionPolicy, ExecutionPolicyResolver
|
|
40
|
+
from ksadk.harness.public_activity import tool_public_action
|
|
41
|
+
from ksadk.harness.reasoner import HarnessReasoner
|
|
42
|
+
from ksadk.harness.skill_composition import compose_engine
|
|
43
|
+
from ksadk.harness.spec import HarnessSpec
|
|
44
|
+
from ksadk.kernel.contracts import RuntimeCapability, RuntimeCapabilityMatrix
|
|
45
|
+
from ksadk.kernel.errors import UnsupportedControlError
|
|
46
|
+
from ksadk.runtime import (
|
|
47
|
+
BaseRuntime,
|
|
48
|
+
CancelResult,
|
|
49
|
+
CheckpointCapability,
|
|
50
|
+
CheckpointDescriptor,
|
|
51
|
+
ResumePayload,
|
|
52
|
+
ResumeTarget,
|
|
53
|
+
RunHandle,
|
|
54
|
+
RuntimeAdapter,
|
|
55
|
+
StartRequest,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class ManagedHarnessRuntime(BaseRuntime):
|
|
60
|
+
runtime_type = "harness"
|
|
61
|
+
|
|
62
|
+
def __init__(self, *, durable: bool = False) -> None:
|
|
63
|
+
self._durable = durable
|
|
64
|
+
|
|
65
|
+
def native_capabilities(self) -> dict[str, Any]:
|
|
66
|
+
return {
|
|
67
|
+
"cancel": {"supported": True},
|
|
68
|
+
"resume": {"supported": True},
|
|
69
|
+
"checkpoint": {"supported": True, "granularity": "snapshot"},
|
|
70
|
+
"session_continuity": {
|
|
71
|
+
"durable": self._durable,
|
|
72
|
+
"scope": "workspace" if self._durable else "process",
|
|
73
|
+
},
|
|
74
|
+
"progressive_disclosure": {"skill": True, "mcp": True},
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class ManagedHarnessRuntimeAdapter(RuntimeAdapter):
|
|
79
|
+
"""Expose :class:`ManagedLangGraphEngine` through the platform adapter API."""
|
|
80
|
+
|
|
81
|
+
def __init__(
|
|
82
|
+
self,
|
|
83
|
+
spec: HarnessSpec,
|
|
84
|
+
*,
|
|
85
|
+
reasoner: HarnessReasoner | None = None,
|
|
86
|
+
workspace_root: str | Path = ".",
|
|
87
|
+
engine: ManagedLangGraphEngine | None = None,
|
|
88
|
+
durable: bool = False,
|
|
89
|
+
shared_across_pods: bool = False,
|
|
90
|
+
execution_policy_resolver: ExecutionPolicyResolver | None = None,
|
|
91
|
+
) -> None:
|
|
92
|
+
super().__init__(ManagedHarnessRuntime(durable=durable))
|
|
93
|
+
self._spec = spec
|
|
94
|
+
self._workspace_root = Path(workspace_root)
|
|
95
|
+
self._durable = durable
|
|
96
|
+
self._shared_across_pods = shared_across_pods
|
|
97
|
+
self._execution_policy_resolver = execution_policy_resolver
|
|
98
|
+
self._engine = engine or compose_engine(
|
|
99
|
+
spec,
|
|
100
|
+
reasoner=reasoner,
|
|
101
|
+
checkpointer=memory_checkpointer(),
|
|
102
|
+
context_engine=HarnessContextEngine(),
|
|
103
|
+
)
|
|
104
|
+
self._compiled: Any | None = None
|
|
105
|
+
self._external_handles: dict[str, RunHandle] = {}
|
|
106
|
+
#: 由装配层注入(持久 Checkpoint 分档时非空);为空则不持久化 Handle。
|
|
107
|
+
self._run_store: Any | None = None
|
|
108
|
+
|
|
109
|
+
def capabilities(self) -> RuntimeCapabilityMatrix:
|
|
110
|
+
return managed_harness_capabilities(
|
|
111
|
+
durable=self._durable,
|
|
112
|
+
execution_policy=self._execution_policy_resolver is not None,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
async def _policy_options(self, request: StartRequest) -> dict[str, Any]:
|
|
116
|
+
ref = request.metadata.get("execution_policy_ref")
|
|
117
|
+
if ref is None:
|
|
118
|
+
return {}
|
|
119
|
+
if not isinstance(ref, str) or not ref.strip():
|
|
120
|
+
raise ValueError("execution_policy_ref must be a non-empty host reference")
|
|
121
|
+
if self._execution_policy_resolver is None:
|
|
122
|
+
raise UnsupportedControlError("execution policy requires a trusted host resolver")
|
|
123
|
+
policy = await self._execution_policy_resolver.resolve(ref, request=request)
|
|
124
|
+
if not isinstance(policy, ExecutionPolicy):
|
|
125
|
+
raise TypeError("host resolver must return ExecutionPolicy")
|
|
126
|
+
return {
|
|
127
|
+
"execution_policy": policy,
|
|
128
|
+
"execution_policy_resolver": self._execution_policy_resolver,
|
|
129
|
+
"execution_policy_request": request,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
def _persist_durable_handle(
|
|
133
|
+
self,
|
|
134
|
+
handle: RunHandle,
|
|
135
|
+
status: str = "running",
|
|
136
|
+
*,
|
|
137
|
+
terminal: bool = False,
|
|
138
|
+
) -> None:
|
|
139
|
+
if self._run_store is None:
|
|
140
|
+
return
|
|
141
|
+
runs, handles = self._run_store.load()
|
|
142
|
+
runs[handle.run_id] = {"runId": handle.run_id, "status": status}
|
|
143
|
+
if terminal:
|
|
144
|
+
handles.pop(handle.run_id, None)
|
|
145
|
+
else:
|
|
146
|
+
handles[handle.run_id] = handle
|
|
147
|
+
self._run_store.save(runs, handles)
|
|
148
|
+
|
|
149
|
+
async def attach(self, handle: RunHandle) -> RunHandle:
|
|
150
|
+
"""Attach a persisted platform handle to the durable LangGraph thread."""
|
|
151
|
+
|
|
152
|
+
if not self._durable:
|
|
153
|
+
raise UnsupportedControlError(
|
|
154
|
+
f"managed Harness run {handle.run_id!r} has no durable checkpoint backend"
|
|
155
|
+
)
|
|
156
|
+
if handle.runtime_type != "harness":
|
|
157
|
+
raise ValueError(f"managed Harness cannot attach {handle.runtime_type!r} handle")
|
|
158
|
+
request = StartRequest(
|
|
159
|
+
input="", user_id=str(handle.native_ref.get("user_id") or "unknown"),
|
|
160
|
+
session_id=handle.session_id, agent_id=handle.native_ref.get("agent_id"),
|
|
161
|
+
metadata={
|
|
162
|
+
"invocation_id": handle.run_id,
|
|
163
|
+
**({"execution_policy_ref": handle.native_ref["execution_policy_ref"]}
|
|
164
|
+
if "execution_policy_ref" in handle.native_ref else {}),
|
|
165
|
+
},
|
|
166
|
+
)
|
|
167
|
+
options = await self._policy_options(request)
|
|
168
|
+
if handle.run_id in self._external_handles:
|
|
169
|
+
return handle
|
|
170
|
+
compiled = await self._ensure_compiled()
|
|
171
|
+
internal_handle = handle.model_copy(update={"runtime_type": "managed-langgraph"})
|
|
172
|
+
internal = await self._engine.attach(internal_handle, compiled, **options)
|
|
173
|
+
self._external_handles[handle.run_id] = internal
|
|
174
|
+
return handle
|
|
175
|
+
|
|
176
|
+
async def durable_restore(self, handle: RunHandle) -> RunHandle:
|
|
177
|
+
"""Restore a persisted handle and continue non-interactive checkpoints.
|
|
178
|
+
|
|
179
|
+
Approval checkpoints deliberately remain ``awaiting_approval`` so the
|
|
180
|
+
Kernel can route the later interaction to the newly attached adapter.
|
|
181
|
+
A process crash during ordinary graph execution is reconstructed as a
|
|
182
|
+
paused checkpoint and must resume automatically; otherwise attach
|
|
183
|
+
succeeds but the durable Run remains open forever.
|
|
184
|
+
"""
|
|
185
|
+
|
|
186
|
+
restored = await self.attach(handle)
|
|
187
|
+
internal = self._internal_handle(restored)
|
|
188
|
+
state = await self._engine.snapshot_state(internal)
|
|
189
|
+
status = str(getattr(getattr(state, "status", None), "value", ""))
|
|
190
|
+
if status == "paused":
|
|
191
|
+
await self._engine.resume(
|
|
192
|
+
internal,
|
|
193
|
+
ResumeTarget(
|
|
194
|
+
kind="checkpoint_id",
|
|
195
|
+
id=str(internal.native_ref.get("thread_id") or internal.run_id),
|
|
196
|
+
),
|
|
197
|
+
None,
|
|
198
|
+
)
|
|
199
|
+
return restored
|
|
200
|
+
|
|
201
|
+
@property
|
|
202
|
+
def harness_spec(self) -> HarnessSpec:
|
|
203
|
+
return self._spec
|
|
204
|
+
|
|
205
|
+
async def preflight(self) -> None:
|
|
206
|
+
await self._ensure_compiled()
|
|
207
|
+
|
|
208
|
+
async def start(self, request: StartRequest) -> RunHandle:
|
|
209
|
+
compiled = await self._ensure_compiled()
|
|
210
|
+
conversation = request.conversation_preprocessing()
|
|
211
|
+
metadata = dict(request.metadata)
|
|
212
|
+
# 回合级审批档位(composer 完全访问/严格/询问)放在 config 里,
|
|
213
|
+
# 挪进 metadata 让 policy_runtime.configure_run 能按它调整审批面。
|
|
214
|
+
approval_mode = str((request.config or {}).get("tool_approval_mode") or "")
|
|
215
|
+
if approval_mode:
|
|
216
|
+
metadata["tool_approval_mode"] = approval_mode
|
|
217
|
+
if conversation is not None and conversation.messages:
|
|
218
|
+
metadata["conversation_history"] = [dict(item) for item in conversation.messages]
|
|
219
|
+
# Studio 的 Agent 合同给出 max_input_tokens + reserve_output_tokens,
|
|
220
|
+
# ContextEngine 需要完整窗口才能避免退回 32K 安全默认值。该值只作为
|
|
221
|
+
# 本次运行的模型窗口来源,不改变不可变 HarnessSpec。
|
|
222
|
+
if not metadata.get("context_window_tokens"):
|
|
223
|
+
max_input = _positive_int(request.config.get("max_input_tokens"))
|
|
224
|
+
reserve_output = _positive_int(request.config.get("reserve_output_tokens")) or 0
|
|
225
|
+
if max_input is not None:
|
|
226
|
+
metadata["context_window_tokens"] = max_input + reserve_output
|
|
227
|
+
internal_request = request.model_copy(update={"metadata": metadata})
|
|
228
|
+
options = await self._policy_options(internal_request)
|
|
229
|
+
# 始终把请求传给 configure_run:回合级 tool_approval_mode 在那里
|
|
230
|
+
# 覆盖静态审批面(execution_policy_request 仅在有 policy 时传)。
|
|
231
|
+
options.setdefault("execution_policy_request", internal_request)
|
|
232
|
+
internal = await self._engine.start(internal_request, compiled, **options)
|
|
233
|
+
external = internal.model_copy(update={"runtime_type": "harness"})
|
|
234
|
+
self._external_handles[external.run_id] = internal
|
|
235
|
+
self._persist_durable_handle(external)
|
|
236
|
+
return external
|
|
237
|
+
|
|
238
|
+
def stream(self, handle: RunHandle) -> AsyncIterator[Any]:
|
|
239
|
+
return self._stream(handle)
|
|
240
|
+
|
|
241
|
+
async def _stream(self, handle: RunHandle) -> AsyncIterator[Any]:
|
|
242
|
+
internal = self._internal_handle(handle)
|
|
243
|
+
async for event in self._engine.stream(internal):
|
|
244
|
+
rich = event.to_v2()
|
|
245
|
+
if not rich.parent_run_id:
|
|
246
|
+
terminal_status = {
|
|
247
|
+
EventType.RUN_COMPLETED: "completed",
|
|
248
|
+
EventType.RUN_FAILED: "failed",
|
|
249
|
+
EventType.RUN_CANCELED: "canceled",
|
|
250
|
+
}.get(rich.event_type)
|
|
251
|
+
if terminal_status is not None:
|
|
252
|
+
# A terminal checkpoint must not remain eligible for cold
|
|
253
|
+
# attach. Persist before yielding so a consumer that stops
|
|
254
|
+
# at the terminal event cannot leave a stale live handle.
|
|
255
|
+
self._persist_durable_handle(
|
|
256
|
+
handle,
|
|
257
|
+
terminal_status,
|
|
258
|
+
terminal=True,
|
|
259
|
+
)
|
|
260
|
+
for projected in _project_event(event):
|
|
261
|
+
yield projected
|
|
262
|
+
|
|
263
|
+
async def cancel(self, handle: RunHandle) -> CancelResult:
|
|
264
|
+
result = await self._engine.cancel(self._internal_handle(handle))
|
|
265
|
+
if result is CancelResult.INTERRUPTED_ACTIVE_TURN:
|
|
266
|
+
self._persist_durable_handle(handle, "canceled", terminal=True)
|
|
267
|
+
elif result is CancelResult.PENDING_CANCEL_RECORDED:
|
|
268
|
+
self._persist_durable_handle(handle, "cancel_requested")
|
|
269
|
+
return result
|
|
270
|
+
|
|
271
|
+
async def resume(
|
|
272
|
+
self,
|
|
273
|
+
handle: RunHandle,
|
|
274
|
+
target: ResumeTarget,
|
|
275
|
+
payload: ResumePayload | None,
|
|
276
|
+
) -> RunHandle:
|
|
277
|
+
if payload is not None and payload.kind == "approval_decision":
|
|
278
|
+
decision = payload.data
|
|
279
|
+
if isinstance(decision, dict):
|
|
280
|
+
decision = decision.get("decision")
|
|
281
|
+
# Studio submits action-shaped data; the loop consumes a decision
|
|
282
|
+
# string. Unknown/missing decisions never become an approval.
|
|
283
|
+
normalized = {
|
|
284
|
+
"approve": "approved",
|
|
285
|
+
"approved": "approved",
|
|
286
|
+
"reject": "denied",
|
|
287
|
+
"rejected": "denied",
|
|
288
|
+
"deny": "denied",
|
|
289
|
+
"denied": "denied",
|
|
290
|
+
"cancel": "denied",
|
|
291
|
+
"canceled": "denied",
|
|
292
|
+
}.get(decision if isinstance(decision, str) else "", "denied")
|
|
293
|
+
payload = payload.model_copy(update={"data": normalized})
|
|
294
|
+
internal = await self._engine.resume(self._internal_handle(handle), target, payload)
|
|
295
|
+
external = internal.model_copy(update={"runtime_type": "harness"})
|
|
296
|
+
self._external_handles[external.run_id] = internal
|
|
297
|
+
return external
|
|
298
|
+
|
|
299
|
+
async def checkpoint(self, handle: RunHandle) -> CheckpointDescriptor:
|
|
300
|
+
internal = self._internal_handle(handle)
|
|
301
|
+
state = await self._engine.snapshot_state(internal)
|
|
302
|
+
return CheckpointDescriptor(
|
|
303
|
+
checkpoint_id=str(internal.native_ref.get("thread_id") or internal.run_id),
|
|
304
|
+
invocation_id=internal.run_id,
|
|
305
|
+
capability=CheckpointCapability(
|
|
306
|
+
supported=True,
|
|
307
|
+
granularity="snapshot",
|
|
308
|
+
rollback_scope="invocation",
|
|
309
|
+
fork_supported=False,
|
|
310
|
+
durable=self._durable,
|
|
311
|
+
shared_across_pods=self._shared_across_pods,
|
|
312
|
+
reason=(
|
|
313
|
+
"Managed Harness uses a durable LangGraph checkpointer"
|
|
314
|
+
if self._durable
|
|
315
|
+
else "Managed Harness uses an in-process LangGraph checkpointer"
|
|
316
|
+
),
|
|
317
|
+
),
|
|
318
|
+
ref={"status": state.status.value if state is not None else "unknown"},
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
async def close(self, handle: RunHandle) -> None:
|
|
322
|
+
internal = self._external_handles.pop(handle.run_id, None)
|
|
323
|
+
if internal is not None:
|
|
324
|
+
await self._engine.close(internal)
|
|
325
|
+
|
|
326
|
+
def is_handle_attached(self, handle: RunHandle) -> bool:
|
|
327
|
+
internal = self._external_handles.get(handle.run_id)
|
|
328
|
+
return internal is not None and self._engine.is_handle_attached(internal)
|
|
329
|
+
|
|
330
|
+
async def _ensure_compiled(self) -> Any:
|
|
331
|
+
if self._compiled is None:
|
|
332
|
+
self._compiled = await self._engine.compile(self._spec)
|
|
333
|
+
return self._compiled
|
|
334
|
+
|
|
335
|
+
def _internal_handle(self, handle: RunHandle) -> RunHandle:
|
|
336
|
+
if handle.runtime_type != "harness":
|
|
337
|
+
raise ValueError(f"managed Harness cannot use {handle.runtime_type!r} handle")
|
|
338
|
+
try:
|
|
339
|
+
return self._external_handles[handle.run_id]
|
|
340
|
+
except KeyError:
|
|
341
|
+
raise KeyError(f"unknown managed Harness run: {handle.run_id}") from None
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
def _project_event(event: HarnessEvent) -> list[Any]:
|
|
345
|
+
"""Project one rich Harness event to one or more canonical v2 events."""
|
|
346
|
+
|
|
347
|
+
rich = event.to_v2()
|
|
348
|
+
native_run_id = str(rich.run_id or rich.invocation_id)
|
|
349
|
+
run_id = str(rich.invocation_id if rich.parent_run_id else native_run_id)
|
|
350
|
+
scope_id = stable_scope_id("ksadk", native_run_id, str(rich.scope_id or rich.agent_id))
|
|
351
|
+
source = SourceRef(
|
|
352
|
+
framework="ksadk",
|
|
353
|
+
native_event_id=rich.event_id,
|
|
354
|
+
native_run_id=native_run_id,
|
|
355
|
+
metadata={
|
|
356
|
+
"native_event_type": rich.event_type,
|
|
357
|
+
"agent_id": rich.agent_id,
|
|
358
|
+
"session_id": rich.session_id,
|
|
359
|
+
**({"phase": rich.phase} if rich.phase else {}),
|
|
360
|
+
**({"parent_run_id": rich.parent_run_id} if rich.parent_run_id else {}),
|
|
361
|
+
},
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
def envelope(event_type: str, item_id: str, part_id: str, ordinal: int = 0) -> dict[str, Any]:
|
|
365
|
+
return {
|
|
366
|
+
"schema_version": 2,
|
|
367
|
+
"event_id": stable_event_id(
|
|
368
|
+
"ksadk", scope_id, item_id, event_type, part_id, rich.event_id, ordinal
|
|
369
|
+
),
|
|
370
|
+
"seq": rich.seq_id * 10 + ordinal,
|
|
371
|
+
"timestamp": rich.timestamp,
|
|
372
|
+
"run_id": run_id,
|
|
373
|
+
"scope_id": scope_id,
|
|
374
|
+
"parent_scope_id": (
|
|
375
|
+
stable_scope_id("ksadk", run_id, rich.parent_scope_id)
|
|
376
|
+
if rich.parent_scope_id
|
|
377
|
+
else None
|
|
378
|
+
),
|
|
379
|
+
"source": source,
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
def status_projection(details: dict[str, Any] | None = None) -> list[Any]:
|
|
383
|
+
"""Keep internal evidence in the canonical trace, not the chat timeline."""
|
|
384
|
+
item_id = stable_item_id("ksadk", run_id, "status", rich.event_id)
|
|
385
|
+
part_id = "status-0"
|
|
386
|
+
text = json.dumps(
|
|
387
|
+
{"event": rich.event_type, "details": rich.payload if details is None else details},
|
|
388
|
+
ensure_ascii=False,
|
|
389
|
+
separators=(",", ":"),
|
|
390
|
+
default=str,
|
|
391
|
+
)
|
|
392
|
+
snapshot = ContentSnapshot(parts=(TextContent(part_id=part_id, text=text),))
|
|
393
|
+
return [
|
|
394
|
+
ItemCompleted(
|
|
395
|
+
**envelope("item.completed", item_id, part_id),
|
|
396
|
+
item_id=item_id,
|
|
397
|
+
item_kind="status",
|
|
398
|
+
snapshot=snapshot,
|
|
399
|
+
)
|
|
400
|
+
]
|
|
401
|
+
|
|
402
|
+
run_item = stable_item_id("ksadk", run_id, "$run")
|
|
403
|
+
payload = rich.payload
|
|
404
|
+
if rich.parent_run_id and rich.event_type in {
|
|
405
|
+
EventType.RUN_STARTED, EventType.RUN_COMPLETED, EventType.RUN_FAILED,
|
|
406
|
+
EventType.RUN_CANCELED, EventType.RUN_INTERRUPTED, EventType.APPROVAL_REQUESTED,
|
|
407
|
+
EventType.TEXT_DELTA, EventType.TEXT_COMPLETED, EventType.REASONING_DELTA,
|
|
408
|
+
EventType.MODEL_CALL_FAILED,
|
|
409
|
+
}:
|
|
410
|
+
return status_projection()
|
|
411
|
+
if rich.event_type == EventType.RUN_STARTED:
|
|
412
|
+
return [RunStarted(**envelope("run.started", run_item, "run"), status="running")]
|
|
413
|
+
if rich.event_type == EventType.RUN_COMPLETED:
|
|
414
|
+
message_id = stable_item_id("ksadk", run_id, "message", "final")
|
|
415
|
+
return [
|
|
416
|
+
RunCompleted(
|
|
417
|
+
**envelope("run.completed", run_item, "run"),
|
|
418
|
+
status="completed",
|
|
419
|
+
output_refs=(OutputRef(scope_id=scope_id, item_id=message_id),),
|
|
420
|
+
)
|
|
421
|
+
]
|
|
422
|
+
if rich.event_type == EventType.RUN_FAILED:
|
|
423
|
+
return [
|
|
424
|
+
RunFailed(
|
|
425
|
+
**envelope("run.failed", run_item, "run"),
|
|
426
|
+
status="failed",
|
|
427
|
+
error=ErrorInfo(
|
|
428
|
+
code="HARNESS_EXECUTION_FAILED",
|
|
429
|
+
message=str(payload.get("error") or "Managed Harness run failed"),
|
|
430
|
+
source="ksadk.harness.managed",
|
|
431
|
+
scope_id=scope_id,
|
|
432
|
+
),
|
|
433
|
+
)
|
|
434
|
+
]
|
|
435
|
+
if rich.event_type == EventType.RUN_CANCELED:
|
|
436
|
+
return [
|
|
437
|
+
RunCanceled(
|
|
438
|
+
**envelope("run.canceled", run_item, "run"),
|
|
439
|
+
status="canceled",
|
|
440
|
+
reason=str(payload.get("reason") or payload.get("status") or "canceled"),
|
|
441
|
+
)
|
|
442
|
+
]
|
|
443
|
+
if rich.event_type == EventType.RUN_INTERRUPTED:
|
|
444
|
+
return [
|
|
445
|
+
RunInterrupted(
|
|
446
|
+
**envelope("run.interrupted", run_item, "run"),
|
|
447
|
+
status="interrupted",
|
|
448
|
+
reason=str(payload.get("reason") or "harness_interrupted"),
|
|
449
|
+
interaction_id=(
|
|
450
|
+
str(payload.get("approval_id") or f"ap-{run_id}")
|
|
451
|
+
if payload.get("reason") == "tool_approval"
|
|
452
|
+
else None
|
|
453
|
+
),
|
|
454
|
+
)
|
|
455
|
+
]
|
|
456
|
+
# Provider reasoning is retained as trace evidence but is not a stable or
|
|
457
|
+
# user-oriented progress contract. Exposing every model turn creates noisy
|
|
458
|
+
# "thought" cards and may reveal private reasoning. Chat progress comes
|
|
459
|
+
# exclusively from the compact RUN_PROGRESS events below.
|
|
460
|
+
if rich.event_type in {EventType.REASONING_DELTA, EventType.REASONING_COMPLETED}:
|
|
461
|
+
return status_projection()
|
|
462
|
+
# Public commentary is rendered by Studio's chronological activity
|
|
463
|
+
# projection. Keeping it as a canonical status fact prevents the shared
|
|
464
|
+
# chat reducer from concatenating every checkpoint into the final answer.
|
|
465
|
+
# The final-answer text remains a normal message item below.
|
|
466
|
+
if rich.event_type == EventType.TEXT_COMPLETED and rich.phase == "commentary":
|
|
467
|
+
return status_projection({"text": str(payload.get("text") or "")})
|
|
468
|
+
if rich.event_type == EventType.MODEL_CALL_FAILED:
|
|
469
|
+
if payload.get("action") != "retry_same_model":
|
|
470
|
+
return status_projection()
|
|
471
|
+
return _public_activity_items(
|
|
472
|
+
rich=rich,
|
|
473
|
+
run_id=run_id,
|
|
474
|
+
scope_id=scope_id,
|
|
475
|
+
source=source,
|
|
476
|
+
envelope=envelope,
|
|
477
|
+
key=f"provider-retry-{payload.get('attempt') or rich.event_id}",
|
|
478
|
+
summary=_provider_retry_text(payload),
|
|
479
|
+
completed=True,
|
|
480
|
+
)
|
|
481
|
+
# A child Run's text is an input to the parent, not a second assistant
|
|
482
|
+
# answer. Keep it inspectable without rendering it in the parent chat.
|
|
483
|
+
if rich.parent_scope_id and rich.event_type in {
|
|
484
|
+
EventType.TEXT_DELTA,
|
|
485
|
+
EventType.TEXT_COMPLETED,
|
|
486
|
+
}:
|
|
487
|
+
return status_projection()
|
|
488
|
+
if rich.event_type == EventType.RUN_PROGRESS:
|
|
489
|
+
# Child lifecycle transitions remain available in Trace, but showing
|
|
490
|
+
# accepted/running/completed as separate chat rows duplicates the
|
|
491
|
+
# aggregate delegation card and makes parallel work unreadable.
|
|
492
|
+
if payload.get("kind") in {"delegation.route", "subagent.event"}:
|
|
493
|
+
return status_projection()
|
|
494
|
+
kind = str(payload.get("kind") or "")
|
|
495
|
+
if kind == "provider.retry":
|
|
496
|
+
return _public_activity_items(
|
|
497
|
+
rich=rich,
|
|
498
|
+
run_id=run_id,
|
|
499
|
+
scope_id=scope_id,
|
|
500
|
+
source=source,
|
|
501
|
+
envelope=envelope,
|
|
502
|
+
key=f"provider-retry-{rich.event_id}",
|
|
503
|
+
summary=_provider_retry_text(payload),
|
|
504
|
+
completed=True,
|
|
505
|
+
)
|
|
506
|
+
if kind == "delegation.batch":
|
|
507
|
+
status = str(payload.get("status") or "running")
|
|
508
|
+
# One quiet line stays visible; responsibility details live in an
|
|
509
|
+
# expandable reasoning-style card. The content is a public
|
|
510
|
+
# activity summary, never provider chain-of-thought.
|
|
511
|
+
summary = _delegation_summary(payload)
|
|
512
|
+
detail = _delegation_detail(payload)
|
|
513
|
+
return [
|
|
514
|
+
*_public_activity_items(
|
|
515
|
+
rich=rich,
|
|
516
|
+
run_id=run_id,
|
|
517
|
+
scope_id=scope_id,
|
|
518
|
+
source=source,
|
|
519
|
+
envelope=envelope,
|
|
520
|
+
key="delegation-summary",
|
|
521
|
+
summary=summary,
|
|
522
|
+
completed=status != "running",
|
|
523
|
+
existing=status != "running",
|
|
524
|
+
),
|
|
525
|
+
*_public_activity_items(
|
|
526
|
+
rich=rich,
|
|
527
|
+
run_id=run_id,
|
|
528
|
+
scope_id=scope_id,
|
|
529
|
+
source=source,
|
|
530
|
+
envelope=envelope,
|
|
531
|
+
key="delegation-detail",
|
|
532
|
+
summary=detail,
|
|
533
|
+
completed=status != "running",
|
|
534
|
+
item_kind="reasoning",
|
|
535
|
+
existing=status != "running",
|
|
536
|
+
),
|
|
537
|
+
]
|
|
538
|
+
progress_completed = str(payload.get("status") or "running") != "running"
|
|
539
|
+
progress_key = (
|
|
540
|
+
f"tool-activity-{payload.get('batch_id') or rich.event_id}"
|
|
541
|
+
if kind == "tool.batch"
|
|
542
|
+
else rich.event_id
|
|
543
|
+
)
|
|
544
|
+
return _public_activity_items(
|
|
545
|
+
rich=rich,
|
|
546
|
+
run_id=run_id,
|
|
547
|
+
scope_id=scope_id,
|
|
548
|
+
source=source,
|
|
549
|
+
envelope=envelope,
|
|
550
|
+
key=progress_key,
|
|
551
|
+
summary=_progress_text(payload),
|
|
552
|
+
completed=progress_completed,
|
|
553
|
+
existing=kind == "tool.batch" and progress_completed,
|
|
554
|
+
)
|
|
555
|
+
if rich.event_type == EventType.USAGE_REPORTED:
|
|
556
|
+
input_tokens = max(0, int(payload.get("input_tokens") or 0))
|
|
557
|
+
output_tokens = max(0, int(payload.get("output_tokens") or 0))
|
|
558
|
+
return [
|
|
559
|
+
UsageReported(
|
|
560
|
+
**envelope("usage.reported", run_item, "usage"),
|
|
561
|
+
input_tokens=input_tokens,
|
|
562
|
+
output_tokens=output_tokens,
|
|
563
|
+
total_tokens=input_tokens + output_tokens,
|
|
564
|
+
cached_tokens=max(0, int(payload.get("cached_tokens") or 0)),
|
|
565
|
+
reasoning_tokens=max(0, int(payload.get("reasoning_tokens") or 0)),
|
|
566
|
+
)
|
|
567
|
+
]
|
|
568
|
+
if rich.event_type == EventType.APPROVAL_REQUESTED:
|
|
569
|
+
interaction_id = str(payload.get("approval_id") or f"ap-{run_id}")
|
|
570
|
+
return [
|
|
571
|
+
InteractionRequested(
|
|
572
|
+
**envelope("interaction.requested", interaction_id, "approval"),
|
|
573
|
+
interaction_id=interaction_id,
|
|
574
|
+
interaction_kind="approval",
|
|
575
|
+
request=ApprovalRequest(
|
|
576
|
+
call_id=str(payload.get("call_id") or "") or None,
|
|
577
|
+
kind=str(payload.get("kind") or "tool"),
|
|
578
|
+
detail=_public_approval_detail(payload.get("detail")),
|
|
579
|
+
),
|
|
580
|
+
)
|
|
581
|
+
]
|
|
582
|
+
if rich.event_type in {EventType.TEXT_COMPLETED, EventType.REASONING_COMPLETED}:
|
|
583
|
+
kind = "message" if rich.event_type == EventType.TEXT_COMPLETED else "reasoning"
|
|
584
|
+
phase = str(rich.phase or ("final_answer" if kind == "message" else "commentary"))
|
|
585
|
+
item_id = (
|
|
586
|
+
stable_item_id("ksadk", run_id, "message", "final")
|
|
587
|
+
if kind == "message" and phase == "final_answer"
|
|
588
|
+
else stable_item_id("ksadk", run_id, kind, rich.event_id)
|
|
589
|
+
)
|
|
590
|
+
part_id = "text-0"
|
|
591
|
+
text = str(payload.get("text") or payload.get("summary") or "")
|
|
592
|
+
content = ContentSnapshot(parts=(TextContent(part_id=part_id, text=text),))
|
|
593
|
+
if payload.get("streamed"):
|
|
594
|
+
return [
|
|
595
|
+
ItemCompleted(
|
|
596
|
+
**envelope("item.completed", item_id, part_id, 1),
|
|
597
|
+
item_id=item_id,
|
|
598
|
+
item_kind=kind,
|
|
599
|
+
snapshot=content,
|
|
600
|
+
)
|
|
601
|
+
]
|
|
602
|
+
return [
|
|
603
|
+
ItemStarted(
|
|
604
|
+
**envelope("item.started", item_id, part_id, 0),
|
|
605
|
+
item_id=item_id,
|
|
606
|
+
item_kind=kind,
|
|
607
|
+
phase=phase,
|
|
608
|
+
initial=None,
|
|
609
|
+
),
|
|
610
|
+
ItemCompleted(
|
|
611
|
+
**envelope("item.completed", item_id, part_id, 1),
|
|
612
|
+
item_id=item_id,
|
|
613
|
+
item_kind=kind,
|
|
614
|
+
snapshot=content,
|
|
615
|
+
),
|
|
616
|
+
]
|
|
617
|
+
if rich.event_type in {EventType.TEXT_DELTA, EventType.REASONING_DELTA}:
|
|
618
|
+
kind = "message" if rich.event_type == EventType.TEXT_DELTA else "reasoning"
|
|
619
|
+
phase = str(rich.phase or ("final_answer" if kind == "message" else "commentary"))
|
|
620
|
+
item_id = (
|
|
621
|
+
stable_item_id("ksadk", native_run_id, "message", "final")
|
|
622
|
+
if kind == "message" and phase == "final_answer"
|
|
623
|
+
else stable_item_id("ksadk", run_id, kind, "stream")
|
|
624
|
+
)
|
|
625
|
+
part_id = "text-0"
|
|
626
|
+
text = str(payload.get("text") or "")
|
|
627
|
+
update = TextContent(part_id=part_id, text=text)
|
|
628
|
+
if int(payload.get("delta_index") or 0) == 0:
|
|
629
|
+
return [
|
|
630
|
+
ItemStarted(
|
|
631
|
+
**envelope("item.started", item_id, part_id, 0),
|
|
632
|
+
item_id=item_id,
|
|
633
|
+
item_kind=kind,
|
|
634
|
+
phase=phase,
|
|
635
|
+
initial=ContentSnapshot(parts=(update,)),
|
|
636
|
+
)
|
|
637
|
+
]
|
|
638
|
+
return [
|
|
639
|
+
ItemUpdated(
|
|
640
|
+
**envelope("item.updated", item_id, part_id, int(payload.get("delta_index") or 0)),
|
|
641
|
+
item_id=item_id,
|
|
642
|
+
item_kind=kind,
|
|
643
|
+
op="append",
|
|
644
|
+
update=update,
|
|
645
|
+
)
|
|
646
|
+
]
|
|
647
|
+
if rich.event_type in {EventType.TOOL_CALL_BEGIN, EventType.TOOL_CALL_END}:
|
|
648
|
+
# Arguments, results and receipts remain in the canonical Trace. The
|
|
649
|
+
# conversation receives the corresponding human-readable tool.batch
|
|
650
|
+
# progress item, avoiding duplicate technical cards and configuration-
|
|
651
|
+
# shaped payloads in the user-facing activity stream.
|
|
652
|
+
action = tool_public_action(payload)
|
|
653
|
+
return status_projection(
|
|
654
|
+
{
|
|
655
|
+
"name": str(payload.get("name") or "tool"),
|
|
656
|
+
"call_id": str(payload.get("call_id") or rich.event_id),
|
|
657
|
+
**({"public_action": action} if action else {}),
|
|
658
|
+
"status": (
|
|
659
|
+
"started"
|
|
660
|
+
if rich.event_type == EventType.TOOL_CALL_BEGIN
|
|
661
|
+
else "failed" if payload.get("error") else "completed"
|
|
662
|
+
),
|
|
663
|
+
}
|
|
664
|
+
)
|
|
665
|
+
|
|
666
|
+
# Preserve the rich execution tree as canonical status items. Studio can
|
|
667
|
+
# render these in the existing Trace inspector without a Harness-only page.
|
|
668
|
+
return status_projection()
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
def _public_activity_items(
|
|
672
|
+
*,
|
|
673
|
+
rich: Any,
|
|
674
|
+
run_id: str,
|
|
675
|
+
scope_id: str,
|
|
676
|
+
source: Any,
|
|
677
|
+
envelope: Any,
|
|
678
|
+
key: str,
|
|
679
|
+
summary: str,
|
|
680
|
+
completed: bool,
|
|
681
|
+
item_kind: str = "message",
|
|
682
|
+
existing: bool = False,
|
|
683
|
+
) -> list[Any]:
|
|
684
|
+
"""Build one identity-stable, replaceable public activity item."""
|
|
685
|
+
del rich, scope_id, source
|
|
686
|
+
item_id = stable_item_id("ksadk", run_id, item_kind, f"activity-{key}")
|
|
687
|
+
part_id = "text-0"
|
|
688
|
+
snapshot = ContentSnapshot(parts=(TextContent(part_id=part_id, text=summary),))
|
|
689
|
+
events: list[Any] = []
|
|
690
|
+
if not existing:
|
|
691
|
+
events.append(ItemStarted(
|
|
692
|
+
**envelope("item.started", item_id, part_id, 0),
|
|
693
|
+
item_id=item_id,
|
|
694
|
+
item_kind=item_kind,
|
|
695
|
+
phase="commentary",
|
|
696
|
+
initial=snapshot,
|
|
697
|
+
))
|
|
698
|
+
events.append(
|
|
699
|
+
ItemUpdated(
|
|
700
|
+
**envelope("item.updated", item_id, part_id, 1),
|
|
701
|
+
item_id=item_id,
|
|
702
|
+
item_kind=item_kind,
|
|
703
|
+
op="replace",
|
|
704
|
+
update=TextContent(part_id=part_id, text=summary),
|
|
705
|
+
)
|
|
706
|
+
)
|
|
707
|
+
if completed:
|
|
708
|
+
events.append(
|
|
709
|
+
ItemCompleted(
|
|
710
|
+
**envelope("item.completed", item_id, part_id, 2),
|
|
711
|
+
item_id=item_id,
|
|
712
|
+
item_kind=item_kind,
|
|
713
|
+
snapshot=snapshot,
|
|
714
|
+
)
|
|
715
|
+
)
|
|
716
|
+
return events
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
def _progress_text(payload: dict[str, Any]) -> str:
|
|
720
|
+
"""Render public execution progress without exposing private chain-of-thought."""
|
|
721
|
+
kind = str(payload.get("kind") or "progress")
|
|
722
|
+
if kind == "plan":
|
|
723
|
+
return f"计划:{_compact_progress_message(payload.get('message'))}"
|
|
724
|
+
if kind == "delegation.batch":
|
|
725
|
+
return _delegation_summary(payload)
|
|
726
|
+
if kind == "tool.batch":
|
|
727
|
+
status = str(payload.get("status") or "running")
|
|
728
|
+
tools = [str(name) for name in payload.get("tools") or []]
|
|
729
|
+
action = _tool_activity_label(tools)
|
|
730
|
+
if status == "failed":
|
|
731
|
+
return f"{action}时遇到问题,正在调整"
|
|
732
|
+
if status == "completed":
|
|
733
|
+
return f"已{action}"
|
|
734
|
+
return f"正在{action}"
|
|
735
|
+
if kind == "provider.retry":
|
|
736
|
+
return _provider_retry_text(payload)
|
|
737
|
+
if kind == "delegation.route":
|
|
738
|
+
provider = "Codex" if "codex" in str(payload.get("provider_ref") or "") else "Harness"
|
|
739
|
+
return f"子任务「{payload.get('label') or '未命名'}」已分派给 {provider}。"
|
|
740
|
+
if kind == "subagent.event":
|
|
741
|
+
status = str(payload.get("status") or "in_progress")
|
|
742
|
+
status_text = {
|
|
743
|
+
"accepted": "等待执行",
|
|
744
|
+
"running": "正在执行",
|
|
745
|
+
"succeeded": "已完成",
|
|
746
|
+
"failed": "执行失败",
|
|
747
|
+
"cancelled": "已取消",
|
|
748
|
+
"interrupted": "已中断",
|
|
749
|
+
}.get(status, status)
|
|
750
|
+
return f"子任务「{payload.get('label') or '未命名'}」:{status_text}。"
|
|
751
|
+
action = str(payload.get("action") or payload.get("status") or "in_progress")
|
|
752
|
+
return f"执行进度:{action}"
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
def _delegation_summary(payload: dict[str, Any]) -> str:
|
|
756
|
+
count = max(1, int(payload.get("count") or 1))
|
|
757
|
+
status = str(payload.get("status") or "running")
|
|
758
|
+
if status == "failed":
|
|
759
|
+
return f"{count} 个子智能体已结束,部分任务需要调整"
|
|
760
|
+
if status == "completed":
|
|
761
|
+
return f"{count} 个子智能体已完成,正在整理结果"
|
|
762
|
+
return f"{count} 个子智能体正在运行"
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
def _delegation_detail(payload: dict[str, Any]) -> str:
|
|
766
|
+
status = str(payload.get("status") or "running")
|
|
767
|
+
labels = [
|
|
768
|
+
str(label).strip() for label in (payload.get("labels") or []) if str(label).strip()
|
|
769
|
+
]
|
|
770
|
+
marker = "已完成" if status == "completed" else "需要调整" if status == "failed" else "正在运行"
|
|
771
|
+
if not labels:
|
|
772
|
+
return marker
|
|
773
|
+
return "\n".join(f"• {marker}:{label}" for label in labels[:6])
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
def _provider_retry_text(payload: dict[str, Any]) -> str:
|
|
777
|
+
if payload.get("next_attempt") is not None:
|
|
778
|
+
attempt = max(2, int(payload["next_attempt"]))
|
|
779
|
+
else:
|
|
780
|
+
attempt = max(2, int(payload.get("model_attempt") or 1) + 1)
|
|
781
|
+
maximum = max(attempt, int(payload.get("max_attempts") or 10))
|
|
782
|
+
delay_ms = max(0, int(payload.get("delay_ms") or payload.get("retry_delay_ms") or 0))
|
|
783
|
+
wait = f",{delay_ms / 1000:g} 秒后" if delay_ms else ""
|
|
784
|
+
label = str(payload.get("label") or "").strip()
|
|
785
|
+
scope = f"({label})" if label else ""
|
|
786
|
+
return f"模型服务繁忙{scope}{wait}自动重试(第 {attempt}/{maximum} 次)"
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
def _public_approval_detail(value: Any) -> dict[str, Any]:
|
|
790
|
+
"""Keep approvals actionable without copying document bodies or secrets into chat."""
|
|
791
|
+
detail = dict(value) if isinstance(value, dict) else {}
|
|
792
|
+
arguments = detail.get("arguments") or detail.get("args")
|
|
793
|
+
safe_arguments: dict[str, str] = {}
|
|
794
|
+
if isinstance(arguments, dict):
|
|
795
|
+
for key in ("path", "file_path", "url", "command"):
|
|
796
|
+
raw = arguments.get(key)
|
|
797
|
+
if raw is not None:
|
|
798
|
+
safe_arguments[key] = _compact_progress_message(raw, max_chars=160)
|
|
799
|
+
public: dict[str, Any] = {
|
|
800
|
+
"name": str(detail.get("name") or detail.get("tool_name") or "tool"),
|
|
801
|
+
}
|
|
802
|
+
if safe_arguments:
|
|
803
|
+
public["args"] = safe_arguments
|
|
804
|
+
return public
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
def _tool_activity_label(tools: list[str]) -> str:
|
|
808
|
+
lowered = " ".join(tools).lower()
|
|
809
|
+
if "write" in lowered or "edit" in lowered or "save" in lowered:
|
|
810
|
+
return "编辑并保存结果"
|
|
811
|
+
if "web_search" in lowered or "search" in lowered:
|
|
812
|
+
return "搜索资料"
|
|
813
|
+
if "web_fetch" in lowered or "fetch" in lowered:
|
|
814
|
+
return "查看资料"
|
|
815
|
+
if "read" in lowered or "list" in lowered:
|
|
816
|
+
return "查看工作区内容"
|
|
817
|
+
if "command" in lowered or "shell" in lowered or "exec" in lowered:
|
|
818
|
+
return "运行任务"
|
|
819
|
+
return "使用工具处理任务"
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
def _compact_progress_message(value: Any, *, max_chars: int = 120) -> str:
|
|
823
|
+
"""Keep only the first useful plan lines for the conversational surface."""
|
|
824
|
+
lines = [line.strip(" -\t") for line in str(value or "计划已生成").splitlines()]
|
|
825
|
+
text = ";".join(line for line in lines if line) or "计划已生成"
|
|
826
|
+
if len(text) <= max_chars:
|
|
827
|
+
return text
|
|
828
|
+
return text[: max_chars - 1].rstrip(";,。 ") + "…"
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
def _compact_responsibilities(labels: list[str], *, max_items: int = 4) -> str:
|
|
832
|
+
if not labels:
|
|
833
|
+
return ""
|
|
834
|
+
visible = labels[:max_items]
|
|
835
|
+
lines = [f"• {label}" for label in visible]
|
|
836
|
+
if len(labels) > max_items:
|
|
837
|
+
lines.append(f"• 另有 {len(labels) - max_items} 项")
|
|
838
|
+
return "\n" + "\n".join(lines)
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
def _positive_int(value: Any) -> int | None:
|
|
842
|
+
try:
|
|
843
|
+
parsed = int(value)
|
|
844
|
+
except (TypeError, ValueError):
|
|
845
|
+
return None
|
|
846
|
+
return parsed if parsed > 0 else None
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
def managed_harness_capabilities(
|
|
850
|
+
*, durable: bool, execution_policy: bool = False
|
|
851
|
+
) -> RuntimeCapabilityMatrix:
|
|
852
|
+
"""Return the canonical control matrix for one concrete assembly tier."""
|
|
853
|
+
|
|
854
|
+
def available() -> RuntimeCapability:
|
|
855
|
+
return RuntimeCapability(supported=True, mode="native")
|
|
856
|
+
|
|
857
|
+
def unavailable(reason: str) -> RuntimeCapability:
|
|
858
|
+
return RuntimeCapability(supported=False, mode="unavailable", reason=reason)
|
|
859
|
+
|
|
860
|
+
durable_capability = (
|
|
861
|
+
available() if durable else unavailable("managed_harness_checkpoint_is_process_local")
|
|
862
|
+
)
|
|
863
|
+
return RuntimeCapabilityMatrix(
|
|
864
|
+
cancel=available(),
|
|
865
|
+
pause=unavailable("managed_harness_pause_not_implemented"),
|
|
866
|
+
resume=available(),
|
|
867
|
+
submit_interaction=durable_capability,
|
|
868
|
+
attach=durable_capability,
|
|
869
|
+
steer=unavailable("runtime_no_native_steer"),
|
|
870
|
+
inject=unavailable("runtime_no_native_inject"),
|
|
871
|
+
checkpoint=available(),
|
|
872
|
+
durable_restore=durable_capability,
|
|
873
|
+
interaction_mode="durable_resume" if durable else "unavailable",
|
|
874
|
+
execution_policy=(
|
|
875
|
+
available() if execution_policy else unavailable("managed_harness_no_host_resolver")
|
|
876
|
+
),
|
|
877
|
+
)
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
__all__ = [
|
|
881
|
+
"ManagedHarnessRuntime",
|
|
882
|
+
"ManagedHarnessRuntimeAdapter",
|
|
883
|
+
"managed_harness_capabilities",
|
|
884
|
+
]
|