agentengine-sdk-python 0.8.6__py3-none-any.whl → 0.8.8__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.
Files changed (764) hide show
  1. {agentengine_sdk_python-0.8.6.dist-info → agentengine_sdk_python-0.8.8.dist-info}/METADATA +41 -18
  2. {agentengine_sdk_python-0.8.6.dist-info → agentengine_sdk_python-0.8.8.dist-info}/RECORD +710 -526
  3. {agentengine_sdk_python-0.8.6.dist-info → agentengine_sdk_python-0.8.8.dist-info}/WHEEL +1 -1
  4. ksadk/__init__.py +2 -1
  5. ksadk/_build_provenance.json +1 -1
  6. ksadk/_mcp_compat.py +305 -0
  7. ksadk/a2a/_invocation_state.py +1 -1
  8. ksadk/a2a/adk_invocation_context.py +2 -1
  9. ksadk/a2a/adk_tools.py +19 -9
  10. ksadk/a2a/bootstrap.py +7 -6
  11. ksadk/a2a/codex.py +2 -1
  12. ksadk/a2a/control_plane.py +119 -2
  13. ksadk/a2a/executor.py +24 -7
  14. ksadk/a2a/invocation_service.py +198 -7
  15. ksadk/a2a/kernel_task_adapter.py +60 -9
  16. ksadk/a2a/langgraph_invocation_context.py +3 -2
  17. ksadk/a2a/langgraph_managed.py +17 -1
  18. ksadk/a2a/langgraph_recovery.py +43 -5
  19. ksadk/a2a/langgraph_tool_runtime.py +8 -6
  20. ksadk/a2a/langgraph_tools.py +13 -1
  21. ksadk/a2a/platform.py +8 -2
  22. ksadk/a2a/runtime_approval.py +6 -21
  23. ksadk/a2a/runtime_input.py +3 -2
  24. ksadk/a2a/timeouts.py +37 -0
  25. ksadk/a2a/tool_outcomes.py +73 -0
  26. ksadk/a2a/workload_tokens.py +21 -134
  27. ksadk/a2ui/__init__.py +4 -0
  28. ksadk/a2ui/assets/basic-v0_9_1.json +1383 -0
  29. ksadk/a2ui/assets/common-types-v0_9.json +305 -0
  30. ksadk/a2ui/assets/legacy-seven-components.json +230 -0
  31. ksadk/a2ui/assets/manifest.json +86 -0
  32. ksadk/a2ui/budget.py +54 -0
  33. ksadk/a2ui/catalog.py +64 -0
  34. ksadk/a2ui/generation.py +71 -0
  35. ksadk/a2ui/legacy.py +88 -0
  36. ksadk/a2ui/linking.py +115 -0
  37. ksadk/a2ui/payload.py +46 -0
  38. ksadk/a2ui/presentation.py +79 -0
  39. ksadk/a2ui/registry.py +166 -0
  40. ksadk/a2ui/wire.py +110 -0
  41. ksadk/agent.py +29 -0
  42. ksadk/agui/_agent_helpers.py +16 -1
  43. ksadk/agui/_agent_kernel.py +515 -0
  44. ksadk/agui/_agent_projection.py +379 -0
  45. ksadk/agui/_agent_resume.py +279 -0
  46. ksadk/agui/_agent_types.py +67 -0
  47. ksadk/agui/a2ui_projection.py +3 -1
  48. ksadk/agui/agent.py +184 -571
  49. ksadk/agui/config.py +19 -5
  50. ksadk/agui/hosted.py +343 -0
  51. ksadk/agui/request_identity.py +11 -0
  52. ksadk/agui/routes.py +79 -2
  53. ksadk/api/client.py +158 -7
  54. ksadk/builders/code_builder.py +174 -52
  55. ksadk/builders/container_builder.py +28 -7
  56. ksadk/builders/framework_requirements.py +5 -4
  57. ksadk/builders/mcp_builder.py +145 -1
  58. ksadk/builders/project_imports.py +66 -0
  59. ksadk/cli/cmd_deploy.py +5 -0
  60. ksadk/cli/cmd_invoke.py +57 -2
  61. ksadk/cli/cmd_mcp.py +1 -1
  62. ksadk/cli/cmd_run.py +2 -4
  63. ksadk/cli/cmd_studio.py +19 -3
  64. ksadk/cli/cmd_web.py +28 -56
  65. ksadk/cli/hosted_command_events.py +148 -0
  66. ksadk/cli/hosted_invoke.py +66 -14
  67. ksadk/cli/runtime_bootstrap.py +5 -1
  68. ksadk/codex/async_client.py +354 -12
  69. ksadk/codex/runtime.py +17 -2
  70. ksadk/common/cloud_headers.py +33 -6
  71. ksadk/common/diagnostics.py +15 -0
  72. ksadk/compat/adk_compat.py +2 -0
  73. ksadk/compat/adk_stream.py +35 -0
  74. ksadk/compat/copilotkit_a2ui.py +85 -21
  75. ksadk/configs/env_registry.py +102 -19
  76. ksadk/configs/env_registry_a2a.py +42 -0
  77. ksadk/conversations/a2ui_projection.py +50 -0
  78. ksadk/conversations/context.py +12 -0
  79. ksadk/conversations/message_projection.py +106 -60
  80. ksadk/conversations/message_projection_blocks.py +75 -3
  81. ksadk/conversations/message_projection_outcomes.py +81 -0
  82. ksadk/conversations/projector.py +35 -0
  83. ksadk/conversations/runtime_invocation.py +3 -0
  84. ksadk/conversations/runtime_observability.py +1 -0
  85. ksadk/conversations/runtime_projection.py +23 -1
  86. ksadk/conversations/runtime_stream_events.py +11 -7
  87. ksadk/conversations/runtime_streaming.py +21 -17
  88. ksadk/deployment/mcp.py +93 -0
  89. ksadk/deployment/providers/serverless.py +130 -4
  90. ksadk/detection/mcp_detector.py +80 -22
  91. ksadk/events/_v1_compat/projection.py +2 -0
  92. ksadk/events/adapters/_langgraph_custom.py +195 -0
  93. ksadk/events/adapters/_langgraph_model_tasks.py +59 -0
  94. ksadk/events/adapters/_langgraph_support.py +80 -29
  95. ksadk/events/adapters/_langgraph_tool_outcomes.py +71 -0
  96. ksadk/events/adapters/_langgraph_usage_origin.py +86 -0
  97. ksadk/events/adapters/adk.py +11 -0
  98. ksadk/events/adapters/langgraph.py +188 -20
  99. ksadk/events/canonical.py +23 -1
  100. ksadk/events/canonical_store.py +133 -4
  101. ksadk/events/cold_recovery.py +2 -1
  102. ksadk/events/native_checkpoint.py +10 -0
  103. ksadk/events/reducer.py +9 -9
  104. ksadk/events/run_authority.py +15 -0
  105. ksadk/events/session_event.py +61 -0
  106. ksadk/events/sse_heartbeat.py +50 -0
  107. ksadk/events/usage.py +50 -0
  108. ksadk/harness/__init__.py +3 -0
  109. ksadk/harness/app.py +1 -1
  110. ksadk/harness/artifact_adapters/native_catalog.py +92 -0
  111. ksadk/harness/artifact_adapters/native_tool.py +16 -0
  112. ksadk/harness/browser_adapters/native_playwright.py +3 -1
  113. ksadk/harness/browser_adapters/native_vision.py +2 -1
  114. ksadk/harness/engine/postgres_checkpointer.py +170 -29
  115. ksadk/harness/model_adapters/native_openai.py +3 -1
  116. ksadk/harness/native/artifact_catalog_contract.py +26 -0
  117. ksadk/harness/native/artifact_partial_read_capacity.py +6 -3
  118. ksadk/harness/native/artifact_read_capacity.py +15 -87
  119. ksadk/harness/native/artifact_runtime.py +44 -1
  120. ksadk/harness/native/artifact_search_capacity.py +20 -119
  121. ksadk/harness/native/artifact_single_read_capacity.py +7 -6
  122. ksadk/harness/native/background_command_contract.py +40 -0
  123. ksadk/harness/native/background_commands.py +101 -0
  124. ksadk/harness/native/call_budget.py +24 -0
  125. ksadk/harness/native/child_budget.py +6 -6
  126. ksadk/harness/native/child_interruption.py +3 -2
  127. ksadk/harness/native/child_media.py +105 -0
  128. ksadk/harness/native/context.py +44 -0
  129. ksadk/harness/native/context_compaction_projection.py +38 -2
  130. ksadk/harness/native/context_continuation.py +54 -0
  131. ksadk/harness/native/context_contributions.py +2 -1
  132. ksadk/harness/native/context_directory_progress.py +117 -0
  133. ksadk/harness/native/context_driver.py +136 -11
  134. ksadk/harness/native/context_partial_summary.py +2 -0
  135. ksadk/harness/native/context_partition.py +37 -1
  136. ksadk/harness/native/context_replay.py +2 -1
  137. ksadk/harness/native/context_request_projection.py +59 -6
  138. ksadk/harness/native/context_runtime.py +211 -16
  139. ksadk/harness/native/context_runtime_contracts.py +123 -1
  140. ksadk/harness/native/context_session_history.py +96 -0
  141. ksadk/harness/native/context_source_progress.py +164 -5
  142. ksadk/harness/native/context_summary_planning.py +63 -15
  143. ksadk/harness/native/context_summary_prompt.py +72 -0
  144. ksadk/harness/native/context_summary_recovery.py +3 -1
  145. ksadk/harness/native/delivery_artifacts.py +58 -0
  146. ksadk/harness/native/delivery_context.py +64 -0
  147. ksadk/harness/native/delivery_feedback.py +95 -0
  148. ksadk/harness/native/delivery_review.py +10 -10
  149. ksadk/harness/native/effect_control.py +45 -1
  150. ksadk/harness/native/effect_receipts.py +50 -3
  151. ksadk/harness/native/effect_runtime.py +10 -1
  152. ksadk/harness/native/engine.py +601 -16
  153. ksadk/harness/native/execution_budget.py +88 -0
  154. ksadk/harness/native/history.py +1 -0
  155. ksadk/harness/native/machine.py +44 -7
  156. ksadk/harness/native/model.py +17 -3
  157. ksadk/harness/native/model_runtime.py +192 -12
  158. ksadk/harness/native/model_takeover.py +4 -2
  159. ksadk/harness/native/notification_admission.py +183 -0
  160. ksadk/harness/native/ports.py +54 -6
  161. ksadk/harness/native/run_clock.py +13 -6
  162. ksadk/harness/native/state.py +100 -1
  163. ksadk/harness/native/stream_display_buffer.py +198 -0
  164. ksadk/harness/native/subagents.py +21 -0
  165. ksadk/harness/native/task_policy.py +8 -3
  166. ksadk/harness/native/tool_batch_capacity.py +152 -0
  167. ksadk/harness/native/tool_budget.py +38 -9
  168. ksadk/harness/native/tool_error_recovery.py +241 -0
  169. ksadk/harness/native/tool_error_streak.py +10 -1
  170. ksadk/harness/native/tool_progress.py +1 -0
  171. ksadk/harness/native/tool_scheduling.py +9 -10
  172. ksadk/harness/native/turn_control.py +21 -2
  173. ksadk/harness/native/verification_runtime.py +2 -1
  174. ksadk/harness/native_facade.py +180 -9
  175. ksadk/harness/native_projection.py +18 -8
  176. ksadk/harness/native_runtime.py +208 -3
  177. ksadk/harness/provider_thinking.py +63 -0
  178. ksadk/harness/public_activity.py +3 -0
  179. ksadk/harness/service_presentation.py +44 -0
  180. ksadk/harness/service_runtime.py +1038 -0
  181. ksadk/harness/skill_adapters/native_disclosure.py +13 -1
  182. ksadk/harness/skill_adapters/native_metadata.py +40 -0
  183. ksadk/harness/spec.py +6 -0
  184. ksadk/harness/stores/native_commit_history.py +373 -0
  185. ksadk/harness/stores/native_contract.py +205 -1
  186. ksadk/harness/stores/native_memory.py +363 -1
  187. ksadk/harness/stores/native_sqlite.py +572 -14
  188. ksadk/harness/stores/native_sqlite_migration.py +34 -7
  189. ksadk/harness/subagent.py +6 -1
  190. ksadk/harness/subagent_adapters/native_background_child.py +8 -7
  191. ksadk/harness/subagent_adapters/native_child.py +87 -8
  192. ksadk/harness/tool_display.py +113 -2
  193. ksadk/harness/tool_display_contract.py +34 -1
  194. ksadk/interaction/contracts.py +19 -4
  195. ksadk/interaction/display_values.py +140 -0
  196. ksadk/interaction/form_values.py +130 -0
  197. ksadk/interaction/langgraph.py +53 -0
  198. ksadk/interaction/langgraph_approval.py +59 -0
  199. ksadk/interaction/langgraph_interrupt.py +129 -0
  200. ksadk/interaction/langgraph_observer.py +125 -0
  201. ksadk/interaction/ledger.py +32 -5
  202. ksadk/interaction/native_events.py +29 -0
  203. ksadk/interaction/providers/harness.py +9 -4
  204. ksadk/interaction/providers/langgraph.py +19 -8
  205. ksadk/interaction/resolution.py +43 -0
  206. ksadk/interaction/schema.py +168 -0
  207. ksadk/interaction/submission.py +184 -0
  208. ksadk/kernel/admission_cursor.py +19 -0
  209. ksadk/kernel/bootstrap.py +344 -228
  210. ksadk/kernel/contract_fingerprints.py +5 -0
  211. ksadk/kernel/contracts.py +1 -0
  212. ksadk/kernel/control.py +67 -0
  213. ksadk/kernel/conversation_input.py +39 -0
  214. ksadk/kernel/execution_host_ingress.py +6 -3
  215. ksadk/kernel/history_projection.py +85 -4
  216. ksadk/kernel/ingress.py +89 -27
  217. ksadk/kernel/interactions_memory.py +447 -0
  218. ksadk/kernel/interactions_postgres.py +500 -0
  219. ksadk/kernel/interactions_sqlite.py +684 -0
  220. ksadk/kernel/legacy_postgres_repair.py +113 -0
  221. ksadk/kernel/local_interactions.py +172 -0
  222. ksadk/kernel/memory_store.py +137 -366
  223. ksadk/kernel/native_confirmation.py +109 -0
  224. ksadk/kernel/postgres_locks.py +23 -0
  225. ksadk/kernel/postgres_store.py +573 -511
  226. ksadk/kernel/postgres_time.py +12 -0
  227. ksadk/kernel/recovery.py +26 -1
  228. ksadk/kernel/runtime_config.py +72 -0
  229. ksadk/kernel/runtime_environment.py +301 -0
  230. ksadk/kernel/session_storage.py +144 -0
  231. ksadk/kernel/sql/002_session_retirement.sql +86 -0
  232. ksadk/kernel/sql/003_legacy_repair_queue.sql +49 -0
  233. ksadk/kernel/sql/backfill_session_namespaces.sql +59 -0
  234. ksadk/kernel/sqlite_session_cleanup.py +84 -0
  235. ksadk/kernel/sqlite_store.py +232 -622
  236. ksadk/kernel/store.py +6 -0
  237. ksadk/kernel/submission_postgres.py +99 -0
  238. ksadk/kernel/submission_sqlite.py +107 -0
  239. ksadk/kernel/teams_effects.py +3 -4
  240. ksadk/kernel/teams_execution_context.py +3 -4
  241. ksadk/kernel/worker.py +91 -202
  242. ksadk/kernel/worker_controls.py +112 -27
  243. ksadk/kernel/worker_identity.py +15 -8
  244. ksadk/kernel/worker_interactions.py +343 -47
  245. ksadk/knowledge_base/__init__.py +1 -1
  246. ksadk/knowledge_base/client.py +138 -17
  247. ksadk/knowledge_base/openclaw_bridge.py +58 -0
  248. ksadk/knowledge_base/service.py +2 -0
  249. ksadk/mcp_runtime/__init__.py +34 -15
  250. ksadk/mcp_runtime/_adk.py +14 -0
  251. ksadk/mcp_runtime/oauth/__init__.py +6 -0
  252. ksadk/mcp_runtime/oauth/_agent.py +215 -0
  253. ksadk/mcp_runtime/oauth/_durable_tools.py +208 -0
  254. ksadk/mcp_runtime/oauth/bootstrap.py +69 -0
  255. ksadk/mcp_runtime/oauth/client.py +200 -0
  256. ksadk/mcp_runtime/oauth/code_config.py +90 -0
  257. ksadk/mcp_runtime/oauth/contract.json +32 -0
  258. ksadk/mcp_runtime/oauth/contract.py +6 -0
  259. ksadk/mcp_runtime/oauth/declarations.py +106 -0
  260. ksadk/mcp_runtime/oauth/http.py +63 -0
  261. ksadk/mcp_runtime/oauth/kernel.py +717 -0
  262. ksadk/mcp_runtime/oauth/langgraph.py +434 -0
  263. ksadk/mcp_runtime/oauth/local/__init__.py +1 -0
  264. ksadk/mcp_runtime/oauth/local/broker.py +491 -0
  265. ksadk/mcp_runtime/oauth/local/checkpoint.py +17 -0
  266. ksadk/mcp_runtime/oauth/local/persistence.py +227 -0
  267. ksadk/mcp_runtime/oauth/local/protocol.py +390 -0
  268. ksadk/mcp_runtime/oauth/local/runtime.py +413 -0
  269. ksadk/mcp_runtime/oauth/local/transport.py +79 -0
  270. ksadk/mcp_runtime/oauth/runtime_io.py +43 -0
  271. ksadk/mcp_runtime/oauth/security.py +73 -0
  272. ksadk/mcp_runtime/oauth/tools.py +434 -0
  273. ksadk/mcp_runtime/oauth/transport.py +109 -0
  274. ksadk/memory/adk/backends/sdk_ltm_backend.py +21 -12
  275. ksadk/memory/adk/long_term_memory.py +1 -2
  276. ksadk/memory/openclaw_bridge.py +115 -0
  277. ksadk/memory/providers/local_postgres.py +247 -55
  278. ksadk/memory/scope_ids.py +49 -0
  279. ksadk/memory/service.py +29 -3
  280. ksadk/model_gateway/client.py +1 -1
  281. ksadk/model_proxy/compat.py +22 -0
  282. ksadk/model_proxy/transform.py +3 -4
  283. ksadk/plugins/providers/codex.py +37 -2
  284. ksadk/plugins/providers/harness.py +65 -28
  285. ksadk/plugins/providers/harness_service.py +198 -0
  286. ksadk/plugins/providers/harness_service_context.py +175 -0
  287. ksadk/plugins/providers/harness_service_hooks.py +168 -0
  288. ksadk/plugins/providers/harness_service_memory.py +479 -0
  289. ksadk/plugins/providers/harness_tools.py +39 -2
  290. ksadk/plugins/providers/platform_resources.py +2 -2
  291. ksadk/resource_runtime/contracts.py +8 -3
  292. ksadk/resource_runtime/knowledge.py +1 -1
  293. ksadk/resource_runtime/langgraph.py +7 -3
  294. ksadk/resource_runtime/managed_projection.py +24 -9
  295. ksadk/resource_runtime/mcp_server.py +3 -3
  296. ksadk/resource_runtime/worker.py +24 -5
  297. ksadk/runners/_adk_a2a_stream.py +10 -0
  298. ksadk/runners/_adk_canonical_stream.py +38 -10
  299. ksadk/runners/_adk_tunnel_history.py +96 -0
  300. ksadk/runners/_langgraph_answer_contract.py +47 -0
  301. ksadk/runners/_langgraph_canonical_stream.py +657 -0
  302. ksadk/runners/_langgraph_checkpoint_binding.py +89 -0
  303. ksadk/runners/_langgraph_factory.py +79 -0
  304. ksadk/runners/_langgraph_final_answer.py +91 -0
  305. ksadk/runners/_langgraph_fresh_turn.py +67 -0
  306. ksadk/runners/_langgraph_interactions.py +199 -0
  307. ksadk/runners/_langgraph_output.py +69 -0
  308. ksadk/runners/_langgraph_runner_streams.py +38 -75
  309. ksadk/runners/_langgraph_state_reader.py +5 -0
  310. ksadk/runners/_langgraph_wait_cancellation.py +49 -0
  311. ksadk/runners/_session_identity.py +30 -4
  312. ksadk/runners/adk_runner.py +108 -22
  313. ksadk/runners/base_runner.py +21 -0
  314. ksadk/runners/langgraph_runner.py +122 -108
  315. ksadk/runners/patch_langchain.py +4 -2
  316. ksadk/runtime/_langgraph_interaction_adapter.py +333 -0
  317. ksadk/runtime/_runner_adapter/a2ui_surface.py +194 -22
  318. ksadk/runtime/_runner_adapter/chunk_mapping.py +688 -0
  319. ksadk/runtime/_runner_adapter/resume_context.py +64 -0
  320. ksadk/runtime/_runner_adapter/stream_mapping.py +29 -597
  321. ksadk/runtime/conversation_execution.py +61 -32
  322. ksadk/runtime/executor.py +34 -1
  323. ksadk/runtime/factory.py +17 -5
  324. ksadk/runtime/framework_adapters.py +37 -2
  325. ksadk/runtime/langgraph_checkpoint_view.py +168 -0
  326. ksadk/runtime/launch.py +2 -0
  327. ksadk/runtime/preprocessing.py +9 -1
  328. ksadk/runtime/runner_adapter.py +77 -37
  329. ksadk/runtime/session_storage.py +71 -0
  330. ksadk/sandbox/backends/e2b.py +95 -13
  331. ksadk/sandbox/backends/local_process.py +68 -4
  332. ksadk/sandbox/base.py +1 -1
  333. ksadk/sandbox/diagnostics.py +31 -0
  334. ksadk/sandbox/e2b_background.py +1768 -0
  335. ksadk/sandbox/e2b_errors.py +26 -0
  336. ksadk/sandbox/local_background.py +406 -0
  337. ksadk/sandbox/local_controls.py +8 -1
  338. ksadk/server/database_access.py +369 -0
  339. ksadk/server/database_access_contract.py +222 -0
  340. ksadk/server/factory.py +180 -3
  341. ksadk/server/history_deadline.py +20 -4
  342. ksadk/server/history_page_cache.py +8 -2
  343. ksadk/server/routes/common.py +13 -1
  344. ksadk/server/routes/control.py +2 -1
  345. ksadk/server/routes/database_access.py +17 -0
  346. ksadk/server/routes/dependencies.py +28 -0
  347. ksadk/server/routes/harness_service_view.py +38 -0
  348. ksadk/server/routes/interactions.py +106 -0
  349. ksadk/server/routes/kernel_ingress.py +19 -1
  350. ksadk/server/routes/local_kernel_control.py +80 -0
  351. ksadk/server/routes/openai_compat.py +6 -0
  352. ksadk/server/routes/projection.py +159 -2
  353. ksadk/server/routes/routers.py +6 -0
  354. ksadk/server/routes/run.py +30 -1
  355. ksadk/server/routes/session_identity.py +130 -0
  356. ksadk/server/routes/sessions.py +326 -312
  357. ksadk/server/routes/streaming.py +3 -2
  358. ksadk/server/routes/ui_bootstrap.py +265 -0
  359. ksadk/server/routes/workspace.py +7 -0
  360. ksadk/server/static/a2ui/basic-v0_9_1.json +1383 -0
  361. ksadk/server/static/a2ui/common-types-v0_9.json +305 -0
  362. ksadk/server/static/a2ui/legacy-seven-components.json +230 -0
  363. ksadk/server/static/a2ui/manifest.json +86 -0
  364. ksadk/server/static/a2ui/material-icons-OFL-1.1.txt +93 -0
  365. ksadk/server/static/assets/{ArtifactsPanel-CILaW-fC.js → ArtifactsPanel-Cdr5C_vM.js} +1 -1
  366. ksadk/server/static/assets/{CodeBlock-BVrNVtJC.js → CodeBlock-BWRafud9.js} +6 -6
  367. ksadk/server/static/assets/{MathMessageMarkdown-Dp7c4wWD.js → MathMessageMarkdown-CFKeJIvy.js} +7 -7
  368. ksadk/server/static/assets/{MermaidBlock-Dxop8Rd7.js → MermaidBlock-BneAGUOd.js} +9 -9
  369. ksadk/server/static/assets/NativeTerminalPanel-BHI85zDO.js +1 -0
  370. ksadk/server/static/assets/OfficialA2uiRenderer-BOmT36lJ.js +16 -0
  371. ksadk/server/static/assets/{abnfDiagram-VCTEODGH-ckWDmOzw.js → abnfDiagram-VCTEODGH-DQvlOsBI.js} +1 -1
  372. ksadk/server/static/assets/{arc-DqxJede-.js → arc-CGx0e4pN.js} +1 -1
  373. ksadk/server/static/assets/architecture-7GRP2DOG-CFWjFkDL.js +1 -0
  374. ksadk/server/static/assets/{architectureDiagram-5GKGNRK7-SEQA4bVi.js → architectureDiagram-5GKGNRK7-WyybcNKX.js} +1 -1
  375. ksadk/server/static/assets/{blockDiagram-NRAW4CY4-pM0B-6NJ.js → blockDiagram-NRAW4CY4-C9Cx_GVs.js} +1 -1
  376. ksadk/server/static/assets/{c4Diagram-UCG6FXSJ-m2tuCNVq.js → c4Diagram-UCG6FXSJ-Bh7X3bGr.js} +1 -1
  377. ksadk/server/static/assets/channel-D6Dp_l74.js +1 -0
  378. ksadk/server/static/assets/chunk-2Q5K7J3B-CwmjhFYK.js +1 -0
  379. ksadk/server/static/assets/{chunk-5VM5RSS4-GJHDr9Ww.js → chunk-5VM5RSS4-cP9XupZj.js} +1 -1
  380. ksadk/server/static/assets/{chunk-F27PBJKO-CbAN45AV.js → chunk-F27PBJKO-Bm77fvR9.js} +1 -1
  381. ksadk/server/static/assets/{chunk-G27WJ6UU-D5ngbbzF.js → chunk-G27WJ6UU-DDKNPesQ.js} +1 -1
  382. ksadk/server/static/assets/{chunk-JWPE2WC7-Cc5IwuYC.js → chunk-JWPE2WC7-BqiUDB7s.js} +1 -1
  383. ksadk/server/static/assets/{chunk-LCL6LL3I-CprgDDdJ.js → chunk-LCL6LL3I-C528mMZy.js} +1 -1
  384. ksadk/server/static/assets/{chunk-POPQ4Y6H-CDZhSy82.js → chunk-POPQ4Y6H-CzZ9g_Uf.js} +1 -1
  385. ksadk/server/static/assets/{chunk-RHFEMEQ7-CZchUNro.js → chunk-RHFEMEQ7-CXj4tUZ-.js} +1 -1
  386. ksadk/server/static/assets/{chunk-SVP7TREG-BVruqk6T.js → chunk-SVP7TREG-BHyd85pS.js} +1 -1
  387. ksadk/server/static/assets/{chunk-XXDRQBXY-4ld9SxPN.js → chunk-XXDRQBXY-Qe29PHGe.js} +1 -1
  388. ksadk/server/static/assets/classDiagram-DTDB5LWJ-DsbvkCAV.js +1 -0
  389. ksadk/server/static/assets/classDiagram-v2-JRS7N3AN-DsbvkCAV.js +1 -0
  390. ksadk/server/static/assets/{cose-bilkent-JH36ORCC-Dmyyk_Vp.js → cose-bilkent-JH36ORCC-maRKgeec.js} +1 -1
  391. ksadk/server/static/assets/cynefin-OW5HDTMX-CBZRVuc4.js +1 -0
  392. ksadk/server/static/assets/{cynefinDiagram-5FMLGOSQ-BIyq3EJb.js → cynefinDiagram-5FMLGOSQ-CoD0bEvn.js} +1 -1
  393. ksadk/server/static/assets/{dagre-3AP2YEHR-eBw08Qdk.js → dagre-3AP2YEHR-BkpgQqyW.js} +1 -1
  394. ksadk/server/static/assets/{dagre-DfvnEf45.js → dagre-BUaTFrYa.js} +1 -1
  395. ksadk/server/static/assets/{diagram-S7CK7UJ4-CUSrE3Mg.js → diagram-S7CK7UJ4-25HdTbjE.js} +1 -1
  396. ksadk/server/static/assets/{diagram-UQ7AKVKN-Dq5Zw2gy.js → diagram-UQ7AKVKN-KO-WqOIg.js} +1 -1
  397. ksadk/server/static/assets/{diagram-VSXAHHWV-DyUHfNwT.js → diagram-VSXAHHWV-B360BkDQ.js} +1 -1
  398. ksadk/server/static/assets/{diagram-VX7I27RA-CREmM89O.js → diagram-VX7I27RA-COr1Oqsg.js} +1 -1
  399. ksadk/server/static/assets/{diagram-Z3DM3KII-Dw9zhHUK.js → diagram-Z3DM3KII-CgaKrIwB.js} +1 -1
  400. ksadk/server/static/assets/{dist-AEv-vXf-.js → dist--HftQyp9.js} +1 -1
  401. ksadk/server/static/assets/{dist-pq-nD33R.js → dist-B3Jp5r1e.js} +1 -1
  402. ksadk/server/static/assets/{dist-cxTGfdqx.js → dist-BEbS8Bag.js} +1 -1
  403. ksadk/server/static/assets/{dist-BX_-FENW.js → dist-BQ116UdZ.js} +1 -1
  404. ksadk/server/static/assets/{dist-DDSyLEOX.js → dist-BoRn8a_t.js} +1 -1
  405. ksadk/server/static/assets/{dist-BBsYarrI.js → dist-Brbrdmff.js} +1 -1
  406. ksadk/server/static/assets/{dist-B8Myiet9.js → dist-Bsuusoi0.js} +1 -1
  407. ksadk/server/static/assets/{dist-DUxO0R99.js → dist-Bxcu8Ca0.js} +1 -1
  408. ksadk/server/static/assets/{dist-CVPau3tn.js → dist-By-MVndb.js} +1 -1
  409. ksadk/server/static/assets/{dist-lOy23y43.js → dist-C9BTMVwS.js} +1 -1
  410. ksadk/server/static/assets/{dist-C_qdxcSH.js → dist-CBo9AHUv.js} +1 -1
  411. ksadk/server/static/assets/{dist-bupkyEBZ.js → dist-CR61WJFC.js} +1 -1
  412. ksadk/server/static/assets/{dist-CHpW1BHj.js → dist-CwnkOyDn.js} +1 -1
  413. ksadk/server/static/assets/{dist-0uJ4tdx6.js → dist-CxIl4t92.js} +1 -1
  414. ksadk/server/static/assets/{dist-Cp2PaOMY.js → dist-DKG0OYnk.js} +1 -1
  415. ksadk/server/static/assets/{dist-BQMrUwdI.js → dist-DSw5Ju6-.js} +1 -1
  416. ksadk/server/static/assets/{dist-hL5p1til.js → dist-DXOlCAay.js} +1 -1
  417. ksadk/server/static/assets/{dist-CD4L6ymH.js → dist-DgJ57sRe.js} +1 -1
  418. ksadk/server/static/assets/{dist-CuR5Bgme.js → dist-DmWw0IXB.js} +1 -1
  419. ksadk/server/static/assets/{dist-Co68Apq4.js → dist-DzdXSBJb.js} +1 -1
  420. ksadk/server/static/assets/{dist-B49GzZDb.js → dist-HHvdjADB.js} +1 -1
  421. ksadk/server/static/assets/{dist-QzbGrED_.js → dist-_0Xgu_07.js} +1 -1
  422. ksadk/server/static/assets/{ebnfDiagram-PWID7BFC-BS5LdNoR.js → ebnfDiagram-PWID7BFC-DogDP2db.js} +1 -1
  423. ksadk/server/static/assets/{erDiagram-SSCWMZ5O-Bv1QtiY-.js → erDiagram-SSCWMZ5O-CeBDnUjR.js} +1 -1
  424. ksadk/server/static/assets/eventmodeling-NTZA5JFV-vXZWMkpn.js +1 -0
  425. ksadk/server/static/assets/flowDiagram-A5DVABFB-5LRgzKLv.js +1 -0
  426. ksadk/server/static/assets/{ganttDiagram-EL5Y4UJY-musi-e0G.js → ganttDiagram-EL5Y4UJY-oIQL3MCp.js} +1 -1
  427. ksadk/server/static/assets/gitGraph-4MIJSDKK-BUWSkncI.js +1 -0
  428. ksadk/server/static/assets/{gitGraphDiagram-WWUBYQGX-DH37EGkG.js → gitGraphDiagram-WWUBYQGX-B7qz0cmZ.js} +1 -1
  429. ksadk/server/static/assets/index-4g1ndaxW.js +1132 -0
  430. ksadk/server/static/assets/index-DEVfafsU.css +2 -0
  431. ksadk/server/static/assets/info-A6RAGUB7-CzJ_YrOs.js +1 -0
  432. ksadk/server/static/assets/{infoDiagram-RXCK75RN-C1kEtv2y.js → infoDiagram-RXCK75RN-yQRC41Ya.js} +1 -1
  433. ksadk/server/static/assets/{ishikawaDiagram-5VMMS53U-BCNPyMka.js → ishikawaDiagram-5VMMS53U-BCu4HiwL.js} +1 -1
  434. ksadk/server/static/assets/{journeyDiagram-EYS64GPL--cDbKnjP.js → journeyDiagram-EYS64GPL-JaqmO73K.js} +1 -1
  435. ksadk/server/static/assets/{kanban-definition-3QL26DDD-R1rAVw2f.js → kanban-definition-3QL26DDD-DQo4X8NO.js} +1 -1
  436. ksadk/server/static/assets/{katex-BT-X-V7U.js → katex-t_DWylQw.js} +1 -1
  437. ksadk/server/static/assets/{linear-DTR631iG.js → linear-DWdnI35B.js} +1 -1
  438. ksadk/server/static/assets/material-icons-latin-400-normal-kAwBdRge.woff2 +0 -0
  439. ksadk/server/static/assets/{mermaid-parser.core-DfFzJhX8.js → mermaid-parser.core-BHrT2Pfe.js} +2 -2
  440. ksadk/server/static/assets/{mindmap-definition-FBJOCRG2-D4by_rmk.js → mindmap-definition-FBJOCRG2-PBVAhZYV.js} +1 -1
  441. ksadk/server/static/assets/packet-AYTQ26CC-CXoos6fx.js +1 -0
  442. ksadk/server/static/assets/{pegDiagram-XKGWAZYB-xWXPEh0c.js → pegDiagram-XKGWAZYB-CU_cLfow.js} +1 -1
  443. ksadk/server/static/assets/pie-WAS4IAKB-CjF9NoIt.js +1 -0
  444. ksadk/server/static/assets/{pieDiagram-E7YTZNPT-BudBDlCI.js → pieDiagram-E7YTZNPT-B1h0-_pW.js} +1 -1
  445. ksadk/server/static/assets/{quadrantDiagram-AXDQQJYC-DXZ0PCJF.js → quadrantDiagram-AXDQQJYC-DEMoGo5a.js} +1 -1
  446. ksadk/server/static/assets/radar-RG4KPBEZ-BQGWs9nw.js +1 -0
  447. ksadk/server/static/assets/railroad-74A4TZTK-B6znvLUK.js +1 -0
  448. ksadk/server/static/assets/railroad-abnf-HS5TGJTU-Bzquz0As.js +1 -0
  449. ksadk/server/static/assets/railroad-ebnf-LZEXJU2U-1IikGkb5.js +1 -0
  450. ksadk/server/static/assets/railroad-peg-WCYAUIDC-BKKgHzdc.js +1 -0
  451. ksadk/server/static/assets/{railroadDiagram-O6MQD6OU-BdAYRYB8.js → railroadDiagram-O6MQD6OU-BTAob2wg.js} +1 -1
  452. ksadk/server/static/assets/{requirementDiagram-EFPCY7ZU-CBBmaL70.js → requirementDiagram-EFPCY7ZU-Dl0Q2SuO.js} +1 -1
  453. ksadk/server/static/assets/{sankeyDiagram-P5KCCOFB-Doc3rdwp.js → sankeyDiagram-P5KCCOFB-DeaTWkur.js} +1 -1
  454. ksadk/server/static/assets/{sequenceDiagram-WJ2MYXX4-0J8R8hWW.js → sequenceDiagram-WJ2MYXX4-gFQYrsOd.js} +1 -1
  455. ksadk/server/static/assets/{sizeCapture-X5ZJPWSS-CfFLlWsK.js → sizeCapture-X5ZJPWSS-pGQzddMB.js} +1 -1
  456. ksadk/server/static/assets/{stateDiagram-HBIQ2CUA-jBwkjtTy.js → stateDiagram-HBIQ2CUA-DmpYOZt1.js} +1 -1
  457. ksadk/server/static/assets/stateDiagram-v2-4QOOHH4V-Dolxgkw3.js +1 -0
  458. ksadk/server/static/assets/{swimlanes-XN3QIQJK-B0WxTQf8.js → swimlanes-XN3QIQJK-BfuSAsrr.js} +1 -1
  459. ksadk/server/static/assets/swimlanesDiagram-VK2B7HYN-BuI1erYj.js +8 -0
  460. ksadk/server/static/assets/{timeline-definition-24CTP7MA-BfCT_75A.js → timeline-definition-24CTP7MA-CgJwrrxf.js} +1 -1
  461. ksadk/server/static/assets/treeView-Q6P3EWNA-DtMdDH8N.js +1 -0
  462. ksadk/server/static/assets/treemap-WGGIJYW6-VoU8QtLZ.js +1 -0
  463. ksadk/server/static/assets/{vennDiagram-4TSXK5OY-9gX1VMDC.js → vennDiagram-4TSXK5OY-CBSAgXDd.js} +1 -1
  464. ksadk/server/static/assets/wardley-WFR3VGLG-YWSRB0Zm.js +1 -0
  465. ksadk/server/static/assets/{wardleyDiagram-VM6X3IG4-sEs_BP6O.js → wardleyDiagram-VM6X3IG4-013TZ2JZ.js} +1 -1
  466. ksadk/server/static/assets/{xychartDiagram-S5SC5T6Z-Ll4jvUN9.js → xychartDiagram-S5SC5T6Z-u6Frp8xp.js} +1 -1
  467. ksadk/server/static/index.html +2 -2
  468. ksadk/server/static/ui-source.json +11 -0
  469. ksadk/sessions/_local_service_sync.py +146 -5
  470. ksadk/sessions/_postgres_schema.py +17 -0
  471. ksadk/sessions/base.py +3 -0
  472. ksadk/sessions/continuity.py +7 -1
  473. ksadk/sessions/db_budget.py +14 -12
  474. ksadk/sessions/history_budget.py +7 -0
  475. ksadk/sessions/in_memory.py +113 -4
  476. ksadk/sessions/persistence.py +73 -7
  477. ksadk/sessions/postgres_service.py +948 -8
  478. ksadk/sessions/resilience.py +16 -0
  479. ksadk/sessions/resilient.py +601 -5
  480. ksadk/sessions/topology.py +9 -2
  481. ksadk/skills/mcp_server/register.py +471 -415
  482. ksadk/skills/mcp_server/server.py +239 -217
  483. ksadk/skills/request_connection.py +188 -0
  484. ksadk/skills/runtime/backends/e2b.py +52 -12
  485. ksadk/skills/service_client.py +104 -45
  486. ksadk/studio/api.py +413 -11
  487. ksadk/studio/api_contracts.py +7 -3
  488. ksadk/studio/api_plugin_routes.py +13 -6
  489. ksadk/studio/authoring_coordinator.py +6 -1
  490. ksadk/studio/background_output.py +72 -0
  491. ksadk/studio/build_resolution.py +28 -4
  492. ksadk/studio/cloud.py +516 -7
  493. ksadk/studio/cloud_history.py +149 -0
  494. ksadk/studio/cloud_shared_web.py +32 -3
  495. ksadk/studio/compiler.py +93 -4
  496. ksadk/studio/contracts.py +376 -9
  497. ksadk/studio/dsh_application.py +17 -4
  498. ksadk/studio/execution_host.py +10 -5
  499. ksadk/studio/interaction_submission.py +7 -2
  500. ksadk/studio/mcp_runtime.py +23 -8
  501. ksadk/studio/model_chat_tools.py +22 -10
  502. ksadk/studio/model_client.py +41 -11
  503. ksadk/studio/model_wire_identity.py +24 -0
  504. ksadk/studio/native_background_command_port.py +97 -0
  505. ksadk/studio/native_background_connection.py +230 -0
  506. ksadk/studio/native_background_locator.py +272 -0
  507. ksadk/studio/native_background_ownership.py +255 -0
  508. ksadk/studio/native_background_wakeup.py +686 -0
  509. ksadk/studio/native_browser_port.py +9 -3
  510. ksadk/studio/native_child_skills.py +4 -0
  511. ksadk/studio/native_coding_template.py +287 -0
  512. ksadk/studio/native_command_policy.py +23 -0
  513. ksadk/studio/native_context_evidence.py +81 -0
  514. ksadk/studio/native_context_port.py +13 -2
  515. ksadk/studio/native_directory_observation.py +177 -0
  516. ksadk/studio/native_final_shape.py +148 -19
  517. ksadk/studio/native_mcp_disclosure.py +8 -6
  518. ksadk/studio/native_mcp_tool_port.py +3 -1
  519. ksadk/studio/native_memory_context.py +10 -8
  520. ksadk/studio/native_model_port.py +201 -43
  521. ksadk/studio/native_planning.py +43 -2
  522. ksadk/studio/native_product.py +237 -12
  523. ksadk/studio/native_project_instructions.py +267 -0
  524. ksadk/studio/native_read_budget.py +21 -3
  525. ksadk/studio/native_subagent_port.py +125 -2
  526. ksadk/studio/native_tool_port.py +255 -14
  527. ksadk/studio/native_verification_presentation.py +13 -3
  528. ksadk/studio/plugin_composition.py +8 -1
  529. ksadk/studio/plugin_kernel_adapter.py +13 -0
  530. ksadk/studio/plugin_native_activation.py +6 -4
  531. ksadk/studio/plugin_runtime.py +9 -0
  532. ksadk/studio/presentation.py +12 -0
  533. ksadk/studio/project_instruction_trust.py +54 -0
  534. ksadk/studio/repository.py +1 -1
  535. ksadk/studio/resource_catalog.py +4 -1
  536. ksadk/studio/run_activity.py +8 -0
  537. ksadk/studio/run_service.py +496 -40
  538. ksadk/studio/scheduler_assistant.py +3 -1
  539. ksadk/studio/service.py +101 -2
  540. ksadk/studio/shared_web.py +38 -12
  541. ksadk/studio/shared_web_response_events.py +32 -5
  542. ksadk/studio/static/assets/ChannelsPage-Do_mRmVu.js +8 -0
  543. ksadk/studio/static/assets/{CodeBlock-DMIf4h33-CkufcPYo.js → CodeBlock-DMIf4h33-CsO7rJKv.js} +3 -3
  544. ksadk/studio/static/assets/{ExecutionTree-v3HexvPo-Bk8wzGSy.js → ExecutionTree-v3HexvPo-BeWoMqA-.js} +1 -1
  545. ksadk/studio/static/assets/{MathMessageMarkdown-BesSeCYl-DYG1Wzbx.js → MathMessageMarkdown-BesSeCYl-CiB60plG.js} +1 -1
  546. ksadk/studio/static/assets/{MermaidBlock-H_0qzQDf-BdXtxug_.js → MermaidBlock-H_0qzQDf-oRTZUNRr.js} +3 -3
  547. ksadk/studio/static/assets/{MessageMarkdown-CwMTvgFj-BeyLyQHu.js → MessageMarkdown-CwMTvgFj-BzEmQkHH.js} +5 -5
  548. ksadk/studio/static/assets/OfficialA2uiRenderer-DI49Kpxu-BBxfdj3P.js +16 -0
  549. ksadk/studio/static/assets/{PrismRenderer-5pK6tUdb.js → PrismRenderer-CcrOV6Lf.js} +1 -1
  550. ksadk/studio/static/assets/TeamsPage-qNVYpcox.js +4 -0
  551. ksadk/studio/static/assets/{abnfDiagram-VCTEODGH-Bnb1O3tA.js → abnfDiagram-VCTEODGH-BdEjkX5G.js} +1 -1
  552. ksadk/studio/static/assets/{arc-Pry-7G1_.js → arc-4LNeT6Qr.js} +1 -1
  553. ksadk/studio/static/assets/architecture-7GRP2DOG-C6BmiLXs.js +1 -0
  554. ksadk/studio/static/assets/{architectureDiagram-5GKGNRK7-5Zn1gqJv.js → architectureDiagram-5GKGNRK7-nKXkceF2.js} +3 -3
  555. ksadk/studio/static/assets/{blockDiagram-I7D4REHJ-CLB4L11u.js → blockDiagram-I7D4REHJ-pSawBX0F.js} +1 -1
  556. ksadk/studio/static/assets/{c4Diagram-7LVT6UL2-BOma_Z_F.js → c4Diagram-7LVT6UL2-D3DGtCIa.js} +1 -1
  557. ksadk/studio/static/assets/channel-CwBcaXYb.js +1 -0
  558. ksadk/studio/static/assets/{chunk-2E4U76K2-BFf_huql.js → chunk-2E4U76K2-CfUBZPB8.js} +2 -2
  559. ksadk/studio/static/assets/chunk-2Q5K7J3B-B9fZb2AW.js +1 -0
  560. ksadk/studio/static/assets/{chunk-2ZTRR5NV-C2qZJila.js → chunk-2ZTRR5NV-63jTqPgP.js} +1 -1
  561. ksadk/studio/static/assets/{chunk-3Z5EZCMW-DMniOlPd.js → chunk-3Z5EZCMW-CLzTC-ds.js} +1 -1
  562. ksadk/studio/static/assets/{chunk-4HAMMTFA-DVtDP4rm.js → chunk-4HAMMTFA--k1euiK8.js} +3 -3
  563. ksadk/studio/static/assets/{chunk-5V3GS4D5-i-ZDOEnP.js → chunk-5V3GS4D5--NT8dMSC.js} +1 -1
  564. ksadk/studio/static/assets/{chunk-5VM5RSS4-ZNzvKenW.js → chunk-5VM5RSS4-B4EX-xPG.js} +2 -2
  565. ksadk/studio/static/assets/{chunk-6AZGARVD-BB6FqMl-.js → chunk-6AZGARVD-BxyCuIKr.js} +1 -1
  566. ksadk/studio/static/assets/{chunk-6EIED4P4-DdUJkP0f.js → chunk-6EIED4P4-BqAnqs6L.js} +1 -1
  567. ksadk/studio/static/assets/{chunk-6K3QC6MW-CqVsVn-y.js → chunk-6K3QC6MW-DqKCc1_c.js} +1 -1
  568. ksadk/studio/static/assets/{chunk-6TQVIW2G-DKlLbNIP.js → chunk-6TQVIW2G-NQp6TssR.js} +1 -1
  569. ksadk/studio/static/assets/{chunk-747NJXEK-BFkZPlab.js → chunk-747NJXEK-CFf3ol0D.js} +1 -1
  570. ksadk/studio/static/assets/{chunk-75Z2AOVW-BZNhM4vB.js → chunk-75Z2AOVW-DpzsVI3p.js} +1 -1
  571. ksadk/studio/static/assets/chunk-CLGD4ZFX-BiEFihjn.js +1 -0
  572. ksadk/studio/static/assets/{chunk-DU6HZSFF-CpEZCUgg.js → chunk-DU6HZSFF-HbWKkMwX.js} +3 -3
  573. ksadk/studio/static/assets/{chunk-F27PBJKO-D7pvKf0C.js → chunk-F27PBJKO-BY9pwz0W.js} +1 -1
  574. ksadk/studio/static/assets/{chunk-FOHPRMQF-DHwB1DNv.js → chunk-FOHPRMQF-BAABtQ6R.js} +5 -5
  575. ksadk/studio/static/assets/{chunk-GMAD6QVW-DE_8H717.js → chunk-GMAD6QVW-C-Lw1ag9.js} +1 -1
  576. ksadk/studio/static/assets/{chunk-GVQU2GXP-BfEB0lNv.js → chunk-GVQU2GXP-CCUMaVF8.js} +1 -1
  577. ksadk/studio/static/assets/{chunk-I5DQTOEV-Hm2LfiYI.js → chunk-I5DQTOEV-DpUJ7zEH.js} +1 -1
  578. ksadk/studio/static/assets/{chunk-ICYGCRZG-749o-pGJ.js → chunk-ICYGCRZG-CknVx2uG.js} +1 -1
  579. ksadk/studio/static/assets/{chunk-IH6LHLGP-CC6I9F3i.js → chunk-IH6LHLGP-BJ6nT6RF.js} +1 -1
  580. ksadk/studio/static/assets/{chunk-IMKFNOWR-D38axYOR.js → chunk-IMKFNOWR-CTelL5KO.js} +1 -1
  581. ksadk/studio/static/assets/{chunk-JWPE2WC7-DVXcaiue.js → chunk-JWPE2WC7-CMg2kMrr.js} +1 -1
  582. ksadk/studio/static/assets/{chunk-KI3K4JFJ-Rma-0k_M.js → chunk-KI3K4JFJ-B1SKa0PC.js} +1 -1
  583. ksadk/studio/static/assets/{chunk-L3NEJ4N5-Dq5xn7aL.js → chunk-L3NEJ4N5-C8A22muD.js} +1 -1
  584. ksadk/studio/static/assets/{chunk-LNGE3PJU-DWpGwHrW.js → chunk-LNGE3PJU-D_NJe87O.js} +1 -1
  585. ksadk/studio/static/assets/{chunk-OSK3NFVY-DiCQjx9b.js → chunk-OSK3NFVY-DFHvKoNt.js} +1 -1
  586. ksadk/studio/static/assets/{chunk-OUJLGHUK-D0j2JRSg.js → chunk-OUJLGHUK-DkHSrVKj.js} +1 -1
  587. ksadk/studio/static/assets/{chunk-P2QGCYS3-VdhKmfYq.js → chunk-P2QGCYS3-C3nH7MEr.js} +1 -1
  588. ksadk/studio/static/assets/{chunk-POPQ4Y6H-C1_rzO5M.js → chunk-POPQ4Y6H-CLm6A2JW.js} +1 -1
  589. ksadk/studio/static/assets/{chunk-PWAF6VOD-B45HvflI.js → chunk-PWAF6VOD-BmVQq92D.js} +1 -1
  590. ksadk/studio/static/assets/{chunk-SHT3W25Y-DsCFnRVE.js → chunk-SHT3W25Y-cETj_Yg7.js} +1 -1
  591. ksadk/studio/static/assets/{chunk-SVP7TREG-DljApgRX.js → chunk-SVP7TREG-hm4Ur8KN.js} +1 -1
  592. ksadk/studio/static/assets/{chunk-TICWLB2K-DWqRtyqa.js → chunk-TICWLB2K-BuVjFGjc.js} +1 -1
  593. ksadk/studio/static/assets/{chunk-TLUHSLCS-DUeGgnD5.js → chunk-TLUHSLCS-7mZ4xr0q.js} +2 -2
  594. ksadk/studio/static/assets/{chunk-UY3FDG6J-CnmaAkG5.js → chunk-UY3FDG6J-2nV2i5mW.js} +1 -1
  595. ksadk/studio/static/assets/{chunk-XHIXRSVI-BFQ6B8BE.js → chunk-XHIXRSVI-BIR36bKX.js} +1 -1
  596. ksadk/studio/static/assets/chunk-XXDRQBXY-rafYnJzG.js +1 -0
  597. ksadk/studio/static/assets/classDiagram-ZZMXUADV-DdyoXyMk.js +1 -0
  598. ksadk/studio/static/assets/classDiagram-v2-VYDZK3BY-DdyoXyMk.js +1 -0
  599. ksadk/studio/static/assets/{cose-bilkent-JH36ORCC-om8AY0Mc.js → cose-bilkent-JH36ORCC-B9Ubz7rk.js} +1 -1
  600. ksadk/studio/static/assets/{createLucideIcon-DR0LGTP5.js → createLucideIcon-CTD6_IjT.js} +1 -1
  601. ksadk/studio/static/assets/cynefin-OW5HDTMX-BVS4hy6V.js +1 -0
  602. ksadk/studio/static/assets/{cynefinDiagram-5FMLGOSQ-6BrmK52S.js → cynefinDiagram-5FMLGOSQ-CKrgw1wI.js} +1 -1
  603. ksadk/studio/static/assets/{cytoscape.esm-CGd-uY3x.js → cytoscape.esm-Jip0ihto.js} +16 -16
  604. ksadk/studio/static/assets/{dagre-GXQ25YYZ-buZBRlwz.js → dagre-GXQ25YYZ-NjDjs3Kl.js} +1 -1
  605. ksadk/studio/static/assets/{dagre-PrKaheQc.js → dagre-YnTFOVV4.js} +1 -1
  606. ksadk/studio/static/assets/{diagram-S7CK7UJ4-C6aH78c4.js → diagram-S7CK7UJ4-C6X87QRZ.js} +1 -1
  607. ksadk/studio/static/assets/{diagram-UQ7AKVKN-DY_tQ6C_.js → diagram-UQ7AKVKN-Xf2JVuyK.js} +1 -1
  608. ksadk/studio/static/assets/{diagram-VSXAHHWV-DX9p5cQT.js → diagram-VSXAHHWV-CUZlU7Dr.js} +1 -1
  609. ksadk/studio/static/assets/{diagram-VX7I27RA-DB2WSH8X.js → diagram-VX7I27RA-BOcfFxfe.js} +1 -1
  610. ksadk/studio/static/assets/{diagram-Z3DM3KII-Ce1BJwHE.js → diagram-Z3DM3KII-1zrr7ezR.js} +1 -1
  611. ksadk/studio/static/assets/{dist-v5Q1xZ2K.js → dist-Brlz61T5.js} +1 -1
  612. ksadk/studio/static/assets/{ebnfDiagram-PWID7BFC-Daukxwqf.js → ebnfDiagram-PWID7BFC-C1LymnKg.js} +1 -1
  613. ksadk/studio/static/assets/{erDiagram-RLTQ6QDP-CGthTMmJ.js → erDiagram-RLTQ6QDP-Dm0YWPea.js} +1 -1
  614. ksadk/studio/static/assets/eventmodeling-NTZA5JFV-D9gMNzTL.js +1 -0
  615. ksadk/studio/static/assets/flowDiagram-HODETNUW-NYJgBJQu.js +1 -0
  616. ksadk/studio/static/assets/{ganttDiagram-EL5Y4UJY-BfoAZW9X.js → ganttDiagram-EL5Y4UJY-uJ27IKEw.js} +1 -1
  617. ksadk/studio/static/assets/gitGraph-4MIJSDKK-DQVCMicu.js +1 -0
  618. ksadk/studio/static/assets/{gitGraphDiagram-WWUBYQGX-S985OIJF.js → gitGraphDiagram-WWUBYQGX-mtpvi7ne.js} +3 -3
  619. ksadk/studio/static/assets/index-Cp9Unfkn.css +2 -0
  620. ksadk/studio/static/assets/index-HepnaEeR.js +1152 -0
  621. ksadk/studio/static/assets/{index.dom-BQenBtFm.js → index.dom-DSf_jcX2.js} +1 -1
  622. ksadk/studio/static/assets/info-A6RAGUB7-CMrsF9SP.js +1 -0
  623. ksadk/studio/static/assets/{infoDiagram-27XIBGKW-CO3W8tFn.js → infoDiagram-27XIBGKW-Hqrd2vbU.js} +1 -1
  624. ksadk/studio/static/assets/{ishikawaDiagram-5VMMS53U-BUGEl8cO.js → ishikawaDiagram-5VMMS53U-BB7nm3Dk.js} +1 -1
  625. ksadk/studio/static/assets/{journeyDiagram-3NMN7TZE-Ch2ZYxvr.js → journeyDiagram-3NMN7TZE-BXbRt7Ps.js} +1 -1
  626. ksadk/studio/static/assets/{kanban-definition-UXKFOSKX-Da-Fp4vC.js → kanban-definition-UXKFOSKX-2EtAxRbw.js} +1 -1
  627. ksadk/studio/static/assets/{katex-DhON-x74.js → katex-K_8DQ5UN.js} +1 -1
  628. ksadk/studio/static/assets/{line-BDaeq300.js → line-C4h80pWP.js} +1 -1
  629. ksadk/studio/static/assets/{linear-DmucvK78.js → linear-DCteYK3U.js} +1 -1
  630. ksadk/studio/static/assets/{mermaid-parser.core-Cj5mYdBi.js → mermaid-parser.core-TWhr-wg2.js} +2 -2
  631. ksadk/studio/static/assets/{mindmap-definition-YA3MSWOX-CvlsVQ38.js → mindmap-definition-YA3MSWOX-BC7jpEOt.js} +1 -1
  632. ksadk/studio/static/assets/{ordinal-BDEzSJ7C.js → ordinal-BXUrfsNY.js} +1 -1
  633. ksadk/studio/static/assets/packet-AYTQ26CC-BdMfjW7Z.js +1 -0
  634. ksadk/studio/static/assets/{pegDiagram-XKGWAZYB-BuHuNgT5.js → pegDiagram-XKGWAZYB-C-ZzWopk.js} +1 -1
  635. ksadk/studio/static/assets/pie-WAS4IAKB-B06bKgAM.js +1 -0
  636. ksadk/studio/static/assets/{pieDiagram-E7YTZNPT-DlrWiSOv.js → pieDiagram-E7YTZNPT-DGDL1XJp.js} +1 -1
  637. ksadk/studio/static/assets/{quadrantDiagram-AXDQQJYC-BA3hpUZM.js → quadrantDiagram-AXDQQJYC-DAPa64vy.js} +1 -1
  638. ksadk/studio/static/assets/radar-RG4KPBEZ-4lhecdYg.js +1 -0
  639. ksadk/studio/static/assets/railroad-74A4TZTK-CBTdV2Xq.js +1 -0
  640. ksadk/studio/static/assets/railroad-abnf-HS5TGJTU-D4HzgxJY.js +1 -0
  641. ksadk/studio/static/assets/railroad-ebnf-LZEXJU2U-D-qRzoh8.js +1 -0
  642. ksadk/studio/static/assets/railroad-peg-WCYAUIDC-DYA99dLv.js +1 -0
  643. ksadk/studio/static/assets/{railroadDiagram-O6MQD6OU-BxpAazym.js → railroadDiagram-O6MQD6OU-CkH0b7UT.js} +1 -1
  644. ksadk/studio/static/assets/{react-vendor-BNmTiJ-I.js → react-vendor-CTyAWUMQ.js} +1 -1
  645. ksadk/studio/static/assets/{requirementDiagram-BXWQKSXE-E-Ge0FcV.js → requirementDiagram-BXWQKSXE-BgZ0H8ni.js} +2 -2
  646. ksadk/studio/static/assets/rolldown-runtime-cO0ylGnt.js +1 -0
  647. ksadk/studio/static/assets/{sankeyDiagram-P5KCCOFB-CA6YKhQ3.js → sankeyDiagram-P5KCCOFB-BgqqGK6v.js} +1 -1
  648. ksadk/studio/static/assets/{sequenceDiagram-WJ2MYXX4-CcElXGg4.js → sequenceDiagram-WJ2MYXX4-CbQE1ava.js} +1 -1
  649. ksadk/studio/static/assets/{sizeCapture-INFHLROL-B0uUizjq.js → sizeCapture-INFHLROL-BtEJ4_JN.js} +1 -1
  650. ksadk/studio/static/assets/{src-B6xuSHsQ.js → src-DSHesKRm.js} +1 -1
  651. ksadk/studio/static/assets/{stateDiagram-D77RDMKH-DdXZOFqY.js → stateDiagram-D77RDMKH-D9uG2y8U.js} +1 -1
  652. ksadk/studio/static/assets/stateDiagram-v2-MP3YSRHH-2pITMnQn.js +1 -0
  653. ksadk/studio/static/assets/{swimlanes-42K2YHIH-NtgEEHLY.js → swimlanes-42K2YHIH-B0QgwqLd.js} +1 -1
  654. ksadk/studio/static/assets/swimlanesDiagram-VR7AAH4N-TXD08-JZ.js +8 -0
  655. ksadk/studio/static/assets/{timeline-definition-24CTP7MA-CIuYhNy3.js → timeline-definition-24CTP7MA-tbRyDWb4.js} +1 -1
  656. ksadk/studio/static/assets/treeView-Q6P3EWNA-NawrivXx.js +1 -0
  657. ksadk/studio/static/assets/treemap-WGGIJYW6-DabVcIU4.js +1 -0
  658. ksadk/studio/static/assets/{vennDiagram-4TSXK5OY-7HbApbrv.js → vennDiagram-4TSXK5OY-Xjhys4e4.js} +1 -1
  659. ksadk/studio/static/assets/wardley-WFR3VGLG-BrU5uhdd.js +1 -0
  660. ksadk/studio/static/assets/{wardleyDiagram-VM6X3IG4-CMJiaedy.js → wardleyDiagram-VM6X3IG4--sd605zd.js} +1 -1
  661. ksadk/studio/static/assets/{xychartDiagram-S5SC5T6Z-BdgtMvW2.js → xychartDiagram-S5SC5T6Z-B3XzcsnZ.js} +1 -1
  662. ksadk/studio/static/index.html +9 -9
  663. ksadk/studio/static/ui-source.json +11 -0
  664. ksadk/studio/teams_installation.py +1 -1
  665. ksadk/studio/templates.py +33 -3
  666. ksadk/toolsets/__init__.py +14 -1
  667. ksadk/toolsets/sandbox.py +303 -7
  668. ksadk/toolsets/workspace.py +17 -10
  669. ksadk/toolsets/workspace_editing.py +40 -0
  670. ksadk/toolsets/workspace_model_observation.py +6 -1
  671. ksadk/tracing/__init__.py +10 -1
  672. ksadk/tracing/routed.py +416 -0
  673. ksadk/tracing/setup.py +111 -6
  674. ksadk/tunnel/__init__.py +37 -0
  675. ksadk/tunnel/connector.py +384 -0
  676. ksadk/tunnel/discovery.py +107 -0
  677. ksadk/tunnel/failure.py +168 -0
  678. ksadk/tunnel/http_tools.py +100 -0
  679. ksadk/tunnel/langgraph.py +125 -0
  680. ksadk/tunnel/middleware.py +28 -0
  681. ksadk/tunnel/peers.py +872 -0
  682. ksadk/tunnel/protocol.py +97 -0
  683. ksadk/tunnel/registry.py +306 -0
  684. ksadk/tunnel/runtime.py +147 -0
  685. ksadk/tunnel/server.py +201 -0
  686. ksadk/tunnel/services.py +366 -0
  687. ksadk/tunnel/toolset.py +78 -0
  688. ksadk/version.py +1 -1
  689. ksadk_runtime_common/memory_backend/manifest.py +1 -1
  690. ksadk_runtime_common/memory_backend/providers/ksmem.py +60 -0
  691. ksadk_runtime_common/memory_backend/providers/lancedb.py +1 -2
  692. ksadk_runtime_common/memory_backend/providers/mem0.py +21 -0
  693. ksadk_runtime_common/memory_backend/registry.py +2 -0
  694. ksadk_runtime_common/memory_backend/render.py +1 -1
  695. ksadk_runtime_common/schemas/memory_backend_manifest.schema.json +37 -12
  696. ksadk_runtime_common/schemas/runtime_event_v2.json +2 -1
  697. ksadk/server/static/assets/NativeTerminalPanel-Cjjz8B30.js +0 -1
  698. ksadk/server/static/assets/architecture-7GRP2DOG-pn_DuLy6.js +0 -1
  699. ksadk/server/static/assets/channel-fySsnkft.js +0 -1
  700. ksadk/server/static/assets/chunk-2Q5K7J3B-BheGxKRQ.js +0 -1
  701. ksadk/server/static/assets/classDiagram-DTDB5LWJ-DSfLtNYm.js +0 -1
  702. ksadk/server/static/assets/classDiagram-v2-JRS7N3AN-DSfLtNYm.js +0 -1
  703. ksadk/server/static/assets/cynefin-OW5HDTMX-PFWIGtvA.js +0 -1
  704. ksadk/server/static/assets/eventmodeling-NTZA5JFV-DsM4upQX.js +0 -1
  705. ksadk/server/static/assets/flowDiagram-A5DVABFB-D5NA16k9.js +0 -1
  706. ksadk/server/static/assets/gitGraph-4MIJSDKK-DUCVz-ih.js +0 -1
  707. ksadk/server/static/assets/index-CZdkAvsv.js +0 -244
  708. ksadk/server/static/assets/index-CvXdHgF3.css +0 -2
  709. ksadk/server/static/assets/info-A6RAGUB7-rw0ZNHZp.js +0 -1
  710. ksadk/server/static/assets/packet-AYTQ26CC-Ca4Hvki9.js +0 -1
  711. ksadk/server/static/assets/pie-WAS4IAKB-hwiz6fbw.js +0 -1
  712. ksadk/server/static/assets/radar-RG4KPBEZ-BR1oZXLM.js +0 -1
  713. ksadk/server/static/assets/railroad-74A4TZTK-DfgEISfX.js +0 -1
  714. ksadk/server/static/assets/railroad-abnf-HS5TGJTU-CWOC3rdk.js +0 -1
  715. ksadk/server/static/assets/railroad-ebnf-LZEXJU2U-CiRvHCLY.js +0 -1
  716. ksadk/server/static/assets/railroad-peg-WCYAUIDC-DSDDyJ2f.js +0 -1
  717. ksadk/server/static/assets/stateDiagram-v2-4QOOHH4V-Cw1fPb5w.js +0 -1
  718. ksadk/server/static/assets/swimlanesDiagram-VK2B7HYN-Cc3JMBAF.js +0 -8
  719. ksadk/server/static/assets/treeView-Q6P3EWNA-C05SJHxo.js +0 -1
  720. ksadk/server/static/assets/treemap-WGGIJYW6-BqNLAhc3.js +0 -1
  721. ksadk/server/static/assets/wardley-WFR3VGLG-DokNktqB.js +0 -1
  722. ksadk/studio/static/assets/ChannelsPage-xX5HlMId.js +0 -8
  723. ksadk/studio/static/assets/TeamsPage-CCaaGaVp.js +0 -3
  724. ksadk/studio/static/assets/architecture-7GRP2DOG-BMOPAkUC.js +0 -1
  725. ksadk/studio/static/assets/channel-r8itPEik.js +0 -1
  726. ksadk/studio/static/assets/chunk-2Q5K7J3B-C1jixKkw.js +0 -1
  727. ksadk/studio/static/assets/chunk-CLGD4ZFX-D-GTtyKs.js +0 -1
  728. ksadk/studio/static/assets/chunk-XXDRQBXY-DqAYeljN.js +0 -1
  729. ksadk/studio/static/assets/classDiagram-ZZMXUADV-DjeMNJmu.js +0 -1
  730. ksadk/studio/static/assets/classDiagram-v2-VYDZK3BY-DjeMNJmu.js +0 -1
  731. ksadk/studio/static/assets/cynefin-OW5HDTMX-7tP7QfM3.js +0 -1
  732. ksadk/studio/static/assets/eventmodeling-NTZA5JFV-BR2FzK4R.js +0 -1
  733. ksadk/studio/static/assets/flowDiagram-HODETNUW-CZ1tEenp.js +0 -1
  734. ksadk/studio/static/assets/gitGraph-4MIJSDKK-DYlXv_yJ.js +0 -1
  735. ksadk/studio/static/assets/index-C7DNDik2.css +0 -2
  736. ksadk/studio/static/assets/index-Cy68gTlH.js +0 -265
  737. ksadk/studio/static/assets/info-A6RAGUB7-BlU-8_xu.js +0 -1
  738. ksadk/studio/static/assets/packet-AYTQ26CC-BSJEH9Lb.js +0 -1
  739. ksadk/studio/static/assets/pie-WAS4IAKB-qxv01Y8W.js +0 -1
  740. ksadk/studio/static/assets/radar-RG4KPBEZ-B6h6pWOs.js +0 -1
  741. ksadk/studio/static/assets/railroad-74A4TZTK-CGtTWdGc.js +0 -1
  742. ksadk/studio/static/assets/railroad-abnf-HS5TGJTU-Cq7y22IA.js +0 -1
  743. ksadk/studio/static/assets/railroad-ebnf-LZEXJU2U-V0aQVv9m.js +0 -1
  744. ksadk/studio/static/assets/railroad-peg-WCYAUIDC-BQiIsX_p.js +0 -1
  745. ksadk/studio/static/assets/rolldown-runtime-hePW80VL.js +0 -1
  746. ksadk/studio/static/assets/stateDiagram-v2-MP3YSRHH-CJbOM-QK.js +0 -1
  747. ksadk/studio/static/assets/swimlanesDiagram-VR7AAH4N-D-AVlW8B.js +0 -8
  748. ksadk/studio/static/assets/treeView-Q6P3EWNA-BTTYcvrF.js +0 -1
  749. ksadk/studio/static/assets/treemap-WGGIJYW6-Cg7tyfH8.js +0 -1
  750. ksadk/studio/static/assets/wardley-WFR3VGLG-C6N1rULY.js +0 -1
  751. {agentengine_sdk_python-0.8.6.dist-info → agentengine_sdk_python-0.8.8.dist-info}/entry_points.txt +0 -0
  752. {agentengine_sdk_python-0.8.6.dist-info → agentengine_sdk_python-0.8.8.dist-info}/licenses/LICENSE +0 -0
  753. {agentengine_sdk_python-0.8.6.dist-info → agentengine_sdk_python-0.8.8.dist-info}/top_level.txt +0 -0
  754. /ksadk/studio/static/assets/{array-BifhSqXX.js → array-mTkv7xdZ.js} +0 -0
  755. /ksadk/studio/static/assets/{chunk-Y2CYZVJY-DsF7k-Jl.js → chunk-Y2CYZVJY-C72YQVBQ.js} +0 -0
  756. /ksadk/studio/static/assets/{clsx-DB0hHKMi.js → clsx-BE-4uLAX.js} +0 -0
  757. /ksadk/studio/static/assets/{defaultLocale-BFoDCU3G.js → defaultLocale-YBltSZ3l.js} +0 -0
  758. /ksadk/studio/static/assets/{graphlib-DS17s2tU.js → graphlib-CYZB3_li.js} +0 -0
  759. /ksadk/studio/static/assets/{init-C-OQMol4.js → init-Ccnd9r3c.js} +0 -0
  760. /ksadk/studio/static/assets/{path-fybaL0A-.js → path-BfzAkHoX.js} +0 -0
  761. /ksadk/studio/static/assets/{preload-helper-CO68xz6u.js → preload-helper-2TpOpXko.js} +0 -0
  762. /ksadk/studio/static/assets/{presentation-yYw7xK60-BmcZriri.js → presentation-yYw7xK60-B7PYgYAE.js} +0 -0
  763. /ksadk/studio/static/assets/{rolldown-runtime-Dy4uBu1J-DK3Fl9T5.js → rolldown-runtime-Dy4uBu1J-CmRlGT1x.js} +0 -0
  764. /ksadk/studio/static/assets/{rough.esm-Dy-Kn_BL.js → rough.esm-BF6Sy8cM.js} +0 -0
