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
|
@@ -0,0 +1,1044 @@
|
|
|
1
|
+
"""Canonical RuntimeAdapter for the managed KsADK Harness engine.
|
|
2
|
+
|
|
3
|
+
Studio and the platform persist canonical RuntimeEvent v2 values, while the
|
|
4
|
+
managed engine intentionally owns a richer, engine-internal event vocabulary.
|
|
5
|
+
This adapter is the boundary between the two contracts: it keeps the managed
|
|
6
|
+
Agent Loop behind the stable ``runtime_type=harness`` product name and projects
|
|
7
|
+
the execution tree into canonical status items without teaching Studio about
|
|
8
|
+
engine-private Python objects.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Any, AsyncIterator
|
|
16
|
+
|
|
17
|
+
from ksadk.events.canonical import (
|
|
18
|
+
ApprovalRequest,
|
|
19
|
+
ErrorInfo,
|
|
20
|
+
InteractionRequested,
|
|
21
|
+
ItemCompleted,
|
|
22
|
+
ItemStarted,
|
|
23
|
+
ItemUpdated,
|
|
24
|
+
OutputRef,
|
|
25
|
+
RunCanceled,
|
|
26
|
+
RunCompleted,
|
|
27
|
+
RunFailed,
|
|
28
|
+
RunInterrupted,
|
|
29
|
+
RunStarted,
|
|
30
|
+
SourceRef,
|
|
31
|
+
UsageReported,
|
|
32
|
+
)
|
|
33
|
+
from ksadk.events.content import ContentSnapshot, TextContent
|
|
34
|
+
from ksadk.events.identity import stable_event_id, stable_item_id, stable_scope_id
|
|
35
|
+
from ksadk.harness.context_engine import HarnessContextEngine
|
|
36
|
+
from ksadk.harness.engine.langgraph import ManagedLangGraphEngine, memory_checkpointer
|
|
37
|
+
from ksadk.harness.engine.steering import SteerReceipt
|
|
38
|
+
from ksadk.harness.events import EventType
|
|
39
|
+
from ksadk.harness.events import RuntimeEvent as HarnessEvent
|
|
40
|
+
from ksadk.harness.execution_policy import ExecutionPolicy, ExecutionPolicyResolver
|
|
41
|
+
from ksadk.harness.public_activity import tool_public_action
|
|
42
|
+
from ksadk.harness.reasoner import HarnessReasoner
|
|
43
|
+
from ksadk.harness.runtime_capabilities import (
|
|
44
|
+
managed_harness_capabilities,
|
|
45
|
+
managed_harness_native_capabilities,
|
|
46
|
+
)
|
|
47
|
+
from ksadk.harness.skill_composition import compose_engine
|
|
48
|
+
from ksadk.harness.spec import HarnessSpec
|
|
49
|
+
from ksadk.harness.tool_display import safe_tool_display, tool_display_start
|
|
50
|
+
from ksadk.kernel.contracts import RuntimeCapabilityMatrix, SteerPayload
|
|
51
|
+
from ksadk.kernel.errors import UnsupportedControlError
|
|
52
|
+
from ksadk.runtime import (
|
|
53
|
+
BaseRuntime,
|
|
54
|
+
CancelResult,
|
|
55
|
+
CheckpointCapability,
|
|
56
|
+
CheckpointDescriptor,
|
|
57
|
+
ResumePayload,
|
|
58
|
+
ResumeTarget,
|
|
59
|
+
RunHandle,
|
|
60
|
+
RuntimeAdapter,
|
|
61
|
+
StartRequest,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class ManagedHarnessRuntime(BaseRuntime):
|
|
66
|
+
runtime_type = "harness"
|
|
67
|
+
|
|
68
|
+
def __init__(self, *, durable: bool = False) -> None:
|
|
69
|
+
self._durable = durable
|
|
70
|
+
|
|
71
|
+
def native_capabilities(self) -> dict[str, Any]:
|
|
72
|
+
return managed_harness_native_capabilities(durable=self._durable)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class ManagedHarnessRuntimeAdapter(RuntimeAdapter):
|
|
76
|
+
"""Expose :class:`ManagedLangGraphEngine` through the platform adapter API."""
|
|
77
|
+
|
|
78
|
+
def __init__(
|
|
79
|
+
self,
|
|
80
|
+
spec: HarnessSpec,
|
|
81
|
+
*,
|
|
82
|
+
reasoner: HarnessReasoner | None = None,
|
|
83
|
+
workspace_root: str | Path = ".",
|
|
84
|
+
engine: ManagedLangGraphEngine | None = None,
|
|
85
|
+
durable: bool = False,
|
|
86
|
+
shared_across_pods: bool = False,
|
|
87
|
+
execution_policy_resolver: ExecutionPolicyResolver | None = None,
|
|
88
|
+
hooks: tuple | None = None,
|
|
89
|
+
) -> None:
|
|
90
|
+
super().__init__(ManagedHarnessRuntime(durable=durable))
|
|
91
|
+
self._spec = spec
|
|
92
|
+
self._workspace_root = Path(workspace_root)
|
|
93
|
+
self._durable = durable
|
|
94
|
+
self._shared_across_pods = shared_across_pods
|
|
95
|
+
self._execution_policy_resolver = execution_policy_resolver
|
|
96
|
+
self._engine = engine or compose_engine(
|
|
97
|
+
spec,
|
|
98
|
+
reasoner=reasoner,
|
|
99
|
+
checkpointer=memory_checkpointer(),
|
|
100
|
+
context_engine=HarnessContextEngine(),
|
|
101
|
+
**({"hooks": tuple(hooks)} if hooks else {}),
|
|
102
|
+
)
|
|
103
|
+
self._compiled: Any | None = None
|
|
104
|
+
self._external_handles: dict[str, RunHandle] = {}
|
|
105
|
+
#: 由装配层注入(持久 Checkpoint 分档时非空);为空则不持久化 Handle。
|
|
106
|
+
self._run_store: Any | None = None
|
|
107
|
+
|
|
108
|
+
def capabilities(self) -> RuntimeCapabilityMatrix:
|
|
109
|
+
return managed_harness_capabilities(
|
|
110
|
+
durable=self._durable,
|
|
111
|
+
execution_policy=self._execution_policy_resolver is not None,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
async def _policy_options(self, request: StartRequest) -> dict[str, Any]:
|
|
115
|
+
ref = request.metadata.get("execution_policy_ref")
|
|
116
|
+
if ref is None:
|
|
117
|
+
return {}
|
|
118
|
+
if not isinstance(ref, str) or not ref.strip():
|
|
119
|
+
raise ValueError("execution_policy_ref must be a non-empty host reference")
|
|
120
|
+
if self._execution_policy_resolver is None:
|
|
121
|
+
raise UnsupportedControlError("execution policy requires a trusted host resolver")
|
|
122
|
+
policy = await self._execution_policy_resolver.resolve(ref, request=request)
|
|
123
|
+
if not isinstance(policy, ExecutionPolicy):
|
|
124
|
+
raise TypeError("host resolver must return ExecutionPolicy")
|
|
125
|
+
return {
|
|
126
|
+
"execution_policy": policy,
|
|
127
|
+
"execution_policy_resolver": self._execution_policy_resolver,
|
|
128
|
+
"execution_policy_request": request,
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
def _persist_durable_handle(
|
|
132
|
+
self,
|
|
133
|
+
handle: RunHandle,
|
|
134
|
+
status: str = "running",
|
|
135
|
+
*,
|
|
136
|
+
terminal: bool = False,
|
|
137
|
+
) -> None:
|
|
138
|
+
if self._run_store is None:
|
|
139
|
+
return
|
|
140
|
+
runs, handles = self._run_store.load()
|
|
141
|
+
runs[handle.run_id] = {"runId": handle.run_id, "status": status}
|
|
142
|
+
if terminal:
|
|
143
|
+
handles.pop(handle.run_id, None)
|
|
144
|
+
else:
|
|
145
|
+
handles[handle.run_id] = handle
|
|
146
|
+
self._run_store.save(runs, handles)
|
|
147
|
+
|
|
148
|
+
async def attach(self, handle: RunHandle) -> RunHandle:
|
|
149
|
+
"""Attach a persisted platform handle to the durable LangGraph thread."""
|
|
150
|
+
|
|
151
|
+
if not self._durable:
|
|
152
|
+
raise UnsupportedControlError(
|
|
153
|
+
f"managed Harness run {handle.run_id!r} has no durable checkpoint backend"
|
|
154
|
+
)
|
|
155
|
+
if handle.runtime_type != "harness":
|
|
156
|
+
raise ValueError(f"managed Harness cannot attach {handle.runtime_type!r} handle")
|
|
157
|
+
request = StartRequest(
|
|
158
|
+
input="", user_id=str(handle.native_ref.get("user_id") or "unknown"),
|
|
159
|
+
session_id=handle.session_id, agent_id=handle.native_ref.get("agent_id"),
|
|
160
|
+
metadata={
|
|
161
|
+
"invocation_id": handle.run_id,
|
|
162
|
+
**({"execution_policy_ref": handle.native_ref["execution_policy_ref"]}
|
|
163
|
+
if "execution_policy_ref" in handle.native_ref else {}),
|
|
164
|
+
},
|
|
165
|
+
)
|
|
166
|
+
options = await self._policy_options(request)
|
|
167
|
+
if handle.run_id in self._external_handles:
|
|
168
|
+
return handle
|
|
169
|
+
compiled = await self._ensure_compiled()
|
|
170
|
+
internal_handle = handle.model_copy(update={"runtime_type": "managed-langgraph"})
|
|
171
|
+
internal = await self._engine.attach(internal_handle, compiled, **options)
|
|
172
|
+
self._external_handles[handle.run_id] = internal
|
|
173
|
+
return handle
|
|
174
|
+
|
|
175
|
+
async def durable_restore(self, handle: RunHandle) -> RunHandle:
|
|
176
|
+
"""Restore a persisted handle and continue non-interactive checkpoints.
|
|
177
|
+
|
|
178
|
+
Approval checkpoints deliberately remain ``awaiting_approval`` so the
|
|
179
|
+
Kernel can route the later interaction to the newly attached adapter.
|
|
180
|
+
A process crash during ordinary graph execution is reconstructed as a
|
|
181
|
+
paused checkpoint and must resume automatically; otherwise attach
|
|
182
|
+
succeeds but the durable Run remains open forever.
|
|
183
|
+
"""
|
|
184
|
+
|
|
185
|
+
restored = await self.attach(handle)
|
|
186
|
+
internal = self._internal_handle(restored)
|
|
187
|
+
state = await self._engine.snapshot_state(internal)
|
|
188
|
+
status = str(getattr(getattr(state, "status", None), "value", ""))
|
|
189
|
+
if status == "paused":
|
|
190
|
+
await self._engine.resume(
|
|
191
|
+
internal,
|
|
192
|
+
ResumeTarget(
|
|
193
|
+
kind="checkpoint_id",
|
|
194
|
+
id=str(internal.native_ref.get("thread_id") or internal.run_id),
|
|
195
|
+
),
|
|
196
|
+
None,
|
|
197
|
+
)
|
|
198
|
+
return restored
|
|
199
|
+
|
|
200
|
+
@property
|
|
201
|
+
def harness_spec(self) -> HarnessSpec:
|
|
202
|
+
return self._spec
|
|
203
|
+
|
|
204
|
+
async def preflight(self) -> None:
|
|
205
|
+
await self._ensure_compiled()
|
|
206
|
+
|
|
207
|
+
async def start(self, request: StartRequest) -> RunHandle:
|
|
208
|
+
compiled = await self._ensure_compiled()
|
|
209
|
+
conversation = request.conversation_preprocessing()
|
|
210
|
+
metadata = dict(request.metadata)
|
|
211
|
+
# 回合级审批档位(composer 完全访问/严格/询问)放在 config 里,
|
|
212
|
+
# 挪进 metadata 让 policy_runtime.configure_run 能按它调整审批面。
|
|
213
|
+
approval_mode = str((request.config or {}).get("tool_approval_mode") or "")
|
|
214
|
+
if approval_mode:
|
|
215
|
+
metadata["tool_approval_mode"] = approval_mode
|
|
216
|
+
if conversation is not None and conversation.messages:
|
|
217
|
+
metadata["conversation_history"] = [dict(item) for item in conversation.messages]
|
|
218
|
+
# Studio 的 Agent 合同给出 max_input_tokens + reserve_output_tokens,
|
|
219
|
+
# ContextEngine 需要完整窗口才能避免退回 32K 安全默认值。该值只作为
|
|
220
|
+
# 本次运行的模型窗口来源,不改变不可变 HarnessSpec。
|
|
221
|
+
if not metadata.get("context_window_tokens"):
|
|
222
|
+
max_input = _positive_int(request.config.get("max_input_tokens"))
|
|
223
|
+
reserve_output = _positive_int(request.config.get("reserve_output_tokens")) or 0
|
|
224
|
+
if max_input is not None:
|
|
225
|
+
metadata["context_window_tokens"] = max_input + reserve_output
|
|
226
|
+
internal_request = request.model_copy(update={"metadata": metadata})
|
|
227
|
+
options = await self._policy_options(internal_request)
|
|
228
|
+
# 始终把请求传给 configure_run:回合级 tool_approval_mode 在那里
|
|
229
|
+
# 覆盖静态审批面(execution_policy_request 仅在有 policy 时传)。
|
|
230
|
+
options.setdefault("execution_policy_request", internal_request)
|
|
231
|
+
internal = await self._engine.start(internal_request, compiled, **options)
|
|
232
|
+
external = internal.model_copy(update={"runtime_type": "harness"})
|
|
233
|
+
self._external_handles[external.run_id] = internal
|
|
234
|
+
self._persist_durable_handle(external)
|
|
235
|
+
return external
|
|
236
|
+
|
|
237
|
+
def stream(self, handle: RunHandle) -> AsyncIterator[Any]:
|
|
238
|
+
return self._stream(handle)
|
|
239
|
+
|
|
240
|
+
async def _stream(self, handle: RunHandle) -> AsyncIterator[Any]:
|
|
241
|
+
internal = self._internal_handle(handle)
|
|
242
|
+
while True:
|
|
243
|
+
run_completed = False
|
|
244
|
+
async for event in self._engine.stream(internal):
|
|
245
|
+
rich = event.to_v2()
|
|
246
|
+
if not rich.parent_run_id:
|
|
247
|
+
terminal_status = {
|
|
248
|
+
EventType.RUN_COMPLETED: "completed",
|
|
249
|
+
EventType.RUN_FAILED: "failed",
|
|
250
|
+
EventType.RUN_CANCELED: "canceled",
|
|
251
|
+
}.get(rich.event_type)
|
|
252
|
+
if terminal_status is not None:
|
|
253
|
+
# A terminal checkpoint must not remain eligible for cold
|
|
254
|
+
# attach. Persist before yielding so a consumer that stops
|
|
255
|
+
# at the terminal event cannot leave a stale live handle.
|
|
256
|
+
self._persist_durable_handle(
|
|
257
|
+
handle,
|
|
258
|
+
terminal_status,
|
|
259
|
+
terminal=True,
|
|
260
|
+
)
|
|
261
|
+
if rich.event_type == EventType.RUN_COMPLETED and not rich.parent_run_id:
|
|
262
|
+
run_completed = True
|
|
263
|
+
for projected in _project_event(event):
|
|
264
|
+
yield projected
|
|
265
|
+
if not run_completed:
|
|
266
|
+
return
|
|
267
|
+
# follow_up 语义:本次 Run 自然完成后,若旧 Run 排了尾随指令,
|
|
268
|
+
# 就在同一条 stream 上自动起下一个 Run(新 run_id),宿主无感知。
|
|
269
|
+
follow_text = self._engine.pop_follow_up(internal.run_id)
|
|
270
|
+
if follow_text is None:
|
|
271
|
+
return
|
|
272
|
+
external_current = handle
|
|
273
|
+
follow_request = StartRequest(
|
|
274
|
+
input=follow_text,
|
|
275
|
+
user_id=external_current.native_ref.get("user_id") or "unknown",
|
|
276
|
+
session_id=external_current.session_id,
|
|
277
|
+
agent_id=external_current.native_ref.get("agent_id"),
|
|
278
|
+
runtime_type="harness",
|
|
279
|
+
metadata={
|
|
280
|
+
"origin": "follow_up",
|
|
281
|
+
"follow_up_of": external_current.run_id,
|
|
282
|
+
},
|
|
283
|
+
)
|
|
284
|
+
external_current = await self.start(follow_request)
|
|
285
|
+
handle = external_current
|
|
286
|
+
internal = self._internal_handle(external_current)
|
|
287
|
+
|
|
288
|
+
async def steer(self, handle: RunHandle, text: Any) -> SteerReceipt:
|
|
289
|
+
"""流式中投递纠偏指令(返回 engine 的 :class:`SteerReceipt`)。
|
|
290
|
+
|
|
291
|
+
同时接受纯文本(adapter 直调)与 Kernel 的 SteerPayload 线格式
|
|
292
|
+
(worker 会把契约载荷原样交给 adapter)。
|
|
293
|
+
"""
|
|
294
|
+
return self._engine.steer(
|
|
295
|
+
self._internal_handle(handle),
|
|
296
|
+
_steer_text(text),
|
|
297
|
+
allow_follow_up=not isinstance(text, SteerPayload),
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
async def follow_up(self, handle: RunHandle, text: Any) -> SteerReceipt:
|
|
301
|
+
"""排队尾随指令:本次 Run 自然完成后自动续跑下一个 Run。"""
|
|
302
|
+
return self._engine.follow_up(self._internal_handle(handle), _steer_text(text))
|
|
303
|
+
|
|
304
|
+
async def cancel(self, handle: RunHandle) -> CancelResult:
|
|
305
|
+
result = await self._engine.cancel(self._internal_handle(handle))
|
|
306
|
+
if result is CancelResult.INTERRUPTED_ACTIVE_TURN:
|
|
307
|
+
self._persist_durable_handle(handle, "canceled", terminal=True)
|
|
308
|
+
elif result is CancelResult.PENDING_CANCEL_RECORDED:
|
|
309
|
+
self._persist_durable_handle(handle, "cancel_requested")
|
|
310
|
+
return result
|
|
311
|
+
|
|
312
|
+
async def resume(
|
|
313
|
+
self,
|
|
314
|
+
handle: RunHandle,
|
|
315
|
+
target: ResumeTarget,
|
|
316
|
+
payload: ResumePayload | None,
|
|
317
|
+
) -> RunHandle:
|
|
318
|
+
if payload is not None and payload.kind == "approval_decision":
|
|
319
|
+
decision = payload.data
|
|
320
|
+
if isinstance(decision, dict):
|
|
321
|
+
decision = decision.get("decision")
|
|
322
|
+
# Studio submits action-shaped data; the loop consumes a decision
|
|
323
|
+
# string. Unknown/missing decisions never become an approval.
|
|
324
|
+
normalized = {
|
|
325
|
+
"approve": "approved",
|
|
326
|
+
# Preserve the wider scope. Collapsing this to ``approved``
|
|
327
|
+
# only released the current tool call, so every subsequent
|
|
328
|
+
# write prompted again despite the Studio action saying
|
|
329
|
+
# "本次会话允许".
|
|
330
|
+
"approve_session": "approved_session",
|
|
331
|
+
"approved": "approved",
|
|
332
|
+
"reject": "denied",
|
|
333
|
+
"rejected": "denied",
|
|
334
|
+
"deny": "denied",
|
|
335
|
+
"denied": "denied",
|
|
336
|
+
"cancel": "denied",
|
|
337
|
+
"canceled": "denied",
|
|
338
|
+
}.get(decision if isinstance(decision, str) else "", "denied")
|
|
339
|
+
payload = payload.model_copy(update={"data": normalized})
|
|
340
|
+
internal = await self._engine.resume(self._internal_handle(handle), target, payload)
|
|
341
|
+
external = internal.model_copy(update={"runtime_type": "harness"})
|
|
342
|
+
self._external_handles[external.run_id] = internal
|
|
343
|
+
return external
|
|
344
|
+
|
|
345
|
+
async def checkpoint(self, handle: RunHandle) -> CheckpointDescriptor:
|
|
346
|
+
internal = self._internal_handle(handle)
|
|
347
|
+
state = await self._engine.snapshot_state(internal)
|
|
348
|
+
return CheckpointDescriptor(
|
|
349
|
+
checkpoint_id=str(internal.native_ref.get("thread_id") or internal.run_id),
|
|
350
|
+
invocation_id=internal.run_id,
|
|
351
|
+
capability=CheckpointCapability(
|
|
352
|
+
supported=True,
|
|
353
|
+
granularity="snapshot",
|
|
354
|
+
rollback_scope="invocation",
|
|
355
|
+
fork_supported=False,
|
|
356
|
+
durable=self._durable,
|
|
357
|
+
shared_across_pods=self._shared_across_pods,
|
|
358
|
+
reason=(
|
|
359
|
+
"Managed Harness uses a durable LangGraph checkpointer"
|
|
360
|
+
if self._durable
|
|
361
|
+
else "Managed Harness uses an in-process LangGraph checkpointer"
|
|
362
|
+
),
|
|
363
|
+
),
|
|
364
|
+
ref={"status": state.status.value if state is not None else "unknown"},
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
async def close(self, handle: RunHandle) -> None:
|
|
368
|
+
internal = self._external_handles.pop(handle.run_id, None)
|
|
369
|
+
if internal is not None:
|
|
370
|
+
await self._engine.close(internal)
|
|
371
|
+
|
|
372
|
+
def is_handle_attached(self, handle: RunHandle) -> bool:
|
|
373
|
+
internal = self._external_handles.get(handle.run_id)
|
|
374
|
+
return internal is not None and self._engine.is_handle_attached(internal)
|
|
375
|
+
|
|
376
|
+
async def _ensure_compiled(self) -> Any:
|
|
377
|
+
if self._compiled is None:
|
|
378
|
+
self._compiled = await self._engine.compile(self._spec)
|
|
379
|
+
return self._compiled
|
|
380
|
+
|
|
381
|
+
def _internal_handle(self, handle: RunHandle) -> RunHandle:
|
|
382
|
+
if handle.runtime_type != "harness":
|
|
383
|
+
raise ValueError(f"managed Harness cannot use {handle.runtime_type!r} handle")
|
|
384
|
+
try:
|
|
385
|
+
return self._external_handles[handle.run_id]
|
|
386
|
+
except KeyError:
|
|
387
|
+
raise KeyError(f"unknown managed Harness run: {handle.run_id}") from None
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def _final_item_id(run_id: str, rich: Any) -> str:
|
|
391
|
+
"""Derive the final-answer message item id, turn-scoped when turn_id is present.
|
|
392
|
+
|
|
393
|
+
会话串轮修复(交接记录 2026-09-22 §7):final item_id 之前只按 ``run_id``
|
|
394
|
+
派生,同一 run 内多轮 final 撞到同一 item_id,历史/重放 final 遮蔽当前轮
|
|
395
|
+
正确 final。引擎在 final-answer 的 TEXT_COMPLETED 与 RUN_COMPLETED payload
|
|
396
|
+
里带上当前 ``turn_id`` 后,这里据此派生 turn 级身份;未带 turn_id 时回退到
|
|
397
|
+
旧 run 级身份,保持不发 TURN_STARTED 的引擎/路径行为不回退。
|
|
398
|
+
"""
|
|
399
|
+
turn_id = str(rich.payload.get("turn_id") or "").strip()
|
|
400
|
+
if turn_id:
|
|
401
|
+
return stable_item_id("ksadk", run_id, "turn", turn_id, "message", "final")
|
|
402
|
+
return stable_item_id("ksadk", run_id, "message", "final")
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
def _project_event(event: HarnessEvent) -> list[Any]:
|
|
406
|
+
"""Project one rich Harness event to one or more canonical v2 events."""
|
|
407
|
+
|
|
408
|
+
rich = event.to_v2()
|
|
409
|
+
native_run_id = str(rich.run_id or rich.invocation_id)
|
|
410
|
+
run_id = str(rich.invocation_id if rich.parent_run_id else native_run_id)
|
|
411
|
+
scope_id = stable_scope_id("ksadk", native_run_id, str(rich.scope_id or rich.agent_id))
|
|
412
|
+
source_metadata: dict[str, Any] = {
|
|
413
|
+
"native_event_type": rich.event_type,
|
|
414
|
+
"agent_id": rich.agent_id,
|
|
415
|
+
"session_id": rich.session_id,
|
|
416
|
+
**({"phase": rich.phase} if rich.phase else {}),
|
|
417
|
+
**({"parent_run_id": rich.parent_run_id} if rich.parent_run_id else {}),
|
|
418
|
+
}
|
|
419
|
+
# Keep comparison-grade lifecycle facts on the canonical envelope. These
|
|
420
|
+
# are identifiers/state, never model reasoning or tool input/output, so
|
|
421
|
+
# evaluation can count retries and subagents without parsing item content.
|
|
422
|
+
if rich.event_type == EventType.RUN_PROGRESS:
|
|
423
|
+
activity_kind = str(rich.payload.get("kind") or "").strip()
|
|
424
|
+
activity_call_id = str(rich.payload.get("call_id") or "").strip()
|
|
425
|
+
if activity_kind:
|
|
426
|
+
source_metadata["activity_kind"] = activity_kind
|
|
427
|
+
if activity_call_id:
|
|
428
|
+
source_metadata["activity_call_id"] = activity_call_id
|
|
429
|
+
elif rich.event_type == EventType.MODEL_CALL_FAILED:
|
|
430
|
+
failure_action = str(rich.payload.get("action") or "").strip()
|
|
431
|
+
if failure_action:
|
|
432
|
+
source_metadata["failure_action"] = failure_action
|
|
433
|
+
source = SourceRef(
|
|
434
|
+
framework="ksadk",
|
|
435
|
+
native_event_id=rich.event_id,
|
|
436
|
+
native_run_id=native_run_id,
|
|
437
|
+
metadata=source_metadata,
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
def envelope(event_type: str, item_id: str, part_id: str, ordinal: int = 0) -> dict[str, Any]:
|
|
441
|
+
return {
|
|
442
|
+
"schema_version": 2,
|
|
443
|
+
"event_id": stable_event_id(
|
|
444
|
+
"ksadk", scope_id, item_id, event_type, part_id, rich.event_id, ordinal
|
|
445
|
+
),
|
|
446
|
+
"seq": rich.seq_id * 10 + ordinal,
|
|
447
|
+
"timestamp": rich.timestamp,
|
|
448
|
+
"run_id": run_id,
|
|
449
|
+
"scope_id": scope_id,
|
|
450
|
+
"parent_scope_id": (
|
|
451
|
+
stable_scope_id("ksadk", run_id, rich.parent_scope_id)
|
|
452
|
+
if rich.parent_scope_id
|
|
453
|
+
else None
|
|
454
|
+
),
|
|
455
|
+
"source": source,
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
def status_projection(details: dict[str, Any] | None = None) -> list[Any]:
|
|
459
|
+
"""Keep internal evidence in the canonical trace, not the chat timeline."""
|
|
460
|
+
item_id = stable_item_id("ksadk", run_id, "status", rich.event_id)
|
|
461
|
+
part_id = "status-0"
|
|
462
|
+
text = json.dumps(
|
|
463
|
+
{"event": rich.event_type, "details": rich.payload if details is None else details},
|
|
464
|
+
ensure_ascii=False,
|
|
465
|
+
separators=(",", ":"),
|
|
466
|
+
default=str,
|
|
467
|
+
)
|
|
468
|
+
snapshot = ContentSnapshot(parts=(TextContent(part_id=part_id, text=text),))
|
|
469
|
+
return [
|
|
470
|
+
ItemCompleted(
|
|
471
|
+
**envelope("item.completed", item_id, part_id),
|
|
472
|
+
item_id=item_id,
|
|
473
|
+
item_kind="status",
|
|
474
|
+
snapshot=snapshot,
|
|
475
|
+
)
|
|
476
|
+
]
|
|
477
|
+
|
|
478
|
+
if str(rich.payload.get("purpose") or "") == "compaction" and rich.event_type in {
|
|
479
|
+
EventType.TEXT_DELTA,
|
|
480
|
+
EventType.TEXT_COMPLETED,
|
|
481
|
+
EventType.REASONING_DELTA,
|
|
482
|
+
EventType.REASONING_COMPLETED,
|
|
483
|
+
}:
|
|
484
|
+
# Context summaries use the normal reasoner so model lifecycle and
|
|
485
|
+
# usage remain auditable. Their text is internal working state: exposing
|
|
486
|
+
# it as a final answer lets an old turn overwrite the current turn in
|
|
487
|
+
# Studio, and can disclose content that was only meant for compaction.
|
|
488
|
+
return status_projection(
|
|
489
|
+
{"purpose": "compaction", "event_type": rich.event_type}
|
|
490
|
+
)
|
|
491
|
+
|
|
492
|
+
run_item = stable_item_id("ksadk", run_id, "$run")
|
|
493
|
+
payload = rich.payload
|
|
494
|
+
if rich.parent_run_id and rich.event_type in {
|
|
495
|
+
EventType.RUN_STARTED, EventType.RUN_COMPLETED, EventType.RUN_FAILED,
|
|
496
|
+
EventType.RUN_CANCELED, EventType.RUN_INTERRUPTED, EventType.APPROVAL_REQUESTED,
|
|
497
|
+
EventType.TEXT_DELTA, EventType.TEXT_COMPLETED, EventType.REASONING_DELTA,
|
|
498
|
+
EventType.MODEL_CALL_FAILED,
|
|
499
|
+
}:
|
|
500
|
+
return status_projection()
|
|
501
|
+
if rich.event_type == EventType.RUN_STARTED:
|
|
502
|
+
return [RunStarted(**envelope("run.started", run_item, "run"), status="running")]
|
|
503
|
+
if rich.event_type == EventType.RUN_COMPLETED:
|
|
504
|
+
message_id = _final_item_id(run_id, rich)
|
|
505
|
+
control_reason = str(payload.get("control_reason") or "").strip()
|
|
506
|
+
if control_reason:
|
|
507
|
+
# A controller stop may preserve a useful partial answer, but it
|
|
508
|
+
# is not successful task completion. Surface it as interrupted
|
|
509
|
+
# so Studio cannot show "已完成" next to an answer that explicitly
|
|
510
|
+
# reports remaining failed tests.
|
|
511
|
+
return [
|
|
512
|
+
RunInterrupted(
|
|
513
|
+
**envelope("run.interrupted", run_item, "run"),
|
|
514
|
+
status="interrupted",
|
|
515
|
+
reason=control_reason,
|
|
516
|
+
)
|
|
517
|
+
]
|
|
518
|
+
return [
|
|
519
|
+
RunCompleted(
|
|
520
|
+
**envelope("run.completed", run_item, "run"),
|
|
521
|
+
status="completed",
|
|
522
|
+
output_refs=(OutputRef(scope_id=scope_id, item_id=message_id),),
|
|
523
|
+
)
|
|
524
|
+
]
|
|
525
|
+
if rich.event_type == EventType.RUN_FAILED:
|
|
526
|
+
category = str(payload.get("error_category") or "").strip()
|
|
527
|
+
error_code = str(payload.get("error_code") or "").strip()
|
|
528
|
+
status_code = payload.get("status_code")
|
|
529
|
+
try:
|
|
530
|
+
status_code = int(status_code) if status_code is not None else None
|
|
531
|
+
except (TypeError, ValueError):
|
|
532
|
+
status_code = None
|
|
533
|
+
if not error_code and category == "rate_limit":
|
|
534
|
+
error_code = "MODEL_RATE_LIMITED"
|
|
535
|
+
message = str(payload.get("error") or "Managed Harness run failed")
|
|
536
|
+
if status_code is not None and f"HTTP {status_code}" not in message:
|
|
537
|
+
message = f"HTTP {status_code} {message}"
|
|
538
|
+
return [
|
|
539
|
+
RunFailed(
|
|
540
|
+
**envelope("run.failed", run_item, "run"),
|
|
541
|
+
status="failed",
|
|
542
|
+
error=ErrorInfo(
|
|
543
|
+
code=error_code or "HARNESS_EXECUTION_FAILED",
|
|
544
|
+
message=message,
|
|
545
|
+
source="ksadk.harness.managed",
|
|
546
|
+
scope_id=scope_id,
|
|
547
|
+
),
|
|
548
|
+
)
|
|
549
|
+
]
|
|
550
|
+
if rich.event_type == EventType.RUN_CANCELED:
|
|
551
|
+
return [
|
|
552
|
+
RunCanceled(
|
|
553
|
+
**envelope("run.canceled", run_item, "run"),
|
|
554
|
+
status="canceled",
|
|
555
|
+
reason=str(payload.get("reason") or payload.get("status") or "canceled"),
|
|
556
|
+
)
|
|
557
|
+
]
|
|
558
|
+
if rich.event_type == EventType.RUN_INTERRUPTED:
|
|
559
|
+
return [
|
|
560
|
+
RunInterrupted(
|
|
561
|
+
**envelope("run.interrupted", run_item, "run"),
|
|
562
|
+
status="interrupted",
|
|
563
|
+
reason=str(payload.get("reason") or "harness_interrupted"),
|
|
564
|
+
interaction_id=(
|
|
565
|
+
str(payload.get("approval_id") or f"ap-{run_id}")
|
|
566
|
+
if payload.get("reason") == "tool_approval"
|
|
567
|
+
else None
|
|
568
|
+
),
|
|
569
|
+
)
|
|
570
|
+
]
|
|
571
|
+
if rich.event_type in {EventType.PUBLIC_SUMMARY_DELTA, EventType.PUBLIC_SUMMARY_COMPLETED}:
|
|
572
|
+
from ksadk.harness.tool_display import display_text
|
|
573
|
+
|
|
574
|
+
item_id = stable_item_id("ksadk", run_id, "public-summary", str(payload["summary_id"]))
|
|
575
|
+
text = display_text(payload.get("text"))
|
|
576
|
+
if rich.event_type == EventType.PUBLIC_SUMMARY_COMPLETED:
|
|
577
|
+
return [ItemCompleted(**envelope("item.completed", item_id, "summary"),
|
|
578
|
+
item_id=item_id, item_kind="reasoning",
|
|
579
|
+
snapshot=ContentSnapshot(parts=(TextContent(part_id="summary", text=text),)))]
|
|
580
|
+
if payload.get("summary_start") is True:
|
|
581
|
+
return [ItemStarted(**envelope("item.started", item_id, "summary"),
|
|
582
|
+
item_id=item_id, item_kind="reasoning", phase="commentary",
|
|
583
|
+
initial=ContentSnapshot(parts=(TextContent(part_id="summary", text=text),)))]
|
|
584
|
+
return [ItemUpdated(**envelope("item.updated", item_id, "summary"),
|
|
585
|
+
item_id=item_id, item_kind="reasoning", op="append",
|
|
586
|
+
update=TextContent(part_id="summary", text=text))]
|
|
587
|
+
# Provider reasoning is retained as trace evidence but is not a stable or
|
|
588
|
+
# user-oriented progress contract. Exposing every model turn creates noisy
|
|
589
|
+
# "thought" cards and may reveal private reasoning. Chat progress comes
|
|
590
|
+
# exclusively from the compact RUN_PROGRESS events below.
|
|
591
|
+
if rich.event_type in {EventType.REASONING_DELTA, EventType.REASONING_COMPLETED}:
|
|
592
|
+
return status_projection()
|
|
593
|
+
# Public commentary is rendered by Studio's chronological activity
|
|
594
|
+
# projection. Keeping it as a canonical status fact prevents the shared
|
|
595
|
+
# chat reducer from concatenating every checkpoint into the final answer.
|
|
596
|
+
# The final-answer text remains a normal message item below.
|
|
597
|
+
if rich.event_type == EventType.TEXT_COMPLETED and rich.phase == "commentary":
|
|
598
|
+
return status_projection({"text": str(payload.get("text") or "")})
|
|
599
|
+
if rich.event_type == EventType.MODEL_CALL_FAILED:
|
|
600
|
+
if payload.get("action") != "retry_same_model":
|
|
601
|
+
return status_projection()
|
|
602
|
+
return _public_activity_items(
|
|
603
|
+
rich=rich,
|
|
604
|
+
run_id=run_id,
|
|
605
|
+
scope_id=scope_id,
|
|
606
|
+
source=source,
|
|
607
|
+
envelope=envelope,
|
|
608
|
+
key=f"provider-retry-{payload.get('attempt') or rich.event_id}",
|
|
609
|
+
summary=_provider_retry_text(payload),
|
|
610
|
+
completed=True,
|
|
611
|
+
)
|
|
612
|
+
# A child Run's text is an input to the parent, not a second assistant
|
|
613
|
+
# answer. Keep it inspectable without rendering it in the parent chat.
|
|
614
|
+
if rich.parent_scope_id and rich.event_type in {
|
|
615
|
+
EventType.TEXT_DELTA,
|
|
616
|
+
EventType.TEXT_COMPLETED,
|
|
617
|
+
}:
|
|
618
|
+
return status_projection()
|
|
619
|
+
if rich.event_type == EventType.RUN_PROGRESS:
|
|
620
|
+
# Child lifecycle transitions remain available in Trace, but showing
|
|
621
|
+
# accepted/running/completed as separate chat rows duplicates the
|
|
622
|
+
# aggregate delegation card and makes parallel work unreadable.
|
|
623
|
+
if payload.get("kind") in {"delegation.route", "subagent.event"}:
|
|
624
|
+
return status_projection()
|
|
625
|
+
kind = str(payload.get("kind") or "")
|
|
626
|
+
# Run-control guidance is an internal controller fact. A literal
|
|
627
|
+
# "执行进度:guidance" row is neither useful to a user nor natural
|
|
628
|
+
# language; retain it in the canonical trace only.
|
|
629
|
+
if kind == "run_control":
|
|
630
|
+
return status_projection()
|
|
631
|
+
if kind == "provider.retry":
|
|
632
|
+
return _public_activity_items(
|
|
633
|
+
rich=rich,
|
|
634
|
+
run_id=run_id,
|
|
635
|
+
scope_id=scope_id,
|
|
636
|
+
source=source,
|
|
637
|
+
envelope=envelope,
|
|
638
|
+
key=f"provider-retry-{rich.event_id}",
|
|
639
|
+
summary=_provider_retry_text(payload),
|
|
640
|
+
completed=True,
|
|
641
|
+
)
|
|
642
|
+
if kind == "delegation.batch":
|
|
643
|
+
status = str(payload.get("status") or "running")
|
|
644
|
+
# One quiet line stays visible; responsibility details live in an
|
|
645
|
+
# expandable reasoning-style card. The content is a public
|
|
646
|
+
# activity summary, never provider chain-of-thought.
|
|
647
|
+
summary = _delegation_summary(payload)
|
|
648
|
+
detail = _delegation_detail(payload)
|
|
649
|
+
return [
|
|
650
|
+
*_public_activity_items(
|
|
651
|
+
rich=rich,
|
|
652
|
+
run_id=run_id,
|
|
653
|
+
scope_id=scope_id,
|
|
654
|
+
source=source,
|
|
655
|
+
envelope=envelope,
|
|
656
|
+
key="delegation-summary",
|
|
657
|
+
summary=summary,
|
|
658
|
+
completed=status != "running",
|
|
659
|
+
existing=status != "running",
|
|
660
|
+
),
|
|
661
|
+
*_public_activity_items(
|
|
662
|
+
rich=rich,
|
|
663
|
+
run_id=run_id,
|
|
664
|
+
scope_id=scope_id,
|
|
665
|
+
source=source,
|
|
666
|
+
envelope=envelope,
|
|
667
|
+
key="delegation-detail",
|
|
668
|
+
summary=detail,
|
|
669
|
+
completed=status != "running",
|
|
670
|
+
item_kind="reasoning",
|
|
671
|
+
existing=status != "running",
|
|
672
|
+
),
|
|
673
|
+
]
|
|
674
|
+
progress_completed = str(payload.get("status") or "running") != "running"
|
|
675
|
+
progress_key = (
|
|
676
|
+
f"tool-activity-{payload.get('batch_id') or rich.event_id}"
|
|
677
|
+
if kind == "tool.batch"
|
|
678
|
+
else rich.event_id
|
|
679
|
+
)
|
|
680
|
+
return _public_activity_items(
|
|
681
|
+
rich=rich,
|
|
682
|
+
run_id=run_id,
|
|
683
|
+
scope_id=scope_id,
|
|
684
|
+
source=source,
|
|
685
|
+
envelope=envelope,
|
|
686
|
+
key=progress_key,
|
|
687
|
+
summary=_progress_text(payload),
|
|
688
|
+
completed=progress_completed,
|
|
689
|
+
existing=kind == "tool.batch" and progress_completed,
|
|
690
|
+
)
|
|
691
|
+
if rich.event_type == EventType.USAGE_REPORTED:
|
|
692
|
+
input_tokens = max(0, int(payload.get("input_tokens") or 0))
|
|
693
|
+
output_tokens = max(0, int(payload.get("output_tokens") or 0))
|
|
694
|
+
return [
|
|
695
|
+
UsageReported(
|
|
696
|
+
**envelope("usage.reported", run_item, "usage"),
|
|
697
|
+
input_tokens=input_tokens,
|
|
698
|
+
output_tokens=output_tokens,
|
|
699
|
+
total_tokens=input_tokens + output_tokens,
|
|
700
|
+
cached_tokens=max(0, int(payload.get("cached_tokens") or 0)),
|
|
701
|
+
reasoning_tokens=max(0, int(payload.get("reasoning_tokens") or 0)),
|
|
702
|
+
mode=str(payload.get("mode") or "delta"),
|
|
703
|
+
)
|
|
704
|
+
]
|
|
705
|
+
if rich.event_type == EventType.APPROVAL_REQUESTED:
|
|
706
|
+
interaction_id = str(payload.get("approval_id") or f"ap-{run_id}")
|
|
707
|
+
return [
|
|
708
|
+
InteractionRequested(
|
|
709
|
+
**envelope("interaction.requested", interaction_id, "approval"),
|
|
710
|
+
interaction_id=interaction_id,
|
|
711
|
+
interaction_kind="approval",
|
|
712
|
+
request=ApprovalRequest(
|
|
713
|
+
call_id=str(payload.get("call_id") or "") or None,
|
|
714
|
+
kind=str(payload.get("kind") or "tool"),
|
|
715
|
+
detail=_public_approval_detail(payload.get("detail")),
|
|
716
|
+
),
|
|
717
|
+
)
|
|
718
|
+
]
|
|
719
|
+
if rich.event_type in {EventType.TEXT_COMPLETED, EventType.REASONING_COMPLETED}:
|
|
720
|
+
kind = "message" if rich.event_type == EventType.TEXT_COMPLETED else "reasoning"
|
|
721
|
+
phase = str(rich.phase or ("final_answer" if kind == "message" else "commentary"))
|
|
722
|
+
item_id = (
|
|
723
|
+
_final_item_id(run_id, rich)
|
|
724
|
+
if kind == "message" and phase == "final_answer"
|
|
725
|
+
else stable_item_id("ksadk", run_id, kind, rich.event_id)
|
|
726
|
+
)
|
|
727
|
+
part_id = "text-0"
|
|
728
|
+
text = str(payload.get("text") or payload.get("summary") or "")
|
|
729
|
+
content = ContentSnapshot(parts=(TextContent(part_id=part_id, text=text),))
|
|
730
|
+
if payload.get("streamed"):
|
|
731
|
+
return [
|
|
732
|
+
ItemCompleted(
|
|
733
|
+
**envelope("item.completed", item_id, part_id, 1),
|
|
734
|
+
item_id=item_id,
|
|
735
|
+
item_kind=kind,
|
|
736
|
+
snapshot=content,
|
|
737
|
+
)
|
|
738
|
+
]
|
|
739
|
+
return [
|
|
740
|
+
ItemStarted(
|
|
741
|
+
**envelope("item.started", item_id, part_id, 0),
|
|
742
|
+
item_id=item_id,
|
|
743
|
+
item_kind=kind,
|
|
744
|
+
phase=phase,
|
|
745
|
+
initial=None,
|
|
746
|
+
),
|
|
747
|
+
ItemCompleted(
|
|
748
|
+
**envelope("item.completed", item_id, part_id, 1),
|
|
749
|
+
item_id=item_id,
|
|
750
|
+
item_kind=kind,
|
|
751
|
+
snapshot=content,
|
|
752
|
+
),
|
|
753
|
+
]
|
|
754
|
+
if rich.event_type in {EventType.TEXT_DELTA, EventType.REASONING_DELTA}:
|
|
755
|
+
kind = "message" if rich.event_type == EventType.TEXT_DELTA else "reasoning"
|
|
756
|
+
phase = str(rich.phase or ("final_answer" if kind == "message" else "commentary"))
|
|
757
|
+
item_id = (
|
|
758
|
+
_final_item_id(native_run_id, rich)
|
|
759
|
+
if kind == "message" and phase == "final_answer"
|
|
760
|
+
else stable_item_id("ksadk", run_id, kind, "stream")
|
|
761
|
+
)
|
|
762
|
+
part_id = "text-0"
|
|
763
|
+
text = str(payload.get("text") or "")
|
|
764
|
+
update = TextContent(part_id=part_id, text=text)
|
|
765
|
+
if int(payload.get("delta_index") or 0) == 0:
|
|
766
|
+
return [
|
|
767
|
+
ItemStarted(
|
|
768
|
+
**envelope("item.started", item_id, part_id, 0),
|
|
769
|
+
item_id=item_id,
|
|
770
|
+
item_kind=kind,
|
|
771
|
+
phase=phase,
|
|
772
|
+
initial=ContentSnapshot(parts=(update,)),
|
|
773
|
+
)
|
|
774
|
+
]
|
|
775
|
+
return [
|
|
776
|
+
ItemUpdated(
|
|
777
|
+
**envelope("item.updated", item_id, part_id, int(payload.get("delta_index") or 0)),
|
|
778
|
+
item_id=item_id,
|
|
779
|
+
item_kind=kind,
|
|
780
|
+
op="append",
|
|
781
|
+
update=update,
|
|
782
|
+
)
|
|
783
|
+
]
|
|
784
|
+
if rich.event_type in {
|
|
785
|
+
EventType.TOOL_CALL_BEGIN, EventType.TOOL_CALL_END, EventType.TOOL_OUTPUT_UPDATED,
|
|
786
|
+
}:
|
|
787
|
+
# Arguments, results and receipts remain in the canonical Trace. The
|
|
788
|
+
# conversation receives the corresponding human-readable tool.batch
|
|
789
|
+
# progress item, avoiding duplicate technical cards and configuration-
|
|
790
|
+
# shaped payloads in the user-facing activity stream.
|
|
791
|
+
action = tool_public_action(payload)
|
|
792
|
+
display = (safe_tool_display(payload.get("public_display"))
|
|
793
|
+
or tool_display_start(str(payload.get("name") or "tool"), payload.get("args")))
|
|
794
|
+
return status_projection(
|
|
795
|
+
{
|
|
796
|
+
"name": str(payload.get("name") or "tool"),
|
|
797
|
+
"call_id": str(payload.get("call_id") or rich.event_id),
|
|
798
|
+
**({"public_action": action} if action else {}),
|
|
799
|
+
"tool_display": display,
|
|
800
|
+
"status": (
|
|
801
|
+
"started"
|
|
802
|
+
if rich.event_type in {EventType.TOOL_CALL_BEGIN, EventType.TOOL_OUTPUT_UPDATED}
|
|
803
|
+
else "failed" if payload.get("error") or (
|
|
804
|
+
isinstance(payload.get("result"), dict)
|
|
805
|
+
and payload["result"].get("ok") is False
|
|
806
|
+
) else "completed"
|
|
807
|
+
),
|
|
808
|
+
}
|
|
809
|
+
)
|
|
810
|
+
|
|
811
|
+
# Preserve the rich execution tree as canonical status items. Studio can
|
|
812
|
+
# render these in the existing Trace inspector without a Harness-only page.
|
|
813
|
+
return status_projection()
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
def _public_activity_items(
|
|
817
|
+
*,
|
|
818
|
+
rich: Any,
|
|
819
|
+
run_id: str,
|
|
820
|
+
scope_id: str,
|
|
821
|
+
source: Any,
|
|
822
|
+
envelope: Any,
|
|
823
|
+
key: str,
|
|
824
|
+
summary: str,
|
|
825
|
+
completed: bool,
|
|
826
|
+
item_kind: str = "message",
|
|
827
|
+
existing: bool = False,
|
|
828
|
+
) -> list[Any]:
|
|
829
|
+
"""Build one identity-stable public activity lifecycle transition.
|
|
830
|
+
|
|
831
|
+
Each Harness event must project to exactly one renderer mutation. Emitting
|
|
832
|
+
``started`` + identical ``updated`` + identical ``completed`` for a single
|
|
833
|
+
retry made clients that preserve canonical lifecycle events render the same
|
|
834
|
+
sentence twice. Running activities start once, subsequent progress replaces
|
|
835
|
+
once, and completion supplies the authoritative final snapshot once.
|
|
836
|
+
"""
|
|
837
|
+
del rich, scope_id, source
|
|
838
|
+
item_id = stable_item_id("ksadk", run_id, item_kind, f"activity-{key}")
|
|
839
|
+
part_id = "text-0"
|
|
840
|
+
snapshot = ContentSnapshot(parts=(TextContent(part_id=part_id, text=summary),))
|
|
841
|
+
if completed:
|
|
842
|
+
return [
|
|
843
|
+
ItemCompleted(
|
|
844
|
+
**envelope("item.completed", item_id, part_id, 2),
|
|
845
|
+
item_id=item_id,
|
|
846
|
+
item_kind=item_kind,
|
|
847
|
+
snapshot=snapshot,
|
|
848
|
+
)
|
|
849
|
+
]
|
|
850
|
+
if not existing:
|
|
851
|
+
return [
|
|
852
|
+
ItemStarted(
|
|
853
|
+
**envelope("item.started", item_id, part_id, 0),
|
|
854
|
+
item_id=item_id,
|
|
855
|
+
item_kind=item_kind,
|
|
856
|
+
phase="commentary",
|
|
857
|
+
initial=snapshot,
|
|
858
|
+
)
|
|
859
|
+
]
|
|
860
|
+
return [
|
|
861
|
+
ItemUpdated(
|
|
862
|
+
**envelope("item.updated", item_id, part_id, 1),
|
|
863
|
+
item_id=item_id,
|
|
864
|
+
item_kind=item_kind,
|
|
865
|
+
op="replace",
|
|
866
|
+
update=TextContent(part_id=part_id, text=summary),
|
|
867
|
+
)
|
|
868
|
+
]
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
def _progress_text(payload: dict[str, Any]) -> str:
|
|
872
|
+
"""Render public execution progress without exposing private chain-of-thought."""
|
|
873
|
+
kind = str(payload.get("kind") or "progress")
|
|
874
|
+
if kind == "plan":
|
|
875
|
+
return f"计划:{_compact_progress_message(payload.get('message'))}"
|
|
876
|
+
if kind == "delegation.batch":
|
|
877
|
+
return _delegation_summary(payload)
|
|
878
|
+
if kind == "tool.batch":
|
|
879
|
+
status = str(payload.get("status") or "running")
|
|
880
|
+
tools = [str(name) for name in payload.get("tools") or []]
|
|
881
|
+
action = _tool_activity_label(tools)
|
|
882
|
+
if status == "failed":
|
|
883
|
+
return f"{action}时遇到问题,正在调整"
|
|
884
|
+
if status == "completed":
|
|
885
|
+
return f"已{action}"
|
|
886
|
+
return f"正在{action}"
|
|
887
|
+
if kind == "provider.retry":
|
|
888
|
+
return _provider_retry_text(payload)
|
|
889
|
+
if kind == "delegation.route":
|
|
890
|
+
provider = "Codex" if "codex" in str(payload.get("provider_ref") or "") else "Harness"
|
|
891
|
+
return f"子任务「{payload.get('label') or '未命名'}」已分派给 {provider}。"
|
|
892
|
+
if kind == "subagent.event":
|
|
893
|
+
status = str(payload.get("status") or "in_progress")
|
|
894
|
+
status_text = {
|
|
895
|
+
"accepted": "等待执行",
|
|
896
|
+
"running": "正在执行",
|
|
897
|
+
"succeeded": "已完成",
|
|
898
|
+
"failed": "执行失败",
|
|
899
|
+
"cancelled": "已取消",
|
|
900
|
+
"interrupted": "已中断",
|
|
901
|
+
}.get(status, status)
|
|
902
|
+
return f"子任务「{payload.get('label') or '未命名'}」:{status_text}。"
|
|
903
|
+
action = str(payload.get("action") or payload.get("status") or "in_progress")
|
|
904
|
+
return f"执行进度:{action}"
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
def _delegation_summary(payload: dict[str, Any]) -> str:
|
|
908
|
+
count = max(1, int(payload.get("count") or 1))
|
|
909
|
+
status = str(payload.get("status") or "running")
|
|
910
|
+
if status == "failed":
|
|
911
|
+
return f"{count} 个子智能体已结束,部分任务需要调整"
|
|
912
|
+
if status == "completed":
|
|
913
|
+
return f"{count} 个子智能体已完成,正在整理结果"
|
|
914
|
+
return f"{count} 个子智能体正在运行"
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
def _delegation_detail(payload: dict[str, Any]) -> str:
|
|
918
|
+
status = str(payload.get("status") or "running")
|
|
919
|
+
labels = [
|
|
920
|
+
str(label).strip() for label in (payload.get("labels") or []) if str(label).strip()
|
|
921
|
+
]
|
|
922
|
+
marker = "已完成" if status == "completed" else "需要调整" if status == "failed" else "正在运行"
|
|
923
|
+
if not labels:
|
|
924
|
+
return marker
|
|
925
|
+
return "\n".join(f"• {marker}:{label}" for label in labels[:6])
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
def _provider_retry_text(payload: dict[str, Any]) -> str:
|
|
929
|
+
if payload.get("next_attempt") is not None:
|
|
930
|
+
attempt = max(2, int(payload["next_attempt"]))
|
|
931
|
+
else:
|
|
932
|
+
attempt = max(2, int(payload.get("model_attempt") or 1) + 1)
|
|
933
|
+
maximum = max(attempt, int(payload.get("max_attempts") or 3))
|
|
934
|
+
delay_ms = max(0, int(payload.get("delay_ms") or payload.get("retry_delay_ms") or 0))
|
|
935
|
+
wait = f",{delay_ms / 1000:g} 秒后" if delay_ms else ""
|
|
936
|
+
label = str(payload.get("label") or "").strip()
|
|
937
|
+
scope = f"({label})" if label else ""
|
|
938
|
+
# 叙述必须区分"上游繁忙/限流"与"其它失败":把被我们拒绝的响应说成
|
|
939
|
+
# "模型服务繁忙"会掩盖 bug(2026-09-18 实测事故)。
|
|
940
|
+
#
|
|
941
|
+
# 并且**类别本身也必须显示出来**:`transient` 里包含 `timeout`,而超时可能
|
|
942
|
+
# 是我们自己触发的(例如空闲进度超时)。统一写成"模型服务繁忙"会让用户
|
|
943
|
+
# 无法判断是网关的问题还是我们的问题——2026-09-18 用户直接质疑"服务器没
|
|
944
|
+
# 那么容易繁忙吧",而我们当时确实拿不出证据。这里保留可读措辞并附上原始
|
|
945
|
+
# 类别,让重试原因可辨。
|
|
946
|
+
category = str(payload.get("failure_category") or "").strip().lower()
|
|
947
|
+
transient = {"rate_limit", "timeout", "unavailable", "transport"}
|
|
948
|
+
# 类别未知时保持原措辞(不改变既有语义);只有确实拿到类别才改口径并附上。
|
|
949
|
+
headline = (
|
|
950
|
+
"模型调用未成功"
|
|
951
|
+
if category and category not in transient
|
|
952
|
+
else "模型服务繁忙"
|
|
953
|
+
)
|
|
954
|
+
if category:
|
|
955
|
+
headline = f"{headline}({category})"
|
|
956
|
+
# 附带上游 HTTP 状态码(纯数字,不含正文,无泄密风险)。2026-09-18 实测:
|
|
957
|
+
# 重试全是 `unavailable`,但它既可能是网关 503,也可能是**我们自己**把
|
|
958
|
+
# "网关 400(例如拒绝请求体某字段)"包装成 MODEL_REQUEST_FAILED(502)。
|
|
959
|
+
# 不显示状态码就无法区分"上游真的不可用"和"我们的请求把上游惹了"。
|
|
960
|
+
status_code = payload.get("status_code")
|
|
961
|
+
if status_code:
|
|
962
|
+
headline = f"{headline}[{status_code}]"
|
|
963
|
+
# 带上内部错误码(是我们自判失败还是上游失败,一眼可辨;不含任何正文/凭证)。
|
|
964
|
+
error_code = str(payload.get("error_code") or "").strip()
|
|
965
|
+
if error_code:
|
|
966
|
+
headline = f"{headline}<{error_code}>"
|
|
967
|
+
return f"{headline}{scope}{wait}自动重试(第 {attempt}/{maximum} 次)"
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
def _public_approval_detail(value: Any) -> dict[str, Any]:
|
|
971
|
+
"""Keep approvals actionable without copying document bodies or secrets into chat."""
|
|
972
|
+
detail = dict(value) if isinstance(value, dict) else {}
|
|
973
|
+
arguments = detail.get("arguments") or detail.get("args")
|
|
974
|
+
safe_arguments: dict[str, str] = {}
|
|
975
|
+
if isinstance(arguments, dict):
|
|
976
|
+
for key in ("path", "file_path", "url", "command"):
|
|
977
|
+
raw = arguments.get(key)
|
|
978
|
+
if raw is not None:
|
|
979
|
+
safe_arguments[key] = _compact_progress_message(raw, max_chars=160)
|
|
980
|
+
public: dict[str, Any] = {
|
|
981
|
+
"name": str(detail.get("name") or detail.get("tool_name") or "tool"),
|
|
982
|
+
}
|
|
983
|
+
if safe_arguments:
|
|
984
|
+
public["args"] = safe_arguments
|
|
985
|
+
return public
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
def _tool_activity_label(tools: list[str]) -> str:
|
|
989
|
+
lowered = " ".join(tools).lower()
|
|
990
|
+
if "write" in lowered or "edit" in lowered or "save" in lowered:
|
|
991
|
+
return "编辑并保存结果"
|
|
992
|
+
if "web_search" in lowered or "search" in lowered:
|
|
993
|
+
return "搜索资料"
|
|
994
|
+
if "web_fetch" in lowered or "fetch" in lowered:
|
|
995
|
+
return "查看资料"
|
|
996
|
+
if "read" in lowered or "list" in lowered:
|
|
997
|
+
return "查看工作区内容"
|
|
998
|
+
if "command" in lowered or "shell" in lowered or "exec" in lowered:
|
|
999
|
+
return "运行任务"
|
|
1000
|
+
return "使用工具处理任务"
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
def _compact_progress_message(value: Any, *, max_chars: int = 120) -> str:
|
|
1004
|
+
"""Keep only the first useful plan lines for the conversational surface."""
|
|
1005
|
+
lines = [line.strip(" -\t") for line in str(value or "计划已生成").splitlines()]
|
|
1006
|
+
text = ";".join(line for line in lines if line) or "计划已生成"
|
|
1007
|
+
if len(text) <= max_chars:
|
|
1008
|
+
return text
|
|
1009
|
+
return text[: max_chars - 1].rstrip(";,。 ") + "…"
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
def _compact_responsibilities(labels: list[str], *, max_items: int = 4) -> str:
|
|
1013
|
+
if not labels:
|
|
1014
|
+
return ""
|
|
1015
|
+
visible = labels[:max_items]
|
|
1016
|
+
lines = [f"• {label}" for label in visible]
|
|
1017
|
+
if len(labels) > max_items:
|
|
1018
|
+
lines.append(f"• 另有 {len(labels) - max_items} 项")
|
|
1019
|
+
return "\n" + "\n".join(lines)
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
def _steer_text(value: Any) -> str:
|
|
1023
|
+
"""Normalize both plain text and the Kernel wire payload to steering text."""
|
|
1024
|
+
if isinstance(value, str):
|
|
1025
|
+
return value
|
|
1026
|
+
content = getattr(value, "content", None)
|
|
1027
|
+
if content is None and isinstance(value, dict):
|
|
1028
|
+
content = value.get("content")
|
|
1029
|
+
return str(content) if content is not None else str(value)
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
def _positive_int(value: Any) -> int | None:
|
|
1033
|
+
try:
|
|
1034
|
+
parsed = int(value)
|
|
1035
|
+
except (TypeError, ValueError):
|
|
1036
|
+
return None
|
|
1037
|
+
return parsed if parsed > 0 else None
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
__all__ = [
|
|
1041
|
+
"ManagedHarnessRuntime",
|
|
1042
|
+
"ManagedHarnessRuntimeAdapter",
|
|
1043
|
+
"managed_harness_capabilities",
|
|
1044
|
+
]
|