agentengine-sdk-python 0.8.4__py3-none-any.whl → 0.8.6__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.6.dist-info}/METADATA +17 -10
- agentengine_sdk_python-0.8.6.dist-info/RECORD +1731 -0
- ksadk/_async_iterators.py +79 -0
- ksadk/_build_provenance.json +1 -1
- ksadk/_model_anthropic.py +49 -0
- ksadk/_model_input.py +86 -0
- ksadk/_model_json.py +40 -0
- ksadk/_model_reasoning.py +17 -0
- ksadk/_model_refusal.py +20 -0
- ksadk/_model_sse.py +163 -0
- ksadk/_process.py +83 -0
- ksadk/_str_enum.py +17 -0
- ksadk/a2a/__init__.py +157 -167
- ksadk/a2a/_invocation_state.py +86 -0
- ksadk/a2a/_space_client_events.py +33 -22
- ksadk/a2a/adk.py +194 -0
- ksadk/a2a/adk_invocation_context.py +242 -0
- ksadk/a2a/adk_runtime.py +126 -0
- ksadk/a2a/adk_tools.py +319 -0
- ksadk/a2a/bootstrap.py +149 -23
- ksadk/a2a/build_validation.py +147 -0
- ksadk/a2a/card.py +23 -15
- ksadk/a2a/codex.py +160 -0
- ksadk/a2a/codex_checkpoint.py +111 -0
- ksadk/a2a/codex_recovery.py +96 -0
- ksadk/a2a/codex_recovery_events.py +123 -0
- ksadk/a2a/codex_runtime.py +198 -0
- ksadk/a2a/codex_session_checkpoint.py +162 -0
- ksadk/a2a/composition.py +88 -0
- ksadk/a2a/context_store.py +118 -19
- ksadk/a2a/control_plane.py +108 -106
- ksadk/a2a/event_adapter.py +92 -193
- ksadk/a2a/executor.py +257 -85
- ksadk/a2a/exposure.py +106 -0
- ksadk/a2a/external_transport.py +3 -4
- ksadk/a2a/identity.py +106 -12
- ksadk/a2a/ids.py +14 -3
- ksadk/a2a/inbound_kernel.py +133 -0
- ksadk/a2a/interaction_wire.py +76 -0
- ksadk/a2a/invocation_checkpoint.py +274 -0
- ksadk/a2a/invocation_policy.py +87 -0
- ksadk/a2a/invocation_publication.py +210 -0
- ksadk/a2a/invocation_service.py +972 -0
- ksadk/a2a/invocation_types.py +459 -0
- ksadk/a2a/kernel_task_adapter.py +259 -0
- ksadk/a2a/langgraph.py +20 -7
- ksadk/a2a/langgraph_invocation_context.py +136 -0
- ksadk/a2a/langgraph_managed.py +150 -0
- ksadk/a2a/langgraph_recovery.py +32 -0
- ksadk/a2a/langgraph_runtime.py +89 -0
- ksadk/a2a/langgraph_tool_runtime.py +132 -0
- ksadk/a2a/langgraph_tools.py +63 -0
- ksadk/a2a/message_digest.py +40 -0
- ksadk/a2a/platform.py +389 -0
- ksadk/a2a/policy_refs.py +13 -0
- ksadk/a2a/presentation.py +402 -0
- ksadk/a2a/product_kernel_facts.py +177 -0
- ksadk/a2a/product_key.py +99 -0
- ksadk/a2a/protocol_errors.py +116 -0
- ksadk/a2a/result_text.py +49 -0
- ksadk/a2a/resume_store.py +93 -3
- ksadk/a2a/routes.py +6 -1
- ksadk/a2a/runtime_approval.py +198 -0
- ksadk/a2a/runtime_input.py +151 -0
- ksadk/a2a/server.py +16 -7
- ksadk/a2a/space_client.py +101 -16
- ksadk/a2a/task_adapter.py +19 -5
- ksadk/a2a/task_event_dispatcher.py +39 -2
- ksadk/a2a/task_event_outbox.py +215 -0
- ksadk/a2a/task_event_outbox_owned.py +130 -0
- ksadk/a2a/task_store.py +37 -0
- ksadk/a2a/tool_activity.py +176 -0
- ksadk/a2a/workload_tokens.py +134 -0
- ksadk/a2ui/core.py +3 -3
- ksadk/api/client.py +38 -79
- ksadk/api/sse_stream.py +96 -0
- ksadk/builders/code_builder.py +121 -118
- ksadk/builders/container_builder.py +11 -29
- ksadk/builders/framework_requirements.py +22 -2
- ksadk/builders/managed_runtime_builder.py +12 -0
- ksadk/builders/source_provenance.py +87 -0
- ksadk/cli/__init__.py +36 -0
- ksadk/cli/cmd_a2a.py +43 -0
- ksadk/cli/cmd_build.py +9 -0
- ksadk/cli/cmd_config.py +4 -4
- ksadk/cli/cmd_create.py +12 -12
- ksadk/cli/cmd_deploy.py +27 -2
- ksadk/cli/cmd_hermes.py +24 -2
- ksadk/cli/cmd_invoke.py +64 -88
- ksadk/cli/cmd_openclaw.py +26 -1
- ksadk/cli/cmd_plugin.py +70 -12
- ksadk/cli/cmd_studio.py +69 -17
- ksadk/cli/cmd_web.py +2 -0
- ksadk/cli/hosted_invoke.py +206 -0
- ksadk/cli/invoke_content.py +60 -0
- ksadk/cli/openclaw_env.py +1 -1
- ksadk/cli/resource_common.py +26 -0
- ksadk/cli/runtime_bootstrap.py +27 -5
- ksadk/codex/_expert_request_reader.py +48 -0
- ksadk/codex/a2a_tools.py +140 -0
- ksadk/codex/async_approval.py +169 -0
- ksadk/codex/async_client.py +938 -0
- ksadk/codex/async_proxy.py +216 -0
- ksadk/codex/base_runtime.py +25 -0
- ksadk/codex/client.py +3 -1047
- ksadk/codex/client_payloads.py +85 -0
- ksadk/codex/rollout_checkpoint.py +264 -0
- ksadk/codex/runtime.py +290 -54
- ksadk/common/auth.py +2 -2
- ksadk/common/cloud_headers.py +36 -0
- ksadk/common/diagnostics.py +34 -0
- ksadk/common/kop_client.py +2 -1
- ksadk/configs/__init__.py +1 -1
- ksadk/configs/env_registry.py +216 -143
- ksadk/configs/env_registry_a2a.py +173 -0
- ksadk/configs/env_registry_studio.py +134 -0
- ksadk/configs/global_config.py +2 -1
- ksadk/configs/settings.py +9 -3
- ksadk/connector/__init__.py +17 -0
- ksadk/connector/channel.py +477 -0
- ksadk/context_engine/assembler.py +9 -0
- ksadk/context_engine/capabilities.py +52 -4
- ksadk/context_engine/contributors.py +80 -17
- ksadk/context_engine/instruction_authority.py +18 -0
- ksadk/conversations/attachment_storage.py +10 -3
- ksadk/conversations/attachments.py +69 -20
- ksadk/conversations/contracts.py +28 -9
- ksadk/conversations/message_projection.py +51 -155
- ksadk/conversations/message_projection_blocks.py +137 -0
- ksadk/conversations/model_context.py +11 -3
- ksadk/conversations/normalize.py +28 -10
- ksadk/conversations/projector.py +63 -0
- ksadk/conversations/runtime_baseline.py +37 -0
- ksadk/conversations/runtime_compaction.py +7 -2
- ksadk/conversations/runtime_input.py +16 -4
- ksadk/conversations/runtime_invocation.py +17 -4
- ksadk/conversations/runtime_observability.py +39 -10
- ksadk/conversations/runtime_payloads.py +12 -0
- ksadk/conversations/runtime_persistence.py +296 -32
- ksadk/conversations/runtime_preparation.py +98 -13
- ksadk/conversations/runtime_projection.py +217 -0
- ksadk/conversations/runtime_resume.py +141 -70
- ksadk/conversations/runtime_stream_events.py +29 -35
- ksadk/conversations/runtime_streaming.py +8 -0
- ksadk/conversations/tool_receipt_resume.py +387 -0
- ksadk/conversations/tool_receipts.py +32 -0
- ksadk/deployment/env_forward.py +5 -0
- ksadk/deployment/manager.py +15 -6
- ksadk/deployment/providers/serverless.py +76 -136
- ksadk/deployment/providers/serverless_payloads.py +122 -0
- ksadk/evaluation/agent_eval_client.py +2 -1
- ksadk/evaluation/contracts.py +78 -3
- ksadk/evaluation/evaluators.py +166 -1
- ksadk/evaluation/evidence.py +271 -4
- ksadk/evaluation/local_adapter.py +76 -12
- ksadk/evaluation/studio_build_adapter.py +73 -9
- ksadk/events/adapters/_a2a_checkpoint.py +151 -0
- ksadk/events/adapters/_a2a_snapshot.py +18 -14
- ksadk/events/adapters/_a2a_support.py +15 -3
- ksadk/events/adapters/_a2a_tool_activity.py +123 -0
- ksadk/events/adapters/_codex_errors.py +49 -0
- ksadk/events/adapters/_codex_items.py +16 -8
- ksadk/events/adapters/_langgraph_support.py +46 -1
- ksadk/events/adapters/a2a.py +54 -26
- ksadk/events/adapters/adk.py +188 -30
- ksadk/events/adapters/codex.py +33 -7
- ksadk/events/adapters/langgraph.py +16 -6
- ksadk/events/canonical.py +5 -0
- ksadk/events/canonical_store.py +200 -4
- ksadk/events/reducer.py +82 -0
- ksadk/events/run_authority.py +176 -0
- ksadk/events/session_event.py +2 -2
- ksadk/harness/__init__.py +18 -0
- ksadk/harness/app.py +11 -0
- ksadk/harness/artifact_adapters/__init__.py +1 -0
- ksadk/harness/artifact_adapters/native_page_budget.py +172 -0
- ksadk/harness/artifact_adapters/native_search.py +249 -0
- ksadk/harness/artifact_adapters/native_search_budget.py +134 -0
- ksadk/harness/artifact_adapters/native_store.py +115 -0
- ksadk/harness/artifact_adapters/native_tool.py +222 -0
- ksadk/harness/artifact_store.py +230 -0
- ksadk/harness/browser_adapters/__init__.py +6 -0
- ksadk/harness/browser_adapters/native_browser_tool.py +92 -0
- ksadk/harness/browser_adapters/native_dom_snapshot.py +187 -0
- ksadk/harness/browser_adapters/native_playwright.py +953 -0
- ksadk/harness/browser_adapters/native_vision.py +295 -0
- ksadk/harness/capabilities.py +115 -0
- ksadk/harness/capability_adapters/__init__.py +1 -0
- ksadk/harness/capability_adapters/native_dsh.py +289 -0
- ksadk/harness/capability_runtime.py +332 -0
- ksadk/harness/closure_contract.py +92 -0
- ksadk/harness/compaction_record.py +153 -0
- ksadk/harness/compiler.py +284 -0
- ksadk/harness/config.py +28 -5
- ksadk/harness/conformance/__init__.py +33 -0
- ksadk/harness/conformance/contract.py +504 -0
- ksadk/harness/conformance/fixtures.py +102 -0
- ksadk/harness/context_engine.py +388 -0
- ksadk/harness/context_maintenance.py +259 -0
- ksadk/harness/context_manifest.py +188 -0
- ksadk/harness/context_sections.py +397 -0
- ksadk/harness/context_tuning.py +168 -0
- ksadk/harness/diagnostic_adapters/__init__.py +1 -0
- ksadk/harness/diagnostic_adapters/contracts.py +70 -0
- ksadk/harness/diagnostic_adapters/lsp_rpc.py +210 -0
- ksadk/harness/diagnostic_adapters/native_lsp.py +286 -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 +57 -0
- ksadk/harness/engine/context_pipeline.py +1351 -0
- ksadk/harness/engine/graph_builder.py +352 -0
- ksadk/harness/engine/hooked_reasoner.py +380 -0
- ksadk/harness/engine/langgraph.py +1049 -0
- ksadk/harness/engine/mcp_disclosure.py +701 -0
- ksadk/harness/engine/phases/__init__.py +6 -0
- ksadk/harness/engine/phases/context.py +48 -0
- ksadk/harness/engine/phases/interaction.py +31 -0
- ksadk/harness/engine/phases/reason.py +552 -0
- ksadk/harness/engine/phases/tools.py +638 -0
- ksadk/harness/engine/policy_runtime.py +81 -0
- ksadk/harness/engine/postgres_checkpointer.py +386 -0
- ksadk/harness/engine/run_control_bridge.py +100 -0
- ksadk/harness/engine/run_types.py +98 -0
- ksadk/harness/engine/skill_disclosure.py +275 -0
- ksadk/harness/engine/spans.py +41 -0
- ksadk/harness/engine/steering.py +177 -0
- ksadk/harness/engine/subagents.py +360 -0
- ksadk/harness/engine/thread_ids.py +112 -0
- ksadk/harness/engine/tool_dispatch.py +249 -0
- ksadk/harness/event_tree.py +212 -0
- ksadk/harness/events.py +498 -0
- ksadk/harness/execution_policy.py +104 -0
- ksadk/harness/hooks.py +259 -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 +699 -0
- ksadk/harness/loop/tools.py +907 -0
- ksadk/harness/managed_runtime.py +1044 -0
- ksadk/harness/mcp_disclosure_contract.py +85 -0
- ksadk/harness/mcp_matrix.py +474 -0
- ksadk/harness/mcp_result_policy.py +44 -0
- ksadk/harness/mcp_runtime.py +504 -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/micro_compact.py +69 -0
- ksadk/harness/model_adapters/__init__.py +1 -0
- ksadk/harness/model_adapters/native_mcp_media.py +100 -0
- ksadk/harness/model_adapters/native_mcp_result.py +36 -0
- ksadk/harness/model_adapters/native_openai.py +703 -0
- ksadk/harness/model_capability.py +468 -0
- ksadk/harness/model_provider.py +430 -0
- ksadk/harness/multimodal.py +57 -0
- ksadk/harness/native/__init__.py +1 -0
- ksadk/harness/native/activation_contract.py +25 -0
- ksadk/harness/native/activation_recovery.py +29 -0
- ksadk/harness/native/adapters.py +291 -0
- ksadk/harness/native/artifact_contract.py +14 -0
- ksadk/harness/native/artifact_partial_read_capacity.py +171 -0
- ksadk/harness/native/artifact_read_capacity.py +182 -0
- ksadk/harness/native/artifact_read_contract.py +27 -0
- ksadk/harness/native/artifact_runtime.py +408 -0
- ksadk/harness/native/artifact_search_capacity.py +206 -0
- ksadk/harness/native/artifact_search_contract.py +40 -0
- ksadk/harness/native/artifact_single_read_capacity.py +170 -0
- ksadk/harness/native/browser_contract.py +229 -0
- ksadk/harness/native/browser_recovery.py +183 -0
- ksadk/harness/native/capabilities.py +204 -0
- ksadk/harness/native/child_approval.py +60 -0
- ksadk/harness/native/child_budget.py +136 -0
- ksadk/harness/native/child_cancellation.py +80 -0
- ksadk/harness/native/child_input.py +98 -0
- ksadk/harness/native/child_input_runtime.py +59 -0
- ksadk/harness/native/child_interruption.py +81 -0
- ksadk/harness/native/child_lifecycle.py +246 -0
- ksadk/harness/native/child_lifecycle_contract.py +91 -0
- ksadk/harness/native/child_notifications.py +75 -0
- ksadk/harness/native/child_promotion.py +66 -0
- ksadk/harness/native/command_runtime.py +99 -0
- ksadk/harness/native/completion.py +302 -0
- ksadk/harness/native/completion_text.py +116 -0
- ksadk/harness/native/context.py +358 -0
- ksadk/harness/native/context_artifact_page.py +75 -0
- ksadk/harness/native/context_compaction_projection.py +131 -0
- ksadk/harness/native/context_contributions.py +320 -0
- ksadk/harness/native/context_contributor_contract.py +133 -0
- ksadk/harness/native/context_driver.py +820 -0
- ksadk/harness/native/context_fresh_tools.py +49 -0
- ksadk/harness/native/context_history.py +272 -0
- ksadk/harness/native/context_microcompact.py +61 -0
- ksadk/harness/native/context_partial_summary.py +58 -0
- ksadk/harness/native/context_partition.py +492 -0
- ksadk/harness/native/context_pruning.py +275 -0
- ksadk/harness/native/context_reduction.py +60 -0
- ksadk/harness/native/context_replay.py +148 -0
- ksadk/harness/native/context_request_projection.py +526 -0
- ksadk/harness/native/context_runtime.py +976 -0
- ksadk/harness/native/context_runtime_contracts.py +409 -0
- ksadk/harness/native/context_search.py +112 -0
- ksadk/harness/native/context_source_fragments.py +188 -0
- ksadk/harness/native/context_source_progress.py +119 -0
- ksadk/harness/native/context_summary_planning.py +788 -0
- ksadk/harness/native/context_summary_recovery.py +105 -0
- ksadk/harness/native/delivery_review.py +331 -0
- ksadk/harness/native/delivery_review_contract.py +54 -0
- ksadk/harness/native/effect_admission.py +82 -0
- ksadk/harness/native/effect_control.py +318 -0
- ksadk/harness/native/effect_receipts.py +729 -0
- ksadk/harness/native/effect_runtime.py +303 -0
- ksadk/harness/native/effective_configuration.py +28 -0
- ksadk/harness/native/engine.py +945 -0
- ksadk/harness/native/final_output.py +34 -0
- ksadk/harness/native/final_submission.py +58 -0
- ksadk/harness/native/finalization_workspace.py +96 -0
- ksadk/harness/native/fork.py +151 -0
- ksadk/harness/native/guidance.py +91 -0
- ksadk/harness/native/history.py +381 -0
- ksadk/harness/native/hook_executor.py +205 -0
- ksadk/harness/native/hook_runtime_contract.py +282 -0
- ksadk/harness/native/interaction_observation.py +117 -0
- ksadk/harness/native/lease.py +103 -0
- ksadk/harness/native/machine.py +974 -0
- ksadk/harness/native/mcp_result_governance.py +156 -0
- ksadk/harness/native/model.py +570 -0
- ksadk/harness/native/model_feedback.py +63 -0
- ksadk/harness/native/model_input.py +30 -0
- ksadk/harness/native/model_recovery_contract.py +35 -0
- ksadk/harness/native/model_replay.py +128 -0
- ksadk/harness/native/model_request.py +133 -0
- ksadk/harness/native/model_runtime.py +196 -0
- ksadk/harness/native/model_takeover.py +419 -0
- ksadk/harness/native/model_tool_batch.py +40 -0
- ksadk/harness/native/observed_progress.py +46 -0
- ksadk/harness/native/operator_guidance.py +201 -0
- ksadk/harness/native/output_contract.py +80 -0
- ksadk/harness/native/output_recovery.py +24 -0
- ksadk/harness/native/ports.py +749 -0
- ksadk/harness/native/precompact_hook_runtime.py +171 -0
- ksadk/harness/native/replay_context.py +149 -0
- ksadk/harness/native/request_media.py +112 -0
- ksadk/harness/native/restore_contract.py +16 -0
- ksadk/harness/native/run_clock.py +120 -0
- ksadk/harness/native/state.py +436 -0
- ksadk/harness/native/steering.py +170 -0
- ksadk/harness/native/stop_hook_runtime.py +151 -0
- ksadk/harness/native/studio_admission.py +29 -0
- ksadk/harness/native/subagents.py +86 -0
- ksadk/harness/native/task_policy.py +99 -0
- ksadk/harness/native/task_progress.py +86 -0
- ksadk/harness/native/terminal_verification.py +43 -0
- ksadk/harness/native/tool_argument_feedback.py +178 -0
- ksadk/harness/native/tool_budget.py +253 -0
- ksadk/harness/native/tool_error_streak.py +89 -0
- ksadk/harness/native/tool_hook_runtime.py +343 -0
- ksadk/harness/native/tool_input_validation.py +58 -0
- ksadk/harness/native/tool_interruption.py +96 -0
- ksadk/harness/native/tool_observation.py +259 -0
- ksadk/harness/native/tool_progress.py +223 -0
- ksadk/harness/native/tool_recovery.py +25 -0
- ksadk/harness/native/tool_scheduling.py +33 -0
- ksadk/harness/native/tool_schema.py +126 -0
- ksadk/harness/native/transitions.py +151 -0
- ksadk/harness/native/turn_control.py +98 -0
- ksadk/harness/native/user_document.py +98 -0
- ksadk/harness/native/user_document_capture.py +49 -0
- ksadk/harness/native/user_input.py +87 -0
- ksadk/harness/native/verification.py +432 -0
- ksadk/harness/native/verification_binding.py +40 -0
- ksadk/harness/native/verification_runtime.py +233 -0
- ksadk/harness/native/verification_workspace.py +67 -0
- ksadk/harness/native_driver_failure.py +123 -0
- ksadk/harness/native_facade.py +977 -0
- ksadk/harness/native_factory.py +244 -0
- ksadk/harness/native_projection.py +503 -0
- ksadk/harness/native_runtime.py +621 -0
- ksadk/harness/native_shadow.py +250 -0
- ksadk/harness/native_shadow_inputs.py +146 -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/progress_adapters/__init__.py +5 -0
- ksadk/harness/progress_adapters/native_todo.py +75 -0
- ksadk/harness/prompt_cache.py +132 -0
- ksadk/harness/public_activity.py +213 -0
- ksadk/harness/public_output.py +30 -0
- ksadk/harness/public_summary.py +36 -0
- ksadk/harness/readiness.py +249 -0
- ksadk/harness/reasoner.py +779 -17
- ksadk/harness/release_readiness.py +140 -0
- ksadk/harness/resource_ref.py +69 -0
- ksadk/harness/rpc.py +200 -0
- ksadk/harness/run_control.py +773 -0
- ksadk/harness/runtime.py +157 -113
- ksadk/harness/runtime_capabilities.py +228 -0
- ksadk/harness/runtime_server.py +514 -0
- ksadk/harness/sandbox_adapters.py +739 -0
- ksadk/harness/sandbox_backend.py +733 -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/sdk.py +153 -0
- ksadk/harness/session_store.py +589 -0
- ksadk/harness/skill_adapters/__init__.py +1 -0
- ksadk/harness/skill_adapters/native_bundle.py +148 -0
- ksadk/harness/skill_adapters/native_disclosure.py +306 -0
- ksadk/harness/skill_composition.py +212 -0
- ksadk/harness/skill_feedback.py +123 -0
- ksadk/harness/skill_intent.py +47 -0
- ksadk/harness/skill_matrix.py +233 -0
- ksadk/harness/skill_runtime.py +317 -0
- ksadk/harness/spec.py +342 -0
- ksadk/harness/state.py +155 -0
- ksadk/harness/stores/__init__.py +14 -0
- ksadk/harness/stores/native_command_settlement.py +65 -0
- ksadk/harness/stores/native_contract.py +311 -0
- ksadk/harness/stores/native_memory.py +326 -0
- ksadk/harness/stores/native_memory_archive.py +70 -0
- ksadk/harness/stores/native_migration_cli.py +91 -0
- ksadk/harness/stores/native_outbox.py +56 -0
- ksadk/harness/stores/native_sqlite.py +782 -0
- ksadk/harness/stores/native_sqlite_audit.py +29 -0
- ksadk/harness/stores/native_sqlite_migration.py +252 -0
- ksadk/harness/strategies.py +149 -0
- ksadk/harness/subagent.py +263 -0
- ksadk/harness/subagent_adapters/checkpoint_recovery.py +120 -0
- ksadk/harness/subagent_adapters/native_background_child.py +803 -0
- ksadk/harness/subagent_adapters/native_child.py +819 -0
- ksadk/harness/subagent_adapters/native_child_approval.py +128 -0
- ksadk/harness/subagent_adapters/native_child_continuation.py +51 -0
- ksadk/harness/subagent_adapters/native_child_result.py +392 -0
- ksadk/harness/subagent_adapters/prepared_recovery.py +120 -0
- ksadk/harness/tool_display.py +75 -0
- ksadk/harness/tool_display_contract.py +134 -0
- ksadk/harness/tool_output.py +141 -0
- ksadk/harness/tool_policy.py +134 -0
- ksadk/harness/tool_receipts.py +96 -0
- ksadk/harness/tool_reliability.py +81 -0
- ksadk/harness/tool_result_policy.py +216 -0
- ksadk/harness/tools.py +52 -0
- ksadk/harness/user_errors.py +69 -0
- ksadk/harness/working_context.py +81 -0
- ksadk/harness/working_context_patch.py +99 -0
- ksadk/harness/workspace_adapters/__init__.py +6 -0
- ksadk/harness/workspace_adapters/native_directory.py +180 -0
- ksadk/harness/workspace_adapters/native_git.py +208 -0
- ksadk/harness/workspace_adapters/native_isolation.py +350 -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 +9 -2
- ksadk/kernel/__init__.py +10 -0
- ksadk/kernel/approval_presentation.py +91 -0
- ksadk/kernel/authorization.py +1 -1
- ksadk/kernel/bootstrap.py +220 -252
- ksadk/kernel/contract_fingerprints.py +45 -1
- ksadk/kernel/contracts.py +30 -0
- ksadk/kernel/control.py +180 -29
- ksadk/kernel/execution_grants.py +428 -0
- ksadk/kernel/execution_grants_memory.py +252 -0
- ksadk/kernel/execution_grants_postgres.py +395 -0
- ksadk/kernel/execution_grants_sqlite.py +435 -0
- ksadk/kernel/execution_host_ingress.py +1071 -0
- ksadk/kernel/history_projection.py +120 -0
- ksadk/kernel/ingress.py +139 -226
- ksadk/kernel/ingress_bootstrap.py +268 -0
- ksadk/kernel/legacy_history.py +179 -0
- ksadk/kernel/mapping.py +1 -1
- ksadk/kernel/memory_store.py +61 -58
- ksadk/kernel/memory_store_projection.py +63 -0
- ksadk/kernel/postgres_event_log.py +181 -0
- ksadk/kernel/postgres_store.py +230 -231
- ksadk/kernel/readiness.py +125 -0
- ksadk/kernel/recovery.py +166 -16
- ksadk/kernel/recovery_projection.py +124 -0
- ksadk/kernel/runtime_checkpoint.py +34 -0
- ksadk/kernel/sql/001_agent_kernel.sql +28 -0
- ksadk/kernel/sqlite_schema.py +100 -0
- ksadk/kernel/sqlite_store.py +410 -200
- ksadk/kernel/state.py +2 -3
- ksadk/kernel/store.py +104 -5
- ksadk/kernel/teams_artifact_tools.py +392 -0
- ksadk/kernel/teams_effects.py +851 -0
- ksadk/kernel/teams_execution_context.py +408 -0
- ksadk/kernel/teams_host_http.py +237 -0
- ksadk/kernel/teams_material_transport.py +245 -0
- ksadk/kernel/teams_materials.py +318 -0
- ksadk/kernel/teams_runtime_bootstrap.py +604 -0
- ksadk/kernel/teams_tool_runtime.py +273 -0
- ksadk/kernel/teams_workspace.py +259 -0
- ksadk/kernel/worker.py +369 -340
- ksadk/kernel/worker_controls.py +454 -0
- ksadk/kernel/worker_history.py +72 -0
- ksadk/kernel/worker_identity.py +74 -0
- ksadk/kernel/worker_interactions.py +197 -0
- ksadk/knowledge_base/client.py +15 -1
- ksadk/managed_runtime.py +29 -2
- ksadk/memory/adk/backends/http_ltm_backend.py +2 -1
- ksadk/memory/adk/backends/sdk_ltm_backend.py +15 -1
- ksadk/memory/adk/bounded_database_session_service.py +232 -0
- ksadk/memory/adk/resilient_session_service.py +115 -15
- ksadk/memory/adk/short_term_memory.py +8 -9
- ksadk/memory/coordinator.py +22 -6
- ksadk/memory/extraction.py +159 -7
- ksadk/memory/models.py +77 -1
- ksadk/memory/provider_resolver.py +5 -0
- ksadk/memory/providers/local_candidates.py +183 -0
- ksadk/memory/providers/local_postgres.py +200 -0
- ksadk/memory/providers/local_sqlite.py +280 -67
- ksadk/memory/resolved_policy.py +12 -7
- ksadk/memory/retrieval.py +189 -0
- ksadk/memory/store_adapter.py +150 -0
- ksadk/model_gateway/__init__.py +29 -0
- ksadk/model_gateway/client.py +253 -0
- ksadk/model_gateway/events.py +113 -0
- ksadk/model_gateway/matrix.py +297 -0
- ksadk/model_policy.py +2 -2
- ksadk/model_proxy/compat.py +670 -0
- ksadk/model_proxy/detect.py +254 -0
- ksadk/model_proxy/server.py +14 -9
- ksadk/model_proxy/transform.py +72 -6
- ksadk/plugins/__init__.py +1 -1
- ksadk/plugins/bridges/dsh.py +29 -20
- ksadk/plugins/bridges/dsh_profile_manifest.py +36 -0
- ksadk/plugins/builtin_resources.py +199 -0
- ksadk/plugins/builtins.py +417 -185
- ksadk/plugins/companion_artifacts.py +83 -0
- ksadk/plugins/companions.py +368 -0
- ksadk/plugins/context_contributor.py +15 -4
- ksadk/plugins/contracts.py +1 -1
- ksadk/plugins/dsh_channels.py +156 -0
- ksadk/plugins/dsh_dependency_policy.py +41 -0
- ksadk/plugins/dsh_home.py +140 -0
- ksadk/plugins/dsh_teams.py +105 -0
- ksadk/plugins/dsh_toolchain.py +92 -21
- ksadk/plugins/execution_host.py +107 -0
- ksadk/plugins/host.py +73 -5
- ksadk/plugins/kernel_adapter.py +44 -1
- ksadk/plugins/memory_provider.py +180 -0
- ksadk/plugins/providers/_process_group.py +50 -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/index.mjs +24 -2
- 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 +52 -40
- ksadk/plugins/providers/codex_native.py +20 -0
- ksadk/plugins/providers/codex_skills.py +46 -0
- ksadk/plugins/providers/dsh_capabilities.py +49 -143
- ksadk/plugins/providers/dsh_connector_lease.py +225 -0
- ksadk/plugins/providers/dsh_mcp.py +163 -1
- ksadk/plugins/providers/harness.py +413 -52
- ksadk/plugins/providers/harness_context.py +61 -0
- ksadk/plugins/providers/harness_contributions.py +241 -0
- ksadk/plugins/providers/harness_delegation.py +670 -0
- ksadk/plugins/providers/harness_hooks.py +121 -0
- ksadk/plugins/providers/harness_managed.py +550 -0
- ksadk/plugins/providers/harness_tools.py +455 -0
- ksadk/plugins/providers/legacy_catalog.py +1 -1
- ksadk/plugins/providers/mcp_projection.py +100 -3
- ksadk/plugins/providers/platform_resources.py +16 -6
- 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 +540 -0
- ksadk/plugins/teams/artifacts.py +60 -0
- ksadk/plugins/teams/build_artifacts.py +460 -0
- ksadk/plugins/teams/cloud_contract_fingerprints.py +22 -0
- ksadk/plugins/teams/cloud_contracts.py +928 -0
- ksadk/plugins/teams/cloud_permits.py +250 -0
- ksadk/plugins/teams/context.py +96 -0
- ksadk/plugins/teams/contracts.py +136 -0
- ksadk/plugins/teams/domain.py +1480 -0
- ksadk/plugins/teams/domain_values.py +24 -0
- ksadk/plugins/teams/effect_contracts.py +255 -0
- ksadk/plugins/teams/errors.py +13 -0
- ksadk/plugins/teams/execution_projection.py +255 -0
- ksadk/plugins/teams/leader_decisions.py +106 -0
- ksadk/plugins/teams/migration.py +311 -0
- ksadk/plugins/teams/migration_cli.py +322 -0
- ksadk/plugins/teams/postgres_store.py +352 -0
- ksadk/plugins/teams/release_contracts.py +60 -0
- ksadk/plugins/teams/runtime.py +853 -0
- ksadk/plugins/teams/source_projection.py +84 -0
- ksadk/plugins/teams/store.py +519 -0
- ksadk/plugins/teams/task_decisions.py +436 -0
- ksadk/plugins/teams/tool_service.py +152 -0
- ksadk/plugins/teams/transport.py +96 -0
- ksadk/plugins/teams/workspaces.py +255 -0
- ksadk/resource_runtime/skill_runtime.py +3 -0
- ksadk/resource_runtime/socket_server.py +11 -0
- ksadk/resource_runtime/worker.py +28 -4
- ksadk/runners/_adk_a2a_stream.py +122 -0
- ksadk/runners/_adk_canonical_stream.py +474 -0
- ksadk/runners/_langgraph_canonical_streams.py +527 -0
- ksadk/runners/_langgraph_runner_streams.py +83 -401
- ksadk/runners/_langgraph_state_reader.py +106 -0
- ksadk/runners/_langgraph_tool_projection.py +86 -0
- ksadk/runners/_langgraph_tools_transformer.py +27 -0
- ksadk/runners/_session_identity.py +285 -0
- ksadk/runners/adk_runner.py +220 -350
- ksadk/runners/base_runner.py +6 -5
- ksadk/runners/langgraph_runner.py +208 -195
- ksadk/runners/patch_langchain.py +47 -0
- ksadk/runners/usage_accumulator.py +11 -3
- ksadk/runners/utils/loader.py +28 -14
- ksadk/runtime/_runner_adapter/a2ui_surface.py +145 -0
- ksadk/runtime/_runner_adapter/gateway_approvals.py +93 -0
- ksadk/runtime/_runner_adapter/stream_mapping.py +134 -129
- ksadk/runtime/adapter.py +40 -3
- ksadk/runtime/conversation_execution.py +29 -3
- ksadk/runtime/executor.py +105 -7
- ksadk/runtime/factory.py +45 -3
- ksadk/runtime/framework_adapters.py +184 -10
- ksadk/runtime/hosted_finalizer.py +4 -6
- ksadk/runtime/launch.py +2 -0
- ksadk/runtime/preprocessing.py +11 -3
- ksadk/runtime/runner_adapter.py +160 -21
- ksadk/runtime/skill_eval_result.py +36 -0
- ksadk/runtime/timing.py +46 -0
- ksadk/runtime/usage.py +49 -18
- ksadk/runtime_context.py +105 -1
- ksadk/sandbox/backends/e2b.py +272 -24
- ksadk/sandbox/backends/local_process.py +73 -39
- ksadk/sandbox/base.py +62 -1
- ksadk/sandbox/diagnostics.py +82 -0
- ksadk/sandbox/e2b_connection.py +9 -1
- ksadk/sandbox/local_controls.py +776 -0
- ksadk/sandbox/local_launcher.py +124 -0
- ksadk/scheduler/dispatcher.py +1 -1
- ksadk/server/factory.py +178 -25
- ksadk/server/history_deadline.py +158 -0
- ksadk/server/history_page_cache.py +129 -0
- ksadk/server/invocation_identity.py +118 -0
- ksadk/server/routes/checkpoint_audit.py +88 -0
- ksadk/server/routes/checkpoint_listing.py +294 -0
- ksadk/server/routes/checkpoint_resolution.py +73 -20
- ksadk/server/routes/common.py +32 -3
- ksadk/server/routes/control.py +112 -9
- ksadk/server/routes/dependencies.py +2 -1
- ksadk/server/routes/display_projection.py +154 -0
- ksadk/server/routes/kernel_ingress.py +26 -3
- ksadk/server/routes/misc.py +331 -33
- ksadk/server/routes/models.py +28 -4
- ksadk/server/routes/openai_compat.py +82 -13
- ksadk/server/routes/projection.py +159 -216
- ksadk/server/routes/run.py +112 -37
- ksadk/server/routes/sessions.py +493 -358
- ksadk/server/routes/streaming.py +68 -15
- ksadk/server/routes/tool_receipt_claim_routes.py +107 -0
- ksadk/server/routes/workspace.py +135 -23
- ksadk/server/static/assets/{ArtifactsPanel-CGbWlMNh.js → ArtifactsPanel-CILaW-fC.js} +1 -1
- ksadk/server/static/assets/{CodeBlock-b4C7upmO.js → CodeBlock-BVrNVtJC.js} +10 -7
- ksadk/server/static/assets/MathMessageMarkdown-Dp7c4wWD.js +8 -0
- ksadk/server/static/assets/{MermaidBlock-BEBN4Ksz.js → MermaidBlock-Dxop8Rd7.js} +9 -9
- ksadk/server/static/assets/{NativeTerminalPanel-zvL-WpAn.js → NativeTerminalPanel-Cjjz8B30.js} +1 -1
- ksadk/server/static/assets/{abnfDiagram-VCTEODGH-BYafW7Za.js → abnfDiagram-VCTEODGH-ckWDmOzw.js} +1 -1
- ksadk/server/static/assets/{arc-bTohInsS.js → arc-DqxJede-.js} +1 -1
- ksadk/server/static/assets/architecture-7GRP2DOG-pn_DuLy6.js +1 -0
- ksadk/server/static/assets/{architectureDiagram-5GKGNRK7-Ch5Lbzsi.js → architectureDiagram-5GKGNRK7-SEQA4bVi.js} +1 -1
- ksadk/server/static/assets/{blockDiagram-NRAW4CY4-kqF4MDOG.js → blockDiagram-NRAW4CY4-pM0B-6NJ.js} +1 -1
- ksadk/server/static/assets/{c4Diagram-UCG6FXSJ-8uSRIODv.js → c4Diagram-UCG6FXSJ-m2tuCNVq.js} +1 -1
- ksadk/server/static/assets/channel-fySsnkft.js +1 -0
- ksadk/server/static/assets/chunk-2Q5K7J3B-BheGxKRQ.js +1 -0
- ksadk/server/static/assets/{chunk-5VM5RSS4-DkhehZDr.js → chunk-5VM5RSS4-GJHDr9Ww.js} +1 -1
- ksadk/server/static/assets/{chunk-F27PBJKO-BdXhtPe9.js → chunk-F27PBJKO-CbAN45AV.js} +1 -1
- ksadk/server/static/assets/{chunk-G27WJ6UU-DPTpvpwi.js → chunk-G27WJ6UU-D5ngbbzF.js} +1 -1
- ksadk/server/static/assets/{chunk-JWPE2WC7-Pqoh38el.js → chunk-JWPE2WC7-Cc5IwuYC.js} +1 -1
- ksadk/server/static/assets/{chunk-LCL6LL3I-DeU00qC-.js → chunk-LCL6LL3I-CprgDDdJ.js} +1 -1
- ksadk/server/static/assets/{chunk-POPQ4Y6H-CzxScFkr.js → chunk-POPQ4Y6H-CDZhSy82.js} +1 -1
- ksadk/server/static/assets/{chunk-RHFEMEQ7-DpqMx-ux.js → chunk-RHFEMEQ7-CZchUNro.js} +1 -1
- ksadk/server/static/assets/{chunk-SVP7TREG-C6t0SypQ.js → chunk-SVP7TREG-BVruqk6T.js} +1 -1
- ksadk/server/static/assets/{chunk-XXDRQBXY-DVaeafZk.js → chunk-XXDRQBXY-4ld9SxPN.js} +1 -1
- ksadk/server/static/assets/classDiagram-DTDB5LWJ-DSfLtNYm.js +1 -0
- ksadk/server/static/assets/classDiagram-v2-JRS7N3AN-DSfLtNYm.js +1 -0
- ksadk/server/static/assets/{cose-bilkent-JH36ORCC-Bf9D3tzJ.js → cose-bilkent-JH36ORCC-Dmyyk_Vp.js} +1 -1
- ksadk/server/static/assets/cynefin-OW5HDTMX-PFWIGtvA.js +1 -0
- ksadk/server/static/assets/{cynefinDiagram-5FMLGOSQ-B9cY3iTz.js → cynefinDiagram-5FMLGOSQ-BIyq3EJb.js} +1 -1
- ksadk/server/static/assets/{dagre-3AP2YEHR-CSwlx3CB.js → dagre-3AP2YEHR-eBw08Qdk.js} +1 -1
- ksadk/server/static/assets/{dagre-UBpgon5q.js → dagre-DfvnEf45.js} +1 -1
- ksadk/server/static/assets/{diagram-S7CK7UJ4-C9akhN9a.js → diagram-S7CK7UJ4-CUSrE3Mg.js} +1 -1
- ksadk/server/static/assets/{diagram-UQ7AKVKN-CgedhTPI.js → diagram-UQ7AKVKN-Dq5Zw2gy.js} +1 -1
- ksadk/server/static/assets/{diagram-VSXAHHWV-Cjucz5BY.js → diagram-VSXAHHWV-DyUHfNwT.js} +1 -1
- ksadk/server/static/assets/{diagram-VX7I27RA-Dd4Vleyn.js → diagram-VX7I27RA-CREmM89O.js} +1 -1
- ksadk/server/static/assets/{diagram-Z3DM3KII-CZ2jGtYW.js → diagram-Z3DM3KII-Dw9zhHUK.js} +1 -1
- ksadk/server/static/assets/{dist-Bj730Ib4.js → dist-0uJ4tdx6.js} +1 -1
- ksadk/server/static/assets/{dist-BnaTiyzN.js → dist-AEv-vXf-.js} +1 -1
- ksadk/server/static/assets/{dist-BgV_owcB.js → dist-B49GzZDb.js} +1 -1
- ksadk/server/static/assets/{dist-D_ctSS2i.js → dist-B8Myiet9.js} +1 -1
- ksadk/server/static/assets/{dist-ufY3F5p6.js → dist-BBsYarrI.js} +2 -2
- ksadk/server/static/assets/{dist-ClYUxfeK.js → dist-BQMrUwdI.js} +1 -1
- ksadk/server/static/assets/{dist-CFzsn6BG.js → dist-BX_-FENW.js} +1 -1
- ksadk/server/static/assets/{dist-B3FR1SKK.js → dist-CD4L6ymH.js} +1 -1
- ksadk/server/static/assets/{dist-Cf125P_m.js → dist-CHpW1BHj.js} +1 -1
- ksadk/server/static/assets/{dist-DVCOWtha.js → dist-CVPau3tn.js} +1 -1
- ksadk/server/static/assets/{dist-DFD6Qa6T.js → dist-C_qdxcSH.js} +1 -1
- ksadk/server/static/assets/{dist-BIr4DSRq.js → dist-Co68Apq4.js} +1 -1
- ksadk/server/static/assets/{dist-DiixqL0J.js → dist-Cp2PaOMY.js} +1 -1
- ksadk/server/static/assets/{dist-fBO2v5Kt.js → dist-CuR5Bgme.js} +1 -1
- ksadk/server/static/assets/{dist-DoVSwoDb.js → dist-DDSyLEOX.js} +1 -1
- ksadk/server/static/assets/{dist-C5_ZAZsG.js → dist-DUxO0R99.js} +1 -1
- ksadk/server/static/assets/{dist-C1NMAY5a.js → dist-QzbGrED_.js} +1 -1
- ksadk/server/static/assets/dist-bupkyEBZ.js +1 -0
- ksadk/server/static/assets/{dist-DvFK7p5S.js → dist-cxTGfdqx.js} +1 -1
- ksadk/server/static/assets/{dist-CB9iJrvg.js → dist-hL5p1til.js} +1 -1
- ksadk/server/static/assets/{dist-btbmmX5O.js → dist-lOy23y43.js} +1 -1
- ksadk/server/static/assets/{dist-QfkEHOlb.js → dist-pq-nD33R.js} +1 -1
- ksadk/server/static/assets/{ebnfDiagram-PWID7BFC-Ci8NqqZu.js → ebnfDiagram-PWID7BFC-BS5LdNoR.js} +1 -1
- ksadk/server/static/assets/{erDiagram-SSCWMZ5O-CCIOhLZG.js → erDiagram-SSCWMZ5O-Bv1QtiY-.js} +1 -1
- ksadk/server/static/assets/eventmodeling-NTZA5JFV-DsM4upQX.js +1 -0
- ksadk/server/static/assets/flowDiagram-A5DVABFB-D5NA16k9.js +1 -0
- ksadk/server/static/assets/{ganttDiagram-EL5Y4UJY-Cp_r9Hb6.js → ganttDiagram-EL5Y4UJY-musi-e0G.js} +1 -1
- ksadk/server/static/assets/gitGraph-4MIJSDKK-DUCVz-ih.js +1 -0
- ksadk/server/static/assets/{gitGraphDiagram-WWUBYQGX-Dlhc8Wr8.js → gitGraphDiagram-WWUBYQGX-DH37EGkG.js} +1 -1
- ksadk/server/static/assets/index-CZdkAvsv.js +244 -0
- ksadk/server/static/assets/index-CvXdHgF3.css +2 -0
- ksadk/server/static/assets/info-A6RAGUB7-rw0ZNHZp.js +1 -0
- ksadk/server/static/assets/{infoDiagram-RXCK75RN-CO0rRTRA.js → infoDiagram-RXCK75RN-C1kEtv2y.js} +1 -1
- ksadk/server/static/assets/{ishikawaDiagram-5VMMS53U-CHiaedSS.js → ishikawaDiagram-5VMMS53U-BCNPyMka.js} +1 -1
- ksadk/server/static/assets/{journeyDiagram-EYS64GPL-CHcCIB09.js → journeyDiagram-EYS64GPL--cDbKnjP.js} +1 -1
- ksadk/server/static/assets/{kanban-definition-3QL26DDD-CJ_ebBZf.js → kanban-definition-3QL26DDD-R1rAVw2f.js} +1 -1
- ksadk/server/static/assets/{katex-B4weu383.js → katex-BT-X-V7U.js} +1 -1
- ksadk/server/static/assets/{linear-V-MgYHW1.js → linear-DTR631iG.js} +1 -1
- ksadk/server/static/assets/{mermaid-parser.core-CBijEX_c.js → mermaid-parser.core-DfFzJhX8.js} +2 -2
- ksadk/server/static/assets/{mindmap-definition-FBJOCRG2-Bc-pQvpp.js → mindmap-definition-FBJOCRG2-D4by_rmk.js} +1 -1
- ksadk/server/static/assets/packet-AYTQ26CC-Ca4Hvki9.js +1 -0
- ksadk/server/static/assets/{pegDiagram-XKGWAZYB-D7genGLl.js → pegDiagram-XKGWAZYB-xWXPEh0c.js} +1 -1
- ksadk/server/static/assets/pie-WAS4IAKB-hwiz6fbw.js +1 -0
- ksadk/server/static/assets/{pieDiagram-E7YTZNPT-Bxj32zwD.js → pieDiagram-E7YTZNPT-BudBDlCI.js} +1 -1
- ksadk/server/static/assets/{quadrantDiagram-AXDQQJYC-BURv2mGh.js → quadrantDiagram-AXDQQJYC-DXZ0PCJF.js} +1 -1
- ksadk/server/static/assets/radar-RG4KPBEZ-BR1oZXLM.js +1 -0
- ksadk/server/static/assets/railroad-74A4TZTK-DfgEISfX.js +1 -0
- ksadk/server/static/assets/railroad-abnf-HS5TGJTU-CWOC3rdk.js +1 -0
- ksadk/server/static/assets/railroad-ebnf-LZEXJU2U-CiRvHCLY.js +1 -0
- ksadk/server/static/assets/railroad-peg-WCYAUIDC-DSDDyJ2f.js +1 -0
- ksadk/server/static/assets/{railroadDiagram-O6MQD6OU-CCsh3avW.js → railroadDiagram-O6MQD6OU-BdAYRYB8.js} +1 -1
- ksadk/server/static/assets/{requirementDiagram-EFPCY7ZU-_FRRBKEd.js → requirementDiagram-EFPCY7ZU-CBBmaL70.js} +1 -1
- ksadk/server/static/assets/{sankeyDiagram-P5KCCOFB-C-gr2o9M.js → sankeyDiagram-P5KCCOFB-Doc3rdwp.js} +1 -1
- ksadk/server/static/assets/{sequenceDiagram-WJ2MYXX4-D97NmfKg.js → sequenceDiagram-WJ2MYXX4-0J8R8hWW.js} +1 -1
- ksadk/server/static/assets/{sizeCapture-X5ZJPWSS-DjrPC5FX.js → sizeCapture-X5ZJPWSS-CfFLlWsK.js} +1 -1
- ksadk/server/static/assets/{stateDiagram-HBIQ2CUA-DzMNg1hh.js → stateDiagram-HBIQ2CUA-jBwkjtTy.js} +1 -1
- ksadk/server/static/assets/stateDiagram-v2-4QOOHH4V-Cw1fPb5w.js +1 -0
- ksadk/server/static/assets/{swimlanes-XN3QIQJK-Cssf_CsU.js → swimlanes-XN3QIQJK-B0WxTQf8.js} +1 -1
- ksadk/server/static/assets/swimlanesDiagram-VK2B7HYN-Cc3JMBAF.js +8 -0
- ksadk/server/static/assets/{timeline-definition-24CTP7MA-BWTHzyS1.js → timeline-definition-24CTP7MA-BfCT_75A.js} +1 -1
- ksadk/server/static/assets/treeView-Q6P3EWNA-C05SJHxo.js +1 -0
- ksadk/server/static/assets/treemap-WGGIJYW6-BqNLAhc3.js +1 -0
- ksadk/server/static/assets/{vennDiagram-4TSXK5OY-BSKgJsmR.js → vennDiagram-4TSXK5OY-9gX1VMDC.js} +1 -1
- ksadk/server/static/assets/wardley-WFR3VGLG-DokNktqB.js +1 -0
- ksadk/server/static/assets/{wardleyDiagram-VM6X3IG4-eflHNoaZ.js → wardleyDiagram-VM6X3IG4-sEs_BP6O.js} +1 -1
- ksadk/server/static/assets/{xychartDiagram-S5SC5T6Z-eYqrQ-v4.js → xychartDiagram-S5SC5T6Z-Ll4jvUN9.js} +1 -1
- ksadk/server/static/index.html +2 -2
- ksadk/server/terminal_sessions.py +34 -2
- ksadk/sessions/__init__.py +8 -1
- ksadk/sessions/_checkpoint_resume_audit.py +44 -0
- ksadk/sessions/_in_memory_query.py +112 -0
- ksadk/sessions/_local_service_sync.py +157 -156
- ksadk/sessions/_local_state_sync.py +152 -0
- ksadk/sessions/_local_tables.py +2 -0
- ksadk/sessions/_postgres_checkpoint_read.py +323 -0
- ksadk/sessions/_postgres_checkpoint_stats.py +330 -0
- ksadk/sessions/_postgres_history_read.py +678 -0
- ksadk/sessions/_postgres_schema.py +44 -2
- ksadk/sessions/_postgres_tables.py +2 -0
- ksadk/sessions/_postgres_tool_receipts.py +169 -0
- ksadk/sessions/_resilient_read.py +630 -0
- ksadk/sessions/_tool_receipt_sync.py +119 -0
- ksadk/sessions/agent_identity.py +16 -0
- ksadk/sessions/base.py +278 -0
- ksadk/sessions/db_budget.py +332 -0
- ksadk/sessions/errors.py +12 -0
- ksadk/sessions/history_budget.py +36 -0
- ksadk/sessions/history_identity.py +27 -0
- ksadk/sessions/in_memory.py +376 -113
- ksadk/sessions/invocation_identity.py +235 -0
- ksadk/sessions/local_service.py +345 -0
- ksadk/sessions/postgres_service.py +515 -549
- ksadk/sessions/resilience.py +21 -14
- ksadk/sessions/resilient.py +611 -504
- ksadk/skills/__init__.py +26 -0
- ksadk/skills/events.py +464 -0
- ksadk/skills/loader.py +44 -2
- 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 +400 -56
- 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/service_client.py +6 -1
- ksadk/skills/tool_defs.py +108 -3
- ksadk/studio/a2a_bindings.py +407 -0
- ksadk/studio/a2a_orchestration.py +178 -0
- ksadk/studio/active_run_output.py +92 -0
- ksadk/studio/activity_records.py +542 -0
- ksadk/studio/agent_configuration.py +173 -0
- ksadk/studio/api.py +784 -419
- ksadk/studio/api_a2a_routes.py +93 -0
- ksadk/studio/api_catalog_routes.py +13 -0
- ksadk/studio/api_cloud_chat_routes.py +382 -0
- ksadk/studio/api_contracts.py +31 -2
- ksadk/studio/api_plugin_routes.py +39 -12
- ksadk/studio/api_resource_connections.py +79 -41
- ksadk/studio/attachment_store.py +14 -2
- ksadk/studio/authoring.py +12 -6
- ksadk/studio/authoring_coordinator.py +4 -2
- ksadk/studio/build_resolution.py +117 -0
- ksadk/studio/build_singleflight.py +37 -0
- ksadk/studio/builder.py +32 -2
- ksadk/studio/capabilities.py +31 -9
- ksadk/studio/channel_connections.py +333 -0
- ksadk/studio/cloud.py +113 -387
- ksadk/studio/cloud_gateways.py +424 -0
- ksadk/studio/cloud_shared_web.py +82 -2
- ksadk/studio/codex_agent_service.py +19 -2
- ksadk/studio/codex_builder.py +1 -1
- ksadk/studio/codex_manifest.py +5 -1
- ksadk/studio/codex_provider_build.py +65 -0
- ksadk/studio/codex_run.py +6 -1
- ksadk/studio/compiler.py +112 -6
- ksadk/studio/configuration.py +182 -0
- ksadk/studio/contract_base.py +19 -0
- ksadk/studio/contracts.py +260 -202
- ksadk/studio/dsh_application.py +183 -27
- ksadk/studio/dsh_capability_service.py +302 -189
- ksadk/studio/dsh_lifecycle.py +58 -0
- ksadk/studio/dsh_mcp_transport.py +191 -0
- ksadk/studio/dsh_provider_registration.py +55 -16
- ksadk/studio/entry.py +53 -0
- ksadk/studio/event_store.py +53 -5
- ksadk/studio/execution_host.py +598 -0
- ksadk/studio/framework_run.py +50 -10
- ksadk/studio/hosted_kernel.py +1 -1
- ksadk/studio/interaction_submission.py +265 -0
- ksadk/studio/kernel_registry.py +429 -0
- ksadk/studio/kernel_sqlite_migration.py +181 -0
- ksadk/studio/lifecycle_status.py +43 -0
- ksadk/studio/model_buffered_wire.py +227 -0
- ksadk/studio/model_chat_tools.py +143 -0
- ksadk/studio/model_client.py +1939 -345
- ksadk/studio/model_content_stream.py +129 -0
- ksadk/studio/model_credentials.py +196 -0
- ksadk/studio/model_profile_service.py +89 -40
- ksadk/studio/model_request_projection.py +284 -0
- ksadk/studio/model_responses_content.py +296 -0
- ksadk/studio/model_usage.py +109 -0
- ksadk/studio/model_wire_failure.py +110 -0
- ksadk/studio/model_wire_identity.py +138 -0
- ksadk/studio/model_wire_snapshot.py +45 -0
- ksadk/studio/model_wire_tools.py +283 -0
- ksadk/studio/native_acceptance.py +68 -0
- ksadk/studio/native_approval.py +111 -0
- ksadk/studio/native_browser_port.py +861 -0
- ksadk/studio/native_child_mcp.py +87 -0
- ksadk/studio/native_child_publication.py +68 -0
- ksadk/studio/native_child_skills.py +72 -0
- ksadk/studio/native_child_workspace.py +176 -0
- ksadk/studio/native_command_policy.py +53 -0
- ksadk/studio/native_context_port.py +326 -0
- ksadk/studio/native_context_registration.py +54 -0
- ksadk/studio/native_document_input.py +88 -0
- ksadk/studio/native_documents.py +172 -0
- ksadk/studio/native_final_shape.py +852 -0
- ksadk/studio/native_gateway_stream.py +69 -0
- ksadk/studio/native_hook_port.py +145 -0
- ksadk/studio/native_hook_registration.py +70 -0
- ksadk/studio/native_inventory_disclosure.py +223 -0
- ksadk/studio/native_kernel_admission.py +84 -0
- ksadk/studio/native_language_diagnostics.py +320 -0
- ksadk/studio/native_mcp_disclosure.py +198 -0
- ksadk/studio/native_mcp_tool_port.py +219 -0
- ksadk/studio/native_memory_acceptance.py +362 -0
- ksadk/studio/native_memory_context.py +266 -0
- ksadk/studio/native_memory_flush.py +174 -0
- ksadk/studio/native_memory_sources.py +80 -0
- ksadk/studio/native_memory_tool_port.py +360 -0
- ksadk/studio/native_memory_turn.py +183 -0
- ksadk/studio/native_model_port.py +765 -0
- ksadk/studio/native_model_recovery.py +126 -0
- ksadk/studio/native_options.py +75 -0
- ksadk/studio/native_output_fields.py +58 -0
- ksadk/studio/native_planning.py +156 -0
- ksadk/studio/native_product.py +988 -0
- ksadk/studio/native_read_budget.py +426 -0
- ksadk/studio/native_recovery.py +171 -0
- ksadk/studio/native_scope.py +35 -0
- ksadk/studio/native_session_context_port.py +141 -0
- ksadk/studio/native_session_engine.py +14 -0
- ksadk/studio/native_skill_source.py +74 -0
- ksadk/studio/native_subagent_port.py +700 -0
- ksadk/studio/native_terminal_recovery.py +95 -0
- ksadk/studio/native_test_action.py +610 -0
- ksadk/studio/native_tool_port.py +477 -0
- ksadk/studio/native_user_input.py +60 -0
- ksadk/studio/native_verification_presentation.py +65 -0
- ksadk/studio/native_workspace_diagnostics.py +183 -0
- ksadk/studio/native_workspace_port.py +43 -0
- ksadk/studio/operations.py +34 -9
- ksadk/studio/plugin_composition.py +39 -12
- ksadk/studio/plugin_kernel_adapter.py +89 -0
- ksadk/studio/plugin_lifecycle.py +80 -0
- ksadk/studio/plugin_native_activation.py +163 -0
- ksadk/studio/plugin_runtime.py +832 -99
- ksadk/studio/plugin_runtime_admission.py +57 -0
- ksadk/studio/presentation.py +92 -0
- ksadk/studio/provider_recovery.py +59 -0
- ksadk/studio/public_output_store.py +69 -0
- ksadk/studio/recovery_page.py +70 -0
- ksadk/studio/resource_authority.py +69 -34
- ksadk/studio/resource_catalog.py +14 -12
- ksadk/studio/run_activity.py +848 -0
- ksadk/studio/run_controls.py +185 -0
- ksadk/studio/run_documents.py +127 -0
- ksadk/studio/run_service.py +1220 -335
- ksadk/studio/run_submission_receipts.py +68 -0
- ksadk/studio/runtime_catalog.py +73 -11
- ksadk/studio/runtime_prewarm.py +22 -0
- ksadk/studio/runtime_source.py +1 -1
- ksadk/studio/scheduler_assistant.py +4 -1
- ksadk/studio/scheduler_runtime.py +32 -289
- ksadk/studio/service.py +615 -246
- ksadk/studio/service_settings.py +229 -0
- ksadk/studio/shared_web.py +518 -181
- ksadk/studio/shared_web_response_events.py +180 -0
- ksadk/studio/shared_web_run_state.py +133 -0
- ksadk/studio/skill_discovery.py +305 -3
- ksadk/studio/static/assets/ChannelsPage-xX5HlMId.js +8 -0
- ksadk/studio/static/assets/CodeBlock-DMIf4h33-CkufcPYo.js +44 -0
- ksadk/studio/static/assets/ExecutionTree-v3HexvPo-Bk8wzGSy.js +1 -0
- ksadk/studio/static/assets/MathMessageMarkdown-BesSeCYl-DYG1Wzbx.js +8 -0
- ksadk/studio/static/assets/MermaidBlock-H_0qzQDf-BdXtxug_.js +11 -0
- ksadk/studio/static/assets/MessageMarkdown-CwMTvgFj-BeyLyQHu.js +59 -0
- ksadk/studio/static/assets/PrismRenderer-5pK6tUdb.js +3 -0
- ksadk/studio/static/assets/TeamsPage-CCaaGaVp.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-C7DNDik2.css +2 -0
- ksadk/studio/static/assets/index-Cy68gTlH.js +265 -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 +166 -0
- ksadk/studio/teams_installation.py +217 -0
- ksadk/studio/teams_node.py +549 -0
- ksadk/studio/teams_node_factory.py +558 -0
- ksadk/studio/teams_node_runner.py +72 -0
- ksadk/studio/teams_node_v1.py +935 -0
- ksadk/studio/teams_remote.py +496 -0
- ksadk/studio/templates.py +41 -19
- ksadk/studio/validator.py +13 -0
- ksadk/studio/workspace.py +19 -4
- ksadk/studio/workspace_plugins.py +138 -0
- ksadk/studio/workspace_registry.py +286 -0
- ksadk/tools/a2a_policy.py +5 -0
- ksadk/tools/artifact_observation.py +53 -0
- ksadk/tools/captured_source_artifact.py +68 -0
- ksadk/tools/schema.py +34 -0
- ksadk/toolsets/__init__.py +93 -88
- ksadk/toolsets/a2a.py +89 -89
- ksadk/toolsets/sandbox.py +377 -6
- ksadk/toolsets/skill_management.py +315 -0
- ksadk/toolsets/skills.py +446 -378
- ksadk/toolsets/tool_selection.py +94 -0
- ksadk/toolsets/workspace.py +344 -326
- ksadk/toolsets/workspace_editing.py +291 -0
- ksadk/toolsets/workspace_identity.py +15 -0
- ksadk/toolsets/workspace_model_observation.py +104 -0
- ksadk/toolsets/workspace_mutation.py +75 -0
- ksadk/toolsets/workspace_read_budget.py +216 -0
- ksadk/toolsets/workspace_search.py +192 -0
- ksadk/toolsets/workspace_search_process.py +129 -0
- ksadk/toolsets/workspace_state.py +6 -0
- ksadk/version.py +1 -1
- ksadk_runtime_common/http_headers.py +18 -0
- 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 +28 -14
- agentengine_sdk_python-0.8.4.dist-info/RECORD +0 -1070
- 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.6.dist-info}/WHEEL +0 -0
- {agentengine_sdk_python-0.8.4.dist-info → agentengine_sdk_python-0.8.6.dist-info}/entry_points.txt +0 -0
- {agentengine_sdk_python-0.8.4.dist-info → agentengine_sdk_python-0.8.6.dist-info}/licenses/LICENSE +0 -0
- {agentengine_sdk_python-0.8.4.dist-info → agentengine_sdk_python-0.8.6.dist-info}/top_level.txt +0 -0
- /ksadk/studio/static/assets/{MathMessageMarkdown-CBcDrAw--BEOyPC3w.css → MathMessageMarkdown-BesSeCYl-BEOyPC3w.css} +0 -0
ksadk/kernel/worker.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
"""per-session FIFO worker(
|
|
2
|
+
"""per-session FIFO worker(Kernel Task 6 Step 6)。
|
|
3
3
|
|
|
4
4
|
- 持有 activation lease(fencing token 通过 Store 的 CAS 校验)才能 claim。
|
|
5
5
|
- 按 per-session accepted_seq 保序;active Run 存在时普通 enqueue 保持排队,
|
|
@@ -19,34 +19,24 @@ execution(同一 client 实例);control lookup 永远按 durable run id。
|
|
|
19
19
|
from __future__ import annotations
|
|
20
20
|
|
|
21
21
|
import asyncio
|
|
22
|
-
import json
|
|
23
22
|
import logging
|
|
24
23
|
from collections.abc import Callable, Mapping
|
|
25
|
-
from
|
|
24
|
+
from contextlib import nullcontext
|
|
25
|
+
from dataclasses import dataclass, field, replace
|
|
26
26
|
from datetime import datetime, timezone
|
|
27
27
|
from typing import Literal
|
|
28
28
|
|
|
29
|
-
from ksadk.interaction.contracts import (
|
|
30
|
-
InteractionSubmission,
|
|
31
|
-
)
|
|
32
29
|
from ksadk.interaction.provider import (
|
|
33
30
|
RUNTIME_INTERACTION_UNAVAILABLE,
|
|
34
31
|
InteractionProvider,
|
|
35
|
-
InteractionResolveContext,
|
|
36
32
|
UnavailableInteractionProvider,
|
|
37
33
|
)
|
|
38
34
|
from ksadk.interaction.providers import default_interaction_providers
|
|
35
|
+
from ksadk.kernel.approval_presentation import approval_presentation
|
|
39
36
|
from ksadk.kernel.contracts import (
|
|
40
37
|
ActivationLease,
|
|
41
38
|
ActivationWriteGuard,
|
|
42
39
|
AgentControlCommand,
|
|
43
|
-
SubmitInteractionPayload,
|
|
44
|
-
)
|
|
45
|
-
from ksadk.kernel.contracts import (
|
|
46
|
-
InjectPayload as ContractInjectPayload,
|
|
47
|
-
)
|
|
48
|
-
from ksadk.kernel.contracts import (
|
|
49
|
-
SteerPayload as ContractSteerPayload,
|
|
50
40
|
)
|
|
51
41
|
from ksadk.kernel.errors import (
|
|
52
42
|
AgentKernelError,
|
|
@@ -54,27 +44,29 @@ from ksadk.kernel.errors import (
|
|
|
54
44
|
StaleFenceError,
|
|
55
45
|
UnsupportedControlError,
|
|
56
46
|
)
|
|
57
|
-
from ksadk.kernel.
|
|
47
|
+
from ksadk.kernel.execution_grants import (
|
|
48
|
+
ExecutionGrantBlocked,
|
|
49
|
+
execution_grant_id,
|
|
50
|
+
execution_grant_run_id,
|
|
51
|
+
)
|
|
52
|
+
from ksadk.kernel.mapping import COMMAND_HANDLERS
|
|
58
53
|
from ksadk.kernel.state import RunState
|
|
59
54
|
from ksadk.kernel.store import (
|
|
60
55
|
AgentKernelStore,
|
|
61
56
|
RunRecord,
|
|
62
57
|
control_event,
|
|
63
|
-
new_message_id,
|
|
64
58
|
)
|
|
59
|
+
from ksadk.kernel.worker_controls import WorkerControlMixin
|
|
60
|
+
from ksadk.kernel.worker_identity import prepare_worker_identity
|
|
65
61
|
from ksadk.runtime.adapter import (
|
|
66
|
-
|
|
67
|
-
PauseResult,
|
|
62
|
+
CONVERSATION_PREPROCESSING_METADATA_KEY,
|
|
68
63
|
RunHandle,
|
|
69
64
|
RuntimeAdapter,
|
|
70
65
|
StartRequest,
|
|
71
66
|
)
|
|
72
|
-
from ksadk.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
from ksadk.runtime.adapter import (
|
|
76
|
-
ResumeTarget as AdapterResumeTarget,
|
|
77
|
-
)
|
|
67
|
+
from ksadk.runtime_context import TRUSTED_IDENTITY_METADATA_KEY
|
|
68
|
+
|
|
69
|
+
from ksadk.kernel.worker_interactions import _WorkerInteractionMixin
|
|
78
70
|
|
|
79
71
|
logger = logging.getLogger(__name__)
|
|
80
72
|
|
|
@@ -99,6 +91,9 @@ class ActiveExecution:
|
|
|
99
91
|
interaction_provider: InteractionProvider
|
|
100
92
|
stream_task: asyncio.Task[None] | None = None
|
|
101
93
|
stream_guard: ActivationWriteGuard | None = None
|
|
94
|
+
managed_interaction_waiters: dict = field(default_factory=dict)
|
|
95
|
+
managed_a2a_bootstraps: dict = field(default_factory=dict)
|
|
96
|
+
recovering: bool = False
|
|
102
97
|
|
|
103
98
|
|
|
104
99
|
@dataclass(frozen=True)
|
|
@@ -112,7 +107,7 @@ class WorkResult:
|
|
|
112
107
|
error: Exception | None = None
|
|
113
108
|
|
|
114
109
|
|
|
115
|
-
class AgentKernelWorker:
|
|
110
|
+
class AgentKernelWorker(_WorkerInteractionMixin, WorkerControlMixin):
|
|
116
111
|
def __init__(
|
|
117
112
|
self,
|
|
118
113
|
store: AgentKernelStore,
|
|
@@ -121,12 +116,14 @@ class AgentKernelWorker:
|
|
|
121
116
|
session_events: object | None = None,
|
|
122
117
|
interaction_providers: Mapping[str, InteractionProvider] | None = None,
|
|
123
118
|
start_request_defaults: Mapping[str, object] | None = None,
|
|
119
|
+
session_service: object | None = None,
|
|
124
120
|
) -> None:
|
|
125
121
|
self._store = store
|
|
126
122
|
self._adapter_factory = adapter_factory
|
|
127
123
|
# SessionEventStore(typed RuntimeEventStore 的 envelope 写路径)。
|
|
128
124
|
# 缺省时不落 runtime 事件,仅保证 stream 被消费到自然结束。
|
|
129
125
|
self._session_events = session_events
|
|
126
|
+
self._session_service = session_service
|
|
130
127
|
# Deployment-owned defaults (model, prompt and sandbox) come from the
|
|
131
128
|
# admitted immutable manifest. Server may attach a bounded per-turn
|
|
132
129
|
# model/approval selector to the signed command; the worker validates
|
|
@@ -144,7 +141,7 @@ class AgentKernelWorker:
|
|
|
144
141
|
# A stream may fail after its enqueue has been durably completed. Keep
|
|
145
142
|
# the exception observable to diagnostics without leaving an unhandled
|
|
146
143
|
# Task warning; the durable run remains open for recovery/takeover.
|
|
147
|
-
self._background_stream_errors: dict[str, Exception] = {}
|
|
144
|
+
self._background_stream_errors: dict[str, tuple[ActivationWriteGuard, Exception]] = {}
|
|
148
145
|
# ``ActivationLease`` is a frozen wire contract and intentionally does
|
|
149
146
|
# not carry ``session_id``. Production composition roots therefore
|
|
150
147
|
# pass the session scope to ``run_once`` explicitly. Serialize that
|
|
@@ -196,11 +193,52 @@ class AgentKernelWorker:
|
|
|
196
193
|
self._executions[durable_run_id] = execution
|
|
197
194
|
return execution
|
|
198
195
|
|
|
196
|
+
def recover_stream(
|
|
197
|
+
self,
|
|
198
|
+
*,
|
|
199
|
+
run: RunRecord,
|
|
200
|
+
adapter: RuntimeAdapter,
|
|
201
|
+
handle: RunHandle,
|
|
202
|
+
guard: ActivationWriteGuard,
|
|
203
|
+
) -> ActiveExecution:
|
|
204
|
+
"""Own native recovery under the same fenced event/interaction pipeline."""
|
|
205
|
+
if handle.session_id != run.session_id or handle.run_id != run.metadata.get(
|
|
206
|
+
"runtime_run_id", run.run_id
|
|
207
|
+
):
|
|
208
|
+
raise ValueError("recovery handle does not match durable run")
|
|
209
|
+
current = self._executions.get(run.run_id)
|
|
210
|
+
if (
|
|
211
|
+
current is not None
|
|
212
|
+
and current.stream_task is not None
|
|
213
|
+
and not current.stream_task.done()
|
|
214
|
+
):
|
|
215
|
+
raise ValueError("recovery cannot replace an active stream owner")
|
|
216
|
+
execution = self.adopt_execution(
|
|
217
|
+
durable_run_id=run.run_id,
|
|
218
|
+
runtime_run_id=handle.run_id,
|
|
219
|
+
adapter=adapter,
|
|
220
|
+
handle=handle,
|
|
221
|
+
)
|
|
222
|
+
execution.recovering = True
|
|
223
|
+
return self._start_stream(execution, run, guard)
|
|
224
|
+
|
|
199
225
|
def execution_for(self, durable_run_id: str) -> ActiveExecution | None:
|
|
200
226
|
"""control lookup 入口:永远按 durable run id 查 live execution。"""
|
|
201
227
|
|
|
202
228
|
return self._executions.get(durable_run_id)
|
|
203
229
|
|
|
230
|
+
def take_stream_failure(self, run_id: str, activation: ActivationLease) -> Exception | None:
|
|
231
|
+
"""Hand a failed stream back only to its original fenced owner."""
|
|
232
|
+
failure = self._background_stream_errors.pop(run_id, None)
|
|
233
|
+
if failure is None:
|
|
234
|
+
return None
|
|
235
|
+
guard, error = failure
|
|
236
|
+
if (guard.activation_id, guard.fencing_token) != (
|
|
237
|
+
activation.activation_id, activation.fencing_token
|
|
238
|
+
):
|
|
239
|
+
return None
|
|
240
|
+
return error
|
|
241
|
+
|
|
204
242
|
def active_session_ids(self) -> set[str]:
|
|
205
243
|
"""Sessions whose activation must stay alive after Inbox ack.
|
|
206
244
|
|
|
@@ -247,27 +285,69 @@ class AgentKernelWorker:
|
|
|
247
285
|
# enqueue,此时其后的 interrupt/pause/steer 等控制命令必须能越过
|
|
248
286
|
# 该 enqueue 作用于 active Run。只处理当前 activation 持有 lease 的
|
|
249
287
|
# session,避免跨 session 抢占。
|
|
250
|
-
|
|
288
|
+
suspended_enqueue = False
|
|
251
289
|
for message in sorted(pending, key=lambda m: m.accepted_seq):
|
|
252
290
|
if session_id is not None and message.session_id != session_id:
|
|
253
291
|
continue
|
|
254
292
|
lease = await self._store.current_lease(agent_instance_id, message.session_id)
|
|
255
293
|
if lease is None or lease.activation_id != activation.activation_id:
|
|
256
|
-
continue
|
|
257
|
-
if message.command is None:
|
|
294
|
+
continue
|
|
295
|
+
if message.command is None:
|
|
258
296
|
continue
|
|
259
297
|
if message.command.command_type == "enqueue":
|
|
260
298
|
active = await self._store.find_active_run(agent_instance_id, message.session_id)
|
|
261
|
-
if active is not None:
|
|
262
|
-
continue
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
299
|
+
if active is not None or suspended_enqueue:
|
|
300
|
+
continue
|
|
301
|
+
if await self._awaiting_recovered_waiter(message.command, activation):
|
|
302
|
+
# Recovery installs managed waiters asynchronously. Keep the
|
|
303
|
+
# accepted reply in the durable inbox until its original waiter
|
|
304
|
+
# exists; other sessions and cancellation can still progress.
|
|
305
|
+
continue
|
|
306
|
+
try:
|
|
307
|
+
# Store claim and execution-grant validation share one atomic
|
|
308
|
+
# transaction. A prior list/read is never start authorization.
|
|
309
|
+
claimed = await self._store.claim_message(message.message_id, fence)
|
|
310
|
+
except ExecutionGrantBlocked as error:
|
|
311
|
+
if error.grant_state in {"suspended", "admission_paused", "queued", "busy"}:
|
|
312
|
+
# Preserve enqueue FIFO while still letting cancel/resume
|
|
313
|
+
# controls behind the suspended command reach active work.
|
|
314
|
+
suspended_enqueue = True
|
|
315
|
+
continue
|
|
316
|
+
return await self._execute_claim(claimed.command, activation)
|
|
317
|
+
return WorkResult(outcome="idle")
|
|
267
318
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
319
|
+
async def _awaiting_recovered_waiter(
|
|
320
|
+
self, command: AgentControlCommand, activation: ActivationLease
|
|
321
|
+
) -> bool:
|
|
322
|
+
if command.command_type != "submit_interaction":
|
|
323
|
+
return False
|
|
324
|
+
interaction_id = command.payload.get("interaction_id")
|
|
325
|
+
if not isinstance(interaction_id, str) or not interaction_id:
|
|
326
|
+
return False
|
|
327
|
+
active = await self._store.find_active_run(command.agent_instance_id, command.session_id)
|
|
328
|
+
execution = self._executions.get(active.run_id) if active is not None else None
|
|
329
|
+
if not (
|
|
330
|
+
execution is not None and execution.recovering
|
|
331
|
+
and execution.stream_task is not None and not execution.stream_task.done()
|
|
332
|
+
and execution.stream_guard is not None
|
|
333
|
+
and execution.stream_guard.activation_id == activation.activation_id
|
|
334
|
+
and execution.stream_guard.fencing_token == activation.fencing_token
|
|
335
|
+
and interaction_id not in execution.managed_interaction_waiters
|
|
336
|
+
):
|
|
337
|
+
return False
|
|
338
|
+
record = await self._store.get( # type: ignore[attr-defined]
|
|
339
|
+
interaction_id, tenant_id=command.tenant_id,
|
|
340
|
+
agent_instance_id=command.agent_instance_id, session_id=command.session_id,
|
|
341
|
+
run_id=active.run_id,
|
|
342
|
+
)
|
|
343
|
+
if (record is None or record.provider_id != "managed-a2a"
|
|
344
|
+
or record.status != "pending"
|
|
345
|
+
or record.tenant_id != command.tenant_id
|
|
346
|
+
or record.agent_instance_id != command.agent_instance_id
|
|
347
|
+
or record.session_id != command.session_id
|
|
348
|
+
or command.payload.get("run_id", record.run_id) != record.run_id):
|
|
349
|
+
return False
|
|
350
|
+
return True
|
|
271
351
|
|
|
272
352
|
# ------------------------------------------------------------- execution
|
|
273
353
|
|
|
@@ -296,9 +376,7 @@ class AgentKernelWorker:
|
|
|
296
376
|
await self._store.discard_claim(message_id, expected_fence=fence)
|
|
297
377
|
return WorkResult(outcome="completed", message_id=message_id)
|
|
298
378
|
except StaleFenceError as error:
|
|
299
|
-
return WorkResult(
|
|
300
|
-
outcome="terminal_failure", message_id=message_id, error=error
|
|
301
|
-
)
|
|
379
|
+
return WorkResult(outcome="terminal_failure", message_id=message_id, error=error)
|
|
302
380
|
except AgentKernelError as error:
|
|
303
381
|
if error.code == RUNTIME_INTERACTION_UNAVAILABLE:
|
|
304
382
|
# typed rejection:provider 诚实声明无法原生送达回包,
|
|
@@ -319,9 +397,7 @@ class AgentKernelWorker:
|
|
|
319
397
|
await self._store.discard_claim(message_id, expected_fence=fence)
|
|
320
398
|
return WorkResult(outcome="completed", message_id=message_id)
|
|
321
399
|
if error.retryable:
|
|
322
|
-
return WorkResult(
|
|
323
|
-
outcome="retryable_failure", message_id=message_id, error=error
|
|
324
|
-
)
|
|
400
|
+
return WorkResult(outcome="retryable_failure", message_id=message_id, error=error)
|
|
325
401
|
logger.error(
|
|
326
402
|
"agent kernel command failed permanently: "
|
|
327
403
|
"agent_instance_id=%s session_id=%s command_id=%s "
|
|
@@ -333,9 +409,7 @@ class AgentKernelWorker:
|
|
|
333
409
|
type(error).__name__,
|
|
334
410
|
error,
|
|
335
411
|
)
|
|
336
|
-
return WorkResult(
|
|
337
|
-
outcome="terminal_failure", message_id=message_id, error=error
|
|
338
|
-
)
|
|
412
|
+
return WorkResult(outcome="terminal_failure", message_id=message_id, error=error)
|
|
339
413
|
except Exception as error:
|
|
340
414
|
# 未知异常绝不 ack 为成功:消息保持 claimed。
|
|
341
415
|
logger.exception(
|
|
@@ -349,16 +423,12 @@ class AgentKernelWorker:
|
|
|
349
423
|
type(error).__name__,
|
|
350
424
|
error,
|
|
351
425
|
)
|
|
352
|
-
return WorkResult(
|
|
353
|
-
outcome="terminal_failure", message_id=message_id, error=error
|
|
354
|
-
)
|
|
426
|
+
return WorkResult(outcome="terminal_failure", message_id=message_id, error=error)
|
|
355
427
|
|
|
356
428
|
try:
|
|
357
429
|
await self._store.complete_claim(message_id, expected_fence=fence)
|
|
358
430
|
except StaleFenceError as error:
|
|
359
|
-
return WorkResult(
|
|
360
|
-
outcome="terminal_failure", message_id=message_id, error=error
|
|
361
|
-
)
|
|
431
|
+
return WorkResult(outcome="terminal_failure", message_id=message_id, error=error)
|
|
362
432
|
return WorkResult(outcome="completed", message_id=message_id, run_id=run_id)
|
|
363
433
|
|
|
364
434
|
async def _message_id_for(self, command: AgentControlCommand) -> str:
|
|
@@ -382,7 +452,41 @@ class AgentKernelWorker:
|
|
|
382
452
|
|
|
383
453
|
fence = activation.fencing_token
|
|
384
454
|
guard = ActivationWriteGuard(activation_id=activation.activation_id, fencing_token=fence)
|
|
385
|
-
|
|
455
|
+
if command.payload.get("legacy_history") is not None:
|
|
456
|
+
if self._session_events is None:
|
|
457
|
+
raise InvalidCommandError("legacy history import requires a SessionEvent store")
|
|
458
|
+
from ksadk.kernel.legacy_history import import_legacy_history
|
|
459
|
+
|
|
460
|
+
await import_legacy_history(
|
|
461
|
+
command,
|
|
462
|
+
session_events=self._session_events,
|
|
463
|
+
guard=guard,
|
|
464
|
+
)
|
|
465
|
+
grant_id = execution_grant_id(command)
|
|
466
|
+
# The stable identity also covers ordinary cloud enqueues. Grant-less
|
|
467
|
+
# requests must not repeat a native start whose response was lost.
|
|
468
|
+
run_id = execution_grant_run_id(command)
|
|
469
|
+
previous = await self._store.load_run(run_id)
|
|
470
|
+
if previous is None and not grant_id:
|
|
471
|
+
# Older workers used random Run IDs. Recover their command link
|
|
472
|
+
# instead of silently creating a second run after an upgrade.
|
|
473
|
+
previous = await self._store.find_command_run(
|
|
474
|
+
command.agent_instance_id, command.session_id, str(command.command_id)
|
|
475
|
+
)
|
|
476
|
+
if previous is not None:
|
|
477
|
+
if (previous.agent_instance_id != command.agent_instance_id
|
|
478
|
+
or previous.session_id != command.session_id
|
|
479
|
+
or previous.metadata.get("command_id") != str(command.command_id)):
|
|
480
|
+
raise InvalidCommandError("existing run does not match command identity")
|
|
481
|
+
if previous.state == RunState.PENDING:
|
|
482
|
+
await self._store.save_run_transition(
|
|
483
|
+
previous.model_copy(update={
|
|
484
|
+
"state": RunState.INTERRUPTED,
|
|
485
|
+
"reason": "execution_start_uncertain",
|
|
486
|
+
}),
|
|
487
|
+
expected_fence=fence,
|
|
488
|
+
)
|
|
489
|
+
return previous.run_id
|
|
386
490
|
adapter = self._adapter_factory()
|
|
387
491
|
pending = RunRecord(
|
|
388
492
|
run_id=run_id,
|
|
@@ -396,13 +500,22 @@ class AgentKernelWorker:
|
|
|
396
500
|
# back to one occurrence without matching text or wall-clock time.
|
|
397
501
|
metadata={
|
|
398
502
|
"command_id": str(command.command_id),
|
|
503
|
+
# Presentation is durable run metadata, never a model/provider option.
|
|
504
|
+
"presentation_profile": (
|
|
505
|
+
"agent-block-v1" if command.payload.get("presentation_profile") == "agent-block-v1"
|
|
506
|
+
else "flat-v1"
|
|
507
|
+
),
|
|
508
|
+
**({"execution_grant_id": grant_id} if grant_id else {}),
|
|
399
509
|
"source_kind": command.source.kind,
|
|
400
510
|
"source_ref": command.source.ref,
|
|
401
511
|
"correlation_id": command.correlation_id,
|
|
402
512
|
},
|
|
403
513
|
)
|
|
404
514
|
created = await self._store.save_run_transition(pending, expected_fence=fence)
|
|
405
|
-
|
|
515
|
+
prepare_continuation = getattr(adapter, "prepare_session_continuation", None)
|
|
516
|
+
continuation_metadata = await self._session_continuation_metadata(
|
|
517
|
+
command.session_id, include_run=callable(prepare_continuation),
|
|
518
|
+
)
|
|
406
519
|
defaults = self._start_request_defaults
|
|
407
520
|
runtime_options = command.payload.get("runtime_options")
|
|
408
521
|
if not isinstance(runtime_options, Mapping):
|
|
@@ -422,6 +535,20 @@ class AgentKernelWorker:
|
|
|
422
535
|
else default_model
|
|
423
536
|
)
|
|
424
537
|
request_config = dict(defaults.get("config") or {})
|
|
538
|
+
requested_collaboration = str(
|
|
539
|
+
runtime_options.get("collaborationMode")
|
|
540
|
+
or runtime_options.get("collaboration_mode")
|
|
541
|
+
or ""
|
|
542
|
+
).strip()
|
|
543
|
+
if requested_collaboration in {"default", "plan"}:
|
|
544
|
+
request_config["collaboration_mode"] = requested_collaboration
|
|
545
|
+
requested_goal = str(
|
|
546
|
+
runtime_options.get("goalObjective")
|
|
547
|
+
or runtime_options.get("goal_objective")
|
|
548
|
+
or ""
|
|
549
|
+
).strip()
|
|
550
|
+
if requested_goal:
|
|
551
|
+
request_config["goal_objective"] = requested_goal
|
|
425
552
|
approval_mode = str(runtime_options.get("tool_approval_mode") or "").strip().lower()
|
|
426
553
|
approval_overrides = {
|
|
427
554
|
"ask": "manual",
|
|
@@ -429,34 +556,108 @@ class AgentKernelWorker:
|
|
|
429
556
|
}
|
|
430
557
|
if approval_mode in approval_overrides:
|
|
431
558
|
request_config["approval_mode"] = approval_overrides[approval_mode]
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
559
|
+
effective_user_id, invocation_identity = await prepare_worker_identity(
|
|
560
|
+
command=command,
|
|
561
|
+
defaults=defaults,
|
|
562
|
+
session_service=self._session_service,
|
|
563
|
+
)
|
|
564
|
+
|
|
565
|
+
conversation_metadata = {}
|
|
566
|
+
if adapter.runtime.runtime_type == "harness" and self._session_events is not None:
|
|
567
|
+
from ksadk.kernel.worker_history import harness_conversation_messages
|
|
568
|
+
|
|
569
|
+
conversation_metadata[CONVERSATION_PREPROCESSING_METADATA_KEY] = {
|
|
570
|
+
"messages": await harness_conversation_messages(
|
|
571
|
+
command,
|
|
572
|
+
store=self._store,
|
|
573
|
+
session_events=self._session_events,
|
|
574
|
+
),
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
start_request = StartRequest(
|
|
578
|
+
input=command.payload.get("content"),
|
|
579
|
+
user_id=effective_user_id,
|
|
580
|
+
session_id=command.session_id,
|
|
581
|
+
agent_id=str(defaults.get("agent_id") or command.agent_instance_id),
|
|
582
|
+
model=selected_model,
|
|
583
|
+
config=request_config,
|
|
584
|
+
# durable run_id 优先传给 adapter;adapter 不认时以
|
|
585
|
+
# runtime_run_id 映射显式记录两个 ID 的对应关系。
|
|
586
|
+
metadata={
|
|
587
|
+
**(
|
|
588
|
+
{"session_context": command.payload["session_context"]}
|
|
589
|
+
if "session_context" in command.payload
|
|
590
|
+
else {}
|
|
591
|
+
),
|
|
592
|
+
"command_id": str(command.command_id),
|
|
593
|
+
"run_id": run_id,
|
|
594
|
+
# Managed tools and runners consume the canonical tool profile
|
|
595
|
+
# from invocation metadata, alongside the Harness config above.
|
|
596
|
+
**(
|
|
597
|
+
{"tool_approval_mode": approval_mode}
|
|
598
|
+
if approval_mode in {"ask", "risk", "full"} else {}
|
|
599
|
+
),
|
|
600
|
+
**(
|
|
601
|
+
{TRUSTED_IDENTITY_METADATA_KEY: dict(invocation_identity)}
|
|
602
|
+
if isinstance(invocation_identity, Mapping)
|
|
603
|
+
else {}
|
|
604
|
+
),
|
|
605
|
+
**continuation_metadata,
|
|
606
|
+
**conversation_metadata,
|
|
607
|
+
# Opaque policy reference is supplied only by a trusted
|
|
608
|
+
# ingress. The Provider resolves and reauthorizes it for
|
|
609
|
+
# this exact Run; Kernel owns no plugin policy semantics.
|
|
610
|
+
**(
|
|
611
|
+
{"execution_policy_ref": command.payload["execution_policy_ref"]}
|
|
612
|
+
if isinstance(command.payload.get("execution_policy_ref"), str)
|
|
613
|
+
else {}
|
|
614
|
+
),
|
|
615
|
+
# An opaque Teams reference carries no permissions by itself.
|
|
616
|
+
# Trusted host policy resolution must match the prepared
|
|
617
|
+
# command/session/run before exposing tools.
|
|
618
|
+
**(
|
|
619
|
+
{"teams_context_ref": command.payload["teams_context_ref"]}
|
|
620
|
+
if isinstance(command.payload.get("teams_context_ref"), str)
|
|
621
|
+
else {}
|
|
622
|
+
),
|
|
623
|
+
},
|
|
624
|
+
)
|
|
625
|
+
start_snapshot = (
|
|
626
|
+
start_request.model_dump(mode="json")
|
|
627
|
+
if adapter.runtime.runtime_type == "adk"
|
|
628
|
+
or getattr(adapter, "requires_durable_start_request", False)
|
|
629
|
+
else None
|
|
630
|
+
)
|
|
631
|
+
# Some adapters (notably ADK) consume their first native events inside
|
|
632
|
+
# ``start`` in order to discover the invocation id. Checkpoint/event
|
|
633
|
+
# writes performed there must use the same Kernel-owned session service
|
|
634
|
+
# as the later background stream.
|
|
635
|
+
from ksadk.sessions import bind_session_service
|
|
636
|
+
|
|
637
|
+
start_session_scope = (
|
|
638
|
+
bind_session_service(self._session_service)
|
|
639
|
+
if self._session_service is not None
|
|
640
|
+
else nullcontext()
|
|
453
641
|
)
|
|
642
|
+
with start_session_scope:
|
|
643
|
+
if callable(prepare_continuation) and continuation_metadata.get("thread_id"):
|
|
644
|
+
predecessor_id = continuation_metadata.get("continuation_run_id")
|
|
645
|
+
predecessor = await self._store.load_run(predecessor_id) if predecessor_id else None
|
|
646
|
+
await prepare_continuation(
|
|
647
|
+
predecessor, start_request, agent_instance_id=command.agent_instance_id,
|
|
648
|
+
tenant_id=command.tenant_id,
|
|
649
|
+
)
|
|
650
|
+
handle = await adapter.start(start_request)
|
|
454
651
|
running_update: dict = {
|
|
455
652
|
"state": RunState.RUNNING,
|
|
456
653
|
"handle": handle.model_dump(mode="json"),
|
|
457
654
|
"handle_digest": handle_digest(handle),
|
|
458
655
|
"tenant_id": command.tenant_id,
|
|
459
656
|
}
|
|
657
|
+
if start_snapshot is not None:
|
|
658
|
+
# Private RunRecord metadata, committed before the stream can
|
|
659
|
+
# invoke tools or contact a model. Never a public control payload.
|
|
660
|
+
running_update["start_request"] = start_snapshot
|
|
460
661
|
if handle.run_id != run_id:
|
|
461
662
|
running_update["runtime_run_id"] = handle.run_id
|
|
462
663
|
running = created.model_copy(update=running_update)
|
|
@@ -479,7 +680,9 @@ class AgentKernelWorker:
|
|
|
479
680
|
execution.stream_task.result()
|
|
480
681
|
return run_id
|
|
481
682
|
|
|
482
|
-
async def _session_continuation_metadata(
|
|
683
|
+
async def _session_continuation_metadata(
|
|
684
|
+
self, session_id: str, *, include_run: bool = False,
|
|
685
|
+
) -> dict[str, str]:
|
|
483
686
|
"""Recover the latest native thread identity for a follow-up turn.
|
|
484
687
|
|
|
485
688
|
A durable Session owns multiple terminal Runs. Starting each enqueue
|
|
@@ -491,11 +694,17 @@ class AgentKernelWorker:
|
|
|
491
694
|
|
|
492
695
|
if self._session_events is None:
|
|
493
696
|
return {}
|
|
494
|
-
from ksadk.events.canonical import ContinuationCreated, ContinuationResumed
|
|
697
|
+
from ksadk.events.canonical import ContinuationCreated, ContinuationResumed, RunCompleted
|
|
495
698
|
from ksadk.events.canonical_store import RuntimeEventStore
|
|
496
699
|
|
|
497
700
|
events = await RuntimeEventStore(self._session_events).list(session_id, limit=256)
|
|
498
701
|
for event in reversed(events):
|
|
702
|
+
if include_run and isinstance(event, RunCompleted) and event.source.framework == "codex":
|
|
703
|
+
# A long turn can evict its initial continuation fact from this
|
|
704
|
+
# tail window; its completed fact carries the same thread scope.
|
|
705
|
+
completed_thread = str(event.source.metadata.get("thread_id") or "").strip()
|
|
706
|
+
if completed_thread:
|
|
707
|
+
return {"thread_id": completed_thread, "continuation_run_id": event.run_id}
|
|
499
708
|
if not isinstance(event, (ContinuationCreated, ContinuationResumed)):
|
|
500
709
|
continue
|
|
501
710
|
if event.continuation_kind != "thread_resume":
|
|
@@ -505,7 +714,20 @@ class AgentKernelWorker:
|
|
|
505
714
|
if not thread_id:
|
|
506
715
|
thread_id = str(event.source.metadata.get("thread_id") or "").strip()
|
|
507
716
|
if thread_id:
|
|
508
|
-
|
|
717
|
+
predecessor_id = event.run_id
|
|
718
|
+
if include_run:
|
|
719
|
+
# Native thread continuation facts need not repeat on every
|
|
720
|
+
# turn. Use its latest completed Run, not the Run that first
|
|
721
|
+
# announced this thread, or a third turn can lose turn two.
|
|
722
|
+
for terminal in reversed(events):
|
|
723
|
+
if (isinstance(terminal, RunCompleted)
|
|
724
|
+
and terminal.source.framework == "codex"
|
|
725
|
+
and terminal.source.metadata.get("thread_id") == thread_id):
|
|
726
|
+
predecessor_id = terminal.run_id
|
|
727
|
+
break
|
|
728
|
+
return {"thread_id": thread_id, **(
|
|
729
|
+
{"continuation_run_id": predecessor_id} if include_run else {}
|
|
730
|
+
)}
|
|
509
731
|
return {}
|
|
510
732
|
|
|
511
733
|
def _start_stream(
|
|
@@ -543,7 +765,6 @@ class AgentKernelWorker:
|
|
|
543
765
|
type(error).__name__,
|
|
544
766
|
error,
|
|
545
767
|
)
|
|
546
|
-
self._background_stream_errors[run_id] = error
|
|
547
768
|
# A background stream has already left the Inbox claim path. Do
|
|
548
769
|
# not turn its failure into an invisible hung UI; keep the full
|
|
549
770
|
# traceback in workload logs while recovery turns the durable run
|
|
@@ -563,6 +784,8 @@ class AgentKernelWorker:
|
|
|
563
784
|
# attachment immediately.
|
|
564
785
|
execution = self._executions.get(run_id)
|
|
565
786
|
if execution is not None and execution.stream_task is task:
|
|
787
|
+
if execution.stream_guard is not None:
|
|
788
|
+
self._background_stream_errors[run_id] = (execution.stream_guard, error)
|
|
566
789
|
self._executions.pop(run_id, None)
|
|
567
790
|
cleanup = asyncio.create_task(
|
|
568
791
|
self._close_failed_execution(execution),
|
|
@@ -593,6 +816,31 @@ class AgentKernelWorker:
|
|
|
593
816
|
execution: ActiveExecution,
|
|
594
817
|
run: RunRecord,
|
|
595
818
|
guard: ActivationWriteGuard,
|
|
819
|
+
) -> None:
|
|
820
|
+
if self._session_events is None:
|
|
821
|
+
return await self._consume_owned_stream(execution, run, guard)
|
|
822
|
+
from ksadk.events.run_authority import RunEventAuthority, bind_run_event_authority
|
|
823
|
+
from ksadk.sessions import bind_session_service
|
|
824
|
+
|
|
825
|
+
authority = RunEventAuthority(
|
|
826
|
+
self._session_events, session_id=run.session_id, run_id=run.run_id, guard=guard,
|
|
827
|
+
interaction_ledger=self._store, tenant_id=str(run.metadata.get("tenant_id") or ""),
|
|
828
|
+
agent_instance_id=run.agent_instance_id,
|
|
829
|
+
managed_a2a_bootstraps=execution.managed_a2a_bootstraps,
|
|
830
|
+
)
|
|
831
|
+
session_scope = (
|
|
832
|
+
bind_session_service(self._session_service)
|
|
833
|
+
if self._session_service is not None
|
|
834
|
+
else nullcontext()
|
|
835
|
+
)
|
|
836
|
+
with bind_run_event_authority(authority), session_scope:
|
|
837
|
+
return await self._consume_owned_stream(execution, run, guard)
|
|
838
|
+
|
|
839
|
+
async def _consume_owned_stream(
|
|
840
|
+
self,
|
|
841
|
+
execution: ActiveExecution,
|
|
842
|
+
run: RunRecord,
|
|
843
|
+
guard: ActivationWriteGuard,
|
|
596
844
|
) -> None:
|
|
597
845
|
"""消费 run 的事件流并把每个事实落为 family=runtime/v2 事件。
|
|
598
846
|
|
|
@@ -610,11 +858,18 @@ class AgentKernelWorker:
|
|
|
610
858
|
)
|
|
611
859
|
|
|
612
860
|
runtime_store = None
|
|
861
|
+
recovery_reconciler = None
|
|
613
862
|
if self._session_events is not None:
|
|
614
863
|
# 延迟导入:ksadk.events 反向依赖 kernel.contracts,避免模块环。
|
|
615
864
|
from ksadk.events.canonical_store import RuntimeEventStore
|
|
616
865
|
|
|
617
866
|
runtime_store = RuntimeEventStore(self._session_events, session_id=run.session_id)
|
|
867
|
+
if execution.recovering:
|
|
868
|
+
from ksadk.kernel.recovery_projection import RecoveryEventReconciler
|
|
869
|
+
|
|
870
|
+
recovery_reconciler = RecoveryEventReconciler(
|
|
871
|
+
await runtime_store.list(run.session_id, run_id=run.run_id)
|
|
872
|
+
)
|
|
618
873
|
current_run = run
|
|
619
874
|
terminal_state: RunState | None = None
|
|
620
875
|
last_source: SourceRef | None = None
|
|
@@ -635,8 +890,8 @@ class AgentKernelWorker:
|
|
|
635
890
|
and event.interaction_id
|
|
636
891
|
and current_run.state is RunState.WAITING
|
|
637
892
|
):
|
|
638
|
-
#
|
|
639
|
-
# describe a
|
|
893
|
+
# Framework adapters emit this after InteractionRequested to
|
|
894
|
+
# describe a temporarily blocked native turn. The durable
|
|
640
895
|
# Kernel state for that condition is WAITING and the
|
|
641
896
|
# Interaction/v1 ledger is its authority. Treating the
|
|
642
897
|
# companion run.interrupted event as a terminal fact closes the
|
|
@@ -653,7 +908,14 @@ class AgentKernelWorker:
|
|
|
653
908
|
update["scope_id"] = f"run:{run.run_id}"
|
|
654
909
|
event = event.model_copy(update=update)
|
|
655
910
|
last_source = event.source
|
|
656
|
-
|
|
911
|
+
events_to_append = (
|
|
912
|
+
recovery_reconciler.accept(event) if recovery_reconciler is not None else (event,)
|
|
913
|
+
)
|
|
914
|
+
for candidate in events_to_append:
|
|
915
|
+
await runtime_store.append(candidate, guard=guard)
|
|
916
|
+
remember = getattr(execution.adapter, "remember_managed_checkpoint", None)
|
|
917
|
+
if callable(remember):
|
|
918
|
+
remember(execution.handle, event)
|
|
657
919
|
terminal_state = {
|
|
658
920
|
"run.completed": RunState.COMPLETED,
|
|
659
921
|
"run.failed": RunState.FAILED,
|
|
@@ -668,6 +930,10 @@ class AgentKernelWorker:
|
|
|
668
930
|
# every later FIFO command queued forever.
|
|
669
931
|
break
|
|
670
932
|
|
|
933
|
+
if recovery_reconciler is not None and runtime_store is not None:
|
|
934
|
+
for candidate in recovery_reconciler.flush():
|
|
935
|
+
await runtime_store.append(candidate, guard=guard)
|
|
936
|
+
|
|
671
937
|
# ``submit_interaction`` may resolve a live provider while this task is
|
|
672
938
|
# blocked in the framework stream. It transitions the durable run
|
|
673
939
|
# WAITING -> RUNNING, but ``current_run`` above is deliberately a
|
|
@@ -708,6 +974,26 @@ class AgentKernelWorker:
|
|
|
708
974
|
guard=guard,
|
|
709
975
|
)
|
|
710
976
|
if terminal_state is not None:
|
|
977
|
+
# Managed A2A waiters can end on their own deadline without a
|
|
978
|
+
# SubmitInteraction command. A terminal run must not leave their
|
|
979
|
+
# durable approval/input prompts pending in replay. Native provider
|
|
980
|
+
# interactions retain their existing lifecycle.
|
|
981
|
+
now = datetime.now(timezone.utc)
|
|
982
|
+
for record in await self._store.list_pending_interactions(
|
|
983
|
+
str(current_run.metadata.get("tenant_id") or ""), current_run.session_id
|
|
984
|
+
):
|
|
985
|
+
if (
|
|
986
|
+
record.run_id != current_run.run_id
|
|
987
|
+
or record.agent_instance_id != current_run.agent_instance_id
|
|
988
|
+
or record.provider_id != "managed-a2a"
|
|
989
|
+
):
|
|
990
|
+
continue
|
|
991
|
+
expired = record.expires_at is not None and datetime.fromisoformat(record.expires_at) <= now
|
|
992
|
+
settle = self._store.expire if expired else self._store.cancel
|
|
993
|
+
await settle(record.interaction_id, record.revision, guard=guard)
|
|
994
|
+
waiter = execution.managed_interaction_waiters.pop(record.interaction_id, None)
|
|
995
|
+
if waiter is not None:
|
|
996
|
+
waiter.close()
|
|
711
997
|
current_run = await self._store.save_run_transition(
|
|
712
998
|
current_run.model_copy(update={"state": terminal_state}),
|
|
713
999
|
expected_fence=guard.fencing_token,
|
|
@@ -737,264 +1023,7 @@ class AgentKernelWorker:
|
|
|
737
1023
|
execution.durable_run_id,
|
|
738
1024
|
)
|
|
739
1025
|
|
|
740
|
-
async def _record_interaction_request(
|
|
741
|
-
self,
|
|
742
|
-
execution: ActiveExecution,
|
|
743
|
-
run: RunRecord,
|
|
744
|
-
event: object,
|
|
745
|
-
guard: ActivationWriteGuard,
|
|
746
|
-
) -> RunRecord:
|
|
747
|
-
"""Persist one framework interaction as the durable ledger authority."""
|
|
748
|
-
|
|
749
|
-
from ksadk.events.canonical import ApprovalRequest, InteractionRequested
|
|
750
|
-
from ksadk.interaction.contracts import InteractionPresentation, InteractionRecord
|
|
751
|
-
|
|
752
|
-
assert isinstance(event, InteractionRequested)
|
|
753
|
-
presentation = None
|
|
754
|
-
if isinstance(event.request, ApprovalRequest):
|
|
755
|
-
request_schema = {
|
|
756
|
-
"type": "object",
|
|
757
|
-
"properties": {
|
|
758
|
-
"decision": {
|
|
759
|
-
"type": "string",
|
|
760
|
-
"enum": ["approve", "reject"],
|
|
761
|
-
}
|
|
762
|
-
},
|
|
763
|
-
"required": ["decision"],
|
|
764
|
-
}
|
|
765
|
-
native_target = {"call_id": event.request.call_id or event.interaction_id}
|
|
766
|
-
detail = event.request.detail if isinstance(event.request.detail, Mapping) else {}
|
|
767
|
-
visible_arguments = {
|
|
768
|
-
key: detail[key]
|
|
769
|
-
for key in ("command", "cwd", "reason", "grantRoot", "proposedExecpolicyAmendment")
|
|
770
|
-
if key in detail and detail[key] is not None
|
|
771
|
-
}
|
|
772
|
-
presentation = InteractionPresentation(
|
|
773
|
-
title={
|
|
774
|
-
"command_execution": "run_command",
|
|
775
|
-
"file_change": "apply_patch",
|
|
776
|
-
"permissions": "request_permission",
|
|
777
|
-
"dynamic_tool_call": "tool_call",
|
|
778
|
-
}.get(event.request.kind, event.request.kind),
|
|
779
|
-
description=json.dumps(
|
|
780
|
-
{"arguments": visible_arguments},
|
|
781
|
-
ensure_ascii=False,
|
|
782
|
-
separators=(",", ":"),
|
|
783
|
-
),
|
|
784
|
-
)
|
|
785
|
-
else:
|
|
786
|
-
request_schema = dict(event.request.schema_)
|
|
787
|
-
# Codex maps the native JSON-RPC request id to a stable canonical
|
|
788
|
-
# interaction id for replay. The live client, however, indexes its
|
|
789
|
-
# pending callback by the original request id. Preserve that id as
|
|
790
|
-
# the provider target or SubmitInteraction can find the durable
|
|
791
|
-
# record but cannot wake the blocked Codex callback.
|
|
792
|
-
native_call_id = (
|
|
793
|
-
event.source.native_event_id
|
|
794
|
-
or event.source.native_item_id
|
|
795
|
-
or event.interaction_id
|
|
796
|
-
)
|
|
797
|
-
native_target = {"call_id": native_call_id}
|
|
798
|
-
for key in ("checkpoint_id", "thread_id"):
|
|
799
|
-
value = execution.handle.native_ref.get(key)
|
|
800
|
-
if value is not None:
|
|
801
|
-
native_target[key] = str(value)
|
|
802
|
-
provider_id = execution.interaction_provider.provider_id or execution.handle.runtime_type
|
|
803
|
-
record = InteractionRecord(
|
|
804
|
-
interaction_id=event.interaction_id,
|
|
805
|
-
tenant_id=str(run.metadata.get("tenant_id") or ""),
|
|
806
|
-
agent_instance_id=run.agent_instance_id,
|
|
807
|
-
session_id=run.session_id,
|
|
808
|
-
run_id=run.run_id,
|
|
809
|
-
kind=event.interaction_kind,
|
|
810
|
-
request_schema=request_schema,
|
|
811
|
-
created_at=datetime.fromtimestamp(event.timestamp, timezone.utc).isoformat(),
|
|
812
|
-
presentation=presentation,
|
|
813
|
-
provider_id=provider_id,
|
|
814
|
-
native_target=native_target,
|
|
815
|
-
continuation_metadata={"runtime_run_id": execution.runtime_run_id},
|
|
816
|
-
)
|
|
817
|
-
await self._store.request(record, guard=guard) # type: ignore[attr-defined]
|
|
818
|
-
if run.state is RunState.WAITING:
|
|
819
|
-
return run
|
|
820
|
-
return await self._store.save_run_transition(
|
|
821
|
-
run.model_copy(update={"state": RunState.WAITING}),
|
|
822
|
-
expected_fence=guard.fencing_token,
|
|
823
|
-
)
|
|
824
|
-
|
|
825
1026
|
# 控制命令必须作用于 active Run 且本进程持有 live execution。
|
|
826
|
-
async def _control_active_run(
|
|
827
|
-
self, command: AgentControlCommand, activation: ActivationLease
|
|
828
|
-
) -> str | None:
|
|
829
|
-
fence = activation.fencing_token
|
|
830
|
-
active = await self._store.find_active_run(command.agent_instance_id, command.session_id)
|
|
831
|
-
if active is None:
|
|
832
|
-
raise UnsupportedControlError(
|
|
833
|
-
"runtime_no_active_run",
|
|
834
|
-
details={"command_type": command.command_type},
|
|
835
|
-
)
|
|
836
|
-
execution = self._executions.get(active.run_id)
|
|
837
|
-
if execution is None:
|
|
838
|
-
raise UnsupportedControlError(
|
|
839
|
-
"runtime_not_attached",
|
|
840
|
-
details={"run_id": active.run_id},
|
|
841
|
-
)
|
|
842
|
-
# Task 6:控制命令作用在 activation 拥有的同一 adapter/handle 上,
|
|
843
|
-
# 绝不新建 adapter(那会把命令打到没有 live 状态的实例上)。
|
|
844
|
-
adapter = execution.adapter
|
|
845
|
-
handle = execution.handle
|
|
846
|
-
verb = COMMAND_HANDLERS[command.command_type]
|
|
847
|
-
|
|
848
|
-
if verb == "cancel":
|
|
849
|
-
result = await adapter.cancel(handle)
|
|
850
|
-
if result == CancelResult.INTERRUPTED_ACTIVE_TURN:
|
|
851
|
-
await self._transition_run(active, RunState.CANCELLED, fence)
|
|
852
|
-
self._executions.pop(active.run_id, None)
|
|
853
|
-
elif verb == "pause":
|
|
854
|
-
result = await adapter.pause(handle)
|
|
855
|
-
if result == PauseResult.PAUSED_ACTIVE_TURN:
|
|
856
|
-
await self._transition_run(active, RunState.PAUSED, fence)
|
|
857
|
-
elif verb == "resume":
|
|
858
|
-
target_dict = dict(command.payload.get("target") or {})
|
|
859
|
-
target = AdapterResumeTarget(
|
|
860
|
-
kind=RESUME_TARGET_KINDS[target_dict["kind"]],
|
|
861
|
-
id=str(target_dict["id"]),
|
|
862
|
-
)
|
|
863
|
-
resumed = await adapter.resume(
|
|
864
|
-
handle,
|
|
865
|
-
target,
|
|
866
|
-
AdapterResumePayload(
|
|
867
|
-
kind="free_text", session_context=command.payload.get("session_context")
|
|
868
|
-
),
|
|
869
|
-
)
|
|
870
|
-
execution = self._replace_handle(execution, resumed)
|
|
871
|
-
self._start_stream(
|
|
872
|
-
execution,
|
|
873
|
-
active,
|
|
874
|
-
ActivationWriteGuard(
|
|
875
|
-
activation_id=activation.activation_id,
|
|
876
|
-
fencing_token=fence,
|
|
877
|
-
),
|
|
878
|
-
)
|
|
879
|
-
elif verb == "submit_interaction":
|
|
880
|
-
await self._submit_interaction(command, activation, active, execution)
|
|
881
|
-
elif verb == "steer":
|
|
882
|
-
await adapter.steer(handle, ContractSteerPayload.model_validate(dict(command.payload)))
|
|
883
|
-
elif verb == "inject":
|
|
884
|
-
await adapter.inject(
|
|
885
|
-
handle, ContractInjectPayload.model_validate(dict(command.payload))
|
|
886
|
-
)
|
|
887
|
-
else: # pragma: no cover - mapping 冻结
|
|
888
|
-
raise UnsupportedControlError(f"unknown handler {verb!r}")
|
|
889
|
-
return active.run_id
|
|
890
|
-
|
|
891
|
-
# ------------------------------------------------- Task 6: interaction 回包
|
|
892
|
-
|
|
893
|
-
async def _submit_interaction(
|
|
894
|
-
self,
|
|
895
|
-
command: AgentControlCommand,
|
|
896
|
-
activation: ActivationLease,
|
|
897
|
-
active: RunRecord,
|
|
898
|
-
execution: ActiveExecution,
|
|
899
|
-
) -> None:
|
|
900
|
-
"""权威 record -> 绑定 provider -> provider 接受后才写 resolved。
|
|
901
|
-
|
|
902
|
-
顺序是合同:provider 拒绝(含 unavailable)时 Interaction 保持
|
|
903
|
-
pending,绝不提前标 resolved;ledger ``resolve`` 本身做 revision CAS
|
|
904
|
-
first-wins。
|
|
905
|
-
"""
|
|
906
|
-
|
|
907
|
-
fence = activation.fencing_token
|
|
908
|
-
payload = SubmitInteractionPayload.model_validate(dict(command.payload))
|
|
909
|
-
record = await self._store.get( # type: ignore[attr-defined]
|
|
910
|
-
payload.interaction_id,
|
|
911
|
-
tenant_id=command.tenant_id,
|
|
912
|
-
agent_instance_id=command.agent_instance_id,
|
|
913
|
-
session_id=command.session_id,
|
|
914
|
-
run_id=active.run_id,
|
|
915
|
-
)
|
|
916
|
-
if record is None:
|
|
917
|
-
raise InvalidCommandError(
|
|
918
|
-
f"unknown interaction_id {payload.interaction_id!r}",
|
|
919
|
-
details={"interaction_id": payload.interaction_id},
|
|
920
|
-
)
|
|
921
|
-
if record.run_id != active.run_id:
|
|
922
|
-
raise InvalidCommandError(
|
|
923
|
-
"interaction does not belong to the active run",
|
|
924
|
-
details={
|
|
925
|
-
"interaction_id": record.interaction_id,
|
|
926
|
-
"interaction_run_id": record.run_id,
|
|
927
|
-
"active_run_id": active.run_id,
|
|
928
|
-
},
|
|
929
|
-
)
|
|
930
|
-
# ``ActiveExecution`` owns the adapter, live handle *and* provider for
|
|
931
|
-
# this activation. The durable record tells us what was requested,
|
|
932
|
-
# but it must not redirect a response into another framework provider:
|
|
933
|
-
# e.g. calling LangGraph checkpoint resume with a Codex live handle
|
|
934
|
-
# would acknowledge a response that can never reach the original run.
|
|
935
|
-
provider = execution.interaction_provider
|
|
936
|
-
if (
|
|
937
|
-
provider.provider_id != record.provider_id
|
|
938
|
-
or provider.mode == "unavailable"
|
|
939
|
-
):
|
|
940
|
-
raise AgentKernelError(
|
|
941
|
-
RUNTIME_INTERACTION_UNAVAILABLE,
|
|
942
|
-
f"interaction provider {record.provider_id!r} cannot deliver "
|
|
943
|
-
"the response through the active execution's native framework "
|
|
944
|
-
"identity",
|
|
945
|
-
retryable=False,
|
|
946
|
-
details={
|
|
947
|
-
"provider_id": record.provider_id,
|
|
948
|
-
"active_provider_id": provider.provider_id,
|
|
949
|
-
"mode": provider.mode,
|
|
950
|
-
"interaction_id": record.interaction_id,
|
|
951
|
-
},
|
|
952
|
-
)
|
|
953
|
-
submission = InteractionSubmission(
|
|
954
|
-
interaction_id=record.interaction_id,
|
|
955
|
-
expected_revision=int(
|
|
956
|
-
payload.expected_revision
|
|
957
|
-
if payload.expected_revision is not None
|
|
958
|
-
else record.revision
|
|
959
|
-
),
|
|
960
|
-
action=payload.action or "submit", # type: ignore[arg-type]
|
|
961
|
-
response=payload.response,
|
|
962
|
-
idempotency_key=payload.idempotency_key or command.idempotency_key,
|
|
963
|
-
)
|
|
964
|
-
context = InteractionResolveContext(
|
|
965
|
-
adapter=execution.adapter,
|
|
966
|
-
handle=execution.handle,
|
|
967
|
-
session_context=command.payload.get("session_context"),
|
|
968
|
-
activation_id=activation.activation_id,
|
|
969
|
-
fencing_token=fence,
|
|
970
|
-
)
|
|
971
|
-
# provider 接受(typed 异常原样上抛 -> command_rejected,不标 resolved)。
|
|
972
|
-
resumed = await provider.resolve(context, record, submission)
|
|
973
|
-
execution = self._replace_handle(execution, resumed)
|
|
974
|
-
# provider 已接受,才在 ledger 收口 InteractionResolved(同一 fence)。
|
|
975
|
-
await self._store.resolve( # type: ignore[attr-defined]
|
|
976
|
-
submission,
|
|
977
|
-
guard=ActivationWriteGuard(activation_id=activation.activation_id, fencing_token=fence),
|
|
978
|
-
)
|
|
979
|
-
# A durable response returns a waiting run to execution. The old live
|
|
980
|
-
# stream usually remains open (Codex); checkpoint providers normally
|
|
981
|
-
# returned a fresh handle and need a new background stream. RUNNING is
|
|
982
|
-
# already the active-execution state (RUNNING -> RUNNING is not a legal
|
|
983
|
-
# transition), so only WAITING/PAUSED runs move back to RUNNING.
|
|
984
|
-
resumed_run = active
|
|
985
|
-
if active.state != RunState.RUNNING:
|
|
986
|
-
resumed_run = await self._transition_run(active, RunState.RUNNING, fence)
|
|
987
|
-
task = execution.stream_task
|
|
988
|
-
if task is None or task.done():
|
|
989
|
-
self._start_stream(
|
|
990
|
-
execution,
|
|
991
|
-
resumed_run,
|
|
992
|
-
ActivationWriteGuard(
|
|
993
|
-
activation_id=activation.activation_id,
|
|
994
|
-
fencing_token=fence,
|
|
995
|
-
),
|
|
996
|
-
)
|
|
997
|
-
|
|
998
1027
|
def _replace_handle(self, execution: ActiveExecution, handle: RunHandle) -> ActiveExecution:
|
|
999
1028
|
if handle is execution.handle or handle == execution.handle:
|
|
1000
1029
|
return execution
|