ksadk/studio/service.py CHANGED
@@ -150,6 +150,7 @@ from ksadk.studio.native_options import validate_native_options
150
150
  from ksadk.studio.operations import OperationManager
151
151
  from ksadk.studio.plugin_composition import StudioPluginCompositionCompiler
152
152
  from ksadk.studio.plugin_runtime import StudioPluginRuntime
153
+ from ksadk.studio.project_instruction_trust import ProjectInstructionTrustStore
153
154
  from ksadk.studio.repository import AgentDraftRepository, BuildRepository
154
155
  from ksadk.studio.resource_authority import (
155
156
  ResourceAuthorityPolicy,
@@ -223,6 +224,9 @@ class StudioService(StudioSettingsMixin):
223
224
  native_harness_child_recovery_policy: ChildRecoveryPolicy | None = None,
224
225
  native_harness_model_recovery_policy: Literal["pure-inference-takeover/v1"] | None = None,
225
226
  native_harness_model_recovery_host: StudioModelTakeoverDeclaration | None = None,
227
+ project_instruction_trust: ProjectInstructionTrustStore | None = None,
228
+ native_background_connection_ref: str | None = None,
229
+ native_background_e2b_domain: str | None = None,
226
230
  native_acceptance_extension: StudioNativeAcceptanceExtension | None = None,
227
231
  native_delivery_review_policy: DeliveryReviewPolicy | None = None,
228
232
  native_harness_hook_registrations: Sequence[StudioNativeHookRegistration] = (),
@@ -460,6 +464,10 @@ class StudioService(StudioSettingsMixin):
460
464
  runtime_events=self.runtime_events,
461
465
  native_harness_ingress=harness_runtime_factory is not None,
462
466
  )
467
+ # The wakeup coordinator's status_reader resolves each still-running
468
+ # background command's real terminal status through the owning service
469
+ # (locator + composer declaration). Fail closed until this is bound.
470
+ self.run_service._studio = self
463
471
  self.codex_runs = CodexRunSpecResolver(
464
472
  self.workspace,
465
473
  build_repository=self.codex_builds,
@@ -478,12 +486,36 @@ class StudioService(StudioSettingsMixin):
478
486
  credential_resolver=self.credentials
479
487
  )
480
488
  self.model_client = runtime_model_client
489
+ self.project_instruction_trust = project_instruction_trust or ProjectInstructionTrustStore()
481
490
  if native_enabled:
482
491
  from ksadk.studio.native_product import StudioNativeProductComposer
492
+ from ksadk.common.cloud_headers import resolve_traffic_source
493
+ from ksadk.studio.native_background_connection import (
494
+ build_background_host_declaration,
495
+ )
496
+ # The E2B background connection identity is a host-declared
497
+ # resource connection (typed ConnectionTarget), not ambient env.
498
+ # No declared ref ⇒ no declaration ⇒ E2B background is unknown with
499
+ # zero backend calls. A declared ref with no record surfaces loudly.
500
+ background_host_declaration = None
501
+ if native_background_connection_ref is not None:
502
+ background_host_declaration = build_background_host_declaration(
503
+ self.resource_connections,
504
+ connection_ref=native_background_connection_ref,
505
+ domain=native_background_e2b_domain or "",
506
+ traffic_source=resolve_traffic_source(),
507
+ )
508
+ # Canonical Native ownership verifier: proves a frozen sandbox_id
509
+ # was launched by a canonical Native run owned by the session (via
510
+ # the committed launch receipt + sealed BackgroundCommandRef), reusing
511
+ # the trusted path BackgroundCommandLocator traverses. Built lazily
512
+ # because it needs the Composer's durable RunStore (created next).
513
+ ownership_verifier = None
483
514
 
484
515
  self._native_product_composer = StudioNativeProductComposer(
485
516
  model_client=self.model_client,
486
517
  workspace_root=self.workspace.root,
518
+ project_instruction_trust=self.project_instruction_trust,
487
519
  acceptance_extension=native_acceptance_extension,
488
520
  delivery_review_policy=native_delivery_review_policy,
489
521
  hook_authorizer=native_harness_hook_authorizer,
@@ -497,6 +529,23 @@ class StudioService(StudioSettingsMixin):
497
529
  diagnostic_profiles=diagnostic_profiles,
498
530
  model_recovery_policy=native_harness_model_recovery_policy,
499
531
  model_recovery_host=native_harness_model_recovery_host,
532
+ background_host_declaration=background_host_declaration,
533
+ ownership_verifier=ownership_verifier,
534
+ )
535
+ # Wire the canonical ownership verifier now that the Composer's
536
+ # durable RunStore exists. The verifier reuses event_store +
537
+ # plugin_runs + session_service (same trusted sources as the
538
+ # locator) + the Composer's store + workspace_root.
539
+ from ksadk.studio.native_background_ownership import (
540
+ StudioNativeBackgroundOwnershipVerifier,
541
+ )
542
+ self._native_product_composer._ownership_verifier = (
543
+ StudioNativeBackgroundOwnershipVerifier(
544
+ self,
545
+ native_store=self._native_product_composer.store,
546
+ workspace_root=self.workspace.root,
547
+ background_declaration=background_host_declaration,
548
+ )
500
549
  )
501
550
  def select_native_engine(context): # type: ignore[no-untyped-def]
502
551
  if self._native_session_enabled(context.agent_name, context.activation_key):
@@ -530,6 +579,8 @@ class StudioService(StudioSettingsMixin):
530
579
  resource_connections=self.resource_connections,
531
580
  resource_actor_ref="local-user",
532
581
  native_workspace_id=self.workspace_record.workspace_id,
582
+ service_hook_authorizer=native_harness_hook_authorizer,
583
+ service_hook_authorization_version=native_harness_hook_authorization_version,
533
584
  )
534
585
  self.run_service.plugin_runtime = self.plugin_runs
535
586
  self.scheduler_runtimes = StudioScheduledKernelRegistry(
@@ -599,6 +650,9 @@ class StudioService(StudioSettingsMixin):
599
650
  self._started = True
600
651
  self._dsh_startup_task = asyncio.create_task(self._initialize_dsh())
601
652
  self.channel_connections.start_background()
653
+ # Start the idle-wake coordinator so durable watches recovered
654
+ # from a prior process begin to fire without a new user run.
655
+ await self.run_service.start_background_wakeup()
602
656
  task = self._dsh_startup_task
603
657
  if wait_for_dsh and task is not None:
604
658
  await asyncio.shield(task)
@@ -1569,6 +1623,25 @@ class StudioService(StudioSettingsMixin):
1569
1623
  )
1570
1624
  await self.run_service.reap_stale_running_run(run.id)
1571
1625
  await self.plugin_runs.close_session(session_id)
1626
+ # Explicitly terminate the persistent background sandbox for this
1627
+ # session's owner BEFORE deleting session metadata. Proves: typed
1628
+ # account authority (declaration), session ownership (owner key), and
1629
+ # canonical Native launch ownership (committed receipt + sealed ref →
1630
+ # task_id → sandbox_id, via the ownership verifier). A different
1631
+ # authority, or a sandbox with no canonical Native run, is unknown (no
1632
+ # kill, no delete). Only terminated/confirmed_absent/not_e2b/no_owner
1633
+ # allow deletion; unknown/failed/timeout retain metadata for recovery.
1634
+ # terminate_owner is async (the verifier awaits the trusted
1635
+ # session-service lookup, same as BackgroundCommandLocator).
1636
+ if self._native_product_composer is not None:
1637
+ result = await self._native_product_composer.terminate_owner(session_id)
1638
+ if result not in ("terminated", "confirmed_absent", "not_e2b", "no_owner"):
1639
+ raise StudioError(
1640
+ "BACKGROUND_TERMINATE_UNCONFIRMED",
1641
+ "后台 sandbox 终止未确认,会话元数据已保留以便恢复",
1642
+ status_code=500,
1643
+ details={"sessionId": session_id, "terminate_result": result},
1644
+ )
1572
1645
  await self.session_service.delete_session(session_id)
1573
1646
  self.event_store.delete_session(session_id)
1574
1647
 
@@ -1595,6 +1668,12 @@ class StudioService(StudioSettingsMixin):
1595
1668
  async def _close_owned_plugin_services(self) -> None:
1596
1669
  from ksadk.studio.provider_recovery import detach_recovered_runs
1597
1670
 
1671
+ # Stop the idle-wake coordinator first so its poll loop cannot fire a
1672
+ # notification turn into a service that is tearing down.
1673
+ try:
1674
+ await self.run_service.stop_background_wakeup()
1675
+ except Exception:
1676
+ pass
1598
1677
  await detach_recovered_runs(self.run_service)
1599
1678
  first_error: BaseException | None = None
1600
1679
  owned = [
@@ -1774,7 +1853,7 @@ class StudioService(StudioSettingsMixin):
1774
1853
  status_code=409,
1775
1854
  details={"id": agent_id},
1776
1855
  )
1777
- resolved_spec = spec or default_agent_spec(
1856
+ resolved_spec = spec or self._default_agent_spec(
1778
1857
  template,
1779
1858
  description=description,
1780
1859
  )
@@ -2214,7 +2293,10 @@ class StudioService(StudioSettingsMixin):
2214
2293
  ) -> AgentDraft:
2215
2294
  """Create one Agent and dispatch from its RuntimeRef."""
2216
2295
 
2217
- resolved_spec = (spec or default_agent_spec(template, description=description)).model_copy(
2296
+ resolved_spec = (spec or self._default_agent_spec(
2297
+ template, description=description,
2298
+ runtime_type=runtime.type if runtime is not None else None,
2299
+ )).model_copy(
2218
2300
  deep=True
2219
2301
  )
2220
2302
  selected = runtime or resolved_spec.runtime
@@ -2550,14 +2632,31 @@ class StudioService(StudioSettingsMixin):
2550
2632
  def list_agent_templates() -> list[dict]:
2551
2633
  return list_agent_templates()
2552
2634
 
2635
+ def _default_agent_spec(
2636
+ self, template: str, *, description: str = "", runtime_type: str | None = None,
2637
+ ) -> AgentSpec:
2638
+ if template == "coding":
2639
+ return self.compose_agent_template(
2640
+ template,
2641
+ AgentTemplateComposeRequest(
2642
+ goal=description or "根据用户要求开发、修复项目并验证实际结果。",
2643
+ description=description,
2644
+ timeout_seconds=0,
2645
+ ),
2646
+ ).spec
2647
+ return default_agent_spec(template, description=description, runtime_type=runtime_type)
2648
+
2553
2649
  def compose_agent_template(
2554
2650
  self,
2555
2651
  template_id: str,
2556
2652
  request: AgentTemplateComposeRequest,
2557
2653
  ) -> AgentTemplateComposition:
2654
+ from ksadk.studio.native_coding_template import compose_native_coding_agent
2655
+
2558
2656
  composers = {
2559
2657
  "blank": compose_blank_agent,
2560
2658
  "research": compose_research_agent,
2659
+ "coding": compose_native_coding_agent,
2561
2660
  }
2562
2661
  composer = composers.get(template_id)
2563
2662
  if composer is None:
@@ -238,19 +238,28 @@ class StudioSharedWebBridge:
238
238
  messages: list[dict[str, Any]] = []
239
239
  sequence = 0
240
240
  for run in runs:
241
- sequence += 1
242
- messages.append(
243
- {
244
- "MessageId": f"{run.id}:user",
245
- "Role": "user",
246
- "Content": {"text": run.input},
247
- "Timestamp": self._timestamp(run.started_at),
248
- "SeqId": sequence,
249
- "InvocationId": run.id,
250
- }
241
+ events = self.studio.event_store.events(run.id)
242
+ notification = any(
243
+ event.type == "run.created" and event.data.get("notification") is True
244
+ for event in events
251
245
  )
246
+ # Notifications retain their source input for immutable runtime
247
+ # binding, but that is not another user submission. Reserve its
248
+ # old sequence slot so persisted history cursors remain valid.
249
+ sequence += 1
250
+ if not notification:
251
+ messages.append(
252
+ {
253
+ "MessageId": f"{run.id}:user",
254
+ "Role": "user",
255
+ "Content": {"text": run.input},
256
+ "Timestamp": self._timestamp(run.started_at),
257
+ "SeqId": sequence,
258
+ "InvocationId": run.id,
259
+ }
260
+ )
252
261
  last_steer_at = None
253
- for event in self.studio.event_store.events(run.id):
262
+ for event in events:
254
263
  if event.type != "run.steer_requested":
255
264
  continue
256
265
  text = event.data.get("text")
@@ -1194,6 +1203,22 @@ class StudioSharedWebBridge:
1194
1203
  }
1195
1204
  else:
1196
1205
  return None
1206
+ if event_type.startswith(("tool.", "command.")):
1207
+ from ksadk.harness.tool_display_contract import safe_tool_display
1208
+
1209
+ # Live Responses must carry the same curated receipt as replay.
1210
+ # Never reconstruct presentation from private arguments/results.
1211
+ # Older completion events can omit it; retain their start receipt.
1212
+ for source_data in (data, started):
1213
+ runtime_event = source_data.get("runtimeEvent") or {}
1214
+ source = runtime_event.get("source") or {}
1215
+ metadata = source.get("metadata") or {}
1216
+ raw_display = metadata.get("tool_display")
1217
+ if raw_display is not None:
1218
+ display = safe_tool_display(raw_display)
1219
+ if display is not None:
1220
+ item["tool_display"] = display
1221
+ break
1197
1222
  response_event = "response.output_item.done" if done else "response.output_item.added"
1198
1223
  return response_event, {"type": response_event, "item": item}
1199
1224
 
@@ -1218,10 +1243,11 @@ class StudioSharedWebBridge:
1218
1243
  *,
1219
1244
  invocation_id: str,
1220
1245
  delta: str,
1246
+ item_id: str | None = None,
1221
1247
  ) -> dict[str, Any]:
1222
1248
  return {
1223
1249
  "type": event_name,
1224
- "item_id": f"msg_{invocation_id}",
1250
+ "item_id": item_id or f"msg_{invocation_id}",
1225
1251
  "output_index": 0,
1226
1252
  "content_index": 0,
1227
1253
  "delta": delta,
@@ -54,6 +54,22 @@ async def project_response_events(
54
54
  if key in seen:
55
55
  continue
56
56
  seen.add(key)
57
+ native = event.data.get("runtimeEvent") or {}
58
+ metadata = native.get("source", {}).get("metadata", {})
59
+ item_id = str(event.data.get("itemId") or native.get("item_id") or "")
60
+ if event.type == "thinking.completed":
61
+ name = "response.reasoning_summary_text.done"
62
+ projected.append((name, {
63
+ "type": name, "item_id": item_id or f"summary_{invocation_id}",
64
+ "text": str(event.data.get("text") or ""),
65
+ "public_summary": metadata.get("public_summary") is True,
66
+ "presentation_source": "provider_reasoning"
67
+ if metadata.get("provider_reasoning") is True else (
68
+ "public_summary" if metadata.get("public_summary") is True else "reasoning"
69
+ ),
70
+ "event_id": f"{run.id}:{event.id}",
71
+ }))
72
+ continue
57
73
  if event.type == "message.completed":
58
74
  native = event.data.get("runtimeEvent") or {}
59
75
  metadata = native.get("source", {}).get("metadata", {})
@@ -96,14 +112,25 @@ async def project_response_events(
96
112
  if event.type == "message.delta" and not is_activity
97
113
  else "response.reasoning_summary_text.delta"
98
114
  )
115
+ payload = self._response_delta_payload(
116
+ event_name, invocation_id=invocation_id,
117
+ delta=f"\n{delta}\n" if is_activity else delta,
118
+ item_id=item_id or None,
119
+ )
120
+ payload.update(
121
+ event_id=f"{run.id}:{event.id}",
122
+ public_summary=metadata.get("public_summary") is True,
123
+ presentation_source="runtime_progress" if is_activity else (
124
+ "public_summary" if metadata.get("public_summary") is True else (
125
+ "provider_reasoning"
126
+ if metadata.get("provider_reasoning") is True else "reasoning"
127
+ )
128
+ ),
129
+ )
99
130
  projected.append(
100
131
  (
101
132
  event_name,
102
- self._response_delta_payload(
103
- event_name,
104
- invocation_id=invocation_id,
105
- delta=f"\n{delta}\n" if is_activity else delta,
106
- ),
133
+ payload,
107
134
  )
108
135
  )
109
136
  continue
@@ -0,0 +1,8 @@
1
+ import{a as e,t}from"./rolldown-runtime-cO0ylGnt.js";import{i as n,t as r}from"./react-vendor-CTyAWUMQ.js";import{t as i}from"./createLucideIcon-CTD6_IjT.js";import{D as a,E as o,M as s,N as c,O as l,_ as u,b as d,c as f,d as p,f as m,g as h,h as g,j as _,l as v,m as ee,p as y,t as te,u as b,v as x,w as ne,x as re}from"./index-HepnaEeR.js";var ie=i(`arrow-down-left`,[[`path`,{d:`M17 7 7 17`,key:`15tmo1`}],[`path`,{d:`M17 17H7V7`,key:`1org7z`}]]),ae=i(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),oe=i(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),se=i(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ce=i(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),le=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),S=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),C=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),ue=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),w=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),de=t((e=>{var t=S().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),T=t((e=>{var t=S().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),fe=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),E=t((e=>{var t=C(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),D=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),O=t((e=>{var t=D();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),pe=t(((e,t)=>{var n=O();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),k=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),me=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
2
+ ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),A=t((e=>{var t=k(),n=me();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),he=t((e=>{var t=S(),n=E(),r=C(),i=A(),a=k(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),ge=t((e=>{var t=S(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),_e=t(((e,t)=>{var n=A();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),ve=t(((e,t)=>{var n=A(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),j=t(((e,t)=>{var n=A();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),ye=t(((e,t)=>{var n=A(),r=S();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
3
+ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),be=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),M=t((e=>{var t=A(),n=_e(),r=ve(),i=j(),a=ye(),o=me(),s=S(),c=be();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
4
+ Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),xe=t((e=>{var t=S(),n=C(),r=ue(),i=w(),a=de(),o=T(),s=fe(),c=E(),l=pe(),u=he(),d=ge(),f=A(),p=M();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function ee(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function y(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return te(a,e,n)}function te(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,ee=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=ee.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let y=new Uint8Array(i),te=0,b,x;for(b=0;b<v;b++)for(x=0;x<o;x++)b<g[x].length&&(y[te++]=g[x][b]);for(b=0;b<p;b++)for(x=0;x<o;x++)y[te++]=_[x][b];return y}function b(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
5
+ The chosen QR Code version cannot contain this amount of data.
6
+ Minimum version required to store current data is: `+c+`.
7
+ `);let l=y(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),ee(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),b(e,a,i,o)}})),N=t((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),P=t((e=>{var t=N();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Se=t((e=>{var t=N();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
8
+ `;return typeof a==`function`&&a(null,p),p}})),Ce=e(t((e=>{var t=le(),n=xe(),r=P(),i=Se();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1),F=e(n(),1),I=r();async function L(e,t){let n=await x(e,t===void 0?{}:{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r=await n.json();if(!n.ok)throw Error(r.error?.message||`连接配置失败,请检查服务地址与凭证`);return r}function we({agents:e,onWorkspace:t,onChange:n}){let[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)({serverUrl:``,accountId:``,workspaceId:``,apiToken:``}),[s,c]=(0,F.useState)(``),[l,u]=(0,F.useState)(``),[d,f]=(0,F.useState)(``),[p,m]=(0,F.useState)(!1);(0,F.useEffect)(()=>{let e=!1,n=!1;async function r(){try{let r=await L(`/api/v1/channels/connection`);if(e)return;i(r),t(r.workspaceId),n||=(o({serverUrl:r.serverUrl,accountId:r.accountId,workspaceId:r.workspaceId,apiToken:``}),!0)}catch(t){e||f(t instanceof Error?t.message:`连接状态暂不可用`)}}r();let a=window.setInterval(()=>void r(),3e3);return()=>{e=!0,window.clearInterval(a)}},[t]);async function h(e){e.preventDefault(),m(!0),f(``);try{let{apiToken:e,...r}=a,s=await L(`/api/v1/channels/connection`,{...r,...e?{apiToken:e}:{}});i(s),o(e=>({...e,workspaceId:s.workspaceId,apiToken:``})),t(s.workspaceId),n()}catch(e){f(e instanceof Error?e.message:`保存失败`)}finally{m(!1)}}async function g(e){m(!0),f(``);try{let t=await L(`/api/v1/channels/agents/${encodeURIComponent(s)}/connection`,{enabled:e,...l?{token:l}:{}});i(t),u(``),n()}catch(e){f(e instanceof Error?e.message:`Agent 连接失败`)}finally{m(!1)}}let _=r?.agents.find(e=>e.agentId===s),v=r?.agents.filter(e=>e.connected).length||0;return(0,I.jsxs)(`details`,{className:`channels-connection`,open:!r?.serverUrl,children:[(0,I.jsxs)(`summary`,{children:[`渠道服务连接 · `,v?`${v} 个本地 Agent 在线`:r?.serverUrl?`暂无本地 Agent 在线`:`尚未配置`]}),d&&(0,I.jsx)(`p`,{role:`alert`,children:d}),(0,I.jsxs)(`form`,{className:`channels-connection__form`,onSubmit:h,children:[(0,I.jsxs)(`label`,{children:[`服务地址`,(0,I.jsx)(`input`,{type:`url`,value:a.serverUrl,placeholder:`https://channel.example.com`,onChange:e=>o({...a,serverUrl:e.target.value}),required:!0})]}),(0,I.jsxs)(`label`,{children:[`账号 ID`,(0,I.jsx)(`input`,{value:a.accountId,onChange:e=>o({...a,accountId:e.target.value}),required:!0})]}),(0,I.jsxs)(`label`,{children:[`工作区 ID`,(0,I.jsx)(`input`,{value:a.workspaceId,onChange:e=>o({...a,workspaceId:e.target.value}),required:!0})]}),(0,I.jsxs)(`label`,{children:[`服务访问凭证`,(0,I.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:a.apiToken,placeholder:r?.hasApiToken?`已保存,留空保留`:`按服务入口要求填写`,onChange:e=>o({...a,apiToken:e.target.value})})]}),(0,I.jsx)(`button`,{className:`button secondary`,disabled:p,children:`保存连接配置`})]}),(0,I.jsxs)(`div`,{className:`channels-connection__form`,children:[(0,I.jsxs)(`label`,{children:[`本地 Agent`,(0,I.jsxs)(`select`,{value:s,onChange:e=>{c(e.target.value),u(``)},children:[(0,I.jsx)(`option`,{value:``,children:`选择需要接收消息的 Agent`}),e.map(e=>(0,I.jsx)(`option`,{value:e.metadata.id,children:e.metadata.name},e.metadata.id))]})]}),(0,I.jsxs)(`label`,{children:[`Agent 连接凭证`,(0,I.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:l,placeholder:_?.hasToken?`已保存,留空保留`:`由渠道服务签发`,onChange:e=>u(e.target.value)})]}),(0,I.jsx)(`button`,{className:`button secondary`,disabled:p||!s||!r?.serverUrl,onClick:()=>void g(!0),children:`连接 Agent`}),(0,I.jsx)(`button`,{className:`button tertiary`,disabled:p||!_?.enabled,onClick:()=>void g(!1),children:`断开`}),s&&(0,I.jsx)(`span`,{role:`status`,children:_?.connected?`已连接`:_?.enabled?`正在连接或等待重连`:`未连接`})]}),(0,I.jsx)(`p`,{children:`本地 Agent 会在 Studio 运行期间接收渠道消息。关闭页面不影响连接,退出 Studio 后离线。`})]})}var R={"wps-xiezuo":`WPS 协作`,feishu:`飞书`,wecom:`企业微信`};Object.keys(R).map(e=>({value:e,label:R[e]}));var z={"wps-xiezuo":`WPS`,feishu:`飞书`,wecom:`企微`},Te=[{value:`wps-xiezuo`,label:`WPS 协作`,desc:`金山办公协作平台`,Icon:l},{value:`feishu`,label:`飞书`,desc:`字节跳动企业协作`,Icon:ne},{value:`wecom`,label:`企业微信`,desc:`腾讯企业即时通讯`,Icon:re}],Ee={pairing:`需配对`,open:`开放`},De=Object.keys(Ee).map(e=>({value:e,label:Ee[e]})),Oe={allowlist:`白名单`,open:`开放`},ke=Object.keys(Oe).map(e=>({value:e,label:Oe[e]})),B={"per-peer":`按用户`,"per-group":`按群聊`},Ae=Object.keys(B).map(e=>({value:e,label:B[e]})),je={pending:`待处理`,approved:`已通过`,rejected:`已拒绝`,expired:`已过期`},Me={pending:`pending`,approved:`ready`,rejected:`failed`,expired:`idle`},Ne={dm:`私聊`,group:`群聊`};function V(e){if(!e)return`-`;let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function Pe(e){if(!e)return``;let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}`}function Fe(e){if(!e)return``;let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=new Date,r=new Date;r.setDate(n.getDate()-1);let i=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();if(i(t,n))return`今天`;if(i(t,r))return`昨天`;let a=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())}`}function H(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return{}}return e??{}}function Ie(e){let t=H(e.Payload);if(typeof t.text==`string`)return t.text;let n=t.message;if(n&&typeof n==`object`){let e=n.content;if(e){let t=e.text;if(t&&typeof t.content==`string`)return t.content}if(typeof n.content==`string`)return n.content}if(typeof t.content==`string`)return t.content;if(typeof t.message==`string`)return t.message;let r=JSON.stringify(t);return r.length>120?`${r.slice(0,120)}…`:r}function Le(e){let t=H(e.Payload);for(let e of[`sender_name`,`senderName`,`from_name`,`fromName`,`user_name`,`userName`]){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim()}let n=t.sender;if(n&&typeof n.id==`string`)return n.id;let r=t.from;return r&&typeof r.id==`string`?r.id:``}var Re={ConnectorWorkspaceId:``,AgentId:``,Channel:`wps-xiezuo`,ChannelAccountId:``,AppId:``,AppSecret:``,DmPolicy:`pairing`,GroupPolicy:`allowlist`,RequireMention:!0,SessionScope:`per-peer`,Enabled:!0,ConfigJson:`{}`};function ze({refreshTick:e}={}){let[t,n]=(0,F.useState)(`channels`),[r,i]=(0,F.useState)(``),[re,le]=(0,F.useState)(``),[S,C]=(0,F.useState)(0),ue=e??S,[w,de]=(0,F.useState)([]),[T,fe]=(0,F.useState)([]),[E,D]=(0,F.useState)([]),[O,pe]=(0,F.useState)([]),[k,me]=(0,F.useState)([]),[A,he]=(0,F.useState)([]),[ge,_e]=(0,F.useState)(!0),[ve,j]=(0,F.useState)(!1),[ye,be]=(0,F.useState)(null),[M,xe]=(0,F.useState)(!1),[N,P]=(0,F.useState)({...Re}),[Se,L]=(0,F.useState)(!1),[B,ze]=(0,F.useState)(null),[Be,Ve]=(0,F.useState)(!1),[U,He]=(0,F.useState)(null),[Ue,We]=(0,F.useState)(!1),[Ge,Ke]=(0,F.useState)(null),[qe,Je]=(0,F.useState)(``),[W,Ye]=(0,F.useState)(!1),[Xe,Ze]=(0,F.useState)([]),[Qe,$e]=(0,F.useState)({}),[G,et]=(0,F.useState)(null),[tt,nt]=(0,F.useState)(``),[rt,it]=(0,F.useState)(``),[K,at]=(0,F.useState)(!1),[ot,st]=(0,F.useState)(null),[ct,lt]=(0,F.useState)(!1),[q,ut]=(0,F.useState)(null),[J,Y]=(0,F.useState)(null),[dt,ft]=(0,F.useState)(!1),[pt,mt]=(0,F.useState)(null),ht=(0,F.useRef)(null),[gt,_t]=(0,F.useState)(null),[vt,yt]=(0,F.useState)(!1),[X,bt]=(0,F.useState)(null),[xt,St]=(0,F.useState)(``),Ct=(0,F.useCallback)(async()=>{let[e,t,n,r,i,a,o]=await Promise.allSettled([f(`ListChannels`,{Offset:0,Limit:100}),f(`ListPairingRequests`,{Offset:0,Limit:100}),f(`ListBindings`,{Offset:0,Limit:100}),f(`ListMessages`,{Offset:0,Limit:100}),x(`/api/v1/agents?limit=100`).then(e=>e.ok?e.json():Promise.reject(Error(`agents`))),x(`/api/v1/cloud-agents?size=100`).then(e=>e.ok?e.json():Promise.reject(Error(`cloud-agents`))),x(`/api/v1/runs`).then(e=>e.ok?e.json():Promise.reject(Error(`runs`)))]);if(e.status===`fulfilled`?(de(e.value.Items||[]),le(``)):(de([]),le(e.reason instanceof Error?e.reason.message:`渠道服务暂不可用`)),t.status===`fulfilled`&&fe(t.value.Items||[]),n.status===`fulfilled`&&D(n.value.Items||[]),r.status===`fulfilled`&&pe(r.value.Items||[]),i.status===`fulfilled`&&me(i.value.items||[]),a.status===`fulfilled`&&he(a.value.items||[]),o.status===`fulfilled`&&o.value.items){let e=[],t=new Set;for(let n of o.value.items){let r=n.agentId||``,i=te([n],r);for(let n of i)t.has(n.id)||(t.add(n.id),e.push(n))}e.sort((e,t)=>(t.updatedAt||``).localeCompare(e.updatedAt||``)),Ze(e)}if(n.status===`fulfilled`){let e=n.value.Items||[],t={};await Promise.allSettled(e.map(async e=>{try{let n=await f(`GetActiveTakeover`,{BindingId:e.Id});n.Takeover&&(t[e.Id]=n.Takeover.Id)}catch{}})),$e(t)}_e(!1)},[]);(0,F.useEffect)(()=>{_e(!0),Ct()},[Ct,ue]);let wt=(0,F.useCallback)(e=>k.find(t=>t.metadata.id===e)?.metadata.name||A.find(t=>t.agentId===e)?.name||e||`未绑定`,[k,A]),Tt=(0,F.useMemo)(()=>{let e=r?k.map(e=>({value:JSON.stringify([r,e.metadata.id]),label:`本地 · ${e.metadata.name}`})):[],t=A.filter(e=>e.agentId&&e.agentId.trim()).map(e=>({value:JSON.stringify([``,e.agentId.trim()]),label:`云端 · ${e.name||e.agentId}`})),n=[...e,...t],i=JSON.stringify([N.ConnectorWorkspaceId,N.AgentId]);return N.AgentId&&!n.some(e=>e.value===i)&&n.push({value:i,label:`${N.ConnectorWorkspaceId?`其他工作区`:`云端`} · ${N.AgentId}`}),n},[k,A,r,N.AgentId,N.ConnectorWorkspaceId]),Et=(0,F.useMemo)(()=>[{value:``,label:`(不关联会话)`},...Xe.map(e=>({value:e.id,label:e.title||e.id}))],[Xe]),Z=!!ye;function Dt(){be(null),P({...Re}),L(!1),j(!0)}function Ot(e){be(e.Id),P({AgentId:e.AgentId,ConnectorWorkspaceId:e.ConnectorWorkspaceId||``,Channel:e.Channel,ChannelAccountId:e.ChannelAccountId,AppId:``,AppSecret:``,DmPolicy:e.DmPolicy,GroupPolicy:e.GroupPolicy,RequireMention:e.RequireMention,SessionScope:e.SessionScope,Enabled:e.Enabled,ConfigJson:e.ConfigJson||`{}`}),L(!0),j(!0)}function kt(e){_t(e),yt(!0),bt(null),St(``),(async()=>{try{let t=await f(`GetConnectQr`,{Id:e.Id});if(bt(t),t.QrUrl){let e=await Ce.toDataURL(t.QrUrl,{width:200,margin:1});St(e)}}catch(e){p(`获取二维码失败`,e instanceof Error?e.message:`请稍后重试`,`error`),_t(null)}finally{yt(!1)}})()}function At(){_t(null),bt(null),St(``)}async function jt(e){e.preventDefault(),xe(!0);try{let e={AgentId:N.AgentId,ConnectorWorkspaceId:N.ConnectorWorkspaceId,Channel:N.Channel,ChannelAccountId:N.ChannelAccountId.trim(),DmPolicy:N.DmPolicy,GroupPolicy:N.GroupPolicy,RequireMention:N.RequireMention,SessionScope:N.SessionScope,Enabled:N.Enabled,ConfigJson:N.ConfigJson||`{}`};N.AppId.trim()&&(e.AppId=N.AppId.trim()),N.AppSecret.trim()&&(e.AppSecret=N.AppSecret.trim()),Z?(e.Id=ye,await f(`UpdateChannel`,e),p(`渠道已更新`,`${R[N.Channel]} · ${N.ChannelAccountId}`)):(await f(`CreateChannel`,e),p(`渠道已创建`,`${R[N.Channel]} · ${N.ChannelAccountId}`)),j(!1),await Ct()}catch(e){p(Z?`渠道更新失败`:`渠道创建失败`,e instanceof Error?e.message:`请稍后重试`,`error`)}finally{xe(!1)}}async function Mt(){if(B){Ve(!0);try{await f(`DeleteChannel`,{Id:B.Id}),de(e=>e.filter(e=>e.Id!==B.Id)),p(`渠道已删除`,`${R[B.Channel]} · ${B.ChannelAccountId}`),ze(null)}catch(e){p(`渠道删除失败`,e instanceof Error?e.message:`请稍后重试`,`error`)}finally{Ve(!1)}}}async function Nt(){if(U){We(!0);try{await f(`DeleteBinding`,{Id:U.Id}),D(e=>e.filter(e=>e.Id!==U.Id)),p(`解绑成功`,`会话 ${U.SessionId} 已解绑`),He(null)}catch(e){p(`解绑失败`,e instanceof Error?e.message:`请稍后重试`,`error`)}finally{We(!1)}}}async function Pt(){if(G){at(!0);try{await f(`Takeover`,{BindingId:G.Id,TakenOverBy:`admin`,TakenOverByName:rt.trim()||`Admin`,Reason:tt.trim()||void 0});let e=await f(`GetActiveTakeover`,{BindingId:G.Id});e.Takeover&&$e(t=>({...t,[G.Id]:e.Takeover.Id})),p(`已接管`,`该会话的消息将不再自动回复`),et(null)}catch(e){p(`接管失败`,e instanceof Error?e.message:`请稍后重试`,`error`)}finally{at(!1)}}}async function Ft(){if(!ot)return;let e=Qe[ot.Id];if(!e){p(`无需释放`,`当前没有活跃的接管`),st(null);return}lt(!0);try{await f(`ReleaseTakeover`,{Id:e}),$e(e=>{let t={...e};return delete t[ot.Id],t}),p(`已释放接管`,`该会话恢复自动回复`),st(null)}catch(e){p(`释放失败`,e instanceof Error?e.message:`请稍后重试`,`error`)}finally{lt(!1)}}async function It(){if(!Ge)return;let e=qe.trim();Ye(!0);try{await f(`UpdateBinding`,{Id:Ge.Id,SessionId:e}),D(t=>t.map(t=>t.Id===Ge.Id?{...t,SessionId:e}:t)),p(e?`会话关联成功`:`已取消关联`,e?`会话已关联到 ${e}`:`该绑定已取消会话关联`),Ke(null)}catch(e){p(`关联失败`,e instanceof Error?e.message:`请稍后重试`,`error`)}finally{Ye(!1)}}async function Lt(){if(!(!q||!J)){ft(!0);try{await f(J===`approve`?`ApprovePairing`:`RejectPairing`,{Id:q.Id});let e=J===`approve`?`approved`:`rejected`;fe(t=>t.map(t=>t.Id===q.Id?{...t,Status:e}:t)),p(J===`approve`?`配对已通过`:`配对已拒绝`,q.SenderName),ut(null),Y(null)}catch(e){p(J===`approve`?`配对通过失败`:`配对拒绝失败`,e instanceof Error?e.message:`请稍后重试`,`error`)}finally{ft(!1)}}}let Rt=(0,F.useMemo)(()=>[{id:`name`,header:`渠道`,minWidth:240,cell:e=>(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`channel-platform-tag`,"data-platform":e.Channel,"aria-hidden":`true`,children:z[e.Channel]}),(0,I.jsxs)(`strong`,{children:[R[e.Channel],` · `,e.ChannelAccountId]}),(0,I.jsx)(`span`,{className:`resource-origin mono`,children:e.Id})]})},{id:`agent`,header:`绑定 Agent`,minWidth:150,cell:e=>e.AgentId?(0,I.jsx)(`span`,{children:wt(e.AgentId)}):(0,I.jsx)(`span`,{className:`text-muted`,children:`未绑定`})},{id:`dmPolicy`,header:`私聊策略`,width:100,cell:e=>(0,I.jsx)(`span`,{className:`channel-policy-tag`,"data-policy":e.DmPolicy,children:Ee[e.DmPolicy]})},{id:`groupPolicy`,header:`群聊策略`,width:100,cell:e=>(0,I.jsx)(`span`,{className:`channel-policy-tag`,"data-policy":e.GroupPolicy,children:Oe[e.GroupPolicy]})},{id:`requireMention`,header:`@机器人`,width:90,cell:e=>e.RequireMention?(0,I.jsx)(`span`,{className:`tag`,children:`需要`}):(0,I.jsx)(`span`,{className:`text-muted`,children:`否`})},{id:`enabled`,header:`状态`,width:100,cell:e=>(0,I.jsx)(`span`,{className:`badge`,"data-state":e.Enabled?`ready`:`idle`,children:e.Enabled?`已启用`:`已停用`})},{id:`createdAt`,header:`创建时间`,minWidth:140,cell:e=>V(e.CreatedAt)},{id:`actions`,header:``,width:56,className:`channels-page__row-actions`,cell:e=>(0,I.jsx)(g,{label:`${e.ChannelAccountId} 操作`,items:[...e.Channel===`feishu`||e.Channel===`wecom`?[{label:`扫码连接`,onSelect:()=>kt(e)}]:[],{label:`编辑`,onSelect:()=>Ot(e)},{label:`删除`,danger:!0,onSelect:()=>ze(e)}]})}],[wt]),zt=(0,F.useMemo)(()=>[{id:`sender`,header:`发起人`,minWidth:120,cell:e=>(0,I.jsx)(`strong`,{children:e.SenderName||e.SenderId})},{id:`channel`,header:`渠道`,minWidth:180,cell:e=>(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`channel-platform-tag`,"data-platform":e.Channel,"aria-hidden":`true`,children:z[e.Channel]}),(0,I.jsxs)(`span`,{children:[R[e.Channel],` · `,e.ChannelAccountId]})]})},{id:`chatType`,header:`会话类型`,width:90,cell:e=>(0,I.jsx)(`span`,{className:`tag`,children:Ne[e.ChatType]})},{id:`peerId`,header:`对端 ID`,minWidth:130,cell:e=>(0,I.jsx)(`span`,{className:`mono`,children:e.PeerId||`-`})},{id:`status`,header:`状态`,width:100,cell:e=>(0,I.jsx)(`span`,{className:`badge`,"data-state":Me[e.Status],children:je[e.Status]})},{id:`createdAt`,header:`创建时间`,minWidth:140,cell:e=>V(e.CreatedAt)},{id:`expiresAt`,header:`过期时间`,minWidth:140,cell:e=>V(e.ExpiresAt)},{id:`actions`,header:``,width:130,className:`channels-page__row-actions`,cell:e=>e.Status===`pending`?(0,I.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,I.jsxs)(`button`,{className:`button accent compact`,type:`button`,onClick:()=>{ut(e),Y(`approve`)},title:`通过配对`,children:[(0,I.jsx)(s,{size:14}),`通过`]}),(0,I.jsxs)(`button`,{className:`button tertiary compact`,type:`button`,onClick:()=>{ut(e),Y(`reject`)},title:`拒绝配对`,children:[(0,I.jsx)(d,{size:14}),`拒绝`]})]}):(0,I.jsx)(`span`,{className:`text-muted`,children:`-`})}],[]),Bt=(0,F.useMemo)(()=>[{id:`channel`,header:`渠道`,minWidth:180,cell:e=>(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`channel-platform-tag`,"data-platform":e.Channel,"aria-hidden":`true`,children:z[e.Channel]}),(0,I.jsxs)(`span`,{children:[R[e.Channel],` · `,e.ChannelAccountId]})]})},{id:`chatType`,header:`会话类型`,width:90,cell:e=>(0,I.jsx)(`span`,{className:`tag`,children:Ne[e.ChatType]})},{id:`peer`,header:`对端 / 群`,minWidth:140,cell:e=>(0,I.jsx)(`span`,{className:`mono`,children:e.ChatType===`group`?e.GroupId:e.PeerId})},{id:`sessionId`,header:`Session ID`,minWidth:150,cell:e=>(0,I.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:6},children:[(0,I.jsx)(`span`,{className:`mono resource-origin`,children:e.SessionId}),Qe[e.Id]&&(0,I.jsx)(`span`,{className:`channels-page__takeover-badge`,children:`已接管`})]})},{id:`userId`,header:`用户 ID`,minWidth:120,cell:e=>(0,I.jsx)(`span`,{className:`mono`,children:e.UserId||`-`})},{id:`createdAt`,header:`创建时间`,minWidth:140,cell:e=>V(e.CreatedAt)},{id:`actions`,header:``,width:48,cell:e=>(0,I.jsx)(g,{label:`会话绑定 ${e.SessionId} 操作`,items:[{label:`编辑会话`,onSelect:()=>{Ke(e),Je(e.SessionId)}},Qe[e.Id]?{label:`释放接管`,onSelect:()=>st(e)}:{label:`接管`,onSelect:()=>{et(e),nt(``),it(``)}},{label:`解绑`,danger:!0,onSelect:()=>He(e)}]})}],[]);(0,F.useMemo)(()=>[{id:`direction`,header:`方向`,width:90,cell:e=>(0,I.jsxs)(`span`,{className:`channel-message-direction ${e.Direction}`,children:[e.Direction===`inbound`?(0,I.jsx)(ie,{size:14}):(0,I.jsx)(c,{size:14}),e.Direction===`inbound`?`接收`:`发送`]})},{id:`channel`,header:`渠道`,minWidth:160,cell:e=>(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`channel-platform-tag`,"data-platform":e.Channel,"aria-hidden":`true`,children:z[e.Channel]}),(0,I.jsxs)(`span`,{children:[R[e.Channel],` · `,e.ChannelAccountId]})]})},{id:`sender`,header:`发送者`,minWidth:110,cell:e=>{let t=Le(e);return t?(0,I.jsx)(`span`,{className:`mono`,children:t}):(0,I.jsx)(`span`,{className:`text-muted`,children:`-`})}},{id:`payload`,header:`内容`,minWidth:280,cell:e=>(0,I.jsx)(`span`,{className:`resource-origin`,style:{maxWidth:360,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:Ie(e)})},{id:`error`,header:`错误`,width:120,cell:e=>e.Error?(0,I.jsx)(`span`,{className:`badge`,"data-state":`failed`,children:e.Error}):(0,I.jsx)(`span`,{className:`text-muted`,children:`-`})},{id:`retryCount`,header:`重试`,width:70,cell:e=>(0,I.jsx)(`span`,{className:`mono`,children:e.RetryCount})},{id:`createdAt`,header:`时间`,minWidth:140,cell:e=>V(e.CreatedAt)}],[]);let Q=(0,F.useMemo)(()=>{let e=new Map;for(let t of O){let n=H(t.Payload),r=``,i=``;if(t.Direction===`inbound`){let e=n.chat;e&&typeof e.id==`string`&&(r=e.id);let t=n.sender;t&&typeof t.id==`string`&&(i=t.id)}else{let e=n.reply_to;if(e){let t=O.find(t=>t.PlatformEventId===e);if(t){let e=H(t.Payload),n=e.chat;n&&typeof n.id==`string`&&(r=n.id);let a=e.sender;a&&typeof a.id==`string`&&(i=a.id)}}}if(!r){let e=n.sender;e&&typeof e.id==`string`&&(r=e.id,i=e.id)}r||=`default`;let a=`${t.Channel}|${t.ChannelAccountId}|${r}`,o=e.get(a);if(o)o.messages.push(t),o.messageCount++,t.CreatedAt>o.lastMessage.CreatedAt&&(o.lastMessage=t);else{let n=i||r!=="default"?i||r:`${R[t.Channel]} · ${t.ChannelAccountId}`;e.set(a,{id:a,channel:t.Channel,channelAccountId:t.ChannelAccountId,chatId:r,senderId:i,title:n,messages:[t],messageCount:1,lastMessage:t})}}for(let t of e.values())t.messages.sort((e,t)=>e.CreatedAt.localeCompare(t.CreatedAt));return Array.from(e.values()).sort((e,t)=>t.lastMessage.CreatedAt.localeCompare(e.lastMessage.CreatedAt))},[O]),$=(0,F.useMemo)(()=>Q.find(e=>e.id===pt)??null,[Q,pt]);(0,F.useEffect)(()=>{ht.current&&(ht.current.scrollTop=ht.current.scrollHeight)},[pt,$?.messages.length]);let Vt=w.filter(e=>e.Enabled).length,Ht=T.filter(e=>e.Status===`pending`).length,Ut=[{id:`channels`,label:`渠道列表`,count:w.length},{id:`pairings`,label:`配对请求`,count:T.length},{id:`bindings`,label:`会话绑定`,count:E.length},{id:`messages`,label:`消息记录`,count:O.length}],Wt=N.ChannelAccountId.trim()&&N.AgentId&&(Z||N.AppId.trim()&&N.AppSecret.trim());return(0,I.jsxs)(`div`,{className:`page-container channels-page`,"data-layout":`data`,"data-scroll-mode":`data`,children:[(0,I.jsxs)(ee,{children:[(0,I.jsx)(`button`,{className:`icon-button tertiary`,type:`button`,"aria-label":`刷新`,title:`刷新`,onClick:()=>C(e=>e+1),children:(0,I.jsx)(o,{size:15})}),(0,I.jsxs)(`button`,{className:`button accent`,type:`button`,onClick:Dt,children:[(0,I.jsx)(a,{size:15}),(0,I.jsx)(`span`,{children:`新建渠道`})]})]}),(0,I.jsx)(we,{agents:k,onWorkspace:i,onChange:()=>C(e=>e+1)}),re&&(0,I.jsx)(`p`,{role:`alert`,children:re}),(0,I.jsxs)(`section`,{className:`channels-page__metrics`,"aria-label":`渠道汇总`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{children:`渠道总数`}),(0,I.jsx)(`strong`,{children:w.length})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{children:`已启用`}),(0,I.jsx)(`strong`,{children:Vt})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{children:`待配对`}),(0,I.jsx)(`strong`,{children:Ht})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{children:`会话绑定`}),(0,I.jsx)(`strong`,{children:E.length})]})]}),(0,I.jsx)(`nav`,{className:`channels-page__tabs`,"aria-label":`消息渠道视图`,children:Ut.map(e=>(0,I.jsxs)(`button`,{className:`channels-page__tab${t===e.id?` active`:``}`,type:`button`,onClick:()=>n(e.id),children:[e.label,(0,I.jsx)(`span`,{className:`channels-page__tab-badge`,children:e.count})]},e.id))}),t===`channels`&&(0,I.jsxs)(`section`,{className:`channels-page__panel`,"aria-label":`渠道列表`,children:[(0,I.jsx)(`div`,{className:`channels-page__panel-header`,children:(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`strong`,{children:`渠道列表`}),(0,I.jsxs)(`span`,{children:[w.length,` 个渠道`]})]})}),(0,I.jsx)(y,{columns:Rt,data:w,getRowId:e=>e.Id,caption:`渠道列表`,minWidth:1e3,loading:ge,onRowActivate:e=>Ot(e),rowAriaLabel:e=>`编辑渠道 ${e.ChannelAccountId}`,empty:{icon:(0,I.jsx)(l,{size:22}),title:`还没有渠道`,description:`新建渠道后即可在这里管理平台接入。`}})]}),t===`pairings`&&(0,I.jsxs)(`section`,{className:`channels-page__panel`,"aria-label":`配对请求`,children:[(0,I.jsx)(`div`,{className:`channels-page__panel-header`,children:(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`strong`,{children:`配对请求`}),(0,I.jsxs)(`span`,{children:[T.length,` 条请求`]})]})}),(0,I.jsx)(y,{columns:zt,data:T,getRowId:e=>e.Id,caption:`配对请求列表`,minWidth:960,empty:{icon:(0,I.jsx)(ce,{size:22}),title:`没有配对请求`,description:`开启配对后,用户可通过配对码绑定渠道。`}})]}),t===`bindings`&&(0,I.jsxs)(`section`,{className:`channels-page__panel`,"aria-label":`会话绑定`,children:[(0,I.jsx)(`div`,{className:`channels-page__panel-header`,children:(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`strong`,{children:`会话绑定`}),(0,I.jsxs)(`span`,{children:[E.length,` 条绑定`]})]})}),(0,I.jsx)(y,{columns:Bt,data:E,getRowId:e=>e.Id,caption:`会话绑定列表`,minWidth:900,empty:{icon:(0,I.jsx)(ae,{size:22}),title:`没有会话绑定`,description:`用户通过配对后,会话绑定将出现在这里。`},expandRowContent:e=>(0,I.jsxs)(`div`,{className:`channels-page__message-detail`,children:[(0,I.jsx)(`pre`,{className:`channels-page__message-payload`,children:JSON.stringify({PeerId:e.PeerId,GroupId:e.GroupId,SenderId:e.SenderId,AgentId:e.AgentId,SessionId:e.SessionId,UserId:e.UserId,Channel:e.Channel,ChannelAccountId:e.ChannelAccountId,ChatType:e.ChatType,CreatedAt:e.CreatedAt,UpdatedAt:e.UpdatedAt},null,2)}),(0,I.jsxs)(`div`,{className:`channels-page__message-meta-row`,children:[(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`small`,{children:`Agent`}),(0,I.jsx)(`code`,{className:`mono`,children:e.AgentId||`-`})]}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`small`,{children:`Session`}),(0,I.jsx)(`code`,{className:`mono`,children:e.SessionId||`-`})]}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`small`,{children:`对端 ID`}),(0,I.jsx)(`code`,{className:`mono`,children:e.PeerId||`-`})]}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`small`,{children:`群 ID`}),(0,I.jsx)(`code`,{className:`mono`,children:e.GroupId||`-`})]}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`small`,{children:`发送者 ID`}),(0,I.jsx)(`code`,{className:`mono`,children:e.SenderId||`-`})]}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`small`,{children:`用户 ID`}),(0,I.jsx)(`code`,{className:`mono`,children:e.UserId||`-`})]}),e.UpdatedAt&&(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`small`,{children:`更新时间`}),V(e.UpdatedAt)]})]})]})})]}),t===`messages`&&(0,I.jsxs)(`section`,{className:`channels-page__chat-view`,"aria-label":`消息记录`,children:[(0,I.jsxs)(`aside`,{className:`channels-page__chat-sidebar`,children:[(0,I.jsxs)(`div`,{className:`channels-page__chat-sidebar-header`,children:[(0,I.jsx)(`span`,{children:`会话列表`}),(0,I.jsx)(`span`,{className:`channels-page__chat-sidebar-count`,children:Q.length})]}),(0,I.jsx)(`div`,{className:`channels-page__chat-sidebar-list`,children:Q.length===0?(0,I.jsxs)(`div`,{className:`channels-page__chat-empty`,children:[(0,I.jsx)(ne,{size:22}),(0,I.jsx)(`p`,{children:`没有消息记录`}),(0,I.jsx)(`span`,{children:`渠道接入并产生对话后,消息将出现在这里。`})]}):Q.map(e=>(0,I.jsxs)(`button`,{className:`channels-page__chat-item${pt===e.id?` active`:``}`,type:`button`,onClick:()=>mt(e.id),children:[(0,I.jsx)(`div`,{className:`channels-page__chat-item-avatar`,children:(0,I.jsx)(`span`,{className:`channel-platform-tag`,"data-platform":e.channel,children:z[e.channel]})}),(0,I.jsxs)(`div`,{className:`channels-page__chat-item-body`,children:[(0,I.jsxs)(`div`,{className:`channels-page__chat-item-top`,children:[(0,I.jsx)(`span`,{className:`channels-page__chat-item-name`,children:e.title}),(0,I.jsx)(`span`,{className:`channels-page__chat-item-time`,children:Pe(e.lastMessage.CreatedAt)})]}),(0,I.jsxs)(`div`,{className:`channels-page__chat-item-bottom`,children:[(0,I.jsxs)(`span`,{className:`channels-page__chat-item-preview`,children:[e.lastMessage.Direction===`outbound`?`↗ `:``,Ie(e.lastMessage)]}),(0,I.jsx)(`span`,{className:`channels-page__chat-item-badge`,children:e.messageCount})]})]})]},e.id))})]}),(0,I.jsx)(`div`,{className:`channels-page__chat-main`,children:$?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`channels-page__chat-header`,children:[(0,I.jsxs)(`div`,{className:`channels-page__chat-header-info`,children:[(0,I.jsx)(`span`,{className:`channel-platform-tag`,"data-platform":$.channel,children:z[$.channel]}),(0,I.jsx)(`span`,{className:`channels-page__chat-header-name`,children:$.title}),(0,I.jsxs)(`span`,{className:`channels-page__chat-header-meta`,children:[R[$.channel],` · `,$.channelAccountId,$.senderId&&` · ${$.senderId}`]})]}),(0,I.jsxs)(`span`,{className:`channels-page__chat-header-count`,children:[$.messageCount,` 条消息`]})]}),(0,I.jsx)(`div`,{className:`channels-page__chat-body`,ref:ht,children:$.messages.map((e,t)=>{let n=t>0?$.messages[t-1]:null,r=!n||Fe(n.CreatedAt)!==Fe(e.CreatedAt),i=e.Direction===`inbound`?Le(e):``;return(0,I.jsxs)(`div`,{children:[r&&(0,I.jsx)(`div`,{className:`channels-page__chat-date-sep`,children:Fe(e.CreatedAt)}),(0,I.jsxs)(`div`,{className:`channels-page__chat-bubble ${e.Direction}`,children:[e.Direction===`inbound`&&i&&(0,I.jsx)(`div`,{className:`channels-page__chat-bubble-sender`,children:i}),(0,I.jsx)(`div`,{className:`channels-page__chat-bubble-content`,children:Ie(e)}),(0,I.jsx)(`div`,{className:`channels-page__chat-bubble-time`,children:Pe(e.CreatedAt)}),e.Error&&(0,I.jsx)(`div`,{className:`channels-page__chat-bubble-error`,children:(0,I.jsx)(`span`,{className:`badge`,"data-state":`failed`,children:e.Error})})]})]},e.Id)})})]}):(0,I.jsxs)(`div`,{className:`channels-page__chat-empty channels-page__chat-empty--center`,children:[(0,I.jsx)(l,{size:32}),(0,I.jsx)(`p`,{children:`选择左侧会话查看聊天记录`})]})})]}),ve&&(0,I.jsx)(v,{title:Z?`编辑渠道`:`新建渠道`,subtitle:`配置消息平台接入信息与对话策略。`,wide:!0,closeDisabled:M,onClose:()=>j(!1),footer:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`drawer-footer-spacer`}),(0,I.jsx)(`button`,{className:`button tertiary`,type:`button`,onClick:()=>j(!1),disabled:M,children:`取消`}),(0,I.jsx)(`button`,{className:`button accent`,type:`submit`,form:`channel-create-form`,disabled:M||!Wt,children:M?`正在保存`:Z?`保存`:`创建`})]}),children:(0,I.jsxs)(`form`,{id:`channel-create-form`,className:`channels-page__create-form`,onSubmit:jt,children:[(0,I.jsxs)(`div`,{className:`channels-page__form-section`,children:[(0,I.jsx)(`div`,{className:`channels-page__form-section-title`,"data-step":`1`,children:`选择平台`}),(0,I.jsx)(`div`,{className:`channels-page__platform-cards`,children:Te.map(({value:e,label:t,desc:n,Icon:r})=>(0,I.jsxs)(`button`,{type:`button`,className:`channels-page__platform-card${N.Channel===e?` selected`:``}`,onClick:()=>P(t=>({...t,Channel:e})),children:[(0,I.jsx)(`span`,{className:`channels-page__platform-card-icon`,children:(0,I.jsx)(r,{size:22})}),(0,I.jsxs)(`span`,{className:`channels-page__platform-card-text`,children:[(0,I.jsx)(`span`,{className:`channels-page__platform-card-name`,children:t}),(0,I.jsx)(`span`,{className:`channels-page__platform-card-desc`,children:n})]}),N.Channel===e&&(0,I.jsx)(s,{size:14,className:`channels-page__platform-card-check`})]},e))})]}),(0,I.jsxs)(`div`,{className:`channels-page__form-section`,children:[(0,I.jsx)(`div`,{className:`channels-page__form-section-title`,"data-step":`2`,children:`接入配置`}),(0,I.jsxs)(`div`,{className:`channels-page__form-grid`,children:[(0,I.jsx)(`div`,{className:`channels-page__form-col-12`,children:(0,I.jsx)(b,{label:`渠道账号 ID`,htmlFor:`channel-account-id`,requirement:`required`,children:(0,I.jsx)(`input`,{id:`channel-account-id`,value:N.ChannelAccountId,onChange:e=>P(t=>({...t,ChannelAccountId:e.target.value})),placeholder:`如:wps-default`,required:!0})})}),(0,I.jsx)(`div`,{className:`channels-page__form-col-6`,children:(0,I.jsx)(b,{label:`App ID`,htmlFor:`channel-app-id`,requirement:Z?`optional`:`required`,children:(0,I.jsx)(`input`,{id:`channel-app-id`,value:N.AppId,onChange:e=>P(t=>({...t,AppId:e.target.value})),placeholder:Z?`留空则不修改`:`平台分配的应用 ID`})})}),(0,I.jsx)(`div`,{className:`channels-page__form-col-6`,children:(0,I.jsx)(b,{label:`App Secret`,htmlFor:`channel-app-secret`,requirement:Z?`optional`:`required`,children:(0,I.jsx)(`input`,{id:`channel-app-secret`,type:`password`,value:N.AppSecret,onChange:e=>P(t=>({...t,AppSecret:e.target.value})),placeholder:Z?`留空则不修改`:`平台分配的应用密钥`})})})]})]}),(0,I.jsxs)(`div`,{className:`channels-page__form-section`,children:[(0,I.jsx)(`div`,{className:`channels-page__form-section-title`,"data-step":`3`,children:`Agent 绑定`}),(0,I.jsxs)(`div`,{className:`channels-page__form-grid`,children:[(0,I.jsx)(`div`,{className:`channels-page__form-col-12`,children:(0,I.jsx)(b,{label:`Agent`,htmlFor:`channel-agent`,requirement:`required`,children:(0,I.jsx)(m,{id:`channel-agent`,ariaLabel:`绑定 Agent`,options:Tt,value:N.AgentId?JSON.stringify([N.ConnectorWorkspaceId,N.AgentId]):``,placeholder:`选择要绑定的 Agent`,onValueChange:e=>{let[t,n]=JSON.parse(e);P(e=>({...e,AgentId:n,ConnectorWorkspaceId:t}))}})})}),(0,I.jsx)(`div`,{className:`channels-page__form-col-6`,children:(0,I.jsxs)(`label`,{className:`channel-toggle-row`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:N.Enabled,onChange:e=>P(t=>({...t,Enabled:e.target.checked}))}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`strong`,{children:`启用渠道`}),(0,I.jsx)(`small`,{children:`停用后渠道不再接收和发送消息`})]})]})})]})]}),(0,I.jsx)(`div`,{className:`channels-page__advanced-toggle`,children:(0,I.jsxs)(`button`,{type:`button`,className:`channels-page__advanced-header`,onClick:()=>L(e=>!e),"aria-expanded":Se,children:[(0,I.jsx)(_,{size:16,className:`channels-page__chevron${Se?``:` channels-page__chevron--closed`}`}),(0,I.jsx)(se,{size:16}),(0,I.jsx)(`span`,{children:`高级设置`}),(0,I.jsx)(`small`,{children:`私聊策略、群聊策略、会话隔离等`})]})}),Se&&(0,I.jsxs)(`div`,{className:`channels-page__advanced-body`,children:[(0,I.jsxs)(`div`,{className:`channels-page__advanced-section`,children:[(0,I.jsx)(`div`,{className:`channels-page__advanced-section-title`,children:`策略设置`}),(0,I.jsxs)(`div`,{className:`channels-page__form-grid`,children:[(0,I.jsx)(`div`,{className:`channels-page__form-col-6`,children:(0,I.jsx)(b,{label:`私聊策略`,children:(0,I.jsx)(m,{ariaLabel:`私聊策略`,value:N.DmPolicy,options:De,onValueChange:e=>P(t=>({...t,DmPolicy:e}))})})}),(0,I.jsx)(`div`,{className:`channels-page__form-col-6`,children:(0,I.jsx)(b,{label:`群聊策略`,children:(0,I.jsx)(m,{ariaLabel:`群聊策略`,value:N.GroupPolicy,options:ke,onValueChange:e=>P(t=>({...t,GroupPolicy:e}))})})})]})]}),(0,I.jsxs)(`div`,{className:`channels-page__advanced-section`,children:[(0,I.jsx)(`div`,{className:`channels-page__advanced-section-title`,children:`会话设置`}),(0,I.jsxs)(`div`,{className:`channels-page__form-grid`,children:[(0,I.jsx)(`div`,{className:`channels-page__form-col-6`,children:(0,I.jsx)(b,{label:`会话隔离`,children:(0,I.jsx)(m,{ariaLabel:`会话隔离`,value:N.SessionScope,options:Ae,onValueChange:e=>P(t=>({...t,SessionScope:e}))})})}),(0,I.jsx)(`div`,{className:`channels-page__form-col-6`,children:(0,I.jsxs)(`label`,{className:`channel-toggle-row channel-toggle-row--compact`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:N.RequireMention,onChange:e=>P(t=>({...t,RequireMention:e.target.checked}))}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`strong`,{children:`要求 @机器人`}),(0,I.jsx)(`small`,{children:`群聊中需 @机器人才会触发响应`})]})]})})]})]}),(0,I.jsx)(`div`,{className:`channels-page__advanced-section`,children:(0,I.jsx)(b,{label:`扩展配置`,htmlFor:`channel-config-json`,hint:`JSON 格式的扩展配置,默认为空对象 {}`,children:(0,I.jsx)(`textarea`,{id:`channel-config-json`,value:N.ConfigJson,onChange:e=>P(t=>({...t,ConfigJson:e.target.value})),placeholder:`{}`,rows:4,className:`channels-page__config-textarea`})})})]})]})}),B&&(0,I.jsx)(h,{title:`删除渠道`,description:`确定要删除「${R[B.Channel]} · ${B.ChannelAccountId}」吗?已绑定的会话将断开连接。`,confirmText:`删除`,danger:!0,busy:Be,onConfirm:Mt,onCancel:()=>ze(null)}),U&&(0,I.jsx)(h,{title:`解绑会话`,description:`解绑后该用户下次发消息将重新走配对流程,确认解绑?`,confirmText:`解绑`,danger:!0,busy:Ue,onConfirm:Nt,onCancel:()=>He(null)}),Ge&&(0,I.jsxs)(u,{open:!0,onOpenChange:e=>{!e&&!W&&Ke(null)},title:`编辑会话绑定`,closeDisabled:W,footer:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{className:`button tertiary`,type:`button`,onClick:()=>Ke(null),disabled:W,children:`取消`}),(0,I.jsx)(`button`,{className:`button accent`,type:`button`,onClick:It,disabled:W,children:W?`处理中…`:`关联`})]}),children:[(0,I.jsx)(b,{label:`关联会话`,htmlFor:`edit-binding-session`,requirement:`required`,children:(0,I.jsx)(m,{ariaLabel:`选择会话`,value:qe,options:Et,onValueChange:e=>Je(e)})}),(0,I.jsx)(`p`,{className:`channels-page__form-hint`,children:`将此绑定关联到 Studio 中的会话,用户在 IM 发送的消息将使用此 SessionId 调用 Agent Runtime,实现 Studio 会话和 IM 会话的互通。`})]}),G&&(0,I.jsxs)(u,{open:!0,onOpenChange:e=>{!e&&!K&&et(null)},title:`接管会话`,closeDisabled:K,footer:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{className:`button tertiary`,type:`button`,onClick:()=>et(null),disabled:K,children:`取消`}),(0,I.jsx)(`button`,{className:`button accent`,type:`button`,onClick:Pt,disabled:K,children:K?`处理中…`:`确认接管`})]}),children:[(0,I.jsxs)(`div`,{className:`form-grid`,children:[(0,I.jsx)(b,{label:`接管人名称`,htmlFor:`takeover-name`,children:(0,I.jsx)(`input`,{id:`takeover-name`,value:rt,onChange:e=>it(e.target.value),placeholder:`Admin`})}),(0,I.jsx)(b,{label:`接管原因`,htmlFor:`takeover-reason`,children:(0,I.jsx)(`input`,{id:`takeover-reason`,value:tt,onChange:e=>nt(e.target.value),placeholder:`可选`})})]}),(0,I.jsx)(`p`,{className:`channels-page__form-hint`,children:`接管后,该会话的 IM 消息将不再自动触发 Agent 回复,直到释放接管。`})]}),ot&&(0,I.jsx)(h,{title:`释放接管`,description:`释放后该会话将恢复 Agent 自动回复,确认释放?`,busy:ct,onConfirm:Ft,onCancel:()=>st(null)}),gt&&(0,I.jsx)(u,{open:!0,onOpenChange:e=>{!e&&!vt&&At()},title:`扫码连接`,icon:(0,I.jsx)(oe,{size:18}),closeDisabled:vt,footer:(0,I.jsx)(`button`,{className:`button tertiary`,type:`button`,onClick:At,disabled:vt,children:`关闭`}),children:vt?(0,I.jsx)(`div`,{className:`channels-page__qr-loading`,children:`正在获取二维码…`}):X&&!X.QrUrl?(0,I.jsx)(`div`,{className:`channels-page__qr-empty`,children:`该平台不支持扫码连接`}):(0,I.jsxs)(`div`,{className:`channels-page__qr-content`,children:[xt&&(0,I.jsx)(`img`,{src:xt,alt:`扫码连接二维码`,className:`channels-page__qr-image`,width:200,height:200}),X?.Label&&(0,I.jsx)(`p`,{className:`channels-page__qr-label`,children:X.Label})]})}),q&&J&&(0,I.jsx)(h,{title:J===`approve`?`通过配对请求`:`拒绝配对请求`,description:J===`approve`?`确定要通过「${q.SenderName}」的配对请求吗?通过后用户即可绑定该渠道。`:`确定要拒绝「${q.SenderName}」的配对请求吗?拒绝后用户需重新发起配对。`,confirmText:J===`approve`?`通过`:`拒绝`,danger:J===`reject`,busy:dt,onConfirm:Lt,onCancel:()=>{ut(null),Y(null)}})]})}export{ze as ChannelsPage};