From 279950b9041b66f993e8bb8ff837f503be3713b1 Mon Sep 17 00:00:00 2001 From: Lihua <1017343802@qq.com> Date: Mon, 14 Sep 2026 00:20:42 -0700 Subject: [PATCH 1/9] feat(manager): reconcile uncertain result delivery Signed-off-by: Lihua <1017343802@qq.com> --- loopx/capabilities/manager_context/README.md | 10 + .../capabilities/manager_context/roundtrip.py | 231 +++++++++++- loopx/chat_server.py | 10 +- loopx/extensions/lark/inbox_reply.py | 347 ++++++++++++++---- loopx/extensions/lark/manager_returns.py | 197 +++++++--- tests/extensions/test_lark_inbox_reactions.py | 75 ++++ tests/extensions/test_lark_markdown_reply.py | 59 ++- tests/test_manager_context_roundtrip.py | 199 +++++++++- 8 files changed, 974 insertions(+), 154 deletions(-) diff --git a/loopx/capabilities/manager_context/README.md b/loopx/capabilities/manager_context/README.md index fd3bb4550d..73fe555a1a 100644 --- a/loopx/capabilities/manager_context/README.md +++ b/loopx/capabilities/manager_context/README.md @@ -168,6 +168,16 @@ sending, and never retargets a closed/replaced conversation. An offline transpor retries the persisted answer rather than rerunning the worker. Ambiguous external writes remain `verification_required` and are not blindly resent. +When the provider returned a trustworthy message locator before readback failed, +the same background pump persists that private attempt and later performs a +read-only verification. A matching message advances the original delivery to +`delivered` without sending again. Provider outages retain +`verification_required`; a missing legacy locator, changed intent, missing +message, or verified mismatch becomes `explicit_unverified`. CLI, Manager read, +and Chat expose the same public-safe state and reason without returning the +provider locator. The Lark adapter keeps locator interpretation and provider +readback; `manager-context` remains the sole result/delivery writer. + New handoffs persist their exact original return route. Legacy requests remain queryable; a receiver can explicitly report one only when its exact persisted Chat receipt uniquely recovers the route. Historical timestamps stay unknown. diff --git a/loopx/capabilities/manager_context/roundtrip.py b/loopx/capabilities/manager_context/roundtrip.py index 69a70cb1b5..0d7e0a2489 100644 --- a/loopx/capabilities/manager_context/roundtrip.py +++ b/loopx/capabilities/manager_context/roundtrip.py @@ -7,6 +7,7 @@ from __future__ import annotations import logging +import re import threading from datetime import datetime, timezone, timedelta @@ -16,6 +17,54 @@ from ...presentation.public_safety import scan_public_boundary_text PHASES = ("decision", "conclusion") +DELIVERY_ATTEMPT_SCHEMA = "manager_return_delivery_attempt_v0" +_PROVIDER = re.compile(r"[a-z][a-z0-9_-]{0,31}") +_OPAQUE_REF = re.compile(r"[A-Za-z0-9][A-Za-z0-9._:-]{0,511}") +_DIGEST = re.compile(r"sha256:[0-9a-f]{64}") + + +def _delivery_attempt(value): + if not isinstance(value, dict) or set(value) != { + "schema_version", + "provider", + "message_ref", + "intent_digest", + "provider_receipt", + }: + raise ValueError("invalid manager return delivery attempt") + if value.get("schema_version") != DELIVERY_ATTEMPT_SCHEMA: + raise ValueError("invalid manager return delivery attempt") + if not _PROVIDER.fullmatch(str(value.get("provider") or "")): + raise ValueError("invalid manager return delivery attempt") + if not _OPAQUE_REF.fullmatch(str(value.get("message_ref") or "")): + raise ValueError("invalid manager return delivery attempt") + if not _DIGEST.fullmatch(str(value.get("intent_digest") or "")): + raise ValueError("invalid manager return delivery attempt") + if not _DIGEST.fullmatch(str(value.get("provider_receipt") or "")): + raise ValueError("invalid manager return delivery attempt") + return dict(value) + + +def _verification_error(outcome): + blocker = str(outcome.get("blocker") or "") + if blocker in { + "provider_delivery_intent_conflict", + "provider_message_missing", + "provider_verification_unavailable", + }: + return blocker + return "provider_delivery_mismatch" + + +def _verification_exception_error(exc): + message = str(exc) + if "authorization" in message or "authorized" in message: + return "return_authorization_unavailable" + if any(token in message for token in ("conversation", "route", "binding", "target")): + return "original_route_unavailable" + if "initial reply" in message or "initial_receipt" in message: + return "initial_delivery_receipt_unavailable" + return None def register(root, row, session, turn): @@ -133,18 +182,53 @@ def reply_status(root, row): reply = _read(path) state_path = path.with_name(phase + ".delivery.json") state = _read(state_path) if state_path.exists() else {} - result.append( - { - "phase": phase, - "status": state.get("status", "queued"), - "created_at": reply.get("created_at"), - "delivered_at": state.get("delivered_at"), - "error": state.get("error"), - } - ) + item = { + "phase": phase, + "status": state.get("status", "queued"), + "created_at": reply.get("created_at"), + "delivered_at": state.get("delivered_at"), + "error": state.get("error"), + } + if state.get("verification") == "reconciled_after_restart": + item["verification"] = "reconciled_after_restart" + result.append(item) return result +def project_chat_return_deliveries(root, session_id, messages): + """Attach public-safe delivery readback to returned Chat transcript rows.""" + + statuses = {} + paths = sorted((_root(root) / "roundtrips").glob("*.json")) + for path in paths[:2000]: + try: + route = _read(path) + if route.get("session_id") != session_id: + continue + request_id = str(route.get("request_id") or "") + if path.stem != request_id or not re.fullmatch(r"[a-f0-9]{64}", request_id): + continue + for item in reply_status(root, route): + phase = item.get("phase") + if phase not in PHASES: + continue + message_id = "handoff." + _hash([request_id, phase]) + statuses[message_id] = { + "schema_version": "manager_return_delivery_status_v0", + **item, + } + except (OSError, ValueError, KeyError, TypeError): + continue + return [ + ( + {**message, "return_delivery": statuses[message.get("message_id")]} + if message.get("message_id") in statuses + else message + ) + for message in messages + ] + + def drain(root, registry, store, external_sender, *, now=None, cancelled=lambda: False): """Restart-safe return delivery; transport retries never rerun the worker/model.""" now = now or datetime.now(timezone.utc) @@ -163,11 +247,7 @@ def drain(root, registry, store, external_sender, *, now=None, cancelled=lambda: # it blindly, and do not starve unrelated pending returns. logging.getLogger(__name__).warning("Unreadable manager return receipt") continue - if state.get("status") in { - "delivered", - "superseded", - "verification_required", - }: + if state.get("status") in {"delivered", "superseded", "explicit_unverified"}: continue if state.get("retry_at") and now.isoformat() < state["retry_at"]: continue @@ -231,17 +311,116 @@ def drain(root, registry, store, external_sender, *, now=None, cancelled=lambda: return processed transport = {} if route["channel_id"] != "manager": - sent = external_sender(route, session, turn, text) - if sent.get("reply_verified") is not True: - if sent.get("external_write_performed") is True: + if state.get("status") == "verification_required": + try: + attempt = _delivery_attempt(state.get("attempt")) + except ValueError: + _write( + state_path, + { + "status": "explicit_unverified", + "error": "provider_locator_unavailable", + }, + ) + continue + verifier = getattr(external_sender, "verify", None) + if not callable(verifier): _write( state_path, { - "status": "verification_required", - "error": "provider_delivery_unverified", + "status": "explicit_unverified", + "error": "provider_verifier_unavailable", }, ) continue + verified = verifier(route, session, turn, text, attempt) + if ( + isinstance(verified, dict) + and verified.get("verification_performed") is True + and verified.get("reply_verified") is True + ): + _write( + state_path, + { + "status": "delivered", + "delivered_at": now.isoformat(), + "message_id": mid, + "provider_receipt": attempt["provider_receipt"], + "reply_verified": True, + "verification": "reconciled_after_restart", + }, + ) + continue + if ( + isinstance(verified, dict) + and verified.get("verification_performed") is True + ): + _write( + state_path, + { + "status": "explicit_unverified", + "error": _verification_error(verified), + }, + ) + continue + attempts = int(state.get("attempts", 0)) + 1 + _write( + state_path, + { + **state, + "status": "verification_required", + "attempts": attempts, + "error": "provider_verification_unavailable", + "retry_at": ( + now + + timedelta( + seconds=min(300, 5 * 2 ** min(attempts, 6)) + ) + ).isoformat(), + }, + ) + continue + + def record_attempt(value): + attempt = _delivery_attempt(value) + current = _read(state_path) if state_path.exists() else {} + existing = current.get("attempt") + if existing is not None and _delivery_attempt(existing) != attempt: + raise ValueError("manager return delivery attempt conflict") + _write( + state_path, + { + "status": "verification_required", + "error": "provider_delivery_unverified", + "attempt": attempt, + }, + ) + + sender = getattr(external_sender, "send_with_attempt", None) + sent = ( + sender(route, session, turn, text, record_attempt) + if callable(sender) + else external_sender(route, session, turn, text) + ) + if sent.get("reply_verified") is not True: + if sent.get("external_write_performed") is True: + current = _read(state_path) if state_path.exists() else {} + _write( + state_path, + ( + { + **current, + "status": "verification_required", + "error": "provider_delivery_unverified", + } + if current.get("attempt") is not None + else { + "status": "explicit_unverified", + "error": "provider_locator_unavailable", + } + ), + ) + continue raise ValueError("return_transport_unavailable") transport = { "provider_receipt": sent.get("idempotency_key"), @@ -256,7 +435,19 @@ def drain(root, registry, store, external_sender, *, now=None, cancelled=lambda: **transport, }, ) - except (OSError, ValueError, KeyError, TypeError, RuntimeError): + except (OSError, ValueError, KeyError, TypeError, RuntimeError) as exc: + current = _read(state_path) if state_path.exists() else {} + if current.get("status") == "verification_required" and current.get( + "attempt" + ) is not None: + error = _verification_exception_error(exc) + if error: + _write( + state_path, + {"status": "explicit_unverified", "error": error}, + ) + processed += 1 + continue attempts = int(state.get("attempts", 0)) + 1 _write( state_path, diff --git a/loopx/chat_server.py b/loopx/chat_server.py index 32ec182d90..57f2ce7f78 100644 --- a/loopx/chat_server.py +++ b/loopx/chat_server.py @@ -758,7 +758,15 @@ def _session_turn(self, session_id: str) -> None: def _session_snapshot(self, session_id: str) -> None: try: - self._send_json(self.server.chat_store.session_snapshot(session_id)) + snapshot = self.server.chat_store.session_snapshot(session_id) + from .capabilities.manager_context.roundtrip import ( + project_chat_return_deliveries, + ) + + snapshot["messages"] = project_chat_return_deliveries( + self.server.runtime_root, session_id, snapshot["messages"] + ) + self._send_json(snapshot) except KeyError: self._send_error("chat session was not found", status=404) diff --git a/loopx/extensions/lark/inbox_reply.py b/loopx/extensions/lark/inbox_reply.py index 15963e9fbe..60ddea7711 100644 --- a/loopx/extensions/lark/inbox_reply.py +++ b/loopx/extensions/lark/inbox_reply.py @@ -104,6 +104,78 @@ def _message(value: Any, message_id: str) -> Mapping[str, Any] | None: return None +def _intent_digest(profile: str, chat_id: str, receipt: str) -> str: + return "sha256:" + hashlib.sha256( + json.dumps([profile, chat_id, receipt]).encode("utf-8") + ).hexdigest() + + +def _verified_mention_aliases( + *, + runner: CommandRunner, + base: Sequence[str], + chat_id: str, + reply_text: str, +) -> tuple[dict[str, str] | None, str | None]: + expected_mentions = expected_lark_mention_identities(reply_text) + if not expected_mentions: + return {}, None + member_identity_sets: dict[str, set[str]] = {} + bot_alias_candidates: dict[str, set[str]] = {} + for identity_kind in sorted(set(expected_mentions.values())): + expected_identities = { + identity + for identity, declared_kind in expected_mentions.items() + if declared_kind == identity_kind + } + members = _call( + runner, + [ + *base, + "im", + "+chat-members-list", + "--chat-id", + chat_id, + "--member-types", + "user,bot", + "--member-id-type", + identity_kind, + "--page-all", + "--as", + "bot", + "--format", + "json", + ], + ) + if members.get("returncode") != 0: + return None, "lark_inbox_reply_mention_identity_unresolved" + member_payload = _json_object(members.get("stdout")) + member_identity_sets[identity_kind] = lark_member_identities(member_payload) + member_data = member_payload.get("data", member_payload) + bots = member_data.get("bots", []) if isinstance(member_data, Mapping) else [] + for member in bots if isinstance(bots, list) else []: + if not isinstance(member, Mapping): + continue + app_id, member_id = member.get("app_id"), member.get("member_id") + if ( + isinstance(app_id, str) + and app_id + and isinstance(member_id, str) + and member_id in expected_identities + ): + bot_alias_candidates.setdefault(app_id, set()).add(member_id) + if any( + identity not in member_identity_sets.get(identity_kind, set()) + for identity, identity_kind in expected_mentions.items() + ): + return None, "lark_inbox_reply_mention_identity_unresolved" + return { + app_id: next(iter(identities)) + for app_id, identities in bot_alias_candidates.items() + if len(identities) == 1 and next(iter(identities)) in expected_mentions + }, None + + def _bot_identity_verification( *, runner: CommandRunner, @@ -207,6 +279,7 @@ def _deliver_lark_inbox_outbound( provider_preflight: bool = False, runner: CommandRunner = _default_runner, before_send: Callable[[str], Mapping[str, Any]] | None = None, + delivery_attempt_recorder: Callable[[Mapping[str, str]], None] | None = None, ) -> dict[str, Any]: """Deliver through one inbox-configured bot with exact provider readback.""" @@ -339,71 +412,21 @@ def _deliver_lark_inbox_outbound( format_preflight_passed=True, ) - expected_mentions = expected_lark_mention_identities(reply_text) - bot_alias_candidates: dict[str, set[str]] = {} - if expected_mentions: - member_identity_sets: dict[str, set[str]] = {} - membership_failed = False - for identity_kind in sorted(set(expected_mentions.values())): - expected_identities = { - identity - for identity, declared_kind in expected_mentions.items() - if declared_kind == identity_kind - } - members = _call( - runner, - base - + [ - "im", - "+chat-members-list", - "--chat-id", - chat_id, - "--member-types", - "user,bot", - "--member-id-type", - identity_kind, - "--page-all", - "--as", - "bot", - "--format", - "json", - ], - ) - if members.get("returncode") != 0: - membership_failed = True - break - member_payload = _json_object(members.get("stdout")) - member_identity_sets[identity_kind] = lark_member_identities(member_payload) - member_data = member_payload.get("data", member_payload) - bots = ( - member_data.get("bots", []) if isinstance(member_data, Mapping) else [] - ) - for member in bots if isinstance(bots, list) else []: - if not isinstance(member, Mapping): - continue - app_id, member_id = member.get("app_id"), member.get("member_id") - if ( - isinstance(app_id, str) - and app_id - and isinstance(member_id, str) - and member_id in expected_identities - ): - bot_alias_candidates.setdefault(app_id, set()).add(member_id) - if membership_failed or any( - identity not in member_identity_sets.get(identity_kind, set()) - for identity, identity_kind in expected_mentions.items() - ): - return _result( - status="gate_required", - ok=False, - execute=execute, - receipt=receipt, - identity_verified=True, - membership_verified=True, - placement=placement, - blocker="lark_inbox_reply_mention_identity_unresolved", - format_preflight_passed=True, - ) + bot_aliases, mention_error = _verified_mention_aliases( + runner=runner, base=base, chat_id=chat_id, reply_text=reply_text + ) + if mention_error: + return _result( + status="gate_required", + ok=False, + execute=execute, + receipt=receipt, + identity_verified=True, + membership_verified=True, + placement=placement, + blocker=mention_error, + format_preflight_passed=True, + ) content_args = ( ["--msg-type", "post", "--content", lark_markdown_post_content(reply_text)] @@ -478,6 +501,7 @@ def _deliver_lark_inbox_outbound( project=project, config_path=config_path, message_id=message_id, text=text, content_format="text", execute=execute, provider_preflight=provider_preflight, runner=runner, before_send=before_send, + delivery_attempt_recorder=delivery_attempt_recorder, ) result.update(content_format="text", format_fallback="post_size_limit") return result @@ -485,12 +509,7 @@ def _deliver_lark_inbox_outbound( if before_send is not None: # Bind review to destination/profile as well as content and placement. # The optional binder hashes the verified destination before retrieval. - intent_digest = ( - "sha256:" - + hashlib.sha256( - json.dumps([profile, chat_id, receipt]).encode("utf-8") - ).hexdigest() - ) + intent_digest = _intent_digest(profile, chat_id, receipt) bind_destination = getattr(before_send, "for_destination", None) scoped_hook = bind_destination(chat_id) if bind_destination else before_send guidance = scoped_hook(intent_digest) @@ -558,6 +577,17 @@ def _deliver_lark_inbox_outbound( provider_preview_performed=True, provider_preview_verified=True, ) + intent_digest = _intent_digest(profile, chat_id, receipt) + if delivery_attempt_recorder is not None: + delivery_attempt_recorder( + { + "schema_version": "manager_return_delivery_attempt_v0", + "provider": "lark", + "message_ref": reply_message_id, + "intent_digest": intent_digest, + "provider_receipt": receipt, + } + ) readback = _call( runner, base @@ -584,11 +614,7 @@ def _deliver_lark_inbox_outbound( message=readback_message, # mget may report a bot's app_id instead of its member_id. Only # accept an unambiguous mapping verified for the mention's declared kind. - verified_bot_aliases={ - app_id: next(iter(identities)) - for app_id, identities in bot_alias_candidates.items() - if len(identities) == 1 and next(iter(identities)) in expected_mentions - }, + verified_bot_aliases=bot_aliases or {}, )) ) reaction_cleanup = ( @@ -653,6 +679,7 @@ def reply_lark_event_inbox( provider_preflight: bool = False, runner: CommandRunner = _default_runner, before_send: Callable[[str], Mapping[str, Any]] | None = None, + delivery_attempt_recorder: Callable[[Mapping[str, str]], None] | None = None, ) -> dict[str, Any]: """Reply with the explicit inbox-configured bot and placement policy.""" @@ -666,6 +693,7 @@ def reply_lark_event_inbox( provider_preflight=provider_preflight, runner=runner, before_send=before_send, + delivery_attempt_recorder=delivery_attempt_recorder, ) result.setdefault("content_format", "markdown" if content_format == "markdown" @@ -673,6 +701,173 @@ def reply_lark_event_inbox( return result +def verify_lark_inbox_reply( + *, + project: str | Path, + config_path: str | Path, + message_id: str, + text: str, + attempt: Mapping[str, Any], + runner: CommandRunner = _default_runner, +) -> dict[str, Any]: + """Read back one prior Lark reply without sending another message.""" + + if ( + set(attempt) != { + "schema_version", + "provider", + "message_ref", + "intent_digest", + "provider_receipt", + } + or attempt.get("schema_version") != "manager_return_delivery_attempt_v0" + or attempt.get("provider") != "lark" + or not MESSAGE_ID_PATTERN.fullmatch(str(attempt.get("message_ref") or "")) + ): + return { + "ok": False, + "verification_performed": True, + "reply_verified": False, + "blocker": "provider_delivery_intent_conflict", + } + config = load_lark_event_inbox_config(project=project, config_path=config_path) + reply_config = config["reply"] + profile = str(reply_config.get("sender_profile") or "") + chat_id = str(reply_config.get("chat_id") or "") + preview = None + for content_format in ("markdown", "text"): + candidate = reply_lark_event_inbox( + project=project, + config_path=config_path, + message_id=message_id, + text=text, + content_format=content_format, + execute=False, + runner=runner, + ) + receipt = str(candidate.get("idempotency_key") or "") + if ( + attempt.get("provider_receipt") == receipt + and attempt.get("intent_digest") + == _intent_digest(profile, chat_id, receipt) + ): + preview = candidate + break + if preview is None: + return { + "ok": False, + "verification_performed": True, + "reply_verified": False, + "blocker": "provider_delivery_intent_conflict", + } + base = ["lark-cli", "--profile", profile] + if not _bot_identity_verified( + runner=runner, + base=base, + expected_name=str(reply_config.get("bot_display_name") or ""), + ): + return { + "ok": False, + "verification_performed": False, + "reply_verified": False, + "blocker": "provider_verification_unavailable", + } + membership = _call( + runner, + [ + *base, + "im", + "chats", + "get", + "--chat-id", + chat_id, + "--as", + "bot", + "--format", + "json", + ], + ) + if membership.get("returncode") != 0: + return { + "ok": False, + "verification_performed": False, + "reply_verified": False, + "blocker": "provider_verification_unavailable", + } + markdown = preview.get("content_format") == "markdown" + reply_text = normalize_lark_outbound_text(text, limit=None, preserve_format=markdown) + bot_aliases, mention_error = _verified_mention_aliases( + runner=runner, base=base, chat_id=chat_id, reply_text=reply_text + ) + if mention_error: + return { + "ok": False, + "verification_performed": False, + "reply_verified": False, + "blocker": "provider_verification_unavailable", + } + provider_message_id = str(attempt["message_ref"]) + readback = _call( + runner, + [ + *base, + "im", + "+messages-mget", + "--message-ids", + provider_message_id, + "--as", + "bot", + "--no-reactions", + "--format", + "json", + ], + ) + if readback.get("returncode") != 0: + return { + "ok": False, + "verification_performed": False, + "reply_verified": False, + "blocker": "provider_verification_unavailable", + } + message = _message(_json_object(readback.get("stdout")), provider_message_id) + if message is None: + return { + "ok": False, + "verification_performed": True, + "reply_verified": False, + "blocker": "provider_message_missing", + } + verified = ( + lark_markdown_readback_matches(text=reply_text, message=message) + if markdown + else lark_readback_matches_outbound( + outbound_text=reply_text, + message=message, + verified_bot_aliases=bot_aliases or {}, + ) + ) + if not verified: + return { + "ok": False, + "verification_performed": True, + "reply_verified": False, + "blocker": "provider_delivery_mismatch", + } + cleanup = complete_lark_event_inbox_reactions( + project=project, + config_path=config_path, + message_id=message_id, + execute=True, + runner=runner, + ) + return { + "ok": cleanup.get("ok") is True, + "verification_performed": True, + "reply_verified": True, + "reaction_cleanup_verified": cleanup.get("ok") is True, + } + + def send_lark_inbox_message( *, project: str | Path, diff --git a/loopx/extensions/lark/manager_returns.py b/loopx/extensions/lark/manager_returns.py index 068f390220..dd532c1a34 100644 --- a/loopx/extensions/lark/manager_returns.py +++ b/loopx/extensions/lark/manager_returns.py @@ -7,10 +7,57 @@ from .goal_topic_runtime import _inbox_config from .manager_routing import authorized_manager_goal_ids from .event_inbox import load_lark_event_inbox_config, _load_processed -from .inbox_reply import reply_lark_event_inbox +from .inbox_reply import reply_lark_event_inbox, verify_lark_inbox_reply from ...capabilities.manager_context import authority +def _resolve_return( + *, root, registry, snapshot_provider, route, session, turn, cancelled +): + if cancelled(): + raise ValueError("manager return service stopped") + snapshot = snapshot_provider() + # Validate live binding/session independently of the worker's target Goal. + # Delegation grants permit only this request's audience-ready reply. + if not authorized_manager_goal_ids(snapshot, session, runtime_root=root): + raise ValueError("manager connection no longer authorized") + target = {k: route[k] for k in ("goal_id", "agent_id")} + grant = authority(root, registry, session, turn) + if ( + target not in grant["targets"] + or grant.get("source_id") != route["source_id"] + ): + raise ValueError("context return authority revoked") + matches = [] + for gid, payload in snapshot.get("binding_payloads", {}).items(): + for binding in bindings_for_goal(payload, gid): + if ( + binding.get("enabled") is True + and binding.get("session_id") == route["session_id"] + and (binding.get("routing") or {}).get("conversation_kind") + == "manager" + ): + matches.append(binding) + if len(matches) != 1: + raise ValueError("manager return binding ambiguous") + binding = matches[0] + target_config = goal_channel_target_for_name( + snapshot["target_payload"], binding["target_ref"] + ) + if not target_config or target_config.get("enabled") is not True: + raise ValueError("manager return target disabled") + routing = { + "target_ref": binding["target_ref"], + "conversation_kind": "manager", + "app_ref": (target_config.get("identity") or {}).get("sender_profile") + or "default", + "topic_root_message_id": (binding.get("topic") or {}).get("root_message_id") + or (binding.get("channel") or {}).get("pinned_message_id") + or "", + } + return snapshot, routing, target_config + + def send_return( *, root, @@ -22,50 +69,18 @@ def send_return( text, runner=None, cancelled=lambda: False, + delivery_attempt_recorder=None, ): def resolve(): - if cancelled(): - raise ValueError("manager return service stopped") - snapshot = snapshot_provider() - # Validate live binding/session independently of the worker's target Goal. - # Delegation grants permit only this request's audience-ready reply. - if not authorized_manager_goal_ids(snapshot, session, runtime_root=root): - raise ValueError("manager connection no longer authorized") - target = {k: route[k] for k in ("goal_id", "agent_id")} - grant = authority(root, registry, session, turn) - if ( - target not in grant["targets"] - or grant.get("source_id") != route["source_id"] - ): - raise ValueError("context return authority revoked") - matches = [] - for gid, payload in snapshot.get("binding_payloads", {}).items(): - for binding in bindings_for_goal(payload, gid): - if ( - binding.get("enabled") is True - and binding.get("session_id") == route["session_id"] - and (binding.get("routing") or {}).get("conversation_kind") - == "manager" - ): - matches.append(binding) - if len(matches) != 1: - raise ValueError("manager return binding ambiguous") - binding = matches[0] - target_config = goal_channel_target_for_name( - snapshot["target_payload"], binding["target_ref"] + return _resolve_return( + root=root, + registry=registry, + snapshot_provider=snapshot_provider, + route=route, + session=session, + turn=turn, + cancelled=cancelled, ) - if not target_config or target_config.get("enabled") is not True: - raise ValueError("manager return target disabled") - routing = { - "target_ref": binding["target_ref"], - "conversation_kind": "manager", - "app_ref": (target_config.get("identity") or {}).get("sender_profile") - or "default", - "topic_root_message_id": (binding.get("topic") or {}).get("root_message_id") - or (binding.get("channel") or {}).get("pinned_message_id") - or "", - } - return snapshot, routing, target_config snapshot, routing, target_config = resolve() config_path, _ = _inbox_config( @@ -88,28 +103,100 @@ def before_send(_intent): content_format="markdown", execute=True, before_send=before_send, + delivery_attempt_recorder=delivery_attempt_recorder, **({"runner": runner} if runner else {}), ) -def start_return_service(server, runtime_root): - """Compose the return pump at the existing Chat/Lark service boundary.""" - from ...capabilities.manager_context.roundtrip import ReturnService +def verify_return( + *, + root, + registry, + snapshot_provider, + route, + session, + turn, + text, + attempt, + runner=None, + cancelled=lambda: False, +): + snapshot, routing, _target_config = _resolve_return( + root=root, + registry=registry, + snapshot_provider=snapshot_provider, + route=route, + session=session, + turn=turn, + cancelled=cancelled, + ) + config_path, _ = _inbox_config( + runtime_root=root, route=routing, target_payload=snapshot["target_payload"] + ) + message_id = route["source_id"].removeprefix("lark:") + config = load_lark_event_inbox_config(project=root, config_path=config_path) + if message_id not in _load_processed(config["inbox_path"] / "processed.json"): + raise ValueError("initial reply has not been acknowledged") + return verify_lark_inbox_reply( + project=root, + config_path=config_path, + message_id=message_id, + text=text, + attempt=attempt, + **({"runner": runner} if runner else {}), + ) - service = ReturnService( - runtime_root, - server.registry_path, - server.chat_store, - lambda route, session, turn, text: send_return( - root=runtime_root, - registry=server.registry_path, - snapshot_provider=server.lark_goal_topic_runtime.snapshot_provider, + +class LarkManagerReturnTransport: + """Send or read back one saved result through the existing Lark adapter.""" + + def __init__(self, server, root): + self.server = server + self.root = root + self.cancelled = lambda: False + + def _arguments(self): + return { + "root": self.root, + "registry": self.server.registry_path, + "snapshot_provider": self.server.lark_goal_topic_runtime.snapshot_provider, + "cancelled": self.cancelled, + } + + def __call__(self, route, session, turn, text): + return send_return( + **self._arguments(), route=route, session=session, turn=turn, text=text + ) + + def send_with_attempt(self, route, session, turn, text, record_attempt): + return send_return( + **self._arguments(), route=route, session=session, turn=turn, text=text, - cancelled=service.stop.is_set, - ), + delivery_attempt_recorder=record_attempt, + ) + + def verify(self, route, session, turn, text, attempt): + return verify_return( + **self._arguments(), + route=route, + session=session, + turn=turn, + text=text, + attempt=attempt, + ) + + +def start_return_service(server, runtime_root): + """Compose the return pump at the existing Chat/Lark service boundary.""" + from ...capabilities.manager_context.roundtrip import ReturnService + + transport = LarkManagerReturnTransport(server, runtime_root) + service = ReturnService( + runtime_root, server.registry_path, server.chat_store, transport ) + transport.cancelled = service.stop.is_set service.start() return service diff --git a/tests/extensions/test_lark_inbox_reactions.py b/tests/extensions/test_lark_inbox_reactions.py index 23c0e05035..fef5be6f01 100644 --- a/tests/extensions/test_lark_inbox_reactions.py +++ b/tests/extensions/test_lark_inbox_reactions.py @@ -22,6 +22,7 @@ from loopx.extensions.lark.inbox_reply import ( reply_lark_event_inbox, send_lark_inbox_message, + verify_lark_inbox_reply, ) @@ -927,6 +928,80 @@ def test_multiline_readback_must_preserve_line_structure(tmp_path: Path) -> None assert result["reply_verified"] is False +def test_unverified_reply_records_private_locator_and_read_only_recovery( + tmp_path: Path, +) -> None: + config, _, project = _fixture(tmp_path, lifecycle=False) + attempts: list[dict[str, str]] = [] + first_runner = ReplyRunner(matching_readback=False) + + sent = reply_lark_event_inbox( + project=project, + config_path=config, + message_id="om_reaction_fixture", + text="处理完成", + execute=True, + runner=first_runner, + delivery_attempt_recorder=attempts.append, + ) + + assert sent["status"] == "sent_unverified" + assert attempts == [ + { + "schema_version": "manager_return_delivery_attempt_v0", + "provider": "lark", + "message_ref": "om_reply_fixture", + "intent_digest": attempts[0]["intent_digest"], + "provider_receipt": sent["idempotency_key"], + } + ] + assert attempts[0]["intent_digest"].startswith("sha256:") + assert "message_ref" not in sent + + recovery_runner = ReplyRunner() + recovered = verify_lark_inbox_reply( + project=project, + config_path=config, + message_id="om_reaction_fixture", + text="处理完成", + attempt=attempts[0], + runner=recovery_runner, + ) + + assert recovered["reply_verified"] is True + assert recovered["verification_performed"] is True + assert not any( + "+messages-send" in call or "+messages-reply" in call + for call in recovery_runner.calls + ) + + +def test_read_only_recovery_rejects_changed_intent_without_provider_call( + tmp_path: Path, +) -> None: + config, _, project = _fixture(tmp_path, lifecycle=False) + runner = ReplyRunner() + result = verify_lark_inbox_reply( + project=project, + config_path=config, + message_id="om_reaction_fixture", + text="different result", + attempt={ + "schema_version": "manager_return_delivery_attempt_v0", + "provider": "lark", + "message_ref": "om_reply_fixture", + "intent_digest": "sha256:" + "a" * 64, + "provider_receipt": "sha256:" + "b" * 64, + }, + runner=runner, + ) + + assert result["reply_verified"] is False + assert result["verification_performed"] is True + assert result["blocker"] == "provider_delivery_intent_conflict" + assert runner.calls == [] + + def test_verified_reply_accepts_provider_token_or_rendered_mention_name( tmp_path: Path, ) -> None: diff --git a/tests/extensions/test_lark_markdown_reply.py b/tests/extensions/test_lark_markdown_reply.py index 791b199467..69f378c6e7 100644 --- a/tests/extensions/test_lark_markdown_reply.py +++ b/tests/extensions/test_lark_markdown_reply.py @@ -7,7 +7,10 @@ lark_markdown_readback_matches, normalize_lark_outbound_text, safe_lark_plain_text_fallback, ) -from loopx.extensions.lark.inbox_reply import reply_lark_event_inbox +from loopx.extensions.lark.inbox_reply import ( + reply_lark_event_inbox, + verify_lark_inbox_reply, +) from test_lark_inbox_reactions import ReplyRunner, _fixture TEXT = "进展\n\n- **结果**\n - 证据\n\n```python\nif ok:\n done()\n```" @@ -108,6 +111,60 @@ def runner(args): assert sent[0][sent[0].index("--text") + 1] == text.strip() +def test_large_post_fallback_can_be_verified_without_resending(tmp_path): + config, _, project = _fixture(tmp_path, lifecycle=False) + text = "- 完整内容\n" * 2000 + fallback = ReplyRunner(readback_text="different text") + attempts = [] + + def runner(args): + if "--content" in args: + return { + "returncode": 0, + "stdout": json.dumps( + { + "api": [ + { + "body": { + "msg_type": "post", + "content": args[args.index("--content") + 1], + } + } + ] + } + ), + } + return fallback(args) + + first = reply_lark_event_inbox( + project=project, + config_path=config, + message_id="om_reaction_fixture", + text=text, + content_format="markdown", + execute=True, + runner=runner, + delivery_attempt_recorder=attempts.append, + ) + assert first["status"] == "sent_unverified" + assert first["content_format"] == "text" + + recovery = ReplyRunner(readback_text=text.strip()) + verified = verify_lark_inbox_reply( + project=project, + config_path=config, + message_id="om_reaction_fixture", + text=text, + attempt=attempts[0], + runner=recovery, + ) + assert verified["reply_verified"] is True + assert not any( + "+messages-send" in call or "+messages-reply" in call + for call in recovery.calls + ) + + def test_markdown_request_with_mentions_keeps_verified_text_transport(tmp_path): config, _, project = _fixture(tmp_path, lifecycle=False) text = 'Reviewer please review' diff --git a/tests/test_manager_context_roundtrip.py b/tests/test_manager_context_roundtrip.py index bb749a4629..eeae64a877 100644 --- a/tests/test_manager_context_roundtrip.py +++ b/tests/test_manager_context_roundtrip.py @@ -19,6 +19,7 @@ from loopx.capabilities.manager_context.roundtrip import ( ReturnService, drain, + project_chat_return_deliveries, report, reply_status, ) @@ -321,7 +322,203 @@ def ambiguous(*args): now=datetime.now(timezone.utc) + timedelta(days=2), ) assert len(calls) == 1 - assert reply_status(root, r)[0]["status"] == "verification_required" + assert reply_status(root, r)[0] == { + "phase": "conclusion", + "status": "explicit_unverified", + "created_at": reply_status(root, r)[0]["created_at"], + "delivered_at": None, + "error": "provider_locator_unavailable", + } + + +def test_known_provider_locator_is_verified_after_restart_without_resend(flow): + root, registry, store, create = flow + session, _, receipt = create(True) + rid = receipt["request_id"] + acknowledge(root, "research", "worker", rid, "adopt", "Checked") + report( + root, + "research", + "worker", + rid, + "conclusion", + "Processed with a recorded validation result.", + ) + + class Transport: + def __init__(self): + self.send_calls = 0 + self.verify_calls = 0 + + def send_with_attempt(self, route, session, turn, text, record_attempt): + self.send_calls += 1 + record_attempt( + { + "schema_version": "manager_return_delivery_attempt_v0", + "provider": "lark", + "message_ref": "om_provider_reply", + "intent_digest": "sha256:" + "a" * 64, + "provider_receipt": "sha256:" + "b" * 64, + } + ) + raise RuntimeError("synthetic process interruption after provider send") + + def verify(self, route, session, turn, text, attempt): + self.verify_calls += 1 + assert attempt["message_ref"] == "om_provider_reply" + return { + "ok": True, + "verification_performed": True, + "reply_verified": True, + } + + transport = Transport() + drain(root, registry, store, transport) + first = reply_status(root, receipt)[0] + assert first["status"] == "verification_required" + assert "message_ref" not in first and "intent_digest" not in first + first_projection = project_chat_return_deliveries( + root, session["session_id"], store.messages(session["session_id"]) + ) + assert next( + row for row in first_projection if row.get("origin") == "manager_followup" + )["return_delivery"]["status"] == "verification_required" + assert "om_provider_reply" not in json.dumps(first_projection) + + drain(root, registry, ChatSessionStore(root), transport) + recovered = reply_status(root, receipt)[0] + assert recovered["status"] == "delivered" + assert recovered["verification"] == "reconciled_after_restart" + assert transport.send_calls == 1 + assert transport.verify_calls == 1 + + projected = project_chat_return_deliveries( + root, session["session_id"], store.messages(session["session_id"]) + ) + returned = [row for row in projected if row.get("origin") == "manager_followup"] + assert returned[0]["return_delivery"] == { + "schema_version": "manager_return_delivery_status_v0", + **recovered, + } + + +def test_provider_verification_outage_retries_read_only_without_resend(flow): + root, registry, store, create = flow + _, _, receipt = create(True) + rid = receipt["request_id"] + acknowledge(root, "research", "worker", rid, "adopt", "Checked") + report(root, "research", "worker", rid, "conclusion", "Bounded result.") + + class Transport: + send_calls = 0 + verify_calls = 0 + + def send_with_attempt(self, route, session, turn, text, record_attempt): + self.send_calls += 1 + record_attempt( + { + "schema_version": "manager_return_delivery_attempt_v0", + "provider": "lark", + "message_ref": "om_provider_reply", + "intent_digest": "sha256:" + "a" * 64, + "provider_receipt": "sha256:" + "b" * 64, + } + ) + return {"external_write_performed": True, "reply_verified": False} + + def verify(self, *_args): + self.verify_calls += 1 + return { + "ok": False, + "verification_performed": False, + "reply_verified": False, + "blocker": "provider_verification_unavailable", + } + + transport = Transport() + now = datetime.now(timezone.utc) + drain(root, registry, store, transport, now=now) + drain(root, registry, ChatSessionStore(root), transport, now=now) + state = reply_status(root, receipt)[0] + assert state["status"] == "verification_required" + assert state["error"] == "provider_verification_unavailable" + assert transport.send_calls == 1 and transport.verify_calls == 1 + + +def test_provider_verification_mismatch_is_terminal_and_public_safe(flow): + root, registry, store, create = flow + _, _, receipt = create(True) + rid = receipt["request_id"] + acknowledge(root, "research", "worker", rid, "adopt", "Checked") + report(root, "research", "worker", rid, "conclusion", "Bounded result.") + + class Transport: + def send_with_attempt(self, route, session, turn, text, record_attempt): + record_attempt( + { + "schema_version": "manager_return_delivery_attempt_v0", + "provider": "lark", + "message_ref": "om_private_provider_reply", + "intent_digest": "sha256:" + "a" * 64, + "provider_receipt": "sha256:" + "b" * 64, + } + ) + return {"external_write_performed": True, "reply_verified": False} + + def verify(self, *_args): + return { + "ok": False, + "verification_performed": True, + "reply_verified": False, + "blocker": "private provider mismatch detail", + } + + transport = Transport() + drain(root, registry, store, transport) + drain(root, registry, ChatSessionStore(root), transport) + state = reply_status(root, receipt)[0] + assert state["status"] == "explicit_unverified" + assert state["error"] == "provider_delivery_mismatch" + assert "private" not in str(state) + + +def test_provider_verification_stops_after_return_authority_revocation(flow): + root, registry, store, create = flow + _, _, receipt = create(True) + rid = receipt["request_id"] + acknowledge(root, "research", "worker", rid, "adopt", "Checked") + report(root, "research", "worker", rid, "conclusion", "Bounded result.") + + class Transport: + verify_calls = 0 + + def send_with_attempt(self, route, session, turn, text, record_attempt): + record_attempt( + { + "schema_version": "manager_return_delivery_attempt_v0", + "provider": "lark", + "message_ref": "om_provider_reply", + "intent_digest": "sha256:" + "a" * 64, + "provider_receipt": "sha256:" + "b" * 64, + } + ) + return {"external_write_performed": True, "reply_verified": False} + + def verify(self, *_args): + self.verify_calls += 1 + return {"verification_performed": True, "reply_verified": True} + + transport = Transport() + drain(root, registry, store, transport) + _write( + _root(root) / "policy.json", {"schema_version": POLICY_SCHEMA, "sources": {}} + ) + drain(root, registry, ChatSessionStore(root), transport) + + state = reply_status(root, receipt)[0] + assert state["status"] == "explicit_unverified" + assert state["error"] == "return_authorization_unavailable" + assert transport.verify_calls == 0 def test_background_service_delivers_without_another_agent_or_query(flow): From 249f77eb34d63fbe1ad962f1ca6694884ac97d86 Mon Sep 17 00:00:00 2001 From: Lihua <1017343802@qq.com> Date: Mon, 14 Sep 2026 00:21:03 -0700 Subject: [PATCH 2/9] feat(chat): show delegated return delivery state Signed-off-by: Lihua <1017343802@qq.com> --- apps/presentation/dashboard/src/data/chat.ts | 9 ++++++++ .../personal-workspace/channel-timeline.tsx | 2 ++ .../src/features/personal-workspace/i18n.tsx | 10 +++++++++ .../personal-workspace-contract.test.mjs | 8 +++++++ .../personal-workspace-model.ts | 7 ++++++ .../personal-workspace-page.tsx | 2 ++ .../personal-workspace/personal-workspace.css | 4 ++++ .../return-delivery-status.tsx | 21 ++++++++++++++++++ .../dashboard/src/views/dashboard-page.tsx | 21 ++++++++++++++++-- loopx/web/chat/asset-retention.json | 6 ++--- loopx/web/chat/assets/index-B5MsQdxX.css | 1 + .../{index-C7Z2HfR1.js => index-ByC0P3wo.js} | 22 +++++++++---------- loopx/web/chat/index.html | 4 ++-- 13 files changed, 99 insertions(+), 18 deletions(-) create mode 100644 apps/presentation/dashboard/src/features/personal-workspace/return-delivery-status.tsx create mode 100644 loopx/web/chat/assets/index-B5MsQdxX.css rename loopx/web/chat/assets/{index-C7Z2HfR1.js => index-ByC0P3wo.js} (77%) diff --git a/apps/presentation/dashboard/src/data/chat.ts b/apps/presentation/dashboard/src/data/chat.ts index 1f04f2b86d..9fb75d8515 100644 --- a/apps/presentation/dashboard/src/data/chat.ts +++ b/apps/presentation/dashboard/src/data/chat.ts @@ -584,6 +584,15 @@ export type ChatVisibleMessage = { role: string; text: string; created_at: string; + return_delivery?: { + schema_version: "manager_return_delivery_status_v0"; + phase: "decision" | "conclusion"; + status: string; + created_at?: string | null; + delivered_at?: string | null; + error?: string | null; + verification?: "reconciled_after_restart"; + }; }; export type ChatImageAttachment = { diff --git a/apps/presentation/dashboard/src/features/personal-workspace/channel-timeline.tsx b/apps/presentation/dashboard/src/features/personal-workspace/channel-timeline.tsx index 9556112dfc..5c36dcfac8 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/channel-timeline.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/channel-timeline.tsx @@ -6,6 +6,7 @@ import { OutputRow } from "./cards/output-row"; import { RunRow } from "./cards/run-row"; import { ScheduleRow } from "./cards/schedule-row"; import { useWorkspaceI18n } from "./i18n"; +import { ReturnDeliveryStatus } from "./return-delivery-status"; import type { WorkspaceDrawerSelection, WorkspaceGoal, WorkspaceTimelineItem } from "./personal-workspace-model"; export function ChannelTimeline({ @@ -76,6 +77,7 @@ export function ChannelTimeline({ {item.message.attachments?.length ?
{item.message.attachments.map((attachment) => {attachment.name})}
: null} {item.message.role === "user" ?

{item.message.text}

: } {item.message.pending ? {t("timeline.pending")} : null} + ); diff --git a/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx b/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx index a2a9932f8c..d71b6b4985 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx @@ -997,6 +997,11 @@ const en = { "timeline.emptyWorkspaceDescription": "Describe a Goal to the LoopX Manager, or ask what deserves attention today.", "timeline.gateHistory": "{count} historical Gates", "timeline.pending": "Working…", + "returnDelivery.queued": "Return queued", + "returnDelivery.verifying": "Verifying delivery without resending", + "returnDelivery.delivered": "Delivered to the original audience", + "returnDelivery.reconciled": "Delivery verified after recovery", + "returnDelivery.unverified": "Delivery remains explicitly unverified", "timeline.runCompleted": "{run}: completed", "timeline.review": "Review", "timeline.reviewAndConfirm": "Review and confirm", @@ -1990,6 +1995,11 @@ const zhCN: Record = { "timeline.emptyWorkspaceDescription": "向 LoopX 管家描述一个 Goal,或询问今天最值得关注的事情。", "timeline.gateHistory": "{count} 项历史 Gate", "timeline.pending": "正在整理…", + "returnDelivery.queued": "结论等待回传", + "returnDelivery.verifying": "正在核验送达,不会重复发送", + "returnDelivery.delivered": "已送达原受众", + "returnDelivery.reconciled": "恢复后已核验送达", + "returnDelivery.unverified": "送达仍明确未核验", "timeline.runCompleted": "{run}:已完成", "timeline.review": "查看处理方式", "timeline.reviewAndConfirm": "查看并确认", diff --git a/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-contract.test.mjs b/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-contract.test.mjs index 9927c320c7..5ce9c03c8e 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-contract.test.mjs +++ b/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-contract.test.mjs @@ -10,6 +10,7 @@ const page = source("./personal-workspace-page.tsx"); const router = source("./personal-workspace-router.ts"); const shell = source("./workspace-shell.tsx"); const timeline = source("./channel-timeline.tsx"); +const returnDelivery = source("./return-delivery-status.tsx"); const runRow = source("./cards/run-row.tsx"); const larkSettings = source("./lark-settings-page.tsx"); const machineSettings = source("./machine-configuration-settings.tsx"); @@ -97,6 +98,13 @@ assert.match(page, /function operationProposalFields/, "Operation details have a assert.doesNotMatch(page.match(/function operationProposalFields[\s\S]*?\n\}/)?.[0] ?? "", /authorized_principals|payload_digest|parameters\.payload/, "Operation details do not expose private authority or inline payloads"); assert.match(page, /t\("proposal\.primary\.operationGroup"\)/, "Operation confirmation routes users to the bound group"); assert.match(chatData, /result_delivery:/, "Dashboard retains operation result-delivery readback"); +assert.match(chatData, /return_delivery\??:/, "Chat messages retain manager return-delivery readback"); +assert.match(dashboard, /deliveryByMessage/, "Manager return polling refreshes delivery state after the message arrives"); +assert.match(timeline + page, /ReturnDeliveryStatus/, "Both manager conversation surfaces render return delivery state"); +for (const state of ["delivered", "verification_required", "explicit_unverified"]) { + assert.match(returnDelivery, new RegExp(state), `Return delivery renders ${state}`); +} +assert.doesNotMatch(returnDelivery, /message_ref|provider_receipt|intent_digest/, "Provider-private locator facts never enter the return status badge"); assert.match(actionReview, /proposal\.action_kind !== "operation\.execute" \|\| objectValue\(objectValue\(proposal\.operation\)\?\.result_delivery\) !== null/, "An operation is not complete in the Dashboard until result delivery is verified"); assert.match(page, /reviewPlan\.operationFrame/, "Dashboard operation details consume the shared TS review frame"); assert.match(page, /operation\.execute" && proposal\.status === "applied"/, "Dashboard restores terminal operation receipts from the canonical action store"); diff --git a/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-model.ts b/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-model.ts index ef81a630dd..7fd7452ed9 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-model.ts +++ b/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-model.ts @@ -241,11 +241,18 @@ export type WorkspaceMessage = { attachments?: WorkspaceImageAttachment[]; id: string; pending?: boolean; + returnDelivery?: WorkspaceReturnDelivery; role: "assistant" | "user" | "system"; text: string; time?: string; }; +export type WorkspaceReturnDelivery = { + error?: string | null; + status: string; + verification?: "reconciled_after_restart"; +}; + export type WorkspaceImageAttachment = { dataUrl: string; id: string; diff --git a/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-page.tsx b/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-page.tsx index 67901aa87b..18b8bb0722 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-page.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-page.tsx @@ -31,6 +31,7 @@ import { GoalSidebar } from "./goal-sidebar"; import { GoalTasksView } from "./goal-tasks-view"; import { localizedGoalState, localizedSessionStatus, useWorkspaceI18n, type WorkspaceTranslate } from "./i18n"; import { MarkdownText } from "./markdown"; +import { ReturnDeliveryStatus } from "./return-delivery-status"; import type { PersonalWorkspaceCallbacks, WorkspaceAgentOption, @@ -289,6 +290,7 @@ function ManagerConversationTray({
{message.role === "user" ?

{message.text}

: } {message.pending ? {t("conversation.agentPending")} : null} +
))} diff --git a/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace.css b/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace.css index 894c67b219..18ad01397c 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace.css +++ b/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace.css @@ -323,6 +323,10 @@ .personal-message time { color: var(--pw-faint); font-size: 10px; } .personal-message p { margin: 6px 0 0; white-space: pre-wrap; line-height: 1.7; font-size: 13.5px; } .personal-message-pending { color: var(--pw-muted); font-size: 11px; } +.personal-return-delivery { display: inline-block; margin-top: 7px; color: var(--pw-muted); font-size: 11px; font-weight: 600; } +.personal-return-delivery.is-delivered { color: var(--pw-green); } +.personal-return-delivery.is-verification_required { color: var(--pw-blue-ink); } +.personal-return-delivery.is-explicit_unverified { color: var(--pw-amber); } .personal-message-images { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; } .personal-message-images img { width: min(220px, 100%); max-height: 180px; object-fit: cover; border: 1px solid var(--pw-line-strong); border-radius: 10px; background: #fff; } diff --git a/apps/presentation/dashboard/src/features/personal-workspace/return-delivery-status.tsx b/apps/presentation/dashboard/src/features/personal-workspace/return-delivery-status.tsx new file mode 100644 index 0000000000..740477faf5 --- /dev/null +++ b/apps/presentation/dashboard/src/features/personal-workspace/return-delivery-status.tsx @@ -0,0 +1,21 @@ +import { useWorkspaceI18n } from "./i18n"; +import type { WorkspaceReturnDelivery } from "./personal-workspace-model"; + +export function ReturnDeliveryStatus({ delivery }: { delivery?: WorkspaceReturnDelivery }) { + const { t } = useWorkspaceI18n(); + if (!delivery) return null; + const label = delivery.status === "delivered" + ? delivery.verification === "reconciled_after_restart" + ? t("returnDelivery.reconciled") + : t("returnDelivery.delivered") + : delivery.status === "verification_required" + ? t("returnDelivery.verifying") + : delivery.status === "explicit_unverified" + ? t("returnDelivery.unverified") + : t("returnDelivery.queued"); + return ( + + {label} + + ); +} diff --git a/apps/presentation/dashboard/src/views/dashboard-page.tsx b/apps/presentation/dashboard/src/views/dashboard-page.tsx index 2a8a2254f4..b13ac283f8 100644 --- a/apps/presentation/dashboard/src/views/dashboard-page.tsx +++ b/apps/presentation/dashboard/src/views/dashboard-page.tsx @@ -56,6 +56,7 @@ import { type ChatSessionSnapshot, type ChatSessionSummary, type ChatImageAttachment, + type ChatVisibleMessage, type ManagerRuntimeSessionReadback, type ProtectedActionProposal, type TodoProposal, @@ -506,6 +507,7 @@ type PersonalManagerMessage = { id: number; lines: string[]; pending?: boolean; + returnDelivery?: ChatVisibleMessage["return_delivery"]; reconnect?: boolean; role: "assistant" | "user"; sourceLabel?: string; @@ -1588,11 +1590,24 @@ function PersonalGoalHome({ const previous = current[contextId] ?? []; const seen = new Set(previous.map((row) => row.sourceMessageId)); const fresh = replies.filter((row) => !seen.has(row.message_id)); - if (!fresh.length) return current; - return { ...current, [contextId]: [...previous, ...fresh.map((row) => ({ + const deliveryByMessage = new Map( + replies.map((row) => [row.message_id, row.return_delivery]), + ); + let deliveryChanged = false; + const updated = previous.map((row) => { + const delivery = row.sourceMessageId + ? deliveryByMessage.get(row.sourceMessageId) + : undefined; + if (JSON.stringify(delivery) === JSON.stringify(row.returnDelivery)) return row; + deliveryChanged = true; + return { ...row, returnDelivery: delivery }; + }); + if (!fresh.length && !deliveryChanged) return current; + return { ...current, [contextId]: [...updated, ...fresh.map((row) => ({ id: managerMessageId.current++, sourceMessageId: row.message_id, role: "assistant" as const, agentLabel: selectedAgent.label, sourceLabel: "管家交接回执", text: visibleAgentMessage(row.text), lines: [], + returnDelivery: row.return_delivery, }))] }; }); } catch { @@ -1689,6 +1704,7 @@ function PersonalGoalHome({ id: managerMessageId.current++, lines: [], role: message.role === "user" ? "user" : "assistant", + returnDelivery: message.return_delivery, sourceLabel: message.role === "user" ? undefined : message.role === "error" @@ -2554,6 +2570,7 @@ function PersonalGoalHome({ attachments: message.attachments, id: String(message.id), pending: message.pending, + returnDelivery: message.returnDelivery, role: message.role, text: message.text || (message.pending ? "Agent 正在处理…" : message.lines.join("\n")), }, diff --git a/loopx/web/chat/asset-retention.json b/loopx/web/chat/asset-retention.json index 5d0fc14df1..5f2094e8a2 100644 --- a/loopx/web/chat/asset-retention.json +++ b/loopx/web/chat/asset-retention.json @@ -13,8 +13,8 @@ "assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2", "assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2", "assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2", - "assets/index-B7B_kVDP.css", - "assets/index-Mlk4kS9d.js" + "assets/index-B5MsQdxX.css", + "assets/index-ByC0P3wo.js" ], [ "assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2", @@ -29,7 +29,7 @@ "assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2", "assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2", "assets/index-B7B_kVDP.css", - "assets/index-C7Z2HfR1.js" + "assets/index-Mlk4kS9d.js" ] ] } diff --git a/loopx/web/chat/assets/index-B5MsQdxX.css b/loopx/web/chat/assets/index-B5MsQdxX.css new file mode 100644 index 0000000000..87c85d4eec --- /dev/null +++ b/loopx/web/chat/assets/index-B5MsQdxX.css @@ -0,0 +1 @@ +.personal-workspace-shell{--pw-bg:#fbfaf7;--pw-card:#fff;--pw-line:#eceae3;--pw-line-strong:#e0ddd4;--pw-muted:#82889a;--pw-faint:#aab0bf;--pw-text:#23262e;--pw-blue:#2f66e9;--pw-blue-ink:#2456c8;--pw-blue-soft:#ebf1fe;--pw-amber:#a86a12;--pw-amber-bg:#fbf2df;--pw-red:#c2402f;--pw-red-bg:#fcecea;--pw-green:#2e7d5b;--pw-green-bg:#e6f3ec;background:var(--pw-bg);min-height:100vh;color:var(--pw-text);grid-template-columns:272px minmax(520px,1fr);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;display:grid}.personal-workspace-shell.has-drawer{grid-template-columns:256px minmax(500px,1fr) minmax(340px,404px)}.personal-workspace-shell.has-task-inspector{grid-template-columns:minmax(520px,1fr) minmax(520px,50vw)}.personal-workspace-shell.has-task-inspector .personal-workspace-sidebar{display:none}.personal-workspace-shell.has-task-inspector.is-task-inspector-full{grid-template-columns:minmax(600px,1fr)}.personal-workspace-shell.is-task-inspector-full .personal-workspace-main{display:none}.personal-workspace-sidebar{border-right:1px solid var(--pw-line);background:#f5f3ee;min-width:0}.personal-workspace-sidebar-inner{width:100%;height:100%}.personal-sr-only{clip:rect(0, 0, 0, 0)!important;white-space:nowrap!important;border:0!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;position:absolute!important;overflow:hidden!important}.personal-workspace-main{min-width:0}.personal-workspace-drawer{border-left:1px solid var(--pw-line);background:#fff;min-width:0;position:relative;box-shadow:-14px 0 36px #1e1c140d}.personal-workspace-drawer[data-drawer-mode=inspector]{z-index:3;width:auto;position:relative;box-shadow:-8px 0 24px #1e284014}.personal-workspace-drawer[data-drawer-mode=inspector-full]{min-width:0;box-shadow:none;grid-column:1}.personal-sidebar-backdrop{display:none}.personal-workspace-shell :focus-visible:not(textarea):not(input){outline-offset:2px;outline:2px solid #5f87ed}.personal-goal-directory{flex-direction:column;width:100%;height:100vh;display:flex;position:sticky;top:0}.personal-sidebar-brand{border-bottom:1px solid var(--pw-line);align-items:center;gap:11px;height:74px;padding:0 18px;display:flex}.personal-sidebar-brand>span:last-child{gap:1px;display:grid}.personal-sidebar-brand strong{letter-spacing:.01em;font-size:16px}.personal-sidebar-brand small{color:var(--pw-muted);font-size:11px}.personal-brand-mark,.personal-manager-icon{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:10px;place-items:center;display:grid;box-shadow:0 2px 6px #2f66e947}.personal-brand-mark{width:34px;height:34px}.personal-manager-icon{width:30px;height:30px;color:var(--pw-blue-ink);background:var(--pw-blue-soft);box-shadow:none}.personal-status-source{border-bottom:1px solid var(--pw-line);gap:7px;padding:12px 14px;display:grid;position:relative}.personal-status-source>header{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;justify-content:space-between;align-items:center;padding:0 3px;font-size:10px;font-weight:700;display:flex}.personal-status-source>header button,.personal-status-source-meta button,.personal-status-source-form header button{width:25px;height:25px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-status-source>header button:hover,.personal-status-source-meta button:hover,.personal-status-source-form header button:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-status-source-select{width:100%}.personal-status-source-meta{min-width:0;color:var(--pw-muted);align-items:center;gap:7px;padding:0 3px;font-size:10.5px;display:flex}.personal-status-source-meta>span{white-space:nowrap;align-items:center;gap:5px;display:inline-flex}.personal-status-source-meta>span i{background:#3fbf82;border-radius:50%;width:6px;height:6px}.personal-status-source-meta>span.is-loading i{background:#e5a33d}.personal-status-source-meta>span.is-error i{background:#dd5b47}.personal-status-source-meta small{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}.personal-status-source-meta button{width:22px;height:22px;color:var(--pw-faint);margin-left:auto}.personal-status-source-error{color:var(--pw-red);overflow-wrap:anywhere;margin:0 3px;font-size:10px;line-height:1.4}.personal-status-source-form{z-index:12;border:1px solid var(--pw-line-strong);background:#fff;border-radius:12px;gap:10px;padding:13px;display:grid;position:absolute;top:calc(100% - 4px);left:12px;right:12px;box-shadow:0 12px 32px #1e1c1424}.personal-status-source-form>header{justify-content:space-between;align-items:center;font-size:12.5px;display:flex}.personal-status-source-form label{color:var(--pw-muted);gap:5px;font-size:10.5px;display:grid}.personal-status-source-form input,.personal-status-source-form select{border:1px solid var(--pw-line-strong);width:100%;min-width:0;height:34px;color:var(--pw-text);background:#fff;border-radius:8px;outline:0;padding:0 9px;font:12px/1.2 inherit}.personal-status-source-form input:focus,.personal-status-source-form select:focus{border-color:#8aa7ed;box-shadow:0 0 0 2px #2f66e91a}.personal-status-source-form input:disabled,.personal-status-source-form select:disabled{color:var(--pw-faint);background:#f6f5f2}.personal-status-source-form p{color:var(--pw-muted);overflow-wrap:anywhere;margin:0;font-size:10px;line-height:1.45}.personal-status-source-form p.is-error{color:var(--pw-red)}.personal-status-source-form code{font:9.5px/1.5 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-status-source-add{background:var(--pw-blue);color:#fff;cursor:pointer;border:0;border-radius:8px;min-height:34px;font-size:11.5px;font-weight:650}.personal-status-source-add:hover{background:var(--pw-blue-ink)}.personal-status-source-add:disabled{cursor:not-allowed;opacity:.48}.personal-status-source-modes{background:#f2f1ed;border-radius:9px;grid-template-columns:1fr 1fr;gap:3px;padding:3px;display:grid}.personal-status-source-modes button{min-height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;padding:0 8px;font-size:10.5px;font-weight:650}.personal-status-source-modes button[aria-selected=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-status-source-field-row{grid-template-columns:minmax(0,1fr) 34px;gap:6px;display:grid}.personal-status-source-field-row>button{border:1px solid var(--pw-line-strong);width:34px;height:34px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:8px;place-items:center;padding:0;display:grid}.personal-status-source-field-row>button:hover{color:var(--pw-text);background:#f8f7f4}.personal-status-source-field-row>button:disabled{cursor:wait;opacity:.45}.personal-status-source-command{background:#f6f5f2;border-radius:8px;gap:7px;padding:8px 9px;display:grid}.personal-status-source-command code{color:#4e5668;overflow-wrap:anywhere}.personal-status-source-command button{border:1px solid var(--pw-line-strong);min-height:25px;color:var(--pw-blue-ink);cursor:pointer;background:#fff;border-radius:7px;justify-content:center;justify-self:end;align-items:center;gap:5px;padding:0 8px;font-size:10px;font-weight:650;display:inline-flex}.personal-status-source-command button:disabled{color:var(--pw-faint);cursor:not-allowed}.personal-sidebar-nav{flex:1;padding:12px;overflow:auto}.personal-manager-link,.personal-goal-link,.personal-sidebar-utility{width:100%;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0}.personal-manager-link{border-radius:11px;grid-template-columns:30px 1fr auto auto;align-items:center;gap:10px;padding:8px 10px;font-weight:650;display:grid}.personal-manager-link:hover,.personal-goal-link:hover{background:#ffffffa6}.personal-manager-link[aria-current=page],.personal-goal-link[aria-current=page]{background:#fff;box-shadow:0 1px 4px #1e1c141a}.personal-sidebar-count{background:var(--pw-amber-bg);min-width:22px;color:var(--pw-amber);text-align:center;border-radius:99px;padding:2px 7px;font-size:11px;font-weight:650}.personal-sidebar-section-title{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;justify-content:space-between;padding:20px 10px 7px;font-size:11px;font-weight:650;display:flex}.personal-sidebar-title-actions{align-items:center;gap:6px;display:flex}.personal-sidebar-title-actions button{width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-sidebar-title-actions button:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141f}.personal-goal-list{gap:2px;display:grid}.personal-goal-row{border-radius:11px;grid-template-columns:minmax(0,1fr) 28px 28px;align-items:center;gap:2px;display:grid}.personal-goal-row:has(.personal-goal-move-actions){grid-template-columns:minmax(0,1fr) 52px 28px}.personal-goal-row[data-reorder-goal]>.personal-goal-link{cursor:grab;-webkit-user-select:none;user-select:none}.personal-goal-row[data-reorder-goal]>.personal-goal-link:active{cursor:grabbing}.personal-goal-row.is-drop-before{box-shadow:0 -2px var(--color-link,#0070f3)}.personal-goal-row.is-drop-after{box-shadow:0 2px var(--color-link,#0070f3)}.personal-goal-move-actions{display:flex}.personal-goal-move-actions button{min-width:26px;min-height:44px;color:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;place-items:center;display:grid}.personal-goal-move-actions button:disabled{opacity:.35;cursor:default}.personal-goal-move-actions button:not(:disabled):hover{background:var(--color-surface-soft,#f2f2f2)}.personal-goal-link{border-radius:11px;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:10px;min-height:44px;padding:7px 5px 7px 10px;display:grid}.personal-goal-lifecycle{width:26px;height:26px;color:var(--pw-faint);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-goal-lifecycle:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141f}.personal-goal-lifecycle:disabled{opacity:.45;cursor:wait}.personal-goal-lifecycle.is-pending svg{animation:.8s linear infinite personal-goal-lifecycle-spin}@keyframes personal-goal-lifecycle-spin{to{transform:rotate(360deg)}}.personal-goal-delete:hover{color:var(--pw-danger)}.personal-goal-link-copy{gap:2px;min-width:0;display:grid}.personal-goal-link-copy strong,.personal-goal-link-copy small{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.personal-goal-link-copy strong{font-size:13px;font-weight:600}.personal-goal-link-copy small{color:var(--pw-muted);align-items:center;gap:5px;font-size:11px;display:flex}.personal-goal-state-dot{background:#e8ecf1;border-radius:9px;width:30px;height:30px;position:relative}.personal-goal-state-dot:after{content:"";background:#9aa3b2;border-radius:50%;width:7px;height:7px;position:absolute;bottom:3px;right:3px;box-shadow:0 0 0 2px #ffffffd9}.personal-goal-row:nth-child(5n+1) .personal-goal-state-dot{background:#e3ebfd}.personal-goal-row:nth-child(5n+2) .personal-goal-state-dot{background:#eee7fb}.personal-goal-row:nth-child(5n+3) .personal-goal-state-dot{background:#e2f2e4}.personal-goal-row:nth-child(5n+4) .personal-goal-state-dot{background:#fbf0dc}.personal-goal-row:nth-child(5n) .personal-goal-state-dot{background:#e8ecf1}.personal-goal-state-dot.is-danger:after{background:#dd5b47}.personal-goal-state-dot.is-warning:after{background:#e5a33d}.personal-goal-state-dot.is-info:after{background:#54a5e8}.personal-goal-state-dot.is-success:after{background:#3fae7c}.personal-goal-state-dot.is-quiet:after{background:#b6bcc9}.personal-goal-state-dot.is-stopped:after{background:#8f96a4}.personal-stopped-goals{border-top:1px solid var(--pw-line);margin-top:14px;padding-top:8px}.personal-stopped-goals>summary{min-height:34px;color:var(--pw-muted);cursor:pointer;letter-spacing:.04em;border-radius:9px;grid-template-columns:16px minmax(0,1fr) auto;align-items:center;gap:6px;padding:5px 10px;font-size:11px;font-weight:650;list-style:none;display:grid}.personal-stopped-goals>summary::-webkit-details-marker{display:none}.personal-stopped-goals>summary:hover{color:var(--pw-text);background:#ffffff8c}.personal-stopped-goals>summary>svg:first-child{transition:transform .14s}.personal-stopped-goals[open]>summary>svg:first-child{transform:rotate(180deg)}.personal-stopped-goals>summary small{text-align:center;background:#ebe9e3;border-radius:99px;min-width:22px;padding:2px 6px}.personal-goal-list.is-stopped{opacity:.82;margin-top:2px}.personal-stopped-goal-error{background:var(--pw-red-bg);color:var(--pw-red);border:1px solid #edc1ba;border-radius:9px;gap:7px;margin:6px 8px;padding:9px 10px;font-size:11px;line-height:1.45;display:grid}.personal-stopped-goal-error button{min-height:28px;color:inherit;cursor:pointer;font:inherit;background:0 0;border:1px solid;border-radius:7px;justify-self:start;padding:0 9px;font-weight:650}.personal-priority-dot{background:#aab2bf;border-radius:50%;width:7px;height:7px}.personal-priority-dot.is-high{background:#dd5b47}.personal-priority-dot.is-medium{background:#e5a33d}.personal-priority-dot.is-low{background:#3fae7c}.personal-sidebar-footer{border-top:1px solid var(--pw-line);flex-shrink:0;padding:12px}.personal-update-trigger{width:100%;min-height:44px;color:var(--pw-text);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;align-items:center;gap:8px;padding:0 9px;font-size:13px;display:flex}.personal-update-trigger span{text-align:left;flex:1}.personal-update-trigger:hover{background:var(--pw-card)}.personal-update-trigger:focus-visible{outline-offset:2px;outline:2px solid #0070f3}.personal-update-panel{box-sizing:border-box;width:min(320px,100vw - 24px);max-height:calc(100dvh - 104px);color:var(--pw-text);background:var(--pw-card,#fff);font:inherit;border:1px solid var(--pw-line);border-radius:12px;margin:0;padding:16px;font-size:13px;line-height:1.6;position:fixed;inset:auto auto 80px 12px;overflow-y:auto;box-shadow:0 8px 28px #0000001f}.personal-update-panel header{justify-content:space-between;align-items:center;display:flex}.personal-update-panel button{min-height:44px;color:inherit;background:var(--pw-card,#fff);border:1px solid var(--pw-line);cursor:pointer;border-radius:6px;padding:6px 10px}.personal-update-panel header button{border:0;place-items:center;min-width:44px;display:grid}.personal-update-panel summary{cursor:pointer;align-content:center;min-height:44px}.personal-update-panel p{margin:10px 0}.personal-update-panel label,.personal-update-panel small,.personal-update-panel code{display:block}.personal-update-panel select{width:100%;min-height:44px;color:inherit;background:var(--pw-card);border:1px solid var(--pw-line);border-radius:6px;margin-top:6px}.personal-update-actions{flex-wrap:wrap;gap:8px;display:flex}.personal-update-actions button{border:1px solid var(--pw-line);border-radius:6px;min-height:44px;padding:6px 10px}.personal-update-panel a{text-decoration:underline}.personal-update-panel :focus-visible{outline-offset:2px;outline:2px solid #0070f3}.personal-sidebar-utility{border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;grid-template-columns:32px minmax(0,1fr) auto;align-items:center;gap:10px;min-height:54px;padding:7px 9px;font-size:13px;display:grid;box-shadow:0 1px 4px #1e1c1412}.personal-sidebar-utility:hover{background:#fff;border-color:#d6d2c8;box-shadow:0 2px 7px #1e1c141a}.personal-sidebar-utility-icon{background:var(--pw-blue-soft);width:32px;height:32px;color:var(--pw-blue-ink);border-radius:9px;place-items:center;display:grid}.personal-sidebar-utility-copy{gap:2px;min-width:0;display:grid}.personal-sidebar-utility-copy strong,.personal-sidebar-utility-copy small{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.personal-sidebar-utility-copy strong{font-size:13px;font-weight:700}.personal-sidebar-utility-copy small{color:var(--pw-muted);font-size:10.5px}.personal-sidebar-utility>svg{color:var(--pw-faint)}.personal-owner-row{min-height:40px;color:var(--pw-muted);border-radius:10px;align-items:center;gap:10px;margin-top:2px;padding:8px 10px;font-size:13px;display:flex}.personal-channel{grid-template-rows:auto minmax(0,1fr) auto;grid-template-columns:minmax(0,1fr);min-width:0;height:100vh;display:grid}.personal-channel-header{z-index:8;border-bottom:1px solid var(--pw-line);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fbfaf7eb;justify-content:space-between;align-items:center;gap:16px;min-height:72px;padding:12px 26px;display:flex;position:relative;overflow:visible}.personal-goal-tabs{background:#f2f1ed;border-radius:10px;align-self:center;align-items:center;gap:2px;margin-left:auto;padding:3px;display:flex}.personal-goal-tabs button{min-height:30px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;padding:0 13px;font-size:12.5px;font-weight:600}.personal-goal-tabs button:hover{color:var(--pw-text)}.personal-goal-tabs button[aria-current=page]{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-channel-title{min-width:0}.personal-channel-title h1{letter-spacing:-.015em;margin:0;font-size:17.5px;font-weight:700;line-height:1.25}.personal-channel-title p{color:var(--pw-muted);white-space:nowrap;text-overflow:ellipsis;margin:3px 0 0;font-size:12px;overflow:hidden}.personal-channel-actions{flex:none;align-items:center;gap:9px;display:flex}.personal-goal-tools{flex:none;position:relative}.personal-goal-tools-trigger{background:var(--pw-blue-soft);min-height:38px;color:var(--pw-blue-ink);cursor:pointer;font:inherit;white-space:nowrap;border:1px solid #b8c9f5;border-radius:10px;justify-content:center;align-items:center;gap:7px;padding:0 11px;font-size:12px;font-weight:720;display:inline-flex}.personal-goal-tools-trigger:hover,.personal-goal-tools-trigger[aria-expanded=true]{color:#1948b5;background:#e5edff;border-color:#7f9fe9}.personal-goal-tools-trigger:focus-visible{outline-offset:2px;outline:3px solid #2f66e947}.personal-goal-tools-trigger>svg:last-child{transition:transform .16s}.personal-goal-tools-trigger[aria-expanded=true]>svg:last-child{transform:rotate(180deg)}.personal-goal-tools-menu{z-index:30;border:1px solid var(--pw-line-strong);background:#fff;border-radius:12px;gap:4px;width:min(300px,100vw - 28px);padding:6px;display:grid;position:absolute;top:calc(100% + 8px);right:0;box-shadow:0 16px 44px #1e284029}.personal-goal-tools-menu>button{width:100%;min-height:52px;color:var(--pw-text);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:9px;grid-template-columns:34px minmax(0,1fr);align-items:center;gap:9px;padding:7px 9px;display:grid}.personal-goal-tools-menu>button:hover,.personal-goal-tools-menu>button:focus-visible{background:var(--pw-blue-soft);outline:none}.personal-goal-tools-menu>button>svg{color:var(--pw-blue);justify-self:center}.personal-goal-tools-menu>button>span{gap:2px;min-width:0;display:grid}.personal-goal-tools-menu strong{font-size:12.5px}.personal-goal-tools-menu small{color:var(--pw-muted);font-size:10.5px;line-height:1.35}.personal-icon-button.personal-mobile-menu{display:none}.personal-select{min-width:0;position:relative}.personal-select-trigger{border:1px solid var(--pw-line-strong);width:100%;min-height:36px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border-radius:10px;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:7px;padding:0 9px;font-size:12px;font-weight:500;line-height:16px;display:grid}.personal-select-trigger:hover,.personal-select-trigger[aria-expanded=true]{border-color:var(--pw-faint)}.personal-select-trigger:focus-visible{border-color:var(--pw-blue);outline-offset:1px;outline:2px solid #0070f329}.personal-select-trigger>svg{color:var(--pw-muted);transition:transform .15s}.personal-select-trigger>svg.is-open{transform:rotate(180deg)}.personal-select-icon{color:var(--pw-muted);place-items:center;display:grid}.personal-select-value{white-space:nowrap;align-items:center;gap:6px;min-width:0;display:flex}.personal-select-value>small{color:var(--pw-faint);flex:none;font-size:10px;font-weight:500}.personal-select-value>span{text-overflow:ellipsis;min-width:0;overflow:hidden}.personal-select-listbox{z-index:50;border:1px solid var(--pw-line);background:#fff;border-radius:12px;min-width:max(100%,204px);max-width:min(300px,80vw);max-height:260px;padding:4px;display:grid;position:absolute;top:calc(100% + 5px);left:0;overflow:auto;box-shadow:0 10px 24px #00000017}.personal-agent-select .personal-select-listbox{min-width:216px;left:auto;right:0}.personal-select-option-wrap{display:grid}.personal-select-group-label{color:var(--pw-faint);letter-spacing:0;text-transform:uppercase;padding:8px 8px 4px;font:500 10px/14px Geist Mono Variable,Geist Mono,monospace}.personal-select-option{width:100%;min-height:32px;color:var(--pw-text);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;grid-template-columns:minmax(0,1fr) 16px;align-items:center;gap:10px;padding:6px 8px;font-size:12px;font-weight:400;line-height:16px;display:grid}.personal-select-option:hover,.personal-select-option:focus-visible{background:#f2f2f2;outline:0}.personal-select-option[aria-selected=true]{font-weight:600}.personal-select-option[disabled]{color:var(--pw-faint);cursor:not-allowed}.personal-select-option>svg{color:var(--pw-text);justify-self:end}.personal-agent-select{width:188px}.personal-read-only-source{border:1px solid var(--pw-line-strong);max-width:190px;height:38px;color:var(--pw-text);white-space:nowrap;background:#fff;border-radius:10px;align-items:center;gap:7px;padding:0 10px;font-size:12.5px;font-weight:600;display:inline-flex;overflow:hidden}.personal-read-only-source>svg{color:var(--pw-muted);flex:none}.personal-read-only-source>small{color:var(--pw-muted);background:#f2f1ed;border-radius:99px;padding:2px 6px;font-size:9.5px;font-weight:650}.personal-live-indicator{color:var(--pw-muted);white-space:nowrap;flex:none;align-items:center;gap:6px;padding:7px 4px;font-size:12px;display:inline-flex}.personal-live-indicator i{background:#3fbf82;border-radius:50%;width:7px;height:7px}.personal-composer-attach{cursor:pointer;border:0;flex:none;place-items:center;display:grid;position:relative;overflow:hidden}.personal-composer-attach:disabled{cursor:not-allowed;opacity:.45}.personal-composer-file-input{opacity:0;pointer-events:none;width:1px;height:1px;position:fixed;overflow:hidden}.personal-action-feedback{border:1px solid var(--pw-line);background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:10px;justify-content:space-between;align-items:center;gap:12px;margin:0 0 8px;padding:9px 12px;font-size:13px;font-weight:650;display:flex}.personal-action-feedback button{color:inherit;cursor:pointer;background:0 0;border:0;place-items:center;display:grid}.personal-refresh-control{flex:none;align-items:center;gap:6px;display:inline-flex}.personal-refresh-control small{color:var(--pw-muted);white-space:nowrap;font-size:11px}.personal-refresh-control.is-error small{color:var(--pw-danger)}.personal-icon-button{border:1px solid var(--pw-line);width:36px;min-width:36px;height:36px;min-height:36px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:10px;flex:0 0 36px;place-items:center;padding:0;display:inline-grid}.personal-icon-button:hover{border-color:var(--pw-line-strong);color:var(--pw-text)}.personal-channel-scroll{min-width:0;min-height:0;padding:22px max(26px,50% - 410px);overflow:auto}.personal-channel-scroll:has(.personal-task-kanban){padding-inline:max(26px,50vw - 770px)}.personal-channel-scroll:has(.personal-task-board){overflow:hidden}.personal-manager-greeting{align-items:center;gap:14px;margin-bottom:16px;padding:18px 20px;display:flex}.personal-home-lanes{grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;display:grid}.personal-system-health-banner{color:#991b1b;background:#fef2f2;border:1px solid #fecaca;border-radius:12px;margin-bottom:16px;padding:12px 16px}.personal-system-health-header{align-items:center;gap:8px;font-size:13px;font-weight:600;display:flex}.personal-system-health-header small{color:#b91c1c;font-size:11.5px;font-weight:400}.personal-system-health-issues{color:#b91c1c;margin:6px 0 0 24px;padding:0;font-size:12px;line-height:1.5}.personal-home-lane{border:1px solid var(--pw-line);background:#fff;border-radius:16px;flex-direction:column;min-width:0;min-height:100%;display:flex;box-shadow:0 1px 4px #1e1c140a}.personal-manager-greeting>span{background:var(--pw-blue-soft);width:38px;height:38px;color:var(--pw-blue);border-radius:12px;place-items:center;display:grid}.personal-manager-greeting div{gap:3px;display:grid}.personal-manager-greeting strong{letter-spacing:-.01em}.personal-manager-greeting p{color:var(--pw-muted);margin:0;font-size:13px}.personal-proposal-explainer{background:var(--pw-blue-soft);color:var(--pw-text);border-radius:10px;padding:10px 12px;font-size:12px;line-height:1.55}.personal-home-board{gap:12px;min-width:0;display:grid}.personal-home-lanes{grid-template-columns:repeat(4,minmax(170px,1fr));gap:10px;min-width:0;display:grid}.personal-home-lane{border:1px solid var(--pw-line);background:#ffffff85;border-radius:15px;align-content:start;min-width:0;min-height:260px;padding:12px;display:grid}.personal-home-lane>header{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-home-lane>header span{align-items:center;gap:7px;font-size:13px;font-weight:700;display:inline-flex}.personal-home-lane>header i,.personal-home-goal-meta i{background:var(--pw-faint);border-radius:50%;width:8px;height:8px}.personal-home-lane>header b{min-width:24px;color:var(--pw-muted);font-variant-numeric:tabular-nums;text-align:right;font-size:12px}.personal-home-lane>p{min-height:34px;color:var(--pw-muted);margin:7px 0 10px;font-size:10.5px;line-height:1.55}.personal-home-lane.is-needs_you>header i,.personal-home-lane.is-needs_you .personal-home-goal-meta i{background:var(--pw-amber)}.personal-home-lane.is-running>header i,.personal-home-lane.is-running .personal-home-goal-meta i{background:var(--pw-green)}.personal-home-lane.is-observing>header i,.personal-home-lane.is-observing .personal-home-goal-meta i{background:var(--pw-blue)}.personal-home-lane.is-scheduled>header i,.personal-home-lane.is-scheduled .personal-home-goal-meta i{background:#8b6bd8}.personal-home-lane-list{align-content:start;gap:9px;display:grid}.personal-home-goal-card{border:1px solid var(--pw-line);width:100%;min-width:0;color:inherit;cursor:pointer;text-align:left;background:#fff;border-radius:12px;gap:7px;padding:12px;transition:border-color .14s,transform .14s,box-shadow .14s;display:grid;box-shadow:0 1px 4px #1e1c140f}.personal-home-goal-card:hover{border-color:var(--pw-line-strong);transform:translateY(-1px);box-shadow:0 4px 12px #1e1c1414}.personal-home-goal-card:focus-visible{outline-offset:2px;outline:2px solid #7da2ff}.personal-home-goal-meta{min-width:0;color:var(--pw-muted);text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:6px;font-size:10.5px;display:flex;overflow:hidden}.personal-home-goal-card>strong{text-overflow:ellipsis;font-size:13px;line-height:1.45;overflow:hidden}.personal-home-goal-card>p{color:var(--pw-muted);-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:0;font-size:11px;line-height:1.55;display:-webkit-box;overflow:hidden}.personal-home-goal-card>footer{justify-content:space-between;align-items:center;gap:8px;padding-top:2px;display:flex}.personal-home-goal-card>footer span{color:var(--pw-muted);background:#f2f1ed;border-radius:99px;flex:none;padding:2px 7px;font-size:9.5px}.personal-home-goal-card>footer small{color:var(--pw-faint);text-overflow:ellipsis;white-space:nowrap;font-size:9.5px;overflow:hidden}.personal-home-empty{border:1px dashed var(--pw-line-strong);min-height:96px;color:var(--pw-faint);border-radius:11px;place-items:center;font-size:11px;display:grid}.personal-home-history{border:1px solid var(--pw-line);background:#fff9;border-radius:13px}.personal-home-history>summary{cursor:pointer;align-items:center;gap:9px;min-height:44px;padding:0 14px;list-style:none;display:flex}.personal-home-history>summary::-webkit-details-marker{display:none}.personal-home-history>summary span{font-size:12.5px;font-weight:700}.personal-home-history>summary b{color:var(--pw-muted);font-size:11px}.personal-home-history>summary small{color:var(--pw-faint);margin-left:auto;font-size:10.5px}.personal-home-history>div{grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:9px;padding:0 12px 12px;display:grid}.personal-session-record{background:var(--pw-blue-soft);border:1px solid #cfdcf9;border-radius:14px;grid-template-columns:minmax(0,1fr) auto;gap:10px 16px;margin-bottom:12px;padding:14px 16px;display:grid}.personal-session-record>header{grid-column:1/-1;justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-session-record>header span{color:var(--pw-blue-ink);align-items:center;gap:7px;font-size:12px;font-weight:700;display:inline-flex}.personal-session-record>header button{width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;place-items:center;padding:0;display:grid}.personal-session-record>header button:hover{color:var(--pw-text);background:#ffffffb3}.personal-session-record>div{min-width:0}.personal-session-record>div strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;display:block;overflow:hidden}.personal-session-record>div p{color:var(--pw-muted);margin:4px 0 0;font-size:11px}.personal-session-record dl{grid-column:1/-1;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0;display:grid}.personal-session-record dl div{background:#ffffff9e;border-radius:9px;gap:2px;min-width:0;padding:8px 10px;display:grid}.personal-session-record dt{color:var(--pw-faint);font-size:9.5px}.personal-session-record dd{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;margin:0;font:10.5px/1.4 SF Mono,ui-monospace,Menlo,Consolas,monospace;overflow:hidden}.personal-session-record>.personal-secondary-action{grid-area:2/2;align-self:center}.personal-channel-timeline{gap:10px;display:grid}.personal-live-region{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:fixed;overflow:hidden}.personal-timeline-row{border:1px solid var(--pw-line);background:var(--pw-card);width:100%;min-height:64px;color:inherit;cursor:pointer;text-align:left;border-radius:14px;grid-template-columns:38px minmax(0,1fr) auto auto 16px;align-items:center;gap:12px;padding:11px 15px;transition:border-color .14s,box-shadow .14s;display:grid}.personal-timeline-row:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-timeline-row:focus-visible{outline-offset:2px;outline:2px solid #7da2ff}.personal-row-icon{border-radius:11px;place-items:center;width:34px;height:34px;display:grid}.personal-row-icon.is-attention{color:var(--pw-amber);background:var(--pw-amber-bg)}.personal-row-icon.is-run{color:var(--pw-blue-ink);background:var(--pw-blue-soft)}.personal-row-icon.is-output{color:var(--pw-green);background:var(--pw-green-bg)}.personal-row-copy,.personal-run-identity{gap:3px;min-width:0;display:grid}.personal-row-copy strong,.personal-row-copy small,.personal-row-copy span,.personal-run-identity strong,.personal-run-identity small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.personal-row-copy strong{font-size:13.5px;font-weight:600}.personal-row-copy small,.personal-run-identity small,.personal-row-copy span{color:var(--pw-muted);font-size:11px}.personal-row-status{color:var(--pw-muted);white-space:nowrap;background:#f2f1ed;border-radius:99px;align-items:center;gap:5px;padding:2.5px 10px;font-size:11px;font-weight:600;display:inline-flex}.personal-row-status.is-running{background:var(--pw-green-bg);color:var(--pw-green)}.personal-run-row{grid-template-columns:38px minmax(90px,.65fr) minmax(160px,1.4fr) 90px auto auto 16px}.personal-run-open-label{color:var(--pw-blue-ink);white-space:nowrap;font-size:10.5px;font-weight:650}.personal-run-identity strong{font-size:12px}.personal-run-progress{gap:5px;display:grid}.personal-run-progress small{color:var(--pw-muted);font-variant-numeric:tabular-nums;font-size:10px}.personal-run-progress i{background:#f0efeb;border-radius:99px;height:4px;display:block;overflow:hidden}.personal-run-progress b{border-radius:inherit;background:var(--pw-blue);height:100%;display:block}.personal-output-row time{color:var(--pw-muted);font-size:11px}.personal-spin{animation:1.2s linear infinite pw-spin}@keyframes pw-spin{to{transform:rotate(360deg)}}.personal-message{gap:11px;max-width:84%;padding:6px 2px;display:flex}.personal-message.is-user{background:var(--pw-blue-soft);color:var(--pw-text);border:1px solid #dbe7fd;border-radius:16px 16px 4px;justify-self:end;padding:11px 15px}.personal-message-avatar{background:var(--pw-blue-soft);height:34px;color:var(--pw-blue-ink);border-radius:11px;flex:0 0 34px;place-items:center;display:grid}.personal-message header{align-items:baseline;gap:8px;display:flex}.personal-message header strong{font-size:12px}.personal-message time{color:var(--pw-faint);font-size:10px}.personal-message p{white-space:pre-wrap;margin:6px 0 0;font-size:13.5px;line-height:1.7}.personal-message-pending{color:var(--pw-muted);font-size:11px}.personal-return-delivery{color:var(--pw-muted);margin-top:7px;font-size:11px;font-weight:600;display:inline-block}.personal-return-delivery.is-delivered{color:var(--pw-green)}.personal-return-delivery.is-verification_required{color:var(--pw-blue-ink)}.personal-return-delivery.is-explicit_unverified{color:var(--pw-amber)}.personal-message-images{flex-wrap:wrap;gap:7px;margin-top:8px;display:flex}.personal-message-images img{object-fit:cover;border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;width:min(220px,100%);max-height:180px}.personal-md{overflow-wrap:anywhere;font-size:13.5px;line-height:1.7}.personal-md>*+*{margin-top:8px}.personal-md p{margin:0}.personal-md-heading.is-h1,.personal-md-heading.is-h2{font-size:14.5px}.personal-md-code{color:#4d5361;background:#f0efe9;border-radius:5px;padding:1px 5px;font-family:SF Mono,ui-monospace,Menlo,Consolas,monospace;font-size:.86em}.personal-md-pre{color:#e8ecf3;white-space:pre;background:#23262e;border-radius:10px;margin:0;padding:12px 14px;font:12px/1.65 SF Mono,ui-monospace,Menlo,Consolas,monospace;overflow-x:auto}.personal-md-pre code{font:inherit}.personal-md-link{color:var(--pw-blue-ink);text-underline-offset:2px;word-break:break-all;text-decoration:underline}.personal-agent-avatar{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:13px;flex:none;place-items:center;width:44px;height:44px;font-size:18px;font-weight:700;display:grid;box-shadow:0 2px 6px #2f66e947}.personal-agent-health.is-off{color:var(--pw-muted);background:#f2f1ed}.personal-agent-persona dl{border-top:1px solid var(--pw-line);margin-top:14px;padding-top:13px}.personal-detail-card-title{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-detail-card-title em{color:var(--pw-muted);background:#f1f1ee;border-radius:99px;padding:2px 8px;font-size:10px;font-style:normal;font-weight:650}.personal-goal-repository h3{align-items:center;gap:8px;display:flex}.personal-goal-notification h3{justify-content:space-between;align-items:center;gap:8px;display:flex}.personal-connection-status{background:var(--pw-green-bg);color:var(--pw-green);border-radius:99px;padding:2px 8px;font-size:10px;font-weight:650}.personal-subagent-heading{justify-content:space-between;align-items:flex-start;gap:14px;display:flex}.personal-subagent-heading h3{align-items:center;gap:7px;margin-bottom:0;display:flex}.personal-subagent-switch{border:1px solid var(--pw-line-strong);min-height:32px;color:var(--pw-muted);cursor:pointer;background:#f2f1ed;border-radius:99px;flex:none;align-items:center;gap:7px;padding:4px 9px 4px 5px;font-size:11px;font-weight:700;display:inline-flex}.personal-subagent-switch>span{background:#c8c8c2;border-radius:99px;width:30px;height:18px;transition:background .18s;position:relative}.personal-subagent-switch>span:after{content:"";background:#fff;border-radius:50%;width:12px;height:12px;transition:transform .18s;position:absolute;top:3px;left:3px}.personal-subagent-switch[aria-checked=true]{background:var(--pw-green-bg);color:var(--pw-green);border-color:#b9dccb}.personal-subagent-switch[aria-checked=true]>span{background:var(--pw-green)}.personal-subagent-switch[aria-checked=true]>span:after{transform:translate(12px)}.personal-subagent-switch[data-pending=true]{color:#8a6b00;opacity:1;background:#fffbed;border-color:#d8c67a}.personal-subagent-switch:disabled{cursor:default;opacity:.55}.personal-subagent-switch[data-pending=true]:disabled{opacity:1}.personal-subagent-fields{border-top:1px solid var(--pw-line);grid-template-columns:minmax(0,1fr) 112px;gap:10px;margin-top:14px;padding-top:13px;display:grid}.personal-subagent-fields label{color:var(--pw-text);align-content:start;gap:6px;font-size:11.5px;font-weight:650;display:grid}.personal-subagent-fields input:not([type=checkbox]),.personal-subagent-fields select{border:1px solid var(--pw-line-strong);min-width:0;min-height:38px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 10px;font-size:12px}.personal-subagent-fields label small{color:var(--pw-faint);font-size:10.5px;font-weight:450;line-height:1.45}.personal-subagent-domain-picker{border:0;grid-column:1/-1;min-width:0;margin:0;padding:0}.personal-subagent-domain-picker>legend{color:var(--pw-text);margin-bottom:7px;padding:0;font-size:11.5px;font-weight:650}.personal-subagent-domain-picker>small{color:var(--pw-faint);margin-top:7px;font-size:10.5px;line-height:1.45;display:block}.personal-subagent-domain-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;display:grid}.personal-subagent-domain-option{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:9px;grid-template-columns:auto minmax(0,1fr);min-height:44px;padding:8px 9px;align-items:center!important;display:grid!important}.personal-subagent-domain-option:hover{border-color:#b9c9dc}.personal-subagent-domain-option:has(input:focus-visible){outline:2px solid var(--pw-blue);outline-offset:2px}.personal-subagent-domain-option.is-selected{background:var(--pw-blue-soft);border-color:#9fc4ed}.personal-subagent-domain-option input{width:15px;height:15px;accent-color:var(--pw-blue);margin:0}.personal-subagent-domain-option>span{gap:1px;min-width:0;display:grid}.personal-subagent-domain-option strong{text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;overflow:hidden}.personal-subagent-domain-option small{font-size:9.5px!important;font-weight:450!important}.personal-subagent-domain-empty{border:1px dashed var(--pw-line-strong);background:var(--pw-bg);color:var(--pw-muted);border-radius:9px;grid-column:1/-1;margin:0;padding:10px;font-size:10.5px;line-height:1.5}.personal-subagent-limit-field{grid-column:1/-1;width:112px}.personal-subagent-fields .personal-secondary-action{grid-column:1/-1;margin-top:0}.personal-subagent-preview{background:#fffbed;border:1px solid #d8c67a;border-radius:10px;margin-top:10px;padding:12px}.personal-subagent-preview>strong{font-size:12.5px}.personal-subagent-preview>p{margin:5px 0 0}.personal-subagent-preview>div{grid-template-columns:1fr 1fr;gap:8px;display:grid}.personal-subagent-preview .personal-primary-action,.personal-subagent-preview .personal-secondary-action{min-height:38px;margin-top:10px}.personal-subagent-feedback{align-items:flex-start;gap:7px;display:flex;margin:10px 0 0!important}.personal-subagent-feedback.is-success{color:var(--pw-green)!important}.personal-subagent-feedback.is-warning{color:#8a6b00!important}.personal-subagent-feedback.is-error{color:var(--pw-red)!important}.personal-subagent-read-only{margin-bottom:0}.personal-settings-page{--pw-bg:#fbfaf7;--pw-card:#fff;--pw-line:#eceae3;--pw-line-strong:#e0ddd4;--pw-muted:#82889a;--pw-faint:#aab0bf;--pw-text:#23262e;--pw-blue:#2f66e9;--pw-blue-ink:#2456c8;--pw-blue-soft:#ebf1fe;--pw-red:#c2402f;--pw-red-bg:#fcecea;--pw-green:#2e7d5b;--pw-green-bg:#e6f3ec;background:var(--pw-bg);height:100dvh;min-height:0;color:var(--pw-text);grid-template-rows:minmax(0,1fr);grid-template-columns:268px minmax(0,1fr);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;display:grid;overflow:hidden}.personal-settings-sidebar{overscroll-behavior:contain;scrollbar-gutter:stable;border-right:1px solid var(--pw-line);background:#f5f3ee;flex-direction:column;gap:14px;min-width:0;height:100%;min-height:0;padding:18px 14px;display:flex;position:relative;overflow-y:auto}.personal-settings-page :focus-visible{outline-offset:2px;outline:2px solid #5f87ed}.personal-settings-back{width:100%;min-height:40px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:10px;align-items:center;gap:8px;padding:0 10px;font-size:13px;font-weight:650;display:inline-flex}.personal-settings-back:hover{color:var(--pw-text);background:#ffffffa6}.personal-settings-title{border-bottom:1px solid var(--pw-line);gap:3px;padding:8px 10px 10px;display:grid}.personal-settings-title small{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-settings-title strong{letter-spacing:-.02em;font-size:18px}.personal-settings-header{justify-content:space-between;align-items:flex-start;gap:24px;margin-bottom:24px;display:flex}.personal-settings-header small{color:var(--pw-blue);letter-spacing:.08em;text-transform:uppercase;font-size:11px;font-weight:700}.personal-settings-header h1{letter-spacing:-.035em;margin:4px 0 2px;font-size:28px}.personal-settings-tabs{gap:3px;display:grid}.personal-settings-tabs button{width:100%;min-height:54px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:11px;grid-template-columns:32px minmax(0,1fr);align-items:center;gap:9px;padding:8px 10px;display:grid}.personal-settings-tabs button:hover{color:var(--pw-text);background:#ffffffa6}.personal-settings-tabs button[aria-current=page]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c141a}.personal-settings-tabs button>span{gap:2px;min-width:0;display:grid}.personal-settings-tabs strong{font-size:13px}.personal-settings-body{overscroll-behavior:contain;scrollbar-gutter:stable;min-width:0;min-height:0;padding:30px clamp(24px,5vw,72px);overflow:auto}.personal-settings-body:has(>.personal-capability-settings){grid-template-rows:auto minmax(0,1fr);display:grid;overflow:hidden}.personal-settings-body>.personal-settings-header{min-width:0}.personal-settings-page *,.personal-settings-page :before,.personal-settings-page :after{box-sizing:border-box}.personal-appearance-settings{max-width:680px}.personal-settings-choice-group{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:14px;display:grid}.personal-settings-choice-group button{border:1px solid var(--pw-line);min-height:60px;color:inherit;cursor:pointer;text-align:left;background:#fff;border-radius:12px;grid-template-columns:34px minmax(0,1fr);align-items:center;gap:10px;padding:13px;display:grid}.personal-settings-choice-group button:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-settings-choice-group button[aria-checked=true]{background:#f7f9ff;border-color:#9fb9f4;box-shadow:0 0 0 3px #2f66e91a}.personal-settings-choice-group strong{align-self:center;font-size:13px}.personal-settings-theme-swatch{border:1px solid var(--pw-line-strong);border-radius:10px;width:34px;height:34px;display:block}.personal-settings-theme-swatch.is-loopx{background:linear-gradient(135deg,#171717 0 44%,#0070f3 44% 54%,#fafafa 54% 76%,#fff 76%);border-radius:6px}.personal-settings-theme-swatch.is-paper{background:linear-gradient(135deg,#fbfaf7 0 48%,#2f66e9 48% 58%,#fff 58%)}.personal-settings-theme-swatch.is-brutal{background:linear-gradient(135deg,#ffd91a 0 45%,#ff8fd0 45% 70%,#8fdcff 70%);border:2px solid #141414;border-radius:5px;box-shadow:2px 2px #141414}.personal-lark-settings{background:var(--pw-bg);min-height:100vh;color:var(--pw-text);padding:30px clamp(24px,5vw,72px);position:relative}.personal-lark-settings.is-embedded{background:0 0;min-height:0;padding:0}.personal-lark-header{justify-content:space-between;align-items:flex-start;gap:24px;max-width:1180px;margin:0 auto;display:flex}.personal-lark-header small{color:var(--pw-blue);letter-spacing:.08em;text-transform:uppercase;font-size:11px;font-weight:700}.personal-lark-header h1{letter-spacing:-.035em;margin:4px 0 2px;font-size:28px}.personal-lark-header p{color:var(--pw-muted);margin:0;font-size:13px}.personal-lark-tabs{border-bottom:1px solid var(--pw-line);gap:24px;max-width:1180px;margin:28px auto 20px;display:flex}.personal-lark-settings.is-embedded .personal-lark-tabs{margin-top:0}.personal-lark-tabs button{min-height:42px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-bottom:2px solid #0000;align-items:center;gap:8px;padding:0 2px;font-weight:650;display:flex}.personal-lark-tabs button[aria-current=page]{border-color:var(--pw-blue);color:var(--pw-text)}.personal-lark-tabs span{min-width:20px;height:20px;color:var(--pw-muted);background:#efeee9;border-radius:99px;place-items:center;padding:0 5px;font-size:10px;display:inline-grid}.personal-lark-section-heading{max-width:1180px;margin:0 auto 18px}.personal-lark-section-heading small{color:var(--pw-blue);letter-spacing:.07em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-lark-section-heading h2{letter-spacing:-.025em;margin:4px 0;font-size:21px}.personal-lark-section-heading p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-lark-subtabs{margin-top:0}.personal-settings-content{max-width:1180px;margin:0 auto}.personal-settings-card{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:16px;max-width:720px;overflow:hidden;box-shadow:0 8px 30px #1e1c140a}.personal-settings-card>header{border-bottom:1px solid var(--pw-line);align-items:center;gap:13px;padding:20px;display:flex}.personal-settings-card>header h2{letter-spacing:-.02em;margin:0;font-size:17px}.personal-settings-card>header p{color:var(--pw-muted);margin:4px 0 0;font-size:12px;line-height:1.5}.personal-settings-icon{background:var(--pw-blue-soft);width:40px;height:40px;color:var(--pw-blue);border-radius:12px;flex:none;place-items:center;display:grid}.personal-language-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:18px 20px;display:grid}.personal-language-options>button{border:1px solid var(--pw-line);min-height:66px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border-radius:12px;justify-content:space-between;align-items:center;gap:18px;padding:13px 15px;transition:border-color .15s,background-color .15s,box-shadow .15s;display:flex}.personal-language-options>button:hover{border-color:var(--pw-line-strong);background:#fcfbf8}.personal-language-options>button.is-selected{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-color:#9bb5f0;box-shadow:0 0 0 1px #2f66e814}.personal-language-options>button>span{gap:4px;display:grid}.personal-language-options strong{font-size:13px}.personal-settings-card>footer{border-top:1px solid var(--pw-line);color:var(--pw-faint);background:#faf9f6;padding:13px 20px;font-size:11px}.personal-machine-loading{min-height:220px;color:var(--pw-muted);place-items:center;font-size:13px;display:grid}.personal-machine-layout{grid-template-columns:210px minmax(0,1fr);gap:22px;max-width:1080px;display:grid}.personal-machine-namespaces{min-width:0}.personal-machine-namespaces>div{gap:3px;margin-bottom:10px;padding:0 4px;display:grid}.personal-machine-namespaces>div small,.personal-machine-editor>header small,.personal-machine-editor-bar small{color:var(--pw-blue);letter-spacing:.07em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-machine-namespaces>div strong{font-size:13px}.personal-machine-namespaces nav{gap:5px;display:grid}.personal-machine-namespaces button{width:100%;min-height:52px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:1px solid #0000;border-radius:10px;gap:3px;padding:9px 11px;display:grid}.personal-machine-namespaces button:hover{border-color:var(--pw-line);background:#fff9}.personal-machine-namespaces button[aria-current=page]{border-color:var(--pw-line-strong);color:var(--pw-text);background:#fff;box-shadow:0 2px 8px #1e1c140d}.personal-machine-namespaces button span{overflow-wrap:anywhere;font-size:12px;font-weight:650}.personal-machine-namespaces button small{color:var(--pw-muted);font-size:10px}.personal-machine-content{min-width:0}.personal-machine-summary{border:1px solid var(--pw-line);background:#fff;border-radius:14px;justify-content:space-between;align-items:center;gap:20px;margin-bottom:14px;padding:14px 16px;display:flex}.personal-machine-summary>div{align-items:center;gap:11px;min-width:0;display:flex}.personal-machine-summary>div>span:last-child{gap:3px;display:grid}.personal-machine-summary>div small{color:var(--pw-muted);text-transform:uppercase;font-size:10px;font-weight:650}.personal-machine-summary>div strong{font-size:13px}.personal-machine-summary dl{gap:22px;margin:0;display:flex}.personal-machine-summary dl div{gap:3px;display:grid}.personal-machine-summary dt{color:var(--pw-muted);font-size:10px}.personal-machine-summary dd{margin:0;font-family:SFMono-Regular,Consolas,monospace;font-size:11px;font-weight:650}.personal-machine-editor-bar{justify-content:space-between;align-items:center;gap:14px;margin-bottom:10px;padding:0 2px;display:flex}.personal-machine-editor-mode{border:1px solid var(--pw-line);background:#f5f4f0;border-radius:9px;flex:none;gap:3px;padding:3px;display:flex}.personal-machine-editor-mode button{min-height:44px;color:var(--pw-muted);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:6px;padding:0 12px;font-size:11px;font-weight:650}.personal-machine-editor-mode button[aria-pressed=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c1414}.personal-machine-editor{border:1px solid var(--pw-line);background:#fff;border-radius:16px;overflow:hidden;box-shadow:0 8px 30px #1e1c140a}.personal-machine-editor>header{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:flex-start;gap:20px;padding:20px;display:flex}.personal-machine-editor>header h2{letter-spacing:-.02em;margin:4px 0 3px;font-size:18px}.personal-machine-editor>header p{max-width:610px;color:var(--pw-muted);margin:0;font-size:12px;line-height:1.55}.personal-machine-switch{min-height:44px;color:var(--pw-muted);cursor:pointer;white-space:nowrap;flex:none;align-items:center;gap:9px;font-size:12px;font-weight:650;display:flex}.personal-machine-switch input{width:42px;height:24px;accent-color:var(--pw-blue);cursor:pointer;margin:0}.personal-machine-scope-note{color:var(--pw-blue-ink);background:#f6f8fd;border:1px solid #cfdaf3;border-radius:12px;align-items:flex-start;gap:10px;margin:18px 20px 0;padding:13px 14px;display:flex}.personal-machine-scope-note svg{flex:none;margin-top:1px}.personal-machine-scope-note strong{font-size:12px}.personal-machine-scope-note p{color:#52627f;margin:3px 0 0;font-size:11px;line-height:1.55}.personal-machine-editor fieldset{border:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:0;padding:20px;display:grid}.personal-machine-editor fieldset label{align-content:start;gap:6px;min-width:0;display:grid}.personal-machine-editor fieldset label:last-child{grid-column:1/-1}.personal-machine-editor fieldset label>span{font-size:12px;font-weight:650}.personal-machine-editor fieldset label>small{color:var(--pw-muted);font-size:10.5px;line-height:1.45}.personal-machine-editor input[type=text],.personal-machine-editor fieldset input{border:1px solid var(--pw-line-strong);width:100%;min-width:0;min-height:42px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 11px;font-size:13px}.personal-machine-editor fieldset:disabled{opacity:.58}.personal-machine-editor fieldset:disabled input{cursor:not-allowed}.personal-machine-json-editor>label{gap:7px;padding:20px;display:grid}.personal-machine-json-editor>label>span{font-size:12px;font-weight:650}.personal-machine-json-editor>label>small{color:var(--pw-muted);font-size:10.5px;line-height:1.5}.personal-machine-json-editor textarea{resize:vertical;border:1px solid var(--pw-line-strong);width:100%;min-width:0;color:var(--pw-text);tab-size:2;background:#fafafa;border-radius:9px;padding:12px 13px;font:12px/1.6 SFMono-Regular,Consolas,monospace}.personal-machine-json-editor textarea:focus-visible{outline:2px solid var(--pw-blue);outline-offset:2px}.personal-machine-validation,.personal-machine-error,.personal-machine-notice{border-radius:9px;margin:0 20px 16px;padding:10px 12px;font-size:11px;line-height:1.5}.personal-machine-validation,.personal-machine-error{background:var(--pw-red-bg);color:var(--pw-red);border:1px solid #edc1ba}.personal-machine-notice{background:var(--pw-green-bg);color:var(--pw-green);border:1px solid #bcdacb;align-items:center;gap:8px;display:flex}.personal-machine-preview{background:#f8faff;border:1px solid #aebfec;border-radius:12px;margin:0 20px 18px;padding:14px}.personal-machine-preview header{justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-machine-preview header strong{font-size:12px}.personal-machine-preview header span{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:99px;padding:3px 8px;font-size:10px;font-weight:650}.personal-machine-preview dl{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:12px 0;display:grid}.personal-machine-preview dl div{background:#fff;border:1px solid #dfe5f3;border-radius:8px;min-width:0;padding:8px}.personal-machine-preview dt{color:var(--pw-muted);font-size:9.5px}.personal-machine-preview dd{overflow-wrap:anywhere;margin:4px 0 0;font-family:SFMono-Regular,Consolas,monospace;font-size:10.5px;font-weight:650}.personal-machine-preview p{color:#52627f;margin:0;font-size:10.5px;line-height:1.5}.personal-machine-rollback{border:1px solid var(--pw-line);background:#faf9f6;border-radius:12px;justify-content:space-between;align-items:center;gap:18px;margin:0 20px 18px;padding:13px 14px;display:flex}.personal-machine-rollback strong{font-size:12px}.personal-machine-rollback p{color:var(--pw-muted);margin:3px 0 0;font-size:10.5px;line-height:1.45}.personal-machine-rollback .personal-secondary-action{flex:none;width:auto;min-height:40px;margin:0;padding:0 13px}.personal-machine-editor>footer{border-top:1px solid var(--pw-line);background:#faf9f6;justify-content:flex-end;gap:10px;padding:15px 20px;display:flex}.personal-machine-editor>footer .personal-primary-action,.personal-machine-editor>footer .personal-secondary-action,.personal-machine-editor>footer .personal-danger-action{width:auto;min-height:42px;margin:0;padding:0 15px}.personal-machine-unavailable{border:1px dashed var(--pw-line-strong);min-height:180px;color:var(--pw-muted);background:#fff;border-radius:14px;justify-items:start;gap:8px;padding:26px;display:grid}.personal-machine-unavailable strong{color:var(--pw-text);font-size:13px}.personal-machine-unavailable p{max-width:540px;margin:0;font-size:11px;line-height:1.6}.personal-lark-loading,.personal-lark-empty{min-height:130px;color:var(--pw-muted);justify-content:center;align-items:center;gap:8px;font-size:13px;display:flex}.personal-lark-apps{max-width:1180px;margin:0 auto}.personal-lark-app-toolbar{color:var(--pw-muted);justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;font-size:11px;display:flex}.personal-lark-app-toolbar .personal-primary-action{width:auto;min-height:40px;margin:0;padding:0 16px}.personal-lark-app-grid{grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px;display:grid}.personal-lark-app-card{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:15px;grid-template-columns:42px minmax(0,1fr) auto;align-items:center;gap:11px;padding:18px;display:grid}.personal-lark-app-avatar{background:var(--pw-blue-soft);width:42px;height:42px;color:var(--pw-blue);border-radius:12px;place-items:center;display:grid}.personal-lark-app-card div{gap:3px;display:grid}.personal-lark-app-card small,.personal-lark-app-card p{color:var(--pw-muted);font-size:11px}.personal-lark-app-card em{border-radius:99px;padding:3px 9px;font-size:10px;font-style:normal;font-weight:650}.personal-lark-app-card em.is-ready{background:var(--pw-green-bg);color:var(--pw-green)}.personal-lark-app-card em.is-off{color:var(--pw-muted);background:#f1f1ee}.personal-lark-app-card p{grid-column:2/-1;margin:0}.personal-lark-connections{max-width:1180px;margin:0 auto}.personal-lark-route-readiness{background:var(--pw-amber-bg);color:var(--pw-amber);border:1px solid #ead49a;border-radius:10px;align-items:center;gap:8px;margin:0 0 12px;padding:10px 12px;font-size:12px;font-weight:650;line-height:1.5;display:flex}.personal-lark-route-readiness svg{flex:none}.personal-lark-toolbar{justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;display:flex}.personal-lark-toolbar>label{border:1px solid var(--pw-line);max-width:680px;height:40px;color:var(--pw-faint);background:#fff;border-radius:10px;flex:1;align-items:center;gap:8px;padding:0 12px;display:flex}.personal-lark-toolbar input{width:100%;font:inherit;background:0 0;border:0;outline:0}.personal-lark-toolbar .personal-primary-action{flex:none;width:auto;min-height:40px;margin-top:0;padding:0 16px}.personal-lark-table{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:14px;overflow:hidden}.personal-lark-table-head,.personal-lark-table-row{grid-template-columns:1.35fr 1.35fr .72fr .72fr 100px;align-items:center;gap:16px;padding:12px 16px;display:grid}.personal-lark-table-head{border-bottom:1px solid var(--pw-line);min-height:42px;color:var(--pw-faint);letter-spacing:.04em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-lark-table-row{border-bottom:1px solid var(--pw-line);min-height:70px;font-size:12px}.personal-lark-table-row:last-of-type{border-bottom:0}.personal-lark-table-row>span{gap:3px;min-width:0;display:grid}.personal-lark-table-row strong,.personal-lark-table-row small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.personal-lark-table-row small{color:var(--pw-muted);font-size:10px}.personal-lark-row-actions{justify-content:flex-end;display:flex!important}.personal-lark-row-actions button,.personal-lark-modal header button{border:1px solid var(--pw-line);min-height:30px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:8px;align-items:center;gap:4px;padding:0 8px;font-size:10px;display:inline-flex}.personal-lark-row-actions button.is-confirm{background:var(--pw-red-bg);color:var(--pw-red);border-color:#e6b0aa}.personal-lark-modal-backdrop{z-index:80;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background:#1e1f2361;place-items:center;padding:24px;display:grid;position:fixed;inset:0}.personal-lark-modal{border:1px solid var(--pw-line);background:#fff;border-radius:18px;gap:14px;width:min(560px,100%);max-height:calc(100vh - 48px);padding:22px;display:grid;overflow:auto;box-shadow:0 24px 70px #14182340}.personal-lark-modal header{justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.personal-lark-modal header small{color:var(--pw-muted);font-size:10px}.personal-lark-modal h2{letter-spacing:-.02em;margin:3px 0 0;font-size:20px}.personal-lark-modal>label{color:var(--pw-muted);gap:7px;font-size:11px;font-weight:650;display:grid}.personal-lark-modal>label>small{color:var(--pw-faint);font-size:10px;font-weight:450;line-height:1.45}.personal-lark-modal input[type=search],.personal-lark-modal input[type=text],.personal-lark-modal input:not([type]),.personal-lark-modal select{border:1px solid var(--pw-line-strong);width:100%;min-height:40px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 11px}.personal-lark-modal label:has(input[type=search]){grid-template-columns:1fr}.personal-lark-modal label:has(input[type=search]) input{margin-bottom:2px}.personal-lark-group-state{border:1px dashed var(--pw-line-strong);min-height:40px;color:var(--pw-muted);background:#fafaf8;border-radius:9px;align-items:center;gap:7px;padding:9px 11px;font-size:11px;font-weight:500;line-height:1.45;display:flex}.personal-lark-group-state.is-error{background:var(--pw-red-bg);color:var(--pw-red);border-style:solid;border-color:#efc3bd}.personal-lark-check{border:1px solid var(--pw-line);background:#fafaf8;border-radius:10px;align-items:flex-start;padding:12px;gap:10px!important;display:flex!important}.personal-lark-check input{accent-color:var(--pw-blue);margin-top:2px}.personal-lark-check span{gap:2px;display:grid}.personal-lark-check strong{color:var(--pw-text)}.personal-lark-check small{font-weight:400}.personal-lark-agent-apps{color:var(--pw-muted);border:0;gap:7px;margin:0;padding:0;display:grid}.personal-lark-agent-apps legend{margin-bottom:1px;font-size:11px;font-weight:650}.personal-lark-agent-apps>small{color:var(--pw-faint);font-size:10px;line-height:1.45}.personal-lark-agent-apps>div{gap:8px;display:grid}.personal-lark-agent-apps label{border:1px solid var(--pw-line);background:#fafaf8;border-radius:10px;grid-template-columns:minmax(0,1fr) minmax(180px,1fr);align-items:center;gap:12px;padding:10px 11px;display:grid}.personal-lark-agent-apps label>span{gap:2px;min-width:0;display:grid}.personal-lark-agent-apps label strong{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;font-size:11px;overflow:hidden}.personal-lark-agent-apps label small{color:var(--pw-faint);text-overflow:ellipsis;white-space:nowrap;font-size:9px;overflow:hidden}.personal-lark-agent-apps select{min-width:0}.personal-lark-ingress{color:var(--pw-muted);border:0;gap:7px;margin:0;padding:0;display:grid}.personal-lark-ingress legend{margin-bottom:1px;font-size:11px;font-weight:650}.personal-lark-ingress>div{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;display:grid}.personal-lark-ingress label{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:10px;min-height:84px;padding:11px;display:block;position:relative}.personal-lark-ingress label.is-active{border-color:var(--pw-blue);background:#2f69eb0f;box-shadow:0 0 0 1px #2f69eb24}.personal-lark-ingress input{opacity:0;width:1px;height:1px;position:absolute}.personal-lark-ingress span{gap:5px;display:grid}.personal-lark-ingress strong{color:var(--pw-text);font-size:11px}.personal-lark-ingress small{color:var(--pw-faint);font-size:9px;font-weight:450;line-height:1.35}.personal-lark-topic-preview{border:1px solid var(--pw-line);min-height:40px;color:var(--pw-text);background:#f7f7f4;border-radius:9px;align-items:center;gap:8px;padding:0 11px;font-size:12px;font-weight:500;display:flex}.personal-lark-topic-preview.is-locked{color:var(--pw-muted)}.personal-lark-cardinality{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:9px;align-items:center;gap:8px;margin:0;padding:10px 12px;font-size:11px;display:flex}.personal-lark-modal footer{z-index:2;border-top:1px solid var(--pw-line);background:#fff;justify-content:flex-end;gap:9px;margin:0 -22px -22px;padding:12px 22px 22px;display:flex;position:sticky;bottom:-22px}.personal-lark-modal footer button{width:auto;min-width:96px;margin-top:0;padding:0 16px}@media (width<=640px){.personal-lark-agent-apps label{grid-template-columns:1fr}}.personal-lark-modal-backdrop.is-setup{z-index:90}.personal-lark-setup-modal{width:min(620px,100%)}.personal-lark-setup-copy{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-lark-setup-progress{border:1px solid var(--pw-line);background:#fafaf8;border-radius:13px;grid-template-columns:46px minmax(0,1fr);align-items:center;gap:13px;min-height:132px;padding:18px;display:grid}.personal-lark-setup-progress>div{gap:5px;display:grid}.personal-lark-setup-progress p{color:var(--pw-muted);margin:0;font-size:11px;line-height:1.5}.personal-lark-setup-progress a{width:fit-content;color:var(--pw-blue);grid-column:2;align-items:center;gap:6px;font-size:11px;font-weight:650;text-decoration:none;display:inline-flex}.personal-lark-setup-icon{background:var(--pw-blue-soft);width:46px;height:46px;color:var(--pw-blue);border-radius:13px;place-items:center;display:grid}.personal-lark-setup-icon.is-ready{background:var(--pw-green-bg);color:var(--pw-green)}.personal-lark-setup-icon.is-failed,.personal-row-status.is-blocking{background:var(--pw-red-bg);color:var(--pw-red)}.personal-proposal-row{width:100%;color:inherit;cursor:pointer;text-align:left;background:#f5f8ff;border:1px solid #c3d3f9;border-radius:14px;grid-template-columns:36px minmax(0,1fr) auto;align-items:center;gap:12px;padding:14px;display:grid}.personal-proposal-row:hover{border-color:#8fabe9;box-shadow:0 2px 10px #2f66e814}.personal-proposal-row>span:first-child{color:#315fc8;background:#e4ebff;border-radius:11px;place-items:center;width:36px;height:36px;display:grid}.personal-proposal-row>span:nth-child(2){gap:3px;min-width:0;display:grid}.personal-proposal-row small{color:#5f74ad;font-size:10px}.personal-proposal-row strong{font-size:13px}.personal-proposal-row p{color:#686f7c;margin:0;font-size:11px}.personal-proposal-row>b{color:#315fc8;font-size:11px}.personal-proposal-row.is-applied{background:#f3fbf7;border-color:#b5ddcc}.personal-proposal-row.is-error,.personal-proposal-row.is-stale{background:#fff7f7;border-color:#efc3c3}.personal-proposal-row.is-gated{background:#fffaf0;border-color:#ead39c}.personal-gated-summary{background:#fffaf0;border:1px solid #ead39c;border-radius:14px}.personal-gated-summary>summary{color:#6d5620;cursor:pointer;align-items:center;gap:9px;padding:12px 14px;list-style:none;display:flex}.personal-gated-summary>summary::-webkit-details-marker{display:none}.personal-gated-summary>summary>span{color:#9a741d;background:#fff1c9;border-radius:9px;place-items:center;width:30px;height:30px;display:grid}.personal-gated-summary>summary small{color:#927d4c;margin-left:auto}.personal-gated-summary>div{gap:8px;padding:0 8px 8px;display:grid}.personal-gated-summary .personal-proposal-row{background:#fffdf7}.personal-schedule-row{border:1px solid var(--pw-line);background:var(--pw-card);width:100%;color:inherit;cursor:pointer;text-align:left;border-radius:14px;grid-template-columns:36px minmax(0,1fr) auto 16px;align-items:center;gap:12px;padding:13px 15px;display:grid}.personal-schedule-row:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-schedule-icon{width:34px;height:34px;color:var(--pw-muted);background:#f2f1ed;border-radius:11px;place-items:center;display:grid}.personal-schedule-copy{gap:2px;min-width:0;display:grid}.personal-schedule-copy small,.personal-schedule-copy p{color:var(--pw-muted);margin:0;font-size:10px}.personal-schedule-copy strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;overflow:hidden}.personal-schedule-status{background:var(--pw-green-bg);color:var(--pw-green);border-radius:99px;align-items:center;padding:2.5px 10px;font-size:11px;font-weight:600;display:inline-flex}.personal-schedule-status.is-paused{color:var(--pw-muted);background:#f2f1ed}.personal-timeline-empty{text-align:center;place-items:center;padding:70px 20px;display:grid}.personal-timeline-empty>span{background:var(--pw-blue-soft);width:44px;height:44px;color:var(--pw-blue);border-radius:14px;place-items:center;margin-bottom:14px;display:grid}.personal-timeline-empty p{max-width:420px;color:var(--pw-muted);font-size:13px}.personal-object-list{border:1px solid var(--pw-line);background:#fff;border-radius:14px;overflow:hidden}.personal-object-list>header,.personal-object-list>button{border:0;border-bottom:1px solid var(--pw-line);width:100%;min-height:52px;color:inherit;text-align:left;background:0 0;grid-template-columns:28px minmax(0,1fr) auto;align-items:center;gap:10px;padding:10px 15px;display:grid}.personal-object-list>header{min-height:46px;color:var(--pw-faint);letter-spacing:.06em;grid-template-columns:minmax(0,1fr) auto;font-size:12px;font-weight:650}.personal-object-list>button{cursor:pointer}.personal-object-list>button:hover{background:#faf9f6}.personal-object-list>button:last-child{border-bottom:0}.personal-object-list>button>p{color:var(--pw-muted);text-overflow:ellipsis;white-space:nowrap;grid-column:2/-1;margin:-3px 0 0;font-size:12px;line-height:1.45;overflow:hidden}.personal-object-list>button>em{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:999px;justify-self:end;padding:2px 7px;font-size:10px;font-style:normal;font-weight:700}.personal-object-list small{color:var(--pw-muted)}.personal-object-list>button>small{white-space:nowrap;align-items:center;gap:8px;display:inline-flex}.personal-object-list-state{border-bottom:1px solid var(--pw-line);color:var(--pw-muted);align-items:center;gap:8px;margin:0;padding:14px 15px;font-size:12px;line-height:1.5;display:flex}.personal-object-list-state.is-error{color:var(--pw-red);background:var(--pw-red-bg)}.personal-object-list .is-done{color:var(--pw-green)}.personal-object-list .is-attention{color:var(--pw-amber);font-weight:700}.personal-task-age{color:var(--pw-faint);font-size:11px}.personal-task-empty{color:var(--pw-muted);margin:0;padding:4px 15px 16px;font-size:12.5px}.personal-task-lane-filter{border:1px solid var(--pw-line);background:#fff;border-radius:10px;justify-content:space-between;align-items:center;gap:16px;min-height:50px;padding:8px 12px;display:flex}.personal-capability-settings{grid-template-rows:auto minmax(0,1fr);gap:16px;width:100%;min-width:0;max-width:1050px;min-height:0;display:grid;overflow:hidden}.personal-capability-scope-note{overscroll-behavior:contain;max-height:120px;color:var(--pw-muted);padding:12px 0;overflow:auto}.personal-capability-scope-note summary{cursor:pointer;align-items:center;gap:8px;font-size:12px;display:flex}.personal-capability-scope-note p{padding:10px 0 0 25px}.personal-capability-scope-note svg{flex:none;margin-top:2px}.personal-capability-scope-note p{margin:0;font-size:12px;line-height:1.55}.personal-capability-scope-note strong{color:var(--pw-text);display:block}.personal-capability-layout{grid-template-columns:220px minmax(0,1fr);align-items:stretch;gap:24px;min-width:0;min-height:0;display:grid;overflow:hidden}.personal-capability-list{overscroll-behavior:contain;scrollbar-gutter:stable;align-content:start;gap:6px;min-height:0;padding:3px;display:grid;overflow-y:auto}.personal-capability-list button{min-height:44px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border:1px solid #0000;border-radius:6px;justify-content:space-between;align-items:center;gap:8px;padding:10px 12px;display:flex}.personal-capability-list button:hover{border-color:#b8c9f5}.personal-capability-list button[aria-current=page]{background:#f4f7ff;border-color:#8cacf0;box-shadow:0 0 0 3px #2f66e914}.personal-capability-list button>span{gap:2px;min-width:0;display:grid}.personal-capability-list em{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:999px;flex:none;padding:3px 6px;font-size:9px;font-style:normal;font-weight:750}.personal-capability-list strong{overflow-wrap:anywhere;font-size:13px;font-weight:500;line-height:1.5}.personal-capability-detail{overscroll-behavior:contain;scrollbar-gutter:stable;border:1px solid var(--pw-line);background:#fff;border-radius:14px;align-self:start;min-width:0;min-height:0;max-height:100%;overflow:auto}.personal-capability-detail>header{border-bottom:1px solid var(--pw-line);align-items:flex-start;gap:12px;padding:24px;display:flex}.personal-capability-detail>header>div{flex:1;min-width:0}.personal-capability-help{color:var(--pw-muted);margin-top:8px;font-size:12px}.personal-capability-help summary{cursor:pointer}.personal-capability-help p{padding-top:12px}.personal-capability-help dl{gap:12px;margin-bottom:0;display:grid}.personal-capability-help dt{color:var(--pw-text);font-weight:500}.personal-capability-help dd{margin:4px 0 0;line-height:1.6}.personal-capability-detail h2{margin:2px 0 4px;font-size:17px}.personal-capability-detail p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.55}.personal-capability-value-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:16px 18px;display:grid}.personal-capability-raw-values{border-top:1px solid var(--pw-line)}.personal-capability-raw-values>summary{cursor:pointer;color:var(--pw-text);padding:16px 18px;font-size:12px}.personal-capability-raw-values>summary:focus-visible{outline:2px solid var(--pw-blue);outline-offset:-2px}.personal-capability-value-grid section{min-width:0}.personal-capability-value-grid strong,.personal-capability-field-summary>strong{font-size:11px}.personal-capability-value-grid pre{border:1px solid var(--pw-line);min-height:72px;max-height:220px;color:var(--pw-text);background:#faf9f6;border-radius:9px;margin:7px 0 0;padding:11px;font-size:10.5px;line-height:1.5;overflow:auto}.personal-capability-editor-status{border-radius:10px;align-items:flex-start;gap:10px;margin:20px 24px;padding:12px;display:flex}.personal-capability-heading-row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;display:flex}.personal-capability-heading-row .personal-capability-effective-source{color:var(--pw-muted);align-items:center;gap:6px;margin:0;display:flex}.personal-capability-effective-source span{color:var(--pw-muted);flex-wrap:wrap;gap:6px;font-size:11px;display:flex}.personal-capability-effective-source strong{color:var(--pw-text)}.personal-capability-editor-status svg{flex:none;margin-top:1px}.personal-capability-editor-status strong{font-size:12px}.personal-capability-editor-status p{margin-top:3px}.personal-capability-editor-status.is-preview{background:var(--pw-blue-soft);color:var(--pw-blue-ink)}.personal-capability-editor-status.is-read-only{color:#9a5a10;background:#fff5e8}.personal-capability-behavior-note{border:1px solid var(--pw-line);background:var(--pw-amber-bg);color:var(--pw-amber);border-radius:6px;align-items:flex-start;gap:10px;margin:16px 24px;padding:12px;display:flex}.personal-capability-behavior-note svg{flex:none;margin-top:1px}.personal-capability-behavior-note strong{font-size:12px}.personal-capability-behavior-note p{color:inherit;margin-top:3px}.personal-capability-editor-mode{color:var(--pw-muted);justify-content:flex-end;align-items:center;gap:12px;margin:8px 24px 0;font-size:11px;display:flex}.personal-capability-editor-mode button{min-height:44px;color:var(--pw-muted);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;gap:6px;padding:0 12px;font-size:11px;font-weight:650;display:inline-flex}.personal-capability-editor-mode button:hover{background:var(--pw-blue-soft);color:var(--pw-text)}.personal-capability-editor-mode button:disabled{cursor:not-allowed;opacity:.45}.personal-capability-field-summary{padding:20px 24px 24px}.personal-capability-field-summary .personal-capability-fields{margin-top:0}.personal-capability-fields{border:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:0;padding:0;display:grid}.personal-report-schedule{grid-column:1/-1;grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr));gap:12px;min-width:0;display:grid}.personal-report-schedule p{color:var(--pw-muted);overflow-wrap:anywhere;grid-column:1/-1;margin:0;font-size:12px}.personal-capability-fields label{align-content:start;gap:6px;min-width:0;display:grid}.personal-capability-fields label>span{font-size:12px;font-weight:650}.personal-capability-fields input:not([type=checkbox]),.personal-capability-fields select,.personal-capability-fields textarea{border:1px solid var(--pw-line-strong);width:100%;min-width:0;min-height:42px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:8px 11px;font-size:13px}.personal-capability-fields .is-boolean{border-bottom:1px solid var(--pw-line);grid-column:1/-1;grid-template-columns:minmax(0,1fr) auto;align-items:center;min-height:48px;padding-bottom:12px}.personal-capability-enabled-row{border-bottom:1px solid var(--pw-line);grid-column:1/-1;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:16px;min-width:0;min-height:60px;padding-bottom:12px;display:grid}.personal-capability-enabled-row>.is-boolean{display:contents}.personal-capability-enabled-row>.is-boolean>span{grid-area:1/1}.personal-capability-enabled-row>.is-boolean>input{grid-area:1/3}.personal-capability-enabled-row>.personal-capability-edit-json{grid-area:1/2}.personal-capability-edit-json{min-height:44px;color:var(--pw-muted);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;align-items:center;gap:6px;padding:0 8px;font-size:11px;display:inline-flex}.personal-capability-edit-json:hover{background:var(--pw-blue-soft);color:var(--pw-text)}.personal-capability-edit-json:disabled{cursor:not-allowed;opacity:.45}.personal-capability-fields .is-boolean input{appearance:none;border:1px solid var(--pw-line-strong);background:var(--pw-line);cursor:pointer;border-radius:999px;width:40px;height:24px;margin:0;padding:2px}.personal-capability-fields .is-boolean input:before{content:"";background:#fff;border-radius:50%;width:18px;height:18px;display:block}.personal-capability-fields .is-boolean input:checked{background:var(--pw-text)}.personal-capability-fields .is-boolean input:checked:before{transform:translate(16px)}.personal-capability-fields .is-boolean input:focus-visible{outline:2px solid var(--pw-blue);outline-offset:3px}.personal-capability-fields:disabled{opacity:.62}.personal-capability-json-editor{gap:7px;margin:0;padding:0 18px 18px;display:grid}.personal-capability-json-editor>span{font-size:11px;font-weight:650}.personal-capability-json-editor>small{color:var(--pw-muted);font-size:10.5px;line-height:1.5}.personal-capability-json-editor textarea{resize:vertical;border:1px solid var(--pw-line-strong);width:100%;min-width:0;color:var(--pw-text);tab-size:2;background:#fafafa;border-radius:9px;padding:12px 13px;font:12px/1.6 SFMono-Regular,Consolas,monospace}.personal-capability-json-editor textarea:focus-visible{outline:2px solid var(--pw-blue);outline-offset:2px}.personal-capability-preview{background:#f4f7ff;border:1px solid #9fb9f4;border-radius:10px;grid-template-columns:minmax(0,1fr) auto;gap:3px 12px;margin:0 18px 16px;padding:12px;display:grid}.personal-capability-preview strong{font-size:12px}.personal-capability-preview span{color:var(--pw-blue-ink);font-size:11px;font-weight:700}.personal-capability-preview small{color:var(--pw-muted);grid-column:1/-1;font-size:10.5px}.personal-capability-actions{border-top:1px solid var(--pw-line);background:0 0;justify-content:flex-end;gap:9px;padding:14px 18px;display:flex}.personal-capability-actions button{border:1px solid var(--pw-line-strong);min-height:44px;color:var(--pw-text);cursor:pointer;font:inherit;background:#fff;border-radius:9px;padding:0 14px;font-size:12px;font-weight:700}.personal-capability-actions button.is-primary{border-color:var(--pw-blue);background:var(--pw-blue);color:#fff}.personal-capability-actions button.is-danger{color:var(--pw-red);align-items:center;gap:6px;margin-right:auto;display:inline-flex}.personal-capability-actions button:disabled{cursor:not-allowed;opacity:.5}.personal-capability-empty,.personal-capability-error{border:1px solid var(--pw-line);max-width:720px;min-height:56px;color:var(--pw-muted);background:#fff;border-radius:11px;align-items:center;gap:9px;margin:0;padding:14px;font-size:12px;display:flex}.personal-capability-error{color:var(--pw-red);border-color:#efc1ba}.personal-capability-error span{gap:2px;display:grid}.personal-capability-error small{color:var(--pw-muted)}.personal-capability-error button{min-height:44px;color:inherit;cursor:pointer;background:0 0;border:1px solid;border-radius:9px;align-items:center;gap:6px;margin-left:auto;padding:0 12px;display:inline-flex}.personal-capability-recovery{color:#74530d;background:#fffaf0;border:1px solid #dfc98d;border-radius:10px;grid-template-columns:auto minmax(0,1fr) auto;align-items:start;gap:9px;margin:0 20px 16px;padding:12px;font-size:11px;line-height:1.5;display:grid}.personal-capability-recovery div{gap:3px;display:grid}.personal-capability-recovery p{margin:0}.personal-capability-recovery small{color:var(--pw-muted);overflow-wrap:anywhere}.personal-capability-recovery button{min-height:40px;color:inherit;cursor:pointer;background:0 0;border:1px solid;border-radius:8px;align-items:center;gap:6px;padding:0 10px;display:inline-flex}.personal-task-lane-filter>div{min-width:0;color:var(--pw-muted);align-items:center;gap:9px;display:flex}.personal-task-lane-filter>div>span{gap:1px;display:grid}.personal-task-lane-filter strong{color:var(--pw-text);font-size:12px}.personal-task-lane-filter small{color:var(--pw-faint);font-size:10.5px}.personal-task-lane-filter label{border:1px solid var(--pw-line-strong);background:var(--pw-bg);border-radius:8px;align-items:center;gap:6px;min-height:34px;padding:0 9px;display:flex}.personal-task-lane-filter select{max-width:300px;color:var(--pw-text);font:inherit;appearance:none;background:0 0;border:0;outline:0;font-size:11.5px;font-weight:600}.personal-task-board{flex-direction:column;gap:12px;height:100%;min-height:0;display:flex}.personal-channel-scroll:has(.personal-task-board.is-list-view){overflow-y:auto}.personal-task-board.is-list-view{gap:24px;height:auto;min-height:100%}.personal-task-view-toolbar{flex:none;justify-content:space-between;align-items:center;gap:16px;display:flex}.personal-task-view-toolbar>div:first-child{gap:4px;display:grid}.personal-task-view-toolbar strong{font-size:16px;font-weight:600}.personal-task-view-toolbar span{color:var(--pw-muted);font-size:12px}.personal-task-view-switch{border:1px solid var(--pw-line);background:var(--pw-bg);border-radius:8px;flex:none;padding:3px;display:flex}.personal-task-view-switch button{min-height:36px;color:var(--pw-muted);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:5px;padding:0 14px;font-size:13px}.personal-task-view-switch button[aria-pressed=true]{background:var(--pw-text);color:var(--pw-bg)}.personal-task-grouped-list{gap:24px;padding-bottom:24px;display:grid}.personal-completed-list{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px}.personal-completed-list>header{min-height:48px;color:var(--pw-text);padding:2px 16px}.personal-completed-list>header>button{color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;min-height:44px;padding:0}.personal-completed-list .personal-task-lane-scroll{height:480px;max-height:60vh;overflow-y:auto}.personal-completed-list .personal-task-lane-scroll[hidden]{display:none}.personal-completed-list .personal-completed-row>button{border:0;border-bottom:1px solid var(--pw-line);text-align:left;background:0 0;grid-template-columns:20px minmax(0,1fr);gap:8px 12px;width:100%;height:100%;padding:16px;display:grid}.personal-completed-list .personal-completed-row>button>strong{-webkit-line-clamp:2}.personal-completed-list .personal-completed-row>button>small{grid-column:2}.personal-task-group{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;min-width:0}.personal-task-group>summary{cursor:pointer;align-items:center;gap:8px;min-height:48px;padding:10px 16px;list-style:none;display:flex}.personal-task-group>summary::-webkit-details-marker{display:none}.personal-task-group>summary strong{font-size:12px;font-weight:600;line-height:18px}.personal-task-group>summary span{background:var(--pw-line);color:var(--pw-muted);border-radius:6px;padding:2px 7px;font-size:12px}.personal-task-group>summary svg{color:var(--pw-muted);transform:rotate(-90deg)}.personal-task-group[open]>summary svg{transform:none}.personal-task-group.tone-attention>summary{color:var(--pw-amber)}.personal-task-list-rows{padding:0 16px 8px}.personal-task-list-rows>button,.personal-task-list-rows>.personal-task-card>button{border:0;border-top:1px solid var(--pw-line);width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border-radius:0;grid-template-columns:20px minmax(0,1fr);gap:8px 12px;padding:16px 4px;display:grid}.personal-task-list-rows>button:hover,.personal-task-list-rows>.personal-task-card>button:hover{background:var(--pw-line)}.personal-task-list-rows>button>strong,.personal-task-list-rows>.personal-task-card>button>strong{-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;font-size:14px;font-weight:500;line-height:20px;display:-webkit-box;overflow:hidden}.personal-task-list-rows>button>small,.personal-task-list-rows>.personal-task-card>button>small{color:var(--pw-muted);overflow-wrap:anywhere;flex-wrap:wrap;grid-column:2;align-items:center;gap:8px;font-size:12px;line-height:16px;display:flex}.personal-task-list-rows .personal-task-card-actions{background:var(--pw-card);top:auto;bottom:12px}@media (width>=721px){.personal-channel-header:has(~.personal-channel-scroll .is-list-view){flex-wrap:wrap}.personal-channel-header:has(~.personal-channel-scroll .is-list-view) .personal-channel-title{flex-basis:100%}}.personal-task-kanban{flex:1;grid-template-columns:repeat(auto-fit,minmax(172px,1fr));align-items:stretch;gap:12px;min-height:0;display:grid}.personal-task-chat-receipt{background:#f8faff;border:1px solid #d8e2f8;border-radius:10px;grid-template-columns:28px minmax(0,1fr) auto;align-items:center;gap:10px;padding:8px 12px;display:grid;box-shadow:0 1px 3px #2f66e90a}.personal-task-chat-icon{background:var(--pw-blue-soft);width:28px;height:28px;color:var(--pw-blue-ink);border-radius:8px;place-items:center;display:grid}.personal-task-chat-receipt>div{min-width:0}.personal-task-chat-receipt header{align-items:center;gap:8px;display:flex}.personal-task-chat-receipt header strong{font-size:12px;font-weight:650}.personal-task-chat-receipt header small{color:var(--pw-faint);font-size:10px}.personal-task-chat-receipt p{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;grid-template-columns:36px minmax(0,1fr);gap:5px;margin:3px 0;font-size:12px;line-height:1.4;display:grid;overflow:hidden}.personal-task-chat-receipt p b{color:var(--pw-faint);font-size:10px;font-weight:650}.personal-task-chat-receipt p.is-assistant{max-height:2.8em;color:var(--pw-muted);white-space:normal}.personal-task-chat-receipt>div>small{color:var(--pw-muted);font-size:10.5px;line-height:1.4}.personal-task-chat-receipt footer{gap:6px;display:flex}.personal-task-chat-receipt footer button{min-height:26px;color:var(--pw-blue-ink);cursor:pointer;white-space:nowrap;background:#fff;border:1px solid #b9c9ee;border-radius:7px;align-items:center;gap:4px;padding:3px 8px;font-size:10.5px;font-weight:650;display:inline-flex}.personal-task-chat-receipt footer button:hover{border-color:var(--pw-blue);background:var(--pw-blue-soft)}.personal-task-kanban .personal-object-list{background:#f6f4ee;flex-direction:column;min-height:0;padding:0;display:flex}.personal-task-kanban .personal-object-list>header{background:#f6f4ee;border-bottom:1px solid #e0ddd4b8;flex:none;align-items:center;gap:8px;min-height:38px;padding:10px 16px 7px;display:flex}.personal-task-kanban .personal-object-list>header>strong{align-items:center;gap:7px;min-width:0;font-size:12px;display:inline-flex}.personal-task-kanban .personal-object-list>header>span{margin-left:auto}.personal-task-lane-scroll{overscroll-behavior-y:contain;scrollbar-color:#bebbb2 transparent;scrollbar-gutter:stable;scrollbar-width:thin;-webkit-overflow-scrolling:touch;flex-direction:column;flex:auto;gap:8px;min-height:0;padding:8px;scroll-padding-block:8px;display:flex;overflow-y:auto}.personal-task-lane-scroll:focus-visible{outline:2px solid var(--pw-blue);outline-offset:-3px}.personal-task-lane-scroll.has-overflow-before{box-shadow:inset 0 12px 10px -13px #34312b94}.personal-task-lane-scroll.has-overflow-after{box-shadow:inset 0 -16px 12px -15px #34312bb3}.personal-task-lane-scroll.has-overflow-before.has-overflow-after{box-shadow:inset 0 12px 10px -13px #34312b94,inset 0 -16px 12px -15px #34312bb3}.personal-task-lane-scroll::-webkit-scrollbar{width:10px}.personal-task-lane-scroll::-webkit-scrollbar-track{background:0 0}.personal-task-lane-scroll::-webkit-scrollbar-thumb{background:#bebbb2 padding-box padding-box;border:3px solid #0000;border-radius:999px;min-height:40px}.personal-task-lane-scroll::-webkit-scrollbar-thumb:hover{background:#97938a padding-box padding-box}.personal-kanban-dot{background:var(--pw-faint);border-radius:50%;width:8px;height:8px}.personal-kanban-dot.tone-attention{background:var(--pw-amber)}.personal-kanban-dot.tone-progress{background:var(--pw-blue)}.personal-kanban-dot.tone-schedule{background:#8a6fd6}.personal-kanban-dot.tone-done{background:var(--pw-green)}.personal-task-kanban .personal-task-lane-scroll>button,.personal-task-kanban .personal-task-card>button{border:1px solid var(--pw-line);width:100%;min-height:0;color:inherit;text-align:left;cursor:pointer;background:#fff;border-radius:10px;grid-template-columns:18px minmax(0,1fr);align-items:center;gap:6px 8px;padding:10px 12px;display:grid;box-shadow:0 1px 3px #1e1c140f}.personal-task-kanban .personal-task-lane-scroll>button:hover,.personal-task-kanban .personal-task-card>button:hover{border-color:var(--pw-line-strong);background:#fff;box-shadow:0 2px 8px #1e1c1417}.personal-task-kanban .personal-task-lane-scroll>button>small,.personal-task-kanban .personal-task-card>button>small{white-space:normal;text-align:left;flex-wrap:wrap;grid-column:1/-1;justify-content:flex-start;align-items:center;gap:8px;display:inline-flex}.personal-task-kanban .personal-task-lane-scroll>button:last-child{border-bottom:1px solid var(--pw-line)}.personal-task-kanban .personal-task-lane-scroll>button:last-child:hover{border-color:var(--pw-line-strong)}.personal-task-lane-scroll>button,.personal-task-card{flex:none;min-width:0}.personal-task-lane-scroll>button>small,.personal-task-card>button>small{font-size:12px;line-height:16px}.personal-task-lane-scroll>button>strong,.personal-task-card>button>strong{-webkit-line-clamp:3;overflow-wrap:anywhere;-webkit-box-orient:vertical;font-size:14px;font-weight:500;line-height:20px;display:-webkit-box;overflow:hidden}.personal-task-card{position:relative}.personal-completed-window{flex-shrink:0;position:relative}.personal-completed-row{padding-bottom:8px;position:absolute;inset-inline:0}.personal-completed-row>button{width:100%;height:100%}.personal-completed-row>button>strong{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.personal-completed-footer{color:var(--pw-muted);text-align:center;flex-shrink:0;padding:12px 4px;font-size:12px}.personal-completed-footer button{border:1px solid var(--pw-line);min-height:32px;color:inherit;cursor:pointer;background:0 0;border-radius:6px}.personal-task-card>button{width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:start;display:grid}.personal-task-card-actions{opacity:0;gap:4px;transition:opacity .12s;display:flex;position:absolute;top:6px;right:6px}.personal-task-card:hover .personal-task-card-actions,.personal-task-card:focus-within .personal-task-card-actions,.personal-task-card.has-session .personal-task-card-actions{opacity:1}.personal-task-card.is-selected>button,.personal-task-kanban .personal-task-lane-scroll>button.is-selected{background:#f5f8ff;border-color:#7c9df1;box-shadow:0 0 0 2px #2f66e91f,0 4px 14px #1e34681a}.personal-task-card.is-selected:before{z-index:2;background:var(--pw-blue);content:"";border-radius:0 3px 3px 0;width:3px;position:absolute;top:8px;bottom:8px;left:0}.personal-task-card-actions button{border:1px solid var(--pw-line-strong);width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:7px;place-items:center;padding:0;display:grid;box-shadow:0 1px 3px #1e1c141f}.personal-task-card-actions button:hover{color:var(--pw-text);border-color:var(--pw-text)}.personal-task-card-actions button:disabled{cursor:wait;opacity:.72}.personal-task-card-actions .personal-task-session-link{width:auto;color:var(--pw-blue-ink);opacity:1;gap:5px;padding:0 8px;display:flex}.personal-task-session-link span{white-space:nowrap;font-size:10.5px;font-weight:650}.personal-task-session-status{color:var(--pw-blue-ink);font-weight:650}.personal-task-kanban .personal-task-empty{border:1px dashed var(--pw-line-strong);text-align:center;border-radius:10px;margin:2px 0 4px;padding:16px 10px;font-size:12px}.personal-workspace-shell.has-drawer .personal-task-kanban{grid-template-columns:repeat(2,minmax(0,1fr))}.personal-workspace-shell.has-task-inspector .personal-channel-scroll:has(.personal-task-kanban){padding-inline:20px}.personal-workspace-shell.has-task-inspector .personal-task-kanban{grid-template-columns:repeat(4,260px);width:max-content;min-width:100%}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-receipt{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-icon{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-receipt footer button{color:#141414;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-composer-wrap{background:linear-gradient(transparent, var(--pw-bg) 22%);padding:10px max(26px,50% - 410px) 20px}.personal-read-only-notice{border:1px solid var(--pw-line);min-height:46px;color:var(--pw-muted);background:#f5f4f1;border-radius:12px;justify-content:center;align-items:center;gap:8px;padding:10px 16px;font-size:11.5px;display:flex}.personal-read-only-notice strong{color:var(--pw-text);white-space:nowrap}.personal-manager-conversation-tray{width:100%;max-height:320px;color:inherit;font:inherit;text-align:left;background:#fffffff7;border:1px solid #bfcdf1;border-radius:14px;gap:9px;margin-bottom:10px;padding:12px 14px;animation:.16s cubic-bezier(.16,1,.3,1) pw-tray-in;display:grid;overflow:hidden;box-shadow:0 5px 20px #223e781a}@keyframes pw-tray-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}.personal-manager-conversation-tray:hover{border-color:#8fa9ee;box-shadow:0 7px 24px #223e7824}.personal-manager-conversation-tray:focus-within{border-color:var(--pw-blue);box-shadow:0 0 0 3px #2f66e921,0 5px 20px #223e781a}.personal-manager-conversation-tray>header{justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-manager-conversation-tray>header>span{color:var(--pw-blue-ink);align-items:center;gap:7px;display:flex}.personal-manager-conversation-tray>header strong{font-size:16px;font-weight:600;line-height:24px}.personal-manager-conversation-tray>header small{color:var(--pw-faint);font-size:12px;font-weight:500;line-height:16px}.personal-manager-conversation-actions{align-items:center;gap:8px;display:flex}.personal-manager-conversation-btn{min-height:32px;color:var(--pw-blue-ink);cursor:pointer;background:#f4f7fe;border:1px solid #b9c9ee;border-radius:8px;align-items:center;gap:5px;padding:5px 10px;font-size:12px;font-weight:600;line-height:16px;transition:all .12s;display:inline-flex}.personal-manager-conversation-btn:hover{background:var(--pw-blue-soft);border-color:var(--pw-blue)}.personal-manager-conversation-link{min-height:32px;color:var(--pw-blue);cursor:pointer;background:0 0;border:0;border-radius:7px;align-items:center;padding:5px 8px;font-size:14px;font-weight:500;line-height:20px;transition:background .12s;display:inline-flex}.personal-manager-conversation-link:hover{background:var(--pw-blue-soft)}.personal-manager-conversation-close{width:32px;height:32px;color:var(--pw-faint);cursor:pointer;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;padding:0;transition:all .12s;display:inline-flex}.personal-manager-conversation-close:hover{color:#ef4444;background:#fee2e2}.personal-manager-conversation-messages{gap:7px;max-height:220px;display:grid;overflow-y:auto}.personal-manager-conversation-messages article{background:#f5f7fc;border-radius:10px;grid-template-columns:86px minmax(0,1fr);gap:10px;padding:10px 12px;font-size:14px;line-height:20px;display:grid}.personal-manager-conversation-messages article.is-user{background:#edf3ff}.personal-manager-conversation-messages article strong{color:var(--pw-muted);font-size:12px;font-weight:500;line-height:16px}.personal-manager-conversation-bubble{min-width:0}.personal-manager-conversation-bubble p{white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.personal-manager-conversation-bubble .personal-md{font-size:14px;line-height:20px}.personal-manager-conversation-bubble small{color:var(--pw-blue);margin-top:4px;font-size:12px;line-height:16px;display:inline-block}.personal-quick-prompts{flex-wrap:wrap;gap:8px;margin-bottom:9px;display:flex}.personal-quick-prompts button{border:1px solid var(--pw-line-strong);min-height:32px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:99px;align-items:center;gap:6px;padding:5px 12px;font-size:12.5px;transition:all .14s;display:inline-flex}.personal-quick-prompts button:hover{border-color:var(--pw-blue);color:var(--pw-blue-ink)}.personal-quick-prompts button.is-draft{color:var(--pw-body);border-color:#dbe4f8}.personal-quick-prompts button.is-draft:hover{color:var(--pw-blue-ink);background:#fafaf8;border-color:#9cbdf8}.personal-quick-prompts button.is-immediate{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-color:#9cbdf8;font-weight:600}.personal-quick-prompts button.is-immediate:hover{border-color:var(--pw-blue);background:#dce7fe;box-shadow:0 1px 4px #2f66e92e}.personal-prompt-badge{color:#fff;letter-spacing:.02em;background:#2f66e9;border-radius:99px;padding:1px 6px;font-size:10px;font-style:normal;font-weight:600;line-height:1.3}.personal-prompt-subtle{color:var(--pw-faint);font-size:10.5px;font-weight:400}.personal-goal-draft-status{color:var(--pw-muted);background:#f5f7ff;border:1px solid #cfd9f5;border-radius:10px;align-items:center;gap:8px;margin-bottom:9px;padding:8px 11px;font-size:11px;display:flex}.personal-goal-draft-status strong{color:var(--pw-text)}.personal-channel-composer{border:1px solid var(--pw-line-strong);background:#fff;border-radius:16px;grid-template-columns:auto 36px minmax(0,1fr) 40px;align-items:center;min-height:56px;padding:7px 7px 7px 14px;transition:border-color .15s,box-shadow .15s;display:grid;box-shadow:0 2px 10px #1e1c1412}.personal-channel-composer:focus-within{border-color:var(--pw-blue);box-shadow:0 0 0 3px #2f66e921,0 2px 10px #1e1c1412}.personal-channel-composer>span{color:#535b68;align-items:center;gap:7px;padding-right:12px;font-size:12.5px;font-weight:650;display:flex}.personal-channel-composer textarea{resize:none;border:0;border-left:1px solid var(--pw-line);width:100%;max-height:120px;color:inherit;font:inherit;background:0 0;outline:0;padding:9px 12px;line-height:1.4}.personal-channel-composer>button,.personal-correction-composer button{background:var(--pw-blue);color:#fff;cursor:pointer;border:0;border-radius:12px;place-items:center;width:40px;height:40px;display:grid;box-shadow:0 2px 6px #2f66e952}.personal-channel-composer>button:hover{background:var(--pw-blue-ink)}.personal-channel-composer>button:disabled,.personal-correction-composer button:disabled{opacity:.4;cursor:default;box-shadow:none}.personal-channel-composer>.personal-composer-attach{width:34px;height:34px;color:var(--pw-muted);box-shadow:none;background:0 0;border-radius:9px}.personal-channel-composer>.personal-composer-attach:hover{background:var(--pw-blue-soft);color:var(--pw-blue-ink)}.personal-composer-images{gap:8px;margin:0 0 8px;display:flex;overflow-x:auto}.personal-composer-images figure{flex:0 0 74px;height:58px;margin:0;position:relative}.personal-composer-images img{object-fit:cover;border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;width:100%;height:100%}.personal-composer-images button{border:1px solid var(--pw-line-strong);width:20px;height:20px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:50%;place-items:center;padding:0;display:grid;position:absolute;top:-5px;right:-5px;box-shadow:0 1px 4px #1e1c142e}.personal-composer-error{color:var(--pw-red);margin:0 0 7px;font-size:11.5px}.personal-context-drawer{grid-template-rows:auto minmax(0,1fr);height:100vh;display:grid}.personal-drawer-header{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:flex-start;min-height:84px;padding:20px 18px 16px;display:flex}.personal-drawer-header h2{letter-spacing:-.01em;margin:0;font-size:15.5px;font-weight:700}.personal-drawer-header p{color:var(--pw-faint);letter-spacing:.07em;text-transform:uppercase;margin:4px 0 0;font-size:11px;font-weight:650}.personal-drawer-close{flex:0 0 44px;width:44px;height:44px;margin-top:2px}.personal-drawer-body{padding:18px;overflow:auto}.personal-context-drawer[data-context-kind=todo]{background:#fbfbfc}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header{background:#fff;min-height:68px;padding:11px 22px}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header h2{font-size:14px}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header p{text-overflow:ellipsis;white-space:nowrap;max-width:330px;overflow:hidden}.personal-drawer-header-actions{align-items:center;gap:6px;display:flex}.personal-drawer-header-actions .personal-icon-button{flex:none}.personal-context-drawer[data-context-kind=todo] .personal-drawer-body{padding:0}.personal-task-inspector-summary{border-bottom:1px solid var(--pw-line);background:#fff;padding:24px 24px 20px}.personal-task-inspector-summary h3{letter-spacing:-.015em;overflow-wrap:anywhere;margin:14px 0 0;font-size:18px;font-weight:680;line-height:1.55}.personal-task-inspector-status{flex-wrap:wrap;align-items:center;gap:7px;display:flex}.personal-task-inspector-status>span{color:#62697a;background:#f1f2f5;border-radius:6px;align-items:center;gap:6px;min-height:24px;padding:2px 8px;font-size:11px;font-weight:650;display:inline-flex}.personal-task-inspector-status>span:first-child{padding-left:7px}.personal-task-inspector-status i{background:var(--pw-blue);border-radius:50%;width:7px;height:7px}.personal-task-inspector-status .is-done{background:var(--pw-green-bg);color:var(--pw-green)}.personal-task-inspector-status .is-done i{background:var(--pw-green)}.personal-task-inspector-status .is-blocked{background:var(--pw-red-bg);color:var(--pw-red)}.personal-task-inspector-status .is-blocked i{background:var(--pw-red)}.personal-task-inspector-fields{background:#fff;padding:20px 24px 22px}.personal-task-inspector-fields h4{color:var(--pw-text);margin:0 0 9px;font-size:12px;font-weight:700}.personal-task-inspector-fields dl{border-top:1px solid var(--pw-line);margin:0}.personal-task-inspector-fields dl div{border-bottom:1px solid var(--pw-line);grid-template-columns:92px minmax(0,1fr);gap:14px;min-height:44px;padding:11px 0;font-size:12px;line-height:1.55;display:grid}.personal-task-inspector-fields dt{color:var(--pw-muted)}.personal-task-inspector-fields dd{color:var(--pw-text);overflow-wrap:anywhere;margin:0}.personal-task-inspector-actions{border-top:1px solid var(--pw-line-strong);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fffffff5;grid-template-columns:auto minmax(170px,1fr);gap:10px;padding:13px 18px;display:grid;position:sticky;bottom:0;box-shadow:0 -8px 26px #1e284012}.personal-task-inspector-actions>.personal-primary-action{min-height:40px;margin:0}.personal-task-management{position:relative}.personal-task-management>summary{border:1px solid var(--pw-line-strong);min-width:128px;min-height:40px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:9px;justify-content:center;align-items:center;gap:7px;padding:0 14px;font-size:12px;font-weight:650;list-style:none;display:flex}.personal-task-management>summary::-webkit-details-marker{display:none}.personal-task-management[open]>summary{color:var(--pw-blue-ink);border-color:#9db3e9}.personal-task-management>div{border:1px solid var(--pw-line-strong);background:#fff;border-radius:12px;gap:9px;width:390px;padding:14px;display:grid;position:absolute;bottom:calc(100% + 9px);left:0;box-shadow:0 16px 38px #1e284029}.personal-task-management>div>strong{color:var(--pw-muted);font-size:10.5px;font-weight:650}.personal-task-management-secondary{border-top:1px solid var(--pw-line);grid-template-columns:1fr 1fr;gap:7px;padding-top:4px;display:grid}.personal-task-management-secondary button{border:1px solid var(--pw-line-strong);min-height:34px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:8px;font-size:11.5px}.personal-task-management-secondary button:hover{background:#f6f7fa}.personal-task-completed-note{background:var(--pw-green-bg);color:var(--pw-green);border:1px solid #cde4d8;border-radius:10px;align-items:center;gap:10px;margin:12px 24px 24px;padding:12px 14px;display:flex}.personal-task-completed-note>span{gap:2px;display:grid}.personal-task-completed-note strong{font-size:12px}.personal-task-completed-note small{color:#5d786c;font-size:10.5px}.personal-detail-card,.personal-correction-panel{border:1px solid var(--pw-line);background:#fff;border-radius:14px;padding:15px}.personal-proposal-card{background:#f5f8ff;border:1px solid #c3d3f9;border-radius:14px;padding:16px}.personal-proposal-card>small{color:#5270bd;letter-spacing:.05em;font-size:11px;font-weight:650}.personal-proposal-card h3{margin:8px 0;font-size:15.5px}.personal-proposal-card p{color:#5f6570;font-size:12px;line-height:1.55}.personal-proposal-card dl{gap:8px;margin:14px 0 0;display:grid}.personal-proposal-card dl div{grid-template-columns:82px minmax(0,1fr);gap:10px;font-size:11.5px;display:grid}.personal-proposal-card dt{color:var(--pw-faint)}.personal-proposal-card dd{overflow-wrap:anywhere;margin:0}.personal-proposal-state{border-radius:9px;align-items:center;gap:7px;margin:10px 0 0;padding:10px 12px;font-size:11px;display:flex}.personal-proposal-state.is-applied{background:var(--pw-green-bg);color:var(--pw-green)}.personal-proposal-state.is-stale,.personal-proposal-state.is-error{background:var(--pw-red-bg);color:var(--pw-red)}.personal-proposal-state.is-gated{color:#825a00;background:#fff6df;gap:6px;display:grid}.personal-proposal-state.is-gated>span{gap:3px;display:grid}.personal-proposal-state.is-gated small{line-height:1.5}.personal-workspace-candidates{gap:8px;margin-top:10px;display:grid}.personal-workspace-candidates button{color:#263e76;cursor:pointer;text-align:left;background:#fff;border:1px solid #c3d3f9;border-radius:10px;gap:3px;min-height:48px;padding:9px 12px;display:grid}.personal-workspace-candidates small{color:var(--pw-muted)}.personal-detail-card.is-attention{background:#fffdf7;border-color:#f1d8ac}.personal-detail-card small{color:var(--pw-muted);font-size:11px}.personal-detail-card h3{margin:7px 0;font-size:14.5px;line-height:1.5}.personal-detail-card p,.personal-correction-panel p{color:var(--pw-muted);font-size:12px;line-height:1.55}.personal-detail-card dl{gap:9px;margin:14px 0 0;display:grid}.personal-detail-card dl div{grid-template-columns:74px minmax(0,1fr);gap:10px;font-size:12px;display:grid}.personal-detail-card dt{color:var(--pw-faint)}.personal-detail-card dd{overflow-wrap:anywhere;margin:0}.personal-run-drawer-tabs{background:#efefec;border-radius:11px;grid-template-columns:1fr 1fr;gap:4px;padding:4px;display:grid}.personal-run-drawer-tabs button{min-height:36px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;padding:0 8px;font-size:12px;font-weight:650}.personal-run-drawer-tabs button[aria-selected=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c141f}.personal-session-summary{margin-top:12px}.personal-session-message-record{margin-top:14px}.personal-session-message-record>h3{color:var(--pw-faint);letter-spacing:.06em;text-transform:uppercase;margin:0 0 10px;font-size:11px}.personal-session-message-record ol{gap:0;margin:0;padding:0;list-style:none;display:grid}.personal-session-message-record li{grid-template-columns:13px minmax(0,1fr);gap:9px;padding-bottom:15px;display:grid}.personal-session-message-record li>i,.personal-session-active-step>i{background:var(--pw-green);width:9px;height:9px;box-shadow:0 0 0 3px var(--pw-green-bg);border-radius:50%;margin-top:5px}.personal-session-message-record li.is-user>i{background:var(--pw-blue);box-shadow:0 0 0 3px var(--pw-blue-soft)}.personal-session-message-record li.is-error>i{background:var(--pw-red);box-shadow:0 0 0 3px var(--pw-red-bg)}.personal-session-message-record li>div{border-bottom:1px solid var(--pw-line);gap:5px;min-width:0;padding:0 0 15px;display:grid}.personal-session-message-record li header{justify-content:space-between;align-items:center;gap:8px;display:flex}.personal-session-message-record li strong{font-size:12px}.personal-session-message-record time{color:var(--pw-faint);font-size:10px}.personal-session-message-record li p{max-height:180px;color:var(--pw-muted);white-space:pre-wrap;margin:0;font-size:11.5px;line-height:1.6;overflow:auto}.personal-session-empty{border:1px dashed var(--pw-line-strong);color:var(--pw-muted);text-align:center;border-radius:10px;margin:0;padding:18px 12px;font-size:11.5px}.personal-session-active-step{grid-template-columns:13px minmax(0,1fr);align-items:start;gap:9px;padding-top:4px;display:grid}.personal-session-active-step>i{background:var(--pw-blue);box-shadow:0 0 0 3px var(--pw-blue-soft);animation:1.4s ease-in-out infinite personal-session-pulse}.personal-session-active-step>span{gap:3px;display:grid}.personal-session-active-step strong{font-size:12px}.personal-session-active-step small{color:var(--pw-muted);font-size:10.5px}@keyframes personal-session-pulse{50%{opacity:.35}}.personal-todo-actions{grid-template-columns:1fr 1fr;gap:8px;margin-top:12px;display:grid}.personal-todo-actions>button{margin-top:0}.personal-todo-actions-title{color:var(--pw-faint);letter-spacing:.06em;grid-column:1/-1;font-size:11px;font-weight:650}.personal-todo-actions .personal-primary-action,.personal-todo-actions .personal-compact-menu{grid-column:1/-1;margin-top:0}.personal-inline-agent-select{border:1px solid var(--pw-line);color:var(--pw-muted);border-radius:10px;grid-column:1/-1;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px;padding:8px;font-size:11px;display:grid}.personal-inline-agent-select select{border:1px solid var(--pw-line-strong);color:#333;background:#fff;border-radius:8px;min-width:0;min-height:36px;padding:0 8px}.personal-inline-agent-select .personal-secondary-action{width:auto;min-height:36px;margin:0;padding:0 12px}.personal-inline-resume-when input{border:1px solid var(--pw-line-strong);color:#333;background:#fff;border-radius:8px;min-width:0;min-height:36px;padding:0 8px}.personal-inline-resume-when small{color:var(--pw-faint);grid-column:2/-1}.personal-primary-action,.personal-secondary-action,.personal-danger-action{cursor:pointer;border-radius:11px;justify-content:center;align-items:center;gap:8px;width:100%;min-height:42px;margin-top:12px;font-size:13.5px;font-weight:650;display:flex}.personal-primary-action{border:1px solid var(--pw-blue);background:var(--pw-blue);color:#fff;box-shadow:0 2px 6px #2f66e947}.personal-primary-action:hover{background:var(--pw-blue-ink)}.personal-secondary-action{border:1px solid var(--pw-line-strong);color:var(--pw-text);background:#fff}.personal-secondary-action:hover{border-color:var(--pw-faint)}.personal-danger-action{color:var(--pw-red);background:#fff;border:1px solid #efd2cd}.personal-danger-action:hover{background:var(--pw-red-bg)}.personal-primary-action:disabled,.personal-secondary-action:disabled,.personal-danger-action:disabled{opacity:.46;cursor:default;box-shadow:none}.personal-drawer-action-grid{grid-template-columns:1fr 1fr;gap:8px;display:grid}.personal-correction-panel{margin-top:12px}.personal-correction-panel header{justify-content:space-between;align-items:center;display:flex}.personal-correction-panel header span{align-items:center;gap:7px;font-size:12px;font-weight:700;display:flex}.personal-correction-panel header button{color:var(--pw-muted);cursor:pointer;background:0 0;border:0}.personal-correction-composer{border:1px solid var(--pw-line-strong);border-radius:12px;position:relative;overflow:hidden}.personal-correction-composer:focus-within{border-color:var(--pw-blue)}.personal-correction-composer textarea{resize:vertical;width:100%;min-height:84px;font:inherit;border:0;outline:0;padding:10px 56px 10px 12px;font-size:12.5px}.personal-correction-composer button{border-radius:10px;width:34px;height:34px;position:absolute;bottom:6px;right:6px}.personal-recovery-panel{background:#fffaf0;border:1px solid #eccf94;border-radius:12px;margin-top:12px;padding:14px}.personal-recovery-panel>strong{font-size:13px}.personal-recovery-panel>p,.personal-preview-unavailable{color:var(--pw-muted);font-size:12px;line-height:1.5}.personal-compact-menu{margin-top:12px;position:relative}.personal-compact-menu>summary{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:11px;justify-content:center;align-items:center;gap:8px;min-height:42px;padding:0 12px;font-size:12.5px;font-weight:650;list-style:none;display:flex}.personal-compact-menu>summary::-webkit-details-marker{display:none}.personal-compact-menu[open]>summary{border-color:var(--pw-faint)}.personal-compact-menu>div{border:1px solid var(--pw-line);background:#fff;border-radius:11px;margin-top:6px;padding:6px;display:grid;box-shadow:0 8px 24px #1e1c141a}.personal-compact-menu>div button{min-height:40px;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;align-items:center;gap:8px;padding:0 10px;display:flex}.personal-compact-menu>div button:hover{background:#f5f4f1}.personal-compact-menu>div button:disabled{color:var(--pw-faint);cursor:default;opacity:.55}.personal-safe-preview{border:1px solid var(--pw-line);color:#333943;white-space:pre-wrap;overflow-wrap:anywhere;background:#f7f6f3;border-radius:11px;max-height:280px;margin:12px 0 0;padding:14px;font:12px/1.6 Geist Mono,SFMono-Regular,Consolas,monospace;overflow:auto}.personal-report-detail{border:1px solid var(--pw-line);background:#fff;border-radius:14px;margin-top:12px;padding:14px}.personal-report-detail>header{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;display:grid}.personal-report-detail>header span{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:10px;flex-direction:column;gap:2px;padding:10px;font-size:10px;font-weight:650;display:flex}.personal-report-detail>header strong{font-size:18px}.personal-report-detail>p{color:var(--pw-muted);margin:10px 0;font-size:11px}.personal-report-detail ol{gap:8px;margin:0;padding:0;list-style:none;display:grid}.personal-report-detail li{border:1px solid var(--pw-line);border-radius:10px;gap:4px;padding:10px;display:grid}.personal-report-detail li[data-change-kind=changed]{background:#fffaf0;border-color:#e8d3a5}.personal-report-detail li small{color:var(--pw-muted);text-transform:uppercase;font-size:10px}.personal-report-detail li strong{font-size:12px;line-height:1.45}.personal-report-detail li p{color:var(--pw-muted);margin:0;font-size:11px;line-height:1.5}.personal-report-detail>footer{color:var(--pw-faint);overflow-wrap:anywhere;gap:4px;margin-top:10px;font:10px/1.5 Geist Mono,SFMono-Regular,Consolas,monospace;display:grid}.personal-execution-history{margin-top:18px}.personal-execution-history h3{letter-spacing:.07em;text-transform:uppercase;color:var(--pw-faint);margin:0 0 10px;font-size:11.5px;font-weight:650}.personal-execution-history>p{color:var(--pw-muted);font-size:12px}.personal-execution-history ol{border-top:1px solid var(--pw-line);margin:0;padding:0;list-style:none}.personal-execution-history li{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:center;gap:12px;min-height:50px;display:flex}.personal-execution-history li>span{gap:3px;display:grid}.personal-execution-history li strong{font-size:12px}.personal-execution-history li small{color:var(--pw-muted);font-size:10px}.personal-execution-history li em{color:var(--pw-muted);font-size:10px;font-style:normal}.personal-execution-history li em.is-completed{color:var(--pw-green)}.personal-execution-history li em.is-failed{color:var(--pw-red)}.personal-mobile-back{display:none}.personal-message:not(.is-user)>div{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:4px 16px 16px;flex:1;min-width:0;padding:10px 14px}.personal-md{gap:8px;margin-top:5px;font-size:13.5px;line-height:1.7;display:grid}.personal-md p{white-space:normal;overflow-wrap:anywhere;margin:0}.personal-md-heading{letter-spacing:-.01em;font-weight:700}.personal-md-heading.is-h1{font-size:15.5px}.personal-md-heading.is-h2{font-size:14.5px}.personal-md-heading.is-h3,.personal-md-heading.is-h4{font-size:13.5px}.personal-md-list{gap:4px;margin:0;padding-left:20px;display:grid}.personal-md ul.personal-md-list{list-style-type:disc}.personal-md ol.personal-md-list{list-style-type:decimal}.personal-md-list li{overflow-wrap:anywhere;padding-left:2px}.personal-md-list li::marker{color:var(--pw-faint)}.personal-md-code{border:1px solid var(--pw-line);overflow-wrap:anywhere;background:#f5f4f1;border-radius:6px;padding:1px 5px;font:12px/1.5 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-md-pre{border:1px solid var(--pw-line);background:#f7f6f3;border-radius:11px;margin:0;padding:12px 14px;overflow-x:auto}.personal-md-pre code{color:#333943;white-space:pre;font:12px/1.65 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-md-link{color:var(--pw-blue-ink);border-bottom:1px solid #c3d3f9;text-decoration:none}.personal-md-link:hover{border-bottom-color:var(--pw-blue-ink)}.personal-agent-persona-head{align-items:center;gap:12px;display:flex}.personal-agent-avatar{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:14px;flex:0 0 46px;place-items:center;height:46px;font-size:19px;font-weight:700;display:grid;box-shadow:0 2px 8px #2f66e942}.personal-agent-persona-id{flex:1;min-width:0}.personal-agent-persona-id h3{margin:0}.personal-agent-persona-id p{margin:2px 0 0}.personal-agent-health{border-radius:99px;flex:none;padding:2.5px 10px;font-size:11px;font-weight:650}.personal-agent-health.is-ok{background:var(--pw-green-bg);color:var(--pw-green)}.personal-agent-health.is-off,.personal-row-status.is-blocking{background:var(--pw-red-bg);color:var(--pw-red)}.personal-row-status.is-pending{background:var(--pw-amber-bg);color:var(--pw-amber)}.personal-row-status.is-failed{background:var(--pw-red-bg);color:var(--pw-red)}.personal-row-status.is-completed{background:var(--pw-green-bg);color:var(--pw-green)}.personal-row-status.is-queued,.personal-row-status.is-waiting,.personal-row-status.is-interrupted{color:var(--pw-muted);background:#f2f1ed}.personal-diagnostics-trigger{border:0;border-top:1px solid var(--pw-line);width:100%;color:var(--pw-muted);cursor:pointer;background:0 0;justify-content:space-between;align-items:center;margin-top:18px;padding:12px 0;font-size:12.5px;display:flex}.personal-diagnostics-trigger svg{transition:transform .16s}.personal-diagnostics-trigger svg.is-open{transform:rotate(180deg)}.personal-diagnostics{color:var(--pw-muted);overflow-wrap:anywhere;background:#f5f4f1;border-radius:10px;gap:7px;padding:12px;font-size:10.5px;display:grid}.personal-copy-feedback{color:var(--pw-green);margin:7px 0 0;font-size:11px}.personal-copy-feedback.is-error{color:var(--pw-red)}@media (width<=1300px){.personal-workspace-shell.has-drawer .personal-live-indicator{display:none}.personal-workspace-shell.has-drawer .personal-channel-title p{max-width:260px}.personal-home-lanes{grid-template-columns:repeat(2,minmax(190px,1fr))}}@media (width<=1100px){.personal-machine-layout{grid-template-columns:1fr;gap:14px}.personal-machine-namespaces nav{overscroll-behavior-x:contain;scroll-snap-type:x proximity;display:flex;overflow-x:auto}.personal-machine-namespaces button{scroll-snap-align:start;flex:0 0 180px}.personal-machine-summary{flex-wrap:wrap;align-items:flex-start}.personal-machine-editor-bar{flex-direction:column;align-items:stretch}.personal-machine-editor-mode{width:100%}.personal-machine-editor-mode button{flex:1 1 0}.personal-machine-editor fieldset{grid-template-columns:1fr}.personal-machine-editor fieldset label:last-child{grid-column:auto}.personal-machine-preview dl{grid-template-columns:1fr}}@media (width<=1050px){.personal-workspace-shell,.personal-workspace-shell.has-drawer{grid-template-columns:minmax(0,1fr)}.personal-workspace-sidebar{z-index:40;width:min(310px,86vw);display:none;position:fixed;inset:0 auto 0 0;box-shadow:18px 0 50px #1e1c1429}.personal-workspace-shell.mobile-sidebar-open .personal-workspace-sidebar{display:block}.personal-sidebar-backdrop{z-index:35;cursor:default;background:#14182047;border:0;display:block;position:fixed;inset:0}.personal-icon-button.personal-mobile-menu{flex:0 0 36px;display:inline-grid}.personal-workspace-drawer{z-index:30;width:min(410px,90vw);position:fixed;inset:0 0 0 auto}.personal-workspace-drawer[data-drawer-mode=inspector],.personal-workspace-drawer[data-drawer-mode=inspector-full]{width:min(520px,92vw);position:fixed;inset:0 0 0 auto;box-shadow:-18px 0 44px #1e284024}.personal-run-row{grid-template-columns:36px minmax(0,1fr) auto 16px}.personal-run-identity,.personal-run-progress{display:none}.personal-home-lanes{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (width<=720px){.personal-workspace-shell,.personal-workspace-shell.has-drawer{grid-template-columns:1fr}.personal-workspace-shell,.personal-workspace-main,.personal-channel{width:100%;max-width:100vw;overflow-x:hidden}.personal-workspace-sidebar{z-index:40;width:min(310px,86vw);display:none;position:fixed;inset:0 auto 0 0;box-shadow:18px 0 50px #1e1c1429}.personal-workspace-shell.mobile-sidebar-open .personal-workspace-sidebar{display:block}.personal-icon-button.personal-mobile-menu{flex:0 0 36px;display:inline-grid}.personal-channel-header{grid-template-columns:36px minmax(0,1fr) auto;gap:10px;min-height:60px;padding:10px 14px;display:grid}.personal-channel-title p{display:none}.personal-channel-actions{min-width:0}.personal-agent-select{min-width:0;max-width:132px}.personal-channel-actions>.personal-icon-button{display:none}.personal-goal-tools-trigger{width:40px;height:40px;padding:0}.personal-goal-tools-trigger span,.personal-goal-tools-trigger>svg:last-child{display:none}.personal-goal-tools-menu{position:fixed;top:60px;right:14px}.personal-goal-tabs{order:4;grid-column:1/-1;align-self:auto;margin-left:0;overflow-x:auto}.personal-channel-actions .personal-live-indicator{display:none}.personal-channel-scroll,.personal-composer-wrap{padding-left:14px;padding-right:14px}.personal-channel-scroll:has(.personal-task-board){overflow-y:auto}.personal-task-board{height:auto;min-height:100%}.personal-task-kanban,.personal-workspace-shell.has-drawer .personal-task-kanban,.personal-workspace-shell.has-task-inspector .personal-task-kanban{grid-template-columns:minmax(0,1fr);width:100%;height:auto}.personal-task-kanban .personal-object-list{min-height:auto}.personal-task-lane-scroll,.personal-task-lane-scroll.has-overflow-before,.personal-task-lane-scroll.has-overflow-after{min-height:auto;box-shadow:none;scrollbar-gutter:auto;flex:none;padding-right:8px;overflow:visible}.personal-quick-prompts{overflow-x:auto}.personal-quick-prompts button{flex:none;min-height:36px}.personal-manager-conversation-tray>header{flex-wrap:wrap;align-items:flex-start}.personal-manager-conversation-actions{justify-content:flex-end;width:100%}.personal-manager-conversation-messages article{grid-template-columns:minmax(0,1fr);gap:4px}.personal-timeline-row,.personal-output-row{grid-template-columns:34px minmax(0,1fr) 14px;gap:9px;padding:10px 12px}.personal-timeline-row>time,.personal-timeline-row>.personal-row-status,.personal-timeline-row .personal-priority-dot{display:none}.personal-channel-composer{grid-template-columns:40px 36px minmax(0,1fr) 40px}.personal-task-chat-receipt{grid-template-columns:32px minmax(0,1fr);padding:11px}.personal-task-lane-filter{flex-direction:column;align-items:stretch;gap:8px}.personal-task-lane-filter label,.personal-task-lane-filter select{width:100%;max-width:none}.personal-capability-layout,.personal-capability-value-grid,.personal-capability-fields{grid-template-columns:minmax(0,1fr)}.personal-capability-layout{grid-template-rows:auto minmax(0,1fr)}.personal-capability-list{min-width:0;max-height:90px;padding:3px;display:flex;overflow-x:auto}.personal-capability-list button{flex:0 0 180px}.personal-task-chat-icon{width:32px;height:32px}.personal-task-chat-receipt footer{grid-column:1/-1;justify-content:flex-end}.personal-channel-composer>span{justify-content:center;min-width:0;padding:0;font-size:0}.personal-composer-wrap{max-width:100vw}.personal-workspace-drawer,.personal-workspace-drawer[data-drawer-mode=inspector],.personal-workspace-drawer[data-drawer-mode=inspector-full]{width:100vw}.personal-inspector-size{display:none!important}.personal-context-drawer{height:100dvh}.personal-drawer-body{padding-bottom:max(18px, env(safe-area-inset-bottom))}.personal-composer-wrap{padding-bottom:max(16px, env(safe-area-inset-bottom))}.personal-mobile-back{display:block}.personal-desktop-close{display:none}.personal-goal-tabs button{min-height:34px}.personal-correction-composer{padding-bottom:2px}.personal-correction-composer textarea{min-height:84px;padding-right:56px;padding-bottom:max(14px, env(safe-area-inset-bottom))}.personal-correction-composer button{width:40px;height:40px}.personal-todo-actions{grid-template-columns:1fr}.personal-task-management>div{width:calc(100vw - 28px)}.personal-home-lanes{grid-template-columns:1fr}.personal-home-lane{min-height:0}.personal-session-record,.personal-session-record dl{grid-template-columns:1fr}.personal-session-record>.personal-secondary-action{grid-area:auto/1}.personal-settings-page{grid-template-rows:auto minmax(0,1fr);grid-template-columns:minmax(0,1fr)}.personal-settings-sidebar{border-right:0;border-bottom:1px solid var(--pw-line);gap:10px;height:auto;max-height:30dvh;padding:12px 14px;position:static;overflow:auto}.personal-settings-title{display:none}.personal-settings-tabs{display:flex;overflow-x:auto}.personal-settings-tabs button{flex:0 0 180px}.personal-settings-body{padding:20px 14px}.personal-settings-header{align-items:center;gap:14px}.personal-settings-header h1{font-size:24px}.personal-machine-layout{grid-template-columns:1fr;gap:14px}.personal-machine-namespaces nav{overscroll-behavior-x:contain;scroll-snap-type:x proximity;display:flex;overflow-x:auto}.personal-machine-namespaces button{scroll-snap-align:start;flex:0 0 180px}.personal-machine-summary{align-items:flex-start}.personal-machine-editor-bar{flex-direction:column;align-items:stretch}.personal-machine-editor-mode{width:100%}.personal-machine-editor-mode button{flex:1 1 0}.personal-machine-summary dl{flex-direction:column;gap:8px}.personal-machine-editor fieldset{grid-template-columns:1fr}.personal-machine-editor fieldset label:last-child{grid-column:auto}.personal-machine-preview dl{grid-template-columns:1fr}.personal-machine-rollback{flex-direction:column;align-items:stretch}.personal-machine-rollback .personal-secondary-action{width:100%}.personal-lark-settings.is-embedded .personal-lark-tabs{overflow-x:auto}.personal-lark-settings.is-embedded .personal-lark-tabs button{flex:none}}@media (prefers-reduced-motion:reduce){.personal-timeline-row,.personal-diagnostics-trigger svg,.personal-workspace-sidebar,.personal-stopped-goals>summary>svg:first-child,.personal-subagent-switch>span,.personal-subagent-switch>span:after{transition:none}.personal-goal-lifecycle.is-pending svg,.personal-spin{animation:none}}.personal-workspace-shell[data-pw-theme=loopx],.personal-settings-page[data-pw-theme=loopx]{--pw-bg:#fafafa;--pw-card:#fff;--pw-line:#ebebeb;--pw-line-strong:#dedede;--pw-muted:#6b6b6b;--pw-faint:#8f8f8f;--pw-text:#171717;--pw-blue:#0070f3;--pw-blue-ink:#0060d1;--pw-blue-soft:#edf6ff;--pw-amber:#9a6200;--pw-amber-bg:#fff7df;--pw-red:#d90000;--pw-red-bg:#fff0f0;--pw-green:#197342;--pw-green-bg:#edf9f1;font-family:Geist Variable,Geist,Inter,Helvetica Neue,Arial,PingFang SC,Microsoft YaHei,sans-serif}.personal-workspace-shell[data-pw-theme=loopx] .personal-workspace-sidebar,.personal-settings-page[data-pw-theme=loopx] .personal-settings-sidebar{background:#fff}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-header{box-shadow:none;background:#fafafaf0}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-title h1{letter-spacing:0;font-size:20px;font-weight:600;line-height:28px}.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-section-title{letter-spacing:0;font-size:12px;font-weight:500;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link-copy strong,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane>header span,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card>strong{font-size:14px;font-weight:600;line-height:20px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link-copy small,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane>p,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card>p{font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-select-trigger,.personal-workspace-shell[data-pw-theme=loopx] .personal-select-option{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-workspace-drawer{box-shadow:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-brand-mark{box-shadow:none;background:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-icon{color:#171717;background:#f2f2f2;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-greeting>span{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-utility,.personal-settings-page[data-pw-theme=loopx] .personal-settings-back,.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-utility:hover,.personal-settings-page[data-pw-theme=loopx] .personal-settings-back:hover,.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button:hover{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link[aria-current=page],.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link[aria-current=page],.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button[aria-current=page]{box-shadow:none;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes{background:#f2f2f2;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes button{border-radius:4px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page],.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes button[aria-selected=true]{box-shadow:0 1px 2px #0000000f}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs{background:0 0;border-radius:0;align-self:stretch;gap:20px;padding:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button{border-radius:0;min-height:46px;padding:0 1px;font-size:12px;font-weight:500;position:relative}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page]{box-shadow:none;color:#171717;background:0 0}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page]:after{content:"";background:#171717;height:2px;position:absolute;bottom:-1px;left:0;right:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-count{color:#4d4d4d;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-state-dot,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-row:nth-child(n) .personal-goal-state-dot{background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-agent-select .personal-select-trigger,.personal-workspace-shell[data-pw-theme=loopx] .personal-read-only-source,.personal-workspace-shell[data-pw-theme=loopx] .personal-icon-button,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-select .personal-select-trigger,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action,.personal-settings-page[data-pw-theme=loopx] .personal-secondary-action{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane,.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row,.personal-workspace-shell[data-pw-theme=loopx] .personal-detail-card,.personal-settings-page[data-pw-theme=loopx] .personal-detail-card,.personal-settings-page[data-pw-theme=loopx] .personal-settings-card,.personal-settings-page[data-pw-theme=loopx] .personal-lark-app-card,.personal-settings-page[data-pw-theme=loopx] .personal-lark-table,.personal-settings-page[data-pw-theme=loopx] .personal-lark-topic-panel{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lanes{border-block:1px solid #ebebeb;gap:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane{border:0;background:0 0;border-left:1px solid #ebebeb;border-radius:0;min-height:260px;padding:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane:first-child{border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card{box-shadow:none;border-radius:12px;transform:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card:hover{box-shadow:none;border-color:#a1a1a1;transform:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-timeline{gap:8px}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row,.personal-workspace-shell[data-pw-theme=loopx] .personal-schedule-row{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-schedule-row:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-row-icon{color:#4d4d4d;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-run-open-label{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-run-progress b{background:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-message.is-user{background:#f2f2f2;border-color:#dedede;border-radius:12px 12px 4px;padding:10px 12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message-avatar{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message:not(.is-user)>div{box-shadow:none;border-radius:4px 12px 12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message p,.personal-workspace-shell[data-pw-theme=loopx] .personal-md{font-size:13px;line-height:1.65}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-empty>span{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row{box-shadow:none;background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row>span:first-child{color:#171717;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row small,.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row>b{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record{background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record>header span{color:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record dl div{background:#fafafa;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt{box-shadow:none;background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-icon{color:#171717;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt footer button{color:#171717;border-color:#dedede;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt footer button:hover{background:#f2f2f2;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban{border-block:1px solid #ebebeb;gap:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list{border:0;background:0 0;border-left:1px solid #ebebeb;border-radius:0;gap:8px;padding:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list:first-child{border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>header{padding:4px 2px 8px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>header>strong{font-size:12px;font-weight:600}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-lane-scroll>button>strong,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button>strong{overflow-wrap:anywhere;font-size:14px;font-weight:500;line-height:20px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button>small,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button>small{color:#6b6b6b;font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card.is-selected>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button.is-selected{background:#fff;border-color:#171717;box-shadow:0 0 0 1px #171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card.is-selected:before{background:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card-actions button{box-shadow:none;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card-actions .personal-task-session-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-session-status{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-empty{border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>header{letter-spacing:0;min-height:44px;padding:8px 14px;font-weight:500}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button{min-height:58px;padding:10px 14px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button:hover{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-file-icon{color:#4d4d4d;background:#fafafa;border:1px solid #ebebeb;border-radius:6px;place-items:center;width:28px;height:28px;display:grid}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>strong{font-size:13px;font-weight:600}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>p,.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>small{font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-primary-action,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action{box-shadow:none;background:#171717;border-color:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-primary-action:hover,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action:hover{background:#333;border-color:#333}.personal-workspace-shell[data-pw-theme=loopx] .personal-md-code,.personal-workspace-shell[data-pw-theme=loopx] .personal-safe-preview,.personal-workspace-shell[data-pw-theme=loopx] .personal-diagnostics{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-md-pre{color:#fafafa;background:#171717;border:1px solid #242424}.personal-workspace-shell[data-pw-theme=loopx] .personal-digest-card{background:#fff;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-action-feedback{color:#171717;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button{color:#4d4d4d;background:#fff;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button.is-draft,.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button.is-immediate{color:#171717;box-shadow:none;background:#fff;border-color:#dedede}.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button.is-draft:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button.is-immediate:hover{color:#171717;box-shadow:none;background:#f2f2f2;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-prompt-badge{color:#fff;background:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-draft-status{color:#6b6b6b;background:#f2f2f2;border-color:#dedede;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-draft-status strong{color:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer{box-shadow:none;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer:focus-within{border-color:#0070f3;box-shadow:0 0 0 2px #0070f31f}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-correction-composer button{box-shadow:none;background:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-correction-composer button:hover{background:#333}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>.personal-composer-attach{color:#6b6b6b;background:0 0}.personal-settings-theme-swatch.is-loopx{background:linear-gradient(135deg,#171717 0 48%,#fafafa 48% 78%,#fff 78%)}.personal-settings-page[data-pw-theme=loopx] .personal-settings-header small,.personal-settings-page[data-pw-theme=loopx] .personal-lark-header small,.personal-settings-page[data-pw-theme=loopx] .personal-lark-section-heading small{color:#0070f3;font-family:Geist Mono Variable,Geist Mono,JetBrains Mono,SFMono-Regular,monospace;font-weight:500}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button{box-shadow:none;border-radius:12px}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button:hover{box-shadow:none;border-color:#c8c8c8}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button[aria-checked=true]{background:#fff;border-color:#171717;box-shadow:0 0 0 1px #171717}@media (width<=720px){.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list{border-top:1px solid #ebebeb;border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane:first-child,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list:first-child{border-top:0}}.personal-workspace-shell[data-pw-theme=brutal],.personal-settings-page[data-pw-theme=brutal]{--pw-bg:#fdf8e7;--pw-card:#fff;--pw-line:#141414;--pw-line-strong:#141414;--pw-muted:#3f3f3f;--pw-faint:#666;--pw-text:#141414;--pw-blue:#141414;--pw-blue-ink:#141414;--pw-blue-soft:#ffe23f;--pw-amber:#141414;--pw-amber-bg:#ffd23f;--pw-red:#141414;--pw-red-bg:#ff9d8a;--pw-green:#141414;--pw-green-bg:#8fe6a4}.personal-workspace-shell[data-pw-theme=brutal] :focus-visible:not(textarea):not(input),.personal-settings-page[data-pw-theme=brutal] :focus-visible:not(textarea):not(input){outline-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-workspace-sidebar{background:#ffd91a;border-right:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-brand{border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-brand-mark{color:#ffd91a;box-shadow:none;background:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-icon{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-link:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-link:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-utility:hover{background:#ffffff8c}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-link[aria-current=page],.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-link[aria-current=page]{background:#ff8fd0;border:2px solid #141414;border-radius:4px;font-weight:700;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-count{color:#141414;background:#fff;border:2px solid #141414;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-section-title{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-title-actions button:hover{box-shadow:none;background:#fff;border:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-footer{border-top:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-sidebar{background:#ffd91a;border-right:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-title{border-bottom:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-title small,.personal-settings-page[data-pw-theme=brutal] .personal-settings-header small,.personal-settings-page[data-pw-theme=brutal] .personal-settings-back,.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button{color:#141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-back:hover,.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button:hover{background:#ffffff8c}.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button[aria-current=page]{color:#141414;background:#ff8fd0;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-detail-card,.personal-settings-page[data-pw-theme=brutal] .personal-machine-editor,.personal-settings-page[data-pw-theme=brutal] .personal-machine-summary,.personal-settings-page[data-pw-theme=brutal] .personal-lark-app-card,.personal-settings-page[data-pw-theme=brutal] .personal-lark-table,.personal-settings-page[data-pw-theme=brutal] .personal-lark-topic-panel{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-machine-namespaces button[aria-current=page],.personal-settings-page[data-pw-theme=brutal] .personal-machine-preview,.personal-settings-page[data-pw-theme=brutal] .personal-machine-scope-note,.personal-settings-page[data-pw-theme=brutal] .personal-machine-rollback{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button:hover{background:#fff8d6;border-color:#141414;transform:translate(-1px,-1px);box-shadow:4px 4px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button[aria-checked=true]{background:#ffe23f;border-color:#141414;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-primary-action,.personal-settings-page[data-pw-theme=brutal] .personal-secondary-action,.personal-settings-page[data-pw-theme=brutal] .personal-lark-toolbar label{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-primary-action{background:#ffe23f}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs{border-bottom:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs button[aria-current=page]{color:#141414;border-color:#141414}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs span,.personal-settings-page[data-pw-theme=brutal] .personal-lark-app-card em,.personal-settings-page[data-pw-theme=brutal] .personal-connection-status{color:#141414;background:#ffe23f;border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-header{background:#fdf8e7;border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs{background:0 0;gap:6px;padding:0}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs button{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs button[aria-current=page]{background:#ffe23f;font-weight:700;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-agent-select .personal-select-trigger,.personal-workspace-shell[data-pw-theme=brutal] .personal-icon-button{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-live-indicator i{border:1.5px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-message.is-user{background:#8fdcff;border:2px solid #141414;border-radius:8px 8px 2px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-message-avatar{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-pre{color:#fdf8e7;background:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-code{color:#141414;background:#ffe23f;border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-link{color:#141414;text-decoration-thickness:2px}.personal-workspace-shell[data-pw-theme=brutal] .personal-object-list{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-object-list>button:hover{background:#fff8d6}.personal-workspace-shell[data-pw-theme=brutal] .personal-row-status{border:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list{background:#fff}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list>header{background:#fff;border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-lane-scroll>button,.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-card>button{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-lane-scroll>button:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-card:hover>button{background:#fff;border-color:#141414;transform:translate(-1px,-1px);box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list>header>span{color:#fff;background:#141414;border-radius:3px;padding:1px 7px}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot{border:2px solid #141414;border-radius:2px;width:10px;height:10px}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-attention{background:#ff9d5c}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-progress{background:#35c5f0}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-schedule{background:#b49bf0}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-done{background:#7ddb8a}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-empty{border:2px dashed #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-card-actions button{color:#141414;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-composer-wrap{background:linear-gradient(transparent, var(--pw-bg) 22%)}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-banner{color:#141414;background:#fee2e2;border:2px solid #141414;border-radius:6px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-header{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-header small{color:#555}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-issues{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray{background:#fff;border:2px solid #141414;border-radius:6px;box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray:focus-within{border-color:#141414;box-shadow:5px 5px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-btn{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-btn:hover{background:#ffd91a}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-link{color:#141414;text-decoration:underline}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-close{color:#141414;border:1.5px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-messages article{background:#fdf8e7;border:1.5px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-messages article.is-user{background:#8fdcff}.personal-workspace-shell[data-pw-theme=brutal] .personal-prompt-badge{color:#ffe23f;background:#141414;border:1px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-quick-prompts button{color:#141414;background:#fff;border:2px solid #141414;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-quick-prompts button:hover{color:#141414;background:#ffe23f;border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer{border:2px solid #141414;border-radius:6px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer:focus-within{border-color:#141414;box-shadow:5px 5px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer textarea{border-left:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>button,.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>.personal-composer-attach,.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer button{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>button:hover{background:#ffd91a;transform:translate(1px,1px);box-shadow:1px 1px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer{border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer:focus-within{border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-workspace-drawer{box-shadow:none;border-left:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-detail-card,.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-panel{border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-detail-card.is-attention{background:#fff3c9;border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-primary-action{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-primary-action:hover{background:#ffd91a;transform:translate(1px,1px);box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-secondary-action{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-secondary-action:hover{border-color:#141414;transform:translate(1px,1px);box-shadow:1px 1px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-danger-action{color:#141414;background:#ff9d8a;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>summary{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>div{border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>div button:hover{background:#fff8d6}.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-agent-select{border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-agent-select select,.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-resume-when input,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-fields input:not([type=checkbox]),.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-fields select,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-domain-option,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-preview{color:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch{background:#fff;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch[aria-checked=true]{background:#baf2c7}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch>span{background:#777}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch[aria-checked=true]>span{background:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-preview{background:#fff3c9;box-shadow:2px 2px #141414}.personal-digest-card{border:1px solid var(--pw-line);background:linear-gradient(135deg,#fff,#fbf7ee);border-radius:14px;justify-content:space-between;align-items:center;gap:14px;margin-bottom:12px;padding:13px 16px;display:flex}.personal-digest-card>strong{letter-spacing:.01em;font-size:13px}.personal-digest-stats{gap:8px;display:flex}.personal-digest-stats span{border:1px solid var(--pw-line-strong);color:var(--pw-muted);background:#fff;border-radius:99px;align-items:baseline;gap:6px;padding:6px 13px;font-size:12px;display:inline-flex}.personal-digest-stats b{color:var(--pw-text);font-size:14px}.personal-composer-hint{color:var(--pw-faint);margin:0 0 8px;font-size:11.5px}.personal-priority-badge{color:var(--pw-muted);background:#f2f1ed;border-radius:6px;padding:1px 7px;font-size:10.5px;font-weight:700}.personal-priority-badge.is-p0{background:var(--pw-red-bg);color:var(--pw-red)}.personal-priority-badge.is-p1{background:var(--pw-amber-bg);color:var(--pw-amber)}.personal-priority-badge.is-blocked{background:var(--pw-red-bg);color:var(--pw-red)}.personal-workspace-shell[data-pw-theme=brutal] .personal-digest-card{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-digest-stats span{color:#141414;border:2px solid #141414;border-radius:99px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-priority-badge{border:1.5px solid #141414;border-radius:3px}.personal-goal-notification code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);word-break:break-all;border-radius:5px;padding:1px 5px;font-size:11px}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-notification code{background:#fff;border:1.5px solid #141414;border-radius:3px}.personal-proposal-state.is-error:has(small){align-items:start;gap:4px;display:grid}.personal-proposal-state.is-error small{word-break:break-all;line-height:1.5}.personal-gate-cli-hint{gap:6px;margin-top:10px;display:grid}.personal-gate-cli-hint code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);-webkit-user-select:all;user-select:all;word-break:break-all;border-radius:7px;padding:8px 10px;font-size:11.5px;line-height:1.5;display:block}.personal-gate-cli-hint small{color:var(--pw-muted);line-height:1.5}.personal-notification-list{gap:0;margin:12px 0 0;padding:0;list-style:none;display:grid}.personal-notification-row{border-top:1px solid var(--pw-line);gap:8px;padding:12px 0;display:grid}.personal-notification-row:first-child{border-top:0;padding-top:4px}.personal-notification-row-head{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-notification-row-head strong{font-size:13px}.personal-notification-badge{border-radius:99px;flex:none;padding:2px 8px;font-size:11px;font-weight:650}.personal-notification-badge.is-on{background:var(--pw-green-bg);color:var(--pw-green)}.personal-notification-badge.is-off{background:var(--pw-bg,#f5f4ef);color:var(--pw-muted)}.personal-notification-meta{color:var(--pw-muted);flex-wrap:wrap;gap:4px 12px;font-size:11.5px;display:flex}.personal-notification-toggle{color:var(--pw-text);cursor:pointer;align-items:center;gap:8px;font-size:12.5px;display:flex}.personal-notification-toggle input{accent-color:var(--pw-blue);cursor:pointer;width:15px;height:15px}.personal-notification-bind{gap:8px;display:flex}.personal-notification-bind select{border:1px solid var(--pw-line-strong);min-width:0;height:34px;color:var(--pw-text);background:#fff;border-radius:8px;flex:1;padding:0 10px;font-size:12.5px}.personal-notification-bind .personal-secondary-action{flex:none}.personal-notification-confirm{border:1px solid var(--pw-line);background:var(--pw-bg,#faf9f5);border-radius:9px;gap:8px;padding:10px 12px;display:grid}.personal-notification-confirm p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-notification-actions{gap:8px;display:flex}.personal-notification-error{color:var(--pw-red);margin:0;font-size:12px;line-height:1.5}.personal-notification-hint{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-notification-hint code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);-webkit-user-select:all;user-select:all;border-radius:5px;margin-top:4px;padding:2px 7px;font-size:11px;display:inline-block}.is-spinning{animation:.9s linear infinite personal-notification-spin}@keyframes personal-notification-spin{to{transform:rotate(360deg)}}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-badge{border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-bind select{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-confirm{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-settings-card{border:2px solid #141414;border-radius:4px;box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-settings-icon{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-language-options>button{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-language-options>button.is-selected{color:#141414;background:#8fdcff}@media (width<=720px){.personal-lark-settings{padding:20px 16px calc(24px + env(safe-area-inset-bottom))}.personal-lark-header h1{font-size:24px}.personal-lark-tabs{gap:18px;margin-top:20px}.personal-settings-card>header,.personal-language-options{padding-left:15px;padding-right:15px}}.personal-goal-acceptance h4{margin:16px 0 8px;font-size:14px}.personal-goal-acceptance .personal-acceptance-observation{border-top:1px solid var(--color-border,#ebebeb);padding:8px 0}.personal-goal-acceptance dd,.personal-goal-acceptance p{overflow-wrap:anywhere}.personal-goal-acceptance details{margin-top:16px}.benchmark-page{--benchmark-ink:#171717;--benchmark-body:#4d4d4d;--benchmark-muted:#767676;--benchmark-canvas:#fafafa;--benchmark-surface:#fff;--benchmark-soft:#f2f2f2;--benchmark-border:#e5e5e5;--benchmark-link:#0068d7;width:100%;max-width:100vw;min-height:100vh;color:var(--benchmark-ink);background:var(--benchmark-canvas);font-family:Geist,Inter,Helvetica Neue,Arial,sans-serif;overflow-x:clip}.benchmark-page,.benchmark-page *{box-sizing:border-box}.benchmark-hero{border-bottom:1px solid var(--benchmark-border);background:var(--benchmark-surface);padding:24px max(24px,50vw - 600px)}.benchmark-hero-topline,.benchmark-title-row,.benchmark-card-heading,.benchmark-footer>div{align-items:center;display:flex}.benchmark-hero-topline{justify-content:space-between;margin-bottom:64px}.benchmark-wordmark{color:var(--benchmark-ink);letter-spacing:-.04em;font-weight:650;text-decoration:none}.benchmark-readonly{color:var(--benchmark-muted);align-items:center;gap:8px;font-size:12px;display:inline-flex}.benchmark-hero-grid{grid-template-columns:minmax(0,1.5fr) minmax(260px,.5fr);align-items:end;gap:64px;display:grid}.benchmark-kicker,.benchmark-mono{color:var(--benchmark-muted);letter-spacing:.08em;text-transform:uppercase;margin:0 0 8px;font:500 11px/16px Geist Mono,JetBrains Mono,monospace}.benchmark-title-row{align-items:baseline;gap:16px}.benchmark-title-row h1{letter-spacing:-.05em;max-width:780px;margin:0;font-size:clamp(32px,4.5vw,48px);font-weight:600;line-height:1}.benchmark-lead{max-width:680px;color:var(--benchmark-body);margin:20px 0 0;font-size:16px;line-height:24px}.benchmark-identity,.benchmark-stat-list{margin:0}.benchmark-identity>div{border-top:1px solid var(--benchmark-border);grid-template-columns:80px minmax(0,1fr);gap:16px;padding:10px 0;display:grid}.benchmark-identity dt,.benchmark-stat-list dt{color:var(--benchmark-muted);font-size:12px}.benchmark-identity dd{text-overflow:ellipsis;white-space:nowrap;margin:0;font:500 12px/18px Geist Mono,monospace;overflow:hidden}.benchmark-kpi-grid{border:1px solid var(--benchmark-border);border-radius:12px;grid-template-columns:repeat(4,minmax(0,1fr));margin-top:64px;display:grid;overflow:hidden}.benchmark-kpi-grid article{border-right:1px solid var(--benchmark-border);min-width:0;padding:20px 24px}.benchmark-kpi-grid article:last-child{border-right:0}.benchmark-kpi-grid svg{color:var(--benchmark-muted)}.benchmark-kpi-grid span{color:var(--benchmark-muted);margin-top:16px;font-size:12px;display:block}.benchmark-kpi-grid strong{letter-spacing:-.04em;font-variant-numeric:tabular-nums;margin-top:6px;font-size:30px;font-weight:600;display:block}.benchmark-kpi-grid strong small{color:var(--benchmark-muted);letter-spacing:0;font-size:14px;font-weight:400}.benchmark-kpi-grid p{color:var(--benchmark-body);margin:8px 0 0;font-size:12px}.benchmark-state{border:1px solid var(--benchmark-border);width:fit-content;color:var(--benchmark-body);background:var(--benchmark-soft);text-transform:capitalize;border-radius:999px;align-items:center;padding:3px 8px;font:500 11px/16px Geist Mono,monospace;display:inline-flex}.benchmark-state-success{color:#087a44;background:#ecf9f2;border-color:#b8e7ce}.benchmark-state-warning{color:#8a5100;background:#fff8e8;border-color:#f0d2a3}.benchmark-state-info{color:#0057b8;background:#eef6ff;border-color:#b9d7f5}.benchmark-tabs{z-index:3;border-bottom:1px solid var(--benchmark-border);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fafafaf0;align-items:center;gap:4px;padding:12px max(24px,50vw - 600px);display:flex;position:sticky;top:0}.benchmark-tabs button,.benchmark-loading button{min-height:40px;color:var(--benchmark-body);cursor:pointer;background:0 0;border:0;border-radius:6px;padding:0 14px;font-size:13px;font-weight:500}.benchmark-tabs button[aria-current=page]{color:#fff;background:var(--benchmark-ink)}.benchmark-tabs .benchmark-refresh{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);align-items:center;gap:7px;margin-left:auto;display:inline-flex}.benchmark-tabs button:focus-visible,.benchmark-cell-link:focus-visible,.benchmark-run-link:focus-visible,.benchmark-loading button:focus-visible{outline:2px solid var(--benchmark-link);outline-offset:2px}.benchmark-content{width:min(100vw - 48px,1200px);min-width:0;margin:0 auto;padding:40px 0 64px}.benchmark-view-stack{gap:48px;min-width:0;display:grid}.benchmark-view-stack>section{min-width:0}.benchmark-section-heading{justify-content:space-between;align-items:end;gap:24px;margin-bottom:16px;display:flex}.benchmark-section-heading h2,.benchmark-detail-card h2,.benchmark-run-detail h2{letter-spacing:-.02em;margin:0;font-size:20px;line-height:28px}.benchmark-section-heading>p{max-width:420px;color:var(--benchmark-muted);text-align:right;margin:0;font-size:12px;line-height:18px}.benchmark-arm-grid,.benchmark-detail-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;display:grid}.benchmark-arm-card,.benchmark-detail-card,.benchmark-run-detail{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:12px;padding:24px}.benchmark-card-heading{justify-content:space-between;align-items:start;gap:24px}.benchmark-card-heading h3{letter-spacing:-.02em;margin:0;font-size:16px;line-height:24px}.benchmark-stat-list{margin-top:24px}.benchmark-stat-list>div{border-top:1px solid var(--benchmark-border);grid-template-columns:minmax(0,1fr) auto;gap:16px;padding:11px 0;display:grid}.benchmark-stat-list dd{font-variant-numeric:tabular-nums;text-align:right;margin:0;font:500 12px/18px Geist Mono,monospace}.benchmark-factor-row{flex-wrap:wrap;gap:8px;margin-top:20px;display:flex}.benchmark-factor-row span{color:var(--benchmark-muted);background:var(--benchmark-soft);border-radius:6px;padding:5px 8px;font-size:11px}.benchmark-runtime-list{flex-wrap:wrap;gap:8px;display:flex}.benchmark-runtime-list>div{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:6px;align-items:center;gap:20px;padding:9px 11px;font:500 11px/16px Geist Mono,monospace;display:inline-flex}.benchmark-runtime-list>div span{color:var(--benchmark-muted)}.benchmark-runtime-list>div strong{font-weight:600}.benchmark-table-shell{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:12px;width:100%;max-width:100%;overflow:auto}.benchmark-table-shell table{border-collapse:collapse;width:100%;font-size:12px}.benchmark-table-shell th,.benchmark-table-shell td{border-bottom:1px solid var(--benchmark-border);text-align:left;white-space:nowrap;padding:14px 16px}.benchmark-table-shell tr:last-child td{border-bottom:0}.benchmark-table-shell th{color:var(--benchmark-muted);background:var(--benchmark-soft);letter-spacing:.03em;text-transform:uppercase;font-size:11px;font-weight:500}.benchmark-table-shell td{color:var(--benchmark-body)}.benchmark-positive{color:#087a44!important}.benchmark-negative{color:#b42318!important}.benchmark-muted{color:var(--benchmark-muted)}.benchmark-wide-table{min-height:300px}.benchmark-cell-link,.benchmark-run-link{color:var(--benchmark-ink);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:0}.benchmark-cell-link span{font-family:Geist Mono,monospace;display:block}.benchmark-cell-link small{color:var(--benchmark-link);align-items:center;gap:4px;margin-top:5px;display:flex}.benchmark-cell-link small+small{color:var(--benchmark-muted)}.benchmark-cell-link .benchmark-cell-metric{color:var(--benchmark-body);font-family:Geist Mono,monospace}.benchmark-run-link{max-width:280px;color:var(--benchmark-link);text-overflow:ellipsis;overflow:hidden}.benchmark-runs-layout{grid-template-columns:minmax(0,1.3fr) minmax(340px,.7fr);align-items:start;gap:16px;display:grid}.benchmark-table-shell tr[aria-selected=true] td{background:#f3f7fb}.benchmark-run-detail{position:sticky;top:82px}.benchmark-run-detail h2{overflow-wrap:anywhere;max-width:340px}.benchmark-run-facts dd{overflow-wrap:anywhere;white-space:normal;max-width:310px}.benchmark-run-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:20px;display:grid}.benchmark-run-metrics>div{background:var(--benchmark-soft);border-radius:6px;padding:10px}.benchmark-run-metrics span,.benchmark-run-metrics strong{display:block}.benchmark-run-metrics span{color:var(--benchmark-muted);font-size:10px}.benchmark-run-metrics strong{margin-top:5px;font:600 12px/18px Geist Mono,monospace}.benchmark-insight{border-left:2px solid var(--benchmark-link);margin-top:20px;padding:4px 0 4px 14px}.benchmark-insight p{color:var(--benchmark-body);margin:8px 0;font-size:13px;line-height:20px}.benchmark-insight small{color:var(--benchmark-muted);line-height:18px}.benchmark-footer{border-top:1px solid var(--benchmark-border);color:var(--benchmark-muted);background:var(--benchmark-surface);justify-content:space-between;gap:24px;padding:20px max(24px,50vw - 600px);font-size:11px;display:flex}.benchmark-footer>div{flex-wrap:wrap;gap:12px}.benchmark-footer code{text-overflow:ellipsis;white-space:nowrap;max-width:360px;overflow:hidden}.benchmark-loading{text-align:center;place-content:center;min-height:100vh;display:grid}.benchmark-loading svg{color:var(--benchmark-muted);margin:0 auto}.benchmark-loading h1{margin:18px 0 0;font-size:24px}.benchmark-loading p{max-width:520px;color:var(--benchmark-muted);margin:8px auto 0}.benchmark-loading button{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);align-items:center;gap:8px;margin:20px auto 0;display:inline-flex}@media (width<=900px){.benchmark-hero-grid,.benchmark-runs-layout{grid-template-columns:1fr}.benchmark-hero-grid{gap:32px}.benchmark-kpi-grid{grid-template-columns:repeat(2,1fr)}.benchmark-kpi-grid article:nth-child(2){border-right:0}.benchmark-kpi-grid article:nth-child(-n+2){border-bottom:1px solid var(--benchmark-border)}.benchmark-run-detail{position:static}}@media (width<=640px){.benchmark-hero{padding-inline:20px}.benchmark-hero-topline{margin-bottom:40px}.benchmark-title-row,.benchmark-section-heading,.benchmark-footer{flex-direction:column;align-items:flex-start}.benchmark-title-row h1{font-size:34px}.benchmark-kpi-grid,.benchmark-arm-grid,.benchmark-detail-grid{grid-template-columns:1fr}.benchmark-kpi-grid article{border-right:0;border-bottom:1px solid var(--benchmark-border)}.benchmark-kpi-grid article:last-child{border-bottom:0}.benchmark-tabs{padding-inline:20px;overflow-x:auto}.benchmark-tabs .benchmark-refresh{display:none}.benchmark-content{width:calc(100vw - 40px);padding-top:28px}.benchmark-section-heading>p{text-align:left}.benchmark-footer code{max-width:100%}}@media (prefers-reduced-motion:reduce){.benchmark-page *,.benchmark-page :before,.benchmark-page :after{scroll-behavior:auto!important;transition:none!important}}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-latin-wght-normal-BgDaEnEv.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2)format("woff2-variations");unicode-range:U+2000-2001,U+2004-2008,U+200A,U+23B8-23BD,U+2500-259F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-amber-950:oklch(27.9% .077 45.635);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-800:oklch(43.2% .095 166.913);--color-emerald-900:oklch(37.8% .077 168.94);--color-emerald-950:oklch(26.2% .051 172.552);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-800:oklch(44.3% .11 240.79);--color-sky-900:oklch(39.1% .09 240.876);--color-sky-950:oklch(29.3% .066 243.157);--color-rose-50:oklch(96.9% .015 12.422);--color-rose-100:oklch(94.1% .03 12.58);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-600:oklch(58.6% .253 17.585);--color-rose-700:oklch(51.4% .222 16.935);--color-rose-800:oklch(45.5% .188 13.697);--color-rose-900:oklch(41% .159 10.272);--color-rose-950:oklch(27.1% .105 12.094);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-zinc-50:oklch(98.5% 0 0);--color-zinc-100:oklch(96.7% .001 286.375);--color-zinc-200:oklch(92% .004 286.32);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-400:oklch(70.5% .015 286.067);--color-zinc-500:oklch(55.2% .016 285.938);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-zinc-950:oklch(14.1% .005 285.823);--color-white:#fff;--spacing:.25rem;--container-xl:36rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-normal:0em;--radius-md:.375rem;--radius-lg:.5rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.\!visible{visibility:visible!important}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.fixed{position:fixed}.relative{position:relative}.static{position:static}.m-0{margin:calc(var(--spacing) * 0)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-8{margin-top:calc(var(--spacing) * 8)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-64{min-height:calc(var(--spacing) * 64)}.min-h-\[calc\(100vh-80px\)\]{min-height:calc(100vh - 80px)}.min-h-screen{min-height:100vh}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-9{width:calc(var(--spacing) * 9)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[1500px\]{max-width:1500px}.max-w-xl{max-width:var(--container-xl)}.min-w-\[260px\]{min-width:260px}.min-w-full{min-width:100%}.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.border-separate{border-collapse:separate}.border-spacing-0{--tw-border-spacing-x:calc(var(--spacing) * 0);--tw-border-spacing-y:calc(var(--spacing) * 0);border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}.animate-spin{animation:var(--animate-spin)}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-slate-100>:not(:last-child)){border-color:var(--color-slate-100)}.overflow-x-auto{overflow-x:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-200{border-color:var(--color-amber-200)}.border-emerald-200{border-color:var(--color-emerald-200)}.border-rose-200{border-color:var(--color-rose-200)}.border-sky-200{border-color:var(--color-sky-200)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-200\/80{border-color:#e2e8f0cc}@supports (color:color-mix(in lab, red, red)){.border-slate-200\/80{border-color:color-mix(in oklab, var(--color-slate-200) 80%, transparent)}}.border-slate-300{border-color:var(--color-slate-300)}.border-slate-900{border-color:var(--color-slate-900)}.border-transparent{border-color:#0000}.bg-\[\#f6f7f9\]{background-color:#f6f7f9}.bg-\[\#f7f7f4\]{background-color:#f7f7f4}.bg-amber-50{background-color:var(--color-amber-50)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-rose-50{background-color:var(--color-rose-50)}.bg-sky-50{background-color:var(--color-sky-50)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-slate-950{background-color:var(--color-slate-950)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.bg-white\/70{background-color:color-mix(in oklab, var(--color-white) 70%, transparent)}}.bg-white\/95{background-color:#fffffff2}@supports (color:color-mix(in lab, red, red)){.bg-white\/95{background-color:color-mix(in oklab, var(--color-white) 95%, transparent)}}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.pt-0{padding-top:calc(var(--spacing) * 0)}.text-center{text-align:center}.text-left{text-align:left}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[11px\]{font-size:11px}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-7{--tw-leading:calc(var(--spacing) * 7);line-height:calc(var(--spacing) * 7)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\[0\.14em\]{--tw-tracking:.14em;letter-spacing:.14em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-amber-900{color:var(--color-amber-900)}.text-amber-950{color:var(--color-amber-950)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-emerald-800{color:var(--color-emerald-800)}.text-emerald-950{color:var(--color-emerald-950)}.text-rose-600{color:var(--color-rose-600)}.text-rose-700{color:var(--color-rose-700)}.text-rose-800{color:var(--color-rose-800)}.text-rose-900{color:var(--color-rose-900)}.text-sky-800{color:var(--color-sky-800)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-slate-900{color:var(--color-slate-900)}.text-slate-950{color:var(--color-slate-950)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_1px_2px_rgba\(15\,23\,42\,0\.04\)\]{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0f172a0a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.hover\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\:bg-slate-100:hover{background-color:var(--color-slate-100)}.hover\:bg-slate-800:hover{background-color:var(--color-slate-800)}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-slate-400:focus{--tw-ring-color:var(--color-slate-400)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-slate-400:focus-visible{--tw-ring-color:var(--color-slate-400)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:block{display:block}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-\[240px_1fr\]{grid-template-columns:240px 1fr}.sm\:p-8{padding:calc(var(--spacing) * 8)}.sm\:px-5{padding-inline:calc(var(--spacing) * 5)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}}@media (width>=48rem){.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=80rem){.xl\:sticky{position:sticky}.xl\:top-4{top:calc(var(--spacing) * 4)}.xl\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-\[260px_minmax\(0\,1fr\)\]{grid-template-columns:260px minmax(0,1fr)}.xl\:grid-cols-\[minmax\(0\,1\.35fr\)_minmax\(360px\,0\.65fr\)\]{grid-template-columns:minmax(0,1.35fr) minmax(360px,.65fr)}.xl\:grid-cols-\[minmax\(0\,1fr\)_420px\]{grid-template-columns:minmax(0,1fr) 420px}.xl\:self-start{align-self:flex-start}}:where(.dark\:divide-zinc-900:where(.dark,.dark *)>:not(:last-child)){border-color:var(--color-zinc-900)}.dark\:border-amber-900:where(.dark,.dark *){border-color:var(--color-amber-900)}.dark\:border-emerald-900:where(.dark,.dark *){border-color:var(--color-emerald-900)}.dark\:border-rose-900:where(.dark,.dark *){border-color:var(--color-rose-900)}.dark\:border-sky-900:where(.dark,.dark *){border-color:var(--color-sky-900)}.dark\:border-zinc-100:where(.dark,.dark *){border-color:var(--color-zinc-100)}.dark\:border-zinc-700:where(.dark,.dark *){border-color:var(--color-zinc-700)}.dark\:border-zinc-800:where(.dark,.dark *){border-color:var(--color-zinc-800)}.dark\:bg-\[\#09090b\]:where(.dark,.dark *){background-color:#09090b}.dark\:bg-amber-950:where(.dark,.dark *){background-color:var(--color-amber-950)}.dark\:bg-amber-950\/40:where(.dark,.dark *){background-color:#46190166}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-950\/40:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-amber-950) 40%, transparent)}}.dark\:bg-emerald-950:where(.dark,.dark *){background-color:var(--color-emerald-950)}.dark\:bg-rose-950:where(.dark,.dark *){background-color:var(--color-rose-950)}.dark\:bg-sky-950:where(.dark,.dark *){background-color:var(--color-sky-950)}.dark\:bg-zinc-50:where(.dark,.dark *){background-color:var(--color-zinc-50)}.dark\:bg-zinc-900:where(.dark,.dark *){background-color:var(--color-zinc-900)}.dark\:bg-zinc-950:where(.dark,.dark *){background-color:var(--color-zinc-950)}.dark\:bg-zinc-950\/40:where(.dark,.dark *){background-color:#09090b66}@supports (color:color-mix(in lab, red, red)){.dark\:bg-zinc-950\/40:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-zinc-950) 40%, transparent)}}.dark\:text-amber-100:where(.dark,.dark *){color:var(--color-amber-100)}.dark\:text-amber-200:where(.dark,.dark *){color:var(--color-amber-200)}.dark\:text-amber-300:where(.dark,.dark *){color:var(--color-amber-300)}.dark\:text-emerald-200:where(.dark,.dark *){color:var(--color-emerald-200)}.dark\:text-emerald-300:where(.dark,.dark *){color:var(--color-emerald-300)}.dark\:text-rose-100:where(.dark,.dark *){color:var(--color-rose-100)}.dark\:text-rose-200:where(.dark,.dark *){color:var(--color-rose-200)}.dark\:text-rose-300:where(.dark,.dark *){color:var(--color-rose-300)}.dark\:text-sky-200:where(.dark,.dark *){color:var(--color-sky-200)}.dark\:text-zinc-50:where(.dark,.dark *){color:var(--color-zinc-50)}.dark\:text-zinc-100:where(.dark,.dark *){color:var(--color-zinc-100)}.dark\:text-zinc-200:where(.dark,.dark *){color:var(--color-zinc-200)}.dark\:text-zinc-300:where(.dark,.dark *){color:var(--color-zinc-300)}.dark\:text-zinc-400:where(.dark,.dark *){color:var(--color-zinc-400)}.dark\:text-zinc-500:where(.dark,.dark *){color:var(--color-zinc-500)}.dark\:text-zinc-950:where(.dark,.dark *){color:var(--color-zinc-950)}@media (hover:hover){.dark\:hover\:bg-zinc-200:where(.dark,.dark *):hover{background-color:var(--color-zinc-200)}.dark\:hover\:bg-zinc-900:where(.dark,.dark *):hover{background-color:var(--color-zinc-900)}}.dark\:focus\:ring-zinc-500:where(.dark,.dark *):focus,.dark\:focus-visible\:ring-zinc-500:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--color-zinc-500)}}:root{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;font-family:Geist Variable,Geist,Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.dark{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}body{-webkit-font-smoothing:antialiased;text-rendering:geometricprecision;margin:0}button,input,select{font:inherit}.personal-home{--personal-accent:#2563eb;--personal-border:#e2ded6;color:#23272d;background:#f8f7f3;grid-template-columns:196px minmax(0,1fr);width:100%;min-height:100vh;display:grid;overflow-x:clip}.personal-sidebar{border-right:1px solid var(--personal-border);background:#fcfbf8;flex-direction:column;height:100vh;padding:1.5rem 1rem;display:flex;position:sticky;top:0}.personal-wordmark{color:#181d24;letter-spacing:-.01em;align-items:center;gap:.625rem;padding-inline:.5rem;font-size:.9375rem;font-weight:700;text-decoration:none;display:flex}.personal-wordmark-mark,.personal-manager-icon{color:#fff;background:#1e40af;border-radius:.625rem;flex:none;place-items:center;width:1.875rem;height:1.875rem;display:grid;box-shadow:0 1px 2px #0f172a24}.personal-nav{gap:.25rem;margin-top:2rem;display:grid}.personal-nav-item{color:#646971;text-align:left;background:0 0;border:0;border-radius:.625rem;align-items:center;gap:.625rem;width:100%;padding:.625rem .75rem;font-size:.875rem;font-weight:500;text-decoration:none;display:flex}.personal-nav-item-active{color:#1e40af;background:#e8eefc}.personal-nav-item:disabled{cursor:default;opacity:.72}.personal-health{color:#71717a;align-items:center;gap:.5rem;margin-top:auto;padding:.75rem .5rem 0;font-size:.75rem;display:flex}.personal-health-dot,.personal-state-dot{background:#94a3b8;border-radius:9999px;flex:none;width:.5rem;height:.5rem}.personal-health-dot.is-healthy{background:#22c55e;box-shadow:0 0 0 3px #22c55e1f}.personal-health-dot.is-unhealthy{background:#e11d48;box-shadow:0 0 0 3px #e11d481f}.personal-main{min-width:0;padding-bottom:6rem;position:relative}.personal-header{border-bottom:1px solid var(--personal-border);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fcfbf8eb;justify-content:space-between;align-items:center;gap:1.5rem;min-height:7rem;padding:1.5rem clamp(1.5rem,5vw,4.5rem);display:flex}.personal-header h1{color:#181d24;letter-spacing:-.035em;margin:0;font-size:clamp(1.625rem,2.5vw,2rem);font-weight:650}.personal-header p{color:#71717a;margin:.375rem 0 0;font-size:.875rem}.personal-primary-link,.personal-row-action{color:#fff;background:var(--personal-accent);border-radius:.625rem;flex:none;justify-content:center;align-items:center;gap:.375rem;font-size:.8125rem;font-weight:600;text-decoration:none;display:inline-flex;box-shadow:0 1px 2px #2563eb33}.personal-primary-link{min-height:2.375rem;padding-inline:.875rem}.personal-content{width:min(100%,70rem);margin-inline:auto;padding:2rem clamp(1.5rem,5vw,4.5rem)}.personal-manager-summary{background:#ffffffb8;border:1px solid #dbe0e8;border-radius:.75rem;align-items:center;gap:.875rem;padding:.875rem 1rem;display:flex;box-shadow:0 1px 2px #0f172a09}.personal-manager-summary p{color:#474f5b;margin:0;font-size:.875rem;line-height:1.5}.personal-manager-icon{color:#1e40af;width:1.75rem;height:1.75rem;box-shadow:none;background:#e2e9f9}.personal-section{margin-top:2.25rem}.personal-section-heading{justify-content:space-between;align-items:end;gap:1rem;margin-bottom:.75rem;display:flex}.personal-section-heading h2{color:#23272d;letter-spacing:-.01em;margin:0;font-size:1rem;font-weight:650}.personal-section-heading p{color:#7d7d85;margin:.25rem 0 0;font-size:.75rem}.personal-section-heading>span{color:#7d7d85;font-variant-numeric:tabular-nums;font-size:.75rem}.personal-list{border:1px solid var(--personal-border);background:#ffffffdb;border-radius:.75rem;overflow:hidden;box-shadow:0 2px 8px #1d232b09}.personal-list-row{border-bottom:1px solid #ebe8e2;align-items:center;gap:1rem;min-width:0;padding:1rem;display:grid}.personal-list-row:last-child{border-bottom:0}.personal-needs-row{grid-template-columns:auto minmax(0,1fr) auto auto}.personal-goal-row{color:inherit;grid-template-columns:minmax(0,1fr) auto auto;text-decoration:none;transition:background-color .12s}.personal-goal-row:hover{background:#f8fafc}.personal-goal-meta{align-items:center;gap:.75rem;display:inline-flex}.personal-state-dot.is-blocking{background:#d97706;box-shadow:0 0 0 3px #d977061f}.personal-row-copy{min-width:0}.personal-row-copy strong,.personal-row-copy span{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.personal-row-copy strong{color:#2a2f36;font-size:.875rem;font-weight:580}.personal-row-copy span{color:#7d7d85;margin-top:.3125rem;font-size:.75rem}.personal-row-action{color:#1e40af;min-height:2rem;box-shadow:none;background:#e8eefc;padding-inline:.75rem}.personal-empty{color:#7d7d85;text-align:center;padding:1.5rem 1rem;font-size:.8125rem}.personal-source-tools{color:#94949c;justify-content:flex-end;align-items:center;gap:.25rem;margin-top:1rem;font-size:.6875rem;display:flex}.personal-source-tools button{min-height:1.75rem;color:inherit;background:0 0;border:0;border-radius:.375rem;align-items:center;gap:.25rem;padding-inline:.375rem;display:inline-flex}.personal-source-tools button:not(:disabled):hover{color:#475569;background:#f1efea}.personal-manager-input{color:#7d7d85;text-align:left;cursor:pointer;background:#fffffff0;border:1px solid #d8d6d0;border-radius:9999px;align-items:center;gap:.625rem;min-width:12rem;padding:.75rem 1rem;font-size:.8125rem;transition:border-color .12s,box-shadow .12s,color .12s;display:inline-flex;position:fixed;bottom:1.5rem;right:1.5rem;box-shadow:0 8px 24px #0f172a14}.personal-manager-input:hover{color:#475569;border-color:#bfc9da;box-shadow:0 10px 28px #0f172a1f}.personal-manager-backdrop{z-index:50;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a33;justify-content:flex-end;display:flex;position:fixed;inset:0}.personal-manager-drawer{color:#23272d;background:#fcfbf8;grid-template-rows:auto auto minmax(0,1fr) auto;width:min(26.25rem,100vw);min-width:0;height:100%;display:grid;box-shadow:-12px 0 36px #0f172a29}.personal-manager-drawer-header{border-bottom:1px solid var(--personal-border);grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;padding:1rem;display:grid}.personal-manager-drawer-header h2,.personal-manager-drawer-header p{margin:0}.personal-manager-drawer-header h2{color:#181d24;font-size:.9375rem;font-weight:650}.personal-manager-drawer-header p{color:#7d7d85;margin-top:.125rem;font-size:.6875rem}.personal-manager-source{color:#475569;background:#f1efea;border-radius:9999px;padding:.25rem .5rem;font-size:.6875rem}.personal-manager-drawer-header button,.personal-manager-composer button{color:#646971;cursor:pointer;background:0 0;border:0;border-radius:.5rem;flex:none;place-items:center;width:2rem;height:2rem;display:inline-grid}.personal-manager-drawer-header button:hover{color:#23272d;background:#f1efea}.personal-manager-quick-actions{border-bottom:1px solid #ebe8e2;gap:.5rem;padding:.75rem 1rem;display:flex;overflow-x:auto}.personal-manager-thread{min-width:0;padding:1rem;overflow-y:auto}.personal-message-answer{white-space:pre-wrap;color:#323944;line-height:1.7}.personal-message-pending{color:#64748b}.personal-message-activity{color:#646a74;border-top:1px solid #d6d3cc;margin-top:.625rem;padding-top:.5rem}.personal-message-activity summary{cursor:pointer;width:fit-content;font-size:.6875rem;font-weight:600}.personal-message-activity ol{gap:.25rem;margin:.5rem 0 0;padding-left:1.125rem;font-size:.6875rem;display:grid}.personal-message-reconnect{color:#1e40af;background:#fff;border:1px solid #cbd5e1;border-radius:.5rem;margin-top:.625rem;padding:.35rem .65rem;font-size:.6875rem;font-weight:700}.personal-message-reconnect:hover{background:#eff6ff;border-color:#93c5fd}.personal-manager-composer{border-top:1px solid var(--personal-border);padding:.875rem 1rem max(.875rem, env(safe-area-inset-bottom));background:#fcfbf8;align-items:center;gap:.5rem;display:flex}.personal-manager-composer input{color:#23272d;background:#fff;border:1px solid #d8d6d0;border-radius:.625rem;outline:none;width:100%;min-width:0;height:2.5rem;padding-inline:.75rem}.personal-manager-composer input:focus{border-color:#60a5fa;box-shadow:0 0 0 3px #3b82f61f}.personal-manager-composer button{color:#fff;background:var(--personal-accent)}.personal-manager-composer button:disabled{cursor:default;opacity:.42}@media (width<=760px){.personal-home{display:block}.personal-sidebar{border-right:0;border-bottom:1px solid var(--personal-border);grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;height:auto;padding:.75rem 1rem;display:grid;position:static}.personal-nav{justify-content:flex-end;min-width:0;margin-top:0;display:flex}.personal-nav-item{width:auto;padding:.5rem}.personal-nav-item:not(.personal-nav-item-active){font-size:0}.personal-health{margin-top:0;padding:0;font-size:0}.personal-header{min-height:auto;padding:1.25rem 1rem}.personal-content{padding:1.5rem 1rem}.personal-list{box-shadow:none;background:0 0;border:0;overflow:visible}.personal-list-row{border:1px solid var(--personal-border);background:#ffffffe6;border-radius:.75rem;margin-bottom:.625rem}.personal-needs-row{grid-template-columns:auto minmax(0,1fr) auto}.personal-needs-row .personal-row-action{grid-column:2/-1;justify-self:start}.personal-manager-input{bottom:1rem;right:1rem}}@media (width<=640px){.personal-manager-backdrop{align-items:flex-end}.personal-manager-drawer{width:100%;max-width:none;height:100dvh}}@media (width<=420px){.personal-wordmark-mark{display:none}.personal-sidebar{grid-template-columns:auto minmax(0,1fr) auto;padding-inline:.75rem}.personal-nav{gap:0}.personal-nav-item{gap:.25rem;padding-inline:.375rem}.personal-header{align-items:flex-start}.personal-primary-link{padding-inline:.625rem}.personal-primary-link svg{display:none}.personal-needs-row,.personal-goal-row{grid-template-columns:minmax(0,1fr) auto}.personal-needs-row .personal-state-dot{display:none}.personal-manager-input{min-width:0;max-width:calc(100vw - 2rem)}.personal-goal-meta svg{display:none}.personal-manager-drawer-header{grid-template-columns:auto minmax(0,1fr) auto auto}}.personal-workspace{--workspace-accent:#2563eb;--workspace-border:#e5e2dc;--workspace-muted:#70747e;color:#1e2228;background:#faf9f6;grid-template-columns:4.5rem 20rem minmax(0,1fr);height:100vh;min-height:42rem;display:grid;overflow:hidden}.personal-global-rail{border-right:1px solid var(--workspace-border);background:#fcfbf8;flex-direction:column;align-items:center;min-height:0;padding:1.125rem .75rem;display:flex}.personal-rail-logo{color:#fff;background:#1e40af;border-radius:.75rem;place-items:center;width:2.5rem;height:2.5rem;display:grid;box-shadow:0 4px 12px #1e40af2e}.personal-global-rail nav{gap:.5rem;margin-top:2rem;display:grid}.personal-global-rail nav button,.personal-global-rail>button{color:#80848c;cursor:pointer;background:0 0;border:0;border-radius:.625rem;place-items:center;width:2.5rem;height:2.5rem;display:grid}.personal-global-rail nav button.is-active{color:#1e40af;background:#e8eefc}.personal-global-rail nav button:disabled{cursor:default;opacity:.42}.personal-global-rail .personal-health-dot{margin-top:auto}.personal-goal-sidebar{border-right:1px solid var(--workspace-border);background:#fcfbf8;grid-template-rows:auto auto minmax(0,1fr) auto;min-width:0;min-height:0;display:grid}.personal-goal-sidebar>header{justify-content:space-between;align-items:center;height:4.75rem;padding:0 1.25rem;display:flex}.personal-goal-sidebar>header h1{letter-spacing:-.02em;margin:0;font-size:1rem;font-weight:680}.personal-goal-sidebar>header button,.personal-goal-sidebar>footer button{color:#70747e;background:0 0;border:0;border-radius:.5rem;place-items:center;width:2rem;height:2rem;display:grid}.personal-goal-sidebar>header button:disabled{opacity:.4}.personal-manager-row,.personal-goal-list-row{width:calc(100% - 1.5rem);min-width:0;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:.75rem;align-items:center;gap:.75rem;margin:0 .75rem;padding:.75rem;display:grid}.personal-manager-row{grid-template-columns:auto minmax(0,1fr);margin-bottom:.5rem}.personal-manager-row.is-selected,.personal-goal-list-row.is-selected{background:#e9eefa}.personal-goal-icon{color:#2563eb;background:#ffffffe6;border-radius:.625rem;place-items:center;width:2.25rem;height:2.25rem;display:grid;box-shadow:0 1px 2px #0f172a0f}.personal-manager-row strong,.personal-manager-row small,.personal-goal-list-copy strong,.personal-goal-list-copy small{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.personal-manager-row strong,.personal-goal-list-copy strong{font-size:.8125rem;font-weight:620}.personal-manager-row small,.personal-goal-list-copy small{color:var(--workspace-muted);margin-top:.25rem;font-size:.6875rem}.personal-goal-scroll{min-height:0;padding-bottom:1rem;overflow-y:auto}.personal-goal-list-row{grid-template-columns:auto minmax(0,1fr) auto;margin-bottom:.25rem}.personal-goal-list-row:hover{background:#f5f3ef}.personal-goal-list-row.is-selected:hover{background:#e9eefa}.personal-goal-list-row .personal-state-dot{width:.4375rem;height:.4375rem}.personal-state-dot.is-progressing{background:#10b981}.personal-state-dot.is-repair{background:#f43f5e}.personal-goal-list-row .rounded-full{padding-inline:.45rem;font-size:.625rem}.personal-goal-sidebar>footer{border-top:1px solid var(--workspace-border);min-height:3.25rem;color:var(--workspace-muted);justify-content:space-between;align-items:center;padding:0 1.25rem;font-size:.6875rem;display:flex}.personal-chat-pane{background:#faf9f6;grid-template-rows:auto minmax(0,1fr) auto;min-width:0;min-height:0;display:grid}.personal-chat-header{z-index:20;border-bottom:1px solid var(--workspace-border);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);background:#fcfbf8f0;justify-content:space-between;align-items:center;gap:1rem;min-width:0;min-height:4.75rem;padding:.75rem clamp(1rem,2.5vw,2rem);display:flex;position:relative}.personal-chat-title,.personal-chat-actions{align-items:center;gap:.75rem;min-width:0;display:flex}.personal-chat-title{flex:auto;overflow:hidden}.personal-chat-title>div{min-width:0}.personal-chat-actions{flex:none}.personal-chat-title h2,.personal-chat-title p{margin:0}.personal-chat-title h2{color:#181d24;letter-spacing:-.02em;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;font-weight:680;overflow:hidden}.personal-chat-title p{max-width:28rem;color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.15rem;font-size:.6875rem;overflow:hidden}.personal-chat-back,.personal-mobile-goals-button,.personal-chat-actions>button{color:#5b606a;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:.625rem;flex:none;place-items:center;width:2.25rem;height:2.25rem;display:grid}.personal-mobile-goals-button,.personal-agent-menu-backdrop{display:none}.personal-chat-back:hover,.personal-chat-actions>button:hover{border-color:var(--workspace-border);background:#fff}.personal-chat-actions>button.personal-progress-trigger{border-color:var(--workspace-border);color:#3c434e;background:#fffc;gap:.4rem;width:auto;padding-inline:.75rem;font-size:.6875rem;font-weight:620;display:inline-flex}.personal-agent-picker{position:relative}.personal-agent-trigger{color:#292e36;cursor:pointer;background:#fff;border:1px solid #dadadc;border-radius:.625rem;align-items:center;gap:.45rem;min-height:2.25rem;padding:0 .75rem;font-size:.75rem;font-weight:600;display:inline-flex}.personal-agent-menu{z-index:40;border:1px solid var(--workspace-border);background:#fffffffa;border-radius:.875rem;width:min(21rem,100vw - 2rem);padding:.5rem;position:absolute;top:calc(100% + .5rem);right:0;box-shadow:0 18px 48px #0f172a29}.personal-agent-menu-title,.personal-agent-menu-footer{color:var(--workspace-muted);padding:.5rem .625rem;font-size:.6875rem}.personal-agent-menu-title{color:#23272d;font-weight:650}.personal-agent-menu-footer{border-top:1px solid var(--workspace-border);margin-top:.375rem}.personal-agent-menu>button{width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:.625rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.625rem;padding:.625rem;display:grid}.personal-agent-menu>button:hover,.personal-agent-menu>button.is-selected{background:#eff3fc}.personal-agent-menu>button:disabled{cursor:not-allowed;opacity:.52}.personal-agent-menu strong,.personal-agent-menu small{display:block}.personal-agent-menu strong{font-size:.75rem}.personal-agent-menu small{color:var(--workspace-muted);margin-top:.125rem;font-size:.65rem}.personal-agent-avatar{color:#1e40af;background:#e2e9f9;border-radius:.625rem;flex:none;place-items:center;width:2rem;height:2rem;font-size:.75rem;font-weight:700;display:grid}.personal-agent-online{background:#10b981;border-radius:9999px;width:.4375rem;height:.4375rem}.personal-agent-online.is-offline{background:#94a3b8}.personal-live-badge{color:#33634e;background:#f5fcf8;border:1px solid #d1eddf;border-radius:9999px;align-items:center;gap:.375rem;padding:.35rem .625rem;font-size:.65rem;display:inline-flex}.personal-live-badge>span{background:#10b981;border-radius:9999px;width:.375rem;height:.375rem}.personal-chat-scroll{width:100%;min-height:0;padding:2rem clamp(1rem,5vw,5rem) 1.5rem;overflow-y:auto}.personal-chat-scroll>*{width:min(100%,56rem);margin-inline:auto}.personal-chat-welcome{background:#f1efea;border-radius:1rem;align-items:flex-start;gap:.875rem;margin-top:clamp(4rem,14vh,9rem);padding:1rem 1.125rem;display:flex}.personal-chat-welcome h3,.personal-chat-welcome p{margin:0}.personal-chat-welcome h3{font-size:.875rem;font-weight:650}.personal-chat-welcome p{color:#474f5b;margin-top:.25rem;font-size:.8125rem;line-height:1.55}.personal-manager-quick-actions{border:0;justify-content:center;gap:.625rem;padding:1rem 0;display:flex;overflow-x:auto}.personal-manager-quick-actions button{color:#3c434e;cursor:pointer;background:#ffffffc7;border:1px solid #d7dae1;border-radius:.625rem;flex:none;padding:.625rem .875rem;font-size:.75rem}.personal-manager-quick-actions button:hover{color:#1e40af;border-color:#a3b5dc}.personal-goal-summary{border:1px solid var(--workspace-border);background:#ffffffd1;border-radius:.875rem;overflow:hidden;box-shadow:0 2px 8px #0f172a08}.personal-goal-summary>div{border-bottom:1px solid #ebe8e2;grid-template-columns:7rem minmax(0,1fr);gap:1rem;padding:.8rem 1rem;font-size:.75rem;display:grid}.personal-goal-summary>div:last-child{border-bottom:0}.personal-goal-summary span{color:var(--workspace-muted)}.personal-goal-summary strong{min-width:0;font-weight:560}.personal-goal-summary .is-attention{background:#fffbeb}.personal-goal-summary .is-attention span,.personal-goal-summary .is-attention strong{color:#92400e}.personal-goal-projection{gap:.75rem;display:grid}.personal-projection-author{align-items:center;gap:.75rem;padding:0 .125rem .25rem;display:flex}.personal-projection-author strong,.personal-projection-author small{display:block}.personal-projection-author strong{color:#23272d;font-size:.8125rem;font-weight:660}.personal-projection-author small{color:var(--workspace-muted);margin-top:.15rem;font-size:.65rem}.personal-plan-card{border:1px solid var(--workspace-border);background:#ffffffdb;border-radius:.875rem;overflow:hidden;box-shadow:0 2px 8px #0f172a06}.personal-plan-card>header{border-bottom:1px solid #ebe8e2;justify-content:space-between;align-items:center;gap:1rem;min-height:3.25rem;padding:.75rem 1rem;display:flex}.personal-plan-card>header strong,.personal-plan-card>header small{display:block}.personal-plan-card>header strong{font-size:.75rem;font-weight:660}.personal-plan-card>header small{color:var(--workspace-muted);margin-top:.2rem;font-size:.625rem}.personal-plan-card>header>span{color:#5a5e65;background:#faf9f6;border:1px solid #e0ddd7;border-radius:.5rem;flex:none;padding:.25rem .45rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.65rem}.personal-plan-row{color:#343a43;border-bottom:1px solid #f0eee9;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;min-height:2.625rem;padding:.625rem 1rem;font-size:.75rem;display:grid}.personal-plan-row svg{color:#2563eb}.personal-plan-row.is-done svg{color:#059669}.personal-plan-row.is-done>span{color:#5c626b}.personal-plan-row small{color:var(--workspace-muted);font-size:.625rem}.personal-plan-card>button{color:#545b66;cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;gap:.25rem;width:100%;min-height:2.625rem;font-size:.6875rem;display:flex}.personal-plan-card>button:hover{color:#1e40af;background:#f8f9fc}.personal-plan-card.is-empty>header{border-bottom:0}.personal-plan-card.is-empty>p{color:var(--workspace-muted);margin:-.25rem 0 0;padding:0 1rem 1rem;font-size:.75rem;line-height:1.55}.personal-run-evidence-card{border:1px solid var(--workspace-border);width:100%;min-height:3.75rem;color:inherit;text-align:left;cursor:pointer;background:#ffffffd1;border-radius:.875rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;padding:.75rem 1rem;display:grid}.personal-run-evidence-card:hover{background:#fff;border-color:#c7ccd6}.personal-evidence-icon{color:#059669;background:#ecfdf5;border-radius:.625rem;place-items:center;width:2rem;height:2rem;display:grid}.personal-run-evidence-card strong,.personal-run-evidence-card small{display:block}.personal-run-evidence-card strong{font-size:.75rem;font-weight:650}.personal-run-evidence-card small{max-width:38rem;color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.2rem;font-size:.65rem;overflow:hidden}.personal-run-evidence-card em{color:var(--workspace-muted);white-space:nowrap;font-size:.625rem;font-style:normal}.personal-decision-card{background:#fffaee;border:1px solid #f5c068;border-radius:.875rem;justify-content:space-between;align-items:center;gap:1.5rem;margin-top:1rem;padding:1rem;display:flex}.personal-decision-card span{color:#b45309;text-transform:uppercase;font-size:.6875rem;font-weight:700}.personal-decision-card h3,.personal-decision-card p{margin:0}.personal-decision-card h3{margin-top:.25rem;font-size:.9375rem;font-weight:650}.personal-decision-card p{color:var(--workspace-muted);margin-top:.25rem;font-size:.75rem}.personal-decision-actions{flex:none;gap:.5rem;display:flex}.personal-decision-actions button,.personal-execution-card button,.personal-ops-link{color:#1e40af;cursor:pointer;background:#fff;border:1px solid #bbc9ea;border-radius:.625rem;justify-content:center;align-items:center;min-height:2.25rem;padding:0 .75rem;font-size:.75rem;font-weight:600;text-decoration:none;display:inline-flex}.personal-decision-actions button:last-child{border-color:var(--workspace-accent);color:#fff;background:var(--workspace-accent)}.personal-manager-thread{min-width:0;padding:1.25rem 0 0;overflow:visible}.personal-manager-message{color:#474f5b;background:#f1efea;border-radius:.875rem;width:fit-content;max-width:min(88%,43rem);margin-bottom:1rem;padding:.75rem .875rem;font-size:.8125rem;line-height:1.55}.personal-manager-message.is-user{color:#fff;background:#2563eb;margin-left:auto}.personal-message-author{color:#1e40af;margin-bottom:.25rem;font-size:.6875rem;font-weight:700;display:block}.personal-manager-message p,.personal-manager-message ul{margin:0}.personal-manager-message ul{gap:.375rem;margin-top:.5rem;padding-left:1rem;display:grid}.personal-manager-message small{color:#7d7d85;margin-top:.5rem;font-size:.625rem;display:block}.personal-manager-message.is-user small{color:#dbeafe}.personal-manager-message.is-pending{color:#64748b;background:#f8fafc}.personal-proposal-list{gap:.75rem;width:min(100%,43rem);margin:0 0 1.25rem;display:grid}.personal-proposal-card{background:#f9fbff;border:1px solid #d3dcee;border-radius:.875rem;gap:.625rem;padding:.875rem;display:grid}.personal-proposal-card>header{align-items:center;gap:.5rem;display:flex}.personal-proposal-card>header span{color:#1e40af;background:#dbeafe;border-radius:999px;padding:.125rem .5rem;font-size:.625rem;font-weight:700}.personal-proposal-card>header strong{font-size:.75rem}.personal-proposal-card>header small{color:var(--workspace-muted);margin-left:auto;font-size:.625rem}.personal-proposal-card>p,.personal-proposal-card>small{margin:0}.personal-proposal-card>p{color:#1e293b;font-size:.8125rem;font-weight:600;line-height:1.5}.personal-proposal-card>small,.personal-proposal-status{color:#64748b;font-size:.6875rem;line-height:1.5}.personal-proposal-card>code{color:#475569;background:#f1f5f9;border-radius:.375rem;width:fit-content;padding:.25rem .375rem;font-size:.625rem}.personal-proposal-card.is-approved{background:#f7fefa;border-color:#a7f3d0}.personal-proposal-card.is-stale,.personal-proposal-card.is-error{background:#fffbeb;border-color:#fdba74}.personal-proposal-actions{flex-wrap:wrap;gap:.5rem;display:flex}.personal-proposal-actions button{color:#475569;cursor:pointer;background:#fff;border:1px solid #cbd5e1;border-radius:.625rem;min-height:2.25rem;padding:0 .75rem;font-size:.6875rem;font-weight:650}.personal-proposal-actions button:first-child{border-color:var(--workspace-accent);color:#fff;background:var(--workspace-accent)}.personal-proposal-actions button:disabled{cursor:wait;opacity:.55}.personal-execution-card{border:1px solid var(--workspace-border);background:#fffc;border-radius:.875rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;margin-top:1.25rem;padding:.875rem;display:grid}.personal-execution-card strong,.personal-execution-card p{margin:0}.personal-execution-card strong{font-size:.8125rem}.personal-execution-card p{color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.25rem;font-size:.6875rem;overflow:hidden}.personal-manager-composer{background:#fffffff5;border:1px solid #d5d5d6;border-radius:1rem;grid-template-rows:1fr;grid-template-columns:auto minmax(0,1fr) auto;gap:.5rem;width:min(100% - 2rem,58rem);min-height:4rem;margin:0 auto 1rem;padding:.5rem .625rem;display:grid;position:relative;box-shadow:0 10px 30px #0f172a14}.personal-manager-composer input{color:#23272d;background:0 0;border:0;outline:none;grid-area:1/2;height:2.75rem;padding:0 .25rem}.personal-manager-composer input:focus{box-shadow:none;border:0}.personal-composer-tools{grid-area:1/1;align-self:center;align-items:center;min-width:0;display:flex}.personal-composer-tools button{color:#334155;cursor:pointer;background:#f5f3ef;border:0;border-radius:.75rem;align-items:center;gap:.35rem;width:auto;min-width:0;height:2.5rem;min-height:2.5rem;padding:0 .625rem;font-size:.6875rem;font-weight:620;display:inline-flex}.personal-composer-tools button span{text-overflow:ellipsis;white-space:nowrap;max-width:8rem;display:block;overflow:hidden}.personal-manager-composer .personal-send-button{color:#fff;background:var(--workspace-accent);cursor:pointer;border:0;border-radius:.75rem;grid-area:1/3;align-self:center;place-items:center;width:2.5rem;height:2.5rem;display:grid}.personal-manager-composer .personal-send-button:disabled{cursor:default;opacity:.34}.personal-details-backdrop{z-index:70;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a2e;justify-content:flex-end;display:flex;position:fixed;inset:0}.personal-running-details{background:#fcfbf8;width:min(28rem,100vw);height:100%;padding:1rem;overflow-y:auto;box-shadow:-12px 0 36px #0f172a29}.personal-running-details>header{justify-content:space-between;align-items:center;gap:1rem;padding-bottom:1rem;display:flex}.personal-running-details h2,.personal-running-details header p{margin:0}.personal-running-details h2{font-size:1rem;font-weight:680}.personal-running-details header p{color:var(--workspace-muted);margin-top:.25rem;font-size:.6875rem}.personal-running-details header button{cursor:pointer;background:#f1efea;border:0;border-radius:.625rem;place-items:center;width:2.25rem;height:2.25rem;display:grid}.personal-diagnosis-card{border:1px solid var(--workspace-border);background:#fff;border-radius:.875rem;padding:1rem}.personal-diagnosis-card>span{color:#059669;font-size:.6875rem;font-weight:700}.personal-diagnosis-card h3{margin:.375rem 0 1rem;font-size:.875rem;line-height:1.5}.personal-diagnosis-card dl,.personal-diagnosis-card dd{margin:0}.personal-diagnosis-card dl{gap:.625rem;display:grid}.personal-diagnosis-card dl>div{grid-template-columns:3.5rem minmax(0,1fr);gap:.75rem;font-size:.75rem;display:grid}.personal-diagnosis-card dt{color:var(--workspace-muted)}.personal-running-details details{border-bottom:1px solid var(--workspace-border);padding:1rem .25rem}.personal-running-details summary{cursor:pointer;font-size:.8125rem;font-weight:620}.personal-running-details details p{color:var(--workspace-muted);margin:.75rem 0 0;font-size:.75rem;line-height:1.55}.personal-details-todo-list{gap:.375rem;margin:.75rem 0 0;padding:0;list-style:none;display:grid}.personal-details-todo-list li{color:#484f59;padding-left:1rem;font-size:.71875rem;line-height:1.45;position:relative}.personal-details-todo-list li:before{content:"";background:#2563eb;border-radius:9999px;width:.375rem;height:.375rem;position:absolute;top:.45em;left:0}.personal-details-todo-list li.is-done{color:#7e838b}.personal-details-todo-list li.is-done:before{background:#059669}.personal-ops-link{gap:.375rem;width:100%;margin-top:1rem}.dark .personal-workspace,.dark .personal-chat-pane{color:#f4f4f5;background:#131417}.dark .personal-global-rail,.dark .personal-goal-sidebar,.dark .personal-chat-header,.dark .personal-running-details{color:#f4f4f5;background:#191a1e}.dark .personal-plan-card,.dark .personal-run-evidence-card,.dark .personal-projection-author strong{color:#f4f4f5;background:#1e1f23}.dark .personal-plan-card>header,.dark .personal-plan-row{border-color:#3f3f46}.dark .personal-plan-row,.dark .personal-plan-row.is-done>span{color:#d4d4d8}.dark .personal-decision-card{background:#45290d;border-color:#92400e}@media (width<=1000px){.personal-workspace{grid-template-columns:3.75rem 16.5rem minmax(0,1fr)}.personal-live-badge{display:none}.personal-chat-scroll{padding-inline:1.25rem}}@media (width<=720px){.personal-workspace{grid-template-rows:minmax(0,1fr);grid-template-columns:1fr;height:100dvh;min-height:100dvh;overflow:hidden}.personal-global-rail{display:none}.personal-goal-sidebar{border-right:0;height:100dvh;display:none}.personal-workspace.mobile-goals-visible .personal-goal-sidebar{display:grid}.personal-workspace.mobile-goals-visible .personal-chat-pane{display:none}.personal-chat-pane{height:100dvh;min-height:0}.personal-chat-header{-webkit-backdrop-filter:none;backdrop-filter:none;gap:.5rem;min-height:4.25rem;padding-inline:.75rem}.personal-mobile-goals-button{display:grid}.personal-goal-sidebar>header button,.personal-goal-sidebar>footer button{width:2.75rem;height:2.75rem}.personal-chat-title p,.personal-chat-title>span,.personal-chat-actions>button:first-of-type,.personal-chat-actions>button.personal-progress-trigger span{display:none}.personal-chat-actions>button.personal-progress-trigger{width:2.75rem;padding:0}.personal-chat-back,.personal-mobile-goals-button,.personal-chat-actions>button{width:2.75rem;height:2.75rem}.personal-agent-trigger{min-height:2.75rem;padding-inline:.5rem}.personal-agent-menu-backdrop{z-index:35;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a33;border:0;display:block;position:fixed;inset:0}.personal-agent-menu{z-index:40;border-radius:1rem;width:auto;max-height:calc(100dvh - 1.5rem);position:fixed;inset:auto .75rem .75rem;overflow-y:auto}.personal-agent-menu>button{min-height:3.5rem}.personal-chat-scroll{padding:1rem .75rem}.personal-chat-welcome{margin-top:1rem}.personal-manager-quick-actions{grid-template-columns:repeat(2,minmax(0,1fr));display:grid;overflow:visible}.personal-manager-quick-actions button{white-space:normal;width:100%}.personal-manager-quick-actions button:last-child{grid-column:1/-1}.personal-goal-summary>div{grid-template-columns:5.5rem minmax(0,1fr)}.personal-decision-card{flex-direction:column;align-items:stretch}.personal-run-evidence-card{grid-template-columns:auto minmax(0,1fr) auto}.personal-run-evidence-card em,.personal-plan-row small{display:none}.personal-decision-actions{grid-template-columns:1fr 1fr;display:grid}.personal-decision-actions button,.personal-manager-quick-actions button,.personal-execution-card button,.personal-ops-link,.personal-running-details header button{min-height:2.75rem}.personal-running-details header button{width:2.75rem;height:2.75rem}.personal-execution-card{grid-template-columns:auto minmax(0,1fr) auto}.personal-execution-card .rounded-full{display:none}.personal-execution-card button{grid-column:2/-1;justify-self:start}.personal-manager-composer{margin-bottom:.5rem;position:sticky;bottom:.5rem}.personal-composer-tools button,.personal-send-button{min-width:2.75rem;min-height:2.75rem}}.chat-shell{background:radial-gradient(circle at 48% 0,#ffffffeb,#0000 30rem),#f7f8f6}.chat-goal-map{isolation:isolate;position:relative;overflow:hidden}.chat-goal-map:before{z-index:0;content:"";opacity:.44;background-image:radial-gradient(#94a3b83b .7px,#0000 .7px);background-size:18px 18px;position:absolute;inset:0;-webkit-mask-image:linear-gradient(#0000,#000 18% 84%,#0000);mask-image:linear-gradient(#0000,#000 18% 84%,#0000)}.chat-map-goal:after{content:"";background:#cbd5e1;width:1px;height:3rem;position:absolute;top:100%;left:50%}.chat-map-branches:before{content:"";background:#cbd5e1;height:1px;position:absolute;top:-1.5rem;left:16.666%;right:16.666%}.chat-map-branches>div{position:relative}.chat-map-branches>div:before{content:"";background:#cbd5e1;width:1px;height:1.5rem;position:absolute;bottom:100%;left:50%}.chat-map-branches:after{content:"";background:#cbd5e1;width:1px;height:2.5rem;position:absolute;top:100%;left:50%}@media (width<=767px){.chat-map-goal:after,.chat-map-branches:before,.chat-map-branches:after,.chat-map-branches>div:before{display:none}}@property --tw-border-spacing-x{syntax:"";inherits:false;initial-value:0}@property --tw-border-spacing-y{syntax:"";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/loopx/web/chat/assets/index-C7Z2HfR1.js b/loopx/web/chat/assets/index-ByC0P3wo.js similarity index 77% rename from loopx/web/chat/assets/index-C7Z2HfR1.js rename to loopx/web/chat/assets/index-ByC0P3wo.js index e169cb9b55..b3d5af21b0 100644 --- a/loopx/web/chat/assets/index-C7Z2HfR1.js +++ b/loopx/web/chat/assets/index-ByC0P3wo.js @@ -25,7 +25,7 @@ Notification: Only notify me when needed`,"composer.heartbeatTemplateWithoutGoal Goal: Frequency: Daily Stop condition: Goal completes -Notification: Only notify me when needed`,"composer.nextAction":`Ask what’s next`,"composer.nextActionPrompt":`What should I do next?`,"composer.prepareDraft":`Insert a draft and review before sending`,"composer.send":`Send`,"composer.sendMessage":`Send a message to LoopX`,"composer.sendMessageHint":`Send message`,"composer.sentImageAlt":`Remove image {name}`,"conversation.agentPending":`Working…`,"conversation.close":`Close conversation receipt`,"conversation.convertHint":`Turn the Agent’s latest reply into a Task draft`,"conversation.full":`View full conversation`,"conversation.receipt":`Conversation receipt`,"conversation.replying":`Replying`,"conversation.title":`Manager conversation`,"conversation.toTask":`Convert to Task`,"digest.away":`Runs since your previous visit`,"digest.completed":`new completions`,"digest.failed":`new failed/interrupted runs`,"digest.needsYou":`currently need confirmation`,"feedback.applying":`Running: {title}`,"feedback.cancelFailed":`Cancel failed: {error}`,"feedback.completed":`Completed: {title}`,"feedback.executionFailed":`Execution failed: {error}`,"feedback.gateRequired":`Your confirmation is required: {summary}`,"feedback.notCompleted":`Not completed: {status}`,"feedback.goalRefreshFailed":`The Goal opened, but its latest state could not be refreshed. Use Refresh to try again.`,"feedback.preparingPreview":`Preparing confirmation preview: {title}`,"feedback.previewFailed":`Could not prepare the confirmation preview: {error}`,"feedback.sendFailed":`Send failed: {error}`,"feedback.sendGenericError":`Could not send the message. Try again later.`,"feedback.stale":`State changed, so nothing was applied. Generate a new confirmation preview.`,"feedback.taskDraftCreated":`Created a Task draft from the reply. Edit and send it to review the confirmation preview.`,"goal.defaultTitle":`New personal Goal`,"goal.initialTodo":`Work toward the completion criteria: {criteria}`,"goal.objectiveBoundary":`Execution boundary: {boundary}`,"goal.objectiveCompletion":`Completion criteria: {criteria}`,"drawer.advancedDiagnostics":`Advanced diagnostics`,"drawer.agentWorking":`Agent is continuing; the record updates automatically.`,"drawer.analysis":`Analyzing`,"drawer.apply":`Confirm and apply`,"drawer.applying":`Applying…`,"drawer.attentionBlocking":`Blocking an Agent`,"drawer.attentionWaiting":`Waiting for your decision`,"drawer.autoNotify":`Human-gate auto notifications`,"drawer.branch":`Branch`,"drawer.closeDetail":`Close details and return to {context}`,"drawer.connected":`Connected`,"drawer.correctionDescription":`The message keeps the current Goal, Todo, and Agent Session context.`,"drawer.correctionLabel":`Guide {agent}`,"drawer.correctionPlaceholder":`For example: focus on permission risks first and do not commit yet…`,"drawer.correctionSend":`Send guidance`,"drawer.correctionTextarea":`Enter guidance for Goal {goal}, Agent {agent}, Run {run}`,"drawer.copyRepository":`Copy repository identity`,"drawer.copyRepositoryDone":`Repository identity copied`,"drawer.copyRepositoryError":`Copy failed. Check browser clipboard permission.`,"drawer.copyRepositorySuccess":`Copied. You can paste it into another tool.`,"drawer.cost":`Cost 24h / 7d`,"drawer.costShort":`Cost`,"drawer.durationShort":`Duration`,"drawer.period24h":`24h`,"drawer.period7d":`7d`,"drawer.tokens":`Tokens 24h / 7d`,"drawer.tokensShort":`tokens`,"drawer.usageNotMeasured":`Not measured`,"drawer.currentGoal":`Current Goal`,"attentionDetail.title":`Request details`,"attentionDetail.request":`What is requested`,"attentionDetail.decision":`Decision requested`,"attentionDetail.unknownRequest":`Not specified; review the source before deciding`,"attentionDetail.open":`Open in current projection`,"attentionDetail.closed":`Closed`,"attentionDetail.deferred":`Deferred`,"attentionDetail.superseded":`Replaced`,"attentionDetail.unknown":`Status not provided`,"attentionDetail.unavailable":`The source has not confirmed this item; refresh before acting`,"attentionDetail.unknownReason":`The source has not provided a reason.`,"attentionDetail.targetTodo":`Linked Todo to unblock`,"attentionDetail.targetAgent":`Agent named by the request`,"attentionDetail.scope":`Declared decision scope`,"attentionDetail.notProvided":`Not provided`,"attentionDetail.replacement":`Replacement Todo`,"attentionDetail.openReplacement":`Open replacement`,"attentionDetail.boundary":`Reading this detail does not resolve a gate or grant authority. Available decisions require a fresh preview.`,"drawer.decisionDefaultEvidence":`No additional public-safe evidence is attached. The next step will still show a Preview first.`,"drawer.decisionDefaultReason":`This decision affects the next step of the current Todo.`,"drawer.decisionDefer":`Decide later`,"drawer.decisionMore":`More decisions`,"drawer.decisionReject":`Reject`,"drawer.decisionReview":`Review impact and decide`,"drawer.dependencies":`Dependencies`,"drawer.detailsAndActions":`Details & actions`,"drawer.duration":`Duration 24h / 7d`,"drawer.evidence":`Evidence`,"drawer.executionHistory":`Execution history`,"drawer.executionRecord":`Run record`,"drawer.executionRecordAndResult":`Execution & result`,"drawer.explainDecision":`Explain this decision`,"drawer.gateApproveHint":`Run one command in the terminal to complete approval:`,"drawer.gateRejectHint":`Replace approve with reject at the end to decline. This notice disappears after the command runs.`,"drawer.gateRequiresHost":`Host confirmation required`,"drawer.gateRequiresHostDescription":`This page cannot approve this protected permission change. Nothing was written by your click.`,"drawer.goalAutoRun":`Automatic runs for this Goal`,"drawer.goalChanges":`Pending changes for this Goal`,"drawer.goalDetails":`Goal details`,"drawer.group":`Group`,"drawer.inspectorFull":`Switch to full screen`,"drawer.inspectorFullView":`Full-screen view`,"drawer.inspectorHalf":`Switch to half screen`,"drawer.inspectorHalfView":`Half-screen view`,"drawer.lastNotification":`Latest notification`,"drawer.larkConfigure":`Configure Lark connection`,"drawer.larkConnect":`Connect Lark App`,"drawer.larkConnection":`Lark connection`,"drawer.larkNotConfigured":`Not configured`,"drawer.larkNotConfiguredDescription":`After setup, LoopX sends a Feishu notification when this Goal needs your confirmation.`,"drawer.managerChanges":`Pending Manager changes`,"drawer.moreActions":`More actions`,"drawer.moreRunActions":`More run actions`,"drawer.nextTransition":`Next transition`,"drawer.noExecutionHistory":`No execution history yet.`,"drawer.noRun":`Execution Session has not started`,"drawer.noRunDescription":`Run records will appear here after an Agent starts execution.`,"drawer.notAssigned":`Unassigned`,"drawer.notLinked":`Not linked`,"drawer.notSet":`Not set`,"drawer.outputDetails":`Output details`,"drawer.outputRecorded":`This output is recorded on the current Goal.`,"drawer.outputSafePreview":`Public-safe output preview`,"drawer.outputRun":`Run`,"drawer.outputTodo":`Todo`,"drawer.outputs":`Outputs from this run`,"drawer.previewUnavailable":`No public-safe inline preview is available for this output.`,"drawer.priority":`Priority`,"drawer.progress":`Progress`,"drawer.proposalApplied":`Applied. LoopX state will refresh.`,"drawer.proposalApplyFailed":`Apply failed. No changes were written.`,"drawer.proposalApplyFailedHint":`Refresh the Goal state and regenerate. If it still fails, keep this page open and inspect advanced diagnostics.`,"drawer.proposalClose":`Close`,"drawer.proposalDefer":`Later`,"drawer.proposalDeferred":`Deferred. You can apply it later or regenerate it.`,"drawer.proposalEnterGoal":`Open new Goal`,"drawer.proposalExplainer":`After confirmation, LoopX applies this change and shows the write result. Closing or canceling changes nothing.`,"drawer.proposalRecheck":`Recheck against latest state`,"drawer.proposalRegenerate":`Retry with latest state`,"drawer.proposalRejected":`Rejected. This change will not be written.`,"drawer.proposalStale":`Source state changed. Recheck against the latest state.`,"drawer.proposalViewGoal":`View updated Goal`,"drawer.reassign":`Reassign to`,"drawer.reassignSummary":`Reassign: {task}`,"drawer.reason":`Reason`,"drawer.recoveryDescription":`Local history is preserved. Choose a recovery path.`,"drawer.recoveryFailed":`Upstream Session recovery failed`,"drawer.recoveryNewSession":`Start a new Session with context`,"drawer.recoveryRetry":`Retry recovery`,"drawer.repositoryRole":`Execution workspace`,"drawer.repository":`Repository`,"drawer.replyMode":`Reply mode`,"drawer.subagentApplied":`Applied and verified against the shared Goal state.`,"drawer.subagentAppliedRefreshFailed":`Applied and verified. The status view could not refresh; retry the page refresh later.`,"drawer.subagentApplying":`Applying and verifying shared-state readback…`,"drawer.subagentApplyFailed":`Could not apply the sub-agent setting.`,"drawer.subagentChildLimit":`Current limit`,"drawer.subagentConfirmDisable":`Confirm turning off sub-agent execution`,"drawer.subagentConfirmEnable":`Confirm turning on sub-agent execution`,"drawer.subagentCurrentBoundary":`Current task-domain restriction`,"drawer.subagentDescription":`Allows the runtime to create temporary child agents for independent tasks only after Todo, quota, capability, and write-scope gates pass. It does not force parallel work or grant durable authority.`,"drawer.subagentDisable":`Preview turning off sub-agent execution`,"drawer.subagentDisableSummary":`New child-agent execution will be disabled for this Goal. Existing Todo ownership and execution records stay unchanged.`,"drawer.subagentDomainInvalid":`The selected task-domain restriction is invalid.`,"drawer.subagentDomainTodoCount":`{count} matching open Todos`,"drawer.subagentDomains":`Task-domain restriction (optional)`,"drawer.subagentDomainsEmpty":`No open advancement Todo declares task_domain. Leave this empty to keep child execution unrestricted by task domain.`,"drawer.subagentDomainsHint":`Leave every option clear to apply no task-domain filter. Selecting domains admits only matching typed Todos; all other execution gates still apply.`,"drawer.subagentDomainsUnrestricted":`No task-domain restriction`,"drawer.subagentEnable":`Preview turning on sub-agent execution`,"drawer.subagentLabel":`Per-Goal execution boundary`,"drawer.subagentModel":`Child model`,"drawer.subagentEffort":`Child reasoning effort`,"drawer.subagentModelDefault":`Host default`,"drawer.subagentLunaPreset":`Use Luna / max`,"drawer.subagentClearModel":`Clear model preference`,"drawer.subagentModelHint":`Use Preview configuration update to save this preference. It can be saved while execution is off; host support is checked at launch.`,"drawer.subagentModelRequired":`Choose a child model before setting reasoning effort.`,"drawer.subagentMaxChildren":`Maximum child agents`,"drawer.subagentNoChange":`The current Goal already matches this setting; nothing was written.`,"drawer.subagentPending":`Pending confirmation`,"drawer.subagentPreviewBoundary":`Preview configuration update`,"drawer.subagentPreviewFailed":`Could not create the sub-agent setting preview.`,"drawer.subagentPreviewing":`Checking the latest Goal state…`,"drawer.subagentPreviewReady":`Preview locked. Confirm to apply this Goal setting.`,"drawer.subagentPreviewSummary":`Allow up to {count} child agents. Task-domain restriction: {domains}.`,"drawer.subagentRemoteReadOnly":`This source is read only. Open the Goal on its host to change the setting.`,"drawer.subagentTitle":`Adaptive sub-agent execution`,"drawer.remoteDetailsDescription":`SSH sources expose public-safe status only and do not read connection settings from the source host.`,"drawer.remoteDetailsUnavailable":`Remote details are not projected`,"drawer.resumeNo":`No`,"drawer.resumeYes":`Yes`,"drawer.runDetails":`Execution Session`,"drawer.runInterrupt":`Interrupt this run`,"drawer.runLatest":`View latest execution`,"drawer.runNewSession":`Start new Session`,"drawer.runCloseSession":`Close Session`,"drawer.runRecordEmpty":`No run record yet. The Agent has not started this execution. Check waiting conditions or resume the Session under Details & actions.`,"drawer.runRecordProjected":`No step-by-step record is available. LoopX read {completed}/{total} projected steps{outputs}; inspect the Session under Details & actions.`,"drawer.runRecordProjectedOutputs":` and {count} outputs`,"drawer.runRoleAssistant":`Completed`,"drawer.runRoleSystem":`Needs review`,"drawer.runRoleUser":`Task received`,"drawer.runView":`Session views`,"drawer.scheduleAdd":`Add scheduled check`,"drawer.scheduleDefaultNotification":`Notify only when you are needed`,"drawer.scheduleDefaultStop":`Goal completes or owner stops it`,"drawer.scheduleDefaultTarget":`Wake according to this Goal’s LoopX schedule.`,"drawer.scheduleEdit":`Change to every 2 hours`,"drawer.scheduleLast":`Last run`,"drawer.scheduleLocalTimezone":`Local timezone`,"drawer.scheduleNext":`Next run`,"drawer.scheduleNeverRun":`Not run yet`,"drawer.scheduleNotification":`Notification`,"drawer.schedulePause":`Pause`,"drawer.schedulePending":`Waiting for schedule`,"drawer.scheduleResume":`Resume`,"drawer.scheduleRunNow":`Run now`,"drawer.scheduleStop":`Stop {kind}`,"drawer.scheduleStopCondition":`Stop condition`,"drawer.scheduleTimezone":`Timezone`,"drawer.sessionRecoverable":`Resumable`,"drawer.sessionStatus":`Session status`,"drawer.setupHeartbeat":`Set up Heartbeat`,"drawer.taskActions":`Pending Todo actions`,"drawer.taskAdvancement":`Advancement task`,"drawer.taskBlock":`Mark blocked`,"drawer.taskComplete":`Mark complete`,"drawer.taskCompletedNote":`This task is retained as a read-only record.`,"drawer.taskCompletedTitle":`Task completed`,"drawer.taskDefer":`Defer`,"drawer.taskDeferCondition":`Todo defer resume condition`,"drawer.taskDeferInvalid":`Unsupported condition format; use one of the deterministic conditions below.`,"drawer.taskDeferPlaceholder":`For example, resume_at:2026-09-14T09:00:00+08:00`,"drawer.taskDeferReview":`Review defer`,"drawer.taskDeferSupported":`Supports todo_done, pr_merged, capacity_available, and timezone-aware resume_at conditions.`,"drawer.taskDeferUntil":`Defer until`,"drawer.taskDetails":`Todo details`,"drawer.taskInfo":`Task information`,"drawer.taskManage":`Manage task`,"drawer.taskNextCompleted":`Create a follow-up task`,"drawer.taskNextOpen":`Advance or update status`,"drawer.taskOrdinary":`Task`,"drawer.taskStatusBlocked":`Blocked`,"drawer.taskStatusDeferred":`Deferred`,"drawer.resumeWhen":`Resume condition`,"drawer.resumeState":`Resume state`,"drawer.resumePending":`Waiting for condition`,"drawer.resumeReady":`Ready to resume`,"drawer.resumeReceipt":`Resume receipt`,"drawer.taskNextDeferred":`Wait for the resume condition, then reassess`,"drawer.taskNextResumeReady":`Resume condition met; awaiting lifecycle replan`,"drawer.taskStatusCompleted":`Completed`,"drawer.taskStatusOpen":`Ready`,"drawer.taskSuccessor":`Create follow-up Todo`,"drawer.taskSuccessorNote":`Owner marked this blocked while waiting for more context.`,"drawer.taskSuccessorSummary":`Create follow-up Todo: {task}`,"drawer.taskSuccessorText":`Follow-up work for {task}`,"drawer.taskType":`Task type`,"drawer.topic":`Topic`,"drawer.trigger":`Trigger`,"drawer.titleAttention":`Needs you`,"drawer.titleOutput":`Output details`,"drawer.titleProposalApplied":`Execution result`,"drawer.titleProposalConfirm":`Confirm execution`,"drawer.titleSchedule":`Scheduled check`,"drawer.unconfigured":`Not configured`,"drawer.workspaceCandidates":`Available workspaces`,"files.emptySummary":`Public-safe output`,"files.empty":`No files, outputs, or verified reports yet.`,"files.loadingReports":`Loading verified milestone reports…`,"files.reportDelta":`+{added} added · {changed} changed`,"files.reportAdded":`added`,"files.reportChanged":`changed`,"files.reportGeneration":`Generation`,"files.reportLoadFailed":`Could not load verified reports`,"files.reportPublication":`Publication`,"files.title":`Files & Outputs`,"files.verifiedReport":`Verified milestone report`,"header.agentUnavailable":`Unavailable`,"header.chatRuntime":`Chat`,"header.workAgentCount":`{count} work Agents`,"header.chat":`Chat`,"header.files":`Files`,"header.goalCapabilities":`Capability settings`,"header.goalCapabilitiesDescription":`Manage overrides and inherited machine defaults.`,"header.goalDetails":`Goal details`,"header.goalDetailsDescription":`Review status, usage, repository, notifications, and sessions.`,"header.goalSettings":`Goal settings`,"header.goalSettingsDescription":`Open Goal details or capability settings`,"header.goalNavigation":`Goal navigation`,"header.goalView":`Goal view`,"header.live":`Live`,"header.manager":`LoopX Manager`,"header.managerDescription":`Your personal workspace across Goals`,"header.managerRuntime":`{profile} · {sandbox}`,"header.managerRuntimeFallback":`Configuration invalid; fell back to {profile} · {sandbox}. Repair it in Machine capabilities.`,"header.managerOverview":`Overview`,"header.managerView":`Manager view`,"header.openGoalNavigation":`Open Goal navigation`,"header.readOnlySourceDescription":`{source} is displayed read-only through an SSH tunnel`,"header.refresh":`Refresh status`,"header.refreshDone":`Updated just now`,"header.refreshFailed":`Refresh failed`,"header.refreshing":`Refreshing`,"header.selectAgent":`Select Agent`,"header.selectChatRuntime":`Select chat runtime`,"header.tasks":`Tasks`,"header.themeBrutal":`Switch to brutal theme`,"header.themePaper":`Switch to default theme`,"home.blockingSummary":`{count} are blocking an Agent.`,"home.completedGoals":`Completed Goals`,"home.empty":`Nothing here`,"startup.goalLoading":`Loading status…`,"startup.goalError":`Could not load status`,"startup.progress":`{loaded} of {total} active Goals loaded`,"startup.partial":`Goal states are updating. Counts are incomplete.`,"startup.independent":`Other Goals remain available while this Goal loads.`,"startup.error.timeout":`The request timed out. Retry when the local service is ready.`,"startup.error.network":`The connection was interrupted. Retry to reconnect.`,"startup.error.service":`The Goal status could not be read. Retry later; if the problem continues, check the status source.`,"startup.error.access":`The status source cannot access files or runtime directories required for this Goal. Check the permissions of the account running that source, then retry.`,"startup.error.revision":`The Goal directory changed during loading. Refresh to synchronize.`,"startup.error.scope":`This Goal is no longer available in the selected source. Refresh the directory.`,"startup.error.invalid":`The status response could not be read. Refresh or check for a LoopX update.`,"startup.retry":`Retry`,"startup.retryFailed":`Retry failed Goals`,"startup.failedCount":`{count} Goals could not be loaded. Ready Goals remain available.`,"home.greeting":`Hi, I’m your LoopX Manager`,"home.history":`History`,"home.lane.needsYou":`Needs you`,"home.lane.needsYouDescription":`Waiting for your decision, authorization, or context`,"home.lane.observing":`Observing`,"home.lane.observingDescription":`Monitoring continuously and notifying you when something changes`,"home.lane.running":`Running`,"home.lane.runningDescription":`Agents are making progress and reporting back`,"home.lane.scheduled":`Scheduled`,"home.lane.scheduledDescription":`Queued until its time or prerequisite arrives`,"home.noActivity":`No activity yet`,"home.noFirstActivity":`Waiting for first activity`,"home.noCompletedGoals":`No completed Goals yet`,"home.preservedState":`State is preserved and can be resumed`,"home.stopped":`Stopped`,"home.systemHealth":`System health: {summary}`,"home.taskCount":`{count} Tasks`,"home.todayAt":`Today {time}`,"home.waitingCount":`You have {count} items to handle.`,"home.workspace":`Goal workspace`,"lark.allMessages":`All messages in this topic`,"lark.allTopicMessages":`All topic messages`,"lark.agentIngress":`Agent ingress`,"lark.agentAppPermissions":`Every selected Agent needs a Lark App that is ready for group mentions and replies.`,"lark.agentApps":`Lark App per Agent`,"lark.agentAppsDescription":`The default App is preselected. Assign a different compatible App when an Agent needs its own bot identity.`,"lark.agentAppSelection":`Lark App for {agent}`,"lark.appCreated":`App created`,"lark.appCreateFailed":`Creation failed`,"lark.appLoading":`Loading available Lark Apps…`,"lark.appPermissions":`This App can send connection messages, but lacks the bot permissions required to receive group mentions or reply automatically. Enable im:message.group_at_msg:readonly, im:message.send_as_bot, and the im.message.receive_v1 event, publish a new version, then refresh.`,"lark.appProfile":`Lark App`,"lark.apps":`Lark Apps`,"lark.autoReplyUnavailable":`Auto reply unavailable`,"lark.autoReplyReady":`Auto reply ready`,"lark.bindGoal":`Bind to Goal`,"lark.cancel":`Cancel`,"lark.cardinality":`One Lark App · many Goals · one isolated route per Agent`,"lark.capture":`Capture`,"lark.captureAddressed":`Only messages that mention or reply to the App`,"lark.captureAll":`All messages in this Goal topic`,"lark.captureScope":`Capture scope`,"lark.captureScopeDescription":`Controls which Topic messages enter LoopX without expanding Agent permissions.`,"lark.closeConnection":`Close connection dialog`,"lark.closeCreate":`Close create dialog`,"lark.closeSettings":`Close Lark settings`,"lark.connect":`Connect`,"lark.connectAllAgents":`Connect every registered Agent`,"lark.connectAllAgentsAction":`Connect {count} Agents`,"lark.connectAllAgentsDescription":`Create {count} isolated Agent Topics in one guided action. Send requests inside the matching Topic; each Agent keeps its own route and inbox.`,"lark.connectApp":`Connect Lark App`,"lark.connection":`Connection`,"lark.connections":`Connections`,"lark.configuration":`Lark configuration`,"lark.continueFeishu":`Continue in Feishu`,"lark.createAutomatically":`Create Goal topic automatically`,"lark.createAutomaticallyDescription":`A dedicated, Agent-labelled Topic will be created for every selected Agent.`,"lark.defaultAgentAppDescription":`Used to find the target group and as the default for every selected Agent. Per-Agent choices below override it.`,"lark.description":`Manage reusable Lark Apps and connect group chats to Goals through dedicated topics.`,"lark.editConnection":`Edit Lark Connection`,"lark.goalConnections":`{count} Goal connections`,"lark.goalTopicConnections":`Lark Goal Topic connections`,"lark.groupChat":`Group chat`,"lark.groupEmpty":`This bot has not joined a group that can be connected. Add it to a Feishu group first, then return to refresh or search.`,"lark.groupLoading":`Reading groups joined by this bot…`,"lark.groupSearch":`Search groups joined by this bot`,"lark.historyPermission":`Group-history permission (separate capability)`,"lark.health.eventProcessed":`{events} events processed, {replies} replies sent.`,"lark.health.eventUnverified":`Event subscription needs verification`,"lark.health.eventUnverifiedDetail":`The provider listener is ready, but no event has arrived. Enable im.message.receive_v1 and group mention permissions, publish a new version, then send a new @ mention inside this Agent Topic. Group-level messages fail closed when multiple Agent routes exist.`,"lark.health.ignoredSelf":`The bot’s own message was ignored to prevent duplicate replies.`,"lark.health.invalidRouting":`Invalid routing configuration`,"lark.health.invalidRoutingDetail":`The connection was safely disabled. Select a processing mode again and save.`,"lark.health.lastStatus":`Latest event status: {status}`,"lark.health.listening":`Listening`,"lark.health.messageContextPermission":`Message permission required`,"lark.health.messageContextPermissionDetail":`A message event arrived, but group context could not be read. Publish and authorize group message read access for this App.`,"lark.health.notAddressed":`Latest message did not directly @ the bot`,"lark.health.notAddressedDetail":`Listening is healthy. This connection only responds to direct @ mentions or replies to the bot.`,"lark.health.notStarted":`Listener not started`,"lark.health.notStartedDetail":`Refresh the connection or restart LoopX, then try again.`,"lark.health.processingFailed":`Message processing failed`,"lark.health.processingFailedDetail":`The message event arrived, but Agent processing failed. Review local diagnostics and retry.`,"lark.health.queued":`Queued in the Agent inbox`,"lark.health.queuedDetail":`The message will be processed asynchronously by {agent} without starting a general Chat Session.`,"lark.health.sourceDisconnected":`Event connection disconnected`,"lark.health.sourceDisconnectedDetail":`The event consumer exited unexpectedly. Check that the app profile uses Feishu for Feishu apps or Lark for international Lark, then inspect connection and subscription errors. LoopX is retrying; successful history queries do not prove live delivery.`,"lark.health.retrying":`Retrying listener`,"lark.health.retryingDetail":`Event listening was interrupted and LoopX is retrying automatically.`,"lark.health.routeAmbiguous":`Message matches multiple Goals`,"lark.health.routeAmbiguousDetail":`The same bot and group have multiple full-group capture connections. Use a separate bot for each Agent or keep only one full-group connection.`,"lark.health.routeMismatch":`Message did not match this Goal Topic`,"lark.health.routeMismatchDetail":`The event came from another group or Topic. Reconnect this Goal to the correct group, then send a new @ mention.`,"lark.health.routeUnavailable":`Message cannot be routed to the Goal`,"lark.health.routeUnavailableDetail":`Connection data is incomplete. Reconnect this Goal, then send a new @ mention.`,"lark.health.starting":`Starting`,"lark.health.startingDetail":`LoopX is starting message event listening for this App.`,"lark.health.unavailable":`Auto reply unavailable`,"lark.health.waiting":`Waiting`,"lark.incomingMessages":`Incoming messages`,"lark.ingressAsync":`Async inbox`,"lark.ingressAsyncDescription":`Write to the Agent private inbox for a later explicit drain.`,"lark.editPreservesIdentity":`Saving preserves this App, group and Topic. Old connections upgrade to the Agent inbox by default.`,"lark.conversationKind":`Connection purpose`,"lark.managerConversation":`Manager · live conversation`,"lark.workerConversation":`Worker Agent · background tasks`,"lark.managerConversationDescription":`The built-in manager responds as you chat and delegates long-running work to background Agents. Group and private conversations keep separate histories.`,"lark.ingressLegacy":`Upgrade available`,"lark.ingressLegacyDescription":`Save this connection to upgrade to the Agent inbox. Existing messages remain in the same Topic.`,"lark.ingressQueue":`Queuing`,"lark.ingressQueueDescription":`Enter the same Agent Session's bounded FIFO queue and run after the current Turn.`,"lark.ingressSteering":`Steering`,"lark.ingressSteeringDescription":`Deliver to the active Turn and reject safely when no exact active Turn exists.`,"lark.loading":`Loading Lark configuration…`,"lark.management":`Lark management`,"lark.openEventSettings":`Open Feishu event settings`,"lark.mentions":`Mentions`,"lark.mentionsOnly":`Mentions only`,"lark.needsMessagePermissions":`Needs message permissions`,"lark.needsSetup":`Needs setup`,"lark.newApp":`New Lark App`,"lark.noAgentConfigured":`No Agent configured`,"lark.noConnections":`No matching connections.`,"lark.noProfiles":`No lark-cli App profiles are available yet.`,"lark.profileName":`Profile name`,"lark.profileValidation":`Profile can contain only letters, numbers, periods, underscores, and hyphens.`,"lark.processing":`Processing`,"lark.region":`Region`,"lark.registerAnother":`+ Register another Lark App — Create through Feishu`,"lark.reopenFeishu":`Reopen Feishu`,"lark.settingsConfigure":`Configure {goal}`,"lark.settingsDisconnect":`Disconnect {goal}`,"lark.replyMode":`Reply mode`,"lark.replyModeDescription":`Replies are limited to the source Topic to prevent cross-group or cross-Goal delivery.`,"lark.reusableApps":`{count} reusable Apps`,"lark.reusableWorkspaceApp":`Reusable workspace App`,"lark.routesUnverified":`{count} Lark routes pending verification`,"lark.saveConnection":`Save connection`,"lark.searchConnections":`Search Lark connections`,"lark.searchPlaceholder":`Search Apps, groups, Goals, or topics`,"lark.setupCopy":`LoopX opens the official Feishu creation page through lark-cli. App credentials stay in the system Keychain; LoopX stores only the profile reference.`,"lark.someoneMentions":`Someone mentions the Agent`,"lark.targetAgent":`Target Agent`,"lark.targetAgentDescription":`Choose a registered Agent in this Goal. This connection delivers to one Agent; it does not broadcast or grant permissions. Steering and Queuing require that Agent's exact active Session.`,"lark.agentUnavailable":`{agent} · no longer available`,"lark.selectRegisteredAgent":`Select an available registered Agent before connecting. The previous Agent will not be replaced automatically.`,"lark.topicPreview":`Topic preview`,"lark.topicReply":`Topic reply`,"lark.trigger":`Trigger`,"lark.waitingFeishu":`Waiting for Feishu`,"lark.waitingFeishuDescription":`Complete Feishu authorization in the new window. This page updates automatically when it is ready.`,"lark.waitingLink":`Generating the official Feishu creation link…`,"lark.error.appCreate":`Lark App creation failed`,"lark.error.appRequired":`Select a Lark App profile.`,"lark.error.bind":`Connection failed`,"lark.error.bindPreview":`Connection preview failed`,"lark.error.configuration":`Could not load Lark configuration`,"lark.error.groupLookup":`Could not read groups joined by this bot. Check the bot status and try again.`,"lark.error.groupLoad":`Could not load group chats`,"lark.error.invalidApp":`The Lark App profile is unavailable or has not completed authorization.`,"lark.error.messagePermissions":`This App lacks the bot permissions required for automatic replies. Enable im:message.group_at_msg:readonly and im:message:send_as_bot, publish a new version, then refresh.`,"lark.error.provider":`The Feishu API call failed without a verified receipt. Try again later.`,"lark.error.setupPoll":`Could not read creation status`,"lark.error.setupStart":`Could not start Lark App creation`,"lark.error.cliExecutable":`The configured lark-cli was found but cannot run. Check the installation or launch arguments.`,"lark.error.cliMissing":`lark-cli was not found. Install lark-cli and restart LoopX.`,"lark.error.cliStart":`lark-cli failed to start. Check the installation and restart LoopX.`,"lark.error.disconnect":`Disconnect failed`,"notifications.autoNotify":`Send automatically when your confirmation is required`,"notifications.bind":`Bind notification group`,"notifications.bindConfirm":`Bind “{goal}” to “{target}”. LoopX will verify that the bot is in the group and send a confirmation message.`,"notifications.bindFailed":`Binding failed`,"notifications.bound":`Bound`,"notifications.confirmBind":`Confirm binding`,"notifications.description":`Send Goal changes that need your confirmation to a Feishu group. Bindings and automatic delivery use the existing channel.`,"notifications.disabled":`Disabled`,"notifications.group":`Notification group: {target}`,"notifications.loadFailed":`Could not load notification groups`,"notifications.noTargets":`No notification groups are available. Group delivery uses a private bot identity; configure one from the terminal first:`,"notifications.notBound":`Not bound`,"notifications.recent":`Latest {time}`,"notifications.sentCount":`{count} sent`,"notifications.settings":`Goal notification bindings`,"notifications.setupFailed":`Could not update settings`,"notifications.title":`Feishu group notifications`,"proposal.field.agentId":`Agent`,"proposal.field.cadence":`Frequency`,"proposal.field.completionCriteria":`Completion criteria`,"proposal.field.executionBoundary":`Execution boundary`,"proposal.field.goalId":`Goal ID`,"proposal.field.heartbeat":`Heartbeat`,"proposal.field.initialTodos":`Initial tasks`,"proposal.field.objective":`Objective`,"proposal.field.operation":`Operation`,"proposal.field.operationState":`Operation state`,"proposal.field.resultDelivery":`Result delivery`,"proposal.field.confirmationBoundary":`Confirmation boundary`,"proposal.field.expiresAt":`Expires at`,"proposal.field.permission":`Permission`,"proposal.field.reason":`Reason`,"proposal.field.stopCondition":`Stop condition`,"proposal.field.target":`Check target`,"proposal.field.timezone":`Timezone`,"proposal.field.title":`Title`,"proposal.field.workspace":`Execution workspace`,"actionReview.targetChanged":`The preview target does not match the requested Goal and operation. Generate a new preview.`,"actionReview.ready_stop":`Pausing is reversible. This validated preview can apply directly; completion still requires verified readback.`,"actionReview.resume_review":`Review before restoring automatic scheduling. Quota, gates and Todo constraints still apply.`,"actionReview.delete_review":`Review removal of this stopped Goal from the registries. Project files and history are preserved.`,"actionReview.action_review":`Review the target and impact before applying this proposal.`,"actionReview.protected_action":`This action needs explicit review. Confirmation cannot replace required authority.`,"actionReview.unknown_permission":`The permission classification is not recognized. Recheck the proposal before continuing.`,"actionReview.unknown_action":`This lifecycle operation is not recognized. Recheck the proposal before continuing.`,"actionReview.incomplete_proposal":`The preview is missing validation or an available apply transition. Generate a new preview.`,"actionReview.authority_gate":`A gate prevents execution. Resolve its requirements, then recheck the proposal.`,"actionReview.stale_proposal":`The source state changed. Generate a new preview; the previous decision no longer applies.`,"actionReview.apply_pending":`Execution is in progress. Wait for its result before retrying.`,"actionReview.readback_verified":`The action completed and its resulting state was verified.`,"actionReview.readback_unverified":`The action returned without verified readback. Completion is not confirmed; recheck the state.`,"actionReview.operation_group_confirmation":`This exact request can only be confirmed on its original card in the bound Feishu group. The Dashboard does not expose a local execution control.`,"actionReview.operation_result_delivery_pending":`The operation outcome was recorded, but the original group result card has not passed readback verification yet.`,"actionReview.apply_failed":`Execution did not complete. Check the failure and regenerate the preview before retrying.`,"actionReview.inactive_proposal":`This proposal is no longer ready to execute. Recheck it before continuing.`,"proposal.gate.default":`Host confirmation required`,"proposal.impact.default":`After confirmation, the canonical LoopX service will write the state change.`,"proposal.impact.goalCreate":`After confirmation, LoopX will create the Goal and its initial Todo, then let the selected Agent start the first run.`,"proposal.impact.lifecycleDelete":`After confirmation, this stopped Goal is removed from the source and global registries. Project files, history state, and backups are preserved.`,"proposal.impact.lifecycleResume":`After confirmation, the Goal becomes eligible for automatic scheduling and returns to Active Goals. Actual execution still follows quota, Gate, and Todo constraints.`,"proposal.impact.lifecycleStop":`After confirmation, automatic progress stops and the Goal moves to the collapsed Stopped list. History, Todos, and evidence remain available for resuming.`,"proposal.impact.protected":`This action must be completed through the protected LoopX write service.`,"proposal.impact.operation":`The exact terms are read-only here. Confirm or reject the same immutable request in the bound Feishu group; confirmation consumes one canonical claim.`,"proposal.primary.apply":`Confirm and apply`,"proposal.primary.goalCreate":`Create Goal and start first run`,"proposal.primary.lifecycleDelete":`Delete Goal`,"proposal.primary.lifecycleResume":`Resume Goal`,"proposal.primary.lifecycleStop":`Stop Goal`,"proposal.primary.todoStart":`Create task and start execution`,"proposal.primary.operationGroup":`Confirm in Feishu group`,"proposal.primary.operationResultPending":`Result card delivery pending`,"proposal.primary.operationResultVerified":`Verified result`,"proposal.resultDelivery.verified":`Verified in the original group card`,"proposal.resultDelivery.pending":`Pending verified return to the original group card`,"proposal.summary.goalCreate":`Create Goal: {title}`,"proposal.summary.heartbeat":`Set a Heartbeat for the current Goal`,"proposal.summary.lifecycleDelete":`Delete Goal: {title}`,"proposal.summary.lifecycleResume":`Resume Goal: {title}`,"proposal.summary.lifecycleStop":`Stop Goal: {title}`,"proposal.summary.monitor":`Create a scheduled check for the current Goal: {target}`,"proposal.workspace.current":`Current local workspace (no Repository bound)`,"proposal.workspace.named":`{workspace} (execution environment only; does not bind a repository)`,"proposal.workspaceGate.agentImpact":`Bind an Agent identity, then recheck the original action. No Goal has been written.`,"proposal.workspaceGate.agentTitle":`Bind an Agent first`,"proposal.workspaceGate.defaultSummary":`Select the Goal workspace.`,"proposal.workspaceGate.selectionImpact":`After selecting a workspace, LoopX will show the confirmation preview again. The selection itself does not write state.`,"proposal.workspaceGate.selectionTitle":`Select Goal workspace`,"projection.agentAdvancingGoal":`Agent is advancing the current Goal`,"projection.agentIdle":`Nothing needs your attention`,"projection.agentNeedsDecision":`Agent is waiting for your decision`,"projection.agentPreparingNextStep":`Agent is preparing the next step`,"projection.agentStopped":`Stopped by you; history, Todos, and evidence are preserved`,"projection.agentWaitingExternal":`Waiting for an external condition`,"projection.confirmAgentDecision":`Confirm the permission or decision the Agent needs next`,"projection.events24h":`{count} events in the last 24 hours`,"projection.firstReadOnlyAdapterCheck":`Run the first read-only adapter check and save progress`,"projection.goalVerified":`Goal state, Todos, and registration information verified`,"projection.latestRun":`Latest run`,"projection.latestValidation":`Latest validation`,"projection.nextUpdatePending":`Waiting for LoopX to update the next step`,"projection.publicSafeProjection":`Public-safe status projection`,"projection.refreshState":`Refresh LoopX status and confirm the current progress is still valid`,"projection.runEvidenceAvailable":`Run evidence is available`,"projection.runRecorded":`The latest LoopX run is recorded`,"projection.statusRefreshNeeded":`LoopX status needs to be refreshed`,"projection.todoStatusUpdated":`Todo status updated; confirming the next step`,"projection.validationRecorded":`The latest validation is recorded`,"runs.completed":`Completed`,"runs.failed":`Needs review`,"runs.interrupted":`Interrupted`,"runs.queued":`Scheduled`,"runs.ready":`Ready`,"runs.resumeFailed":`Recovery failed`,"runs.running":`Running`,"runs.unknown":`Unknown`,"runs.waiting":`Waiting`,"schedule.active":`Running`,"schedule.heartbeat":`Goal Heartbeat`,"schedule.monitor":`Scheduled & continuous task`,"schedule.paused":`Paused`,"schedule.summary":`Continuously checked under LoopX scheduling constraints`,"schedule.defaultTarget":`Check the current Goal for blockers, progress, and new outputs`,"schedule.unsupportedCalendar":`Scheduled checks do not currently support an exact weekday or time. Use a fixed interval such as “Every 30 minutes,” “Every 2 hours,” or “Daily.” The draft was preserved and no confirmation preview was created.`,"source.add":`Add source`,"source.addConfigured":`Add read-only source`,"source.addMethod":`Source setup method`,"source.addSsh":`Add SSH source`,"source.closeForm":`Close source form`,"source.configured":`Configured SSH`,"source.configuredCount":`Local SSH Hosts · {count}`,"source.configuredGroup":`Configured SSH Hosts · {count} (select to add)`,"source.connected":`Connected`,"source.connecting":`Connecting`,"source.controlPlane":`Control plane source`,"source.copy":`Copy`,"source.copyCommand":`Copy SSH tunnel command`,"source.copyError":`Could not copy the command. Copy it manually below.`,"source.copied":`Copied`,"source.description":`All explicit Hosts are loaded, including Include files. Wildcards are not listed. Run the command first; LoopX never reads SSH keys or configuration details.`,"source.host":`Local SSH Host`,"source.hostEmpty":`No explicit SSH Hosts are available in ~/.ssh/config.`,"source.hostLoadError":`Could not read local SSH Hosts.`,"source.hostPlaceholder":`Enter or search for a Host`,"source.invalid":`The SSH source settings are invalid.`,"source.loadingHosts":`Loading…`,"source.localInteractive":`Local interactive`,"source.localPort":`Local port`,"source.manual":`Manual URL`,"source.manualDescription":`Remote sources always remain read-only projections and never inherit local write permissions.`,"source.name":`Name`,"source.namePlaceholder":`Remote development machine`,"source.notAvailable":`Unavailable`,"source.readOnly":`SSH tunnel · read only`,"source.readOnlyNoticeDescription":`You can view Goals, Tasks, evidence, and run status. Writes, guidance, and Agent sessions remain on the source host.`,"source.readOnlyNoticeTitle":`Remote read-only projection`,"source.readOnlyWriteError":`Remote SSH tunnel sources are read-only projections and cannot perform control-plane writes.`,"source.refreshHosts":`Reload SSH Hosts`,"source.remove":`Remove source {source}`,"source.removeCurrent":`Remove current source`,"source.select":`Select control plane source`,"source.selectHost":`Select a configured SSH Host.`,"source.statusUrl":`Local forwarded URL`,"source.tunnelCommandPending":`Select a Host to generate the tunnel command`,"machine.absent":`Not configured`,"machine.action.create":`Create machine policy`,"machine.action.delete":`Remove machine policy`,"machine.action.unchanged":`No write required`,"machine.action.update":`Update machine policy`,"machine.applied":`Machine policy applied and read back successfully.`,"machine.applyError":`Machine policy could not be applied.`,"machine.applyPreview":`Apply reviewed preview`,"machine.changedNamespaces":`Changed namespaces`,"machine.capabilityCatalog":`Machine capability catalog`,"machine.capabilityEmpty":`No machine-configurable capabilities are registered.`,"machine.configured":`Configured`,"machine.confirmRollback":`Confirm rollback`,"machine.currentRevision":`Current revision`,"machine.currentValue":`Current machine value`,"machine.description":`Browse the same capability catalog as Goal settings. Configure supported machine defaults here; Goal-only capabilities are labeled explicitly.`,"capabilities.rawJson":`Advanced: raw JSON`,"machine.goalOnly":`This capability currently supports Goal configuration only. Open a Goal’s capability settings to configure it; no machine-wide default is applied.`,"machine.desiredRevision":`Desired revision`,"machine.editorUnavailable":`No editor is installed for this namespace`,"machine.editorUnavailableDescription":`The namespace remains visible in the registry. Install or upgrade its Dashboard editor before changing it.`,"machine.editorMode":`Editor mode`,"machine.liveDefault":`Live default; Goal override wins`,"machine.liveDefaultDescription":`Goals without an explicit override read the current machine policy at the capability’s next decision point. Changes and removal affect those existing Goals immediately; an explicit Goal override stays pinned.`,"machine.genericNamespaceDescription":`Edit this registered namespace as JSON. LoopX validates it with the capability-owned schema before previewing any write.`,"machine.jsonConfiguration":`Namespace configuration (JSON)`,"machine.jsonConfigurationHelp":`Only this namespace is updated. Other machine configuration is preserved, and Apply remains locked to the reviewed preview revision.`,"machine.jsonEditor":`JSON`,"machine.editJson":`Edit JSON`,"capabilities.jsonConfiguration":`Goal configuration (JSON)`,"capabilities.jsonHelp":`Edit registered fields for this Goal. Changes require a new preview before applying.`,"capabilities.jsonInvalid":`Enter a valid JSON object using only registered editable fields.`,"machine.backToForm":`Back to form`,"machine.jsonInvalid":`Enter one valid JSON object before previewing changes.`,"machine.loadError":`Machine configuration could not be loaded.`,"machine.invalidStoredConfiguration":`Stored machine configuration needs repair`,"machine.invalidStoredConfigurationDescription":`Stored values are hidden because they no longer match the installed contract. Review the affected capability, then Preview and Apply its replacement; unrelated namespaces remain unchanged.`,"machine.machinePolicy":`Machine policy`,"machine.namespaceCount":`Registered namespaces`,"machine.namespaces":`Configuration namespaces`,"machine.periodicReport":`Periodic reports`,"machine.periodicReportDescription":`Default report policy for every Goal without an explicit override. Goal scheduling and delivery consume the effective configuration.`,"machine.periodicReportActivation":`Enabled means automatic delivery at validated stage boundaries`,"machine.periodicReportActivationDescription":`This is not a weekly timer. When LoopX validates a Goal stage completion, an Agent prepares and freezes the report, then automatically delivers it through the configured Goal Channel. The enabled subscription is standing delivery authority; failures and route drift stop closed for repair.`,"machine.changeQualityActivation":`Qualification is a quality gate, not new authority`,"machine.changeQualityActivationDescription":`Goals that inherit this policy qualify their exact final diff. safe_fix allows at most one bounded fix pass inside existing write authority; this setting never grants file, permission, or merge authority.`,"machine.replanCadenceActivation":`Review cadence changes timing, not execution authority`,"machine.replanCadenceActivationDescription":`Goals without an explicit override read this threshold before the next review decision. It does not create Turns, spend quota, or grant authority.`,"machine.preview":`Review exact machine change`,"machine.previewChanges":`Preview changes`,"machine.previewError":`A machine-policy preview could not be created.`,"machine.previewLocked":`Apply is locked to this exact revision. If machine state changes, LoopX requires a new preview.`,"machine.previewRollback":`Preview rollback`,"machine.previewRemoval":`Preview removal`,"machine.profilePreset":`Profile preset`,"machine.profilePresetHelp":`A capability-owned preset, such as weekly-progress.`,"machine.registry":`Typed registry`,"machine.requiredFields":`Enable requires a profile preset, Goal Channel route, and valid timezone.`,"machine.revision":`Machine revision`,"machine.revisionLockedReady":`All changes require a preview and apply only while that exact machine revision remains current.`,"machine.rollbackAvailable":`Rollback is available for the last apply`,"machine.rollbackDescription":`Preview the stored prior revision before restoring it.`,"machine.rollbackError":`The rollback could not be completed.`,"machine.rollbackPreviewDescription":`The prior revision is ready to restore. Confirm to apply this rollback.`,"machine.rolledBack":`The prior machine policy was restored and verified.`,"machine.removed":`Machine policy removed and the resulting configuration read back successfully.`,"machine.routeRef":`Goal Channel route`,"machine.routeRefHelp":`Use a public route alias; credentials and provider identifiers never enter this form.`,"machine.timezone":`Timezone`,"machine.timezoneHelp":`Use an IANA timezone, for example Asia/Shanghai.`,"machine.title":`Machine configuration`,"machine.unchanged":`Machine policy already matches this preview; nothing was written.`,"machine.visualEditor":`Guided`,"capabilities.atomicOverride":`Goal override is atomic`,"capabilities.atomicOverrideDescription":`A complete Goal value wins over the machine default. LoopX never mixes individual fields across scopes.`,"capabilities.applyFailed":`Goal capability changes were not applied.`,"capabilities.applyPreview":`Apply preview`,"capabilities.catalog":`Goal capability catalog`,"capabilities.chooseGoal":`Choose a Goal before inspecting its capabilities.`,"capabilities.defaultValue":`Declared default`,"capabilities.description":`Inspect the capabilities available to this Goal and the exact scope of each setting.`,"capabilities.editorPrepared":`Typed editor contract available`,"capabilities.effectiveSource":`Effective source`,"capabilities.empty":`No capability descriptors are available for this Goal.`,"capabilities.fields":`Registered fields`,"capabilities.goalPolicy":`Goal capability policy`,"capabilities.goalScope":`Goal`,"capabilities.goalValue":`Current Goal value`,"capabilities.loadFailed":`Could not load Goal capabilities`,"capabilities.loading":`Loading Goal capabilities…`,"capabilities.machineOnly":`This capability is configured only at machine scope.`,"capabilities.machineValue":`Live machine default`,"capabilities.machineScope":`Machine`,"capabilities.previewOnly":`Inspection is live. Goal writes remain unavailable until the revision-locked preview and apply path is connected.`,"capabilities.preview":`Revision-locked preview`,"capabilities.previewChanges":`Preview changes`,"capabilities.restoreInheritance":`Restore machine-default inheritance`,"capabilities.previewFailed":`Could not preview Goal capability changes.`,"capabilities.previewLocked":`Apply will re-check this exact plan revision and reject stale changes.`,"capabilities.partialWrite":`Goal value saved; shared projection needs reconciliation`,"capabilities.partialWriteDescription":`The source Goal configuration was written and read back. Its shared runtime projection did not synchronize, so do not submit the change again.`,"capabilities.refreshSource":`Refresh source value`,"capabilities.readOnly":`Read-only capability`,"capabilities.revisionLockedReady":`Changes require a preview and are applied only when its exact revision is still current.`,"capabilities.retry":`Retry`,"capabilities.source.capability_default":`Capability default`,"capabilities.source.goal_override":`Goal override`,"capabilities.source.machine_default":`Live machine default`,"capabilities.source.not_configured":`Not configured`,"capabilities.title":`Goal capabilities`,"settings.close":`Close settings`,"settings.appearance":`Appearance`,"settings.appearanceDescription":`Manage workspace display preferences in this browser.`,"settings.appearanceTabDescription":`Theme and display preferences`,"settings.capabilitiesTabDescription":`Capability overrides for this Goal`,"settings.back":`Back to workspace`,"settings.categories":`Settings categories`,"settings.description":`Manage workspace preferences and integrations.`,"settings.eyebrow":`Workspace preferences`,"settings.general":`General`,"settings.goalConnections":`Goal connections`,"settings.language":`Language`,"settings.languageDescription":`Choose the language used by the LoopX desktop workspace.`,"settings.languageEnglishDescription":`Use English for navigation, settings, and workspace controls.`,"settings.languageEnglish":`English`,"settings.languageSimplifiedChineseDescription":`Use Simplified Chinese for navigation, settings, and workspace controls.`,"settings.languageSimplifiedChinese":`Simplified Chinese`,"settings.languageStoredLocally":`This preference is stored only on this device.`,"settings.languageTabDescription":`Interface language for this device`,"settings.larkTabDescription":`Apps, group chats, and Goal Topic connections`,"settings.machineTabDescription":`Typed defaults shared by capabilities on this machine`,"settings.notifications":`Notifications`,"settings.open":`Settings`,"settings.themeDefault":`Paper`,"settings.themeDefaultDescription":`Calm and lightweight for long-running work.`,"settings.themeDescription":`Choose the workspace visual style. This preference is stored in the current browser.`,"settings.themeHighContrast":`High contrast`,"settings.themeHighContrastDescription":`Stronger borders and more prominent state blocks.`,"settings.themeLoopx":`LoopX standard`,"settings.themeLoopxDescription":`Precise monochrome surfaces, Geist type, and quiet hairline structure.`,"settings.title":`Settings`,"settings.workspaceDisplay":`Workspace display`,"settings.workspaceTheme":`Workspace theme`,"session.closeRecord":`Exit run record`,"session.details":`Session details`,"session.record":`Execution Session · Run record`,"session.recordDescription":`The timeline now shows messages and Turn records from this Session.`,"sidebar.createGoal":`Create Goal`,"sidebar.delete":`Delete`,"sidebar.deleteGoal":`Delete Goal`,"sidebar.manager":`LoopX Manager`,"sidebar.notifications":`Settings`,"sidebar.owner":`Personal workspace`,"sidebar.product":`Personal Agent workspace`,"sidebar.resume":`Resume`,"sidebar.resumeGoal":`Resume Goal`,"sidebar.stop":`Stop`,"tasks.historyLoading":`Loading history…`,"tasks.historyError":`History could not be loaded.`,"tasks.historyExpired":`History snapshot expired. Reload to continue.`,"tasks.historyRetry":`Reload`,"tasks.historyEnd":`End of completed history`,"tasks.historyMore":`Load more`,"tasks.historyLocalOnly":`Open this machine’s Dashboard to browse full history.`,"sidebar.sortGoals":`Reorder Goals`,"sidebar.dragGoal":`Drag to reorder, or use Reorder Goals`,"sidebar.moveUp":`Move {goal} up`,"sidebar.moveDown":`Move {goal} down`,"sidebar.goalMoved":`{goal} moved to position {position}`,"sidebar.orderNotSaved":`Order changed for this visit; browser storage is unavailable.`,"sidebar.stopGoal":`Stop Goal`,"sidebar.stopped":`Stopped`,"sidebar.stoppedLoading":`Loading stopped Goals`,"sidebar.stoppedLoadFailed":`Stopped Goals could not be loaded. Active Goals remain available.`,"sidebar.retryStopped":`Retry`,"state.completed":`Completed`,"state.needsRepair":`Needs repair`,"state.needsYou":`Needs you`,"state.quiet":`Quiet`,"state.running":`Running`,"state.stopped":`Stopped`,"state.waiting":`Waiting`,"tasks.blocked":`Blocked`,"tasks.agentLane":`Work Agent`,"tasks.agentLaneDescription":`Filter this Goal's projected work lanes`,"tasks.agentLaneFilter":`Filter by work Agent`,"tasks.allAgentLanes":`All Agents ({count})`,"tasks.chatAgentReplied":`Agent replied`,"tasks.chatPending":`Sent to Agent`,"tasks.chatPendingDescription":`Processing. Tasks update only after a task operation is confirmed.`,"tasks.chatRecent":`Recent conversation`,"tasks.chatUnchangedDescription":`This conversation did not directly change Tasks. Convert the reply to a Task draft and confirm it when execution is needed.`,"tasks.chatViewReply":`View reply`,"tasks.convertToTask":`Convert to Task`,"tasks.completed":`Completed`,"runs.discoveryPartial":`Some execution details are unavailable. Reconnecting; task summaries are not live execution status.`,"runs.discoveryOffline":`Execution service unavailable. Reconnecting; retained task summaries may be stale.`,"files.openConversation":`Go to conversation`,"files.exportSummary":`Export summary`,"tasks.viewDescription":`Decisions first, then work and recent completions`,"tasks.viewLabel":`Task view`,"tasks.listView":`List`,"tasks.boardView":`Board`,"tasks.completedSummary":`{count} tasks completed. Recent details are projected by the control plane when needed.`,"tasks.emptyCompleted":`No completed tasks yet.`,"tasks.emptyConfirm":`No tasks waiting for confirmation.`,"tasks.emptyRunning":`No queued or running tasks.`,"tasks.emptySchedules":`No scheduled tasks.`,"tasks.emptyGoal":`This Goal has no tasks yet. Describe the next step below and LoopX will show a confirmation preview first.`,"tasks.markComplete":`Mark complete: {name}`,"tasks.moreActions":`More actions: {name}`,"tasks.openExecution":`View execution: {name}`,"tasks.pending":`Pending`,"tasks.pendingAndRunning":`Queued / Running`,"tasks.scheduled":`Scheduled & continuous`,"tasks.sessionError":`Session issue`,"tasks.waiting":`Queued`,"tasks.waitingAge":`Waiting {age}`,"tasks.viewExecution":`View execution`,"tasks.viewResult":`View result`,"time.days":`{count} days`,"time.hours":`{count} hours`,"timeline.emptyGoal":`This Goal has no new activity`,"timeline.emptyGoalDescription":`Ask for progress or send new guidance.`,"timeline.emptyWorkspace":`Your workspace is quiet today`,"timeline.emptyWorkspaceDescription":`Describe a Goal to the LoopX Manager, or ask what deserves attention today.`,"timeline.gateHistory":`{count} historical Gates`,"timeline.pending":`Working…`,"timeline.runCompleted":`{run}: completed`,"timeline.review":`Review`,"timeline.reviewAndConfirm":`Review and confirm`,"timeline.waitingConfirmation":`Needs your confirmation`},"zh-CN":{"acceptance.connected":`已连接`,"acceptance.mapped":`已建立项目映射`,"acceptance.refreshed":`已刷新状态`,"acceptance.inspected":`已检查适配器`,"acceptance.recorded":`已记录执行`,"acceptance.judged":`已记录反馈`,"acceptance.approved":`已记录批准`,"acceptance.ready":`已记录控制器就绪`,"acceptance.attentionSource":`当前状态`,"acceptance.visionSource":`Agent 验收条件`,"acceptance.todoSource":`任务状态`,"acceptance.runSource":`最新执行证据`,"acceptance.title":`验收观察`,"acceptance.unavailable":`验收观测不可用,Goal 是否达成仍未知。`,"acceptance.partial":`当前仅有部分观测。任务完成或缺口列表为空,都不能证明 Goal 已通过验收。`,"acceptance.gaps":`仍需补充的证据`,"acceptance.reasonUnknown":`来源未提供原因`,"acceptance.unknown":`未知`,"acceptance.required":`所需证据或条件`,"acceptance.observed":`观测时间`,"acceptance.noGaps":`现有观测中没有缺口,尚未评估完整验收条件。`,"acceptance.guards":`待处理的门禁决策`,"acceptance.noGuards":`现有观测中没有待处理的门禁决策。`,"acceptance.scope":`决策范围`,"acceptance.next":`当前状态给出的下一步`,"acceptance.historical_progress":`已记录的历史进展`,"acceptance.historical":`历史生命周期记录不授予权限,也不代表通过验收。`,"acceptance.missing":`未获取的来源:`,"acceptance.truncated":`仅展示前 12 条观测。`,"common.actions":`操作`,"common.agent":`Agent`,"common.allMessages":`所有消息`,"common.cancel":`取消`,"common.close":`关闭`,"common.closeActionReceipt":`关闭操作回执`,"common.confirm":`确认`,"common.export":`导出`,"common.failed":`失败`,"common.goal":`Goal`,"common.loading":`加载中…`,"common.none":`无`,"common.off":`关闭`,"common.on":`开启`,"common.open":`打开`,"common.owner":`Owner`,"common.readOnly":`只读`,"common.recently":`刚刚`,"common.status":`状态`,"common.task":`Task`,"common.you":`你`,"common.waiting":`等待中`,"composer.addImage":`添加图片`,"composer.agentProgress":`向 Agent 获取进度报告`,"composer.agentProgressPrompt":`请给我一份当前 Goal 的进度报告:已完成、执行中、阻塞和下一步。`,"composer.attachImageHint":`选择、粘贴或拖入图片`,"composer.clarifyDefer":`暂缓 Todo 需要可自动判断的恢复条件。请补充 todo_done:、pr_merged:[owner/repo]#、capacity_available: 或 resume_at:<带时区 RFC3339 时间>。`,"composer.clarifySingleAction":`这句话包含多个可能修改状态的操作。请一次描述一项操作,我会逐项展示确认预览。`,"composer.createGoal":`创建新 Goal`,"composer.createGoalDraft":`Goal 草稿`,"composer.createGoalDraftDescription":`补充内容后发送,LoopX 会先展示待确认操作。`,"composer.createGoalDraftLead":`我想创建一个长期 Goal:`,"composer.createGoalTemplate":`我想创建一个长期 Goal: +Notification: Only notify me when needed`,"composer.nextAction":`Ask what’s next`,"composer.nextActionPrompt":`What should I do next?`,"composer.prepareDraft":`Insert a draft and review before sending`,"composer.send":`Send`,"composer.sendMessage":`Send a message to LoopX`,"composer.sendMessageHint":`Send message`,"composer.sentImageAlt":`Remove image {name}`,"conversation.agentPending":`Working…`,"conversation.close":`Close conversation receipt`,"conversation.convertHint":`Turn the Agent’s latest reply into a Task draft`,"conversation.full":`View full conversation`,"conversation.receipt":`Conversation receipt`,"conversation.replying":`Replying`,"conversation.title":`Manager conversation`,"conversation.toTask":`Convert to Task`,"digest.away":`Runs since your previous visit`,"digest.completed":`new completions`,"digest.failed":`new failed/interrupted runs`,"digest.needsYou":`currently need confirmation`,"feedback.applying":`Running: {title}`,"feedback.cancelFailed":`Cancel failed: {error}`,"feedback.completed":`Completed: {title}`,"feedback.executionFailed":`Execution failed: {error}`,"feedback.gateRequired":`Your confirmation is required: {summary}`,"feedback.notCompleted":`Not completed: {status}`,"feedback.goalRefreshFailed":`The Goal opened, but its latest state could not be refreshed. Use Refresh to try again.`,"feedback.preparingPreview":`Preparing confirmation preview: {title}`,"feedback.previewFailed":`Could not prepare the confirmation preview: {error}`,"feedback.sendFailed":`Send failed: {error}`,"feedback.sendGenericError":`Could not send the message. Try again later.`,"feedback.stale":`State changed, so nothing was applied. Generate a new confirmation preview.`,"feedback.taskDraftCreated":`Created a Task draft from the reply. Edit and send it to review the confirmation preview.`,"goal.defaultTitle":`New personal Goal`,"goal.initialTodo":`Work toward the completion criteria: {criteria}`,"goal.objectiveBoundary":`Execution boundary: {boundary}`,"goal.objectiveCompletion":`Completion criteria: {criteria}`,"drawer.advancedDiagnostics":`Advanced diagnostics`,"drawer.agentWorking":`Agent is continuing; the record updates automatically.`,"drawer.analysis":`Analyzing`,"drawer.apply":`Confirm and apply`,"drawer.applying":`Applying…`,"drawer.attentionBlocking":`Blocking an Agent`,"drawer.attentionWaiting":`Waiting for your decision`,"drawer.autoNotify":`Human-gate auto notifications`,"drawer.branch":`Branch`,"drawer.closeDetail":`Close details and return to {context}`,"drawer.connected":`Connected`,"drawer.correctionDescription":`The message keeps the current Goal, Todo, and Agent Session context.`,"drawer.correctionLabel":`Guide {agent}`,"drawer.correctionPlaceholder":`For example: focus on permission risks first and do not commit yet…`,"drawer.correctionSend":`Send guidance`,"drawer.correctionTextarea":`Enter guidance for Goal {goal}, Agent {agent}, Run {run}`,"drawer.copyRepository":`Copy repository identity`,"drawer.copyRepositoryDone":`Repository identity copied`,"drawer.copyRepositoryError":`Copy failed. Check browser clipboard permission.`,"drawer.copyRepositorySuccess":`Copied. You can paste it into another tool.`,"drawer.cost":`Cost 24h / 7d`,"drawer.costShort":`Cost`,"drawer.durationShort":`Duration`,"drawer.period24h":`24h`,"drawer.period7d":`7d`,"drawer.tokens":`Tokens 24h / 7d`,"drawer.tokensShort":`tokens`,"drawer.usageNotMeasured":`Not measured`,"drawer.currentGoal":`Current Goal`,"attentionDetail.title":`Request details`,"attentionDetail.request":`What is requested`,"attentionDetail.decision":`Decision requested`,"attentionDetail.unknownRequest":`Not specified; review the source before deciding`,"attentionDetail.open":`Open in current projection`,"attentionDetail.closed":`Closed`,"attentionDetail.deferred":`Deferred`,"attentionDetail.superseded":`Replaced`,"attentionDetail.unknown":`Status not provided`,"attentionDetail.unavailable":`The source has not confirmed this item; refresh before acting`,"attentionDetail.unknownReason":`The source has not provided a reason.`,"attentionDetail.targetTodo":`Linked Todo to unblock`,"attentionDetail.targetAgent":`Agent named by the request`,"attentionDetail.scope":`Declared decision scope`,"attentionDetail.notProvided":`Not provided`,"attentionDetail.replacement":`Replacement Todo`,"attentionDetail.openReplacement":`Open replacement`,"attentionDetail.boundary":`Reading this detail does not resolve a gate or grant authority. Available decisions require a fresh preview.`,"drawer.decisionDefaultEvidence":`No additional public-safe evidence is attached. The next step will still show a Preview first.`,"drawer.decisionDefaultReason":`This decision affects the next step of the current Todo.`,"drawer.decisionDefer":`Decide later`,"drawer.decisionMore":`More decisions`,"drawer.decisionReject":`Reject`,"drawer.decisionReview":`Review impact and decide`,"drawer.dependencies":`Dependencies`,"drawer.detailsAndActions":`Details & actions`,"drawer.duration":`Duration 24h / 7d`,"drawer.evidence":`Evidence`,"drawer.executionHistory":`Execution history`,"drawer.executionRecord":`Run record`,"drawer.executionRecordAndResult":`Execution & result`,"drawer.explainDecision":`Explain this decision`,"drawer.gateApproveHint":`Run one command in the terminal to complete approval:`,"drawer.gateRejectHint":`Replace approve with reject at the end to decline. This notice disappears after the command runs.`,"drawer.gateRequiresHost":`Host confirmation required`,"drawer.gateRequiresHostDescription":`This page cannot approve this protected permission change. Nothing was written by your click.`,"drawer.goalAutoRun":`Automatic runs for this Goal`,"drawer.goalChanges":`Pending changes for this Goal`,"drawer.goalDetails":`Goal details`,"drawer.group":`Group`,"drawer.inspectorFull":`Switch to full screen`,"drawer.inspectorFullView":`Full-screen view`,"drawer.inspectorHalf":`Switch to half screen`,"drawer.inspectorHalfView":`Half-screen view`,"drawer.lastNotification":`Latest notification`,"drawer.larkConfigure":`Configure Lark connection`,"drawer.larkConnect":`Connect Lark App`,"drawer.larkConnection":`Lark connection`,"drawer.larkNotConfigured":`Not configured`,"drawer.larkNotConfiguredDescription":`After setup, LoopX sends a Feishu notification when this Goal needs your confirmation.`,"drawer.managerChanges":`Pending Manager changes`,"drawer.moreActions":`More actions`,"drawer.moreRunActions":`More run actions`,"drawer.nextTransition":`Next transition`,"drawer.noExecutionHistory":`No execution history yet.`,"drawer.noRun":`Execution Session has not started`,"drawer.noRunDescription":`Run records will appear here after an Agent starts execution.`,"drawer.notAssigned":`Unassigned`,"drawer.notLinked":`Not linked`,"drawer.notSet":`Not set`,"drawer.outputDetails":`Output details`,"drawer.outputRecorded":`This output is recorded on the current Goal.`,"drawer.outputSafePreview":`Public-safe output preview`,"drawer.outputRun":`Run`,"drawer.outputTodo":`Todo`,"drawer.outputs":`Outputs from this run`,"drawer.previewUnavailable":`No public-safe inline preview is available for this output.`,"drawer.priority":`Priority`,"drawer.progress":`Progress`,"drawer.proposalApplied":`Applied. LoopX state will refresh.`,"drawer.proposalApplyFailed":`Apply failed. No changes were written.`,"drawer.proposalApplyFailedHint":`Refresh the Goal state and regenerate. If it still fails, keep this page open and inspect advanced diagnostics.`,"drawer.proposalClose":`Close`,"drawer.proposalDefer":`Later`,"drawer.proposalDeferred":`Deferred. You can apply it later or regenerate it.`,"drawer.proposalEnterGoal":`Open new Goal`,"drawer.proposalExplainer":`After confirmation, LoopX applies this change and shows the write result. Closing or canceling changes nothing.`,"drawer.proposalRecheck":`Recheck against latest state`,"drawer.proposalRegenerate":`Retry with latest state`,"drawer.proposalRejected":`Rejected. This change will not be written.`,"drawer.proposalStale":`Source state changed. Recheck against the latest state.`,"drawer.proposalViewGoal":`View updated Goal`,"drawer.reassign":`Reassign to`,"drawer.reassignSummary":`Reassign: {task}`,"drawer.reason":`Reason`,"drawer.recoveryDescription":`Local history is preserved. Choose a recovery path.`,"drawer.recoveryFailed":`Upstream Session recovery failed`,"drawer.recoveryNewSession":`Start a new Session with context`,"drawer.recoveryRetry":`Retry recovery`,"drawer.repositoryRole":`Execution workspace`,"drawer.repository":`Repository`,"drawer.replyMode":`Reply mode`,"drawer.subagentApplied":`Applied and verified against the shared Goal state.`,"drawer.subagentAppliedRefreshFailed":`Applied and verified. The status view could not refresh; retry the page refresh later.`,"drawer.subagentApplying":`Applying and verifying shared-state readback…`,"drawer.subagentApplyFailed":`Could not apply the sub-agent setting.`,"drawer.subagentChildLimit":`Current limit`,"drawer.subagentConfirmDisable":`Confirm turning off sub-agent execution`,"drawer.subagentConfirmEnable":`Confirm turning on sub-agent execution`,"drawer.subagentCurrentBoundary":`Current task-domain restriction`,"drawer.subagentDescription":`Allows the runtime to create temporary child agents for independent tasks only after Todo, quota, capability, and write-scope gates pass. It does not force parallel work or grant durable authority.`,"drawer.subagentDisable":`Preview turning off sub-agent execution`,"drawer.subagentDisableSummary":`New child-agent execution will be disabled for this Goal. Existing Todo ownership and execution records stay unchanged.`,"drawer.subagentDomainInvalid":`The selected task-domain restriction is invalid.`,"drawer.subagentDomainTodoCount":`{count} matching open Todos`,"drawer.subagentDomains":`Task-domain restriction (optional)`,"drawer.subagentDomainsEmpty":`No open advancement Todo declares task_domain. Leave this empty to keep child execution unrestricted by task domain.`,"drawer.subagentDomainsHint":`Leave every option clear to apply no task-domain filter. Selecting domains admits only matching typed Todos; all other execution gates still apply.`,"drawer.subagentDomainsUnrestricted":`No task-domain restriction`,"drawer.subagentEnable":`Preview turning on sub-agent execution`,"drawer.subagentLabel":`Per-Goal execution boundary`,"drawer.subagentModel":`Child model`,"drawer.subagentEffort":`Child reasoning effort`,"drawer.subagentModelDefault":`Host default`,"drawer.subagentLunaPreset":`Use Luna / max`,"drawer.subagentClearModel":`Clear model preference`,"drawer.subagentModelHint":`Use Preview configuration update to save this preference. It can be saved while execution is off; host support is checked at launch.`,"drawer.subagentModelRequired":`Choose a child model before setting reasoning effort.`,"drawer.subagentMaxChildren":`Maximum child agents`,"drawer.subagentNoChange":`The current Goal already matches this setting; nothing was written.`,"drawer.subagentPending":`Pending confirmation`,"drawer.subagentPreviewBoundary":`Preview configuration update`,"drawer.subagentPreviewFailed":`Could not create the sub-agent setting preview.`,"drawer.subagentPreviewing":`Checking the latest Goal state…`,"drawer.subagentPreviewReady":`Preview locked. Confirm to apply this Goal setting.`,"drawer.subagentPreviewSummary":`Allow up to {count} child agents. Task-domain restriction: {domains}.`,"drawer.subagentRemoteReadOnly":`This source is read only. Open the Goal on its host to change the setting.`,"drawer.subagentTitle":`Adaptive sub-agent execution`,"drawer.remoteDetailsDescription":`SSH sources expose public-safe status only and do not read connection settings from the source host.`,"drawer.remoteDetailsUnavailable":`Remote details are not projected`,"drawer.resumeNo":`No`,"drawer.resumeYes":`Yes`,"drawer.runDetails":`Execution Session`,"drawer.runInterrupt":`Interrupt this run`,"drawer.runLatest":`View latest execution`,"drawer.runNewSession":`Start new Session`,"drawer.runCloseSession":`Close Session`,"drawer.runRecordEmpty":`No run record yet. The Agent has not started this execution. Check waiting conditions or resume the Session under Details & actions.`,"drawer.runRecordProjected":`No step-by-step record is available. LoopX read {completed}/{total} projected steps{outputs}; inspect the Session under Details & actions.`,"drawer.runRecordProjectedOutputs":` and {count} outputs`,"drawer.runRoleAssistant":`Completed`,"drawer.runRoleSystem":`Needs review`,"drawer.runRoleUser":`Task received`,"drawer.runView":`Session views`,"drawer.scheduleAdd":`Add scheduled check`,"drawer.scheduleDefaultNotification":`Notify only when you are needed`,"drawer.scheduleDefaultStop":`Goal completes or owner stops it`,"drawer.scheduleDefaultTarget":`Wake according to this Goal’s LoopX schedule.`,"drawer.scheduleEdit":`Change to every 2 hours`,"drawer.scheduleLast":`Last run`,"drawer.scheduleLocalTimezone":`Local timezone`,"drawer.scheduleNext":`Next run`,"drawer.scheduleNeverRun":`Not run yet`,"drawer.scheduleNotification":`Notification`,"drawer.schedulePause":`Pause`,"drawer.schedulePending":`Waiting for schedule`,"drawer.scheduleResume":`Resume`,"drawer.scheduleRunNow":`Run now`,"drawer.scheduleStop":`Stop {kind}`,"drawer.scheduleStopCondition":`Stop condition`,"drawer.scheduleTimezone":`Timezone`,"drawer.sessionRecoverable":`Resumable`,"drawer.sessionStatus":`Session status`,"drawer.setupHeartbeat":`Set up Heartbeat`,"drawer.taskActions":`Pending Todo actions`,"drawer.taskAdvancement":`Advancement task`,"drawer.taskBlock":`Mark blocked`,"drawer.taskComplete":`Mark complete`,"drawer.taskCompletedNote":`This task is retained as a read-only record.`,"drawer.taskCompletedTitle":`Task completed`,"drawer.taskDefer":`Defer`,"drawer.taskDeferCondition":`Todo defer resume condition`,"drawer.taskDeferInvalid":`Unsupported condition format; use one of the deterministic conditions below.`,"drawer.taskDeferPlaceholder":`For example, resume_at:2026-09-14T09:00:00+08:00`,"drawer.taskDeferReview":`Review defer`,"drawer.taskDeferSupported":`Supports todo_done, pr_merged, capacity_available, and timezone-aware resume_at conditions.`,"drawer.taskDeferUntil":`Defer until`,"drawer.taskDetails":`Todo details`,"drawer.taskInfo":`Task information`,"drawer.taskManage":`Manage task`,"drawer.taskNextCompleted":`Create a follow-up task`,"drawer.taskNextOpen":`Advance or update status`,"drawer.taskOrdinary":`Task`,"drawer.taskStatusBlocked":`Blocked`,"drawer.taskStatusDeferred":`Deferred`,"drawer.resumeWhen":`Resume condition`,"drawer.resumeState":`Resume state`,"drawer.resumePending":`Waiting for condition`,"drawer.resumeReady":`Ready to resume`,"drawer.resumeReceipt":`Resume receipt`,"drawer.taskNextDeferred":`Wait for the resume condition, then reassess`,"drawer.taskNextResumeReady":`Resume condition met; awaiting lifecycle replan`,"drawer.taskStatusCompleted":`Completed`,"drawer.taskStatusOpen":`Ready`,"drawer.taskSuccessor":`Create follow-up Todo`,"drawer.taskSuccessorNote":`Owner marked this blocked while waiting for more context.`,"drawer.taskSuccessorSummary":`Create follow-up Todo: {task}`,"drawer.taskSuccessorText":`Follow-up work for {task}`,"drawer.taskType":`Task type`,"drawer.topic":`Topic`,"drawer.trigger":`Trigger`,"drawer.titleAttention":`Needs you`,"drawer.titleOutput":`Output details`,"drawer.titleProposalApplied":`Execution result`,"drawer.titleProposalConfirm":`Confirm execution`,"drawer.titleSchedule":`Scheduled check`,"drawer.unconfigured":`Not configured`,"drawer.workspaceCandidates":`Available workspaces`,"files.emptySummary":`Public-safe output`,"files.empty":`No files, outputs, or verified reports yet.`,"files.loadingReports":`Loading verified milestone reports…`,"files.reportDelta":`+{added} added · {changed} changed`,"files.reportAdded":`added`,"files.reportChanged":`changed`,"files.reportGeneration":`Generation`,"files.reportLoadFailed":`Could not load verified reports`,"files.reportPublication":`Publication`,"files.title":`Files & Outputs`,"files.verifiedReport":`Verified milestone report`,"header.agentUnavailable":`Unavailable`,"header.chatRuntime":`Chat`,"header.workAgentCount":`{count} work Agents`,"header.chat":`Chat`,"header.files":`Files`,"header.goalCapabilities":`Capability settings`,"header.goalCapabilitiesDescription":`Manage overrides and inherited machine defaults.`,"header.goalDetails":`Goal details`,"header.goalDetailsDescription":`Review status, usage, repository, notifications, and sessions.`,"header.goalSettings":`Goal settings`,"header.goalSettingsDescription":`Open Goal details or capability settings`,"header.goalNavigation":`Goal navigation`,"header.goalView":`Goal view`,"header.live":`Live`,"header.manager":`LoopX Manager`,"header.managerDescription":`Your personal workspace across Goals`,"header.managerRuntime":`{profile} · {sandbox}`,"header.managerRuntimeFallback":`Configuration invalid; fell back to {profile} · {sandbox}. Repair it in Machine capabilities.`,"header.managerOverview":`Overview`,"header.managerView":`Manager view`,"header.openGoalNavigation":`Open Goal navigation`,"header.readOnlySourceDescription":`{source} is displayed read-only through an SSH tunnel`,"header.refresh":`Refresh status`,"header.refreshDone":`Updated just now`,"header.refreshFailed":`Refresh failed`,"header.refreshing":`Refreshing`,"header.selectAgent":`Select Agent`,"header.selectChatRuntime":`Select chat runtime`,"header.tasks":`Tasks`,"header.themeBrutal":`Switch to brutal theme`,"header.themePaper":`Switch to default theme`,"home.blockingSummary":`{count} are blocking an Agent.`,"home.completedGoals":`Completed Goals`,"home.empty":`Nothing here`,"startup.goalLoading":`Loading status…`,"startup.goalError":`Could not load status`,"startup.progress":`{loaded} of {total} active Goals loaded`,"startup.partial":`Goal states are updating. Counts are incomplete.`,"startup.independent":`Other Goals remain available while this Goal loads.`,"startup.error.timeout":`The request timed out. Retry when the local service is ready.`,"startup.error.network":`The connection was interrupted. Retry to reconnect.`,"startup.error.service":`The Goal status could not be read. Retry later; if the problem continues, check the status source.`,"startup.error.access":`The status source cannot access files or runtime directories required for this Goal. Check the permissions of the account running that source, then retry.`,"startup.error.revision":`The Goal directory changed during loading. Refresh to synchronize.`,"startup.error.scope":`This Goal is no longer available in the selected source. Refresh the directory.`,"startup.error.invalid":`The status response could not be read. Refresh or check for a LoopX update.`,"startup.retry":`Retry`,"startup.retryFailed":`Retry failed Goals`,"startup.failedCount":`{count} Goals could not be loaded. Ready Goals remain available.`,"home.greeting":`Hi, I’m your LoopX Manager`,"home.history":`History`,"home.lane.needsYou":`Needs you`,"home.lane.needsYouDescription":`Waiting for your decision, authorization, or context`,"home.lane.observing":`Observing`,"home.lane.observingDescription":`Monitoring continuously and notifying you when something changes`,"home.lane.running":`Running`,"home.lane.runningDescription":`Agents are making progress and reporting back`,"home.lane.scheduled":`Scheduled`,"home.lane.scheduledDescription":`Queued until its time or prerequisite arrives`,"home.noActivity":`No activity yet`,"home.noFirstActivity":`Waiting for first activity`,"home.noCompletedGoals":`No completed Goals yet`,"home.preservedState":`State is preserved and can be resumed`,"home.stopped":`Stopped`,"home.systemHealth":`System health: {summary}`,"home.taskCount":`{count} Tasks`,"home.todayAt":`Today {time}`,"home.waitingCount":`You have {count} items to handle.`,"home.workspace":`Goal workspace`,"lark.allMessages":`All messages in this topic`,"lark.allTopicMessages":`All topic messages`,"lark.agentIngress":`Agent ingress`,"lark.agentAppPermissions":`Every selected Agent needs a Lark App that is ready for group mentions and replies.`,"lark.agentApps":`Lark App per Agent`,"lark.agentAppsDescription":`The default App is preselected. Assign a different compatible App when an Agent needs its own bot identity.`,"lark.agentAppSelection":`Lark App for {agent}`,"lark.appCreated":`App created`,"lark.appCreateFailed":`Creation failed`,"lark.appLoading":`Loading available Lark Apps…`,"lark.appPermissions":`This App can send connection messages, but lacks the bot permissions required to receive group mentions or reply automatically. Enable im:message.group_at_msg:readonly, im:message.send_as_bot, and the im.message.receive_v1 event, publish a new version, then refresh.`,"lark.appProfile":`Lark App`,"lark.apps":`Lark Apps`,"lark.autoReplyUnavailable":`Auto reply unavailable`,"lark.autoReplyReady":`Auto reply ready`,"lark.bindGoal":`Bind to Goal`,"lark.cancel":`Cancel`,"lark.cardinality":`One Lark App · many Goals · one isolated route per Agent`,"lark.capture":`Capture`,"lark.captureAddressed":`Only messages that mention or reply to the App`,"lark.captureAll":`All messages in this Goal topic`,"lark.captureScope":`Capture scope`,"lark.captureScopeDescription":`Controls which Topic messages enter LoopX without expanding Agent permissions.`,"lark.closeConnection":`Close connection dialog`,"lark.closeCreate":`Close create dialog`,"lark.closeSettings":`Close Lark settings`,"lark.connect":`Connect`,"lark.connectAllAgents":`Connect every registered Agent`,"lark.connectAllAgentsAction":`Connect {count} Agents`,"lark.connectAllAgentsDescription":`Create {count} isolated Agent Topics in one guided action. Send requests inside the matching Topic; each Agent keeps its own route and inbox.`,"lark.connectApp":`Connect Lark App`,"lark.connection":`Connection`,"lark.connections":`Connections`,"lark.configuration":`Lark configuration`,"lark.continueFeishu":`Continue in Feishu`,"lark.createAutomatically":`Create Goal topic automatically`,"lark.createAutomaticallyDescription":`A dedicated, Agent-labelled Topic will be created for every selected Agent.`,"lark.defaultAgentAppDescription":`Used to find the target group and as the default for every selected Agent. Per-Agent choices below override it.`,"lark.description":`Manage reusable Lark Apps and connect group chats to Goals through dedicated topics.`,"lark.editConnection":`Edit Lark Connection`,"lark.goalConnections":`{count} Goal connections`,"lark.goalTopicConnections":`Lark Goal Topic connections`,"lark.groupChat":`Group chat`,"lark.groupEmpty":`This bot has not joined a group that can be connected. Add it to a Feishu group first, then return to refresh or search.`,"lark.groupLoading":`Reading groups joined by this bot…`,"lark.groupSearch":`Search groups joined by this bot`,"lark.historyPermission":`Group-history permission (separate capability)`,"lark.health.contextCaptured":`Group context captured`,"lark.health.contextCapturedDetail":`The message is retained as non-authoritative context. It did not start or steer a Manager turn; send a direct @ mention or verified reply when action is required.`,"lark.health.eventProcessed":`{events} events processed, {replies} replies sent.`,"lark.health.eventUnverified":`Event subscription needs verification`,"lark.health.eventUnverifiedDetail":`The provider listener is ready, but no event has arrived. Enable im.message.receive_v1 and group mention permissions, publish a new version, then send a new @ mention inside this Agent Topic. Group-level messages fail closed when multiple Agent routes exist.`,"lark.health.ignoredSelf":`The bot’s own message was ignored to prevent duplicate replies.`,"lark.health.invalidRouting":`Invalid routing configuration`,"lark.health.invalidRoutingDetail":`The connection was safely disabled. Select a processing mode again and save.`,"lark.health.lastStatus":`Latest event status: {status}`,"lark.health.listening":`Listening`,"lark.health.messageContextPermission":`Message permission required`,"lark.health.messageContextPermissionDetail":`A message event arrived, but group context could not be read. Publish and authorize group message read access for this App.`,"lark.health.notAddressed":`Latest message did not directly @ the bot`,"lark.health.notAddressedDetail":`Listening is healthy. This connection only responds to direct @ mentions or replies to the bot.`,"lark.health.notStarted":`Listener not started`,"lark.health.notStartedDetail":`Refresh the connection or restart LoopX, then try again.`,"lark.health.processingFailed":`Message processing failed`,"lark.health.processingFailedDetail":`The message event arrived, but Agent processing failed. Review local diagnostics and retry.`,"lark.health.queued":`Queued in the Agent inbox`,"lark.health.queuedDetail":`The message will be processed asynchronously by {agent} without starting a general Chat Session.`,"lark.health.sourceDisconnected":`Event connection disconnected`,"lark.health.sourceDisconnectedDetail":`The event consumer exited unexpectedly. Check that the app profile uses Feishu for Feishu apps or Lark for international Lark, then inspect connection and subscription errors. LoopX is retrying; successful history queries do not prove live delivery.`,"lark.health.retrying":`Retrying listener`,"lark.health.retryingDetail":`Event listening was interrupted and LoopX is retrying automatically.`,"lark.health.routeAmbiguous":`Message matches multiple Goals`,"lark.health.routeAmbiguousDetail":`The same bot and group have multiple full-group capture connections. Use a separate bot for each Agent or keep only one full-group connection.`,"lark.health.routeMismatch":`Message did not match this Goal Topic`,"lark.health.routeMismatchDetail":`The event came from another group or Topic. Reconnect this Goal to the correct group, then send a new @ mention.`,"lark.health.routeUnavailable":`Message cannot be routed to the Goal`,"lark.health.routeUnavailableDetail":`Connection data is incomplete. Reconnect this Goal, then send a new @ mention.`,"lark.health.starting":`Starting`,"lark.health.startingDetail":`LoopX is starting message event listening for this App.`,"lark.health.unavailable":`Auto reply unavailable`,"lark.health.waiting":`Waiting`,"lark.incomingMessages":`Incoming messages`,"lark.ingressAsync":`Async inbox`,"lark.ingressAsyncDescription":`Write to the Agent private inbox for a later explicit drain.`,"lark.editPreservesIdentity":`Saving preserves this App, group and Topic. Old connections upgrade to the Agent inbox by default.`,"lark.conversationKind":`Connection purpose`,"lark.managerConversation":`Manager · live conversation`,"lark.workerConversation":`Worker Agent · background tasks`,"lark.managerConversationDescription":`The built-in manager responds as you chat and delegates long-running work to background Agents. Group and private conversations keep separate histories.`,"lark.ingressLegacy":`Upgrade available`,"lark.ingressLegacyDescription":`Save this connection to upgrade to the Agent inbox. Existing messages remain in the same Topic.`,"lark.ingressQueue":`Queuing`,"lark.ingressQueueDescription":`Enter the same Agent Session's bounded FIFO queue and run after the current Turn.`,"lark.ingressSteering":`Steering`,"lark.ingressSteeringDescription":`Deliver to the active Turn and reject safely when no exact active Turn exists.`,"lark.loading":`Loading Lark configuration…`,"lark.management":`Lark management`,"lark.openEventSettings":`Open Feishu event settings`,"lark.mentions":`Mentions`,"lark.mentionsOnly":`Mentions only`,"lark.needsMessagePermissions":`Needs message permissions`,"lark.needsSetup":`Needs setup`,"lark.newApp":`New Lark App`,"lark.noAgentConfigured":`No Agent configured`,"lark.noConnections":`No matching connections.`,"lark.noProfiles":`No lark-cli App profiles are available yet.`,"lark.profileName":`Profile name`,"lark.profileValidation":`Profile can contain only letters, numbers, periods, underscores, and hyphens.`,"lark.processing":`Processing`,"lark.region":`Region`,"lark.registerAnother":`+ Register another Lark App — Create through Feishu`,"lark.reopenFeishu":`Reopen Feishu`,"lark.settingsConfigure":`Configure {goal}`,"lark.settingsDisconnect":`Disconnect {goal}`,"lark.replyMode":`Reply mode`,"lark.replyModeDescription":`Replies are limited to the source Topic to prevent cross-group or cross-Goal delivery.`,"lark.reusableApps":`{count} reusable Apps`,"lark.reusableWorkspaceApp":`Reusable workspace App`,"lark.routesUnverified":`{count} Lark routes pending verification`,"lark.saveConnection":`Save connection`,"lark.searchConnections":`Search Lark connections`,"lark.searchPlaceholder":`Search Apps, groups, Goals, or topics`,"lark.setupCopy":`LoopX opens the official Feishu creation page through lark-cli. App credentials stay in the system Keychain; LoopX stores only the profile reference.`,"lark.someoneMentions":`Someone mentions the Agent`,"lark.targetAgent":`Target Agent`,"lark.targetAgentDescription":`Choose a registered Agent in this Goal. This connection delivers to one Agent; it does not broadcast or grant permissions. Steering and Queuing require that Agent's exact active Session.`,"lark.agentUnavailable":`{agent} · no longer available`,"lark.selectRegisteredAgent":`Select an available registered Agent before connecting. The previous Agent will not be replaced automatically.`,"lark.topicPreview":`Topic preview`,"lark.topicReply":`Topic reply`,"lark.trigger":`Trigger`,"lark.waitingFeishu":`Waiting for Feishu`,"lark.waitingFeishuDescription":`Complete Feishu authorization in the new window. This page updates automatically when it is ready.`,"lark.waitingLink":`Generating the official Feishu creation link…`,"lark.error.appCreate":`Lark App creation failed`,"lark.error.appRequired":`Select a Lark App profile.`,"lark.error.bind":`Connection failed`,"lark.error.bindPreview":`Connection preview failed`,"lark.error.configuration":`Could not load Lark configuration`,"lark.error.groupLookup":`Could not read groups joined by this bot. Check the bot status and try again.`,"lark.error.groupLoad":`Could not load group chats`,"lark.error.invalidApp":`The Lark App profile is unavailable or has not completed authorization.`,"lark.error.messagePermissions":`This App lacks the bot permissions required for automatic replies. Enable im:message.group_at_msg:readonly and im:message:send_as_bot, publish a new version, then refresh.`,"lark.error.provider":`The Feishu API call failed without a verified receipt. Try again later.`,"lark.error.setupPoll":`Could not read creation status`,"lark.error.setupStart":`Could not start Lark App creation`,"lark.error.cliExecutable":`The configured lark-cli was found but cannot run. Check the installation or launch arguments.`,"lark.error.cliMissing":`lark-cli was not found. Install lark-cli and restart LoopX.`,"lark.error.cliStart":`lark-cli failed to start. Check the installation and restart LoopX.`,"lark.error.disconnect":`Disconnect failed`,"notifications.autoNotify":`Send automatically when your confirmation is required`,"notifications.bind":`Bind notification group`,"notifications.bindConfirm":`Bind “{goal}” to “{target}”. LoopX will verify that the bot is in the group and send a confirmation message.`,"notifications.bindFailed":`Binding failed`,"notifications.bound":`Bound`,"notifications.confirmBind":`Confirm binding`,"notifications.description":`Send Goal changes that need your confirmation to a Feishu group. Bindings and automatic delivery use the existing channel.`,"notifications.disabled":`Disabled`,"notifications.group":`Notification group: {target}`,"notifications.loadFailed":`Could not load notification groups`,"notifications.noTargets":`No notification groups are available. Group delivery uses a private bot identity; configure one from the terminal first:`,"notifications.notBound":`Not bound`,"notifications.recent":`Latest {time}`,"notifications.sentCount":`{count} sent`,"notifications.settings":`Goal notification bindings`,"notifications.setupFailed":`Could not update settings`,"notifications.title":`Feishu group notifications`,"proposal.field.agentId":`Agent`,"proposal.field.cadence":`Frequency`,"proposal.field.completionCriteria":`Completion criteria`,"proposal.field.executionBoundary":`Execution boundary`,"proposal.field.goalId":`Goal ID`,"proposal.field.heartbeat":`Heartbeat`,"proposal.field.initialTodos":`Initial tasks`,"proposal.field.objective":`Objective`,"proposal.field.operation":`Operation`,"proposal.field.operationState":`Operation state`,"proposal.field.resultDelivery":`Result delivery`,"proposal.field.confirmationBoundary":`Confirmation boundary`,"proposal.field.expiresAt":`Expires at`,"proposal.field.permission":`Permission`,"proposal.field.reason":`Reason`,"proposal.field.stopCondition":`Stop condition`,"proposal.field.target":`Check target`,"proposal.field.timezone":`Timezone`,"proposal.field.title":`Title`,"proposal.field.workspace":`Execution workspace`,"actionReview.targetChanged":`The preview target does not match the requested Goal and operation. Generate a new preview.`,"actionReview.ready_stop":`Pausing is reversible. This validated preview can apply directly; completion still requires verified readback.`,"actionReview.resume_review":`Review before restoring automatic scheduling. Quota, gates and Todo constraints still apply.`,"actionReview.delete_review":`Review removal of this stopped Goal from the registries. Project files and history are preserved.`,"actionReview.action_review":`Review the target and impact before applying this proposal.`,"actionReview.protected_action":`This action needs explicit review. Confirmation cannot replace required authority.`,"actionReview.unknown_permission":`The permission classification is not recognized. Recheck the proposal before continuing.`,"actionReview.unknown_action":`This lifecycle operation is not recognized. Recheck the proposal before continuing.`,"actionReview.incomplete_proposal":`The preview is missing validation or an available apply transition. Generate a new preview.`,"actionReview.authority_gate":`A gate prevents execution. Resolve its requirements, then recheck the proposal.`,"actionReview.stale_proposal":`The source state changed. Generate a new preview; the previous decision no longer applies.`,"actionReview.apply_pending":`Execution is in progress. Wait for its result before retrying.`,"actionReview.readback_verified":`The action completed and its resulting state was verified.`,"actionReview.readback_unverified":`The action returned without verified readback. Completion is not confirmed; recheck the state.`,"actionReview.operation_group_confirmation":`This exact request can only be confirmed on its original card in the bound Feishu group. The Dashboard does not expose a local execution control.`,"actionReview.operation_result_delivery_pending":`The operation outcome was recorded, but the original group result card has not passed readback verification yet.`,"actionReview.apply_failed":`Execution did not complete. Check the failure and regenerate the preview before retrying.`,"actionReview.inactive_proposal":`This proposal is no longer ready to execute. Recheck it before continuing.`,"proposal.gate.default":`Host confirmation required`,"proposal.impact.default":`After confirmation, the canonical LoopX service will write the state change.`,"proposal.impact.goalCreate":`After confirmation, LoopX will create the Goal and its initial Todo, then let the selected Agent start the first run.`,"proposal.impact.lifecycleDelete":`After confirmation, this stopped Goal is removed from the source and global registries. Project files, history state, and backups are preserved.`,"proposal.impact.lifecycleResume":`After confirmation, the Goal becomes eligible for automatic scheduling and returns to Active Goals. Actual execution still follows quota, Gate, and Todo constraints.`,"proposal.impact.lifecycleStop":`After confirmation, automatic progress stops and the Goal moves to the collapsed Stopped list. History, Todos, and evidence remain available for resuming.`,"proposal.impact.protected":`This action must be completed through the protected LoopX write service.`,"proposal.impact.operation":`The exact terms are read-only here. Confirm or reject the same immutable request in the bound Feishu group; confirmation consumes one canonical claim.`,"proposal.primary.apply":`Confirm and apply`,"proposal.primary.goalCreate":`Create Goal and start first run`,"proposal.primary.lifecycleDelete":`Delete Goal`,"proposal.primary.lifecycleResume":`Resume Goal`,"proposal.primary.lifecycleStop":`Stop Goal`,"proposal.primary.todoStart":`Create task and start execution`,"proposal.primary.operationGroup":`Confirm in Feishu group`,"proposal.primary.operationResultPending":`Result card delivery pending`,"proposal.primary.operationResultVerified":`Verified result`,"proposal.resultDelivery.verified":`Verified in the original group card`,"proposal.resultDelivery.pending":`Pending verified return to the original group card`,"proposal.summary.goalCreate":`Create Goal: {title}`,"proposal.summary.heartbeat":`Set a Heartbeat for the current Goal`,"proposal.summary.lifecycleDelete":`Delete Goal: {title}`,"proposal.summary.lifecycleResume":`Resume Goal: {title}`,"proposal.summary.lifecycleStop":`Stop Goal: {title}`,"proposal.summary.monitor":`Create a scheduled check for the current Goal: {target}`,"proposal.workspace.current":`Current local workspace (no Repository bound)`,"proposal.workspace.named":`{workspace} (execution environment only; does not bind a repository)`,"proposal.workspaceGate.agentImpact":`Bind an Agent identity, then recheck the original action. No Goal has been written.`,"proposal.workspaceGate.agentTitle":`Bind an Agent first`,"proposal.workspaceGate.defaultSummary":`Select the Goal workspace.`,"proposal.workspaceGate.selectionImpact":`After selecting a workspace, LoopX will show the confirmation preview again. The selection itself does not write state.`,"proposal.workspaceGate.selectionTitle":`Select Goal workspace`,"projection.agentAdvancingGoal":`Agent is advancing the current Goal`,"projection.agentIdle":`Nothing needs your attention`,"projection.agentNeedsDecision":`Agent is waiting for your decision`,"projection.agentPreparingNextStep":`Agent is preparing the next step`,"projection.agentStopped":`Stopped by you; history, Todos, and evidence are preserved`,"projection.agentWaitingExternal":`Waiting for an external condition`,"projection.confirmAgentDecision":`Confirm the permission or decision the Agent needs next`,"projection.events24h":`{count} events in the last 24 hours`,"projection.firstReadOnlyAdapterCheck":`Run the first read-only adapter check and save progress`,"projection.goalVerified":`Goal state, Todos, and registration information verified`,"projection.latestRun":`Latest run`,"projection.latestValidation":`Latest validation`,"projection.nextUpdatePending":`Waiting for LoopX to update the next step`,"projection.publicSafeProjection":`Public-safe status projection`,"projection.refreshState":`Refresh LoopX status and confirm the current progress is still valid`,"projection.runEvidenceAvailable":`Run evidence is available`,"projection.runRecorded":`The latest LoopX run is recorded`,"projection.statusRefreshNeeded":`LoopX status needs to be refreshed`,"projection.todoStatusUpdated":`Todo status updated; confirming the next step`,"projection.validationRecorded":`The latest validation is recorded`,"runs.completed":`Completed`,"runs.failed":`Needs review`,"runs.interrupted":`Interrupted`,"runs.queued":`Scheduled`,"runs.ready":`Ready`,"runs.resumeFailed":`Recovery failed`,"runs.running":`Running`,"runs.unknown":`Unknown`,"runs.waiting":`Waiting`,"schedule.active":`Running`,"schedule.heartbeat":`Goal Heartbeat`,"schedule.monitor":`Scheduled & continuous task`,"schedule.paused":`Paused`,"schedule.summary":`Continuously checked under LoopX scheduling constraints`,"schedule.defaultTarget":`Check the current Goal for blockers, progress, and new outputs`,"schedule.unsupportedCalendar":`Scheduled checks do not currently support an exact weekday or time. Use a fixed interval such as “Every 30 minutes,” “Every 2 hours,” or “Daily.” The draft was preserved and no confirmation preview was created.`,"source.add":`Add source`,"source.addConfigured":`Add read-only source`,"source.addMethod":`Source setup method`,"source.addSsh":`Add SSH source`,"source.closeForm":`Close source form`,"source.configured":`Configured SSH`,"source.configuredCount":`Local SSH Hosts · {count}`,"source.configuredGroup":`Configured SSH Hosts · {count} (select to add)`,"source.connected":`Connected`,"source.connecting":`Connecting`,"source.controlPlane":`Control plane source`,"source.copy":`Copy`,"source.copyCommand":`Copy SSH tunnel command`,"source.copyError":`Could not copy the command. Copy it manually below.`,"source.copied":`Copied`,"source.description":`All explicit Hosts are loaded, including Include files. Wildcards are not listed. Run the command first; LoopX never reads SSH keys or configuration details.`,"source.host":`Local SSH Host`,"source.hostEmpty":`No explicit SSH Hosts are available in ~/.ssh/config.`,"source.hostLoadError":`Could not read local SSH Hosts.`,"source.hostPlaceholder":`Enter or search for a Host`,"source.invalid":`The SSH source settings are invalid.`,"source.loadingHosts":`Loading…`,"source.localInteractive":`Local interactive`,"source.localPort":`Local port`,"source.manual":`Manual URL`,"source.manualDescription":`Remote sources always remain read-only projections and never inherit local write permissions.`,"source.name":`Name`,"source.namePlaceholder":`Remote development machine`,"source.notAvailable":`Unavailable`,"source.readOnly":`SSH tunnel · read only`,"source.readOnlyNoticeDescription":`You can view Goals, Tasks, evidence, and run status. Writes, guidance, and Agent sessions remain on the source host.`,"source.readOnlyNoticeTitle":`Remote read-only projection`,"source.readOnlyWriteError":`Remote SSH tunnel sources are read-only projections and cannot perform control-plane writes.`,"source.refreshHosts":`Reload SSH Hosts`,"source.remove":`Remove source {source}`,"source.removeCurrent":`Remove current source`,"source.select":`Select control plane source`,"source.selectHost":`Select a configured SSH Host.`,"source.statusUrl":`Local forwarded URL`,"source.tunnelCommandPending":`Select a Host to generate the tunnel command`,"machine.absent":`Not configured`,"machine.action.create":`Create machine policy`,"machine.action.delete":`Remove machine policy`,"machine.action.unchanged":`No write required`,"machine.action.update":`Update machine policy`,"machine.applied":`Machine policy applied and read back successfully.`,"machine.applyError":`Machine policy could not be applied.`,"machine.applyPreview":`Apply reviewed preview`,"machine.changedNamespaces":`Changed namespaces`,"machine.capabilityCatalog":`Machine capability catalog`,"machine.capabilityEmpty":`No machine-configurable capabilities are registered.`,"machine.configured":`Configured`,"machine.confirmRollback":`Confirm rollback`,"machine.currentRevision":`Current revision`,"machine.currentValue":`Current machine value`,"machine.description":`Browse the same capability catalog as Goal settings. Configure supported machine defaults here; Goal-only capabilities are labeled explicitly.`,"capabilities.rawJson":`Advanced: raw JSON`,"machine.goalOnly":`This capability currently supports Goal configuration only. Open a Goal’s capability settings to configure it; no machine-wide default is applied.`,"machine.desiredRevision":`Desired revision`,"machine.editorUnavailable":`No editor is installed for this namespace`,"machine.editorUnavailableDescription":`The namespace remains visible in the registry. Install or upgrade its Dashboard editor before changing it.`,"machine.editorMode":`Editor mode`,"machine.liveDefault":`Live default; Goal override wins`,"machine.liveDefaultDescription":`Goals without an explicit override read the current machine policy at the capability’s next decision point. Changes and removal affect those existing Goals immediately; an explicit Goal override stays pinned.`,"machine.genericNamespaceDescription":`Edit this registered namespace as JSON. LoopX validates it with the capability-owned schema before previewing any write.`,"machine.jsonConfiguration":`Namespace configuration (JSON)`,"machine.jsonConfigurationHelp":`Only this namespace is updated. Other machine configuration is preserved, and Apply remains locked to the reviewed preview revision.`,"machine.jsonEditor":`JSON`,"machine.editJson":`Edit JSON`,"capabilities.jsonConfiguration":`Goal configuration (JSON)`,"capabilities.jsonHelp":`Edit registered fields for this Goal. Changes require a new preview before applying.`,"capabilities.jsonInvalid":`Enter a valid JSON object using only registered editable fields.`,"machine.backToForm":`Back to form`,"machine.jsonInvalid":`Enter one valid JSON object before previewing changes.`,"machine.loadError":`Machine configuration could not be loaded.`,"machine.invalidStoredConfiguration":`Stored machine configuration needs repair`,"machine.invalidStoredConfigurationDescription":`Stored values are hidden because they no longer match the installed contract. Review the affected capability, then Preview and Apply its replacement; unrelated namespaces remain unchanged.`,"machine.machinePolicy":`Machine policy`,"machine.namespaceCount":`Registered namespaces`,"machine.namespaces":`Configuration namespaces`,"machine.periodicReport":`Periodic reports`,"machine.periodicReportDescription":`Default report policy for every Goal without an explicit override. Goal scheduling and delivery consume the effective configuration.`,"machine.periodicReportActivation":`Enabled means automatic delivery at validated stage boundaries`,"machine.periodicReportActivationDescription":`This is not a weekly timer. When LoopX validates a Goal stage completion, an Agent prepares and freezes the report, then automatically delivers it through the configured Goal Channel. The enabled subscription is standing delivery authority; failures and route drift stop closed for repair.`,"machine.changeQualityActivation":`Qualification is a quality gate, not new authority`,"machine.changeQualityActivationDescription":`Goals that inherit this policy qualify their exact final diff. safe_fix allows at most one bounded fix pass inside existing write authority; this setting never grants file, permission, or merge authority.`,"machine.replanCadenceActivation":`Review cadence changes timing, not execution authority`,"machine.replanCadenceActivationDescription":`Goals without an explicit override read this threshold before the next review decision. It does not create Turns, spend quota, or grant authority.`,"machine.preview":`Review exact machine change`,"machine.previewChanges":`Preview changes`,"machine.previewError":`A machine-policy preview could not be created.`,"machine.previewLocked":`Apply is locked to this exact revision. If machine state changes, LoopX requires a new preview.`,"machine.previewRollback":`Preview rollback`,"machine.previewRemoval":`Preview removal`,"machine.profilePreset":`Profile preset`,"machine.profilePresetHelp":`A capability-owned preset, such as weekly-progress.`,"machine.registry":`Typed registry`,"machine.requiredFields":`Enable requires a profile preset, Goal Channel route, and valid timezone.`,"machine.revision":`Machine revision`,"machine.revisionLockedReady":`All changes require a preview and apply only while that exact machine revision remains current.`,"machine.rollbackAvailable":`Rollback is available for the last apply`,"machine.rollbackDescription":`Preview the stored prior revision before restoring it.`,"machine.rollbackError":`The rollback could not be completed.`,"machine.rollbackPreviewDescription":`The prior revision is ready to restore. Confirm to apply this rollback.`,"machine.rolledBack":`The prior machine policy was restored and verified.`,"machine.removed":`Machine policy removed and the resulting configuration read back successfully.`,"machine.routeRef":`Goal Channel route`,"machine.routeRefHelp":`Use a public route alias; credentials and provider identifiers never enter this form.`,"machine.timezone":`Timezone`,"machine.timezoneHelp":`Use an IANA timezone, for example Asia/Shanghai.`,"machine.title":`Machine configuration`,"machine.unchanged":`Machine policy already matches this preview; nothing was written.`,"machine.visualEditor":`Guided`,"capabilities.atomicOverride":`Goal override is atomic`,"capabilities.atomicOverrideDescription":`A complete Goal value wins over the machine default. LoopX never mixes individual fields across scopes.`,"capabilities.applyFailed":`Goal capability changes were not applied.`,"capabilities.applyPreview":`Apply preview`,"capabilities.catalog":`Goal capability catalog`,"capabilities.chooseGoal":`Choose a Goal before inspecting its capabilities.`,"capabilities.defaultValue":`Declared default`,"capabilities.description":`Inspect the capabilities available to this Goal and the exact scope of each setting.`,"capabilities.editorPrepared":`Typed editor contract available`,"capabilities.effectiveSource":`Effective source`,"capabilities.empty":`No capability descriptors are available for this Goal.`,"capabilities.fields":`Registered fields`,"capabilities.goalPolicy":`Goal capability policy`,"capabilities.goalScope":`Goal`,"capabilities.goalValue":`Current Goal value`,"capabilities.loadFailed":`Could not load Goal capabilities`,"capabilities.loading":`Loading Goal capabilities…`,"capabilities.machineOnly":`This capability is configured only at machine scope.`,"capabilities.machineValue":`Live machine default`,"capabilities.machineScope":`Machine`,"capabilities.previewOnly":`Inspection is live. Goal writes remain unavailable until the revision-locked preview and apply path is connected.`,"capabilities.preview":`Revision-locked preview`,"capabilities.previewChanges":`Preview changes`,"capabilities.restoreInheritance":`Restore machine-default inheritance`,"capabilities.previewFailed":`Could not preview Goal capability changes.`,"capabilities.previewLocked":`Apply will re-check this exact plan revision and reject stale changes.`,"capabilities.partialWrite":`Goal value saved; shared projection needs reconciliation`,"capabilities.partialWriteDescription":`The source Goal configuration was written and read back. Its shared runtime projection did not synchronize, so do not submit the change again.`,"capabilities.refreshSource":`Refresh source value`,"capabilities.readOnly":`Read-only capability`,"capabilities.revisionLockedReady":`Changes require a preview and are applied only when its exact revision is still current.`,"capabilities.retry":`Retry`,"capabilities.source.capability_default":`Capability default`,"capabilities.source.goal_override":`Goal override`,"capabilities.source.machine_default":`Live machine default`,"capabilities.source.not_configured":`Not configured`,"capabilities.title":`Goal capabilities`,"settings.close":`Close settings`,"settings.appearance":`Appearance`,"settings.appearanceDescription":`Manage workspace display preferences in this browser.`,"settings.appearanceTabDescription":`Theme and display preferences`,"settings.capabilitiesTabDescription":`Capability overrides for this Goal`,"settings.back":`Back to workspace`,"settings.categories":`Settings categories`,"settings.description":`Manage workspace preferences and integrations.`,"settings.eyebrow":`Workspace preferences`,"settings.general":`General`,"settings.goalConnections":`Goal connections`,"settings.language":`Language`,"settings.languageDescription":`Choose the language used by the LoopX desktop workspace.`,"settings.languageEnglishDescription":`Use English for navigation, settings, and workspace controls.`,"settings.languageEnglish":`English`,"settings.languageSimplifiedChineseDescription":`Use Simplified Chinese for navigation, settings, and workspace controls.`,"settings.languageSimplifiedChinese":`Simplified Chinese`,"settings.languageStoredLocally":`This preference is stored only on this device.`,"settings.languageTabDescription":`Interface language for this device`,"settings.larkTabDescription":`Apps, group chats, and Goal Topic connections`,"settings.machineTabDescription":`Typed defaults shared by capabilities on this machine`,"settings.notifications":`Notifications`,"settings.open":`Settings`,"settings.themeDefault":`Paper`,"settings.themeDefaultDescription":`Calm and lightweight for long-running work.`,"settings.themeDescription":`Choose the workspace visual style. This preference is stored in the current browser.`,"settings.themeHighContrast":`High contrast`,"settings.themeHighContrastDescription":`Stronger borders and more prominent state blocks.`,"settings.themeLoopx":`LoopX standard`,"settings.themeLoopxDescription":`Precise monochrome surfaces, Geist type, and quiet hairline structure.`,"settings.title":`Settings`,"settings.workspaceDisplay":`Workspace display`,"settings.workspaceTheme":`Workspace theme`,"session.closeRecord":`Exit run record`,"session.details":`Session details`,"session.record":`Execution Session · Run record`,"session.recordDescription":`The timeline now shows messages and Turn records from this Session.`,"sidebar.createGoal":`Create Goal`,"sidebar.delete":`Delete`,"sidebar.deleteGoal":`Delete Goal`,"sidebar.manager":`LoopX Manager`,"sidebar.notifications":`Settings`,"sidebar.owner":`Personal workspace`,"sidebar.product":`Personal Agent workspace`,"sidebar.resume":`Resume`,"sidebar.resumeGoal":`Resume Goal`,"sidebar.stop":`Stop`,"tasks.historyLoading":`Loading history…`,"tasks.historyError":`History could not be loaded.`,"tasks.historyExpired":`History snapshot expired. Reload to continue.`,"tasks.historyRetry":`Reload`,"tasks.historyEnd":`End of completed history`,"tasks.historyMore":`Load more`,"tasks.historyLocalOnly":`Open this machine’s Dashboard to browse full history.`,"sidebar.sortGoals":`Reorder Goals`,"sidebar.dragGoal":`Drag to reorder, or use Reorder Goals`,"sidebar.moveUp":`Move {goal} up`,"sidebar.moveDown":`Move {goal} down`,"sidebar.goalMoved":`{goal} moved to position {position}`,"sidebar.orderNotSaved":`Order changed for this visit; browser storage is unavailable.`,"sidebar.stopGoal":`Stop Goal`,"sidebar.stopped":`Stopped`,"sidebar.stoppedLoading":`Loading stopped Goals`,"sidebar.stoppedLoadFailed":`Stopped Goals could not be loaded. Active Goals remain available.`,"sidebar.retryStopped":`Retry`,"state.completed":`Completed`,"state.needsRepair":`Needs repair`,"state.needsYou":`Needs you`,"state.quiet":`Quiet`,"state.running":`Running`,"state.stopped":`Stopped`,"state.waiting":`Waiting`,"tasks.blocked":`Blocked`,"tasks.agentLane":`Work Agent`,"tasks.agentLaneDescription":`Filter this Goal's projected work lanes`,"tasks.agentLaneFilter":`Filter by work Agent`,"tasks.allAgentLanes":`All Agents ({count})`,"tasks.chatAgentReplied":`Agent replied`,"tasks.chatPending":`Sent to Agent`,"tasks.chatPendingDescription":`Processing. Tasks update only after a task operation is confirmed.`,"tasks.chatRecent":`Recent conversation`,"tasks.chatUnchangedDescription":`This conversation did not directly change Tasks. Convert the reply to a Task draft and confirm it when execution is needed.`,"tasks.chatViewReply":`View reply`,"tasks.convertToTask":`Convert to Task`,"tasks.completed":`Completed`,"runs.discoveryPartial":`Some execution details are unavailable. Reconnecting; task summaries are not live execution status.`,"runs.discoveryOffline":`Execution service unavailable. Reconnecting; retained task summaries may be stale.`,"files.openConversation":`Go to conversation`,"files.exportSummary":`Export summary`,"tasks.viewDescription":`Decisions first, then work and recent completions`,"tasks.viewLabel":`Task view`,"tasks.listView":`List`,"tasks.boardView":`Board`,"tasks.completedSummary":`{count} tasks completed. Recent details are projected by the control plane when needed.`,"tasks.emptyCompleted":`No completed tasks yet.`,"tasks.emptyConfirm":`No tasks waiting for confirmation.`,"tasks.emptyRunning":`No queued or running tasks.`,"tasks.emptySchedules":`No scheduled tasks.`,"tasks.emptyGoal":`This Goal has no tasks yet. Describe the next step below and LoopX will show a confirmation preview first.`,"tasks.markComplete":`Mark complete: {name}`,"tasks.moreActions":`More actions: {name}`,"tasks.openExecution":`View execution: {name}`,"tasks.pending":`Pending`,"tasks.pendingAndRunning":`Queued / Running`,"tasks.scheduled":`Scheduled & continuous`,"tasks.sessionError":`Session issue`,"tasks.waiting":`Queued`,"tasks.waitingAge":`Waiting {age}`,"tasks.viewExecution":`View execution`,"tasks.viewResult":`View result`,"time.days":`{count} days`,"time.hours":`{count} hours`,"timeline.emptyGoal":`This Goal has no new activity`,"timeline.emptyGoalDescription":`Ask for progress or send new guidance.`,"timeline.emptyWorkspace":`Your workspace is quiet today`,"timeline.emptyWorkspaceDescription":`Describe a Goal to the LoopX Manager, or ask what deserves attention today.`,"timeline.gateHistory":`{count} historical Gates`,"timeline.pending":`Working…`,"returnDelivery.queued":`Return queued`,"returnDelivery.verifying":`Verifying delivery without resending`,"returnDelivery.delivered":`Delivered to the original audience`,"returnDelivery.reconciled":`Delivery verified after recovery`,"returnDelivery.unverified":`Delivery remains explicitly unverified`,"timeline.runCompleted":`{run}: completed`,"timeline.review":`Review`,"timeline.reviewAndConfirm":`Review and confirm`,"timeline.waitingConfirmation":`Needs your confirmation`},"zh-CN":{"acceptance.connected":`已连接`,"acceptance.mapped":`已建立项目映射`,"acceptance.refreshed":`已刷新状态`,"acceptance.inspected":`已检查适配器`,"acceptance.recorded":`已记录执行`,"acceptance.judged":`已记录反馈`,"acceptance.approved":`已记录批准`,"acceptance.ready":`已记录控制器就绪`,"acceptance.attentionSource":`当前状态`,"acceptance.visionSource":`Agent 验收条件`,"acceptance.todoSource":`任务状态`,"acceptance.runSource":`最新执行证据`,"acceptance.title":`验收观察`,"acceptance.unavailable":`验收观测不可用,Goal 是否达成仍未知。`,"acceptance.partial":`当前仅有部分观测。任务完成或缺口列表为空,都不能证明 Goal 已通过验收。`,"acceptance.gaps":`仍需补充的证据`,"acceptance.reasonUnknown":`来源未提供原因`,"acceptance.unknown":`未知`,"acceptance.required":`所需证据或条件`,"acceptance.observed":`观测时间`,"acceptance.noGaps":`现有观测中没有缺口,尚未评估完整验收条件。`,"acceptance.guards":`待处理的门禁决策`,"acceptance.noGuards":`现有观测中没有待处理的门禁决策。`,"acceptance.scope":`决策范围`,"acceptance.next":`当前状态给出的下一步`,"acceptance.historical_progress":`已记录的历史进展`,"acceptance.historical":`历史生命周期记录不授予权限,也不代表通过验收。`,"acceptance.missing":`未获取的来源:`,"acceptance.truncated":`仅展示前 12 条观测。`,"common.actions":`操作`,"common.agent":`Agent`,"common.allMessages":`所有消息`,"common.cancel":`取消`,"common.close":`关闭`,"common.closeActionReceipt":`关闭操作回执`,"common.confirm":`确认`,"common.export":`导出`,"common.failed":`失败`,"common.goal":`Goal`,"common.loading":`加载中…`,"common.none":`无`,"common.off":`关闭`,"common.on":`开启`,"common.open":`打开`,"common.owner":`Owner`,"common.readOnly":`只读`,"common.recently":`刚刚`,"common.status":`状态`,"common.task":`Task`,"common.you":`你`,"common.waiting":`等待中`,"composer.addImage":`添加图片`,"composer.agentProgress":`向 Agent 获取进度报告`,"composer.agentProgressPrompt":`请给我一份当前 Goal 的进度报告:已完成、执行中、阻塞和下一步。`,"composer.attachImageHint":`选择、粘贴或拖入图片`,"composer.clarifyDefer":`暂缓 Todo 需要可自动判断的恢复条件。请补充 todo_done:、pr_merged:[owner/repo]#、capacity_available: 或 resume_at:<带时区 RFC3339 时间>。`,"composer.clarifySingleAction":`这句话包含多个可能修改状态的操作。请一次描述一项操作,我会逐项展示确认预览。`,"composer.createGoal":`创建新 Goal`,"composer.createGoalDraft":`Goal 草稿`,"composer.createGoalDraftDescription":`补充内容后发送,LoopX 会先展示待确认操作。`,"composer.createGoalDraftLead":`我想创建一个长期 Goal:`,"composer.createGoalTemplate":`我想创建一个长期 Goal: 目标: 完成标准: 执行边界(可选): @@ -44,7 +44,7 @@ Goal: Goal: 频率:每天 停止条件:Goal 完成 -通知:仅在需要我时`,"composer.nextAction":`询问下一步`,"composer.nextActionPrompt":`我现在该做什么?`,"composer.prepareDraft":`填入编辑框,确认后再发送`,"composer.send":`发送`,"composer.sendMessage":`向 LoopX 发送消息`,"composer.sendMessageHint":`发送消息`,"composer.sentImageAlt":`移除图片 {name}`,"conversation.agentPending":`正在整理…`,"conversation.close":`关闭对话回执`,"conversation.convertHint":`将 Agent 最新回复转为 Task 草稿`,"conversation.full":`查看完整对话`,"conversation.receipt":`对话回执`,"conversation.replying":`正在回复`,"conversation.title":`管家对话`,"conversation.toTask":`转为 Task`,"digest.away":`自上次访问以来的运行记录`,"digest.completed":`新增完成运行`,"digest.failed":`新增失败或中断`,"digest.needsYou":`当前待确认`,"feedback.applying":`正在执行:{title}`,"feedback.cancelFailed":`取消失败:{error}`,"feedback.completed":`已完成:{title}`,"feedback.executionFailed":`执行失败:{error}`,"feedback.gateRequired":`需要你确认:{summary}`,"feedback.notCompleted":`操作未完成:{status}`,"feedback.goalRefreshFailed":`已打开 Goal,但暂时无法刷新最新状态。请点击刷新重试。`,"feedback.preparingPreview":`正在准备确认预览:{title}`,"feedback.previewFailed":`无法准备确认预览:{error}`,"feedback.sendFailed":`发送失败:{error}`,"feedback.sendGenericError":`消息发送失败,请稍后重试。`,"feedback.stale":`状态已变化,操作未执行,请重新生成确认预览。`,"feedback.taskDraftCreated":`已根据回复生成 Task 草稿。编辑后发送,LoopX 会先展示确认预览。`,"goal.defaultTitle":`新的个人 Goal`,"goal.initialTodo":`按完成标准推进:{criteria}`,"goal.objectiveBoundary":`执行边界:{boundary}`,"goal.objectiveCompletion":`完成标准:{criteria}`,"drawer.advancedDiagnostics":`高级诊断`,"drawer.agentWorking":`Agent 正在继续执行,记录会自动更新。`,"drawer.analysis":`正在分析`,"drawer.apply":`确认并应用`,"drawer.applying":`正在应用…`,"drawer.attentionBlocking":`正在阻塞 Agent`,"drawer.attentionWaiting":`等待你的决定`,"drawer.autoNotify":`Human-gate 自动通知`,"drawer.branch":`分支`,"drawer.closeDetail":`关闭详情:返回{context}`,"drawer.connected":`已连接`,"drawer.correctionDescription":`消息会沿用当前 Goal、Todo 与 Agent Session 上下文。`,"drawer.correctionLabel":`与 {agent} 纠偏`,"drawer.correctionPlaceholder":`例如:先关注权限风险,暂时不要提交…`,"drawer.correctionSend":`发送纠偏`,"drawer.correctionTextarea":`输入纠偏信息:Goal {goal},Agent {agent},Run {run}`,"drawer.copyRepository":`复制仓库标识`,"drawer.copyRepositoryDone":`已复制仓库标识`,"drawer.copyRepositoryError":`复制失败,请检查浏览器剪贴板权限。`,"drawer.copyRepositorySuccess":`已复制,可粘贴到其他工具。`,"drawer.cost":`成本 24h / 7d`,"drawer.costShort":`成本`,"drawer.durationShort":`时长`,"drawer.period24h":`24 小时`,"drawer.period7d":`7 天`,"drawer.tokens":`Token 24 小时 / 7 天`,"drawer.tokensShort":`Token`,"drawer.usageNotMeasured":`未采集`,"drawer.currentGoal":`当前 Goal`,"attentionDetail.title":`事项说明`,"attentionDetail.request":`需要你做什么`,"attentionDetail.decision":`需要作出决定`,"attentionDetail.unknownRequest":`来源未明确,请先查看来源再判断`,"attentionDetail.open":`当前投影中待处理`,"attentionDetail.closed":`已关闭`,"attentionDetail.deferred":`已推迟`,"attentionDetail.superseded":`已被替代`,"attentionDetail.unknown":`来源未提供状态`,"attentionDetail.unavailable":`来源尚未确认当前事项,请刷新后再操作`,"attentionDetail.unknownReason":`来源尚未提供原因。`,"attentionDetail.targetTodo":`关联的待解锁 Todo`,"attentionDetail.targetAgent":`事项指定的 Agent`,"attentionDetail.scope":`声明的决策范围`,"attentionDetail.notProvided":`来源未提供`,"attentionDetail.replacement":`替代 Todo`,"attentionDetail.openReplacement":`打开替代事项`,"attentionDetail.boundary":`阅读详情不会关闭 gate 或授予权限;作出决定前仍需新的操作预览。`,"drawer.decisionDefaultEvidence":`当前状态没有附加公开安全证据;下一步仍会先展示 Preview。`,"drawer.decisionDefaultReason":`该决定会影响当前 Todo 的下一步执行。`,"drawer.decisionDefer":`稍后决定`,"drawer.decisionMore":`更多决定`,"drawer.decisionReject":`拒绝`,"drawer.decisionReview":`查看影响并决定`,"drawer.dependencies":`依赖`,"drawer.detailsAndActions":`详情与操作`,"drawer.duration":`运行时长 24h / 7d`,"drawer.evidence":`证据`,"drawer.executionHistory":`执行历史`,"drawer.executionRecord":`运行记录`,"drawer.executionRecordAndResult":`执行过程与结果`,"drawer.explainDecision":`解释此决定`,"drawer.gateApproveHint":`在终端执行一条命令即可完成审批:`,"drawer.gateRejectHint":`不同意就把末尾的 approve 换成 reject。执行后这条提醒会自动消失。`,"drawer.gateRequiresHost":`需要宿主确认`,"drawer.gateRequiresHostDescription":`页面无权直接批准这类权限变更,你的点击没有写入任何内容。`,"drawer.goalAutoRun":`当前 Goal 的自动运行`,"drawer.goalChanges":`当前 Goal 的待确认变更`,"drawer.goalDetails":`Goal 详情`,"drawer.group":`群聊`,"drawer.inspectorFull":`切换到全屏`,"drawer.inspectorFullView":`全屏查看`,"drawer.inspectorHalf":`切换到半屏`,"drawer.inspectorHalfView":`半屏查看`,"drawer.lastNotification":`最近通知`,"drawer.larkConfigure":`管理 Lark connection`,"drawer.larkConnect":`连接 Lark App`,"drawer.larkConnection":`Lark connection`,"drawer.larkNotConfigured":`未配置`,"drawer.larkNotConfiguredDescription":`配置后,当这个 Goal 出现需要你确认的变更时,会自动发飞书通知。`,"drawer.managerChanges":`管家待确认变更`,"drawer.moreActions":`更多操作`,"drawer.moreRunActions":`更多运行操作`,"drawer.nextTransition":`下一转换`,"drawer.noExecutionHistory":`暂无执行记录。`,"drawer.noRun":`尚未启动执行 Session`,"drawer.noRunDescription":`Agent 开始执行后,运行记录会稳定显示在这里。`,"drawer.notAssigned":`未分配`,"drawer.notLinked":`未关联`,"drawer.notSet":`未设置`,"drawer.outputDetails":`产出详情`,"drawer.outputRecorded":`该产出已记录到当前 Goal。`,"drawer.outputSafePreview":`公开安全产出预览`,"drawer.outputRun":`Run`,"drawer.outputTodo":`Todo`,"drawer.outputs":`本次运行产出`,"drawer.previewUnavailable":`此产出没有可用的公开安全内联预览。`,"drawer.priority":`优先级`,"drawer.progress":`进度`,"drawer.proposalApplied":`已应用,LoopX 状态将刷新。`,"drawer.proposalApplyFailed":`应用失败,没有写入任何变更。`,"drawer.proposalApplyFailedHint":`请刷新 Goal 状态后重新生成;若仍失败,可保留此页并查看高级诊断。`,"drawer.proposalClose":`关闭`,"drawer.proposalDefer":`稍后`,"drawer.proposalDeferred":`已暂缓,可稍后继续应用或重新生成。`,"drawer.proposalEnterGoal":`进入新 Goal`,"drawer.proposalExplainer":`确认后,LoopX 会执行这项变更并显示写入结果。关闭或取消不会修改任何状态。`,"drawer.proposalRecheck":`按最新状态重新检查`,"drawer.proposalRegenerate":`基于最新状态重试`,"drawer.proposalRejected":`已拒绝,这项变更不会写入。`,"drawer.proposalStale":`来源状态已变化,请按最新状态重新检查。`,"drawer.proposalViewGoal":`查看更新后的 Goal`,"drawer.reassign":`改派给`,"drawer.reassignSummary":`重新分配:{task}`,"drawer.reason":`原因`,"drawer.recoveryDescription":`本地历史已经保留,请选择恢复路径。`,"drawer.recoveryFailed":`上游 Session 恢复失败`,"drawer.recoveryNewSession":`携带上下文开始新 Session`,"drawer.recoveryRetry":`重试恢复`,"drawer.repositoryRole":`执行工作区`,"drawer.repository":`仓库`,"drawer.replyMode":`回复方式`,"drawer.subagentApplied":`已写入,并通过共享 Goal 状态读回校验。`,"drawer.subagentAppliedRefreshFailed":`已写入并通过共享 Goal 状态读回;状态投影刷新失败,可稍后手动刷新。`,"drawer.subagentApplying":`正在写入并校验共享状态读回…`,"drawer.subagentApplyFailed":`子代理设置写入失败。`,"drawer.subagentChildLimit":`当前上限`,"drawer.subagentConfirmDisable":`确认关闭子代理执行`,"drawer.subagentConfirmEnable":`确认开启子代理执行`,"drawer.subagentCurrentBoundary":`当前任务领域限制`,"drawer.subagentDescription":`仅在 Todo、配额、能力和写入范围门禁全部通过后,允许运行时为相互独立的任务临时创建子代理;不会强制并行,也不会授予持久权限。`,"drawer.subagentDisable":`预览关闭子代理执行`,"drawer.subagentDisableSummary":`这个 Goal 将不再创建新的子代理;现有 Todo 归属和执行记录不受影响。`,"drawer.subagentDomainInvalid":`所选任务领域限制无效。`,"drawer.subagentDomainTodoCount":`匹配 {count} 个开放 Todo`,"drawer.subagentDomains":`任务领域限制(可选)`,"drawer.subagentDomainsEmpty":`当前没有开放的 advancement Todo 声明 task_domain;保持为空即可不按任务领域限制子代理执行。`,"drawer.subagentDomainsHint":`全部不选表示不按任务领域过滤;选择后只放行匹配且已声明领域的 Todo,其他执行门禁始终生效。`,"drawer.subagentDomainsUnrestricted":`不限制任务领域`,"drawer.subagentEnable":`预览开启子代理执行`,"drawer.subagentLabel":`Per-Goal 执行边界`,"drawer.subagentModel":`子 Agent 模型`,"drawer.subagentEffort":`子 Agent 推理档位`,"drawer.subagentModelDefault":`宿主默认`,"drawer.subagentLunaPreset":`使用 Luna / max`,"drawer.subagentClearModel":`清除模型偏好`,"drawer.subagentModelHint":`填写后通过“预览配置调整”保存,执行关闭时也可保存偏好;启动时须核验宿主支持情况。`,"drawer.subagentModelRequired":`设置推理档位前请先指定子 Agent 模型。`,"drawer.subagentMaxChildren":`最多子代理数`,"drawer.subagentNoChange":`当前 Goal 已是这个设置,没有写入任何内容。`,"drawer.subagentPending":`待确认`,"drawer.subagentPreviewBoundary":`预览配置调整`,"drawer.subagentPreviewFailed":`无法生成子代理设置预览。`,"drawer.subagentPreviewing":`正在核对最新 Goal 状态…`,"drawer.subagentPreviewReady":`预览已锁定,确认后才会写入这个 Goal。`,"drawer.subagentPreviewSummary":`最多允许创建 {count} 个子代理;任务领域限制:{domains}。`,"drawer.subagentRemoteReadOnly":`当前来源只读,请在 Goal 所在主机上修改。`,"drawer.subagentTitle":`自适应子代理执行`,"drawer.remoteDetailsDescription":`SSH 来源只展示公开安全状态,不读取来源主机上的连接配置。`,"drawer.remoteDetailsUnavailable":`远端详情未投影`,"drawer.resumeNo":`否`,"drawer.resumeYes":`是`,"drawer.runDetails":`执行 Session`,"drawer.runInterrupt":`中断本次运行`,"drawer.runLatest":`查看最近执行过程`,"drawer.runNewSession":`开始新 Session`,"drawer.runCloseSession":`关闭 Session`,"drawer.runRecordEmpty":`还没有运行记录。Agent 尚未开始这次执行;请在“详情与操作”查看等待条件或恢复 Session。`,"drawer.runRecordProjected":`当前没有可展示的逐步运行记录。LoopX 已读取到 {completed}/{total} 的投影进度{outputs};请在“详情与操作”检查 Session 状态。`,"drawer.runRecordProjectedOutputs":`和 {count} 项产出`,"drawer.runRoleAssistant":`已完成`,"drawer.runRoleSystem":`需检查`,"drawer.runRoleUser":`收到任务`,"drawer.runView":`Session 视图`,"drawer.scheduleAdd":`添加定时检查`,"drawer.scheduleDefaultNotification":`仅在需要你时通知`,"drawer.scheduleDefaultStop":`Goal 完成或 owner 停止`,"drawer.scheduleDefaultTarget":`由 LoopX 调度器按 Goal 配置唤醒。`,"drawer.scheduleEdit":`改为每 2 小时`,"drawer.scheduleLast":`上次执行`,"drawer.scheduleLocalTimezone":`本地时区`,"drawer.scheduleNext":`下次执行`,"drawer.scheduleNeverRun":`尚未执行`,"drawer.scheduleNotification":`通知`,"drawer.schedulePause":`暂停`,"drawer.schedulePending":`等待调度`,"drawer.scheduleResume":`恢复`,"drawer.scheduleRunNow":`立即运行`,"drawer.scheduleStop":`停止{kind}`,"drawer.scheduleStopCondition":`停止条件`,"drawer.scheduleTimezone":`时区`,"drawer.sessionRecoverable":`可恢复`,"drawer.sessionStatus":`会话状态`,"drawer.setupHeartbeat":`设置 Heartbeat`,"drawer.taskActions":`Todo 待确认操作`,"drawer.taskAdvancement":`推进任务`,"drawer.taskBlock":`标记阻塞`,"drawer.taskComplete":`标记完成`,"drawer.taskCompletedNote":`该任务保留为只读记录。`,"drawer.taskCompletedTitle":`任务已完成`,"drawer.taskDefer":`暂缓`,"drawer.taskDeferCondition":`Todo 暂缓恢复条件`,"drawer.taskDeferInvalid":`条件格式不受支持;请使用下列可判定条件。`,"drawer.taskDeferPlaceholder":`例如 resume_at:2026-09-14T09:00:00+08:00`,"drawer.taskDeferReview":`检查暂缓`,"drawer.taskDeferSupported":`支持 todo_done、pr_merged、capacity_available 与带时区的 resume_at 条件。`,"drawer.taskDeferUntil":`暂缓至`,"drawer.taskDetails":`Todo 详情`,"drawer.taskInfo":`任务信息`,"drawer.taskManage":`管理任务`,"drawer.taskNextCompleted":`可创建后续任务`,"drawer.taskNextOpen":`推进或更新状态`,"drawer.taskOrdinary":`普通任务`,"drawer.taskStatusBlocked":`受阻`,"drawer.taskStatusDeferred":`已延期`,"drawer.resumeWhen":`恢复条件`,"drawer.resumeState":`恢复状态`,"drawer.resumePending":`等待条件满足`,"drawer.resumeReady":`可恢复`,"drawer.resumeReceipt":`恢复回执`,"drawer.taskNextDeferred":`等待恢复条件满足后重新评估`,"drawer.taskNextResumeReady":`恢复条件已满足,等待生命周期重新规划`,"drawer.taskStatusCompleted":`已完成`,"drawer.taskStatusOpen":`待执行`,"drawer.taskSuccessor":`创建后续 Todo`,"drawer.taskSuccessorNote":`Owner 标记为阻塞,等待补充上下文。`,"drawer.taskSuccessorSummary":`创建后续 Todo:{task}`,"drawer.taskSuccessorText":`{task} 的后续工作`,"drawer.taskType":`任务类型`,"drawer.topic":`Topic`,"drawer.trigger":`触发方式`,"drawer.titleAttention":`需要你`,"drawer.titleOutput":`产出详情`,"drawer.titleProposalApplied":`执行结果`,"drawer.titleProposalConfirm":`确认执行`,"drawer.titleSchedule":`定时检查`,"drawer.unconfigured":`未配置`,"drawer.workspaceCandidates":`可选择的工作区`,"files.emptySummary":`公开安全产出`,"files.empty":`还没有文件、产出或已验证的阶段周报。`,"files.loadingReports":`正在加载已验证的阶段周报…`,"files.reportDelta":`+{added} 新增 · {changed} 变化`,"files.reportAdded":`新增`,"files.reportChanged":`变化`,"files.reportGeneration":`生成批次`,"files.reportLoadFailed":`无法加载已验证周报`,"files.reportPublication":`发布批次`,"files.title":`Files & Outputs`,"files.verifiedReport":`已验证阶段周报`,"header.agentUnavailable":`不可用`,"header.chatRuntime":`Chat`,"header.workAgentCount":`{count} 个工作 Agent`,"header.chat":`Chat`,"header.files":`Files`,"header.goalCapabilities":`能力配置`,"header.goalCapabilitiesDescription":`管理 Goal override 与继承的本机默认值。`,"header.goalDetails":`Goal 详情`,"header.goalDetailsDescription":`查看状态、用量、仓库、通知与 Session。`,"header.goalSettings":`Goal 设置`,"header.goalSettingsDescription":`打开 Goal 详情或能力配置`,"header.goalNavigation":`Goal 导航`,"header.goalView":`Goal 视图`,"header.live":`实时`,"header.manager":`LoopX 管家`,"header.managerDescription":`跨 Goal 的个人工作入口`,"header.managerRuntime":`{profile} · {sandbox}`,"header.managerRuntimeFallback":`配置无效,已回退到 {profile} · {sandbox};请在机器能力设置中修复。`,"header.managerOverview":`总览`,"header.managerView":`管家视图`,"header.openGoalNavigation":`打开 Goal 导航`,"header.readOnlySourceDescription":`{source} 通过 SSH 隧道只读展示`,"header.refresh":`刷新状态`,"header.refreshDone":`刚刚更新`,"header.refreshFailed":`刷新失败`,"header.refreshing":`刷新中`,"header.selectAgent":`选择 Agent`,"header.selectChatRuntime":`选择聊天 Runtime`,"header.tasks":`Tasks`,"header.themeBrutal":`切换到野兽主题`,"header.themePaper":`切换到默认主题`,"home.blockingSummary":`其中 {count} 项正在阻塞 Agent。`,"home.completedGoals":`已完成的 Goal`,"home.empty":`当前没有`,"startup.goalLoading":`正在加载状态…`,"startup.goalError":`状态加载失败`,"startup.progress":`已加载 {loaded} / {total} 个活跃 Goal`,"startup.partial":`Goal 状态正在逐个更新,当前统计尚不完整。`,"startup.independent":`此 Goal 的加载不会阻塞其他 Goal,你可以先查看已加载的内容。`,"startup.error.timeout":`读取超时,可在本地服务就绪后重试。`,"startup.error.network":`连接中断,请重试以重新连接。`,"startup.error.service":`Goal 状态读取失败。请稍后重试;若问题持续,请检查状态来源。`,"startup.error.access":`状态来源无法访问此 Goal 所需的文件或运行时目录。请检查该来源运行账户的访问权限,修复后重试。`,"startup.error.revision":`加载期间 Goal 目录发生变化,请刷新以同步。`,"startup.error.scope":`该 Goal 已不在当前来源中,请刷新目录。`,"startup.error.invalid":`无法解析状态响应,请刷新或检查 LoopX 更新。`,"startup.retry":`重试`,"startup.retryFailed":`重试失败的 Goal`,"startup.failedCount":`{count} 个 Goal 加载失败,已加载的 Goal 可继续使用。`,"home.greeting":`你好,我是 LoopX 管家`,"home.history":`历史`,"home.lane.needsYou":`需要你`,"home.lane.needsYouDescription":`等待你的决定、授权或补充信息`,"home.lane.observing":`观察中`,"home.lane.observingDescription":`持续监控,出现变化时再提醒你`,"home.lane.running":`执行中`,"home.lane.runningDescription":`Agent 正在推进并持续回传进展`,"home.lane.scheduled":`已安排`,"home.lane.scheduledDescription":`已经安排,等待时间或前置条件`,"home.noActivity":`尚无活动`,"home.noFirstActivity":`等待首次活动`,"home.noCompletedGoals":`还没有已完成的 Goal`,"home.preservedState":`保留状态,可随时恢复`,"home.stopped":`已停止`,"home.systemHealth":`系统健康:{summary}`,"home.taskCount":`{count} 个 Task`,"home.todayAt":`今天 {time}`,"home.waitingCount":`你有 {count} 项需要处理。`,"home.workspace":`Goal 工作区`,"lark.allMessages":`此 Topic 中的所有消息`,"lark.allTopicMessages":`所有 Topic 消息`,"lark.agentIngress":`Agent 入站方式`,"lark.agentAppPermissions":`每个选中的 Agent 都需要一个已具备群聊提及和回复能力的 Lark App。`,"lark.agentApps":`每个 Agent 的 Lark App`,"lark.agentAppsDescription":`默认使用上方 App;需要独立机器人身份时,可为 Agent 选择另一个兼容 App。`,"lark.agentAppSelection":`{agent} 的 Lark App`,"lark.appCreated":`App 已创建`,"lark.appCreateFailed":`创建失败`,"lark.appLoading":`正在加载可用的 Lark Apps…`,"lark.appPermissions":`该 App 能发送建联消息,但缺少接收群聊 @ 消息或自动回复所需的机器人权限。请开启 im:message.group_at_msg:readonly、im:message.send_as_bot 和事件 im.message.receive_v1,发布新版后刷新。`,"lark.appProfile":`Lark App`,"lark.apps":`Lark Apps`,"lark.autoReplyUnavailable":`自动回复暂不可用`,"lark.autoReplyReady":`自动回复可用`,"lark.bindGoal":`绑定到 Goal`,"lark.cancel":`取消`,"lark.cardinality":`一个 Lark App · 多个 Goal · 每个 Agent 一条隔离路由`,"lark.capture":`接收范围`,"lark.captureAddressed":`仅接收提及 App 或回复 App 的消息`,"lark.captureAll":`接收此 Goal Topic 中的所有消息`,"lark.captureScope":`接收范围`,"lark.captureScopeDescription":`决定哪些 Topic 消息会进入 LoopX;不会扩大 Agent 权限。`,"lark.closeConnection":`关闭连接弹窗`,"lark.closeCreate":`关闭创建弹窗`,"lark.closeSettings":`关闭 Lark 设置`,"lark.connect":`连接`,"lark.connectAllAgents":`连接全部已注册 Agent`,"lark.connectAllAgentsAction":`一键连接 {count} 个 Agent`,"lark.connectAllAgentsDescription":`一次引导创建 {count} 个隔离的 Agent Topic;请在对应 Topic 内发送请求,每个 Agent 保留独立路由和收件箱。`,"lark.connectApp":`连接 Lark App`,"lark.connection":`连接`,"lark.connections":`连接`,"lark.configuration":`Lark 配置`,"lark.continueFeishu":`在飞书中继续`,"lark.createAutomatically":`自动创建 Goal Topic`,"lark.createAutomaticallyDescription":`将为每个选中的 Agent 创建带 Agent 标识的专属 Topic。`,"lark.defaultAgentAppDescription":`用于查找目标群聊,并作为所有选中 Agent 的默认 App;下方的逐 Agent 选择可覆盖它。`,"lark.description":`管理可复用的 Lark App,并用独立 Topic 将群聊连接到 Goal。`,"lark.editConnection":`编辑 Lark 连接`,"lark.goalConnections":`{count} 个 Goal 连接`,"lark.goalTopicConnections":`Lark Goal Topic 连接`,"lark.groupChat":`群聊`,"lark.groupEmpty":`该机器人尚未加入可连接的群。请先在飞书群设置中添加这个机器人,再回来刷新或搜索。`,"lark.groupLoading":`正在读取该机器人已加入的群…`,"lark.groupSearch":`搜索该机器人已加入的群`,"lark.historyPermission":`历史补读权限(独立能力)`,"lark.health.eventProcessed":`已处理 {events} 条事件,成功回复 {replies} 条。`,"lark.health.eventUnverified":`事件订阅待验证`,"lark.health.eventUnverifiedDetail":`Provider listener 已就绪,但尚未收到消息事件。请启用 im.message.receive_v1、开通群聊 @ 消息权限并发布新版,然后在这个 Agent Topic 内发送新的 @ 消息;存在多条 Agent 路由时,群顶层消息会 fail closed。`,"lark.health.ignoredSelf":`已忽略机器人自身发送的消息,避免重复回复。`,"lark.health.invalidRouting":`路由配置无效`,"lark.health.invalidRoutingDetail":`连接已安全停用,请重新选择处理方式并保存。`,"lark.health.lastStatus":`最近事件状态:{status}`,"lark.health.listening":`监听中`,"lark.health.messageContextPermission":`消息权限不足`,"lark.health.messageContextPermissionDetail":`已收到消息事件,但无法读取群消息上下文。请发布并授权该 App 的群消息读取权限。`,"lark.health.notAddressed":`最近消息未直接 @ 机器人`,"lark.health.notAddressedDetail":`监听正常;当前连接只响应直接 @ 机器人或对机器人的回复。`,"lark.health.notStarted":`监听未启动`,"lark.health.notStartedDetail":`请刷新连接或重新启动 LoopX 后再试。`,"lark.health.processingFailed":`消息处理失败`,"lark.health.processingFailedDetail":`已收到消息事件,但 Agent 处理失败。请查看本地诊断后重试。`,"lark.health.queued":`已进入 Agent 收件箱`,"lark.health.queuedDetail":`消息由 {agent} 异步处理,不会启动通用 Chat Session。`,"lark.health.sourceDisconnected":`实时消息连接断开`,"lark.health.sourceDisconnectedDetail":`消息监听进程意外退出。请核对应用档案的平台:飞书应用选飞书,国际版 Lark 应用选 Lark,再检查连接及订阅错误。LoopX 正在重试;历史消息能读取,不代表能实时收消息。`,"lark.health.retrying":`监听重试中`,"lark.health.retryingDetail":`事件监听暂时中断,LoopX 正在自动重试。`,"lark.health.routeAmbiguous":`消息匹配多个 Goal`,"lark.health.routeAmbiguousDetail":`同一 Bot 和群聊存在多个完整群捕获连接。请让每个 Agent 使用独立 Bot,或只保留一个完整群连接。`,"lark.health.routeMismatch":`消息未匹配当前 Goal Topic`,"lark.health.routeMismatchDetail":`事件来自其他群聊或 Topic。请重新选择群聊并连接该 Goal,然后发送一条新的 @ 消息。`,"lark.health.routeUnavailable":`消息无法路由到 Goal`,"lark.health.routeUnavailableDetail":`当前连接信息不完整。请重新连接该 Goal 后再发送一条新的 @ 消息。`,"lark.health.starting":`正在启动`,"lark.health.startingDetail":`LoopX 正在启动该 App 的消息事件监听。`,"lark.health.unavailable":`自动回复不可用`,"lark.health.waiting":`等待处理`,"lark.incomingMessages":`接收消息`,"lark.ingressAsync":`异步收件箱`,"lark.ingressAsyncDescription":`写入 Agent 私有收件箱,等待后续显式处理。`,"lark.editPreservesIdentity":`保存会保留此 App、群和 Topic;旧连接默认升级为 Agent 异步收件箱。`,"lark.conversationKind":`连接用途`,"lark.managerConversation":`管家 · 同步对话`,"lark.workerConversation":`工作 Agent · 后台任务`,"lark.managerConversationDescription":`内置管家即时回应对话,长任务交给后台 Agent。群聊与私聊分别保存上下文。`,"lark.ingressLegacy":`待升级`,"lark.ingressLegacyDescription":`保存连接即可升级为 Agent 异步收件箱,已有消息保留在原 Topic 中。`,"lark.ingressQueue":`排队`,"lark.ingressQueueDescription":`进入同一 Agent Session 的有界 FIFO 队列,当前 Turn 完成后处理。`,"lark.ingressSteering":`实时引导`,"lark.ingressSteeringDescription":`投到当前活跃 Turn;没有精确活跃 Turn 时安全拒绝。`,"lark.loading":`加载 Lark 配置…`,"lark.management":`Lark 管理`,"lark.openEventSettings":`查看飞书事件配置`,"lark.mentions":`提及机器人`,"lark.mentionsOnly":`仅提及消息`,"lark.needsMessagePermissions":`需要消息权限`,"lark.needsSetup":`需要设置`,"lark.newApp":`新建 Lark App`,"lark.noAgentConfigured":`未配置 Agent`,"lark.noConnections":`暂无匹配的连接。`,"lark.noProfiles":`还没有可用的 lark-cli App profile。`,"lark.profileName":`Profile 名称`,"lark.profileValidation":`Profile 只能包含字母、数字、点、下划线和连字符。`,"lark.processing":`处理方式`,"lark.region":`区域`,"lark.registerAnother":`+ 注册另一个 Lark App — 通过飞书创建`,"lark.reopenFeishu":`重新打开飞书`,"lark.settingsConfigure":`配置 {goal}`,"lark.settingsDisconnect":`解绑 {goal}`,"lark.replyMode":`回复方式`,"lark.replyModeDescription":`当前只支持在来源 Topic 内回复,避免跨群或跨 Goal 投递。`,"lark.reusableApps":`{count} 个可复用 App`,"lark.reusableWorkspaceApp":`可复用工作区 App`,"lark.routesUnverified":`{count} 条 Lark 路由尚未验证`,"lark.saveConnection":`保存连接`,"lark.searchConnections":`搜索 Lark 连接`,"lark.searchPlaceholder":`搜索 App、群、Goal 或 Topic`,"lark.setupCopy":`LoopX 将通过 lark-cli 打开飞书官方创建页面。应用凭证保存在系统 Keychain,LoopX 只保留 profile 引用。`,"lark.someoneMentions":`有人提及 Agent`,"lark.targetAgent":`目标 Agent`,"lark.targetAgentDescription":`选择该 Goal 内已注册的 Agent。此连接只投递给一个 Agent,不广播、不授予新权限。实时引导与排队需要该 Agent 的精确活跃 Session。`,"lark.agentUnavailable":`{agent} · 已不可用`,"lark.selectRegisteredAgent":`请先选择可用的已注册 Agent;不会自动替换原先的接收者。`,"lark.topicPreview":`Topic 预览`,"lark.topicReply":`Topic 回复`,"lark.trigger":`触发方式`,"lark.waitingFeishu":`等待飞书完成创建`,"lark.waitingFeishuDescription":`请在新窗口中完成飞书授权,完成后会自动回到这里。`,"lark.waitingLink":`正在生成飞书官方创建链接…`,"lark.error.appCreate":`Lark App 创建失败`,"lark.error.appRequired":`请选择一个 Lark App profile。`,"lark.error.bind":`绑定失败`,"lark.error.bindPreview":`绑定预览失败`,"lark.error.configuration":`Lark 配置加载失败`,"lark.error.groupLookup":`无法读取该机器人已加入的群。请检查机器人状态后重试。`,"lark.error.groupLoad":`群聊加载失败`,"lark.error.invalidApp":`Lark App profile 不可用或尚未完成授权。`,"lark.error.messagePermissions":`该 App 缺少自动回复所需的机器人权限。请开启 im:message.group_at_msg:readonly 和 im:message:send_as_bot,发布新版后回来刷新重试。`,"lark.error.provider":`飞书 API 调用失败,且没有生成已验证回执。请稍后重试。`,"lark.error.setupPoll":`创建状态查询失败`,"lark.error.setupStart":`无法启动 Lark App 创建流程`,"lark.error.cliExecutable":`已找到配置的 lark-cli,但当前无法执行。请检查安装或启动参数。`,"lark.error.cliMissing":`未发现 lark-cli。请先安装 lark-cli,然后重新启动 LoopX。`,"lark.error.cliStart":`lark-cli 启动失败。请检查安装状态,然后重新启动 LoopX。`,"lark.error.disconnect":`解绑失败`,"notifications.autoNotify":`需要你确认时自动推送到群里`,"notifications.bind":`绑定到通知群`,"notifications.bindConfirm":`将把「{goal}」绑定到通知群「{target}」,绑定时会验证机器人在群内并发送一条确认消息。`,"notifications.bindFailed":`绑定失败`,"notifications.bound":`已绑定`,"notifications.confirmBind":`确认绑定`,"notifications.description":`把 Goal 里需要你确认的变更推送到飞书群。绑定和开关在这里完成,推送逻辑沿用现有通道。`,"notifications.disabled":`已停用`,"notifications.group":`通知群:{target}`,"notifications.loadFailed":`通知群列表加载失败`,"notifications.noTargets":`还没有可用的通知群。通知群涉及机器人私有身份,请先在终端配置一次:`,"notifications.notBound":`未绑定`,"notifications.recent":`最近 {time}`,"notifications.sentCount":`已发送 {count} 条`,"notifications.settings":`Goal 通知绑定`,"notifications.setupFailed":`设置失败`,"notifications.title":`飞书群通知`,"proposal.field.agentId":`Agent`,"proposal.field.cadence":`频率`,"proposal.field.completionCriteria":`完成标准`,"proposal.field.executionBoundary":`执行边界`,"proposal.field.goalId":`Goal ID`,"proposal.field.heartbeat":`Heartbeat`,"proposal.field.initialTodos":`首个任务`,"proposal.field.objective":`目标`,"proposal.field.operation":`操作`,"proposal.field.operationState":`操作状态`,"proposal.field.resultDelivery":`结果回传`,"proposal.field.confirmationBoundary":`确认边界`,"proposal.field.expiresAt":`过期时间`,"proposal.field.permission":`权限`,"proposal.field.reason":`原因`,"proposal.field.stopCondition":`停止条件`,"proposal.field.target":`检查内容`,"proposal.field.timezone":`时区`,"proposal.field.title":`标题`,"proposal.field.workspace":`执行工作区`,"actionReview.targetChanged":`预览目标与请求的 Goal 或操作不一致,请重新生成预览。`,"actionReview.ready_stop":`暂停可恢复。此预览已通过检查,可直接执行;完成仍需要读回验证。`,"actionReview.resume_review":`恢复自动调度前需要确认。实际执行仍受额度、Gate 和 Todo 约束。`,"actionReview.delete_review":`请确认从注册表移除这个已停止 Goal。项目文件与历史记录会保留。`,"actionReview.action_review":`执行前请检查此提案的目标与影响。`,"actionReview.protected_action":`此操作需要明确审阅。确认不能替代所需授权。`,"actionReview.unknown_permission":`无法识别权限分类。请重新检查提案后再继续。`,"actionReview.unknown_action":`无法识别此生命周期操作。请重新检查提案后再继续。`,"actionReview.incomplete_proposal":`预览缺少验证信息或可执行转换。请重新生成预览。`,"actionReview.authority_gate":`Gate 阻止执行。请满足其要求后重新检查提案。`,"actionReview.stale_proposal":`来源状态已变化。请重新生成预览,原决定不再适用。`,"actionReview.apply_pending":`正在执行,请等待读回结果后再重试。`,"actionReview.readback_verified":`操作已完成,结果状态已通过读回验证。`,"actionReview.readback_unverified":`操作返回但未通过读回验证。尚不能确认完成,请重新检查状态。`,"actionReview.operation_group_confirmation":`这份精确请求只能在已绑定飞书群的原始卡片确认;Dashboard 不提供本地执行入口。`,"actionReview.operation_result_delivery_pending":`操作结果已经记录,但原群结果卡尚未通过回读核验。`,"actionReview.apply_failed":`执行未完成。请检查失败原因并重新生成预览后再试。`,"actionReview.inactive_proposal":`此提案当前不可执行。请重新检查后再继续。`,"proposal.gate.default":`需要宿主确认`,"proposal.impact.default":`确认后会调用规范 LoopX 服务写入状态。`,"proposal.impact.goalCreate":`确认后会创建 Goal 和首个 Todo,并让选定 Agent 开始首轮推进。`,"proposal.impact.lifecycleDelete":`确认后会从 source registry 和 global registry 移除这个已停止 Goal;项目文件、历史状态文件和备份不会被删除。`,"proposal.impact.lifecycleResume":`确认后会恢复 Goal 的自动调度资格并移回 Active Goals;实际执行仍受 quota、Gate 和 Todo 约束。`,"proposal.impact.lifecycleStop":`确认后会停止自动推进,并将 Goal 移入折叠的「已停止」列表;历史、Todo 和证据都会保留,可随时恢复。`,"proposal.impact.protected":`该操作需要通过受保护的 LoopX 写入服务完成。`,"proposal.impact.operation":`这里仅展示同一份不可变条款。请在已绑定的飞书群确认或拒绝;确认只会消费一个规范 claim。`,"proposal.primary.apply":`确认并应用`,"proposal.primary.goalCreate":`创建 Goal 并开始首轮`,"proposal.primary.lifecycleDelete":`删除 Goal`,"proposal.primary.lifecycleResume":`恢复 Goal`,"proposal.primary.lifecycleStop":`停止 Goal`,"proposal.primary.todoStart":`创建任务并开始执行`,"proposal.primary.operationGroup":`前往飞书群确认`,"proposal.primary.operationResultPending":`结果卡回传待恢复`,"proposal.primary.operationResultVerified":`结果已核验`,"proposal.resultDelivery.verified":`已在原群卡片完成回读核验`,"proposal.resultDelivery.pending":`等待回传并核验原群卡片`,"proposal.summary.goalCreate":`创建 Goal:{title}`,"proposal.summary.heartbeat":`为当前 Goal 设置 Heartbeat`,"proposal.summary.lifecycleDelete":`删除 Goal:{title}`,"proposal.summary.lifecycleResume":`恢复 Goal:{title}`,"proposal.summary.lifecycleStop":`停止 Goal:{title}`,"proposal.summary.monitor":`为当前 Goal 创建定时检查:{target}`,"proposal.workspace.current":`当前本地工作区(未绑定 Repository)`,"proposal.workspace.named":`{workspace}(仅提供执行环境,不会自动关联仓库)`,"proposal.workspaceGate.agentImpact":`先完成 Agent 身份绑定,再重新检查原操作;当前没有写入 Goal。`,"proposal.workspaceGate.agentTitle":`先绑定 Agent`,"proposal.workspaceGate.defaultSummary":`请选择 Goal 所属工作区。`,"proposal.workspaceGate.selectionImpact":`选择工作区后会重新展示待确认操作,选择本身不会写入状态。`,"proposal.workspaceGate.selectionTitle":`选择 Goal 工作区`,"projection.agentAdvancingGoal":`Agent 正在推进当前 Goal`,"projection.agentIdle":`暂无需要你处理`,"projection.agentNeedsDecision":`Agent 等待你的决定`,"projection.agentPreparingNextStep":`Agent 正在整理下一步`,"projection.agentStopped":`已由你停止;历史、Todo 和证据仍保留`,"projection.agentWaitingExternal":`正在等待外部条件`,"projection.confirmAgentDecision":`请确认 Agent 下一步需要的权限或决策`,"projection.events24h":`24 小时内 {count} 个事件`,"projection.firstReadOnlyAdapterCheck":`执行首次只读适配检查并保存进度`,"projection.goalVerified":`Goal 状态、Todo 与注册信息已验证`,"projection.latestRun":`最近运行`,"projection.latestValidation":`最近验证`,"projection.nextUpdatePending":`等待 LoopX 更新下一步`,"projection.publicSafeProjection":`公开安全状态投影`,"projection.refreshState":`刷新 LoopX 状态,确认当前进度仍然有效`,"projection.runEvidenceAvailable":`存在可查看的运行证据`,"projection.runRecorded":`最近一次 LoopX 运行已经记录`,"projection.statusRefreshNeeded":`LoopX 状态需要刷新`,"projection.todoStatusUpdated":`Todo 状态已经更新,正在确认下一步`,"projection.validationRecorded":`最近验证已经记录`,"runs.completed":`已完成`,"runs.failed":`需检查`,"runs.interrupted":`已中断`,"runs.queued":`已安排`,"runs.ready":`可继续`,"runs.resumeFailed":`恢复失败`,"runs.running":`执行中`,"runs.unknown":`状态未知`,"runs.waiting":`等待条件`,"schedule.active":`执行中`,"schedule.heartbeat":`Goal Heartbeat`,"schedule.monitor":`定时与持续任务`,"schedule.paused":`已暂停`,"schedule.summary":`按 LoopX 调度约束持续检查`,"schedule.defaultTarget":`检查当前 Goal 的阻塞、进度与新产出`,"schedule.unsupportedCalendar":`当前定时检查不支持精确到星期或时刻的日历计划。请改用固定间隔,例如“每 30 分钟”“每 2 小时”或“每天”;草稿已保留,没有生成待确认操作。`,"source.add":`添加来源`,"source.addConfigured":`添加只读来源`,"source.addMethod":`来源添加方式`,"source.addSsh":`添加 SSH 隧道来源`,"source.closeForm":`关闭来源表单`,"source.configured":`已配置 SSH`,"source.configuredCount":`本机 SSH Host · {count} 个`,"source.configuredGroup":`已配置 SSH Host · {count}(点击快速添加)`,"source.connected":`已连接`,"source.connecting":`连接中`,"source.controlPlane":`控制面来源`,"source.copy":`复制`,"source.copyCommand":`复制 SSH 隧道命令`,"source.copyError":`无法复制命令,请手动复制下方命令。`,"source.copied":`已复制`,"source.description":`已读取全部显式 Host(含 Include);通配规则不会作为具体来源。先运行命令,LoopX 不读取密钥或配置细节。`,"source.host":`本机 SSH Host`,"source.hostEmpty":`~/.ssh/config 中没有可直接选择的显式 Host。`,"source.hostLoadError":`无法读取本机 SSH Host。`,"source.hostPlaceholder":`输入或搜索 Host`,"source.invalid":`SSH 来源参数无效。`,"source.loadingHosts":`正在读取…`,"source.localInteractive":`本机交互`,"source.localPort":`本地端口`,"source.manual":`手动 URL`,"source.manualDescription":`远端来源始终按只读投影处理,不继承本机写权限。`,"source.name":`名称`,"source.namePlaceholder":`远程开发机`,"source.notAvailable":`不可用`,"source.readOnly":`SSH 隧道 · 只读`,"source.readOnlyNoticeDescription":`你可以查看 Goal、Task、证据与运行状态;写入、纠偏和 Agent 会话仍留在来源主机。`,"source.readOnlyNoticeTitle":`远端只读投影`,"source.readOnlyWriteError":`远端 SSH 隧道来源是只读投影,不能执行控制面写入。`,"source.refreshHosts":`重新读取 SSH Host`,"source.remove":`移除来源 {source}`,"source.removeCurrent":`移除当前来源`,"source.select":`选择控制面来源`,"source.selectHost":`请选择已配置的 SSH Host。`,"source.statusUrl":`本地转发 URL`,"source.tunnelCommandPending":`选择 Host 后生成隧道命令`,"machine.absent":`尚未配置`,"machine.action.create":`创建机器策略`,"machine.action.delete":`移除机器策略`,"machine.action.unchanged":`无需写入`,"machine.action.update":`更新机器策略`,"machine.applied":`机器策略已应用,并通过回读校验。`,"machine.applyError":`无法应用机器策略。`,"machine.applyPreview":`应用已审阅预览`,"machine.changedNamespaces":`变更的 Namespace`,"machine.capabilityCatalog":`机器能力目录`,"machine.capabilityEmpty":`当前没有注册可在机器作用域配置的能力。`,"machine.configured":`已配置`,"machine.confirmRollback":`确认回滚`,"machine.currentRevision":`当前 Revision`,"machine.currentValue":`当前机器值`,"machine.description":`与 Goal 设置共用能力目录。在这里管理受支持的机器默认值;仅支持 Goal 配置的能力会明确标注。`,"capabilities.rawJson":`高级:原始 JSON`,"machine.goalOnly":`此能力目前仅支持 Goal 级配置。请打开具体 Goal 的能力设置进行配置;这里不会设置机器级默认值。`,"machine.desiredRevision":`目标 Revision`,"machine.editorUnavailable":`当前版本未安装此 Namespace 的编辑器`,"machine.editorUnavailableDescription":`它仍会显示在 Registry 中;安装或升级对应的 Dashboard 编辑器后才能修改。`,"machine.editorMode":`编辑模式`,"machine.liveDefault":`实时默认值;Goal 显式覆盖优先`,"machine.liveDefaultDescription":`没有显式覆盖的 Goal 会在该能力下一次决策时读取当前机器策略。修改或移除策略会立即影响这些已有 Goal;显式 Goal 覆盖保持固定。`,"machine.genericNamespaceDescription":`使用 JSON 编辑这个已注册 Namespace。LoopX 会先按 capability 自己拥有的 schema 校验,再允许预览写入。`,"machine.jsonConfiguration":`Namespace 配置(JSON)`,"machine.jsonConfigurationHelp":`只更新当前 Namespace;其他机器配置会保留,Apply 仍锁定到已审阅的 Preview Revision。`,"machine.jsonEditor":`JSON`,"machine.editJson":`编辑 JSON`,"capabilities.jsonConfiguration":`Goal 配置(JSON)`,"capabilities.jsonHelp":`仅编辑当前 Goal 的已注册字段。修改后需重新预览才能应用。`,"capabilities.jsonInvalid":`请输入合法的 JSON 对象,且仅包含已注册的可编辑字段。`,"machine.backToForm":`返回表单`,"machine.jsonInvalid":`请先填写一个合法的 JSON object,再预览变更。`,"machine.loadError":`无法读取机器配置。`,"machine.invalidStoredConfiguration":`已保存的机器配置需要修复`,"machine.invalidStoredConfigurationDescription":`已保存值不再符合当前契约,因此不会在这里显示。请检查已定位的能力,并通过“预览”和“应用”替换它;无关 namespace 保持不变。`,"machine.machinePolicy":`机器策略`,"machine.namespaceCount":`已注册 Namespace`,"machine.namespaces":`配置 Namespace`,"machine.periodicReport":`周期报告`,"machine.periodicReportDescription":`为所有未显式覆盖的 Goal 提供默认报告策略;Goal 调度与发送消费解析后的有效配置。`,"machine.periodicReportActivation":`开启后将在已验证的阶段节点自动投递`,"machine.periodicReportActivationDescription":`这不是每周定时器。当 LoopX 验证 Goal 已完成一个阶段时,Agent 会生成并冻结报告,随后通过配置的 Goal Channel 自动发送。启用此订阅即授予持续投递权;发送失败或路由漂移会 fail closed 并进入修复。`,"machine.changeQualityActivation":`质量验证是质量门禁,不是新增授权`,"machine.changeQualityActivationDescription":`继承该策略的 Goal 会验证最终精确 diff。safe_fix 只允许在既有写入权限内执行至多一次有界修复;此设置不会授予文件、权限或合并权。`,"machine.replanCadenceActivation":`复核周期只改变时机,不改变执行权限`,"machine.replanCadenceActivationDescription":`没有显式覆盖的 Goal 会在下一次复核决策前读取此阈值;它不会创建 Turn、消耗配额或授予权限。`,"machine.preview":`审阅机器配置变更`,"machine.previewChanges":`预览变更`,"machine.previewError":`无法生成机器策略预览。`,"machine.previewLocked":`应用操作锁定到当前 Revision;若机器状态变化,LoopX 会要求重新预览。`,"machine.previewRollback":`预览回滚`,"machine.previewRemoval":`预览移除`,"machine.profilePreset":`Profile preset`,"machine.profilePresetHelp":`由 capability 管理的 preset,例如 weekly-progress。`,"machine.registry":`Typed Registry`,"machine.requiredFields":`开启后必须填写 profile preset、Goal Channel route 与有效时区。`,"machine.revision":`机器 Revision`,"machine.revisionLockedReady":`所有变更必须先预览;只有对应的机器 Revision 仍然有效时才会应用。`,"machine.rollbackAvailable":`可回滚上一次应用`,"machine.rollbackDescription":`先预览已保存的前一 Revision,再决定是否恢复。`,"machine.rollbackError":`无法完成回滚。`,"machine.rollbackPreviewDescription":`前一 Revision 已准备恢复,请确认执行本次回滚。`,"machine.rolledBack":`已恢复前一版机器策略,并通过校验。`,"machine.removed":`机器策略已移除,并通过回读校验。`,"machine.routeRef":`Goal Channel route`,"machine.routeRefHelp":`只填写公开 route alias;凭据与 provider identifier 不会进入此表单。`,"machine.timezone":`时区`,"machine.timezoneHelp":`填写 IANA 时区,例如 Asia/Shanghai。`,"machine.title":`机器配置`,"machine.unchanged":`机器策略已与预览一致,本次没有写入。`,"machine.visualEditor":`引导式`,"capabilities.atomicOverride":`Goal override 按完整配置生效`,"capabilities.atomicOverrideDescription":`Goal 的完整配置优先于机器默认值;LoopX 不会在两个作用域之间逐字段拼接。`,"capabilities.applyFailed":`Goal 能力变更未写入。`,"capabilities.applyPreview":`应用此预览`,"capabilities.catalog":`Goal 能力目录`,"capabilities.chooseGoal":`请先选择一个 Goal,再查看它的能力配置。`,"capabilities.defaultValue":`声明的默认值`,"capabilities.description":`查看当前 Goal 可用的能力,以及每项配置的准确作用域。`,"capabilities.editorPrepared":`已注册 typed editor contract`,"capabilities.effectiveSource":`当前生效来源`,"capabilities.empty":`当前 Goal 没有可用的能力描述。`,"capabilities.fields":`已注册字段`,"capabilities.goalPolicy":`Goal 能力策略`,"capabilities.goalScope":`Goal`,"capabilities.goalValue":`当前 Goal 值`,"capabilities.loadFailed":`无法加载 Goal 能力`,"capabilities.loading":`正在加载 Goal 能力…`,"capabilities.machineOnly":`此能力只能在机器作用域配置。`,"capabilities.machineValue":`实时机器默认值`,"capabilities.machineScope":`机器`,"capabilities.previewOnly":`当前读取结果来自真实配置;在 revision-locked preview/apply 路径接通前,Dashboard 不会提供 Goal 写入控件。`,"capabilities.preview":`锁定 revision 的变更预览`,"capabilities.previewChanges":`预览变更`,"capabilities.restoreInheritance":`恢复继承机器默认值`,"capabilities.previewFailed":`无法预览 Goal 能力变更。`,"capabilities.previewLocked":`应用时会重新校验这一个 plan revision;过期变更将被拒绝。`,"capabilities.partialWrite":`Goal 值已保存;共享投影仍需修复`,"capabilities.partialWriteDescription":`源 Goal 配置已经写入并回读,但共享 runtime 投影尚未同步;请勿重复提交本次变更。`,"capabilities.refreshSource":`刷新源配置`,"capabilities.readOnly":`只读能力`,"capabilities.revisionLockedReady":`所有变更必须先预览;只有对应的精确 revision 仍然有效时才会写入。`,"capabilities.retry":`重试`,"capabilities.source.capability_default":`能力默认值`,"capabilities.source.goal_override":`Goal override`,"capabilities.source.machine_default":`实时机器默认值`,"capabilities.source.not_configured":`未配置`,"capabilities.title":`Goal 能力`,"settings.close":`关闭设置`,"settings.appearance":`外观`,"settings.appearanceDescription":`管理当前浏览器里的工作区显示偏好。`,"settings.appearanceTabDescription":`主题和显示偏好`,"settings.capabilitiesTabDescription":`当前 Goal 的能力覆盖配置`,"settings.back":`返回工作区`,"settings.categories":`设置分类`,"settings.description":`管理工作区偏好与集成。`,"settings.eyebrow":`工作区偏好`,"settings.general":`通用`,"settings.goalConnections":`Goal 连接`,"settings.language":`语言`,"settings.languageDescription":`选择 LoopX Desktop 工作区使用的界面语言。`,"settings.languageEnglishDescription":`使用英文显示导航、设置和工作区控件。`,"settings.languageEnglish":`English`,"settings.languageSimplifiedChineseDescription":`使用简体中文显示导航、设置和工作区控件。`,"settings.languageSimplifiedChinese":`简体中文`,"settings.languageStoredLocally":`此偏好仅保存在当前设备。`,"settings.languageTabDescription":`当前设备的界面语言`,"settings.larkTabDescription":`App、群聊和 Goal Topic 连接`,"settings.machineTabDescription":`本机各 Capability 共享的 typed defaults`,"settings.notifications":`通知`,"settings.open":`设置`,"settings.themeDefault":`纸张`,"settings.themeDefaultDescription":`安静、轻量,适合长期查看。`,"settings.themeDescription":`选择工作区的视觉风格。设置会保存在当前浏览器本地。`,"settings.themeHighContrast":`高对比`,"settings.themeHighContrastDescription":`更强边框和更醒目的状态块。`,"settings.themeLoopx":`LoopX 标准`,"settings.themeLoopxDescription":`精确的黑白界面、Geist 字体与安静的细线结构。`,"settings.title":`设置`,"settings.workspaceDisplay":`工作区显示`,"settings.workspaceTheme":`工作区主题`,"session.closeRecord":`退出运行记录`,"session.details":`Session 详情`,"session.record":`执行 Session · 运行记录`,"session.recordDescription":`当前时间线已切换到这次 Session 的消息与 Turn 记录。`,"sidebar.createGoal":`创建 Goal`,"sidebar.delete":`删除`,"sidebar.deleteGoal":`删除 Goal`,"sidebar.manager":`LoopX 管家`,"sidebar.notifications":`设置`,"sidebar.owner":`个人工作区`,"sidebar.product":`个人 Agent 工作区`,"sidebar.resume":`恢复`,"sidebar.resumeGoal":`恢复 Goal`,"sidebar.stop":`停止`,"tasks.historyLoading":`正在加载历史…`,"tasks.historyError":`历史加载失败,已显示的内容仍可查看。`,"tasks.historyExpired":`历史快照已过期,重新加载后可继续查看。`,"tasks.historyRetry":`重新加载`,"tasks.historyEnd":`已显示全部完成记录`,"tasks.historyMore":`加载更多`,"tasks.historyLocalOnly":`请打开这台机器的 Dashboard 查看完整历史。`,"sidebar.sortGoals":`调整 Goal 顺序`,"sidebar.dragGoal":`拖拽调整顺序,或使用列表排序按钮`,"sidebar.moveUp":`上移 {goal}`,"sidebar.moveDown":`下移 {goal}`,"sidebar.goalMoved":`{goal} 已移至第 {position} 位`,"sidebar.orderNotSaved":`顺序已在本次页面生效;浏览器存储不可用,无法保存。`,"sidebar.stopGoal":`停止 Goal`,"sidebar.stopped":`已停止`,"sidebar.stoppedLoading":`正在加载已停止 Goal`,"sidebar.stoppedLoadFailed":`已停止 Goal 加载失败,其他 Goal 仍可使用。`,"sidebar.retryStopped":`重试`,"state.completed":`已完成`,"state.needsRepair":`需修复`,"state.needsYou":`等你`,"state.quiet":`安静运行`,"state.running":`推进中`,"state.stopped":`已停止`,"state.waiting":`等待条件`,"tasks.blocked":`受阻`,"tasks.agentLane":`工作 Agent`,"tasks.agentLaneDescription":`筛选这个 Goal 下的工作泳道`,"tasks.agentLaneFilter":`按工作 Agent 筛选`,"tasks.allAgentLanes":`全部 Agent({count})`,"tasks.chatAgentReplied":`Agent 已回复`,"tasks.chatPending":`已发送给 Agent`,"tasks.chatPendingDescription":`正在处理;只有经过确认的任务操作才会更新 Tasks。`,"tasks.chatRecent":`最近对话`,"tasks.chatUnchangedDescription":`本次对话没有直接修改 Tasks。需要执行时,可先转成 Task 草稿并确认。`,"tasks.chatViewReply":`查看回复`,"tasks.convertToTask":`转为 Task`,"tasks.completed":`已完成`,"runs.discoveryPartial":`部分执行详情暂不可用,正在重连;任务摘要不代表实时执行状态。`,"runs.discoveryOffline":`执行服务暂不可用,正在重连;保留的任务摘要可能已过时。`,"files.openConversation":`前往会话`,"files.exportSummary":`导出摘要`,"tasks.viewDescription":`先处理待确认,再查看工作与完成记录`,"tasks.viewLabel":`任务视图`,"tasks.listView":`列表`,"tasks.boardView":`看板`,"tasks.completedSummary":`已完成 {count} 项,近期完成明细由控制面按需投影。`,"tasks.emptyCompleted":`还没有完成的任务。`,"tasks.emptyConfirm":`没有待确认的任务。`,"tasks.emptyRunning":`没有待执行或进行中的任务。`,"tasks.emptySchedules":`没有定时任务。`,"tasks.emptyGoal":`这个 Goal 还没有任务。用下面的输入框描述下一步,LoopX 会先展示待确认操作。`,"tasks.markComplete":`标记完成:{name}`,"tasks.moreActions":`更多操作:{name}`,"tasks.openExecution":`查看执行过程:{name}`,"tasks.pending":`待处理`,"tasks.pendingAndRunning":`待执行 / 进行中`,"tasks.scheduled":`定时与持续`,"tasks.sessionError":`Session 异常`,"tasks.waiting":`待执行`,"tasks.waitingAge":`已等待 {age}`,"tasks.viewExecution":`查看执行过程`,"tasks.viewResult":`查看结果`,"time.days":`{count} 天`,"time.hours":`{count} 小时`,"timeline.emptyGoal":`这个 Goal 还没有新动态`,"timeline.emptyGoalDescription":`你可以直接询问进度或下发新的纠偏信息。`,"timeline.emptyWorkspace":`今天的工作区很安静`,"timeline.emptyWorkspaceDescription":`向 LoopX 管家描述一个 Goal,或询问今天最值得关注的事情。`,"timeline.gateHistory":`{count} 项历史 Gate`,"timeline.pending":`正在整理…`,"timeline.runCompleted":`{run}:已完成`,"timeline.review":`查看处理方式`,"timeline.reviewAndConfirm":`查看并确认`,"timeline.waitingConfirmation":`待你确认`}};function Wi(e,t){return t?Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e):e}function Gi(){try{return window.localStorage.getItem(`loopx-pw-locale`)===`en`?`en`:`zh-CN`}catch{return`zh-CN`}}function Ki({children:e}){let[t,n]=(0,V.useState)(Gi);function r(e){n(e);try{window.localStorage.setItem(Hi,e)}catch{}}(0,V.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,V.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Wi(Ui[t][e],n)}),[t]);return(0,H.jsx)(Vi.Provider,{value:i,children:e})}function qi(){let e=(0,V.useContext)(Vi);if(!e)throw Error(`useWorkspaceI18n must be used within WorkspaceI18nProvider`);return e}function Ji(e,t){let n={安静运行:`state.quiet`,等你:`state.needsYou`,等待条件:`state.waiting`,推进中:`state.running`,需修复:`state.needsRepair`,已完成:`state.completed`,已停止:`state.stopped`}[e];return n?Ui[t][n]:e}function Yi(e,t){let n={busy:`runs.running`,completed:`runs.completed`,failed:`runs.failed`,queued:`runs.queued`,ready:`runs.ready`,resume_failed:`runs.resumeFailed`,running:`runs.running`,waiting:`runs.waiting`};return e?n[e]?t(n[e]):e:t(`runs.unknown`)}function Xi(e,t){if(!e)return null;let n=new Date(e).getTime();if(Number.isNaN(n))return null;let r=Date.now()-n;if(r<36e5)return null;let i=Math.floor(r/864e5);return i>=1?t(`time.days`,{count:i}):t(`time.hours`,{count:Math.floor(r/36e5)})}var Zi;function U(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;en?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Qi=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},$i=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Zi=globalThis).__zod_globalConfig??(Zi.__zod_globalConfig={});var ea=globalThis.__zod_globalConfig;function ta(e){return e&&Object.assign(ea,e),ea}function na(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ra(e,t){return typeof t==`bigint`?t.toString():t}function ia(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function aa(e){return e==null}function oa(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function sa(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){};function ha(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ga=ia(()=>{if(ea.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function _a(e){if(ha(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ha(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function va(e){return _a(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ya=new Set([`string`,`number`,`symbol`]);function ba(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xa(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function W(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Sa(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Ca={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function wa(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return xa(e,da(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ua(this,`shape`,e),e},checks:[]}))}function Ta(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return xa(e,da(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ua(this,`shape`,r),r},checks:[]}))}function Ea(e,t){if(!_a(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xa(e,da(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ua(this,`shape`,n),n}}))}function Da(e,t){if(!_a(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return xa(e,da(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ua(this,`shape`,n),n}}))}function Oa(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return xa(e,da(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ua(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ka(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return xa(t,da(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return ua(this,`shape`,i),i},checks:[]}))}function Aa(e,t,n){return xa(t,da(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return ua(this,`shape`,i),i}}))}function ja(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Pa(e){return typeof e==`string`?e:e?.message}function Fa(e,t,n){let r=e.message?e.message:Pa(e.inst?._zod.def?.error?.(e))??Pa(t?.error?.(e))??Pa(n.customError?.(e))??Pa(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Ia(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function La(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ra=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ra,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},za=U(`$ZodError`,Ra),Ba=U(`$ZodError`,Ra,{Parent:Error});function Va(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ha(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Qi;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Fa(e,a,ta())));throw ma(t,i?.callee),t}return o.value},Wa=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Fa(e,a,ta())));throw ma(t,i?.callee),t}return o.value},Ga=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Qi;return a.issues.length?{success:!1,error:new(e??za)(a.issues.map(e=>Fa(e,i,ta())))}:{success:!0,data:a.value}},Ka=Ga(Ba),qa=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Fa(e,i,ta())))}:{success:!0,data:a.value}},Ja=qa(Ba),Ya=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ua(e)(t,n,i)},Xa=e=>(t,n,r)=>Ua(e)(t,n,r),Za=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Wa(e)(t,n,i)},Qa=e=>async(t,n,r)=>Wa(e)(t,n,r),$a=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ga(e)(t,n,i)},eo=e=>(t,n,r)=>Ga(e)(t,n,r),to=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qa(e)(t,n,i)},no=e=>async(t,n,r)=>qa(e)(t,n,r),ro=/^[cC][0-9a-z]{6,}$/,io=/^[0-9a-z]+$/,ao=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,oo=/^[0-9a-vA-V]{20}$/,so=/^[A-Za-z0-9]{27}$/,co=/^[a-zA-Z0-9_-]{21}$/,lo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,uo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,fo=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,po=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,mo=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function ho(){return new RegExp(mo,`u`)}var go=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_o=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,vo=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,yo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,xo=/^[A-Za-z0-9_-]*$/,So=/^https?$/,Co=/^\+[1-9]\d{6,14}$/,wo=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,To=RegExp(`^${wo}$`);function Eo(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Do(e){return RegExp(`^${Eo(e)}$`)}function Oo(e){let t=Eo({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${wo}T(?:${r})$`)}var ko=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ao=/^-?\d+$/,jo=/^-?\d+(?:\.\d+)?$/,Mo=/^(?:true|false)$/i,No=/^null$/i,Po=/^[^A-Z]*$/,Fo=/^[^a-z]*$/,Io=U(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Lo={number:`number`,bigint:`bigint`,object:`date`},Ro=U(`$ZodCheckLessThan`,(e,t)=>{Io.init(e,t);let n=Lo[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{Io.init(e,t);let n=Lo[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bo=U(`$ZodCheckMultipleOf`,(e,t)=>{Io.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):sa(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Vo=U(`$ZodCheckNumberFormat`,(e,t)=>{Io.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ca[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Ao)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Ho=U(`$ZodCheckMaxLength`,(e,t)=>{var n;Io.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!aa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value;if(r.length<=t.maximum)return;let i=Ia(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Uo=U(`$ZodCheckMinLength`,(e,t)=>{var n;Io.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!aa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ia(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wo=U(`$ZodCheckLengthEquals`,(e,t)=>{var n;Io.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!aa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ia(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Go=U(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Io.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ko=U(`$ZodCheckRegex`,(e,t)=>{Go.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),qo=U(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Po,Go.init(e,t)}),Jo=U(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Fo,Go.init(e,t)}),Yo=U(`$ZodCheckIncludes`,(e,t)=>{Io.init(e,t);let n=ba(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Xo=U(`$ZodCheckStartsWith`,(e,t)=>{Io.init(e,t);let n=RegExp(`^${ba(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Zo=U(`$ZodCheckEndsWith`,(e,t)=>{Io.init(e,t);let n=RegExp(`.*${ba(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Qo=U(`$ZodCheckOverwrite`,(e,t)=>{Io.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),$o=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` +通知:仅在需要我时`,"composer.nextAction":`询问下一步`,"composer.nextActionPrompt":`我现在该做什么?`,"composer.prepareDraft":`填入编辑框,确认后再发送`,"composer.send":`发送`,"composer.sendMessage":`向 LoopX 发送消息`,"composer.sendMessageHint":`发送消息`,"composer.sentImageAlt":`移除图片 {name}`,"conversation.agentPending":`正在整理…`,"conversation.close":`关闭对话回执`,"conversation.convertHint":`将 Agent 最新回复转为 Task 草稿`,"conversation.full":`查看完整对话`,"conversation.receipt":`对话回执`,"conversation.replying":`正在回复`,"conversation.title":`管家对话`,"conversation.toTask":`转为 Task`,"digest.away":`自上次访问以来的运行记录`,"digest.completed":`新增完成运行`,"digest.failed":`新增失败或中断`,"digest.needsYou":`当前待确认`,"feedback.applying":`正在执行:{title}`,"feedback.cancelFailed":`取消失败:{error}`,"feedback.completed":`已完成:{title}`,"feedback.executionFailed":`执行失败:{error}`,"feedback.gateRequired":`需要你确认:{summary}`,"feedback.notCompleted":`操作未完成:{status}`,"feedback.goalRefreshFailed":`已打开 Goal,但暂时无法刷新最新状态。请点击刷新重试。`,"feedback.preparingPreview":`正在准备确认预览:{title}`,"feedback.previewFailed":`无法准备确认预览:{error}`,"feedback.sendFailed":`发送失败:{error}`,"feedback.sendGenericError":`消息发送失败,请稍后重试。`,"feedback.stale":`状态已变化,操作未执行,请重新生成确认预览。`,"feedback.taskDraftCreated":`已根据回复生成 Task 草稿。编辑后发送,LoopX 会先展示确认预览。`,"goal.defaultTitle":`新的个人 Goal`,"goal.initialTodo":`按完成标准推进:{criteria}`,"goal.objectiveBoundary":`执行边界:{boundary}`,"goal.objectiveCompletion":`完成标准:{criteria}`,"drawer.advancedDiagnostics":`高级诊断`,"drawer.agentWorking":`Agent 正在继续执行,记录会自动更新。`,"drawer.analysis":`正在分析`,"drawer.apply":`确认并应用`,"drawer.applying":`正在应用…`,"drawer.attentionBlocking":`正在阻塞 Agent`,"drawer.attentionWaiting":`等待你的决定`,"drawer.autoNotify":`Human-gate 自动通知`,"drawer.branch":`分支`,"drawer.closeDetail":`关闭详情:返回{context}`,"drawer.connected":`已连接`,"drawer.correctionDescription":`消息会沿用当前 Goal、Todo 与 Agent Session 上下文。`,"drawer.correctionLabel":`与 {agent} 纠偏`,"drawer.correctionPlaceholder":`例如:先关注权限风险,暂时不要提交…`,"drawer.correctionSend":`发送纠偏`,"drawer.correctionTextarea":`输入纠偏信息:Goal {goal},Agent {agent},Run {run}`,"drawer.copyRepository":`复制仓库标识`,"drawer.copyRepositoryDone":`已复制仓库标识`,"drawer.copyRepositoryError":`复制失败,请检查浏览器剪贴板权限。`,"drawer.copyRepositorySuccess":`已复制,可粘贴到其他工具。`,"drawer.cost":`成本 24h / 7d`,"drawer.costShort":`成本`,"drawer.durationShort":`时长`,"drawer.period24h":`24 小时`,"drawer.period7d":`7 天`,"drawer.tokens":`Token 24 小时 / 7 天`,"drawer.tokensShort":`Token`,"drawer.usageNotMeasured":`未采集`,"drawer.currentGoal":`当前 Goal`,"attentionDetail.title":`事项说明`,"attentionDetail.request":`需要你做什么`,"attentionDetail.decision":`需要作出决定`,"attentionDetail.unknownRequest":`来源未明确,请先查看来源再判断`,"attentionDetail.open":`当前投影中待处理`,"attentionDetail.closed":`已关闭`,"attentionDetail.deferred":`已推迟`,"attentionDetail.superseded":`已被替代`,"attentionDetail.unknown":`来源未提供状态`,"attentionDetail.unavailable":`来源尚未确认当前事项,请刷新后再操作`,"attentionDetail.unknownReason":`来源尚未提供原因。`,"attentionDetail.targetTodo":`关联的待解锁 Todo`,"attentionDetail.targetAgent":`事项指定的 Agent`,"attentionDetail.scope":`声明的决策范围`,"attentionDetail.notProvided":`来源未提供`,"attentionDetail.replacement":`替代 Todo`,"attentionDetail.openReplacement":`打开替代事项`,"attentionDetail.boundary":`阅读详情不会关闭 gate 或授予权限;作出决定前仍需新的操作预览。`,"drawer.decisionDefaultEvidence":`当前状态没有附加公开安全证据;下一步仍会先展示 Preview。`,"drawer.decisionDefaultReason":`该决定会影响当前 Todo 的下一步执行。`,"drawer.decisionDefer":`稍后决定`,"drawer.decisionMore":`更多决定`,"drawer.decisionReject":`拒绝`,"drawer.decisionReview":`查看影响并决定`,"drawer.dependencies":`依赖`,"drawer.detailsAndActions":`详情与操作`,"drawer.duration":`运行时长 24h / 7d`,"drawer.evidence":`证据`,"drawer.executionHistory":`执行历史`,"drawer.executionRecord":`运行记录`,"drawer.executionRecordAndResult":`执行过程与结果`,"drawer.explainDecision":`解释此决定`,"drawer.gateApproveHint":`在终端执行一条命令即可完成审批:`,"drawer.gateRejectHint":`不同意就把末尾的 approve 换成 reject。执行后这条提醒会自动消失。`,"drawer.gateRequiresHost":`需要宿主确认`,"drawer.gateRequiresHostDescription":`页面无权直接批准这类权限变更,你的点击没有写入任何内容。`,"drawer.goalAutoRun":`当前 Goal 的自动运行`,"drawer.goalChanges":`当前 Goal 的待确认变更`,"drawer.goalDetails":`Goal 详情`,"drawer.group":`群聊`,"drawer.inspectorFull":`切换到全屏`,"drawer.inspectorFullView":`全屏查看`,"drawer.inspectorHalf":`切换到半屏`,"drawer.inspectorHalfView":`半屏查看`,"drawer.lastNotification":`最近通知`,"drawer.larkConfigure":`管理 Lark connection`,"drawer.larkConnect":`连接 Lark App`,"drawer.larkConnection":`Lark connection`,"drawer.larkNotConfigured":`未配置`,"drawer.larkNotConfiguredDescription":`配置后,当这个 Goal 出现需要你确认的变更时,会自动发飞书通知。`,"drawer.managerChanges":`管家待确认变更`,"drawer.moreActions":`更多操作`,"drawer.moreRunActions":`更多运行操作`,"drawer.nextTransition":`下一转换`,"drawer.noExecutionHistory":`暂无执行记录。`,"drawer.noRun":`尚未启动执行 Session`,"drawer.noRunDescription":`Agent 开始执行后,运行记录会稳定显示在这里。`,"drawer.notAssigned":`未分配`,"drawer.notLinked":`未关联`,"drawer.notSet":`未设置`,"drawer.outputDetails":`产出详情`,"drawer.outputRecorded":`该产出已记录到当前 Goal。`,"drawer.outputSafePreview":`公开安全产出预览`,"drawer.outputRun":`Run`,"drawer.outputTodo":`Todo`,"drawer.outputs":`本次运行产出`,"drawer.previewUnavailable":`此产出没有可用的公开安全内联预览。`,"drawer.priority":`优先级`,"drawer.progress":`进度`,"drawer.proposalApplied":`已应用,LoopX 状态将刷新。`,"drawer.proposalApplyFailed":`应用失败,没有写入任何变更。`,"drawer.proposalApplyFailedHint":`请刷新 Goal 状态后重新生成;若仍失败,可保留此页并查看高级诊断。`,"drawer.proposalClose":`关闭`,"drawer.proposalDefer":`稍后`,"drawer.proposalDeferred":`已暂缓,可稍后继续应用或重新生成。`,"drawer.proposalEnterGoal":`进入新 Goal`,"drawer.proposalExplainer":`确认后,LoopX 会执行这项变更并显示写入结果。关闭或取消不会修改任何状态。`,"drawer.proposalRecheck":`按最新状态重新检查`,"drawer.proposalRegenerate":`基于最新状态重试`,"drawer.proposalRejected":`已拒绝,这项变更不会写入。`,"drawer.proposalStale":`来源状态已变化,请按最新状态重新检查。`,"drawer.proposalViewGoal":`查看更新后的 Goal`,"drawer.reassign":`改派给`,"drawer.reassignSummary":`重新分配:{task}`,"drawer.reason":`原因`,"drawer.recoveryDescription":`本地历史已经保留,请选择恢复路径。`,"drawer.recoveryFailed":`上游 Session 恢复失败`,"drawer.recoveryNewSession":`携带上下文开始新 Session`,"drawer.recoveryRetry":`重试恢复`,"drawer.repositoryRole":`执行工作区`,"drawer.repository":`仓库`,"drawer.replyMode":`回复方式`,"drawer.subagentApplied":`已写入,并通过共享 Goal 状态读回校验。`,"drawer.subagentAppliedRefreshFailed":`已写入并通过共享 Goal 状态读回;状态投影刷新失败,可稍后手动刷新。`,"drawer.subagentApplying":`正在写入并校验共享状态读回…`,"drawer.subagentApplyFailed":`子代理设置写入失败。`,"drawer.subagentChildLimit":`当前上限`,"drawer.subagentConfirmDisable":`确认关闭子代理执行`,"drawer.subagentConfirmEnable":`确认开启子代理执行`,"drawer.subagentCurrentBoundary":`当前任务领域限制`,"drawer.subagentDescription":`仅在 Todo、配额、能力和写入范围门禁全部通过后,允许运行时为相互独立的任务临时创建子代理;不会强制并行,也不会授予持久权限。`,"drawer.subagentDisable":`预览关闭子代理执行`,"drawer.subagentDisableSummary":`这个 Goal 将不再创建新的子代理;现有 Todo 归属和执行记录不受影响。`,"drawer.subagentDomainInvalid":`所选任务领域限制无效。`,"drawer.subagentDomainTodoCount":`匹配 {count} 个开放 Todo`,"drawer.subagentDomains":`任务领域限制(可选)`,"drawer.subagentDomainsEmpty":`当前没有开放的 advancement Todo 声明 task_domain;保持为空即可不按任务领域限制子代理执行。`,"drawer.subagentDomainsHint":`全部不选表示不按任务领域过滤;选择后只放行匹配且已声明领域的 Todo,其他执行门禁始终生效。`,"drawer.subagentDomainsUnrestricted":`不限制任务领域`,"drawer.subagentEnable":`预览开启子代理执行`,"drawer.subagentLabel":`Per-Goal 执行边界`,"drawer.subagentModel":`子 Agent 模型`,"drawer.subagentEffort":`子 Agent 推理档位`,"drawer.subagentModelDefault":`宿主默认`,"drawer.subagentLunaPreset":`使用 Luna / max`,"drawer.subagentClearModel":`清除模型偏好`,"drawer.subagentModelHint":`填写后通过“预览配置调整”保存,执行关闭时也可保存偏好;启动时须核验宿主支持情况。`,"drawer.subagentModelRequired":`设置推理档位前请先指定子 Agent 模型。`,"drawer.subagentMaxChildren":`最多子代理数`,"drawer.subagentNoChange":`当前 Goal 已是这个设置,没有写入任何内容。`,"drawer.subagentPending":`待确认`,"drawer.subagentPreviewBoundary":`预览配置调整`,"drawer.subagentPreviewFailed":`无法生成子代理设置预览。`,"drawer.subagentPreviewing":`正在核对最新 Goal 状态…`,"drawer.subagentPreviewReady":`预览已锁定,确认后才会写入这个 Goal。`,"drawer.subagentPreviewSummary":`最多允许创建 {count} 个子代理;任务领域限制:{domains}。`,"drawer.subagentRemoteReadOnly":`当前来源只读,请在 Goal 所在主机上修改。`,"drawer.subagentTitle":`自适应子代理执行`,"drawer.remoteDetailsDescription":`SSH 来源只展示公开安全状态,不读取来源主机上的连接配置。`,"drawer.remoteDetailsUnavailable":`远端详情未投影`,"drawer.resumeNo":`否`,"drawer.resumeYes":`是`,"drawer.runDetails":`执行 Session`,"drawer.runInterrupt":`中断本次运行`,"drawer.runLatest":`查看最近执行过程`,"drawer.runNewSession":`开始新 Session`,"drawer.runCloseSession":`关闭 Session`,"drawer.runRecordEmpty":`还没有运行记录。Agent 尚未开始这次执行;请在“详情与操作”查看等待条件或恢复 Session。`,"drawer.runRecordProjected":`当前没有可展示的逐步运行记录。LoopX 已读取到 {completed}/{total} 的投影进度{outputs};请在“详情与操作”检查 Session 状态。`,"drawer.runRecordProjectedOutputs":`和 {count} 项产出`,"drawer.runRoleAssistant":`已完成`,"drawer.runRoleSystem":`需检查`,"drawer.runRoleUser":`收到任务`,"drawer.runView":`Session 视图`,"drawer.scheduleAdd":`添加定时检查`,"drawer.scheduleDefaultNotification":`仅在需要你时通知`,"drawer.scheduleDefaultStop":`Goal 完成或 owner 停止`,"drawer.scheduleDefaultTarget":`由 LoopX 调度器按 Goal 配置唤醒。`,"drawer.scheduleEdit":`改为每 2 小时`,"drawer.scheduleLast":`上次执行`,"drawer.scheduleLocalTimezone":`本地时区`,"drawer.scheduleNext":`下次执行`,"drawer.scheduleNeverRun":`尚未执行`,"drawer.scheduleNotification":`通知`,"drawer.schedulePause":`暂停`,"drawer.schedulePending":`等待调度`,"drawer.scheduleResume":`恢复`,"drawer.scheduleRunNow":`立即运行`,"drawer.scheduleStop":`停止{kind}`,"drawer.scheduleStopCondition":`停止条件`,"drawer.scheduleTimezone":`时区`,"drawer.sessionRecoverable":`可恢复`,"drawer.sessionStatus":`会话状态`,"drawer.setupHeartbeat":`设置 Heartbeat`,"drawer.taskActions":`Todo 待确认操作`,"drawer.taskAdvancement":`推进任务`,"drawer.taskBlock":`标记阻塞`,"drawer.taskComplete":`标记完成`,"drawer.taskCompletedNote":`该任务保留为只读记录。`,"drawer.taskCompletedTitle":`任务已完成`,"drawer.taskDefer":`暂缓`,"drawer.taskDeferCondition":`Todo 暂缓恢复条件`,"drawer.taskDeferInvalid":`条件格式不受支持;请使用下列可判定条件。`,"drawer.taskDeferPlaceholder":`例如 resume_at:2026-09-14T09:00:00+08:00`,"drawer.taskDeferReview":`检查暂缓`,"drawer.taskDeferSupported":`支持 todo_done、pr_merged、capacity_available 与带时区的 resume_at 条件。`,"drawer.taskDeferUntil":`暂缓至`,"drawer.taskDetails":`Todo 详情`,"drawer.taskInfo":`任务信息`,"drawer.taskManage":`管理任务`,"drawer.taskNextCompleted":`可创建后续任务`,"drawer.taskNextOpen":`推进或更新状态`,"drawer.taskOrdinary":`普通任务`,"drawer.taskStatusBlocked":`受阻`,"drawer.taskStatusDeferred":`已延期`,"drawer.resumeWhen":`恢复条件`,"drawer.resumeState":`恢复状态`,"drawer.resumePending":`等待条件满足`,"drawer.resumeReady":`可恢复`,"drawer.resumeReceipt":`恢复回执`,"drawer.taskNextDeferred":`等待恢复条件满足后重新评估`,"drawer.taskNextResumeReady":`恢复条件已满足,等待生命周期重新规划`,"drawer.taskStatusCompleted":`已完成`,"drawer.taskStatusOpen":`待执行`,"drawer.taskSuccessor":`创建后续 Todo`,"drawer.taskSuccessorNote":`Owner 标记为阻塞,等待补充上下文。`,"drawer.taskSuccessorSummary":`创建后续 Todo:{task}`,"drawer.taskSuccessorText":`{task} 的后续工作`,"drawer.taskType":`任务类型`,"drawer.topic":`Topic`,"drawer.trigger":`触发方式`,"drawer.titleAttention":`需要你`,"drawer.titleOutput":`产出详情`,"drawer.titleProposalApplied":`执行结果`,"drawer.titleProposalConfirm":`确认执行`,"drawer.titleSchedule":`定时检查`,"drawer.unconfigured":`未配置`,"drawer.workspaceCandidates":`可选择的工作区`,"files.emptySummary":`公开安全产出`,"files.empty":`还没有文件、产出或已验证的阶段周报。`,"files.loadingReports":`正在加载已验证的阶段周报…`,"files.reportDelta":`+{added} 新增 · {changed} 变化`,"files.reportAdded":`新增`,"files.reportChanged":`变化`,"files.reportGeneration":`生成批次`,"files.reportLoadFailed":`无法加载已验证周报`,"files.reportPublication":`发布批次`,"files.title":`Files & Outputs`,"files.verifiedReport":`已验证阶段周报`,"header.agentUnavailable":`不可用`,"header.chatRuntime":`Chat`,"header.workAgentCount":`{count} 个工作 Agent`,"header.chat":`Chat`,"header.files":`Files`,"header.goalCapabilities":`能力配置`,"header.goalCapabilitiesDescription":`管理 Goal override 与继承的本机默认值。`,"header.goalDetails":`Goal 详情`,"header.goalDetailsDescription":`查看状态、用量、仓库、通知与 Session。`,"header.goalSettings":`Goal 设置`,"header.goalSettingsDescription":`打开 Goal 详情或能力配置`,"header.goalNavigation":`Goal 导航`,"header.goalView":`Goal 视图`,"header.live":`实时`,"header.manager":`LoopX 管家`,"header.managerDescription":`跨 Goal 的个人工作入口`,"header.managerRuntime":`{profile} · {sandbox}`,"header.managerRuntimeFallback":`配置无效,已回退到 {profile} · {sandbox};请在机器能力设置中修复。`,"header.managerOverview":`总览`,"header.managerView":`管家视图`,"header.openGoalNavigation":`打开 Goal 导航`,"header.readOnlySourceDescription":`{source} 通过 SSH 隧道只读展示`,"header.refresh":`刷新状态`,"header.refreshDone":`刚刚更新`,"header.refreshFailed":`刷新失败`,"header.refreshing":`刷新中`,"header.selectAgent":`选择 Agent`,"header.selectChatRuntime":`选择聊天 Runtime`,"header.tasks":`Tasks`,"header.themeBrutal":`切换到野兽主题`,"header.themePaper":`切换到默认主题`,"home.blockingSummary":`其中 {count} 项正在阻塞 Agent。`,"home.completedGoals":`已完成的 Goal`,"home.empty":`当前没有`,"startup.goalLoading":`正在加载状态…`,"startup.goalError":`状态加载失败`,"startup.progress":`已加载 {loaded} / {total} 个活跃 Goal`,"startup.partial":`Goal 状态正在逐个更新,当前统计尚不完整。`,"startup.independent":`此 Goal 的加载不会阻塞其他 Goal,你可以先查看已加载的内容。`,"startup.error.timeout":`读取超时,可在本地服务就绪后重试。`,"startup.error.network":`连接中断,请重试以重新连接。`,"startup.error.service":`Goal 状态读取失败。请稍后重试;若问题持续,请检查状态来源。`,"startup.error.access":`状态来源无法访问此 Goal 所需的文件或运行时目录。请检查该来源运行账户的访问权限,修复后重试。`,"startup.error.revision":`加载期间 Goal 目录发生变化,请刷新以同步。`,"startup.error.scope":`该 Goal 已不在当前来源中,请刷新目录。`,"startup.error.invalid":`无法解析状态响应,请刷新或检查 LoopX 更新。`,"startup.retry":`重试`,"startup.retryFailed":`重试失败的 Goal`,"startup.failedCount":`{count} 个 Goal 加载失败,已加载的 Goal 可继续使用。`,"home.greeting":`你好,我是 LoopX 管家`,"home.history":`历史`,"home.lane.needsYou":`需要你`,"home.lane.needsYouDescription":`等待你的决定、授权或补充信息`,"home.lane.observing":`观察中`,"home.lane.observingDescription":`持续监控,出现变化时再提醒你`,"home.lane.running":`执行中`,"home.lane.runningDescription":`Agent 正在推进并持续回传进展`,"home.lane.scheduled":`已安排`,"home.lane.scheduledDescription":`已经安排,等待时间或前置条件`,"home.noActivity":`尚无活动`,"home.noFirstActivity":`等待首次活动`,"home.noCompletedGoals":`还没有已完成的 Goal`,"home.preservedState":`保留状态,可随时恢复`,"home.stopped":`已停止`,"home.systemHealth":`系统健康:{summary}`,"home.taskCount":`{count} 个 Task`,"home.todayAt":`今天 {time}`,"home.waitingCount":`你有 {count} 项需要处理。`,"home.workspace":`Goal 工作区`,"lark.allMessages":`此 Topic 中的所有消息`,"lark.allTopicMessages":`所有 Topic 消息`,"lark.agentIngress":`Agent 入站方式`,"lark.agentAppPermissions":`每个选中的 Agent 都需要一个已具备群聊提及和回复能力的 Lark App。`,"lark.agentApps":`每个 Agent 的 Lark App`,"lark.agentAppsDescription":`默认使用上方 App;需要独立机器人身份时,可为 Agent 选择另一个兼容 App。`,"lark.agentAppSelection":`{agent} 的 Lark App`,"lark.appCreated":`App 已创建`,"lark.appCreateFailed":`创建失败`,"lark.appLoading":`正在加载可用的 Lark Apps…`,"lark.appPermissions":`该 App 能发送建联消息,但缺少接收群聊 @ 消息或自动回复所需的机器人权限。请开启 im:message.group_at_msg:readonly、im:message.send_as_bot 和事件 im.message.receive_v1,发布新版后刷新。`,"lark.appProfile":`Lark App`,"lark.apps":`Lark Apps`,"lark.autoReplyUnavailable":`自动回复暂不可用`,"lark.autoReplyReady":`自动回复可用`,"lark.bindGoal":`绑定到 Goal`,"lark.cancel":`取消`,"lark.cardinality":`一个 Lark App · 多个 Goal · 每个 Agent 一条隔离路由`,"lark.capture":`接收范围`,"lark.captureAddressed":`仅接收提及 App 或回复 App 的消息`,"lark.captureAll":`接收此 Goal Topic 中的所有消息`,"lark.captureScope":`接收范围`,"lark.captureScopeDescription":`决定哪些 Topic 消息会进入 LoopX;不会扩大 Agent 权限。`,"lark.closeConnection":`关闭连接弹窗`,"lark.closeCreate":`关闭创建弹窗`,"lark.closeSettings":`关闭 Lark 设置`,"lark.connect":`连接`,"lark.connectAllAgents":`连接全部已注册 Agent`,"lark.connectAllAgentsAction":`一键连接 {count} 个 Agent`,"lark.connectAllAgentsDescription":`一次引导创建 {count} 个隔离的 Agent Topic;请在对应 Topic 内发送请求,每个 Agent 保留独立路由和收件箱。`,"lark.connectApp":`连接 Lark App`,"lark.connection":`连接`,"lark.connections":`连接`,"lark.configuration":`Lark 配置`,"lark.continueFeishu":`在飞书中继续`,"lark.createAutomatically":`自动创建 Goal Topic`,"lark.createAutomaticallyDescription":`将为每个选中的 Agent 创建带 Agent 标识的专属 Topic。`,"lark.defaultAgentAppDescription":`用于查找目标群聊,并作为所有选中 Agent 的默认 App;下方的逐 Agent 选择可覆盖它。`,"lark.description":`管理可复用的 Lark App,并用独立 Topic 将群聊连接到 Goal。`,"lark.editConnection":`编辑 Lark 连接`,"lark.goalConnections":`{count} 个 Goal 连接`,"lark.goalTopicConnections":`Lark Goal Topic 连接`,"lark.groupChat":`群聊`,"lark.groupEmpty":`该机器人尚未加入可连接的群。请先在飞书群设置中添加这个机器人,再回来刷新或搜索。`,"lark.groupLoading":`正在读取该机器人已加入的群…`,"lark.groupSearch":`搜索该机器人已加入的群`,"lark.historyPermission":`历史补读权限(独立能力)`,"lark.health.contextCaptured":`已捕获群聊上下文`,"lark.health.contextCapturedDetail":`该消息仅作为非权威上下文保留,不会启动或引导管家 Turn;需要执行时请直接 @ 机器人或回复机器人的消息。`,"lark.health.eventProcessed":`已处理 {events} 条事件,成功回复 {replies} 条。`,"lark.health.eventUnverified":`事件订阅待验证`,"lark.health.eventUnverifiedDetail":`Provider listener 已就绪,但尚未收到消息事件。请启用 im.message.receive_v1、开通群聊 @ 消息权限并发布新版,然后在这个 Agent Topic 内发送新的 @ 消息;存在多条 Agent 路由时,群顶层消息会 fail closed。`,"lark.health.ignoredSelf":`已忽略机器人自身发送的消息,避免重复回复。`,"lark.health.invalidRouting":`路由配置无效`,"lark.health.invalidRoutingDetail":`连接已安全停用,请重新选择处理方式并保存。`,"lark.health.lastStatus":`最近事件状态:{status}`,"lark.health.listening":`监听中`,"lark.health.messageContextPermission":`消息权限不足`,"lark.health.messageContextPermissionDetail":`已收到消息事件,但无法读取群消息上下文。请发布并授权该 App 的群消息读取权限。`,"lark.health.notAddressed":`最近消息未直接 @ 机器人`,"lark.health.notAddressedDetail":`监听正常;当前连接只响应直接 @ 机器人或对机器人的回复。`,"lark.health.notStarted":`监听未启动`,"lark.health.notStartedDetail":`请刷新连接或重新启动 LoopX 后再试。`,"lark.health.processingFailed":`消息处理失败`,"lark.health.processingFailedDetail":`已收到消息事件,但 Agent 处理失败。请查看本地诊断后重试。`,"lark.health.queued":`已进入 Agent 收件箱`,"lark.health.queuedDetail":`消息由 {agent} 异步处理,不会启动通用 Chat Session。`,"lark.health.sourceDisconnected":`实时消息连接断开`,"lark.health.sourceDisconnectedDetail":`消息监听进程意外退出。请核对应用档案的平台:飞书应用选飞书,国际版 Lark 应用选 Lark,再检查连接及订阅错误。LoopX 正在重试;历史消息能读取,不代表能实时收消息。`,"lark.health.retrying":`监听重试中`,"lark.health.retryingDetail":`事件监听暂时中断,LoopX 正在自动重试。`,"lark.health.routeAmbiguous":`消息匹配多个 Goal`,"lark.health.routeAmbiguousDetail":`同一 Bot 和群聊存在多个完整群捕获连接。请让每个 Agent 使用独立 Bot,或只保留一个完整群连接。`,"lark.health.routeMismatch":`消息未匹配当前 Goal Topic`,"lark.health.routeMismatchDetail":`事件来自其他群聊或 Topic。请重新选择群聊并连接该 Goal,然后发送一条新的 @ 消息。`,"lark.health.routeUnavailable":`消息无法路由到 Goal`,"lark.health.routeUnavailableDetail":`当前连接信息不完整。请重新连接该 Goal 后再发送一条新的 @ 消息。`,"lark.health.starting":`正在启动`,"lark.health.startingDetail":`LoopX 正在启动该 App 的消息事件监听。`,"lark.health.unavailable":`自动回复不可用`,"lark.health.waiting":`等待处理`,"lark.incomingMessages":`接收消息`,"lark.ingressAsync":`异步收件箱`,"lark.ingressAsyncDescription":`写入 Agent 私有收件箱,等待后续显式处理。`,"lark.editPreservesIdentity":`保存会保留此 App、群和 Topic;旧连接默认升级为 Agent 异步收件箱。`,"lark.conversationKind":`连接用途`,"lark.managerConversation":`管家 · 同步对话`,"lark.workerConversation":`工作 Agent · 后台任务`,"lark.managerConversationDescription":`内置管家即时回应对话,长任务交给后台 Agent。群聊与私聊分别保存上下文。`,"lark.ingressLegacy":`待升级`,"lark.ingressLegacyDescription":`保存连接即可升级为 Agent 异步收件箱,已有消息保留在原 Topic 中。`,"lark.ingressQueue":`排队`,"lark.ingressQueueDescription":`进入同一 Agent Session 的有界 FIFO 队列,当前 Turn 完成后处理。`,"lark.ingressSteering":`实时引导`,"lark.ingressSteeringDescription":`投到当前活跃 Turn;没有精确活跃 Turn 时安全拒绝。`,"lark.loading":`加载 Lark 配置…`,"lark.management":`Lark 管理`,"lark.openEventSettings":`查看飞书事件配置`,"lark.mentions":`提及机器人`,"lark.mentionsOnly":`仅提及消息`,"lark.needsMessagePermissions":`需要消息权限`,"lark.needsSetup":`需要设置`,"lark.newApp":`新建 Lark App`,"lark.noAgentConfigured":`未配置 Agent`,"lark.noConnections":`暂无匹配的连接。`,"lark.noProfiles":`还没有可用的 lark-cli App profile。`,"lark.profileName":`Profile 名称`,"lark.profileValidation":`Profile 只能包含字母、数字、点、下划线和连字符。`,"lark.processing":`处理方式`,"lark.region":`区域`,"lark.registerAnother":`+ 注册另一个 Lark App — 通过飞书创建`,"lark.reopenFeishu":`重新打开飞书`,"lark.settingsConfigure":`配置 {goal}`,"lark.settingsDisconnect":`解绑 {goal}`,"lark.replyMode":`回复方式`,"lark.replyModeDescription":`当前只支持在来源 Topic 内回复,避免跨群或跨 Goal 投递。`,"lark.reusableApps":`{count} 个可复用 App`,"lark.reusableWorkspaceApp":`可复用工作区 App`,"lark.routesUnverified":`{count} 条 Lark 路由尚未验证`,"lark.saveConnection":`保存连接`,"lark.searchConnections":`搜索 Lark 连接`,"lark.searchPlaceholder":`搜索 App、群、Goal 或 Topic`,"lark.setupCopy":`LoopX 将通过 lark-cli 打开飞书官方创建页面。应用凭证保存在系统 Keychain,LoopX 只保留 profile 引用。`,"lark.someoneMentions":`有人提及 Agent`,"lark.targetAgent":`目标 Agent`,"lark.targetAgentDescription":`选择该 Goal 内已注册的 Agent。此连接只投递给一个 Agent,不广播、不授予新权限。实时引导与排队需要该 Agent 的精确活跃 Session。`,"lark.agentUnavailable":`{agent} · 已不可用`,"lark.selectRegisteredAgent":`请先选择可用的已注册 Agent;不会自动替换原先的接收者。`,"lark.topicPreview":`Topic 预览`,"lark.topicReply":`Topic 回复`,"lark.trigger":`触发方式`,"lark.waitingFeishu":`等待飞书完成创建`,"lark.waitingFeishuDescription":`请在新窗口中完成飞书授权,完成后会自动回到这里。`,"lark.waitingLink":`正在生成飞书官方创建链接…`,"lark.error.appCreate":`Lark App 创建失败`,"lark.error.appRequired":`请选择一个 Lark App profile。`,"lark.error.bind":`绑定失败`,"lark.error.bindPreview":`绑定预览失败`,"lark.error.configuration":`Lark 配置加载失败`,"lark.error.groupLookup":`无法读取该机器人已加入的群。请检查机器人状态后重试。`,"lark.error.groupLoad":`群聊加载失败`,"lark.error.invalidApp":`Lark App profile 不可用或尚未完成授权。`,"lark.error.messagePermissions":`该 App 缺少自动回复所需的机器人权限。请开启 im:message.group_at_msg:readonly 和 im:message:send_as_bot,发布新版后回来刷新重试。`,"lark.error.provider":`飞书 API 调用失败,且没有生成已验证回执。请稍后重试。`,"lark.error.setupPoll":`创建状态查询失败`,"lark.error.setupStart":`无法启动 Lark App 创建流程`,"lark.error.cliExecutable":`已找到配置的 lark-cli,但当前无法执行。请检查安装或启动参数。`,"lark.error.cliMissing":`未发现 lark-cli。请先安装 lark-cli,然后重新启动 LoopX。`,"lark.error.cliStart":`lark-cli 启动失败。请检查安装状态,然后重新启动 LoopX。`,"lark.error.disconnect":`解绑失败`,"notifications.autoNotify":`需要你确认时自动推送到群里`,"notifications.bind":`绑定到通知群`,"notifications.bindConfirm":`将把「{goal}」绑定到通知群「{target}」,绑定时会验证机器人在群内并发送一条确认消息。`,"notifications.bindFailed":`绑定失败`,"notifications.bound":`已绑定`,"notifications.confirmBind":`确认绑定`,"notifications.description":`把 Goal 里需要你确认的变更推送到飞书群。绑定和开关在这里完成,推送逻辑沿用现有通道。`,"notifications.disabled":`已停用`,"notifications.group":`通知群:{target}`,"notifications.loadFailed":`通知群列表加载失败`,"notifications.noTargets":`还没有可用的通知群。通知群涉及机器人私有身份,请先在终端配置一次:`,"notifications.notBound":`未绑定`,"notifications.recent":`最近 {time}`,"notifications.sentCount":`已发送 {count} 条`,"notifications.settings":`Goal 通知绑定`,"notifications.setupFailed":`设置失败`,"notifications.title":`飞书群通知`,"proposal.field.agentId":`Agent`,"proposal.field.cadence":`频率`,"proposal.field.completionCriteria":`完成标准`,"proposal.field.executionBoundary":`执行边界`,"proposal.field.goalId":`Goal ID`,"proposal.field.heartbeat":`Heartbeat`,"proposal.field.initialTodos":`首个任务`,"proposal.field.objective":`目标`,"proposal.field.operation":`操作`,"proposal.field.operationState":`操作状态`,"proposal.field.resultDelivery":`结果回传`,"proposal.field.confirmationBoundary":`确认边界`,"proposal.field.expiresAt":`过期时间`,"proposal.field.permission":`权限`,"proposal.field.reason":`原因`,"proposal.field.stopCondition":`停止条件`,"proposal.field.target":`检查内容`,"proposal.field.timezone":`时区`,"proposal.field.title":`标题`,"proposal.field.workspace":`执行工作区`,"actionReview.targetChanged":`预览目标与请求的 Goal 或操作不一致,请重新生成预览。`,"actionReview.ready_stop":`暂停可恢复。此预览已通过检查,可直接执行;完成仍需要读回验证。`,"actionReview.resume_review":`恢复自动调度前需要确认。实际执行仍受额度、Gate 和 Todo 约束。`,"actionReview.delete_review":`请确认从注册表移除这个已停止 Goal。项目文件与历史记录会保留。`,"actionReview.action_review":`执行前请检查此提案的目标与影响。`,"actionReview.protected_action":`此操作需要明确审阅。确认不能替代所需授权。`,"actionReview.unknown_permission":`无法识别权限分类。请重新检查提案后再继续。`,"actionReview.unknown_action":`无法识别此生命周期操作。请重新检查提案后再继续。`,"actionReview.incomplete_proposal":`预览缺少验证信息或可执行转换。请重新生成预览。`,"actionReview.authority_gate":`Gate 阻止执行。请满足其要求后重新检查提案。`,"actionReview.stale_proposal":`来源状态已变化。请重新生成预览,原决定不再适用。`,"actionReview.apply_pending":`正在执行,请等待读回结果后再重试。`,"actionReview.readback_verified":`操作已完成,结果状态已通过读回验证。`,"actionReview.readback_unverified":`操作返回但未通过读回验证。尚不能确认完成,请重新检查状态。`,"actionReview.operation_group_confirmation":`这份精确请求只能在已绑定飞书群的原始卡片确认;Dashboard 不提供本地执行入口。`,"actionReview.operation_result_delivery_pending":`操作结果已经记录,但原群结果卡尚未通过回读核验。`,"actionReview.apply_failed":`执行未完成。请检查失败原因并重新生成预览后再试。`,"actionReview.inactive_proposal":`此提案当前不可执行。请重新检查后再继续。`,"proposal.gate.default":`需要宿主确认`,"proposal.impact.default":`确认后会调用规范 LoopX 服务写入状态。`,"proposal.impact.goalCreate":`确认后会创建 Goal 和首个 Todo,并让选定 Agent 开始首轮推进。`,"proposal.impact.lifecycleDelete":`确认后会从 source registry 和 global registry 移除这个已停止 Goal;项目文件、历史状态文件和备份不会被删除。`,"proposal.impact.lifecycleResume":`确认后会恢复 Goal 的自动调度资格并移回 Active Goals;实际执行仍受 quota、Gate 和 Todo 约束。`,"proposal.impact.lifecycleStop":`确认后会停止自动推进,并将 Goal 移入折叠的「已停止」列表;历史、Todo 和证据都会保留,可随时恢复。`,"proposal.impact.protected":`该操作需要通过受保护的 LoopX 写入服务完成。`,"proposal.impact.operation":`这里仅展示同一份不可变条款。请在已绑定的飞书群确认或拒绝;确认只会消费一个规范 claim。`,"proposal.primary.apply":`确认并应用`,"proposal.primary.goalCreate":`创建 Goal 并开始首轮`,"proposal.primary.lifecycleDelete":`删除 Goal`,"proposal.primary.lifecycleResume":`恢复 Goal`,"proposal.primary.lifecycleStop":`停止 Goal`,"proposal.primary.todoStart":`创建任务并开始执行`,"proposal.primary.operationGroup":`前往飞书群确认`,"proposal.primary.operationResultPending":`结果卡回传待恢复`,"proposal.primary.operationResultVerified":`结果已核验`,"proposal.resultDelivery.verified":`已在原群卡片完成回读核验`,"proposal.resultDelivery.pending":`等待回传并核验原群卡片`,"proposal.summary.goalCreate":`创建 Goal:{title}`,"proposal.summary.heartbeat":`为当前 Goal 设置 Heartbeat`,"proposal.summary.lifecycleDelete":`删除 Goal:{title}`,"proposal.summary.lifecycleResume":`恢复 Goal:{title}`,"proposal.summary.lifecycleStop":`停止 Goal:{title}`,"proposal.summary.monitor":`为当前 Goal 创建定时检查:{target}`,"proposal.workspace.current":`当前本地工作区(未绑定 Repository)`,"proposal.workspace.named":`{workspace}(仅提供执行环境,不会自动关联仓库)`,"proposal.workspaceGate.agentImpact":`先完成 Agent 身份绑定,再重新检查原操作;当前没有写入 Goal。`,"proposal.workspaceGate.agentTitle":`先绑定 Agent`,"proposal.workspaceGate.defaultSummary":`请选择 Goal 所属工作区。`,"proposal.workspaceGate.selectionImpact":`选择工作区后会重新展示待确认操作,选择本身不会写入状态。`,"proposal.workspaceGate.selectionTitle":`选择 Goal 工作区`,"projection.agentAdvancingGoal":`Agent 正在推进当前 Goal`,"projection.agentIdle":`暂无需要你处理`,"projection.agentNeedsDecision":`Agent 等待你的决定`,"projection.agentPreparingNextStep":`Agent 正在整理下一步`,"projection.agentStopped":`已由你停止;历史、Todo 和证据仍保留`,"projection.agentWaitingExternal":`正在等待外部条件`,"projection.confirmAgentDecision":`请确认 Agent 下一步需要的权限或决策`,"projection.events24h":`24 小时内 {count} 个事件`,"projection.firstReadOnlyAdapterCheck":`执行首次只读适配检查并保存进度`,"projection.goalVerified":`Goal 状态、Todo 与注册信息已验证`,"projection.latestRun":`最近运行`,"projection.latestValidation":`最近验证`,"projection.nextUpdatePending":`等待 LoopX 更新下一步`,"projection.publicSafeProjection":`公开安全状态投影`,"projection.refreshState":`刷新 LoopX 状态,确认当前进度仍然有效`,"projection.runEvidenceAvailable":`存在可查看的运行证据`,"projection.runRecorded":`最近一次 LoopX 运行已经记录`,"projection.statusRefreshNeeded":`LoopX 状态需要刷新`,"projection.todoStatusUpdated":`Todo 状态已经更新,正在确认下一步`,"projection.validationRecorded":`最近验证已经记录`,"runs.completed":`已完成`,"runs.failed":`需检查`,"runs.interrupted":`已中断`,"runs.queued":`已安排`,"runs.ready":`可继续`,"runs.resumeFailed":`恢复失败`,"runs.running":`执行中`,"runs.unknown":`状态未知`,"runs.waiting":`等待条件`,"schedule.active":`执行中`,"schedule.heartbeat":`Goal Heartbeat`,"schedule.monitor":`定时与持续任务`,"schedule.paused":`已暂停`,"schedule.summary":`按 LoopX 调度约束持续检查`,"schedule.defaultTarget":`检查当前 Goal 的阻塞、进度与新产出`,"schedule.unsupportedCalendar":`当前定时检查不支持精确到星期或时刻的日历计划。请改用固定间隔,例如“每 30 分钟”“每 2 小时”或“每天”;草稿已保留,没有生成待确认操作。`,"source.add":`添加来源`,"source.addConfigured":`添加只读来源`,"source.addMethod":`来源添加方式`,"source.addSsh":`添加 SSH 隧道来源`,"source.closeForm":`关闭来源表单`,"source.configured":`已配置 SSH`,"source.configuredCount":`本机 SSH Host · {count} 个`,"source.configuredGroup":`已配置 SSH Host · {count}(点击快速添加)`,"source.connected":`已连接`,"source.connecting":`连接中`,"source.controlPlane":`控制面来源`,"source.copy":`复制`,"source.copyCommand":`复制 SSH 隧道命令`,"source.copyError":`无法复制命令,请手动复制下方命令。`,"source.copied":`已复制`,"source.description":`已读取全部显式 Host(含 Include);通配规则不会作为具体来源。先运行命令,LoopX 不读取密钥或配置细节。`,"source.host":`本机 SSH Host`,"source.hostEmpty":`~/.ssh/config 中没有可直接选择的显式 Host。`,"source.hostLoadError":`无法读取本机 SSH Host。`,"source.hostPlaceholder":`输入或搜索 Host`,"source.invalid":`SSH 来源参数无效。`,"source.loadingHosts":`正在读取…`,"source.localInteractive":`本机交互`,"source.localPort":`本地端口`,"source.manual":`手动 URL`,"source.manualDescription":`远端来源始终按只读投影处理,不继承本机写权限。`,"source.name":`名称`,"source.namePlaceholder":`远程开发机`,"source.notAvailable":`不可用`,"source.readOnly":`SSH 隧道 · 只读`,"source.readOnlyNoticeDescription":`你可以查看 Goal、Task、证据与运行状态;写入、纠偏和 Agent 会话仍留在来源主机。`,"source.readOnlyNoticeTitle":`远端只读投影`,"source.readOnlyWriteError":`远端 SSH 隧道来源是只读投影,不能执行控制面写入。`,"source.refreshHosts":`重新读取 SSH Host`,"source.remove":`移除来源 {source}`,"source.removeCurrent":`移除当前来源`,"source.select":`选择控制面来源`,"source.selectHost":`请选择已配置的 SSH Host。`,"source.statusUrl":`本地转发 URL`,"source.tunnelCommandPending":`选择 Host 后生成隧道命令`,"machine.absent":`尚未配置`,"machine.action.create":`创建机器策略`,"machine.action.delete":`移除机器策略`,"machine.action.unchanged":`无需写入`,"machine.action.update":`更新机器策略`,"machine.applied":`机器策略已应用,并通过回读校验。`,"machine.applyError":`无法应用机器策略。`,"machine.applyPreview":`应用已审阅预览`,"machine.changedNamespaces":`变更的 Namespace`,"machine.capabilityCatalog":`机器能力目录`,"machine.capabilityEmpty":`当前没有注册可在机器作用域配置的能力。`,"machine.configured":`已配置`,"machine.confirmRollback":`确认回滚`,"machine.currentRevision":`当前 Revision`,"machine.currentValue":`当前机器值`,"machine.description":`与 Goal 设置共用能力目录。在这里管理受支持的机器默认值;仅支持 Goal 配置的能力会明确标注。`,"capabilities.rawJson":`高级:原始 JSON`,"machine.goalOnly":`此能力目前仅支持 Goal 级配置。请打开具体 Goal 的能力设置进行配置;这里不会设置机器级默认值。`,"machine.desiredRevision":`目标 Revision`,"machine.editorUnavailable":`当前版本未安装此 Namespace 的编辑器`,"machine.editorUnavailableDescription":`它仍会显示在 Registry 中;安装或升级对应的 Dashboard 编辑器后才能修改。`,"machine.editorMode":`编辑模式`,"machine.liveDefault":`实时默认值;Goal 显式覆盖优先`,"machine.liveDefaultDescription":`没有显式覆盖的 Goal 会在该能力下一次决策时读取当前机器策略。修改或移除策略会立即影响这些已有 Goal;显式 Goal 覆盖保持固定。`,"machine.genericNamespaceDescription":`使用 JSON 编辑这个已注册 Namespace。LoopX 会先按 capability 自己拥有的 schema 校验,再允许预览写入。`,"machine.jsonConfiguration":`Namespace 配置(JSON)`,"machine.jsonConfigurationHelp":`只更新当前 Namespace;其他机器配置会保留,Apply 仍锁定到已审阅的 Preview Revision。`,"machine.jsonEditor":`JSON`,"machine.editJson":`编辑 JSON`,"capabilities.jsonConfiguration":`Goal 配置(JSON)`,"capabilities.jsonHelp":`仅编辑当前 Goal 的已注册字段。修改后需重新预览才能应用。`,"capabilities.jsonInvalid":`请输入合法的 JSON 对象,且仅包含已注册的可编辑字段。`,"machine.backToForm":`返回表单`,"machine.jsonInvalid":`请先填写一个合法的 JSON object,再预览变更。`,"machine.loadError":`无法读取机器配置。`,"machine.invalidStoredConfiguration":`已保存的机器配置需要修复`,"machine.invalidStoredConfigurationDescription":`已保存值不再符合当前契约,因此不会在这里显示。请检查已定位的能力,并通过“预览”和“应用”替换它;无关 namespace 保持不变。`,"machine.machinePolicy":`机器策略`,"machine.namespaceCount":`已注册 Namespace`,"machine.namespaces":`配置 Namespace`,"machine.periodicReport":`周期报告`,"machine.periodicReportDescription":`为所有未显式覆盖的 Goal 提供默认报告策略;Goal 调度与发送消费解析后的有效配置。`,"machine.periodicReportActivation":`开启后将在已验证的阶段节点自动投递`,"machine.periodicReportActivationDescription":`这不是每周定时器。当 LoopX 验证 Goal 已完成一个阶段时,Agent 会生成并冻结报告,随后通过配置的 Goal Channel 自动发送。启用此订阅即授予持续投递权;发送失败或路由漂移会 fail closed 并进入修复。`,"machine.changeQualityActivation":`质量验证是质量门禁,不是新增授权`,"machine.changeQualityActivationDescription":`继承该策略的 Goal 会验证最终精确 diff。safe_fix 只允许在既有写入权限内执行至多一次有界修复;此设置不会授予文件、权限或合并权。`,"machine.replanCadenceActivation":`复核周期只改变时机,不改变执行权限`,"machine.replanCadenceActivationDescription":`没有显式覆盖的 Goal 会在下一次复核决策前读取此阈值;它不会创建 Turn、消耗配额或授予权限。`,"machine.preview":`审阅机器配置变更`,"machine.previewChanges":`预览变更`,"machine.previewError":`无法生成机器策略预览。`,"machine.previewLocked":`应用操作锁定到当前 Revision;若机器状态变化,LoopX 会要求重新预览。`,"machine.previewRollback":`预览回滚`,"machine.previewRemoval":`预览移除`,"machine.profilePreset":`Profile preset`,"machine.profilePresetHelp":`由 capability 管理的 preset,例如 weekly-progress。`,"machine.registry":`Typed Registry`,"machine.requiredFields":`开启后必须填写 profile preset、Goal Channel route 与有效时区。`,"machine.revision":`机器 Revision`,"machine.revisionLockedReady":`所有变更必须先预览;只有对应的机器 Revision 仍然有效时才会应用。`,"machine.rollbackAvailable":`可回滚上一次应用`,"machine.rollbackDescription":`先预览已保存的前一 Revision,再决定是否恢复。`,"machine.rollbackError":`无法完成回滚。`,"machine.rollbackPreviewDescription":`前一 Revision 已准备恢复,请确认执行本次回滚。`,"machine.rolledBack":`已恢复前一版机器策略,并通过校验。`,"machine.removed":`机器策略已移除,并通过回读校验。`,"machine.routeRef":`Goal Channel route`,"machine.routeRefHelp":`只填写公开 route alias;凭据与 provider identifier 不会进入此表单。`,"machine.timezone":`时区`,"machine.timezoneHelp":`填写 IANA 时区,例如 Asia/Shanghai。`,"machine.title":`机器配置`,"machine.unchanged":`机器策略已与预览一致,本次没有写入。`,"machine.visualEditor":`引导式`,"capabilities.atomicOverride":`Goal override 按完整配置生效`,"capabilities.atomicOverrideDescription":`Goal 的完整配置优先于机器默认值;LoopX 不会在两个作用域之间逐字段拼接。`,"capabilities.applyFailed":`Goal 能力变更未写入。`,"capabilities.applyPreview":`应用此预览`,"capabilities.catalog":`Goal 能力目录`,"capabilities.chooseGoal":`请先选择一个 Goal,再查看它的能力配置。`,"capabilities.defaultValue":`声明的默认值`,"capabilities.description":`查看当前 Goal 可用的能力,以及每项配置的准确作用域。`,"capabilities.editorPrepared":`已注册 typed editor contract`,"capabilities.effectiveSource":`当前生效来源`,"capabilities.empty":`当前 Goal 没有可用的能力描述。`,"capabilities.fields":`已注册字段`,"capabilities.goalPolicy":`Goal 能力策略`,"capabilities.goalScope":`Goal`,"capabilities.goalValue":`当前 Goal 值`,"capabilities.loadFailed":`无法加载 Goal 能力`,"capabilities.loading":`正在加载 Goal 能力…`,"capabilities.machineOnly":`此能力只能在机器作用域配置。`,"capabilities.machineValue":`实时机器默认值`,"capabilities.machineScope":`机器`,"capabilities.previewOnly":`当前读取结果来自真实配置;在 revision-locked preview/apply 路径接通前,Dashboard 不会提供 Goal 写入控件。`,"capabilities.preview":`锁定 revision 的变更预览`,"capabilities.previewChanges":`预览变更`,"capabilities.restoreInheritance":`恢复继承机器默认值`,"capabilities.previewFailed":`无法预览 Goal 能力变更。`,"capabilities.previewLocked":`应用时会重新校验这一个 plan revision;过期变更将被拒绝。`,"capabilities.partialWrite":`Goal 值已保存;共享投影仍需修复`,"capabilities.partialWriteDescription":`源 Goal 配置已经写入并回读,但共享 runtime 投影尚未同步;请勿重复提交本次变更。`,"capabilities.refreshSource":`刷新源配置`,"capabilities.readOnly":`只读能力`,"capabilities.revisionLockedReady":`所有变更必须先预览;只有对应的精确 revision 仍然有效时才会写入。`,"capabilities.retry":`重试`,"capabilities.source.capability_default":`能力默认值`,"capabilities.source.goal_override":`Goal override`,"capabilities.source.machine_default":`实时机器默认值`,"capabilities.source.not_configured":`未配置`,"capabilities.title":`Goal 能力`,"settings.close":`关闭设置`,"settings.appearance":`外观`,"settings.appearanceDescription":`管理当前浏览器里的工作区显示偏好。`,"settings.appearanceTabDescription":`主题和显示偏好`,"settings.capabilitiesTabDescription":`当前 Goal 的能力覆盖配置`,"settings.back":`返回工作区`,"settings.categories":`设置分类`,"settings.description":`管理工作区偏好与集成。`,"settings.eyebrow":`工作区偏好`,"settings.general":`通用`,"settings.goalConnections":`Goal 连接`,"settings.language":`语言`,"settings.languageDescription":`选择 LoopX Desktop 工作区使用的界面语言。`,"settings.languageEnglishDescription":`使用英文显示导航、设置和工作区控件。`,"settings.languageEnglish":`English`,"settings.languageSimplifiedChineseDescription":`使用简体中文显示导航、设置和工作区控件。`,"settings.languageSimplifiedChinese":`简体中文`,"settings.languageStoredLocally":`此偏好仅保存在当前设备。`,"settings.languageTabDescription":`当前设备的界面语言`,"settings.larkTabDescription":`App、群聊和 Goal Topic 连接`,"settings.machineTabDescription":`本机各 Capability 共享的 typed defaults`,"settings.notifications":`通知`,"settings.open":`设置`,"settings.themeDefault":`纸张`,"settings.themeDefaultDescription":`安静、轻量,适合长期查看。`,"settings.themeDescription":`选择工作区的视觉风格。设置会保存在当前浏览器本地。`,"settings.themeHighContrast":`高对比`,"settings.themeHighContrastDescription":`更强边框和更醒目的状态块。`,"settings.themeLoopx":`LoopX 标准`,"settings.themeLoopxDescription":`精确的黑白界面、Geist 字体与安静的细线结构。`,"settings.title":`设置`,"settings.workspaceDisplay":`工作区显示`,"settings.workspaceTheme":`工作区主题`,"session.closeRecord":`退出运行记录`,"session.details":`Session 详情`,"session.record":`执行 Session · 运行记录`,"session.recordDescription":`当前时间线已切换到这次 Session 的消息与 Turn 记录。`,"sidebar.createGoal":`创建 Goal`,"sidebar.delete":`删除`,"sidebar.deleteGoal":`删除 Goal`,"sidebar.manager":`LoopX 管家`,"sidebar.notifications":`设置`,"sidebar.owner":`个人工作区`,"sidebar.product":`个人 Agent 工作区`,"sidebar.resume":`恢复`,"sidebar.resumeGoal":`恢复 Goal`,"sidebar.stop":`停止`,"tasks.historyLoading":`正在加载历史…`,"tasks.historyError":`历史加载失败,已显示的内容仍可查看。`,"tasks.historyExpired":`历史快照已过期,重新加载后可继续查看。`,"tasks.historyRetry":`重新加载`,"tasks.historyEnd":`已显示全部完成记录`,"tasks.historyMore":`加载更多`,"tasks.historyLocalOnly":`请打开这台机器的 Dashboard 查看完整历史。`,"sidebar.sortGoals":`调整 Goal 顺序`,"sidebar.dragGoal":`拖拽调整顺序,或使用列表排序按钮`,"sidebar.moveUp":`上移 {goal}`,"sidebar.moveDown":`下移 {goal}`,"sidebar.goalMoved":`{goal} 已移至第 {position} 位`,"sidebar.orderNotSaved":`顺序已在本次页面生效;浏览器存储不可用,无法保存。`,"sidebar.stopGoal":`停止 Goal`,"sidebar.stopped":`已停止`,"sidebar.stoppedLoading":`正在加载已停止 Goal`,"sidebar.stoppedLoadFailed":`已停止 Goal 加载失败,其他 Goal 仍可使用。`,"sidebar.retryStopped":`重试`,"state.completed":`已完成`,"state.needsRepair":`需修复`,"state.needsYou":`等你`,"state.quiet":`安静运行`,"state.running":`推进中`,"state.stopped":`已停止`,"state.waiting":`等待条件`,"tasks.blocked":`受阻`,"tasks.agentLane":`工作 Agent`,"tasks.agentLaneDescription":`筛选这个 Goal 下的工作泳道`,"tasks.agentLaneFilter":`按工作 Agent 筛选`,"tasks.allAgentLanes":`全部 Agent({count})`,"tasks.chatAgentReplied":`Agent 已回复`,"tasks.chatPending":`已发送给 Agent`,"tasks.chatPendingDescription":`正在处理;只有经过确认的任务操作才会更新 Tasks。`,"tasks.chatRecent":`最近对话`,"tasks.chatUnchangedDescription":`本次对话没有直接修改 Tasks。需要执行时,可先转成 Task 草稿并确认。`,"tasks.chatViewReply":`查看回复`,"tasks.convertToTask":`转为 Task`,"tasks.completed":`已完成`,"runs.discoveryPartial":`部分执行详情暂不可用,正在重连;任务摘要不代表实时执行状态。`,"runs.discoveryOffline":`执行服务暂不可用,正在重连;保留的任务摘要可能已过时。`,"files.openConversation":`前往会话`,"files.exportSummary":`导出摘要`,"tasks.viewDescription":`先处理待确认,再查看工作与完成记录`,"tasks.viewLabel":`任务视图`,"tasks.listView":`列表`,"tasks.boardView":`看板`,"tasks.completedSummary":`已完成 {count} 项,近期完成明细由控制面按需投影。`,"tasks.emptyCompleted":`还没有完成的任务。`,"tasks.emptyConfirm":`没有待确认的任务。`,"tasks.emptyRunning":`没有待执行或进行中的任务。`,"tasks.emptySchedules":`没有定时任务。`,"tasks.emptyGoal":`这个 Goal 还没有任务。用下面的输入框描述下一步,LoopX 会先展示待确认操作。`,"tasks.markComplete":`标记完成:{name}`,"tasks.moreActions":`更多操作:{name}`,"tasks.openExecution":`查看执行过程:{name}`,"tasks.pending":`待处理`,"tasks.pendingAndRunning":`待执行 / 进行中`,"tasks.scheduled":`定时与持续`,"tasks.sessionError":`Session 异常`,"tasks.waiting":`待执行`,"tasks.waitingAge":`已等待 {age}`,"tasks.viewExecution":`查看执行过程`,"tasks.viewResult":`查看结果`,"time.days":`{count} 天`,"time.hours":`{count} 小时`,"timeline.emptyGoal":`这个 Goal 还没有新动态`,"timeline.emptyGoalDescription":`你可以直接询问进度或下发新的纠偏信息。`,"timeline.emptyWorkspace":`今天的工作区很安静`,"timeline.emptyWorkspaceDescription":`向 LoopX 管家描述一个 Goal,或询问今天最值得关注的事情。`,"timeline.gateHistory":`{count} 项历史 Gate`,"timeline.pending":`正在整理…`,"returnDelivery.queued":`结论等待回传`,"returnDelivery.verifying":`正在核验送达,不会重复发送`,"returnDelivery.delivered":`已送达原受众`,"returnDelivery.reconciled":`恢复后已核验送达`,"returnDelivery.unverified":`送达仍明确未核验`,"timeline.runCompleted":`{run}:已完成`,"timeline.review":`查看处理方式`,"timeline.reviewAndConfirm":`查看并确认`,"timeline.waitingConfirmation":`待你确认`}};function Wi(e,t){return t?Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e):e}function Gi(){try{return window.localStorage.getItem(`loopx-pw-locale`)===`en`?`en`:`zh-CN`}catch{return`zh-CN`}}function Ki({children:e}){let[t,n]=(0,V.useState)(Gi);function r(e){n(e);try{window.localStorage.setItem(Hi,e)}catch{}}(0,V.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,V.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Wi(Ui[t][e],n)}),[t]);return(0,H.jsx)(Vi.Provider,{value:i,children:e})}function qi(){let e=(0,V.useContext)(Vi);if(!e)throw Error(`useWorkspaceI18n must be used within WorkspaceI18nProvider`);return e}function Ji(e,t){let n={安静运行:`state.quiet`,等你:`state.needsYou`,等待条件:`state.waiting`,推进中:`state.running`,需修复:`state.needsRepair`,已完成:`state.completed`,已停止:`state.stopped`}[e];return n?Ui[t][n]:e}function Yi(e,t){let n={busy:`runs.running`,completed:`runs.completed`,failed:`runs.failed`,queued:`runs.queued`,ready:`runs.ready`,resume_failed:`runs.resumeFailed`,running:`runs.running`,waiting:`runs.waiting`};return e?n[e]?t(n[e]):e:t(`runs.unknown`)}function Xi(e,t){if(!e)return null;let n=new Date(e).getTime();if(Number.isNaN(n))return null;let r=Date.now()-n;if(r<36e5)return null;let i=Math.floor(r/864e5);return i>=1?t(`time.days`,{count:i}):t(`time.hours`,{count:Math.floor(r/36e5)})}var Zi;function U(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;en?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Qi=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},$i=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Zi=globalThis).__zod_globalConfig??(Zi.__zod_globalConfig={});var ea=globalThis.__zod_globalConfig;function ta(e){return e&&Object.assign(ea,e),ea}function na(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ra(e,t){return typeof t==`bigint`?t.toString():t}function ia(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function aa(e){return e==null}function oa(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function sa(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){};function ha(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ga=ia(()=>{if(ea.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function _a(e){if(ha(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ha(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function va(e){return _a(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ya=new Set([`string`,`number`,`symbol`]);function ba(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xa(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function W(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Sa(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Ca={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function wa(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return xa(e,da(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ua(this,`shape`,e),e},checks:[]}))}function Ta(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return xa(e,da(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ua(this,`shape`,r),r},checks:[]}))}function Ea(e,t){if(!_a(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xa(e,da(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ua(this,`shape`,n),n}}))}function Da(e,t){if(!_a(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return xa(e,da(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ua(this,`shape`,n),n}}))}function Oa(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return xa(e,da(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ua(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ka(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return xa(t,da(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return ua(this,`shape`,i),i},checks:[]}))}function Aa(e,t,n){return xa(t,da(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return ua(this,`shape`,i),i}}))}function ja(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Pa(e){return typeof e==`string`?e:e?.message}function Fa(e,t,n){let r=e.message?e.message:Pa(e.inst?._zod.def?.error?.(e))??Pa(t?.error?.(e))??Pa(n.customError?.(e))??Pa(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Ia(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function La(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ra=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ra,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},za=U(`$ZodError`,Ra),Ba=U(`$ZodError`,Ra,{Parent:Error});function Va(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ha(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Qi;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Fa(e,a,ta())));throw ma(t,i?.callee),t}return o.value},Wa=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Fa(e,a,ta())));throw ma(t,i?.callee),t}return o.value},Ga=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Qi;return a.issues.length?{success:!1,error:new(e??za)(a.issues.map(e=>Fa(e,i,ta())))}:{success:!0,data:a.value}},Ka=Ga(Ba),qa=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Fa(e,i,ta())))}:{success:!0,data:a.value}},Ja=qa(Ba),Ya=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ua(e)(t,n,i)},Xa=e=>(t,n,r)=>Ua(e)(t,n,r),Za=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Wa(e)(t,n,i)},Qa=e=>async(t,n,r)=>Wa(e)(t,n,r),$a=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ga(e)(t,n,i)},eo=e=>(t,n,r)=>Ga(e)(t,n,r),to=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qa(e)(t,n,i)},no=e=>async(t,n,r)=>qa(e)(t,n,r),ro=/^[cC][0-9a-z]{6,}$/,io=/^[0-9a-z]+$/,ao=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,oo=/^[0-9a-vA-V]{20}$/,so=/^[A-Za-z0-9]{27}$/,co=/^[a-zA-Z0-9_-]{21}$/,lo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,uo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,fo=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,po=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,mo=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function ho(){return new RegExp(mo,`u`)}var go=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_o=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,vo=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,yo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,xo=/^[A-Za-z0-9_-]*$/,So=/^https?$/,Co=/^\+[1-9]\d{6,14}$/,wo=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,To=RegExp(`^${wo}$`);function Eo(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Do(e){return RegExp(`^${Eo(e)}$`)}function Oo(e){let t=Eo({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${wo}T(?:${r})$`)}var ko=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ao=/^-?\d+$/,jo=/^-?\d+(?:\.\d+)?$/,Mo=/^(?:true|false)$/i,No=/^null$/i,Po=/^[^A-Z]*$/,Fo=/^[^a-z]*$/,Io=U(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Lo={number:`number`,bigint:`bigint`,object:`date`},Ro=U(`$ZodCheckLessThan`,(e,t)=>{Io.init(e,t);let n=Lo[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{Io.init(e,t);let n=Lo[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bo=U(`$ZodCheckMultipleOf`,(e,t)=>{Io.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):sa(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Vo=U(`$ZodCheckNumberFormat`,(e,t)=>{Io.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ca[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Ao)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Ho=U(`$ZodCheckMaxLength`,(e,t)=>{var n;Io.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!aa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value;if(r.length<=t.maximum)return;let i=Ia(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Uo=U(`$ZodCheckMinLength`,(e,t)=>{var n;Io.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!aa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ia(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wo=U(`$ZodCheckLengthEquals`,(e,t)=>{var n;Io.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!aa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ia(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Go=U(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Io.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ko=U(`$ZodCheckRegex`,(e,t)=>{Go.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),qo=U(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Po,Go.init(e,t)}),Jo=U(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Fo,Go.init(e,t)}),Yo=U(`$ZodCheckIncludes`,(e,t)=>{Io.init(e,t);let n=ba(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Xo=U(`$ZodCheckStartsWith`,(e,t)=>{Io.init(e,t);let n=RegExp(`^${ba(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Zo=U(`$ZodCheckEndsWith`,(e,t)=>{Io.init(e,t);let n=RegExp(`.*${ba(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Qo=U(`$ZodCheckOverwrite`,(e,t)=>{Io.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),$o=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(` `))}},es={major:4,minor:4,patch:3},ts=U(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=es;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=ja(e),i;for(let a of t){if(a._zod.def.when){if(Ma(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Qi;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=ja(e,t))});else{if(e.issues.length===t)continue;r||=ja(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(ja(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Qi;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Qi;return o.then(e=>t(e,r,a))}return t(o,r,a)}}la(e,`~standard`,()=>({validate:t=>{try{let n=Ka(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ja(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),ns=U(`$ZodString`,(e,t)=>{ts.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ko(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),rs=U(`$ZodStringFormat`,(e,t)=>{Go.init(e,t),ns.init(e,t)}),is=U(`$ZodGUID`,(e,t)=>{t.pattern??=uo,rs.init(e,t)}),as=U(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=fo(e)}else t.pattern??=fo();rs.init(e,t)}),os=U(`$ZodEmail`,(e,t)=>{t.pattern??=po,rs.init(e,t)}),ss=U(`$ZodURL`,(e,t)=>{rs.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===So.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),cs=U(`$ZodEmoji`,(e,t)=>{t.pattern??=ho(),rs.init(e,t)}),ls=U(`$ZodNanoID`,(e,t)=>{t.pattern??=co,rs.init(e,t)}),us=U(`$ZodCUID`,(e,t)=>{t.pattern??=ro,rs.init(e,t)}),ds=U(`$ZodCUID2`,(e,t)=>{t.pattern??=io,rs.init(e,t)}),fs=U(`$ZodULID`,(e,t)=>{t.pattern??=ao,rs.init(e,t)}),ps=U(`$ZodXID`,(e,t)=>{t.pattern??=oo,rs.init(e,t)}),ms=U(`$ZodKSUID`,(e,t)=>{t.pattern??=so,rs.init(e,t)}),hs=U(`$ZodISODateTime`,(e,t)=>{t.pattern??=Oo(t),rs.init(e,t)}),gs=U(`$ZodISODate`,(e,t)=>{t.pattern??=To,rs.init(e,t)}),_s=U(`$ZodISOTime`,(e,t)=>{t.pattern??=Do(t),rs.init(e,t)}),vs=U(`$ZodISODuration`,(e,t)=>{t.pattern??=lo,rs.init(e,t)}),ys=U(`$ZodIPv4`,(e,t)=>{t.pattern??=go,rs.init(e,t),e._zod.bag.format=`ipv4`}),bs=U(`$ZodIPv6`,(e,t)=>{t.pattern??=_o,rs.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),xs=U(`$ZodCIDRv4`,(e,t)=>{t.pattern??=vo,rs.init(e,t)}),Ss=U(`$ZodCIDRv6`,(e,t)=>{t.pattern??=yo,rs.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Cs(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var ws=U(`$ZodBase64`,(e,t)=>{t.pattern??=bo,rs.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Cs(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Ts(e){if(!xo.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Cs(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Es=U(`$ZodBase64URL`,(e,t)=>{t.pattern??=xo,rs.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Ts(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ds=U(`$ZodE164`,(e,t)=>{t.pattern??=Co,rs.init(e,t)});function Os(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var ks=U(`$ZodJWT`,(e,t)=>{rs.init(e,t),e._zod.check=n=>{Os(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),As=U(`$ZodNumber`,(e,t)=>{ts.init(e,t),e._zod.pattern=e._zod.bag.pattern??jo,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),js=U(`$ZodNumberFormat`,(e,t)=>{Vo.init(e,t),As.init(e,t)}),Ms=U(`$ZodBoolean`,(e,t)=>{ts.init(e,t),e._zod.pattern=Mo,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Ns=U(`$ZodNull`,(e,t)=>{ts.init(e,t),e._zod.pattern=No,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Ps=U(`$ZodUnknown`,(e,t)=>{ts.init(e,t),e._zod.parse=e=>e}),Fs=U(`$ZodNever`,(e,t)=>{ts.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Is(e,t,n){e.issues.length&&t.issues.push(...Na(n,e.issues)),t.value[n]=e.value}var Ls=U(`$ZodArray`,(e,t)=>{ts.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;eIs(t,n,e))):Is(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Rs(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Na(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function zs(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Sa(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Bs(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Rs(e,n,i,t,u,d))):Rs(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Vs=U(`$ZodObject`,(e,t)=>{if(ts.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=ia(()=>zs(t));la(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=ha,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Rs(n,t,e,s,r,i))):Rs(a,t,e,s,r,i)}return i?Bs(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Hs=U(`$ZodObjectJIT`,(e,t)=>{Vs.init(e,t);let n=e._zod.parse,r=ia(()=>zs(t)),i=e=>{let t=new $o([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=fa(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=fa(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(` if (${n}.issues.length) { @@ -117,13 +117,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs. `)}if(e||a)break}i=a?i:i+1}catch(e){if(n?.aborted||(i+=1,i>=4))throw e;await new Promise(e=>globalThis.setTimeout(e,250*2**(i-1)))}}if(!a)throw new Eh(`Agent 事件流连接已断开。`,{reconnect_attempts:i})}async function Jh(e,t){return Lh(`/api/chat/sessions/${e}/turns/${t}/interrupt`,{method:`POST`,body:`{}`})}async function Yh(e,t,n={}){let r=await Gh(e,t,n.clientTurnId??crypto.randomUUID(),n.attachments);return n.onPhase?.(`turn.accepted`,r.turn_id),Xh(e,r.turn_id,r.events_url,n)}async function Xh(e,t,n,r={}){let i=null,a={failure:null,interrupted:null};try{await qh(n,e=>{r.onPhase?.(e.kind,t),(e.kind===`answer.delta`||e.kind===`assistant.delta`)&&r.onDelta?.(String(e.payload.text??``)),e.kind===`agent.phase`&&r.onActivity?.(String(e.payload.label??`Agent 正在处理`)),e.kind===`turn.completed`&&(i=e.payload.response),e.kind===`turn.failed`&&(a.failure=e.payload),e.kind===`turn.interrupted`&&(a.interrupted=e.payload)},r.signal)}catch(i){throw i instanceof Eh&&!r.signal?.aborted?new Eh(i.message,{...i.payload,events_url:n,reconnectable:!0,session_id:e,turn_id:t}):i}if(a.failure)throw new Eh(String(a.failure.message||`Agent 回合失败。`),a.failure);if(a.interrupted)throw new Eh(`Agent 回合已中断。`,{...a.interrupted,error_code:`turn_interrupted`,session_id:e,turn_id:t});return{response:bh.parse(i),sessionId:e,turnId:t}}async function Zh(e,t,n={}){return Xh(e,t,`/api/chat/sessions/${e}/turns/${t}/events`,n)}async function Qh(e){let t=xh.parse(await Lh(`/api/chat/sessions/${e}`,{keepalive:!0,method:`DELETE`}));if(t.session_id!==e)throw new Eh(`Agent 会话关闭回执与本次请求不一致。`,{session_id:t.session_id});return t}async function $h(e){return Lh(`/api/chat/sessions/${e}/resume`,{method:`POST`,body:`{}`})}function eg(e){return{goal_id:e.goalId,enabled:e.enabled,...e.modelConfig===void 0?{}:{model_config:e.modelConfig},...e.enabled?{max_children:e.maxChildren,allowed_domains:e.allowedDomains}:{}}}function tg(e,t){let n=e.after.orchestration,r=[...new Set(t.allowedDomains)],i=e.feature_summary.multi_subagent===`enabled`;if(!(e.goal_id===t.goalId&&i===t.enabled&&(t.modelConfig===void 0||JSON.stringify(n.model_config??null)===JSON.stringify(t.modelConfig))&&(t.enabled?n.max_children===t.maxChildren&&JSON.stringify(n.allowed_domains)===JSON.stringify(r):n.spawn_allowed===!1&&n.max_children===0)))throw new Eh(`Goal 子代理配置回执与本次请求不一致,界面已停止更新。`,{after:e.after,goal_id:e.goal_id});return e}async function ng(e){let t=wh.parse(await Lh(`/api/chat/goal-subagents/dry-run`,{method:`POST`,body:JSON.stringify(eg(e))}));if(!t.dry_run||t.execute||t.written)throw new Eh(`Goal 子代理预览返回了非预览回执,已停止进入确认状态。`,{result:t});return tg(t,e)}async function rg(e,t){let n=wh.parse(await Lh(`/api/chat/goal-subagents/apply`,{method:`POST`,body:JSON.stringify({...eg(e),preview_id:t})}));if(n.preview_id!==t||n.dry_run||!n.execute)throw new Eh(`Goal 子代理写入回执与本次确认不一致,界面已停止更新。`,{result:n});if(n.changed&&(!n.written||!n.global_sync.executed||!n.global_sync.readback.verified))throw new Eh(`Goal 子代理设置未通过共享状态读回验证。`,{result:n});return tg(n,e)}var ig=Y({ok:X(!0),targets:J(Y({enabled:q(),provider:G(),target_name:G()}))});async function ag(){return ig.parse(await Lh(`/api/chat/goal-channel/targets`)).targets}var og=Y({ok:q(),blocker:G().optional(),public_summary:G().optional(),status:G().optional()});async function sg(e){return og.parse(await Lh(`/api/chat/goal-channel/setup`,{method:`POST`,body:JSON.stringify({execute:e.execute,goal_id:e.goalId,target:e.target})}))}async function cg(e){return og.parse(await Lh(`/api/chat/goal-channel/configure`,{method:`POST`,body:JSON.stringify({auto_notify_human_gates:e.autoNotify,goal_id:e.goalId})}))}var lg=Y({schema_version:X(`periodic_report_schedule_v0`),schedule_id:G(),rrule:G(),timezone:G()});Y({schema_version:X(`periodic_report_machine_defaults_v0`),enabled:q(),inheritance:X(`live_machine_default`),profile_preset:G().optional(),route_ref:G().optional(),timezone:G(),schedule:lg.nullable().optional()});var ug=Y({schema_version:X(`loopx_machine_configuration_v0`),namespaces:hd(G(),hd(G(),rd()))}),dg=Y({namespace:G(),title:G(),description:G(),schema_versions:J(G()).min(1),configuration_template:hd(G(),rd()),template_status:_d([`ready`,`schema_only`])}),fg=Y({schema_version:X(`machine_configuration_catalog_v0`),namespaces:J(dg)}),pg=Y({key:G(),label:G(),description:G(),input_kind:_d([`boolean`,`number`,`select`,`string_list`,`text`,`periodic_report_schedule`]),nullable:q().optional(),required:q(),minimum:K().int().optional(),maximum:K().int().optional(),options:J(G()).optional()}),mg=Y({schema_version:X(`capability_configuration_editor_v0`),editable:q(),supported_scopes:J(_d([`goal`,`machine`])),writable_scopes:J(_d([`goal`,`machine`])),fields:J(pg),read_only_reason:G().optional()}),hg=Y({schema_version:X(`capability_configuration_catalog_v0`),capabilities:J(Y({capability_id:G(),display_name:G(),description:G(),available_scopes:J(_d([`goal`,`machine`])),machine_namespace:G().optional(),goal_feature_id:G().optional(),effective_value_policy:X(`goal_override_over_live_machine_default`).optional(),availability:G().optional(),default:hd(G(),rd()).optional(),current:hd(G(),rd()).optional(),machine_current:hd(G(),rd()).optional(),effective_configuration:Y({schema_version:X(`capability_configuration_resolution_v0`),capability_id:G(),source:_d([`goal_override`,`machine_default`,`capability_default`,`not_configured`]),configuration:hd(G(),rd()).nullable(),inherited:q(),goal_override_present:q(),machine_default_present:q(),effective_revision:G()}).optional(),documentation:hd(G(),rd()).optional(),context_contribution:Y({supported_phases:J(_d([`before_plan`,`before_delegate`,`after_delegate_result`])),target:X(`coordinator`),activation:X(`with_capability`),receipt_required:X(!0)}).optional(),configuration_editor:mg}))}),gg=Y({ok:X(!0),schema_version:X(`goal_configuration_inspection_v0`),status:X(`configured`),goal_id:G(),revision:G(),available_capabilities:J(G()),capability_catalog:hg}),_g=Y({ok:X(!0),goal_id:G(),capability_id:G(),changed_fields:J(G()),goal_configuration:hd(G(),rd()).nullable(),capability_catalog:hg}),vg=_g.extend({schema_version:X(`goal_configuration_update_plan_v0`),status:X(`preview`),action:_d([`create`,`update`,`delete`,`unchanged`]),current_revision:G(),desired_revision:G(),base_revision:G(),plan_revision:G(),writes_required:K().int().nonnegative()}),yg=ld([_g.extend({schema_version:X(`goal_configuration_transaction_v0`),status:_d([`applied`,`unchanged`]),plan_revision:G(),applied_revision:G(),readback_verified:X(!0)}),Y({ok:X(!1),schema_version:X(`goal_configuration_transaction_v0`),status:X(`partial_write`),goal_id:G(),capability_id:G(),plan_revision:G(),applied_revision:G().nullable(),source_written:X(!0),shared_sync_pending:X(!0),readback_verified:q(),changed_fields:J(G()),goal_configuration:hd(G(),rd()).nullable(),capability_catalog:hg,error:G(),recommended_action:G()})]),bg=Y({ok:X(!0),available_namespaces:J(G()),namespace_catalog:fg.optional().default({schema_version:`machine_configuration_catalog_v0`,namespaces:[]}),capability_catalog:hg,changed_namespaces:J(G()).optional().default([]),invalid_namespaces:J(G()).optional().default([]),machine_configuration:ug.nullable().optional()}),xg=bg.extend({schema_version:X(`machine_configuration_inspection_v0`),status:_d([`configured`,`absent`,`invalid`]),revision:G()}),Sg=bg.extend({schema_version:X(`machine_configuration_update_plan_v0`),status:X(`preview`),action:_d([`create`,`update`,`delete`,`unchanged`]),current_revision:G(),desired_revision:G(),plan_revision:G(),writes_required:K().int().nonnegative(),machine_configuration:ug.nullable()}),Cg=bg.extend({schema_version:X(`machine_configuration_transaction_v0`),status:_d([`applied`,`unchanged`]),plan_revision:G(),transaction_id:G().nullable(),readback_verified:X(!0),rollback_available:q(),applied_revision:G().optional(),prior_revision:G().optional()}),wg=bg.extend({schema_version:X(`machine_configuration_rollback_plan_v0`),status:X(`preview`),action:_d([`delete`,`restore`,`unchanged`,`blocked`]),reason:G(),transaction_id:G(),plan_revision:G(),rollback_allowed:q(),writes_required:K().int().nonnegative()}),Tg=bg.extend({schema_version:X(`machine_configuration_rollback_receipt_v0`),status:_d([`rolled_back`,`unchanged`]),transaction_id:G(),plan_revision:G(),rollback_id:G().nullable(),readback_verified:X(!0)});async function Eg(){return xg.parse(await Lh(`/api/chat/machine-configuration`))}async function Dg(e){let t=new URLSearchParams({goal_id:e});return gg.parse(await Lh(`/api/chat/goal-configuration?${t.toString()}`))}async function Og(e,t,n){return vg.parse(await Lh(`/api/chat/goal-configuration/preview`,{method:`POST`,body:JSON.stringify({goal_id:e,capability_id:t,configuration:n})}))}async function kg(e,t,n,r){return yg.parse(await Lh(`/api/chat/goal-configuration/apply`,{method:`POST`,body:JSON.stringify({goal_id:e,capability_id:t,configuration:n,expected_plan_revision:r})}))}async function Ag(e,t){return Sg.parse(await Lh(`/api/chat/machine-configuration/preview`,{method:`POST`,body:JSON.stringify({namespace:e,namespace_configuration:t})}))}async function jg(e,t,n){return Cg.parse(await Lh(`/api/chat/machine-configuration/apply`,{method:`POST`,body:JSON.stringify({expected_plan_revision:n,namespace:e,namespace_configuration:t})}))}async function Mg(e){return Sg.parse(await Lh(`/api/chat/machine-configuration/preview`,{method:`POST`,body:JSON.stringify({namespace:e,operation:`remove`})}))}async function Ng(e,t){return Cg.parse(await Lh(`/api/chat/machine-configuration/apply`,{method:`POST`,body:JSON.stringify({expected_plan_revision:t,namespace:e,operation:`remove`})}))}async function Pg(e){return wg.parse(await Lh(`/api/chat/machine-configuration/rollback`,{method:`POST`,body:JSON.stringify({execute:!1,transaction_id:e})}))}async function Fg(e,t){return Tg.parse(await Lh(`/api/chat/machine-configuration/rollback`,{method:`POST`,body:JSON.stringify({execute:!0,expected_plan_revision:t,transaction_id:e})}))}var Ig=Y({ok:X(!0),goals:J(Y({goal_id:G(),repository:Y({branch:G(),identity:G(),label:G(),read_only:X(!0)})}))});async function Lg(){return Ig.parse(await Lh(`/api/chat/goals/contexts`)).goals}var Rg=Y({ok:X(!0),apps:J(Y({active:q(),app_ref:G(),brand:G(),health_error_code:G().nullable().default(null),label:G(),ready:q(),reply_ready:q().default(!1)}))});async function zg(){return Rg.parse(await Lh(`/api/chat/lark/apps`)).apps}var Bg=Y({ok:X(!0),app_ref:G(),error:G().nullable(),setup_id:G(),status:_d([`starting`,`waiting_for_feishu`,`ready`,`failed`,`cancelled`]),verification_url:G().url().nullable()});async function Vg(e){return Bg.parse(await Lh(`/api/chat/lark/app-setups`,{method:`POST`,body:JSON.stringify({app_ref:e.appRef,brand:e.brand})}))}async function Hg(e){return Bg.parse(await Lh(`/api/chat/lark/app-setups/${encodeURIComponent(e)}`))}async function Ug(e){return Bg.parse(await Lh(`/api/chat/lark/app-setups/${encodeURIComponent(e)}`,{method:`DELETE`}))}var Wg=[`invalid_event`,`binding_unavailable`,`chat_mismatch`,`topic_mismatch`,`route_ambiguous`,`self_message`,`invalid_routing_state`,`not_addressed`],Gg=Y({ok:X(!0),chats:J(Y({chat_id:G(),chat_name:G()}))});async function Kg(e,t){let n=new URLSearchParams({app_ref:e});return t&&n.set(`query`,t),Gg.parse(await Lh(`/api/chat/lark/chats?${n.toString()}`)).chats}var qg=Y({ok:X(!0),connections:J(Y({conversation_kind:_d([`goal`,`manager`]).default(`goal`),agent_id:G().nullable().default(null),connection_id:G(),app_label:G(),app_ref:G(),capture_scope:_d([`addressed_only`,`configured_chat_all`]).default(`addressed_only`),chat_name:G(),enabled:q(),goal_id:G(),goal_title:G(),health_error_code:G().nullable().default(null),history_permission_guidance:Y({action:X(`enable_application_scopes_and_publish`),api_document_url:G().url(),capability:X(`group_history_pagination`),identity:X(`bot`),required_scopes:pd([X(`im:message.group_msg`),X(`im:message.group_msg.include_bot:read`)]),schema_version:X(`lark_bot_group_history_permission_guidance_v0`)}).nullable().default(null),incoming_mode:_d([`mentions`,`all`]),ingress_mode:_d([`live_steering`,`session_queue`,`async_inbox`,`direct_session`]).default(`async_inbox`),event_count:K().int().nonnegative().default(0),last_event_reason:_d(Wg).nullable().default(null).catch(null),last_event_status:G().nullable().default(null),listener_error_code:G().nullable().default(null),listener_status:_d([`starting`,`listening`,`retrying`,`stopped`]).nullable().default(null),replied_count:K().int().nonnegative().default(0),reply_ready:q().default(!1),reply_mode:X(`topic_reply`),session_bound:q().default(!1),target_ref:G(),topic_name:G(),topic_setup_required:q()}))});async function Jg(){return qg.parse(await Lh(`/api/chat/lark/connections`)).connections}async function Yg(e){return og.parse(await Lh(`/api/chat/lark/connections`,{method:`POST`,body:JSON.stringify({...e.agentBindings?{agent_bindings:e.agentBindings.map(e=>({agent_id:e.agentId,app_ref:e.appRef}))}:{},...e.agentId?{agent_id:e.agentId}:{},...e.appRef?{app_ref:e.appRef}:{},...e.connectionId?{connection_id:e.connectionId}:{},conversation_kind:e.conversationKind??`goal`,capture_scope:e.captureScope,chat_id:e.chatId,chat_name:e.chatName,execute:e.execute,goal_id:e.goalId,incoming_mode:e.incomingMode,ingress_mode:e.ingressMode,reply_mode:e.replyMode})}))}async function Xg(e,t){let n=new URLSearchParams({goal_id:e,connection_id:t});return og.parse(await Lh(`/api/chat/lark/connections?${n.toString()}`,{method:`DELETE`}))}function Zg(e){return{loadedUrl:null,projectionRevision:0,requestedUrl:e,selectionRevision:0,requestGeneration:0}}function Qg(e,t){return e.selectionRevision+=1,e.requestedUrl=t,e.selectionRevision}function $g(e,t,n){if(n.background)return e.requestedUrl!==null||e.loadedUrl!==t?null:(e.requestGeneration+=1,{background:!0,projectionRevision:e.projectionRevision,selectionRevision:e.selectionRevision,url:t,generation:e.requestGeneration});let r=n.selectionRevision??e.selectionRevision+1;return n.selectionRevision!==void 0&&e.selectionRevision!==r?null:(e.selectionRevision=r,e.projectionRevision+=1,e.requestedUrl=t,e.requestGeneration+=1,{background:!1,projectionRevision:e.projectionRevision,selectionRevision:r,url:t,generation:e.requestGeneration})}function e_(e,t){return t.generation===e.requestGeneration&&e.projectionRevision===t.projectionRevision&&e.selectionRevision===t.selectionRevision}function t_(e,t){return e_(e,t)&&(!t.background||e.requestedUrl===null&&e.loadedUrl===t.url)}function n_(e,t,n){return t.get(e)===n}function r_(e,t,n,r){return e.filter(e=>n_(r(e),n,t))}function i_(e,t,n){let r=new Set,i=[];for(let a of[...e,...t]){let e=n(a);e==null||r.has(e)||(r.add(e),i.push(a))}return i}var a_=[`runs_24h`,`runs_7d`,`quota_spend_slots_24h`,`quota_spend_slots_7d`,`automation_run_count_24h`,`automation_run_count_7d`,`progress_signal_run_count_24h`,`progress_signal_run_count_7d`],o_=[`input_tokens_24h`,`input_tokens_7d`,`output_tokens_24h`,`output_tokens_7d`,`cache_tokens_24h`,`cache_tokens_7d`,`cost_usd_24h`,`cost_usd_7d`,`duration_ms_24h`,`duration_ms_7d`],s_=[`accounting`,`decision`,`evidence`,`state`,`work`],c_={accounting:0,decision:0,evidence:0,state:0,work:0},l_={runs_24h:0,runs_7d:0,quota_spend_slots_24h:0,quota_spend_slots_7d:0,automation_run_count_24h:0,automation_run_count_7d:0,progress_signal_run_count_24h:0,progress_signal_run_count_7d:0};function u_(e,t){let n={...e};for(let r of a_)n[r]=(Number(e[r])||0)+(Number(t[r])||0);for(let r of o_)(e[r]!==void 0||t[r]!==void 0)&&(n[r]=(e[r]??0)+(t[r]??0));return n}function d_(e,t){return!e.length||t<=0?e:e.map(e=>({...e,project_share_24h:Math.round((Number(e.runs_24h)||0)/t*1e3)/1e3}))}function f_(e,t){let n={...e};for(let r of s_)n[r]=(e[r]??0)+(t[r]??0);return n}function p_(e){let t={events_24h:0,events_7d:0,by_class_24h:{...c_},by_class_7d:{...c_}};for(let n of e)t.events_24h+=n.events_24h,t.events_7d+=n.events_7d,t.by_class_24h=f_(t.by_class_24h,n.by_class_24h),t.by_class_7d=f_(t.by_class_7d,n.by_class_7d);return t}function m_(e,t,n){if(!e&&!t)return null;let r=r_(e?.goals??[],`active`,n,e=>e.goal_id),i=r_(t?.goals??[],`stopped`,n,e=>e.goal_id),a=i_(r,i,e=>e.goal_id),o=p_(r),s=p_(i),c={events_24h:o.events_24h+s.events_24h,events_7d:o.events_7d+s.events_7d,by_class_24h:f_(o.by_class_24h,s.by_class_24h),by_class_7d:f_(o.by_class_7d,s.by_class_7d)};return{...e??t,goals:a,sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),totals:c}}function h_(e,t,n){if(!e&&!t)return null;let r=i_([...r_(e?.items??[],`active`,n,e=>e.goal_id),...r_(t?.items??[],`stopped`,n,e=>e.goal_id)],[],e=>`${e.goal_id}:${e.decision_kind??``}:${e.decision_at??``}`),i={decision_count:(e?.summary.decision_count??0)+(t?.summary.decision_count??0),stale_count:r.filter(e=>e.stale_by_age).length,rebase_required_count:(e?.summary.rebase_required_count??0)+(t?.summary.rebase_required_count??0),fresh_count:(e?.summary.fresh_count??0)+(t?.summary.fresh_count??0)};return{...e??t,items:r,sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),summary:i}}function g_(e,t){return i_([...e,...t].sort((e,t)=>t.generated_at.localeCompare(e.generated_at)),[],e=>`${e.goal_id}:${e.generated_at}:${e.classification??``}`)}function __(e,t,n){let r=i_(r_(e.items,`active`,n,e=>e.goal_id),r_(t.items,`stopped`,n,e=>e.goal_id),e=>e.goal_id);return{...e,item_count:r.length,items:r,needs_controller:r.filter(e=>e.waiting_on===`controller`).length,needs_codex:r.filter(e=>e.waiting_on===`codex`).length,needs_user_or_controller:r.filter(e=>[`user_or_controller`,`controller`].includes(e.waiting_on)).length,watching_external_evidence:r.filter(e=>e.waiting_on===`external_evidence`).length}}function v_(e){let t=e.todo_id?.trim()||``;return t?`${e.goal_id}:${t}`:`${e.goal_id}:synthetic:${e.role??``}:${e.index??``}:${e.text??``}`}function y_(e){let t={...l_};for(let n of e){for(let e of a_)t[e]+=Number(n[e])||0;for(let e of o_)n[e]!==void 0&&(t[e]=(t[e]??0)+n[e])}return t}function b_(e,t,n){if(!e&&!t)return null;let r=r_(e?.items??[],`active`,n,e=>e.goal_id),i=r_(t?.items??[],`stopped`,n,e=>e.goal_id),a=i_(r,i,v_);return{...e??t,current_projected_count:r.length+i.length,items:a,rollout_event_count:a.reduce((e,t)=>e+(t.event_count??0),0),total_count:a.length}}function x_(e,t,n){if(!e&&!t)return null;let r=r_(e?.goals??[],`active`,n,e=>e.goal_id),i=r_(t?.goals??[],`stopped`,n,e=>e.goal_id),a=i_(r,i,e=>e.goal_id),o=u_(y_(r),y_(i));return{...e??t,goals:d_(a,Number(o.runs_24h)||0),sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),totals:o}}function S_(e,t,n){if(!e&&!t)return null;let r=(e?.agents??[]).filter(e=>e.goal_ids.some(e=>n_(e,n,`active`))||(e.current_todo?.goal_id?n_(e.current_todo.goal_id,n,`active`):!1)),i=(t?.agents??[]).filter(e=>e.goal_ids.some(e=>n_(e,n,`stopped`))||(e.current_todo?.goal_id?n_(e.current_todo.goal_id,n,`stopped`):!1)),a=i_(r,i,e=>e.agent_id).map(e=>{let t=i.find(t=>t.agent_id===e.agent_id);return t?{...e,goal_ids:Array.from(new Set([...e.goal_ids??[],...t.goal_ids]))}:e});return{...e??t,agents:a,source_summary:(e??t)?.source_summary?{...(e??t).source_summary,projected_agent_count:a.length,registered_agent_count:new Set(a.map(e=>e.agent_id)).size}:(e??t)?.source_summary}}function C_(e,t,n){if(!e&&!t)return null;let r=i_(r_(e?.goals??[],`active`,n,e=>e.goal_id),r_(t?.goals??[],`stopped`,n,e=>e.goal_id),e=>e.goal_id);return{...e??t,goals:r}}function w_(e,t){let n=t.goal_projection?.scope;if(n!==`active`&&n!==`stopped`)return t;let r=n,i=t.run_history.goals,a=e.run_history.goals,o=i_(r===`active`?i:a.filter(e=>e.activation_state!==`stopped`),r===`stopped`?i:a.filter(e=>e.activation_state===`stopped`),e=>e.id),s=new Map(o.map(e=>[e.id,e.activation_state])),c=r===`active`?t:e,l=r===`stopped`?t:e,u=e.goal_projection?.registry_revision??null,d=t.goal_projection?.registry_revision??null,f=u===null||d===null||u===d;return{...e,agent_management_projection:S_(c.agent_management_projection,l.agent_management_projection,s),attention_queue:__(c.attention_queue,l.attention_queue,s),decision_freshness_summary:h_(c.decision_freshness_summary,l.decision_freshness_summary,s),event_ledger_summary:m_(c.event_ledger_summary,l.event_ledger_summary,s),goal_channel_notification_projection:C_(c.goal_channel_notification_projection,l.goal_channel_notification_projection,s),goal_projection:{schema_version:`loopx_goal_projection_scope_v0`,...t.goal_projection,complete:f,projected_goal_count:o.length,registry_goal_count:t.goal_projection?.registry_goal_count??0,scope:`all`},run_history:{...e.run_history,goal_count:o.length,goals:o,recent_runs:g_(c.run_history.recent_runs,l.run_history.recent_runs),run_count:c.run_history.run_count+l.run_history.run_count},todo_index:b_(c.todo_index,l.todo_index,s),usage_summary:x_(c.usage_summary,l.usage_summary,s)}}function T_(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,O_=E_,k_=(e,t)=>n=>{if(t?.variants==null)return O_(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=D_(t)||D_(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return O_(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},A_=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t({classGroupId:e,validator:t}),M_=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),N_=`-`,P_=[],F_=`arbitrary..`,I_=e=>{let t=z_(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return R_(e);let n=e.split(N_);return L_(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?A_(i,t):t:i||P_}return n[e]||P_}}},L_=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=L_(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(N_):e.slice(t).join(N_),s=a.length;for(let e=0;ee.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?F_+r:void 0})(),z_=e=>{let{theme:t,classGroups:n}=e;return B_(n,t)},B_=(e,t)=>{let n=M_();for(let r in e){let i=e[r];V_(i,n,r,t)}return n},V_=(e,t,n,r)=>{let i=e.length;for(let a=0;a{if(typeof e==`string`){U_(e,t,n);return}if(typeof e==`function`){W_(e,t,n,r);return}G_(e,t,n,r)},U_=(e,t,n)=>{let r=e===``?t:K_(t,e);r.classGroupId=n},W_=(e,t,n,r)=>{if(q_(e)){V_(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(j_(n,e))},G_=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e{let n=e,r=t.split(N_),i=r.length;for(let e=0;e`isThemeGetter`in e&&e.isThemeGetter===!0,J_=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Y_=`!`,X_=`:`,Z_=[],Q_=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),$_=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;si?a-i:void 0;return Q_(t,l,c,u)};if(t){let e=t+X_,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Q_(Z_,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ev=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},tv=e=>({cache:J_(e.cacheSize),parseClassName:$_(e),sortModifiers:ev(e),postfixLookupClassGroupIds:nv(e),...I_(e)}),nv=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(rv),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Y_:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e0?` `+l:l)}return l},av=(...e)=>{let t=0,n,r,i=``;for(;t{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r{let n,r,i,a,o=o=>(n=tv(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=iv(e,n);return i(e,a),a};return a=o,(...e)=>a(av(...e))},cv=[],lv=e=>{let t=t=>t[e]||cv;return t.isThemeGetter=!0,t},uv=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,dv=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fv=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,pv=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,mv=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,hv=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_v=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vv=e=>fv.test(e),yv=e=>!!e&&!Number.isNaN(Number(e)),bv=e=>!!e&&Number.isInteger(Number(e)),xv=e=>e.endsWith(`%`)&&yv(e.slice(0,-1)),Sv=e=>pv.test(e),Cv=()=>!0,wv=e=>mv.test(e)&&!hv.test(e),Tv=()=>!1,Ev=e=>gv.test(e),Dv=e=>_v.test(e),Ov=e=>!Q(e)&&!$(e),kv=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Av=e=>Gv(e,Yv,Tv),Q=e=>uv.test(e),jv=e=>Gv(e,Xv,wv),Mv=e=>Gv(e,Zv,yv),Nv=e=>Gv(e,$v,Cv),Pv=e=>Gv(e,Qv,Tv),Fv=e=>Gv(e,qv,Tv),Iv=e=>Gv(e,Jv,Dv),Lv=e=>Gv(e,ey,Ev),$=e=>dv.test(e),Rv=e=>Kv(e,Xv),zv=e=>Kv(e,Qv),Bv=e=>Kv(e,qv),Vv=e=>Kv(e,Yv),Hv=e=>Kv(e,Jv),Uv=e=>Kv(e,ey,!0),Wv=e=>Kv(e,$v,!0),Gv=(e,t,n)=>{let r=uv.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Kv=(e,t,n=!1)=>{let r=dv.exec(e);return r?r[1]?t(r[1]):n:!1},qv=e=>e===`position`||e===`percentage`,Jv=e=>e===`image`||e===`url`,Yv=e=>e===`length`||e===`size`||e===`bg-size`,Xv=e=>e===`length`,Zv=e=>e===`number`,Qv=e=>e===`family-name`,$v=e=>e===`number`||e===`weight`,ey=e=>e===`shadow`,ty=sv(()=>{let e=lv(`color`),t=lv(`font`),n=lv(`text`),r=lv(`font-weight`),i=lv(`tracking`),a=lv(`leading`),o=lv(`breakpoint`),s=lv(`container`),c=lv(`spacing`),l=lv(`radius`),u=lv(`shadow`),d=lv(`inset-shadow`),f=lv(`text-shadow`),p=lv(`drop-shadow`),m=lv(`blur`),h=lv(`perspective`),g=lv(`aspect`),_=lv(`ease`),v=lv(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),$,Q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$,Q,c],T=()=>[vv,`full`,`auto`,...w()],E=()=>[bv,`none`,`subgrid`,$,Q],D=()=>[`auto`,{span:[`full`,bv,$,Q]},bv,$,Q],O=()=>[bv,`auto`,$,Q],k=()=>[`auto`,`min`,`max`,`fr`,$,Q],ee=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],te=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],A=()=>[`auto`,...w()],j=()=>[vv,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],M=()=>[vv,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],N=()=>[vv,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,$,Q],F=()=>[...b(),Bv,Fv,{position:[$,Q]}],ne=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],re=()=>[`auto`,`cover`,`contain`,Vv,Av,{size:[$,Q]}],I=()=>[xv,Rv,jv],L=()=>[``,`none`,`full`,l,$,Q],ie=()=>[``,yv,Rv,jv],R=()=>[`solid`,`dashed`,`dotted`,`double`],ae=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],oe=()=>[yv,xv,Bv,Fv],se=()=>[``,`none`,m,$,Q],ce=()=>[`none`,yv,$,Q],le=()=>[`none`,yv,$,Q],ue=()=>[yv,$,Q],z=()=>[vv,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Sv],breakpoint:[Sv],color:[Cv],container:[Sv],"drop-shadow":[Sv],ease:[`in`,`out`,`in-out`],font:[Ov],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Sv],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Sv],shadow:[Sv],spacing:[`px`,yv],text:[Sv],"text-shadow":[Sv],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,vv,Q,$,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,$,Q]}],"container-named":[kv],columns:[{columns:[yv,Q,$,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[bv,`auto`,$,Q]}],basis:[{basis:[vv,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[yv,vv,`auto`,`initial`,`none`,Q]}],grow:[{grow:[``,yv,$,Q]}],shrink:[{shrink:[``,yv,$,Q]}],order:[{order:[bv,`first`,`last`,`none`,$,Q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ee(),`normal`]}],"justify-items":[{"justify-items":[...te(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...te()]}],"align-content":[{content:[`normal`,...ee()]}],"align-items":[{items:[...te(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...te(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...te(),`baseline`]}],"place-self":[{"place-self":[`auto`,...te()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:j()}],"inline-size":[{inline:[`auto`,...M()]}],"min-inline-size":[{"min-inline":[`auto`,...M()]}],"max-inline-size":[{"max-inline":[`none`,...M()]}],"block-size":[{block:[`auto`,...N()]}],"min-block-size":[{"min-block":[`auto`,...N()]}],"max-block-size":[{"max-block":[`none`,...N()]}],w:[{w:[s,`screen`,...j()]}],"min-w":[{"min-w":[s,`screen`,`none`,...j()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...j()]}],h:[{h:[`screen`,`lh`,...j()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...j()]}],"max-h":[{"max-h":[`screen`,`lh`,...j()]}],"font-size":[{text:[`base`,n,Rv,jv]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Wv,Nv]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,xv,Q]}],"font-family":[{font:[zv,Pv,t]}],"font-features":[{"font-features":[Q]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,$,Q]}],"line-clamp":[{"line-clamp":[yv,`none`,$,Mv]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$,Q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$,Q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...R(),`wavy`]}],"text-decoration-thickness":[{decoration:[yv,`from-font`,`auto`,$,jv]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[yv,`auto`,$,Q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[bv,$,Q]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$,Q]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,$,Q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:ne()}],"bg-size":[{bg:re()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},bv,$,Q],radial:[``,$,Q],conic:[bv,$,Q]},Hv,Iv]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-bs":[{"border-bs":ie()}],"border-w-be":[{"border-be":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...R(),`hidden`,`none`]}],"divide-style":[{divide:[...R(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...R(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[yv,$,Q]}],"outline-w":[{outline:[``,yv,Rv,jv]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,Uv,Lv]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,Uv,Lv]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:ie()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[yv,jv]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,Uv,Lv]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[yv,$,Q]}],"mix-blend":[{"mix-blend":[...ae(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ae()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[yv]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[$,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[yv]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:ne()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,$,Q]}],filter:[{filter:[``,`none`,$,Q]}],blur:[{blur:se()}],brightness:[{brightness:[yv,$,Q]}],contrast:[{contrast:[yv,$,Q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Uv,Lv]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,yv,$,Q]}],"hue-rotate":[{"hue-rotate":[yv,$,Q]}],invert:[{invert:[``,yv,$,Q]}],saturate:[{saturate:[yv,$,Q]}],sepia:[{sepia:[``,yv,$,Q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$,Q]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[yv,$,Q]}],"backdrop-contrast":[{"backdrop-contrast":[yv,$,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,yv,$,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[yv,$,Q]}],"backdrop-invert":[{"backdrop-invert":[``,yv,$,Q]}],"backdrop-opacity":[{"backdrop-opacity":[yv,$,Q]}],"backdrop-saturate":[{"backdrop-saturate":[yv,$,Q]}],"backdrop-sepia":[{"backdrop-sepia":[``,yv,$,Q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,$,Q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[yv,`initial`,$,Q]}],ease:[{ease:[`linear`,`initial`,_,$,Q]}],delay:[{delay:[yv,$,Q]}],animate:[{animate:[`none`,v,$,Q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$,Q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":[`scale-3d`],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[$,Q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:z()}],"translate-x":[{"translate-x":z()}],"translate-y":[{"translate-y":z()}],"translate-z":[{"translate-z":z()}],"translate-none":[`translate-none`],zoom:[{zoom:[bv,$,Q]}],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,$,Q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":P()}],"scrollbar-track-color":[{"scrollbar-track":P()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,$,Q]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[yv,Rv,jv,Mv]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function ny(...e){return ty(E_(e))}var ry=k_(`inline-flex h-9 shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md border px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 disabled:pointer-events-none disabled:opacity-50 dark:focus-visible:ring-zinc-500`,{variants:{variant:{primary:`border-slate-900 bg-slate-950 text-white hover:bg-slate-800 dark:border-zinc-100 dark:bg-zinc-50 dark:text-zinc-950 dark:hover:bg-zinc-200`,secondary:`border-slate-200 bg-white text-slate-900 hover:bg-slate-50 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-100 dark:hover:bg-zinc-900`,ghost:`border-transparent bg-transparent text-slate-700 hover:bg-slate-100 dark:text-zinc-300 dark:hover:bg-zinc-900`},size:{sm:`h-8 px-2 text-xs`,md:`h-9 px-3 text-sm`,icon:`h-9 w-9 px-0`}},defaultVariants:{variant:`secondary`,size:`md`}});function iy({className:e,variant:t,size:n,...r}){return(0,H.jsx)(`button`,{className:ny(ry({variant:t,size:n}),e),type:`button`,...r})}function ay({className:e,...t}){return(0,H.jsx)(`section`,{className:ny(`rounded-lg border border-slate-200/80 bg-white/95 text-slate-950 shadow-[0_1px_2px_rgba(15,23,42,0.04)] dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50`,e),...t})}function oy({className:e,...t}){return(0,H.jsx)(`div`,{className:ny(`p-4 pt-0`,e),...t})}var sy=[`codex`,`claude`,`kiro`,`trae`,`coco`,`openai`,`anthropic`],cy=new Set([`acp`,`status_projection`]);function ly(e){let t=e.trim().toLowerCase().replace(/_/gu,`-`);for(let e of sy)if(t===e||t.startsWith(`${e}-`))return e;return t}function uy(e,t){let n=t?.trim().toLowerCase()??``;return n.length>0&&!cy.has(n)?ly(n):ly(e)}var dy={stop:`ready_stop`,resume:`resume_review`,delete:`delete_review`};function fy(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function py(e){return typeof e==`string`&&e.trim().length>0?e:null}function my(e){let t=fy(e.projection);if(t?.schema_version!==`loopx_operation_projection_v0`)return null;let n=py(t.title),r=py(t.subtitle),i=py(t.focus),a=py(t.warning);if(!n||!r||!i||!a||!Array.isArray(t.fields))return null;let o=[];for(let e of t.fields){let t=fy(e),n=py(t?.label),r=py(t?.value);if(!n||!r)return null;o.push({label:n,value:r})}return{title:n,subtitle:r,focus:i,fields:o,warning:a}}function hy(e){let t=fy(e);if(t?.action_kind!==`operation.execute`)return;let n=fy(t.normalized_parameters),r=fy(t.operation);if(!n||r?.schema_version!==`loopx_operation_envelope_v0`)return;let i=py(r.operation_id),a=py(r.confirmation_digest),o=py(r.expires_at),s=my(n);if(!i||!a||!o||!s||i!==t.proposal_id)return;let c=r.lifecycle_state;if(c!==`awaiting_confirmation`&&c!==`claimed`&&c!==`outcome_observed`)return;let l={schemaVersion:`operation_review_frame_v0`,operationId:i,confirmationDigest:a,lifecycleState:c,simulated:fy(n.projection).simulated===!0,expiresAt:o,content:s};if(c===`awaiting_confirmation`)return{...l,kind:`confirmation`,attentionKind:`authority`,interactionMode:`confirm_reject`,decisions:[`confirm`,`reject`]};if(c===`claimed`)return{...l,kind:`pending`,attentionKind:`progress`,interactionMode:`inform`};let u=fy(r.outcome);if(!u)return;let d=u.outcome===`rejected_by_operator`,f=u.simulation===!0||l.simulated;return{...l,kind:`result`,attentionKind:`progress`,interactionMode:`inform`,resultKind:d?`rejected`:f?`simulation_completed`:`completed`,resultDeliveryVerified:fy(r.result_delivery)!==null,summary:py(u.summary)??``}}function gy(e){let t=fy(e)??{},n={schemaVersion:`action_review_plan_v0`,proposalId:typeof t.proposal_id==`string`?t.proposal_id:``,sourceFingerprint:typeof t.expected_state_fingerprint==`string`?t.expected_state_fingerprint:``},r=hy(t),i=e=>({...n,...e,...r?{operationFrame:r}:{}}),a=(e,t)=>i({interaction:e,reason:t,canApply:!1}),o=t.action_kind===`goal.lifecycle`;if(o&&t.gate!=null||t.status===`gated`)return a(`gated`,`authority_gate`);if(o&&t.stale!=null||t.status===`stale`)return a(`refresh`,`stale_proposal`);if(t.status===`applied`)return fy(t.receipt)?.projection_verified===!0&&(t.action_kind!==`operation.execute`||fy(fy(t.operation)?.result_delivery)!==null)?a(`completed`,`readback_verified`):a(`repair`,`readback_unverified`);if(t.status===`applying`)return a(`pending`,`apply_pending`);if(t.status===`failed`||t.error!=null)return a(`repair`,`apply_failed`);if(t.status!==`preview_ready`&&t.status!==`deferred`)return a(`inactive`,`inactive_proposal`);let s=(e,t=!0)=>i({interaction:`review`,reason:e,canApply:t});if(t.action_kind!==`goal.lifecycle`)return s(t.permission_classification===`protected`?`protected_action`:`action_review`);let c=t.validation_evidence,l=t.available_transitions;if(!(py(t.proposal_id)!==null&&py(t.expected_state_fingerprint)!==null&&Array.isArray(c)&&c.length>0&&c.every(e=>py(e)!==null)&&Array.isArray(l)&&l.includes(`apply`)))return a(`refresh`,`incomplete_proposal`);let u=fy(t.normalized_parameters),d=fy(t.context),f=u?.operation,p=py(u?.goal_id);if(!p||d?.goal_id!=null&&d.goal_id!==p)return a(`refresh`,`incomplete_proposal`);if(f!==`stop`&&f!==`resume`&&f!==`delete`)return s(`unknown_action`,!1);if(t.permission_classification===`protected`)return s(`protected_action`);if(t.permission_classification!==`durable_write`)return s(`unknown_permission`,!1);let m=dy[f];return m===`ready_stop`&&t.status===`preview_ready`?i({interaction:`direct`,reason:m,canApply:!0}):s(m===`ready_stop`?`action_review`:m)}function _y(e){return e.error_code===`action_stale`||e.error_code===`action_conflict`||fy(e.proposal)?.status===`stale`}function vy(e){return{blockingTodoCount:e.blockingTodoCount,goalNotifications:e.goalNotifications,goals:e.goals,openUserTodoCount:e.openUserTodoCount,systemHealth:e.systemHealth,attentionHistory:e.attentionHistory,userTodos:e.userTodos,workers:e.workers}}function yy(e,t){return e.goals.find(e=>e.goalId===t)?.title??t}function by(e){return e.activationState===`stopped`||e.state===`已停止`?`stopped`:e.state===`已完成`?`history`:e.needsYou||e.state===`等你`?`needs_you`:e.state===`推进中`||e.state===`需修复`?`running`:e.state===`安静运行`?`observing`:`scheduled`}function xy(e){let t=e;return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Sy(e){return`$${e.toFixed(2)}`}function Cy(e){let t=e;return t>=36e5?`${(t/36e5).toFixed(1)}h`:t>=6e4?`${(t/6e4).toFixed(1)}m`:t>=1e3?`${Math.round(t/1e3)}s`:`${t}ms`}function wy(e,t,n){return e==null?t:n(e)}function Ty(e){return!!(e&&[e.tokens24h,e.tokens7d,e.costUsd24h,e.costUsd7d,e.durationMs24h,e.durationMs7d].some(e=>e!=null))}function Ey(e,t){if(!Ty(e))return null;let n=(e,n,r,i)=>{let a=[n==null?null:`${xy(n)} ${t.tokens}`,r==null?null:`${t.cost}: ${Sy(r)}`,i==null?null:`${t.duration}: ${Cy(i)}`].filter(e=>e!==null);return a.length?`${e} ${a.join(` · `)}`:null};return n(t.period7d,e.tokens7d,e.costUsd7d,e.durationMs7d)??n(t.period24h,e.tokens24h,e.costUsd24h,e.durationMs24h)}function Dy({ariaLabel:e,className:t,icon:n,onChange:r,options:i,prefixLabel:a,value:o}){let s=(0,V.useId)(),c=(0,V.useRef)(null),l=(0,V.useRef)(null),u=(0,V.useRef)(new Map),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(o),h=i.find(e=>e.value===o)??i[0],g=i.filter(e=>!e.disabled);(0,V.useEffect)(()=>{if(!d)return;let e=e=>{c.current?.contains(e.target)||f(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[d]),(0,V.useEffect)(()=>{d&&u.current.get(p)?.focus()},[p,d]);function _(e){m(e)}function v(e=`selected`){let t=e===`last`?g.at(-1):g[0],n=e===`selected`&&h&&!h.disabled?h:t;n&&(f(!0),_(n.value))}function y({restoreFocus:e=!1}={}){f(!1),e&&l.current?.focus()}function b(e){e.disabled||(r(e.value),y({restoreFocus:!0}))}function x(e){if(!g.length)return;let t=g.findIndex(e=>e.value===p),n=t<0?0:(t+e+g.length)%g.length;_(g[n].value)}function S(e){e.key===`ArrowDown`||e.key===`Enter`||e.key===` `?(e.preventDefault(),v(`selected`)):e.key===`ArrowUp`&&(e.preventDefault(),v(`last`))}function C(e,t){if(e.key===`ArrowDown`)e.preventDefault(),x(1);else if(e.key===`ArrowUp`)e.preventDefault(),x(-1);else if(e.key===`Home`)e.preventDefault(),g[0]&&_(g[0].value);else if(e.key===`End`){e.preventDefault();let t=g.at(-1);t&&_(t.value)}else e.key===`Enter`||e.key===` `?(e.preventDefault(),b(t)):e.key===`Escape`?(e.preventDefault(),y({restoreFocus:!0})):e.key===`Tab`&&y()}let w;return(0,H.jsxs)(`div`,{className:`personal-select${t?` ${t}`:``}`,ref:c,children:[(0,H.jsxs)(`button`,{"aria-controls":s,"aria-expanded":d,"aria-haspopup":`listbox`,"aria-label":e,className:`personal-select-trigger`,"data-value":o,onClick:()=>d?y():v(),onKeyDown:S,ref:l,role:`combobox`,type:`button`,children:[n?(0,H.jsx)(`span`,{className:`personal-select-icon`,children:n}):null,(0,H.jsxs)(`span`,{className:`personal-select-value`,children:[a?(0,H.jsx)(`small`,{children:a}):null,(0,H.jsx)(`span`,{children:h?.label??o})]}),(0,H.jsx)(nm,{"aria-hidden":!0,className:d?`is-open`:void 0,size:14})]}),d?(0,H.jsx)(`div`,{"aria-label":e,className:`personal-select-listbox`,id:s,role:`listbox`,children:i.map(e=>{let t=e.group&&e.group!==w;return w=e.group,(0,H.jsxs)(`div`,{className:`personal-select-option-wrap`,children:[t?(0,H.jsx)(`div`,{className:`personal-select-group-label`,children:e.group}):null,(0,H.jsxs)(`button`,{"aria-disabled":e.disabled||void 0,"aria-selected":e.value===o,className:`personal-select-option`,disabled:e.disabled,id:`${s}-${e.value.replace(/[^a-z0-9_-]/gi,`-`)}`,onClick:()=>b(e),onFocus:()=>m(e.value),onKeyDown:t=>C(t,e),ref:t=>{t?u.current.set(e.value,t):u.current.delete(e.value)},role:`option`,tabIndex:e.value===p?0:-1,type:`button`,children:[(0,H.jsx)(`span`,{children:e.label}),e.value===o?(0,H.jsx)(tm,{"aria-hidden":!0,size:15}):null]})]},e.value)})}):null]})}function Oy({agents:e,managerChatOpen:t,managerRuntime:n,mobileNavigationOpen:r,onOpenGoalCapabilities:i,onOpenGoalDetail:a,onOpenManagerChat:o,onRefresh:s,onOpenNavigation:c,onSelectGoalTab:l,onSelectAgent:u,onReturnManagerHome:d,refreshState:f,readOnlySourceLabel:p,selectedAgentId:m,selectedGoal:h,selectedGoalTab:g}){let{locale:_,t:v}=qi(),[y,b]=(0,V.useState)(!1),x=(0,V.useRef)(null),S=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!y)return;function e(e){S.current?.contains(e.target)||b(!1)}function t(e){e.key===`Escape`&&(b(!1),x.current?.focus())}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[y]),(0,V.useEffect)(()=>b(!1),[h?.goalId]);function C(e){b(!1),e?.()}let w=h?Ey(h.usage,{cost:v(`drawer.costShort`),duration:v(`drawer.durationShort`),period24h:v(`drawer.period24h`),period7d:v(`drawer.period7d`),tokens:v(`drawer.tokensShort`)}):null;return(0,H.jsxs)(`header`,{className:`personal-channel-header`,children:[(0,H.jsx)(`button`,{"aria-expanded":r??!1,"aria-label":v(`header.openGoalNavigation`),className:`personal-icon-button personal-mobile-menu`,onClick:c,type:`button`,children:(0,H.jsx)(Em,{size:18})}),(0,H.jsxs)(`div`,{className:`personal-channel-title`,children:[(0,H.jsx)(`h1`,{children:h?.title??v(`header.manager`)}),!h&&n?(0,H.jsx)(`p`,{children:n.status===`ready`?v(`header.managerRuntime`,{profile:n.runtime_profile,sandbox:n.sandbox}):v(`header.managerRuntimeFallback`,{profile:n.runtime_profile,sandbox:n.sandbox})}):null,h?(0,H.jsx)(`p`,{children:h.loadState?v(h.loadState===`error`?`startup.goalError`:`startup.goalLoading`):`${h.agentLaneCount&&h.agentLaneCount>1?v(`header.workAgentCount`,{count:h.agentLaneCount}):h.agentLabel??h.agentId} · ${h.loadState?v(h.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Ji(h.state,_)}${w?` · ${w}`:``} · ${h.nextSentence}`}):null]}),h?(0,H.jsxs)(`nav`,{"aria-label":v(`header.goalView`),className:`personal-goal-tabs`,children:[(0,H.jsx)(`button`,{"aria-current":g===`chat`?`page`:void 0,onClick:()=>l(`chat`),type:`button`,children:v(`header.chat`)}),(0,H.jsx)(`button`,{"aria-current":g===`tasks`?`page`:void 0,onClick:()=>l(`tasks`),type:`button`,children:v(`header.tasks`)}),(0,H.jsx)(`button`,{"aria-current":g===`files`?`page`:void 0,onClick:()=>l(`files`),type:`button`,children:v(`header.files`)})]}):(0,H.jsxs)(`nav`,{"aria-label":v(`header.managerView`),className:`personal-goal-tabs`,children:[(0,H.jsx)(`button`,{"aria-current":t?void 0:`page`,onClick:d,type:`button`,children:v(`header.managerOverview`)}),(0,H.jsx)(`button`,{"aria-current":t?`page`:void 0,onClick:o,type:`button`,children:v(`header.chat`)})]}),(0,H.jsxs)(`div`,{className:`personal-channel-actions`,children:[h&&a&&i?(0,H.jsxs)(`div`,{className:`personal-goal-tools`,ref:S,children:[(0,H.jsxs)(`button`,{"aria-expanded":y,"aria-haspopup":`menu`,"aria-label":v(`header.goalSettingsDescription`),className:`personal-goal-tools-trigger`,onClick:()=>b(e=>!e),ref:x,title:v(`header.goalSettingsDescription`),type:`button`,children:[(0,H.jsx)(Km,{"aria-hidden":!0,size:16}),(0,H.jsx)(`span`,{children:v(`header.goalSettings`)}),(0,H.jsx)(nm,{"aria-hidden":!0,size:13})]}),y?(0,H.jsxs)(`fieldset`,{"aria-label":v(`header.goalSettings`),className:`personal-goal-tools-menu`,children:[(0,H.jsxs)(`button`,{onClick:()=>C(a),type:`button`,children:[(0,H.jsx)(bm,{"aria-hidden":!0,size:17}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:v(`header.goalDetails`)})})]}),(0,H.jsxs)(`button`,{onClick:()=>C(i),type:`button`,children:[(0,H.jsx)(Km,{"aria-hidden":!0,size:17}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:v(`header.goalCapabilities`)})})]})]}):null]}):null,p?(0,H.jsxs)(`span`,{className:`personal-read-only-source`,title:v(`header.readOnlySourceDescription`,{source:p}),children:[(0,H.jsx)(mm,{size:15}),p,(0,H.jsx)(`small`,{children:v(`common.readOnly`)})]}):(0,H.jsx)(Dy,{ariaLabel:v(`header.selectChatRuntime`),className:`personal-agent-select`,icon:(0,H.jsx)(Qp,{size:16}),onChange:u,options:e.map(e=>({disabled:!e.available,label:`${e.label}${e.available?``:` · ${v(`header.agentUnavailable`)}`}`,value:e.agentId})),prefixLabel:v(`header.chatRuntime`),value:m}),(0,H.jsxs)(`span`,{className:`personal-live-indicator`,children:[(0,H.jsx)(`i`,{}),v(`header.live`)]}),s?(0,H.jsxs)(`span`,{className:`personal-refresh-control is-${f??`idle`}`,children:[f===`loading`?(0,H.jsx)(`small`,{children:v(`header.refreshing`)}):f===`done`?(0,H.jsx)(`small`,{children:v(`header.refreshDone`)}):f===`error`?(0,H.jsx)(`small`,{children:v(`header.refreshFailed`)}):null,(0,H.jsx)(`button`,{"aria-label":v(f===`loading`?`header.refreshing`:`header.refresh`),className:`personal-icon-button`,disabled:f===`loading`,onClick:s,type:`button`,children:(0,H.jsx)(Lm,{className:f===`loading`?`is-spinning`:void 0,size:17})})]}):null]})]})}function ky({attention:e,onSelect:t}){let{t:n}=qi(),r=Xi(e.updatedAt,n);return(0,H.jsxs)(`button`,{className:`personal-timeline-row personal-attention-row`,"data-testid":`personal-browse-row`,onClick:t,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-row-icon is-attention`,children:(0,H.jsx)(am,{size:18})}),(0,H.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,H.jsxs)(`small`,{children:[e.goalTitle??e.goalId,` · `,n(`home.lane.needsYou`),r?` · ${n(`tasks.waitingAge`,{age:r})}`:``]}),(0,H.jsx)(`strong`,{children:e.text})]}),(0,H.jsx)(`span`,{className:`personal-priority-dot is-${e.priority??(e.blocking?`high`:`medium`)}`}),(0,H.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?n(`tasks.blocked`):n(`tasks.pending`)}),(0,H.jsx)(rm,{size:17})]})}var Ay=/(`[^`\n]+`)|(\*\*[^*\n]+(\*[^*\n]*)?\*\*)|(\[[^\]\n]{1,120}\]\(https?:\/\/[^)\s]+\))/g;function jy(e,t){let n=[],r=0,i=0;for(let a of e.matchAll(Ay)){let o=a.index??0;o>r&&n.push(e.slice(r,o));let s=a[0],c=`${t}-i${i++}`;if(s.startsWith("`"))n.push((0,H.jsx)(`code`,{className:`personal-md-code`,children:s.slice(1,-1)},c));else if(s.startsWith(`**`))n.push((0,H.jsx)(`strong`,{children:s.slice(2,-2)},c));else{let e=s.indexOf(`](`),t=s.slice(1,e),r=s.slice(e+2,-1);n.push((0,H.jsx)(`a`,{className:`personal-md-link`,href:r,rel:`noreferrer`,target:`_blank`,children:t},c))}r=o+s.length}return r{r.length>0&&(n.push({type:`paragraph`,lines:r}),r=[])},a=0;for(;a{let n=`b${t}`;if(e.type===`code`)return(0,H.jsx)(`pre`,{className:`personal-md-pre`,children:(0,H.jsx)(`code`,{children:e.text})},n);if(e.type===`heading`)return(0,H.jsx)(`p`,{className:`personal-md-heading is-h${e.level}`,children:jy(e.text,n)},n);if(e.type===`list`){let t=e.items.map((e,t)=>(0,H.jsx)(`li`,{children:jy(e,`${n}-${t}`)},`${n}-${t}`));return e.ordered?(0,H.jsx)(`ol`,{className:`personal-md-list`,children:t},n):(0,H.jsx)(`ul`,{className:`personal-md-list`,children:t},n)}return(0,H.jsx)(`p`,{children:e.lines.map((e,t)=>(0,H.jsxs)(V.Fragment,{children:[t>0?(0,H.jsx)(`br`,{}):null,jy(e,`${n}-${t}`)]},`${n}-${t}`))},n)})})}function Iy({onSelect:e,output:t}){let{t:n}=qi(),r=t.kind===`report`?_m:gm;return(0,H.jsxs)(`button`,{className:`personal-timeline-row personal-output-row`,"data-output-kind":t.kind,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-row-icon is-output`,children:(0,H.jsx)(r,{size:18})}),(0,H.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,H.jsxs)(`small`,{children:[t.goalTitle??t.goalId,` · `,t.agentLabel??`LoopX`]}),(0,H.jsx)(`strong`,{children:t.title}),t.summary?(0,H.jsx)(`span`,{children:t.summary}):null,t.report?(0,H.jsxs)(`small`,{children:[n(`files.reportDelta`,{added:t.report.addedCount,changed:t.report.changedCount}),` · `,n(`files.verifiedReport`)]}):null]}),t.createdAt?(0,H.jsx)(`time`,{children:t.createdAt}):null,(0,H.jsx)(rm,{size:17})]})}var Ly={completed:`runs.completed`,failed:`runs.failed`,interrupted:`runs.interrupted`,queued:`runs.queued`,running:`runs.running`,waiting:`runs.waiting`};function Ry({onSelect:e,run:t}){let{t:n}=qi(),r=t.totalSteps>0?Math.min(100,t.completedSteps/t.totalSteps*100):0;return(0,H.jsxs)(`button`,{"aria-label":`${n(`tasks.viewExecution`)}:${t.title}`,className:`personal-timeline-row personal-run-row`,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-row-icon is-run`,children:(0,H.jsx)(Qp,{size:18})}),(0,H.jsxs)(`span`,{className:`personal-run-identity`,children:[(0,H.jsx)(`small`,{children:t.goalTitle}),(0,H.jsx)(`strong`,{children:t.agentLabel})]}),(0,H.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,H.jsx)(`strong`,{children:t.title}),(0,H.jsx)(`small`,{children:t.latestActivity})]}),(0,H.jsxs)(`span`,{className:`personal-run-progress`,"aria-label":`${t.completedSteps}/${t.totalSteps}`,children:[(0,H.jsxs)(`small`,{children:[t.completedSteps,`/`,t.totalSteps]}),(0,H.jsx)(`i`,{children:(0,H.jsx)(`b`,{style:{width:`${r}%`}})})]}),(0,H.jsxs)(`span`,{className:`personal-row-status is-${t.status}`,children:[t.status===`running`?(0,H.jsx)(wm,{className:`personal-spin`,size:14}):null,n(Ly[t.status])]}),t.sessionId?(0,H.jsx)(`span`,{className:`personal-run-open-label`,children:n(`tasks.viewExecution`)}):null,(0,H.jsx)(rm,{size:17})]})}function zy({onSelect:e,schedule:t}){let{t:n}=qi(),r=t.scheduleKind===`heartbeat`;return(0,H.jsxs)(`button`,{"aria-label":`${r?`Heartbeat`:n(`tasks.scheduled`)}:${t.label};${t.status??`active`}`,className:`personal-schedule-row`,onClick:e,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-schedule-icon`,children:r?(0,H.jsx)(Im,{size:17}):(0,H.jsx)(em,{size:17})}),(0,H.jsxs)(`span`,{className:`personal-schedule-copy`,children:[(0,H.jsx)(`small`,{children:n(r?`schedule.heartbeat`:`schedule.monitor`)}),(0,H.jsx)(`strong`,{children:t.label}),(0,H.jsx)(`p`,{children:t.schedule??n(`schedule.summary`)})]}),(0,H.jsx)(`span`,{className:`personal-schedule-status is-${t.status??`active`}`,children:t.status===`paused`?n(`schedule.paused`):n(`schedule.active`)}),(0,H.jsx)(rm,{size:16})]})}function By({items:e,onSelect:t,selectedGoal:n}){let{t:r}=qi();if(e.length===0)return(0,H.jsxs)(`div`,{className:`personal-timeline-empty`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(qm,{size:20})}),(0,H.jsx)(`strong`,{children:r(n?`timeline.emptyGoal`:`timeline.emptyWorkspace`)}),(0,H.jsx)(`p`,{children:r(n?`timeline.emptyGoalDescription`:`timeline.emptyWorkspaceDescription`)})]});let i=[...e].reverse().find(e=>e.kind===`message`&&e.message.role!==`user`||e.kind===`proposal`&&[`applied`,`stale`,`error`,`gated`].includes(e.proposal.status)||e.kind===`run`&&e.run.status===`completed`),a=i?.kind===`message`?`${i.message.agentLabel??r(`header.manager`)}:${i.message.pending?r(`timeline.pending`):i.message.text}`:i?.kind===`proposal`?`${i.proposal.title}:${i.proposal.status}`:i?.kind===`run`?r(`timeline.runCompleted`,{run:i.run.title}):``,o=e.filter(e=>e.kind===`proposal`&&e.proposal.status===`gated`),s=e.filter(e=>e.kind!==`proposal`),c=e.filter(e=>e.kind===`proposal`&&e.proposal.status!==`gated`);function l(e){return e.kind===`attention`?(0,H.jsx)(ky,{attention:e.attention,onSelect:()=>t({item:e.attention,kind:`attention`})},e.id):e.kind===`run`?(0,H.jsx)(Ry,{onSelect:()=>t({item:e.run,kind:`run`}),run:e.run},e.id):e.kind===`output`?(0,H.jsx)(Iy,{onSelect:()=>t({item:e.output,kind:`output`}),output:e.output},e.id):e.kind===`schedule`?(0,H.jsx)(zy,{onSelect:()=>t({item:e.schedule,kind:`schedule`}),schedule:e.schedule},e.id):e.kind===`proposal`?(0,H.jsxs)(`button`,{className:`personal-proposal-row is-${e.proposal.status}`,onClick:()=>t({item:e.proposal,kind:`proposal`}),type:`button`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(qm,{size:17})}),(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(`small`,{children:[e.proposal.actionKind,` · `,e.proposal.status]}),(0,H.jsx)(`strong`,{children:e.proposal.title}),(0,H.jsx)(`p`,{children:e.proposal.impact})]}),(0,H.jsx)(`b`,{children:e.proposal.status===`gated`&&e.proposal.actionKind!==`operation.execute`?r(`timeline.review`):e.proposal.primaryLabel??r(`timeline.reviewAndConfirm`)})]},e.id):(0,H.jsxs)(`article`,{className:`personal-message is-${e.message.role}`,children:[e.message.role===`user`?null:(0,H.jsx)(`span`,{className:`personal-message-avatar`,children:(0,H.jsx)(Qp,{size:17})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:e.message.role===`user`?r(`common.you`):e.message.agentLabel??r(`header.manager`)}),e.message.time?(0,H.jsx)(`time`,{children:e.message.time}):null]}),e.message.attachments?.length?(0,H.jsx)(`div`,{className:`personal-message-images`,children:e.message.attachments.map(e=>(0,H.jsx)(`img`,{alt:e.name,src:e.dataUrl},e.id))}):null,e.message.role===`user`?(0,H.jsx)(`p`,{children:e.message.text}):(0,H.jsx)(Fy,{text:e.message.text}),e.message.pending?(0,H.jsx)(`span`,{className:`personal-message-pending`,children:r(`timeline.pending`)}):null]})]},e.id)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{"aria-atomic":`true`,"aria-live":`polite`,className:`personal-live-region`,role:`status`,children:a}),(0,H.jsxs)(`div`,{className:`personal-channel-timeline`,children:[s.map(l),o.length?(0,H.jsxs)(`details`,{className:`personal-gated-summary`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(qm,{size:16})}),(0,H.jsx)(`strong`,{children:r(`timeline.waitingConfirmation`)}),(0,H.jsx)(`small`,{children:r(`timeline.gateHistory`,{count:o.length})})]}),(0,H.jsx)(`div`,{children:o.map(l)})]}):null,c.map(l)]})]})}function Vy({goal:e}){let{t}=qi(),n={connected:t(`acceptance.connected`),mapped:t(`acceptance.mapped`),refreshed:t(`acceptance.refreshed`),adapter_inspected:t(`acceptance.inspected`),run_recorded:t(`acceptance.recorded`),reward_judged:t(`acceptance.judged`),operator_approved:t(`acceptance.approved`),controller_ready:t(`acceptance.ready`),attention_queue:t(`acceptance.attentionSource`),agent_vision:t(`acceptance.visionSource`),todo_projection:t(`acceptance.todoSource`),current_run:t(`acceptance.runSource`)},r=e=>n[e]??t(`acceptance.unknown`),i=e.acceptanceObservation,a=e.loadState||!i||i.goal_id!==e.goalId||i.coverage===`unavailable`;return(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-acceptance`,"aria-label":t(`acceptance.title`),children:[(0,H.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,H.jsx)(`h3`,{children:t(`acceptance.title`)}),(0,H.jsx)(`em`,{children:t(`common.readOnly`)})]}),(0,H.jsx)(`p`,{role:`status`,children:t(a?`acceptance.unavailable`:`acceptance.partial`)}),!a&&i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h4`,{children:t(`acceptance.gaps`)}),i.acceptance_gaps.length?i.acceptance_gaps.map((e,n)=>(0,H.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,H.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.owner`)}),(0,H.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,H.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.observed`)}),(0,H.jsx)(`dd`,{children:e.observed_at??t(`acceptance.unknown`)})]})]})]},`${e.kind}:${e.owner}:${n}`)):(0,H.jsx)(`p`,{children:t(`acceptance.noGaps`)}),(0,H.jsx)(`h4`,{children:t(`acceptance.guards`)}),i.guards.length?i.guards.map((e,n)=>(0,H.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,H.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.owner`)}),(0,H.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),e.blocks_agent?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.agent`)}),(0,H.jsx)(`dd`,{children:e.blocks_agent})]}):null,e.todo_id?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.task`)}),(0,H.jsx)(`dd`,{children:e.todo_id})]}):null,(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,H.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.scope`)}),(0,H.jsx)(`dd`,{children:e.decision_scope??t(`acceptance.unknown`)})]})]})]},`${e.todo_id}:${n}`)):(0,H.jsx)(`p`,{children:t(`acceptance.noGuards`)}),(0,H.jsx)(`h4`,{children:t(`acceptance.next`)}),(0,H.jsx)(`p`,{children:i.next_action??t(`acceptance.unknown`)}),(0,H.jsxs)(`details`,{children:[(0,H.jsxs)(`summary`,{children:[t(`acceptance.historical_progress`),` · `,i.historical_progress.length]}),(0,H.jsx)(`p`,{children:t(`acceptance.historical`)}),i.historical_progress.map(e=>(0,H.jsxs)(`p`,{children:[(0,H.jsx)(`strong`,{children:r(e.kind)}),` · `,e.observed_at??t(`acceptance.unknown`),` `,e.evidence_refs.join(`, `)]},e.kind))]}),i.missing_sources.length?(0,H.jsxs)(`p`,{children:[t(`acceptance.missing`),` `,i.missing_sources.map(r).join(`, `)]}):null,i.truncated?(0,H.jsx)(`p`,{children:t(`acceptance.truncated`)}):null]}):null]})}function Hy({item:e,successor:t,onSelect:n}){let{t:r}=qi(),i=e.details;return(0,H.jsxs)(`section`,{className:`personal-detail-card`,"aria-label":r(`attentionDetail.title`),children:[(0,H.jsx)(`h3`,{children:r(`attentionDetail.title`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.request`)}),(0,H.jsx)(`dd`,{children:r(i?.interaction===`decision`?`attentionDetail.decision`:`attentionDetail.unknownRequest`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`common.status`)}),(0,H.jsx)(`dd`,{children:r(`attentionDetail.${i?.lifecycle??`unknown`}`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`drawer.reason`)}),(0,H.jsx)(`dd`,{children:i?.reason??e.explanation??r(`attentionDetail.unknownReason`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Todo`}),(0,H.jsx)(`dd`,{children:e.todoId})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.targetTodo`)}),(0,H.jsx)(`dd`,{children:i?.unblocksTodoId??r(`attentionDetail.notProvided`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.targetAgent`)}),(0,H.jsx)(`dd`,{children:i?.blocksAgent??r(`attentionDetail.notProvided`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.scope`)}),(0,H.jsx)(`dd`,{children:i?.decisionScope?`${i.decisionScope.kind} · ${i.decisionScope.granularity} · ${i.decisionScope.scopeKey}`:r(`attentionDetail.notProvided`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`drawer.evidence`)}),(0,H.jsx)(`dd`,{children:i?.evidence??e.evidence??r(`drawer.decisionDefaultEvidence`)})]})]}),i?.supersededBy?(0,H.jsxs)(`p`,{children:[r(`attentionDetail.replacement`),`: `,i.supersededBy]}):null,t&&n?(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>n(t),type:`button`,children:r(`attentionDetail.openReplacement`)}):null,(0,H.jsx)(`p`,{children:r(`attentionDetail.boundary`)})]})}function Uy(e){return e.replace(/\s+/gu,` `).trim()}function Wy(e,t){let n=RegExp(`(?:不要|不需要|无需|禁止|别|暂不|do not\\b|don't\\b|without\\b).{0,10}(?:${t.source})`,`iu`),r=RegExp(`(?:${t.source}).{0,10}(?:不要|不需要|无需|禁止|关闭)`,`iu`),i=RegExp(`disable\\b.{0,10}(?:${t.source})|(?:turn|switch|set)\\b.{0,10}(?:${t.source}).{0,10}\\boff\\b|(?:${t.source})\\s+(?:is\\s+)?disabled\\b`,`iu`);return n.test(e)||r.test(e)||i.test(e)}function Gy(e){return/(我现在该做什么|下一步|哪些\s*Goal\s*在等我|需要我|谁在等我|Agent\s*在做什么|当前进度|总结(?:今天)?进展)/iu.test(e)}function Ky(e){let t=/(怎么|如何|为什么|给.*建议|分析一下|解释|只读)/u.test(e),n=/(解决一下|修复一下|处理一下|执行一下|改一下|跑(?:一下)?测试|rebase|push|提交|推送)/iu.test(e);return!t&&n&&/(帮我|请|给我|直接|现在|开始|bytedcli|codebase|git|rebase|push|提交|推送)/iu.test(e)}function qy(e){return Uy(e).toLowerCase().match(/(?:^|[\s,,;;:((:]|到|至)(?todo_done:todo_[a-z0-9_-]{3,64}|pr_merged:(?:(?:[a-z0-9_.-]{1,80})\/(?:[a-z0-9_.-]{1,100}))?#[1-9][0-9]{0,8}|capacity_available:[a-z][a-z0-9_:-]{0,63}|resume_at:[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}t[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\.[0-9]{1,3})?(?:z|[+-][0-9]{2}:[0-9]{2}))(?=$|[\s,,。;;))])/iu)?.groups?.condition??null}function Jy(e,t){let n=Uy(e),r=[],i=t.agents.find(e=>{let t=n.toLowerCase();return t.includes(e.agentId.toLowerCase())||t.includes(e.label.toLowerCase())}),a=t.todos.find(e=>n.includes(e.todoId)||n.includes(e.text)),o=/(刚刚|已经|已)(?:经)?\s*(新增|创建|添加)(?:的)?\s*(todo|待办|任务)/iu.test(n),s=!!t.goalId&&!Wy(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n);if(!t.goalId&&!Wy(n,/goal|目标/iu)&&/(创建|新建|设置|create|start|set up).{0,24}(goal|目标)/iu.test(n)&&r.push({actionKind:`goal.create`,confidence:.97,normalizedParameters:{heartbeat_enabled:!Wy(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n)}}),t.goalId&&s&&r.push({actionKind:`heartbeat.bind`,confidence:.96,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&!s&&!Wy(n,/定时|监控|监测|持续观察|scheduled check|monitor/iu)&&/(定时|监控|监测|每.{0,8}(分钟|小时|天)|持续观察|scheduled check|monitor|every.{0,12}(minute|hour|day)|daily)/iu.test(n)&&r.push({actionKind:`monitor.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&i&&!Wy(n,/绑定|负责|接管|管理/iu)&&/((让|交给).{0,20}(管理|负责|接管).{0,8}(goal|目标)|(绑定).{0,12}(goal|目标)|(goal|目标).{0,12}(交给|绑定|负责|接管))/iu.test(n)&&r.push({actionKind:`agent.bind`,confidence:.96,normalizedParameters:{agent_id:i.agentId,goal_id:t.goalId}}),t.goalId&&!o&&!Wy(n,RegExp(`todo|待办|任务`,`iu`))&&/(创建|新建|新增|添加|加一个|记一个).{0,16}(todo|待办|任务)|(todo|待办|任务).{0,12}(创建|新建|新增|添加)|(?:create|add)(?:\s+(?:a|an|new))?\s+(?:todo|task)|(?:todo|task).{0,12}(?:create|add)/iu.test(n)&&r.push({actionKind:`todo.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&Ky(n)&&r.push({actionKind:`todo.create`,confidence:.9,normalizedParameters:{goal_id:t.goalId,start_execution:!0}}),t.goalId&&a){let e=!Wy(n,/完成|做完|关闭/u)&&/完成|做完|关闭/u.test(n)?`complete`:!Wy(n,/阻塞|卡住/u)&&/阻塞|卡住/u.test(n)?`block`:!Wy(n,/暂缓|稍后|推迟/u)&&/暂缓|稍后|推迟/u.test(n)?`defer`:i&&!Wy(n,/交给|分配给|改派/u)&&/交给|分配给|改派/u.test(n)?`reassign`:null;if(e){let i=e===`defer`?qy(n):null;if(e===`defer`&&!i)return{actionKind:`todo.update`,confidence:.97,missingFields:[`resume_when`],normalizedParameters:{goal_id:t.goalId,operation:e,todo_id:a.todoId},route:`clarify`};r.push({actionKind:`todo.update`,confidence:.97,normalizedParameters:{goal_id:t.goalId,operation:e,...i?{resume_when:i}:{},todo_id:a.todoId}})}}let c=[...new Map(r.map(e=>[e.actionKind,e])).values()];return c.length>1?{actionKind:null,confidence:.4,missingFields:[`single_intent`],normalizedParameters:{},route:`clarify`}:c.length===1?{...c[0],missingFields:[],route:`typed_action`}:!t.goalId&&Gy(n)?{actionKind:null,confidence:.98,missingFields:[],normalizedParameters:{},route:`projection`}:{actionKind:null,confidence:.75,missingFields:[],normalizedParameters:{},route:`agent_chat`}}function Yy(e,t,n){if(!e)return{};if(!t.trim())return{modelConfig:null};let r={model:t.trim()};return n&&(r.reasoning_effort=n),{modelConfig:r}}var Xy=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`select:not([disabled])`,`input:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`),Zy=[{key:`drawer.taskBlock`,operation:`block`},{key:`drawer.taskSuccessor`,operation:`successor_create`}],Qy=[{key:`drawer.decisionReject`,resolution:`reject`},{key:`drawer.decisionDefer`,resolution:`defer`}],$y=Array.from({length:32},(e,t)=>t+1),eb=/^[a-z][a-z0-9_.-]{0,63}$/u;function tb(e){let t=String(e??``).trim().toLowerCase();return eb.test(t)?t:null}function nb(e,t){return e.enabled===t.enabled&&e.maxChildren===t.maxChildren&&JSON.stringify(e.modelConfig??null)===JSON.stringify(t.modelConfig??null)&&[...e.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)===[...t.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)}function rb({agents:e,attentionHistory:t=[],onSelectAttention:n,callbacks:r,goalNotifications:i=[],goals:a=[],inspectorExpanded:o=!1,larkConnections:s=[],onClose:c,onToggleInspectorSize:l,readOnly:u=!1,runs:d=[],selection:f}){let{locale:p,t:m}=qi(),[h,g]=(0,V.useState)(``),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(`idle`),[x,S]=(0,V.useState)(`record`),[C,w]=(0,V.useState)([]),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(2),[k,ee]=(0,V.useState)(``),[te,A]=(0,V.useState)(``),[j,M]=(0,V.useState)(`idle`),[N,P]=(0,V.useState)(null),[F,ne]=(0,V.useState)(null),re=(0,V.useRef)(null),I=(0,V.useRef)(null),[L,ie]=(0,V.useState)(e.find(e=>e.available)?.agentId??`codex`),[R,ae]=(0,V.useState)(``),oe=(0,V.useRef)(null),se=(0,V.useRef)(null),ce=(0,V.useRef)(null),le=(0,V.useRef)(null),ue=f.kind===`run`?`run:${f.item.runId}`:f.kind===`proposal`?`proposal:${f.item.previewId}`:f.kind===`todo`?`todo:${f.item.todoId}`:f.kind===`attention`?`attention:${f.item.todoId}`:f.kind===`output`?`output:${f.item.outputId}`:f.kind===`schedule`?`schedule:${f.item.scheduleId}`:`goal:${f.item.goalId}`;(0,V.useEffect)(()=>{b(`idle`),v(!1),S(`record`),ae(``);let e=f.kind===`goal`?f.item.subagentExecution:void 0;w(e?.allowedDomains??[]),ee(e?.modelConfig?.model??``),A(e?.modelConfig?.reasoning_effort??``),O(e?.maxChildren?Math.min(e.maxChildren,32):2),E(null),M(`idle`),P(null),ne(null),re.current=e??null,I.current=null},[ue]);let z=f.kind===`goal`?f.item.subagentExecution:void 0;(0,V.useEffect)(()=>{let e=re.current,t=z?!e||!nb(e,z):e!==null;if(re.current=z??null,!F){t&&z&&(w(z.allowedDomains),ee(z.modelConfig?.model??``),A(z.modelConfig?.reasoning_effort??``),O(z.maxChildren||2),E(null),M(`idle`),P(null));return}let n=I.current;(!z||nb(F,z)||n&&!nb(n,z))&&(z&&(w(z.allowedDomains),ee(z.modelConfig?.model??``),A(z.modelConfig?.reasoning_effort??``),O(z.maxChildren||2)),I.current=null,ne(null))},[z,F]),(0,V.useEffect)(()=>{let e=document.activeElement;e instanceof HTMLElement&&!se.current?.contains(e)&&(ce.current=e);let t=window.requestAnimationFrame(()=>le.current?.focus());return()=>window.cancelAnimationFrame(t)},[ue]);let de=(0,V.useCallback)(()=>{let e=ce.current;c(),window.requestAnimationFrame(()=>e?.focus())},[c]);(0,V.useEffect)(()=>{function e(e){if(e.key===`Escape`){e.preventDefault(),de();return}if(e.key===`Tab`&&f.kind!==`todo`){let t=Array.from(se.current?.querySelectorAll(Xy)??[]).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`);if(t.length===0)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[de,f.kind]);let fe=f.kind===`attention`?m(`drawer.titleAttention`):f.kind===`todo`?m(`drawer.taskDetails`):f.kind===`run`?m(`drawer.runDetails`):f.kind===`output`?m(`drawer.titleOutput`):f.kind===`proposal`?m(f.item.status===`applied`?`drawer.titleProposalApplied`:`drawer.titleProposalConfirm`):f.kind===`schedule`?f.item.scheduleKind===`heartbeat`?`Heartbeat`:m(`drawer.titleSchedule`):m(`drawer.goalDetails`),pe=f.kind===`proposal`?f.item.goalId??`manager`:f.item.goalId,me=f.kind===`attention`?f.item.goalTitle??m(`drawer.currentGoal`):f.kind===`todo`||f.kind===`run`?f.item.goalTitle:f.kind===`output`?f.item.goalTitle??m(`drawer.currentGoal`):f.kind===`goal`?f.item.title:f.kind===`schedule`?m(`drawer.goalAutoRun`):f.item.goalId?m(`drawer.goalChanges`):m(`drawer.managerChanges`),he=f.kind===`goal`?d.find(e=>e.goalId===f.item.goalId&&!!e.sessionId)??d.find(e=>e.goalId===f.item.goalId):null,ge=f.kind===`run`&&(f.item.completedSteps>0||!!f.item.latestActivity||!!f.item.outputs?.length),_e=f.kind===`attention`?Xi(f.item.updatedAt,m):null,ve=qy(R);async function ye(){f.kind!==`run`||!h.trim()||(await r.onCorrectRun?.(f.item,h.trim()),g(``))}async function be(e,t,n,i){if(t===`successor_create`){await r.onPreviewAction?.({actionKind:`todo.create`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-successor-${e.todoId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,text:m(`drawer.taskSuccessorText`,{task:e.text})},summary:m(`drawer.taskSuccessorSummary`,{task:e.text})});return}await r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-${e.todoId}-${t}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:e.claimedBy??L,goal_id:e.goalId,operation:t,...t===`block`?{note:m(`drawer.taskSuccessorNote`)}:{},...t===`defer`&&i?{resume_when:i}:{},todo_id:e.todoId},summary:`${n}:${e.text}`})}async function xe(e,t,n){u||!qd(e)||await r.onPreviewAction?.({actionKind:`gate.resolve`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-decision-${e.todoId}-${t}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,decision:t,todo_id:e.todoId},summary:`${n}:${e.text}`})}let Se=f.kind===`goal`?F??f.item.subagentExecution??{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0}:{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0},Ce=j===`previewing`||j===`applying`,we=(()=>{if(f.kind!==`goal`)return[];let e=new Map;for(let t of Se.allowedDomains){let n=tb(t);n&&e.set(n,{matchingTodoCount:0,value:n})}if(Se.domainCandidates)for(let t of Se.domainCandidates){let n=tb(t.domain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+t.matchingTodoCount,value:n})}else for(let t of f.item.agentTodos){if(t.done||t.taskClass!==`advancement_task`)continue;let n=tb(t.taskDomain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+1,value:n})}return[...e.values()]})();function Te(){w(Se.allowedDomains),ee(Se.modelConfig?.model??``),A(Se.modelConfig?.reasoning_effort??``),O(Se.maxChildren||2),E(null),M(`idle`),P(null)}function B(){let e=[...new Set(C.map(e=>tb(e)))];return e.every(e=>!!e)?e:null}function Ee(e,t){w(n=>t?[...n,e].filter((e,t,n)=>n.indexOf(e)===t):n.filter(t=>t!==e)),P(null),M(`idle`),E(null)}async function De(e,t=e){if(f.kind!==`goal`||!r.onPreviewGoalSubagentConfiguration)return;let n=e?B():[];if(t&&!k.trim()&&te){M(`error`),E(m(`drawer.subagentModelRequired`));return}if(e&&!n){M(`error`),E(m(`drawer.subagentDomainInvalid`)),P(null);return}let i={allowedDomains:n??[],enabled:e,goalId:f.item.goalId,maxChildren:e?D:0,...Yy(t,k,te)};M(`previewing`),E(m(`drawer.subagentPreviewing`)),P(null);try{let e=await r.onPreviewGoalSubagentConfiguration(i);if(!e.changed){I.current=z??null,ne({...e.configuration,domainCandidates:Se.domainCandidates}),w(e.configuration.allowedDomains),ee(e.configuration.modelConfig?.model??``),A(e.configuration.modelConfig?.reasoning_effort??``),O(e.configuration.maxChildren||2),M(`success`),E(m(`drawer.subagentNoChange`));return}P({...i,changed:e.changed,previewId:e.previewId}),M(`ready`),E(m(`drawer.subagentPreviewReady`))}catch(e){M(`error`),E(e instanceof Error?e.message:m(`drawer.subagentPreviewFailed`))}}async function Oe(){if(!(!N||!r.onApplyGoalSubagentConfiguration)){M(`applying`),E(m(`drawer.subagentApplying`));try{let e=await r.onApplyGoalSubagentConfiguration({allowedDomains:N.allowedDomains,enabled:N.enabled,goalId:N.goalId,maxChildren:N.maxChildren,modelConfig:N.modelConfig,previewId:N.previewId});I.current=z??null,ne({...e,domainCandidates:Se.domainCandidates}),w(e.allowedDomains),ee(e.modelConfig?.model??``),A(e.modelConfig?.reasoning_effort??``),O(e.maxChildren||2),M(`success`),E(m(`drawer.subagentApplied`)),P(null);try{await r.onRefresh?.()}catch{M(`warning`),E(m(`drawer.subagentAppliedRefreshFailed`))}}catch(e){M(`error`),E(e instanceof Error?e.message:m(`drawer.subagentApplyFailed`))}}}return(0,H.jsxs)(`div`,{"aria-labelledby":`personal-drawer-title`,"aria-modal":f.kind===`todo`?void 0:`true`,className:`personal-context-drawer`,"data-context-kind":f.kind,ref:se,role:`dialog`,children:[(0,H.jsxs)(`header`,{className:`personal-drawer-header${f.kind===`todo`?` is-task-inspector`:``}`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{id:`personal-drawer-title`,ref:le,tabIndex:-1,children:fe}),(0,H.jsx)(`p`,{children:me})]}),(0,H.jsxs)(`div`,{className:`personal-drawer-header-actions`,children:[f.kind===`todo`&&l?(0,H.jsx)(`button`,{"aria-label":m(o?`drawer.inspectorHalf`:`drawer.inspectorFull`),className:`personal-icon-button personal-inspector-size`,onClick:l,title:m(o?`drawer.inspectorHalfView`:`drawer.inspectorFullView`),type:`button`,children:o?(0,H.jsx)(km,{size:17}):(0,H.jsx)(Tm,{size:17})}):null,(0,H.jsxs)(`button`,{"aria-label":m(`drawer.closeDetail`,{context:me}),className:`personal-icon-button personal-drawer-close`,onClick:de,ref:oe,type:`button`,children:[(0,H.jsx)(Kp,{className:`personal-mobile-back`,size:18}),(0,H.jsx)(eh,{className:`personal-desktop-close`,size:18})]})]})]}),(0,H.jsxs)(`div`,{className:`personal-drawer-body`,children:[f.kind===`attention`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card is-attention`,children:[(0,H.jsx)(`small`,{children:f.item.blocking?m(`drawer.attentionBlocking`):m(`drawer.attentionWaiting`)}),(0,H.jsx)(`h3`,{children:f.item.text}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,H.jsx)(`dd`,{children:f.item.priority??`medium`})]}),_e?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`common.waiting`)}),(0,H.jsx)(`dd`,{children:m(`tasks.waitingAge`,{age:_e})})]}):null]})]}),(0,H.jsx)(Hy,{item:f.item,onSelect:n,successor:Kd(f.item,t)}),!u&&qd(f.item)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void xe(f.item,`approve`,m(`common.confirm`)),type:`button`,children:[(0,H.jsx)(tm,{size:17}),m(`drawer.decisionReview`)]}),(0,H.jsxs)(`details`,{className:`personal-compact-menu`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(fm,{size:17}),m(`drawer.decisionMore`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{onClick:()=>void r.onExplainDecision?.(f.item),type:`button`,children:[(0,H.jsx)(Dm,{size:16}),m(`drawer.explainDecision`)]}),Qy.map(e=>(0,H.jsx)(`button`,{onClick:()=>void xe(f.item,e.resolution,m(e.key)),type:`button`,children:m(e.key)},e.resolution))]})]})]}):null]}):null,f.kind===`todo`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-task-inspector-summary`,children:[(0,H.jsxs)(`div`,{className:`personal-task-inspector-status`,children:[(0,H.jsxs)(`span`,{className:f.item.done?`is-done`:f.item.status===`blocked`?`is-blocked`:`is-open`,children:[(0,H.jsx)(`i`,{}),f.item.done?m(`drawer.taskStatusCompleted`):f.item.status===`deferred`?m(`drawer.taskStatusDeferred`):f.item.status===`blocked`?m(`drawer.taskStatusBlocked`):m(`drawer.taskStatusOpen`)]}),f.item.priority?(0,H.jsx)(`span`,{children:f.item.priority}):null,(0,H.jsx)(`span`,{children:f.item.taskClass===`advancement_task`?m(`drawer.taskAdvancement`):f.item.taskClass??m(`drawer.taskOrdinary`)})]}),(0,H.jsx)(`h3`,{children:f.item.text})]}),(0,H.jsxs)(`section`,{"aria-label":m(`drawer.taskInfo`),className:`personal-task-inspector-fields`,children:[(0,H.jsx)(`h4`,{children:m(`drawer.taskInfo`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`common.owner`)}),(0,H.jsx)(`dd`,{children:f.item.ownerLabel??f.item.claimedBy??m(`drawer.notAssigned`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`common.status`)}),(0,H.jsx)(`dd`,{children:f.item.done?m(`drawer.taskStatusCompleted`):f.item.status===`deferred`?m(`drawer.taskStatusDeferred`):f.item.status===`blocked`?m(`drawer.taskStatusBlocked`):m(`drawer.taskStatusOpen`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,H.jsx)(`dd`,{children:f.item.priority??m(`drawer.notSet`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.dependencies`)}),(0,H.jsx)(`dd`,{children:f.item.dependencies?.join(` · `)||m(`common.none`)})]}),f.item.status===`deferred`||f.item.resumeWhen?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.resumeWhen`)}),(0,H.jsx)(`dd`,{children:f.item.resumeWhen||m(`drawer.notSet`)})]}):null,f.item.resumeWhen?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.resumeState`)}),(0,H.jsx)(`dd`,{children:f.item.resumeReady?m(`drawer.resumeReady`):m(`drawer.resumePending`)})]}):null,f.item.resumeReceiptId?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.resumeReceipt`)}),(0,H.jsx)(`dd`,{children:f.item.resumeReceiptId})]}):null,(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.nextTransition`)}),(0,H.jsx)(`dd`,{children:f.item.nextTransition??(f.item.done?m(`drawer.taskNextCompleted`):f.item.resumeReady?m(`drawer.taskNextResumeReady`):f.item.status===`deferred`?m(`drawer.taskNextDeferred`):m(`drawer.taskNextOpen`))})]})]})]}),!u&&!f.item.done?(0,H.jsxs)(`div`,{className:`personal-task-inspector-actions`,"aria-label":m(`drawer.taskActions`),children:[(0,H.jsxs)(`details`,{className:`personal-task-management`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(fm,{size:16}),m(`drawer.taskManage`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:m(`drawer.reassign`)}),(0,H.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.reassign`),(0,H.jsx)(`select`,{"aria-label":m(`drawer.reassign`),onChange:e=>ie(e.target.value),value:L,children:e.filter(e=>e.available).map(e=>(0,H.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:f.item.goalId,kind:`todo`,todo_id:f.item.todoId},idempotencyKey:`workspace-todo-${f.item.todoId}-reassign-${L}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:L,goal_id:f.item.goalId,operation:`reassign`,todo_id:f.item.todoId},summary:m(`drawer.reassignSummary`,{task:f.item.text})}),type:`button`,children:m(`timeline.review`)})]}),(0,H.jsx)(`strong`,{children:m(`drawer.taskDeferUntil`)}),(0,H.jsxs)(`label`,{className:`personal-inline-agent-select personal-inline-resume-when`,children:[m(`drawer.taskDeferUntil`),(0,H.jsx)(`input`,{"aria-label":m(`drawer.taskDeferCondition`),"aria-invalid":!!R.trim()&&!ve,onChange:e=>ae(e.target.value),placeholder:m(`drawer.taskDeferPlaceholder`),value:R}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:!ve,onClick:()=>void be(f.item,`defer`,m(`drawer.taskDefer`),ve??void 0),type:`button`,children:m(`drawer.taskDeferReview`)}),(0,H.jsx)(`small`,{children:R.trim()&&!ve?m(`drawer.taskDeferInvalid`):m(`drawer.taskDeferSupported`)})]}),(0,H.jsx)(`div`,{className:`personal-task-management-secondary`,children:Zy.map(e=>(0,H.jsx)(`button`,{onClick:()=>void be(f.item,e.operation,m(e.key)),type:`button`,children:m(e.key)},e.operation))})]})]}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void be(f.item,`complete`,m(`drawer.taskComplete`)),type:`button`,children:[(0,H.jsx)(tm,{size:17}),m(`drawer.taskComplete`)]})]}):null,f.item.done?(0,H.jsxs)(`div`,{className:`personal-task-completed-note`,children:[(0,H.jsx)(tm,{size:16}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:m(`drawer.taskCompletedTitle`)}),(0,H.jsx)(`small`,{children:m(`drawer.taskCompletedNote`)})]})]}):null]}):null,f.kind===`goal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsx)(`small`,{children:Ji(f.item.state,p)}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.agentSentence}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.tokens`)}),(0,H.jsxs)(`dd`,{children:[wy(f.item.usage?.tokens24h,m(`drawer.usageNotMeasured`),xy),` / `,wy(f.item.usage?.tokens7d,m(`drawer.usageNotMeasured`),xy)]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.cost`)}),(0,H.jsxs)(`dd`,{children:[wy(f.item.usage?.costUsd24h,m(`drawer.usageNotMeasured`),Sy),` / `,wy(f.item.usage?.costUsd7d,m(`drawer.usageNotMeasured`),Sy)]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.duration`)}),(0,H.jsxs)(`dd`,{children:[wy(f.item.usage?.durationMs24h,m(`drawer.usageNotMeasured`),Cy),` / `,wy(f.item.usage?.durationMs7d,m(`drawer.usageNotMeasured`),Cy)]})]})]})]}),(0,H.jsx)(Vy,{goal:f.item}),(()=>{let e=i.find(e=>e.goalId===f.item.goalId),t=s.find(e=>e.goal_id===f.item.goalId);return(0,H.jsxs)(H.Fragment,{children:[f.item.repository?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-repository`,children:[(0,H.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,H.jsx)(`small`,{children:m(`drawer.repository`)}),(0,H.jsx)(`em`,{children:m(`common.readOnly`)})]}),(0,H.jsxs)(`h3`,{children:[(0,H.jsx)(vm,{size:16}),f.item.repository.label]}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.branch`)}),(0,H.jsx)(`dd`,{children:f.item.repository.branch||`detached`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Role`}),(0,H.jsx)(`dd`,{children:m(`drawer.repositoryRole`)})]})]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>{let e=navigator.clipboard?.writeText(f.item.repository?.identity??``);if(!e){b(`error`);return}e.then(()=>b(`copied`)).catch(()=>b(`error`))},type:`button`,children:[(0,H.jsx)(lm,{size:15}),m(y===`copied`?`drawer.copyRepositoryDone`:`drawer.copyRepository`)]}),y===`error`?(0,H.jsx)(`p`,{className:`personal-copy-feedback is-error`,role:`status`,children:m(`drawer.copyRepositoryError`)}):y===`copied`?(0,H.jsx)(`p`,{className:`personal-copy-feedback`,role:`status`,children:m(`drawer.copyRepositorySuccess`)}):null]}):null,u?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,H.jsx)(`small`,{children:m(`drawer.larkConnection`)}),(0,H.jsx)(`h3`,{children:m(`drawer.remoteDetailsUnavailable`)}),(0,H.jsx)(`p`,{children:m(`drawer.remoteDetailsDescription`)})]}):(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,H.jsx)(`small`,{children:m(`drawer.larkConnection`)}),t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{children:[t.app_label,(0,H.jsx)(`span`,{className:`personal-connection-status`,children:m(`drawer.connected`)})]}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.group`)}),(0,H.jsx)(`dd`,{children:t.chat_name})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.topic`)}),(0,H.jsxs)(`dd`,{children:[`# `,t.topic_name]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.trigger`)}),(0,H.jsx)(`dd`,{children:t.incoming_mode===`mentions`?m(`lark.someoneMentions`):m(`lark.allMessages`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.replyMode`)}),(0,H.jsx)(`dd`,{children:m(`lark.topicReply`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.autoNotify`)}),(0,H.jsx)(`dd`,{children:e?.humanGateAutoNotifyEnabled?m(`common.on`):m(`common.off`)})]}),e?.lastNotifiedAt?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.lastNotification`)}),(0,H.jsx)(`dd`,{children:e.lastNotifiedAt})]}):null]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{children:m(`drawer.larkNotConfigured`)}),(0,H.jsx)(`p`,{children:m(`drawer.larkNotConfiguredDescription`)})]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onOpenNotificationSettings?.(f.item.goalId),type:`button`,children:[(0,H.jsx)(Zp,{size:16}),m(t?`drawer.larkConfigure`:`drawer.larkConnect`)]})]})]})})(),(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-session`,children:[(0,H.jsx)(`small`,{children:m(`drawer.runDetails`)}),he?.sessionId?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{children:Yi(he.sessionStatus??he.status,m)}),(0,H.jsx)(`p`,{children:he.title}),r.onOpenRunSession?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onOpenRunSession?.(he),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.runLatest`)]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{children:m(`drawer.noRun`)}),(0,H.jsx)(`p`,{children:m(`drawer.noRunDescription`)})]})]}),u?null:(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`heartbeat`,f.item.goalId),type:`button`,children:[(0,H.jsx)(Im,{size:16}),m(`drawer.setupHeartbeat`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`monitor`,f.item.goalId),type:`button`,children:[(0,H.jsx)(em,{size:16}),m(`drawer.scheduleAdd`)]})]}),f.item.subagentExecution?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-subagents`,children:[(0,H.jsxs)(`div`,{className:`personal-subagent-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:m(`drawer.subagentLabel`)}),(0,H.jsxs)(`h3`,{children:[(0,H.jsx)(Qp,{size:16}),m(`drawer.subagentTitle`)]})]}),(0,H.jsxs)(`button`,{"aria-checked":Se.enabled,"aria-label":m(N&&j===`ready`?`drawer.subagentPending`:Se.enabled?`drawer.subagentDisable`:`drawer.subagentEnable`),className:`personal-subagent-switch`,"data-pending":N&&j===`ready`?`true`:void 0,disabled:u||Ce||!!N||!r.onPreviewGoalSubagentConfiguration,onClick:()=>void De(!Se.enabled),role:`switch`,type:`button`,children:[(0,H.jsx)(`span`,{}),m(N&&j===`ready`?`drawer.subagentPending`:Se.enabled?`common.on`:`common.off`)]})]}),(0,H.jsx)(`p`,{children:m(`drawer.subagentDescription`)}),N&&j===`ready`?(0,H.jsxs)(`div`,{className:`personal-subagent-preview`,children:[(0,H.jsx)(`strong`,{children:m(N.enabled?`drawer.subagentConfirmEnable`:`drawer.subagentConfirmDisable`)}),(0,H.jsx)(`p`,{children:N.enabled?m(`drawer.subagentPreviewSummary`,{count:N.maxChildren,domains:N.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)}):m(`drawer.subagentDisableSummary`)}),N.modelConfig===void 0?null:(0,H.jsxs)(`p`,{children:[m(`drawer.subagentModel`),`: `,N.modelConfig?.model||m(`drawer.subagentModelDefault`),` · `,N.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`button`,{className:`personal-primary-action`,onClick:()=>void Oe(),type:`button`,children:m(`common.confirm`)}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:Te,type:`button`,children:m(`common.cancel`)})]})]}):null,T?(0,H.jsxs)(`p`,{className:`personal-subagent-feedback is-${j}`,role:`status`,children:[j===`previewing`||j===`applying`?(0,H.jsx)(Rm,{className:`personal-spin`,size:13}):null,T]}):null,(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentModel`)}),(0,H.jsx)(`dd`,{children:Se.modelConfig?.model||m(`drawer.subagentModelDefault`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentEffort`)}),(0,H.jsx)(`dd`,{children:Se.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentCurrentBoundary`)}),(0,H.jsx)(`dd`,{children:Se.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentChildLimit`)}),(0,H.jsx)(`dd`,{children:Se.maxChildren||0})]})]}),u?(0,H.jsx)(`p`,{className:`personal-subagent-read-only`,children:m(`drawer.subagentRemoteReadOnly`)}):(0,H.jsxs)(`div`,{className:`personal-subagent-fields`,children:[(0,H.jsxs)(`fieldset`,{className:`personal-subagent-domain-picker`,disabled:Ce,children:[(0,H.jsx)(`legend`,{children:m(`drawer.subagentDomains`)}),we.length>0?(0,H.jsx)(`div`,{className:`personal-subagent-domain-options`,children:we.map(e=>{let t=C.includes(e.value);return(0,H.jsxs)(`label`,{className:`personal-subagent-domain-option${t?` is-selected`:``}`,children:[(0,H.jsx)(`input`,{"aria-label":e.value,checked:t,onChange:t=>Ee(e.value,t.target.checked),type:`checkbox`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.value}),(0,H.jsx)(`small`,{children:m(`drawer.subagentDomainTodoCount`,{count:e.matchingTodoCount})})]})]},e.value)})}):(0,H.jsx)(`p`,{className:`personal-subagent-domain-empty`,children:m(`drawer.subagentDomainsEmpty`)}),(0,H.jsx)(`small`,{children:m(`drawer.subagentDomainsHint`)})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:m(`drawer.subagentModel`)}),(0,H.jsx)(`input`,{"aria-label":m(`drawer.subagentModel`),disabled:Ce,value:k,placeholder:`gpt-5.6-luna`,onChange:e=>{ee(e.target.value),P(null),M(`idle`),E(null)}})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:m(`drawer.subagentEffort`)}),(0,H.jsxs)(`select`,{"aria-label":m(`drawer.subagentEffort`),disabled:Ce,value:te,onChange:e=>{A(e.target.value),P(null),M(`idle`),E(null)},children:[(0,H.jsx)(`option`,{value:``,children:m(`drawer.subagentModelDefault`)}),[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`].map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]})]}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:Ce,type:`button`,onClick:()=>{ee(`gpt-5.6-luna`),A(`max`),P(null),M(`idle`),E(null)},children:m(`drawer.subagentLunaPreset`)}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:Ce,type:`button`,onClick:()=>{ee(``),A(``),P(null),M(`idle`),E(null)},children:m(`drawer.subagentClearModel`)}),(0,H.jsx)(`p`,{children:m(`drawer.subagentModelHint`)}),(0,H.jsxs)(`label`,{className:`personal-subagent-limit-field`,children:[(0,H.jsx)(`span`,{children:m(`drawer.subagentMaxChildren`)}),(0,H.jsx)(`select`,{"aria-label":m(`drawer.subagentMaxChildren`),disabled:Ce,onChange:e=>{O(Number(e.target.value)),P(null),M(`idle`),E(null)},value:D,children:$y.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})]}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:Ce,onClick:()=>void De(Se.enabled,!0),type:`button`,children:m(`drawer.subagentPreviewBoundary`)})]})]}):null]}):null,f.kind===`run`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{"aria-label":m(`drawer.runView`),className:`personal-run-drawer-tabs`,role:`tablist`,children:[(0,H.jsx)(`button`,{"aria-selected":x===`record`,onClick:()=>S(`record`),role:`tab`,type:`button`,children:m(`drawer.executionRecordAndResult`)}),(0,H.jsx)(`button`,{"aria-selected":x===`details`,onClick:()=>S(`details`),role:`tab`,type:`button`,children:m(`drawer.detailsAndActions`)})]}),x===`record`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card personal-session-summary`,children:[(0,H.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Yi(f.item.sessionStatus??f.item.status,m)]}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.latestActivity}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,H.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]})]})]}),(0,H.jsxs)(`section`,{"aria-label":m(`drawer.executionRecord`),className:`personal-session-message-record`,children:[(0,H.jsx)(`h3`,{children:m(`drawer.executionRecord`)}),f.item.sessionMessages?.length?(0,H.jsx)(`ol`,{children:f.item.sessionMessages.map(e=>(0,H.jsxs)(`li`,{className:`is-${e.role}`,children:[(0,H.jsx)(`i`,{}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:e.role===`user`?m(`drawer.runRoleUser`):e.role===`assistant`?m(`drawer.runRoleAssistant`):m(`drawer.runRoleSystem`)}),e.createdAt?(0,H.jsx)(`time`,{children:new Date(e.createdAt).toLocaleTimeString(p,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}):null]}),(0,H.jsx)(`p`,{children:e.text})]})]},e.messageId))}):(0,H.jsx)(`p`,{className:`personal-session-empty`,children:ge?m(`drawer.runRecordProjected`,{completed:f.item.completedSteps,outputs:f.item.outputs?.length?m(`drawer.runRecordProjectedOutputs`,{count:f.item.outputs.length}):``,total:f.item.totalSteps}):m(`drawer.runRecordEmpty`)}),f.item.status===`running`?(0,H.jsxs)(`div`,{className:`personal-session-active-step`,children:[(0,H.jsx)(`i`,{}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:m(`drawer.analysis`)}),(0,H.jsx)(`small`,{children:m(`drawer.agentWorking`)})]})]}):null]}),f.item.outputs?.length?(0,H.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-run-outputs-title`,children:[(0,H.jsx)(`h3`,{id:`personal-run-outputs-title`,children:m(`drawer.outputs`)}),(0,H.jsx)(`ol`,{children:f.item.outputs.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsx)(`small`,{children:e.createdAt??e.kind??m(`files.emptySummary`)})]})},e.outputId))})]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Yi(f.item.status,m)]}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.latestActivity}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,H.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.sessionStatus`)}),(0,H.jsx)(`dd`,{children:Yi(f.item.sessionStatus??f.item.status,m)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.sessionRecoverable`)}),(0,H.jsx)(`dd`,{children:f.item.resumable===!1?m(`drawer.resumeNo`):m(`drawer.resumeYes`)})]})]})]}),f.item.sessionStatus===`resume_failed`&&!u?(0,H.jsxs)(`section`,{className:`personal-recovery-panel`,"aria-label":m(`drawer.recoveryFailed`),children:[(0,H.jsx)(`strong`,{children:m(`drawer.recoveryFailed`)}),(0,H.jsx)(`p`,{children:m(`drawer.recoveryDescription`)}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,H.jsx)(Rm,{size:16}),m(`drawer.recoveryRetry`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.recoveryNewSession`)]})]}):null,u?null:(0,H.jsxs)(`section`,{className:`personal-correction-panel`,children:[(0,H.jsx)(`header`,{children:(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:16}),m(`drawer.correctionLabel`,{agent:f.item.agentLabel})]})}),(0,H.jsx)(`p`,{children:m(`drawer.correctionDescription`)}),(0,H.jsxs)(`div`,{className:`personal-correction-composer`,children:[(0,H.jsx)(`textarea`,{"aria-label":m(`drawer.correctionTextarea`,{agent:f.item.agentLabel,goal:f.item.goalTitle,run:f.item.title}),onChange:e=>g(e.target.value),placeholder:m(`drawer.correctionPlaceholder`),rows:3,value:h}),(0,H.jsx)(`button`,{"aria-label":m(`drawer.correctionSend`),disabled:!h.trim(),onClick:()=>void ye(),type:`button`,children:(0,H.jsx)(Vm,{size:16})})]})]}),u?null:(0,H.jsxs)(`details`,{className:`personal-compact-menu personal-run-more`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(fm,{size:17}),m(`drawer.moreRunActions`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{disabled:!f.item.canInterrupt,onClick:()=>void r.onInterruptRun?.(f.item),type:`button`,children:[(0,H.jsx)(Nm,{size:16}),m(`drawer.runInterrupt`)]}),(0,H.jsxs)(`button`,{disabled:f.item.resumable===!1,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,H.jsx)(Rm,{size:16}),m(`drawer.recoveryRetry`)]}),(0,H.jsxs)(`button`,{onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.runNewSession`)]}),(0,H.jsxs)(`button`,{onClick:()=>void r.onCloseRunSession?.(f.item),type:`button`,children:[(0,H.jsx)(Jm,{size:16}),m(`drawer.runCloseSession`)]})]})]})]})]}):null,f.kind===`output`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsx)(`small`,{children:f.item.kind??`output`}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.summary??m(`drawer.outputRecorded`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.outputTodo`)}),(0,H.jsx)(`dd`,{children:f.item.todoId??m(`drawer.notLinked`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.outputRun`)}),(0,H.jsx)(`dd`,{children:f.item.runId??m(`drawer.notLinked`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Agent`}),(0,H.jsx)(`dd`,{children:f.item.agentLabel??f.item.agentId??`LoopX`})]})]})]}),f.item.report?(0,H.jsxs)(`section`,{className:`personal-report-detail`,"data-testid":`personal-periodic-report-detail`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(`strong`,{children:[`+`,f.item.report.addedCount]}),m(`files.reportAdded`)]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:f.item.report.changedCount}),m(`files.reportChanged`)]})]}),(0,H.jsxs)(`p`,{children:[f.item.report.periodStartAt,` → `,f.item.report.periodEndAt]}),(0,H.jsx)(`ol`,{children:f.item.report.items.map(e=>(0,H.jsxs)(`li`,{"data-change-kind":e.changeKind,children:[(0,H.jsxs)(`small`,{children:[e.changeKind,` · `,e.status]}),(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsx)(`p`,{children:e.summary})]},e.sourceRef))}),(0,H.jsxs)(`footer`,{children:[(0,H.jsxs)(`span`,{children:[m(`files.reportPublication`),`: `,f.item.report.publicationId]}),(0,H.jsxs)(`span`,{children:[m(`files.reportGeneration`),`: `,f.item.report.generationId]})]})]}):null,f.item.safePreview?(0,H.jsx)(`pre`,{"aria-label":m(`drawer.outputSafePreview`),className:`personal-safe-preview`,children:f.item.safePreview}):(0,H.jsx)(`p`,{className:`personal-preview-unavailable`,children:m(`drawer.previewUnavailable`)}),(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:!r.onOpenOutput,onClick:()=>{r.onOpenOutput?.(f.item),c()},type:`button`,children:[(0,H.jsx)(pm,{size:16}),m(`files.openConversation`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!r.onExportOutput,onClick:()=>void r.onExportOutput?.(f.item),type:`button`,children:[(0,H.jsx)(dm,{size:16}),m(`files.exportSummary`)]})]})]}):null,f.kind===`proposal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-proposal-card`,children:[(0,H.jsxs)(`small`,{children:[f.item.actionKind,` · `,f.item.status]}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.impact}),f.item.reviewPlan?(0,H.jsx)(`p`,{className:`personal-proposal-explainer`,"data-action-review":f.item.reviewPlan.interaction,children:f.item.actionKind===`operation.execute`&&f.item.status===`gated`?m(`actionReview.operation_group_confirmation`):f.item.actionKind===`operation.execute`&&f.item.reviewPlan.reason===`readback_unverified`?m(`actionReview.operation_result_delivery_pending`):m(`actionReview.${f.item.reviewPlan.reason}`)}):null,f.item.status===`ready`?(0,H.jsx)(`p`,{className:`personal-proposal-explainer`,children:m(`drawer.proposalExplainer`)}):null,(0,H.jsx)(`dl`,{children:f.item.fields.map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:e.label}),(0,H.jsx)(`dd`,{children:e.value})]},e.key))})]}),f.item.status===`applied`?(0,H.jsxs)(`p`,{className:`personal-proposal-state ${f.item.actionKind===`operation.execute`&&f.item.reviewPlan?.reason===`readback_unverified`?`is-gated`:`is-applied`}`,children:[(0,H.jsx)(tm,{size:16}),f.item.actionKind===`operation.execute`?f.item.primaryLabel:m(`drawer.proposalApplied`)]}):null,f.item.status===`applied`&&f.item.actionKind!==`operation.execute`&&f.item.goalId?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>{let e=f.item.goalId;c(),r.onOpenGoal?.(e)},type:`button`,children:[(0,H.jsx)(pm,{size:16}),f.item.actionKind===`goal.create`?m(`drawer.proposalEnterGoal`):m(`drawer.proposalViewGoal`)]}):null,f.item.status===`stale`?(0,H.jsx)(`p`,{className:`personal-proposal-state is-stale`,children:m(`drawer.proposalStale`)}):null,f.item.status===`error`?(0,H.jsxs)(`div`,{className:`personal-proposal-state is-error`,children:[(0,H.jsx)(`span`,{children:f.item.reviewPlan?.reason===`readback_unverified`?m(`actionReview.readback_unverified`):m(`drawer.proposalApplyFailed`)}),f.item.errorMessage?(0,H.jsx)(`small`,{children:f.item.errorMessage}):null,(0,H.jsx)(`small`,{children:m(`drawer.proposalApplyFailedHint`)})]}):null,f.item.status===`rejected`?(0,H.jsx)(`p`,{className:`personal-proposal-state is-error`,children:m(`drawer.proposalRejected`)}):null,f.item.status===`deferred`?(0,H.jsx)(`p`,{className:`personal-proposal-state is-gated`,children:m(`drawer.proposalDeferred`)}):null,f.item.status===`gated`?(0,H.jsxs)(`div`,{className:`personal-proposal-state is-gated`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:f.item.actionKind===`operation.execute`?f.item.primaryLabel:m(`drawer.gateRequiresHost`)}),f.item.actionKind===`operation.execute`?f.item.impact:m(`drawer.gateRequiresHostDescription`)]}),f.item.gate?.nextAction?(0,H.jsx)(`small`,{children:f.item.gate.nextAction}):null]}):null,f.item.status===`gated`&&f.item.actionKind===`gate.resolve`?(()=>{let e=e=>f.item.fields.find(t=>t.key===e)?.value,t=e(`goal_id`),n=e(`todo_id`);return!t||!n?null:(0,H.jsxs)(`section`,{className:`personal-detail-card personal-gate-cli-hint`,children:[(0,H.jsx)(`small`,{children:m(`drawer.gateApproveHint`)}),(0,H.jsxs)(`code`,{children:[`loopx todo complete --goal-id `,t,` --todo-id `,n,` --decision-outcome approve`]}),(0,H.jsx)(`small`,{children:m(`drawer.gateRejectHint`)})]})})():null,!u&&f.item.workspaceCandidates?.length?(0,H.jsx)(`div`,{className:`personal-workspace-candidates`,"aria-label":m(`drawer.workspaceCandidates`),children:f.item.workspaceCandidates.map(e=>(0,H.jsxs)(`button`,{onClick:()=>void r.onSelectWorkspaceCandidate?.(f.item,e.workspaceRef),type:`button`,children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsx)(`small`,{children:e.workspaceRef})]},e.workspaceRef))}):null,!u&&f.item.actionKind!==`operation.execute`&&f.item.status===`error`?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,H.jsx)(Rm,{size:17}),m(`drawer.proposalRegenerate`)]}):!u&&f.item.actionKind!==`operation.execute`&&f.item.status!==`gated`?(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:![`ready`,`deferred`].includes(f.item.status)||f.item.reviewPlan?.canApply===!1,onClick:()=>void r.onApplyProposal?.(f.item),type:`button`,children:[(0,H.jsx)(tm,{size:17}),f.item.status===`applying`?m(`drawer.applying`):f.item.primaryLabel??m(`drawer.apply`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&([`stale`,`gated`,`rejected`].includes(f.item.status)||f.item.status===`ready`&&f.item.reviewPlan?.canApply===!1)?(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,H.jsx)(Rm,{size:16}),m(`drawer.proposalRecheck`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&[`ready`,`gated`].includes(f.item.status)?(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`defer`),type:`button`,children:m(`drawer.proposalDefer`)}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`reject`),type:`button`,children:m(`drawer.decisionReject`)})]}):null,[`applied`,`applying`].includes(f.item.status)?null:(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:c,type:`button`,children:m(`drawer.proposalClose`)})]}):null,f.kind===`schedule`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsxs)(`small`,{children:[f.item.scheduleKind===`heartbeat`?`Goal Heartbeat`:`continuous_monitor`,` · `,f.item.status??`active`]}),(0,H.jsx)(`h3`,{children:f.item.label}),(0,H.jsx)(`p`,{children:f.item.target??f.item.schedule??m(`drawer.scheduleDefaultTarget`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleTimezone`)}),(0,H.jsx)(`dd`,{children:f.item.timezone??m(`drawer.scheduleLocalTimezone`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleNext`)}),(0,H.jsx)(`dd`,{children:f.item.nextRunAt??m(`drawer.schedulePending`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleLast`)}),(0,H.jsx)(`dd`,{children:f.item.previousRunAt??m(`drawer.scheduleNeverRun`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleNotification`)}),(0,H.jsx)(`dd`,{children:f.item.notificationRule??m(`drawer.scheduleDefaultNotification`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleStopCondition`)}),(0,H.jsx)(`dd`,{children:f.item.stopCondition??m(`drawer.scheduleDefaultStop`)})]})]})]}),!u&&f.item.scheduleKind===`monitor`?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`run_now`),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.scheduleRunNow`)]}):null,u?null:(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,f.item.status===`paused`?`resume`:`pause`),type:`button`,children:[f.item.status===`paused`?(0,H.jsx)(Pm,{size:16}):(0,H.jsx)(Nm,{size:16}),f.item.status===`paused`?m(`drawer.scheduleResume`):m(`drawer.schedulePause`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`edit`),type:`button`,children:[(0,H.jsx)(em,{size:16}),m(`drawer.scheduleEdit`)]})]}),u?null:(0,H.jsxs)(`button`,{className:`personal-danger-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`stop`),type:`button`,children:[(0,H.jsx)(Jm,{size:16}),m(`drawer.scheduleStop`,{kind:f.item.scheduleKind===`heartbeat`?` Heartbeat`:m(`drawer.titleSchedule`)})]}),(0,H.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-execution-history-title`,children:[(0,H.jsx)(`h3`,{id:`personal-execution-history-title`,children:m(`drawer.executionHistory`)}),f.item.executionHistory?.length?(0,H.jsx)(`ol`,{children:f.item.executionHistory.map((e,t)=>(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsx)(`small`,{children:e.timestamp})]}),(0,H.jsx)(`em`,{className:`is-${e.status}`,children:e.status})]},`${e.timestamp}:${e.runId??t}`))}):(0,H.jsx)(`p`,{children:m(`drawer.noExecutionHistory`)})]})]}):null,f.kind===`run`||f.kind===`proposal`||f.kind===`schedule`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{"aria-expanded":_,className:`personal-diagnostics-trigger`,onClick:()=>v(e=>!e),type:`button`,children:[(0,H.jsx)(`span`,{children:m(`drawer.advancedDiagnostics`)}),(0,H.jsx)(nm,{className:_?`is-open`:``,size:16})]}),_?(0,H.jsxs)(`div`,{className:`personal-diagnostics`,children:[(0,H.jsxs)(`code`,{children:[`goal_id: `,pe]}),(0,H.jsxs)(`code`,{children:[`kind: `,f.kind]}),f.kind===`run`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`code`,{children:[`session_id: `,f.item.sessionId??m(`drawer.notLinked`)]}),(0,H.jsxs)(`code`,{children:[`turn_id: `,f.item.turnId??m(`common.none`)]}),(0,H.jsxs)(`code`,{children:[`adapter: `,f.item.agentId]}),(0,H.jsxs)(`code`,{children:[`status: `,f.item.sessionStatus??f.item.status]})]}):f.kind===`proposal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`code`,{children:[`action: `,f.item.actionKind]}),(0,H.jsxs)(`code`,{children:[`status: `,f.item.status]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`code`,{children:[`schedule_id: `,f.item.scheduleId]}),(0,H.jsxs)(`code`,{children:[`status: `,f.item.status??`active`]})]})]}):null]}):null]})]})}var ib=[`checking`,`connecting`,`downloading`,`installing_app`,`installing_runtime`],ab={desktop_status_unavailable:[`无法读取 App 更新状态。请重启 App 后再试;若仍失败,请重新安装最新 App。`,`Cannot read the App update status. Restart the App; if this persists, reinstall the latest App.`],update_feed_unavailable:[`此通道的更新源尚未就绪或暂时不可用。可稍后重新检查,当前版本仍可继续使用。`,`This channel's update feed is not ready or temporarily unavailable. Check again later; you can keep using this version.`],update_feed_invalid:[`更新源格式异常。请稍后重新检查。`,`The update feed is invalid. Check again later.`],update_platform_unavailable:[`此通道尚无适用于本机的更新包。`,`This channel has no update package for this platform.`],update_check_timeout:[`检查更新超时。请稍后重试。`,`The update check timed out. Try again later.`],update_network_failed:[`无法连接更新服务器。请检查网络后重试。`,`Cannot reach the update server. Check your connection and retry.`],update_download_or_signature_failed:[`更新包下载或签名校验失败,尚未安装。请重新检查更新。`,`Download or signature verification failed; the update was not installed. Check for updates again.`]};function ob(e,t=`update_failed`){return{phase:`error`,details:{code:typeof e==`string`&&Object.hasOwn(ab,e)?e:t}}}function sb(){let{locale:e}=qi(),t=e===`zh-CN`,[n,r]=(0,V.useState)(!1),i=(0,V.useRef)(null),[a,o]=(0,V.useState)(`stable`),[s,c]=(0,V.useState)({phase:`idle`}),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(!1),p=(0,V.useRef)(!1),m=window.__TAURI__?.core.invoke,h=ib.includes(s.phase);(0,V.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>r(e.matches(`:popover-open`));return e.addEventListener(`toggle`,t),()=>e.removeEventListener(`toggle`,t)},[]),(0,V.useEffect)(()=>{if(!m)return;let e=!0;return m(`desktop_update_status`).then(t=>{if(!e)return;u(t.app_version),f(t.rollback_available===!0),t.state?.phase&&c(t.state);let n=t.state?.details?.channel??(t.app_version.includes(`-main.`)?`main`:`stable`);o(n),t.state?.phase||m(`desktop_update`,{action:`check`,channel:n}).then(t=>{e&&c(t)}).catch(t=>{e&&c(ob(t))})}).catch(()=>{e&&c(ob(null,`desktop_status_unavailable`))}),()=>{e=!1}},[m]),(0,V.useEffect)(()=>{if(!m||!h)return;let e=window.setInterval(()=>{m(`desktop_update_status`).then(e=>{e.state?.phase&&c(e.state)}).catch(()=>{})},1e3);return()=>window.clearInterval(e)},[m,h]);async function g(e){if(!(!m||p.current)){p.current=!0,c({phase:e===`check`?`checking`:e===`repair`?`installing_runtime`:`downloading`});try{if(!l){let e=await m(`desktop_update_status`);u(e.app_version),f(e.rollback_available===!0)}c(await m(`desktop_update`,{action:e,channel:a}))}catch(e){c(ob(e,l?`update_failed`:`desktop_status_unavailable`))}finally{p.current=!1}}}let _={service_error:t?`运行时已安装,但服务尚未连接。可重试更新、修复或恢复上版。`:`Runtime installed, but services are unavailable. Retry updates, repair, or restore the previous version.`,idle:t?`App 会检查可用更新,不会自动安装。`:`Updates are checked automatically, never installed without confirmation.`,runtime_required:t?`请完成匹配组件安装,或检查 App 更新。`:`Install matching components or check for an App update.`,connecting:t?`正在连接更新后的服务…`:`Connecting to updated services…`,checking:t?`正在检查更新…`:`Checking for updates…`,available:t?`新版本已就绪,一次更新 App 与匹配的运行时。`:`Update the App and its matching runtime together.`,up_to_date:t?`当前通道暂无更新。`:`No newer update on this channel.`,downloading:t?`正在下载并校验签名…`:`Downloading and verifying signature…`,installing_app:t?`正在安装 App,请保持窗口打开。`:`Installing the App. Keep this window open.`,installing_runtime:t?`正在安装匹配的运行时,请稍候…`:`Installing the matching runtime…`,restart_required:t?`重启后将自动完成运行时安装与服务连接。`:`Restart to finish runtime installation and reconnect services.`,ready:t?`更新完成,服务已就绪。`:`Update completed; services are ready.`,error:ab[s.details?.code??``]?.[+!t]??(t?`更新未完成。请重试;启动失败可尝试修复当前版本。`:`Update incomplete. Retry; repair this version if startup fails.`)},v=h?t?`正在更新…`:`Updating…`:s.phase===`available`?t?`有可用更新`:`Update available`:s.phase===`restart_required`?t?`重启完成更新`:`Restart to finish`:s.phase===`error`?t?`更新需重试`:`Retry update`:t?`更新 LoopX`:`Update LoopX`;return(0,H.jsxs)(`div`,{className:`personal-desktop-update`,children:[(0,H.jsxs)(`button`,{className:`personal-update-trigger`,type:`button`,"aria-expanded":n,"aria-controls":`desktop-update-panel`,onClick:e=>{i.current?.style.setProperty(`bottom`,`${window.innerHeight-e.currentTarget.getBoundingClientRect().top+8}px`),i.current?.togglePopover()},children:[(0,H.jsx)(dm,{size:16,"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:v}),(0,H.jsx)(im,{size:14,"aria-hidden":`true`})]}),(0,H.jsxs)(`section`,{ref:i,popover:`auto`,id:`desktop-update-panel`,className:`personal-update-panel`,"aria-label":t?`LoopX 更新`:`LoopX updates`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:t?`LoopX 更新`:`LoopX updates`}),(0,H.jsx)(`button`,{type:`button`,"aria-label":t?`关闭更新面板`:`Close updates`,onClick:()=>i.current?.hidePopover(),children:(0,H.jsx)(eh,{size:16,"aria-hidden":`true`})})]}),(0,H.jsxs)(`small`,{children:[l,` · `,a===`main`?t?`main 预览版`:`main preview`:t?`稳定版`:`Stable`]}),s.details?.version?(0,H.jsxs)(`p`,{children:[t?`目标版本:`:`Target: `,s.details.version]}):null,(0,H.jsxs)(`p`,{role:`status`,"aria-live":`polite`,children:[h?(0,H.jsx)(Lm,{className:`is-spinning`,size:14,"aria-hidden":`true`}):null,_[s.phase]]}),s.phase===`downloading`&&s.details?.total?(0,H.jsx)(`progress`,{"aria-label":t?`下载进度`:`Download progress`,max:s.details.total,value:s.details.received??0}):null,m?(0,H.jsx)(`div`,{className:`personal-update-actions`,children:s.phase===`restart_required`?(0,H.jsx)(`button`,{type:`button`,onClick:()=>void g(`restart`),children:t?`重启完成更新`:`Restart to finish`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void g(`check`),children:t?`检查更新`:`Check for updates`}),s.phase===`available`?(0,H.jsx)(`button`,{type:`button`,onClick:()=>void g(`apply`),children:t?`更新并准备重启`:`Install update`}):null]})}):(0,H.jsx)(`p`,{children:t?`请在 LoopX App 中更新;浏览器自身无需安装包。`:`Update from the LoopX App; the browser needs no installer.`}),(0,H.jsxs)(`details`,{children:[(0,H.jsx)(`summary`,{children:t?`高级选项`:`Advanced options`}),(0,H.jsxs)(`label`,{children:[t?`更新通道`:`Update channel`,(0,H.jsxs)(`select`,{disabled:h||s.phase===`restart_required`,value:a,onChange:e=>{o(e.target.value),c({phase:`idle`})},children:[(0,H.jsx)(`option`,{value:`stable`,children:t?`稳定版(推荐)`:`Stable (recommended)`}),(0,H.jsx)(`option`,{value:`main`,children:t?`main 预览版`:`main preview`})]})]}),(0,H.jsx)(`p`,{children:t?`App 与匹配的 CLI 一起更新,服务可能短暂断开。不删除 Goal 数据。`:`Updates the App and matching CLI. Services may briefly disconnect. Goal data is not deleted.`}),m?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{children:t?`启动失败时,可重装当前 App 随附的运行时。`:`If startup fails, reinstall this App's bundled runtime.`}),(0,H.jsx)(`button`,{disabled:h||s.phase===`restart_required`,type:`button`,onClick:()=>void g(`repair`),children:t?`修复当前版本`:`Repair this version`})]}):null,m&&d?(0,H.jsxs)(`details`,{children:[(0,H.jsx)(`summary`,{children:t?`恢复上个版本`:`Restore previous version`}),(0,H.jsx)(`p`,{children:t?`将恢复已保留的 App 和它的运行时,需要重启。`:`Restore the retained App and its runtime, then restart.`}),(0,H.jsx)(`button`,{disabled:h,type:`button`,onClick:()=>void g(`rollback`),children:t?`确认恢复上版`:`Restore previous version`})]}):null]})]})]})}var cb=e=>`loopx-sidebar-goal-order-v1:${encodeURIComponent(e)}`;function lb(e){try{let t=JSON.parse(e??`null`);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?[...new Set(t)]:[]}catch{return[]}}function ub(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.goalId)??1/0)-(n.get(t.goalId)??1/0))}function db(e,t,n,r,i){if(n===r||!t.includes(n)||!t.includes(r))return e;let a=[...new Set([...e,...t])].filter(e=>e!==n);return a.splice(a.indexOf(r)+Number(i),0,n),a}function fb(e,t){let n=cb(t),[r,i]=(0,V.useState)(()=>{try{return lb(localStorage.getItem(n))}catch{return[]}}),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),d=(0,V.useRef)(null),f=(0,V.useRef)(!1),p=ub(e,r),m=p.map(e=>e.goalId);function h(t,a,s){let l=db(r,m,t,a,s);if(l===r)return;i(l);let u=ub(e,l),d=u.findIndex(e=>e.goalId===t),f=u[d];f&&c({title:f.title,position:d+1});try{localStorage.setItem(n,JSON.stringify(l)),o(!1)}catch{o(!0)}}function g(){d.current=null,u(null)}return{sorted:p,target:l,saveFailed:a,lastMoved:s,move:h,moveBy(e,t){let n=p[m.indexOf(e)+t];n&&h(e,n.goalId,t===1)},pointerProps:e=>({onPointerDown(t){f.current=!1,t.pointerType===`mouse`&&t.button===0&&(d.current={id:e,x:t.clientX,y:t.clientY,dragging:!1},t.currentTarget.setPointerCapture(t.pointerId))},onPointerMove(e){let t=d.current;if(!t||!t.dragging&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<6)return;t.dragging=!0,f.current=!0;let n=document.elementFromPoint(e.clientX,e.clientY)?.closest(`[data-reorder-goal]`),r=e.currentTarget.closest(`.personal-goal-list`),i=n?.dataset.reorderGoal;if(!n||!i||!r?.contains(n)||i===t.id){u(null);return}let a=n.getBoundingClientRect();u({id:i,after:e.clientY>a.top+a.height/2})},onPointerUp(){d.current?.dragging&&l&&h(d.current.id,l.id,l.after),g()},onPointerCancel:g,onLostPointerCapture:g,onKeyDown(e){e.key===`Escape`&&g()},onClickCapture(e){f.current&&=(e.preventDefault(),e.stopPropagation(),!1)}})}}var pb=`/ssh-hosts`,mb=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/;function hb(e){return typeof e==`string`&&mb.test(e.trim())}function gb(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`SSH Host 列表响应无效。`);let t=e;if(t.ok!==!0||t.schema_version!==`ssh_host_catalog_v0`||!Array.isArray(t.hosts))throw Error(`SSH Host 列表协议不兼容,请更新本机 LoopX 服务。`);let n=new Set;return{hosts:t.hosts.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=String(e.alias??``).trim();return!hb(t)||n.has(t)?[]:(n.add(t),[{alias:t}])}),schemaVersion:`ssh_host_catalog_v0`}}async function _b(e=fetch,t=pb){let n=await e(t,{cache:`no-store`});if(!n.ok)throw Error(`无法读取本机 SSH Host(HTTP ${n.status})。`);return gb(await n.json())}function vb(e,t){let n=e.trim();if(!hb(n))return{error:`请选择有效的 SSH Host。`};let r=Number(t);return!Number.isInteger(r)||r<1024||r>65535?{error:`本地端口必须是 1024–65535 之间的整数。`}:{command:`ssh -N -L ${r}:127.0.0.1:8766 ${n}`,hostAlias:n,label:n,statusUrl:`http://127.0.0.1:${r}/status.json`}}var yb=`/api/ssh-source/ensure`,bb=`/api/ssh-source/goal-lifecycle`;async function xb(e,t){let n=await fetch(yb,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({host_alias:e,local_port:Number(t)})}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error??`无法建立 SSH 隧道来源。`);if(!r?.ok)throw Error(`无法建立 SSH 隧道来源。`);return r}async function Sb(e,t,n,r,i=fetch){let a=await i(bb,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({goal_id:t,host_alias:e,operation:n,reason:r})}),o=await a.json().catch(()=>null);if(!a.ok)throw Error(o?.error??`无法更新远端 Goal 生命周期。`);if(!o?.ok||o.schema_version!==`loopx_remote_goal_lifecycle_v1`||o.goal_id!==t||o.host_alias!==e||o.operation!==n||o.activation_state!==(n===`stop`?`stopped`:`active`)||o.projection_verified!==!0)throw Error(`远端 Goal 生命周期回读未验证。`);return o}function Cb({activeSource:e,connectionState:t,errorMessage:n,onAdd:r,onConfiguredHostsLoaded:i,onRemove:a,onSelect:o,sources:s}){let{t:c}=qi(),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)(`configured`),[h,g]=(0,V.useState)([]),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(``),[T,E]=(0,V.useState)(``),[D,O]=(0,V.useState)(`8876`),[k,ee]=(0,V.useState)(``),te=`configured:`,A=[...s.map(e=>({label:e.label,value:e.id})),...h.filter(e=>!s.some(t=>t.label===e.alias)).map(e=>({group:c(`source.configuredGroup`,{count:h.length}),label:e.alias,value:`${te}${e.alias}`}))],j=(0,V.useMemo)(()=>h.some(e=>e.alias===C)?vb(C,D):{error:c(`source.selectHost`)},[h,C,D,c]);(0,V.useEffect)(()=>{M()},[]);async function M(){b(!0),v(null);try{let e=await _b();g(e.hosts),i?.(e.hosts.map(e=>e.alias)),w(t=>t||e.hosts[0]?.alias||``),e.hosts.length||v(c(`source.hostEmpty`))}catch(e){v(e instanceof Error?e.message:c(`source.hostLoadError`))}finally{b(!1)}}function N(){u(!0),m(`configured`),f(null),M()}function P(){u(!1),m(`configured`),v(null),S(!1),w(``),f(null),E(``),O(`8876`),ee(``)}function F(){let e=r({label:T,statusUrl:k});if(e.error){f(e.error);return}P()}function ne(){if(`error`in j){f(j.error??c(`source.invalid`));return}let e=r({ensureTunnel:!0,hostAlias:j.hostAlias,label:j.label,statusUrl:j.statusUrl});if(e.error){f(e.error);return}P()}function re(e){let t=new Set;for(let e of s)try{t.add(new URL(e.statusUrl).port)}catch{}let n=`8877`;for(let e=8877;e<9077;e+=1)if(!t.has(String(e))){n=String(e);break}let i=vb(e,n);if(`error`in i){f(i.error??c(`source.invalid`));return}let a=r({ensureTunnel:!0,hostAlias:i.hostAlias,label:i.label,statusUrl:i.statusUrl});a.error?f(a.error):f(null),O(n)}async function I(){if(`error`in j){f(j.error??c(`source.invalid`));return}try{await navigator.clipboard.writeText(j.command),S(!0),f(null)}catch{f(c(`source.copyError`))}}return(0,H.jsxs)(`section`,{"aria-label":c(`source.controlPlane`),className:`personal-status-source`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`span`,{children:`Control plane`}),(0,H.jsx)(`button`,{"aria-label":c(`source.addSsh`),onClick:N,title:c(`source.add`),type:`button`,children:(0,H.jsx)(Fm,{size:14})})]}),(0,H.jsx)(Dy,{ariaLabel:c(`source.select`),className:`personal-status-source-select`,icon:(0,H.jsx)(Um,{size:15}),onChange:e=>{if(e.startsWith(te)){re(e.slice(11));return}o(e)},options:A,value:e.id}),(0,H.jsxs)(`div`,{className:`personal-status-source-meta`,children:[(0,H.jsxs)(`span`,{className:`is-${t}`,children:[(0,H.jsx)(`i`,{}),c(t===`loading`?`source.connecting`:t===`error`?`source.notAvailable`:`source.connected`)]}),(0,H.jsx)(`small`,{children:e.readOnly?c(`source.readOnly`):c(`source.localInteractive`)}),e.kind===`ssh_tunnel`?(0,H.jsx)(`button`,{"aria-label":c(`source.remove`,{source:e.label}),onClick:()=>a(e.id),title:c(`source.removeCurrent`),type:`button`,children:(0,H.jsx)(Zm,{size:12})}):null]}),n?(0,H.jsx)(`p`,{className:`personal-status-source-error`,role:`alert`,children:n}):null,l?(0,H.jsxs)(`div`,{className:`personal-status-source-form`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:c(`source.addSsh`)}),(0,H.jsx)(`button`,{"aria-label":c(`source.closeForm`),onClick:P,type:`button`,children:(0,H.jsx)(eh,{size:13})})]}),(0,H.jsxs)(`div`,{"aria-label":c(`source.addMethod`),className:`personal-status-source-modes`,role:`tablist`,children:[(0,H.jsx)(`button`,{"aria-selected":p===`configured`,onClick:()=>{m(`configured`),f(null)},role:`tab`,type:`button`,children:c(`source.configured`)}),(0,H.jsx)(`button`,{"aria-selected":p===`manual`,onClick:()=>{m(`manual`),f(null)},role:`tab`,type:`button`,children:c(`source.manual`)})]}),p===`configured`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.configuredCount`,{count:h.length})}),(0,H.jsxs)(`span`,{className:`personal-status-source-field-row`,children:[(0,H.jsx)(`input`,{"aria-label":c(`source.host`),disabled:y||!h.length,list:`loopx-configured-ssh-hosts`,onChange:e=>{w(e.target.value),S(!1)},placeholder:c(y?`source.loadingHosts`:`source.hostPlaceholder`),value:C}),(0,H.jsx)(`datalist`,{id:`loopx-configured-ssh-hosts`,children:h.map(e=>(0,H.jsx)(`option`,{value:e.alias},e.alias))}),(0,H.jsx)(`button`,{"aria-label":c(`source.refreshHosts`),disabled:y,onClick:()=>void M(),title:c(`source.refreshHosts`),type:`button`,children:(0,H.jsx)(zm,{size:13})})]})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.localPort`)}),(0,H.jsx)(`input`,{"aria-label":c(`source.localPort`),inputMode:`numeric`,onChange:e=>{O(e.target.value),S(!1)},value:D})]}),(0,H.jsxs)(`div`,{className:`personal-status-source-command`,children:[(0,H.jsx)(`code`,{children:`error`in j?c(`source.tunnelCommandPending`):j.command}),(0,H.jsxs)(`button`,{"aria-label":c(`source.copyCommand`),disabled:`error`in j,onClick:()=>void I(),type:`button`,children:[(0,H.jsx)(lm,{size:12}),c(x?`source.copied`:`source.copy`)]})]}),_?(0,H.jsx)(`p`,{className:`is-error`,children:_}):null,(0,H.jsx)(`p`,{children:c(`source.description`)}),(0,H.jsx)(`button`,{className:`personal-status-source-add`,disabled:`error`in j,onClick:ne,type:`button`,children:c(`source.addConfigured`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.name`)}),(0,H.jsx)(`input`,{autoFocus:!0,maxLength:48,onChange:e=>E(e.target.value),placeholder:c(`source.namePlaceholder`),value:T})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.statusUrl`)}),(0,H.jsx)(`input`,{onChange:e=>ee(e.target.value),placeholder:`http://127.0.0.1:8876/status.json`,value:k})]}),(0,H.jsx)(`p`,{children:(0,H.jsx)(`code`,{children:`ssh -N -L 8876:127.0.0.1:8766 `})}),(0,H.jsx)(`p`,{children:c(`source.manualDescription`)}),(0,H.jsx)(`button`,{className:`personal-status-source-add`,onClick:F,type:`button`,children:c(`source.addConfigured`)})]}),d?(0,H.jsx)(`p`,{className:`is-error`,role:`alert`,children:d}):null]}):null]})}var wb={需修复:`is-danger`,等你:`is-warning`,等待条件:`is-info`,推进中:`is-success`,安静运行:`is-quiet`,已完成:`is-quiet`,已停止:`is-stopped`};function Tb({attentionCount:e,goals:t,goalArchiveLoadState:n={error:null,phase:`ready`},lifecycleBusyGoalIds:r,goalLifecycleOperations:i,onRequestGoalCreate:a,onOpenSettings:o,onRetryGoalArchive:s,onRequestGoalLifecycle:c,onSelectGoal:l,selectedGoalId:u,statusSourceControl:d}){let{locale:f,t:p}=qi(),[m,h]=(0,V.useState)(!1),g=fb(t.filter(e=>e.activationState!==`stopped`),d?.activeSource.statusUrl??`/status.json`),_=g.sorted,v=t.filter(e=>e.activationState===`stopped`),y=e=>!!c&&(!i||i.includes(e)),b=(e,t)=>(0,H.jsxs)(`div`,{className:`personal-goal-row${g.target?.id===e.goalId?g.target.after?` is-drop-after`:` is-drop-before`:``}`,"data-reorder-goal":t?void 0:e.goalId,"data-load-error":e.loadError,children:[(0,H.jsxs)(`button`,{...t?{}:g.pointerProps(e.goalId),title:t?void 0:p(`sidebar.dragGoal`),"aria-current":u===e.goalId?`page`:void 0,className:`personal-goal-link`,onClick:()=>l(e.goalId),type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-goal-state-dot ${e.loadState?``:wb[e.state]}`}),(0,H.jsxs)(`span`,{className:`personal-goal-link-copy`,children:[(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsxs)(`small`,{children:[e.loadState&&(!t||u===e.goalId)?p(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Ji(e.state,f),e.needsYou&&!t?` · ${p(`home.lane.needsYou`)}`:``]})]}),(0,H.jsx)(rm,{size:15})]}),!t&&m?(0,H.jsxs)(`div`,{className:`personal-goal-move-actions`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":p(`sidebar.moveUp`,{goal:e.title}),disabled:_[0]?.goalId===e.goalId,onClick:()=>g.moveBy(e.goalId,-1),children:(0,H.jsx)(Yp,{"aria-hidden":`true`,size:13})}),(0,H.jsx)(`button`,{type:`button`,"aria-label":p(`sidebar.moveDown`,{goal:e.title}),disabled:_.at(-1)?.goalId===e.goalId,onClick:()=>g.moveBy(e.goalId,1),children:(0,H.jsx)(Gp,{"aria-hidden":`true`,size:13})})]}):null,c&&y(t?`resume`:`stop`)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{"aria-label":`${p(t?`sidebar.resume`:`sidebar.stop`)} ${e.title}`,"aria-busy":r?.has(e.goalId)||void 0,className:`personal-goal-lifecycle${r?.has(e.goalId)?` is-pending`:``}`,disabled:r?.has(e.goalId),onClick:()=>c(e,t?`resume`:`stop`),title:p(t?`sidebar.resumeGoal`:`sidebar.stopGoal`),type:`button`,children:r?.has(e.goalId)?(0,H.jsx)(wm,{size:13}):t?(0,H.jsx)(Rm,{size:13}):(0,H.jsx)(Nm,{size:13})}),t&&y(`delete`)?(0,H.jsx)(`button`,{"aria-label":`${p(`sidebar.delete`)} ${e.title}`,className:`personal-goal-lifecycle personal-goal-delete`,onClick:()=>c(e,`delete`),title:p(`sidebar.deleteGoal`),type:`button`,children:(0,H.jsx)(Zm,{size:13})}):null]}):null]},e.goalId);return(0,H.jsxs)(`div`,{className:`personal-goal-directory`,children:[(0,H.jsxs)(`div`,{className:`personal-sidebar-brand`,children:[(0,H.jsx)(`span`,{className:`personal-brand-mark`,children:(0,H.jsx)(Qp,{size:18})}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:`LoopX`})})]}),d?(0,H.jsx)(Cb,{...d}):null,(0,H.jsxs)(`nav`,{"aria-label":p(`home.workspace`),className:`personal-sidebar-nav`,children:[(0,H.jsxs)(`button`,{"aria-current":u===null?`page`:void 0,className:`personal-manager-link`,onClick:()=>l(null),type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-manager-icon`,children:(0,H.jsx)(Qp,{size:17})}),(0,H.jsx)(`span`,{children:p(`sidebar.manager`)}),e>0?(0,H.jsx)(`span`,{className:`personal-sidebar-count`,children:e}):null,(0,H.jsx)(rm,{size:15})]}),(0,H.jsxs)(`div`,{className:`personal-sidebar-section-title`,children:[(0,H.jsx)(`span`,{children:`Goals`}),(0,H.jsxs)(`span`,{className:`personal-sidebar-title-actions`,children:[(0,H.jsx)(`small`,{children:_.length}),(0,H.jsx)(`button`,{"aria-label":p(`sidebar.sortGoals`),title:p(`sidebar.sortGoals`),"aria-pressed":m,onClick:()=>h(!m),type:`button`,children:(0,H.jsx)(Jp,{"aria-hidden":`true`,size:15})}),a?(0,H.jsx)(`button`,{"aria-label":p(`sidebar.createGoal`),onClick:a,type:`button`,children:(0,H.jsx)(Fm,{size:15})}):null]})]}),g.saveFailed?(0,H.jsx)(`p`,{role:`status`,children:p(`sidebar.orderNotSaved`)}):null,(0,H.jsx)(`span`,{className:`personal-sr-only`,role:`status`,children:g.lastMoved?p(`sidebar.goalMoved`,{goal:g.lastMoved.title,position:g.lastMoved.position}):``}),(0,H.jsx)(`div`,{className:`personal-goal-list`,children:_.map(e=>b(e,!1))}),v.length||n.phase===`loading`||n.phase===`error`?(0,H.jsxs)(`details`,{className:`personal-stopped-goals`,open:n.phase===`error`||void 0,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(nm,{size:13}),(0,H.jsx)(`span`,{children:p(`sidebar.stopped`)}),n.phase===`loading`?(0,H.jsx)(wm,{"aria-label":p(`sidebar.stoppedLoading`),className:`is-spinning`,size:13}):(0,H.jsx)(`small`,{children:v.length})]}),(0,H.jsxs)(`div`,{className:`personal-goal-list is-stopped`,children:[n.phase===`error`?(0,H.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`alert`,children:[(0,H.jsx)(`span`,{children:p(`sidebar.stoppedLoadFailed`)}),s?(0,H.jsx)(`button`,{onClick:s,type:`button`,children:p(`sidebar.retryStopped`)}):null]}):null,v.map(e=>b(e,!0))]})]}):null]}),(0,H.jsxs)(`div`,{className:`personal-sidebar-footer`,children:[(0,H.jsx)(sb,{}),o?(0,H.jsxs)(`button`,{"aria-label":p(`settings.open`),className:`personal-sidebar-utility`,onClick:o,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-sidebar-utility-icon`,children:(0,H.jsx)(Wm,{size:17})}),(0,H.jsx)(`span`,{className:`personal-sidebar-utility-copy`,children:(0,H.jsx)(`strong`,{children:p(`settings.open`)})}),(0,H.jsx)(rm,{"aria-hidden":`true`,size:15})]}):null]})]})}var Eb=Y({ok:X(!0),total:K().int().nonnegative(),next_cursor:G().nullable(),items:J(Y({todo_id:G(),text:G(),claimed_by:G().nullable(),evidence:G().nullable(),priority:G().nullable(),task_class:G().nullable()})).max(40)});function Db({goal:e,agentId:t,seed:n,enabled:r,listView:i=!1,onSelect:a}){let{t:o}=qi(),s=(0,V.useId)(),[c,l]=(0,V.useState)(!1),u=!i||c,d=i?96:148,[f,p]=(0,V.useState)(n),[m,h]=(0,V.useState)(t===`all`?e.doneTodoCount??n.length:n.length),[g,_]=(0,V.useState)(void 0),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(!1),[w,T]=(0,V.useState)({top:0,height:600}),[E,D]=(0,V.useState)(null),O=(0,V.useRef)(null),k=(0,V.useRef)(null),[ee,te]=(0,V.useState)(0);(0,V.useEffect)(()=>{let e=O.current;if(!e)return;let t=new ResizeObserver(()=>T({top:e.scrollTop,height:e.clientHeight}));return t.observe(e),()=>{t.disconnect(),k.current?.abort()}},[]);let A=g===void 0||w.top+w.height>=f.length*d-d*2;(0,V.useEffect)(()=>{if(!r||!u||!A||g===null||b||k.current)return;let n=new AbortController;k.current=n,y(!0);let i=new URLSearchParams({goal_id:e.goalId});t!==`all`&&i.set(`agent_id`,t),g&&i.set(`cursor`,g),fetch(`/api/chat/completed-todos?${i}`,{signal:n.signal}).then(async e=>{if(e.status===409&&C(!0),!e.ok)throw Error(`history unavailable`);let t=Eb.parse(await e.json());if(n.signal.aborted)return;let r=t.items.map(e=>({todoId:e.todo_id,text:e.text,claimedBy:e.claimed_by,evidence:e.evidence,priority:e.priority,taskClass:e.task_class,done:!0,status:`done`}));p(e=>g===void 0?r:[...e,...r.filter(t=>!e.some(e=>e.todoId===t.todoId))]),h(t.total),_(t.next_cursor)}).catch(()=>{n.signal.aborted||x(!0)}).finally(()=>{n.signal.aborted||(k.current=null,y(!1))})},[r,u,A,g,b,ee,e.goalId,t,v]),(0,V.useEffect)(()=>{O.current&&(O.current.scrollTop=0),T({top:0,height:O.current?.clientHeight??600}),D(null)},[i]);let j=Math.max(0,Math.floor(w.top/d)-3),M=Math.min(f.length,Math.ceil((w.top+w.height)/d)+3),N=Array.from({length:Math.max(0,M-j)},(e,t)=>j+t);return E!==null&&El(e=>!e),children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,children:c?`▾`:`▸`}),` `,o(`tasks.completed`)]}):(0,H.jsxs)(`strong`,{children:[(0,H.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-done`}),o(`tasks.completed`)]}),(0,H.jsx)(`span`,{children:m})]}),(0,H.jsxs)(`div`,{id:s,hidden:!u,"aria-label":o(`tasks.completed`),className:`personal-task-lane-scroll`,ref:O,role:`region`,tabIndex:0,onScroll:e=>T({top:e.currentTarget.scrollTop,height:e.currentTarget.clientHeight}),children:[(0,H.jsx)(`div`,{className:`personal-completed-window`,style:{height:f.length*d},children:N.map(t=>{let n=f[t];return(0,H.jsx)(`div`,{className:`personal-task-card personal-completed-row`,style:{top:t*d,height:d},children:(0,H.jsxs)(`button`,{type:`button`,onFocus:()=>D(t),onBlur:()=>D(null),onClick:()=>a({kind:`todo`,item:{...n,goalId:e.goalId,goalTitle:e.title,ownerLabel:n.claimedBy??e.agentLabel??e.agentId}}),children:[(0,H.jsx)(`span`,{className:`is-done`,children:`✓`}),(0,H.jsx)(`strong`,{children:n.text}),(0,H.jsx)(`small`,{children:n.claimedBy??e.agentLabel??e.agentId})]})},n.todoId)})}),(0,H.jsx)(`div`,{className:`personal-completed-footer`,role:`status`,children:v?o(`tasks.historyLoading`):b?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:o(S?`tasks.historyExpired`:`tasks.historyError`)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{S&&(_(void 0),O.current&&(O.current.scrollTop=0)),C(!1),x(!1),te(e=>e+1)},children:o(`tasks.historyRetry`)})]}):r?g===null?o(`tasks.historyEnd`):(0,H.jsx)(`button`,{type:`button`,onClick:()=>{O.current&&(O.current.scrollTop=f.length*d)},children:o(`tasks.historyMore`)}):o(`tasks.historyLocalOnly`)})]})]})}function Ob({children:e,count:t,label:n,tone:r,listView:i=!1}){let a=(0,V.useId)(),o=(0,V.useRef)(null),s=(0,V.useRef)([]),c=(0,V.useRef)(null),[l,u]=(0,V.useState)({after:!1,before:!1}),d=(0,V.useCallback)(()=>{let e=o.current;if(!e)return;let t={after:Math.max(0,e.scrollHeight-e.clientHeight)-e.scrollTop>1,before:e.scrollTop>1};u(e=>e.after===t.after&&e.before===t.before?e:t)},[]);return(0,V.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(d);return c.current=t,t.observe(e),e.addEventListener(`scroll`,d,{passive:!0}),d(),()=>{t.disconnect(),c.current=null,s.current=[],e.removeEventListener(`scroll`,d)}},[i,d]),(0,V.useEffect)(()=>{let e=o.current,t=c.current;if(!e||!t)return;for(let e of s.current)t.unobserve(e);let n=Array.from(e.children).filter(e=>e instanceof HTMLElement);for(let e of n)t.observe(e);s.current=n,d()},[e,t,i,d]),i?!t&&r!==`done`?null:(0,H.jsxs)(`details`,{className:`personal-task-group tone-${r}`,open:!0,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(nm,{size:16}),(0,H.jsx)(`strong`,{children:n}),(0,H.jsx)(`span`,{children:t})]}),(0,H.jsx)(`div`,{className:`personal-task-list-rows`,children:e})]}):(0,H.jsxs)(`section`,{className:`personal-object-list personal-task-lane`,children:[(0,H.jsxs)(`header`,{id:a,children:[(0,H.jsxs)(`strong`,{children:[(0,H.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-${r}`}),n]}),(0,H.jsx)(`span`,{children:t})]}),(0,H.jsx)(`div`,{"aria-labelledby":a,className:`personal-task-lane-scroll${l.before?` has-overflow-before`:``}${l.after?` has-overflow-after`:``}`,ref:o,role:`region`,tabIndex:t>0?0:-1,children:e})]})}function kb({historyEnabled:e=!1,goal:t,items:n,onDraftTaskFromMessage:r,onOpenChat:i,onQuickComplete:a,quickCompletingTodoIds:o,onSelect:s,selectedTodoId:c=null,userTodos:l}){let{t:u}=qi(),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)({goalId:``,laneId:`all`}),h=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!c)return;let e=window.requestAnimationFrame(()=>h.current?.scrollIntoView({block:`nearest`,inline:`nearest`}));return()=>window.cancelAnimationFrame(e)},[c]);let g=l.filter(e=>e.goalId===t.goalId).map(e=>({...e,goalTitle:t.title})),_=e=>e.priority===`P0`?0:e.priority===`P1`?1:e.priority===`P2`?2:3,v=(0,V.useMemo)(()=>{let e=new Map((t.agentLanes??[]).map(e=>[e.agentId,e]));for(let n of t.agentTodos)n.claimedBy&&!e.has(n.claimedBy)&&e.set(n.claimedBy,{agentId:n.claimedBy,label:n.claimedBy});return[...e.values()]},[t.agentLanes,t.agentTodos]),y=p.goalId===t.goalId&&v.some(e=>e.agentId===p.laneId)?p.laneId:`all`,b=e=>y===`all`||e===y,x=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&!e.done).filter(e=>b(e.claimedBy)).sort((e,t)=>_(e)-_(t)),S=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&e.done).filter(e=>b(e.claimedBy)),C=n.filter(e=>e.kind===`schedule`&&b(e.schedule.agentId)),w=n.filter(e=>e.kind===`run`&&!!e.run.todoId&&b(e.run.agentId)),T=!g.length&&!x.length&&!S.length&&!C.length,E=n.filter(e=>e.kind===`message`&&(e.message.role===`user`||e.message.role===`assistant`)),D=E.reduce((e,t,n)=>t.message.role===`user`?n:e,-1),O=D>=0?E[D]?.message:null,k=D>=0?E.slice(D+1).reverse().find(e=>e.message.role===`assistant`)?.message:null,ee=D>=0&&E.slice(D+1).some(e=>e.message.role===`assistant`&&e.message.pending);return(0,H.jsxs)(`section`,{"aria-label":u(`header.tasks`),className:`personal-task-board${d?` is-list-view`:``}`,children:[(0,H.jsxs)(`header`,{className:`personal-task-view-toolbar`,children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(`strong`,{children:u(`header.tasks`)})}),(0,H.jsxs)(`div`,{className:`personal-task-view-switch`,role:`group`,"aria-label":u(`tasks.viewLabel`),children:[(0,H.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(!0),children:u(`tasks.listView`)}),(0,H.jsx)(`button`,{type:`button`,"aria-pressed":!d,onClick:()=>f(!1),children:u(`tasks.boardView`)})]})]}),v.length>1?(0,H.jsxs)(`section`,{"aria-label":u(`tasks.agentLaneFilter`),className:`personal-task-lane-filter`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Qp,{size:15}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:u(`tasks.agentLane`)})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`sr-only`,children:u(`tasks.agentLaneFilter`)}),(0,H.jsxs)(`select`,{"aria-label":u(`tasks.agentLaneFilter`),onChange:e=>m({goalId:t.goalId,laneId:e.target.value}),value:y,children:[(0,H.jsx)(`option`,{value:`all`,children:u(`tasks.allAgentLanes`,{count:v.length})}),v.map(e=>(0,H.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))]}),(0,H.jsx)(nm,{"aria-hidden":!0,size:14})]})]}):null,O?(0,H.jsxs)(`section`,{"aria-label":u(`tasks.chatRecent`),className:`personal-task-chat-receipt`,children:[(0,H.jsx)(`span`,{className:`personal-task-chat-icon`,children:(0,H.jsx)(Om,{size:18})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:u(ee?`tasks.chatPending`:k?`tasks.chatAgentReplied`:`tasks.chatRecent`)}),(0,H.jsx)(`small`,{children:t.agentLabel??t.agentId})]}),(0,H.jsxs)(`p`,{className:`is-user`,children:[(0,H.jsx)(`b`,{children:u(`common.you`)}),O.text]}),k&&!k.pending?(0,H.jsxs)(`p`,{className:`is-assistant`,children:[(0,H.jsx)(`b`,{children:u(`common.agent`)}),k.text]}):null,(0,H.jsx)(`small`,{children:u(ee?`tasks.chatPendingDescription`:`tasks.chatUnchangedDescription`)})]}),(0,H.jsxs)(`footer`,{children:[(0,H.jsxs)(`button`,{onClick:i,type:`button`,children:[(0,H.jsx)(Om,{size:14}),u(`tasks.chatViewReply`)]}),k&&!ee&&r?(0,H.jsxs)(`button`,{onClick:()=>r(k.text),type:`button`,children:[(0,H.jsx)(Cm,{size:14}),u(`tasks.convertToTask`)]}):null]})]}):null,(0,H.jsxs)(`div`,{className:d?`personal-task-grouped-list`:`personal-task-kanban`,children:[(0,H.jsxs)(Ob,{listView:d,count:g.length,label:u(`timeline.waitingConfirmation`),tone:`attention`,children:[g.map(e=>{let t=Xi(e.updatedAt,u);return(0,H.jsxs)(`button`,{onClick:()=>s({item:e,kind:`attention`}),type:`button`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`is-attention`,children:`!`}),(0,H.jsx)(`strong`,{children:e.text}),(0,H.jsxs)(`small`,{children:[(0,H.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?u(`tasks.blocked`):u(`tasks.pending`)}),t?(0,H.jsx)(`span`,{className:`personal-task-age`,children:u(`tasks.waitingAge`,{age:t})}):null]})]},e.todoId)}),g.length?null:(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyConfirm`)})]}),(0,H.jsxs)(Ob,{listView:d,count:x.length,label:u(`tasks.pendingAndRunning`),tone:`progress`,children:[x.map(e=>{let n={...e,goalId:t.goalId,goalTitle:t.title,ownerLabel:e.claimedBy??t.agentLabel??t.agentId},r=w.find(t=>t.run.todoId===e.todoId)?.run;return(0,H.jsxs)(`div`,{className:`personal-task-card${r?` has-session`:``}${c===e.todoId?` is-selected`:``}`,ref:c===e.todoId?e=>{h.current=e}:void 0,children:[(0,H.jsxs)(`button`,{"aria-pressed":c===e.todoId,onClick:()=>s({item:n,kind:`todo`}),type:`button`,children:[(0,H.jsx)(`span`,{children:`○`}),(0,H.jsx)(`strong`,{children:e.text}),(0,H.jsxs)(`small`,{children:[e.priority?(0,H.jsx)(`span`,{className:`personal-priority-badge is-${e.priority.toLowerCase()}`,children:e.priority}):null,e.status===`blocked`?(0,H.jsx)(`span`,{className:`personal-priority-badge is-blocked`,children:u(`tasks.blocked`)}):null,r?(0,H.jsx)(`span`,{className:`personal-task-session-status`,children:r.status===`running`||r.status===`queued`?u(`runs.running`):r.status===`failed`?u(`tasks.sessionError`):u(`common.waiting`)}):null,e.status===`deferred`?(0,H.jsx)(`span`,{className:`personal-task-session-status`,children:u(`drawer.taskStatusDeferred`)}):r?null:(0,H.jsx)(`span`,{className:`personal-task-session-status`,children:u(`tasks.waiting`)}),e.claimedBy??t.agentLabel??t.agentId]})]}),(0,H.jsxs)(`div`,{className:`personal-task-card-actions`,children:[r?(0,H.jsxs)(`button`,{className:`personal-task-session-link`,"aria-label":u(`tasks.openExecution`,{name:e.text}),onClick:()=>s({item:r,kind:`run`}),title:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`),type:`button`,children:[(0,H.jsx)(pm,{size:14}),(0,H.jsx)(`span`,{children:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`)})]}):null,a?(0,H.jsx)(`button`,{"aria-busy":o?.has(e.todoId)||void 0,"aria-label":u(`tasks.markComplete`,{name:e.text}),disabled:o?.has(e.todoId),onClick:()=>void a(n),title:u(`tasks.completed`),type:`button`,children:o?.has(e.todoId)?(0,H.jsx)(wm,{className:`personal-spin`,size:14}):(0,H.jsx)(tm,{size:14})}):null,(0,H.jsx)(`button`,{"aria-label":u(`tasks.moreActions`,{name:e.text}),onClick:()=>s({item:n,kind:`todo`}),title:u(`common.actions`),type:`button`,children:(0,H.jsx)(fm,{size:14})})]})]},e.todoId)}),x.length?null:(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyRunning`)})]}),(0,H.jsxs)(Ob,{listView:d,count:C.length,label:u(`tasks.scheduled`),tone:`schedule`,children:[C.map(e=>(0,H.jsxs)(`button`,{onClick:()=>s({item:e.schedule,kind:`schedule`}),type:`button`,children:[(0,H.jsx)(`span`,{children:`◷`}),(0,H.jsx)(`strong`,{children:e.schedule.label}),(0,H.jsx)(`small`,{children:e.schedule.status===`paused`?u(`schedule.paused`):u(`schedule.active`)})]},e.id)),C.length?null:(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptySchedules`)})]}),(0,H.jsx)(Db,{goal:t,agentId:y,seed:S,enabled:e,listView:d,onSelect:s},`${t.goalId}:${y}:${e}`)]}),T?(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyGoal`)}):null]})}function Ab(e,t){return{live_steering:{label:t(`lark.ingressSteering`),detail:t(`lark.ingressSteeringDescription`)},session_queue:{label:t(`lark.ingressQueue`),detail:t(`lark.ingressQueueDescription`)},async_inbox:{label:t(`lark.ingressAsync`),detail:t(`lark.ingressAsyncDescription`)},direct_session:{label:t(`lark.ingressLegacy`),detail:t(`lark.ingressLegacyDescription`)}}[e]}function jb(e,t){return e.listener_status===`starting`?{label:t(`lark.health.starting`),detail:t(`lark.health.startingDetail`),state:`not_ready`}:e.listener_status===`retrying`&&e.listener_error_code===`lark_event_source_disconnected`?{label:t(`lark.health.sourceDisconnected`),detail:t(`lark.health.sourceDisconnectedDetail`),state:`not_ready`}:e.listener_status===`retrying`?{label:t(`lark.health.retrying`),detail:t(`lark.health.retryingDetail`),state:`not_ready`}:e.listener_status===`stopped`||e.listener_status===null?{label:t(`lark.health.notStarted`),detail:t(`lark.health.notStartedDetail`),state:`not_ready`}:e.last_event_status===`message_context_permission_required`?{label:t(`lark.health.messageContextPermission`),detail:t(`lark.health.messageContextPermissionDetail`),state:`not_ready`}:e.last_event_status===`processing_failed`?{label:t(`lark.health.processingFailed`),detail:t(`lark.health.processingFailedDetail`),state:`not_ready`}:e.health_error_code===`invalid_routing_state`?{label:t(`lark.health.invalidRouting`),detail:t(`lark.health.invalidRoutingDetail`),state:`not_ready`}:e.last_event_status===`queued_for_agent`?{label:t(`lark.health.queued`),detail:t(`lark.health.queuedDetail`,{agent:e.agent_id??t(`lark.targetAgent`)}),state:`ready`}:e.last_event_status===`ignored`&&e.last_event_reason===`not_addressed`?{label:t(`lark.health.notAddressed`),detail:t(`lark.health.notAddressedDetail`),state:`ready`}:e.last_event_status===`ignored`&&e.last_event_reason===`self_message`?{label:t(`lark.health.listening`),detail:t(`lark.health.ignoredSelf`),state:`ready`}:e.health_error_code===`lark_event_route_mismatch`||[`chat_mismatch`,`topic_mismatch`,`route_ambiguous`].includes(e.last_event_reason??``)?{label:e.last_event_reason===`route_ambiguous`?t(`lark.health.routeAmbiguous`):t(`lark.health.routeMismatch`),detail:e.last_event_reason===`route_ambiguous`?t(`lark.health.routeAmbiguousDetail`):t(`lark.health.routeMismatchDetail`),state:`not_ready`}:[`invalid_event`,`binding_unavailable`].includes(e.last_event_reason??``)?{label:t(`lark.health.routeUnavailable`),detail:t(`lark.health.routeUnavailableDetail`),state:`not_ready`}:e.last_event_status===`replied_and_acknowledged`?{label:t(`lark.health.listening`),detail:t(`lark.health.eventProcessed`,{events:e.event_count,replies:e.replied_count}),state:`ready`}:e.health_error_code===`lark_event_delivery_unverified`||e.event_count===0?{label:t(`lark.health.eventUnverified`),detail:t(`lark.health.eventUnverifiedDetail`),state:`unverified`}:{label:e.reply_ready?t(`lark.health.listening`):t(`lark.health.unavailable`),detail:t(`lark.health.lastStatus`,{status:e.last_event_status??t(`lark.health.waiting`)}),state:e.reply_ready?`ready`:`not_ready`}}function Mb(e){return e.history_permission_guidance?.api_document_url??null}function Nb(e,t,n){if(e instanceof Eh){let t=String(e.payload.error_code??``);return{lark_cli_not_installed:n(`lark.error.cliMissing`),lark_cli_not_executable:n(`lark.error.cliExecutable`),lark_cli_start_failed:n(`lark.error.cliStart`),lark_message_permissions_required:n(`lark.error.messagePermissions`),lark_app_required:n(`lark.error.appRequired`),invalid_lark_app:n(`lark.error.invalidApp`),lark_group_lookup_failed:n(`lark.error.groupLookup`),provider_api_failed:n(`lark.error.provider`)}[t]??e.message}return e instanceof Error?e.message:t}function Pb({embedded:e=!1,focusGoalConnection:t=!1,goals:n,initialGoalId:r,onChanged:i,onClose:a}){let{t:o}=qi(),[s,c]=(0,V.useState)(`connections`),[l,u]=(0,V.useState)([]),[d,f]=(0,V.useState)([]),[p,m]=(0,V.useState)(!0),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(``),[y,b]=(0,V.useState)(t),[x,S]=(0,V.useState)(``),[C,w]=(0,V.useState)(r??n[0]?.goalId??``),[T,E]=(0,V.useState)(``),[D,O]=(0,V.useState)([]),[k,ee]=(0,V.useState)(``),[te,A]=(0,V.useState)(!1),[j,M]=(0,V.useState)(null),[N,P]=(0,V.useState)(`addressed_only`),[F,ne]=(0,V.useState)(t&&r?`goal`:`manager`),[re,I]=(0,V.useState)(`async_inbox`),[L,ie]=(0,V.useState)(`topic_reply`),[R,ae]=(0,V.useState)(``),[oe,se]=(0,V.useState)(!1),[ce,le]=(0,V.useState)({}),[ue,z]=(0,V.useState)(!1),[de,fe]=(0,V.useState)(null),[pe,me]=(0,V.useState)(null),[he,ge]=(0,V.useState)(null),[_e,ve]=(0,V.useState)(null),[ye,be]=(0,V.useState)(!1),[xe,Se]=(0,V.useState)(`loopx-workspace-bot`),[Ce,we]=(0,V.useState)(`feishu`),[Te,B]=(0,V.useState)(null),[Ee,De]=(0,V.useState)(!1),[Oe,ke]=(0,V.useState)(null),Ae=(0,V.useRef)(null),je=(0,V.useRef)(null),Me=(0,V.useRef)(!1);async function Ne(){m(!0),g(null);try{let[e,t]=await Promise.all([zg(),Jg()]);u(e),f(t),S(t=>t||e.find(e=>e.reply_ready)?.app_ref||e.find(e=>e.ready)?.app_ref||e[0]?.app_ref||``)}catch(e){g(Nb(e,o(`lark.error.configuration`),o))}finally{m(!1)}}(0,V.useEffect)(()=>{Ne()},[]),(0,V.useEffect)(()=>{if(!t||p||Me.current||!r)return;Me.current=!0;let e=d.find(e=>e.goal_id===r);e?qe(e):Ke(n.find(e=>e.goalId===r))},[d,t,n,r,p]),(0,V.useEffect)(()=>{if(!y||!x||he){O([]),ee(``),A(!1),M(null);return}let e=!1;A(!0),M(null);let t=window.setTimeout(()=>{Kg(x,T).then(t=>{e||(O(t),ee(e=>t.some(t=>t.chat_id===e)?e:t[0]?.chat_id??``))}).catch(t=>{e||(O([]),ee(``),M(Nb(t,o(`lark.error.groupLoad`),o)))}).finally(()=>{e||A(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[x,T,y,he]),(0,V.useEffect)(()=>{if(!ye||!Te||[`ready`,`failed`,`cancelled`].includes(Te.status))return;let e=!1,t=window.setTimeout(()=>{Hg(Te.setup_id).then(async t=>{e||(B(t),t.verification_url&&je.current!==t.verification_url&&(je.current=t.verification_url,Ae.current&&!Ae.current.closed&&(Ae.current.location.href=t.verification_url)),t.status===`ready`&&(await Ne(),S(t.app_ref),le({}),be(!1)),t.status===`failed`&&ke(t.error??o(`lark.error.appCreate`)))}).catch(t=>{e||ke(Nb(t,o(`lark.error.setupPoll`),o))})},650);return()=>{e=!0,window.clearTimeout(t)}},[ye,Te]);let Pe=n.find(e=>e.goalId===C),Fe=Pe?.agentId?[{agentId:Pe.agentId,label:Pe.agentLabel??Pe.agentId}]:[],Ie=Pe?.agentLanes?.length?Pe.agentLanes:Fe,Le=Ie.some(e=>e.agentId===R),Re=[];oe?Re=Ie.map(e=>({agentId:e.agentId,appRef:ce[e.agentId]??x})):Le&&(Re=[{agentId:R,appRef:x}]);let ze=Re.map(e=>e.agentId),Be=!!he||Re.length>0&&Re.every(e=>l.some(t=>t.app_ref===e.appRef&&t.reply_ready)),Ve=o(`lark.connect`);pe?Ve=o(`lark.saveConnection`):oe&&(Ve=o(`lark.connectAllAgentsAction`,{count:ze.length}));let He=l.find(e=>e.app_ref===x),Ue=D.find(e=>e.chat_id===k),We=(0,V.useMemo)(()=>{let e=_.trim().toLocaleLowerCase();return e?d.filter(t=>[t.app_label,t.chat_name,t.goal_title,t.topic_name].some(t=>t.toLocaleLowerCase().includes(e))):d},[d,_]),Ge=(0,V.useMemo)(()=>d.filter(e=>jb(e,o).state===`unverified`).length,[d,o]);function Ke(e){let i=e??n.find(e=>e.goalId===r)??n[0];me(null),ge(null),ne(e||t?`goal`:`manager`),S(l.some(e=>e.app_ref===x)?x:l.find(e=>e.reply_ready)?.app_ref??l[0]?.app_ref??``),ee(``),w(i?.goalId??``),ae(i?.agentId??``),se(!1),le({}),P(`addressed_only`),I(`async_inbox`),ie(`topic_reply`),E(``),fe(null),b(!0)}function qe(e){me(e.goal_id),ge(e),ne(e.conversation_kind??`goal`),S(e.app_ref),w(e.goal_id);let t=n.find(t=>t.goalId===e.goal_id),r=t?.agentLanes?.length?t.agentLanes:t?.agentId?[{agentId:t.agentId}]:[];ae(e.agent_id??(r.length===1?r[0].agentId:``)),se(!1),le({}),P(e.capture_scope),I(e.ingress_mode===`direct_session`?`async_inbox`:e.ingress_mode),ie(e.reply_mode),E(e.chat_name),fe(null),b(!0)}function Je(){B(null),ke(null),je.current=null,be(!0)}async function Ye(){if(!(Ee||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(xe))){De(!0),ke(null),je.current=null,Ae.current=window.open(window.location.href,`_blank`);try{let e=await Vg({appRef:xe,brand:Ce});B(e)}catch(e){Ae.current?.close(),ke(Nb(e,o(`lark.error.setupStart`),o))}finally{De(!1)}}}async function Xe(){let e=Te;if(be(!1),Ae.current?.close(),e&&![`ready`,`failed`,`cancelled`].includes(e.status))try{await Ug(e.setup_id)}catch{}}async function Ze(){if(!(!x||!C||!he&&!Ue||F===`goal`&&ze.length===0||ue)){z(!0),fe(null);try{let e={...F===`manager`?{...he?{connectionId:he.connection_id}:{appRef:x,chatId:Ue.chat_id,chatName:Ue.chat_name}}:he?{connectionId:he.connection_id,agentId:R}:{agentBindings:Re,chatId:Ue.chat_id,chatName:Ue.chat_name},conversationKind:F,captureScope:F===`manager`?`addressed_only`:N,goalId:C,incomingMode:N===`configured_chat_all`?`all`:`mentions`,ingressMode:F===`manager`?`session_queue`:re,replyMode:L},t=await Yg({...e,execute:!1});if(!t.ok)throw new Eh(t.public_summary??t.blocker??o(`lark.error.bindPreview`),{error_code:t.blocker??`provider_api_failed`});let n=await Yg({...e,execute:!0});if(!n.ok)throw new Eh(n.public_summary??n.blocker??o(`lark.error.bind`),{error_code:n.blocker??`provider_api_failed`});b(!1),await Ne(),i?.()}catch(e){fe(Nb(e,o(`lark.error.bind`),o))}finally{z(!1)}}}async function Qe(e,t){if(_e!==t){ve(t);return}try{await Xg(e,t),ve(null),await Ne(),i?.()}catch(e){g(Nb(e,o(`lark.error.disconnect`),o))}}return(0,H.jsxs)(`section`,{className:`personal-lark-settings${e?` is-embedded`:``}`,"aria-label":o(`lark.configuration`),children:[e?null:(0,H.jsxs)(`header`,{className:`personal-lark-header`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:o(`settings.goalConnections`)}),(0,H.jsx)(`h1`,{children:`Lark`})]}),(0,H.jsx)(`button`,{"aria-label":o(`lark.closeSettings`),className:`personal-icon-button`,onClick:a,type:`button`,children:(0,H.jsx)(eh,{size:18})})]}),(0,H.jsxs)(`nav`,{className:`personal-lark-tabs`,"aria-label":o(`lark.management`),children:[(0,H.jsxs)(`button`,{"aria-current":s===`apps`?`page`:void 0,onClick:()=>c(`apps`),type:`button`,children:[o(`lark.apps`),` `,(0,H.jsx)(`span`,{children:p?`…`:l.length})]}),(0,H.jsxs)(`button`,{"aria-current":s===`connections`?`page`:void 0,onClick:()=>c(`connections`),type:`button`,children:[o(`lark.connections`),` `,(0,H.jsx)(`span`,{children:p?`…`:d.length})]})]}),h?(0,H.jsx)(`p`,{className:`personal-notification-error`,children:h}):null,p?(0,H.jsxs)(`div`,{className:`personal-lark-loading`,children:[(0,H.jsx)(wm,{className:`is-spinning`,size:18}),o(`lark.loading`)]}):null,!p&&s===`apps`?(0,H.jsxs)(`div`,{className:`personal-lark-apps`,children:[(0,H.jsxs)(`div`,{className:`personal-lark-app-toolbar`,children:[(0,H.jsx)(`span`,{children:o(`lark.reusableApps`,{count:l.length})}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:Je,type:`button`,children:[(0,H.jsx)(Fm,{size:16}),o(`lark.newApp`)]})]}),(0,H.jsxs)(`div`,{className:`personal-lark-app-grid`,children:[l.map(e=>(0,H.jsxs)(`article`,{className:`personal-lark-app-card`,children:[(0,H.jsx)(`span`,{className:`personal-lark-app-avatar`,children:(0,H.jsx)(Qp,{size:19})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsxs)(`small`,{children:[e.brand,` · lark-cli profile`]})]}),(0,H.jsx)(`em`,{className:e.reply_ready?`is-ready`:`is-off`,children:e.reply_ready?o(`lark.autoReplyReady`):e.ready?o(`lark.needsMessagePermissions`):o(`lark.needsSetup`)}),(0,H.jsxs)(`p`,{children:[o(`lark.goalConnections`,{count:d.filter(t=>t.app_ref===e.app_ref).length}),e.ready&&!e.reply_ready?` · ${o(`lark.autoReplyUnavailable`)}`:``]})]},e.app_ref)),l.length===0?(0,H.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noProfiles`)}):null]})]}):null,!p&&s===`connections`?(0,H.jsxs)(`div`,{className:`personal-lark-connections`,children:[Ge>0?(0,H.jsxs)(`p`,{className:`personal-lark-route-readiness`,role:`status`,children:[(0,H.jsx)(Om,{size:15}),o(`lark.routesUnverified`,{count:Ge})]}):null,(0,H.jsxs)(`div`,{className:`personal-lark-toolbar`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(Bm,{size:16}),(0,H.jsx)(`input`,{"aria-label":o(`lark.searchConnections`),onChange:e=>v(e.target.value),placeholder:o(`lark.searchPlaceholder`),type:`search`,value:_})]}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:l.length===0||n.length===0,onClick:()=>Ke(),type:`button`,children:[(0,H.jsx)(Fm,{size:16}),o(`lark.connectApp`)]})]}),(0,H.jsxs)(`div`,{className:`personal-lark-table`,role:`table`,"aria-label":o(`lark.goalTopicConnections`),children:[(0,H.jsxs)(`div`,{className:`personal-lark-table-head`,role:`row`,children:[(0,H.jsx)(`span`,{children:o(`lark.connection`)}),(0,H.jsx)(`span`,{children:o(`common.goal`)}),(0,H.jsx)(`span`,{children:o(`lark.capture`)}),(0,H.jsx)(`span`,{children:o(`lark.processing`)}),(0,H.jsx)(`span`,{children:o(`common.actions`)})]}),We.map(e=>{let t=jb(e,o);return(0,H.jsxs)(`div`,{className:`personal-lark-table-row`,role:`row`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.chat_name}),(0,H.jsxs)(`small`,{children:[e.app_label,` · `,t.label]}),(0,H.jsx)(`small`,{children:t.detail}),t.state===`unverified`?(0,H.jsxs)(`a`,{href:`https://open.feishu.cn/document/server-docs/im-v1/message/events/receive?lang=zh-CN`,rel:`noreferrer`,target:`_blank`,children:[(0,H.jsx)(pm,{size:12}),o(`lark.openEventSettings`)]}):null,Mb(e)?(0,H.jsxs)(`a`,{href:Mb(e)??void 0,rel:`noreferrer`,target:`_blank`,children:[(0,H.jsx)(pm,{size:12}),o(`lark.historyPermission`)]}):null]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.goal_title}),(0,H.jsxs)(`small`,{children:[`# `,e.topic_name]})]}),(0,H.jsx)(`span`,{children:e.capture_scope===`addressed_only`?o(`lark.mentionsOnly`):o(`lark.allTopicMessages`)}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.conversation_kind===`manager`?o(`lark.managerConversation`):Ab(e.ingress_mode,o).label}),(0,H.jsx)(`small`,{children:e.conversation_kind===`manager`?o(`lark.managerConversationDescription`):e.agent_id??Ab(e.ingress_mode,o).detail})]}),(0,H.jsxs)(`span`,{className:`personal-lark-row-actions`,children:[(0,H.jsx)(`button`,{"aria-label":o(`lark.settingsConfigure`,{goal:e.goal_title}),onClick:()=>qe(e),type:`button`,children:(0,H.jsx)(Wm,{size:15})}),(0,H.jsxs)(`button`,{"aria-label":o(`lark.settingsDisconnect`,{goal:e.goal_title}),className:_e===e.connection_id?`is-confirm`:``,onClick:()=>void Qe(e.goal_id,e.connection_id),type:`button`,children:[(0,H.jsx)($m,{size:15}),_e===e.connection_id?o(`common.confirm`):null]})]})]},e.connection_id)}),We.length===0?(0,H.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noConnections`)}):null]})]}):null,y?(0,H.jsx)(`div`,{className:`personal-lark-modal-backdrop`,role:`presentation`,children:(0,H.jsxs)(`section`,{"aria-labelledby":`connect-lark-title`,"aria-modal":`true`,className:`personal-lark-modal`,role:`dialog`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:`Goal Topic connection`}),(0,H.jsx)(`h2`,{id:`connect-lark-title`,children:o(pe?`lark.editConnection`:`lark.connectApp`)})]}),(0,H.jsx)(`button`,{"aria-label":o(`lark.closeConnection`),onClick:()=>b(!1),type:`button`,children:(0,H.jsx)(eh,{size:18})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.conversationKind`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.conversationKind`),disabled:!!he,value:F,onChange:e=>ne(e.target.value),children:[(0,H.jsx)(`option`,{value:`manager`,children:o(`lark.managerConversation`)}),(0,H.jsx)(`option`,{value:`goal`,children:o(`lark.workerConversation`)})]})]}),F===`manager`?(0,H.jsx)(`p`,{children:o(`lark.managerConversationDescription`)}):null,he?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,H.jsx)(`div`,{children:he.app_label})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,H.jsx)(`div`,{children:he.chat_name})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,H.jsx)(`div`,{children:he.goal_title})]}),(0,H.jsx)(`small`,{children:o(`lark.editPreservesIdentity`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,H.jsx)(`select`,{"aria-label":o(`lark.appProfile`),disabled:p,onChange:e=>{e.target.value===`__register__`?Je():(S(e.target.value),le({}))},value:x,children:p?(0,H.jsx)(`option`,{value:``,children:o(`lark.appLoading`)}):(0,H.jsxs)(H.Fragment,{children:[l.map(e=>(0,H.jsxs)(`option`,{disabled:!e.ready,value:e.app_ref,children:[e.label,e.reply_ready?``:e.ready?` · ${o(`lark.needsMessagePermissions`)}`:` · ${o(`lark.needsSetup`)}`]},e.app_ref)),(0,H.jsx)(`option`,{value:`__register__`,children:o(`lark.registerAnother`)})]})}),(0,H.jsx)(`small`,{children:o(`lark.defaultAgentAppDescription`)})]}),He?.ready&&!He.reply_ready?(0,H.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.appPermissions`)}):null,(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,H.jsx)(`input`,{"aria-label":o(`lark.groupSearch`),onChange:e=>E(e.target.value),placeholder:o(`lark.groupSearch`),type:`search`,value:T}),te?(0,H.jsxs)(`div`,{className:`personal-lark-group-state`,role:`status`,children:[(0,H.jsx)(wm,{className:`is-spinning`,size:15}),o(`lark.groupLoading`)]}):null,!te&&j?(0,H.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:j}):null,!te&&!j&&D.length===0?(0,H.jsx)(`div`,{className:`personal-lark-group-state`,role:`status`,children:o(`lark.groupEmpty`)}):null,!te&&!j&&D.length>0?(0,H.jsx)(`select`,{"aria-label":o(`lark.groupChat`),onChange:e=>ee(e.target.value),value:k,children:D.map(e=>(0,H.jsx)(`option`,{value:e.chat_id,children:e.chat_name},e.chat_id))}):null]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,H.jsx)(`select`,{"aria-label":o(`lark.bindGoal`),onChange:e=>{let t=e.target.value;w(t),ae(n.find(e=>e.goalId===t)?.agentId??``),le({})},value:C,children:n.map(e=>(0,H.jsx)(`option`,{value:e.goalId,children:e.title},e.goalId))})]})]}),(0,H.jsxs)(`label`,{className:`personal-lark-check`,children:[(0,H.jsx)(`input`,{checked:!0,readOnly:!0,type:`checkbox`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:o(`lark.createAutomatically`)}),(0,H.jsx)(`small`,{children:o(`lark.createAutomaticallyDescription`)})]})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.topicPreview`)}),(0,H.jsxs)(`div`,{className:`personal-lark-topic-preview`,children:[(0,H.jsx)(Om,{size:15}),`# `,Pe?.title??Pe?.goalId??`Goal`]})]}),F===`goal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.captureScope`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.captureScope`),disabled:he?.ingress_mode===`direct_session`,onChange:e=>P(e.target.value),value:N,children:[(0,H.jsx)(`option`,{value:`addressed_only`,children:o(`lark.captureAddressed`)}),(0,H.jsx)(`option`,{value:`configured_chat_all`,children:o(`lark.captureAll`)})]}),(0,H.jsx)(`small`,{children:o(`lark.captureScopeDescription`)})]}),(0,H.jsxs)(`fieldset`,{"aria-label":o(`lark.agentIngress`),className:`personal-lark-ingress`,children:[(0,H.jsx)(`legend`,{children:o(`lark.agentIngress`)}),(0,H.jsx)(`div`,{children:[`live_steering`,`session_queue`,`async_inbox`].map(e=>{let t=Ab(e,o);return(0,H.jsxs)(`label`,{className:re===e?`is-active`:``,children:[(0,H.jsx)(`input`,{"aria-label":t.label,checked:re===e,name:`lark-agent-ingress`,onChange:()=>I(e),type:`radio`,value:e}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:t.label}),(0,H.jsx)(`small`,{children:t.detail})]})]},e)})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.targetAgent`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.targetAgent`),disabled:!!he?.agent_id,onChange:e=>ae(e.target.value),value:R,children:[Le?null:(0,H.jsx)(`option`,{disabled:!0,value:R,children:R?o(`lark.agentUnavailable`,{agent:R}):o(`lark.noAgentConfigured`)}),Ie.map(e=>(0,H.jsx)(`option`,{value:e.agentId,children:e.label===e.agentId?e.agentId:`${e.label} · ${e.agentId}`},e.agentId))]}),(0,H.jsx)(`small`,{children:o(`lark.targetAgentDescription`)})]}),!pe&&Ie.length>1?(0,H.jsxs)(`label`,{"aria-label":o(`lark.connectAllAgents`),className:`personal-lark-check`,children:[(0,H.jsx)(`input`,{checked:oe,onChange:e=>se(e.target.checked),type:`checkbox`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:o(`lark.connectAllAgents`)}),(0,H.jsx)(`small`,{children:o(`lark.connectAllAgentsDescription`,{count:Ie.length})})]})]}):null,!pe&&oe&&Ie.length>1?(0,H.jsxs)(`fieldset`,{"aria-label":o(`lark.agentApps`),className:`personal-lark-agent-apps`,children:[(0,H.jsx)(`legend`,{children:o(`lark.agentApps`)}),(0,H.jsx)(`small`,{children:o(`lark.agentAppsDescription`)}),(0,H.jsx)(`div`,{children:Ie.map(e=>(0,H.jsxs)(`label`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsx)(`small`,{children:e.agentId})]}),(0,H.jsx)(`select`,{"aria-label":o(`lark.agentAppSelection`,{agent:e.label}),onChange:t=>le(n=>({...n,[e.agentId]:t.target.value})),value:ce[e.agentId]??x,children:l.map(e=>(0,H.jsxs)(`option`,{disabled:!e.ready,value:e.app_ref,children:[e.label,e.reply_ready?``:e.ready?` · ${o(`lark.needsMessagePermissions`)}`:` · ${o(`lark.needsSetup`)}`]},e.app_ref))})]},e.agentId))})]}):null,oe&&Re.length>0&&!Be?(0,H.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.agentAppPermissions`)}):null,ze.length===0?(0,H.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:o(`lark.selectRegisteredAgent`)}):null]}):null,(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.replyMode`)}),(0,H.jsx)(`select`,{"aria-label":o(`lark.replyMode`),onChange:e=>ie(e.target.value),value:L,children:(0,H.jsx)(`option`,{value:`topic_reply`,children:o(`lark.topicReply`)})}),(0,H.jsx)(`small`,{children:o(`lark.replyModeDescription`)})]}),(0,H.jsxs)(`p`,{className:`personal-lark-cardinality`,children:[(0,H.jsx)(tm,{size:15}),o(`lark.cardinality`)]}),de?(0,H.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:de}):null,(0,H.jsxs)(`footer`,{children:[(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>b(!1),type:`button`,children:o(`lark.cancel`)}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:p||!x||!he&&(!He?.reply_ready||!k)||F===`goal`&&(!Be||ze.length===0)||!C||ue,onClick:()=>void Ze(),type:`button`,children:[ue?(0,H.jsx)(wm,{className:`is-spinning`,size:15}):null,Ve]})]})]})}):null,ye?(0,H.jsx)(`div`,{className:`personal-lark-modal-backdrop is-setup`,role:`presentation`,children:(0,H.jsxs)(`section`,{"aria-labelledby":`new-lark-app-title`,"aria-modal":`true`,className:`personal-lark-modal personal-lark-setup-modal`,role:`dialog`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:o(`lark.reusableWorkspaceApp`)}),(0,H.jsx)(`h2`,{id:`new-lark-app-title`,children:o(`lark.newApp`)})]}),(0,H.jsx)(`button`,{"aria-label":o(`lark.closeCreate`),onClick:()=>void Xe(),type:`button`,children:(0,H.jsx)(eh,{size:18})})]}),Te?(0,H.jsxs)(`div`,{className:`personal-lark-setup-progress`,children:[(0,H.jsx)(`span`,{className:`personal-lark-setup-icon is-${Te.status}`,children:Te.status===`ready`?(0,H.jsx)(tm,{size:22}):(0,H.jsx)(wm,{className:Te.status===`failed`?``:`is-spinning`,size:22})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:Te.status===`ready`?o(`lark.appCreated`):Te.status===`failed`?o(`lark.appCreateFailed`):o(`lark.waitingFeishu`)}),(0,H.jsx)(`p`,{children:Te.status===`waiting_for_feishu`?o(`lark.waitingFeishuDescription`):Te.status===`starting`?o(`lark.waitingLink`):Te.error})]}),Te.verification_url?(0,H.jsxs)(`a`,{href:Te.verification_url,rel:`noreferrer`,target:`_blank`,children:[(0,H.jsx)(pm,{size:15}),o(`lark.reopenFeishu`)]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`personal-lark-setup-copy`,children:o(`lark.setupCopy`)}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.profileName`)}),(0,H.jsx)(`input`,{"aria-label":o(`lark.profileName`),autoComplete:`off`,onChange:e=>Se(e.target.value),placeholder:`loopx-workspace-bot`,value:xe})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.region`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.region`),onChange:e=>we(e.target.value),value:Ce,children:[(0,H.jsx)(`option`,{value:`feishu`,children:`Feishu`}),(0,H.jsx)(`option`,{value:`lark`,children:`Lark`})]})]}),xe&&!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(xe)?(0,H.jsx)(`p`,{className:`personal-notification-error`,children:o(`lark.profileValidation`)}):null]}),Oe?(0,H.jsx)(`p`,{className:`personal-notification-error`,children:Oe}):null,(0,H.jsxs)(`footer`,{children:[(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void Xe(),type:`button`,children:o(`lark.cancel`)}),Te?null:(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:Ee||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(xe),onClick:()=>void Ye(),type:`button`,children:[Ee?(0,H.jsx)(wm,{className:`is-spinning`,size:15}):(0,H.jsx)(pm,{size:15}),o(`lark.continueFeishu`)]})]})]})}):null]})}function Fb(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Ib(e,t,n){let r=Fb(t),i=Fb(n);return Object.fromEntries(e.fields.flatMap(({key:e,nullable:t})=>{let n=r[e],a=i[e];return Object.hasOwn(r,e)&&(n!=null||t&&n===null)?[[e,n]]:Object.hasOwn(i,e)&&a!=null?[[e,a]]:[]}))}function Lb(e,t){let n;try{n=JSON.parse(t)}catch{return null}if(!n||typeof n!=`object`||Array.isArray(n))return null;let r=new Set(e.fields.map(e=>e.key));return Object.keys(n).some(e=>!r.has(e))?null:n}function Rb(e,t,n){let r={...e,[t]:n},i=e.schedule;return t===`timezone`&&i&&typeof i==`object`&&`schema_version`in i&&i.schema_version===`periodic_report_schedule_v0`&&(r.schedule={...i,timezone:n}),r}function zb({id:e,value:t,timezone:n,onChange:r}){let{locale:i}=qi(),a=i===`zh-CN`,o=t&&typeof t==`object`&&!Array.isArray(t)?t:null,s=String(o?.rrule??``).split(`;`).map(e=>e.split(`=`)),c=Object.fromEntries(s.filter(e=>e.length===2)),l=[`MO`,`TU`,`WE`,`TH`,`FR`,`SA`,`SU`],u=(e,t)=>e!==void 0&&/^\d+$/.test(e)&&Number(e)<=t,d=!o||o.schema_version===`periodic_report_schedule_v0`&&[`DAILY`,`WEEKLY`].includes(c.FREQ)&&o.timezone===n&&s.every(e=>e.length===2&&[`FREQ`,`BYDAY`,`BYHOUR`,`BYMINUTE`,`INTERVAL`].includes(e[0]))&&new Set(s.map(([e])=>e)).size===s.length&&u(c.BYHOUR,23)&&u(c.BYMINUTE??`0`,59)&&(c.FREQ===`WEEKLY`?l.includes(c.BYDAY):!c.BYDAY)&&(!c.INTERVAL||c.INTERVAL===`1`),f=a?[`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`,`星期日`]:[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`];function p(e){let t={FREQ:`WEEKLY`,BYDAY:`MO`,BYHOUR:`9`,BYMINUTE:`0`,...c,...e};r?.({schema_version:`periodic_report_schedule_v0`,schedule_id:o?.schedule_id??`report-schedule`,timezone:n,rrule:[`FREQ=${t.FREQ}`,...t.FREQ===`WEEKLY`?[`BYDAY=${t.BYDAY}`]:[],`BYHOUR=${t.BYHOUR}`,`BYMINUTE=${t.BYMINUTE}`].join(`;`)})}return(0,H.jsxs)(`div`,{className:`personal-report-schedule`,children:[(0,H.jsxs)(`label`,{className:`is-boolean`,htmlFor:e,children:[(0,H.jsx)(`span`,{children:a?`按日历汇报`:`Calendar reports`}),(0,H.jsx)(`input`,{id:e,type:`checkbox`,role:`switch`,checked:!!o,disabled:!r,onChange:e=>e.target.checked?p({}):r?.(null)})]}),o?(0,H.jsxs)(H.Fragment,{children:[d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{htmlFor:`${e}-frequency`,children:[(0,H.jsx)(`span`,{children:a?`频率`:`Frequency`}),(0,H.jsxs)(`select`,{id:`${e}-frequency`,value:c.FREQ,disabled:!r,onChange:e=>p({FREQ:e.target.value}),children:[(0,H.jsx)(`option`,{value:`DAILY`,children:a?`每天`:`Daily`}),(0,H.jsx)(`option`,{value:`WEEKLY`,children:a?`每周`:`Weekly`})]})]}),c.FREQ===`WEEKLY`&&(0,H.jsxs)(`label`,{htmlFor:`${e}-day`,children:[(0,H.jsx)(`span`,{children:a?`星期`:`Weekday`}),(0,H.jsx)(`select`,{id:`${e}-day`,value:c.BYDAY,disabled:!r,onChange:e=>p({BYDAY:e.target.value}),children:l.map((e,t)=>(0,H.jsx)(`option`,{value:e,children:f[t]},e))})]}),(0,H.jsxs)(`label`,{htmlFor:`${e}-time`,children:[(0,H.jsxs)(`span`,{children:[a?`当地时间`:`Local time`,` (`,n,`)`]}),(0,H.jsx)(`input`,{id:`${e}-time`,type:`time`,required:!0,disabled:!r,value:`${(c.BYHOUR??`9`).padStart(2,`0`)}:${(c.BYMINUTE??`0`).padStart(2,`0`)}`,onChange:e=>{if(!/^\d{2}:\d{2}$/.test(e.target.value))return;let[t,n]=e.target.value.split(`:`);p({BYHOUR:t,BYMINUTE:n})}})]})]}):(0,H.jsx)(`p`,{role:`alert`,children:a?`此计划需在 JSON 模式中编辑;当前内容已保留。`:`Edit this schedule in JSON mode; its current value is preserved.`}),(0,H.jsx)(`p`,{children:a?`由现有唤醒检查到期计划;实际送达以回执为准。`:`Existing wakes check the schedule; delivery is confirmed by its receipt.`})]}):(0,H.jsx)(`p`,{children:a?`未设置日历计划;保持阶段结束时汇报。`:`No calendar schedule; report at validated stage boundaries.`})]})}function Bb({copy:e,field:t,id:n,onChange:r,value:i,timezone:a}){let o=e[t.key]?.label??t.label,s=!r;if(t.input_kind===`periodic_report_schedule`)return(0,H.jsx)(zb,{id:n,value:i,timezone:a,onChange:r?e=>r(t.key,e):void 0});if(t.input_kind===`boolean`)return(0,H.jsxs)(`label`,{className:`is-boolean`,htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsx)(`input`,{checked:i===!0,id:n,onChange:r?e=>r(t.key,e.target.checked):void 0,readOnly:s,role:`switch`,type:`checkbox`})]});if(t.input_kind===`select`)return(0,H.jsxs)(`label`,{htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsxs)(`select`,{id:n,onChange:r?e=>r(t.key,e.target.value):void 0,value:typeof i==`string`?i:``,children:[(0,H.jsx)(`option`,{value:``}),(t.options??[]).map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]})]});if(t.input_kind===`string_list`)return(0,H.jsxs)(`label`,{htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsx)(`textarea`,{id:n,onChange:r?e=>r(t.key,e.target.value.split(/\r?\n/u).filter(Boolean)):void 0,readOnly:s,rows:4,value:Array.isArray(i)?i.join(` -`):``})]});let c=t.input_kind===`number`;return(0,H.jsxs)(`label`,{htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsx)(`input`,{id:n,max:t.maximum,min:t.minimum,onChange:r?e=>r(t.key,c?Number(e.target.value):e.target.value):void 0,readOnly:s,required:t.required,type:c?`number`:`text`,value:typeof i==`number`||typeof i==`string`?i:``})]})}function Vb({copy:e={},disabled:t=!1,editor:n,enabledAction:r,omitKeys:i=[],onChange:a,value:o}){let s=(0,V.useId)(),c=new Set(i);return(0,H.jsx)(`fieldset`,{className:`personal-capability-fields`,disabled:t,children:n.fields.filter(e=>!c.has(e.key)).map(t=>{let n=(0,H.jsx)(Bb,{copy:e,field:t,id:`${s}-${t.key.replace(/[^a-z0-9_-]/gi,`-`)}`,onChange:a,value:o[t.key],timezone:String(o.timezone??`UTC`)},t.key);return t.key===`enabled`&&t.input_kind===`boolean`?(0,H.jsxs)(`div`,{className:`personal-capability-enabled-row`,children:[n,r]},t.key):n})})}var Hb={en:{manager_runtime:{displayName:`Manager runtime`,description:`Selects the persistent host-tool profile used by owner manager conversations.`},todo_replan_cadence:{displayName:`Goal review cadence`,description:`Configures the Goal review cadence.`},change_quality_qualification:{displayName:`Change quality qualification`,description:`Prepares a provider-neutral review packet, allows at most one policy-authorized safe-fix pass, and can require an exact-diff receipt.`},explore_graph:{displayName:`Explore Graph`,description:`Organizes bounded exploration as a typed evidence graph so branches, findings, and synthesis remain inspectable.`},explore_harness:{displayName:`Explore Harness`,description:`Selects a capability-owned planning and research harness profile for bounded multi-step exploration.`},lark_event_inbox:{displayName:`Lark event inbox`,description:`Receives provider events through a local-private inbox binding before LoopX projects them into governed work.`,readOnlyReason:`This capability requires a local-private inbox binding. Manage it in Lark settings or through the capability CLI.`},lark_kanban_heartbeat_sync:{displayName:`Lark Kanban heartbeat sync`,description:`Synchronizes accepted LoopX work state to the configured Lark Kanban heartbeat surface.`},local_authority_shadow:{displayName:`Local authority shadow`,description:`Observes post-commit Todo and task-lease state through the shared authority contract without taking write authority.`},multi_subagent:{displayName:`Adaptive child capacity`,description:`Sets bounded child-agent capacity and the public-safe responsibility domains in which parallel work may be delegated.`},peer_task_coordination:{displayName:`Registered-peer task coordination`,description:`Routes explicitly scoped peer-owned work to one registered coordinator without granting cross-owner mutation authority.`},periodic_report:{displayName:`Periodic reports`,description:`Turns validated Goal stage progress into a frozen report and automatically delivers it through the configured Goal Channel with exact readback.`},pull_request_review:{displayName:`Pull-request review`,description:`Ranks the public GitHub PR review queue with a machine-level default; it never grants GitHub, Todo, push, or merge authority.`},reward_memory:{displayName:`Reward Memory experiment`,description:`Configures a reviewed local-private provider binding for Goal-scoped Agent recall and evidence-backed outcome learning.`}},"zh-CN":{manager_runtime:{displayName:`管家 Runtime`,description:`选择管家会话持续生效的宿主工具模式。`},todo_replan_cadence:{displayName:`Goal 复核周期`,description:`配置 Goal 的复核周期。`},change_quality_qualification:{displayName:`变更质量验证`,description:`生成与 Provider 无关的审阅包,最多允许一次策略授权的安全修复,并可要求精确 diff 回执。`},explore_graph:{displayName:`探索图谱`,description:`把有界探索组织为 typed 证据图,让探索分支、发现与综合结论都可检查、可追溯。`},explore_harness:{displayName:`探索 Harness`,description:`为有界的多步探索选择由能力负责的规划与研究 Harness profile。`},lark_event_inbox:{displayName:`飞书事件收件箱`,description:`通过本机私有收件箱接收 Provider 事件,再由 LoopX 将其投影为受治理的工作。`,readOnlyReason:`此能力依赖本机私有的收件箱绑定,请在飞书设置或 capability CLI 中管理。`},lark_kanban_heartbeat_sync:{displayName:`飞书看板心跳同步`,description:`把 LoopX 已接受的工作状态同步到配置好的飞书看板心跳界面。`},local_authority_shadow:{displayName:`本地 Authority 影子观测`,description:`通过共享 Authority contract 观测提交后的 Todo 与 task lease 状态,但不取得写入权。`},multi_subagent:{displayName:`自适应子 Agent 容量`,description:`限定子 Agent 容量与可公开的职责域,只有落在这些边界内的工作才能并行委派。`},peer_task_coordination:{displayName:`已注册 Peer 任务协调`,description:`把明确限定的 Peer 工作路由给一个已注册协调者,不授予跨 Owner 修改权限。`},periodic_report:{displayName:`周期报告`,description:`把经过验证的 Goal 阶段进展整理为冻结报告,并通过配置的 Goal Channel 自动发送和精确回读。`},pull_request_review:{displayName:`Pull-request Review`,description:`配置公开 GitHub PR 审阅队列的本机默认排序;不会授予 GitHub、Todo、push 或 merge 权限。`},reward_memory:{displayName:`Reward Memory 实验`,description:`为 Goal 内 Agent 的召回与证据化结果学习配置经过审阅的本机私有 Provider 绑定。`}}},Ub={en:{runtime_profile:{label:`Runtime profile`,description:`Restricted keeps scoped LoopX reads only. Trusted owner enables normal host tools while protected operations retain separate checks.`},completed_todos:{label:`Completed Todos between Goal reviews`,description:`Machine default or explicit Goal override, from 1 to 5.`},allowed_domains:{label:`Allowed responsibility domains`,description:`Enter one bounded, public-safe domain per line.`},coordinator_agent_id:{label:`Coordinator Agent`,description:`Use an already registered Agent id; leave blank to disable coordination.`},enabled:{label:`Enabled`},model:{label:`Child model`,description:`For example gpt-5.6-luna. Blank clears the child model preference.`},reasoning_effort:{label:`Child reasoning effort`,description:`For example max; the host must support this model and effort.`},max_children:{label:`Maximum children`,description:`Hard upper bound for concurrently delegated child work.`},profile:{label:`Planner profile`,description:`Select one registered Explore Harness profile.`},profile_preset:{label:`Report profile`,description:`Capability-owned report profile, such as weekly-progress.`},review_priority:{label:`Review priority`,description:`Choose whether other developers' PRs or the authenticated reviewer's own PRs are ranked first.`},route_ref:{label:`Goal Channel route`,description:`Public route alias only; credentials and provider identifiers stay outside this form.`},safe_fix:{label:`Allow one bounded safe-fix pass`},strict_receipt:{label:`Require an exact-diff receipt`},timezone:{label:`Timezone`,description:`Use an IANA timezone, for example Asia/Shanghai.`},schedule:{label:`Calendar reports`,description:`Optional daily or weekly reports; no schedule preserves stage-only delivery.`},config_path:{label:`Local-private configuration path`,description:`Repo-relative ignored JSON under .loopx/config/. Leave blank to retain the current binding; the path is never returned.`},enabled_agents:{label:`Enabled Goal Agents`,description:`Enter one registered Goal-local Agent id per line. A private binding currently accepts exactly one Agent.`}},"zh-CN":{runtime_profile:{label:`运行模式`,description:`restricted 仅使用受限 LoopX 读取;trusted_owner 开放常规宿主工具,但受保护操作仍单独校验。`},completed_todos:{label:`两次 Goal 复核间的已完成 Todo 数`,description:`可设置 1–5;机器默认值可被 Goal 显式覆盖。`},allowed_domains:{label:`允许的职责域`,description:`每行填写一个有边界、可公开的职责域。`},coordinator_agent_id:{label:`协调 Agent`,description:`填写一个已经注册的 Agent ID;留空表示关闭协调。`},enabled:{label:`启用`},model:{label:`子 Agent 模型`,description:`例如 gpt-5.6-luna;留空清除模型偏好。`},reasoning_effort:{label:`子 Agent 推理档位`,description:`例如 max;宿主须支持所选模型与档位。`},max_children:{label:`最大子 Agent 数`,description:`可同时委派的子任务硬上限。`},profile:{label:`规划 Profile`,description:`选择一个已注册的 Explore Harness profile。`},profile_preset:{label:`报告 Profile`,description:`由该能力管理的报告 profile,例如 weekly-progress。`},review_priority:{label:`审阅优先级`,description:`选择先排其他开发者的 PR,还是先排当前已认证审阅者自己的 PR。`},route_ref:{label:`Goal Channel 路由`,description:`只填写公开 route alias;凭据与 Provider 标识不会进入此表单。`},safe_fix:{label:`允许一次有界安全修复`},strict_receipt:{label:`要求精确 diff 回执`},timezone:{label:`时区`,description:`使用 IANA 时区,例如 Asia/Shanghai。`},schedule:{label:`日历汇报`,description:`可选每日或每周计划;未设置时保持阶段结束汇报。`},config_path:{label:`本机私有配置路径`,description:`填写 .loopx/config/ 下、相对仓库且被忽略的 JSON;留空保留当前绑定,路径不会被回传。`},enabled_agents:{label:`已启用的 Goal Agent`,description:`每行填写一个已注册的 Goal 内 Agent ID;私有绑定当前只接受一个 Agent。`}}};function Wb(e,t){let n=Hb[t][e.capability_id];return n?{...e,display_name:n.displayName,description:n.description,configuration_editor:{...e.configuration_editor,...n.readOnlyReason?{read_only_reason:n.readOnlyReason}:{}}}:e}function Gb(e){return Ub[e]}Object.freeze(Object.keys(Hb.en).sort());function Kb(e,t){return e.available_scopes.includes(t)&&(t!==`machine`||!!e.machine_namespace)&&e.configuration_editor.editable&&e.configuration_editor.writable_scopes.includes(t)}function qb({values:e,t}){return(0,H.jsxs)(`details`,{className:`personal-capability-raw-values`,children:[(0,H.jsx)(`summary`,{children:t(`capabilities.rawJson`)}),(0,H.jsx)(`div`,{className:`personal-capability-value-grid`,children:e.map(({label:e,value:t})=>(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`strong`,{children:e}),(0,H.jsx)(`pre`,{children:t?JSON.stringify(t,null,2):`—`})]},e))})]})}function Jb({source:e,t}){return e?(0,H.jsxs)(`p`,{className:`personal-capability-effective-source`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:15}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:t(`capabilities.effectiveSource`)}),t(`capabilities.source.${e}`)]})]}):null}function Yb({available:e,description:t,t:n}){return e?null:(0,H.jsxs)(`section`,{className:`personal-capability-editor-status is-read-only`,children:[(0,H.jsx)(Qm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:n(`capabilities.readOnly`)}),(0,H.jsx)(`p`,{children:t})]})]})}function Xb(e){return e.availability?.includes(`experimental`)?4:e.capability_id===`multi_subagent`?3:e.configuration_editor.writable_scopes.length===0||e.availability===`supported_explicit_opt_in`?2:e.availability===`supported_explicit_override`?0:1}function Zb(e,t){return[...e].sort((e,n)=>{let r=Xb(e)-Xb(n);if(r!==0)return r;let i=Wb(e,t),a=Wb(n,t);return i.display_name.localeCompare(a.display_name,t)||e.capability_id.localeCompare(n.capability_id)})}function Qb({capabilities:e,locale:t,onSelect:n,scope:r,selectedCapabilityId:i,t:a}){return(0,H.jsx)(`nav`,{"aria-label":a(r===`goal`?`capabilities.catalog`:`machine.capabilityCatalog`),className:`personal-capability-list`,tabIndex:0,children:Zb(e,t).map(e=>{let o=Wb(e,t);return(0,H.jsxs)(`button`,{"aria-current":i===o.capability_id?`page`:void 0,onClick:()=>n(o.capability_id),type:`button`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:o.display_name})}),(0,H.jsx)(`em`,{children:a(o.available_scopes.includes(r)?r===`goal`?`capabilities.goalScope`:`capabilities.machineScope`:r===`machine`?`capabilities.goalScope`:`capabilities.machineScope`)})]},o.capability_id)})})}function $b({capability:e,locale:t,source:n}){let{t:r}=qi(),i=Wb(e,t);return(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`span`,{className:`personal-settings-icon`,children:(0,H.jsx)(Km,{"aria-hidden":!0,size:18})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`personal-capability-heading-row`,children:[(0,H.jsx)(`h2`,{children:i.display_name}),(0,H.jsx)(Jb,{source:n,t:r})]}),e.context_contribution&&(0,H.jsxs)(`details`,{className:`personal-capability-help`,"data-testid":`capability-context-phases`,children:[(0,H.jsx)(`summary`,{children:t===`zh-CN`?`主 Agent 协作指导`:`Coordinator workflow guidance`}),(0,H.jsx)(`p`,{children:t===`zh-CN`?`随能力开启。支持以下阶段;此处展示能力范围,不能证明某次运行已读取或采纳。`:`Enabled with this capability. These are supported phases, not proof that a run read or adopted the guidance.`}),(0,H.jsx)(`dl`,{children:e.context_contribution.supported_phases.map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:(0,H.jsx)(`code`,{children:e})}),(0,H.jsx)(`dd`,{children:ex[e][t===`zh-CN`?`zh`:`en`]})]},e))}),(0,H.jsx)(`p`,{children:t===`zh-CN`?`LoopX Turn 在请求与结果中提供上下文;原生工具入口由 LoopX skill 调用同一只读接口。执行与采纳需另看运行证据。`:`LoopX Turn includes context in requests and results. For native tools, the LoopX skill reads the same interface. Execution and adoption require run evidence.`})]}),(0,H.jsxs)(`details`,{className:`personal-capability-help`,children:[(0,H.jsx)(`summary`,{children:t===`zh-CN`?`配置说明`:`Configuration help`}),(0,H.jsx)(`p`,{children:i.description}),(0,H.jsx)(`dl`,{children:e.configuration_editor.fields.map(e=>{let n=Gb(t)[e.key],r=n?.description??e.description;return r?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:n?.label??e.label}),(0,H.jsx)(`dd`,{children:r})]},e.key):null})})]},e.capability_id)]})]})}var ex={before_plan:{zh:`规划前:识别独立问题并保留主 Agent 的核验与整合职责。`,en:`Before planning: identify independent questions and retain coordinator validation and integration.`},before_delegate:{zh:`委派前:明确子任务边界、模型偏好及预期证据。`,en:`Before delegation: specify task boundaries, model preferences and expected evidence.`},after_delegate_result:{zh:`回收后:核验结果,说明采纳决定并关联计划与成果。`,en:`After results: validate evidence, explain acceptance and link plans and deliverables.`}};function tx({goalId:e,onApplied:t,selected:n,t:r}){let[i,a]=(0,V.useState)({busy:null,draft:{},partialWrite:null,preview:null}),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(`guided`),[u,d]=(0,V.useState)(``),f=(0,V.useMemo)(()=>n?Lb(n.configuration_editor,u):null,[n,u]),p=c===`guided`||f!==null;(0,V.useEffect)(()=>{l(`guided`),d(``),a({busy:null,draft:Ib(n?.configuration_editor??{fields:[]},n?.current??n?.effective_configuration?.configuration??n?.default,n?.default),partialWrite:null,preview:null}),s(null)},[n]);async function m(t){if(!(!n||i.busy||!p)){a(e=>({...e,busy:`preview`,partialWrite:null})),s(null);try{let r=await Og(e,n.capability_id,t);a(e=>({...e,preview:r}))}catch(e){s(e instanceof Error?e.message:r(`capabilities.previewFailed`))}finally{a(e=>({...e,busy:null}))}}}async function h(){if(!(!n||!i.preview||i.busy||!p)){a(e=>({...e,busy:`apply`})),s(null);try{let r=Ib(n.configuration_editor,i.draft,n.default),o=await kg(e,n.capability_id,i.preview.action===`delete`?null:r,i.preview.plan_revision);a(e=>({...e,partialWrite:o.status===`partial_write`?o:null,preview:null})),o.status!==`partial_write`&&t()}catch(e){a(e=>({...e,preview:null})),s(e instanceof Error?e.message:r(`capabilities.applyFailed`))}finally{a(e=>({...e,busy:null}))}}}function g(e,t){a(r=>({...r,draft:n?.capability_id===`periodic_report`?Rb(r.draft,e,t):{...r.draft,[e]:t},preview:null})),s(null)}function _(e){if(!n||i.busy)return;d(e);let t=Lb(n.configuration_editor,e);a(e=>({...e,preview:null,draft:t?Ib(n.configuration_editor,t,n.default):e.draft})),s(null)}function v(){i.busy||!p||(c===`guided`&&d(JSON.stringify(i.draft,null,2)),l(c===`guided`?`json`:`guided`),a(e=>({...e,preview:null})))}return{apply:h,changeDraft:g,changeJson:_,changeMode:v,editorMode:c,jsonDraft:u,jsonValid:p,error:o,mutation:i,preview:m}}function nx({mutationError:e,onApplied:t,partialWrite:n,preview:r}){let{t:i}=qi();return(0,H.jsxs)(H.Fragment,{children:[e?(0,H.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:e}):null,n?(0,H.jsxs)(`section`,{"aria-live":`polite`,className:`personal-capability-recovery`,children:[(0,H.jsx)(Qm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:i(`capabilities.partialWrite`)}),(0,H.jsx)(`p`,{children:i(`capabilities.partialWriteDescription`)}),(0,H.jsx)(`small`,{children:n.recommended_action})]}),(0,H.jsxs)(`button`,{onClick:t,type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":!0,size:15}),i(`capabilities.refreshSource`)]})]}):null,r?(0,H.jsxs)(`section`,{className:`personal-capability-preview`,"aria-label":i(`capabilities.preview`),children:[(0,H.jsx)(`strong`,{children:i(`capabilities.preview`)}),(0,H.jsx)(`span`,{children:i(`machine.action.${r.action}`)}),(0,H.jsx)(`small`,{children:i(`capabilities.previewLocked`)})]}):null]})}function rx({catalog:e,goalId:t,onApplied:n}){let{locale:r,t:i}=qi(),a=(0,V.useMemo)(()=>Zb(e.capabilities,r),[e.capabilities,r]),[o,s]=(0,V.useState)(()=>a[0]?.capability_id??``),c=(0,V.useMemo)(()=>a.find(e=>e.capability_id===o)??a[0],[a,o]),l=(0,V.useMemo)(()=>c?Wb(c,r):void 0,[r,c]),{apply:u,changeDraft:d,changeJson:f,changeMode:p,editorMode:m,jsonDraft:h,jsonValid:g,error:_,mutation:v,preview:y}=tx({goalId:t,onApplied:n,selected:l,t:i}),{busy:b,draft:x,partialWrite:S,preview:C}=v;if(!c||!l)return(0,H.jsx)(`p`,{className:`personal-capability-empty`,children:i(`capabilities.empty`)});let w=l.available_scopes.includes(`goal`),T=Kb(l,`goal`),E=l.configuration_editor.read_only_reason??i(w?`capabilities.previewOnly`:`capabilities.machineOnly`);async function D(){if(!l||!T||b||!g)return;let e=Ib(l.configuration_editor,x,l.default);await y(e)}async function O(){!T||b||await y(null)}return(0,H.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,H.jsx)(Qb,{capabilities:e.capabilities,locale:r,onSelect:s,scope:`goal`,selectedCapabilityId:l.capability_id,t:i}),(0,H.jsxs)(`article`,{"aria-label":l.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,H.jsx)($b,{capability:c,locale:r,source:l.effective_configuration?.source}),(0,H.jsx)(Yb,{available:T,t:i,description:E}),T?(0,H.jsxs)(H.Fragment,{children:[m===`json`||!l.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,H.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,H.jsxs)(`button`,{disabled:!!b||!g,onClick:p,type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),i(m===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,m===`guided`?(0,H.jsx)(`section`,{className:`personal-capability-field-summary`,children:(0,H.jsx)(Vb,{disabled:!!b,copy:Gb(r),editor:l.configuration_editor,onChange:d,value:x,enabledAction:(0,H.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:p,type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),i(`machine.editJson`)]})})}):(0,H.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`goal-configuration-json`,children:[(0,H.jsx)(`span`,{children:i(`capabilities.jsonConfiguration`)}),(0,H.jsx)(`textarea`,{id:`goal-configuration-json`,"aria-describedby":`goal-configuration-json-help`,disabled:!!b,onChange:e=>f(e.target.value),rows:12,spellCheck:!1,value:h}),(0,H.jsx)(`small`,{id:`goal-configuration-json-help`,children:i(`capabilities.jsonHelp`)}),g?null:(0,H.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:i(`capabilities.jsonInvalid`)})]})]}):null,(0,H.jsx)(nx,{mutationError:_,onApplied:n,partialWrite:S,preview:C}),T?(0,H.jsxs)(`footer`,{className:`personal-capability-actions`,children:[l.current&&l.available_scopes.includes(`machine`)?(0,H.jsx)(`button`,{disabled:!!b||!g,onClick:()=>void O(),type:`button`,children:i(`capabilities.restoreInheritance`)}):null,(0,H.jsx)(`button`,{disabled:!!b||!g,onClick:()=>void D(),type:`button`,children:i(b===`preview`?`common.loading`:`capabilities.previewChanges`)}),(0,H.jsx)(`button`,{className:`is-primary`,disabled:!!b||!C||!g,onClick:()=>void u(),type:`button`,children:i(b===`apply`?`common.loading`:`capabilities.applyPreview`)})]}):null,(0,H.jsx)(qb,{values:[{label:i(`capabilities.goalValue`),value:l.current},{label:i(l.machine_current?`capabilities.machineValue`:`capabilities.defaultValue`),value:l.machine_current??l.default}],t:i},c.capability_id)]})]})}function ix({goalId:e}){let{t}=qi(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(!1);function c(){e&&(s(!0),a(null),Dg(e).then(r).catch(e=>a(e instanceof Error?e.message:t(`capabilities.loadFailed`))).finally(()=>s(!1)))}return(0,V.useEffect)(c,[e]),e?o&&!n?(0,H.jsxs)(`p`,{"aria-live":`polite`,className:`personal-capability-empty`,children:[(0,H.jsx)(wm,{className:`personal-spin`,size:18}),t(`capabilities.loading`)]}):i?(0,H.jsxs)(`section`,{className:`personal-capability-error`,role:`alert`,children:[(0,H.jsx)(Qm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:t(`capabilities.loadFailed`)}),(0,H.jsx)(`small`,{children:i})]}),(0,H.jsxs)(`button`,{onClick:c,type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":!0,size:15}),t(`capabilities.retry`)]})]}):n?(0,H.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n.revision,children:[(0,H.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:17}),t(`capabilities.atomicOverride`)]}),(0,H.jsx)(`p`,{children:t(`capabilities.atomicOverrideDescription`)})]}),(0,H.jsx)(rx,{catalog:n.capability_catalog,goalId:e,onApplied:c})]}):null:(0,H.jsx)(`p`,{className:`personal-capability-empty`,children:t(`capabilities.chooseGoal`)})}function ax(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function ox(e,t){let n=t?.machine_namespace;return n?e?.machine_configuration?.namespaces[n]:void 0}function sx(e,t,n){return{...ax(e.default),...ax(t),...n}}function cx(e,t){for(let n of e.configuration_editor.fields){let e=t[n.key];if(n.required&&(e==null||e===``))return!1}return e.capability_id===`periodic_report`&&t.enabled===!0?!!(String(t.profile_preset??``).trim()&&String(t.route_ref??``).trim()&&String(t.timezone??``).trim()):!0}function lx(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}catch{return null}}function ux(e){return e?e===`absent`?e:e.replace(/^sha256:/,``).slice(0,12):`—`}function dx(){let{locale:e,t}=qi(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)({}),[c,l]=(0,V.useState)(`{}`),[u,d]=(0,V.useState)(`guided`),[f,p]=(0,V.useState)(null),[m,h]=(0,V.useState)(`upsert`),[g,_]=(0,V.useState)(null),[v,y]=(0,V.useState)(null),[b,x]=(0,V.useState)(`load`),[S,C]=(0,V.useState)(null),[w,T]=(0,V.useState)(null),E=(0,V.useMemo)(()=>Zb(n?.capability_catalog.capabilities??[],e),[n,e]),D=n?.invalid_namespaces[0],O=E.find(e=>e.capability_id===i)??(D?E.find(e=>e.machine_namespace===D):void 0)??E.find(e=>Kb(e,`machine`))??E[0],k=O?Wb(O,e):void 0,ee=ox(n,k),te=!!(k?.machine_namespace&&ee),A=!!(k&&Kb(k,`machine`)),j=(0,V.useMemo)(()=>lx(c),[c]),M=k?u===`json`?j:sx(k,ee,o):null,N=!!(k&&(u===`json`?j:cx(k,M??{})));async function P(){r(await Eg())}(0,V.useEffect)(()=>{let e=!0;return Eg().then(t=>{e&&r(t)}).catch(n=>{e&&C(n instanceof Error?n.message:t(`machine.loadError`))}).finally(()=>{e&&x(null)}),()=>{e=!1}},[t]),(0,V.useEffect)(()=>{if(!k)return;let e=ox(n,k),t=Ib(k.configuration_editor,e??k.default,k.default),r=sx(k,e,t);s(t),l(JSON.stringify(r,null,2)),d(A?`guided`:`json`),p(null),h(`upsert`),y(null)},[n,i,e]);function F(e,t){s(n=>k?.capability_id===`periodic_report`?Rb(n,e,t):{...n,[e]:t}),p(null),h(`upsert`),C(null),T(null)}function ne(e){if(k){if(e===`json`)l(JSON.stringify(sx(k,ee,o),null,2));else if(j)s(Ib(k.configuration_editor,j,k.default));else{C(t(`machine.jsonInvalid`));return}d(e),p(null),h(`upsert`),C(null)}}async function re(){if(!(!A||!k?.machine_namespace||!M||!N||b)){x(`preview`),C(null),T(null);try{h(`upsert`),p(await Ag(k.machine_namespace,M))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function I(){if(!(!A||!k?.machine_namespace||!te||b)){x(`preview`),C(null),T(null);try{h(`remove`),p(await Mg(k.machine_namespace))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function L(){if(!A||!k?.machine_namespace||!f||b||m===`upsert`&&!M)return;x(`apply`),C(null);let e=m;try{let n=e===`remove`?await Ng(k.machine_namespace,f.plan_revision):await jg(k.machine_namespace,M,f.plan_revision);_(n),p(null),h(`upsert`),y(null),await P(),T(n.status===`applied`?t(e===`remove`?`machine.removed`:`machine.applied`):t(`machine.unchanged`))}catch(e){p(null),h(`upsert`),C(e instanceof Error?e.message:t(`machine.applyError`))}finally{x(null)}}async function ie(){if(!(!g?.transaction_id||b)){x(`rollback-preview`),C(null);try{y(await Pg(g.transaction_id))}catch(e){C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}async function R(){if(!(!g?.transaction_id||!v||b)){x(`rollback`),C(null);try{await Fg(g.transaction_id,v.plan_revision),_(null),y(null),p(null),await P(),T(t(`machine.rolledBack`))}catch(e){y(null),C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}return b===`load`?(0,H.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:t(`common.loading`)}):k?(0,H.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n?.revision,children:[(0,H.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:17}),t(`machine.liveDefault`)]}),(0,H.jsx)(`p`,{children:t(`machine.liveDefaultDescription`)})]}),n?.status===`invalid`?(0,H.jsxs)(`section`,{className:`personal-machine-error`,"data-testid":`machine-invalid-repair`,role:`alert`,children:[(0,H.jsx)(`strong`,{children:t(`machine.invalidStoredConfiguration`)}),(0,H.jsx)(`p`,{children:t(`machine.invalidStoredConfigurationDescription`)})]}):null,(0,H.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,H.jsx)(Qb,{capabilities:E,locale:e,onSelect:a,scope:`machine`,selectedCapabilityId:k.capability_id,t}),(0,H.jsxs)(`article`,{"aria-label":k.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,H.jsx)($b,{capability:O,locale:e,source:k.available_scopes.includes(`machine`)?te?`machine_default`:`capability_default`:void 0}),(0,H.jsx)(Yb,{available:A,t,description:k.available_scopes.includes(`machine`)?t(`machine.editorUnavailableDescription`):t(`machine.goalOnly`)}),k.capability_id===`periodic_report`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:ee?.schedule?e===`zh-CN`?`日历与阶段汇报`:`Calendar and stage reports`:t(`machine.periodicReportActivation`)}),(0,H.jsx)(`p`,{children:ee?.schedule?ee.enabled===!0?e===`zh-CN`?`已配置日历计划,由现有唤醒检查;是否送达请核对报告回执。`:`A calendar schedule is configured and checked by existing wakes. Verify delivery in the report receipt.`:e===`zh-CN`?`日历计划已保存;启用此能力后才会检查和投递。`:`The schedule is saved; enable this capability to check and deliver reports.`:t(`machine.periodicReportActivationDescription`)})]})]}):null,k.capability_id===`change_quality_qualification`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.changeQualityActivation`)}),(0,H.jsx)(`p`,{children:t(`machine.changeQualityActivationDescription`)})]})]}):null,k.capability_id===`todo_replan_cadence`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.replanCadenceActivation`)}),(0,H.jsx)(`p`,{children:t(`machine.replanCadenceActivationDescription`)})]})]}):null,k.capability_id===`pull_request_review`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:e===`zh-CN`?`只改变队列排序`:`Queue ordering only`}),(0,H.jsx)(`p`,{children:e===`zh-CN`?`默认先审阅其他开发者的 PR;选择 owner-first 才会优先当前已认证审阅者自己的 PR。此配置不会发布 review、写 Todo、push 或 merge。`:`The default reviews other developers' PRs first; choose owner-first only when the authenticated reviewer's own PRs should lead. This setting never posts a review, writes Todos, pushes, or merges.`})]})]}):null,A?(0,H.jsxs)(H.Fragment,{children:[u===`json`||!k.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,H.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,H.jsxs)(`button`,{onClick:()=>ne(u===`guided`?`json`:`guided`),type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),t(u===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,u===`guided`?(0,H.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,H.jsx)(Vb,{copy:Gb(e),disabled:!!b,editor:k.configuration_editor,onChange:F,value:o,enabledAction:(0,H.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:()=>ne(`json`),type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),t(`machine.editJson`)]})}),N?null:(0,H.jsx)(`p`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.requiredFields`)})]}):(0,H.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`machine-configuration-json`,children:[(0,H.jsx)(`span`,{children:t(`machine.jsonConfiguration`)}),(0,H.jsx)(`textarea`,{"aria-describedby":`machine-configuration-json-help`,disabled:!!b,id:`machine-configuration-json`,onChange:e=>{l(e.target.value),p(null),C(null)},rows:12,spellCheck:!1,value:c}),(0,H.jsx)(`small`,{id:`machine-configuration-json-help`,children:t(`machine.jsonConfigurationHelp`)}),j?null:(0,H.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.jsonInvalid`)})]})]}):null,S?(0,H.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:S}):null,w?(0,H.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(tm,{"aria-hidden":!0,size:16}),w]}):null,f?(0,H.jsxs)(`section`,{"aria-label":t(`machine.preview`),className:`personal-machine-preview`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.preview`)}),(0,H.jsx)(`span`,{children:t(`machine.action.${f.action}`)})]}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`machine.currentRevision`)}),(0,H.jsx)(`dd`,{title:f.current_revision,children:ux(f.current_revision)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`machine.desiredRevision`)}),(0,H.jsx)(`dd`,{title:f.desired_revision,children:ux(f.desired_revision)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`machine.changedNamespaces`)}),(0,H.jsx)(`dd`,{children:f.changed_namespaces.join(`, `)||t(`common.none`)})]})]}),(0,H.jsx)(`p`,{children:t(`machine.previewLocked`)})]}):null,g?.rollback_available&&g.transaction_id?(0,H.jsxs)(`section`,{className:`personal-machine-rollback`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.rollbackAvailable`)}),(0,H.jsx)(`p`,{children:t(v?`machine.rollbackPreviewDescription`:`machine.rollbackDescription`)})]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!!b||!!(v&&!v.rollback_allowed),onClick:()=>void(v?R():ie()),type:`button`,children:[(0,H.jsx)(Rm,{"aria-hidden":!0,size:15}),t(b===`rollback`||b===`rollback-preview`?`common.loading`:v?`machine.confirmRollback`:`machine.previewRollback`)]})]}):null,A?(0,H.jsxs)(`footer`,{className:`personal-capability-actions`,children:[te?(0,H.jsxs)(`button`,{className:`is-danger`,disabled:!!b,onClick:()=>void I(),type:`button`,children:[(0,H.jsx)(Zm,{"aria-hidden":!0,size:15}),t(`machine.previewRemoval`)]}):null,(0,H.jsx)(`button`,{disabled:!!b||!N,onClick:()=>void re(),type:`button`,children:t(b===`preview`?`common.loading`:`machine.previewChanges`)}),(0,H.jsx)(`button`,{className:`is-primary`,disabled:!!b||!f,onClick:()=>void L(),type:`button`,children:t(b===`apply`?`common.loading`:`machine.applyPreview`)})]}):null,k.available_scopes.includes(`machine`)?(0,H.jsx)(qb,{values:[{label:t(`machine.currentValue`),value:ee},{label:t(`capabilities.defaultValue`),value:k.default}],t},k.capability_id):null]})]})]}):(0,H.jsx)(`p`,{className:`personal-capability-empty`,children:t(`machine.capabilityEmpty`)})}var fx={appearance:jm,capabilities:Km,language:xm,lark:Wm,machine:Hm};function px({focusGoalConnection:e=!1,goals:t,initialGoalId:n,initialTab:r=`lark`,onChanged:i,onClose:a,onThemeChange:o,theme:s}){let{locale:c,setLocale:l,t:u}=qi(),[d,f]=(0,V.useState)(r),p=[...n?[{key:`capabilities`,label:u(`capabilities.title`)}]:[],{key:`machine`,label:u(`machine.title`)},{key:`lark`,label:`Lark`},{key:`appearance`,label:u(`settings.appearance`)},{key:`language`,label:u(`settings.language`)}],m=[{label:u(`settings.languageEnglish`),value:`en`},{label:u(`settings.languageSimplifiedChinese`),value:`zh-CN`}],h={appearance:{title:u(`settings.appearance`)},capabilities:{title:u(`capabilities.title`)},language:{title:u(`settings.language`)},lark:{title:`Lark`},machine:{title:u(`machine.title`)}}[d];return(0,H.jsxs)(`section`,{"aria-label":u(`settings.title`),className:`personal-settings-page`,"data-pw-theme":s,children:[(0,H.jsxs)(`aside`,{className:`personal-settings-sidebar`,children:[(0,H.jsxs)(`button`,{className:`personal-settings-back`,onClick:a,type:`button`,children:[(0,H.jsx)(Kp,{size:17}),(0,H.jsx)(`span`,{children:u(`settings.back`)})]}),(0,H.jsxs)(`div`,{className:`personal-settings-title`,children:[(0,H.jsx)(`small`,{children:u(`settings.eyebrow`)}),(0,H.jsx)(`strong`,{children:u(`settings.title`)})]}),(0,H.jsx)(`nav`,{"aria-label":u(`settings.categories`),className:`personal-settings-tabs`,children:p.map(e=>{let t=fx[e.key];return(0,H.jsxs)(`button`,{"aria-current":d===e.key?`page`:void 0,onClick:()=>f(e.key),type:`button`,children:[(0,H.jsx)(t,{size:17}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:e.label})})]},e.key)})})]}),(0,H.jsxs)(`main`,{className:`personal-settings-body`,children:[(0,H.jsx)(`header`,{className:`personal-settings-header`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(`h1`,{children:h.title})})}),d===`lark`?(0,H.jsx)(Pb,{embedded:!0,focusGoalConnection:e,goals:t,initialGoalId:n,onChanged:i,onClose:a}):null,d===`machine`?(0,H.jsx)(dx,{}):null,d===`capabilities`?(0,H.jsx)(ix,{goalId:n}):null,d===`appearance`?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-appearance-settings`,children:[(0,H.jsx)(`small`,{children:u(`settings.workspaceDisplay`)}),(0,H.jsx)(`h3`,{children:u(`settings.appearance`)}),(0,H.jsxs)(`div`,{className:`personal-settings-choice-group`,role:`radiogroup`,"aria-label":u(`settings.workspaceTheme`),children:[(0,H.jsxs)(`button`,{"aria-checked":s===`loopx`,onClick:()=>o(`loopx`),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-settings-theme-swatch is-loopx`}),(0,H.jsx)(`strong`,{children:u(`settings.themeLoopx`)})]}),(0,H.jsxs)(`button`,{"aria-checked":s===`paper`,onClick:()=>o(`paper`),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-settings-theme-swatch is-paper`}),(0,H.jsx)(`strong`,{children:u(`settings.themeDefault`)})]}),(0,H.jsxs)(`button`,{"aria-checked":s===`brutal`,onClick:()=>o(`brutal`),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-settings-theme-swatch is-brutal`}),(0,H.jsx)(`strong`,{children:u(`settings.themeHighContrast`)})]})]})]}):null,d===`language`?(0,H.jsxs)(`section`,{className:`personal-settings-card`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`span`,{className:`personal-settings-icon`,children:(0,H.jsx)(xm,{size:18})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(`h2`,{children:u(`settings.language`)})})]}),(0,H.jsx)(`div`,{"aria-label":u(`settings.language`),className:`personal-language-options`,role:`radiogroup`,children:m.map(e=>(0,H.jsxs)(`button`,{"aria-checked":c===e.value,className:c===e.value?`is-selected`:``,onClick:()=>l(e.value),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:e.label})}),c===e.value?(0,H.jsx)(tm,{"aria-hidden":!0,size:17}):null]},e.value))})]}):null]})]})}var mx=`loopx-pw-theme`,hx=`loopx`;function gx(){try{let e=window.localStorage.getItem(mx);return e===`loopx`||e===`paper`||e===`brutal`?e:hx}catch{return hx}}function _x(e){try{window.localStorage.setItem(mx,e)}catch{}}function vx({drawer:e,drawerMode:t=`panel`,drawerOpen:n,main:r,mobileSidebarOpen:i=!1,onCloseMobileSidebar:a,sidebar:o,theme:s=`loopx`}){let{t:c}=qi(),l=(0,V.useRef)(null),u=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(!i)return;u.current=document.activeElement instanceof HTMLElement?document.activeElement:null;let e=l.current?.querySelectorAll(`button:not([disabled]), a[href], select:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])`);e?.[0]?.focus();function t(t){if(t.key!==`Tab`||!e?.length)return;let n=e[0],r=e[e.length-1];t.shiftKey&&document.activeElement===n?(t.preventDefault(),r.focus()):!t.shiftKey&&document.activeElement===r&&(t.preventDefault(),n.focus())}return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),u.current?.focus(),u.current=null}},[i]),(0,H.jsxs)(`section`,{className:`personal-workspace-shell${n?` has-drawer`:``}${n&&t.startsWith(`inspector`)?` has-task-inspector`:``}${t===`inspector-full`?` is-task-inspector-full`:``}${i?` mobile-sidebar-open`:``}`,"data-pw-theme":s,children:[i?(0,H.jsx)(`button`,{"aria-hidden":!0,className:`personal-sidebar-backdrop`,onClick:a,tabIndex:-1,type:`button`}):null,(0,H.jsx)(`aside`,{"aria-label":i?c(`header.goalNavigation`):void 0,"aria-modal":i?!0:void 0,className:`personal-workspace-sidebar`,"data-workspace-sidebar":!0,ref:l,role:i?`dialog`:void 0,children:(0,H.jsxs)(`div`,{className:`personal-workspace-sidebar-inner`,children:[i?(0,H.jsxs)(`button`,{className:`personal-sr-only`,onClick:a,type:`button`,children:[c(`common.close`),` `,c(`header.goalNavigation`)]}):null,o]})}),(0,H.jsx)(`main`,{"aria-hidden":i||void 0,className:`personal-workspace-main`,inert:i||void 0,children:r}),n?(0,H.jsx)(`aside`,{className:`personal-workspace-drawer`,"data-context-drawer":!0,"data-drawer-mode":t,children:e}):null]})}function yx(e){let t=e.match(/(?:下一步|建议|行动项|待办)[::\s]*([^\n]+)/u),n=t?t[1]:e;n=n.replace(/```[\s\S]*?```/g,``).replace(/`([^`]+)`/g,`$1`).replace(/\[([^\]]+)\]\([^)]+\)/g,`$1`).replace(/[#*~_>]/g,``).replace(/^[-*•\d+.\s]+/u,``).replace(/^(好的|没问题|收到|建议如下|任务如下|分析如下|结论[::])[\s,,::]*/u,``);let r=(n.split(/\r?\n/).map(e=>e.trim()).filter(Boolean)[0]||n).replace(/\s+/gu,` `).trim();return Array.from(r).slice(0,120).join(``)}function bx(e){let t=new Map;return e.forEach(e=>{let n=e.fields.find(e=>e.key===`todo_id`)?.value??``,r=[e.actionKind,e.goalId??``,n,e.title].join(`:`);t.set(r,e)}),[...t.values()]}function xx(e,t,n){if(!e)return n(`home.noFirstActivity`);let r=new Date(e);if(Number.isNaN(r.getTime()))return e;let i=new Date,a=new Intl.DateTimeFormat(t,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);return r.toDateString()===i.toDateString()?n(`home.todayAt`,{time:a}):new Intl.DateTimeFormat(t,{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r)}function Sx({goals:e,onSelectGoal:t,onRetry:n,systemHealth:r}){let{locale:i,t:a}=qi(),o=e.filter(e=>e.activationState===`active`),s=o.filter(e=>e.loadState===`error`).length,c=[{key:`needs_you`,label:a(`home.lane.needsYou`)},{key:`running`,label:a(`home.lane.running`)},{key:`observing`,label:a(`home.lane.observing`)},{key:`scheduled`,label:a(`home.lane.scheduled`)}],l=Object.fromEntries(c.map(e=>[e.key,[]])),u=[],d=[];e.filter(e=>!e.loadState).forEach(e=>{let t=by(e);t===`history`?u.push(e):t===`stopped`?d.push(e):l[t].push(e)});let f=e=>(0,H.jsxs)(`button`,{className:`personal-home-goal-card`,"data-goal-state":e.loadState??e.state,"data-load-error":e.loadError,onClick:()=>t(e.goalId),type:`button`,children:[(0,H.jsxs)(`span`,{className:`personal-home-goal-meta`,children:[(0,H.jsx)(`i`,{}),e.agentLaneCount&&e.agentLaneCount>1?a(`header.workAgentCount`,{count:e.agentLaneCount}):e.agentLabel??e.agentId]}),(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsx)(`p`,{children:e.loadError?a(`startup.error.${e.loadError}`):e.needsYou??e.nextSentence}),(0,H.jsxs)(`footer`,{children:[(0,H.jsx)(`span`,{children:e.loadState?a(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Ji(e.state,i)}),(0,H.jsx)(`small`,{title:e.latestActivity,children:e.loadState?``:e.latestActivity?xx(e.latestActivity,i,a):e.agentTodos.length?a(`home.taskCount`,{count:e.agentTodos.length}):a(`home.noActivity`)})]})]},e.goalId);return(0,H.jsxs)(`section`,{"aria-label":a(`home.workspace`),className:`personal-home-board`,children:[r&&(!r.ok||r.issues.length>0||r.freshnessWarning)?(0,H.jsxs)(`div`,{className:`personal-system-health-banner`,role:`alert`,children:[(0,H.jsxs)(`div`,{className:`personal-system-health-header`,children:[(0,H.jsx)(am,{size:15}),(0,H.jsx)(`strong`,{children:a(`home.systemHealth`,{summary:r.summary})}),r.freshnessWarning?(0,H.jsxs)(`small`,{children:[`(`,r.freshnessWarning,`)`]}):null]}),r.issues.length>0?(0,H.jsx)(`ul`,{className:`personal-system-health-issues`,children:r.issues.map((e,t)=>(0,H.jsx)(`li`,{children:e},t))}):null]}):null,o.some(e=>e.loadState)?(0,H.jsxs)(`section`,{className:`personal-home-lane`,"aria-live":`polite`,children:[(0,H.jsx)(`header`,{children:a(`startup.progress`,{loaded:o.filter(e=>!e.loadState).length,total:o.length})}),s?(0,H.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`status`,children:[(0,H.jsx)(`span`,{children:a(`startup.failedCount`,{count:s})}),(0,H.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,onClick:n,type:`button`,children:a(`startup.retryFailed`)})]}):null,o.filter(e=>e.loadState).map(f)]}):null,(0,H.jsx)(`div`,{className:`personal-home-lanes`,children:c.map(e=>(0,H.jsxs)(`section`,{className:`personal-home-lane is-${e.key}`,"data-testid":`personal-home-lane-${e.key}`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`i`,{}),e.label]}),(0,H.jsx)(`b`,{children:l[e.key].length})]}),(0,H.jsx)(`div`,{className:`personal-home-lane-list`,children:l[e.key].length?l[e.key].map(f):(0,H.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.empty`)})})]},e.key))}),(0,H.jsxs)(`details`,{className:`personal-home-history`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{children:a(`home.history`)}),(0,H.jsx)(`b`,{children:u.length}),(0,H.jsx)(`small`,{children:a(`home.completedGoals`)})]}),(0,H.jsx)(`div`,{children:u.length?u.map(f):(0,H.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.noCompletedGoals`)})})]}),d.length?(0,H.jsxs)(`details`,{className:`personal-home-history is-stopped`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{children:a(`home.stopped`)}),(0,H.jsx)(`b`,{children:d.length}),(0,H.jsx)(`small`,{children:a(`home.preservedState`)})]}),(0,H.jsx)(`div`,{children:d.map(f)})]}):null]})}function Cx({items:e,onSelect:t,reportState:n}){let{locale:r,t:i}=qi();return(0,H.jsxs)(`section`,{className:`personal-object-list personal-files-list`,"data-testid":`personal-goal-outputs`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:i(`files.title`)}),(0,H.jsx)(`span`,{children:e.length})]}),n?.loading?(0,H.jsxs)(`p`,{className:`personal-object-list-state`,role:`status`,children:[(0,H.jsx)(Lm,{className:`is-spinning`,size:14}),i(`files.loadingReports`)]}):null,n?.error?(0,H.jsxs)(`p`,{className:`personal-object-list-state is-error`,role:`alert`,children:[(0,H.jsx)(am,{size:14}),i(`files.reportLoadFailed`),`: `,n.error]}):null,!n?.loading&&!n?.error&&e.length===0?(0,H.jsxs)(`p`,{className:`personal-object-list-state`,children:[(0,H.jsx)(_m,{size:14}),i(`files.empty`)]}):null,e.map(e=>(0,H.jsxs)(`button`,{"data-output-kind":e.output.kind,onClick:()=>t({item:e.output,kind:`output`}),type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-file-icon`,children:(0,H.jsx)(_m,{size:16})}),(0,H.jsx)(`strong`,{children:e.output.title}),e.output.report?(0,H.jsx)(`em`,{children:i(`files.reportDelta`,{added:e.output.report.addedCount,changed:e.output.report.changedCount})}):null,(0,H.jsx)(`p`,{children:e.output.summary??e.output.safePreview??e.output.kind??i(`files.emptySummary`)}),(0,H.jsx)(`small`,{title:e.output.createdAt,children:[e.output.goalTitle,e.output.kind===`report`?i(`files.verifiedReport`):null,e.output.todoId?`${i(`common.task`)} ${e.output.todoId}`:null,xx(e.output.createdAt,r,i)].filter(Boolean).join(` · `)})]},e.id))]})}function wx({agentLabel:e,messages:t,onClose:n,onDraftTask:r,onOpenConversation:i,title:a}){let{t:o}=qi(),s=t.reduce((e,t,n)=>t.role===`user`?n:e,0),c=t.slice(Math.max(0,s)).slice(-3),l=c.filter(e=>e.role===`assistant`&&!e.pending).at(-1);return(0,V.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,H.jsxs)(`aside`,{"aria-label":o(`conversation.receipt`),className:`personal-manager-conversation-tray`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:16}),(0,H.jsx)(`strong`,{children:a??o(`conversation.title`)}),(0,H.jsx)(`small`,{children:t.at(-1)?.pending?o(`conversation.replying`):o(`common.recently`)})]}),(0,H.jsxs)(`div`,{className:`personal-manager-conversation-actions`,children:[r&&l?(0,H.jsxs)(`button`,{className:`personal-manager-conversation-btn`,onClick:()=>r(l.text),title:o(`conversation.convertHint`),type:`button`,children:[(0,H.jsx)(Cm,{size:13}),(0,H.jsx)(`span`,{children:o(`conversation.toTask`)})]}):null,(0,H.jsx)(`button`,{className:`personal-manager-conversation-link`,onClick:i,type:`button`,children:o(`conversation.full`)}),n?(0,H.jsx)(`button`,{"aria-label":o(`conversation.close`),className:`personal-manager-conversation-close`,onClick:n,title:o(`conversation.close`),type:`button`,children:(0,H.jsx)(eh,{size:14})}):null]})]}),(0,H.jsx)(`div`,{"aria-live":`polite`,className:`personal-manager-conversation-messages`,children:c.map(t=>(0,H.jsxs)(`article`,{className:`is-${t.role}`,children:[(0,H.jsx)(`strong`,{children:t.role===`user`?o(`common.you`):t.agentLabel??e??o(`header.manager`)}),(0,H.jsxs)(`div`,{className:`personal-manager-conversation-bubble`,children:[t.role===`user`?(0,H.jsx)(`p`,{children:t.text}):(0,H.jsx)(Fy,{text:t.text}),t.pending?(0,H.jsx)(`small`,{children:o(`conversation.agentPending`)}):null]})]},t.id))})]})}function Tx({onClose:e,onOpenDetails:t,run:n}){let{t:r}=qi();return(0,H.jsxs)(`section`,{"aria-label":r(`session.record`),className:`personal-session-record`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:17}),r(`session.record`)]}),(0,H.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,H.jsx)(eh,{size:15})})]}),(0,H.jsx)(`div`,{children:(0,H.jsx)(`strong`,{children:n.title})}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Agent`}),(0,H.jsx)(`dd`,{children:n.agentLabel})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`common.status`)}),(0,H.jsx)(`dd`,{children:Yi(n.sessionStatus??n.status,r)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Session`}),(0,H.jsx)(`dd`,{title:n.sessionId,children:n.sessionId})]})]}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:t,type:`button`,children:r(`session.details`)})]})}function Ex(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??yy(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>by(e)===`running`).slice(0,4).forEach(e=>r.push({id:`run:${e.goalId}`,kind:`run`,run:{agentId:e.agentId,agentLabel:e.agentLabel??e.agentId,completedSteps:e.doneTodoCount??e.agentTodos.filter(e=>e.done).length,goalId:e.goalId,goalTitle:e.title,latestActivity:e.agentSentence,runId:`goal:${e.goalId}`,status:`running`,title:e.nextSentence,totalSteps:Math.max((e.doneTodoCount??0)+e.agentTodos.filter(e=>!e.done).length,1)}})),r;let i=e.goals.find(e=>e.goalId===t);if(!i)return r;if(i.needsYou){let t=e.userTodos.find(e=>e.goalId===i.goalId);r.push({attention:t?{...t,goalTitle:i.title}:{blocking:i.needsYouBlocking??!1,goalId:i.goalId,goalTitle:i.title,text:i.needsYou,todoId:`${i.goalId}:attention`},id:`attention:${i.goalId}`,kind:`attention`})}r.push({id:`run:${i.goalId}`,kind:`run`,run:{agentId:i.agentId,agentLabel:i.agentLabel??i.agentId,completedSteps:i.doneTodoCount??i.agentTodos.filter(e=>e.done).length,goalId:i.goalId,goalTitle:i.title,latestActivity:i.agentSentence,runId:`goal:${i.goalId}`,status:i.state===`推进中`?`running`:i.state===`需修复`?`failed`:`waiting`,title:i.nextSentence,totalSteps:Math.max((i.doneTodoCount??0)+i.agentTodos.filter(e=>!e.done).length,1)}}),i.agentTodos.filter(e=>e.taskClass===`continuous_monitor`).forEach(t=>{let a=e.timeline?.find(e=>e.kind===`run`&&e.run.goalId===i.goalId&&e.run.todoId===t.todoId&&!!e.run.sessionId);r.push({id:`schedule:${i.goalId}:${t.todoId}`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:a?[{label:a.run.latestActivity||a.run.title,runId:a.run.runId,status:a.run.status===`waiting`||a.run.status===`queued`?`running`:a.run.status,timestamp:i.latestActivity||n(`common.recently`)}]:[],goalId:i.goalId,label:t.text,schedule:t.evidence??n(`schedule.summary`),scheduleId:t.todoId,scheduleKind:`monitor`,sessionId:a?.run.sessionId,status:t.done||t.status===`paused`?`paused`:`active`,stopCondition:n(`drawer.scheduleDefaultStop`),target:t.text,timezone:`Asia/Shanghai`}})});let a=e.timeline?.find(e=>e.kind===`proposal`&&e.proposal.actionKind===`heartbeat.bind`&&e.proposal.goalId===i.goalId);if(a){let e=e=>a.proposal.fields.find(t=>t.key===e)?.value;r.push({id:`schedule:${i.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:[],goalId:i.goalId,label:`${n(`schedule.heartbeat`)} · ${i.title}`,nextRunAt:n(`drawer.schedulePending`),notificationRule:n(`drawer.scheduleDefaultNotification`),schedule:e(`cadence`)??n(`schedule.summary`),scheduleId:`${i.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:a.proposal.status===`applied`?`active`:`draft`,stopCondition:e(`stop_condition`)??n(`drawer.scheduleDefaultStop`),timezone:e(`timezone`)??`Asia/Shanghai`}})}return r}function Dx(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function Ox(e,t){let n={agent_id:t(`proposal.field.agentId`),cadence:t(`proposal.field.cadence`),completion_criteria:t(`proposal.field.completionCriteria`),execution_boundary:t(`proposal.field.executionBoundary`),goal_id:t(`proposal.field.goalId`),heartbeat:t(`proposal.field.heartbeat`),initial_todos:t(`proposal.field.initialTodos`),objective:t(`proposal.field.objective`),operation:t(`proposal.field.operation`),permission:t(`proposal.field.permission`),reason:t(`proposal.field.reason`),stop_condition:t(`proposal.field.stopCondition`),target:t(`proposal.field.target`),timezone:t(`proposal.field.timezone`),title:t(`proposal.field.title`),workspace_ref:t(`proposal.field.workspace`)},r=[`title`,`objective`,`completion_criteria`,`execution_boundary`,`permission`,`agent_id`,`workspace_ref`,`initial_todos`,`heartbeat`,`stop_condition`,`goal_id`];return Object.entries(e).sort(([e],[t])=>{let n=r.indexOf(e),i=r.indexOf(t);return(n<0?r.length:n)-(i<0?r.length:i)}).slice(0,10).map(([e,r])=>({key:e,label:n[e]??e.replaceAll(`_`,` `),value:e===`workspace_ref`?r===`current`?t(`proposal.workspace.current`):t(`proposal.workspace.named`,{workspace:String(r??`current`)}):Array.isArray(r)?r.join(` · `):typeof r==`object`&&r?JSON.stringify(r):String(r??`—`)}))}function kx(e,t,n){let r=t.operationFrame,i=r?.content.fields.map((e,t)=>({key:`projection:${t}`,label:e.label,value:e.value})).slice(0,8)??[];return[{key:`operation_state`,label:n(`proposal.field.operationState`),value:r?.lifecycleState??e.status},...r?.kind===`result`?[{key:`result_delivery`,label:n(`proposal.field.resultDelivery`),value:r.resultDeliveryVerified?n(`proposal.resultDelivery.verified`):n(`proposal.resultDelivery.pending`)}]:[],...i,...r?[{key:`warning`,label:n(`proposal.field.confirmationBoundary`),value:r.content.warning}]:[],...r?[{key:`expires_at`,label:n(`proposal.field.expiresAt`),value:r.expiresAt}]:[]].slice(0,10)}function Ax(e){if(e.action_kind!==`goal.lifecycle`)return;let t=e.normalized_parameters.operation;return t===`stop`||t===`resume`||t===`delete`?t:void 0}function jx(e,t){let n=Ax(e),r=gy(e),i=typeof e.normalized_parameters.title==`string`?e.normalized_parameters.title:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:``,a=typeof e.normalized_parameters.target==`string`?e.normalized_parameters.target:``,o=r.operationFrame,s=o?.content.title??e.summary,c=e.action_kind===`operation.execute`?s:e.action_kind===`goal.create`?t(`proposal.summary.goalCreate`,{title:i}):e.action_kind===`heartbeat.bind`?t(`proposal.summary.heartbeat`):e.action_kind===`monitor.create`?t(`proposal.summary.monitor`,{target:a}):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.summary.lifecycleStop`,{title:i}):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.summary.lifecycleDelete`,{title:i}):e.action_kind===`goal.lifecycle`?t(`proposal.summary.lifecycleResume`,{title:i}):e.summary;return{actionKind:e.action_kind,reviewPlan:r,fields:e.action_kind===`operation.execute`?kx(e,r,t):Ox(e.normalized_parameters,t),goalId:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:void 0,impact:e.action_kind===`operation.execute`?t(`proposal.impact.operation`):e.action_kind===`goal.create`?t(`proposal.impact.goalCreate`):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.impact.lifecycleStop`):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.impact.lifecycleDelete`):e.action_kind===`goal.lifecycle`?t(`proposal.impact.lifecycleResume`):e.permission_classification===`protected`?t(`proposal.impact.protected`):t(`proposal.impact.default`),previewId:e.proposal_id,lifecycleOperation:n,gate:e.gate?{kind:String(e.gate.kind??`protected_action`),nextAction:typeof e.gate.next_action==`string`?e.gate.next_action:void 0,summary:String(e.gate.summary??t(`proposal.gate.default`))}:void 0,primaryLabel:e.action_kind===`operation.execute`?o?.kind===`result`?o.resultDeliveryVerified?t(`proposal.primary.operationResultVerified`):t(`proposal.primary.operationResultPending`):t(`proposal.primary.operationGroup`):e.action_kind===`goal.create`?t(`proposal.primary.goalCreate`):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.primary.lifecycleStop`):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.primary.lifecycleDelete`):e.action_kind===`goal.lifecycle`?t(`proposal.primary.lifecycleResume`):e.action_kind===`todo.create`&&e.normalized_parameters.start_execution===!0?t(`proposal.primary.todoStart`):t(`proposal.primary.apply`),status:e.status===`applied`&&e.action_kind!==`operation.execute`&&r.interaction!==`completed`?`error`:Dx(e.status),title:c}}function Mx(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,42);if(t)return t;let n=2166136261;for(let t of e)n^=t.codePointAt(0)??0,n=Math.imul(n,16777619);return`goal-${(n>>>0).toString(36)}`}function Nx(e,t){let n=e.match(/[「“"]([^」”"]{2,80})[」”"]/u)?.[1];return n?n.trim():e.replace(/^(请|帮我|我想|给我|创建|新建|设置|please|i want to|create|set up)+/iu,``).replace(/(一个|新的)?\s*(goal|目标)/giu,``).replace(/[,。!?].*$/u,``).trim().slice(0,80)||t(`goal.defaultTitle`)}function Px(e,t){for(let n of e.split(/\r?\n/u)){let e=n.trim();for(let n of t){let t=e.match(RegExp(`^${n.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}\\s*[::]\\s*(.*)$`,`iu`));if(t?.[1]?.trim())return t[1].trim()}}return``}function Fx(e,t){let n=Px(e,[`目标`,`Objective`]),r=Px(e,[`完成标准`,`Completion criteria`]),i=Px(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||Nx(e,t)).split(/[。;;\n]/u)[0].trim().slice(0,80)||t(`goal.defaultTitle`),o=[n||a,r?t(`goal.objectiveCompletion`,{criteria:r}):``,i?t(`goal.objectiveBoundary`,{boundary:i}):``].filter(Boolean).join(` -`),s=/(只读|不调用外部工具|不修改(?:仓库|代码|状态)|read.?only|do not (?:call|use) external tools|do not modify (?:repositories|repository|code|state))/iu.test(i||e);return{completionCriteria:r,executionBoundary:i,initialTodos:r?[t(`goal.initialTodo`,{criteria:r})]:[],objective:o,permission:s?`read_only`:`workspace_write_on_confirmation`,title:a}}function Ix(e){let t=e.match(/(?:每|every)\s*(\d{1,3})\s*(?:分钟|minutes?)/iu)?.[1];if(t)return`${t}m`;let n=e.match(/(?:每|every)\s*(\d{1,2})\s*(?:小时|hours?)/iu)?.[1];return n?`${n}h`:/每小时|every hour|hourly/iu.test(e)?`1h`:(/每天|每日|早上|上午|daily|every day/iu.test(e),`1d`)}function Lx(e,t){return/(每周|星期|周[一二三四五六日天]|weekly|every\s+(?:mon|tues|wednes|thurs|fri|satur|sun)day|\d{1,2}\s*[::]\s*\d{2})/iu.test(e)?t(`schedule.unsupportedCalendar`):null}function Rx(e,t){return Px(e,[`检查内容`,`监控内容`,`目标`,`Check target`,`Monitor target`,`Target`])||e.replace(/^(?:为当前 Goal |for the current Goal )?(?:添加|配置|创建|add|configure|create)?\s*(?:定时检查|监控|scheduled check|monitor)[::]?/iu,``).split(/\r?\n/u)[0].trim()||t(`schedule.defaultTarget`)}function zx(e){return/(mr|pr).{0,8}(合并|merge)/iu.test(e)?`pr_merged`:/发布完成|上线完成|release (?:is )?complete|deployment (?:is )?complete/iu.test(e)?`release_complete`:`goal_complete`}function Bx(e,t){let n=e.toLowerCase();return t.find(e=>n.includes(e.agentId.toLowerCase())||n.includes(e.label.toLowerCase()))}function Vx(e){let t=Px(e,[`标题`,`任务标题`,`Todo 标题`]),n=Px(e,[`内容`,`任务内容`,`Todo 内容`]);if(t)return[t,n].filter(Boolean).join(`:`).slice(0,400);let r=e.match(/[「“"]([^」”"]{2,200})[」”"]/u)?.[1];return r?r.trim():e.replace(/^(请|帮我|给我|为当前 Goal |新增|新建|创建|添加|加上|加一个|记一个)+/u,``).replace(/^(一个\s*)?(普通\s*)?(todo|待办|任务)(?:\s*到\s*Tasks?)?[::\s]*/iu,``).replace(/[。;;,,]\s*(?:不要|不需要|无需|禁止|别|暂不).{0,80}(?:heartbeat|心跳|定时|监控|执行).*$/iu,``).replace(/[,,]\s*(并且|然后|再)?\s*(交给|分配给|让).+$/u,``).replace(/\s*(交给|分配给|让)\s+.+$/u,``).trim().slice(0,400)||`推进当前 Goal 的下一项工作`}var Hx=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),Ux=5242880,Wx=4;function Gx(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onerror=()=>r(Error(t(`composer.imageReadError`,{name:e.name}))),i.onload=()=>n({dataUrl:String(i.result??``),id:crypto.randomUUID(),mimeType:e.type,name:e.name,size:e.size}),i.readAsDataURL(e)})}function Kx({agents:e=[{agentId:`codex`,available:!0,capability:`代码与项目执行`,label:`Codex`}],callbacks:t={},goalArchiveLoadState:n={error:null,phase:`ready`},managerRuntime:r,model:i,readOnly:a=!1,selectedAgentId:o,selectedGoalId:s,statusSourceControl:c}){let{locale:l,t:u}=qi(),[d,f]=(0,V.useState)(s??null),[p,m]=(0,V.useState)(o??e.find(e=>e.available)?.agentId??`codex`),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(null),[x,S]=(0,V.useState)({}),[C,w]=(0,V.useState)(`chat`),[T,E]=(0,V.useState)(!1),[D,O]=(0,V.useState)(!1),[k,ee]=(0,V.useState)(!1),[te,A]=(0,V.useState)(()=>{try{let e=window.sessionStorage.getItem(`loopx-pw-composer-drafts`),t=e?JSON.parse(e):{};return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}),[j,M]=(0,V.useState)(!1),[N,P]=(0,V.useState)([]),[F,ne]=(0,V.useState)(null),[re,I]=(0,V.useState)(null),[L,ie]=(0,V.useState)(()=>new Set),[R,ae]=(0,V.useState)(()=>new Set),[oe,se]=(0,V.useState)(`idle`),[ce,le]=(0,V.useState)([]),[ue,z]=(0,V.useState)(!1),[de,fe]=(0,V.useState)(gx),[pe,me]=(0,V.useState)({}),[he,ge]=(0,V.useState)([]),_e=(0,V.useRef)(!1),ve=(0,V.useRef)(NaN),ye=(0,V.useRef)(null),be=(0,V.useRef)(null),xe=(0,V.useRef)(null),Se=(0,V.useRef)(new Set),Ce=(0,V.useRef)(new Set),[we,Te]=(0,V.useState)(null),B=s===void 0?d:s,Ee=o??p,De=`${B??`manager`}:${Ee}`,Oe=te[De]??``;(0,V.useEffect)(()=>{P([]),ne(null)},[De]);function ke(e,t){A(n=>{let r={...n};t?r[e]=t:delete r[e];try{window.sessionStorage.setItem(`loopx-pw-composer-drafts`,JSON.stringify(r))}catch{}return r})}function Ae(e){ke(De,e)}function je(e){let t=te[De]?.trimEnd();Ae(t?`${t}\n${e}`:e),window.requestAnimationFrame(()=>ye.current?.focus())}(0,V.useEffect)(()=>{let e=ye.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[Oe]);let Me=(0,V.useMemo)(()=>i.goals.map(e=>{let t=pe[e.goalId];return t?{...e,repository:{branch:t.branch,identity:t.identity,label:t.label,readOnly:!0}}:e}),[pe,i.goals]),Ne=(0,V.useMemo)(()=>Me.filter(e=>by(e)===`needs_you`).length,[Me]),Pe=(0,V.useMemo)(()=>Me.filter(e=>by(e)===`needs_you`&&(e.needsYouBlocking||e.state===`等你`)).length,[Me]),Fe=Me.find(e=>e.goalId===B)??null,Ie=h?.kind===`settings`,Le=B,Re=(0,V.useMemo)(()=>{let e=Object.values(x).filter(e=>e.actionKind===`heartbeat.bind`&&e.goalId&&e.status===`applied`).map(e=>({id:`schedule:${e.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:Ee,executionHistory:[],goalId:e.goalId,label:e.title,nextRunAt:u(`drawer.schedulePending`),notificationRule:u(`drawer.scheduleDefaultNotification`),schedule:e.fields.find(e=>e.key===`cadence`)?.value??u(`schedule.summary`),scheduleId:`${e.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:e.status===`applied`?`active`:`draft`,stopCondition:e.fields.find(e=>e.key===`stop_condition`)?.value??u(`drawer.scheduleDefaultStop`),timezone:e.fields.find(e=>e.key===`timezone`)?.value??`Asia/Shanghai`}})),t=[...Ex(i,Le,u),...i.timeline??[],...e,...bx(Object.values(x)).filter(e=>e.actionKind!==`heartbeat.bind`||e.status!==`applied`).map(e=>({id:`proposal:${e.previewId}`,kind:`proposal`,proposal:e}))];return[...new Map(t.map(e=>[e.id,e])).values()].filter(e=>e.kind!==`proposal`||![`stale`,`error`].includes(e.proposal.status)||ce.includes(e.proposal.previewId)).filter(e=>!B||e.kind===`message`?!0:e.kind===`proposal`?!e.proposal.goalId||e.proposal.goalId===B:e.kind===`attention`?e.attention.goalId===B:e.kind===`run`?e.run.goalId===B:e.kind===`schedule`?e.schedule.goalId===B:e.output.goalId===B)},[Le,i,x,Ee,B,ce,u]),ze=(0,V.useMemo)(()=>y?Re.filter(e=>e.kind===`message`?!0:e.kind===`run`?e.run.runId===y.runId:e.kind===`output`&&e.output.runId===y.runId):Re,[y,Re]);(0,V.useEffect)(()=>{if(!y)return;let e=Re.find(e=>e.kind===`run`&&e.run.runId===y.runId);!e||e.kind!==`run`||JSON.stringify({completedSteps:y.completedSteps,latestActivity:y.latestActivity,messages:y.sessionMessages,sessionStatus:y.sessionStatus,status:y.status,totalSteps:y.totalSteps})!==JSON.stringify({completedSteps:e.run.completedSteps,latestActivity:e.run.latestActivity,messages:e.run.sessionMessages,sessionStatus:e.run.sessionStatus,status:e.run.status,totalSteps:e.run.totalSteps})&&b(e.run)},[y,Re]);let Be=(0,V.useMemo)(()=>Re.flatMap(e=>e.kind===`message`?[e.message]:[]),[Re]),Ve=(0,V.useMemo)(()=>Fe?Re.flatMap(e=>e.kind===`message`?[e.message]:[]):[],[Re,Fe]);(0,V.useEffect)(()=>{Fe||T||Be.some(e=>e.pending)&&O(!0)},[T,Be,Fe]),(0,V.useEffect)(()=>{!Fe||C===`chat`||Ve.some(e=>e.pending)&&ee(!0)},[Ve,Fe,C]);let He=(0,V.useMemo)(()=>Re.filter(e=>e.kind===`message`||e.kind===`proposal`&&ce.includes(e.proposal.previewId)),[Re,ce]),Ue=He[He.length-1],We=Ue?.kind===`message`?Ue.message.text.length:0;(0,V.useEffect)(()=>{if(!T||!be.current)return;let e=window.requestAnimationFrame(()=>{be.current&&(be.current.scrollTop=be.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[He.length,T,We]);let Ge=(0,V.useMemo)(()=>{if(h?.kind===`settings`)return null;if(h?.kind===`attention`)return{kind:`attention`,item:Gd(h.item,i.attentionHistory??i.userTodos)};if(h?.kind===`goal`){let e=Me.find(e=>e.goalId===h.item.goalId);return e?{item:e,kind:`goal`}:h}if(h?.kind!==`run`)return h;let e=Re.find(e=>e.kind===`run`&&e.run.runId===h.item.runId);return e?{item:e.run,kind:`run`}:h},[Re,h,Me,i.attentionHistory,i.userTodos]);(0,V.useEffect)(()=>{if(a){me({}),ge([]);return}let e=!1;return Promise.all([Lg(),Jg()]).then(([t,n])=>{e||(me(Object.fromEntries(t.map(e=>[e.goal_id,e.repository]))),ge(n))}).catch(()=>{}),()=>{e=!0}},[a]),(0,V.useEffect)(()=>{if(!ue)return;function e(e){e.key===`Escape`&&z(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[ue]),(0,V.useEffect)(()=>{if(B||!Re.length)return;if(!_e.current){_e.current=!0;try{ve.current=Date.parse(window.localStorage.getItem(`loopx-pw-last-visit`)??``),window.localStorage.setItem(`loopx-pw-last-visit`,new Date().toISOString())}catch{ve.current=NaN}}let e=ve.current,t=Re.filter(e=>e.kind===`run`).map(e=>e.run),n=t=>{let n=Date.parse(t??``);return!Number.isNaN(e)&&!Number.isNaN(n)&&n>e},r={attention:Ne,done:t.filter(e=>e.status===`completed`&&n(e.latestActivity)).length,failed:t.filter(e=>(e.status===`failed`||e.status===`interrupted`)&&n(e.latestActivity)).length};Te(e=>e?.attention===r.attention&&e.done===r.done&&e.failed===r.failed?e:r)},[Re,Ne,B]),(0,V.useEffect)(()=>{if(a){S({});return}let e=!1;return Nh(B?{goalId:B}:{contextKind:`manager`}).then(t=>{if(e)return;let n=Object.fromEntries(t.filter(e=>[`preview_ready`,`gated`,`deferred`,`applying`].includes(e.status)||e.action_kind===`operation.execute`&&e.status===`applied`).map(e=>{let t=jx(e,u);return[t.previewId,t]}));S(e=>({...e,...n}))}).catch(()=>{}),()=>{e=!0}},[a,B,u]);async function Ke(e,n={}){if(a)throw Error(u(`source.readOnlyWriteError`));let r;try{r=t.onPreviewAction?await t.onPreviewAction(e):jx(await jh(e),u)}catch(t){if(!(t instanceof Eh)||t.payload.error_code!==`action_preview_gate`)throw t;let n=t.payload.gate&&typeof t.payload.gate==`object`?t.payload.gate:{},i=(Array.isArray(n.candidates)?n.candidates:[]).flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.workspace_ref==`string`&&typeof t.label==`string`?[{label:t.label,workspaceRef:t.workspace_ref}]:[]}),a=String(n.kind??`workspace_selection_required`),o=a===`agent_binding_required`||a===`agent_identity_selection_required`;r={actionKind:e.actionKind,fields:i.map(e=>({key:`workspace_ref:${e.workspaceRef}`,label:e.label,value:e.workspaceRef})),gate:{kind:a,nextAction:typeof n.next_action==`string`?n.next_action:void 0,summary:String(n.summary??u(`proposal.workspaceGate.defaultSummary`))},impact:u(o?`proposal.workspaceGate.agentImpact`:`proposal.workspaceGate.selectionImpact`),previewId:`workspace-choice-${Date.now().toString(36)}`,sourceRequest:e,status:`gated`,title:u(o?`proposal.workspaceGate.agentTitle`:`proposal.workspaceGate.selectionTitle`),workspaceCandidates:i}}return le(e=>e.includes(r.previewId)?e:[...e,r.previewId]),S(e=>({...e,[r.previewId]:r})),n.select!==!1&&g({item:r,kind:`proposal`}),r}function qe(){tt(null),ke(`manager:${Ee}`,u(`composer.createGoalTemplate`)),window.requestAnimationFrame(()=>ye.current?.focus())}async function Je(e,n){z(!1);let r={delete:`Deleted from the owner workspace`,resume:`Resumed from the owner workspace`,stop:`Stopped from the owner workspace`},i={delete:u(`proposal.summary.lifecycleDelete`,{title:e.title}),resume:u(`proposal.summary.lifecycleResume`,{title:e.title}),stop:u(`proposal.summary.lifecycleStop`,{title:e.title})},a=null,o=!1;try{if(n===`stop`){if(Se.current.has(e.goalId))return;Se.current.add(e.goalId),ie(new Set(Se.current)),g(null),a={goalId:e.goalId,next:`stopped`,optimisticApplied:!0,previous:e.activationState},I(u(`feedback.applying`,{title:i.stop})),t.onGoalActivationStateChange?.(e.goalId,`stopped`)}if(t.onExecuteGoalLifecycle){if(n===`delete`)throw Error(`The selected status source does not authorize Goal deletion.`);let a=await t.onExecuteGoalLifecycle({goalId:e.goalId,operation:n,reason:r[n]});if(!a.projectionVerified)throw Error(`Goal lifecycle projection did not verify.`);o=!0,t.onGoalActivationStateChange?.(e.goalId,a.activationState),I(u(`feedback.completed`,{title:i[n]})),n===`stop`&&tt(null),await(t.onReconcileStatus??t.onRefresh)?.();return}let s=await Ke({actionKind:`goal.lifecycle`,context:{kind:`goal_directory`,goal_id:e.goalId},idempotencyKey:`workspace-goal-${n}-${e.goalId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:n,reason:r[n]},summary:i[n]},{select:n!==`stop`});if(s.goalId!==e.goalId||s.lifecycleOperation!==n)throw g(null),Error(u(`actionReview.targetChanged`));n===`stop`&&(s.reviewPlan?.interaction===`direct`?(o=!0,await Qe(s,{lifecycleProjection:a??void 0,presentation:`feedback`})):(a&&t.onGoalActivationStateChange?.(a.goalId,a.previous),I(s.gate?u(`feedback.gateRequired`,{summary:s.gate.summary}):u(`feedback.notCompleted`,{status:s.status})),g({item:s,kind:`proposal`})))}catch(e){a&&!o&&t.onGoalActivationStateChange?.(a.goalId,a.previous),I(u(`feedback.executionFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{n===`stop`&&(Se.current.delete(e.goalId),ie(new Set(Se.current)))}}function Ye(e,t){Ae(u(t?e===`heartbeat`?`composer.heartbeatTemplate`:`composer.monitorTemplate`:e===`heartbeat`?`composer.heartbeatTemplateWithoutGoal`:`composer.monitorTemplateWithoutGoal`)),g(null),window.requestAnimationFrame(()=>ye.current?.focus())}async function Xe(e,n,r=``){let i=await t.onRequestScheduleConfig?.(e,n);if(i){le(e=>e.includes(i.previewId)?e:[...e,i.previewId]),S(e=>({...e,[i.previewId]:i})),g({item:i,kind:`proposal`});return}if(!n){Ae(u(e===`heartbeat`?`composer.heartbeatGoalQuestion`:`composer.monitorGoalQuestion`));return}let a=Date.now().toString(36);await Ke({actionKind:e===`heartbeat`?`heartbeat.bind`:`monitor.create`,context:{kind:`schedule`,goal_id:n},idempotencyKey:`workspace-${e}-${n}-${a}`,normalizedParameters:e===`heartbeat`?{agent_id:Ee,cadence:Ix(r),goal_id:n,stop_condition:zx(r),timezone:`Asia/Shanghai`}:{agent_id:Ee,cadence:Ix(r),goal_id:n,stop_condition:zx(r),target:Rx(r,u),target_key:`goal-${n}`,timezone:`Asia/Shanghai`},summary:e===`heartbeat`?u(`proposal.summary.heartbeat`):u(`proposal.summary.monitor`,{target:Rx(r,u)})})}async function Ze(e){if(!Ce.current.has(e.todoId)){Ce.current.add(e.todoId),ae(new Set(Ce.current)),I(u(`feedback.preparingPreview`,{title:e.text}));try{await Ke({actionKind:`todo.update`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-${e.todoId}-complete-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:`complete`,todo_id:e.todoId},summary:u(`tasks.markComplete`,{name:e.text})}),I(null)}catch(e){I(u(`feedback.previewFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{Ce.current.delete(e.todoId),ae(new Set(Ce.current))}}}async function Qe(e,n={}){if(e.reviewPlan&&!e.reviewPlan.canApply)return;let r=n.presentation!==`feedback`,a=e.actionKind===`goal.lifecycle`&&e.goalId&&(e.lifecycleOperation===`stop`||e.lifecycleOperation===`resume`)?{goalId:e.goalId,next:e.lifecycleOperation===`stop`?`stopped`:`active`,optimisticApplied:!1,previous:i.goals.find(t=>t.goalId===e.goalId)?.activationState??(e.lifecycleOperation===`stop`?`active`:`stopped`)}:null,o=n.lifecycleProjection??a;I(u(`feedback.applying`,{title:e.title}));let s={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`pending`,reason:`apply_pending`,canApply:!1}:void 0,status:`applying`};S(t=>({...t,[e.previewId]:s})),r&&g({item:s,kind:`proposal`}),o&&!o.optimisticApplied&&t.onGoalActivationStateChange?.(o.goalId,o.next);try{if(t.onApplyProposal){await t.onApplyProposal(e);let n={...e,status:`applied`};if(S(t=>({...t,[e.previewId]:n})),r&&g({item:n,kind:`proposal`}),I(u(`feedback.completed`,{title:e.title})),e.actionKind===`goal.lifecycle`){(e.lifecycleOperation===`stop`||e.lifecycleOperation===`delete`)&&tt(null),e.lifecycleOperation===`delete`&&e.goalId&&t.onGoalDeleted?.(e.goalId);let n=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>n?.()).catch(()=>void 0)}return}let n=await Ph(e.previewId);if(n.proposal.proposal_id!==e.previewId||n.proposal.action_kind!==e.actionKind||e.actionKind===`goal.lifecycle`&&(n.proposal.normalized_parameters.goal_id!==e.goalId||Ax(n.proposal)!==e.lifecycleOperation))throw new Eh(u(`actionReview.targetChanged`),{error_code:`action_response_mismatch`});let i=jx(n.proposal,u);if(S(t=>({...t,[e.previewId]:i})),r&&g({item:i,kind:`proposal`}),i.reviewPlan?.interaction!==`completed`){o&&t.onGoalActivationStateChange?.(o.goalId,o.previous),g({item:i,kind:`proposal`}),I(n.proposal.status===`stale`?u(`feedback.stale`):u(`actionReview.${i.reviewPlan.reason}`));return}if(I(u(`feedback.completed`,{title:i.title})),i.actionKind===`todo.create`&&await t.onRefresh?.(),i.actionKind===`goal.lifecycle`&&(i.lifecycleOperation===`stop`||i.lifecycleOperation===`delete`)&&tt(null),i.actionKind===`goal.lifecycle`&&i.lifecycleOperation===`delete`&&i.goalId&&t.onGoalDeleted?.(i.goalId),i.actionKind===`goal.lifecycle`){let e=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>e?.()).catch(()=>void 0)}}catch(n){if(o&&t.onGoalActivationStateChange?.(o.goalId,o.previous),n instanceof Eh&&n.payload.error_code===`protected_action`){let r=n.payload.gate,i=r&&typeof r==`object`?r:{},a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`gated`,reason:`authority_gate`,canApply:!1}:void 0,gate:{kind:String(i.kind??`protected_action`),nextAction:typeof i.next_action==`string`?i.next_action:void 0,summary:String(i.summary??n.message)},status:`gated`};S(t=>({...t,[e.previewId]:a})),g({item:a,kind:`proposal`}),I(u(`feedback.gateRequired`,{summary:a.gate.summary})),e.actionKind===`goal.create`&&e.goalId&&(t.onRefresh?.(),tt(e.goalId));return}let r=n instanceof Eh&&_y(n.payload),i=n instanceof Eh&&n.payload.error_code===`action_response_mismatch`,a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:r?`refresh`:`repair`,reason:i?`readback_unverified`:r?`stale_proposal`:`apply_failed`,canApply:!1}:void 0,errorMessage:n instanceof Error?n.message:String(n),status:r?`stale`:`error`};S(t=>({...t,[e.previewId]:a})),g({item:a,kind:`proposal`}),I(u(`feedback.executionFailed`,{error:a.errorMessage}))}}let $e={...t,onOpenRunSession:async e=>{e.goalId!==B&&tt(e.goalId),w(`chat`),await t.onOpenRunSession?.(e),b(e),g(null)},onOpenGoal:e=>{tt(e);let n=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>n?.()).catch(()=>{I(u(`feedback.goalRefreshFailed`))})},onOpenGoalView:e=>{w(e),e===`chat`&&b(null),g(null)},onOpenOutput:e=>{e.goalId!==B&&tt(e.goalId),w(`files`),t.onOpenOutput?.(e)},onApplyProposal:Qe,onCancelProposal:async e=>{g(null),S(t=>{let n={...t};return delete n[e.previewId],n});try{t.onCancelProposal?.(e),t.onCancelProposal||await Fh(e.previewId)}catch(t){S(t=>({...t,[e.previewId]:e})),I(u(`feedback.cancelFailed`,{error:t instanceof Error?t.message:String(t)}))}},onTransitionProposal:async(e,t)=>{let n=jx(await Ih(e.previewId,t),u);le(e=>e.includes(n.previewId)?e:[...e,n.previewId]),S(r=>{let i={...r};return t===`regenerate`&&delete i[e.previewId],i[n.previewId]=n,i}),g({item:n,kind:`proposal`})},onSelectWorkspaceCandidate:async(e,t)=>{e.sourceRequest&&(S(t=>{let n={...t};return delete n[e.previewId],n}),await Ke({...e.sourceRequest,idempotencyKey:`${e.sourceRequest.idempotencyKey}-${t}`,normalizedParameters:{...e.sourceRequest.normalizedParameters,workspace_ref:t}}))},onPreviewAction:Ke,onRequestScheduleConfig:(e,t)=>Ye(e,t),onOpenNotificationSettings:e=>g({goalId:e,kind:`settings`,tab:`lark`}),onFetchNotificationTargets:()=>ag(),onSetupGoalChannel:e=>sg(e),onToggleGoalAutoNotify:e=>cg(e),onUpdateSchedule:async(e,t)=>{let n=Date.now().toString(36),r=e.scheduleKind===`heartbeat`;await Ke({actionKind:r?`heartbeat.bind`:`monitor.update`,context:{kind:`schedule`,goal_id:e.goalId},idempotencyKey:`workspace-monitor-${e.scheduleId}-${t}-${n}`,normalizedParameters:{agent_id:e.agentId??Ee,...!r&&t===`run_now`?{endpoint_id:Ee}:{},...t===`edit`?{cadence:`2h`,...r?{timezone:e.timezone??`Asia/Shanghai`}:{}}:{},goal_id:e.goalId,operation:t,...!r&&t===`run_now`&&e.sessionId?{session_id:e.sessionId}:{},...r?{}:{todo_id:e.scheduleId}},summary:t===`pause`?`暂停自动运行:${e.label}`:t===`resume`?`恢复自动运行:${e.label}`:t===`run_now`?`立即运行:${e.label}`:t===`stop`?`停止自动运行:${e.label}`:`编辑自动运行生命周期:${e.label}`})}},et=a?{onOpenGoal:$e.onOpenGoal,onOpenGoalView:$e.onOpenGoalView,onOpenOutput:$e.onOpenOutput}:$e;function tt(e){f(e),E(!1),O(!1),ee(!1),b(null),g(null),w(`tasks`),z(!1),t.onSelectGoal?.(e)}function nt(e){m(e),t.onSelectAgent?.(e)}function rt(e){fe(e),_x(e)}async function it(n){let r=n?[]:N,i=(n??Oe).trim()||(r.length?u(`composer.imageAnalysisPrompt`):``);if(!(!i||j)){n||(Ae(``),P([])),ne(null),M(!0);try{if(r.length){B?C!==`chat`&&ee(!0):O(!0);let e=await t.onSendMessage?.(i,Ee,B,r);e&&await Ke(e);return}let n=Jy(i,{agents:e.map(e=>({agentId:e.agentId,label:e.label})),goalId:B,todos:(Fe?.agentTodos??[]).map(e=>({text:e.text,todoId:e.todoId}))});if(n.route===`clarify`){Ae(i);let e=u(`composer.clarifySingleAction`);n.missingFields.includes(`resume_when`)&&(e=u(`composer.clarifyDefer`)),I(e);return}if(n.actionKind===`goal.create`){let e=Fx(i,u),t=Mx(e.title);await Ke({actionKind:`goal.create`,context:{kind:`manager`,goal_id:null,natural_language:i},idempotencyKey:`workspace-goal-intent-${t}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Ee,completion_criteria:e.completionCriteria,execution_boundary:e.executionBoundary,goal_id:t,heartbeat:{cadence:Ix(i),enabled:n.normalizedParameters.heartbeat_enabled===!0,timezone:`Asia/Shanghai`},initial_todos:e.initialTodos,objective:e.objective,permission:e.permission,stop_condition:zx(i),title:e.title,workspace_ref:`current`},summary:u(`proposal.summary.goalCreate`,{title:e.title})});return}if(B&&n.actionKind===`heartbeat.bind`){await Xe(`heartbeat`,B,i);return}if(B&&n.actionKind===`monitor.create`){let e=Lx(i,u);if(e){Ae(i),I(e);return}await Xe(`monitor`,B,i);return}let a=Bx(i,e);if(B&&a&&n.actionKind===`agent.bind`){await Ke({actionKind:`agent.bind`,context:{kind:`goal`,goal_id:B,natural_language:i},idempotencyKey:`workspace-agent-bind-${B}-${a.agentId}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:a.agentId,goal_id:B},summary:`将 ${a.label} 绑定到 ${Fe?.title??B}`});return}if(B&&n.actionKind===`todo.create`){if(n.normalizedParameters.start_execution===!0){await Ke({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:i},idempotencyKey:`workspace-task-start-${B}-${Date.now().toString(36)}`,normalizedParameters:{endpoint_id:a?.agentId??Ee,goal_id:B,start_execution:!0,text:i},summary:`交给 Agent 执行:${i.slice(0,120)}`});return}let e=a?.agentId??(/(交给|分配给|让).{0,24}(agent|codex|claude|kiro|kimi)/iu.test(i)?Ee:null);await Ke({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:i},idempotencyKey:`workspace-todo-create-${B}-${Date.now().toString(36)}`,normalizedParameters:{...e?{endpoint_id:e}:{},goal_id:B,text:Vx(i)},summary:`创建 Todo:${Vx(i)}`});return}let o=Fe?.agentTodos.find(e=>i.includes(e.todoId)||i.includes(e.text)),s=typeof n.normalizedParameters.operation==`string`?n.normalizedParameters.operation:null;if(B&&o&&n.actionKind===`todo.update`&&s){await Ke({actionKind:`todo.update`,context:{kind:`todo`,goal_id:B,todo_id:o.todoId,natural_language:i},idempotencyKey:`workspace-todo-update-${o.todoId}-${s}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Ee,...s===`reassign`&&a?{endpoint_id:a.agentId}:{},...s===`block`?{note:i}:{},...s===`defer`&&typeof n.normalizedParameters.resume_when==`string`?{resume_when:n.normalizedParameters.resume_when}:{},goal_id:B,operation:s,todo_id:o.todoId},summary:`更新 Todo:${o.text}`});return}B?C!==`chat`&&ee(!0):O(!0);let c=await t.onSendMessage?.(i,Ee,B);c&&await Ke(c)}catch(e){n||(Ae(i),P(r));let t=e instanceof Error?e.message:u(`feedback.sendGenericError`);I(u(`feedback.sendFailed`,{error:t}))}finally{M(!1)}}}let at=e.find(e=>e.agentId===Ee)?.label??Ee,ot=!Fe&&Oe.startsWith(u(`composer.createGoalDraftLead`)),st=Re.filter(e=>e.kind===`run`&&!!e.run.sessionId&&!!e.run.canInterrupt&&(e.run.status===`running`||e.run.status===`queued`)).length;async function ct(e){if(!e?.length)return;let t=Wx-N.length,n=Array.from(e).slice(0,Math.max(0,t)),r=n.find(e=>!Hx.has(e.type)),i=n.find(e=>e.size>Ux);if(t<=0){ne(u(`composer.imageCountError`,{count:Wx}));return}if(r){ne(u(`composer.imageTypeError`));return}if(i){ne(u(`composer.imageSizeError`,{size:Ux/1024/1024}));return}try{let t=await Promise.all(n.map(e=>Gx(e,u)));P(e=>[...e,...t].slice(0,Wx)),ne(e.length>n.length?u(`composer.imageCountError`,{count:Wx}):null)}catch(e){ne(e instanceof Error?e.message:u(`composer.imageReadGenericError`))}finally{xe.current&&(xe.current.value=``)}}function lt(e){let t=Array.from(e.clipboardData.items).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).flatMap(e=>{let t=e.getAsFile();return t?[t]:[]});t.length&&(e.preventDefault(),ct(t))}async function ut(){let e=await Jg();ge(e)}async function dt(){await Promise.all([ut(),t.onRefresh?.()])}async function ft(){if(!(!t.onRefresh||oe===`loading`)){se(`loading`);try{await t.onRefresh(),se(`done`)}catch{se(`error`)}window.setTimeout(()=>se(`idle`),1800)}}return Ie?(0,H.jsx)(px,{focusGoalConnection:!!(h?.kind===`settings`&&h.goalId),goals:Me,initialGoalId:h?.kind===`settings`?h.goalId??B:B,initialTab:h?.kind===`settings`?h.tab??`lark`:`lark`,onChanged:()=>void dt(),onClose:()=>g(null),onThemeChange:rt,theme:de}):(0,H.jsx)(vx,{drawer:Ge?(0,H.jsx)(rb,{agents:e,attentionHistory:i.attentionHistory??i.userTodos,onSelectAttention:e=>g({kind:`attention`,item:e}),callbacks:et,goalNotifications:i.goalNotifications??[],goals:Me,inspectorExpanded:_,larkConnections:a?[]:he,onClose:()=>{Ge.kind===`proposal`&&[`applied`,`rejected`].includes(Ge.item.status)&&(Ge.item.actionKind!==`heartbeat.bind`||Ge.item.status!==`applied`)&&S(e=>{let t={...e};return delete t[Ge.item.previewId],t}),v(!1),g(null)},onToggleInspectorSize:()=>v(e=>!e),readOnly:a,runs:Re.flatMap(e=>e.kind===`run`?[e.run]:[]),selection:Ge}):null,drawerMode:Ge?.kind===`todo`?_?`inspector-full`:`inspector`:`panel`,drawerOpen:Ge!==null,mobileSidebarOpen:ue,onCloseMobileSidebar:()=>z(!1),theme:de,main:(0,H.jsxs)(`div`,{className:`personal-channel`,children:[(0,H.jsx)(Oy,{agents:e,managerChatOpen:T,managerRuntime:r,mobileNavigationOpen:ue,onOpenGoalCapabilities:Fe?()=>g({goalId:Fe.goalId,kind:`settings`,tab:`capabilities`}):void 0,onOpenGoalDetail:Fe&&!Fe.loadState?()=>g({item:Fe,kind:`goal`}):void 0,onRefresh:t.onRefresh?()=>void ft():void 0,onOpenNavigation:()=>z(!0),onOpenManagerChat:()=>{O(!1),E(!0)},onSelectGoalTab:e=>{w(e),e===`chat`&&(b(null),ee(!1))},onSelectAgent:nt,onReturnManagerHome:()=>{E(!1),O(!1),window.requestAnimationFrame(()=>be.current?.scrollTo({behavior:`smooth`,top:0}))},selectedAgentId:Ee,refreshState:oe,readOnlySourceLabel:a?c?.activeSource.label:void 0,selectedGoal:Fe,selectedGoalTab:C}),(0,H.jsxs)(`div`,{className:`personal-channel-scroll`,ref:be,children:[!Fe&&!T&&we&&we.done+we.failed+we.attention>0?(0,H.jsxs)(`section`,{className:`personal-digest-card`,"aria-label":u(`digest.away`),children:[(0,H.jsx)(`strong`,{children:u(`digest.away`)}),(0,H.jsxs)(`div`,{className:`personal-digest-stats`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{children:we.done}),u(`digest.completed`)]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{children:we.failed}),u(`digest.failed`)]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{children:we.attention}),u(`digest.needsYou`)]})]})]}):null,!Fe&&!T?(0,H.jsxs)(`section`,{className:`personal-manager-greeting`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(Qp,{size:20})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:u(`home.greeting`)}),(0,H.jsx)(`p`,{children:i.goals.some(e=>e.activationState===`active`&&e.loadState)?u(`startup.partial`):(0,H.jsxs)(H.Fragment,{children:[u(`home.waitingCount`,{count:Ne}),` `,u(`home.blockingSummary`,{count:Pe})]})})]})]}):null,Fe?.loadState?(0,H.jsx)(`section`,{className:`personal-manager-greeting`,role:`status`,"data-testid":`goal-status-loading`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:u(Fe.loadState===`error`?`startup.goalError`:`startup.goalLoading`)}),(0,H.jsx)(`p`,{children:u(Fe.loadError?`startup.error.${Fe.loadError}`:`startup.independent`)}),Fe.loadState===`error`?(0,H.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,type:`button`,onClick:()=>void t.onRefresh?.(),children:u(`startup.retry`)}):null]})}):Fe&&C===`tasks`?(0,H.jsx)(kb,{historyEnabled:!a,goal:Fe,items:Re,onDraftTaskFromMessage:a?void 0:e=>{Ae(`创建一个 Task:${yx(e)}`),I(u(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>ye.current?.focus())},onOpenChat:()=>w(`chat`),onQuickComplete:a?void 0:Ze,onSelect:g,quickCompletingTodoIds:R,selectedTodoId:Ge?.kind===`todo`?Ge.item.todoId:null,userTodos:i.userTodos}):Fe&&C===`files`?(0,H.jsx)(Cx,{items:Re.filter(e=>e.kind===`output`),onSelect:g,reportState:i.periodicReports}):!Fe&&!T?(0,H.jsx)(Sx,{goals:Me,onRetry:()=>void t.onRefresh?.(),onSelectGoal:tt,systemHealth:i.systemHealth}):Fe?(0,H.jsxs)(H.Fragment,{children:[Fe&&y?.goalId===Fe.goalId?(0,H.jsx)(Tx,{onClose:()=>b(null),onOpenDetails:()=>g({item:y,kind:`run`}),run:y}):null,(0,H.jsx)(By,{items:ze,onSelect:g,selectedGoal:Fe})]}):(0,H.jsx)(By,{items:He,onSelect:g,selectedGoal:null})]}),(0,H.jsx)(`div`,{className:`personal-composer-wrap`,children:a?(0,H.jsxs)(`div`,{className:`personal-read-only-notice`,children:[(0,H.jsx)(`strong`,{children:u(`source.readOnlyNoticeTitle`)}),(0,H.jsx)(`span`,{children:u(`source.readOnlyNoticeDescription`)})]}):(0,H.jsxs)(H.Fragment,{children:[!Fe&&!T&&D&&Be.length?(0,H.jsx)(wx,{messages:Be,onClose:()=>O(!1),onOpenConversation:()=>{O(!1),E(!0)}}):null,Fe&&C!==`chat`&&k&&Ve.length?(0,H.jsx)(wx,{agentLabel:at,messages:Ve,onClose:()=>ee(!1),onDraftTask:C===`tasks`?e=>{Ae(`创建一个 Task:${yx(e)}`),I(u(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>ye.current?.focus())}:void 0,onOpenConversation:()=>{ee(!1),w(`chat`)},title:`${Fe.title} · ${at}`}):null,re?(0,H.jsxs)(`div`,{className:`personal-action-feedback`,role:`status`,children:[(0,H.jsx)(`span`,{children:re}),(0,H.jsx)(`button`,{"aria-label":u(`common.closeActionReceipt`),onClick:()=>I(null),type:`button`,children:(0,H.jsx)(eh,{size:14})})]}):null,(0,H.jsx)(`p`,{className:`personal-composer-hint`,children:Fe?st>0?u(`composer.goalRunningHint`,{agent:at,count:st}):u(`composer.goalMessageHint`,{agent:at}):u(`composer.managerMessageHint`)}),Fe?(0,H.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,H.jsxs)(`button`,{"aria-label":u(`composer.nextAction`),className:`is-draft`,onClick:()=>je(u(`composer.nextActionPrompt`)),title:u(`composer.prepareDraft`),type:`button`,children:[(0,H.jsx)(Dm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.nextAction`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]}),(0,H.jsxs)(`button`,{className:`is-immediate`,disabled:j,onClick:()=>void it(u(`composer.agentProgressPrompt`)),title:u(`composer.immediate`),type:`button`,children:[(0,H.jsx)(Vm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.agentProgress`)}),(0,H.jsx)(`em`,{className:`personal-prompt-badge`,children:u(`composer.immediate`)})]}),(0,H.jsxs)(`button`,{"aria-label":u(`composer.monitor`),className:`is-draft`,onClick:()=>Ye(`monitor`,B),title:u(`composer.monitorHint`),type:`button`,children:[(0,H.jsx)(em,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.monitor`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]})]}):(0,H.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,H.jsxs)(`button`,{"aria-label":u(`composer.globalTasks`),className:`is-draft`,onClick:()=>je(u(`composer.globalTasksPrompt`)),title:u(`composer.prepareDraft`),type:`button`,children:[(0,H.jsx)(Dm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.globalTasks`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]}),(0,H.jsxs)(`button`,{className:`is-immediate`,disabled:j,onClick:()=>void it(u(`composer.globalProgressPrompt`)),title:u(`composer.immediate`),type:`button`,children:[(0,H.jsx)(Vm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.globalProgress`)}),(0,H.jsx)(`em`,{className:`personal-prompt-badge`,children:u(`composer.immediate`)})]}),(0,H.jsxs)(`button`,{"aria-label":u(`composer.createGoal`),className:`is-draft`,onClick:qe,title:u(`composer.createGoalHint`),type:`button`,children:[(0,H.jsx)(Fm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.createGoal`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]})]}),ot?(0,H.jsxs)(`div`,{className:`personal-goal-draft-status`,role:`status`,children:[(0,H.jsx)(`strong`,{children:u(`composer.createGoalDraft`)}),(0,H.jsx)(`span`,{children:u(`composer.createGoalDraftDescription`)})]}):null,N.length?(0,H.jsx)(`div`,{className:`personal-composer-images`,"aria-label":u(`composer.imagesPending`),children:N.map(e=>(0,H.jsxs)(`figure`,{children:[(0,H.jsx)(`img`,{alt:e.name,src:e.dataUrl}),(0,H.jsx)(`button`,{"aria-label":u(`composer.sentImageAlt`,{name:e.name}),onClick:()=>P(t=>t.filter(t=>t.id!==e.id)),type:`button`,children:(0,H.jsx)(eh,{size:13})})]},e.id))}):null,F?(0,H.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:F}):null,(0,H.jsxs)(`div`,{className:`personal-channel-composer`,onDragOver:e=>{[...e.dataTransfer.items].some(e=>e.kind===`file`&&e.type.startsWith(`image/`))&&e.preventDefault()},onDrop:e=>{let t=[...e.dataTransfer.files].filter(e=>e.type.startsWith(`image/`));t.length&&(e.preventDefault(),ct(t))},children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:17}),e.find(e=>e.agentId===Ee)?.label??Ee]}),(0,H.jsx)(`button`,{"aria-label":u(`composer.addImage`),className:`personal-composer-attach`,disabled:j||N.length>=Wx,onClick:()=>xe.current?.click(),title:u(`composer.attachImageHint`),type:`button`,children:(0,H.jsx)(Mm,{size:17})}),(0,H.jsx)(`input`,{accept:`image/png,image/jpeg,image/webp,image/gif`,"aria-label":u(`composer.imagePicker`),className:`personal-composer-file-input`,disabled:j||N.length>=Wx,multiple:!0,onChange:e=>void ct(e.target.files),ref:xe,type:`file`}),(0,H.jsx)(`textarea`,{"aria-label":u(`composer.sendMessage`),onChange:e=>Ae(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),it())},onPaste:lt,placeholder:Fe?u(`composer.goalPlaceholder`,{goal:Fe.title}):u(`composer.managerPlaceholder`),ref:ye,rows:1,value:Oe}),(0,H.jsx)(`button`,{"aria-label":u(ot?`composer.createGoal`:`composer.send`),disabled:!Oe.trim()&&N.length===0||j,onClick:()=>void it(),title:u(ot?`composer.createGoalHint`:`composer.sendMessageHint`),type:`button`,children:(0,H.jsx)(Vm,{size:18})})]})]})})]}),sidebar:(0,H.jsx)(Tb,{attentionCount:Ne,goals:Me,goalArchiveLoadState:n,goalLifecycleOperations:t.onExecuteGoalLifecycle?[`stop`,`resume`]:void 0,lifecycleBusyGoalIds:L,onRequestGoalCreate:a?void 0:qe,onRequestGoalLifecycle:a&&!t.onExecuteGoalLifecycle?void 0:(e,t)=>void Je(e,t),onRetryGoalArchive:t.onRetryGoalArchive||t.onRefresh?()=>void(t.onRetryGoalArchive??t.onRefresh)?.():void 0,onOpenSettings:a?void 0:()=>g({kind:`settings`}),onSelectGoal:tt,selectedGoalId:B,statusSourceControl:c},c?.activeSource.statusUrl??`/status.json`)})}function qx(e){return(e??``).replace(/\s+/gu,` `).trim()}function Jx(e,t=120){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t-1).join(``)}…`}function Yx(e,t,n){let r=qx(e);return!r||r===`暂无`?n?t(n):``:/refresh-state|latest_run|latest run-derived/iu.test(r)?t(`projection.refreshState`):/first read-only adapter tick|read-only adapter/iu.test(r)?t(`projection.firstReadOnlyAdapterCheck`):/todo update recorded for/iu.test(r)?t(`projection.todoStatusUpdated`):/^(loopx|python3|npm|git|run)\s|\s--[a-z0-9-]+|\b[a-z]+_[a-z_]+\b/iu.test(r)?t(n??`projection.agentPreparingNextStep`):Jx(r)}function Xx(e,t){return t({advancing:`projection.agentAdvancingGoal`,idle:`projection.agentIdle`,needs_you:`projection.agentNeedsDecision`,stopped:`projection.agentStopped`,waiting_external:`projection.agentWaitingExternal`}[e])}function Zx({eventCount:e,hasArtifact:t,hasLatestValidation:n},r){return{label:r(n?`projection.latestValidation`:`projection.latestRun`),metadata:e>0?r(`projection.events24h`,{count:e}):r(t?`projection.runEvidenceAvailable`:`projection.publicSafeProjection`)}}var Qx=`/status.json`,$x=`loopx-status-source-catalog-v1`,eS={id:`local`,kind:`local`,label:`本机`,readOnly:!1,statusUrl:Qx};function tS(e,t){let n=ah(e,t).source;if(!n||!n.isLoopback||n.isRelative)return{error:`SSH 隧道来源必须使用显式的 localhost、127.0.0.1 或 ::1 URL。`};let r=new URL(n.url,t);return[`http:`,`https:`].includes(r.protocol)?{url:r.toString()}:{error:`状态来源只支持 HTTP 或 HTTPS。`}}function nS(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return`ssh-${(t>>>0).toString(36)}`}function rS(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return null;let n=e;if(n.kind!==`ssh_tunnel`||typeof n.label!=`string`||typeof n.statusUrl!=`string`)return null;let r=n.label.trim(),i=tS(n.statusUrl,t);if(!r||r.length>48||!(`url`in i))return null;let a=hb(n.hostAlias)?n.hostAlias.trim():void 0;return{...a?{hostAlias:a}:{},id:nS(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url}}function iS(){return{schemaVersion:1,sources:[eS]}}function aS(e,t){try{let n=e.getItem($x);if(!n)return iS();let r=JSON.parse(n);if(r.schemaVersion!==1||!Array.isArray(r.sources))return iS();let i=new Set([eS.statusUrl]);return{schemaVersion:1,sources:[eS,...r.sources.flatMap(e=>{let n=rS(e,t);return!n||i.has(n.statusUrl)?[]:(i.add(n.statusUrl),[n])})]}}catch{return iS()}}function oS(e,t){e.setItem($x,JSON.stringify({schemaVersion:1,sources:t.sources.filter(e=>e.kind===`ssh_tunnel`)}))}function sS(e,t){let n=new Set(t.filter(hb).map(e=>e.trim())),r=!1,i=e.sources.map(e=>e.kind!==`ssh_tunnel`||e.hostAlias||!n.has(e.label)?e:(r=!0,{...e,hostAlias:e.label}));return r?{...e,sources:i}:e}function cS(e,t,n){let r=t.label.trim();if(!r)return{error:`请填写来源名称。`};if(r.length>48)return{error:`来源名称不能超过 48 个字符。`};let i=tS(t.statusUrl,n);if(!(`url`in i))return i;if(e.sources.some(e=>e.statusUrl===i.url))return{error:`这个状态 URL 已经在来源目录中。`};if(t.hostAlias!==void 0&&!hb(t.hostAlias))return{error:`请选择有效的 SSH Host。`};let a=t.hostAlias?.trim(),o={...a?{hostAlias:a}:{},id:nS(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url};return{catalog:{...e,sources:[...e.sources,o]},source:o}}function lS(e,t){return{...e,sources:e.sources.filter(e=>e.kind===`local`||e.id!==t)}}function uS(e,t,n){if(!t.trim()||ah(t,n).source?.isRelative)return eS;let r=t.trim();try{r=new URL(r,n).toString()}catch{return null}return e.sources.find(e=>e.statusUrl===r)??null}function dS(e,t,n){return uS(e,t,n)||(ah(t,n).source?.isRelative?eS:{id:`temporary`,kind:`ssh_tunnel`,label:`临时来源`,readOnly:!0,statusUrl:t.trim()})}function fS(e,t,n,r){return dS(e,t??n,r)}var pS={delete:`删除`,deploy:`部署`,merge:`合并`,payment:`付款`,release:`发布`};function mS(e,t,n){let r=t.replace(/\s+/gu,` `).trim().toLowerCase(),i=n.target.replace(/\s+/gu,` `).trim().toLowerCase();return!i||!r.includes(i)?null:{actionKind:`goal.update`,context:{goal_id:e,kind:`goal`,natural_language:t,semantic_proposal:{operation:n.operation,target:n.target}},idempotencyKey:`workspace-semantic-protected-${e}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e,status:`operator_gate_requested`},summary:`请求受保护操作:${pS[n.operation]} · ${n.target}`}}var hS=Qx;async function gS(e){let t=await fetch(e,{cache:`no-store`,signal:AbortSignal.timeout(3e4)});if(!t.ok)throw Error(`HTTP ${t.status} while loading ${e}`);return Ep(await t.json())}function _S(e,t){if(t?.controller_readiness?.decision_advisor_ready||t?.controller_readiness?.write_controller_ready)return`controller_ready`;if(t?.controller_readiness)return`controller_gated`;if(t?.human_reward)return`reward_judged`;if(t?.operator_gate?.decision===`approve`)return`operator_approved`;if(t?.operator_gate)return`operator_gated`;let n=e||t?.classification||``;return n===`connected_without_run`?`connected`:n===`read_only_project_map`||t?.project_map?`mapped`:n===`state_refreshed`?`refreshed`:n&&n!==`no_status`?`adapter_inspected`:`registered`}function vS(e,t){let n=new Map(t.map(e=>[e.goal_id,e])),r=new Set,i=e.map(e=>{r.add(e.id);let t=n.get(e.id),i=e.latest_runs[0],a=t?.lifecycle_phase??e.lifecycle_phase??i?.lifecycle_phase??_S(t?.status??i?.classification??e.status,i),o=t?.lifecycle_flags?.length?t.lifecycle_flags:e.lifecycle_flags?.length?e.lifecycle_flags:i?.lifecycle_flags?.length?i.lifecycle_flags:[a];return{goal:e,queueItem:t,latestRun:i,status:t?.status??i?.classification??e.status??`no_status`,waitingOn:t?.waiting_on??`clear`,severity:t?.severity??`clear`,lifecyclePhase:a,lifecycleFlags:o}});for(let e of t)r.has(e.goal_id)||i.push({goal:{activation_state:e.activation_state,id:e.goal_id,status:e.status,display_name:e.goal_id,latest_runs:[],lifecycle_flags:[e.lifecycle_phase??`registered`],registry_member:!0,legacy_runtime_goal:!1,index_exists:!1,raw_index_records:0,unique_runs:0},queueItem:e,status:e.status,waitingOn:e.waiting_on,severity:e.severity,lifecyclePhase:e.lifecycle_phase??`registered`,lifecycleFlags:e.lifecycle_flags??[`registered`]});return i}function yS(e){return(e??``).replace(/\s+/g,` `).trim()}function bS(e,t=132){let n=yS(e);return n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}…`}function xS(e){let t=new Map;for(let n of e?.goals??[])t.set(n.goal_id,n);return t}function SS(e,t){return e===void 0||t===void 0?void 0:e+t}function CS(e,t){if(!e)return null;let n=t===`user`?e.queueItem?.project_asset?.user_todos:e.queueItem?.project_asset?.agent_todos;if(n?.items?.length)return{done_count:n.done??n.items.filter(e=>e.done).length,items:n.items,open_count:n.open??n.items.filter(e=>!e.done).length,total_count:n.total??n.items.length};let r=t===`user`?e.queueItem?.user_todos:e.queueItem?.agent_todos;return r?.items?.length?r:null}function wS(e){return e?.items.find(e=>!e.done)}function TS(e,t,n=`todos`){return e?.items?.length?{advancement_done_count:e.advancement_done_count??t?.advancement_done_count,done_count:e.done??e.items.filter(e=>e.done).length,items:e.items,open_count:e.open??e.items.filter(e=>!e.done).length,total_count:e.total??e.items.length}:t??null}function ES(e){return e?.queueItem?.project_asset?.quota?.state??e?.queueItem?.quota?.state??e?.goal.quota?.state??`waiting`}function DS(e,t,n){let r=[];for(let t of e){let e=CS(t,`agent`);for(let n of e?.items??[])r.push({goalId:t.goal.id,role:`agent`,todo:n})}let i=new Map;for(let e of r){let t=e.todo.claimed_by||`codex`,n=i.get(t)??[];n.push(e),i.set(t,n)}let a=new Map((n?.agents??[]).map(e=>[e.agent_id,e]));return Array.from(new Set([...i.keys(),...a.keys()])).map(e=>{let t=i.get(e)??[],n=a.get(e),r=Array.from(new Set([...t.map(e=>e.goalId),n?.current_todo?.goal_id,...n?.goal_ids??[]].filter(Boolean))),o=(t.filter(e=>!e.todo.done)[0]??t[0])?.goalId??n?.current_todo?.goal_id??r[0]??``,s=n?.last_activity_at??null;return{agentId:e,claimedTodos:t,currentTodo:n?.current_todo??null,evidenceRefs:[],goalIds:r,handoffNote:null,lastActivity:s,nextSafeAction:n?.next_action?.trim()||`Inspect status projection before taking work`,primaryGoalId:o,quotaHints:[],staleClaimHint:null,status:{label:`可用`,summary:`正常运行`,variant:`success`},workspaceRef:null}})}function OS(e){return e?.map(e=>({dataUrl:e.data_url,id:e.id,mimeType:e.mime_type,name:e.name,size:e.size}))}var kS=`loopx.personal-agent-selection.v1`;function AS(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(kS)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[0]==`string`&&typeof e[1]==`string`))}catch{return{}}}var jS={需修复:`danger`,等你:`warning`,等待条件:`info`,推进中:`success`,安静运行:`neutral`,已停止:`neutral`,已完成:`neutral`};function MS(e,t){return yS(t)||e.replace(/^loopx[-_]/i,`LoopX `).split(/[-_]+/).filter(Boolean).map((e,t)=>t===0?`${e.slice(0,1).toUpperCase()}${e.slice(1)}`:e).join(` `)}function NS(e){return e.split(/\r?\n/u).filter(e=>!/^\s*GOAL_(STATUS|PROGRESS)\s*:/u.test(e)).map(e=>/^\s*GOAL_EVIDENCE\s*:/u.test(e)?e.replace(/^\s*GOAL_EVIDENCE\s*:/u,`验证依据:`):/^\s*NEXT_ACTION\s*:/u.test(e)?e.replace(/^\s*NEXT_ACTION\s*:/u,`下一步:`):e).join(` -`).trim()}function PS(e,t){return[`agent`,`assistant`].includes(e.trim().toLowerCase())&&t.trim().length>0}var FS=`已发现的项目 Agent`;function IS(e){switch(ly(e)){case`codex`:return`Codex`;case`claude`:return`Claude Code`;case`kiro`:return`Kiro CLI`;case`trae`:return`Trae CLI Agent`;case`coco`:return`Coco Agent`;default:return MS(e)}}function LS(e,t){switch(uy(e,t)){case`codex`:return`代码与项目执行`;case`claude`:return`复杂分析与长任务`;case`openai`:case`anthropic`:return`管家问答 · 无工具`;case`kiro`:return`终端编码 · 原生 /goal 循环`;case`trae`:return`前端与交互实现`;case`coco`:return`通用任务`;default:return FS}}function RS(e,t){let n=e.project_asset;return t===`user`?TS(n?.user_todos,e.user_todos,`project_asset.user_todos`):TS(n?.agent_todos,e.agent_todos,`project_asset.agent_todos`)}function zS(e){return bS(e.title??e.text,112)}function BS(e){let t=e.resume_condition?.resume_receipt;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.receipt_id;return typeof n==`string`&&n.trim()?n.trim():null}function VS(e,t){return{resumeWhen:e.resume_when??null,resumeReady:e.resume_ready??null,resumeReceiptId:BS(e),claimedBy:e.claimed_by??null,done:e.status!==`deferred`&&e.done,evidence:e.evidence?bS(e.evidence,96):null,index:e.index,priority:e.priority??null,status:e.status??null,taskClass:e.task_class??null,taskDomain:e.task_domain??null,text:zS(e),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.index}`}}function HS(e){let t=e.queueItem?.agent_todos,n=t?.items??e.queueItem?.project_asset?.agent_todos?.items??[],r=new Map(n.map(t=>[t.todo_id?.trim()||`${e.goal.id}:agent:${t.index}`,t]));for(let n of t?.deferred_items??[]){let t=n.todo_id?.trim()||`${e.goal.id}:agent:${n.index}`;r.has(t)||r.set(t,n)}return[...r.values()]}function US(e){return HS(e).map(t=>VS(t,e))}function WS(e,t,n){let r=new Map;for(let n of e.todo_index?.items??[]){if(n.goal_id!==t.goal.id||n.role!==`agent`)continue;let e=VS(n,t);r.set(e.todoId,e)}for(let e of n)r.has(e.todoId)||r.set(e.todoId,e);let i=new Map;for(let e of r.values()){if(e.done||e.taskClass!==`advancement_task`)continue;let t=e.taskDomain?.trim();t&&i.set(t,(i.get(t)??0)+1)}return[...i].map(([e,t])=>({domain:e,matchingTodoCount:t}))}function GS(e,t){return{claimedBy:e.claimed_by??null,done:e.status===`done`||e.status===`completed`,index:-1,priority:e.priority??null,status:e.status??null,taskClass:e.task_class??null,text:bS(e.title,112),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.claimed_by??`unknown`}:current`}}function KS(e,t,n){let r=new Map(e.map(e=>[e.todoId,e]));for(let e of t){let t=e.currentTodo;if(!t||t.goal_id!==n.goal.id)continue;let i=GS(t,n);r.has(i.todoId)||r.set(i.todoId,i)}return[...r.values()]}function qS(e){let t=e.queueItem?.project_asset?.agent_todos,n=e.queueItem?.agent_todos,r=HS(e),i=t?.advancement_done_count??n?.advancement_done_count??t?.done??n?.done_count??null,a=r.filter(e=>e.done&&e.status!==`deferred`).length,o=Math.max(i??0,a),s=new Set(r.map(e=>e.todo_id?.trim()).filter(e=>!!e)),c=(t?.recent_completed_advancement_items??[]).filter(e=>!e.todo_id?.trim()||!s.has(e.todo_id.trim())).map(t=>VS(t,e)),l=r.find(e=>!e.done);return{doneTodoCount:o,nextTodoText:yS(t?.next??``)||(l?yS(l.title??``)||yS(l.text??``):``)||null,recentCompleted:c}}function JS(e,t){let n=yS(e);return n?/\b(state_file|registry_goal|authority_sources|source_registry)\b|\b[a-z_]+\s+\d+\/\d+/i.test(n)?t(`projection.goalVerified`):Yx(n,t,`projection.validationRecorded`):``}function YS(e,t=4){if(e.length<=t)return e;let n=e.findIndex(e=>!e.done);if(n<0)return e.slice(-t);let r=Math.max(0,Math.min(n-2,e.length-t));return e.slice(r,r+t)}function XS(e,t,n){let r=t.queueItem?.project_asset?.latest_validation,i=t.latestRun,a=e.event_ledger_summary?.goals.find(e=>e.goal_id===t.goal.id);if(!r&&!i&&!a)return null;let o=[JS(r?.summary,n),Yx(i?.health_check,n),Yx(i?.recommended_action,n)].find(e=>e!==``&&e!==`暂无`)??n(`projection.runRecorded`),s=Zx({eventCount:a?.events_24h??0,hasArtifact:!!(i?.json_exists||i?.markdown_exists),hasLatestValidation:!!r},n);return{generatedAt:r?.generated_at??i?.generated_at??a?.latest_event_at??``,label:s.label,metadata:s.metadata,runId:i?`${t.goal.id}:${i.generated_at}`:null,safePreview:[o,s.metadata].filter(Boolean).join(` -`),summary:o,todoId:t.queueItem?.project_asset?.agent_todos?.items.find(e=>!e.done)?.todo_id??null}}function ZS(e){return[e.status,e.goal.status,e.latestRun?.classification,e.lifecyclePhase].filter(Boolean).some(e=>/(^|[_\s-])(done|complete|completed|finished|terminal|closed|success)([_\s-]|$)/i.test(e??``))}function QS(e,t){return e.global_registry?.findings?.find(e=>e.severity===`high`&&(e.goal_id===t.goal.id||e.goal_ids.includes(t.goal.id)))}function $S(e){return[e.status,e.goal.status,e.latestRun?.classification,e.lifecyclePhase].filter(Boolean).some(e=>/(^|[_\s-])(failure|failed|error|broken|unhealthy|blocked[_\s-]?health|health[_\s-]?blocked)([_\s-]|$)/i.test(e??``))}function eC(e,t){let n=t.queueItem?.stale_latest_run_warning;return t.severity===`high`||!!QS(e,t)||!!(n?.requires_refresh_state||n?.severity===`high`)||$S(t)}function tC(e,t){let n=QS(e,t);return t.queueItem?.stale_latest_run_warning?.recommended_action??t.queueItem?.stale_latest_run_warning?.reason??n?.recommended_action??n?.message??t.queueItem?.recommended_action??t.latestRun?.recommended_action??null}function nC(e){let t=e.latestRun?.operator_gate,n=t?.decision?.trim().toLowerCase()??``,r=new Set([`approve`,`approved`,`reject`,`rejected`,`defer`,`deferred`,`cancel`,`cancelled`]),i=[e.queueItem?.recommended_action,e.latestRun?.recommended_action].filter(Boolean).join(` `),a=/(?:等待|需要)(?:用户|你|owner).{0,24}(?:批准|确认|授权|补充|选择|决定)|(?:批准|确认|授权).{0,16}(?:后|才能|方可)/i.test(i);return!!(t&&!r.has(n))||e.lifecyclePhase===`operator_gated`&&!r.has(n)||a}function rC(e,t){let n=e.latestRun?.operator_gate;return Yx(n?.operator_question??n?.reason_summary??n?.follow_up??e.queueItem?.recommended_action??e.latestRun?.recommended_action,t,`projection.confirmAgentDecision`)}function iC(e,t){if(t.goal.activation_state===`stopped`)return`已停止`;let n=CS(t,`user`),r=CS(t,`agent`),i=!!wS(n),a=!!wS(r);return[`user_or_controller`,`controller`].includes(t.waitingOn)||i||nC(t)?`等你`:eC(e,t)?`需修复`:t.waitingOn===`external_evidence`?`等待条件`:ES(t)===`eligible`||a?`推进中`:ZS(t)?`已完成`:`安静运行`}function aC(e,t,n,r){if(n===`已停止`)return Xx(`stopped`,r);if(n===`需修复`)return Yx(tC(e,t),r,`projection.statusRefreshNeeded`);if(n===`等你`)return Xx(`needs_you`,r);if(n===`推进中`){let e=[(CS(t,`agent`)?.items??[]).filter(e=>!e.done).flatMap(e=>[e.title,e.text]).map(e=>yS(e)).find(e=>e!==``&&e!==`暂无`),t.queueItem?.recommended_action,t.latestRun?.recommended_action].map(e=>yS(e)).find(e=>e!==``&&e!==`暂无`);return e?Yx(e,r,`projection.agentAdvancingGoal`):Xx(`advancing`,r)}return Xx(n===`等待条件`?`waiting_external`:`idle`,r)}function oC(e,t){return t.some(t=>e.includes(t))}function sC(e,t,n){if(t.goals.some(e=>e.activationState===`active`&&e.loadState))return{text:`Goal 状态尚未全部加载,暂不能给出完整统计。可先打开已加载的 Goal,失败项可重试。`,lines:[]};if(oC(n,[`Agent`,`agent`,`推进`,`在做`])){let e=t.goals.filter(e=>![`安静运行`,`已完成`,`已停止`].includes(e.state)),n=(e.length>0?e:t.goals).slice(0,3);return n.length===0?{text:`当前状态里还没有 Goal 可供汇总。`,lines:[]}:{text:e.length>0?`Agent 当前关注这些 Goal:`:`当前 Goal 都比较安静:`,lines:n.map(e=>`${e.title} · ${e.state} · ${e.agentSentence}`)}}if(oC(n,[`现在`,`下一步`,`我该`,`该做什么`,`优先处理`])){let e=t.userTodos[0];if(e)return{text:e.blocking?`先处理「${MS(e.goalId)}」:${e.text}`:`当前最先处理「${MS(e.goalId)}」:${e.text}`,lines:[]};let n=t.goals.find(e=>e.state===`需修复`);if(n)return{text:`没有待办,但这个 Goal 需要先修复。`,lines:[`${n.title} · ${n.agentSentence}`]};let r=t.goals.find(e=>e.state===`推进中`);return r?{text:`目前不需要你介入,Agent 正在推进。`,lines:[`${r.title} · ${r.agentSentence}`]}:{text:`当前系统很安静,没有需要你立即处理的事项。`,lines:[]}}if(oC(n,[`等我`,`阻塞`,`需要我`,`全局待办`]))return t.userTodos.length===0?{text:`目前没有 Goal 在等你,开放用户待办为 0。`,lines:[]}:{text:`有 ${t.userTodos.length} 项开放用户待办,阻塞项优先:`,lines:t.userTodos.slice(0,3).map(e=>`${MS(e.goalId)} · ${e.blocking?`阻塞`:`待处理`} · ${e.text}`)};if(oC(n,[`状态`,`异常`,`修复`,`健康`])){let n=t.systemHealth?!t.systemHealth.ok:!e.ok||!e.contract?.ok||!e.global_registry?.ok||(e.global_registry?.summary?.high??0)>0,r=t.goals.filter(e=>e.state===`需修复`),i=r.slice(0,n?2:3).map(e=>`${e.title} · ${e.agentSentence}`);return n&&i.push(`全局状态、契约或注册表健康检查未通过,请进入管理页检查。`),i.length===0?{text:`当前没有发现 Goal 级或全局健康异常。`,lines:[]}:{text:r.length>0?`当前需要关注这些健康问题:`:`Goal 状态正常,但全局健康需要检查:`,lines:i}}return{text:`当前管家支持三类问题:下一步、等待你的事项、Agent 与健康状态。`,lines:[`问“我现在该做什么?”`,`问“哪些 Goal 在等我?”`,`问“Agent 在做什么?”或当前健康状态`]}}function cC(e,t,n,r=!1){let i=new Map(t.map(e=>[e.goal.id,e])),a=new Set(e.run_history.goals.filter(e=>e.activation_state===`stopped`).map(e=>e.id)),o=xS(e.usage_summary),s=DS(t,e.todo_index,e.agent_management_projection),c=e.attention_queue.items.flatMap((e,t)=>{if(a.has(e.goal_id))return[];let n=[`user_or_controller`,`controller`].includes(e.waiting_on);return(RS(e,`user`)?.items??[]).map((r,i)=>({projectedDone:r.done,details:Ud(r),actionKind:r.action_kind??null,blocking:n,goalId:e.goal_id,sourceOrder:t,taskClass:r.task_class??null,text:zS(r),todoId:r.todo_id?.trim()||`${e.goal_id}:user:${r.index}`,todoOrder:i,updatedAt:r.updated_at??null}))}),l=c.filter(e=>!e.projectedDone),u=new Set(l.map(e=>e.goalId)),d=t.flatMap((t,r)=>a.has(t.goal.id)||u.has(t.goal.id)||!nC(t)?[]:[{details:Ud({task_class:`user_gate`,status:`open`,note:t.latestRun?.operator_gate?.reason_summary}),actionKind:`gate.resolve`,blocking:!0,goalId:t.goal.id,sourceOrder:e.attention_queue.items.length+r,taskClass:`user_gate`,text:rC(t,n),todoId:`${t.goal.id}:operator-gate`,todoOrder:0,updatedAt:t.latestRun?.operator_gate?.recorded_at??t.latestRun?.generated_at??null}]),f=[...l,...d].sort((e,t)=>Number(t.blocking)-Number(e.blocking)||e.sourceOrder-t.sourceOrder||e.todoOrder-t.todoOrder),p=e.run_history.goals.flatMap(t=>{if(t.registry_member===!1)return[];let a=i.get(t.id);if(!a)return[];let c=iC(e,a),l=f.find(e=>e.goalId===t.id),u=l?.text??null,d=qS(a),p=t.coordination?.registered_agents??[],m=new Set(p),h=[...s.filter(e=>e.goalIds.includes(t.id)&&!/unassigned|unknown/i.test(e.agentId)&&(m.size===0||m.has(e.agentId))&&(e.currentTodo?.goal_id===t.id||e.claimedTodos.some(e=>e.goalId===t.id)))].sort((e,t)=>(t.lastActivity??``).localeCompare(e.lastActivity??``)),g=new Set(h.map(e=>e.agentId)),_=[...h.map(e=>({agentId:e.agentId,label:e.agentId,lastActivityAt:e.lastActivity,state:e.status.label})),...p.filter(e=>!g.has(e)).map(e=>({agentId:e,label:e,lastActivityAt:null,state:`registered`}))],v=h[0],y=KS(US(a),h,a),b=[d.nextTodoText,a.queueItem?.recommended_action,a.latestRun?.recommended_action,aC(e,a,c,n)].map(e=>Yx(e,n)).find(e=>e!==``&&e!==`暂无`)??n(`projection.nextUpdatePending`);return[{activationState:t.activation_state,agentId:v?.agentId??p[0]??`codex`,agentLaneCount:_.length,agentLanes:_,agentLabel:v?.agentId,agentSentence:aC(e,a,c,n),agentTodos:[...y,...d.recentCompleted],doneTodoCount:d.doneTodoCount,acceptanceObservation:t.acceptance_observation,goalId:t.id,latestActivity:a.latestRun?.generated_at??``,needsYou:u,needsYouActionKind:l?.actionKind??null,needsYouBlocking:l?.blocking??!1,needsYouTaskClass:l?.taskClass??null,needsYouTodoId:l?.todoId??null,nextSentence:b,runEvidence:XS(e,a,n),state:c,...r?{subagentExecution:{allowedDomains:t.spawn_policy?.allowed_domains??[],domainCandidates:WS(e,a,y),enabled:t.spawn_policy?.mode===`multi_subagent`&&t.spawn_policy.spawn_allowed===!0&&t.spawn_policy.max_children>0,maxChildren:t.spawn_policy?.max_children??0,modelConfig:t.spawn_policy?.model_config}}:{},title:MS(t.id,t.display_name),usage:(()=>{let e=o.get(t.id);return e?{costUsd24h:e.cost_usd_24h,costUsd7d:e.cost_usd_7d,durationMs24h:e.duration_ms_24h,durationMs7d:e.duration_ms_7d,tokens24h:SS(e.input_tokens_24h,e.output_tokens_24h),tokens7d:SS(e.input_tokens_7d,e.output_tokens_7d)}:null})()}]}),m=[];if(e.ok||m.push(`状态载荷未标记为正常 (payload.ok === false)`),e.contract&&!e.contract.ok){let t=e.contract.summary,n=t?`${t.errors} 项错误 / ${t.warnings} 项警告`:e.contract.errors?.[0]||`请检查控制面契约`;m.push(`契约检查未通过: ${n}`)}if(e.global_registry){e.global_registry.ok||m.push(`注册表状态异常: ${e.global_registry.summary.high} 项高危`);for(let t of e.global_registry.findings||[])t.severity===`high`&&m.push(`[${t.kind}] ${t.message}`)}let h=e.decision_freshness_summary?.summary?.stale_count?`${e.decision_freshness_summary.summary.stale_count} 项决策状态已过期`:null,g=m.length===0&&!h,_={ok:g,summary:g?`所有控制面契约与注册表检查均正常`:`发现 ${m.length+ +!!h} 项系统健康关注点`,issues:m,freshnessWarning:h};return{blockingTodoCount:f.filter(e=>e.blocking).length,goalNotifications:(e.goal_channel_notification_projection?.goals??[]).map(e=>({goalId:e.goal_id,configured:e.configured,enabled:e.enabled,humanGateAutoNotifyEnabled:e.human_gate_auto_notify_enabled,lastNotifiedAt:e.last_notified_at??null,receiptCount:e.receipt_count,targetRef:e.target_ref??null})),goals:p,openUserTodoCount:f.length,systemHealth:_,attentionHistory:[...c,...d],userTodos:f,visibleUserTodos:f.slice(0,5),workers:(e.agent_management_projection?.agents??[]).map(e=>({agentId:e.agent_id,currentTodoGoalId:e.current_todo?.goal_id??null,currentTodoText:e.current_todo?.title?bS(e.current_todo.title,96):null,lastActivityAt:e.last_activity_at??null,state:e.state??null}))}}function lC({goalArchiveLoadState:e,isLoading:t,onGoalActivationStateChange:n,onGoalDeleted:r,onSelectGoal:i,onReconcileStatus:a,onRefresh:o,onRetryGoalArchive:s,payload:c,progress:l,rows:u,selectedGoalId:d,statusSourceControl:f,theme:p,toggleTheme:m}){let h=f.activeSource.readOnly,g=f.activeSource.kind===`ssh_tunnel`?f.activeSource.hostAlias:void 0,{t:_}=qi(),[v,y]=(0,V.useState)([]),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(null),w=(0,V.useMemo)(()=>{let e=cC(c,u,_,b);if(!l)return e;let t=Object.values(l.snapshots).map(e=>cC(e,vS(e.run_history.goals,e.attention_queue.items),_,b)),n=new Map(t.flatMap(e=>e.goals).map(e=>[e.goalId,e])),r=e.goals.map(e=>n.get(e.goalId)??{...e,loadError:l.errors[e.goalId],loadState:l.errors[e.goalId]?`error`:`loading`,agentId:``,agentSentence:``,nextSentence:``,subagentExecution:void 0}),i=t.flatMap(e=>e.userTodos),a=r.some(e=>e.activationState===`active`&&e.loadState),o=[...new Set(t.flatMap(e=>e.systemHealth?.issues??[]))];return{...e,goals:r,userTodos:i,attentionHistory:t.flatMap(e=>e.attentionHistory??e.userTodos),visibleUserTodos:i.slice(0,5),openUserTodoCount:i.length,blockingTodoCount:i.filter(e=>e.blocking).length,workers:[...new Map(t.flatMap(e=>e.workers??[]).map(e=>[e.agentId,e])).values()],goalNotifications:t.flatMap(e=>e.goalNotifications??[]),systemHealth:a||t.length===0?void 0:{ok:t.every(e=>e.systemHealth?.ok),issues:o,summary:o.length?`发现 ${o.length} 项系统健康关注点`:`状态检查已完成`,freshnessWarning:t.map(e=>e.systemHealth?.freshnessWarning).filter(Boolean).join(`;`)||null}}},[c,u,l,b,_]),T=w.goals.find(e=>e.goalId===d)??null,E=l?.snapshots[d]??c,[D,O]=(0,V.useState)(null),[k,ee]=(0,V.useState)(null),[te,A]=(0,V.useState)(!1),j=w.goals.some(e=>e.activationState===`active`&&e.loadState===`loading`)?`loading`:w.goals.map(e=>`${e.goalId}:${e.agentId}`).join(`|`),M=T?.goalId??`manager`;w.goals.some(e=>e.activationState===`active`&&e.loadState)||(w.systemHealth?!w.systemHealth.ok:!c.ok)||w.openUserTodoCount>0&&`${w.openUserTodoCount}${w.blockingTodoCount}`;let N=v.length>0?v.map(e=>({agentId:e.agent_id,adapterKind:e.adapter_kind,available:e.available,capability:LS(e.agent_id,e.adapter_kind),interrupt:e.interrupt,label:e.display_name,location:e.location,resume:e.resume,source:e.source,statusLabel:e.available?`可用`:`需要配置`,streaming:e.streaming,toolCalls:e.tool_calls,trustScope:e.trust_scope})):[{agentId:`codex`,available:!0,capability:LS(`codex`),label:`Codex`,statusLabel:`正在检测`}],P=[...N,{agentId:`status-only`,available:!0,capability:`不调用模型`,adapterKind:`status_projection`,interrupt:!1,label:`仅查状态`,resume:!0,statusLabel:`只读`,streaming:!1,toolCalls:!1,trustScope:`read_only`}],F=N.find(e=>e.label===`Codex`&&e.available)?.agentId??N.find(e=>e.available)?.agentId??`status-only`,[ne,re]=(0,V.useState)(AS),I=dh(P,ne[M]??F,F),[L,ie]=(0,V.useState)(!1),[R,ae]=(0,V.useState)(!1),[oe,se]=(0,V.useState)(`chat`),[ce,le]=(0,V.useState)(``),[ue,z]=(0,V.useState)({}),[de,fe]=(0,V.useState)({}),[pe,me]=(0,V.useState)(null),[he,ge]=(0,V.useState)({}),[_e,ve]=(0,V.useState)([]),[ye,be]=(0,V.useState)(null),[xe,Se]=(0,V.useState)({}),Ce=(0,V.useRef)(1),we=(0,V.useRef)(1),Te=(0,V.useRef)(new Map),B=(0,V.useRef)(new Set),Ee=(0,V.useRef)(new Map),De=(0,V.useRef)(new Map),Oe=(0,V.useRef)(new Set),ke=(0,V.useRef)(new Set),Ae=(0,V.useRef)(null),je=(0,V.useRef)(null),Me=(0,V.useRef)(null),Ne=(0,V.useRef)(null);(0,V.useRef)(null);let Pe=ue[M]??[];de[M];let Fe=T?w.userTodos.filter(e=>e.goalId===T.goalId):w.userTodos,Ie=T?.agentTodos??[];YS(Ie,T?.needsYou?3:4);let Le=Ie.filter(e=>e.done).length,Re=Ie.length>0?`${Le}/${Ie.length}`:`暂无计划`;T&&({...w},Fe.filter(e=>e.blocking).length,Fe.length),(0,V.useEffect)(()=>{let e=ih(f.activeSource.statusUrl,window.location.href),t=e.source?ch(E,e.source):null;if(!T||!t?.indexUrl||!t.detailUrl){O(null),ee(null),A(!1);return}let{detailUrl:n,indexUrl:r}=t,i=!1;return O(null),ee(null),A(!0),lh(r,T.goalId).then(async e=>{let t=e.items[0]?.detail_ref;return t?uh(n,t):null}).then(e=>{i||O(e)}).catch(e=>{i||ee(Dp(e))}).finally(()=>{i||A(!1)}),()=>{i=!0}},[E,T?.goalId,f.activeSource.statusUrl]);let ze=T?void 0:he[M]?.sessionId;(0,V.useEffect)(()=>{if(h||!ze)return;let e=!1,t,n=async()=>{try{let t=await Vh(ze);if(e)return;let n=t.messages.filter(e=>e.origin===`manager_followup`);z(e=>{let t=e[M]??[],r=new Set(t.map(e=>e.sourceMessageId)),i=n.filter(e=>!r.has(e.message_id));return i.length?{...e,[M]:[...t,...i.map(e=>({id:Ce.current++,sourceMessageId:e.message_id,role:`assistant`,agentLabel:I.label,sourceLabel:`管家交接回执`,text:NS(e.text),lines:[]}))]}:e})}catch{}finally{e||(t=setTimeout(n,3e3))}};return n(),()=>{e=!0,t&&clearTimeout(t)}},[h,ze,M,I.label]);function Be(e,t){ge(n=>{if(t===null){let t={...n};return delete t[e],t}return{...n,[e]:t}})}(0,V.useEffect)(()=>{if(h){y([]),x(!1),C(null);return}let e=!1;return Rh().then(t=>{if(!e){y(t.adapters??[]);let e=t.manager?.runtime;C(e?{schema_version:`manager_runtime_session_readback_v0`,runtime_profile:e.runtime_profile,configuration_revision:e.configuration_revision,status:e.status,sandbox:e.sandbox,standing_grant:e.standing_grant,tool_classes:e.tool_classes}:null),x(t.goal_subagent_configuration===`preview_locked`)}}).catch(()=>{e||x(!1)}),()=>{e=!0}},[h]),(0,V.useEffect)(()=>{try{window.localStorage.setItem(kS,JSON.stringify(ne))}catch{}},[ne]),(0,V.useEffect)(()=>{if(h||!I.available)return;let e=M,t=`${e}:${I.agentId}`,n=T?`goal`:`manager`,r=T?`goal.${T.goalId}`:`manager`,i=!1,a=null,o=null;return(async()=>{try{let s=await Wh({agentId:I.agentId,channelId:r,goalId:T?.goalId});if(i||(z(t=>(t[e]?.length??0)>0?t:{...t,[e]:s.messages.map(e=>({sourceMessageId:e.message_id,agentLabel:e.role===`user`?void 0:I.label,attachments:OS(e.attachments),id:Ce.current++,lines:[],role:e.role===`user`?`user`:`assistant`,sourceLabel:e.role===`user`?void 0:e.role===`error`?`本地会话记录`:`恢复的 ${I.label} 会话`,text:e.role===`user`?e.text:NS(e.text)}))}),I.agentId===`status-only`))return;let c=s.sessions[0];if(o=c?.session_id??null,c&&!c.resumable){B.current.add(t),Be(e,{agentId:I.agentId,resumable:!1,sessionId:c.session_id,status:`resume_failed`});return}let l=n===`manager`?``:T?.goalId??``;if(n===`goal`&&!l)return;let u=await Bh(l,I.agentId,`resume_latest`,n);if(i)return;n===`manager`&&u.session.manager_runtime&&C(u.session.manager_runtime),Te.current.set(t,u.session_id);let d=s.snapshots.find(e=>e.session.session_id===u.session_id),f=d?.session.active_turn_id??``;if(Be(e,{agentId:I.agentId,resumable:!0,sessionId:u.session_id,status:f?`running`:`ready`,turnId:f||void 0}),B.current.delete(t),!f)return;let p=`${u.session_id}:${f}`;if(ke.current.has(p))return;ke.current.add(p),Ee.current.set(e,f),Be(e,{agentId:I.agentId,resumable:!0,sessionId:u.session_id,status:`running`,turnId:f}),me(e),a=new AbortController,De.current.set(e,a);let m=``,h=Ve(e,{activity:[`正在恢复进行中的 Agent 回合`],agentLabel:I.label,lines:[],pending:!0,sourceLabel:`恢复的 ${I.label} 会话`,text:``});try{let t=await Zh(u.session_id,f,{signal:a.signal,onDelta:t=>{m+=t,He(e,h,{text:m})},onActivity:t=>{z(n=>({...n,[e]:(n[e]??[]).map(e=>e.id===h?{...e,activity:[...new Set([...e.activity??[],t])].slice(-6)}:e)}))}});if(i)return;He(e,h,{lines:t.response.gate?[t.response.gate.summary,t.response.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:t.response.message||m.trim()||`${I.label} 已完成分析。`});let n=w.goals.find(e=>e.goalId===d?.session.goal_id)??T??w.goals[0]??null;if(n&&t.response.proposals.length>0){let r=t.response.proposals.map(e=>({goalId:n.goalId,id:we.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));fe(t=>({...t,[e]:[...t[e]??[],...r]}))}}catch(t){if(i)return;He(e,h,{activity:[],lines:[],pending:!1,reconnect:t instanceof Eh&&t.payload.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t instanceof Error?t.message:`无法恢复进行中的 Agent 回合。`})}finally{ke.current.delete(p),Ee.current.get(e)===f&&Ee.current.delete(e),Be(e,{agentId:I.agentId,resumable:!0,sessionId:u.session_id,status:`ready`}),De.current.get(e)===a&&De.current.delete(e),i||me(t=>t===e?null:t)}}catch(n){if(i)return;n instanceof Eh&&n.payload.error_code===`resume_failed`&&(B.current.add(t),o&&Be(e,{agentId:I.agentId,resumable:!1,sessionId:o,status:`resume_failed`}))}})(),()=>{i=!0,a?.abort()}},[M,w.goals[0]?.goalId,h,T?.goalId,I.agentId,I.available,I.label]),(0,V.useEffect)(()=>{if(h||T||w.goals.length===0||j===`loading`)return;let e=!1;return Promise.all(w.goals.filter(e=>!e.loadState).map(async e=>{let t=await Hh({agentId:e.agentId,channelId:`goal.${e.goalId}`,goalId:e.goalId});return{goalId:e.goalId,session:t.sessions[0]??null}})).then(t=>{e||ge(e=>{let n={...e};for(let e of t)e.session&&(n[e.goalId]={agentId:e.session.agent_id,resumable:e.session.resumable,sessionId:e.session.session_id,status:e.session.active_turn_id?`running`:e.session.status,turnId:e.session.active_turn_id??void 0});return n})}).catch(()=>{}),()=>{e=!0}},[h,j,T?.goalId]),(0,V.useEffect)(()=>{if(be(null),h){ve([]),Se({});return}if(!T){ve([]),Se({});return}let e=!1,t=0,n=0;ve([]),Se({});let r=async()=>{if(!e){if(document.hidden){t=window.setTimeout(()=>void r(),1e4);return}try{let t=await Hh({goalId:T.goalId});if(!e){let r=t.sessions.filter(e=>e.channel_id?.startsWith(`task.`));ve(r);let i=await Promise.allSettled(r.map(e=>Vh(e.session_id)));if(!e){let e=i.some(e=>e.status===`rejected`);n=e?n+1:0,be(e?`partial`:null),Se(Object.fromEntries(i.flatMap((e,t)=>e.status===`fulfilled`?[[r[t].session_id,e.value]]:[])))}}}catch{n+=1,e||be(`offline`)}e||(t=window.setTimeout(()=>void r(),Math.min(3e4,2e3*2**Math.min(n,4))))}};return r(),()=>{e=!0,window.clearTimeout(t)}},[h,T?.goalId]),(0,V.useEffect)(()=>{if(!L)return;let e=window.requestAnimationFrame(()=>{Ae.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()});return()=>{window.cancelAnimationFrame(e),je.current?.focus()}},[L]),(0,V.useEffect)(()=>{if(!R)return;let e=window.requestAnimationFrame(()=>Me.current?.focus());return()=>{window.cancelAnimationFrame(e),Ne.current?.focus()}},[R]),(0,V.useEffect)(()=>{if(!L&&!R)return;let e=e=>{e.key===`Escape`&&(ie(!1),ae(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[L,R]);function Ve(e,t){let n=Ce.current++;return z(r=>({...r,[e]:[...r[e]??[],{...t,id:n,role:`assistant`}]})),n}function He(e,t,n){z(r=>({...r,[e]:(r[e]??[]).map(e=>e.id===t?{...e,...n}:e)}))}async function Ue(e,t){let n=e.trim();if(!n)return;let r=t&&`goalId`in t?t.goalId??`manager`:M,i=r===`manager`?null:w.goals.find(e=>e.goalId===r)??null,a=t?.agentId?dh(P,t.agentId,F):I,o=r===`manager`?w:i?{...w,blockingTodoCount:w.userTodos.filter(e=>e.goalId===i.goalId&&e.blocking).length,goals:[i],openUserTodoCount:w.userTodos.filter(e=>e.goalId===i.goalId).length,userTodos:w.userTodos.filter(e=>e.goalId===i.goalId),visibleUserTodos:w.userTodos.filter(e=>e.goalId===i.goalId)}:w,s=Ce.current++;if(z(e=>({...e,[r]:[...e[r]??[],{attachments:t?.attachments,id:s,lines:[],role:`user`,text:n}]})),le(``),me(r),a.agentId===`status-only`||!i&&r!==`manager`){let e=sC(E,o,n),t=a.agentId===`status-only`;Ve(r,{agentLabel:t?`仅查状态`:`LoopX 管家`,lines:e.lines.slice(0,3),sourceLabel:t?`LoopX 状态投影 · 仅查状态`:`LoopX 状态投影`,text:e.text}),zh({answer:[e.text,...e.lines.slice(0,3)].filter(Boolean).join(` -`),contextKind:r===`manager`?`manager`:`goal`,goalId:r===`manager`?void 0:r,question:n}).catch(()=>{}),me(null);return}let c=`${r}:${a.agentId}`,l=null;try{let e=Te.current.get(c);if(!e){let t=B.current.has(c)?`new`:`resume_latest`,n=await Bh(r===`manager`?``:i.goalId,a.agentId,t,r===`manager`?`manager`:`goal`);r===`manager`&&n.session.manager_runtime&&C(n.session.manager_runtime),e=n.session_id,Te.current.set(c,e),Be(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),B.current.delete(c)}let o=``;l=Ve(r,{activity:[`正在连接 Agent`],agentLabel:a.label,lines:[],pending:!0,sourceLabel:r===`manager`?`${a.label} 管家 · 跨 Goal`:`${a.label} Agent · ${MS(i.goalId)}`,text:``});let s=(await Yh(e,n,{attachments:t?.attachments,signal:(()=>{let e=new AbortController;return De.current.set(r,e),e.signal})(),onDelta:e=>{o+=e,l!==null&&He(r,l,{text:o})},onActivity:e=>{l!==null&&z(t=>({...t,[r]:(t[r]??[]).map(t=>t.id===l?{...t,activity:[...new Set([...t.activity??[],e])].slice(-6)}:t)}))},onPhase:(t,n)=>{Ee.current.set(r,n),Be(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`running`,turnId:n})}})).response;if(He(r,l,{lines:s.gate?[s.gate.summary,s.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:NS(s.message||o.trim())||`${a.label} 已完成分析。`}),s.proposals.length>0&&!i&&He(r,l,{lines:[`请进入要修改的 Goal,预览并确认具体变更。`]}),s.proposals.length>0&&i){let e=s.proposals.map(e=>({goalId:i.goalId,id:we.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));fe(t=>({...t,[r]:[...t[r]??[],...e]}))}if(r!==`manager`&&s.protected_action){let e=mS(r,n,s.protected_action);if(e)return e}}catch(e){if(Oe.current.delete(r)){let e={agentLabel:a.label,lines:[],pending:!1,sourceLabel:`${a.label} 会话`,text:`已中断。你可以在当前会话继续发送消息。`};l===null?Ve(r,e):He(r,l,e);return}let t=e instanceof Eh?e.payload:null;t&&fh(t)&&Te.current.delete(c),t?.error_code===`resume_failed`&&(Te.current.delete(c),B.current.add(c),Be(r,{agentId:a.agentId,resumable:!1,sessionId:he[r]?.sessionId??`resume-failed`,status:`resume_failed`}));let n=t?.gate,i=n&&typeof n==`object`?String(n.summary??``):``,o={agentLabel:a.label,lines:i?[i]:[],pending:!1,reconnect:t?.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t?.error_code===`resume_failed`?`原 ${a.label} 会话无法恢复。本地历史已经保留,请在运行详情里选择“重试恢复”或“开始新 Session”。`:e instanceof Error?e.message:`${a.label} 会话暂时不可用。`};l===null?Ve(r,o):He(r,l,o)}finally{Ee.current.delete(r),De.current.delete(r);let e=Te.current.get(c);e&&Be(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),me(e=>e===r?null:e)}}async function We(e){let t=e?.goalId??M,n=he[t],r=e?.agentId??n?.agentId??I.agentId,i=`${t}:${r}`,a=e?.sessionId??n?.sessionId??Te.current.get(i),o=e?.turnId??n?.turnId??Ee.current.get(t);if(!(!a||!o))try{Oe.current.add(t),await Jh(a,o),De.current.get(t)?.abort()}catch(e){throw Oe.current.delete(t),e}finally{Ee.current.delete(t),Be(t,{agentId:r,resumable:!0,sessionId:a,status:`ready`}),De.current.delete(t),me(e=>e===t?null:e)}}async function Ge(e){let t=e.goalId,n=`${t}:${e.agentId}`,r=e.sessionId??he[t]?.sessionId??Te.current.get(n);if(r)try{let i=await $h(r);Te.current.set(n,r),B.current.delete(n),Be(t,{agentId:e.agentId,resumable:i.session.resumable,sessionId:r,status:i.session.status})}catch{Be(t,{agentId:e.agentId,resumable:!1,sessionId:r,status:`resume_failed`})}}function Ke(e){let t=`${e.goalId}:${e.agentId}`;Te.current.delete(t),B.current.add(t),Be(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:`new-session-pending`,status:`ready`})}async function qe(e){let t=`${e.goalId}:${e.agentId}`,n=e.sessionId??he[e.goalId]?.sessionId??Te.current.get(t);n&&n!==`new-session-pending`&&await Qh(n),Te.current.delete(t),B.current.add(t),Be(e.goalId,null)}function Je(e){P.some(t=>t.agentId===e&&t.available)&&(re(t=>({...t,[M]:e})),ie(!1))}function Ye(){i(``),se(`chat`)}function Xe(e){i(e),se(`chat`)}T&&jS[T.state],T&&(`${I.label}${T.state}`,Ie.length>0&&`${Re}`,Fe.length>0&&`${Fe.length}`),T?.state===`需修复`||!T&&!c.ok?(T&&IS(T.agentId),T?.nextSentence,T?.agentSentence):T?.state===`等你`?(T.needsYouBlocking,T.needsYouBlocking,T.needsYou??T.nextSentence,T.needsYou):(T&&IS(T.agentId),T?.nextSentence);let Ze=[...!T&&he.manager?.status===`resume_failed`?[{id:`run:manager:resume-failed`,kind:`run`,run:{agentId:he.manager.agentId,agentLabel:IS(he.manager.agentId),canInterrupt:!1,completedSteps:0,goalId:`manager`,goalTitle:`LoopX 管家`,latestActivity:`本地聊天记录已保留,点我查看恢复方式。`,resumable:!1,runId:`manager:resume-failed`,sessionId:he.manager.sessionId,sessionStatus:`resume_failed`,status:`failed`,title:`上次会话需要恢复`,totalSteps:1,outputs:[]}}]:[],...T?_e.map(e=>{let t=e.channel_id?.startsWith(`task.`)?e.channel_id.slice(5):void 0,n=T.agentTodos.find(e=>e.todoId===t),r=!!e.active_turn_id,i=xe[e.session_id],a=i?.messages.some(e=>PS(e.role,e.text))===!0;return{id:`run:task:${e.session_id}`,kind:`run`,run:{agentId:e.agent_id,agentLabel:IS(e.agent_id),canInterrupt:r,completedSteps:n?.done||a?1:0,goalId:T.goalId,goalTitle:T.title,latestActivity:r?`Agent 正在执行,可进入 Session 查看过程或发送纠偏。`:a?`Agent 已返回结果,点击查看结果与完整运行记录。`:`执行 Session 已保留,可继续纠偏或恢复。`,resumable:e.resumable,runId:e.session_id,sessionId:e.session_id,sessionMessages:i?.messages.map(e=>({createdAt:e.created_at,messageId:e.message_id,role:e.role===`user`?`user`:PS(e.role,e.text)?`assistant`:`error`,text:e.role===`user`?e.text:NS(e.text)})),sessionStatus:a?`completed`:e.status,status:n?.done||a?`completed`:r?`running`:e.status===`resume_failed`?`failed`:`waiting`,title:n?.text??`Agent 执行任务`,todoId:t,totalSteps:1,turnId:e.active_turn_id??void 0}}}):[],...T?[{id:`run:${T.goalId}`,kind:`run`,run:{agentId:he[T.goalId]?.agentId??T.agentId,agentLabel:IS(he[T.goalId]?.agentId??T.agentId),canInterrupt:!!he[T.goalId]?.turnId,completedSteps:T.agentTodos.filter(e=>e.done).length,goalId:T.goalId,goalTitle:T.title,latestActivity:T.agentSentence,resumable:he[T.goalId]?.resumable??!0,runId:`goal:${T.goalId}`,sessionId:he[T.goalId]?.sessionId,sessionStatus:he[T.goalId]?.status,status:he[T.goalId]?.turnId?`running`:T.state===`需修复`?`failed`:`waiting`,title:T.nextSentence,totalSteps:T.agentTodos.length||1,turnId:he[T.goalId]?.turnId,outputs:T.runEvidence?[{createdAt:T.runEvidence.generatedAt,kind:`evidence`,outputId:`${T.goalId}:latest-evidence`,title:T.runEvidence.label}]:[]}}]:[],...Pe.map(e=>({id:`message:${e.id}`,kind:`message`,message:{agentLabel:e.agentLabel,attachments:e.attachments,id:String(e.id),pending:e.pending,role:e.role,text:e.text||(e.pending?`Agent 正在处理…`:e.lines.join(` -`))}})),...(T?[T]:w.goals).flatMap(e=>e.runEvidence?[{id:`output:${e.goalId}:${e.runEvidence.generatedAt||`latest`}`,kind:`output`,output:{agentLabel:IS(e.agentId),createdAt:e.runEvidence.generatedAt,goalId:e.goalId,goalTitle:e.title,kind:`evidence`,outputId:`${e.goalId}:latest-evidence`,runId:e.runEvidence.runId??void 0,safePreview:e.runEvidence.safePreview,summary:e.runEvidence.summary,title:e.runEvidence.label,todoId:e.runEvidence.todoId??void 0}}]:[]),...T&&D?[{id:`output:${T.goalId}:report:${D.publication.publication_id}`,kind:`output`,output:{agentId:D.agent_id,agentLabel:IS(D.agent_id),createdAt:D.publication.delivered_at,goalId:T.goalId,goalTitle:T.title,kind:`report`,outputId:D.publication.publication_id,report:{addedCount:D.delta.added_count,changedCount:D.delta.changed_count,deliveredAt:D.publication.delivered_at,generationId:D.generation_id,items:D.delta.items.map(e=>({changeKind:e.change_kind,previousStatus:e.previous_status,sourceRef:e.source_ref,status:e.status,summary:e.summary,title:e.title})),periodEndAt:D.period_window.end_at,periodStartAt:D.period_window.start_at,predecessorPublicationId:D.publication.predecessor_publication_id,publicationId:D.publication.publication_id},safePreview:D.delta.items.map(e=>`${e.change_kind===`added`?`+`:`~`} ${e.title}\n${e.summary}`).join(` +`)});continue}let o=e.match(/^\s{0,3}#{1,4}\s+(.*)$/);if(o){i();let t=e.trimStart().match(/^#+/)?.[0].length??1;n.push({type:`heading`,level:t,text:o[1].trim()}),a+=1;continue}if(My.test(e)||Ny.test(e)){i();let r=Ny.test(e),o=r?Ny:My,s=[];for(;a{let n=`b${t}`;if(e.type===`code`)return(0,H.jsx)(`pre`,{className:`personal-md-pre`,children:(0,H.jsx)(`code`,{children:e.text})},n);if(e.type===`heading`)return(0,H.jsx)(`p`,{className:`personal-md-heading is-h${e.level}`,children:jy(e.text,n)},n);if(e.type===`list`){let t=e.items.map((e,t)=>(0,H.jsx)(`li`,{children:jy(e,`${n}-${t}`)},`${n}-${t}`));return e.ordered?(0,H.jsx)(`ol`,{className:`personal-md-list`,children:t},n):(0,H.jsx)(`ul`,{className:`personal-md-list`,children:t},n)}return(0,H.jsx)(`p`,{children:e.lines.map((e,t)=>(0,H.jsxs)(V.Fragment,{children:[t>0?(0,H.jsx)(`br`,{}):null,jy(e,`${n}-${t}`)]},`${n}-${t}`))},n)})})}function Iy({onSelect:e,output:t}){let{t:n}=qi(),r=t.kind===`report`?_m:gm;return(0,H.jsxs)(`button`,{className:`personal-timeline-row personal-output-row`,"data-output-kind":t.kind,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-row-icon is-output`,children:(0,H.jsx)(r,{size:18})}),(0,H.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,H.jsxs)(`small`,{children:[t.goalTitle??t.goalId,` · `,t.agentLabel??`LoopX`]}),(0,H.jsx)(`strong`,{children:t.title}),t.summary?(0,H.jsx)(`span`,{children:t.summary}):null,t.report?(0,H.jsxs)(`small`,{children:[n(`files.reportDelta`,{added:t.report.addedCount,changed:t.report.changedCount}),` · `,n(`files.verifiedReport`)]}):null]}),t.createdAt?(0,H.jsx)(`time`,{children:t.createdAt}):null,(0,H.jsx)(rm,{size:17})]})}var Ly={completed:`runs.completed`,failed:`runs.failed`,interrupted:`runs.interrupted`,queued:`runs.queued`,running:`runs.running`,waiting:`runs.waiting`};function Ry({onSelect:e,run:t}){let{t:n}=qi(),r=t.totalSteps>0?Math.min(100,t.completedSteps/t.totalSteps*100):0;return(0,H.jsxs)(`button`,{"aria-label":`${n(`tasks.viewExecution`)}:${t.title}`,className:`personal-timeline-row personal-run-row`,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-row-icon is-run`,children:(0,H.jsx)(Qp,{size:18})}),(0,H.jsxs)(`span`,{className:`personal-run-identity`,children:[(0,H.jsx)(`small`,{children:t.goalTitle}),(0,H.jsx)(`strong`,{children:t.agentLabel})]}),(0,H.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,H.jsx)(`strong`,{children:t.title}),(0,H.jsx)(`small`,{children:t.latestActivity})]}),(0,H.jsxs)(`span`,{className:`personal-run-progress`,"aria-label":`${t.completedSteps}/${t.totalSteps}`,children:[(0,H.jsxs)(`small`,{children:[t.completedSteps,`/`,t.totalSteps]}),(0,H.jsx)(`i`,{children:(0,H.jsx)(`b`,{style:{width:`${r}%`}})})]}),(0,H.jsxs)(`span`,{className:`personal-row-status is-${t.status}`,children:[t.status===`running`?(0,H.jsx)(wm,{className:`personal-spin`,size:14}):null,n(Ly[t.status])]}),t.sessionId?(0,H.jsx)(`span`,{className:`personal-run-open-label`,children:n(`tasks.viewExecution`)}):null,(0,H.jsx)(rm,{size:17})]})}function zy({onSelect:e,schedule:t}){let{t:n}=qi(),r=t.scheduleKind===`heartbeat`;return(0,H.jsxs)(`button`,{"aria-label":`${r?`Heartbeat`:n(`tasks.scheduled`)}:${t.label};${t.status??`active`}`,className:`personal-schedule-row`,onClick:e,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-schedule-icon`,children:r?(0,H.jsx)(Im,{size:17}):(0,H.jsx)(em,{size:17})}),(0,H.jsxs)(`span`,{className:`personal-schedule-copy`,children:[(0,H.jsx)(`small`,{children:n(r?`schedule.heartbeat`:`schedule.monitor`)}),(0,H.jsx)(`strong`,{children:t.label}),(0,H.jsx)(`p`,{children:t.schedule??n(`schedule.summary`)})]}),(0,H.jsx)(`span`,{className:`personal-schedule-status is-${t.status??`active`}`,children:t.status===`paused`?n(`schedule.paused`):n(`schedule.active`)}),(0,H.jsx)(rm,{size:16})]})}function By({delivery:e}){let{t}=qi();if(!e)return null;let n=e.status===`delivered`?e.verification===`reconciled_after_restart`?t(`returnDelivery.reconciled`):t(`returnDelivery.delivered`):e.status===`verification_required`?t(`returnDelivery.verifying`):e.status===`explicit_unverified`?t(`returnDelivery.unverified`):t(`returnDelivery.queued`);return(0,H.jsx)(`small`,{className:`personal-return-delivery is-${e.status}`,role:`status`,children:n})}function Vy({items:e,onSelect:t,selectedGoal:n}){let{t:r}=qi();if(e.length===0)return(0,H.jsxs)(`div`,{className:`personal-timeline-empty`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(qm,{size:20})}),(0,H.jsx)(`strong`,{children:r(n?`timeline.emptyGoal`:`timeline.emptyWorkspace`)}),(0,H.jsx)(`p`,{children:r(n?`timeline.emptyGoalDescription`:`timeline.emptyWorkspaceDescription`)})]});let i=[...e].reverse().find(e=>e.kind===`message`&&e.message.role!==`user`||e.kind===`proposal`&&[`applied`,`stale`,`error`,`gated`].includes(e.proposal.status)||e.kind===`run`&&e.run.status===`completed`),a=i?.kind===`message`?`${i.message.agentLabel??r(`header.manager`)}:${i.message.pending?r(`timeline.pending`):i.message.text}`:i?.kind===`proposal`?`${i.proposal.title}:${i.proposal.status}`:i?.kind===`run`?r(`timeline.runCompleted`,{run:i.run.title}):``,o=e.filter(e=>e.kind===`proposal`&&e.proposal.status===`gated`),s=e.filter(e=>e.kind!==`proposal`),c=e.filter(e=>e.kind===`proposal`&&e.proposal.status!==`gated`);function l(e){return e.kind===`attention`?(0,H.jsx)(ky,{attention:e.attention,onSelect:()=>t({item:e.attention,kind:`attention`})},e.id):e.kind===`run`?(0,H.jsx)(Ry,{onSelect:()=>t({item:e.run,kind:`run`}),run:e.run},e.id):e.kind===`output`?(0,H.jsx)(Iy,{onSelect:()=>t({item:e.output,kind:`output`}),output:e.output},e.id):e.kind===`schedule`?(0,H.jsx)(zy,{onSelect:()=>t({item:e.schedule,kind:`schedule`}),schedule:e.schedule},e.id):e.kind===`proposal`?(0,H.jsxs)(`button`,{className:`personal-proposal-row is-${e.proposal.status}`,onClick:()=>t({item:e.proposal,kind:`proposal`}),type:`button`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(qm,{size:17})}),(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(`small`,{children:[e.proposal.actionKind,` · `,e.proposal.status]}),(0,H.jsx)(`strong`,{children:e.proposal.title}),(0,H.jsx)(`p`,{children:e.proposal.impact})]}),(0,H.jsx)(`b`,{children:e.proposal.status===`gated`&&e.proposal.actionKind!==`operation.execute`?r(`timeline.review`):e.proposal.primaryLabel??r(`timeline.reviewAndConfirm`)})]},e.id):(0,H.jsxs)(`article`,{className:`personal-message is-${e.message.role}`,children:[e.message.role===`user`?null:(0,H.jsx)(`span`,{className:`personal-message-avatar`,children:(0,H.jsx)(Qp,{size:17})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:e.message.role===`user`?r(`common.you`):e.message.agentLabel??r(`header.manager`)}),e.message.time?(0,H.jsx)(`time`,{children:e.message.time}):null]}),e.message.attachments?.length?(0,H.jsx)(`div`,{className:`personal-message-images`,children:e.message.attachments.map(e=>(0,H.jsx)(`img`,{alt:e.name,src:e.dataUrl},e.id))}):null,e.message.role===`user`?(0,H.jsx)(`p`,{children:e.message.text}):(0,H.jsx)(Fy,{text:e.message.text}),e.message.pending?(0,H.jsx)(`span`,{className:`personal-message-pending`,children:r(`timeline.pending`)}):null,(0,H.jsx)(By,{delivery:e.message.returnDelivery})]})]},e.id)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{"aria-atomic":`true`,"aria-live":`polite`,className:`personal-live-region`,role:`status`,children:a}),(0,H.jsxs)(`div`,{className:`personal-channel-timeline`,children:[s.map(l),o.length?(0,H.jsxs)(`details`,{className:`personal-gated-summary`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(qm,{size:16})}),(0,H.jsx)(`strong`,{children:r(`timeline.waitingConfirmation`)}),(0,H.jsx)(`small`,{children:r(`timeline.gateHistory`,{count:o.length})})]}),(0,H.jsx)(`div`,{children:o.map(l)})]}):null,c.map(l)]})]})}function Hy({goal:e}){let{t}=qi(),n={connected:t(`acceptance.connected`),mapped:t(`acceptance.mapped`),refreshed:t(`acceptance.refreshed`),adapter_inspected:t(`acceptance.inspected`),run_recorded:t(`acceptance.recorded`),reward_judged:t(`acceptance.judged`),operator_approved:t(`acceptance.approved`),controller_ready:t(`acceptance.ready`),attention_queue:t(`acceptance.attentionSource`),agent_vision:t(`acceptance.visionSource`),todo_projection:t(`acceptance.todoSource`),current_run:t(`acceptance.runSource`)},r=e=>n[e]??t(`acceptance.unknown`),i=e.acceptanceObservation,a=e.loadState||!i||i.goal_id!==e.goalId||i.coverage===`unavailable`;return(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-acceptance`,"aria-label":t(`acceptance.title`),children:[(0,H.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,H.jsx)(`h3`,{children:t(`acceptance.title`)}),(0,H.jsx)(`em`,{children:t(`common.readOnly`)})]}),(0,H.jsx)(`p`,{role:`status`,children:t(a?`acceptance.unavailable`:`acceptance.partial`)}),!a&&i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h4`,{children:t(`acceptance.gaps`)}),i.acceptance_gaps.length?i.acceptance_gaps.map((e,n)=>(0,H.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,H.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.owner`)}),(0,H.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,H.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.observed`)}),(0,H.jsx)(`dd`,{children:e.observed_at??t(`acceptance.unknown`)})]})]})]},`${e.kind}:${e.owner}:${n}`)):(0,H.jsx)(`p`,{children:t(`acceptance.noGaps`)}),(0,H.jsx)(`h4`,{children:t(`acceptance.guards`)}),i.guards.length?i.guards.map((e,n)=>(0,H.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,H.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.owner`)}),(0,H.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),e.blocks_agent?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.agent`)}),(0,H.jsx)(`dd`,{children:e.blocks_agent})]}):null,e.todo_id?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.task`)}),(0,H.jsx)(`dd`,{children:e.todo_id})]}):null,(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,H.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.scope`)}),(0,H.jsx)(`dd`,{children:e.decision_scope??t(`acceptance.unknown`)})]})]})]},`${e.todo_id}:${n}`)):(0,H.jsx)(`p`,{children:t(`acceptance.noGuards`)}),(0,H.jsx)(`h4`,{children:t(`acceptance.next`)}),(0,H.jsx)(`p`,{children:i.next_action??t(`acceptance.unknown`)}),(0,H.jsxs)(`details`,{children:[(0,H.jsxs)(`summary`,{children:[t(`acceptance.historical_progress`),` · `,i.historical_progress.length]}),(0,H.jsx)(`p`,{children:t(`acceptance.historical`)}),i.historical_progress.map(e=>(0,H.jsxs)(`p`,{children:[(0,H.jsx)(`strong`,{children:r(e.kind)}),` · `,e.observed_at??t(`acceptance.unknown`),` `,e.evidence_refs.join(`, `)]},e.kind))]}),i.missing_sources.length?(0,H.jsxs)(`p`,{children:[t(`acceptance.missing`),` `,i.missing_sources.map(r).join(`, `)]}):null,i.truncated?(0,H.jsx)(`p`,{children:t(`acceptance.truncated`)}):null]}):null]})}function Uy({item:e,successor:t,onSelect:n}){let{t:r}=qi(),i=e.details;return(0,H.jsxs)(`section`,{className:`personal-detail-card`,"aria-label":r(`attentionDetail.title`),children:[(0,H.jsx)(`h3`,{children:r(`attentionDetail.title`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.request`)}),(0,H.jsx)(`dd`,{children:r(i?.interaction===`decision`?`attentionDetail.decision`:`attentionDetail.unknownRequest`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`common.status`)}),(0,H.jsx)(`dd`,{children:r(`attentionDetail.${i?.lifecycle??`unknown`}`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`drawer.reason`)}),(0,H.jsx)(`dd`,{children:i?.reason??e.explanation??r(`attentionDetail.unknownReason`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Todo`}),(0,H.jsx)(`dd`,{children:e.todoId})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.targetTodo`)}),(0,H.jsx)(`dd`,{children:i?.unblocksTodoId??r(`attentionDetail.notProvided`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.targetAgent`)}),(0,H.jsx)(`dd`,{children:i?.blocksAgent??r(`attentionDetail.notProvided`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.scope`)}),(0,H.jsx)(`dd`,{children:i?.decisionScope?`${i.decisionScope.kind} · ${i.decisionScope.granularity} · ${i.decisionScope.scopeKey}`:r(`attentionDetail.notProvided`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`drawer.evidence`)}),(0,H.jsx)(`dd`,{children:i?.evidence??e.evidence??r(`drawer.decisionDefaultEvidence`)})]})]}),i?.supersededBy?(0,H.jsxs)(`p`,{children:[r(`attentionDetail.replacement`),`: `,i.supersededBy]}):null,t&&n?(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>n(t),type:`button`,children:r(`attentionDetail.openReplacement`)}):null,(0,H.jsx)(`p`,{children:r(`attentionDetail.boundary`)})]})}function Wy(e){return e.replace(/\s+/gu,` `).trim()}function Gy(e,t){let n=RegExp(`(?:不要|不需要|无需|禁止|别|暂不|do not\\b|don't\\b|without\\b).{0,10}(?:${t.source})`,`iu`),r=RegExp(`(?:${t.source}).{0,10}(?:不要|不需要|无需|禁止|关闭)`,`iu`),i=RegExp(`disable\\b.{0,10}(?:${t.source})|(?:turn|switch|set)\\b.{0,10}(?:${t.source}).{0,10}\\boff\\b|(?:${t.source})\\s+(?:is\\s+)?disabled\\b`,`iu`);return n.test(e)||r.test(e)||i.test(e)}function Ky(e){return/(我现在该做什么|下一步|哪些\s*Goal\s*在等我|需要我|谁在等我|Agent\s*在做什么|当前进度|总结(?:今天)?进展)/iu.test(e)}function qy(e){let t=/(怎么|如何|为什么|给.*建议|分析一下|解释|只读)/u.test(e),n=/(解决一下|修复一下|处理一下|执行一下|改一下|跑(?:一下)?测试|rebase|push|提交|推送)/iu.test(e);return!t&&n&&/(帮我|请|给我|直接|现在|开始|bytedcli|codebase|git|rebase|push|提交|推送)/iu.test(e)}function Jy(e){return Wy(e).toLowerCase().match(/(?:^|[\s,,;;:((:]|到|至)(?todo_done:todo_[a-z0-9_-]{3,64}|pr_merged:(?:(?:[a-z0-9_.-]{1,80})\/(?:[a-z0-9_.-]{1,100}))?#[1-9][0-9]{0,8}|capacity_available:[a-z][a-z0-9_:-]{0,63}|resume_at:[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}t[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\.[0-9]{1,3})?(?:z|[+-][0-9]{2}:[0-9]{2}))(?=$|[\s,,。;;))])/iu)?.groups?.condition??null}function Yy(e,t){let n=Wy(e),r=[],i=t.agents.find(e=>{let t=n.toLowerCase();return t.includes(e.agentId.toLowerCase())||t.includes(e.label.toLowerCase())}),a=t.todos.find(e=>n.includes(e.todoId)||n.includes(e.text)),o=/(刚刚|已经|已)(?:经)?\s*(新增|创建|添加)(?:的)?\s*(todo|待办|任务)/iu.test(n),s=!!t.goalId&&!Gy(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n);if(!t.goalId&&!Gy(n,/goal|目标/iu)&&/(创建|新建|设置|create|start|set up).{0,24}(goal|目标)/iu.test(n)&&r.push({actionKind:`goal.create`,confidence:.97,normalizedParameters:{heartbeat_enabled:!Gy(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n)}}),t.goalId&&s&&r.push({actionKind:`heartbeat.bind`,confidence:.96,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&!s&&!Gy(n,/定时|监控|监测|持续观察|scheduled check|monitor/iu)&&/(定时|监控|监测|每.{0,8}(分钟|小时|天)|持续观察|scheduled check|monitor|every.{0,12}(minute|hour|day)|daily)/iu.test(n)&&r.push({actionKind:`monitor.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&i&&!Gy(n,/绑定|负责|接管|管理/iu)&&/((让|交给).{0,20}(管理|负责|接管).{0,8}(goal|目标)|(绑定).{0,12}(goal|目标)|(goal|目标).{0,12}(交给|绑定|负责|接管))/iu.test(n)&&r.push({actionKind:`agent.bind`,confidence:.96,normalizedParameters:{agent_id:i.agentId,goal_id:t.goalId}}),t.goalId&&!o&&!Gy(n,RegExp(`todo|待办|任务`,`iu`))&&/(创建|新建|新增|添加|加一个|记一个).{0,16}(todo|待办|任务)|(todo|待办|任务).{0,12}(创建|新建|新增|添加)|(?:create|add)(?:\s+(?:a|an|new))?\s+(?:todo|task)|(?:todo|task).{0,12}(?:create|add)/iu.test(n)&&r.push({actionKind:`todo.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&qy(n)&&r.push({actionKind:`todo.create`,confidence:.9,normalizedParameters:{goal_id:t.goalId,start_execution:!0}}),t.goalId&&a){let e=!Gy(n,/完成|做完|关闭/u)&&/完成|做完|关闭/u.test(n)?`complete`:!Gy(n,/阻塞|卡住/u)&&/阻塞|卡住/u.test(n)?`block`:!Gy(n,/暂缓|稍后|推迟/u)&&/暂缓|稍后|推迟/u.test(n)?`defer`:i&&!Gy(n,/交给|分配给|改派/u)&&/交给|分配给|改派/u.test(n)?`reassign`:null;if(e){let i=e===`defer`?Jy(n):null;if(e===`defer`&&!i)return{actionKind:`todo.update`,confidence:.97,missingFields:[`resume_when`],normalizedParameters:{goal_id:t.goalId,operation:e,todo_id:a.todoId},route:`clarify`};r.push({actionKind:`todo.update`,confidence:.97,normalizedParameters:{goal_id:t.goalId,operation:e,...i?{resume_when:i}:{},todo_id:a.todoId}})}}let c=[...new Map(r.map(e=>[e.actionKind,e])).values()];return c.length>1?{actionKind:null,confidence:.4,missingFields:[`single_intent`],normalizedParameters:{},route:`clarify`}:c.length===1?{...c[0],missingFields:[],route:`typed_action`}:!t.goalId&&Ky(n)?{actionKind:null,confidence:.98,missingFields:[],normalizedParameters:{},route:`projection`}:{actionKind:null,confidence:.75,missingFields:[],normalizedParameters:{},route:`agent_chat`}}function Xy(e,t,n){if(!e)return{};if(!t.trim())return{modelConfig:null};let r={model:t.trim()};return n&&(r.reasoning_effort=n),{modelConfig:r}}var Zy=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`select:not([disabled])`,`input:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`),Qy=[{key:`drawer.taskBlock`,operation:`block`},{key:`drawer.taskSuccessor`,operation:`successor_create`}],$y=[{key:`drawer.decisionReject`,resolution:`reject`},{key:`drawer.decisionDefer`,resolution:`defer`}],eb=Array.from({length:32},(e,t)=>t+1),tb=/^[a-z][a-z0-9_.-]{0,63}$/u;function nb(e){let t=String(e??``).trim().toLowerCase();return tb.test(t)?t:null}function rb(e,t){return e.enabled===t.enabled&&e.maxChildren===t.maxChildren&&JSON.stringify(e.modelConfig??null)===JSON.stringify(t.modelConfig??null)&&[...e.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)===[...t.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)}function ib({agents:e,attentionHistory:t=[],onSelectAttention:n,callbacks:r,goalNotifications:i=[],goals:a=[],inspectorExpanded:o=!1,larkConnections:s=[],onClose:c,onToggleInspectorSize:l,readOnly:u=!1,runs:d=[],selection:f}){let{locale:p,t:m}=qi(),[h,g]=(0,V.useState)(``),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(`idle`),[x,S]=(0,V.useState)(`record`),[C,w]=(0,V.useState)([]),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(2),[k,ee]=(0,V.useState)(``),[te,A]=(0,V.useState)(``),[j,M]=(0,V.useState)(`idle`),[N,P]=(0,V.useState)(null),[F,ne]=(0,V.useState)(null),re=(0,V.useRef)(null),I=(0,V.useRef)(null),[L,ie]=(0,V.useState)(e.find(e=>e.available)?.agentId??`codex`),[R,ae]=(0,V.useState)(``),oe=(0,V.useRef)(null),se=(0,V.useRef)(null),ce=(0,V.useRef)(null),le=(0,V.useRef)(null),ue=f.kind===`run`?`run:${f.item.runId}`:f.kind===`proposal`?`proposal:${f.item.previewId}`:f.kind===`todo`?`todo:${f.item.todoId}`:f.kind===`attention`?`attention:${f.item.todoId}`:f.kind===`output`?`output:${f.item.outputId}`:f.kind===`schedule`?`schedule:${f.item.scheduleId}`:`goal:${f.item.goalId}`;(0,V.useEffect)(()=>{b(`idle`),v(!1),S(`record`),ae(``);let e=f.kind===`goal`?f.item.subagentExecution:void 0;w(e?.allowedDomains??[]),ee(e?.modelConfig?.model??``),A(e?.modelConfig?.reasoning_effort??``),O(e?.maxChildren?Math.min(e.maxChildren,32):2),E(null),M(`idle`),P(null),ne(null),re.current=e??null,I.current=null},[ue]);let z=f.kind===`goal`?f.item.subagentExecution:void 0;(0,V.useEffect)(()=>{let e=re.current,t=z?!e||!rb(e,z):e!==null;if(re.current=z??null,!F){t&&z&&(w(z.allowedDomains),ee(z.modelConfig?.model??``),A(z.modelConfig?.reasoning_effort??``),O(z.maxChildren||2),E(null),M(`idle`),P(null));return}let n=I.current;(!z||rb(F,z)||n&&!rb(n,z))&&(z&&(w(z.allowedDomains),ee(z.modelConfig?.model??``),A(z.modelConfig?.reasoning_effort??``),O(z.maxChildren||2)),I.current=null,ne(null))},[z,F]),(0,V.useEffect)(()=>{let e=document.activeElement;e instanceof HTMLElement&&!se.current?.contains(e)&&(ce.current=e);let t=window.requestAnimationFrame(()=>le.current?.focus());return()=>window.cancelAnimationFrame(t)},[ue]);let de=(0,V.useCallback)(()=>{let e=ce.current;c(),window.requestAnimationFrame(()=>e?.focus())},[c]);(0,V.useEffect)(()=>{function e(e){if(e.key===`Escape`){e.preventDefault(),de();return}if(e.key===`Tab`&&f.kind!==`todo`){let t=Array.from(se.current?.querySelectorAll(Zy)??[]).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`);if(t.length===0)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[de,f.kind]);let fe=f.kind===`attention`?m(`drawer.titleAttention`):f.kind===`todo`?m(`drawer.taskDetails`):f.kind===`run`?m(`drawer.runDetails`):f.kind===`output`?m(`drawer.titleOutput`):f.kind===`proposal`?m(f.item.status===`applied`?`drawer.titleProposalApplied`:`drawer.titleProposalConfirm`):f.kind===`schedule`?f.item.scheduleKind===`heartbeat`?`Heartbeat`:m(`drawer.titleSchedule`):m(`drawer.goalDetails`),pe=f.kind===`proposal`?f.item.goalId??`manager`:f.item.goalId,me=f.kind===`attention`?f.item.goalTitle??m(`drawer.currentGoal`):f.kind===`todo`||f.kind===`run`?f.item.goalTitle:f.kind===`output`?f.item.goalTitle??m(`drawer.currentGoal`):f.kind===`goal`?f.item.title:f.kind===`schedule`?m(`drawer.goalAutoRun`):f.item.goalId?m(`drawer.goalChanges`):m(`drawer.managerChanges`),he=f.kind===`goal`?d.find(e=>e.goalId===f.item.goalId&&!!e.sessionId)??d.find(e=>e.goalId===f.item.goalId):null,ge=f.kind===`run`&&(f.item.completedSteps>0||!!f.item.latestActivity||!!f.item.outputs?.length),_e=f.kind===`attention`?Xi(f.item.updatedAt,m):null,ve=Jy(R);async function ye(){f.kind!==`run`||!h.trim()||(await r.onCorrectRun?.(f.item,h.trim()),g(``))}async function be(e,t,n,i){if(t===`successor_create`){await r.onPreviewAction?.({actionKind:`todo.create`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-successor-${e.todoId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,text:m(`drawer.taskSuccessorText`,{task:e.text})},summary:m(`drawer.taskSuccessorSummary`,{task:e.text})});return}await r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-${e.todoId}-${t}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:e.claimedBy??L,goal_id:e.goalId,operation:t,...t===`block`?{note:m(`drawer.taskSuccessorNote`)}:{},...t===`defer`&&i?{resume_when:i}:{},todo_id:e.todoId},summary:`${n}:${e.text}`})}async function xe(e,t,n){u||!qd(e)||await r.onPreviewAction?.({actionKind:`gate.resolve`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-decision-${e.todoId}-${t}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,decision:t,todo_id:e.todoId},summary:`${n}:${e.text}`})}let Se=f.kind===`goal`?F??f.item.subagentExecution??{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0}:{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0},Ce=j===`previewing`||j===`applying`,we=(()=>{if(f.kind!==`goal`)return[];let e=new Map;for(let t of Se.allowedDomains){let n=nb(t);n&&e.set(n,{matchingTodoCount:0,value:n})}if(Se.domainCandidates)for(let t of Se.domainCandidates){let n=nb(t.domain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+t.matchingTodoCount,value:n})}else for(let t of f.item.agentTodos){if(t.done||t.taskClass!==`advancement_task`)continue;let n=nb(t.taskDomain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+1,value:n})}return[...e.values()]})();function Te(){w(Se.allowedDomains),ee(Se.modelConfig?.model??``),A(Se.modelConfig?.reasoning_effort??``),O(Se.maxChildren||2),E(null),M(`idle`),P(null)}function B(){let e=[...new Set(C.map(e=>nb(e)))];return e.every(e=>!!e)?e:null}function Ee(e,t){w(n=>t?[...n,e].filter((e,t,n)=>n.indexOf(e)===t):n.filter(t=>t!==e)),P(null),M(`idle`),E(null)}async function De(e,t=e){if(f.kind!==`goal`||!r.onPreviewGoalSubagentConfiguration)return;let n=e?B():[];if(t&&!k.trim()&&te){M(`error`),E(m(`drawer.subagentModelRequired`));return}if(e&&!n){M(`error`),E(m(`drawer.subagentDomainInvalid`)),P(null);return}let i={allowedDomains:n??[],enabled:e,goalId:f.item.goalId,maxChildren:e?D:0,...Xy(t,k,te)};M(`previewing`),E(m(`drawer.subagentPreviewing`)),P(null);try{let e=await r.onPreviewGoalSubagentConfiguration(i);if(!e.changed){I.current=z??null,ne({...e.configuration,domainCandidates:Se.domainCandidates}),w(e.configuration.allowedDomains),ee(e.configuration.modelConfig?.model??``),A(e.configuration.modelConfig?.reasoning_effort??``),O(e.configuration.maxChildren||2),M(`success`),E(m(`drawer.subagentNoChange`));return}P({...i,changed:e.changed,previewId:e.previewId}),M(`ready`),E(m(`drawer.subagentPreviewReady`))}catch(e){M(`error`),E(e instanceof Error?e.message:m(`drawer.subagentPreviewFailed`))}}async function Oe(){if(!(!N||!r.onApplyGoalSubagentConfiguration)){M(`applying`),E(m(`drawer.subagentApplying`));try{let e=await r.onApplyGoalSubagentConfiguration({allowedDomains:N.allowedDomains,enabled:N.enabled,goalId:N.goalId,maxChildren:N.maxChildren,modelConfig:N.modelConfig,previewId:N.previewId});I.current=z??null,ne({...e,domainCandidates:Se.domainCandidates}),w(e.allowedDomains),ee(e.modelConfig?.model??``),A(e.modelConfig?.reasoning_effort??``),O(e.maxChildren||2),M(`success`),E(m(`drawer.subagentApplied`)),P(null);try{await r.onRefresh?.()}catch{M(`warning`),E(m(`drawer.subagentAppliedRefreshFailed`))}}catch(e){M(`error`),E(e instanceof Error?e.message:m(`drawer.subagentApplyFailed`))}}}return(0,H.jsxs)(`div`,{"aria-labelledby":`personal-drawer-title`,"aria-modal":f.kind===`todo`?void 0:`true`,className:`personal-context-drawer`,"data-context-kind":f.kind,ref:se,role:`dialog`,children:[(0,H.jsxs)(`header`,{className:`personal-drawer-header${f.kind===`todo`?` is-task-inspector`:``}`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{id:`personal-drawer-title`,ref:le,tabIndex:-1,children:fe}),(0,H.jsx)(`p`,{children:me})]}),(0,H.jsxs)(`div`,{className:`personal-drawer-header-actions`,children:[f.kind===`todo`&&l?(0,H.jsx)(`button`,{"aria-label":m(o?`drawer.inspectorHalf`:`drawer.inspectorFull`),className:`personal-icon-button personal-inspector-size`,onClick:l,title:m(o?`drawer.inspectorHalfView`:`drawer.inspectorFullView`),type:`button`,children:o?(0,H.jsx)(km,{size:17}):(0,H.jsx)(Tm,{size:17})}):null,(0,H.jsxs)(`button`,{"aria-label":m(`drawer.closeDetail`,{context:me}),className:`personal-icon-button personal-drawer-close`,onClick:de,ref:oe,type:`button`,children:[(0,H.jsx)(Kp,{className:`personal-mobile-back`,size:18}),(0,H.jsx)(eh,{className:`personal-desktop-close`,size:18})]})]})]}),(0,H.jsxs)(`div`,{className:`personal-drawer-body`,children:[f.kind===`attention`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card is-attention`,children:[(0,H.jsx)(`small`,{children:f.item.blocking?m(`drawer.attentionBlocking`):m(`drawer.attentionWaiting`)}),(0,H.jsx)(`h3`,{children:f.item.text}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,H.jsx)(`dd`,{children:f.item.priority??`medium`})]}),_e?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`common.waiting`)}),(0,H.jsx)(`dd`,{children:m(`tasks.waitingAge`,{age:_e})})]}):null]})]}),(0,H.jsx)(Uy,{item:f.item,onSelect:n,successor:Kd(f.item,t)}),!u&&qd(f.item)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void xe(f.item,`approve`,m(`common.confirm`)),type:`button`,children:[(0,H.jsx)(tm,{size:17}),m(`drawer.decisionReview`)]}),(0,H.jsxs)(`details`,{className:`personal-compact-menu`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(fm,{size:17}),m(`drawer.decisionMore`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{onClick:()=>void r.onExplainDecision?.(f.item),type:`button`,children:[(0,H.jsx)(Dm,{size:16}),m(`drawer.explainDecision`)]}),$y.map(e=>(0,H.jsx)(`button`,{onClick:()=>void xe(f.item,e.resolution,m(e.key)),type:`button`,children:m(e.key)},e.resolution))]})]})]}):null]}):null,f.kind===`todo`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-task-inspector-summary`,children:[(0,H.jsxs)(`div`,{className:`personal-task-inspector-status`,children:[(0,H.jsxs)(`span`,{className:f.item.done?`is-done`:f.item.status===`blocked`?`is-blocked`:`is-open`,children:[(0,H.jsx)(`i`,{}),f.item.done?m(`drawer.taskStatusCompleted`):f.item.status===`deferred`?m(`drawer.taskStatusDeferred`):f.item.status===`blocked`?m(`drawer.taskStatusBlocked`):m(`drawer.taskStatusOpen`)]}),f.item.priority?(0,H.jsx)(`span`,{children:f.item.priority}):null,(0,H.jsx)(`span`,{children:f.item.taskClass===`advancement_task`?m(`drawer.taskAdvancement`):f.item.taskClass??m(`drawer.taskOrdinary`)})]}),(0,H.jsx)(`h3`,{children:f.item.text})]}),(0,H.jsxs)(`section`,{"aria-label":m(`drawer.taskInfo`),className:`personal-task-inspector-fields`,children:[(0,H.jsx)(`h4`,{children:m(`drawer.taskInfo`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`common.owner`)}),(0,H.jsx)(`dd`,{children:f.item.ownerLabel??f.item.claimedBy??m(`drawer.notAssigned`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`common.status`)}),(0,H.jsx)(`dd`,{children:f.item.done?m(`drawer.taskStatusCompleted`):f.item.status===`deferred`?m(`drawer.taskStatusDeferred`):f.item.status===`blocked`?m(`drawer.taskStatusBlocked`):m(`drawer.taskStatusOpen`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,H.jsx)(`dd`,{children:f.item.priority??m(`drawer.notSet`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.dependencies`)}),(0,H.jsx)(`dd`,{children:f.item.dependencies?.join(` · `)||m(`common.none`)})]}),f.item.status===`deferred`||f.item.resumeWhen?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.resumeWhen`)}),(0,H.jsx)(`dd`,{children:f.item.resumeWhen||m(`drawer.notSet`)})]}):null,f.item.resumeWhen?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.resumeState`)}),(0,H.jsx)(`dd`,{children:f.item.resumeReady?m(`drawer.resumeReady`):m(`drawer.resumePending`)})]}):null,f.item.resumeReceiptId?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.resumeReceipt`)}),(0,H.jsx)(`dd`,{children:f.item.resumeReceiptId})]}):null,(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.nextTransition`)}),(0,H.jsx)(`dd`,{children:f.item.nextTransition??(f.item.done?m(`drawer.taskNextCompleted`):f.item.resumeReady?m(`drawer.taskNextResumeReady`):f.item.status===`deferred`?m(`drawer.taskNextDeferred`):m(`drawer.taskNextOpen`))})]})]})]}),!u&&!f.item.done?(0,H.jsxs)(`div`,{className:`personal-task-inspector-actions`,"aria-label":m(`drawer.taskActions`),children:[(0,H.jsxs)(`details`,{className:`personal-task-management`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(fm,{size:16}),m(`drawer.taskManage`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:m(`drawer.reassign`)}),(0,H.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.reassign`),(0,H.jsx)(`select`,{"aria-label":m(`drawer.reassign`),onChange:e=>ie(e.target.value),value:L,children:e.filter(e=>e.available).map(e=>(0,H.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:f.item.goalId,kind:`todo`,todo_id:f.item.todoId},idempotencyKey:`workspace-todo-${f.item.todoId}-reassign-${L}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:L,goal_id:f.item.goalId,operation:`reassign`,todo_id:f.item.todoId},summary:m(`drawer.reassignSummary`,{task:f.item.text})}),type:`button`,children:m(`timeline.review`)})]}),(0,H.jsx)(`strong`,{children:m(`drawer.taskDeferUntil`)}),(0,H.jsxs)(`label`,{className:`personal-inline-agent-select personal-inline-resume-when`,children:[m(`drawer.taskDeferUntil`),(0,H.jsx)(`input`,{"aria-label":m(`drawer.taskDeferCondition`),"aria-invalid":!!R.trim()&&!ve,onChange:e=>ae(e.target.value),placeholder:m(`drawer.taskDeferPlaceholder`),value:R}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:!ve,onClick:()=>void be(f.item,`defer`,m(`drawer.taskDefer`),ve??void 0),type:`button`,children:m(`drawer.taskDeferReview`)}),(0,H.jsx)(`small`,{children:R.trim()&&!ve?m(`drawer.taskDeferInvalid`):m(`drawer.taskDeferSupported`)})]}),(0,H.jsx)(`div`,{className:`personal-task-management-secondary`,children:Qy.map(e=>(0,H.jsx)(`button`,{onClick:()=>void be(f.item,e.operation,m(e.key)),type:`button`,children:m(e.key)},e.operation))})]})]}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void be(f.item,`complete`,m(`drawer.taskComplete`)),type:`button`,children:[(0,H.jsx)(tm,{size:17}),m(`drawer.taskComplete`)]})]}):null,f.item.done?(0,H.jsxs)(`div`,{className:`personal-task-completed-note`,children:[(0,H.jsx)(tm,{size:16}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:m(`drawer.taskCompletedTitle`)}),(0,H.jsx)(`small`,{children:m(`drawer.taskCompletedNote`)})]})]}):null]}):null,f.kind===`goal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsx)(`small`,{children:Ji(f.item.state,p)}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.agentSentence}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.tokens`)}),(0,H.jsxs)(`dd`,{children:[wy(f.item.usage?.tokens24h,m(`drawer.usageNotMeasured`),xy),` / `,wy(f.item.usage?.tokens7d,m(`drawer.usageNotMeasured`),xy)]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.cost`)}),(0,H.jsxs)(`dd`,{children:[wy(f.item.usage?.costUsd24h,m(`drawer.usageNotMeasured`),Sy),` / `,wy(f.item.usage?.costUsd7d,m(`drawer.usageNotMeasured`),Sy)]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.duration`)}),(0,H.jsxs)(`dd`,{children:[wy(f.item.usage?.durationMs24h,m(`drawer.usageNotMeasured`),Cy),` / `,wy(f.item.usage?.durationMs7d,m(`drawer.usageNotMeasured`),Cy)]})]})]})]}),(0,H.jsx)(Hy,{goal:f.item}),(()=>{let e=i.find(e=>e.goalId===f.item.goalId),t=s.find(e=>e.goal_id===f.item.goalId);return(0,H.jsxs)(H.Fragment,{children:[f.item.repository?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-repository`,children:[(0,H.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,H.jsx)(`small`,{children:m(`drawer.repository`)}),(0,H.jsx)(`em`,{children:m(`common.readOnly`)})]}),(0,H.jsxs)(`h3`,{children:[(0,H.jsx)(vm,{size:16}),f.item.repository.label]}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.branch`)}),(0,H.jsx)(`dd`,{children:f.item.repository.branch||`detached`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Role`}),(0,H.jsx)(`dd`,{children:m(`drawer.repositoryRole`)})]})]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>{let e=navigator.clipboard?.writeText(f.item.repository?.identity??``);if(!e){b(`error`);return}e.then(()=>b(`copied`)).catch(()=>b(`error`))},type:`button`,children:[(0,H.jsx)(lm,{size:15}),m(y===`copied`?`drawer.copyRepositoryDone`:`drawer.copyRepository`)]}),y===`error`?(0,H.jsx)(`p`,{className:`personal-copy-feedback is-error`,role:`status`,children:m(`drawer.copyRepositoryError`)}):y===`copied`?(0,H.jsx)(`p`,{className:`personal-copy-feedback`,role:`status`,children:m(`drawer.copyRepositorySuccess`)}):null]}):null,u?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,H.jsx)(`small`,{children:m(`drawer.larkConnection`)}),(0,H.jsx)(`h3`,{children:m(`drawer.remoteDetailsUnavailable`)}),(0,H.jsx)(`p`,{children:m(`drawer.remoteDetailsDescription`)})]}):(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,H.jsx)(`small`,{children:m(`drawer.larkConnection`)}),t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{children:[t.app_label,(0,H.jsx)(`span`,{className:`personal-connection-status`,children:m(`drawer.connected`)})]}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.group`)}),(0,H.jsx)(`dd`,{children:t.chat_name})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.topic`)}),(0,H.jsxs)(`dd`,{children:[`# `,t.topic_name]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.trigger`)}),(0,H.jsx)(`dd`,{children:t.incoming_mode===`mentions`?m(`lark.someoneMentions`):m(`lark.allMessages`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.replyMode`)}),(0,H.jsx)(`dd`,{children:m(`lark.topicReply`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.autoNotify`)}),(0,H.jsx)(`dd`,{children:e?.humanGateAutoNotifyEnabled?m(`common.on`):m(`common.off`)})]}),e?.lastNotifiedAt?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.lastNotification`)}),(0,H.jsx)(`dd`,{children:e.lastNotifiedAt})]}):null]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{children:m(`drawer.larkNotConfigured`)}),(0,H.jsx)(`p`,{children:m(`drawer.larkNotConfiguredDescription`)})]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onOpenNotificationSettings?.(f.item.goalId),type:`button`,children:[(0,H.jsx)(Zp,{size:16}),m(t?`drawer.larkConfigure`:`drawer.larkConnect`)]})]})]})})(),(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-session`,children:[(0,H.jsx)(`small`,{children:m(`drawer.runDetails`)}),he?.sessionId?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{children:Yi(he.sessionStatus??he.status,m)}),(0,H.jsx)(`p`,{children:he.title}),r.onOpenRunSession?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onOpenRunSession?.(he),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.runLatest`)]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{children:m(`drawer.noRun`)}),(0,H.jsx)(`p`,{children:m(`drawer.noRunDescription`)})]})]}),u?null:(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`heartbeat`,f.item.goalId),type:`button`,children:[(0,H.jsx)(Im,{size:16}),m(`drawer.setupHeartbeat`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`monitor`,f.item.goalId),type:`button`,children:[(0,H.jsx)(em,{size:16}),m(`drawer.scheduleAdd`)]})]}),f.item.subagentExecution?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-subagents`,children:[(0,H.jsxs)(`div`,{className:`personal-subagent-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:m(`drawer.subagentLabel`)}),(0,H.jsxs)(`h3`,{children:[(0,H.jsx)(Qp,{size:16}),m(`drawer.subagentTitle`)]})]}),(0,H.jsxs)(`button`,{"aria-checked":Se.enabled,"aria-label":m(N&&j===`ready`?`drawer.subagentPending`:Se.enabled?`drawer.subagentDisable`:`drawer.subagentEnable`),className:`personal-subagent-switch`,"data-pending":N&&j===`ready`?`true`:void 0,disabled:u||Ce||!!N||!r.onPreviewGoalSubagentConfiguration,onClick:()=>void De(!Se.enabled),role:`switch`,type:`button`,children:[(0,H.jsx)(`span`,{}),m(N&&j===`ready`?`drawer.subagentPending`:Se.enabled?`common.on`:`common.off`)]})]}),(0,H.jsx)(`p`,{children:m(`drawer.subagentDescription`)}),N&&j===`ready`?(0,H.jsxs)(`div`,{className:`personal-subagent-preview`,children:[(0,H.jsx)(`strong`,{children:m(N.enabled?`drawer.subagentConfirmEnable`:`drawer.subagentConfirmDisable`)}),(0,H.jsx)(`p`,{children:N.enabled?m(`drawer.subagentPreviewSummary`,{count:N.maxChildren,domains:N.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)}):m(`drawer.subagentDisableSummary`)}),N.modelConfig===void 0?null:(0,H.jsxs)(`p`,{children:[m(`drawer.subagentModel`),`: `,N.modelConfig?.model||m(`drawer.subagentModelDefault`),` · `,N.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`button`,{className:`personal-primary-action`,onClick:()=>void Oe(),type:`button`,children:m(`common.confirm`)}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:Te,type:`button`,children:m(`common.cancel`)})]})]}):null,T?(0,H.jsxs)(`p`,{className:`personal-subagent-feedback is-${j}`,role:`status`,children:[j===`previewing`||j===`applying`?(0,H.jsx)(Rm,{className:`personal-spin`,size:13}):null,T]}):null,(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentModel`)}),(0,H.jsx)(`dd`,{children:Se.modelConfig?.model||m(`drawer.subagentModelDefault`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentEffort`)}),(0,H.jsx)(`dd`,{children:Se.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentCurrentBoundary`)}),(0,H.jsx)(`dd`,{children:Se.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentChildLimit`)}),(0,H.jsx)(`dd`,{children:Se.maxChildren||0})]})]}),u?(0,H.jsx)(`p`,{className:`personal-subagent-read-only`,children:m(`drawer.subagentRemoteReadOnly`)}):(0,H.jsxs)(`div`,{className:`personal-subagent-fields`,children:[(0,H.jsxs)(`fieldset`,{className:`personal-subagent-domain-picker`,disabled:Ce,children:[(0,H.jsx)(`legend`,{children:m(`drawer.subagentDomains`)}),we.length>0?(0,H.jsx)(`div`,{className:`personal-subagent-domain-options`,children:we.map(e=>{let t=C.includes(e.value);return(0,H.jsxs)(`label`,{className:`personal-subagent-domain-option${t?` is-selected`:``}`,children:[(0,H.jsx)(`input`,{"aria-label":e.value,checked:t,onChange:t=>Ee(e.value,t.target.checked),type:`checkbox`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.value}),(0,H.jsx)(`small`,{children:m(`drawer.subagentDomainTodoCount`,{count:e.matchingTodoCount})})]})]},e.value)})}):(0,H.jsx)(`p`,{className:`personal-subagent-domain-empty`,children:m(`drawer.subagentDomainsEmpty`)}),(0,H.jsx)(`small`,{children:m(`drawer.subagentDomainsHint`)})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:m(`drawer.subagentModel`)}),(0,H.jsx)(`input`,{"aria-label":m(`drawer.subagentModel`),disabled:Ce,value:k,placeholder:`gpt-5.6-luna`,onChange:e=>{ee(e.target.value),P(null),M(`idle`),E(null)}})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:m(`drawer.subagentEffort`)}),(0,H.jsxs)(`select`,{"aria-label":m(`drawer.subagentEffort`),disabled:Ce,value:te,onChange:e=>{A(e.target.value),P(null),M(`idle`),E(null)},children:[(0,H.jsx)(`option`,{value:``,children:m(`drawer.subagentModelDefault`)}),[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`].map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]})]}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:Ce,type:`button`,onClick:()=>{ee(`gpt-5.6-luna`),A(`max`),P(null),M(`idle`),E(null)},children:m(`drawer.subagentLunaPreset`)}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:Ce,type:`button`,onClick:()=>{ee(``),A(``),P(null),M(`idle`),E(null)},children:m(`drawer.subagentClearModel`)}),(0,H.jsx)(`p`,{children:m(`drawer.subagentModelHint`)}),(0,H.jsxs)(`label`,{className:`personal-subagent-limit-field`,children:[(0,H.jsx)(`span`,{children:m(`drawer.subagentMaxChildren`)}),(0,H.jsx)(`select`,{"aria-label":m(`drawer.subagentMaxChildren`),disabled:Ce,onChange:e=>{O(Number(e.target.value)),P(null),M(`idle`),E(null)},value:D,children:eb.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})]}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:Ce,onClick:()=>void De(Se.enabled,!0),type:`button`,children:m(`drawer.subagentPreviewBoundary`)})]})]}):null]}):null,f.kind===`run`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{"aria-label":m(`drawer.runView`),className:`personal-run-drawer-tabs`,role:`tablist`,children:[(0,H.jsx)(`button`,{"aria-selected":x===`record`,onClick:()=>S(`record`),role:`tab`,type:`button`,children:m(`drawer.executionRecordAndResult`)}),(0,H.jsx)(`button`,{"aria-selected":x===`details`,onClick:()=>S(`details`),role:`tab`,type:`button`,children:m(`drawer.detailsAndActions`)})]}),x===`record`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card personal-session-summary`,children:[(0,H.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Yi(f.item.sessionStatus??f.item.status,m)]}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.latestActivity}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,H.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]})]})]}),(0,H.jsxs)(`section`,{"aria-label":m(`drawer.executionRecord`),className:`personal-session-message-record`,children:[(0,H.jsx)(`h3`,{children:m(`drawer.executionRecord`)}),f.item.sessionMessages?.length?(0,H.jsx)(`ol`,{children:f.item.sessionMessages.map(e=>(0,H.jsxs)(`li`,{className:`is-${e.role}`,children:[(0,H.jsx)(`i`,{}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:e.role===`user`?m(`drawer.runRoleUser`):e.role===`assistant`?m(`drawer.runRoleAssistant`):m(`drawer.runRoleSystem`)}),e.createdAt?(0,H.jsx)(`time`,{children:new Date(e.createdAt).toLocaleTimeString(p,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}):null]}),(0,H.jsx)(`p`,{children:e.text})]})]},e.messageId))}):(0,H.jsx)(`p`,{className:`personal-session-empty`,children:ge?m(`drawer.runRecordProjected`,{completed:f.item.completedSteps,outputs:f.item.outputs?.length?m(`drawer.runRecordProjectedOutputs`,{count:f.item.outputs.length}):``,total:f.item.totalSteps}):m(`drawer.runRecordEmpty`)}),f.item.status===`running`?(0,H.jsxs)(`div`,{className:`personal-session-active-step`,children:[(0,H.jsx)(`i`,{}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:m(`drawer.analysis`)}),(0,H.jsx)(`small`,{children:m(`drawer.agentWorking`)})]})]}):null]}),f.item.outputs?.length?(0,H.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-run-outputs-title`,children:[(0,H.jsx)(`h3`,{id:`personal-run-outputs-title`,children:m(`drawer.outputs`)}),(0,H.jsx)(`ol`,{children:f.item.outputs.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsx)(`small`,{children:e.createdAt??e.kind??m(`files.emptySummary`)})]})},e.outputId))})]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Yi(f.item.status,m)]}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.latestActivity}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,H.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.sessionStatus`)}),(0,H.jsx)(`dd`,{children:Yi(f.item.sessionStatus??f.item.status,m)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.sessionRecoverable`)}),(0,H.jsx)(`dd`,{children:f.item.resumable===!1?m(`drawer.resumeNo`):m(`drawer.resumeYes`)})]})]})]}),f.item.sessionStatus===`resume_failed`&&!u?(0,H.jsxs)(`section`,{className:`personal-recovery-panel`,"aria-label":m(`drawer.recoveryFailed`),children:[(0,H.jsx)(`strong`,{children:m(`drawer.recoveryFailed`)}),(0,H.jsx)(`p`,{children:m(`drawer.recoveryDescription`)}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,H.jsx)(Rm,{size:16}),m(`drawer.recoveryRetry`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.recoveryNewSession`)]})]}):null,u?null:(0,H.jsxs)(`section`,{className:`personal-correction-panel`,children:[(0,H.jsx)(`header`,{children:(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:16}),m(`drawer.correctionLabel`,{agent:f.item.agentLabel})]})}),(0,H.jsx)(`p`,{children:m(`drawer.correctionDescription`)}),(0,H.jsxs)(`div`,{className:`personal-correction-composer`,children:[(0,H.jsx)(`textarea`,{"aria-label":m(`drawer.correctionTextarea`,{agent:f.item.agentLabel,goal:f.item.goalTitle,run:f.item.title}),onChange:e=>g(e.target.value),placeholder:m(`drawer.correctionPlaceholder`),rows:3,value:h}),(0,H.jsx)(`button`,{"aria-label":m(`drawer.correctionSend`),disabled:!h.trim(),onClick:()=>void ye(),type:`button`,children:(0,H.jsx)(Vm,{size:16})})]})]}),u?null:(0,H.jsxs)(`details`,{className:`personal-compact-menu personal-run-more`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(fm,{size:17}),m(`drawer.moreRunActions`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{disabled:!f.item.canInterrupt,onClick:()=>void r.onInterruptRun?.(f.item),type:`button`,children:[(0,H.jsx)(Nm,{size:16}),m(`drawer.runInterrupt`)]}),(0,H.jsxs)(`button`,{disabled:f.item.resumable===!1,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,H.jsx)(Rm,{size:16}),m(`drawer.recoveryRetry`)]}),(0,H.jsxs)(`button`,{onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.runNewSession`)]}),(0,H.jsxs)(`button`,{onClick:()=>void r.onCloseRunSession?.(f.item),type:`button`,children:[(0,H.jsx)(Jm,{size:16}),m(`drawer.runCloseSession`)]})]})]})]})]}):null,f.kind===`output`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsx)(`small`,{children:f.item.kind??`output`}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.summary??m(`drawer.outputRecorded`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.outputTodo`)}),(0,H.jsx)(`dd`,{children:f.item.todoId??m(`drawer.notLinked`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.outputRun`)}),(0,H.jsx)(`dd`,{children:f.item.runId??m(`drawer.notLinked`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Agent`}),(0,H.jsx)(`dd`,{children:f.item.agentLabel??f.item.agentId??`LoopX`})]})]})]}),f.item.report?(0,H.jsxs)(`section`,{className:`personal-report-detail`,"data-testid":`personal-periodic-report-detail`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(`strong`,{children:[`+`,f.item.report.addedCount]}),m(`files.reportAdded`)]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:f.item.report.changedCount}),m(`files.reportChanged`)]})]}),(0,H.jsxs)(`p`,{children:[f.item.report.periodStartAt,` → `,f.item.report.periodEndAt]}),(0,H.jsx)(`ol`,{children:f.item.report.items.map(e=>(0,H.jsxs)(`li`,{"data-change-kind":e.changeKind,children:[(0,H.jsxs)(`small`,{children:[e.changeKind,` · `,e.status]}),(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsx)(`p`,{children:e.summary})]},e.sourceRef))}),(0,H.jsxs)(`footer`,{children:[(0,H.jsxs)(`span`,{children:[m(`files.reportPublication`),`: `,f.item.report.publicationId]}),(0,H.jsxs)(`span`,{children:[m(`files.reportGeneration`),`: `,f.item.report.generationId]})]})]}):null,f.item.safePreview?(0,H.jsx)(`pre`,{"aria-label":m(`drawer.outputSafePreview`),className:`personal-safe-preview`,children:f.item.safePreview}):(0,H.jsx)(`p`,{className:`personal-preview-unavailable`,children:m(`drawer.previewUnavailable`)}),(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:!r.onOpenOutput,onClick:()=>{r.onOpenOutput?.(f.item),c()},type:`button`,children:[(0,H.jsx)(pm,{size:16}),m(`files.openConversation`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!r.onExportOutput,onClick:()=>void r.onExportOutput?.(f.item),type:`button`,children:[(0,H.jsx)(dm,{size:16}),m(`files.exportSummary`)]})]})]}):null,f.kind===`proposal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-proposal-card`,children:[(0,H.jsxs)(`small`,{children:[f.item.actionKind,` · `,f.item.status]}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.impact}),f.item.reviewPlan?(0,H.jsx)(`p`,{className:`personal-proposal-explainer`,"data-action-review":f.item.reviewPlan.interaction,children:f.item.actionKind===`operation.execute`&&f.item.status===`gated`?m(`actionReview.operation_group_confirmation`):f.item.actionKind===`operation.execute`&&f.item.reviewPlan.reason===`readback_unverified`?m(`actionReview.operation_result_delivery_pending`):m(`actionReview.${f.item.reviewPlan.reason}`)}):null,f.item.status===`ready`?(0,H.jsx)(`p`,{className:`personal-proposal-explainer`,children:m(`drawer.proposalExplainer`)}):null,(0,H.jsx)(`dl`,{children:f.item.fields.map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:e.label}),(0,H.jsx)(`dd`,{children:e.value})]},e.key))})]}),f.item.status===`applied`?(0,H.jsxs)(`p`,{className:`personal-proposal-state ${f.item.actionKind===`operation.execute`&&f.item.reviewPlan?.reason===`readback_unverified`?`is-gated`:`is-applied`}`,children:[(0,H.jsx)(tm,{size:16}),f.item.actionKind===`operation.execute`?f.item.primaryLabel:m(`drawer.proposalApplied`)]}):null,f.item.status===`applied`&&f.item.actionKind!==`operation.execute`&&f.item.goalId?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>{let e=f.item.goalId;c(),r.onOpenGoal?.(e)},type:`button`,children:[(0,H.jsx)(pm,{size:16}),f.item.actionKind===`goal.create`?m(`drawer.proposalEnterGoal`):m(`drawer.proposalViewGoal`)]}):null,f.item.status===`stale`?(0,H.jsx)(`p`,{className:`personal-proposal-state is-stale`,children:m(`drawer.proposalStale`)}):null,f.item.status===`error`?(0,H.jsxs)(`div`,{className:`personal-proposal-state is-error`,children:[(0,H.jsx)(`span`,{children:f.item.reviewPlan?.reason===`readback_unverified`?m(`actionReview.readback_unverified`):m(`drawer.proposalApplyFailed`)}),f.item.errorMessage?(0,H.jsx)(`small`,{children:f.item.errorMessage}):null,(0,H.jsx)(`small`,{children:m(`drawer.proposalApplyFailedHint`)})]}):null,f.item.status===`rejected`?(0,H.jsx)(`p`,{className:`personal-proposal-state is-error`,children:m(`drawer.proposalRejected`)}):null,f.item.status===`deferred`?(0,H.jsx)(`p`,{className:`personal-proposal-state is-gated`,children:m(`drawer.proposalDeferred`)}):null,f.item.status===`gated`?(0,H.jsxs)(`div`,{className:`personal-proposal-state is-gated`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:f.item.actionKind===`operation.execute`?f.item.primaryLabel:m(`drawer.gateRequiresHost`)}),f.item.actionKind===`operation.execute`?f.item.impact:m(`drawer.gateRequiresHostDescription`)]}),f.item.gate?.nextAction?(0,H.jsx)(`small`,{children:f.item.gate.nextAction}):null]}):null,f.item.status===`gated`&&f.item.actionKind===`gate.resolve`?(()=>{let e=e=>f.item.fields.find(t=>t.key===e)?.value,t=e(`goal_id`),n=e(`todo_id`);return!t||!n?null:(0,H.jsxs)(`section`,{className:`personal-detail-card personal-gate-cli-hint`,children:[(0,H.jsx)(`small`,{children:m(`drawer.gateApproveHint`)}),(0,H.jsxs)(`code`,{children:[`loopx todo complete --goal-id `,t,` --todo-id `,n,` --decision-outcome approve`]}),(0,H.jsx)(`small`,{children:m(`drawer.gateRejectHint`)})]})})():null,!u&&f.item.workspaceCandidates?.length?(0,H.jsx)(`div`,{className:`personal-workspace-candidates`,"aria-label":m(`drawer.workspaceCandidates`),children:f.item.workspaceCandidates.map(e=>(0,H.jsxs)(`button`,{onClick:()=>void r.onSelectWorkspaceCandidate?.(f.item,e.workspaceRef),type:`button`,children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsx)(`small`,{children:e.workspaceRef})]},e.workspaceRef))}):null,!u&&f.item.actionKind!==`operation.execute`&&f.item.status===`error`?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,H.jsx)(Rm,{size:17}),m(`drawer.proposalRegenerate`)]}):!u&&f.item.actionKind!==`operation.execute`&&f.item.status!==`gated`?(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:![`ready`,`deferred`].includes(f.item.status)||f.item.reviewPlan?.canApply===!1,onClick:()=>void r.onApplyProposal?.(f.item),type:`button`,children:[(0,H.jsx)(tm,{size:17}),f.item.status===`applying`?m(`drawer.applying`):f.item.primaryLabel??m(`drawer.apply`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&([`stale`,`gated`,`rejected`].includes(f.item.status)||f.item.status===`ready`&&f.item.reviewPlan?.canApply===!1)?(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,H.jsx)(Rm,{size:16}),m(`drawer.proposalRecheck`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&[`ready`,`gated`].includes(f.item.status)?(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`defer`),type:`button`,children:m(`drawer.proposalDefer`)}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`reject`),type:`button`,children:m(`drawer.decisionReject`)})]}):null,[`applied`,`applying`].includes(f.item.status)?null:(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:c,type:`button`,children:m(`drawer.proposalClose`)})]}):null,f.kind===`schedule`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsxs)(`small`,{children:[f.item.scheduleKind===`heartbeat`?`Goal Heartbeat`:`continuous_monitor`,` · `,f.item.status??`active`]}),(0,H.jsx)(`h3`,{children:f.item.label}),(0,H.jsx)(`p`,{children:f.item.target??f.item.schedule??m(`drawer.scheduleDefaultTarget`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleTimezone`)}),(0,H.jsx)(`dd`,{children:f.item.timezone??m(`drawer.scheduleLocalTimezone`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleNext`)}),(0,H.jsx)(`dd`,{children:f.item.nextRunAt??m(`drawer.schedulePending`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleLast`)}),(0,H.jsx)(`dd`,{children:f.item.previousRunAt??m(`drawer.scheduleNeverRun`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleNotification`)}),(0,H.jsx)(`dd`,{children:f.item.notificationRule??m(`drawer.scheduleDefaultNotification`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleStopCondition`)}),(0,H.jsx)(`dd`,{children:f.item.stopCondition??m(`drawer.scheduleDefaultStop`)})]})]})]}),!u&&f.item.scheduleKind===`monitor`?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`run_now`),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.scheduleRunNow`)]}):null,u?null:(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,f.item.status===`paused`?`resume`:`pause`),type:`button`,children:[f.item.status===`paused`?(0,H.jsx)(Pm,{size:16}):(0,H.jsx)(Nm,{size:16}),f.item.status===`paused`?m(`drawer.scheduleResume`):m(`drawer.schedulePause`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`edit`),type:`button`,children:[(0,H.jsx)(em,{size:16}),m(`drawer.scheduleEdit`)]})]}),u?null:(0,H.jsxs)(`button`,{className:`personal-danger-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`stop`),type:`button`,children:[(0,H.jsx)(Jm,{size:16}),m(`drawer.scheduleStop`,{kind:f.item.scheduleKind===`heartbeat`?` Heartbeat`:m(`drawer.titleSchedule`)})]}),(0,H.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-execution-history-title`,children:[(0,H.jsx)(`h3`,{id:`personal-execution-history-title`,children:m(`drawer.executionHistory`)}),f.item.executionHistory?.length?(0,H.jsx)(`ol`,{children:f.item.executionHistory.map((e,t)=>(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsx)(`small`,{children:e.timestamp})]}),(0,H.jsx)(`em`,{className:`is-${e.status}`,children:e.status})]},`${e.timestamp}:${e.runId??t}`))}):(0,H.jsx)(`p`,{children:m(`drawer.noExecutionHistory`)})]})]}):null,f.kind===`run`||f.kind===`proposal`||f.kind===`schedule`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{"aria-expanded":_,className:`personal-diagnostics-trigger`,onClick:()=>v(e=>!e),type:`button`,children:[(0,H.jsx)(`span`,{children:m(`drawer.advancedDiagnostics`)}),(0,H.jsx)(nm,{className:_?`is-open`:``,size:16})]}),_?(0,H.jsxs)(`div`,{className:`personal-diagnostics`,children:[(0,H.jsxs)(`code`,{children:[`goal_id: `,pe]}),(0,H.jsxs)(`code`,{children:[`kind: `,f.kind]}),f.kind===`run`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`code`,{children:[`session_id: `,f.item.sessionId??m(`drawer.notLinked`)]}),(0,H.jsxs)(`code`,{children:[`turn_id: `,f.item.turnId??m(`common.none`)]}),(0,H.jsxs)(`code`,{children:[`adapter: `,f.item.agentId]}),(0,H.jsxs)(`code`,{children:[`status: `,f.item.sessionStatus??f.item.status]})]}):f.kind===`proposal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`code`,{children:[`action: `,f.item.actionKind]}),(0,H.jsxs)(`code`,{children:[`status: `,f.item.status]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`code`,{children:[`schedule_id: `,f.item.scheduleId]}),(0,H.jsxs)(`code`,{children:[`status: `,f.item.status??`active`]})]})]}):null]}):null]})]})}var ab=[`checking`,`connecting`,`downloading`,`installing_app`,`installing_runtime`],ob={desktop_status_unavailable:[`无法读取 App 更新状态。请重启 App 后再试;若仍失败,请重新安装最新 App。`,`Cannot read the App update status. Restart the App; if this persists, reinstall the latest App.`],update_feed_unavailable:[`此通道的更新源尚未就绪或暂时不可用。可稍后重新检查,当前版本仍可继续使用。`,`This channel's update feed is not ready or temporarily unavailable. Check again later; you can keep using this version.`],update_feed_invalid:[`更新源格式异常。请稍后重新检查。`,`The update feed is invalid. Check again later.`],update_platform_unavailable:[`此通道尚无适用于本机的更新包。`,`This channel has no update package for this platform.`],update_check_timeout:[`检查更新超时。请稍后重试。`,`The update check timed out. Try again later.`],update_network_failed:[`无法连接更新服务器。请检查网络后重试。`,`Cannot reach the update server. Check your connection and retry.`],update_download_or_signature_failed:[`更新包下载或签名校验失败,尚未安装。请重新检查更新。`,`Download or signature verification failed; the update was not installed. Check for updates again.`]};function sb(e,t=`update_failed`){return{phase:`error`,details:{code:typeof e==`string`&&Object.hasOwn(ob,e)?e:t}}}function cb(){let{locale:e}=qi(),t=e===`zh-CN`,[n,r]=(0,V.useState)(!1),i=(0,V.useRef)(null),[a,o]=(0,V.useState)(`stable`),[s,c]=(0,V.useState)({phase:`idle`}),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(!1),p=(0,V.useRef)(!1),m=window.__TAURI__?.core.invoke,h=ab.includes(s.phase);(0,V.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>r(e.matches(`:popover-open`));return e.addEventListener(`toggle`,t),()=>e.removeEventListener(`toggle`,t)},[]),(0,V.useEffect)(()=>{if(!m)return;let e=!0;return m(`desktop_update_status`).then(t=>{if(!e)return;u(t.app_version),f(t.rollback_available===!0),t.state?.phase&&c(t.state);let n=t.state?.details?.channel??(t.app_version.includes(`-main.`)?`main`:`stable`);o(n),t.state?.phase||m(`desktop_update`,{action:`check`,channel:n}).then(t=>{e&&c(t)}).catch(t=>{e&&c(sb(t))})}).catch(()=>{e&&c(sb(null,`desktop_status_unavailable`))}),()=>{e=!1}},[m]),(0,V.useEffect)(()=>{if(!m||!h)return;let e=window.setInterval(()=>{m(`desktop_update_status`).then(e=>{e.state?.phase&&c(e.state)}).catch(()=>{})},1e3);return()=>window.clearInterval(e)},[m,h]);async function g(e){if(!(!m||p.current)){p.current=!0,c({phase:e===`check`?`checking`:e===`repair`?`installing_runtime`:`downloading`});try{if(!l){let e=await m(`desktop_update_status`);u(e.app_version),f(e.rollback_available===!0)}c(await m(`desktop_update`,{action:e,channel:a}))}catch(e){c(sb(e,l?`update_failed`:`desktop_status_unavailable`))}finally{p.current=!1}}}let _={service_error:t?`运行时已安装,但服务尚未连接。可重试更新、修复或恢复上版。`:`Runtime installed, but services are unavailable. Retry updates, repair, or restore the previous version.`,idle:t?`App 会检查可用更新,不会自动安装。`:`Updates are checked automatically, never installed without confirmation.`,runtime_required:t?`请完成匹配组件安装,或检查 App 更新。`:`Install matching components or check for an App update.`,connecting:t?`正在连接更新后的服务…`:`Connecting to updated services…`,checking:t?`正在检查更新…`:`Checking for updates…`,available:t?`新版本已就绪,一次更新 App 与匹配的运行时。`:`Update the App and its matching runtime together.`,up_to_date:t?`当前通道暂无更新。`:`No newer update on this channel.`,downloading:t?`正在下载并校验签名…`:`Downloading and verifying signature…`,installing_app:t?`正在安装 App,请保持窗口打开。`:`Installing the App. Keep this window open.`,installing_runtime:t?`正在安装匹配的运行时,请稍候…`:`Installing the matching runtime…`,restart_required:t?`重启后将自动完成运行时安装与服务连接。`:`Restart to finish runtime installation and reconnect services.`,ready:t?`更新完成,服务已就绪。`:`Update completed; services are ready.`,error:ob[s.details?.code??``]?.[+!t]??(t?`更新未完成。请重试;启动失败可尝试修复当前版本。`:`Update incomplete. Retry; repair this version if startup fails.`)},v=h?t?`正在更新…`:`Updating…`:s.phase===`available`?t?`有可用更新`:`Update available`:s.phase===`restart_required`?t?`重启完成更新`:`Restart to finish`:s.phase===`error`?t?`更新需重试`:`Retry update`:t?`更新 LoopX`:`Update LoopX`;return(0,H.jsxs)(`div`,{className:`personal-desktop-update`,children:[(0,H.jsxs)(`button`,{className:`personal-update-trigger`,type:`button`,"aria-expanded":n,"aria-controls":`desktop-update-panel`,onClick:e=>{i.current?.style.setProperty(`bottom`,`${window.innerHeight-e.currentTarget.getBoundingClientRect().top+8}px`),i.current?.togglePopover()},children:[(0,H.jsx)(dm,{size:16,"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:v}),(0,H.jsx)(im,{size:14,"aria-hidden":`true`})]}),(0,H.jsxs)(`section`,{ref:i,popover:`auto`,id:`desktop-update-panel`,className:`personal-update-panel`,"aria-label":t?`LoopX 更新`:`LoopX updates`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:t?`LoopX 更新`:`LoopX updates`}),(0,H.jsx)(`button`,{type:`button`,"aria-label":t?`关闭更新面板`:`Close updates`,onClick:()=>i.current?.hidePopover(),children:(0,H.jsx)(eh,{size:16,"aria-hidden":`true`})})]}),(0,H.jsxs)(`small`,{children:[l,` · `,a===`main`?t?`main 预览版`:`main preview`:t?`稳定版`:`Stable`]}),s.details?.version?(0,H.jsxs)(`p`,{children:[t?`目标版本:`:`Target: `,s.details.version]}):null,(0,H.jsxs)(`p`,{role:`status`,"aria-live":`polite`,children:[h?(0,H.jsx)(Lm,{className:`is-spinning`,size:14,"aria-hidden":`true`}):null,_[s.phase]]}),s.phase===`downloading`&&s.details?.total?(0,H.jsx)(`progress`,{"aria-label":t?`下载进度`:`Download progress`,max:s.details.total,value:s.details.received??0}):null,m?(0,H.jsx)(`div`,{className:`personal-update-actions`,children:s.phase===`restart_required`?(0,H.jsx)(`button`,{type:`button`,onClick:()=>void g(`restart`),children:t?`重启完成更新`:`Restart to finish`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void g(`check`),children:t?`检查更新`:`Check for updates`}),s.phase===`available`?(0,H.jsx)(`button`,{type:`button`,onClick:()=>void g(`apply`),children:t?`更新并准备重启`:`Install update`}):null]})}):(0,H.jsx)(`p`,{children:t?`请在 LoopX App 中更新;浏览器自身无需安装包。`:`Update from the LoopX App; the browser needs no installer.`}),(0,H.jsxs)(`details`,{children:[(0,H.jsx)(`summary`,{children:t?`高级选项`:`Advanced options`}),(0,H.jsxs)(`label`,{children:[t?`更新通道`:`Update channel`,(0,H.jsxs)(`select`,{disabled:h||s.phase===`restart_required`,value:a,onChange:e=>{o(e.target.value),c({phase:`idle`})},children:[(0,H.jsx)(`option`,{value:`stable`,children:t?`稳定版(推荐)`:`Stable (recommended)`}),(0,H.jsx)(`option`,{value:`main`,children:t?`main 预览版`:`main preview`})]})]}),(0,H.jsx)(`p`,{children:t?`App 与匹配的 CLI 一起更新,服务可能短暂断开。不删除 Goal 数据。`:`Updates the App and matching CLI. Services may briefly disconnect. Goal data is not deleted.`}),m?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{children:t?`启动失败时,可重装当前 App 随附的运行时。`:`If startup fails, reinstall this App's bundled runtime.`}),(0,H.jsx)(`button`,{disabled:h||s.phase===`restart_required`,type:`button`,onClick:()=>void g(`repair`),children:t?`修复当前版本`:`Repair this version`})]}):null,m&&d?(0,H.jsxs)(`details`,{children:[(0,H.jsx)(`summary`,{children:t?`恢复上个版本`:`Restore previous version`}),(0,H.jsx)(`p`,{children:t?`将恢复已保留的 App 和它的运行时,需要重启。`:`Restore the retained App and its runtime, then restart.`}),(0,H.jsx)(`button`,{disabled:h,type:`button`,onClick:()=>void g(`rollback`),children:t?`确认恢复上版`:`Restore previous version`})]}):null]})]})]})}var lb=e=>`loopx-sidebar-goal-order-v1:${encodeURIComponent(e)}`;function ub(e){try{let t=JSON.parse(e??`null`);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?[...new Set(t)]:[]}catch{return[]}}function db(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.goalId)??1/0)-(n.get(t.goalId)??1/0))}function fb(e,t,n,r,i){if(n===r||!t.includes(n)||!t.includes(r))return e;let a=[...new Set([...e,...t])].filter(e=>e!==n);return a.splice(a.indexOf(r)+Number(i),0,n),a}function pb(e,t){let n=lb(t),[r,i]=(0,V.useState)(()=>{try{return ub(localStorage.getItem(n))}catch{return[]}}),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),d=(0,V.useRef)(null),f=(0,V.useRef)(!1),p=db(e,r),m=p.map(e=>e.goalId);function h(t,a,s){let l=fb(r,m,t,a,s);if(l===r)return;i(l);let u=db(e,l),d=u.findIndex(e=>e.goalId===t),f=u[d];f&&c({title:f.title,position:d+1});try{localStorage.setItem(n,JSON.stringify(l)),o(!1)}catch{o(!0)}}function g(){d.current=null,u(null)}return{sorted:p,target:l,saveFailed:a,lastMoved:s,move:h,moveBy(e,t){let n=p[m.indexOf(e)+t];n&&h(e,n.goalId,t===1)},pointerProps:e=>({onPointerDown(t){f.current=!1,t.pointerType===`mouse`&&t.button===0&&(d.current={id:e,x:t.clientX,y:t.clientY,dragging:!1},t.currentTarget.setPointerCapture(t.pointerId))},onPointerMove(e){let t=d.current;if(!t||!t.dragging&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<6)return;t.dragging=!0,f.current=!0;let n=document.elementFromPoint(e.clientX,e.clientY)?.closest(`[data-reorder-goal]`),r=e.currentTarget.closest(`.personal-goal-list`),i=n?.dataset.reorderGoal;if(!n||!i||!r?.contains(n)||i===t.id){u(null);return}let a=n.getBoundingClientRect();u({id:i,after:e.clientY>a.top+a.height/2})},onPointerUp(){d.current?.dragging&&l&&h(d.current.id,l.id,l.after),g()},onPointerCancel:g,onLostPointerCapture:g,onKeyDown(e){e.key===`Escape`&&g()},onClickCapture(e){f.current&&=(e.preventDefault(),e.stopPropagation(),!1)}})}}var mb=`/ssh-hosts`,hb=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/;function gb(e){return typeof e==`string`&&hb.test(e.trim())}function _b(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`SSH Host 列表响应无效。`);let t=e;if(t.ok!==!0||t.schema_version!==`ssh_host_catalog_v0`||!Array.isArray(t.hosts))throw Error(`SSH Host 列表协议不兼容,请更新本机 LoopX 服务。`);let n=new Set;return{hosts:t.hosts.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=String(e.alias??``).trim();return!gb(t)||n.has(t)?[]:(n.add(t),[{alias:t}])}),schemaVersion:`ssh_host_catalog_v0`}}async function vb(e=fetch,t=mb){let n=await e(t,{cache:`no-store`});if(!n.ok)throw Error(`无法读取本机 SSH Host(HTTP ${n.status})。`);return _b(await n.json())}function yb(e,t){let n=e.trim();if(!gb(n))return{error:`请选择有效的 SSH Host。`};let r=Number(t);return!Number.isInteger(r)||r<1024||r>65535?{error:`本地端口必须是 1024–65535 之间的整数。`}:{command:`ssh -N -L ${r}:127.0.0.1:8766 ${n}`,hostAlias:n,label:n,statusUrl:`http://127.0.0.1:${r}/status.json`}}var bb=`/api/ssh-source/ensure`,xb=`/api/ssh-source/goal-lifecycle`;async function Sb(e,t){let n=await fetch(bb,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({host_alias:e,local_port:Number(t)})}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error??`无法建立 SSH 隧道来源。`);if(!r?.ok)throw Error(`无法建立 SSH 隧道来源。`);return r}async function Cb(e,t,n,r,i=fetch){let a=await i(xb,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({goal_id:t,host_alias:e,operation:n,reason:r})}),o=await a.json().catch(()=>null);if(!a.ok)throw Error(o?.error??`无法更新远端 Goal 生命周期。`);if(!o?.ok||o.schema_version!==`loopx_remote_goal_lifecycle_v1`||o.goal_id!==t||o.host_alias!==e||o.operation!==n||o.activation_state!==(n===`stop`?`stopped`:`active`)||o.projection_verified!==!0)throw Error(`远端 Goal 生命周期回读未验证。`);return o}function wb({activeSource:e,connectionState:t,errorMessage:n,onAdd:r,onConfiguredHostsLoaded:i,onRemove:a,onSelect:o,sources:s}){let{t:c}=qi(),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)(`configured`),[h,g]=(0,V.useState)([]),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(``),[T,E]=(0,V.useState)(``),[D,O]=(0,V.useState)(`8876`),[k,ee]=(0,V.useState)(``),te=`configured:`,A=[...s.map(e=>({label:e.label,value:e.id})),...h.filter(e=>!s.some(t=>t.label===e.alias)).map(e=>({group:c(`source.configuredGroup`,{count:h.length}),label:e.alias,value:`${te}${e.alias}`}))],j=(0,V.useMemo)(()=>h.some(e=>e.alias===C)?yb(C,D):{error:c(`source.selectHost`)},[h,C,D,c]);(0,V.useEffect)(()=>{M()},[]);async function M(){b(!0),v(null);try{let e=await vb();g(e.hosts),i?.(e.hosts.map(e=>e.alias)),w(t=>t||e.hosts[0]?.alias||``),e.hosts.length||v(c(`source.hostEmpty`))}catch(e){v(e instanceof Error?e.message:c(`source.hostLoadError`))}finally{b(!1)}}function N(){u(!0),m(`configured`),f(null),M()}function P(){u(!1),m(`configured`),v(null),S(!1),w(``),f(null),E(``),O(`8876`),ee(``)}function F(){let e=r({label:T,statusUrl:k});if(e.error){f(e.error);return}P()}function ne(){if(`error`in j){f(j.error??c(`source.invalid`));return}let e=r({ensureTunnel:!0,hostAlias:j.hostAlias,label:j.label,statusUrl:j.statusUrl});if(e.error){f(e.error);return}P()}function re(e){let t=new Set;for(let e of s)try{t.add(new URL(e.statusUrl).port)}catch{}let n=`8877`;for(let e=8877;e<9077;e+=1)if(!t.has(String(e))){n=String(e);break}let i=yb(e,n);if(`error`in i){f(i.error??c(`source.invalid`));return}let a=r({ensureTunnel:!0,hostAlias:i.hostAlias,label:i.label,statusUrl:i.statusUrl});a.error?f(a.error):f(null),O(n)}async function I(){if(`error`in j){f(j.error??c(`source.invalid`));return}try{await navigator.clipboard.writeText(j.command),S(!0),f(null)}catch{f(c(`source.copyError`))}}return(0,H.jsxs)(`section`,{"aria-label":c(`source.controlPlane`),className:`personal-status-source`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`span`,{children:`Control plane`}),(0,H.jsx)(`button`,{"aria-label":c(`source.addSsh`),onClick:N,title:c(`source.add`),type:`button`,children:(0,H.jsx)(Fm,{size:14})})]}),(0,H.jsx)(Dy,{ariaLabel:c(`source.select`),className:`personal-status-source-select`,icon:(0,H.jsx)(Um,{size:15}),onChange:e=>{if(e.startsWith(te)){re(e.slice(11));return}o(e)},options:A,value:e.id}),(0,H.jsxs)(`div`,{className:`personal-status-source-meta`,children:[(0,H.jsxs)(`span`,{className:`is-${t}`,children:[(0,H.jsx)(`i`,{}),c(t===`loading`?`source.connecting`:t===`error`?`source.notAvailable`:`source.connected`)]}),(0,H.jsx)(`small`,{children:e.readOnly?c(`source.readOnly`):c(`source.localInteractive`)}),e.kind===`ssh_tunnel`?(0,H.jsx)(`button`,{"aria-label":c(`source.remove`,{source:e.label}),onClick:()=>a(e.id),title:c(`source.removeCurrent`),type:`button`,children:(0,H.jsx)(Zm,{size:12})}):null]}),n?(0,H.jsx)(`p`,{className:`personal-status-source-error`,role:`alert`,children:n}):null,l?(0,H.jsxs)(`div`,{className:`personal-status-source-form`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:c(`source.addSsh`)}),(0,H.jsx)(`button`,{"aria-label":c(`source.closeForm`),onClick:P,type:`button`,children:(0,H.jsx)(eh,{size:13})})]}),(0,H.jsxs)(`div`,{"aria-label":c(`source.addMethod`),className:`personal-status-source-modes`,role:`tablist`,children:[(0,H.jsx)(`button`,{"aria-selected":p===`configured`,onClick:()=>{m(`configured`),f(null)},role:`tab`,type:`button`,children:c(`source.configured`)}),(0,H.jsx)(`button`,{"aria-selected":p===`manual`,onClick:()=>{m(`manual`),f(null)},role:`tab`,type:`button`,children:c(`source.manual`)})]}),p===`configured`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.configuredCount`,{count:h.length})}),(0,H.jsxs)(`span`,{className:`personal-status-source-field-row`,children:[(0,H.jsx)(`input`,{"aria-label":c(`source.host`),disabled:y||!h.length,list:`loopx-configured-ssh-hosts`,onChange:e=>{w(e.target.value),S(!1)},placeholder:c(y?`source.loadingHosts`:`source.hostPlaceholder`),value:C}),(0,H.jsx)(`datalist`,{id:`loopx-configured-ssh-hosts`,children:h.map(e=>(0,H.jsx)(`option`,{value:e.alias},e.alias))}),(0,H.jsx)(`button`,{"aria-label":c(`source.refreshHosts`),disabled:y,onClick:()=>void M(),title:c(`source.refreshHosts`),type:`button`,children:(0,H.jsx)(zm,{size:13})})]})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.localPort`)}),(0,H.jsx)(`input`,{"aria-label":c(`source.localPort`),inputMode:`numeric`,onChange:e=>{O(e.target.value),S(!1)},value:D})]}),(0,H.jsxs)(`div`,{className:`personal-status-source-command`,children:[(0,H.jsx)(`code`,{children:`error`in j?c(`source.tunnelCommandPending`):j.command}),(0,H.jsxs)(`button`,{"aria-label":c(`source.copyCommand`),disabled:`error`in j,onClick:()=>void I(),type:`button`,children:[(0,H.jsx)(lm,{size:12}),c(x?`source.copied`:`source.copy`)]})]}),_?(0,H.jsx)(`p`,{className:`is-error`,children:_}):null,(0,H.jsx)(`p`,{children:c(`source.description`)}),(0,H.jsx)(`button`,{className:`personal-status-source-add`,disabled:`error`in j,onClick:ne,type:`button`,children:c(`source.addConfigured`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.name`)}),(0,H.jsx)(`input`,{autoFocus:!0,maxLength:48,onChange:e=>E(e.target.value),placeholder:c(`source.namePlaceholder`),value:T})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.statusUrl`)}),(0,H.jsx)(`input`,{onChange:e=>ee(e.target.value),placeholder:`http://127.0.0.1:8876/status.json`,value:k})]}),(0,H.jsx)(`p`,{children:(0,H.jsx)(`code`,{children:`ssh -N -L 8876:127.0.0.1:8766 `})}),(0,H.jsx)(`p`,{children:c(`source.manualDescription`)}),(0,H.jsx)(`button`,{className:`personal-status-source-add`,onClick:F,type:`button`,children:c(`source.addConfigured`)})]}),d?(0,H.jsx)(`p`,{className:`is-error`,role:`alert`,children:d}):null]}):null]})}var Tb={需修复:`is-danger`,等你:`is-warning`,等待条件:`is-info`,推进中:`is-success`,安静运行:`is-quiet`,已完成:`is-quiet`,已停止:`is-stopped`};function Eb({attentionCount:e,goals:t,goalArchiveLoadState:n={error:null,phase:`ready`},lifecycleBusyGoalIds:r,goalLifecycleOperations:i,onRequestGoalCreate:a,onOpenSettings:o,onRetryGoalArchive:s,onRequestGoalLifecycle:c,onSelectGoal:l,selectedGoalId:u,statusSourceControl:d}){let{locale:f,t:p}=qi(),[m,h]=(0,V.useState)(!1),g=pb(t.filter(e=>e.activationState!==`stopped`),d?.activeSource.statusUrl??`/status.json`),_=g.sorted,v=t.filter(e=>e.activationState===`stopped`),y=e=>!!c&&(!i||i.includes(e)),b=(e,t)=>(0,H.jsxs)(`div`,{className:`personal-goal-row${g.target?.id===e.goalId?g.target.after?` is-drop-after`:` is-drop-before`:``}`,"data-reorder-goal":t?void 0:e.goalId,"data-load-error":e.loadError,children:[(0,H.jsxs)(`button`,{...t?{}:g.pointerProps(e.goalId),title:t?void 0:p(`sidebar.dragGoal`),"aria-current":u===e.goalId?`page`:void 0,className:`personal-goal-link`,onClick:()=>l(e.goalId),type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-goal-state-dot ${e.loadState?``:Tb[e.state]}`}),(0,H.jsxs)(`span`,{className:`personal-goal-link-copy`,children:[(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsxs)(`small`,{children:[e.loadState&&(!t||u===e.goalId)?p(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Ji(e.state,f),e.needsYou&&!t?` · ${p(`home.lane.needsYou`)}`:``]})]}),(0,H.jsx)(rm,{size:15})]}),!t&&m?(0,H.jsxs)(`div`,{className:`personal-goal-move-actions`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":p(`sidebar.moveUp`,{goal:e.title}),disabled:_[0]?.goalId===e.goalId,onClick:()=>g.moveBy(e.goalId,-1),children:(0,H.jsx)(Yp,{"aria-hidden":`true`,size:13})}),(0,H.jsx)(`button`,{type:`button`,"aria-label":p(`sidebar.moveDown`,{goal:e.title}),disabled:_.at(-1)?.goalId===e.goalId,onClick:()=>g.moveBy(e.goalId,1),children:(0,H.jsx)(Gp,{"aria-hidden":`true`,size:13})})]}):null,c&&y(t?`resume`:`stop`)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{"aria-label":`${p(t?`sidebar.resume`:`sidebar.stop`)} ${e.title}`,"aria-busy":r?.has(e.goalId)||void 0,className:`personal-goal-lifecycle${r?.has(e.goalId)?` is-pending`:``}`,disabled:r?.has(e.goalId),onClick:()=>c(e,t?`resume`:`stop`),title:p(t?`sidebar.resumeGoal`:`sidebar.stopGoal`),type:`button`,children:r?.has(e.goalId)?(0,H.jsx)(wm,{size:13}):t?(0,H.jsx)(Rm,{size:13}):(0,H.jsx)(Nm,{size:13})}),t&&y(`delete`)?(0,H.jsx)(`button`,{"aria-label":`${p(`sidebar.delete`)} ${e.title}`,className:`personal-goal-lifecycle personal-goal-delete`,onClick:()=>c(e,`delete`),title:p(`sidebar.deleteGoal`),type:`button`,children:(0,H.jsx)(Zm,{size:13})}):null]}):null]},e.goalId);return(0,H.jsxs)(`div`,{className:`personal-goal-directory`,children:[(0,H.jsxs)(`div`,{className:`personal-sidebar-brand`,children:[(0,H.jsx)(`span`,{className:`personal-brand-mark`,children:(0,H.jsx)(Qp,{size:18})}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:`LoopX`})})]}),d?(0,H.jsx)(wb,{...d}):null,(0,H.jsxs)(`nav`,{"aria-label":p(`home.workspace`),className:`personal-sidebar-nav`,children:[(0,H.jsxs)(`button`,{"aria-current":u===null?`page`:void 0,className:`personal-manager-link`,onClick:()=>l(null),type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-manager-icon`,children:(0,H.jsx)(Qp,{size:17})}),(0,H.jsx)(`span`,{children:p(`sidebar.manager`)}),e>0?(0,H.jsx)(`span`,{className:`personal-sidebar-count`,children:e}):null,(0,H.jsx)(rm,{size:15})]}),(0,H.jsxs)(`div`,{className:`personal-sidebar-section-title`,children:[(0,H.jsx)(`span`,{children:`Goals`}),(0,H.jsxs)(`span`,{className:`personal-sidebar-title-actions`,children:[(0,H.jsx)(`small`,{children:_.length}),(0,H.jsx)(`button`,{"aria-label":p(`sidebar.sortGoals`),title:p(`sidebar.sortGoals`),"aria-pressed":m,onClick:()=>h(!m),type:`button`,children:(0,H.jsx)(Jp,{"aria-hidden":`true`,size:15})}),a?(0,H.jsx)(`button`,{"aria-label":p(`sidebar.createGoal`),onClick:a,type:`button`,children:(0,H.jsx)(Fm,{size:15})}):null]})]}),g.saveFailed?(0,H.jsx)(`p`,{role:`status`,children:p(`sidebar.orderNotSaved`)}):null,(0,H.jsx)(`span`,{className:`personal-sr-only`,role:`status`,children:g.lastMoved?p(`sidebar.goalMoved`,{goal:g.lastMoved.title,position:g.lastMoved.position}):``}),(0,H.jsx)(`div`,{className:`personal-goal-list`,children:_.map(e=>b(e,!1))}),v.length||n.phase===`loading`||n.phase===`error`?(0,H.jsxs)(`details`,{className:`personal-stopped-goals`,open:n.phase===`error`||void 0,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(nm,{size:13}),(0,H.jsx)(`span`,{children:p(`sidebar.stopped`)}),n.phase===`loading`?(0,H.jsx)(wm,{"aria-label":p(`sidebar.stoppedLoading`),className:`is-spinning`,size:13}):(0,H.jsx)(`small`,{children:v.length})]}),(0,H.jsxs)(`div`,{className:`personal-goal-list is-stopped`,children:[n.phase===`error`?(0,H.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`alert`,children:[(0,H.jsx)(`span`,{children:p(`sidebar.stoppedLoadFailed`)}),s?(0,H.jsx)(`button`,{onClick:s,type:`button`,children:p(`sidebar.retryStopped`)}):null]}):null,v.map(e=>b(e,!0))]})]}):null]}),(0,H.jsxs)(`div`,{className:`personal-sidebar-footer`,children:[(0,H.jsx)(cb,{}),o?(0,H.jsxs)(`button`,{"aria-label":p(`settings.open`),className:`personal-sidebar-utility`,onClick:o,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-sidebar-utility-icon`,children:(0,H.jsx)(Wm,{size:17})}),(0,H.jsx)(`span`,{className:`personal-sidebar-utility-copy`,children:(0,H.jsx)(`strong`,{children:p(`settings.open`)})}),(0,H.jsx)(rm,{"aria-hidden":`true`,size:15})]}):null]})]})}var Db=Y({ok:X(!0),total:K().int().nonnegative(),next_cursor:G().nullable(),items:J(Y({todo_id:G(),text:G(),claimed_by:G().nullable(),evidence:G().nullable(),priority:G().nullable(),task_class:G().nullable()})).max(40)});function Ob({goal:e,agentId:t,seed:n,enabled:r,listView:i=!1,onSelect:a}){let{t:o}=qi(),s=(0,V.useId)(),[c,l]=(0,V.useState)(!1),u=!i||c,d=i?96:148,[f,p]=(0,V.useState)(n),[m,h]=(0,V.useState)(t===`all`?e.doneTodoCount??n.length:n.length),[g,_]=(0,V.useState)(void 0),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(!1),[w,T]=(0,V.useState)({top:0,height:600}),[E,D]=(0,V.useState)(null),O=(0,V.useRef)(null),k=(0,V.useRef)(null),[ee,te]=(0,V.useState)(0);(0,V.useEffect)(()=>{let e=O.current;if(!e)return;let t=new ResizeObserver(()=>T({top:e.scrollTop,height:e.clientHeight}));return t.observe(e),()=>{t.disconnect(),k.current?.abort()}},[]);let A=g===void 0||w.top+w.height>=f.length*d-d*2;(0,V.useEffect)(()=>{if(!r||!u||!A||g===null||b||k.current)return;let n=new AbortController;k.current=n,y(!0);let i=new URLSearchParams({goal_id:e.goalId});t!==`all`&&i.set(`agent_id`,t),g&&i.set(`cursor`,g),fetch(`/api/chat/completed-todos?${i}`,{signal:n.signal}).then(async e=>{if(e.status===409&&C(!0),!e.ok)throw Error(`history unavailable`);let t=Db.parse(await e.json());if(n.signal.aborted)return;let r=t.items.map(e=>({todoId:e.todo_id,text:e.text,claimedBy:e.claimed_by,evidence:e.evidence,priority:e.priority,taskClass:e.task_class,done:!0,status:`done`}));p(e=>g===void 0?r:[...e,...r.filter(t=>!e.some(e=>e.todoId===t.todoId))]),h(t.total),_(t.next_cursor)}).catch(()=>{n.signal.aborted||x(!0)}).finally(()=>{n.signal.aborted||(k.current=null,y(!1))})},[r,u,A,g,b,ee,e.goalId,t,v]),(0,V.useEffect)(()=>{O.current&&(O.current.scrollTop=0),T({top:0,height:O.current?.clientHeight??600}),D(null)},[i]);let j=Math.max(0,Math.floor(w.top/d)-3),M=Math.min(f.length,Math.ceil((w.top+w.height)/d)+3),N=Array.from({length:Math.max(0,M-j)},(e,t)=>j+t);return E!==null&&El(e=>!e),children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,children:c?`▾`:`▸`}),` `,o(`tasks.completed`)]}):(0,H.jsxs)(`strong`,{children:[(0,H.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-done`}),o(`tasks.completed`)]}),(0,H.jsx)(`span`,{children:m})]}),(0,H.jsxs)(`div`,{id:s,hidden:!u,"aria-label":o(`tasks.completed`),className:`personal-task-lane-scroll`,ref:O,role:`region`,tabIndex:0,onScroll:e=>T({top:e.currentTarget.scrollTop,height:e.currentTarget.clientHeight}),children:[(0,H.jsx)(`div`,{className:`personal-completed-window`,style:{height:f.length*d},children:N.map(t=>{let n=f[t];return(0,H.jsx)(`div`,{className:`personal-task-card personal-completed-row`,style:{top:t*d,height:d},children:(0,H.jsxs)(`button`,{type:`button`,onFocus:()=>D(t),onBlur:()=>D(null),onClick:()=>a({kind:`todo`,item:{...n,goalId:e.goalId,goalTitle:e.title,ownerLabel:n.claimedBy??e.agentLabel??e.agentId}}),children:[(0,H.jsx)(`span`,{className:`is-done`,children:`✓`}),(0,H.jsx)(`strong`,{children:n.text}),(0,H.jsx)(`small`,{children:n.claimedBy??e.agentLabel??e.agentId})]})},n.todoId)})}),(0,H.jsx)(`div`,{className:`personal-completed-footer`,role:`status`,children:v?o(`tasks.historyLoading`):b?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:o(S?`tasks.historyExpired`:`tasks.historyError`)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{S&&(_(void 0),O.current&&(O.current.scrollTop=0)),C(!1),x(!1),te(e=>e+1)},children:o(`tasks.historyRetry`)})]}):r?g===null?o(`tasks.historyEnd`):(0,H.jsx)(`button`,{type:`button`,onClick:()=>{O.current&&(O.current.scrollTop=f.length*d)},children:o(`tasks.historyMore`)}):o(`tasks.historyLocalOnly`)})]})]})}function kb({children:e,count:t,label:n,tone:r,listView:i=!1}){let a=(0,V.useId)(),o=(0,V.useRef)(null),s=(0,V.useRef)([]),c=(0,V.useRef)(null),[l,u]=(0,V.useState)({after:!1,before:!1}),d=(0,V.useCallback)(()=>{let e=o.current;if(!e)return;let t={after:Math.max(0,e.scrollHeight-e.clientHeight)-e.scrollTop>1,before:e.scrollTop>1};u(e=>e.after===t.after&&e.before===t.before?e:t)},[]);return(0,V.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(d);return c.current=t,t.observe(e),e.addEventListener(`scroll`,d,{passive:!0}),d(),()=>{t.disconnect(),c.current=null,s.current=[],e.removeEventListener(`scroll`,d)}},[i,d]),(0,V.useEffect)(()=>{let e=o.current,t=c.current;if(!e||!t)return;for(let e of s.current)t.unobserve(e);let n=Array.from(e.children).filter(e=>e instanceof HTMLElement);for(let e of n)t.observe(e);s.current=n,d()},[e,t,i,d]),i?!t&&r!==`done`?null:(0,H.jsxs)(`details`,{className:`personal-task-group tone-${r}`,open:!0,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(nm,{size:16}),(0,H.jsx)(`strong`,{children:n}),(0,H.jsx)(`span`,{children:t})]}),(0,H.jsx)(`div`,{className:`personal-task-list-rows`,children:e})]}):(0,H.jsxs)(`section`,{className:`personal-object-list personal-task-lane`,children:[(0,H.jsxs)(`header`,{id:a,children:[(0,H.jsxs)(`strong`,{children:[(0,H.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-${r}`}),n]}),(0,H.jsx)(`span`,{children:t})]}),(0,H.jsx)(`div`,{"aria-labelledby":a,className:`personal-task-lane-scroll${l.before?` has-overflow-before`:``}${l.after?` has-overflow-after`:``}`,ref:o,role:`region`,tabIndex:t>0?0:-1,children:e})]})}function Ab({historyEnabled:e=!1,goal:t,items:n,onDraftTaskFromMessage:r,onOpenChat:i,onQuickComplete:a,quickCompletingTodoIds:o,onSelect:s,selectedTodoId:c=null,userTodos:l}){let{t:u}=qi(),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)({goalId:``,laneId:`all`}),h=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!c)return;let e=window.requestAnimationFrame(()=>h.current?.scrollIntoView({block:`nearest`,inline:`nearest`}));return()=>window.cancelAnimationFrame(e)},[c]);let g=l.filter(e=>e.goalId===t.goalId).map(e=>({...e,goalTitle:t.title})),_=e=>e.priority===`P0`?0:e.priority===`P1`?1:e.priority===`P2`?2:3,v=(0,V.useMemo)(()=>{let e=new Map((t.agentLanes??[]).map(e=>[e.agentId,e]));for(let n of t.agentTodos)n.claimedBy&&!e.has(n.claimedBy)&&e.set(n.claimedBy,{agentId:n.claimedBy,label:n.claimedBy});return[...e.values()]},[t.agentLanes,t.agentTodos]),y=p.goalId===t.goalId&&v.some(e=>e.agentId===p.laneId)?p.laneId:`all`,b=e=>y===`all`||e===y,x=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&!e.done).filter(e=>b(e.claimedBy)).sort((e,t)=>_(e)-_(t)),S=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&e.done).filter(e=>b(e.claimedBy)),C=n.filter(e=>e.kind===`schedule`&&b(e.schedule.agentId)),w=n.filter(e=>e.kind===`run`&&!!e.run.todoId&&b(e.run.agentId)),T=!g.length&&!x.length&&!S.length&&!C.length,E=n.filter(e=>e.kind===`message`&&(e.message.role===`user`||e.message.role===`assistant`)),D=E.reduce((e,t,n)=>t.message.role===`user`?n:e,-1),O=D>=0?E[D]?.message:null,k=D>=0?E.slice(D+1).reverse().find(e=>e.message.role===`assistant`)?.message:null,ee=D>=0&&E.slice(D+1).some(e=>e.message.role===`assistant`&&e.message.pending);return(0,H.jsxs)(`section`,{"aria-label":u(`header.tasks`),className:`personal-task-board${d?` is-list-view`:``}`,children:[(0,H.jsxs)(`header`,{className:`personal-task-view-toolbar`,children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(`strong`,{children:u(`header.tasks`)})}),(0,H.jsxs)(`div`,{className:`personal-task-view-switch`,role:`group`,"aria-label":u(`tasks.viewLabel`),children:[(0,H.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(!0),children:u(`tasks.listView`)}),(0,H.jsx)(`button`,{type:`button`,"aria-pressed":!d,onClick:()=>f(!1),children:u(`tasks.boardView`)})]})]}),v.length>1?(0,H.jsxs)(`section`,{"aria-label":u(`tasks.agentLaneFilter`),className:`personal-task-lane-filter`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Qp,{size:15}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:u(`tasks.agentLane`)})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`sr-only`,children:u(`tasks.agentLaneFilter`)}),(0,H.jsxs)(`select`,{"aria-label":u(`tasks.agentLaneFilter`),onChange:e=>m({goalId:t.goalId,laneId:e.target.value}),value:y,children:[(0,H.jsx)(`option`,{value:`all`,children:u(`tasks.allAgentLanes`,{count:v.length})}),v.map(e=>(0,H.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))]}),(0,H.jsx)(nm,{"aria-hidden":!0,size:14})]})]}):null,O?(0,H.jsxs)(`section`,{"aria-label":u(`tasks.chatRecent`),className:`personal-task-chat-receipt`,children:[(0,H.jsx)(`span`,{className:`personal-task-chat-icon`,children:(0,H.jsx)(Om,{size:18})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:u(ee?`tasks.chatPending`:k?`tasks.chatAgentReplied`:`tasks.chatRecent`)}),(0,H.jsx)(`small`,{children:t.agentLabel??t.agentId})]}),(0,H.jsxs)(`p`,{className:`is-user`,children:[(0,H.jsx)(`b`,{children:u(`common.you`)}),O.text]}),k&&!k.pending?(0,H.jsxs)(`p`,{className:`is-assistant`,children:[(0,H.jsx)(`b`,{children:u(`common.agent`)}),k.text]}):null,(0,H.jsx)(`small`,{children:u(ee?`tasks.chatPendingDescription`:`tasks.chatUnchangedDescription`)})]}),(0,H.jsxs)(`footer`,{children:[(0,H.jsxs)(`button`,{onClick:i,type:`button`,children:[(0,H.jsx)(Om,{size:14}),u(`tasks.chatViewReply`)]}),k&&!ee&&r?(0,H.jsxs)(`button`,{onClick:()=>r(k.text),type:`button`,children:[(0,H.jsx)(Cm,{size:14}),u(`tasks.convertToTask`)]}):null]})]}):null,(0,H.jsxs)(`div`,{className:d?`personal-task-grouped-list`:`personal-task-kanban`,children:[(0,H.jsxs)(kb,{listView:d,count:g.length,label:u(`timeline.waitingConfirmation`),tone:`attention`,children:[g.map(e=>{let t=Xi(e.updatedAt,u);return(0,H.jsxs)(`button`,{onClick:()=>s({item:e,kind:`attention`}),type:`button`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`is-attention`,children:`!`}),(0,H.jsx)(`strong`,{children:e.text}),(0,H.jsxs)(`small`,{children:[(0,H.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?u(`tasks.blocked`):u(`tasks.pending`)}),t?(0,H.jsx)(`span`,{className:`personal-task-age`,children:u(`tasks.waitingAge`,{age:t})}):null]})]},e.todoId)}),g.length?null:(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyConfirm`)})]}),(0,H.jsxs)(kb,{listView:d,count:x.length,label:u(`tasks.pendingAndRunning`),tone:`progress`,children:[x.map(e=>{let n={...e,goalId:t.goalId,goalTitle:t.title,ownerLabel:e.claimedBy??t.agentLabel??t.agentId},r=w.find(t=>t.run.todoId===e.todoId)?.run;return(0,H.jsxs)(`div`,{className:`personal-task-card${r?` has-session`:``}${c===e.todoId?` is-selected`:``}`,ref:c===e.todoId?e=>{h.current=e}:void 0,children:[(0,H.jsxs)(`button`,{"aria-pressed":c===e.todoId,onClick:()=>s({item:n,kind:`todo`}),type:`button`,children:[(0,H.jsx)(`span`,{children:`○`}),(0,H.jsx)(`strong`,{children:e.text}),(0,H.jsxs)(`small`,{children:[e.priority?(0,H.jsx)(`span`,{className:`personal-priority-badge is-${e.priority.toLowerCase()}`,children:e.priority}):null,e.status===`blocked`?(0,H.jsx)(`span`,{className:`personal-priority-badge is-blocked`,children:u(`tasks.blocked`)}):null,r?(0,H.jsx)(`span`,{className:`personal-task-session-status`,children:r.status===`running`||r.status===`queued`?u(`runs.running`):r.status===`failed`?u(`tasks.sessionError`):u(`common.waiting`)}):null,e.status===`deferred`?(0,H.jsx)(`span`,{className:`personal-task-session-status`,children:u(`drawer.taskStatusDeferred`)}):r?null:(0,H.jsx)(`span`,{className:`personal-task-session-status`,children:u(`tasks.waiting`)}),e.claimedBy??t.agentLabel??t.agentId]})]}),(0,H.jsxs)(`div`,{className:`personal-task-card-actions`,children:[r?(0,H.jsxs)(`button`,{className:`personal-task-session-link`,"aria-label":u(`tasks.openExecution`,{name:e.text}),onClick:()=>s({item:r,kind:`run`}),title:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`),type:`button`,children:[(0,H.jsx)(pm,{size:14}),(0,H.jsx)(`span`,{children:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`)})]}):null,a?(0,H.jsx)(`button`,{"aria-busy":o?.has(e.todoId)||void 0,"aria-label":u(`tasks.markComplete`,{name:e.text}),disabled:o?.has(e.todoId),onClick:()=>void a(n),title:u(`tasks.completed`),type:`button`,children:o?.has(e.todoId)?(0,H.jsx)(wm,{className:`personal-spin`,size:14}):(0,H.jsx)(tm,{size:14})}):null,(0,H.jsx)(`button`,{"aria-label":u(`tasks.moreActions`,{name:e.text}),onClick:()=>s({item:n,kind:`todo`}),title:u(`common.actions`),type:`button`,children:(0,H.jsx)(fm,{size:14})})]})]},e.todoId)}),x.length?null:(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyRunning`)})]}),(0,H.jsxs)(kb,{listView:d,count:C.length,label:u(`tasks.scheduled`),tone:`schedule`,children:[C.map(e=>(0,H.jsxs)(`button`,{onClick:()=>s({item:e.schedule,kind:`schedule`}),type:`button`,children:[(0,H.jsx)(`span`,{children:`◷`}),(0,H.jsx)(`strong`,{children:e.schedule.label}),(0,H.jsx)(`small`,{children:e.schedule.status===`paused`?u(`schedule.paused`):u(`schedule.active`)})]},e.id)),C.length?null:(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptySchedules`)})]}),(0,H.jsx)(Ob,{goal:t,agentId:y,seed:S,enabled:e,listView:d,onSelect:s},`${t.goalId}:${y}:${e}`)]}),T?(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyGoal`)}):null]})}function jb(e,t){return{live_steering:{label:t(`lark.ingressSteering`),detail:t(`lark.ingressSteeringDescription`)},session_queue:{label:t(`lark.ingressQueue`),detail:t(`lark.ingressQueueDescription`)},async_inbox:{label:t(`lark.ingressAsync`),detail:t(`lark.ingressAsyncDescription`)},direct_session:{label:t(`lark.ingressLegacy`),detail:t(`lark.ingressLegacyDescription`)}}[e]}function Mb(e,t){return e.listener_status===`starting`?{label:t(`lark.health.starting`),detail:t(`lark.health.startingDetail`),state:`not_ready`}:e.listener_status===`retrying`&&e.listener_error_code===`lark_event_source_disconnected`?{label:t(`lark.health.sourceDisconnected`),detail:t(`lark.health.sourceDisconnectedDetail`),state:`not_ready`}:e.listener_status===`retrying`?{label:t(`lark.health.retrying`),detail:t(`lark.health.retryingDetail`),state:`not_ready`}:e.listener_status===`stopped`||e.listener_status===null?{label:t(`lark.health.notStarted`),detail:t(`lark.health.notStartedDetail`),state:`not_ready`}:e.last_event_status===`message_context_permission_required`?{label:t(`lark.health.messageContextPermission`),detail:t(`lark.health.messageContextPermissionDetail`),state:`not_ready`}:e.last_event_status===`processing_failed`?{label:t(`lark.health.processingFailed`),detail:t(`lark.health.processingFailedDetail`),state:`not_ready`}:e.health_error_code===`invalid_routing_state`?{label:t(`lark.health.invalidRouting`),detail:t(`lark.health.invalidRoutingDetail`),state:`not_ready`}:e.last_event_status===`queued_for_agent`?{label:t(`lark.health.queued`),detail:t(`lark.health.queuedDetail`,{agent:e.agent_id??t(`lark.targetAgent`)}),state:`ready`}:e.last_event_status===`context_only_captured`||e.last_event_status===`context_only_already_captured`?{label:t(`lark.health.contextCaptured`),detail:t(`lark.health.contextCapturedDetail`),state:`ready`}:e.last_event_status===`ignored`&&e.last_event_reason===`not_addressed`?{label:t(`lark.health.notAddressed`),detail:t(`lark.health.notAddressedDetail`),state:`ready`}:e.last_event_status===`ignored`&&e.last_event_reason===`self_message`?{label:t(`lark.health.listening`),detail:t(`lark.health.ignoredSelf`),state:`ready`}:e.health_error_code===`lark_event_route_mismatch`||[`chat_mismatch`,`topic_mismatch`,`route_ambiguous`].includes(e.last_event_reason??``)?{label:e.last_event_reason===`route_ambiguous`?t(`lark.health.routeAmbiguous`):t(`lark.health.routeMismatch`),detail:e.last_event_reason===`route_ambiguous`?t(`lark.health.routeAmbiguousDetail`):t(`lark.health.routeMismatchDetail`),state:`not_ready`}:[`invalid_event`,`binding_unavailable`].includes(e.last_event_reason??``)?{label:t(`lark.health.routeUnavailable`),detail:t(`lark.health.routeUnavailableDetail`),state:`not_ready`}:e.last_event_status===`replied_and_acknowledged`?{label:t(`lark.health.listening`),detail:t(`lark.health.eventProcessed`,{events:e.event_count,replies:e.replied_count}),state:`ready`}:e.health_error_code===`lark_event_delivery_unverified`||e.event_count===0?{label:t(`lark.health.eventUnverified`),detail:t(`lark.health.eventUnverifiedDetail`),state:`unverified`}:{label:e.reply_ready?t(`lark.health.listening`):t(`lark.health.unavailable`),detail:t(`lark.health.lastStatus`,{status:e.last_event_status??t(`lark.health.waiting`)}),state:e.reply_ready?`ready`:`not_ready`}}function Nb(e){return e.history_permission_guidance?.api_document_url??null}function Pb(e,t,n){if(e instanceof Eh){let t=String(e.payload.error_code??``);return{lark_cli_not_installed:n(`lark.error.cliMissing`),lark_cli_not_executable:n(`lark.error.cliExecutable`),lark_cli_start_failed:n(`lark.error.cliStart`),lark_message_permissions_required:n(`lark.error.messagePermissions`),lark_app_required:n(`lark.error.appRequired`),invalid_lark_app:n(`lark.error.invalidApp`),lark_group_lookup_failed:n(`lark.error.groupLookup`),provider_api_failed:n(`lark.error.provider`)}[t]??e.message}return e instanceof Error?e.message:t}function Fb({embedded:e=!1,focusGoalConnection:t=!1,goals:n,initialGoalId:r,onChanged:i,onClose:a}){let{t:o}=qi(),[s,c]=(0,V.useState)(`connections`),[l,u]=(0,V.useState)([]),[d,f]=(0,V.useState)([]),[p,m]=(0,V.useState)(!0),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(``),[y,b]=(0,V.useState)(t),[x,S]=(0,V.useState)(``),[C,w]=(0,V.useState)(r??n[0]?.goalId??``),[T,E]=(0,V.useState)(``),[D,O]=(0,V.useState)([]),[k,ee]=(0,V.useState)(``),[te,A]=(0,V.useState)(!1),[j,M]=(0,V.useState)(null),[N,P]=(0,V.useState)(`addressed_only`),[F,ne]=(0,V.useState)(t&&r?`goal`:`manager`),[re,I]=(0,V.useState)(`async_inbox`),[L,ie]=(0,V.useState)(`topic_reply`),[R,ae]=(0,V.useState)(``),[oe,se]=(0,V.useState)(!1),[ce,le]=(0,V.useState)({}),[ue,z]=(0,V.useState)(!1),[de,fe]=(0,V.useState)(null),[pe,me]=(0,V.useState)(null),[he,ge]=(0,V.useState)(null),[_e,ve]=(0,V.useState)(null),[ye,be]=(0,V.useState)(!1),[xe,Se]=(0,V.useState)(`loopx-workspace-bot`),[Ce,we]=(0,V.useState)(`feishu`),[Te,B]=(0,V.useState)(null),[Ee,De]=(0,V.useState)(!1),[Oe,ke]=(0,V.useState)(null),Ae=(0,V.useRef)(null),je=(0,V.useRef)(null),Me=(0,V.useRef)(!1);async function Ne(){m(!0),g(null);try{let[e,t]=await Promise.all([zg(),Jg()]);u(e),f(t),S(t=>t||e.find(e=>e.reply_ready)?.app_ref||e.find(e=>e.ready)?.app_ref||e[0]?.app_ref||``)}catch(e){g(Pb(e,o(`lark.error.configuration`),o))}finally{m(!1)}}(0,V.useEffect)(()=>{Ne()},[]),(0,V.useEffect)(()=>{if(!t||p||Me.current||!r)return;Me.current=!0;let e=d.find(e=>e.goal_id===r);e?qe(e):Ke(n.find(e=>e.goalId===r))},[d,t,n,r,p]),(0,V.useEffect)(()=>{if(!y||!x||he){O([]),ee(``),A(!1),M(null);return}let e=!1;A(!0),M(null);let t=window.setTimeout(()=>{Kg(x,T).then(t=>{e||(O(t),ee(e=>t.some(t=>t.chat_id===e)?e:t[0]?.chat_id??``))}).catch(t=>{e||(O([]),ee(``),M(Pb(t,o(`lark.error.groupLoad`),o)))}).finally(()=>{e||A(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[x,T,y,he]),(0,V.useEffect)(()=>{if(!ye||!Te||[`ready`,`failed`,`cancelled`].includes(Te.status))return;let e=!1,t=window.setTimeout(()=>{Hg(Te.setup_id).then(async t=>{e||(B(t),t.verification_url&&je.current!==t.verification_url&&(je.current=t.verification_url,Ae.current&&!Ae.current.closed&&(Ae.current.location.href=t.verification_url)),t.status===`ready`&&(await Ne(),S(t.app_ref),le({}),be(!1)),t.status===`failed`&&ke(t.error??o(`lark.error.appCreate`)))}).catch(t=>{e||ke(Pb(t,o(`lark.error.setupPoll`),o))})},650);return()=>{e=!0,window.clearTimeout(t)}},[ye,Te]);let Pe=n.find(e=>e.goalId===C),Fe=Pe?.agentId?[{agentId:Pe.agentId,label:Pe.agentLabel??Pe.agentId}]:[],Ie=Pe?.agentLanes?.length?Pe.agentLanes:Fe,Le=Ie.some(e=>e.agentId===R),Re=[];oe?Re=Ie.map(e=>({agentId:e.agentId,appRef:ce[e.agentId]??x})):Le&&(Re=[{agentId:R,appRef:x}]);let ze=Re.map(e=>e.agentId),Be=!!he||Re.length>0&&Re.every(e=>l.some(t=>t.app_ref===e.appRef&&t.reply_ready)),Ve=o(`lark.connect`);pe?Ve=o(`lark.saveConnection`):oe&&(Ve=o(`lark.connectAllAgentsAction`,{count:ze.length}));let He=l.find(e=>e.app_ref===x),Ue=D.find(e=>e.chat_id===k),We=(0,V.useMemo)(()=>{let e=_.trim().toLocaleLowerCase();return e?d.filter(t=>[t.app_label,t.chat_name,t.goal_title,t.topic_name].some(t=>t.toLocaleLowerCase().includes(e))):d},[d,_]),Ge=(0,V.useMemo)(()=>d.filter(e=>Mb(e,o).state===`unverified`).length,[d,o]);function Ke(e){let i=e??n.find(e=>e.goalId===r)??n[0];me(null),ge(null),ne(e||t?`goal`:`manager`),S(l.some(e=>e.app_ref===x)?x:l.find(e=>e.reply_ready)?.app_ref??l[0]?.app_ref??``),ee(``),w(i?.goalId??``),ae(i?.agentId??``),se(!1),le({}),P(`addressed_only`),I(`async_inbox`),ie(`topic_reply`),E(``),fe(null),b(!0)}function qe(e){me(e.goal_id),ge(e),ne(e.conversation_kind??`goal`),S(e.app_ref),w(e.goal_id);let t=n.find(t=>t.goalId===e.goal_id),r=t?.agentLanes?.length?t.agentLanes:t?.agentId?[{agentId:t.agentId}]:[];ae(e.agent_id??(r.length===1?r[0].agentId:``)),se(!1),le({}),P(e.capture_scope),I(e.ingress_mode===`direct_session`?`async_inbox`:e.ingress_mode),ie(e.reply_mode),E(e.chat_name),fe(null),b(!0)}function Je(){B(null),ke(null),je.current=null,be(!0)}async function Ye(){if(!(Ee||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(xe))){De(!0),ke(null),je.current=null,Ae.current=window.open(window.location.href,`_blank`);try{let e=await Vg({appRef:xe,brand:Ce});B(e)}catch(e){Ae.current?.close(),ke(Pb(e,o(`lark.error.setupStart`),o))}finally{De(!1)}}}async function Xe(){let e=Te;if(be(!1),Ae.current?.close(),e&&![`ready`,`failed`,`cancelled`].includes(e.status))try{await Ug(e.setup_id)}catch{}}async function Ze(){if(!(!x||!C||!he&&!Ue||F===`goal`&&ze.length===0||ue)){z(!0),fe(null);try{let e={...F===`manager`?{...he?{connectionId:he.connection_id}:{appRef:x,chatId:Ue.chat_id,chatName:Ue.chat_name}}:he?{connectionId:he.connection_id,agentId:R}:{agentBindings:Re,chatId:Ue.chat_id,chatName:Ue.chat_name},conversationKind:F,captureScope:F===`manager`?`addressed_only`:N,goalId:C,incomingMode:N===`configured_chat_all`?`all`:`mentions`,ingressMode:F===`manager`?`session_queue`:re,replyMode:L},t=await Yg({...e,execute:!1});if(!t.ok)throw new Eh(t.public_summary??t.blocker??o(`lark.error.bindPreview`),{error_code:t.blocker??`provider_api_failed`});let n=await Yg({...e,execute:!0});if(!n.ok)throw new Eh(n.public_summary??n.blocker??o(`lark.error.bind`),{error_code:n.blocker??`provider_api_failed`});b(!1),await Ne(),i?.()}catch(e){fe(Pb(e,o(`lark.error.bind`),o))}finally{z(!1)}}}async function Qe(e,t){if(_e!==t){ve(t);return}try{await Xg(e,t),ve(null),await Ne(),i?.()}catch(e){g(Pb(e,o(`lark.error.disconnect`),o))}}return(0,H.jsxs)(`section`,{className:`personal-lark-settings${e?` is-embedded`:``}`,"aria-label":o(`lark.configuration`),children:[e?null:(0,H.jsxs)(`header`,{className:`personal-lark-header`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:o(`settings.goalConnections`)}),(0,H.jsx)(`h1`,{children:`Lark`})]}),(0,H.jsx)(`button`,{"aria-label":o(`lark.closeSettings`),className:`personal-icon-button`,onClick:a,type:`button`,children:(0,H.jsx)(eh,{size:18})})]}),(0,H.jsxs)(`nav`,{className:`personal-lark-tabs`,"aria-label":o(`lark.management`),children:[(0,H.jsxs)(`button`,{"aria-current":s===`apps`?`page`:void 0,onClick:()=>c(`apps`),type:`button`,children:[o(`lark.apps`),` `,(0,H.jsx)(`span`,{children:p?`…`:l.length})]}),(0,H.jsxs)(`button`,{"aria-current":s===`connections`?`page`:void 0,onClick:()=>c(`connections`),type:`button`,children:[o(`lark.connections`),` `,(0,H.jsx)(`span`,{children:p?`…`:d.length})]})]}),h?(0,H.jsx)(`p`,{className:`personal-notification-error`,children:h}):null,p?(0,H.jsxs)(`div`,{className:`personal-lark-loading`,children:[(0,H.jsx)(wm,{className:`is-spinning`,size:18}),o(`lark.loading`)]}):null,!p&&s===`apps`?(0,H.jsxs)(`div`,{className:`personal-lark-apps`,children:[(0,H.jsxs)(`div`,{className:`personal-lark-app-toolbar`,children:[(0,H.jsx)(`span`,{children:o(`lark.reusableApps`,{count:l.length})}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:Je,type:`button`,children:[(0,H.jsx)(Fm,{size:16}),o(`lark.newApp`)]})]}),(0,H.jsxs)(`div`,{className:`personal-lark-app-grid`,children:[l.map(e=>(0,H.jsxs)(`article`,{className:`personal-lark-app-card`,children:[(0,H.jsx)(`span`,{className:`personal-lark-app-avatar`,children:(0,H.jsx)(Qp,{size:19})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsxs)(`small`,{children:[e.brand,` · lark-cli profile`]})]}),(0,H.jsx)(`em`,{className:e.reply_ready?`is-ready`:`is-off`,children:e.reply_ready?o(`lark.autoReplyReady`):e.ready?o(`lark.needsMessagePermissions`):o(`lark.needsSetup`)}),(0,H.jsxs)(`p`,{children:[o(`lark.goalConnections`,{count:d.filter(t=>t.app_ref===e.app_ref).length}),e.ready&&!e.reply_ready?` · ${o(`lark.autoReplyUnavailable`)}`:``]})]},e.app_ref)),l.length===0?(0,H.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noProfiles`)}):null]})]}):null,!p&&s===`connections`?(0,H.jsxs)(`div`,{className:`personal-lark-connections`,children:[Ge>0?(0,H.jsxs)(`p`,{className:`personal-lark-route-readiness`,role:`status`,children:[(0,H.jsx)(Om,{size:15}),o(`lark.routesUnverified`,{count:Ge})]}):null,(0,H.jsxs)(`div`,{className:`personal-lark-toolbar`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(Bm,{size:16}),(0,H.jsx)(`input`,{"aria-label":o(`lark.searchConnections`),onChange:e=>v(e.target.value),placeholder:o(`lark.searchPlaceholder`),type:`search`,value:_})]}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:l.length===0||n.length===0,onClick:()=>Ke(),type:`button`,children:[(0,H.jsx)(Fm,{size:16}),o(`lark.connectApp`)]})]}),(0,H.jsxs)(`div`,{className:`personal-lark-table`,role:`table`,"aria-label":o(`lark.goalTopicConnections`),children:[(0,H.jsxs)(`div`,{className:`personal-lark-table-head`,role:`row`,children:[(0,H.jsx)(`span`,{children:o(`lark.connection`)}),(0,H.jsx)(`span`,{children:o(`common.goal`)}),(0,H.jsx)(`span`,{children:o(`lark.capture`)}),(0,H.jsx)(`span`,{children:o(`lark.processing`)}),(0,H.jsx)(`span`,{children:o(`common.actions`)})]}),We.map(e=>{let t=Mb(e,o);return(0,H.jsxs)(`div`,{className:`personal-lark-table-row`,role:`row`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.chat_name}),(0,H.jsxs)(`small`,{children:[e.app_label,` · `,t.label]}),(0,H.jsx)(`small`,{children:t.detail}),t.state===`unverified`?(0,H.jsxs)(`a`,{href:`https://open.feishu.cn/document/server-docs/im-v1/message/events/receive?lang=zh-CN`,rel:`noreferrer`,target:`_blank`,children:[(0,H.jsx)(pm,{size:12}),o(`lark.openEventSettings`)]}):null,Nb(e)?(0,H.jsxs)(`a`,{href:Nb(e)??void 0,rel:`noreferrer`,target:`_blank`,children:[(0,H.jsx)(pm,{size:12}),o(`lark.historyPermission`)]}):null]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.goal_title}),(0,H.jsxs)(`small`,{children:[`# `,e.topic_name]})]}),(0,H.jsx)(`span`,{children:e.capture_scope===`addressed_only`?o(`lark.mentionsOnly`):o(`lark.allTopicMessages`)}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.conversation_kind===`manager`?o(`lark.managerConversation`):jb(e.ingress_mode,o).label}),(0,H.jsx)(`small`,{children:e.conversation_kind===`manager`?o(`lark.managerConversationDescription`):e.agent_id??jb(e.ingress_mode,o).detail})]}),(0,H.jsxs)(`span`,{className:`personal-lark-row-actions`,children:[(0,H.jsx)(`button`,{"aria-label":o(`lark.settingsConfigure`,{goal:e.goal_title}),onClick:()=>qe(e),type:`button`,children:(0,H.jsx)(Wm,{size:15})}),(0,H.jsxs)(`button`,{"aria-label":o(`lark.settingsDisconnect`,{goal:e.goal_title}),className:_e===e.connection_id?`is-confirm`:``,onClick:()=>void Qe(e.goal_id,e.connection_id),type:`button`,children:[(0,H.jsx)($m,{size:15}),_e===e.connection_id?o(`common.confirm`):null]})]})]},e.connection_id)}),We.length===0?(0,H.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noConnections`)}):null]})]}):null,y?(0,H.jsx)(`div`,{className:`personal-lark-modal-backdrop`,role:`presentation`,children:(0,H.jsxs)(`section`,{"aria-labelledby":`connect-lark-title`,"aria-modal":`true`,className:`personal-lark-modal`,role:`dialog`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:`Goal Topic connection`}),(0,H.jsx)(`h2`,{id:`connect-lark-title`,children:o(pe?`lark.editConnection`:`lark.connectApp`)})]}),(0,H.jsx)(`button`,{"aria-label":o(`lark.closeConnection`),onClick:()=>b(!1),type:`button`,children:(0,H.jsx)(eh,{size:18})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.conversationKind`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.conversationKind`),disabled:!!he,value:F,onChange:e=>ne(e.target.value),children:[(0,H.jsx)(`option`,{value:`manager`,children:o(`lark.managerConversation`)}),(0,H.jsx)(`option`,{value:`goal`,children:o(`lark.workerConversation`)})]})]}),F===`manager`?(0,H.jsx)(`p`,{children:o(`lark.managerConversationDescription`)}):null,he?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,H.jsx)(`div`,{children:he.app_label})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,H.jsx)(`div`,{children:he.chat_name})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,H.jsx)(`div`,{children:he.goal_title})]}),(0,H.jsx)(`small`,{children:o(`lark.editPreservesIdentity`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,H.jsx)(`select`,{"aria-label":o(`lark.appProfile`),disabled:p,onChange:e=>{e.target.value===`__register__`?Je():(S(e.target.value),le({}))},value:x,children:p?(0,H.jsx)(`option`,{value:``,children:o(`lark.appLoading`)}):(0,H.jsxs)(H.Fragment,{children:[l.map(e=>(0,H.jsxs)(`option`,{disabled:!e.ready,value:e.app_ref,children:[e.label,e.reply_ready?``:e.ready?` · ${o(`lark.needsMessagePermissions`)}`:` · ${o(`lark.needsSetup`)}`]},e.app_ref)),(0,H.jsx)(`option`,{value:`__register__`,children:o(`lark.registerAnother`)})]})}),(0,H.jsx)(`small`,{children:o(`lark.defaultAgentAppDescription`)})]}),He?.ready&&!He.reply_ready?(0,H.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.appPermissions`)}):null,(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,H.jsx)(`input`,{"aria-label":o(`lark.groupSearch`),onChange:e=>E(e.target.value),placeholder:o(`lark.groupSearch`),type:`search`,value:T}),te?(0,H.jsxs)(`div`,{className:`personal-lark-group-state`,role:`status`,children:[(0,H.jsx)(wm,{className:`is-spinning`,size:15}),o(`lark.groupLoading`)]}):null,!te&&j?(0,H.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:j}):null,!te&&!j&&D.length===0?(0,H.jsx)(`div`,{className:`personal-lark-group-state`,role:`status`,children:o(`lark.groupEmpty`)}):null,!te&&!j&&D.length>0?(0,H.jsx)(`select`,{"aria-label":o(`lark.groupChat`),onChange:e=>ee(e.target.value),value:k,children:D.map(e=>(0,H.jsx)(`option`,{value:e.chat_id,children:e.chat_name},e.chat_id))}):null]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,H.jsx)(`select`,{"aria-label":o(`lark.bindGoal`),onChange:e=>{let t=e.target.value;w(t),ae(n.find(e=>e.goalId===t)?.agentId??``),le({})},value:C,children:n.map(e=>(0,H.jsx)(`option`,{value:e.goalId,children:e.title},e.goalId))})]})]}),(0,H.jsxs)(`label`,{className:`personal-lark-check`,children:[(0,H.jsx)(`input`,{checked:!0,readOnly:!0,type:`checkbox`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:o(`lark.createAutomatically`)}),(0,H.jsx)(`small`,{children:o(`lark.createAutomaticallyDescription`)})]})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.topicPreview`)}),(0,H.jsxs)(`div`,{className:`personal-lark-topic-preview`,children:[(0,H.jsx)(Om,{size:15}),`# `,Pe?.title??Pe?.goalId??`Goal`]})]}),F===`goal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.captureScope`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.captureScope`),disabled:he?.ingress_mode===`direct_session`,onChange:e=>P(e.target.value),value:N,children:[(0,H.jsx)(`option`,{value:`addressed_only`,children:o(`lark.captureAddressed`)}),(0,H.jsx)(`option`,{value:`configured_chat_all`,children:o(`lark.captureAll`)})]}),(0,H.jsx)(`small`,{children:o(`lark.captureScopeDescription`)})]}),(0,H.jsxs)(`fieldset`,{"aria-label":o(`lark.agentIngress`),className:`personal-lark-ingress`,children:[(0,H.jsx)(`legend`,{children:o(`lark.agentIngress`)}),(0,H.jsx)(`div`,{children:[`live_steering`,`session_queue`,`async_inbox`].map(e=>{let t=jb(e,o);return(0,H.jsxs)(`label`,{className:re===e?`is-active`:``,children:[(0,H.jsx)(`input`,{"aria-label":t.label,checked:re===e,name:`lark-agent-ingress`,onChange:()=>I(e),type:`radio`,value:e}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:t.label}),(0,H.jsx)(`small`,{children:t.detail})]})]},e)})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.targetAgent`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.targetAgent`),disabled:!!he?.agent_id,onChange:e=>ae(e.target.value),value:R,children:[Le?null:(0,H.jsx)(`option`,{disabled:!0,value:R,children:R?o(`lark.agentUnavailable`,{agent:R}):o(`lark.noAgentConfigured`)}),Ie.map(e=>(0,H.jsx)(`option`,{value:e.agentId,children:e.label===e.agentId?e.agentId:`${e.label} · ${e.agentId}`},e.agentId))]}),(0,H.jsx)(`small`,{children:o(`lark.targetAgentDescription`)})]}),!pe&&Ie.length>1?(0,H.jsxs)(`label`,{"aria-label":o(`lark.connectAllAgents`),className:`personal-lark-check`,children:[(0,H.jsx)(`input`,{checked:oe,onChange:e=>se(e.target.checked),type:`checkbox`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:o(`lark.connectAllAgents`)}),(0,H.jsx)(`small`,{children:o(`lark.connectAllAgentsDescription`,{count:Ie.length})})]})]}):null,!pe&&oe&&Ie.length>1?(0,H.jsxs)(`fieldset`,{"aria-label":o(`lark.agentApps`),className:`personal-lark-agent-apps`,children:[(0,H.jsx)(`legend`,{children:o(`lark.agentApps`)}),(0,H.jsx)(`small`,{children:o(`lark.agentAppsDescription`)}),(0,H.jsx)(`div`,{children:Ie.map(e=>(0,H.jsxs)(`label`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsx)(`small`,{children:e.agentId})]}),(0,H.jsx)(`select`,{"aria-label":o(`lark.agentAppSelection`,{agent:e.label}),onChange:t=>le(n=>({...n,[e.agentId]:t.target.value})),value:ce[e.agentId]??x,children:l.map(e=>(0,H.jsxs)(`option`,{disabled:!e.ready,value:e.app_ref,children:[e.label,e.reply_ready?``:e.ready?` · ${o(`lark.needsMessagePermissions`)}`:` · ${o(`lark.needsSetup`)}`]},e.app_ref))})]},e.agentId))})]}):null,oe&&Re.length>0&&!Be?(0,H.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.agentAppPermissions`)}):null,ze.length===0?(0,H.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:o(`lark.selectRegisteredAgent`)}):null]}):null,(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.replyMode`)}),(0,H.jsx)(`select`,{"aria-label":o(`lark.replyMode`),onChange:e=>ie(e.target.value),value:L,children:(0,H.jsx)(`option`,{value:`topic_reply`,children:o(`lark.topicReply`)})}),(0,H.jsx)(`small`,{children:o(`lark.replyModeDescription`)})]}),(0,H.jsxs)(`p`,{className:`personal-lark-cardinality`,children:[(0,H.jsx)(tm,{size:15}),o(`lark.cardinality`)]}),de?(0,H.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:de}):null,(0,H.jsxs)(`footer`,{children:[(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>b(!1),type:`button`,children:o(`lark.cancel`)}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:p||!x||!he&&(!He?.reply_ready||!k)||F===`goal`&&(!Be||ze.length===0)||!C||ue,onClick:()=>void Ze(),type:`button`,children:[ue?(0,H.jsx)(wm,{className:`is-spinning`,size:15}):null,Ve]})]})]})}):null,ye?(0,H.jsx)(`div`,{className:`personal-lark-modal-backdrop is-setup`,role:`presentation`,children:(0,H.jsxs)(`section`,{"aria-labelledby":`new-lark-app-title`,"aria-modal":`true`,className:`personal-lark-modal personal-lark-setup-modal`,role:`dialog`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:o(`lark.reusableWorkspaceApp`)}),(0,H.jsx)(`h2`,{id:`new-lark-app-title`,children:o(`lark.newApp`)})]}),(0,H.jsx)(`button`,{"aria-label":o(`lark.closeCreate`),onClick:()=>void Xe(),type:`button`,children:(0,H.jsx)(eh,{size:18})})]}),Te?(0,H.jsxs)(`div`,{className:`personal-lark-setup-progress`,children:[(0,H.jsx)(`span`,{className:`personal-lark-setup-icon is-${Te.status}`,children:Te.status===`ready`?(0,H.jsx)(tm,{size:22}):(0,H.jsx)(wm,{className:Te.status===`failed`?``:`is-spinning`,size:22})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:Te.status===`ready`?o(`lark.appCreated`):Te.status===`failed`?o(`lark.appCreateFailed`):o(`lark.waitingFeishu`)}),(0,H.jsx)(`p`,{children:Te.status===`waiting_for_feishu`?o(`lark.waitingFeishuDescription`):Te.status===`starting`?o(`lark.waitingLink`):Te.error})]}),Te.verification_url?(0,H.jsxs)(`a`,{href:Te.verification_url,rel:`noreferrer`,target:`_blank`,children:[(0,H.jsx)(pm,{size:15}),o(`lark.reopenFeishu`)]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`personal-lark-setup-copy`,children:o(`lark.setupCopy`)}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.profileName`)}),(0,H.jsx)(`input`,{"aria-label":o(`lark.profileName`),autoComplete:`off`,onChange:e=>Se(e.target.value),placeholder:`loopx-workspace-bot`,value:xe})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.region`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.region`),onChange:e=>we(e.target.value),value:Ce,children:[(0,H.jsx)(`option`,{value:`feishu`,children:`Feishu`}),(0,H.jsx)(`option`,{value:`lark`,children:`Lark`})]})]}),xe&&!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(xe)?(0,H.jsx)(`p`,{className:`personal-notification-error`,children:o(`lark.profileValidation`)}):null]}),Oe?(0,H.jsx)(`p`,{className:`personal-notification-error`,children:Oe}):null,(0,H.jsxs)(`footer`,{children:[(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void Xe(),type:`button`,children:o(`lark.cancel`)}),Te?null:(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:Ee||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(xe),onClick:()=>void Ye(),type:`button`,children:[Ee?(0,H.jsx)(wm,{className:`is-spinning`,size:15}):(0,H.jsx)(pm,{size:15}),o(`lark.continueFeishu`)]})]})]})}):null]})}function Ib(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Lb(e,t,n){let r=Ib(t),i=Ib(n);return Object.fromEntries(e.fields.flatMap(({key:e,nullable:t})=>{let n=r[e],a=i[e];return Object.hasOwn(r,e)&&(n!=null||t&&n===null)?[[e,n]]:Object.hasOwn(i,e)&&a!=null?[[e,a]]:[]}))}function Rb(e,t){let n;try{n=JSON.parse(t)}catch{return null}if(!n||typeof n!=`object`||Array.isArray(n))return null;let r=new Set(e.fields.map(e=>e.key));return Object.keys(n).some(e=>!r.has(e))?null:n}function zb(e,t,n){let r={...e,[t]:n},i=e.schedule;return t===`timezone`&&i&&typeof i==`object`&&`schema_version`in i&&i.schema_version===`periodic_report_schedule_v0`&&(r.schedule={...i,timezone:n}),r}function Bb({id:e,value:t,timezone:n,onChange:r}){let{locale:i}=qi(),a=i===`zh-CN`,o=t&&typeof t==`object`&&!Array.isArray(t)?t:null,s=String(o?.rrule??``).split(`;`).map(e=>e.split(`=`)),c=Object.fromEntries(s.filter(e=>e.length===2)),l=[`MO`,`TU`,`WE`,`TH`,`FR`,`SA`,`SU`],u=(e,t)=>e!==void 0&&/^\d+$/.test(e)&&Number(e)<=t,d=!o||o.schema_version===`periodic_report_schedule_v0`&&[`DAILY`,`WEEKLY`].includes(c.FREQ)&&o.timezone===n&&s.every(e=>e.length===2&&[`FREQ`,`BYDAY`,`BYHOUR`,`BYMINUTE`,`INTERVAL`].includes(e[0]))&&new Set(s.map(([e])=>e)).size===s.length&&u(c.BYHOUR,23)&&u(c.BYMINUTE??`0`,59)&&(c.FREQ===`WEEKLY`?l.includes(c.BYDAY):!c.BYDAY)&&(!c.INTERVAL||c.INTERVAL===`1`),f=a?[`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`,`星期日`]:[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`];function p(e){let t={FREQ:`WEEKLY`,BYDAY:`MO`,BYHOUR:`9`,BYMINUTE:`0`,...c,...e};r?.({schema_version:`periodic_report_schedule_v0`,schedule_id:o?.schedule_id??`report-schedule`,timezone:n,rrule:[`FREQ=${t.FREQ}`,...t.FREQ===`WEEKLY`?[`BYDAY=${t.BYDAY}`]:[],`BYHOUR=${t.BYHOUR}`,`BYMINUTE=${t.BYMINUTE}`].join(`;`)})}return(0,H.jsxs)(`div`,{className:`personal-report-schedule`,children:[(0,H.jsxs)(`label`,{className:`is-boolean`,htmlFor:e,children:[(0,H.jsx)(`span`,{children:a?`按日历汇报`:`Calendar reports`}),(0,H.jsx)(`input`,{id:e,type:`checkbox`,role:`switch`,checked:!!o,disabled:!r,onChange:e=>e.target.checked?p({}):r?.(null)})]}),o?(0,H.jsxs)(H.Fragment,{children:[d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{htmlFor:`${e}-frequency`,children:[(0,H.jsx)(`span`,{children:a?`频率`:`Frequency`}),(0,H.jsxs)(`select`,{id:`${e}-frequency`,value:c.FREQ,disabled:!r,onChange:e=>p({FREQ:e.target.value}),children:[(0,H.jsx)(`option`,{value:`DAILY`,children:a?`每天`:`Daily`}),(0,H.jsx)(`option`,{value:`WEEKLY`,children:a?`每周`:`Weekly`})]})]}),c.FREQ===`WEEKLY`&&(0,H.jsxs)(`label`,{htmlFor:`${e}-day`,children:[(0,H.jsx)(`span`,{children:a?`星期`:`Weekday`}),(0,H.jsx)(`select`,{id:`${e}-day`,value:c.BYDAY,disabled:!r,onChange:e=>p({BYDAY:e.target.value}),children:l.map((e,t)=>(0,H.jsx)(`option`,{value:e,children:f[t]},e))})]}),(0,H.jsxs)(`label`,{htmlFor:`${e}-time`,children:[(0,H.jsxs)(`span`,{children:[a?`当地时间`:`Local time`,` (`,n,`)`]}),(0,H.jsx)(`input`,{id:`${e}-time`,type:`time`,required:!0,disabled:!r,value:`${(c.BYHOUR??`9`).padStart(2,`0`)}:${(c.BYMINUTE??`0`).padStart(2,`0`)}`,onChange:e=>{if(!/^\d{2}:\d{2}$/.test(e.target.value))return;let[t,n]=e.target.value.split(`:`);p({BYHOUR:t,BYMINUTE:n})}})]})]}):(0,H.jsx)(`p`,{role:`alert`,children:a?`此计划需在 JSON 模式中编辑;当前内容已保留。`:`Edit this schedule in JSON mode; its current value is preserved.`}),(0,H.jsx)(`p`,{children:a?`由现有唤醒检查到期计划;实际送达以回执为准。`:`Existing wakes check the schedule; delivery is confirmed by its receipt.`})]}):(0,H.jsx)(`p`,{children:a?`未设置日历计划;保持阶段结束时汇报。`:`No calendar schedule; report at validated stage boundaries.`})]})}function Vb({copy:e,field:t,id:n,onChange:r,value:i,timezone:a}){let o=e[t.key]?.label??t.label,s=!r;if(t.input_kind===`periodic_report_schedule`)return(0,H.jsx)(Bb,{id:n,value:i,timezone:a,onChange:r?e=>r(t.key,e):void 0});if(t.input_kind===`boolean`)return(0,H.jsxs)(`label`,{className:`is-boolean`,htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsx)(`input`,{checked:i===!0,id:n,onChange:r?e=>r(t.key,e.target.checked):void 0,readOnly:s,role:`switch`,type:`checkbox`})]});if(t.input_kind===`select`)return(0,H.jsxs)(`label`,{htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsxs)(`select`,{id:n,onChange:r?e=>r(t.key,e.target.value):void 0,value:typeof i==`string`?i:``,children:[(0,H.jsx)(`option`,{value:``}),(t.options??[]).map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]})]});if(t.input_kind===`string_list`)return(0,H.jsxs)(`label`,{htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsx)(`textarea`,{id:n,onChange:r?e=>r(t.key,e.target.value.split(/\r?\n/u).filter(Boolean)):void 0,readOnly:s,rows:4,value:Array.isArray(i)?i.join(` +`):``})]});let c=t.input_kind===`number`;return(0,H.jsxs)(`label`,{htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsx)(`input`,{id:n,max:t.maximum,min:t.minimum,onChange:r?e=>r(t.key,c?Number(e.target.value):e.target.value):void 0,readOnly:s,required:t.required,type:c?`number`:`text`,value:typeof i==`number`||typeof i==`string`?i:``})]})}function Hb({copy:e={},disabled:t=!1,editor:n,enabledAction:r,omitKeys:i=[],onChange:a,value:o}){let s=(0,V.useId)(),c=new Set(i);return(0,H.jsx)(`fieldset`,{className:`personal-capability-fields`,disabled:t,children:n.fields.filter(e=>!c.has(e.key)).map(t=>{let n=(0,H.jsx)(Vb,{copy:e,field:t,id:`${s}-${t.key.replace(/[^a-z0-9_-]/gi,`-`)}`,onChange:a,value:o[t.key],timezone:String(o.timezone??`UTC`)},t.key);return t.key===`enabled`&&t.input_kind===`boolean`?(0,H.jsxs)(`div`,{className:`personal-capability-enabled-row`,children:[n,r]},t.key):n})})}var Ub={en:{manager_runtime:{displayName:`Manager runtime`,description:`Selects the persistent host-tool profile used by owner manager conversations.`},todo_replan_cadence:{displayName:`Goal review cadence`,description:`Configures the Goal review cadence.`},change_quality_qualification:{displayName:`Change quality qualification`,description:`Prepares a provider-neutral review packet, allows at most one policy-authorized safe-fix pass, and can require an exact-diff receipt.`},explore_graph:{displayName:`Explore Graph`,description:`Organizes bounded exploration as a typed evidence graph so branches, findings, and synthesis remain inspectable.`},explore_harness:{displayName:`Explore Harness`,description:`Selects a capability-owned planning and research harness profile for bounded multi-step exploration.`},lark_event_inbox:{displayName:`Lark event inbox`,description:`Receives provider events through a local-private inbox binding before LoopX projects them into governed work.`,readOnlyReason:`This capability requires a local-private inbox binding. Manage it in Lark settings or through the capability CLI.`},lark_kanban_heartbeat_sync:{displayName:`Lark Kanban heartbeat sync`,description:`Synchronizes accepted LoopX work state to the configured Lark Kanban heartbeat surface.`},local_authority_shadow:{displayName:`Local authority shadow`,description:`Observes post-commit Todo and task-lease state through the shared authority contract without taking write authority.`},multi_subagent:{displayName:`Adaptive child capacity`,description:`Sets bounded child-agent capacity and the public-safe responsibility domains in which parallel work may be delegated.`},peer_task_coordination:{displayName:`Registered-peer task coordination`,description:`Routes explicitly scoped peer-owned work to one registered coordinator without granting cross-owner mutation authority.`},periodic_report:{displayName:`Periodic reports`,description:`Turns validated Goal stage progress into a frozen report and automatically delivers it through the configured Goal Channel with exact readback.`},pull_request_review:{displayName:`Pull-request review`,description:`Ranks the public GitHub PR review queue with a machine-level default; it never grants GitHub, Todo, push, or merge authority.`},reward_memory:{displayName:`Reward Memory experiment`,description:`Configures a reviewed local-private provider binding for Goal-scoped Agent recall and evidence-backed outcome learning.`}},"zh-CN":{manager_runtime:{displayName:`管家 Runtime`,description:`选择管家会话持续生效的宿主工具模式。`},todo_replan_cadence:{displayName:`Goal 复核周期`,description:`配置 Goal 的复核周期。`},change_quality_qualification:{displayName:`变更质量验证`,description:`生成与 Provider 无关的审阅包,最多允许一次策略授权的安全修复,并可要求精确 diff 回执。`},explore_graph:{displayName:`探索图谱`,description:`把有界探索组织为 typed 证据图,让探索分支、发现与综合结论都可检查、可追溯。`},explore_harness:{displayName:`探索 Harness`,description:`为有界的多步探索选择由能力负责的规划与研究 Harness profile。`},lark_event_inbox:{displayName:`飞书事件收件箱`,description:`通过本机私有收件箱接收 Provider 事件,再由 LoopX 将其投影为受治理的工作。`,readOnlyReason:`此能力依赖本机私有的收件箱绑定,请在飞书设置或 capability CLI 中管理。`},lark_kanban_heartbeat_sync:{displayName:`飞书看板心跳同步`,description:`把 LoopX 已接受的工作状态同步到配置好的飞书看板心跳界面。`},local_authority_shadow:{displayName:`本地 Authority 影子观测`,description:`通过共享 Authority contract 观测提交后的 Todo 与 task lease 状态,但不取得写入权。`},multi_subagent:{displayName:`自适应子 Agent 容量`,description:`限定子 Agent 容量与可公开的职责域,只有落在这些边界内的工作才能并行委派。`},peer_task_coordination:{displayName:`已注册 Peer 任务协调`,description:`把明确限定的 Peer 工作路由给一个已注册协调者,不授予跨 Owner 修改权限。`},periodic_report:{displayName:`周期报告`,description:`把经过验证的 Goal 阶段进展整理为冻结报告,并通过配置的 Goal Channel 自动发送和精确回读。`},pull_request_review:{displayName:`Pull-request Review`,description:`配置公开 GitHub PR 审阅队列的本机默认排序;不会授予 GitHub、Todo、push 或 merge 权限。`},reward_memory:{displayName:`Reward Memory 实验`,description:`为 Goal 内 Agent 的召回与证据化结果学习配置经过审阅的本机私有 Provider 绑定。`}}},Wb={en:{runtime_profile:{label:`Runtime profile`,description:`Restricted keeps scoped LoopX reads only. Trusted owner enables normal host tools while protected operations retain separate checks.`},completed_todos:{label:`Completed Todos between Goal reviews`,description:`Machine default or explicit Goal override, from 1 to 5.`},allowed_domains:{label:`Allowed responsibility domains`,description:`Enter one bounded, public-safe domain per line.`},coordinator_agent_id:{label:`Coordinator Agent`,description:`Use an already registered Agent id; leave blank to disable coordination.`},enabled:{label:`Enabled`},model:{label:`Child model`,description:`For example gpt-5.6-luna. Blank clears the child model preference.`},reasoning_effort:{label:`Child reasoning effort`,description:`For example max; the host must support this model and effort.`},max_children:{label:`Maximum children`,description:`Hard upper bound for concurrently delegated child work.`},profile:{label:`Planner profile`,description:`Select one registered Explore Harness profile.`},profile_preset:{label:`Report profile`,description:`Capability-owned report profile, such as weekly-progress.`},review_priority:{label:`Review priority`,description:`Choose whether other developers' PRs or the authenticated reviewer's own PRs are ranked first.`},route_ref:{label:`Goal Channel route`,description:`Public route alias only; credentials and provider identifiers stay outside this form.`},safe_fix:{label:`Allow one bounded safe-fix pass`},strict_receipt:{label:`Require an exact-diff receipt`},timezone:{label:`Timezone`,description:`Use an IANA timezone, for example Asia/Shanghai.`},schedule:{label:`Calendar reports`,description:`Optional daily or weekly reports; no schedule preserves stage-only delivery.`},config_path:{label:`Local-private configuration path`,description:`Repo-relative ignored JSON under .loopx/config/. Leave blank to retain the current binding; the path is never returned.`},enabled_agents:{label:`Enabled Goal Agents`,description:`Enter one registered Goal-local Agent id per line. A private binding currently accepts exactly one Agent.`}},"zh-CN":{runtime_profile:{label:`运行模式`,description:`restricted 仅使用受限 LoopX 读取;trusted_owner 开放常规宿主工具,但受保护操作仍单独校验。`},completed_todos:{label:`两次 Goal 复核间的已完成 Todo 数`,description:`可设置 1–5;机器默认值可被 Goal 显式覆盖。`},allowed_domains:{label:`允许的职责域`,description:`每行填写一个有边界、可公开的职责域。`},coordinator_agent_id:{label:`协调 Agent`,description:`填写一个已经注册的 Agent ID;留空表示关闭协调。`},enabled:{label:`启用`},model:{label:`子 Agent 模型`,description:`例如 gpt-5.6-luna;留空清除模型偏好。`},reasoning_effort:{label:`子 Agent 推理档位`,description:`例如 max;宿主须支持所选模型与档位。`},max_children:{label:`最大子 Agent 数`,description:`可同时委派的子任务硬上限。`},profile:{label:`规划 Profile`,description:`选择一个已注册的 Explore Harness profile。`},profile_preset:{label:`报告 Profile`,description:`由该能力管理的报告 profile,例如 weekly-progress。`},review_priority:{label:`审阅优先级`,description:`选择先排其他开发者的 PR,还是先排当前已认证审阅者自己的 PR。`},route_ref:{label:`Goal Channel 路由`,description:`只填写公开 route alias;凭据与 Provider 标识不会进入此表单。`},safe_fix:{label:`允许一次有界安全修复`},strict_receipt:{label:`要求精确 diff 回执`},timezone:{label:`时区`,description:`使用 IANA 时区,例如 Asia/Shanghai。`},schedule:{label:`日历汇报`,description:`可选每日或每周计划;未设置时保持阶段结束汇报。`},config_path:{label:`本机私有配置路径`,description:`填写 .loopx/config/ 下、相对仓库且被忽略的 JSON;留空保留当前绑定,路径不会被回传。`},enabled_agents:{label:`已启用的 Goal Agent`,description:`每行填写一个已注册的 Goal 内 Agent ID;私有绑定当前只接受一个 Agent。`}}};function Gb(e,t){let n=Ub[t][e.capability_id];return n?{...e,display_name:n.displayName,description:n.description,configuration_editor:{...e.configuration_editor,...n.readOnlyReason?{read_only_reason:n.readOnlyReason}:{}}}:e}function Kb(e){return Wb[e]}Object.freeze(Object.keys(Ub.en).sort());function qb(e,t){return e.available_scopes.includes(t)&&(t!==`machine`||!!e.machine_namespace)&&e.configuration_editor.editable&&e.configuration_editor.writable_scopes.includes(t)}function Jb({values:e,t}){return(0,H.jsxs)(`details`,{className:`personal-capability-raw-values`,children:[(0,H.jsx)(`summary`,{children:t(`capabilities.rawJson`)}),(0,H.jsx)(`div`,{className:`personal-capability-value-grid`,children:e.map(({label:e,value:t})=>(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`strong`,{children:e}),(0,H.jsx)(`pre`,{children:t?JSON.stringify(t,null,2):`—`})]},e))})]})}function Yb({source:e,t}){return e?(0,H.jsxs)(`p`,{className:`personal-capability-effective-source`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:15}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:t(`capabilities.effectiveSource`)}),t(`capabilities.source.${e}`)]})]}):null}function Xb({available:e,description:t,t:n}){return e?null:(0,H.jsxs)(`section`,{className:`personal-capability-editor-status is-read-only`,children:[(0,H.jsx)(Qm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:n(`capabilities.readOnly`)}),(0,H.jsx)(`p`,{children:t})]})]})}function Zb(e){return e.availability?.includes(`experimental`)?4:e.capability_id===`multi_subagent`?3:e.configuration_editor.writable_scopes.length===0||e.availability===`supported_explicit_opt_in`?2:e.availability===`supported_explicit_override`?0:1}function Qb(e,t){return[...e].sort((e,n)=>{let r=Zb(e)-Zb(n);if(r!==0)return r;let i=Gb(e,t),a=Gb(n,t);return i.display_name.localeCompare(a.display_name,t)||e.capability_id.localeCompare(n.capability_id)})}function $b({capabilities:e,locale:t,onSelect:n,scope:r,selectedCapabilityId:i,t:a}){return(0,H.jsx)(`nav`,{"aria-label":a(r===`goal`?`capabilities.catalog`:`machine.capabilityCatalog`),className:`personal-capability-list`,tabIndex:0,children:Qb(e,t).map(e=>{let o=Gb(e,t);return(0,H.jsxs)(`button`,{"aria-current":i===o.capability_id?`page`:void 0,onClick:()=>n(o.capability_id),type:`button`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:o.display_name})}),(0,H.jsx)(`em`,{children:a(o.available_scopes.includes(r)?r===`goal`?`capabilities.goalScope`:`capabilities.machineScope`:r===`machine`?`capabilities.goalScope`:`capabilities.machineScope`)})]},o.capability_id)})})}function ex({capability:e,locale:t,source:n}){let{t:r}=qi(),i=Gb(e,t);return(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`span`,{className:`personal-settings-icon`,children:(0,H.jsx)(Km,{"aria-hidden":!0,size:18})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`personal-capability-heading-row`,children:[(0,H.jsx)(`h2`,{children:i.display_name}),(0,H.jsx)(Yb,{source:n,t:r})]}),e.context_contribution&&(0,H.jsxs)(`details`,{className:`personal-capability-help`,"data-testid":`capability-context-phases`,children:[(0,H.jsx)(`summary`,{children:t===`zh-CN`?`主 Agent 协作指导`:`Coordinator workflow guidance`}),(0,H.jsx)(`p`,{children:t===`zh-CN`?`随能力开启。支持以下阶段;此处展示能力范围,不能证明某次运行已读取或采纳。`:`Enabled with this capability. These are supported phases, not proof that a run read or adopted the guidance.`}),(0,H.jsx)(`dl`,{children:e.context_contribution.supported_phases.map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:(0,H.jsx)(`code`,{children:e})}),(0,H.jsx)(`dd`,{children:tx[e][t===`zh-CN`?`zh`:`en`]})]},e))}),(0,H.jsx)(`p`,{children:t===`zh-CN`?`LoopX Turn 在请求与结果中提供上下文;原生工具入口由 LoopX skill 调用同一只读接口。执行与采纳需另看运行证据。`:`LoopX Turn includes context in requests and results. For native tools, the LoopX skill reads the same interface. Execution and adoption require run evidence.`})]}),(0,H.jsxs)(`details`,{className:`personal-capability-help`,children:[(0,H.jsx)(`summary`,{children:t===`zh-CN`?`配置说明`:`Configuration help`}),(0,H.jsx)(`p`,{children:i.description}),(0,H.jsx)(`dl`,{children:e.configuration_editor.fields.map(e=>{let n=Kb(t)[e.key],r=n?.description??e.description;return r?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:n?.label??e.label}),(0,H.jsx)(`dd`,{children:r})]},e.key):null})})]},e.capability_id)]})]})}var tx={before_plan:{zh:`规划前:识别独立问题并保留主 Agent 的核验与整合职责。`,en:`Before planning: identify independent questions and retain coordinator validation and integration.`},before_delegate:{zh:`委派前:明确子任务边界、模型偏好及预期证据。`,en:`Before delegation: specify task boundaries, model preferences and expected evidence.`},after_delegate_result:{zh:`回收后:核验结果,说明采纳决定并关联计划与成果。`,en:`After results: validate evidence, explain acceptance and link plans and deliverables.`}};function nx({goalId:e,onApplied:t,selected:n,t:r}){let[i,a]=(0,V.useState)({busy:null,draft:{},partialWrite:null,preview:null}),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(`guided`),[u,d]=(0,V.useState)(``),f=(0,V.useMemo)(()=>n?Rb(n.configuration_editor,u):null,[n,u]),p=c===`guided`||f!==null;(0,V.useEffect)(()=>{l(`guided`),d(``),a({busy:null,draft:Lb(n?.configuration_editor??{fields:[]},n?.current??n?.effective_configuration?.configuration??n?.default,n?.default),partialWrite:null,preview:null}),s(null)},[n]);async function m(t){if(!(!n||i.busy||!p)){a(e=>({...e,busy:`preview`,partialWrite:null})),s(null);try{let r=await Og(e,n.capability_id,t);a(e=>({...e,preview:r}))}catch(e){s(e instanceof Error?e.message:r(`capabilities.previewFailed`))}finally{a(e=>({...e,busy:null}))}}}async function h(){if(!(!n||!i.preview||i.busy||!p)){a(e=>({...e,busy:`apply`})),s(null);try{let r=Lb(n.configuration_editor,i.draft,n.default),o=await kg(e,n.capability_id,i.preview.action===`delete`?null:r,i.preview.plan_revision);a(e=>({...e,partialWrite:o.status===`partial_write`?o:null,preview:null})),o.status!==`partial_write`&&t()}catch(e){a(e=>({...e,preview:null})),s(e instanceof Error?e.message:r(`capabilities.applyFailed`))}finally{a(e=>({...e,busy:null}))}}}function g(e,t){a(r=>({...r,draft:n?.capability_id===`periodic_report`?zb(r.draft,e,t):{...r.draft,[e]:t},preview:null})),s(null)}function _(e){if(!n||i.busy)return;d(e);let t=Rb(n.configuration_editor,e);a(e=>({...e,preview:null,draft:t?Lb(n.configuration_editor,t,n.default):e.draft})),s(null)}function v(){i.busy||!p||(c===`guided`&&d(JSON.stringify(i.draft,null,2)),l(c===`guided`?`json`:`guided`),a(e=>({...e,preview:null})))}return{apply:h,changeDraft:g,changeJson:_,changeMode:v,editorMode:c,jsonDraft:u,jsonValid:p,error:o,mutation:i,preview:m}}function rx({mutationError:e,onApplied:t,partialWrite:n,preview:r}){let{t:i}=qi();return(0,H.jsxs)(H.Fragment,{children:[e?(0,H.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:e}):null,n?(0,H.jsxs)(`section`,{"aria-live":`polite`,className:`personal-capability-recovery`,children:[(0,H.jsx)(Qm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:i(`capabilities.partialWrite`)}),(0,H.jsx)(`p`,{children:i(`capabilities.partialWriteDescription`)}),(0,H.jsx)(`small`,{children:n.recommended_action})]}),(0,H.jsxs)(`button`,{onClick:t,type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":!0,size:15}),i(`capabilities.refreshSource`)]})]}):null,r?(0,H.jsxs)(`section`,{className:`personal-capability-preview`,"aria-label":i(`capabilities.preview`),children:[(0,H.jsx)(`strong`,{children:i(`capabilities.preview`)}),(0,H.jsx)(`span`,{children:i(`machine.action.${r.action}`)}),(0,H.jsx)(`small`,{children:i(`capabilities.previewLocked`)})]}):null]})}function ix({catalog:e,goalId:t,onApplied:n}){let{locale:r,t:i}=qi(),a=(0,V.useMemo)(()=>Qb(e.capabilities,r),[e.capabilities,r]),[o,s]=(0,V.useState)(()=>a[0]?.capability_id??``),c=(0,V.useMemo)(()=>a.find(e=>e.capability_id===o)??a[0],[a,o]),l=(0,V.useMemo)(()=>c?Gb(c,r):void 0,[r,c]),{apply:u,changeDraft:d,changeJson:f,changeMode:p,editorMode:m,jsonDraft:h,jsonValid:g,error:_,mutation:v,preview:y}=nx({goalId:t,onApplied:n,selected:l,t:i}),{busy:b,draft:x,partialWrite:S,preview:C}=v;if(!c||!l)return(0,H.jsx)(`p`,{className:`personal-capability-empty`,children:i(`capabilities.empty`)});let w=l.available_scopes.includes(`goal`),T=qb(l,`goal`),E=l.configuration_editor.read_only_reason??i(w?`capabilities.previewOnly`:`capabilities.machineOnly`);async function D(){if(!l||!T||b||!g)return;let e=Lb(l.configuration_editor,x,l.default);await y(e)}async function O(){!T||b||await y(null)}return(0,H.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,H.jsx)($b,{capabilities:e.capabilities,locale:r,onSelect:s,scope:`goal`,selectedCapabilityId:l.capability_id,t:i}),(0,H.jsxs)(`article`,{"aria-label":l.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,H.jsx)(ex,{capability:c,locale:r,source:l.effective_configuration?.source}),(0,H.jsx)(Xb,{available:T,t:i,description:E}),T?(0,H.jsxs)(H.Fragment,{children:[m===`json`||!l.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,H.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,H.jsxs)(`button`,{disabled:!!b||!g,onClick:p,type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),i(m===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,m===`guided`?(0,H.jsx)(`section`,{className:`personal-capability-field-summary`,children:(0,H.jsx)(Hb,{disabled:!!b,copy:Kb(r),editor:l.configuration_editor,onChange:d,value:x,enabledAction:(0,H.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:p,type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),i(`machine.editJson`)]})})}):(0,H.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`goal-configuration-json`,children:[(0,H.jsx)(`span`,{children:i(`capabilities.jsonConfiguration`)}),(0,H.jsx)(`textarea`,{id:`goal-configuration-json`,"aria-describedby":`goal-configuration-json-help`,disabled:!!b,onChange:e=>f(e.target.value),rows:12,spellCheck:!1,value:h}),(0,H.jsx)(`small`,{id:`goal-configuration-json-help`,children:i(`capabilities.jsonHelp`)}),g?null:(0,H.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:i(`capabilities.jsonInvalid`)})]})]}):null,(0,H.jsx)(rx,{mutationError:_,onApplied:n,partialWrite:S,preview:C}),T?(0,H.jsxs)(`footer`,{className:`personal-capability-actions`,children:[l.current&&l.available_scopes.includes(`machine`)?(0,H.jsx)(`button`,{disabled:!!b||!g,onClick:()=>void O(),type:`button`,children:i(`capabilities.restoreInheritance`)}):null,(0,H.jsx)(`button`,{disabled:!!b||!g,onClick:()=>void D(),type:`button`,children:i(b===`preview`?`common.loading`:`capabilities.previewChanges`)}),(0,H.jsx)(`button`,{className:`is-primary`,disabled:!!b||!C||!g,onClick:()=>void u(),type:`button`,children:i(b===`apply`?`common.loading`:`capabilities.applyPreview`)})]}):null,(0,H.jsx)(Jb,{values:[{label:i(`capabilities.goalValue`),value:l.current},{label:i(l.machine_current?`capabilities.machineValue`:`capabilities.defaultValue`),value:l.machine_current??l.default}],t:i},c.capability_id)]})]})}function ax({goalId:e}){let{t}=qi(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(!1);function c(){e&&(s(!0),a(null),Dg(e).then(r).catch(e=>a(e instanceof Error?e.message:t(`capabilities.loadFailed`))).finally(()=>s(!1)))}return(0,V.useEffect)(c,[e]),e?o&&!n?(0,H.jsxs)(`p`,{"aria-live":`polite`,className:`personal-capability-empty`,children:[(0,H.jsx)(wm,{className:`personal-spin`,size:18}),t(`capabilities.loading`)]}):i?(0,H.jsxs)(`section`,{className:`personal-capability-error`,role:`alert`,children:[(0,H.jsx)(Qm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:t(`capabilities.loadFailed`)}),(0,H.jsx)(`small`,{children:i})]}),(0,H.jsxs)(`button`,{onClick:c,type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":!0,size:15}),t(`capabilities.retry`)]})]}):n?(0,H.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n.revision,children:[(0,H.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:17}),t(`capabilities.atomicOverride`)]}),(0,H.jsx)(`p`,{children:t(`capabilities.atomicOverrideDescription`)})]}),(0,H.jsx)(ix,{catalog:n.capability_catalog,goalId:e,onApplied:c})]}):null:(0,H.jsx)(`p`,{className:`personal-capability-empty`,children:t(`capabilities.chooseGoal`)})}function ox(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function sx(e,t){let n=t?.machine_namespace;return n?e?.machine_configuration?.namespaces[n]:void 0}function cx(e,t,n){return{...ox(e.default),...ox(t),...n}}function lx(e,t){for(let n of e.configuration_editor.fields){let e=t[n.key];if(n.required&&(e==null||e===``))return!1}return e.capability_id===`periodic_report`&&t.enabled===!0?!!(String(t.profile_preset??``).trim()&&String(t.route_ref??``).trim()&&String(t.timezone??``).trim()):!0}function ux(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}catch{return null}}function dx(e){return e?e===`absent`?e:e.replace(/^sha256:/,``).slice(0,12):`—`}function fx(){let{locale:e,t}=qi(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)({}),[c,l]=(0,V.useState)(`{}`),[u,d]=(0,V.useState)(`guided`),[f,p]=(0,V.useState)(null),[m,h]=(0,V.useState)(`upsert`),[g,_]=(0,V.useState)(null),[v,y]=(0,V.useState)(null),[b,x]=(0,V.useState)(`load`),[S,C]=(0,V.useState)(null),[w,T]=(0,V.useState)(null),E=(0,V.useMemo)(()=>Qb(n?.capability_catalog.capabilities??[],e),[n,e]),D=n?.invalid_namespaces[0],O=E.find(e=>e.capability_id===i)??(D?E.find(e=>e.machine_namespace===D):void 0)??E.find(e=>qb(e,`machine`))??E[0],k=O?Gb(O,e):void 0,ee=sx(n,k),te=!!(k?.machine_namespace&&ee),A=!!(k&&qb(k,`machine`)),j=(0,V.useMemo)(()=>ux(c),[c]),M=k?u===`json`?j:cx(k,ee,o):null,N=!!(k&&(u===`json`?j:lx(k,M??{})));async function P(){r(await Eg())}(0,V.useEffect)(()=>{let e=!0;return Eg().then(t=>{e&&r(t)}).catch(n=>{e&&C(n instanceof Error?n.message:t(`machine.loadError`))}).finally(()=>{e&&x(null)}),()=>{e=!1}},[t]),(0,V.useEffect)(()=>{if(!k)return;let e=sx(n,k),t=Lb(k.configuration_editor,e??k.default,k.default),r=cx(k,e,t);s(t),l(JSON.stringify(r,null,2)),d(A?`guided`:`json`),p(null),h(`upsert`),y(null)},[n,i,e]);function F(e,t){s(n=>k?.capability_id===`periodic_report`?zb(n,e,t):{...n,[e]:t}),p(null),h(`upsert`),C(null),T(null)}function ne(e){if(k){if(e===`json`)l(JSON.stringify(cx(k,ee,o),null,2));else if(j)s(Lb(k.configuration_editor,j,k.default));else{C(t(`machine.jsonInvalid`));return}d(e),p(null),h(`upsert`),C(null)}}async function re(){if(!(!A||!k?.machine_namespace||!M||!N||b)){x(`preview`),C(null),T(null);try{h(`upsert`),p(await Ag(k.machine_namespace,M))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function I(){if(!(!A||!k?.machine_namespace||!te||b)){x(`preview`),C(null),T(null);try{h(`remove`),p(await Mg(k.machine_namespace))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function L(){if(!A||!k?.machine_namespace||!f||b||m===`upsert`&&!M)return;x(`apply`),C(null);let e=m;try{let n=e===`remove`?await Ng(k.machine_namespace,f.plan_revision):await jg(k.machine_namespace,M,f.plan_revision);_(n),p(null),h(`upsert`),y(null),await P(),T(n.status===`applied`?t(e===`remove`?`machine.removed`:`machine.applied`):t(`machine.unchanged`))}catch(e){p(null),h(`upsert`),C(e instanceof Error?e.message:t(`machine.applyError`))}finally{x(null)}}async function ie(){if(!(!g?.transaction_id||b)){x(`rollback-preview`),C(null);try{y(await Pg(g.transaction_id))}catch(e){C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}async function R(){if(!(!g?.transaction_id||!v||b)){x(`rollback`),C(null);try{await Fg(g.transaction_id,v.plan_revision),_(null),y(null),p(null),await P(),T(t(`machine.rolledBack`))}catch(e){y(null),C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}return b===`load`?(0,H.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:t(`common.loading`)}):k?(0,H.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n?.revision,children:[(0,H.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:17}),t(`machine.liveDefault`)]}),(0,H.jsx)(`p`,{children:t(`machine.liveDefaultDescription`)})]}),n?.status===`invalid`?(0,H.jsxs)(`section`,{className:`personal-machine-error`,"data-testid":`machine-invalid-repair`,role:`alert`,children:[(0,H.jsx)(`strong`,{children:t(`machine.invalidStoredConfiguration`)}),(0,H.jsx)(`p`,{children:t(`machine.invalidStoredConfigurationDescription`)})]}):null,(0,H.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,H.jsx)($b,{capabilities:E,locale:e,onSelect:a,scope:`machine`,selectedCapabilityId:k.capability_id,t}),(0,H.jsxs)(`article`,{"aria-label":k.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,H.jsx)(ex,{capability:O,locale:e,source:k.available_scopes.includes(`machine`)?te?`machine_default`:`capability_default`:void 0}),(0,H.jsx)(Xb,{available:A,t,description:k.available_scopes.includes(`machine`)?t(`machine.editorUnavailableDescription`):t(`machine.goalOnly`)}),k.capability_id===`periodic_report`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:ee?.schedule?e===`zh-CN`?`日历与阶段汇报`:`Calendar and stage reports`:t(`machine.periodicReportActivation`)}),(0,H.jsx)(`p`,{children:ee?.schedule?ee.enabled===!0?e===`zh-CN`?`已配置日历计划,由现有唤醒检查;是否送达请核对报告回执。`:`A calendar schedule is configured and checked by existing wakes. Verify delivery in the report receipt.`:e===`zh-CN`?`日历计划已保存;启用此能力后才会检查和投递。`:`The schedule is saved; enable this capability to check and deliver reports.`:t(`machine.periodicReportActivationDescription`)})]})]}):null,k.capability_id===`change_quality_qualification`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.changeQualityActivation`)}),(0,H.jsx)(`p`,{children:t(`machine.changeQualityActivationDescription`)})]})]}):null,k.capability_id===`todo_replan_cadence`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.replanCadenceActivation`)}),(0,H.jsx)(`p`,{children:t(`machine.replanCadenceActivationDescription`)})]})]}):null,k.capability_id===`pull_request_review`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:e===`zh-CN`?`只改变队列排序`:`Queue ordering only`}),(0,H.jsx)(`p`,{children:e===`zh-CN`?`默认先审阅其他开发者的 PR;选择 owner-first 才会优先当前已认证审阅者自己的 PR。此配置不会发布 review、写 Todo、push 或 merge。`:`The default reviews other developers' PRs first; choose owner-first only when the authenticated reviewer's own PRs should lead. This setting never posts a review, writes Todos, pushes, or merges.`})]})]}):null,A?(0,H.jsxs)(H.Fragment,{children:[u===`json`||!k.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,H.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,H.jsxs)(`button`,{onClick:()=>ne(u===`guided`?`json`:`guided`),type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),t(u===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,u===`guided`?(0,H.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,H.jsx)(Hb,{copy:Kb(e),disabled:!!b,editor:k.configuration_editor,onChange:F,value:o,enabledAction:(0,H.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:()=>ne(`json`),type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),t(`machine.editJson`)]})}),N?null:(0,H.jsx)(`p`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.requiredFields`)})]}):(0,H.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`machine-configuration-json`,children:[(0,H.jsx)(`span`,{children:t(`machine.jsonConfiguration`)}),(0,H.jsx)(`textarea`,{"aria-describedby":`machine-configuration-json-help`,disabled:!!b,id:`machine-configuration-json`,onChange:e=>{l(e.target.value),p(null),C(null)},rows:12,spellCheck:!1,value:c}),(0,H.jsx)(`small`,{id:`machine-configuration-json-help`,children:t(`machine.jsonConfigurationHelp`)}),j?null:(0,H.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.jsonInvalid`)})]})]}):null,S?(0,H.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:S}):null,w?(0,H.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(tm,{"aria-hidden":!0,size:16}),w]}):null,f?(0,H.jsxs)(`section`,{"aria-label":t(`machine.preview`),className:`personal-machine-preview`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.preview`)}),(0,H.jsx)(`span`,{children:t(`machine.action.${f.action}`)})]}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`machine.currentRevision`)}),(0,H.jsx)(`dd`,{title:f.current_revision,children:dx(f.current_revision)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`machine.desiredRevision`)}),(0,H.jsx)(`dd`,{title:f.desired_revision,children:dx(f.desired_revision)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`machine.changedNamespaces`)}),(0,H.jsx)(`dd`,{children:f.changed_namespaces.join(`, `)||t(`common.none`)})]})]}),(0,H.jsx)(`p`,{children:t(`machine.previewLocked`)})]}):null,g?.rollback_available&&g.transaction_id?(0,H.jsxs)(`section`,{className:`personal-machine-rollback`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.rollbackAvailable`)}),(0,H.jsx)(`p`,{children:t(v?`machine.rollbackPreviewDescription`:`machine.rollbackDescription`)})]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!!b||!!(v&&!v.rollback_allowed),onClick:()=>void(v?R():ie()),type:`button`,children:[(0,H.jsx)(Rm,{"aria-hidden":!0,size:15}),t(b===`rollback`||b===`rollback-preview`?`common.loading`:v?`machine.confirmRollback`:`machine.previewRollback`)]})]}):null,A?(0,H.jsxs)(`footer`,{className:`personal-capability-actions`,children:[te?(0,H.jsxs)(`button`,{className:`is-danger`,disabled:!!b,onClick:()=>void I(),type:`button`,children:[(0,H.jsx)(Zm,{"aria-hidden":!0,size:15}),t(`machine.previewRemoval`)]}):null,(0,H.jsx)(`button`,{disabled:!!b||!N,onClick:()=>void re(),type:`button`,children:t(b===`preview`?`common.loading`:`machine.previewChanges`)}),(0,H.jsx)(`button`,{className:`is-primary`,disabled:!!b||!f,onClick:()=>void L(),type:`button`,children:t(b===`apply`?`common.loading`:`machine.applyPreview`)})]}):null,k.available_scopes.includes(`machine`)?(0,H.jsx)(Jb,{values:[{label:t(`machine.currentValue`),value:ee},{label:t(`capabilities.defaultValue`),value:k.default}],t},k.capability_id):null]})]})]}):(0,H.jsx)(`p`,{className:`personal-capability-empty`,children:t(`machine.capabilityEmpty`)})}var px={appearance:jm,capabilities:Km,language:xm,lark:Wm,machine:Hm};function mx({focusGoalConnection:e=!1,goals:t,initialGoalId:n,initialTab:r=`lark`,onChanged:i,onClose:a,onThemeChange:o,theme:s}){let{locale:c,setLocale:l,t:u}=qi(),[d,f]=(0,V.useState)(r),p=[...n?[{key:`capabilities`,label:u(`capabilities.title`)}]:[],{key:`machine`,label:u(`machine.title`)},{key:`lark`,label:`Lark`},{key:`appearance`,label:u(`settings.appearance`)},{key:`language`,label:u(`settings.language`)}],m=[{label:u(`settings.languageEnglish`),value:`en`},{label:u(`settings.languageSimplifiedChinese`),value:`zh-CN`}],h={appearance:{title:u(`settings.appearance`)},capabilities:{title:u(`capabilities.title`)},language:{title:u(`settings.language`)},lark:{title:`Lark`},machine:{title:u(`machine.title`)}}[d];return(0,H.jsxs)(`section`,{"aria-label":u(`settings.title`),className:`personal-settings-page`,"data-pw-theme":s,children:[(0,H.jsxs)(`aside`,{className:`personal-settings-sidebar`,children:[(0,H.jsxs)(`button`,{className:`personal-settings-back`,onClick:a,type:`button`,children:[(0,H.jsx)(Kp,{size:17}),(0,H.jsx)(`span`,{children:u(`settings.back`)})]}),(0,H.jsxs)(`div`,{className:`personal-settings-title`,children:[(0,H.jsx)(`small`,{children:u(`settings.eyebrow`)}),(0,H.jsx)(`strong`,{children:u(`settings.title`)})]}),(0,H.jsx)(`nav`,{"aria-label":u(`settings.categories`),className:`personal-settings-tabs`,children:p.map(e=>{let t=px[e.key];return(0,H.jsxs)(`button`,{"aria-current":d===e.key?`page`:void 0,onClick:()=>f(e.key),type:`button`,children:[(0,H.jsx)(t,{size:17}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:e.label})})]},e.key)})})]}),(0,H.jsxs)(`main`,{className:`personal-settings-body`,children:[(0,H.jsx)(`header`,{className:`personal-settings-header`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(`h1`,{children:h.title})})}),d===`lark`?(0,H.jsx)(Fb,{embedded:!0,focusGoalConnection:e,goals:t,initialGoalId:n,onChanged:i,onClose:a}):null,d===`machine`?(0,H.jsx)(fx,{}):null,d===`capabilities`?(0,H.jsx)(ax,{goalId:n}):null,d===`appearance`?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-appearance-settings`,children:[(0,H.jsx)(`small`,{children:u(`settings.workspaceDisplay`)}),(0,H.jsx)(`h3`,{children:u(`settings.appearance`)}),(0,H.jsxs)(`div`,{className:`personal-settings-choice-group`,role:`radiogroup`,"aria-label":u(`settings.workspaceTheme`),children:[(0,H.jsxs)(`button`,{"aria-checked":s===`loopx`,onClick:()=>o(`loopx`),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-settings-theme-swatch is-loopx`}),(0,H.jsx)(`strong`,{children:u(`settings.themeLoopx`)})]}),(0,H.jsxs)(`button`,{"aria-checked":s===`paper`,onClick:()=>o(`paper`),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-settings-theme-swatch is-paper`}),(0,H.jsx)(`strong`,{children:u(`settings.themeDefault`)})]}),(0,H.jsxs)(`button`,{"aria-checked":s===`brutal`,onClick:()=>o(`brutal`),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-settings-theme-swatch is-brutal`}),(0,H.jsx)(`strong`,{children:u(`settings.themeHighContrast`)})]})]})]}):null,d===`language`?(0,H.jsxs)(`section`,{className:`personal-settings-card`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`span`,{className:`personal-settings-icon`,children:(0,H.jsx)(xm,{size:18})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(`h2`,{children:u(`settings.language`)})})]}),(0,H.jsx)(`div`,{"aria-label":u(`settings.language`),className:`personal-language-options`,role:`radiogroup`,children:m.map(e=>(0,H.jsxs)(`button`,{"aria-checked":c===e.value,className:c===e.value?`is-selected`:``,onClick:()=>l(e.value),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:e.label})}),c===e.value?(0,H.jsx)(tm,{"aria-hidden":!0,size:17}):null]},e.value))})]}):null]})]})}var hx=`loopx-pw-theme`,gx=`loopx`;function _x(){try{let e=window.localStorage.getItem(hx);return e===`loopx`||e===`paper`||e===`brutal`?e:gx}catch{return gx}}function vx(e){try{window.localStorage.setItem(hx,e)}catch{}}function yx({drawer:e,drawerMode:t=`panel`,drawerOpen:n,main:r,mobileSidebarOpen:i=!1,onCloseMobileSidebar:a,sidebar:o,theme:s=`loopx`}){let{t:c}=qi(),l=(0,V.useRef)(null),u=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(!i)return;u.current=document.activeElement instanceof HTMLElement?document.activeElement:null;let e=l.current?.querySelectorAll(`button:not([disabled]), a[href], select:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])`);e?.[0]?.focus();function t(t){if(t.key!==`Tab`||!e?.length)return;let n=e[0],r=e[e.length-1];t.shiftKey&&document.activeElement===n?(t.preventDefault(),r.focus()):!t.shiftKey&&document.activeElement===r&&(t.preventDefault(),n.focus())}return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),u.current?.focus(),u.current=null}},[i]),(0,H.jsxs)(`section`,{className:`personal-workspace-shell${n?` has-drawer`:``}${n&&t.startsWith(`inspector`)?` has-task-inspector`:``}${t===`inspector-full`?` is-task-inspector-full`:``}${i?` mobile-sidebar-open`:``}`,"data-pw-theme":s,children:[i?(0,H.jsx)(`button`,{"aria-hidden":!0,className:`personal-sidebar-backdrop`,onClick:a,tabIndex:-1,type:`button`}):null,(0,H.jsx)(`aside`,{"aria-label":i?c(`header.goalNavigation`):void 0,"aria-modal":i?!0:void 0,className:`personal-workspace-sidebar`,"data-workspace-sidebar":!0,ref:l,role:i?`dialog`:void 0,children:(0,H.jsxs)(`div`,{className:`personal-workspace-sidebar-inner`,children:[i?(0,H.jsxs)(`button`,{className:`personal-sr-only`,onClick:a,type:`button`,children:[c(`common.close`),` `,c(`header.goalNavigation`)]}):null,o]})}),(0,H.jsx)(`main`,{"aria-hidden":i||void 0,className:`personal-workspace-main`,inert:i||void 0,children:r}),n?(0,H.jsx)(`aside`,{className:`personal-workspace-drawer`,"data-context-drawer":!0,"data-drawer-mode":t,children:e}):null]})}function bx(e){let t=e.match(/(?:下一步|建议|行动项|待办)[::\s]*([^\n]+)/u),n=t?t[1]:e;n=n.replace(/```[\s\S]*?```/g,``).replace(/`([^`]+)`/g,`$1`).replace(/\[([^\]]+)\]\([^)]+\)/g,`$1`).replace(/[#*~_>]/g,``).replace(/^[-*•\d+.\s]+/u,``).replace(/^(好的|没问题|收到|建议如下|任务如下|分析如下|结论[::])[\s,,::]*/u,``);let r=(n.split(/\r?\n/).map(e=>e.trim()).filter(Boolean)[0]||n).replace(/\s+/gu,` `).trim();return Array.from(r).slice(0,120).join(``)}function xx(e){let t=new Map;return e.forEach(e=>{let n=e.fields.find(e=>e.key===`todo_id`)?.value??``,r=[e.actionKind,e.goalId??``,n,e.title].join(`:`);t.set(r,e)}),[...t.values()]}function Sx(e,t,n){if(!e)return n(`home.noFirstActivity`);let r=new Date(e);if(Number.isNaN(r.getTime()))return e;let i=new Date,a=new Intl.DateTimeFormat(t,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);return r.toDateString()===i.toDateString()?n(`home.todayAt`,{time:a}):new Intl.DateTimeFormat(t,{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r)}function Cx({goals:e,onSelectGoal:t,onRetry:n,systemHealth:r}){let{locale:i,t:a}=qi(),o=e.filter(e=>e.activationState===`active`),s=o.filter(e=>e.loadState===`error`).length,c=[{key:`needs_you`,label:a(`home.lane.needsYou`)},{key:`running`,label:a(`home.lane.running`)},{key:`observing`,label:a(`home.lane.observing`)},{key:`scheduled`,label:a(`home.lane.scheduled`)}],l=Object.fromEntries(c.map(e=>[e.key,[]])),u=[],d=[];e.filter(e=>!e.loadState).forEach(e=>{let t=by(e);t===`history`?u.push(e):t===`stopped`?d.push(e):l[t].push(e)});let f=e=>(0,H.jsxs)(`button`,{className:`personal-home-goal-card`,"data-goal-state":e.loadState??e.state,"data-load-error":e.loadError,onClick:()=>t(e.goalId),type:`button`,children:[(0,H.jsxs)(`span`,{className:`personal-home-goal-meta`,children:[(0,H.jsx)(`i`,{}),e.agentLaneCount&&e.agentLaneCount>1?a(`header.workAgentCount`,{count:e.agentLaneCount}):e.agentLabel??e.agentId]}),(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsx)(`p`,{children:e.loadError?a(`startup.error.${e.loadError}`):e.needsYou??e.nextSentence}),(0,H.jsxs)(`footer`,{children:[(0,H.jsx)(`span`,{children:e.loadState?a(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Ji(e.state,i)}),(0,H.jsx)(`small`,{title:e.latestActivity,children:e.loadState?``:e.latestActivity?Sx(e.latestActivity,i,a):e.agentTodos.length?a(`home.taskCount`,{count:e.agentTodos.length}):a(`home.noActivity`)})]})]},e.goalId);return(0,H.jsxs)(`section`,{"aria-label":a(`home.workspace`),className:`personal-home-board`,children:[r&&(!r.ok||r.issues.length>0||r.freshnessWarning)?(0,H.jsxs)(`div`,{className:`personal-system-health-banner`,role:`alert`,children:[(0,H.jsxs)(`div`,{className:`personal-system-health-header`,children:[(0,H.jsx)(am,{size:15}),(0,H.jsx)(`strong`,{children:a(`home.systemHealth`,{summary:r.summary})}),r.freshnessWarning?(0,H.jsxs)(`small`,{children:[`(`,r.freshnessWarning,`)`]}):null]}),r.issues.length>0?(0,H.jsx)(`ul`,{className:`personal-system-health-issues`,children:r.issues.map((e,t)=>(0,H.jsx)(`li`,{children:e},t))}):null]}):null,o.some(e=>e.loadState)?(0,H.jsxs)(`section`,{className:`personal-home-lane`,"aria-live":`polite`,children:[(0,H.jsx)(`header`,{children:a(`startup.progress`,{loaded:o.filter(e=>!e.loadState).length,total:o.length})}),s?(0,H.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`status`,children:[(0,H.jsx)(`span`,{children:a(`startup.failedCount`,{count:s})}),(0,H.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,onClick:n,type:`button`,children:a(`startup.retryFailed`)})]}):null,o.filter(e=>e.loadState).map(f)]}):null,(0,H.jsx)(`div`,{className:`personal-home-lanes`,children:c.map(e=>(0,H.jsxs)(`section`,{className:`personal-home-lane is-${e.key}`,"data-testid":`personal-home-lane-${e.key}`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`i`,{}),e.label]}),(0,H.jsx)(`b`,{children:l[e.key].length})]}),(0,H.jsx)(`div`,{className:`personal-home-lane-list`,children:l[e.key].length?l[e.key].map(f):(0,H.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.empty`)})})]},e.key))}),(0,H.jsxs)(`details`,{className:`personal-home-history`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{children:a(`home.history`)}),(0,H.jsx)(`b`,{children:u.length}),(0,H.jsx)(`small`,{children:a(`home.completedGoals`)})]}),(0,H.jsx)(`div`,{children:u.length?u.map(f):(0,H.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.noCompletedGoals`)})})]}),d.length?(0,H.jsxs)(`details`,{className:`personal-home-history is-stopped`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{children:a(`home.stopped`)}),(0,H.jsx)(`b`,{children:d.length}),(0,H.jsx)(`small`,{children:a(`home.preservedState`)})]}),(0,H.jsx)(`div`,{children:d.map(f)})]}):null]})}function wx({items:e,onSelect:t,reportState:n}){let{locale:r,t:i}=qi();return(0,H.jsxs)(`section`,{className:`personal-object-list personal-files-list`,"data-testid":`personal-goal-outputs`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:i(`files.title`)}),(0,H.jsx)(`span`,{children:e.length})]}),n?.loading?(0,H.jsxs)(`p`,{className:`personal-object-list-state`,role:`status`,children:[(0,H.jsx)(Lm,{className:`is-spinning`,size:14}),i(`files.loadingReports`)]}):null,n?.error?(0,H.jsxs)(`p`,{className:`personal-object-list-state is-error`,role:`alert`,children:[(0,H.jsx)(am,{size:14}),i(`files.reportLoadFailed`),`: `,n.error]}):null,!n?.loading&&!n?.error&&e.length===0?(0,H.jsxs)(`p`,{className:`personal-object-list-state`,children:[(0,H.jsx)(_m,{size:14}),i(`files.empty`)]}):null,e.map(e=>(0,H.jsxs)(`button`,{"data-output-kind":e.output.kind,onClick:()=>t({item:e.output,kind:`output`}),type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-file-icon`,children:(0,H.jsx)(_m,{size:16})}),(0,H.jsx)(`strong`,{children:e.output.title}),e.output.report?(0,H.jsx)(`em`,{children:i(`files.reportDelta`,{added:e.output.report.addedCount,changed:e.output.report.changedCount})}):null,(0,H.jsx)(`p`,{children:e.output.summary??e.output.safePreview??e.output.kind??i(`files.emptySummary`)}),(0,H.jsx)(`small`,{title:e.output.createdAt,children:[e.output.goalTitle,e.output.kind===`report`?i(`files.verifiedReport`):null,e.output.todoId?`${i(`common.task`)} ${e.output.todoId}`:null,Sx(e.output.createdAt,r,i)].filter(Boolean).join(` · `)})]},e.id))]})}function Tx({agentLabel:e,messages:t,onClose:n,onDraftTask:r,onOpenConversation:i,title:a}){let{t:o}=qi(),s=t.reduce((e,t,n)=>t.role===`user`?n:e,0),c=t.slice(Math.max(0,s)).slice(-3),l=c.filter(e=>e.role===`assistant`&&!e.pending).at(-1);return(0,V.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,H.jsxs)(`aside`,{"aria-label":o(`conversation.receipt`),className:`personal-manager-conversation-tray`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:16}),(0,H.jsx)(`strong`,{children:a??o(`conversation.title`)}),(0,H.jsx)(`small`,{children:t.at(-1)?.pending?o(`conversation.replying`):o(`common.recently`)})]}),(0,H.jsxs)(`div`,{className:`personal-manager-conversation-actions`,children:[r&&l?(0,H.jsxs)(`button`,{className:`personal-manager-conversation-btn`,onClick:()=>r(l.text),title:o(`conversation.convertHint`),type:`button`,children:[(0,H.jsx)(Cm,{size:13}),(0,H.jsx)(`span`,{children:o(`conversation.toTask`)})]}):null,(0,H.jsx)(`button`,{className:`personal-manager-conversation-link`,onClick:i,type:`button`,children:o(`conversation.full`)}),n?(0,H.jsx)(`button`,{"aria-label":o(`conversation.close`),className:`personal-manager-conversation-close`,onClick:n,title:o(`conversation.close`),type:`button`,children:(0,H.jsx)(eh,{size:14})}):null]})]}),(0,H.jsx)(`div`,{"aria-live":`polite`,className:`personal-manager-conversation-messages`,children:c.map(t=>(0,H.jsxs)(`article`,{className:`is-${t.role}`,children:[(0,H.jsx)(`strong`,{children:t.role===`user`?o(`common.you`):t.agentLabel??e??o(`header.manager`)}),(0,H.jsxs)(`div`,{className:`personal-manager-conversation-bubble`,children:[t.role===`user`?(0,H.jsx)(`p`,{children:t.text}):(0,H.jsx)(Fy,{text:t.text}),t.pending?(0,H.jsx)(`small`,{children:o(`conversation.agentPending`)}):null,(0,H.jsx)(By,{delivery:t.returnDelivery})]})]},t.id))})]})}function Ex({onClose:e,onOpenDetails:t,run:n}){let{t:r}=qi();return(0,H.jsxs)(`section`,{"aria-label":r(`session.record`),className:`personal-session-record`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:17}),r(`session.record`)]}),(0,H.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,H.jsx)(eh,{size:15})})]}),(0,H.jsx)(`div`,{children:(0,H.jsx)(`strong`,{children:n.title})}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Agent`}),(0,H.jsx)(`dd`,{children:n.agentLabel})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`common.status`)}),(0,H.jsx)(`dd`,{children:Yi(n.sessionStatus??n.status,r)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Session`}),(0,H.jsx)(`dd`,{title:n.sessionId,children:n.sessionId})]})]}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:t,type:`button`,children:r(`session.details`)})]})}function Dx(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??yy(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>by(e)===`running`).slice(0,4).forEach(e=>r.push({id:`run:${e.goalId}`,kind:`run`,run:{agentId:e.agentId,agentLabel:e.agentLabel??e.agentId,completedSteps:e.doneTodoCount??e.agentTodos.filter(e=>e.done).length,goalId:e.goalId,goalTitle:e.title,latestActivity:e.agentSentence,runId:`goal:${e.goalId}`,status:`running`,title:e.nextSentence,totalSteps:Math.max((e.doneTodoCount??0)+e.agentTodos.filter(e=>!e.done).length,1)}})),r;let i=e.goals.find(e=>e.goalId===t);if(!i)return r;if(i.needsYou){let t=e.userTodos.find(e=>e.goalId===i.goalId);r.push({attention:t?{...t,goalTitle:i.title}:{blocking:i.needsYouBlocking??!1,goalId:i.goalId,goalTitle:i.title,text:i.needsYou,todoId:`${i.goalId}:attention`},id:`attention:${i.goalId}`,kind:`attention`})}r.push({id:`run:${i.goalId}`,kind:`run`,run:{agentId:i.agentId,agentLabel:i.agentLabel??i.agentId,completedSteps:i.doneTodoCount??i.agentTodos.filter(e=>e.done).length,goalId:i.goalId,goalTitle:i.title,latestActivity:i.agentSentence,runId:`goal:${i.goalId}`,status:i.state===`推进中`?`running`:i.state===`需修复`?`failed`:`waiting`,title:i.nextSentence,totalSteps:Math.max((i.doneTodoCount??0)+i.agentTodos.filter(e=>!e.done).length,1)}}),i.agentTodos.filter(e=>e.taskClass===`continuous_monitor`).forEach(t=>{let a=e.timeline?.find(e=>e.kind===`run`&&e.run.goalId===i.goalId&&e.run.todoId===t.todoId&&!!e.run.sessionId);r.push({id:`schedule:${i.goalId}:${t.todoId}`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:a?[{label:a.run.latestActivity||a.run.title,runId:a.run.runId,status:a.run.status===`waiting`||a.run.status===`queued`?`running`:a.run.status,timestamp:i.latestActivity||n(`common.recently`)}]:[],goalId:i.goalId,label:t.text,schedule:t.evidence??n(`schedule.summary`),scheduleId:t.todoId,scheduleKind:`monitor`,sessionId:a?.run.sessionId,status:t.done||t.status===`paused`?`paused`:`active`,stopCondition:n(`drawer.scheduleDefaultStop`),target:t.text,timezone:`Asia/Shanghai`}})});let a=e.timeline?.find(e=>e.kind===`proposal`&&e.proposal.actionKind===`heartbeat.bind`&&e.proposal.goalId===i.goalId);if(a){let e=e=>a.proposal.fields.find(t=>t.key===e)?.value;r.push({id:`schedule:${i.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:[],goalId:i.goalId,label:`${n(`schedule.heartbeat`)} · ${i.title}`,nextRunAt:n(`drawer.schedulePending`),notificationRule:n(`drawer.scheduleDefaultNotification`),schedule:e(`cadence`)??n(`schedule.summary`),scheduleId:`${i.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:a.proposal.status===`applied`?`active`:`draft`,stopCondition:e(`stop_condition`)??n(`drawer.scheduleDefaultStop`),timezone:e(`timezone`)??`Asia/Shanghai`}})}return r}function Ox(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function kx(e,t){let n={agent_id:t(`proposal.field.agentId`),cadence:t(`proposal.field.cadence`),completion_criteria:t(`proposal.field.completionCriteria`),execution_boundary:t(`proposal.field.executionBoundary`),goal_id:t(`proposal.field.goalId`),heartbeat:t(`proposal.field.heartbeat`),initial_todos:t(`proposal.field.initialTodos`),objective:t(`proposal.field.objective`),operation:t(`proposal.field.operation`),permission:t(`proposal.field.permission`),reason:t(`proposal.field.reason`),stop_condition:t(`proposal.field.stopCondition`),target:t(`proposal.field.target`),timezone:t(`proposal.field.timezone`),title:t(`proposal.field.title`),workspace_ref:t(`proposal.field.workspace`)},r=[`title`,`objective`,`completion_criteria`,`execution_boundary`,`permission`,`agent_id`,`workspace_ref`,`initial_todos`,`heartbeat`,`stop_condition`,`goal_id`];return Object.entries(e).sort(([e],[t])=>{let n=r.indexOf(e),i=r.indexOf(t);return(n<0?r.length:n)-(i<0?r.length:i)}).slice(0,10).map(([e,r])=>({key:e,label:n[e]??e.replaceAll(`_`,` `),value:e===`workspace_ref`?r===`current`?t(`proposal.workspace.current`):t(`proposal.workspace.named`,{workspace:String(r??`current`)}):Array.isArray(r)?r.join(` · `):typeof r==`object`&&r?JSON.stringify(r):String(r??`—`)}))}function Ax(e,t,n){let r=t.operationFrame,i=r?.content.fields.map((e,t)=>({key:`projection:${t}`,label:e.label,value:e.value})).slice(0,8)??[];return[{key:`operation_state`,label:n(`proposal.field.operationState`),value:r?.lifecycleState??e.status},...r?.kind===`result`?[{key:`result_delivery`,label:n(`proposal.field.resultDelivery`),value:r.resultDeliveryVerified?n(`proposal.resultDelivery.verified`):n(`proposal.resultDelivery.pending`)}]:[],...i,...r?[{key:`warning`,label:n(`proposal.field.confirmationBoundary`),value:r.content.warning}]:[],...r?[{key:`expires_at`,label:n(`proposal.field.expiresAt`),value:r.expiresAt}]:[]].slice(0,10)}function jx(e){if(e.action_kind!==`goal.lifecycle`)return;let t=e.normalized_parameters.operation;return t===`stop`||t===`resume`||t===`delete`?t:void 0}function Mx(e,t){let n=jx(e),r=gy(e),i=typeof e.normalized_parameters.title==`string`?e.normalized_parameters.title:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:``,a=typeof e.normalized_parameters.target==`string`?e.normalized_parameters.target:``,o=r.operationFrame,s=o?.content.title??e.summary,c=e.action_kind===`operation.execute`?s:e.action_kind===`goal.create`?t(`proposal.summary.goalCreate`,{title:i}):e.action_kind===`heartbeat.bind`?t(`proposal.summary.heartbeat`):e.action_kind===`monitor.create`?t(`proposal.summary.monitor`,{target:a}):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.summary.lifecycleStop`,{title:i}):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.summary.lifecycleDelete`,{title:i}):e.action_kind===`goal.lifecycle`?t(`proposal.summary.lifecycleResume`,{title:i}):e.summary;return{actionKind:e.action_kind,reviewPlan:r,fields:e.action_kind===`operation.execute`?Ax(e,r,t):kx(e.normalized_parameters,t),goalId:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:void 0,impact:e.action_kind===`operation.execute`?t(`proposal.impact.operation`):e.action_kind===`goal.create`?t(`proposal.impact.goalCreate`):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.impact.lifecycleStop`):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.impact.lifecycleDelete`):e.action_kind===`goal.lifecycle`?t(`proposal.impact.lifecycleResume`):e.permission_classification===`protected`?t(`proposal.impact.protected`):t(`proposal.impact.default`),previewId:e.proposal_id,lifecycleOperation:n,gate:e.gate?{kind:String(e.gate.kind??`protected_action`),nextAction:typeof e.gate.next_action==`string`?e.gate.next_action:void 0,summary:String(e.gate.summary??t(`proposal.gate.default`))}:void 0,primaryLabel:e.action_kind===`operation.execute`?o?.kind===`result`?o.resultDeliveryVerified?t(`proposal.primary.operationResultVerified`):t(`proposal.primary.operationResultPending`):t(`proposal.primary.operationGroup`):e.action_kind===`goal.create`?t(`proposal.primary.goalCreate`):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.primary.lifecycleStop`):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.primary.lifecycleDelete`):e.action_kind===`goal.lifecycle`?t(`proposal.primary.lifecycleResume`):e.action_kind===`todo.create`&&e.normalized_parameters.start_execution===!0?t(`proposal.primary.todoStart`):t(`proposal.primary.apply`),status:e.status===`applied`&&e.action_kind!==`operation.execute`&&r.interaction!==`completed`?`error`:Ox(e.status),title:c}}function Nx(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,42);if(t)return t;let n=2166136261;for(let t of e)n^=t.codePointAt(0)??0,n=Math.imul(n,16777619);return`goal-${(n>>>0).toString(36)}`}function Px(e,t){let n=e.match(/[「“"]([^」”"]{2,80})[」”"]/u)?.[1];return n?n.trim():e.replace(/^(请|帮我|我想|给我|创建|新建|设置|please|i want to|create|set up)+/iu,``).replace(/(一个|新的)?\s*(goal|目标)/giu,``).replace(/[,。!?].*$/u,``).trim().slice(0,80)||t(`goal.defaultTitle`)}function Fx(e,t){for(let n of e.split(/\r?\n/u)){let e=n.trim();for(let n of t){let t=e.match(RegExp(`^${n.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}\\s*[::]\\s*(.*)$`,`iu`));if(t?.[1]?.trim())return t[1].trim()}}return``}function Ix(e,t){let n=Fx(e,[`目标`,`Objective`]),r=Fx(e,[`完成标准`,`Completion criteria`]),i=Fx(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||Px(e,t)).split(/[。;;\n]/u)[0].trim().slice(0,80)||t(`goal.defaultTitle`),o=[n||a,r?t(`goal.objectiveCompletion`,{criteria:r}):``,i?t(`goal.objectiveBoundary`,{boundary:i}):``].filter(Boolean).join(` +`),s=/(只读|不调用外部工具|不修改(?:仓库|代码|状态)|read.?only|do not (?:call|use) external tools|do not modify (?:repositories|repository|code|state))/iu.test(i||e);return{completionCriteria:r,executionBoundary:i,initialTodos:r?[t(`goal.initialTodo`,{criteria:r})]:[],objective:o,permission:s?`read_only`:`workspace_write_on_confirmation`,title:a}}function Lx(e){let t=e.match(/(?:每|every)\s*(\d{1,3})\s*(?:分钟|minutes?)/iu)?.[1];if(t)return`${t}m`;let n=e.match(/(?:每|every)\s*(\d{1,2})\s*(?:小时|hours?)/iu)?.[1];return n?`${n}h`:/每小时|every hour|hourly/iu.test(e)?`1h`:(/每天|每日|早上|上午|daily|every day/iu.test(e),`1d`)}function Rx(e,t){return/(每周|星期|周[一二三四五六日天]|weekly|every\s+(?:mon|tues|wednes|thurs|fri|satur|sun)day|\d{1,2}\s*[::]\s*\d{2})/iu.test(e)?t(`schedule.unsupportedCalendar`):null}function zx(e,t){return Fx(e,[`检查内容`,`监控内容`,`目标`,`Check target`,`Monitor target`,`Target`])||e.replace(/^(?:为当前 Goal |for the current Goal )?(?:添加|配置|创建|add|configure|create)?\s*(?:定时检查|监控|scheduled check|monitor)[::]?/iu,``).split(/\r?\n/u)[0].trim()||t(`schedule.defaultTarget`)}function Bx(e){return/(mr|pr).{0,8}(合并|merge)/iu.test(e)?`pr_merged`:/发布完成|上线完成|release (?:is )?complete|deployment (?:is )?complete/iu.test(e)?`release_complete`:`goal_complete`}function Vx(e,t){let n=e.toLowerCase();return t.find(e=>n.includes(e.agentId.toLowerCase())||n.includes(e.label.toLowerCase()))}function Hx(e){let t=Fx(e,[`标题`,`任务标题`,`Todo 标题`]),n=Fx(e,[`内容`,`任务内容`,`Todo 内容`]);if(t)return[t,n].filter(Boolean).join(`:`).slice(0,400);let r=e.match(/[「“"]([^」”"]{2,200})[」”"]/u)?.[1];return r?r.trim():e.replace(/^(请|帮我|给我|为当前 Goal |新增|新建|创建|添加|加上|加一个|记一个)+/u,``).replace(/^(一个\s*)?(普通\s*)?(todo|待办|任务)(?:\s*到\s*Tasks?)?[::\s]*/iu,``).replace(/[。;;,,]\s*(?:不要|不需要|无需|禁止|别|暂不).{0,80}(?:heartbeat|心跳|定时|监控|执行).*$/iu,``).replace(/[,,]\s*(并且|然后|再)?\s*(交给|分配给|让).+$/u,``).replace(/\s*(交给|分配给|让)\s+.+$/u,``).trim().slice(0,400)||`推进当前 Goal 的下一项工作`}var Ux=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),Wx=5242880,Gx=4;function Kx(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onerror=()=>r(Error(t(`composer.imageReadError`,{name:e.name}))),i.onload=()=>n({dataUrl:String(i.result??``),id:crypto.randomUUID(),mimeType:e.type,name:e.name,size:e.size}),i.readAsDataURL(e)})}function qx({agents:e=[{agentId:`codex`,available:!0,capability:`代码与项目执行`,label:`Codex`}],callbacks:t={},goalArchiveLoadState:n={error:null,phase:`ready`},managerRuntime:r,model:i,readOnly:a=!1,selectedAgentId:o,selectedGoalId:s,statusSourceControl:c}){let{locale:l,t:u}=qi(),[d,f]=(0,V.useState)(s??null),[p,m]=(0,V.useState)(o??e.find(e=>e.available)?.agentId??`codex`),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(null),[x,S]=(0,V.useState)({}),[C,w]=(0,V.useState)(`chat`),[T,E]=(0,V.useState)(!1),[D,O]=(0,V.useState)(!1),[k,ee]=(0,V.useState)(!1),[te,A]=(0,V.useState)(()=>{try{let e=window.sessionStorage.getItem(`loopx-pw-composer-drafts`),t=e?JSON.parse(e):{};return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}),[j,M]=(0,V.useState)(!1),[N,P]=(0,V.useState)([]),[F,ne]=(0,V.useState)(null),[re,I]=(0,V.useState)(null),[L,ie]=(0,V.useState)(()=>new Set),[R,ae]=(0,V.useState)(()=>new Set),[oe,se]=(0,V.useState)(`idle`),[ce,le]=(0,V.useState)([]),[ue,z]=(0,V.useState)(!1),[de,fe]=(0,V.useState)(_x),[pe,me]=(0,V.useState)({}),[he,ge]=(0,V.useState)([]),_e=(0,V.useRef)(!1),ve=(0,V.useRef)(NaN),ye=(0,V.useRef)(null),be=(0,V.useRef)(null),xe=(0,V.useRef)(null),Se=(0,V.useRef)(new Set),Ce=(0,V.useRef)(new Set),[we,Te]=(0,V.useState)(null),B=s===void 0?d:s,Ee=o??p,De=`${B??`manager`}:${Ee}`,Oe=te[De]??``;(0,V.useEffect)(()=>{P([]),ne(null)},[De]);function ke(e,t){A(n=>{let r={...n};t?r[e]=t:delete r[e];try{window.sessionStorage.setItem(`loopx-pw-composer-drafts`,JSON.stringify(r))}catch{}return r})}function Ae(e){ke(De,e)}function je(e){let t=te[De]?.trimEnd();Ae(t?`${t}\n${e}`:e),window.requestAnimationFrame(()=>ye.current?.focus())}(0,V.useEffect)(()=>{let e=ye.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[Oe]);let Me=(0,V.useMemo)(()=>i.goals.map(e=>{let t=pe[e.goalId];return t?{...e,repository:{branch:t.branch,identity:t.identity,label:t.label,readOnly:!0}}:e}),[pe,i.goals]),Ne=(0,V.useMemo)(()=>Me.filter(e=>by(e)===`needs_you`).length,[Me]),Pe=(0,V.useMemo)(()=>Me.filter(e=>by(e)===`needs_you`&&(e.needsYouBlocking||e.state===`等你`)).length,[Me]),Fe=Me.find(e=>e.goalId===B)??null,Ie=h?.kind===`settings`,Le=B,Re=(0,V.useMemo)(()=>{let e=Object.values(x).filter(e=>e.actionKind===`heartbeat.bind`&&e.goalId&&e.status===`applied`).map(e=>({id:`schedule:${e.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:Ee,executionHistory:[],goalId:e.goalId,label:e.title,nextRunAt:u(`drawer.schedulePending`),notificationRule:u(`drawer.scheduleDefaultNotification`),schedule:e.fields.find(e=>e.key===`cadence`)?.value??u(`schedule.summary`),scheduleId:`${e.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:e.status===`applied`?`active`:`draft`,stopCondition:e.fields.find(e=>e.key===`stop_condition`)?.value??u(`drawer.scheduleDefaultStop`),timezone:e.fields.find(e=>e.key===`timezone`)?.value??`Asia/Shanghai`}})),t=[...Dx(i,Le,u),...i.timeline??[],...e,...xx(Object.values(x)).filter(e=>e.actionKind!==`heartbeat.bind`||e.status!==`applied`).map(e=>({id:`proposal:${e.previewId}`,kind:`proposal`,proposal:e}))];return[...new Map(t.map(e=>[e.id,e])).values()].filter(e=>e.kind!==`proposal`||![`stale`,`error`].includes(e.proposal.status)||ce.includes(e.proposal.previewId)).filter(e=>!B||e.kind===`message`?!0:e.kind===`proposal`?!e.proposal.goalId||e.proposal.goalId===B:e.kind===`attention`?e.attention.goalId===B:e.kind===`run`?e.run.goalId===B:e.kind===`schedule`?e.schedule.goalId===B:e.output.goalId===B)},[Le,i,x,Ee,B,ce,u]),ze=(0,V.useMemo)(()=>y?Re.filter(e=>e.kind===`message`?!0:e.kind===`run`?e.run.runId===y.runId:e.kind===`output`&&e.output.runId===y.runId):Re,[y,Re]);(0,V.useEffect)(()=>{if(!y)return;let e=Re.find(e=>e.kind===`run`&&e.run.runId===y.runId);!e||e.kind!==`run`||JSON.stringify({completedSteps:y.completedSteps,latestActivity:y.latestActivity,messages:y.sessionMessages,sessionStatus:y.sessionStatus,status:y.status,totalSteps:y.totalSteps})!==JSON.stringify({completedSteps:e.run.completedSteps,latestActivity:e.run.latestActivity,messages:e.run.sessionMessages,sessionStatus:e.run.sessionStatus,status:e.run.status,totalSteps:e.run.totalSteps})&&b(e.run)},[y,Re]);let Be=(0,V.useMemo)(()=>Re.flatMap(e=>e.kind===`message`?[e.message]:[]),[Re]),Ve=(0,V.useMemo)(()=>Fe?Re.flatMap(e=>e.kind===`message`?[e.message]:[]):[],[Re,Fe]);(0,V.useEffect)(()=>{Fe||T||Be.some(e=>e.pending)&&O(!0)},[T,Be,Fe]),(0,V.useEffect)(()=>{!Fe||C===`chat`||Ve.some(e=>e.pending)&&ee(!0)},[Ve,Fe,C]);let He=(0,V.useMemo)(()=>Re.filter(e=>e.kind===`message`||e.kind===`proposal`&&ce.includes(e.proposal.previewId)),[Re,ce]),Ue=He[He.length-1],We=Ue?.kind===`message`?Ue.message.text.length:0;(0,V.useEffect)(()=>{if(!T||!be.current)return;let e=window.requestAnimationFrame(()=>{be.current&&(be.current.scrollTop=be.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[He.length,T,We]);let Ge=(0,V.useMemo)(()=>{if(h?.kind===`settings`)return null;if(h?.kind===`attention`)return{kind:`attention`,item:Gd(h.item,i.attentionHistory??i.userTodos)};if(h?.kind===`goal`){let e=Me.find(e=>e.goalId===h.item.goalId);return e?{item:e,kind:`goal`}:h}if(h?.kind!==`run`)return h;let e=Re.find(e=>e.kind===`run`&&e.run.runId===h.item.runId);return e?{item:e.run,kind:`run`}:h},[Re,h,Me,i.attentionHistory,i.userTodos]);(0,V.useEffect)(()=>{if(a){me({}),ge([]);return}let e=!1;return Promise.all([Lg(),Jg()]).then(([t,n])=>{e||(me(Object.fromEntries(t.map(e=>[e.goal_id,e.repository]))),ge(n))}).catch(()=>{}),()=>{e=!0}},[a]),(0,V.useEffect)(()=>{if(!ue)return;function e(e){e.key===`Escape`&&z(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[ue]),(0,V.useEffect)(()=>{if(B||!Re.length)return;if(!_e.current){_e.current=!0;try{ve.current=Date.parse(window.localStorage.getItem(`loopx-pw-last-visit`)??``),window.localStorage.setItem(`loopx-pw-last-visit`,new Date().toISOString())}catch{ve.current=NaN}}let e=ve.current,t=Re.filter(e=>e.kind===`run`).map(e=>e.run),n=t=>{let n=Date.parse(t??``);return!Number.isNaN(e)&&!Number.isNaN(n)&&n>e},r={attention:Ne,done:t.filter(e=>e.status===`completed`&&n(e.latestActivity)).length,failed:t.filter(e=>(e.status===`failed`||e.status===`interrupted`)&&n(e.latestActivity)).length};Te(e=>e?.attention===r.attention&&e.done===r.done&&e.failed===r.failed?e:r)},[Re,Ne,B]),(0,V.useEffect)(()=>{if(a){S({});return}let e=!1;return Nh(B?{goalId:B}:{contextKind:`manager`}).then(t=>{if(e)return;let n=Object.fromEntries(t.filter(e=>[`preview_ready`,`gated`,`deferred`,`applying`].includes(e.status)||e.action_kind===`operation.execute`&&e.status===`applied`).map(e=>{let t=Mx(e,u);return[t.previewId,t]}));S(e=>({...e,...n}))}).catch(()=>{}),()=>{e=!0}},[a,B,u]);async function Ke(e,n={}){if(a)throw Error(u(`source.readOnlyWriteError`));let r;try{r=t.onPreviewAction?await t.onPreviewAction(e):Mx(await jh(e),u)}catch(t){if(!(t instanceof Eh)||t.payload.error_code!==`action_preview_gate`)throw t;let n=t.payload.gate&&typeof t.payload.gate==`object`?t.payload.gate:{},i=(Array.isArray(n.candidates)?n.candidates:[]).flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.workspace_ref==`string`&&typeof t.label==`string`?[{label:t.label,workspaceRef:t.workspace_ref}]:[]}),a=String(n.kind??`workspace_selection_required`),o=a===`agent_binding_required`||a===`agent_identity_selection_required`;r={actionKind:e.actionKind,fields:i.map(e=>({key:`workspace_ref:${e.workspaceRef}`,label:e.label,value:e.workspaceRef})),gate:{kind:a,nextAction:typeof n.next_action==`string`?n.next_action:void 0,summary:String(n.summary??u(`proposal.workspaceGate.defaultSummary`))},impact:u(o?`proposal.workspaceGate.agentImpact`:`proposal.workspaceGate.selectionImpact`),previewId:`workspace-choice-${Date.now().toString(36)}`,sourceRequest:e,status:`gated`,title:u(o?`proposal.workspaceGate.agentTitle`:`proposal.workspaceGate.selectionTitle`),workspaceCandidates:i}}return le(e=>e.includes(r.previewId)?e:[...e,r.previewId]),S(e=>({...e,[r.previewId]:r})),n.select!==!1&&g({item:r,kind:`proposal`}),r}function qe(){tt(null),ke(`manager:${Ee}`,u(`composer.createGoalTemplate`)),window.requestAnimationFrame(()=>ye.current?.focus())}async function Je(e,n){z(!1);let r={delete:`Deleted from the owner workspace`,resume:`Resumed from the owner workspace`,stop:`Stopped from the owner workspace`},i={delete:u(`proposal.summary.lifecycleDelete`,{title:e.title}),resume:u(`proposal.summary.lifecycleResume`,{title:e.title}),stop:u(`proposal.summary.lifecycleStop`,{title:e.title})},a=null,o=!1;try{if(n===`stop`){if(Se.current.has(e.goalId))return;Se.current.add(e.goalId),ie(new Set(Se.current)),g(null),a={goalId:e.goalId,next:`stopped`,optimisticApplied:!0,previous:e.activationState},I(u(`feedback.applying`,{title:i.stop})),t.onGoalActivationStateChange?.(e.goalId,`stopped`)}if(t.onExecuteGoalLifecycle){if(n===`delete`)throw Error(`The selected status source does not authorize Goal deletion.`);let a=await t.onExecuteGoalLifecycle({goalId:e.goalId,operation:n,reason:r[n]});if(!a.projectionVerified)throw Error(`Goal lifecycle projection did not verify.`);o=!0,t.onGoalActivationStateChange?.(e.goalId,a.activationState),I(u(`feedback.completed`,{title:i[n]})),n===`stop`&&tt(null),await(t.onReconcileStatus??t.onRefresh)?.();return}let s=await Ke({actionKind:`goal.lifecycle`,context:{kind:`goal_directory`,goal_id:e.goalId},idempotencyKey:`workspace-goal-${n}-${e.goalId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:n,reason:r[n]},summary:i[n]},{select:n!==`stop`});if(s.goalId!==e.goalId||s.lifecycleOperation!==n)throw g(null),Error(u(`actionReview.targetChanged`));n===`stop`&&(s.reviewPlan?.interaction===`direct`?(o=!0,await Qe(s,{lifecycleProjection:a??void 0,presentation:`feedback`})):(a&&t.onGoalActivationStateChange?.(a.goalId,a.previous),I(s.gate?u(`feedback.gateRequired`,{summary:s.gate.summary}):u(`feedback.notCompleted`,{status:s.status})),g({item:s,kind:`proposal`})))}catch(e){a&&!o&&t.onGoalActivationStateChange?.(a.goalId,a.previous),I(u(`feedback.executionFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{n===`stop`&&(Se.current.delete(e.goalId),ie(new Set(Se.current)))}}function Ye(e,t){Ae(u(t?e===`heartbeat`?`composer.heartbeatTemplate`:`composer.monitorTemplate`:e===`heartbeat`?`composer.heartbeatTemplateWithoutGoal`:`composer.monitorTemplateWithoutGoal`)),g(null),window.requestAnimationFrame(()=>ye.current?.focus())}async function Xe(e,n,r=``){let i=await t.onRequestScheduleConfig?.(e,n);if(i){le(e=>e.includes(i.previewId)?e:[...e,i.previewId]),S(e=>({...e,[i.previewId]:i})),g({item:i,kind:`proposal`});return}if(!n){Ae(u(e===`heartbeat`?`composer.heartbeatGoalQuestion`:`composer.monitorGoalQuestion`));return}let a=Date.now().toString(36);await Ke({actionKind:e===`heartbeat`?`heartbeat.bind`:`monitor.create`,context:{kind:`schedule`,goal_id:n},idempotencyKey:`workspace-${e}-${n}-${a}`,normalizedParameters:e===`heartbeat`?{agent_id:Ee,cadence:Lx(r),goal_id:n,stop_condition:Bx(r),timezone:`Asia/Shanghai`}:{agent_id:Ee,cadence:Lx(r),goal_id:n,stop_condition:Bx(r),target:zx(r,u),target_key:`goal-${n}`,timezone:`Asia/Shanghai`},summary:e===`heartbeat`?u(`proposal.summary.heartbeat`):u(`proposal.summary.monitor`,{target:zx(r,u)})})}async function Ze(e){if(!Ce.current.has(e.todoId)){Ce.current.add(e.todoId),ae(new Set(Ce.current)),I(u(`feedback.preparingPreview`,{title:e.text}));try{await Ke({actionKind:`todo.update`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-${e.todoId}-complete-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:`complete`,todo_id:e.todoId},summary:u(`tasks.markComplete`,{name:e.text})}),I(null)}catch(e){I(u(`feedback.previewFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{Ce.current.delete(e.todoId),ae(new Set(Ce.current))}}}async function Qe(e,n={}){if(e.reviewPlan&&!e.reviewPlan.canApply)return;let r=n.presentation!==`feedback`,a=e.actionKind===`goal.lifecycle`&&e.goalId&&(e.lifecycleOperation===`stop`||e.lifecycleOperation===`resume`)?{goalId:e.goalId,next:e.lifecycleOperation===`stop`?`stopped`:`active`,optimisticApplied:!1,previous:i.goals.find(t=>t.goalId===e.goalId)?.activationState??(e.lifecycleOperation===`stop`?`active`:`stopped`)}:null,o=n.lifecycleProjection??a;I(u(`feedback.applying`,{title:e.title}));let s={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`pending`,reason:`apply_pending`,canApply:!1}:void 0,status:`applying`};S(t=>({...t,[e.previewId]:s})),r&&g({item:s,kind:`proposal`}),o&&!o.optimisticApplied&&t.onGoalActivationStateChange?.(o.goalId,o.next);try{if(t.onApplyProposal){await t.onApplyProposal(e);let n={...e,status:`applied`};if(S(t=>({...t,[e.previewId]:n})),r&&g({item:n,kind:`proposal`}),I(u(`feedback.completed`,{title:e.title})),e.actionKind===`goal.lifecycle`){(e.lifecycleOperation===`stop`||e.lifecycleOperation===`delete`)&&tt(null),e.lifecycleOperation===`delete`&&e.goalId&&t.onGoalDeleted?.(e.goalId);let n=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>n?.()).catch(()=>void 0)}return}let n=await Ph(e.previewId);if(n.proposal.proposal_id!==e.previewId||n.proposal.action_kind!==e.actionKind||e.actionKind===`goal.lifecycle`&&(n.proposal.normalized_parameters.goal_id!==e.goalId||jx(n.proposal)!==e.lifecycleOperation))throw new Eh(u(`actionReview.targetChanged`),{error_code:`action_response_mismatch`});let i=Mx(n.proposal,u);if(S(t=>({...t,[e.previewId]:i})),r&&g({item:i,kind:`proposal`}),i.reviewPlan?.interaction!==`completed`){o&&t.onGoalActivationStateChange?.(o.goalId,o.previous),g({item:i,kind:`proposal`}),I(n.proposal.status===`stale`?u(`feedback.stale`):u(`actionReview.${i.reviewPlan.reason}`));return}if(I(u(`feedback.completed`,{title:i.title})),i.actionKind===`todo.create`&&await t.onRefresh?.(),i.actionKind===`goal.lifecycle`&&(i.lifecycleOperation===`stop`||i.lifecycleOperation===`delete`)&&tt(null),i.actionKind===`goal.lifecycle`&&i.lifecycleOperation===`delete`&&i.goalId&&t.onGoalDeleted?.(i.goalId),i.actionKind===`goal.lifecycle`){let e=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>e?.()).catch(()=>void 0)}}catch(n){if(o&&t.onGoalActivationStateChange?.(o.goalId,o.previous),n instanceof Eh&&n.payload.error_code===`protected_action`){let r=n.payload.gate,i=r&&typeof r==`object`?r:{},a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`gated`,reason:`authority_gate`,canApply:!1}:void 0,gate:{kind:String(i.kind??`protected_action`),nextAction:typeof i.next_action==`string`?i.next_action:void 0,summary:String(i.summary??n.message)},status:`gated`};S(t=>({...t,[e.previewId]:a})),g({item:a,kind:`proposal`}),I(u(`feedback.gateRequired`,{summary:a.gate.summary})),e.actionKind===`goal.create`&&e.goalId&&(t.onRefresh?.(),tt(e.goalId));return}let r=n instanceof Eh&&_y(n.payload),i=n instanceof Eh&&n.payload.error_code===`action_response_mismatch`,a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:r?`refresh`:`repair`,reason:i?`readback_unverified`:r?`stale_proposal`:`apply_failed`,canApply:!1}:void 0,errorMessage:n instanceof Error?n.message:String(n),status:r?`stale`:`error`};S(t=>({...t,[e.previewId]:a})),g({item:a,kind:`proposal`}),I(u(`feedback.executionFailed`,{error:a.errorMessage}))}}let $e={...t,onOpenRunSession:async e=>{e.goalId!==B&&tt(e.goalId),w(`chat`),await t.onOpenRunSession?.(e),b(e),g(null)},onOpenGoal:e=>{tt(e);let n=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>n?.()).catch(()=>{I(u(`feedback.goalRefreshFailed`))})},onOpenGoalView:e=>{w(e),e===`chat`&&b(null),g(null)},onOpenOutput:e=>{e.goalId!==B&&tt(e.goalId),w(`files`),t.onOpenOutput?.(e)},onApplyProposal:Qe,onCancelProposal:async e=>{g(null),S(t=>{let n={...t};return delete n[e.previewId],n});try{t.onCancelProposal?.(e),t.onCancelProposal||await Fh(e.previewId)}catch(t){S(t=>({...t,[e.previewId]:e})),I(u(`feedback.cancelFailed`,{error:t instanceof Error?t.message:String(t)}))}},onTransitionProposal:async(e,t)=>{let n=Mx(await Ih(e.previewId,t),u);le(e=>e.includes(n.previewId)?e:[...e,n.previewId]),S(r=>{let i={...r};return t===`regenerate`&&delete i[e.previewId],i[n.previewId]=n,i}),g({item:n,kind:`proposal`})},onSelectWorkspaceCandidate:async(e,t)=>{e.sourceRequest&&(S(t=>{let n={...t};return delete n[e.previewId],n}),await Ke({...e.sourceRequest,idempotencyKey:`${e.sourceRequest.idempotencyKey}-${t}`,normalizedParameters:{...e.sourceRequest.normalizedParameters,workspace_ref:t}}))},onPreviewAction:Ke,onRequestScheduleConfig:(e,t)=>Ye(e,t),onOpenNotificationSettings:e=>g({goalId:e,kind:`settings`,tab:`lark`}),onFetchNotificationTargets:()=>ag(),onSetupGoalChannel:e=>sg(e),onToggleGoalAutoNotify:e=>cg(e),onUpdateSchedule:async(e,t)=>{let n=Date.now().toString(36),r=e.scheduleKind===`heartbeat`;await Ke({actionKind:r?`heartbeat.bind`:`monitor.update`,context:{kind:`schedule`,goal_id:e.goalId},idempotencyKey:`workspace-monitor-${e.scheduleId}-${t}-${n}`,normalizedParameters:{agent_id:e.agentId??Ee,...!r&&t===`run_now`?{endpoint_id:Ee}:{},...t===`edit`?{cadence:`2h`,...r?{timezone:e.timezone??`Asia/Shanghai`}:{}}:{},goal_id:e.goalId,operation:t,...!r&&t===`run_now`&&e.sessionId?{session_id:e.sessionId}:{},...r?{}:{todo_id:e.scheduleId}},summary:t===`pause`?`暂停自动运行:${e.label}`:t===`resume`?`恢复自动运行:${e.label}`:t===`run_now`?`立即运行:${e.label}`:t===`stop`?`停止自动运行:${e.label}`:`编辑自动运行生命周期:${e.label}`})}},et=a?{onOpenGoal:$e.onOpenGoal,onOpenGoalView:$e.onOpenGoalView,onOpenOutput:$e.onOpenOutput}:$e;function tt(e){f(e),E(!1),O(!1),ee(!1),b(null),g(null),w(`tasks`),z(!1),t.onSelectGoal?.(e)}function nt(e){m(e),t.onSelectAgent?.(e)}function rt(e){fe(e),vx(e)}async function it(n){let r=n?[]:N,i=(n??Oe).trim()||(r.length?u(`composer.imageAnalysisPrompt`):``);if(!(!i||j)){n||(Ae(``),P([])),ne(null),M(!0);try{if(r.length){B?C!==`chat`&&ee(!0):O(!0);let e=await t.onSendMessage?.(i,Ee,B,r);e&&await Ke(e);return}let n=Yy(i,{agents:e.map(e=>({agentId:e.agentId,label:e.label})),goalId:B,todos:(Fe?.agentTodos??[]).map(e=>({text:e.text,todoId:e.todoId}))});if(n.route===`clarify`){Ae(i);let e=u(`composer.clarifySingleAction`);n.missingFields.includes(`resume_when`)&&(e=u(`composer.clarifyDefer`)),I(e);return}if(n.actionKind===`goal.create`){let e=Ix(i,u),t=Nx(e.title);await Ke({actionKind:`goal.create`,context:{kind:`manager`,goal_id:null,natural_language:i},idempotencyKey:`workspace-goal-intent-${t}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Ee,completion_criteria:e.completionCriteria,execution_boundary:e.executionBoundary,goal_id:t,heartbeat:{cadence:Lx(i),enabled:n.normalizedParameters.heartbeat_enabled===!0,timezone:`Asia/Shanghai`},initial_todos:e.initialTodos,objective:e.objective,permission:e.permission,stop_condition:Bx(i),title:e.title,workspace_ref:`current`},summary:u(`proposal.summary.goalCreate`,{title:e.title})});return}if(B&&n.actionKind===`heartbeat.bind`){await Xe(`heartbeat`,B,i);return}if(B&&n.actionKind===`monitor.create`){let e=Rx(i,u);if(e){Ae(i),I(e);return}await Xe(`monitor`,B,i);return}let a=Vx(i,e);if(B&&a&&n.actionKind===`agent.bind`){await Ke({actionKind:`agent.bind`,context:{kind:`goal`,goal_id:B,natural_language:i},idempotencyKey:`workspace-agent-bind-${B}-${a.agentId}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:a.agentId,goal_id:B},summary:`将 ${a.label} 绑定到 ${Fe?.title??B}`});return}if(B&&n.actionKind===`todo.create`){if(n.normalizedParameters.start_execution===!0){await Ke({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:i},idempotencyKey:`workspace-task-start-${B}-${Date.now().toString(36)}`,normalizedParameters:{endpoint_id:a?.agentId??Ee,goal_id:B,start_execution:!0,text:i},summary:`交给 Agent 执行:${i.slice(0,120)}`});return}let e=a?.agentId??(/(交给|分配给|让).{0,24}(agent|codex|claude|kiro|kimi)/iu.test(i)?Ee:null);await Ke({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:i},idempotencyKey:`workspace-todo-create-${B}-${Date.now().toString(36)}`,normalizedParameters:{...e?{endpoint_id:e}:{},goal_id:B,text:Hx(i)},summary:`创建 Todo:${Hx(i)}`});return}let o=Fe?.agentTodos.find(e=>i.includes(e.todoId)||i.includes(e.text)),s=typeof n.normalizedParameters.operation==`string`?n.normalizedParameters.operation:null;if(B&&o&&n.actionKind===`todo.update`&&s){await Ke({actionKind:`todo.update`,context:{kind:`todo`,goal_id:B,todo_id:o.todoId,natural_language:i},idempotencyKey:`workspace-todo-update-${o.todoId}-${s}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Ee,...s===`reassign`&&a?{endpoint_id:a.agentId}:{},...s===`block`?{note:i}:{},...s===`defer`&&typeof n.normalizedParameters.resume_when==`string`?{resume_when:n.normalizedParameters.resume_when}:{},goal_id:B,operation:s,todo_id:o.todoId},summary:`更新 Todo:${o.text}`});return}B?C!==`chat`&&ee(!0):O(!0);let c=await t.onSendMessage?.(i,Ee,B);c&&await Ke(c)}catch(e){n||(Ae(i),P(r));let t=e instanceof Error?e.message:u(`feedback.sendGenericError`);I(u(`feedback.sendFailed`,{error:t}))}finally{M(!1)}}}let at=e.find(e=>e.agentId===Ee)?.label??Ee,ot=!Fe&&Oe.startsWith(u(`composer.createGoalDraftLead`)),st=Re.filter(e=>e.kind===`run`&&!!e.run.sessionId&&!!e.run.canInterrupt&&(e.run.status===`running`||e.run.status===`queued`)).length;async function ct(e){if(!e?.length)return;let t=Gx-N.length,n=Array.from(e).slice(0,Math.max(0,t)),r=n.find(e=>!Ux.has(e.type)),i=n.find(e=>e.size>Wx);if(t<=0){ne(u(`composer.imageCountError`,{count:Gx}));return}if(r){ne(u(`composer.imageTypeError`));return}if(i){ne(u(`composer.imageSizeError`,{size:Wx/1024/1024}));return}try{let t=await Promise.all(n.map(e=>Kx(e,u)));P(e=>[...e,...t].slice(0,Gx)),ne(e.length>n.length?u(`composer.imageCountError`,{count:Gx}):null)}catch(e){ne(e instanceof Error?e.message:u(`composer.imageReadGenericError`))}finally{xe.current&&(xe.current.value=``)}}function lt(e){let t=Array.from(e.clipboardData.items).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).flatMap(e=>{let t=e.getAsFile();return t?[t]:[]});t.length&&(e.preventDefault(),ct(t))}async function ut(){let e=await Jg();ge(e)}async function dt(){await Promise.all([ut(),t.onRefresh?.()])}async function ft(){if(!(!t.onRefresh||oe===`loading`)){se(`loading`);try{await t.onRefresh(),se(`done`)}catch{se(`error`)}window.setTimeout(()=>se(`idle`),1800)}}return Ie?(0,H.jsx)(mx,{focusGoalConnection:!!(h?.kind===`settings`&&h.goalId),goals:Me,initialGoalId:h?.kind===`settings`?h.goalId??B:B,initialTab:h?.kind===`settings`?h.tab??`lark`:`lark`,onChanged:()=>void dt(),onClose:()=>g(null),onThemeChange:rt,theme:de}):(0,H.jsx)(yx,{drawer:Ge?(0,H.jsx)(ib,{agents:e,attentionHistory:i.attentionHistory??i.userTodos,onSelectAttention:e=>g({kind:`attention`,item:e}),callbacks:et,goalNotifications:i.goalNotifications??[],goals:Me,inspectorExpanded:_,larkConnections:a?[]:he,onClose:()=>{Ge.kind===`proposal`&&[`applied`,`rejected`].includes(Ge.item.status)&&(Ge.item.actionKind!==`heartbeat.bind`||Ge.item.status!==`applied`)&&S(e=>{let t={...e};return delete t[Ge.item.previewId],t}),v(!1),g(null)},onToggleInspectorSize:()=>v(e=>!e),readOnly:a,runs:Re.flatMap(e=>e.kind===`run`?[e.run]:[]),selection:Ge}):null,drawerMode:Ge?.kind===`todo`?_?`inspector-full`:`inspector`:`panel`,drawerOpen:Ge!==null,mobileSidebarOpen:ue,onCloseMobileSidebar:()=>z(!1),theme:de,main:(0,H.jsxs)(`div`,{className:`personal-channel`,children:[(0,H.jsx)(Oy,{agents:e,managerChatOpen:T,managerRuntime:r,mobileNavigationOpen:ue,onOpenGoalCapabilities:Fe?()=>g({goalId:Fe.goalId,kind:`settings`,tab:`capabilities`}):void 0,onOpenGoalDetail:Fe&&!Fe.loadState?()=>g({item:Fe,kind:`goal`}):void 0,onRefresh:t.onRefresh?()=>void ft():void 0,onOpenNavigation:()=>z(!0),onOpenManagerChat:()=>{O(!1),E(!0)},onSelectGoalTab:e=>{w(e),e===`chat`&&(b(null),ee(!1))},onSelectAgent:nt,onReturnManagerHome:()=>{E(!1),O(!1),window.requestAnimationFrame(()=>be.current?.scrollTo({behavior:`smooth`,top:0}))},selectedAgentId:Ee,refreshState:oe,readOnlySourceLabel:a?c?.activeSource.label:void 0,selectedGoal:Fe,selectedGoalTab:C}),(0,H.jsxs)(`div`,{className:`personal-channel-scroll`,ref:be,children:[!Fe&&!T&&we&&we.done+we.failed+we.attention>0?(0,H.jsxs)(`section`,{className:`personal-digest-card`,"aria-label":u(`digest.away`),children:[(0,H.jsx)(`strong`,{children:u(`digest.away`)}),(0,H.jsxs)(`div`,{className:`personal-digest-stats`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{children:we.done}),u(`digest.completed`)]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{children:we.failed}),u(`digest.failed`)]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{children:we.attention}),u(`digest.needsYou`)]})]})]}):null,!Fe&&!T?(0,H.jsxs)(`section`,{className:`personal-manager-greeting`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(Qp,{size:20})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:u(`home.greeting`)}),(0,H.jsx)(`p`,{children:i.goals.some(e=>e.activationState===`active`&&e.loadState)?u(`startup.partial`):(0,H.jsxs)(H.Fragment,{children:[u(`home.waitingCount`,{count:Ne}),` `,u(`home.blockingSummary`,{count:Pe})]})})]})]}):null,Fe?.loadState?(0,H.jsx)(`section`,{className:`personal-manager-greeting`,role:`status`,"data-testid":`goal-status-loading`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:u(Fe.loadState===`error`?`startup.goalError`:`startup.goalLoading`)}),(0,H.jsx)(`p`,{children:u(Fe.loadError?`startup.error.${Fe.loadError}`:`startup.independent`)}),Fe.loadState===`error`?(0,H.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,type:`button`,onClick:()=>void t.onRefresh?.(),children:u(`startup.retry`)}):null]})}):Fe&&C===`tasks`?(0,H.jsx)(Ab,{historyEnabled:!a,goal:Fe,items:Re,onDraftTaskFromMessage:a?void 0:e=>{Ae(`创建一个 Task:${bx(e)}`),I(u(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>ye.current?.focus())},onOpenChat:()=>w(`chat`),onQuickComplete:a?void 0:Ze,onSelect:g,quickCompletingTodoIds:R,selectedTodoId:Ge?.kind===`todo`?Ge.item.todoId:null,userTodos:i.userTodos}):Fe&&C===`files`?(0,H.jsx)(wx,{items:Re.filter(e=>e.kind===`output`),onSelect:g,reportState:i.periodicReports}):!Fe&&!T?(0,H.jsx)(Cx,{goals:Me,onRetry:()=>void t.onRefresh?.(),onSelectGoal:tt,systemHealth:i.systemHealth}):Fe?(0,H.jsxs)(H.Fragment,{children:[Fe&&y?.goalId===Fe.goalId?(0,H.jsx)(Ex,{onClose:()=>b(null),onOpenDetails:()=>g({item:y,kind:`run`}),run:y}):null,(0,H.jsx)(Vy,{items:ze,onSelect:g,selectedGoal:Fe})]}):(0,H.jsx)(Vy,{items:He,onSelect:g,selectedGoal:null})]}),(0,H.jsx)(`div`,{className:`personal-composer-wrap`,children:a?(0,H.jsxs)(`div`,{className:`personal-read-only-notice`,children:[(0,H.jsx)(`strong`,{children:u(`source.readOnlyNoticeTitle`)}),(0,H.jsx)(`span`,{children:u(`source.readOnlyNoticeDescription`)})]}):(0,H.jsxs)(H.Fragment,{children:[!Fe&&!T&&D&&Be.length?(0,H.jsx)(Tx,{messages:Be,onClose:()=>O(!1),onOpenConversation:()=>{O(!1),E(!0)}}):null,Fe&&C!==`chat`&&k&&Ve.length?(0,H.jsx)(Tx,{agentLabel:at,messages:Ve,onClose:()=>ee(!1),onDraftTask:C===`tasks`?e=>{Ae(`创建一个 Task:${bx(e)}`),I(u(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>ye.current?.focus())}:void 0,onOpenConversation:()=>{ee(!1),w(`chat`)},title:`${Fe.title} · ${at}`}):null,re?(0,H.jsxs)(`div`,{className:`personal-action-feedback`,role:`status`,children:[(0,H.jsx)(`span`,{children:re}),(0,H.jsx)(`button`,{"aria-label":u(`common.closeActionReceipt`),onClick:()=>I(null),type:`button`,children:(0,H.jsx)(eh,{size:14})})]}):null,(0,H.jsx)(`p`,{className:`personal-composer-hint`,children:Fe?st>0?u(`composer.goalRunningHint`,{agent:at,count:st}):u(`composer.goalMessageHint`,{agent:at}):u(`composer.managerMessageHint`)}),Fe?(0,H.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,H.jsxs)(`button`,{"aria-label":u(`composer.nextAction`),className:`is-draft`,onClick:()=>je(u(`composer.nextActionPrompt`)),title:u(`composer.prepareDraft`),type:`button`,children:[(0,H.jsx)(Dm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.nextAction`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]}),(0,H.jsxs)(`button`,{className:`is-immediate`,disabled:j,onClick:()=>void it(u(`composer.agentProgressPrompt`)),title:u(`composer.immediate`),type:`button`,children:[(0,H.jsx)(Vm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.agentProgress`)}),(0,H.jsx)(`em`,{className:`personal-prompt-badge`,children:u(`composer.immediate`)})]}),(0,H.jsxs)(`button`,{"aria-label":u(`composer.monitor`),className:`is-draft`,onClick:()=>Ye(`monitor`,B),title:u(`composer.monitorHint`),type:`button`,children:[(0,H.jsx)(em,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.monitor`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]})]}):(0,H.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,H.jsxs)(`button`,{"aria-label":u(`composer.globalTasks`),className:`is-draft`,onClick:()=>je(u(`composer.globalTasksPrompt`)),title:u(`composer.prepareDraft`),type:`button`,children:[(0,H.jsx)(Dm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.globalTasks`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]}),(0,H.jsxs)(`button`,{className:`is-immediate`,disabled:j,onClick:()=>void it(u(`composer.globalProgressPrompt`)),title:u(`composer.immediate`),type:`button`,children:[(0,H.jsx)(Vm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.globalProgress`)}),(0,H.jsx)(`em`,{className:`personal-prompt-badge`,children:u(`composer.immediate`)})]}),(0,H.jsxs)(`button`,{"aria-label":u(`composer.createGoal`),className:`is-draft`,onClick:qe,title:u(`composer.createGoalHint`),type:`button`,children:[(0,H.jsx)(Fm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.createGoal`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]})]}),ot?(0,H.jsxs)(`div`,{className:`personal-goal-draft-status`,role:`status`,children:[(0,H.jsx)(`strong`,{children:u(`composer.createGoalDraft`)}),(0,H.jsx)(`span`,{children:u(`composer.createGoalDraftDescription`)})]}):null,N.length?(0,H.jsx)(`div`,{className:`personal-composer-images`,"aria-label":u(`composer.imagesPending`),children:N.map(e=>(0,H.jsxs)(`figure`,{children:[(0,H.jsx)(`img`,{alt:e.name,src:e.dataUrl}),(0,H.jsx)(`button`,{"aria-label":u(`composer.sentImageAlt`,{name:e.name}),onClick:()=>P(t=>t.filter(t=>t.id!==e.id)),type:`button`,children:(0,H.jsx)(eh,{size:13})})]},e.id))}):null,F?(0,H.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:F}):null,(0,H.jsxs)(`div`,{className:`personal-channel-composer`,onDragOver:e=>{[...e.dataTransfer.items].some(e=>e.kind===`file`&&e.type.startsWith(`image/`))&&e.preventDefault()},onDrop:e=>{let t=[...e.dataTransfer.files].filter(e=>e.type.startsWith(`image/`));t.length&&(e.preventDefault(),ct(t))},children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:17}),e.find(e=>e.agentId===Ee)?.label??Ee]}),(0,H.jsx)(`button`,{"aria-label":u(`composer.addImage`),className:`personal-composer-attach`,disabled:j||N.length>=Gx,onClick:()=>xe.current?.click(),title:u(`composer.attachImageHint`),type:`button`,children:(0,H.jsx)(Mm,{size:17})}),(0,H.jsx)(`input`,{accept:`image/png,image/jpeg,image/webp,image/gif`,"aria-label":u(`composer.imagePicker`),className:`personal-composer-file-input`,disabled:j||N.length>=Gx,multiple:!0,onChange:e=>void ct(e.target.files),ref:xe,type:`file`}),(0,H.jsx)(`textarea`,{"aria-label":u(`composer.sendMessage`),onChange:e=>Ae(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),it())},onPaste:lt,placeholder:Fe?u(`composer.goalPlaceholder`,{goal:Fe.title}):u(`composer.managerPlaceholder`),ref:ye,rows:1,value:Oe}),(0,H.jsx)(`button`,{"aria-label":u(ot?`composer.createGoal`:`composer.send`),disabled:!Oe.trim()&&N.length===0||j,onClick:()=>void it(),title:u(ot?`composer.createGoalHint`:`composer.sendMessageHint`),type:`button`,children:(0,H.jsx)(Vm,{size:18})})]})]})})]}),sidebar:(0,H.jsx)(Eb,{attentionCount:Ne,goals:Me,goalArchiveLoadState:n,goalLifecycleOperations:t.onExecuteGoalLifecycle?[`stop`,`resume`]:void 0,lifecycleBusyGoalIds:L,onRequestGoalCreate:a?void 0:qe,onRequestGoalLifecycle:a&&!t.onExecuteGoalLifecycle?void 0:(e,t)=>void Je(e,t),onRetryGoalArchive:t.onRetryGoalArchive||t.onRefresh?()=>void(t.onRetryGoalArchive??t.onRefresh)?.():void 0,onOpenSettings:a?void 0:()=>g({kind:`settings`}),onSelectGoal:tt,selectedGoalId:B,statusSourceControl:c},c?.activeSource.statusUrl??`/status.json`)})}function Jx(e){return(e??``).replace(/\s+/gu,` `).trim()}function Yx(e,t=120){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t-1).join(``)}…`}function Xx(e,t,n){let r=Jx(e);return!r||r===`暂无`?n?t(n):``:/refresh-state|latest_run|latest run-derived/iu.test(r)?t(`projection.refreshState`):/first read-only adapter tick|read-only adapter/iu.test(r)?t(`projection.firstReadOnlyAdapterCheck`):/todo update recorded for/iu.test(r)?t(`projection.todoStatusUpdated`):/^(loopx|python3|npm|git|run)\s|\s--[a-z0-9-]+|\b[a-z]+_[a-z_]+\b/iu.test(r)?t(n??`projection.agentPreparingNextStep`):Yx(r)}function Zx(e,t){return t({advancing:`projection.agentAdvancingGoal`,idle:`projection.agentIdle`,needs_you:`projection.agentNeedsDecision`,stopped:`projection.agentStopped`,waiting_external:`projection.agentWaitingExternal`}[e])}function Qx({eventCount:e,hasArtifact:t,hasLatestValidation:n},r){return{label:r(n?`projection.latestValidation`:`projection.latestRun`),metadata:e>0?r(`projection.events24h`,{count:e}):r(t?`projection.runEvidenceAvailable`:`projection.publicSafeProjection`)}}var $x=`/status.json`,eS=`loopx-status-source-catalog-v1`,tS={id:`local`,kind:`local`,label:`本机`,readOnly:!1,statusUrl:$x};function nS(e,t){let n=ah(e,t).source;if(!n||!n.isLoopback||n.isRelative)return{error:`SSH 隧道来源必须使用显式的 localhost、127.0.0.1 或 ::1 URL。`};let r=new URL(n.url,t);return[`http:`,`https:`].includes(r.protocol)?{url:r.toString()}:{error:`状态来源只支持 HTTP 或 HTTPS。`}}function rS(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return`ssh-${(t>>>0).toString(36)}`}function iS(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return null;let n=e;if(n.kind!==`ssh_tunnel`||typeof n.label!=`string`||typeof n.statusUrl!=`string`)return null;let r=n.label.trim(),i=nS(n.statusUrl,t);if(!r||r.length>48||!(`url`in i))return null;let a=gb(n.hostAlias)?n.hostAlias.trim():void 0;return{...a?{hostAlias:a}:{},id:rS(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url}}function aS(){return{schemaVersion:1,sources:[tS]}}function oS(e,t){try{let n=e.getItem(eS);if(!n)return aS();let r=JSON.parse(n);if(r.schemaVersion!==1||!Array.isArray(r.sources))return aS();let i=new Set([tS.statusUrl]);return{schemaVersion:1,sources:[tS,...r.sources.flatMap(e=>{let n=iS(e,t);return!n||i.has(n.statusUrl)?[]:(i.add(n.statusUrl),[n])})]}}catch{return aS()}}function sS(e,t){e.setItem(eS,JSON.stringify({schemaVersion:1,sources:t.sources.filter(e=>e.kind===`ssh_tunnel`)}))}function cS(e,t){let n=new Set(t.filter(gb).map(e=>e.trim())),r=!1,i=e.sources.map(e=>e.kind!==`ssh_tunnel`||e.hostAlias||!n.has(e.label)?e:(r=!0,{...e,hostAlias:e.label}));return r?{...e,sources:i}:e}function lS(e,t,n){let r=t.label.trim();if(!r)return{error:`请填写来源名称。`};if(r.length>48)return{error:`来源名称不能超过 48 个字符。`};let i=nS(t.statusUrl,n);if(!(`url`in i))return i;if(e.sources.some(e=>e.statusUrl===i.url))return{error:`这个状态 URL 已经在来源目录中。`};if(t.hostAlias!==void 0&&!gb(t.hostAlias))return{error:`请选择有效的 SSH Host。`};let a=t.hostAlias?.trim(),o={...a?{hostAlias:a}:{},id:rS(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url};return{catalog:{...e,sources:[...e.sources,o]},source:o}}function uS(e,t){return{...e,sources:e.sources.filter(e=>e.kind===`local`||e.id!==t)}}function dS(e,t,n){if(!t.trim()||ah(t,n).source?.isRelative)return tS;let r=t.trim();try{r=new URL(r,n).toString()}catch{return null}return e.sources.find(e=>e.statusUrl===r)??null}function fS(e,t,n){return dS(e,t,n)||(ah(t,n).source?.isRelative?tS:{id:`temporary`,kind:`ssh_tunnel`,label:`临时来源`,readOnly:!0,statusUrl:t.trim()})}function pS(e,t,n,r){return fS(e,t??n,r)}var mS={delete:`删除`,deploy:`部署`,merge:`合并`,payment:`付款`,release:`发布`};function hS(e,t,n){let r=t.replace(/\s+/gu,` `).trim().toLowerCase(),i=n.target.replace(/\s+/gu,` `).trim().toLowerCase();return!i||!r.includes(i)?null:{actionKind:`goal.update`,context:{goal_id:e,kind:`goal`,natural_language:t,semantic_proposal:{operation:n.operation,target:n.target}},idempotencyKey:`workspace-semantic-protected-${e}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e,status:`operator_gate_requested`},summary:`请求受保护操作:${mS[n.operation]} · ${n.target}`}}var gS=$x;async function _S(e){let t=await fetch(e,{cache:`no-store`,signal:AbortSignal.timeout(3e4)});if(!t.ok)throw Error(`HTTP ${t.status} while loading ${e}`);return Ep(await t.json())}function vS(e,t){if(t?.controller_readiness?.decision_advisor_ready||t?.controller_readiness?.write_controller_ready)return`controller_ready`;if(t?.controller_readiness)return`controller_gated`;if(t?.human_reward)return`reward_judged`;if(t?.operator_gate?.decision===`approve`)return`operator_approved`;if(t?.operator_gate)return`operator_gated`;let n=e||t?.classification||``;return n===`connected_without_run`?`connected`:n===`read_only_project_map`||t?.project_map?`mapped`:n===`state_refreshed`?`refreshed`:n&&n!==`no_status`?`adapter_inspected`:`registered`}function yS(e,t){let n=new Map(t.map(e=>[e.goal_id,e])),r=new Set,i=e.map(e=>{r.add(e.id);let t=n.get(e.id),i=e.latest_runs[0],a=t?.lifecycle_phase??e.lifecycle_phase??i?.lifecycle_phase??vS(t?.status??i?.classification??e.status,i),o=t?.lifecycle_flags?.length?t.lifecycle_flags:e.lifecycle_flags?.length?e.lifecycle_flags:i?.lifecycle_flags?.length?i.lifecycle_flags:[a];return{goal:e,queueItem:t,latestRun:i,status:t?.status??i?.classification??e.status??`no_status`,waitingOn:t?.waiting_on??`clear`,severity:t?.severity??`clear`,lifecyclePhase:a,lifecycleFlags:o}});for(let e of t)r.has(e.goal_id)||i.push({goal:{activation_state:e.activation_state,id:e.goal_id,status:e.status,display_name:e.goal_id,latest_runs:[],lifecycle_flags:[e.lifecycle_phase??`registered`],registry_member:!0,legacy_runtime_goal:!1,index_exists:!1,raw_index_records:0,unique_runs:0},queueItem:e,status:e.status,waitingOn:e.waiting_on,severity:e.severity,lifecyclePhase:e.lifecycle_phase??`registered`,lifecycleFlags:e.lifecycle_flags??[`registered`]});return i}function bS(e){return(e??``).replace(/\s+/g,` `).trim()}function xS(e,t=132){let n=bS(e);return n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}…`}function SS(e){let t=new Map;for(let n of e?.goals??[])t.set(n.goal_id,n);return t}function CS(e,t){return e===void 0||t===void 0?void 0:e+t}function wS(e,t){if(!e)return null;let n=t===`user`?e.queueItem?.project_asset?.user_todos:e.queueItem?.project_asset?.agent_todos;if(n?.items?.length)return{done_count:n.done??n.items.filter(e=>e.done).length,items:n.items,open_count:n.open??n.items.filter(e=>!e.done).length,total_count:n.total??n.items.length};let r=t===`user`?e.queueItem?.user_todos:e.queueItem?.agent_todos;return r?.items?.length?r:null}function TS(e){return e?.items.find(e=>!e.done)}function ES(e,t,n=`todos`){return e?.items?.length?{advancement_done_count:e.advancement_done_count??t?.advancement_done_count,done_count:e.done??e.items.filter(e=>e.done).length,items:e.items,open_count:e.open??e.items.filter(e=>!e.done).length,total_count:e.total??e.items.length}:t??null}function DS(e){return e?.queueItem?.project_asset?.quota?.state??e?.queueItem?.quota?.state??e?.goal.quota?.state??`waiting`}function OS(e,t,n){let r=[];for(let t of e){let e=wS(t,`agent`);for(let n of e?.items??[])r.push({goalId:t.goal.id,role:`agent`,todo:n})}let i=new Map;for(let e of r){let t=e.todo.claimed_by||`codex`,n=i.get(t)??[];n.push(e),i.set(t,n)}let a=new Map((n?.agents??[]).map(e=>[e.agent_id,e]));return Array.from(new Set([...i.keys(),...a.keys()])).map(e=>{let t=i.get(e)??[],n=a.get(e),r=Array.from(new Set([...t.map(e=>e.goalId),n?.current_todo?.goal_id,...n?.goal_ids??[]].filter(Boolean))),o=(t.filter(e=>!e.todo.done)[0]??t[0])?.goalId??n?.current_todo?.goal_id??r[0]??``,s=n?.last_activity_at??null;return{agentId:e,claimedTodos:t,currentTodo:n?.current_todo??null,evidenceRefs:[],goalIds:r,handoffNote:null,lastActivity:s,nextSafeAction:n?.next_action?.trim()||`Inspect status projection before taking work`,primaryGoalId:o,quotaHints:[],staleClaimHint:null,status:{label:`可用`,summary:`正常运行`,variant:`success`},workspaceRef:null}})}function kS(e){return e?.map(e=>({dataUrl:e.data_url,id:e.id,mimeType:e.mime_type,name:e.name,size:e.size}))}var AS=`loopx.personal-agent-selection.v1`;function jS(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(AS)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[0]==`string`&&typeof e[1]==`string`))}catch{return{}}}var MS={需修复:`danger`,等你:`warning`,等待条件:`info`,推进中:`success`,安静运行:`neutral`,已停止:`neutral`,已完成:`neutral`};function NS(e,t){return bS(t)||e.replace(/^loopx[-_]/i,`LoopX `).split(/[-_]+/).filter(Boolean).map((e,t)=>t===0?`${e.slice(0,1).toUpperCase()}${e.slice(1)}`:e).join(` `)}function PS(e){return e.split(/\r?\n/u).filter(e=>!/^\s*GOAL_(STATUS|PROGRESS)\s*:/u.test(e)).map(e=>/^\s*GOAL_EVIDENCE\s*:/u.test(e)?e.replace(/^\s*GOAL_EVIDENCE\s*:/u,`验证依据:`):/^\s*NEXT_ACTION\s*:/u.test(e)?e.replace(/^\s*NEXT_ACTION\s*:/u,`下一步:`):e).join(` +`).trim()}function FS(e,t){return[`agent`,`assistant`].includes(e.trim().toLowerCase())&&t.trim().length>0}var IS=`已发现的项目 Agent`;function LS(e){switch(ly(e)){case`codex`:return`Codex`;case`claude`:return`Claude Code`;case`kiro`:return`Kiro CLI`;case`trae`:return`Trae CLI Agent`;case`coco`:return`Coco Agent`;default:return NS(e)}}function RS(e,t){switch(uy(e,t)){case`codex`:return`代码与项目执行`;case`claude`:return`复杂分析与长任务`;case`openai`:case`anthropic`:return`管家问答 · 无工具`;case`kiro`:return`终端编码 · 原生 /goal 循环`;case`trae`:return`前端与交互实现`;case`coco`:return`通用任务`;default:return IS}}function zS(e,t){let n=e.project_asset;return t===`user`?ES(n?.user_todos,e.user_todos,`project_asset.user_todos`):ES(n?.agent_todos,e.agent_todos,`project_asset.agent_todos`)}function BS(e){return xS(e.title??e.text,112)}function VS(e){let t=e.resume_condition?.resume_receipt;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.receipt_id;return typeof n==`string`&&n.trim()?n.trim():null}function HS(e,t){return{resumeWhen:e.resume_when??null,resumeReady:e.resume_ready??null,resumeReceiptId:VS(e),claimedBy:e.claimed_by??null,done:e.status!==`deferred`&&e.done,evidence:e.evidence?xS(e.evidence,96):null,index:e.index,priority:e.priority??null,status:e.status??null,taskClass:e.task_class??null,taskDomain:e.task_domain??null,text:BS(e),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.index}`}}function US(e){let t=e.queueItem?.agent_todos,n=t?.items??e.queueItem?.project_asset?.agent_todos?.items??[],r=new Map(n.map(t=>[t.todo_id?.trim()||`${e.goal.id}:agent:${t.index}`,t]));for(let n of t?.deferred_items??[]){let t=n.todo_id?.trim()||`${e.goal.id}:agent:${n.index}`;r.has(t)||r.set(t,n)}return[...r.values()]}function WS(e){return US(e).map(t=>HS(t,e))}function GS(e,t,n){let r=new Map;for(let n of e.todo_index?.items??[]){if(n.goal_id!==t.goal.id||n.role!==`agent`)continue;let e=HS(n,t);r.set(e.todoId,e)}for(let e of n)r.has(e.todoId)||r.set(e.todoId,e);let i=new Map;for(let e of r.values()){if(e.done||e.taskClass!==`advancement_task`)continue;let t=e.taskDomain?.trim();t&&i.set(t,(i.get(t)??0)+1)}return[...i].map(([e,t])=>({domain:e,matchingTodoCount:t}))}function KS(e,t){return{claimedBy:e.claimed_by??null,done:e.status===`done`||e.status===`completed`,index:-1,priority:e.priority??null,status:e.status??null,taskClass:e.task_class??null,text:xS(e.title,112),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.claimed_by??`unknown`}:current`}}function qS(e,t,n){let r=new Map(e.map(e=>[e.todoId,e]));for(let e of t){let t=e.currentTodo;if(!t||t.goal_id!==n.goal.id)continue;let i=KS(t,n);r.has(i.todoId)||r.set(i.todoId,i)}return[...r.values()]}function JS(e){let t=e.queueItem?.project_asset?.agent_todos,n=e.queueItem?.agent_todos,r=US(e),i=t?.advancement_done_count??n?.advancement_done_count??t?.done??n?.done_count??null,a=r.filter(e=>e.done&&e.status!==`deferred`).length,o=Math.max(i??0,a),s=new Set(r.map(e=>e.todo_id?.trim()).filter(e=>!!e)),c=(t?.recent_completed_advancement_items??[]).filter(e=>!e.todo_id?.trim()||!s.has(e.todo_id.trim())).map(t=>HS(t,e)),l=r.find(e=>!e.done);return{doneTodoCount:o,nextTodoText:bS(t?.next??``)||(l?bS(l.title??``)||bS(l.text??``):``)||null,recentCompleted:c}}function YS(e,t){let n=bS(e);return n?/\b(state_file|registry_goal|authority_sources|source_registry)\b|\b[a-z_]+\s+\d+\/\d+/i.test(n)?t(`projection.goalVerified`):Xx(n,t,`projection.validationRecorded`):``}function XS(e,t=4){if(e.length<=t)return e;let n=e.findIndex(e=>!e.done);if(n<0)return e.slice(-t);let r=Math.max(0,Math.min(n-2,e.length-t));return e.slice(r,r+t)}function ZS(e,t,n){let r=t.queueItem?.project_asset?.latest_validation,i=t.latestRun,a=e.event_ledger_summary?.goals.find(e=>e.goal_id===t.goal.id);if(!r&&!i&&!a)return null;let o=[YS(r?.summary,n),Xx(i?.health_check,n),Xx(i?.recommended_action,n)].find(e=>e!==``&&e!==`暂无`)??n(`projection.runRecorded`),s=Qx({eventCount:a?.events_24h??0,hasArtifact:!!(i?.json_exists||i?.markdown_exists),hasLatestValidation:!!r},n);return{generatedAt:r?.generated_at??i?.generated_at??a?.latest_event_at??``,label:s.label,metadata:s.metadata,runId:i?`${t.goal.id}:${i.generated_at}`:null,safePreview:[o,s.metadata].filter(Boolean).join(` +`),summary:o,todoId:t.queueItem?.project_asset?.agent_todos?.items.find(e=>!e.done)?.todo_id??null}}function QS(e){return[e.status,e.goal.status,e.latestRun?.classification,e.lifecyclePhase].filter(Boolean).some(e=>/(^|[_\s-])(done|complete|completed|finished|terminal|closed|success)([_\s-]|$)/i.test(e??``))}function $S(e,t){return e.global_registry?.findings?.find(e=>e.severity===`high`&&(e.goal_id===t.goal.id||e.goal_ids.includes(t.goal.id)))}function eC(e){return[e.status,e.goal.status,e.latestRun?.classification,e.lifecyclePhase].filter(Boolean).some(e=>/(^|[_\s-])(failure|failed|error|broken|unhealthy|blocked[_\s-]?health|health[_\s-]?blocked)([_\s-]|$)/i.test(e??``))}function tC(e,t){let n=t.queueItem?.stale_latest_run_warning;return t.severity===`high`||!!$S(e,t)||!!(n?.requires_refresh_state||n?.severity===`high`)||eC(t)}function nC(e,t){let n=$S(e,t);return t.queueItem?.stale_latest_run_warning?.recommended_action??t.queueItem?.stale_latest_run_warning?.reason??n?.recommended_action??n?.message??t.queueItem?.recommended_action??t.latestRun?.recommended_action??null}function rC(e){let t=e.latestRun?.operator_gate,n=t?.decision?.trim().toLowerCase()??``,r=new Set([`approve`,`approved`,`reject`,`rejected`,`defer`,`deferred`,`cancel`,`cancelled`]),i=[e.queueItem?.recommended_action,e.latestRun?.recommended_action].filter(Boolean).join(` `),a=/(?:等待|需要)(?:用户|你|owner).{0,24}(?:批准|确认|授权|补充|选择|决定)|(?:批准|确认|授权).{0,16}(?:后|才能|方可)/i.test(i);return!!(t&&!r.has(n))||e.lifecyclePhase===`operator_gated`&&!r.has(n)||a}function iC(e,t){let n=e.latestRun?.operator_gate;return Xx(n?.operator_question??n?.reason_summary??n?.follow_up??e.queueItem?.recommended_action??e.latestRun?.recommended_action,t,`projection.confirmAgentDecision`)}function aC(e,t){if(t.goal.activation_state===`stopped`)return`已停止`;let n=wS(t,`user`),r=wS(t,`agent`),i=!!TS(n),a=!!TS(r);return[`user_or_controller`,`controller`].includes(t.waitingOn)||i||rC(t)?`等你`:tC(e,t)?`需修复`:t.waitingOn===`external_evidence`?`等待条件`:DS(t)===`eligible`||a?`推进中`:QS(t)?`已完成`:`安静运行`}function oC(e,t,n,r){if(n===`已停止`)return Zx(`stopped`,r);if(n===`需修复`)return Xx(nC(e,t),r,`projection.statusRefreshNeeded`);if(n===`等你`)return Zx(`needs_you`,r);if(n===`推进中`){let e=[(wS(t,`agent`)?.items??[]).filter(e=>!e.done).flatMap(e=>[e.title,e.text]).map(e=>bS(e)).find(e=>e!==``&&e!==`暂无`),t.queueItem?.recommended_action,t.latestRun?.recommended_action].map(e=>bS(e)).find(e=>e!==``&&e!==`暂无`);return e?Xx(e,r,`projection.agentAdvancingGoal`):Zx(`advancing`,r)}return Zx(n===`等待条件`?`waiting_external`:`idle`,r)}function sC(e,t){return t.some(t=>e.includes(t))}function cC(e,t,n){if(t.goals.some(e=>e.activationState===`active`&&e.loadState))return{text:`Goal 状态尚未全部加载,暂不能给出完整统计。可先打开已加载的 Goal,失败项可重试。`,lines:[]};if(sC(n,[`Agent`,`agent`,`推进`,`在做`])){let e=t.goals.filter(e=>![`安静运行`,`已完成`,`已停止`].includes(e.state)),n=(e.length>0?e:t.goals).slice(0,3);return n.length===0?{text:`当前状态里还没有 Goal 可供汇总。`,lines:[]}:{text:e.length>0?`Agent 当前关注这些 Goal:`:`当前 Goal 都比较安静:`,lines:n.map(e=>`${e.title} · ${e.state} · ${e.agentSentence}`)}}if(sC(n,[`现在`,`下一步`,`我该`,`该做什么`,`优先处理`])){let e=t.userTodos[0];if(e)return{text:e.blocking?`先处理「${NS(e.goalId)}」:${e.text}`:`当前最先处理「${NS(e.goalId)}」:${e.text}`,lines:[]};let n=t.goals.find(e=>e.state===`需修复`);if(n)return{text:`没有待办,但这个 Goal 需要先修复。`,lines:[`${n.title} · ${n.agentSentence}`]};let r=t.goals.find(e=>e.state===`推进中`);return r?{text:`目前不需要你介入,Agent 正在推进。`,lines:[`${r.title} · ${r.agentSentence}`]}:{text:`当前系统很安静,没有需要你立即处理的事项。`,lines:[]}}if(sC(n,[`等我`,`阻塞`,`需要我`,`全局待办`]))return t.userTodos.length===0?{text:`目前没有 Goal 在等你,开放用户待办为 0。`,lines:[]}:{text:`有 ${t.userTodos.length} 项开放用户待办,阻塞项优先:`,lines:t.userTodos.slice(0,3).map(e=>`${NS(e.goalId)} · ${e.blocking?`阻塞`:`待处理`} · ${e.text}`)};if(sC(n,[`状态`,`异常`,`修复`,`健康`])){let n=t.systemHealth?!t.systemHealth.ok:!e.ok||!e.contract?.ok||!e.global_registry?.ok||(e.global_registry?.summary?.high??0)>0,r=t.goals.filter(e=>e.state===`需修复`),i=r.slice(0,n?2:3).map(e=>`${e.title} · ${e.agentSentence}`);return n&&i.push(`全局状态、契约或注册表健康检查未通过,请进入管理页检查。`),i.length===0?{text:`当前没有发现 Goal 级或全局健康异常。`,lines:[]}:{text:r.length>0?`当前需要关注这些健康问题:`:`Goal 状态正常,但全局健康需要检查:`,lines:i}}return{text:`当前管家支持三类问题:下一步、等待你的事项、Agent 与健康状态。`,lines:[`问“我现在该做什么?”`,`问“哪些 Goal 在等我?”`,`问“Agent 在做什么?”或当前健康状态`]}}function lC(e,t,n,r=!1){let i=new Map(t.map(e=>[e.goal.id,e])),a=new Set(e.run_history.goals.filter(e=>e.activation_state===`stopped`).map(e=>e.id)),o=SS(e.usage_summary),s=OS(t,e.todo_index,e.agent_management_projection),c=e.attention_queue.items.flatMap((e,t)=>{if(a.has(e.goal_id))return[];let n=[`user_or_controller`,`controller`].includes(e.waiting_on);return(zS(e,`user`)?.items??[]).map((r,i)=>({projectedDone:r.done,details:Ud(r),actionKind:r.action_kind??null,blocking:n,goalId:e.goal_id,sourceOrder:t,taskClass:r.task_class??null,text:BS(r),todoId:r.todo_id?.trim()||`${e.goal_id}:user:${r.index}`,todoOrder:i,updatedAt:r.updated_at??null}))}),l=c.filter(e=>!e.projectedDone),u=new Set(l.map(e=>e.goalId)),d=t.flatMap((t,r)=>a.has(t.goal.id)||u.has(t.goal.id)||!rC(t)?[]:[{details:Ud({task_class:`user_gate`,status:`open`,note:t.latestRun?.operator_gate?.reason_summary}),actionKind:`gate.resolve`,blocking:!0,goalId:t.goal.id,sourceOrder:e.attention_queue.items.length+r,taskClass:`user_gate`,text:iC(t,n),todoId:`${t.goal.id}:operator-gate`,todoOrder:0,updatedAt:t.latestRun?.operator_gate?.recorded_at??t.latestRun?.generated_at??null}]),f=[...l,...d].sort((e,t)=>Number(t.blocking)-Number(e.blocking)||e.sourceOrder-t.sourceOrder||e.todoOrder-t.todoOrder),p=e.run_history.goals.flatMap(t=>{if(t.registry_member===!1)return[];let a=i.get(t.id);if(!a)return[];let c=aC(e,a),l=f.find(e=>e.goalId===t.id),u=l?.text??null,d=JS(a),p=t.coordination?.registered_agents??[],m=new Set(p),h=[...s.filter(e=>e.goalIds.includes(t.id)&&!/unassigned|unknown/i.test(e.agentId)&&(m.size===0||m.has(e.agentId))&&(e.currentTodo?.goal_id===t.id||e.claimedTodos.some(e=>e.goalId===t.id)))].sort((e,t)=>(t.lastActivity??``).localeCompare(e.lastActivity??``)),g=new Set(h.map(e=>e.agentId)),_=[...h.map(e=>({agentId:e.agentId,label:e.agentId,lastActivityAt:e.lastActivity,state:e.status.label})),...p.filter(e=>!g.has(e)).map(e=>({agentId:e,label:e,lastActivityAt:null,state:`registered`}))],v=h[0],y=qS(WS(a),h,a),b=[d.nextTodoText,a.queueItem?.recommended_action,a.latestRun?.recommended_action,oC(e,a,c,n)].map(e=>Xx(e,n)).find(e=>e!==``&&e!==`暂无`)??n(`projection.nextUpdatePending`);return[{activationState:t.activation_state,agentId:v?.agentId??p[0]??`codex`,agentLaneCount:_.length,agentLanes:_,agentLabel:v?.agentId,agentSentence:oC(e,a,c,n),agentTodos:[...y,...d.recentCompleted],doneTodoCount:d.doneTodoCount,acceptanceObservation:t.acceptance_observation,goalId:t.id,latestActivity:a.latestRun?.generated_at??``,needsYou:u,needsYouActionKind:l?.actionKind??null,needsYouBlocking:l?.blocking??!1,needsYouTaskClass:l?.taskClass??null,needsYouTodoId:l?.todoId??null,nextSentence:b,runEvidence:ZS(e,a,n),state:c,...r?{subagentExecution:{allowedDomains:t.spawn_policy?.allowed_domains??[],domainCandidates:GS(e,a,y),enabled:t.spawn_policy?.mode===`multi_subagent`&&t.spawn_policy.spawn_allowed===!0&&t.spawn_policy.max_children>0,maxChildren:t.spawn_policy?.max_children??0,modelConfig:t.spawn_policy?.model_config}}:{},title:NS(t.id,t.display_name),usage:(()=>{let e=o.get(t.id);return e?{costUsd24h:e.cost_usd_24h,costUsd7d:e.cost_usd_7d,durationMs24h:e.duration_ms_24h,durationMs7d:e.duration_ms_7d,tokens24h:CS(e.input_tokens_24h,e.output_tokens_24h),tokens7d:CS(e.input_tokens_7d,e.output_tokens_7d)}:null})()}]}),m=[];if(e.ok||m.push(`状态载荷未标记为正常 (payload.ok === false)`),e.contract&&!e.contract.ok){let t=e.contract.summary,n=t?`${t.errors} 项错误 / ${t.warnings} 项警告`:e.contract.errors?.[0]||`请检查控制面契约`;m.push(`契约检查未通过: ${n}`)}if(e.global_registry){e.global_registry.ok||m.push(`注册表状态异常: ${e.global_registry.summary.high} 项高危`);for(let t of e.global_registry.findings||[])t.severity===`high`&&m.push(`[${t.kind}] ${t.message}`)}let h=e.decision_freshness_summary?.summary?.stale_count?`${e.decision_freshness_summary.summary.stale_count} 项决策状态已过期`:null,g=m.length===0&&!h,_={ok:g,summary:g?`所有控制面契约与注册表检查均正常`:`发现 ${m.length+ +!!h} 项系统健康关注点`,issues:m,freshnessWarning:h};return{blockingTodoCount:f.filter(e=>e.blocking).length,goalNotifications:(e.goal_channel_notification_projection?.goals??[]).map(e=>({goalId:e.goal_id,configured:e.configured,enabled:e.enabled,humanGateAutoNotifyEnabled:e.human_gate_auto_notify_enabled,lastNotifiedAt:e.last_notified_at??null,receiptCount:e.receipt_count,targetRef:e.target_ref??null})),goals:p,openUserTodoCount:f.length,systemHealth:_,attentionHistory:[...c,...d],userTodos:f,visibleUserTodos:f.slice(0,5),workers:(e.agent_management_projection?.agents??[]).map(e=>({agentId:e.agent_id,currentTodoGoalId:e.current_todo?.goal_id??null,currentTodoText:e.current_todo?.title?xS(e.current_todo.title,96):null,lastActivityAt:e.last_activity_at??null,state:e.state??null}))}}function uC({goalArchiveLoadState:e,isLoading:t,onGoalActivationStateChange:n,onGoalDeleted:r,onSelectGoal:i,onReconcileStatus:a,onRefresh:o,onRetryGoalArchive:s,payload:c,progress:l,rows:u,selectedGoalId:d,statusSourceControl:f,theme:p,toggleTheme:m}){let h=f.activeSource.readOnly,g=f.activeSource.kind===`ssh_tunnel`?f.activeSource.hostAlias:void 0,{t:_}=qi(),[v,y]=(0,V.useState)([]),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(null),w=(0,V.useMemo)(()=>{let e=lC(c,u,_,b);if(!l)return e;let t=Object.values(l.snapshots).map(e=>lC(e,yS(e.run_history.goals,e.attention_queue.items),_,b)),n=new Map(t.flatMap(e=>e.goals).map(e=>[e.goalId,e])),r=e.goals.map(e=>n.get(e.goalId)??{...e,loadError:l.errors[e.goalId],loadState:l.errors[e.goalId]?`error`:`loading`,agentId:``,agentSentence:``,nextSentence:``,subagentExecution:void 0}),i=t.flatMap(e=>e.userTodos),a=r.some(e=>e.activationState===`active`&&e.loadState),o=[...new Set(t.flatMap(e=>e.systemHealth?.issues??[]))];return{...e,goals:r,userTodos:i,attentionHistory:t.flatMap(e=>e.attentionHistory??e.userTodos),visibleUserTodos:i.slice(0,5),openUserTodoCount:i.length,blockingTodoCount:i.filter(e=>e.blocking).length,workers:[...new Map(t.flatMap(e=>e.workers??[]).map(e=>[e.agentId,e])).values()],goalNotifications:t.flatMap(e=>e.goalNotifications??[]),systemHealth:a||t.length===0?void 0:{ok:t.every(e=>e.systemHealth?.ok),issues:o,summary:o.length?`发现 ${o.length} 项系统健康关注点`:`状态检查已完成`,freshnessWarning:t.map(e=>e.systemHealth?.freshnessWarning).filter(Boolean).join(`;`)||null}}},[c,u,l,b,_]),T=w.goals.find(e=>e.goalId===d)??null,E=l?.snapshots[d]??c,[D,O]=(0,V.useState)(null),[k,ee]=(0,V.useState)(null),[te,A]=(0,V.useState)(!1),j=w.goals.some(e=>e.activationState===`active`&&e.loadState===`loading`)?`loading`:w.goals.map(e=>`${e.goalId}:${e.agentId}`).join(`|`),M=T?.goalId??`manager`;w.goals.some(e=>e.activationState===`active`&&e.loadState)||(w.systemHealth?!w.systemHealth.ok:!c.ok)||w.openUserTodoCount>0&&`${w.openUserTodoCount}${w.blockingTodoCount}`;let N=v.length>0?v.map(e=>({agentId:e.agent_id,adapterKind:e.adapter_kind,available:e.available,capability:RS(e.agent_id,e.adapter_kind),interrupt:e.interrupt,label:e.display_name,location:e.location,resume:e.resume,source:e.source,statusLabel:e.available?`可用`:`需要配置`,streaming:e.streaming,toolCalls:e.tool_calls,trustScope:e.trust_scope})):[{agentId:`codex`,available:!0,capability:RS(`codex`),label:`Codex`,statusLabel:`正在检测`}],P=[...N,{agentId:`status-only`,available:!0,capability:`不调用模型`,adapterKind:`status_projection`,interrupt:!1,label:`仅查状态`,resume:!0,statusLabel:`只读`,streaming:!1,toolCalls:!1,trustScope:`read_only`}],F=N.find(e=>e.label===`Codex`&&e.available)?.agentId??N.find(e=>e.available)?.agentId??`status-only`,[ne,re]=(0,V.useState)(jS),I=dh(P,ne[M]??F,F),[L,ie]=(0,V.useState)(!1),[R,ae]=(0,V.useState)(!1),[oe,se]=(0,V.useState)(`chat`),[ce,le]=(0,V.useState)(``),[ue,z]=(0,V.useState)({}),[de,fe]=(0,V.useState)({}),[pe,me]=(0,V.useState)(null),[he,ge]=(0,V.useState)({}),[_e,ve]=(0,V.useState)([]),[ye,be]=(0,V.useState)(null),[xe,Se]=(0,V.useState)({}),Ce=(0,V.useRef)(1),we=(0,V.useRef)(1),Te=(0,V.useRef)(new Map),B=(0,V.useRef)(new Set),Ee=(0,V.useRef)(new Map),De=(0,V.useRef)(new Map),Oe=(0,V.useRef)(new Set),ke=(0,V.useRef)(new Set),Ae=(0,V.useRef)(null),je=(0,V.useRef)(null),Me=(0,V.useRef)(null),Ne=(0,V.useRef)(null);(0,V.useRef)(null);let Pe=ue[M]??[];de[M];let Fe=T?w.userTodos.filter(e=>e.goalId===T.goalId):w.userTodos,Ie=T?.agentTodos??[];XS(Ie,T?.needsYou?3:4);let Le=Ie.filter(e=>e.done).length,Re=Ie.length>0?`${Le}/${Ie.length}`:`暂无计划`;T&&({...w},Fe.filter(e=>e.blocking).length,Fe.length),(0,V.useEffect)(()=>{let e=ih(f.activeSource.statusUrl,window.location.href),t=e.source?ch(E,e.source):null;if(!T||!t?.indexUrl||!t.detailUrl){O(null),ee(null),A(!1);return}let{detailUrl:n,indexUrl:r}=t,i=!1;return O(null),ee(null),A(!0),lh(r,T.goalId).then(async e=>{let t=e.items[0]?.detail_ref;return t?uh(n,t):null}).then(e=>{i||O(e)}).catch(e=>{i||ee(Dp(e))}).finally(()=>{i||A(!1)}),()=>{i=!0}},[E,T?.goalId,f.activeSource.statusUrl]);let ze=T?void 0:he[M]?.sessionId;(0,V.useEffect)(()=>{if(h||!ze)return;let e=!1,t,n=async()=>{try{let t=await Vh(ze);if(e)return;let n=t.messages.filter(e=>e.origin===`manager_followup`);z(e=>{let t=e[M]??[],r=new Set(t.map(e=>e.sourceMessageId)),i=n.filter(e=>!r.has(e.message_id)),a=new Map(n.map(e=>[e.message_id,e.return_delivery])),o=!1,s=t.map(e=>{let t=e.sourceMessageId?a.get(e.sourceMessageId):void 0;return JSON.stringify(t)===JSON.stringify(e.returnDelivery)?e:(o=!0,{...e,returnDelivery:t})});return!i.length&&!o?e:{...e,[M]:[...s,...i.map(e=>({id:Ce.current++,sourceMessageId:e.message_id,role:`assistant`,agentLabel:I.label,sourceLabel:`管家交接回执`,text:PS(e.text),lines:[],returnDelivery:e.return_delivery}))]}})}catch{}finally{e||(t=setTimeout(n,3e3))}};return n(),()=>{e=!0,t&&clearTimeout(t)}},[h,ze,M,I.label]);function Be(e,t){ge(n=>{if(t===null){let t={...n};return delete t[e],t}return{...n,[e]:t}})}(0,V.useEffect)(()=>{if(h){y([]),x(!1),C(null);return}let e=!1;return Rh().then(t=>{if(!e){y(t.adapters??[]);let e=t.manager?.runtime;C(e?{schema_version:`manager_runtime_session_readback_v0`,runtime_profile:e.runtime_profile,configuration_revision:e.configuration_revision,status:e.status,sandbox:e.sandbox,standing_grant:e.standing_grant,tool_classes:e.tool_classes}:null),x(t.goal_subagent_configuration===`preview_locked`)}}).catch(()=>{e||x(!1)}),()=>{e=!0}},[h]),(0,V.useEffect)(()=>{try{window.localStorage.setItem(AS,JSON.stringify(ne))}catch{}},[ne]),(0,V.useEffect)(()=>{if(h||!I.available)return;let e=M,t=`${e}:${I.agentId}`,n=T?`goal`:`manager`,r=T?`goal.${T.goalId}`:`manager`,i=!1,a=null,o=null;return(async()=>{try{let s=await Wh({agentId:I.agentId,channelId:r,goalId:T?.goalId});if(i||(z(t=>(t[e]?.length??0)>0?t:{...t,[e]:s.messages.map(e=>({sourceMessageId:e.message_id,agentLabel:e.role===`user`?void 0:I.label,attachments:kS(e.attachments),id:Ce.current++,lines:[],role:e.role===`user`?`user`:`assistant`,returnDelivery:e.return_delivery,sourceLabel:e.role===`user`?void 0:e.role===`error`?`本地会话记录`:`恢复的 ${I.label} 会话`,text:e.role===`user`?e.text:PS(e.text)}))}),I.agentId===`status-only`))return;let c=s.sessions[0];if(o=c?.session_id??null,c&&!c.resumable){B.current.add(t),Be(e,{agentId:I.agentId,resumable:!1,sessionId:c.session_id,status:`resume_failed`});return}let l=n===`manager`?``:T?.goalId??``;if(n===`goal`&&!l)return;let u=await Bh(l,I.agentId,`resume_latest`,n);if(i)return;n===`manager`&&u.session.manager_runtime&&C(u.session.manager_runtime),Te.current.set(t,u.session_id);let d=s.snapshots.find(e=>e.session.session_id===u.session_id),f=d?.session.active_turn_id??``;if(Be(e,{agentId:I.agentId,resumable:!0,sessionId:u.session_id,status:f?`running`:`ready`,turnId:f||void 0}),B.current.delete(t),!f)return;let p=`${u.session_id}:${f}`;if(ke.current.has(p))return;ke.current.add(p),Ee.current.set(e,f),Be(e,{agentId:I.agentId,resumable:!0,sessionId:u.session_id,status:`running`,turnId:f}),me(e),a=new AbortController,De.current.set(e,a);let m=``,h=Ve(e,{activity:[`正在恢复进行中的 Agent 回合`],agentLabel:I.label,lines:[],pending:!0,sourceLabel:`恢复的 ${I.label} 会话`,text:``});try{let t=await Zh(u.session_id,f,{signal:a.signal,onDelta:t=>{m+=t,He(e,h,{text:m})},onActivity:t=>{z(n=>({...n,[e]:(n[e]??[]).map(e=>e.id===h?{...e,activity:[...new Set([...e.activity??[],t])].slice(-6)}:e)}))}});if(i)return;He(e,h,{lines:t.response.gate?[t.response.gate.summary,t.response.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:t.response.message||m.trim()||`${I.label} 已完成分析。`});let n=w.goals.find(e=>e.goalId===d?.session.goal_id)??T??w.goals[0]??null;if(n&&t.response.proposals.length>0){let r=t.response.proposals.map(e=>({goalId:n.goalId,id:we.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));fe(t=>({...t,[e]:[...t[e]??[],...r]}))}}catch(t){if(i)return;He(e,h,{activity:[],lines:[],pending:!1,reconnect:t instanceof Eh&&t.payload.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t instanceof Error?t.message:`无法恢复进行中的 Agent 回合。`})}finally{ke.current.delete(p),Ee.current.get(e)===f&&Ee.current.delete(e),Be(e,{agentId:I.agentId,resumable:!0,sessionId:u.session_id,status:`ready`}),De.current.get(e)===a&&De.current.delete(e),i||me(t=>t===e?null:t)}}catch(n){if(i)return;n instanceof Eh&&n.payload.error_code===`resume_failed`&&(B.current.add(t),o&&Be(e,{agentId:I.agentId,resumable:!1,sessionId:o,status:`resume_failed`}))}})(),()=>{i=!0,a?.abort()}},[M,w.goals[0]?.goalId,h,T?.goalId,I.agentId,I.available,I.label]),(0,V.useEffect)(()=>{if(h||T||w.goals.length===0||j===`loading`)return;let e=!1;return Promise.all(w.goals.filter(e=>!e.loadState).map(async e=>{let t=await Hh({agentId:e.agentId,channelId:`goal.${e.goalId}`,goalId:e.goalId});return{goalId:e.goalId,session:t.sessions[0]??null}})).then(t=>{e||ge(e=>{let n={...e};for(let e of t)e.session&&(n[e.goalId]={agentId:e.session.agent_id,resumable:e.session.resumable,sessionId:e.session.session_id,status:e.session.active_turn_id?`running`:e.session.status,turnId:e.session.active_turn_id??void 0});return n})}).catch(()=>{}),()=>{e=!0}},[h,j,T?.goalId]),(0,V.useEffect)(()=>{if(be(null),h){ve([]),Se({});return}if(!T){ve([]),Se({});return}let e=!1,t=0,n=0;ve([]),Se({});let r=async()=>{if(!e){if(document.hidden){t=window.setTimeout(()=>void r(),1e4);return}try{let t=await Hh({goalId:T.goalId});if(!e){let r=t.sessions.filter(e=>e.channel_id?.startsWith(`task.`));ve(r);let i=await Promise.allSettled(r.map(e=>Vh(e.session_id)));if(!e){let e=i.some(e=>e.status===`rejected`);n=e?n+1:0,be(e?`partial`:null),Se(Object.fromEntries(i.flatMap((e,t)=>e.status===`fulfilled`?[[r[t].session_id,e.value]]:[])))}}}catch{n+=1,e||be(`offline`)}e||(t=window.setTimeout(()=>void r(),Math.min(3e4,2e3*2**Math.min(n,4))))}};return r(),()=>{e=!0,window.clearTimeout(t)}},[h,T?.goalId]),(0,V.useEffect)(()=>{if(!L)return;let e=window.requestAnimationFrame(()=>{Ae.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()});return()=>{window.cancelAnimationFrame(e),je.current?.focus()}},[L]),(0,V.useEffect)(()=>{if(!R)return;let e=window.requestAnimationFrame(()=>Me.current?.focus());return()=>{window.cancelAnimationFrame(e),Ne.current?.focus()}},[R]),(0,V.useEffect)(()=>{if(!L&&!R)return;let e=e=>{e.key===`Escape`&&(ie(!1),ae(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[L,R]);function Ve(e,t){let n=Ce.current++;return z(r=>({...r,[e]:[...r[e]??[],{...t,id:n,role:`assistant`}]})),n}function He(e,t,n){z(r=>({...r,[e]:(r[e]??[]).map(e=>e.id===t?{...e,...n}:e)}))}async function Ue(e,t){let n=e.trim();if(!n)return;let r=t&&`goalId`in t?t.goalId??`manager`:M,i=r===`manager`?null:w.goals.find(e=>e.goalId===r)??null,a=t?.agentId?dh(P,t.agentId,F):I,o=r===`manager`?w:i?{...w,blockingTodoCount:w.userTodos.filter(e=>e.goalId===i.goalId&&e.blocking).length,goals:[i],openUserTodoCount:w.userTodos.filter(e=>e.goalId===i.goalId).length,userTodos:w.userTodos.filter(e=>e.goalId===i.goalId),visibleUserTodos:w.userTodos.filter(e=>e.goalId===i.goalId)}:w,s=Ce.current++;if(z(e=>({...e,[r]:[...e[r]??[],{attachments:t?.attachments,id:s,lines:[],role:`user`,text:n}]})),le(``),me(r),a.agentId===`status-only`||!i&&r!==`manager`){let e=cC(E,o,n),t=a.agentId===`status-only`;Ve(r,{agentLabel:t?`仅查状态`:`LoopX 管家`,lines:e.lines.slice(0,3),sourceLabel:t?`LoopX 状态投影 · 仅查状态`:`LoopX 状态投影`,text:e.text}),zh({answer:[e.text,...e.lines.slice(0,3)].filter(Boolean).join(` +`),contextKind:r===`manager`?`manager`:`goal`,goalId:r===`manager`?void 0:r,question:n}).catch(()=>{}),me(null);return}let c=`${r}:${a.agentId}`,l=null;try{let e=Te.current.get(c);if(!e){let t=B.current.has(c)?`new`:`resume_latest`,n=await Bh(r===`manager`?``:i.goalId,a.agentId,t,r===`manager`?`manager`:`goal`);r===`manager`&&n.session.manager_runtime&&C(n.session.manager_runtime),e=n.session_id,Te.current.set(c,e),Be(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),B.current.delete(c)}let o=``;l=Ve(r,{activity:[`正在连接 Agent`],agentLabel:a.label,lines:[],pending:!0,sourceLabel:r===`manager`?`${a.label} 管家 · 跨 Goal`:`${a.label} Agent · ${NS(i.goalId)}`,text:``});let s=(await Yh(e,n,{attachments:t?.attachments,signal:(()=>{let e=new AbortController;return De.current.set(r,e),e.signal})(),onDelta:e=>{o+=e,l!==null&&He(r,l,{text:o})},onActivity:e=>{l!==null&&z(t=>({...t,[r]:(t[r]??[]).map(t=>t.id===l?{...t,activity:[...new Set([...t.activity??[],e])].slice(-6)}:t)}))},onPhase:(t,n)=>{Ee.current.set(r,n),Be(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`running`,turnId:n})}})).response;if(He(r,l,{lines:s.gate?[s.gate.summary,s.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:PS(s.message||o.trim())||`${a.label} 已完成分析。`}),s.proposals.length>0&&!i&&He(r,l,{lines:[`请进入要修改的 Goal,预览并确认具体变更。`]}),s.proposals.length>0&&i){let e=s.proposals.map(e=>({goalId:i.goalId,id:we.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));fe(t=>({...t,[r]:[...t[r]??[],...e]}))}if(r!==`manager`&&s.protected_action){let e=hS(r,n,s.protected_action);if(e)return e}}catch(e){if(Oe.current.delete(r)){let e={agentLabel:a.label,lines:[],pending:!1,sourceLabel:`${a.label} 会话`,text:`已中断。你可以在当前会话继续发送消息。`};l===null?Ve(r,e):He(r,l,e);return}let t=e instanceof Eh?e.payload:null;t&&fh(t)&&Te.current.delete(c),t?.error_code===`resume_failed`&&(Te.current.delete(c),B.current.add(c),Be(r,{agentId:a.agentId,resumable:!1,sessionId:he[r]?.sessionId??`resume-failed`,status:`resume_failed`}));let n=t?.gate,i=n&&typeof n==`object`?String(n.summary??``):``,o={agentLabel:a.label,lines:i?[i]:[],pending:!1,reconnect:t?.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t?.error_code===`resume_failed`?`原 ${a.label} 会话无法恢复。本地历史已经保留,请在运行详情里选择“重试恢复”或“开始新 Session”。`:e instanceof Error?e.message:`${a.label} 会话暂时不可用。`};l===null?Ve(r,o):He(r,l,o)}finally{Ee.current.delete(r),De.current.delete(r);let e=Te.current.get(c);e&&Be(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),me(e=>e===r?null:e)}}async function We(e){let t=e?.goalId??M,n=he[t],r=e?.agentId??n?.agentId??I.agentId,i=`${t}:${r}`,a=e?.sessionId??n?.sessionId??Te.current.get(i),o=e?.turnId??n?.turnId??Ee.current.get(t);if(!(!a||!o))try{Oe.current.add(t),await Jh(a,o),De.current.get(t)?.abort()}catch(e){throw Oe.current.delete(t),e}finally{Ee.current.delete(t),Be(t,{agentId:r,resumable:!0,sessionId:a,status:`ready`}),De.current.delete(t),me(e=>e===t?null:e)}}async function Ge(e){let t=e.goalId,n=`${t}:${e.agentId}`,r=e.sessionId??he[t]?.sessionId??Te.current.get(n);if(r)try{let i=await $h(r);Te.current.set(n,r),B.current.delete(n),Be(t,{agentId:e.agentId,resumable:i.session.resumable,sessionId:r,status:i.session.status})}catch{Be(t,{agentId:e.agentId,resumable:!1,sessionId:r,status:`resume_failed`})}}function Ke(e){let t=`${e.goalId}:${e.agentId}`;Te.current.delete(t),B.current.add(t),Be(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:`new-session-pending`,status:`ready`})}async function qe(e){let t=`${e.goalId}:${e.agentId}`,n=e.sessionId??he[e.goalId]?.sessionId??Te.current.get(t);n&&n!==`new-session-pending`&&await Qh(n),Te.current.delete(t),B.current.add(t),Be(e.goalId,null)}function Je(e){P.some(t=>t.agentId===e&&t.available)&&(re(t=>({...t,[M]:e})),ie(!1))}function Ye(){i(``),se(`chat`)}function Xe(e){i(e),se(`chat`)}T&&MS[T.state],T&&(`${I.label}${T.state}`,Ie.length>0&&`${Re}`,Fe.length>0&&`${Fe.length}`),T?.state===`需修复`||!T&&!c.ok?(T&&LS(T.agentId),T?.nextSentence,T?.agentSentence):T?.state===`等你`?(T.needsYouBlocking,T.needsYouBlocking,T.needsYou??T.nextSentence,T.needsYou):(T&&LS(T.agentId),T?.nextSentence);let Ze=[...!T&&he.manager?.status===`resume_failed`?[{id:`run:manager:resume-failed`,kind:`run`,run:{agentId:he.manager.agentId,agentLabel:LS(he.manager.agentId),canInterrupt:!1,completedSteps:0,goalId:`manager`,goalTitle:`LoopX 管家`,latestActivity:`本地聊天记录已保留,点我查看恢复方式。`,resumable:!1,runId:`manager:resume-failed`,sessionId:he.manager.sessionId,sessionStatus:`resume_failed`,status:`failed`,title:`上次会话需要恢复`,totalSteps:1,outputs:[]}}]:[],...T?_e.map(e=>{let t=e.channel_id?.startsWith(`task.`)?e.channel_id.slice(5):void 0,n=T.agentTodos.find(e=>e.todoId===t),r=!!e.active_turn_id,i=xe[e.session_id],a=i?.messages.some(e=>FS(e.role,e.text))===!0;return{id:`run:task:${e.session_id}`,kind:`run`,run:{agentId:e.agent_id,agentLabel:LS(e.agent_id),canInterrupt:r,completedSteps:n?.done||a?1:0,goalId:T.goalId,goalTitle:T.title,latestActivity:r?`Agent 正在执行,可进入 Session 查看过程或发送纠偏。`:a?`Agent 已返回结果,点击查看结果与完整运行记录。`:`执行 Session 已保留,可继续纠偏或恢复。`,resumable:e.resumable,runId:e.session_id,sessionId:e.session_id,sessionMessages:i?.messages.map(e=>({createdAt:e.created_at,messageId:e.message_id,role:e.role===`user`?`user`:FS(e.role,e.text)?`assistant`:`error`,text:e.role===`user`?e.text:PS(e.text)})),sessionStatus:a?`completed`:e.status,status:n?.done||a?`completed`:r?`running`:e.status===`resume_failed`?`failed`:`waiting`,title:n?.text??`Agent 执行任务`,todoId:t,totalSteps:1,turnId:e.active_turn_id??void 0}}}):[],...T?[{id:`run:${T.goalId}`,kind:`run`,run:{agentId:he[T.goalId]?.agentId??T.agentId,agentLabel:LS(he[T.goalId]?.agentId??T.agentId),canInterrupt:!!he[T.goalId]?.turnId,completedSteps:T.agentTodos.filter(e=>e.done).length,goalId:T.goalId,goalTitle:T.title,latestActivity:T.agentSentence,resumable:he[T.goalId]?.resumable??!0,runId:`goal:${T.goalId}`,sessionId:he[T.goalId]?.sessionId,sessionStatus:he[T.goalId]?.status,status:he[T.goalId]?.turnId?`running`:T.state===`需修复`?`failed`:`waiting`,title:T.nextSentence,totalSteps:T.agentTodos.length||1,turnId:he[T.goalId]?.turnId,outputs:T.runEvidence?[{createdAt:T.runEvidence.generatedAt,kind:`evidence`,outputId:`${T.goalId}:latest-evidence`,title:T.runEvidence.label}]:[]}}]:[],...Pe.map(e=>({id:`message:${e.id}`,kind:`message`,message:{agentLabel:e.agentLabel,attachments:e.attachments,id:String(e.id),pending:e.pending,returnDelivery:e.returnDelivery,role:e.role,text:e.text||(e.pending?`Agent 正在处理…`:e.lines.join(` +`))}})),...(T?[T]:w.goals).flatMap(e=>e.runEvidence?[{id:`output:${e.goalId}:${e.runEvidence.generatedAt||`latest`}`,kind:`output`,output:{agentLabel:LS(e.agentId),createdAt:e.runEvidence.generatedAt,goalId:e.goalId,goalTitle:e.title,kind:`evidence`,outputId:`${e.goalId}:latest-evidence`,runId:e.runEvidence.runId??void 0,safePreview:e.runEvidence.safePreview,summary:e.runEvidence.summary,title:e.runEvidence.label,todoId:e.runEvidence.todoId??void 0}}]:[]),...T&&D?[{id:`output:${T.goalId}:report:${D.publication.publication_id}`,kind:`output`,output:{agentId:D.agent_id,agentLabel:LS(D.agent_id),createdAt:D.publication.delivered_at,goalId:T.goalId,goalTitle:T.title,kind:`report`,outputId:D.publication.publication_id,report:{addedCount:D.delta.added_count,changedCount:D.delta.changed_count,deliveredAt:D.publication.delivered_at,generationId:D.generation_id,items:D.delta.items.map(e=>({changeKind:e.change_kind,previousStatus:e.previous_status,sourceRef:e.source_ref,status:e.status,summary:e.summary,title:e.title})),periodEndAt:D.period_window.end_at,periodStartAt:D.period_window.start_at,predecessorPublicationId:D.publication.predecessor_publication_id,publicationId:D.publication.publication_id},safePreview:D.delta.items.map(e=>`${e.change_kind===`added`?`+`:`~`} ${e.title}\n${e.summary}`).join(` -`),summary:D.summary,title:D.title}}]:[]],Qe=f.connectionState===`connected`,$e=new Map(w.goals.map(e=>[e.goalId,e.title])),et=e=>Wd(e,f.activeSource.statusUrl,Qe&&!l?.errors[e.goalId],$e.get(e.goalId)),tt={...vy(w),userTodos:w.userTodos.map(et),attentionHistory:(w.attentionHistory??w.userTodos).map(et),periodicReports:{error:k,loading:te},timeline:Ze};return(0,H.jsxs)(`div`,{className:p===`dark`?`dark`:``,"data-testid":`personal-goal-home`,children:[ye?(0,H.jsx)(`p`,{role:`status`,className:`m-0 bg-amber-50 px-4 py-2 text-sm text-amber-900`,children:_(ye===`partial`?`runs.discoveryPartial`:`runs.discoveryOffline`)}):null,(0,H.jsx)(Kx,{agents:P.map(e=>({adapterKind:e.adapterKind,agentId:e.agentId,available:e.available,capability:e.capability,interrupt:e.interrupt,label:e.label,location:e.location,resume:e.resume,source:e.source,streaming:e.streaming,toolCalls:e.toolCalls,trustScope:e.trustScope,workspaceCompatibility:e.available?`当前 Goal 写入前验证`:`不可用,需先修复 Endpoint`})),callbacks:{onApplyAttention:e=>Xe(e.goalId),onCorrectRun:async(e,t)=>{if(!e.sessionId)throw Error(`这个 Run 还没有可纠偏的执行 Session。`);let n=await Ph((await jh({actionKind:`run.correct`,context:{kind:`run`,goal_id:e.goalId,todo_id:e.todoId},idempotencyKey:`workspace-run-correct-${e.sessionId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,message:t,session_id:e.sessionId},summary:`纠偏执行任务:${e.title}`})).proposal_id),r=typeof n.turn?.turn_id==`string`?n.turn.turn_id:void 0;if(Be(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:r?`running`:`ready`,turnId:r}),r){Ee.current.set(e.goalId,r);let t=new AbortController;De.current.set(e.goalId,t);let n=``,i=Ve(e.goalId,{activity:[`正在把纠偏送入原执行 Session`],agentLabel:e.agentLabel,lines:[],pending:!0,sourceLabel:`${e.agentLabel} · 执行 Session`,text:``});try{let a=await Zh(e.sessionId,r,{signal:t.signal,onDelta:t=>{n+=t,He(e.goalId,i,{text:n})}});He(e.goalId,i,{activity:[],pending:!1,text:NS(a.response.message||n.trim())||`${e.agentLabel} 已完成纠偏。`})}catch(t){let n=Oe.current.delete(e.goalId);He(e.goalId,i,{activity:[],pending:!1,text:n?`已中断。你可以在当前会话继续发送消息。`:t instanceof Error?t.message:`纠偏回合失败。`})}finally{Ee.current.delete(e.goalId),De.current.delete(e.goalId),Be(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:`ready`})}}},onCloseRunSession:qe,onInterruptRun:async e=>We(e),onOpenGoal:Xe,onOpenRunSession:async e=>{if(!e.sessionId)return;let t=e.sessionId,n=await Vh(t);Se(e=>({...e,[t]:n})),Xe(e.goalId),z(t=>({...t,[e.goalId]:n.messages.map(t=>({agentLabel:t.role===`user`?void 0:e.agentLabel,attachments:OS(t.attachments),id:Ce.current++,lines:[],role:t.role===`user`?`user`:`assistant`,sourceLabel:t.role===`user`?void 0:`${e.agentLabel} · 执行 Session`,text:t.role===`user`?t.text:NS(t.text)}))})),Be(e.goalId,{agentId:e.agentId,resumable:n.session.resumable,sessionId:t,status:n.session.active_turn_id?`running`:n.session.status,turnId:n.session.active_turn_id??void 0})},onOpenOutput:e=>Xe(e.goalId),...b?{onPreviewGoalSubagentConfiguration:async e=>{let t=await ng(e);return{changed:t.changed,configuration:{allowedDomains:t.after.orchestration.allowed_domains,enabled:t.feature_summary.multi_subagent===`enabled`,maxChildren:t.after.orchestration.max_children,modelConfig:t.after.orchestration.model_config},previewId:t.preview_id}},onApplyGoalSubagentConfiguration:async({previewId:e,...t})=>{let n=await rg(t,e);return{allowedDomains:n.after.orchestration.allowed_domains,enabled:n.feature_summary.multi_subagent===`enabled`,maxChildren:n.after.orchestration.max_children,modelConfig:n.after.orchestration.model_config}}}:{},...g?{onExecuteGoalLifecycle:async({goalId:e,operation:t,reason:n})=>{let r=await Sb(g,e,t,n);return{activationState:r.activation_state,projectionVerified:r.projection_verified}}}:{},onGoalActivationStateChange:n,onGoalDeleted:r,onReconcileStatus:a,onRetryGoalArchive:s,onExportOutput:async e=>{let t=[`# ${e.title}`,``,e.summary??``,``,e.safePreview??`此产出没有可用的公开安全预览。`,``,`Goal: ${e.goalId}`,`Todo: ${e.todoId??`unlinked`}`,`Run: ${e.runId??`unlinked`}`].join(` -`),n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),r=document.createElement(`a`);r.href=n,r.download=`${e.outputId.replace(/[^a-z0-9._-]+/gi,`-`)}.md`,r.click(),URL.revokeObjectURL(n)},onRefresh:o,onRetryResumeRun:Ge,onSelectAgent:Je,onSelectGoal:e=>e?Xe(e):Ye(),onSendMessage:async(e,t,n,r)=>Ue(e,{agentId:t,goalId:n,attachments:r}),onStartNewRunSession:Ke},goalArchiveLoadState:e,managerRuntime:S,model:tt,readOnly:h,selectedAgentId:I.agentId,selectedGoalId:T?.goalId??null,statusSourceControl:f})]})}function uC({error:e,isLoading:t,onRetry:n,requestedUrl:r,theme:i,toggleTheme:a}){let o=!!(e&&/failed to fetch|networkerror|load failed/i.test(e)&&r.includes(`status.json`));return(0,H.jsx)(`div`,{className:i===`dark`?`dark`:``,children:(0,H.jsxs)(`main`,{className:`min-h-screen bg-[#f6f7f9] text-slate-950 dark:bg-[#09090b] dark:text-zinc-50`,children:[(0,H.jsxs)(`header`,{className:`flex min-h-16 flex-wrap items-center justify-between gap-3 border-b border-slate-200 bg-white px-4 py-3 dark:border-zinc-800 dark:bg-zinc-950 sm:px-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold`,children:`LoopX Workspace`}),(0,H.jsx)(`p`,{className:`mt-1 break-all text-sm text-slate-500 dark:text-zinc-400`,children:`Personal Workspace`})]}),(0,H.jsx)(iy,{"aria-label":`切换主题`,onClick:a,size:`icon`,variant:`secondary`,children:i===`dark`?(0,H.jsx)(Ym,{className:`h-4 w-4`}):(0,H.jsx)(Am,{className:`h-4 w-4`})})]}),(0,H.jsxs)(`div`,{className:`grid min-h-[calc(100vh-80px)] sm:grid-cols-[240px_1fr]`,children:[(0,H.jsxs)(`aside`,{className:`hidden border-r border-slate-200 p-6 dark:border-zinc-800 sm:block`,"aria-label":`Workspace`,children:[(0,H.jsx)(`strong`,{children:`LoopX`}),(0,H.jsx)(`p`,{className:`mt-6 text-sm`,children:`Workspace`}),(0,H.jsx)(`p`,{className:`mt-8 text-xs text-slate-500`,children:`Goals`}),[1,2,3].map(e=>(0,H.jsx)(`div`,{className:`mt-4 h-8 rounded bg-slate-100 dark:bg-zinc-900`},e))]}),(0,H.jsx)(`div`,{className:`p-4 sm:p-8`,children:(0,H.jsx)(ay,{"data-testid":`initial-status-state`,children:(0,H.jsx)(oy,{className:`flex min-h-64 items-center justify-center p-6`,children:(0,H.jsxs)(`div`,{className:`max-w-xl text-center`,children:[e?(0,H.jsx)(am,{className:`mx-auto h-6 w-6 text-rose-600 dark:text-rose-300`}):(0,H.jsx)(Lm,{className:`mx-auto h-6 w-6 animate-spin text-slate-500 dark:text-zinc-400`}),(0,H.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e?`无法加载实时状态`:`正在加载实时状态`}),e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`mt-2 break-words text-sm leading-6 text-slate-500 dark:text-zinc-400`,children:o?`本地状态服务暂时未连接。升级或启动期间可能短暂断开,请重试;仍失败时重新打开 LoopX App,或运行 loopx doctor。`:e}),o?(0,H.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-slate-400 dark:text-zinc-500`,children:`重新加载不会执行任务,也不会改变 Goal 配置。`}):null,(0,H.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:(0,H.jsxs)(iy,{disabled:t,onClick:n,children:[(0,H.jsx)(Lm,{className:`h-4 w-4`}),`重试`]})})]}):(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-500 dark:text-zinc-400`,role:`status`,children:`正在连接 Workspace,Goal 列表将先出现,详细状态会逐个补齐。 / Connecting to your Workspace. Goals load independently.`})]})})})})]})]})})}function dC(){let e=cw.useSearch(),t=cw.useNavigate(),[n,r]=(0,V.useState)(`light`),[i,a]=(0,V.useState)(null),o=(0,V.useRef)(null),s=(0,V.useRef)(e.goalId);s.current=e.goalId;let[c,l]=(0,V.useState)(Op),[u,d]=(0,V.useState)({kind:`example`,label:`bundled example`}),[f,p]=(0,V.useState)(()=>aS(window.localStorage,window.location.href)),m=(0,V.useRef)(f);m.current=f;let[h,g]=(0,V.useState)(e.statusUrl),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)({error:null,phase:`idle`}),[C,w]=(0,V.useState)(e.statusUrl.trim()||null),[T,E]=(0,V.useState)(!1),D=(0,V.useRef)(null),O=(0,V.useRef)(Zg(e.statusUrl.trim()||null)),k=!T&&u.kind===`example`?e.statusUrl.trim():``,ee=C??k,te=u.kind===`url`?u.label:hS,A=!!(_&&C),j=fS(f,C,te,window.location.href),M=u.kind===`example`&&!T,N=c.attention_queue,P=c.run_history,F=(0,V.useMemo)(()=>vS(P.goals,N.items),[P.goals,N.items]);function ne(e,t,n=0){S({error:null,phase:`loading`}),gS(oh(e,`stopped`,window.location.href)).then(r=>{if(!t_(O.current,t))return;let i=r.goal_projection?.registry_revision??null,a=t.registryRevision!==null&&t.registryRevision!==void 0&&i!==null&&t.registryRevision!==i;if(l(e=>w_(e,r)),a&&n<1){L(e,{background:!0,resyncAttempt:n+1});return}S(a?{error:`Goal 状态在加载历史时发生变化,请重试。`,phase:`error`}:{error:null,phase:`ready`})}).catch(e=>{t_(O.current,t)&&S({error:Dp(e),phase:`error`})})}function re(){let e=u.kind===`url`?u.label:h||hS,t=$g(O.current,e,{background:!0});if(i){L(e);return}t&&ne(e,t)}async function I(e,n,r){if(r.background)return l(e=>w_(e,n)),!0;let i={kind:`url`,label:e};return O.current.loadedUrl=e,l(n),d(i),g(e),await t({search:t=>({...t,statusUrl:e})}),e_(O.current,r)?(O.current.requestedUrl=null,w(null),!0):!1}async function L(e,t={}){let n=e.trim(),r=t.background===!0;if(!n){r||v(`状态地址不能为空`);return}let c=$g(O.current,n,{background:r,selectionRevision:t.selectionRevision});if(!c)return;o.current?.abort();let d=new AbortController;o.current=d,r||(D.current=null,E(!1),w(n),b(!0),v(null),S({error:null,phase:`idle`}));try{let e=await jp(n,window.location.href).catch(()=>null);if(!t_(O.current,c))return;if(e){let o=t.retryOnly&&u.kind===`url`&&u.label===n&&i?.directory.registry_revision===e.registry_revision?i.snapshots:{};a({directory:e,snapshots:o,errors:{}});let f={...e,goals:e.goals.filter(e=>!o[e.id])},p=!1,m=Mp(e);if(r)l(m);else if(!await I(n,m,c))return;if(S({error:null,phase:`loading`}),await Pp(n,window.location.href,f,(e,t,n)=>{n===`revision`&&(p=!0),a(r=>r&&{...r,snapshots:t?{...r.snapshots,[e]:t}:r.snapshots,errors:n?{...r.errors,[e]:n}:r.errors})},()=>t_(O.current,c),()=>s.current,d.signal),p&&(t.resyncAttempt??0)<1&&t_(O.current,c)){await L(n,{resyncAttempt:1});return}t_(O.current,c)&&S({error:null,phase:`ready`});return}let o=await gS(oh(n,`active`,window.location.href));if(!t_(O.current,c)||(a(null),c.registryRevision=o.goal_projection?.registry_revision??null,!await I(n,o,c)))return;if(o.goal_projection?.scope!==`active`||o.goal_projection.complete){S({error:null,phase:`ready`});return}ne(n,c,t.resyncAttempt??0)}catch(e){if(!e_(O.current,c))return;r||v(Dp(e))}finally{!r&&e_(O.current,c)&&b(!1)}}function ie(e,t={}){o.current?.abort();let n=Qg(O.current,e.statusUrl);D.current=null,E(!1),w(e.statusUrl),b(!0),v(null),(async()=>{if(t.ensureTunnel&&e.kind===`ssh_tunnel`){let t=new URL(e.statusUrl,window.location.href).port;if(t)try{await xb(e.label,t)}catch{}}O.current.selectionRevision===n&&await L(e.statusUrl,{selectionRevision:n})})()}function R(e){m.current=e,p(e);try{oS(window.localStorage,e)}catch{}}let ae={activeSource:j,connectionState:y?`loading`:A?`error`:`connected`,errorMessage:A?`未切换到 ${C??`所选来源`}:${_}`:null,onAdd:e=>{let t=cS(f,e,window.location.href);return`error`in t?{error:t.error}:(R(t.catalog),ie(t.source,{ensureTunnel:e.ensureTunnel}),{})},onConfiguredHostsLoaded:e=>{let t=m.current,n=sS(t,e);n!==t&&R(n)},onRemove:e=>{R(lS(f,e)),j.id===e&&ie(eS)},onSelect:e=>{let t=f.sources.find(t=>t.id===e);t&&ie(t,{ensureTunnel:t.kind===`ssh_tunnel`})},sources:j.id===`temporary`?[...f.sources,j]:f.sources};(0,V.useEffect)(()=>{let t=e.statusUrl.trim();if(t){if(D.current===t||C&&C!==t)return;(u.kind!==`url`||u.label!==t)&&L(t);return}D.current=null,!T&&(C||u.kind===`example`&&L(hS))},[T,C,e.statusUrl,u.kind,u.label]),(0,V.useEffect)(()=>{if(e.statusUrl&&u.kind===`example`)return;let n=new Set(F.map(e=>e.goal.id));if(F.length===0){e.goalId&&t({search:e=>({...e,goalId:``})});return}e.goalId&&!n.has(e.goalId)&&x.phase!==`loading`&&t({search:e=>({...e,goalId:``})})},[x.phase,F,t,e.goalId,e.statusUrl,u.kind]),(0,V.useEffect)(()=>{if(!i||y||!e.goalId||u.kind!==`url`)return;let t=i.directory.goals.find(t=>t.id===e.goalId);t?.activation_state===`stopped`&&!i.snapshots[t.id]&&!i.errors[t.id]&&L(u.label,{retryOnly:!0})},[e.goalId,y,i,u]);function oe(e){t({search:t=>({...t,goalId:e})})}return M?(0,H.jsx)(uC,{error:_,isLoading:y,onRetry:()=>void L(ee||hS),requestedUrl:ee||hS,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)}):(0,H.jsx)(lC,{goalArchiveLoadState:x,isLoading:y,onGoalActivationStateChange:(e,t)=>{O.current.projectionRevision+=1,l(n=>wp(n,e,t)),a(n=>n&&{...n,snapshots:Object.fromEntries(Object.entries(n.snapshots).map(([n,r])=>[n,wp(r,e,t)]))})},onGoalDeleted:e=>{O.current.projectionRevision+=1,l(t=>Tp(t,e)),a(t=>t&&{...t,snapshots:Object.fromEntries(Object.entries(t.snapshots).filter(([t])=>t!==e))})},onSelectGoal:oe,onReconcileStatus:()=>L(u.kind===`url`?u.label:h||hS,{background:!0}),onRetryGoalArchive:re,onRefresh:()=>L(u.kind===`url`?u.label:h||hS,{retryOnly:!!(i&&Object.keys(i.errors).length)}),payload:c,progress:i,rows:F,selectedGoalId:e.goalId,statusSourceControl:ae,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)})}var fC=k_(`inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium`,{variants:{variant:{neutral:`border-slate-200 bg-white text-slate-700 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-300`,success:`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-200`,warning:`border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200`,info:`border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-900 dark:bg-sky-950 dark:text-sky-200`,danger:`border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-900 dark:bg-rose-950 dark:text-rose-200`}},defaultVariants:{variant:`neutral`}});function pC({className:e,variant:t,...n}){return(0,H.jsx)(`span`,{className:ny(fC({variant:t}),e),...n})}var mC=[{label:`status payload`,source:`apps/presentation/dashboard/src/data/status.ts`,detail:`status_contract, attention_queue, local_dashboard_api, run_history`},{label:`channel projection`,source:`apps/presentation/dashboard/src/data/goal-channel-frontstage.ts`,detail:`decision_frame, todos, gates, leases, artifacts, truth_contract`},{label:`public showcase catalog`,source:`docs/showcases/showcase-catalog.json`,detail:`case metadata, visual hints, evidence boundaries, story beats`},{label:`route smoke`,source:`apps/presentation/dashboard/smoke/frontstage-route-smoke.ts`,detail:`static route contract, source guards, component expectations`}],hC=[{axis:`schema`,current:`goal_channel_projection_v0`,proposed:`new optional projection field`,gate:`parser default plus route smoke assertion`},{axis:`truth`,current:`event ledger and active state remain source of truth`,proposed:`derived UI state only`,gate:`truth_contract must stay read-only`},{axis:`privacy`,current:`compact source refs and warnings`,proposed:`public-safe fixture field`,gate:`loopx check and browser fake-private fixture`},{axis:`interaction`,current:`render, filter, select, inspect`,proposed:`no browser write by default`,gate:`write affordance requires explicit loopback capability`}],gC=[{title:`Fixture sources`,body:`Use examples/status.example.json, browser-smoke fixtures, and docs/showcases/showcase-catalog.json.`},{title:`Required proof`,body:`Every projection addition needs parser coverage, route smoke assertions, and one browser or bundle check when UI output changes.`},{title:`Never include`,body:`Raw task text, trajectories, transcripts, local paths, private registry state, credentials, or internal document links.`}],_C=[`npm --prefix apps/presentation/dashboard run smoke:frontstage-route`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-browser`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-share-bundle`,`npm --prefix apps/presentation/dashboard run build`,`loopx check --scan-path apps/presentation/dashboard --scan-path docs/status-data-contract.md`],vC=[{name:`Projection lane`,badges:[`read-only`,`schema v0`],body:`Summarizes one compact projection lane without mutating the underlying LoopX state.`},{name:`Capability badge`,badges:[`loopback`,`dry-run`],body:`Shows an advertised local capability only after the status feed declares it.`},{name:`Boundary warning`,badges:[`public-safe`,`omitted`],body:`Names omitted private material and points contributors back to compact source references.`}];function yC({children:e,icon:t,title:n}){return(0,H.jsxs)(`section`,{className:`rounded-lg border border-slate-200 bg-white shadow-sm`,children:[(0,H.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,H.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,H.jsx)(t,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function bC(){return(0,H.jsx)(yC,{icon:$p,title:`Status Contract Explorer`,children:(0,H.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,"data-testid":`developer-contract-explorer`,children:mC.map(e=>(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(pC,{variant:`info`,children:e.label}),(0,H.jsx)(pC,{variant:`neutral`,children:`public contract`})]}),(0,H.jsx)(`div`,{className:`mt-2 break-words font-mono text-xs text-slate-700`,children:e.source}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.detail})]},e.label))})})}function xC(){return(0,H.jsx)(yC,{icon:ym,title:`Projection Diffing`,children:(0,H.jsx)(`div`,{className:`overflow-x-auto`,"data-testid":`developer-projection-diffing`,children:(0,H.jsxs)(`table`,{className:`min-w-full border-separate border-spacing-0 text-left text-sm`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{className:`bg-slate-50 text-xs uppercase tracking-normal text-slate-500`,children:[(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Axis`}),(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Current`}),(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Proposed`}),(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Gate`})]})}),(0,H.jsx)(`tbody`,{children:hC.map(e=>(0,H.jsxs)(`tr`,{className:`align-top`,children:[(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 font-semibold text-slate-950`,children:e.axis}),(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.current}),(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.proposed}),(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.gate})]},e.axis))})]})})})}function SC(){return(0,H.jsx)(yC,{icon:hm,title:`Fixture Generation`,children:(0,H.jsx)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-fixture-generation`,children:gC.map(e=>(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:e.title}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.title))})})}function CC(){return(0,H.jsx)(yC,{icon:sm,title:`Smoke Checklist`,children:(0,H.jsx)(`div`,{className:`space-y-2 p-4`,"data-testid":`developer-smoke-checklist`,children:_C.map(e=>(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,H.jsx)(Xp,{className:`mt-0.5 h-4 w-4 shrink-0 text-emerald-600`}),(0,H.jsx)(`code`,{className:`break-all text-xs font-semibold leading-5 text-slate-700`,children:e})]},e))})})}function wC(){return(0,H.jsx)(yC,{icon:cm,title:`Component Examples`,children:(0,H.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-3`,"data-testid":`developer-component-examples`,children:vC.map(e=>(0,H.jsxs)(`article`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.badges.map(e=>(0,H.jsx)(pC,{variant:e===`read-only`||e===`public-safe`?`success`:`neutral`,children:e},e))}),(0,H.jsx)(`h3`,{className:`mt-3 text-sm font-semibold leading-6 text-slate-950`,children:e.name}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.name))})})}function TC(){return(0,H.jsx)(`main`,{className:`min-h-screen bg-[#f7f7f4] px-4 py-4 text-slate-950 sm:px-5`,"data-testid":`frontstage-developer-cockpit`,children:(0,H.jsxs)(`div`,{className:`mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,H.jsxs)(`aside`,{className:`rounded-lg border border-slate-200 bg-white p-4 shadow-sm xl:sticky xl:top-4 xl:self-start`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md border border-slate-200 bg-slate-950 text-white`,children:(0,H.jsx)(Xm,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:`Developer Cockpit`}),(0,H.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Projection extension`})]})]}),(0,H.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,H.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://huangruiteng.github.io/loopx/`,children:[(0,H.jsx)(Sm,{className:`h-4 w-4`}),`LoopX home`]}),(0,H.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://huangruiteng.github.io/loopx/docs/showcases/index.en.html`,children:[(0,H.jsx)(pm,{className:`h-4 w-4`}),`Public cases`]}),(0,H.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md bg-slate-950 px-3 py-2 text-sm font-medium text-white`,href:`/chat/developers/projections/`,children:[(0,H.jsx)(cm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,H.jsxs)(`div`,{className:`mt-5 space-y-2 rounded-md border border-emerald-200 bg-emerald-50 p-3 text-xs leading-5 text-emerald-950`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(pC,{variant:`success`,children:`read-only`}),(0,H.jsx)(pC,{variant:`neutral`,children:`public fixtures`})]}),(0,H.jsx)(`p`,{children:`This route uses static public contracts only; live status feeds, registry files, and browser write APIs stay outside the cockpit.`})]})]}),(0,H.jsxs)(`section`,{className:`space-y-4`,children:[(0,H.jsx)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(pC,{variant:`info`,children:`developers/projections`}),(0,H.jsx)(pC,{variant:`success`,children:`public-safe`}),(0,H.jsx)(pC,{variant:`neutral`,children:`no browser writes`})]}),(0,H.jsx)(`h1`,{className:`mt-3 text-3xl font-semibold tracking-normal text-slate-950`,children:`LoopX Projection Developer Cockpit`}),(0,H.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-slate-600`,children:`A read-only contributor workbench for adding dashboard/frontstage projections without reverse-engineering the large operator page.`})]}),(0,H.jsxs)(`div`,{className:`grid min-w-[260px] gap-2 text-sm`,children:[(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Source of truth`}),(0,H.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`status contract + compact fixtures`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Boundary`}),(0,H.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`read-only extension surface`})]})]})]})}),(0,H.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,H.jsx)(bC,{}),(0,H.jsx)(xC,{})]}),(0,H.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,H.jsx)(SC,{}),(0,H.jsx)(CC,{})]}),(0,H.jsx)(wC,{}),(0,H.jsx)(yC,{icon:Gm,title:`Extension Boundary`,children:(0,H.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-extension-boundary`,children:[(0,H.jsxs)(`div`,{className:`rounded-md border border-emerald-200 bg-emerald-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Allowed`}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Versioned parser defaults, public fixtures, read-only route panels, and focused smoke assertions.`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Review`}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`New dashboard dependencies, status contract fields, loopback capability display, and browser-visible workflows.`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-rose-200 bg-rose-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Stop`}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Credentials, private registry material, raw logs, transcripts, production actions, or default browser write authority.`})]})]})})]})]})})}var EC=Y({value:K().finite(),total:K().finite().positive().optional(),unit:G().optional(),higher_is_better:q()}).passthrough(),DC=hd(G(),K().finite()).default({}),OC=Y({outcome_status:G().optional(),failure_class:G(),causal_summary:G(),expectedness:G(),implication:G(),next_probe:G(),confidence:G(),evidence_refs:J(G()).optional()}).passthrough(),kC=Y({arm_id:G(),selected_run_id:G().nullable(),score_countable:q(),metrics:hd(G(),EC),effort:DC,insight:OC.nullable().optional()}),AC=Y({run_id:G(),case_id:G(),arm_id:G(),arm_role:G(),status:G(),protocol_id:G(),runner_revision:G().optional(),observed_at:G(),metrics:hd(G(),EC),countability:Y({integrity_qualified:q(),official_result_present:q(),score_countable:q()}).passthrough(),treatment_fidelity:G(),effort:DC,redacted_insight:OC.nullable().optional(),upload_provenance:Y({producer_id:G(),producer_version:G(),observed_at:G(),source_revision:G()}).passthrough()}).passthrough(),jC=Y({case_denominator:K().int().nonnegative(),value_sum:K().finite(),value_mean:K().finite().nullable(),value_median:K().finite().nullable(),value_min:K().finite().nullable(),value_max:K().finite().nullable(),case_macro_rate:K().finite().optional(),suite_micro_rate:K().finite().optional(),suite_micro_numerator:K().finite().optional(),suite_micro_denominator:K().finite().positive().optional()}).passthrough(),MC=Y({arm_id:G(),arm_role:G(),factor_assignments:hd(G(),G()),protocol_counts:hd(G(),K().int().nonnegative()).default({}),runner_revision_counts:hd(G(),K().int().nonnegative()).default({}),orchestrator_runtime_counts:hd(G(),K().int().nonnegative()).default({}),intended_case_count:K().int().positive(),run_count:K().int().nonnegative(),terminal_run_count:K().int().nonnegative(),selected_score_countable_case_count:K().int().nonnegative(),coverage_rate:K().finite().min(0).max(1),metrics:hd(G(),jC),binary_outcomes:hd(G(),Y({success_count:K().int().nonnegative(),case_denominator:K().int().nonnegative(),success_rate:K().finite().min(0).max(1).nullable()})),effort:hd(G(),Y({denominator:K().int().nonnegative(),mean:K().finite().nullable(),median:K().finite().nullable()})),failure_class_counts:hd(G(),K().int().nonnegative())}).passthrough(),NC=Y({baseline_value:K().finite(),candidate_value:K().finite(),delta:K().finite(),direction:_d([`improved`,`flat`,`regressed`]).optional()}).passthrough(),PC=Y({comparison_id:G(),comparison_anchor_run_id:G(),candidate_run_id:G(),candidate_arm_id:G(),primary_metric:G(),matched_pair_countable:X(!0),metric_deltas:hd(G(),NC)}).passthrough(),FC=Y({ok:X(!0),schema_version:X(`benchmark_study_dashboard_v0`),benchmark_id:G(),study_id:G(),status:_d([`complete`,`provisional`]),design:Y({protocol_id:G(),comparison_protocol_id:G(),baseline_arm_id:G(),case_set:Y({case_set_id:G(),case_ids:J(G())}),metric_catalog:J(Y({metric_name:G(),role:_d([`primary`,`guardrail`,`supporting`]),unit:G().optional(),higher_is_better:q(),binary:q()})),labels:hd(G(),G())}).passthrough(),campaign:Y({intended_case_count:K().int().positive(),intended_arm_count:K().int().positive(),intended_cell_denominator:K().int().positive(),selected_score_countable_cell_count:K().int().nonnegative(),selected_score_countable_coverage_rate:K().finite().min(0).max(1),complete_declared_design_case_count:K().int().nonnegative(),ambiguous_score_countable_cell_count:K().int().nonnegative(),in_flight_run_count:K().int().nonnegative(),matched_pair_countable_count:K().int().nonnegative(),factorial_contrast_count:K().int().nonnegative(),factorial_contrast_countable_count:K().int().nonnegative(),runtime_observation_count:K().int().nonnegative(),runtime_classification_counts:hd(G(),K().int().nonnegative())}),arms:J(MC),contrasts:hd(G(),Y({matched_pair_denominator:K().int().nonnegative(),primary_metric_directions:Y({improved:K().int().nonnegative(),flat:K().int().nonnegative(),regressed:K().int().nonnegative()}),binary_metric_transitions:hd(G(),Y({"0_to_1":K().int().nonnegative(),"1_to_0":K().int().nonnegative(),same:K().int().nonnegative()}))})),cases:J(Y({case_id:G(),complete_declared_design:q(),arms:J(kC),eligible_comparisons:J(PC),largest_eligible_primary_contrast:PC.nullable()})),runs:J(AC),authority:Y({score_source:G(),matched_comparison_source:G(),factorial_comparison_source:G().nullable(),manifest_changes_scores:X(!1),dashboard_is_execution_authority:X(!1)}),public_boundary:Y({raw_task_recorded:X(!1),raw_trajectory_recorded:X(!1),hidden_evaluation_recorded:X(!1),raw_verifier_output_recorded:X(!1),credentials_recorded:X(!1),local_paths_recorded:X(!1)}),write_performed:X(!1),network_access_performed:X(!1)});function IC(e){return FC.parse(e)}function LC(e,t){let n=new URL(t),r=new URL(e||`/benchmark-study.example.json`,n);if(!new Set([`http:`,`https:`]).has(r.protocol))throw Error(`Benchmark dashboard source must use HTTP or HTTPS`);if(r.origin!==n.origin)throw Error(`Benchmark dashboard source must use same-origin local readback`);return r.toString()}var RC=[{id:`campaign`,label:`Campaign`},{id:`arms`,label:`Arms`},{id:`cases`,label:`Cases`},{id:`runs`,label:`Runs`}];function zC(e){return e==null?`—`:`${(e*100).toFixed(e>=.995?0:1)}%`}function BC(e){return e==null?`—`:new Intl.NumberFormat(`en`,{maximumFractionDigits:2,notation:`compact`}).format(e)}function VC(e){if(e==null)return`—`;let t=e/6e4;return t>=120?`${(t/60).toFixed(1)} h`:`${BC(t)} min`}function HC(e){let t=Object.entries(e);return t.length?t.map(([e,t])=>`${e} (${t})`).join(`, `):`—`}function UC(e){if(!e)return`—`;let t=e.total==null?BC(e.value):`${BC(e.value)}/${BC(e.total)}`;return e.unit?`${t} ${e.unit}`:t}function WC(e,t){let n=e.metrics[t];return!n||n.case_denominator===0?`—`:n.suite_micro_rate==null?`${BC(n.value_mean)} mean`:`${zC(n.suite_micro_rate)} · ${BC(n.suite_micro_numerator)}/${BC(n.suite_micro_denominator)}`}function GC(e,t){let n=e.largest_eligible_primary_contrast,r=n?.metric_deltas[t];if(!n||!r)return null;let i=r.delta>0?`+`:``;return{direction:r.direction,text:`${n.candidate_arm_id}: ${i}${BC(r.delta)}`}}function KC({children:e,tone:t=`neutral`}){return(0,H.jsx)(`span`,{className:`benchmark-state benchmark-state-${t}`,children:e})}function qC({packet:e,primaryMetric:t}){return(0,H.jsxs)(`div`,{className:`benchmark-view-stack`,children:[(0,H.jsxs)(`section`,{"aria-labelledby":`arm-summary-title`,children:[(0,H.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`benchmark-kicker`,children:`ARM SUMMARY`}),(0,H.jsx)(`h2`,{id:`arm-summary-title`,children:`Comparable outcomes, denominator first`})]}),(0,H.jsx)(`p`,{children:`Only one score-countable run per declared case × arm cell is selected.`})]}),(0,H.jsx)(`div`,{className:`benchmark-arm-grid`,children:e.arms.map(e=>{let n=Object.values(e.binary_outcomes)[0];return(0,H.jsxs)(`article`,{className:`benchmark-arm-card`,children:[(0,H.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`benchmark-mono`,children:e.arm_role}),(0,H.jsx)(`h3`,{children:e.arm_id})]}),(0,H.jsx)(KC,{tone:e.coverage_rate===1?`success`:`warning`,children:e.coverage_rate===1?`Complete`:`Provisional`})]}),(0,H.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`dt`,{children:[`Primary · `,t]}),(0,H.jsx)(`dd`,{children:WC(e,t)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Score-countable coverage`}),(0,H.jsxs)(`dd`,{children:[e.selected_score_countable_case_count,`/`,e.intended_case_count]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Binary success`}),(0,H.jsx)(`dd`,{children:n?`${n.success_count}/${n.case_denominator}`:`Not declared`})]})]})]},e.arm_id)})})]}),(0,H.jsxs)(`section`,{"aria-labelledby":`contrast-title`,children:[(0,H.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`benchmark-kicker`,children:`MATCHED CONTRASTS`}),(0,H.jsx)(`h2`,{id:`contrast-title`,children:`Direction counts on eligible pairs`})]}),(0,H.jsx)(`p`,{children:`Raw run volume is never used as a comparison denominator.`})]}),(0,H.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Candidate arm`}),(0,H.jsx)(`th`,{children:`Matched denominator`}),(0,H.jsx)(`th`,{children:`Improved`}),(0,H.jsx)(`th`,{children:`Flat`}),(0,H.jsx)(`th`,{children:`Regressed`}),(0,H.jsx)(`th`,{children:`Binary transitions`})]})}),(0,H.jsxs)(`tbody`,{children:[Object.entries(e.contrasts).map(([e,t])=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`strong`,{children:e})}),(0,H.jsx)(`td`,{children:t.matched_pair_denominator}),(0,H.jsx)(`td`,{className:`benchmark-positive`,children:t.primary_metric_directions.improved}),(0,H.jsx)(`td`,{children:t.primary_metric_directions.flat}),(0,H.jsx)(`td`,{className:`benchmark-negative`,children:t.primary_metric_directions.regressed}),(0,H.jsx)(`td`,{children:Object.entries(t.binary_metric_transitions).map(([e,t])=>`${e}: 0→1 ${t[`0_to_1`]}, 1→0 ${t[`1_to_0`]}, same ${t.same}`).join(` · `)||`—`})]},e)),Object.keys(e.contrasts).length===0&&(0,H.jsx)(`tr`,{children:(0,H.jsx)(`td`,{colSpan:6,children:`No matched comparisons are countable yet.`})})]})]})})]}),(0,H.jsxs)(`section`,{"aria-labelledby":`runtime-health-title`,children:[(0,H.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`benchmark-kicker`,children:`RUNTIME HEALTH`}),(0,H.jsx)(`h2`,{id:`runtime-health-title`,children:`Qualified observations, without execution authority`})]}),(0,H.jsxs)(`p`,{children:[e.campaign.runtime_observation_count,` public-safe runtime observations.`]})]}),(0,H.jsxs)(`div`,{className:`benchmark-runtime-list`,children:[Object.entries(e.campaign.runtime_classification_counts).map(([e,t])=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{children:e}),(0,H.jsx)(`strong`,{children:t})]},e)),e.campaign.runtime_observation_count===0&&(0,H.jsx)(`p`,{className:`benchmark-muted`,children:`No runtime observations uploaded.`})]})]})]})}function JC({packet:e}){return(0,H.jsx)(`div`,{className:`benchmark-detail-grid`,children:e.arms.map(t=>(0,H.jsxs)(`article`,{className:`benchmark-detail-card`,children:[(0,H.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`benchmark-mono`,children:t.arm_role}),(0,H.jsx)(`h2`,{children:t.arm_id})]}),(0,H.jsxs)(KC,{tone:t.coverage_rate===1?`success`:`warning`,children:[t.selected_score_countable_case_count,`/`,t.intended_case_count,` countable`]})]}),(0,H.jsx)(`div`,{className:`benchmark-factor-row`,children:Object.entries(t.factor_assignments).map(([e,t])=>(0,H.jsxs)(`span`,{children:[e,`: `,(0,H.jsx)(`strong`,{children:t})]},e))}),(0,H.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[e.design.metric_catalog.map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`dt`,{children:[e.role,` · `,e.metric_name]}),(0,H.jsx)(`dd`,{children:WC(t,e.metric_name)})]},e.metric_name)),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Runs terminal / observed`}),(0,H.jsxs)(`dd`,{children:[t.terminal_run_count,`/`,t.run_count]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Median duration`}),(0,H.jsx)(`dd`,{children:VC(t.effort.duration_ms?.median)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Protocols`}),(0,H.jsx)(`dd`,{children:HC(t.protocol_counts)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Runner revisions`}),(0,H.jsx)(`dd`,{children:HC(t.runner_revision_counts)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Orchestrator runtimes`}),(0,H.jsxs)(`dd`,{children:[Object.keys(t.orchestrator_runtime_counts).length||0,` distinct`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Failure classes`}),(0,H.jsx)(`dd`,{children:HC(t.failure_class_counts)})]})]})]},t.arm_id))})}function YC({packet:e,primaryMetric:t,onOpenRun:n}){return(0,H.jsx)(`div`,{className:`benchmark-table-shell benchmark-wide-table`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Case`}),(0,H.jsx)(`th`,{children:`Design status`}),(0,H.jsx)(`th`,{children:`Largest eligible delta`}),e.arms.map(e=>(0,H.jsx)(`th`,{children:e.arm_id},e.arm_id))]})}),(0,H.jsx)(`tbody`,{children:e.cases.map(r=>{let i=GC(r,t);return(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`strong`,{children:r.case_id})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(KC,{tone:r.complete_declared_design?`success`:`warning`,children:r.complete_declared_design?`Complete`:`Provisional`})}),(0,H.jsx)(`td`,{className:i?.direction===`improved`?`benchmark-positive`:i?.direction===`regressed`?`benchmark-negative`:void 0,children:i?.text??`—`}),r.arms.map(r=>(0,H.jsx)(`td`,{children:r.selected_run_id&&r.score_countable?(0,H.jsxs)(`button`,{className:`benchmark-cell-link`,onClick:()=>n(r.selected_run_id),type:`button`,children:[(0,H.jsxs)(`span`,{children:[t,`: `,UC(r.metrics[t])]}),e.design.metric_catalog.filter(e=>e.metric_name!==t).map(e=>(0,H.jsxs)(`small`,{className:`benchmark-cell-metric`,children:[e.metric_name,`: `,UC(r.metrics[e.metric_name])]},e.metric_name)),(0,H.jsxs)(`small`,{children:[`Countable · `,VC(r.effort.duration_ms),` `,(0,H.jsx)(qp,{"aria-hidden":`true`,size:12})]}),r.insight&&(0,H.jsxs)(`small`,{children:[r.insight.failure_class,` · `,r.insight.confidence]})]}):(0,H.jsx)(`span`,{className:`benchmark-muted`,children:`Not countable`})},r.arm_id))]},r.case_id)})})]})})}function XC({run:e,packet:t}){return(0,H.jsxs)(`aside`,{"aria-label":`Run detail for ${e.run_id}`,className:`benchmark-run-detail`,children:[(0,H.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`benchmark-mono`,children:`RUN DETAIL`}),(0,H.jsx)(`h2`,{children:e.run_id})]}),(0,H.jsx)(KC,{tone:e.countability.score_countable?`success`:`warning`,children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]}),(0,H.jsxs)(`dl`,{className:`benchmark-stat-list benchmark-run-facts`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Case / arm`}),(0,H.jsxs)(`dd`,{children:[e.case_id,` · `,e.arm_id]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Lifecycle`}),(0,H.jsxs)(`dd`,{children:[e.status,` · `,e.observed_at]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Protocol`}),(0,H.jsx)(`dd`,{children:e.protocol_id})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Qualification`}),(0,H.jsxs)(`dd`,{children:[`Integrity `,e.countability.integrity_qualified?`qualified`:`not qualified`,` · result `,e.countability.official_result_present?`present`:`missing`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Treatment fidelity`}),(0,H.jsx)(`dd`,{children:e.treatment_fidelity})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Effort`}),(0,H.jsxs)(`dd`,{children:[VC(e.effort.duration_ms),` · `,BC(e.effort.agent_steps),` steps · `,BC(e.effort.token_count),` tokens`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Runner revision`}),(0,H.jsx)(`dd`,{children:e.runner_revision??`—`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Upload provenance`}),(0,H.jsxs)(`dd`,{children:[e.upload_provenance.producer_id,` · `,e.upload_provenance.source_revision]})]})]}),(0,H.jsx)(`div`,{className:`benchmark-run-metrics`,children:t.design.metric_catalog.map(t=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{children:t.metric_name}),(0,H.jsx)(`strong`,{children:UC(e.metrics[t.metric_name])})]},t.metric_name))}),e.redacted_insight&&(0,H.jsxs)(`div`,{className:`benchmark-insight`,children:[(0,H.jsxs)(`span`,{className:`benchmark-mono`,children:[`REDACTED CASE INSIGHT · `,e.redacted_insight.confidence]}),(0,H.jsx)(`p`,{children:e.redacted_insight.causal_summary}),(0,H.jsxs)(`small`,{children:[`Implication: `,e.redacted_insight.implication]}),(0,H.jsx)(`br`,{}),(0,H.jsxs)(`small`,{children:[`Next probe: `,e.redacted_insight.next_probe]}),!!e.redacted_insight.evidence_refs?.length&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`br`,{}),(0,H.jsxs)(`small`,{children:[`Evidence: `,e.redacted_insight.evidence_refs.join(`, `)]})]})]})]})}function ZC({packet:e,selectedRunId:t,onSelectRun:n}){let r=e.runs.find(e=>e.run_id===t)??e.runs[0];return(0,H.jsxs)(`div`,{className:`benchmark-runs-layout`,children:[(0,H.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Run`}),(0,H.jsx)(`th`,{children:`Case`}),(0,H.jsx)(`th`,{children:`Arm`}),(0,H.jsx)(`th`,{children:`Status`}),(0,H.jsx)(`th`,{children:`Countability`})]})}),(0,H.jsx)(`tbody`,{children:e.runs.map(e=>(0,H.jsxs)(`tr`,{"aria-selected":e.run_id===r?.run_id,children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`button`,{className:`benchmark-run-link`,onClick:()=>n(e.run_id),type:`button`,children:e.run_id})}),(0,H.jsx)(`td`,{children:e.case_id}),(0,H.jsx)(`td`,{children:e.arm_id}),(0,H.jsx)(`td`,{children:e.status}),(0,H.jsx)(`td`,{children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]},e.run_id))})]})}),r&&(0,H.jsx)(XC,{packet:e,run:r})]})}function QC(){let e=pw.useSearch(),t=pw.useNavigate(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(0),c=(0,V.useMemo)(()=>{let t=e.dashboardUrl||`/chat/benchmark-study.example.json`;try{return{url:LC(t,window.location.href),error:null}}catch(e){return{url:``,error:e instanceof Error?e.message:`Invalid dashboard source`}}},[e.dashboardUrl]);if((0,V.useEffect)(()=>{let e=!0;return r(null),a(null),c.error?(a(c.error),()=>{e=!1}):(fetch(c.url,{cache:`no-store`}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status} while loading the dashboard packet`);return IC(await e.json())}).then(t=>{e&&r(t)}).catch(t=>{e&&a(t instanceof Error?t.message:`Unable to load dashboard packet`)}),()=>{e=!1})},[o,c]),(0,V.useEffect)(()=>{n&&(document.title=`${n.design.labels.title??n.study_id} · LoopX Benchmark`)},[n]),i)return(0,H.jsxs)(`main`,{className:`benchmark-page benchmark-loading`,children:[(0,H.jsx)(am,{"aria-hidden":`true`}),(0,H.jsx)(`h1`,{children:`Dashboard packet unavailable`}),(0,H.jsx)(`p`,{children:i}),(0,H.jsxs)(`button`,{onClick:()=>s(e=>e+1),type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":`true`,size:16}),` Retry readback`]})]});if(!n)return(0,H.jsxs)(`main`,{"aria-busy":`true`,className:`benchmark-page benchmark-loading`,children:[(0,H.jsx)(Wp,{"aria-hidden":`true`}),(0,H.jsx)(`h1`,{children:`Reading benchmark study`}),(0,H.jsx)(`p`,{children:`Validating the public-safe dashboard packet…`})]});let l=n.design.metric_catalog.find(e=>e.role===`primary`)?.metric_name??`primary`,u=(n,r=e.runId)=>t({search:e=>({...e,view:n,runId:r})}),d=new URL(c.url).pathname;return(0,H.jsxs)(`main`,{className:`benchmark-page`,children:[(0,H.jsxs)(`header`,{className:`benchmark-hero`,children:[(0,H.jsxs)(`div`,{className:`benchmark-hero-topline`,children:[(0,H.jsx)(`a`,{className:`benchmark-wordmark`,href:`/chat/`,children:`LoopX`}),(0,H.jsxs)(`div`,{className:`benchmark-readonly`,children:[(0,H.jsx)(Gm,{"aria-hidden":`true`,size:15}),` Derived read-only projection`]})]}),(0,H.jsxs)(`div`,{className:`benchmark-hero-grid`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`p`,{className:`benchmark-kicker`,children:[`BENCHMARK STUDY / `,n.benchmark_id]}),(0,H.jsxs)(`div`,{className:`benchmark-title-row`,children:[(0,H.jsx)(`h1`,{children:n.design.labels.title??n.study_id}),(0,H.jsx)(KC,{tone:n.status===`complete`?`success`:`warning`,children:n.status})]}),(0,H.jsx)(`p`,{className:`benchmark-lead`,children:`One declared study, explicit denominators, and the same countability rules from campaign summary to exact run.`})]}),(0,H.jsxs)(`dl`,{className:`benchmark-identity`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Study`}),(0,H.jsx)(`dd`,{children:n.study_id})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Protocol`}),(0,H.jsx)(`dd`,{children:n.design.protocol_id})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Case set`}),(0,H.jsx)(`dd`,{children:n.design.case_set.case_set_id})]})]})]}),(0,H.jsxs)(`div`,{className:`benchmark-kpi-grid`,children:[(0,H.jsxs)(`article`,{children:[(0,H.jsx)(um,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Score-countable cells`}),(0,H.jsxs)(`strong`,{children:[n.campaign.selected_score_countable_cell_count,(0,H.jsxs)(`small`,{children:[` / `,n.campaign.intended_cell_denominator]})]}),(0,H.jsxs)(`p`,{children:[zC(n.campaign.selected_score_countable_coverage_rate),` declared coverage`]})]}),(0,H.jsxs)(`article`,{children:[(0,H.jsx)(om,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Complete designs`}),(0,H.jsxs)(`strong`,{children:[n.campaign.complete_declared_design_case_count,(0,H.jsxs)(`small`,{children:[` / `,n.campaign.intended_case_count]})]}),(0,H.jsx)(`p`,{children:`Cases with every declared arm`})]}),(0,H.jsxs)(`article`,{children:[(0,H.jsx)(qp,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Matched comparisons`}),(0,H.jsx)(`strong`,{children:n.campaign.matched_pair_countable_count}),(0,H.jsx)(`p`,{children:`Eligible pairs only`})]}),(0,H.jsxs)(`article`,{children:[(0,H.jsx)(Wp,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`In flight`}),(0,H.jsx)(`strong`,{children:n.campaign.in_flight_run_count}),(0,H.jsx)(`p`,{children:n.status===`provisional`?`Coverage remains provisional`:`Declared coverage complete`})]})]})]}),(0,H.jsxs)(`nav`,{"aria-label":`Benchmark dashboard views`,className:`benchmark-tabs`,children:[RC.map(t=>(0,H.jsx)(`button`,{"aria-current":e.view===t.id?`page`:void 0,onClick:()=>u(t.id),type:`button`,children:t.label},t.id)),(0,H.jsxs)(`button`,{className:`benchmark-refresh`,onClick:()=>s(e=>e+1),type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":`true`,size:14}),` Refresh local readback`]})]}),(0,H.jsxs)(`div`,{className:`benchmark-content`,children:[e.view===`campaign`&&(0,H.jsx)(qC,{packet:n,primaryMetric:l}),e.view===`arms`&&(0,H.jsx)(JC,{packet:n}),e.view===`cases`&&(0,H.jsx)(YC,{onOpenRun:e=>u(`runs`,e),packet:n,primaryMetric:l}),e.view===`runs`&&(0,H.jsx)(ZC,{onSelectRun:e=>u(`runs`,e),packet:n,selectedRunId:e.runId})]}),(0,H.jsxs)(`footer`,{className:`benchmark-footer`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Gm,{"aria-hidden":`true`,size:16}),(0,H.jsxs)(`span`,{children:[`Scores: `,n.authority.score_source]}),(0,H.jsx)(`span`,{children:`Dashboard cannot launch, grade, or mutate runs.`})]}),(0,H.jsxs)(`code`,{title:d,children:[`local`,d]})]})]})}var $C=Y({goalId:G().optional().default(``),statusUrl:G().optional().default(``)}),ew=Y({goalId:G().optional().default(``),mode:_d([`showcase`,`developer`,`ops`]).optional().default(`showcase`),statusUrl:G().optional().default(``),todoLane:_d([`all`,`user`,`agent`]).optional().default(`all`),todoQuery:G().optional().default(``)}),tw=ew.omit({mode:!0}),nw=Y({dashboardUrl:G().optional().default(``),view:_d([`campaign`,`arms`,`cases`,`runs`]).optional().default(`campaign`),runId:G().optional().default(``)});function rw(){let e=`https://huangruiteng.github.io/loopx/docs/showcases/index.en.html`;return(0,V.useEffect)(()=>{window.location.replace(e)},[]),(0,H.jsx)(`a`,{href:e,children:`Open LoopX cases / 浏览案例`})}function iw({goalId:e,statusUrl:t}){let n=t?ih(t,window.location.href):null;return n?.error?(0,H.jsx)(`main`,{role:`alert`,children:n.error}):(0,H.jsx)(ri,{replace:!0,to:`/`,search:{goalId:e,statusUrl:t}})}function aw(){let e=lw.useSearch();return e.mode===`ops`?(0,H.jsx)(iw,{...e}):e.mode===`developer`?(0,H.jsx)(ri,{replace:!0,to:`/developers/projections`}):(0,H.jsx)(rw,{})}function ow(){return(0,H.jsx)(iw,{...uw.useSearch()})}var sw=Si({component:()=>(0,H.jsx)(ji,{}),errorComponent:()=>(0,H.jsxs)(`main`,{role:`alert`,className:`p-8`,children:[(0,H.jsx)(`h1`,{children:`页面暂时无法显示 / Page unavailable`}),(0,H.jsx)(`p`,{children:`请重新加载页面;这不会执行任务。 / Reloading does not execute tasks.`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`重新加载 / Reload`})]})}),cw=bi({getParentRoute:()=>sw,path:`/`,validateSearch:e=>$C.parse(e),component:dC}),lw=bi({getParentRoute:()=>sw,path:`/frontstage`,validateSearch:e=>ew.parse(e),component:aw}),uw=bi({getParentRoute:()=>sw,path:`/deprecated/frontstage/ops`,validateSearch:e=>tw.parse(e),component:ow}),dw=bi({getParentRoute:()=>sw,path:`/frontstage/developer`,component:()=>(0,H.jsx)(ri,{replace:!0,to:`/developers/projections`})}),fw=bi({getParentRoute:()=>sw,path:`/developers/projections`,component:TC}),pw=bi({getParentRoute:()=>sw,path:`/benchmarks/study`,validateSearch:e=>nw.parse(e),component:QC}),mw=sw.addChildren([cw,lw,uw,dw,fw,pw]);function hw(e){return!e||e===`/`||e===`./`?`/`:(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``)||`/`}var gw=Ii({routeTree:mw,basepath:hw(`/chat/`),trailingSlash:`preserve`}),_w=document.getElementById(`root`);if(!_w)throw Error(`Root element not found`);var vw=new Oe({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}});(0,Bi.createRoot)(_w).render((0,H.jsx)(Me,{client:vw,children:(0,H.jsx)(Ki,{children:(0,H.jsx)(zi,{router:gw})})})); \ No newline at end of file +`),summary:D.summary,title:D.title}}]:[]],Qe=f.connectionState===`connected`,$e=new Map(w.goals.map(e=>[e.goalId,e.title])),et=e=>Wd(e,f.activeSource.statusUrl,Qe&&!l?.errors[e.goalId],$e.get(e.goalId)),tt={...vy(w),userTodos:w.userTodos.map(et),attentionHistory:(w.attentionHistory??w.userTodos).map(et),periodicReports:{error:k,loading:te},timeline:Ze};return(0,H.jsxs)(`div`,{className:p===`dark`?`dark`:``,"data-testid":`personal-goal-home`,children:[ye?(0,H.jsx)(`p`,{role:`status`,className:`m-0 bg-amber-50 px-4 py-2 text-sm text-amber-900`,children:_(ye===`partial`?`runs.discoveryPartial`:`runs.discoveryOffline`)}):null,(0,H.jsx)(qx,{agents:P.map(e=>({adapterKind:e.adapterKind,agentId:e.agentId,available:e.available,capability:e.capability,interrupt:e.interrupt,label:e.label,location:e.location,resume:e.resume,source:e.source,streaming:e.streaming,toolCalls:e.toolCalls,trustScope:e.trustScope,workspaceCompatibility:e.available?`当前 Goal 写入前验证`:`不可用,需先修复 Endpoint`})),callbacks:{onApplyAttention:e=>Xe(e.goalId),onCorrectRun:async(e,t)=>{if(!e.sessionId)throw Error(`这个 Run 还没有可纠偏的执行 Session。`);let n=await Ph((await jh({actionKind:`run.correct`,context:{kind:`run`,goal_id:e.goalId,todo_id:e.todoId},idempotencyKey:`workspace-run-correct-${e.sessionId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,message:t,session_id:e.sessionId},summary:`纠偏执行任务:${e.title}`})).proposal_id),r=typeof n.turn?.turn_id==`string`?n.turn.turn_id:void 0;if(Be(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:r?`running`:`ready`,turnId:r}),r){Ee.current.set(e.goalId,r);let t=new AbortController;De.current.set(e.goalId,t);let n=``,i=Ve(e.goalId,{activity:[`正在把纠偏送入原执行 Session`],agentLabel:e.agentLabel,lines:[],pending:!0,sourceLabel:`${e.agentLabel} · 执行 Session`,text:``});try{let a=await Zh(e.sessionId,r,{signal:t.signal,onDelta:t=>{n+=t,He(e.goalId,i,{text:n})}});He(e.goalId,i,{activity:[],pending:!1,text:PS(a.response.message||n.trim())||`${e.agentLabel} 已完成纠偏。`})}catch(t){let n=Oe.current.delete(e.goalId);He(e.goalId,i,{activity:[],pending:!1,text:n?`已中断。你可以在当前会话继续发送消息。`:t instanceof Error?t.message:`纠偏回合失败。`})}finally{Ee.current.delete(e.goalId),De.current.delete(e.goalId),Be(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:`ready`})}}},onCloseRunSession:qe,onInterruptRun:async e=>We(e),onOpenGoal:Xe,onOpenRunSession:async e=>{if(!e.sessionId)return;let t=e.sessionId,n=await Vh(t);Se(e=>({...e,[t]:n})),Xe(e.goalId),z(t=>({...t,[e.goalId]:n.messages.map(t=>({agentLabel:t.role===`user`?void 0:e.agentLabel,attachments:kS(t.attachments),id:Ce.current++,lines:[],role:t.role===`user`?`user`:`assistant`,sourceLabel:t.role===`user`?void 0:`${e.agentLabel} · 执行 Session`,text:t.role===`user`?t.text:PS(t.text)}))})),Be(e.goalId,{agentId:e.agentId,resumable:n.session.resumable,sessionId:t,status:n.session.active_turn_id?`running`:n.session.status,turnId:n.session.active_turn_id??void 0})},onOpenOutput:e=>Xe(e.goalId),...b?{onPreviewGoalSubagentConfiguration:async e=>{let t=await ng(e);return{changed:t.changed,configuration:{allowedDomains:t.after.orchestration.allowed_domains,enabled:t.feature_summary.multi_subagent===`enabled`,maxChildren:t.after.orchestration.max_children,modelConfig:t.after.orchestration.model_config},previewId:t.preview_id}},onApplyGoalSubagentConfiguration:async({previewId:e,...t})=>{let n=await rg(t,e);return{allowedDomains:n.after.orchestration.allowed_domains,enabled:n.feature_summary.multi_subagent===`enabled`,maxChildren:n.after.orchestration.max_children,modelConfig:n.after.orchestration.model_config}}}:{},...g?{onExecuteGoalLifecycle:async({goalId:e,operation:t,reason:n})=>{let r=await Cb(g,e,t,n);return{activationState:r.activation_state,projectionVerified:r.projection_verified}}}:{},onGoalActivationStateChange:n,onGoalDeleted:r,onReconcileStatus:a,onRetryGoalArchive:s,onExportOutput:async e=>{let t=[`# ${e.title}`,``,e.summary??``,``,e.safePreview??`此产出没有可用的公开安全预览。`,``,`Goal: ${e.goalId}`,`Todo: ${e.todoId??`unlinked`}`,`Run: ${e.runId??`unlinked`}`].join(` +`),n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),r=document.createElement(`a`);r.href=n,r.download=`${e.outputId.replace(/[^a-z0-9._-]+/gi,`-`)}.md`,r.click(),URL.revokeObjectURL(n)},onRefresh:o,onRetryResumeRun:Ge,onSelectAgent:Je,onSelectGoal:e=>e?Xe(e):Ye(),onSendMessage:async(e,t,n,r)=>Ue(e,{agentId:t,goalId:n,attachments:r}),onStartNewRunSession:Ke},goalArchiveLoadState:e,managerRuntime:S,model:tt,readOnly:h,selectedAgentId:I.agentId,selectedGoalId:T?.goalId??null,statusSourceControl:f})]})}function dC({error:e,isLoading:t,onRetry:n,requestedUrl:r,theme:i,toggleTheme:a}){let o=!!(e&&/failed to fetch|networkerror|load failed/i.test(e)&&r.includes(`status.json`));return(0,H.jsx)(`div`,{className:i===`dark`?`dark`:``,children:(0,H.jsxs)(`main`,{className:`min-h-screen bg-[#f6f7f9] text-slate-950 dark:bg-[#09090b] dark:text-zinc-50`,children:[(0,H.jsxs)(`header`,{className:`flex min-h-16 flex-wrap items-center justify-between gap-3 border-b border-slate-200 bg-white px-4 py-3 dark:border-zinc-800 dark:bg-zinc-950 sm:px-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold`,children:`LoopX Workspace`}),(0,H.jsx)(`p`,{className:`mt-1 break-all text-sm text-slate-500 dark:text-zinc-400`,children:`Personal Workspace`})]}),(0,H.jsx)(iy,{"aria-label":`切换主题`,onClick:a,size:`icon`,variant:`secondary`,children:i===`dark`?(0,H.jsx)(Ym,{className:`h-4 w-4`}):(0,H.jsx)(Am,{className:`h-4 w-4`})})]}),(0,H.jsxs)(`div`,{className:`grid min-h-[calc(100vh-80px)] sm:grid-cols-[240px_1fr]`,children:[(0,H.jsxs)(`aside`,{className:`hidden border-r border-slate-200 p-6 dark:border-zinc-800 sm:block`,"aria-label":`Workspace`,children:[(0,H.jsx)(`strong`,{children:`LoopX`}),(0,H.jsx)(`p`,{className:`mt-6 text-sm`,children:`Workspace`}),(0,H.jsx)(`p`,{className:`mt-8 text-xs text-slate-500`,children:`Goals`}),[1,2,3].map(e=>(0,H.jsx)(`div`,{className:`mt-4 h-8 rounded bg-slate-100 dark:bg-zinc-900`},e))]}),(0,H.jsx)(`div`,{className:`p-4 sm:p-8`,children:(0,H.jsx)(ay,{"data-testid":`initial-status-state`,children:(0,H.jsx)(oy,{className:`flex min-h-64 items-center justify-center p-6`,children:(0,H.jsxs)(`div`,{className:`max-w-xl text-center`,children:[e?(0,H.jsx)(am,{className:`mx-auto h-6 w-6 text-rose-600 dark:text-rose-300`}):(0,H.jsx)(Lm,{className:`mx-auto h-6 w-6 animate-spin text-slate-500 dark:text-zinc-400`}),(0,H.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e?`无法加载实时状态`:`正在加载实时状态`}),e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`mt-2 break-words text-sm leading-6 text-slate-500 dark:text-zinc-400`,children:o?`本地状态服务暂时未连接。升级或启动期间可能短暂断开,请重试;仍失败时重新打开 LoopX App,或运行 loopx doctor。`:e}),o?(0,H.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-slate-400 dark:text-zinc-500`,children:`重新加载不会执行任务,也不会改变 Goal 配置。`}):null,(0,H.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:(0,H.jsxs)(iy,{disabled:t,onClick:n,children:[(0,H.jsx)(Lm,{className:`h-4 w-4`}),`重试`]})})]}):(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-500 dark:text-zinc-400`,role:`status`,children:`正在连接 Workspace,Goal 列表将先出现,详细状态会逐个补齐。 / Connecting to your Workspace. Goals load independently.`})]})})})})]})]})})}function fC(){let e=lw.useSearch(),t=lw.useNavigate(),[n,r]=(0,V.useState)(`light`),[i,a]=(0,V.useState)(null),o=(0,V.useRef)(null),s=(0,V.useRef)(e.goalId);s.current=e.goalId;let[c,l]=(0,V.useState)(Op),[u,d]=(0,V.useState)({kind:`example`,label:`bundled example`}),[f,p]=(0,V.useState)(()=>oS(window.localStorage,window.location.href)),m=(0,V.useRef)(f);m.current=f;let[h,g]=(0,V.useState)(e.statusUrl),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)({error:null,phase:`idle`}),[C,w]=(0,V.useState)(e.statusUrl.trim()||null),[T,E]=(0,V.useState)(!1),D=(0,V.useRef)(null),O=(0,V.useRef)(Zg(e.statusUrl.trim()||null)),k=!T&&u.kind===`example`?e.statusUrl.trim():``,ee=C??k,te=u.kind===`url`?u.label:gS,A=!!(_&&C),j=pS(f,C,te,window.location.href),M=u.kind===`example`&&!T,N=c.attention_queue,P=c.run_history,F=(0,V.useMemo)(()=>yS(P.goals,N.items),[P.goals,N.items]);function ne(e,t,n=0){S({error:null,phase:`loading`}),_S(oh(e,`stopped`,window.location.href)).then(r=>{if(!t_(O.current,t))return;let i=r.goal_projection?.registry_revision??null,a=t.registryRevision!==null&&t.registryRevision!==void 0&&i!==null&&t.registryRevision!==i;if(l(e=>w_(e,r)),a&&n<1){L(e,{background:!0,resyncAttempt:n+1});return}S(a?{error:`Goal 状态在加载历史时发生变化,请重试。`,phase:`error`}:{error:null,phase:`ready`})}).catch(e=>{t_(O.current,t)&&S({error:Dp(e),phase:`error`})})}function re(){let e=u.kind===`url`?u.label:h||gS,t=$g(O.current,e,{background:!0});if(i){L(e);return}t&&ne(e,t)}async function I(e,n,r){if(r.background)return l(e=>w_(e,n)),!0;let i={kind:`url`,label:e};return O.current.loadedUrl=e,l(n),d(i),g(e),await t({search:t=>({...t,statusUrl:e})}),e_(O.current,r)?(O.current.requestedUrl=null,w(null),!0):!1}async function L(e,t={}){let n=e.trim(),r=t.background===!0;if(!n){r||v(`状态地址不能为空`);return}let c=$g(O.current,n,{background:r,selectionRevision:t.selectionRevision});if(!c)return;o.current?.abort();let d=new AbortController;o.current=d,r||(D.current=null,E(!1),w(n),b(!0),v(null),S({error:null,phase:`idle`}));try{let e=await jp(n,window.location.href).catch(()=>null);if(!t_(O.current,c))return;if(e){let o=t.retryOnly&&u.kind===`url`&&u.label===n&&i?.directory.registry_revision===e.registry_revision?i.snapshots:{};a({directory:e,snapshots:o,errors:{}});let f={...e,goals:e.goals.filter(e=>!o[e.id])},p=!1,m=Mp(e);if(r)l(m);else if(!await I(n,m,c))return;if(S({error:null,phase:`loading`}),await Pp(n,window.location.href,f,(e,t,n)=>{n===`revision`&&(p=!0),a(r=>r&&{...r,snapshots:t?{...r.snapshots,[e]:t}:r.snapshots,errors:n?{...r.errors,[e]:n}:r.errors})},()=>t_(O.current,c),()=>s.current,d.signal),p&&(t.resyncAttempt??0)<1&&t_(O.current,c)){await L(n,{resyncAttempt:1});return}t_(O.current,c)&&S({error:null,phase:`ready`});return}let o=await _S(oh(n,`active`,window.location.href));if(!t_(O.current,c)||(a(null),c.registryRevision=o.goal_projection?.registry_revision??null,!await I(n,o,c)))return;if(o.goal_projection?.scope!==`active`||o.goal_projection.complete){S({error:null,phase:`ready`});return}ne(n,c,t.resyncAttempt??0)}catch(e){if(!e_(O.current,c))return;r||v(Dp(e))}finally{!r&&e_(O.current,c)&&b(!1)}}function ie(e,t={}){o.current?.abort();let n=Qg(O.current,e.statusUrl);D.current=null,E(!1),w(e.statusUrl),b(!0),v(null),(async()=>{if(t.ensureTunnel&&e.kind===`ssh_tunnel`){let t=new URL(e.statusUrl,window.location.href).port;if(t)try{await Sb(e.label,t)}catch{}}O.current.selectionRevision===n&&await L(e.statusUrl,{selectionRevision:n})})()}function R(e){m.current=e,p(e);try{sS(window.localStorage,e)}catch{}}let ae={activeSource:j,connectionState:y?`loading`:A?`error`:`connected`,errorMessage:A?`未切换到 ${C??`所选来源`}:${_}`:null,onAdd:e=>{let t=lS(f,e,window.location.href);return`error`in t?{error:t.error}:(R(t.catalog),ie(t.source,{ensureTunnel:e.ensureTunnel}),{})},onConfiguredHostsLoaded:e=>{let t=m.current,n=cS(t,e);n!==t&&R(n)},onRemove:e=>{R(uS(f,e)),j.id===e&&ie(tS)},onSelect:e=>{let t=f.sources.find(t=>t.id===e);t&&ie(t,{ensureTunnel:t.kind===`ssh_tunnel`})},sources:j.id===`temporary`?[...f.sources,j]:f.sources};(0,V.useEffect)(()=>{let t=e.statusUrl.trim();if(t){if(D.current===t||C&&C!==t)return;(u.kind!==`url`||u.label!==t)&&L(t);return}D.current=null,!T&&(C||u.kind===`example`&&L(gS))},[T,C,e.statusUrl,u.kind,u.label]),(0,V.useEffect)(()=>{if(e.statusUrl&&u.kind===`example`)return;let n=new Set(F.map(e=>e.goal.id));if(F.length===0){e.goalId&&t({search:e=>({...e,goalId:``})});return}e.goalId&&!n.has(e.goalId)&&x.phase!==`loading`&&t({search:e=>({...e,goalId:``})})},[x.phase,F,t,e.goalId,e.statusUrl,u.kind]),(0,V.useEffect)(()=>{if(!i||y||!e.goalId||u.kind!==`url`)return;let t=i.directory.goals.find(t=>t.id===e.goalId);t?.activation_state===`stopped`&&!i.snapshots[t.id]&&!i.errors[t.id]&&L(u.label,{retryOnly:!0})},[e.goalId,y,i,u]);function oe(e){t({search:t=>({...t,goalId:e})})}return M?(0,H.jsx)(dC,{error:_,isLoading:y,onRetry:()=>void L(ee||gS),requestedUrl:ee||gS,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)}):(0,H.jsx)(uC,{goalArchiveLoadState:x,isLoading:y,onGoalActivationStateChange:(e,t)=>{O.current.projectionRevision+=1,l(n=>wp(n,e,t)),a(n=>n&&{...n,snapshots:Object.fromEntries(Object.entries(n.snapshots).map(([n,r])=>[n,wp(r,e,t)]))})},onGoalDeleted:e=>{O.current.projectionRevision+=1,l(t=>Tp(t,e)),a(t=>t&&{...t,snapshots:Object.fromEntries(Object.entries(t.snapshots).filter(([t])=>t!==e))})},onSelectGoal:oe,onReconcileStatus:()=>L(u.kind===`url`?u.label:h||gS,{background:!0}),onRetryGoalArchive:re,onRefresh:()=>L(u.kind===`url`?u.label:h||gS,{retryOnly:!!(i&&Object.keys(i.errors).length)}),payload:c,progress:i,rows:F,selectedGoalId:e.goalId,statusSourceControl:ae,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)})}var pC=k_(`inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium`,{variants:{variant:{neutral:`border-slate-200 bg-white text-slate-700 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-300`,success:`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-200`,warning:`border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200`,info:`border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-900 dark:bg-sky-950 dark:text-sky-200`,danger:`border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-900 dark:bg-rose-950 dark:text-rose-200`}},defaultVariants:{variant:`neutral`}});function mC({className:e,variant:t,...n}){return(0,H.jsx)(`span`,{className:ny(pC({variant:t}),e),...n})}var hC=[{label:`status payload`,source:`apps/presentation/dashboard/src/data/status.ts`,detail:`status_contract, attention_queue, local_dashboard_api, run_history`},{label:`channel projection`,source:`apps/presentation/dashboard/src/data/goal-channel-frontstage.ts`,detail:`decision_frame, todos, gates, leases, artifacts, truth_contract`},{label:`public showcase catalog`,source:`docs/showcases/showcase-catalog.json`,detail:`case metadata, visual hints, evidence boundaries, story beats`},{label:`route smoke`,source:`apps/presentation/dashboard/smoke/frontstage-route-smoke.ts`,detail:`static route contract, source guards, component expectations`}],gC=[{axis:`schema`,current:`goal_channel_projection_v0`,proposed:`new optional projection field`,gate:`parser default plus route smoke assertion`},{axis:`truth`,current:`event ledger and active state remain source of truth`,proposed:`derived UI state only`,gate:`truth_contract must stay read-only`},{axis:`privacy`,current:`compact source refs and warnings`,proposed:`public-safe fixture field`,gate:`loopx check and browser fake-private fixture`},{axis:`interaction`,current:`render, filter, select, inspect`,proposed:`no browser write by default`,gate:`write affordance requires explicit loopback capability`}],_C=[{title:`Fixture sources`,body:`Use examples/status.example.json, browser-smoke fixtures, and docs/showcases/showcase-catalog.json.`},{title:`Required proof`,body:`Every projection addition needs parser coverage, route smoke assertions, and one browser or bundle check when UI output changes.`},{title:`Never include`,body:`Raw task text, trajectories, transcripts, local paths, private registry state, credentials, or internal document links.`}],vC=[`npm --prefix apps/presentation/dashboard run smoke:frontstage-route`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-browser`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-share-bundle`,`npm --prefix apps/presentation/dashboard run build`,`loopx check --scan-path apps/presentation/dashboard --scan-path docs/status-data-contract.md`],yC=[{name:`Projection lane`,badges:[`read-only`,`schema v0`],body:`Summarizes one compact projection lane without mutating the underlying LoopX state.`},{name:`Capability badge`,badges:[`loopback`,`dry-run`],body:`Shows an advertised local capability only after the status feed declares it.`},{name:`Boundary warning`,badges:[`public-safe`,`omitted`],body:`Names omitted private material and points contributors back to compact source references.`}];function bC({children:e,icon:t,title:n}){return(0,H.jsxs)(`section`,{className:`rounded-lg border border-slate-200 bg-white shadow-sm`,children:[(0,H.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,H.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,H.jsx)(t,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function xC(){return(0,H.jsx)(bC,{icon:$p,title:`Status Contract Explorer`,children:(0,H.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,"data-testid":`developer-contract-explorer`,children:hC.map(e=>(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(mC,{variant:`info`,children:e.label}),(0,H.jsx)(mC,{variant:`neutral`,children:`public contract`})]}),(0,H.jsx)(`div`,{className:`mt-2 break-words font-mono text-xs text-slate-700`,children:e.source}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.detail})]},e.label))})})}function SC(){return(0,H.jsx)(bC,{icon:ym,title:`Projection Diffing`,children:(0,H.jsx)(`div`,{className:`overflow-x-auto`,"data-testid":`developer-projection-diffing`,children:(0,H.jsxs)(`table`,{className:`min-w-full border-separate border-spacing-0 text-left text-sm`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{className:`bg-slate-50 text-xs uppercase tracking-normal text-slate-500`,children:[(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Axis`}),(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Current`}),(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Proposed`}),(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Gate`})]})}),(0,H.jsx)(`tbody`,{children:gC.map(e=>(0,H.jsxs)(`tr`,{className:`align-top`,children:[(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 font-semibold text-slate-950`,children:e.axis}),(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.current}),(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.proposed}),(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.gate})]},e.axis))})]})})})}function CC(){return(0,H.jsx)(bC,{icon:hm,title:`Fixture Generation`,children:(0,H.jsx)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-fixture-generation`,children:_C.map(e=>(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:e.title}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.title))})})}function wC(){return(0,H.jsx)(bC,{icon:sm,title:`Smoke Checklist`,children:(0,H.jsx)(`div`,{className:`space-y-2 p-4`,"data-testid":`developer-smoke-checklist`,children:vC.map(e=>(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,H.jsx)(Xp,{className:`mt-0.5 h-4 w-4 shrink-0 text-emerald-600`}),(0,H.jsx)(`code`,{className:`break-all text-xs font-semibold leading-5 text-slate-700`,children:e})]},e))})})}function TC(){return(0,H.jsx)(bC,{icon:cm,title:`Component Examples`,children:(0,H.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-3`,"data-testid":`developer-component-examples`,children:yC.map(e=>(0,H.jsxs)(`article`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.badges.map(e=>(0,H.jsx)(mC,{variant:e===`read-only`||e===`public-safe`?`success`:`neutral`,children:e},e))}),(0,H.jsx)(`h3`,{className:`mt-3 text-sm font-semibold leading-6 text-slate-950`,children:e.name}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.name))})})}function EC(){return(0,H.jsx)(`main`,{className:`min-h-screen bg-[#f7f7f4] px-4 py-4 text-slate-950 sm:px-5`,"data-testid":`frontstage-developer-cockpit`,children:(0,H.jsxs)(`div`,{className:`mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,H.jsxs)(`aside`,{className:`rounded-lg border border-slate-200 bg-white p-4 shadow-sm xl:sticky xl:top-4 xl:self-start`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md border border-slate-200 bg-slate-950 text-white`,children:(0,H.jsx)(Xm,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:`Developer Cockpit`}),(0,H.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Projection extension`})]})]}),(0,H.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,H.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://huangruiteng.github.io/loopx/`,children:[(0,H.jsx)(Sm,{className:`h-4 w-4`}),`LoopX home`]}),(0,H.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://huangruiteng.github.io/loopx/docs/showcases/index.en.html`,children:[(0,H.jsx)(pm,{className:`h-4 w-4`}),`Public cases`]}),(0,H.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md bg-slate-950 px-3 py-2 text-sm font-medium text-white`,href:`/chat/developers/projections/`,children:[(0,H.jsx)(cm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,H.jsxs)(`div`,{className:`mt-5 space-y-2 rounded-md border border-emerald-200 bg-emerald-50 p-3 text-xs leading-5 text-emerald-950`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(mC,{variant:`success`,children:`read-only`}),(0,H.jsx)(mC,{variant:`neutral`,children:`public fixtures`})]}),(0,H.jsx)(`p`,{children:`This route uses static public contracts only; live status feeds, registry files, and browser write APIs stay outside the cockpit.`})]})]}),(0,H.jsxs)(`section`,{className:`space-y-4`,children:[(0,H.jsx)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(mC,{variant:`info`,children:`developers/projections`}),(0,H.jsx)(mC,{variant:`success`,children:`public-safe`}),(0,H.jsx)(mC,{variant:`neutral`,children:`no browser writes`})]}),(0,H.jsx)(`h1`,{className:`mt-3 text-3xl font-semibold tracking-normal text-slate-950`,children:`LoopX Projection Developer Cockpit`}),(0,H.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-slate-600`,children:`A read-only contributor workbench for adding dashboard/frontstage projections without reverse-engineering the large operator page.`})]}),(0,H.jsxs)(`div`,{className:`grid min-w-[260px] gap-2 text-sm`,children:[(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Source of truth`}),(0,H.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`status contract + compact fixtures`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Boundary`}),(0,H.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`read-only extension surface`})]})]})]})}),(0,H.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,H.jsx)(xC,{}),(0,H.jsx)(SC,{})]}),(0,H.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,H.jsx)(CC,{}),(0,H.jsx)(wC,{})]}),(0,H.jsx)(TC,{}),(0,H.jsx)(bC,{icon:Gm,title:`Extension Boundary`,children:(0,H.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-extension-boundary`,children:[(0,H.jsxs)(`div`,{className:`rounded-md border border-emerald-200 bg-emerald-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Allowed`}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Versioned parser defaults, public fixtures, read-only route panels, and focused smoke assertions.`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Review`}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`New dashboard dependencies, status contract fields, loopback capability display, and browser-visible workflows.`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-rose-200 bg-rose-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Stop`}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Credentials, private registry material, raw logs, transcripts, production actions, or default browser write authority.`})]})]})})]})]})})}var DC=Y({value:K().finite(),total:K().finite().positive().optional(),unit:G().optional(),higher_is_better:q()}).passthrough(),OC=hd(G(),K().finite()).default({}),kC=Y({outcome_status:G().optional(),failure_class:G(),causal_summary:G(),expectedness:G(),implication:G(),next_probe:G(),confidence:G(),evidence_refs:J(G()).optional()}).passthrough(),AC=Y({arm_id:G(),selected_run_id:G().nullable(),score_countable:q(),metrics:hd(G(),DC),effort:OC,insight:kC.nullable().optional()}),jC=Y({run_id:G(),case_id:G(),arm_id:G(),arm_role:G(),status:G(),protocol_id:G(),runner_revision:G().optional(),observed_at:G(),metrics:hd(G(),DC),countability:Y({integrity_qualified:q(),official_result_present:q(),score_countable:q()}).passthrough(),treatment_fidelity:G(),effort:OC,redacted_insight:kC.nullable().optional(),upload_provenance:Y({producer_id:G(),producer_version:G(),observed_at:G(),source_revision:G()}).passthrough()}).passthrough(),MC=Y({case_denominator:K().int().nonnegative(),value_sum:K().finite(),value_mean:K().finite().nullable(),value_median:K().finite().nullable(),value_min:K().finite().nullable(),value_max:K().finite().nullable(),case_macro_rate:K().finite().optional(),suite_micro_rate:K().finite().optional(),suite_micro_numerator:K().finite().optional(),suite_micro_denominator:K().finite().positive().optional()}).passthrough(),NC=Y({arm_id:G(),arm_role:G(),factor_assignments:hd(G(),G()),protocol_counts:hd(G(),K().int().nonnegative()).default({}),runner_revision_counts:hd(G(),K().int().nonnegative()).default({}),orchestrator_runtime_counts:hd(G(),K().int().nonnegative()).default({}),intended_case_count:K().int().positive(),run_count:K().int().nonnegative(),terminal_run_count:K().int().nonnegative(),selected_score_countable_case_count:K().int().nonnegative(),coverage_rate:K().finite().min(0).max(1),metrics:hd(G(),MC),binary_outcomes:hd(G(),Y({success_count:K().int().nonnegative(),case_denominator:K().int().nonnegative(),success_rate:K().finite().min(0).max(1).nullable()})),effort:hd(G(),Y({denominator:K().int().nonnegative(),mean:K().finite().nullable(),median:K().finite().nullable()})),failure_class_counts:hd(G(),K().int().nonnegative())}).passthrough(),PC=Y({baseline_value:K().finite(),candidate_value:K().finite(),delta:K().finite(),direction:_d([`improved`,`flat`,`regressed`]).optional()}).passthrough(),FC=Y({comparison_id:G(),comparison_anchor_run_id:G(),candidate_run_id:G(),candidate_arm_id:G(),primary_metric:G(),matched_pair_countable:X(!0),metric_deltas:hd(G(),PC)}).passthrough(),IC=Y({ok:X(!0),schema_version:X(`benchmark_study_dashboard_v0`),benchmark_id:G(),study_id:G(),status:_d([`complete`,`provisional`]),design:Y({protocol_id:G(),comparison_protocol_id:G(),baseline_arm_id:G(),case_set:Y({case_set_id:G(),case_ids:J(G())}),metric_catalog:J(Y({metric_name:G(),role:_d([`primary`,`guardrail`,`supporting`]),unit:G().optional(),higher_is_better:q(),binary:q()})),labels:hd(G(),G())}).passthrough(),campaign:Y({intended_case_count:K().int().positive(),intended_arm_count:K().int().positive(),intended_cell_denominator:K().int().positive(),selected_score_countable_cell_count:K().int().nonnegative(),selected_score_countable_coverage_rate:K().finite().min(0).max(1),complete_declared_design_case_count:K().int().nonnegative(),ambiguous_score_countable_cell_count:K().int().nonnegative(),in_flight_run_count:K().int().nonnegative(),matched_pair_countable_count:K().int().nonnegative(),factorial_contrast_count:K().int().nonnegative(),factorial_contrast_countable_count:K().int().nonnegative(),runtime_observation_count:K().int().nonnegative(),runtime_classification_counts:hd(G(),K().int().nonnegative())}),arms:J(NC),contrasts:hd(G(),Y({matched_pair_denominator:K().int().nonnegative(),primary_metric_directions:Y({improved:K().int().nonnegative(),flat:K().int().nonnegative(),regressed:K().int().nonnegative()}),binary_metric_transitions:hd(G(),Y({"0_to_1":K().int().nonnegative(),"1_to_0":K().int().nonnegative(),same:K().int().nonnegative()}))})),cases:J(Y({case_id:G(),complete_declared_design:q(),arms:J(AC),eligible_comparisons:J(FC),largest_eligible_primary_contrast:FC.nullable()})),runs:J(jC),authority:Y({score_source:G(),matched_comparison_source:G(),factorial_comparison_source:G().nullable(),manifest_changes_scores:X(!1),dashboard_is_execution_authority:X(!1)}),public_boundary:Y({raw_task_recorded:X(!1),raw_trajectory_recorded:X(!1),hidden_evaluation_recorded:X(!1),raw_verifier_output_recorded:X(!1),credentials_recorded:X(!1),local_paths_recorded:X(!1)}),write_performed:X(!1),network_access_performed:X(!1)});function LC(e){return IC.parse(e)}function RC(e,t){let n=new URL(t),r=new URL(e||`/benchmark-study.example.json`,n);if(!new Set([`http:`,`https:`]).has(r.protocol))throw Error(`Benchmark dashboard source must use HTTP or HTTPS`);if(r.origin!==n.origin)throw Error(`Benchmark dashboard source must use same-origin local readback`);return r.toString()}var zC=[{id:`campaign`,label:`Campaign`},{id:`arms`,label:`Arms`},{id:`cases`,label:`Cases`},{id:`runs`,label:`Runs`}];function BC(e){return e==null?`—`:`${(e*100).toFixed(e>=.995?0:1)}%`}function VC(e){return e==null?`—`:new Intl.NumberFormat(`en`,{maximumFractionDigits:2,notation:`compact`}).format(e)}function HC(e){if(e==null)return`—`;let t=e/6e4;return t>=120?`${(t/60).toFixed(1)} h`:`${VC(t)} min`}function UC(e){let t=Object.entries(e);return t.length?t.map(([e,t])=>`${e} (${t})`).join(`, `):`—`}function WC(e){if(!e)return`—`;let t=e.total==null?VC(e.value):`${VC(e.value)}/${VC(e.total)}`;return e.unit?`${t} ${e.unit}`:t}function GC(e,t){let n=e.metrics[t];return!n||n.case_denominator===0?`—`:n.suite_micro_rate==null?`${VC(n.value_mean)} mean`:`${BC(n.suite_micro_rate)} · ${VC(n.suite_micro_numerator)}/${VC(n.suite_micro_denominator)}`}function KC(e,t){let n=e.largest_eligible_primary_contrast,r=n?.metric_deltas[t];if(!n||!r)return null;let i=r.delta>0?`+`:``;return{direction:r.direction,text:`${n.candidate_arm_id}: ${i}${VC(r.delta)}`}}function qC({children:e,tone:t=`neutral`}){return(0,H.jsx)(`span`,{className:`benchmark-state benchmark-state-${t}`,children:e})}function JC({packet:e,primaryMetric:t}){return(0,H.jsxs)(`div`,{className:`benchmark-view-stack`,children:[(0,H.jsxs)(`section`,{"aria-labelledby":`arm-summary-title`,children:[(0,H.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`benchmark-kicker`,children:`ARM SUMMARY`}),(0,H.jsx)(`h2`,{id:`arm-summary-title`,children:`Comparable outcomes, denominator first`})]}),(0,H.jsx)(`p`,{children:`Only one score-countable run per declared case × arm cell is selected.`})]}),(0,H.jsx)(`div`,{className:`benchmark-arm-grid`,children:e.arms.map(e=>{let n=Object.values(e.binary_outcomes)[0];return(0,H.jsxs)(`article`,{className:`benchmark-arm-card`,children:[(0,H.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`benchmark-mono`,children:e.arm_role}),(0,H.jsx)(`h3`,{children:e.arm_id})]}),(0,H.jsx)(qC,{tone:e.coverage_rate===1?`success`:`warning`,children:e.coverage_rate===1?`Complete`:`Provisional`})]}),(0,H.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`dt`,{children:[`Primary · `,t]}),(0,H.jsx)(`dd`,{children:GC(e,t)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Score-countable coverage`}),(0,H.jsxs)(`dd`,{children:[e.selected_score_countable_case_count,`/`,e.intended_case_count]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Binary success`}),(0,H.jsx)(`dd`,{children:n?`${n.success_count}/${n.case_denominator}`:`Not declared`})]})]})]},e.arm_id)})})]}),(0,H.jsxs)(`section`,{"aria-labelledby":`contrast-title`,children:[(0,H.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`benchmark-kicker`,children:`MATCHED CONTRASTS`}),(0,H.jsx)(`h2`,{id:`contrast-title`,children:`Direction counts on eligible pairs`})]}),(0,H.jsx)(`p`,{children:`Raw run volume is never used as a comparison denominator.`})]}),(0,H.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Candidate arm`}),(0,H.jsx)(`th`,{children:`Matched denominator`}),(0,H.jsx)(`th`,{children:`Improved`}),(0,H.jsx)(`th`,{children:`Flat`}),(0,H.jsx)(`th`,{children:`Regressed`}),(0,H.jsx)(`th`,{children:`Binary transitions`})]})}),(0,H.jsxs)(`tbody`,{children:[Object.entries(e.contrasts).map(([e,t])=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`strong`,{children:e})}),(0,H.jsx)(`td`,{children:t.matched_pair_denominator}),(0,H.jsx)(`td`,{className:`benchmark-positive`,children:t.primary_metric_directions.improved}),(0,H.jsx)(`td`,{children:t.primary_metric_directions.flat}),(0,H.jsx)(`td`,{className:`benchmark-negative`,children:t.primary_metric_directions.regressed}),(0,H.jsx)(`td`,{children:Object.entries(t.binary_metric_transitions).map(([e,t])=>`${e}: 0→1 ${t[`0_to_1`]}, 1→0 ${t[`1_to_0`]}, same ${t.same}`).join(` · `)||`—`})]},e)),Object.keys(e.contrasts).length===0&&(0,H.jsx)(`tr`,{children:(0,H.jsx)(`td`,{colSpan:6,children:`No matched comparisons are countable yet.`})})]})]})})]}),(0,H.jsxs)(`section`,{"aria-labelledby":`runtime-health-title`,children:[(0,H.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`benchmark-kicker`,children:`RUNTIME HEALTH`}),(0,H.jsx)(`h2`,{id:`runtime-health-title`,children:`Qualified observations, without execution authority`})]}),(0,H.jsxs)(`p`,{children:[e.campaign.runtime_observation_count,` public-safe runtime observations.`]})]}),(0,H.jsxs)(`div`,{className:`benchmark-runtime-list`,children:[Object.entries(e.campaign.runtime_classification_counts).map(([e,t])=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{children:e}),(0,H.jsx)(`strong`,{children:t})]},e)),e.campaign.runtime_observation_count===0&&(0,H.jsx)(`p`,{className:`benchmark-muted`,children:`No runtime observations uploaded.`})]})]})]})}function YC({packet:e}){return(0,H.jsx)(`div`,{className:`benchmark-detail-grid`,children:e.arms.map(t=>(0,H.jsxs)(`article`,{className:`benchmark-detail-card`,children:[(0,H.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`benchmark-mono`,children:t.arm_role}),(0,H.jsx)(`h2`,{children:t.arm_id})]}),(0,H.jsxs)(qC,{tone:t.coverage_rate===1?`success`:`warning`,children:[t.selected_score_countable_case_count,`/`,t.intended_case_count,` countable`]})]}),(0,H.jsx)(`div`,{className:`benchmark-factor-row`,children:Object.entries(t.factor_assignments).map(([e,t])=>(0,H.jsxs)(`span`,{children:[e,`: `,(0,H.jsx)(`strong`,{children:t})]},e))}),(0,H.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[e.design.metric_catalog.map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`dt`,{children:[e.role,` · `,e.metric_name]}),(0,H.jsx)(`dd`,{children:GC(t,e.metric_name)})]},e.metric_name)),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Runs terminal / observed`}),(0,H.jsxs)(`dd`,{children:[t.terminal_run_count,`/`,t.run_count]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Median duration`}),(0,H.jsx)(`dd`,{children:HC(t.effort.duration_ms?.median)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Protocols`}),(0,H.jsx)(`dd`,{children:UC(t.protocol_counts)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Runner revisions`}),(0,H.jsx)(`dd`,{children:UC(t.runner_revision_counts)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Orchestrator runtimes`}),(0,H.jsxs)(`dd`,{children:[Object.keys(t.orchestrator_runtime_counts).length||0,` distinct`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Failure classes`}),(0,H.jsx)(`dd`,{children:UC(t.failure_class_counts)})]})]})]},t.arm_id))})}function XC({packet:e,primaryMetric:t,onOpenRun:n}){return(0,H.jsx)(`div`,{className:`benchmark-table-shell benchmark-wide-table`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Case`}),(0,H.jsx)(`th`,{children:`Design status`}),(0,H.jsx)(`th`,{children:`Largest eligible delta`}),e.arms.map(e=>(0,H.jsx)(`th`,{children:e.arm_id},e.arm_id))]})}),(0,H.jsx)(`tbody`,{children:e.cases.map(r=>{let i=KC(r,t);return(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`strong`,{children:r.case_id})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(qC,{tone:r.complete_declared_design?`success`:`warning`,children:r.complete_declared_design?`Complete`:`Provisional`})}),(0,H.jsx)(`td`,{className:i?.direction===`improved`?`benchmark-positive`:i?.direction===`regressed`?`benchmark-negative`:void 0,children:i?.text??`—`}),r.arms.map(r=>(0,H.jsx)(`td`,{children:r.selected_run_id&&r.score_countable?(0,H.jsxs)(`button`,{className:`benchmark-cell-link`,onClick:()=>n(r.selected_run_id),type:`button`,children:[(0,H.jsxs)(`span`,{children:[t,`: `,WC(r.metrics[t])]}),e.design.metric_catalog.filter(e=>e.metric_name!==t).map(e=>(0,H.jsxs)(`small`,{className:`benchmark-cell-metric`,children:[e.metric_name,`: `,WC(r.metrics[e.metric_name])]},e.metric_name)),(0,H.jsxs)(`small`,{children:[`Countable · `,HC(r.effort.duration_ms),` `,(0,H.jsx)(qp,{"aria-hidden":`true`,size:12})]}),r.insight&&(0,H.jsxs)(`small`,{children:[r.insight.failure_class,` · `,r.insight.confidence]})]}):(0,H.jsx)(`span`,{className:`benchmark-muted`,children:`Not countable`})},r.arm_id))]},r.case_id)})})]})})}function ZC({run:e,packet:t}){return(0,H.jsxs)(`aside`,{"aria-label":`Run detail for ${e.run_id}`,className:`benchmark-run-detail`,children:[(0,H.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`benchmark-mono`,children:`RUN DETAIL`}),(0,H.jsx)(`h2`,{children:e.run_id})]}),(0,H.jsx)(qC,{tone:e.countability.score_countable?`success`:`warning`,children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]}),(0,H.jsxs)(`dl`,{className:`benchmark-stat-list benchmark-run-facts`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Case / arm`}),(0,H.jsxs)(`dd`,{children:[e.case_id,` · `,e.arm_id]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Lifecycle`}),(0,H.jsxs)(`dd`,{children:[e.status,` · `,e.observed_at]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Protocol`}),(0,H.jsx)(`dd`,{children:e.protocol_id})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Qualification`}),(0,H.jsxs)(`dd`,{children:[`Integrity `,e.countability.integrity_qualified?`qualified`:`not qualified`,` · result `,e.countability.official_result_present?`present`:`missing`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Treatment fidelity`}),(0,H.jsx)(`dd`,{children:e.treatment_fidelity})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Effort`}),(0,H.jsxs)(`dd`,{children:[HC(e.effort.duration_ms),` · `,VC(e.effort.agent_steps),` steps · `,VC(e.effort.token_count),` tokens`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Runner revision`}),(0,H.jsx)(`dd`,{children:e.runner_revision??`—`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Upload provenance`}),(0,H.jsxs)(`dd`,{children:[e.upload_provenance.producer_id,` · `,e.upload_provenance.source_revision]})]})]}),(0,H.jsx)(`div`,{className:`benchmark-run-metrics`,children:t.design.metric_catalog.map(t=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{children:t.metric_name}),(0,H.jsx)(`strong`,{children:WC(e.metrics[t.metric_name])})]},t.metric_name))}),e.redacted_insight&&(0,H.jsxs)(`div`,{className:`benchmark-insight`,children:[(0,H.jsxs)(`span`,{className:`benchmark-mono`,children:[`REDACTED CASE INSIGHT · `,e.redacted_insight.confidence]}),(0,H.jsx)(`p`,{children:e.redacted_insight.causal_summary}),(0,H.jsxs)(`small`,{children:[`Implication: `,e.redacted_insight.implication]}),(0,H.jsx)(`br`,{}),(0,H.jsxs)(`small`,{children:[`Next probe: `,e.redacted_insight.next_probe]}),!!e.redacted_insight.evidence_refs?.length&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`br`,{}),(0,H.jsxs)(`small`,{children:[`Evidence: `,e.redacted_insight.evidence_refs.join(`, `)]})]})]})]})}function QC({packet:e,selectedRunId:t,onSelectRun:n}){let r=e.runs.find(e=>e.run_id===t)??e.runs[0];return(0,H.jsxs)(`div`,{className:`benchmark-runs-layout`,children:[(0,H.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Run`}),(0,H.jsx)(`th`,{children:`Case`}),(0,H.jsx)(`th`,{children:`Arm`}),(0,H.jsx)(`th`,{children:`Status`}),(0,H.jsx)(`th`,{children:`Countability`})]})}),(0,H.jsx)(`tbody`,{children:e.runs.map(e=>(0,H.jsxs)(`tr`,{"aria-selected":e.run_id===r?.run_id,children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`button`,{className:`benchmark-run-link`,onClick:()=>n(e.run_id),type:`button`,children:e.run_id})}),(0,H.jsx)(`td`,{children:e.case_id}),(0,H.jsx)(`td`,{children:e.arm_id}),(0,H.jsx)(`td`,{children:e.status}),(0,H.jsx)(`td`,{children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]},e.run_id))})]})}),r&&(0,H.jsx)(ZC,{packet:e,run:r})]})}function $C(){let e=mw.useSearch(),t=mw.useNavigate(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(0),c=(0,V.useMemo)(()=>{let t=e.dashboardUrl||`/chat/benchmark-study.example.json`;try{return{url:RC(t,window.location.href),error:null}}catch(e){return{url:``,error:e instanceof Error?e.message:`Invalid dashboard source`}}},[e.dashboardUrl]);if((0,V.useEffect)(()=>{let e=!0;return r(null),a(null),c.error?(a(c.error),()=>{e=!1}):(fetch(c.url,{cache:`no-store`}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status} while loading the dashboard packet`);return LC(await e.json())}).then(t=>{e&&r(t)}).catch(t=>{e&&a(t instanceof Error?t.message:`Unable to load dashboard packet`)}),()=>{e=!1})},[o,c]),(0,V.useEffect)(()=>{n&&(document.title=`${n.design.labels.title??n.study_id} · LoopX Benchmark`)},[n]),i)return(0,H.jsxs)(`main`,{className:`benchmark-page benchmark-loading`,children:[(0,H.jsx)(am,{"aria-hidden":`true`}),(0,H.jsx)(`h1`,{children:`Dashboard packet unavailable`}),(0,H.jsx)(`p`,{children:i}),(0,H.jsxs)(`button`,{onClick:()=>s(e=>e+1),type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":`true`,size:16}),` Retry readback`]})]});if(!n)return(0,H.jsxs)(`main`,{"aria-busy":`true`,className:`benchmark-page benchmark-loading`,children:[(0,H.jsx)(Wp,{"aria-hidden":`true`}),(0,H.jsx)(`h1`,{children:`Reading benchmark study`}),(0,H.jsx)(`p`,{children:`Validating the public-safe dashboard packet…`})]});let l=n.design.metric_catalog.find(e=>e.role===`primary`)?.metric_name??`primary`,u=(n,r=e.runId)=>t({search:e=>({...e,view:n,runId:r})}),d=new URL(c.url).pathname;return(0,H.jsxs)(`main`,{className:`benchmark-page`,children:[(0,H.jsxs)(`header`,{className:`benchmark-hero`,children:[(0,H.jsxs)(`div`,{className:`benchmark-hero-topline`,children:[(0,H.jsx)(`a`,{className:`benchmark-wordmark`,href:`/chat/`,children:`LoopX`}),(0,H.jsxs)(`div`,{className:`benchmark-readonly`,children:[(0,H.jsx)(Gm,{"aria-hidden":`true`,size:15}),` Derived read-only projection`]})]}),(0,H.jsxs)(`div`,{className:`benchmark-hero-grid`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`p`,{className:`benchmark-kicker`,children:[`BENCHMARK STUDY / `,n.benchmark_id]}),(0,H.jsxs)(`div`,{className:`benchmark-title-row`,children:[(0,H.jsx)(`h1`,{children:n.design.labels.title??n.study_id}),(0,H.jsx)(qC,{tone:n.status===`complete`?`success`:`warning`,children:n.status})]}),(0,H.jsx)(`p`,{className:`benchmark-lead`,children:`One declared study, explicit denominators, and the same countability rules from campaign summary to exact run.`})]}),(0,H.jsxs)(`dl`,{className:`benchmark-identity`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Study`}),(0,H.jsx)(`dd`,{children:n.study_id})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Protocol`}),(0,H.jsx)(`dd`,{children:n.design.protocol_id})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Case set`}),(0,H.jsx)(`dd`,{children:n.design.case_set.case_set_id})]})]})]}),(0,H.jsxs)(`div`,{className:`benchmark-kpi-grid`,children:[(0,H.jsxs)(`article`,{children:[(0,H.jsx)(um,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Score-countable cells`}),(0,H.jsxs)(`strong`,{children:[n.campaign.selected_score_countable_cell_count,(0,H.jsxs)(`small`,{children:[` / `,n.campaign.intended_cell_denominator]})]}),(0,H.jsxs)(`p`,{children:[BC(n.campaign.selected_score_countable_coverage_rate),` declared coverage`]})]}),(0,H.jsxs)(`article`,{children:[(0,H.jsx)(om,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Complete designs`}),(0,H.jsxs)(`strong`,{children:[n.campaign.complete_declared_design_case_count,(0,H.jsxs)(`small`,{children:[` / `,n.campaign.intended_case_count]})]}),(0,H.jsx)(`p`,{children:`Cases with every declared arm`})]}),(0,H.jsxs)(`article`,{children:[(0,H.jsx)(qp,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Matched comparisons`}),(0,H.jsx)(`strong`,{children:n.campaign.matched_pair_countable_count}),(0,H.jsx)(`p`,{children:`Eligible pairs only`})]}),(0,H.jsxs)(`article`,{children:[(0,H.jsx)(Wp,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`In flight`}),(0,H.jsx)(`strong`,{children:n.campaign.in_flight_run_count}),(0,H.jsx)(`p`,{children:n.status===`provisional`?`Coverage remains provisional`:`Declared coverage complete`})]})]})]}),(0,H.jsxs)(`nav`,{"aria-label":`Benchmark dashboard views`,className:`benchmark-tabs`,children:[zC.map(t=>(0,H.jsx)(`button`,{"aria-current":e.view===t.id?`page`:void 0,onClick:()=>u(t.id),type:`button`,children:t.label},t.id)),(0,H.jsxs)(`button`,{className:`benchmark-refresh`,onClick:()=>s(e=>e+1),type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":`true`,size:14}),` Refresh local readback`]})]}),(0,H.jsxs)(`div`,{className:`benchmark-content`,children:[e.view===`campaign`&&(0,H.jsx)(JC,{packet:n,primaryMetric:l}),e.view===`arms`&&(0,H.jsx)(YC,{packet:n}),e.view===`cases`&&(0,H.jsx)(XC,{onOpenRun:e=>u(`runs`,e),packet:n,primaryMetric:l}),e.view===`runs`&&(0,H.jsx)(QC,{onSelectRun:e=>u(`runs`,e),packet:n,selectedRunId:e.runId})]}),(0,H.jsxs)(`footer`,{className:`benchmark-footer`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Gm,{"aria-hidden":`true`,size:16}),(0,H.jsxs)(`span`,{children:[`Scores: `,n.authority.score_source]}),(0,H.jsx)(`span`,{children:`Dashboard cannot launch, grade, or mutate runs.`})]}),(0,H.jsxs)(`code`,{title:d,children:[`local`,d]})]})]})}var ew=Y({goalId:G().optional().default(``),statusUrl:G().optional().default(``)}),tw=Y({goalId:G().optional().default(``),mode:_d([`showcase`,`developer`,`ops`]).optional().default(`showcase`),statusUrl:G().optional().default(``),todoLane:_d([`all`,`user`,`agent`]).optional().default(`all`),todoQuery:G().optional().default(``)}),nw=tw.omit({mode:!0}),rw=Y({dashboardUrl:G().optional().default(``),view:_d([`campaign`,`arms`,`cases`,`runs`]).optional().default(`campaign`),runId:G().optional().default(``)});function iw(){let e=`https://huangruiteng.github.io/loopx/docs/showcases/index.en.html`;return(0,V.useEffect)(()=>{window.location.replace(e)},[]),(0,H.jsx)(`a`,{href:e,children:`Open LoopX cases / 浏览案例`})}function aw({goalId:e,statusUrl:t}){let n=t?ih(t,window.location.href):null;return n?.error?(0,H.jsx)(`main`,{role:`alert`,children:n.error}):(0,H.jsx)(ri,{replace:!0,to:`/`,search:{goalId:e,statusUrl:t}})}function ow(){let e=uw.useSearch();return e.mode===`ops`?(0,H.jsx)(aw,{...e}):e.mode===`developer`?(0,H.jsx)(ri,{replace:!0,to:`/developers/projections`}):(0,H.jsx)(iw,{})}function sw(){return(0,H.jsx)(aw,{...dw.useSearch()})}var cw=Si({component:()=>(0,H.jsx)(ji,{}),errorComponent:()=>(0,H.jsxs)(`main`,{role:`alert`,className:`p-8`,children:[(0,H.jsx)(`h1`,{children:`页面暂时无法显示 / Page unavailable`}),(0,H.jsx)(`p`,{children:`请重新加载页面;这不会执行任务。 / Reloading does not execute tasks.`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`重新加载 / Reload`})]})}),lw=bi({getParentRoute:()=>cw,path:`/`,validateSearch:e=>ew.parse(e),component:fC}),uw=bi({getParentRoute:()=>cw,path:`/frontstage`,validateSearch:e=>tw.parse(e),component:ow}),dw=bi({getParentRoute:()=>cw,path:`/deprecated/frontstage/ops`,validateSearch:e=>nw.parse(e),component:sw}),fw=bi({getParentRoute:()=>cw,path:`/frontstage/developer`,component:()=>(0,H.jsx)(ri,{replace:!0,to:`/developers/projections`})}),pw=bi({getParentRoute:()=>cw,path:`/developers/projections`,component:EC}),mw=bi({getParentRoute:()=>cw,path:`/benchmarks/study`,validateSearch:e=>rw.parse(e),component:$C}),hw=cw.addChildren([lw,uw,dw,fw,pw,mw]);function gw(e){return!e||e===`/`||e===`./`?`/`:(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``)||`/`}var _w=Ii({routeTree:hw,basepath:gw(`/chat/`),trailingSlash:`preserve`}),vw=document.getElementById(`root`);if(!vw)throw Error(`Root element not found`);var yw=new Oe({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}});(0,Bi.createRoot)(vw).render((0,H.jsx)(Me,{client:yw,children:(0,H.jsx)(Ki,{children:(0,H.jsx)(zi,{router:_w})})})); \ No newline at end of file diff --git a/loopx/web/chat/index.html b/loopx/web/chat/index.html index becfeae53e..928a503111 100644 --- a/loopx/web/chat/index.html +++ b/loopx/web/chat/index.html @@ -18,8 +18,8 @@ content="LoopX 个人 Agent 工作区:在同一个频道里查看、纠偏并推进 Goal。" /> LoopX 个人 Agent 工作区 - - + +
From cb60f60c93380b3ed04d0efe5ca6f149dc86a5b5 Mon Sep 17 00:00:00 2001 From: Lihua <1017343802@qq.com> Date: Mon, 14 Sep 2026 00:31:56 -0700 Subject: [PATCH 3/9] test(chat): verify recovered return status in packaged UI Signed-off-by: Lihua <1017343802@qq.com> --- .../personal-workspace-browser/chat-recovery.mjs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/examples/personal-workspace-browser/chat-recovery.mjs b/examples/personal-workspace-browser/chat-recovery.mjs index 30708b7938..bdd2eb98cb 100644 --- a/examples/personal-workspace-browser/chat-recovery.mjs +++ b/examples/personal-workspace-browser/chat-recovery.mjs @@ -83,8 +83,15 @@ export const chatRecoveryScenario = { message_id: "handoff.browser-fixture", turn_id: "original-delegation", role: "agent", origin: "manager_followup", text: `${returnText}\n\n- **已完成**:核验新约束\n- 下一步:继续现有计划\n\n1. 核对证据\n2. 汇报结论`, created_at: "2026-08-13T01:00:03Z", + return_delivery: { + schema_version: "manager_return_delivery_status_v0", + phase: "conclusion", + status: "verification_required", + error: "provider_delivery_unverified", + }, }); await page.getByText(returnText, { exact: true }).waitFor({ state: "visible", timeout: 10_000 }); + await page.getByText("正在核验送达,不会重复发送", { exact: true }).waitFor({ state: "visible" }); const richConclusion = page.locator(".personal-channel-timeline .personal-message").filter({ hasText: returnText }); if (await richConclusion.locator("ul > li").count() !== 2 || await richConclusion.locator(".personal-md strong").innerText() !== "已完成") { @@ -100,6 +107,15 @@ export const chatRecoveryScenario = { } await richConclusion.scrollIntoViewIfNeeded(); await page.screenshot({ path: resolve(outputDir, "manager-automatic-conclusion.png"), fullPage: false, animations: "disabled" }); + const returnedMessage = page.__loopxRuntime.messages.get(returnSessionId) + .find((message) => message.message_id === "handoff.browser-fixture"); + returnedMessage.return_delivery = { + schema_version: "manager_return_delivery_status_v0", + phase: "conclusion", + status: "delivered", + verification: "reconciled_after_restart", + }; + await page.getByText("恢复后已核验送达", { exact: true }).waitFor({ state: "visible", timeout: 10_000 }); await page.setViewportSize({ width: 390, height: 844 }); await page.getByText(returnText, { exact: true }).waitFor({ state: "visible" }); await richConclusion.scrollIntoViewIfNeeded(); From 718b2ef6fa141b93ff734471f092ecc94df59944 Mon Sep 17 00:00:00 2001 From: Lihua <1017343802@qq.com> Date: Mon, 14 Sep 2026 00:34:58 -0700 Subject: [PATCH 4/9] fix(manager): fail closed on unverifiable returns Signed-off-by: Lihua <1017343802@qq.com> --- .../return-delivery-status.tsx | 9 ++++- .../capabilities/manager_context/roundtrip.py | 37 +++++++++++++++++-- loopx/extensions/lark/inbox_reply.py | 34 ++++++++++++----- loopx/web/chat/asset-retention.json | 6 +-- loopx/web/chat/assets/index-B7B_kVDP.css | 1 - .../{index-Mlk4kS9d.js => index-CSsrBwtA.js} | 22 +++++------ loopx/web/chat/index.html | 2 +- tests/extensions/test_lark_inbox_reactions.py | 25 +++++++++++++ tests/test_manager_context_roundtrip.py | 17 +++++++++ 9 files changed, 124 insertions(+), 29 deletions(-) delete mode 100644 loopx/web/chat/assets/index-B7B_kVDP.css rename loopx/web/chat/assets/{index-Mlk4kS9d.js => index-CSsrBwtA.js} (80%) diff --git a/apps/presentation/dashboard/src/features/personal-workspace/return-delivery-status.tsx b/apps/presentation/dashboard/src/features/personal-workspace/return-delivery-status.tsx index 740477faf5..6e99a368a8 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/return-delivery-status.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/return-delivery-status.tsx @@ -13,8 +13,15 @@ export function ReturnDeliveryStatus({ delivery }: { delivery?: WorkspaceReturnD : delivery.status === "explicit_unverified" ? t("returnDelivery.unverified") : t("returnDelivery.queued"); + const tone = delivery.status === "delivered" + ? "delivered" + : delivery.status === "verification_required" + ? "verification_required" + : delivery.status === "explicit_unverified" + ? "explicit_unverified" + : "queued"; return ( - + {label} ); diff --git a/loopx/capabilities/manager_context/roundtrip.py b/loopx/capabilities/manager_context/roundtrip.py index 0d7e0a2489..699be60d27 100644 --- a/loopx/capabilities/manager_context/roundtrip.py +++ b/loopx/capabilities/manager_context/roundtrip.py @@ -17,6 +17,28 @@ from ...presentation.public_safety import scan_public_boundary_text PHASES = ("decision", "conclusion") +DELIVERY_STATUSES = { + "queued", + "retry_pending", + "verification_required", + "delivered", + "superseded", + "explicit_unverified", +} +DELIVERY_ERRORS = { + "provider_delivery_unverified", + "provider_locator_unavailable", + "provider_verifier_unavailable", + "provider_verification_unavailable", + "provider_delivery_intent_conflict", + "provider_message_missing", + "provider_delivery_mismatch", + "return_authorization_unavailable", + "original_route_unavailable", + "initial_delivery_receipt_unavailable", + "original_route_or_return_delivery_unavailable", + "delivery_state_unreadable", +} DELIVERY_ATTEMPT_SCHEMA = "manager_return_delivery_attempt_v0" _PROVIDER = re.compile(r"[a-z][a-z0-9_-]{0,31}") _OPAQUE_REF = re.compile(r"[A-Za-z0-9][A-Za-z0-9._:-]{0,511}") @@ -182,12 +204,21 @@ def reply_status(root, row): reply = _read(path) state_path = path.with_name(phase + ".delivery.json") state = _read(state_path) if state_path.exists() else {} + status = state.get("status", "queued") + error = state.get("error") + if status not in DELIVERY_STATUSES: + status, error = "explicit_unverified", "delivery_state_unreadable" + elif error is not None and error not in DELIVERY_ERRORS: + status, error = "explicit_unverified", "delivery_state_unreadable" + delivered_at = state.get("delivered_at") + if not isinstance(delivered_at, str) or len(delivered_at) > 80: + delivered_at = None item = { "phase": phase, - "status": state.get("status", "queued"), + "status": status, "created_at": reply.get("created_at"), - "delivered_at": state.get("delivered_at"), - "error": state.get("error"), + "delivered_at": delivered_at, + "error": error, } if state.get("verification") == "reconciled_after_restart": item["verification"] = "reconciled_after_restart" diff --git a/loopx/extensions/lark/inbox_reply.py b/loopx/extensions/lark/inbox_reply.py index 60ddea7711..771e0bd552 100644 --- a/loopx/extensions/lark/inbox_reply.py +++ b/loopx/extensions/lark/inbox_reply.py @@ -579,15 +579,31 @@ def _deliver_lark_inbox_outbound( ) intent_digest = _intent_digest(profile, chat_id, receipt) if delivery_attempt_recorder is not None: - delivery_attempt_recorder( - { - "schema_version": "manager_return_delivery_attempt_v0", - "provider": "lark", - "message_ref": reply_message_id, - "intent_digest": intent_digest, - "provider_receipt": receipt, - } - ) + try: + delivery_attempt_recorder( + { + "schema_version": "manager_return_delivery_attempt_v0", + "provider": "lark", + "message_ref": reply_message_id, + "intent_digest": intent_digest, + "provider_receipt": receipt, + } + ) + except (OSError, TypeError, ValueError): + return _result( + status="sent_unverified", + ok=False, + execute=True, + receipt=receipt, + identity_verified=True, + membership_verified=True, + write_performed=True, + placement=placement, + blocker="lark_inbox_reply_delivery_attempt_not_persisted", + format_preflight_passed=True, + provider_preview_performed=True, + provider_preview_verified=True, + ) readback = _call( runner, base diff --git a/loopx/web/chat/asset-retention.json b/loopx/web/chat/asset-retention.json index 5f2094e8a2..cc87a1c9c8 100644 --- a/loopx/web/chat/asset-retention.json +++ b/loopx/web/chat/asset-retention.json @@ -14,7 +14,7 @@ "assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2", "assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2", "assets/index-B5MsQdxX.css", - "assets/index-ByC0P3wo.js" + "assets/index-CSsrBwtA.js" ], [ "assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2", @@ -28,8 +28,8 @@ "assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2", "assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2", "assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2", - "assets/index-B7B_kVDP.css", - "assets/index-Mlk4kS9d.js" + "assets/index-B5MsQdxX.css", + "assets/index-ByC0P3wo.js" ] ] } diff --git a/loopx/web/chat/assets/index-B7B_kVDP.css b/loopx/web/chat/assets/index-B7B_kVDP.css deleted file mode 100644 index 3e24d6e540..0000000000 --- a/loopx/web/chat/assets/index-B7B_kVDP.css +++ /dev/null @@ -1 +0,0 @@ -.personal-workspace-shell{--pw-bg:#fbfaf7;--pw-card:#fff;--pw-line:#eceae3;--pw-line-strong:#e0ddd4;--pw-muted:#82889a;--pw-faint:#aab0bf;--pw-text:#23262e;--pw-blue:#2f66e9;--pw-blue-ink:#2456c8;--pw-blue-soft:#ebf1fe;--pw-amber:#a86a12;--pw-amber-bg:#fbf2df;--pw-red:#c2402f;--pw-red-bg:#fcecea;--pw-green:#2e7d5b;--pw-green-bg:#e6f3ec;background:var(--pw-bg);min-height:100vh;color:var(--pw-text);grid-template-columns:272px minmax(520px,1fr);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;display:grid}.personal-workspace-shell.has-drawer{grid-template-columns:256px minmax(500px,1fr) minmax(340px,404px)}.personal-workspace-shell.has-task-inspector{grid-template-columns:minmax(520px,1fr) minmax(520px,50vw)}.personal-workspace-shell.has-task-inspector .personal-workspace-sidebar{display:none}.personal-workspace-shell.has-task-inspector.is-task-inspector-full{grid-template-columns:minmax(600px,1fr)}.personal-workspace-shell.is-task-inspector-full .personal-workspace-main{display:none}.personal-workspace-sidebar{border-right:1px solid var(--pw-line);background:#f5f3ee;min-width:0}.personal-workspace-sidebar-inner{width:100%;height:100%}.personal-sr-only{clip:rect(0, 0, 0, 0)!important;white-space:nowrap!important;border:0!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;position:absolute!important;overflow:hidden!important}.personal-workspace-main{min-width:0}.personal-workspace-drawer{border-left:1px solid var(--pw-line);background:#fff;min-width:0;position:relative;box-shadow:-14px 0 36px #1e1c140d}.personal-workspace-drawer[data-drawer-mode=inspector]{z-index:3;width:auto;position:relative;box-shadow:-8px 0 24px #1e284014}.personal-workspace-drawer[data-drawer-mode=inspector-full]{min-width:0;box-shadow:none;grid-column:1}.personal-sidebar-backdrop{display:none}.personal-workspace-shell :focus-visible:not(textarea):not(input){outline-offset:2px;outline:2px solid #5f87ed}.personal-goal-directory{flex-direction:column;width:100%;height:100vh;display:flex;position:sticky;top:0}.personal-sidebar-brand{border-bottom:1px solid var(--pw-line);align-items:center;gap:11px;height:74px;padding:0 18px;display:flex}.personal-sidebar-brand>span:last-child{gap:1px;display:grid}.personal-sidebar-brand strong{letter-spacing:.01em;font-size:16px}.personal-sidebar-brand small{color:var(--pw-muted);font-size:11px}.personal-brand-mark,.personal-manager-icon{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:10px;place-items:center;display:grid;box-shadow:0 2px 6px #2f66e947}.personal-brand-mark{width:34px;height:34px}.personal-manager-icon{width:30px;height:30px;color:var(--pw-blue-ink);background:var(--pw-blue-soft);box-shadow:none}.personal-status-source{border-bottom:1px solid var(--pw-line);gap:7px;padding:12px 14px;display:grid;position:relative}.personal-status-source>header{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;justify-content:space-between;align-items:center;padding:0 3px;font-size:10px;font-weight:700;display:flex}.personal-status-source>header button,.personal-status-source-meta button,.personal-status-source-form header button{width:25px;height:25px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-status-source>header button:hover,.personal-status-source-meta button:hover,.personal-status-source-form header button:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-status-source-select{width:100%}.personal-status-source-meta{min-width:0;color:var(--pw-muted);align-items:center;gap:7px;padding:0 3px;font-size:10.5px;display:flex}.personal-status-source-meta>span{white-space:nowrap;align-items:center;gap:5px;display:inline-flex}.personal-status-source-meta>span i{background:#3fbf82;border-radius:50%;width:6px;height:6px}.personal-status-source-meta>span.is-loading i{background:#e5a33d}.personal-status-source-meta>span.is-error i{background:#dd5b47}.personal-status-source-meta small{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}.personal-status-source-meta button{width:22px;height:22px;color:var(--pw-faint);margin-left:auto}.personal-status-source-error{color:var(--pw-red);overflow-wrap:anywhere;margin:0 3px;font-size:10px;line-height:1.4}.personal-status-source-form{z-index:12;border:1px solid var(--pw-line-strong);background:#fff;border-radius:12px;gap:10px;padding:13px;display:grid;position:absolute;top:calc(100% - 4px);left:12px;right:12px;box-shadow:0 12px 32px #1e1c1424}.personal-status-source-form>header{justify-content:space-between;align-items:center;font-size:12.5px;display:flex}.personal-status-source-form label{color:var(--pw-muted);gap:5px;font-size:10.5px;display:grid}.personal-status-source-form input,.personal-status-source-form select{border:1px solid var(--pw-line-strong);width:100%;min-width:0;height:34px;color:var(--pw-text);background:#fff;border-radius:8px;outline:0;padding:0 9px;font:12px/1.2 inherit}.personal-status-source-form input:focus,.personal-status-source-form select:focus{border-color:#8aa7ed;box-shadow:0 0 0 2px #2f66e91a}.personal-status-source-form input:disabled,.personal-status-source-form select:disabled{color:var(--pw-faint);background:#f6f5f2}.personal-status-source-form p{color:var(--pw-muted);overflow-wrap:anywhere;margin:0;font-size:10px;line-height:1.45}.personal-status-source-form p.is-error{color:var(--pw-red)}.personal-status-source-form code{font:9.5px/1.5 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-status-source-add{background:var(--pw-blue);color:#fff;cursor:pointer;border:0;border-radius:8px;min-height:34px;font-size:11.5px;font-weight:650}.personal-status-source-add:hover{background:var(--pw-blue-ink)}.personal-status-source-add:disabled{cursor:not-allowed;opacity:.48}.personal-status-source-modes{background:#f2f1ed;border-radius:9px;grid-template-columns:1fr 1fr;gap:3px;padding:3px;display:grid}.personal-status-source-modes button{min-height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;padding:0 8px;font-size:10.5px;font-weight:650}.personal-status-source-modes button[aria-selected=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-status-source-field-row{grid-template-columns:minmax(0,1fr) 34px;gap:6px;display:grid}.personal-status-source-field-row>button{border:1px solid var(--pw-line-strong);width:34px;height:34px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:8px;place-items:center;padding:0;display:grid}.personal-status-source-field-row>button:hover{color:var(--pw-text);background:#f8f7f4}.personal-status-source-field-row>button:disabled{cursor:wait;opacity:.45}.personal-status-source-command{background:#f6f5f2;border-radius:8px;gap:7px;padding:8px 9px;display:grid}.personal-status-source-command code{color:#4e5668;overflow-wrap:anywhere}.personal-status-source-command button{border:1px solid var(--pw-line-strong);min-height:25px;color:var(--pw-blue-ink);cursor:pointer;background:#fff;border-radius:7px;justify-content:center;justify-self:end;align-items:center;gap:5px;padding:0 8px;font-size:10px;font-weight:650;display:inline-flex}.personal-status-source-command button:disabled{color:var(--pw-faint);cursor:not-allowed}.personal-sidebar-nav{flex:1;padding:12px;overflow:auto}.personal-manager-link,.personal-goal-link,.personal-sidebar-utility{width:100%;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0}.personal-manager-link{border-radius:11px;grid-template-columns:30px 1fr auto auto;align-items:center;gap:10px;padding:8px 10px;font-weight:650;display:grid}.personal-manager-link:hover,.personal-goal-link:hover{background:#ffffffa6}.personal-manager-link[aria-current=page],.personal-goal-link[aria-current=page]{background:#fff;box-shadow:0 1px 4px #1e1c141a}.personal-sidebar-count{background:var(--pw-amber-bg);min-width:22px;color:var(--pw-amber);text-align:center;border-radius:99px;padding:2px 7px;font-size:11px;font-weight:650}.personal-sidebar-section-title{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;justify-content:space-between;padding:20px 10px 7px;font-size:11px;font-weight:650;display:flex}.personal-sidebar-title-actions{align-items:center;gap:6px;display:flex}.personal-sidebar-title-actions button{width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-sidebar-title-actions button:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141f}.personal-goal-list{gap:2px;display:grid}.personal-goal-row{border-radius:11px;grid-template-columns:minmax(0,1fr) 28px 28px;align-items:center;gap:2px;display:grid}.personal-goal-row:has(.personal-goal-move-actions){grid-template-columns:minmax(0,1fr) 52px 28px}.personal-goal-row[data-reorder-goal]>.personal-goal-link{cursor:grab;-webkit-user-select:none;user-select:none}.personal-goal-row[data-reorder-goal]>.personal-goal-link:active{cursor:grabbing}.personal-goal-row.is-drop-before{box-shadow:0 -2px var(--color-link,#0070f3)}.personal-goal-row.is-drop-after{box-shadow:0 2px var(--color-link,#0070f3)}.personal-goal-move-actions{display:flex}.personal-goal-move-actions button{min-width:26px;min-height:44px;color:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;place-items:center;display:grid}.personal-goal-move-actions button:disabled{opacity:.35;cursor:default}.personal-goal-move-actions button:not(:disabled):hover{background:var(--color-surface-soft,#f2f2f2)}.personal-goal-link{border-radius:11px;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:10px;min-height:44px;padding:7px 5px 7px 10px;display:grid}.personal-goal-lifecycle{width:26px;height:26px;color:var(--pw-faint);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-goal-lifecycle:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141f}.personal-goal-lifecycle:disabled{opacity:.45;cursor:wait}.personal-goal-lifecycle.is-pending svg{animation:.8s linear infinite personal-goal-lifecycle-spin}@keyframes personal-goal-lifecycle-spin{to{transform:rotate(360deg)}}.personal-goal-delete:hover{color:var(--pw-danger)}.personal-goal-link-copy{gap:2px;min-width:0;display:grid}.personal-goal-link-copy strong,.personal-goal-link-copy small{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.personal-goal-link-copy strong{font-size:13px;font-weight:600}.personal-goal-link-copy small{color:var(--pw-muted);align-items:center;gap:5px;font-size:11px;display:flex}.personal-goal-state-dot{background:#e8ecf1;border-radius:9px;width:30px;height:30px;position:relative}.personal-goal-state-dot:after{content:"";background:#9aa3b2;border-radius:50%;width:7px;height:7px;position:absolute;bottom:3px;right:3px;box-shadow:0 0 0 2px #ffffffd9}.personal-goal-row:nth-child(5n+1) .personal-goal-state-dot{background:#e3ebfd}.personal-goal-row:nth-child(5n+2) .personal-goal-state-dot{background:#eee7fb}.personal-goal-row:nth-child(5n+3) .personal-goal-state-dot{background:#e2f2e4}.personal-goal-row:nth-child(5n+4) .personal-goal-state-dot{background:#fbf0dc}.personal-goal-row:nth-child(5n) .personal-goal-state-dot{background:#e8ecf1}.personal-goal-state-dot.is-danger:after{background:#dd5b47}.personal-goal-state-dot.is-warning:after{background:#e5a33d}.personal-goal-state-dot.is-info:after{background:#54a5e8}.personal-goal-state-dot.is-success:after{background:#3fae7c}.personal-goal-state-dot.is-quiet:after{background:#b6bcc9}.personal-goal-state-dot.is-stopped:after{background:#8f96a4}.personal-stopped-goals{border-top:1px solid var(--pw-line);margin-top:14px;padding-top:8px}.personal-stopped-goals>summary{min-height:34px;color:var(--pw-muted);cursor:pointer;letter-spacing:.04em;border-radius:9px;grid-template-columns:16px minmax(0,1fr) auto;align-items:center;gap:6px;padding:5px 10px;font-size:11px;font-weight:650;list-style:none;display:grid}.personal-stopped-goals>summary::-webkit-details-marker{display:none}.personal-stopped-goals>summary:hover{color:var(--pw-text);background:#ffffff8c}.personal-stopped-goals>summary>svg:first-child{transition:transform .14s}.personal-stopped-goals[open]>summary>svg:first-child{transform:rotate(180deg)}.personal-stopped-goals>summary small{text-align:center;background:#ebe9e3;border-radius:99px;min-width:22px;padding:2px 6px}.personal-goal-list.is-stopped{opacity:.82;margin-top:2px}.personal-stopped-goal-error{background:var(--pw-red-bg);color:var(--pw-red);border:1px solid #edc1ba;border-radius:9px;gap:7px;margin:6px 8px;padding:9px 10px;font-size:11px;line-height:1.45;display:grid}.personal-stopped-goal-error button{min-height:28px;color:inherit;cursor:pointer;font:inherit;background:0 0;border:1px solid;border-radius:7px;justify-self:start;padding:0 9px;font-weight:650}.personal-priority-dot{background:#aab2bf;border-radius:50%;width:7px;height:7px}.personal-priority-dot.is-high{background:#dd5b47}.personal-priority-dot.is-medium{background:#e5a33d}.personal-priority-dot.is-low{background:#3fae7c}.personal-sidebar-footer{border-top:1px solid var(--pw-line);flex-shrink:0;padding:12px}.personal-update-trigger{width:100%;min-height:44px;color:var(--pw-text);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;align-items:center;gap:8px;padding:0 9px;font-size:13px;display:flex}.personal-update-trigger span{text-align:left;flex:1}.personal-update-trigger:hover{background:var(--pw-card)}.personal-update-trigger:focus-visible{outline-offset:2px;outline:2px solid #0070f3}.personal-update-panel{box-sizing:border-box;width:min(320px,100vw - 24px);max-height:calc(100dvh - 104px);color:var(--pw-text);background:var(--pw-card,#fff);font:inherit;border:1px solid var(--pw-line);border-radius:12px;margin:0;padding:16px;font-size:13px;line-height:1.6;position:fixed;inset:auto auto 80px 12px;overflow-y:auto;box-shadow:0 8px 28px #0000001f}.personal-update-panel header{justify-content:space-between;align-items:center;display:flex}.personal-update-panel button{min-height:44px;color:inherit;background:var(--pw-card,#fff);border:1px solid var(--pw-line);cursor:pointer;border-radius:6px;padding:6px 10px}.personal-update-panel header button{border:0;place-items:center;min-width:44px;display:grid}.personal-update-panel summary{cursor:pointer;align-content:center;min-height:44px}.personal-update-panel p{margin:10px 0}.personal-update-panel label,.personal-update-panel small,.personal-update-panel code{display:block}.personal-update-panel select{width:100%;min-height:44px;color:inherit;background:var(--pw-card);border:1px solid var(--pw-line);border-radius:6px;margin-top:6px}.personal-update-actions{flex-wrap:wrap;gap:8px;display:flex}.personal-update-actions button{border:1px solid var(--pw-line);border-radius:6px;min-height:44px;padding:6px 10px}.personal-update-panel a{text-decoration:underline}.personal-update-panel :focus-visible{outline-offset:2px;outline:2px solid #0070f3}.personal-sidebar-utility{border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;grid-template-columns:32px minmax(0,1fr) auto;align-items:center;gap:10px;min-height:54px;padding:7px 9px;font-size:13px;display:grid;box-shadow:0 1px 4px #1e1c1412}.personal-sidebar-utility:hover{background:#fff;border-color:#d6d2c8;box-shadow:0 2px 7px #1e1c141a}.personal-sidebar-utility-icon{background:var(--pw-blue-soft);width:32px;height:32px;color:var(--pw-blue-ink);border-radius:9px;place-items:center;display:grid}.personal-sidebar-utility-copy{gap:2px;min-width:0;display:grid}.personal-sidebar-utility-copy strong,.personal-sidebar-utility-copy small{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.personal-sidebar-utility-copy strong{font-size:13px;font-weight:700}.personal-sidebar-utility-copy small{color:var(--pw-muted);font-size:10.5px}.personal-sidebar-utility>svg{color:var(--pw-faint)}.personal-owner-row{min-height:40px;color:var(--pw-muted);border-radius:10px;align-items:center;gap:10px;margin-top:2px;padding:8px 10px;font-size:13px;display:flex}.personal-channel{grid-template-rows:auto minmax(0,1fr) auto;grid-template-columns:minmax(0,1fr);min-width:0;height:100vh;display:grid}.personal-channel-header{z-index:8;border-bottom:1px solid var(--pw-line);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fbfaf7eb;justify-content:space-between;align-items:center;gap:16px;min-height:72px;padding:12px 26px;display:flex;position:relative;overflow:visible}.personal-goal-tabs{background:#f2f1ed;border-radius:10px;align-self:center;align-items:center;gap:2px;margin-left:auto;padding:3px;display:flex}.personal-goal-tabs button{min-height:30px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;padding:0 13px;font-size:12.5px;font-weight:600}.personal-goal-tabs button:hover{color:var(--pw-text)}.personal-goal-tabs button[aria-current=page]{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-channel-title{min-width:0}.personal-channel-title h1{letter-spacing:-.015em;margin:0;font-size:17.5px;font-weight:700;line-height:1.25}.personal-channel-title p{color:var(--pw-muted);white-space:nowrap;text-overflow:ellipsis;margin:3px 0 0;font-size:12px;overflow:hidden}.personal-channel-actions{flex:none;align-items:center;gap:9px;display:flex}.personal-goal-tools{flex:none;position:relative}.personal-goal-tools-trigger{background:var(--pw-blue-soft);min-height:38px;color:var(--pw-blue-ink);cursor:pointer;font:inherit;white-space:nowrap;border:1px solid #b8c9f5;border-radius:10px;justify-content:center;align-items:center;gap:7px;padding:0 11px;font-size:12px;font-weight:720;display:inline-flex}.personal-goal-tools-trigger:hover,.personal-goal-tools-trigger[aria-expanded=true]{color:#1948b5;background:#e5edff;border-color:#7f9fe9}.personal-goal-tools-trigger:focus-visible{outline-offset:2px;outline:3px solid #2f66e947}.personal-goal-tools-trigger>svg:last-child{transition:transform .16s}.personal-goal-tools-trigger[aria-expanded=true]>svg:last-child{transform:rotate(180deg)}.personal-goal-tools-menu{z-index:30;border:1px solid var(--pw-line-strong);background:#fff;border-radius:12px;gap:4px;width:min(300px,100vw - 28px);padding:6px;display:grid;position:absolute;top:calc(100% + 8px);right:0;box-shadow:0 16px 44px #1e284029}.personal-goal-tools-menu>button{width:100%;min-height:52px;color:var(--pw-text);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:9px;grid-template-columns:34px minmax(0,1fr);align-items:center;gap:9px;padding:7px 9px;display:grid}.personal-goal-tools-menu>button:hover,.personal-goal-tools-menu>button:focus-visible{background:var(--pw-blue-soft);outline:none}.personal-goal-tools-menu>button>svg{color:var(--pw-blue);justify-self:center}.personal-goal-tools-menu>button>span{gap:2px;min-width:0;display:grid}.personal-goal-tools-menu strong{font-size:12.5px}.personal-goal-tools-menu small{color:var(--pw-muted);font-size:10.5px;line-height:1.35}.personal-icon-button.personal-mobile-menu{display:none}.personal-select{min-width:0;position:relative}.personal-select-trigger{border:1px solid var(--pw-line-strong);width:100%;min-height:36px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border-radius:10px;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:7px;padding:0 9px;font-size:12px;font-weight:500;line-height:16px;display:grid}.personal-select-trigger:hover,.personal-select-trigger[aria-expanded=true]{border-color:var(--pw-faint)}.personal-select-trigger:focus-visible{border-color:var(--pw-blue);outline-offset:1px;outline:2px solid #0070f329}.personal-select-trigger>svg{color:var(--pw-muted);transition:transform .15s}.personal-select-trigger>svg.is-open{transform:rotate(180deg)}.personal-select-icon{color:var(--pw-muted);place-items:center;display:grid}.personal-select-value{white-space:nowrap;align-items:center;gap:6px;min-width:0;display:flex}.personal-select-value>small{color:var(--pw-faint);flex:none;font-size:10px;font-weight:500}.personal-select-value>span{text-overflow:ellipsis;min-width:0;overflow:hidden}.personal-select-listbox{z-index:50;border:1px solid var(--pw-line);background:#fff;border-radius:12px;min-width:max(100%,204px);max-width:min(300px,80vw);max-height:260px;padding:4px;display:grid;position:absolute;top:calc(100% + 5px);left:0;overflow:auto;box-shadow:0 10px 24px #00000017}.personal-agent-select .personal-select-listbox{min-width:216px;left:auto;right:0}.personal-select-option-wrap{display:grid}.personal-select-group-label{color:var(--pw-faint);letter-spacing:0;text-transform:uppercase;padding:8px 8px 4px;font:500 10px/14px Geist Mono Variable,Geist Mono,monospace}.personal-select-option{width:100%;min-height:32px;color:var(--pw-text);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;grid-template-columns:minmax(0,1fr) 16px;align-items:center;gap:10px;padding:6px 8px;font-size:12px;font-weight:400;line-height:16px;display:grid}.personal-select-option:hover,.personal-select-option:focus-visible{background:#f2f2f2;outline:0}.personal-select-option[aria-selected=true]{font-weight:600}.personal-select-option[disabled]{color:var(--pw-faint);cursor:not-allowed}.personal-select-option>svg{color:var(--pw-text);justify-self:end}.personal-agent-select{width:188px}.personal-read-only-source{border:1px solid var(--pw-line-strong);max-width:190px;height:38px;color:var(--pw-text);white-space:nowrap;background:#fff;border-radius:10px;align-items:center;gap:7px;padding:0 10px;font-size:12.5px;font-weight:600;display:inline-flex;overflow:hidden}.personal-read-only-source>svg{color:var(--pw-muted);flex:none}.personal-read-only-source>small{color:var(--pw-muted);background:#f2f1ed;border-radius:99px;padding:2px 6px;font-size:9.5px;font-weight:650}.personal-live-indicator{color:var(--pw-muted);white-space:nowrap;flex:none;align-items:center;gap:6px;padding:7px 4px;font-size:12px;display:inline-flex}.personal-live-indicator i{background:#3fbf82;border-radius:50%;width:7px;height:7px}.personal-composer-attach{cursor:pointer;border:0;flex:none;place-items:center;display:grid;position:relative;overflow:hidden}.personal-composer-attach:disabled{cursor:not-allowed;opacity:.45}.personal-composer-file-input{opacity:0;pointer-events:none;width:1px;height:1px;position:fixed;overflow:hidden}.personal-action-feedback{border:1px solid var(--pw-line);background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:10px;justify-content:space-between;align-items:center;gap:12px;margin:0 0 8px;padding:9px 12px;font-size:13px;font-weight:650;display:flex}.personal-action-feedback button{color:inherit;cursor:pointer;background:0 0;border:0;place-items:center;display:grid}.personal-refresh-control{flex:none;align-items:center;gap:6px;display:inline-flex}.personal-refresh-control small{color:var(--pw-muted);white-space:nowrap;font-size:11px}.personal-refresh-control.is-error small{color:var(--pw-danger)}.personal-icon-button{border:1px solid var(--pw-line);width:36px;min-width:36px;height:36px;min-height:36px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:10px;flex:0 0 36px;place-items:center;padding:0;display:inline-grid}.personal-icon-button:hover{border-color:var(--pw-line-strong);color:var(--pw-text)}.personal-channel-scroll{min-width:0;min-height:0;padding:22px max(26px,50% - 410px);overflow:auto}.personal-channel-scroll:has(.personal-task-kanban){padding-inline:max(26px,50vw - 770px)}.personal-channel-scroll:has(.personal-task-board){overflow:hidden}.personal-manager-greeting{align-items:center;gap:14px;margin-bottom:16px;padding:18px 20px;display:flex}.personal-home-lanes{grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;display:grid}.personal-system-health-banner{color:#991b1b;background:#fef2f2;border:1px solid #fecaca;border-radius:12px;margin-bottom:16px;padding:12px 16px}.personal-system-health-header{align-items:center;gap:8px;font-size:13px;font-weight:600;display:flex}.personal-system-health-header small{color:#b91c1c;font-size:11.5px;font-weight:400}.personal-system-health-issues{color:#b91c1c;margin:6px 0 0 24px;padding:0;font-size:12px;line-height:1.5}.personal-home-lane{border:1px solid var(--pw-line);background:#fff;border-radius:16px;flex-direction:column;min-width:0;min-height:100%;display:flex;box-shadow:0 1px 4px #1e1c140a}.personal-manager-greeting>span{background:var(--pw-blue-soft);width:38px;height:38px;color:var(--pw-blue);border-radius:12px;place-items:center;display:grid}.personal-manager-greeting div{gap:3px;display:grid}.personal-manager-greeting strong{letter-spacing:-.01em}.personal-manager-greeting p{color:var(--pw-muted);margin:0;font-size:13px}.personal-proposal-explainer{background:var(--pw-blue-soft);color:var(--pw-text);border-radius:10px;padding:10px 12px;font-size:12px;line-height:1.55}.personal-home-board{gap:12px;min-width:0;display:grid}.personal-home-lanes{grid-template-columns:repeat(4,minmax(170px,1fr));gap:10px;min-width:0;display:grid}.personal-home-lane{border:1px solid var(--pw-line);background:#ffffff85;border-radius:15px;align-content:start;min-width:0;min-height:260px;padding:12px;display:grid}.personal-home-lane>header{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-home-lane>header span{align-items:center;gap:7px;font-size:13px;font-weight:700;display:inline-flex}.personal-home-lane>header i,.personal-home-goal-meta i{background:var(--pw-faint);border-radius:50%;width:8px;height:8px}.personal-home-lane>header b{min-width:24px;color:var(--pw-muted);font-variant-numeric:tabular-nums;text-align:right;font-size:12px}.personal-home-lane>p{min-height:34px;color:var(--pw-muted);margin:7px 0 10px;font-size:10.5px;line-height:1.55}.personal-home-lane.is-needs_you>header i,.personal-home-lane.is-needs_you .personal-home-goal-meta i{background:var(--pw-amber)}.personal-home-lane.is-running>header i,.personal-home-lane.is-running .personal-home-goal-meta i{background:var(--pw-green)}.personal-home-lane.is-observing>header i,.personal-home-lane.is-observing .personal-home-goal-meta i{background:var(--pw-blue)}.personal-home-lane.is-scheduled>header i,.personal-home-lane.is-scheduled .personal-home-goal-meta i{background:#8b6bd8}.personal-home-lane-list{align-content:start;gap:9px;display:grid}.personal-home-goal-card{border:1px solid var(--pw-line);width:100%;min-width:0;color:inherit;cursor:pointer;text-align:left;background:#fff;border-radius:12px;gap:7px;padding:12px;transition:border-color .14s,transform .14s,box-shadow .14s;display:grid;box-shadow:0 1px 4px #1e1c140f}.personal-home-goal-card:hover{border-color:var(--pw-line-strong);transform:translateY(-1px);box-shadow:0 4px 12px #1e1c1414}.personal-home-goal-card:focus-visible{outline-offset:2px;outline:2px solid #7da2ff}.personal-home-goal-meta{min-width:0;color:var(--pw-muted);text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:6px;font-size:10.5px;display:flex;overflow:hidden}.personal-home-goal-card>strong{text-overflow:ellipsis;font-size:13px;line-height:1.45;overflow:hidden}.personal-home-goal-card>p{color:var(--pw-muted);-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:0;font-size:11px;line-height:1.55;display:-webkit-box;overflow:hidden}.personal-home-goal-card>footer{justify-content:space-between;align-items:center;gap:8px;padding-top:2px;display:flex}.personal-home-goal-card>footer span{color:var(--pw-muted);background:#f2f1ed;border-radius:99px;flex:none;padding:2px 7px;font-size:9.5px}.personal-home-goal-card>footer small{color:var(--pw-faint);text-overflow:ellipsis;white-space:nowrap;font-size:9.5px;overflow:hidden}.personal-home-empty{border:1px dashed var(--pw-line-strong);min-height:96px;color:var(--pw-faint);border-radius:11px;place-items:center;font-size:11px;display:grid}.personal-home-history{border:1px solid var(--pw-line);background:#fff9;border-radius:13px}.personal-home-history>summary{cursor:pointer;align-items:center;gap:9px;min-height:44px;padding:0 14px;list-style:none;display:flex}.personal-home-history>summary::-webkit-details-marker{display:none}.personal-home-history>summary span{font-size:12.5px;font-weight:700}.personal-home-history>summary b{color:var(--pw-muted);font-size:11px}.personal-home-history>summary small{color:var(--pw-faint);margin-left:auto;font-size:10.5px}.personal-home-history>div{grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:9px;padding:0 12px 12px;display:grid}.personal-session-record{background:var(--pw-blue-soft);border:1px solid #cfdcf9;border-radius:14px;grid-template-columns:minmax(0,1fr) auto;gap:10px 16px;margin-bottom:12px;padding:14px 16px;display:grid}.personal-session-record>header{grid-column:1/-1;justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-session-record>header span{color:var(--pw-blue-ink);align-items:center;gap:7px;font-size:12px;font-weight:700;display:inline-flex}.personal-session-record>header button{width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;place-items:center;padding:0;display:grid}.personal-session-record>header button:hover{color:var(--pw-text);background:#ffffffb3}.personal-session-record>div{min-width:0}.personal-session-record>div strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;display:block;overflow:hidden}.personal-session-record>div p{color:var(--pw-muted);margin:4px 0 0;font-size:11px}.personal-session-record dl{grid-column:1/-1;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0;display:grid}.personal-session-record dl div{background:#ffffff9e;border-radius:9px;gap:2px;min-width:0;padding:8px 10px;display:grid}.personal-session-record dt{color:var(--pw-faint);font-size:9.5px}.personal-session-record dd{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;margin:0;font:10.5px/1.4 SF Mono,ui-monospace,Menlo,Consolas,monospace;overflow:hidden}.personal-session-record>.personal-secondary-action{grid-area:2/2;align-self:center}.personal-channel-timeline{gap:10px;display:grid}.personal-live-region{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:fixed;overflow:hidden}.personal-timeline-row{border:1px solid var(--pw-line);background:var(--pw-card);width:100%;min-height:64px;color:inherit;cursor:pointer;text-align:left;border-radius:14px;grid-template-columns:38px minmax(0,1fr) auto auto 16px;align-items:center;gap:12px;padding:11px 15px;transition:border-color .14s,box-shadow .14s;display:grid}.personal-timeline-row:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-timeline-row:focus-visible{outline-offset:2px;outline:2px solid #7da2ff}.personal-row-icon{border-radius:11px;place-items:center;width:34px;height:34px;display:grid}.personal-row-icon.is-attention{color:var(--pw-amber);background:var(--pw-amber-bg)}.personal-row-icon.is-run{color:var(--pw-blue-ink);background:var(--pw-blue-soft)}.personal-row-icon.is-output{color:var(--pw-green);background:var(--pw-green-bg)}.personal-row-copy,.personal-run-identity{gap:3px;min-width:0;display:grid}.personal-row-copy strong,.personal-row-copy small,.personal-row-copy span,.personal-run-identity strong,.personal-run-identity small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.personal-row-copy strong{font-size:13.5px;font-weight:600}.personal-row-copy small,.personal-run-identity small,.personal-row-copy span{color:var(--pw-muted);font-size:11px}.personal-row-status{color:var(--pw-muted);white-space:nowrap;background:#f2f1ed;border-radius:99px;align-items:center;gap:5px;padding:2.5px 10px;font-size:11px;font-weight:600;display:inline-flex}.personal-row-status.is-running{background:var(--pw-green-bg);color:var(--pw-green)}.personal-run-row{grid-template-columns:38px minmax(90px,.65fr) minmax(160px,1.4fr) 90px auto auto 16px}.personal-run-open-label{color:var(--pw-blue-ink);white-space:nowrap;font-size:10.5px;font-weight:650}.personal-run-identity strong{font-size:12px}.personal-run-progress{gap:5px;display:grid}.personal-run-progress small{color:var(--pw-muted);font-variant-numeric:tabular-nums;font-size:10px}.personal-run-progress i{background:#f0efeb;border-radius:99px;height:4px;display:block;overflow:hidden}.personal-run-progress b{border-radius:inherit;background:var(--pw-blue);height:100%;display:block}.personal-output-row time{color:var(--pw-muted);font-size:11px}.personal-spin{animation:1.2s linear infinite pw-spin}@keyframes pw-spin{to{transform:rotate(360deg)}}.personal-message{gap:11px;max-width:84%;padding:6px 2px;display:flex}.personal-message.is-user{background:var(--pw-blue-soft);color:var(--pw-text);border:1px solid #dbe7fd;border-radius:16px 16px 4px;justify-self:end;padding:11px 15px}.personal-message-avatar{background:var(--pw-blue-soft);height:34px;color:var(--pw-blue-ink);border-radius:11px;flex:0 0 34px;place-items:center;display:grid}.personal-message header{align-items:baseline;gap:8px;display:flex}.personal-message header strong{font-size:12px}.personal-message time{color:var(--pw-faint);font-size:10px}.personal-message p{white-space:pre-wrap;margin:6px 0 0;font-size:13.5px;line-height:1.7}.personal-message-pending{color:var(--pw-muted);font-size:11px}.personal-message-images{flex-wrap:wrap;gap:7px;margin-top:8px;display:flex}.personal-message-images img{object-fit:cover;border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;width:min(220px,100%);max-height:180px}.personal-md{overflow-wrap:anywhere;font-size:13.5px;line-height:1.7}.personal-md>*+*{margin-top:8px}.personal-md p{margin:0}.personal-md-heading.is-h1,.personal-md-heading.is-h2{font-size:14.5px}.personal-md-code{color:#4d5361;background:#f0efe9;border-radius:5px;padding:1px 5px;font-family:SF Mono,ui-monospace,Menlo,Consolas,monospace;font-size:.86em}.personal-md-pre{color:#e8ecf3;white-space:pre;background:#23262e;border-radius:10px;margin:0;padding:12px 14px;font:12px/1.65 SF Mono,ui-monospace,Menlo,Consolas,monospace;overflow-x:auto}.personal-md-pre code{font:inherit}.personal-md-link{color:var(--pw-blue-ink);text-underline-offset:2px;word-break:break-all;text-decoration:underline}.personal-agent-avatar{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:13px;flex:none;place-items:center;width:44px;height:44px;font-size:18px;font-weight:700;display:grid;box-shadow:0 2px 6px #2f66e947}.personal-agent-health.is-off{color:var(--pw-muted);background:#f2f1ed}.personal-agent-persona dl{border-top:1px solid var(--pw-line);margin-top:14px;padding-top:13px}.personal-detail-card-title{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-detail-card-title em{color:var(--pw-muted);background:#f1f1ee;border-radius:99px;padding:2px 8px;font-size:10px;font-style:normal;font-weight:650}.personal-goal-repository h3{align-items:center;gap:8px;display:flex}.personal-goal-notification h3{justify-content:space-between;align-items:center;gap:8px;display:flex}.personal-connection-status{background:var(--pw-green-bg);color:var(--pw-green);border-radius:99px;padding:2px 8px;font-size:10px;font-weight:650}.personal-subagent-heading{justify-content:space-between;align-items:flex-start;gap:14px;display:flex}.personal-subagent-heading h3{align-items:center;gap:7px;margin-bottom:0;display:flex}.personal-subagent-switch{border:1px solid var(--pw-line-strong);min-height:32px;color:var(--pw-muted);cursor:pointer;background:#f2f1ed;border-radius:99px;flex:none;align-items:center;gap:7px;padding:4px 9px 4px 5px;font-size:11px;font-weight:700;display:inline-flex}.personal-subagent-switch>span{background:#c8c8c2;border-radius:99px;width:30px;height:18px;transition:background .18s;position:relative}.personal-subagent-switch>span:after{content:"";background:#fff;border-radius:50%;width:12px;height:12px;transition:transform .18s;position:absolute;top:3px;left:3px}.personal-subagent-switch[aria-checked=true]{background:var(--pw-green-bg);color:var(--pw-green);border-color:#b9dccb}.personal-subagent-switch[aria-checked=true]>span{background:var(--pw-green)}.personal-subagent-switch[aria-checked=true]>span:after{transform:translate(12px)}.personal-subagent-switch[data-pending=true]{color:#8a6b00;opacity:1;background:#fffbed;border-color:#d8c67a}.personal-subagent-switch:disabled{cursor:default;opacity:.55}.personal-subagent-switch[data-pending=true]:disabled{opacity:1}.personal-subagent-fields{border-top:1px solid var(--pw-line);grid-template-columns:minmax(0,1fr) 112px;gap:10px;margin-top:14px;padding-top:13px;display:grid}.personal-subagent-fields label{color:var(--pw-text);align-content:start;gap:6px;font-size:11.5px;font-weight:650;display:grid}.personal-subagent-fields input:not([type=checkbox]),.personal-subagent-fields select{border:1px solid var(--pw-line-strong);min-width:0;min-height:38px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 10px;font-size:12px}.personal-subagent-fields label small{color:var(--pw-faint);font-size:10.5px;font-weight:450;line-height:1.45}.personal-subagent-domain-picker{border:0;grid-column:1/-1;min-width:0;margin:0;padding:0}.personal-subagent-domain-picker>legend{color:var(--pw-text);margin-bottom:7px;padding:0;font-size:11.5px;font-weight:650}.personal-subagent-domain-picker>small{color:var(--pw-faint);margin-top:7px;font-size:10.5px;line-height:1.45;display:block}.personal-subagent-domain-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;display:grid}.personal-subagent-domain-option{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:9px;grid-template-columns:auto minmax(0,1fr);min-height:44px;padding:8px 9px;align-items:center!important;display:grid!important}.personal-subagent-domain-option:hover{border-color:#b9c9dc}.personal-subagent-domain-option:has(input:focus-visible){outline:2px solid var(--pw-blue);outline-offset:2px}.personal-subagent-domain-option.is-selected{background:var(--pw-blue-soft);border-color:#9fc4ed}.personal-subagent-domain-option input{width:15px;height:15px;accent-color:var(--pw-blue);margin:0}.personal-subagent-domain-option>span{gap:1px;min-width:0;display:grid}.personal-subagent-domain-option strong{text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;overflow:hidden}.personal-subagent-domain-option small{font-size:9.5px!important;font-weight:450!important}.personal-subagent-domain-empty{border:1px dashed var(--pw-line-strong);background:var(--pw-bg);color:var(--pw-muted);border-radius:9px;grid-column:1/-1;margin:0;padding:10px;font-size:10.5px;line-height:1.5}.personal-subagent-limit-field{grid-column:1/-1;width:112px}.personal-subagent-fields .personal-secondary-action{grid-column:1/-1;margin-top:0}.personal-subagent-preview{background:#fffbed;border:1px solid #d8c67a;border-radius:10px;margin-top:10px;padding:12px}.personal-subagent-preview>strong{font-size:12.5px}.personal-subagent-preview>p{margin:5px 0 0}.personal-subagent-preview>div{grid-template-columns:1fr 1fr;gap:8px;display:grid}.personal-subagent-preview .personal-primary-action,.personal-subagent-preview .personal-secondary-action{min-height:38px;margin-top:10px}.personal-subagent-feedback{align-items:flex-start;gap:7px;display:flex;margin:10px 0 0!important}.personal-subagent-feedback.is-success{color:var(--pw-green)!important}.personal-subagent-feedback.is-warning{color:#8a6b00!important}.personal-subagent-feedback.is-error{color:var(--pw-red)!important}.personal-subagent-read-only{margin-bottom:0}.personal-settings-page{--pw-bg:#fbfaf7;--pw-card:#fff;--pw-line:#eceae3;--pw-line-strong:#e0ddd4;--pw-muted:#82889a;--pw-faint:#aab0bf;--pw-text:#23262e;--pw-blue:#2f66e9;--pw-blue-ink:#2456c8;--pw-blue-soft:#ebf1fe;--pw-red:#c2402f;--pw-red-bg:#fcecea;--pw-green:#2e7d5b;--pw-green-bg:#e6f3ec;background:var(--pw-bg);height:100dvh;min-height:0;color:var(--pw-text);grid-template-rows:minmax(0,1fr);grid-template-columns:268px minmax(0,1fr);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;display:grid;overflow:hidden}.personal-settings-sidebar{overscroll-behavior:contain;scrollbar-gutter:stable;border-right:1px solid var(--pw-line);background:#f5f3ee;flex-direction:column;gap:14px;min-width:0;height:100%;min-height:0;padding:18px 14px;display:flex;position:relative;overflow-y:auto}.personal-settings-page :focus-visible{outline-offset:2px;outline:2px solid #5f87ed}.personal-settings-back{width:100%;min-height:40px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:10px;align-items:center;gap:8px;padding:0 10px;font-size:13px;font-weight:650;display:inline-flex}.personal-settings-back:hover{color:var(--pw-text);background:#ffffffa6}.personal-settings-title{border-bottom:1px solid var(--pw-line);gap:3px;padding:8px 10px 10px;display:grid}.personal-settings-title small{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-settings-title strong{letter-spacing:-.02em;font-size:18px}.personal-settings-header{justify-content:space-between;align-items:flex-start;gap:24px;margin-bottom:24px;display:flex}.personal-settings-header small{color:var(--pw-blue);letter-spacing:.08em;text-transform:uppercase;font-size:11px;font-weight:700}.personal-settings-header h1{letter-spacing:-.035em;margin:4px 0 2px;font-size:28px}.personal-settings-tabs{gap:3px;display:grid}.personal-settings-tabs button{width:100%;min-height:54px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:11px;grid-template-columns:32px minmax(0,1fr);align-items:center;gap:9px;padding:8px 10px;display:grid}.personal-settings-tabs button:hover{color:var(--pw-text);background:#ffffffa6}.personal-settings-tabs button[aria-current=page]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c141a}.personal-settings-tabs button>span{gap:2px;min-width:0;display:grid}.personal-settings-tabs strong{font-size:13px}.personal-settings-body{overscroll-behavior:contain;scrollbar-gutter:stable;min-width:0;min-height:0;padding:30px clamp(24px,5vw,72px);overflow:auto}.personal-settings-body:has(>.personal-capability-settings){grid-template-rows:auto minmax(0,1fr);display:grid;overflow:hidden}.personal-settings-body>.personal-settings-header{min-width:0}.personal-settings-page *,.personal-settings-page :before,.personal-settings-page :after{box-sizing:border-box}.personal-appearance-settings{max-width:680px}.personal-settings-choice-group{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:14px;display:grid}.personal-settings-choice-group button{border:1px solid var(--pw-line);min-height:60px;color:inherit;cursor:pointer;text-align:left;background:#fff;border-radius:12px;grid-template-columns:34px minmax(0,1fr);align-items:center;gap:10px;padding:13px;display:grid}.personal-settings-choice-group button:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-settings-choice-group button[aria-checked=true]{background:#f7f9ff;border-color:#9fb9f4;box-shadow:0 0 0 3px #2f66e91a}.personal-settings-choice-group strong{align-self:center;font-size:13px}.personal-settings-theme-swatch{border:1px solid var(--pw-line-strong);border-radius:10px;width:34px;height:34px;display:block}.personal-settings-theme-swatch.is-loopx{background:linear-gradient(135deg,#171717 0 44%,#0070f3 44% 54%,#fafafa 54% 76%,#fff 76%);border-radius:6px}.personal-settings-theme-swatch.is-paper{background:linear-gradient(135deg,#fbfaf7 0 48%,#2f66e9 48% 58%,#fff 58%)}.personal-settings-theme-swatch.is-brutal{background:linear-gradient(135deg,#ffd91a 0 45%,#ff8fd0 45% 70%,#8fdcff 70%);border:2px solid #141414;border-radius:5px;box-shadow:2px 2px #141414}.personal-lark-settings{background:var(--pw-bg);min-height:100vh;color:var(--pw-text);padding:30px clamp(24px,5vw,72px);position:relative}.personal-lark-settings.is-embedded{background:0 0;min-height:0;padding:0}.personal-lark-header{justify-content:space-between;align-items:flex-start;gap:24px;max-width:1180px;margin:0 auto;display:flex}.personal-lark-header small{color:var(--pw-blue);letter-spacing:.08em;text-transform:uppercase;font-size:11px;font-weight:700}.personal-lark-header h1{letter-spacing:-.035em;margin:4px 0 2px;font-size:28px}.personal-lark-header p{color:var(--pw-muted);margin:0;font-size:13px}.personal-lark-tabs{border-bottom:1px solid var(--pw-line);gap:24px;max-width:1180px;margin:28px auto 20px;display:flex}.personal-lark-settings.is-embedded .personal-lark-tabs{margin-top:0}.personal-lark-tabs button{min-height:42px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-bottom:2px solid #0000;align-items:center;gap:8px;padding:0 2px;font-weight:650;display:flex}.personal-lark-tabs button[aria-current=page]{border-color:var(--pw-blue);color:var(--pw-text)}.personal-lark-tabs span{min-width:20px;height:20px;color:var(--pw-muted);background:#efeee9;border-radius:99px;place-items:center;padding:0 5px;font-size:10px;display:inline-grid}.personal-lark-section-heading{max-width:1180px;margin:0 auto 18px}.personal-lark-section-heading small{color:var(--pw-blue);letter-spacing:.07em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-lark-section-heading h2{letter-spacing:-.025em;margin:4px 0;font-size:21px}.personal-lark-section-heading p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-lark-subtabs{margin-top:0}.personal-settings-content{max-width:1180px;margin:0 auto}.personal-settings-card{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:16px;max-width:720px;overflow:hidden;box-shadow:0 8px 30px #1e1c140a}.personal-settings-card>header{border-bottom:1px solid var(--pw-line);align-items:center;gap:13px;padding:20px;display:flex}.personal-settings-card>header h2{letter-spacing:-.02em;margin:0;font-size:17px}.personal-settings-card>header p{color:var(--pw-muted);margin:4px 0 0;font-size:12px;line-height:1.5}.personal-settings-icon{background:var(--pw-blue-soft);width:40px;height:40px;color:var(--pw-blue);border-radius:12px;flex:none;place-items:center;display:grid}.personal-language-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:18px 20px;display:grid}.personal-language-options>button{border:1px solid var(--pw-line);min-height:66px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border-radius:12px;justify-content:space-between;align-items:center;gap:18px;padding:13px 15px;transition:border-color .15s,background-color .15s,box-shadow .15s;display:flex}.personal-language-options>button:hover{border-color:var(--pw-line-strong);background:#fcfbf8}.personal-language-options>button.is-selected{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-color:#9bb5f0;box-shadow:0 0 0 1px #2f66e814}.personal-language-options>button>span{gap:4px;display:grid}.personal-language-options strong{font-size:13px}.personal-settings-card>footer{border-top:1px solid var(--pw-line);color:var(--pw-faint);background:#faf9f6;padding:13px 20px;font-size:11px}.personal-machine-loading{min-height:220px;color:var(--pw-muted);place-items:center;font-size:13px;display:grid}.personal-machine-layout{grid-template-columns:210px minmax(0,1fr);gap:22px;max-width:1080px;display:grid}.personal-machine-namespaces{min-width:0}.personal-machine-namespaces>div{gap:3px;margin-bottom:10px;padding:0 4px;display:grid}.personal-machine-namespaces>div small,.personal-machine-editor>header small,.personal-machine-editor-bar small{color:var(--pw-blue);letter-spacing:.07em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-machine-namespaces>div strong{font-size:13px}.personal-machine-namespaces nav{gap:5px;display:grid}.personal-machine-namespaces button{width:100%;min-height:52px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:1px solid #0000;border-radius:10px;gap:3px;padding:9px 11px;display:grid}.personal-machine-namespaces button:hover{border-color:var(--pw-line);background:#fff9}.personal-machine-namespaces button[aria-current=page]{border-color:var(--pw-line-strong);color:var(--pw-text);background:#fff;box-shadow:0 2px 8px #1e1c140d}.personal-machine-namespaces button span{overflow-wrap:anywhere;font-size:12px;font-weight:650}.personal-machine-namespaces button small{color:var(--pw-muted);font-size:10px}.personal-machine-content{min-width:0}.personal-machine-summary{border:1px solid var(--pw-line);background:#fff;border-radius:14px;justify-content:space-between;align-items:center;gap:20px;margin-bottom:14px;padding:14px 16px;display:flex}.personal-machine-summary>div{align-items:center;gap:11px;min-width:0;display:flex}.personal-machine-summary>div>span:last-child{gap:3px;display:grid}.personal-machine-summary>div small{color:var(--pw-muted);text-transform:uppercase;font-size:10px;font-weight:650}.personal-machine-summary>div strong{font-size:13px}.personal-machine-summary dl{gap:22px;margin:0;display:flex}.personal-machine-summary dl div{gap:3px;display:grid}.personal-machine-summary dt{color:var(--pw-muted);font-size:10px}.personal-machine-summary dd{margin:0;font-family:SFMono-Regular,Consolas,monospace;font-size:11px;font-weight:650}.personal-machine-editor-bar{justify-content:space-between;align-items:center;gap:14px;margin-bottom:10px;padding:0 2px;display:flex}.personal-machine-editor-mode{border:1px solid var(--pw-line);background:#f5f4f0;border-radius:9px;flex:none;gap:3px;padding:3px;display:flex}.personal-machine-editor-mode button{min-height:44px;color:var(--pw-muted);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:6px;padding:0 12px;font-size:11px;font-weight:650}.personal-machine-editor-mode button[aria-pressed=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c1414}.personal-machine-editor{border:1px solid var(--pw-line);background:#fff;border-radius:16px;overflow:hidden;box-shadow:0 8px 30px #1e1c140a}.personal-machine-editor>header{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:flex-start;gap:20px;padding:20px;display:flex}.personal-machine-editor>header h2{letter-spacing:-.02em;margin:4px 0 3px;font-size:18px}.personal-machine-editor>header p{max-width:610px;color:var(--pw-muted);margin:0;font-size:12px;line-height:1.55}.personal-machine-switch{min-height:44px;color:var(--pw-muted);cursor:pointer;white-space:nowrap;flex:none;align-items:center;gap:9px;font-size:12px;font-weight:650;display:flex}.personal-machine-switch input{width:42px;height:24px;accent-color:var(--pw-blue);cursor:pointer;margin:0}.personal-machine-scope-note{color:var(--pw-blue-ink);background:#f6f8fd;border:1px solid #cfdaf3;border-radius:12px;align-items:flex-start;gap:10px;margin:18px 20px 0;padding:13px 14px;display:flex}.personal-machine-scope-note svg{flex:none;margin-top:1px}.personal-machine-scope-note strong{font-size:12px}.personal-machine-scope-note p{color:#52627f;margin:3px 0 0;font-size:11px;line-height:1.55}.personal-machine-editor fieldset{border:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:0;padding:20px;display:grid}.personal-machine-editor fieldset label{align-content:start;gap:6px;min-width:0;display:grid}.personal-machine-editor fieldset label:last-child{grid-column:1/-1}.personal-machine-editor fieldset label>span{font-size:12px;font-weight:650}.personal-machine-editor fieldset label>small{color:var(--pw-muted);font-size:10.5px;line-height:1.45}.personal-machine-editor input[type=text],.personal-machine-editor fieldset input{border:1px solid var(--pw-line-strong);width:100%;min-width:0;min-height:42px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 11px;font-size:13px}.personal-machine-editor fieldset:disabled{opacity:.58}.personal-machine-editor fieldset:disabled input{cursor:not-allowed}.personal-machine-json-editor>label{gap:7px;padding:20px;display:grid}.personal-machine-json-editor>label>span{font-size:12px;font-weight:650}.personal-machine-json-editor>label>small{color:var(--pw-muted);font-size:10.5px;line-height:1.5}.personal-machine-json-editor textarea{resize:vertical;border:1px solid var(--pw-line-strong);width:100%;min-width:0;color:var(--pw-text);tab-size:2;background:#fafafa;border-radius:9px;padding:12px 13px;font:12px/1.6 SFMono-Regular,Consolas,monospace}.personal-machine-json-editor textarea:focus-visible{outline:2px solid var(--pw-blue);outline-offset:2px}.personal-machine-validation,.personal-machine-error,.personal-machine-notice{border-radius:9px;margin:0 20px 16px;padding:10px 12px;font-size:11px;line-height:1.5}.personal-machine-validation,.personal-machine-error{background:var(--pw-red-bg);color:var(--pw-red);border:1px solid #edc1ba}.personal-machine-notice{background:var(--pw-green-bg);color:var(--pw-green);border:1px solid #bcdacb;align-items:center;gap:8px;display:flex}.personal-machine-preview{background:#f8faff;border:1px solid #aebfec;border-radius:12px;margin:0 20px 18px;padding:14px}.personal-machine-preview header{justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-machine-preview header strong{font-size:12px}.personal-machine-preview header span{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:99px;padding:3px 8px;font-size:10px;font-weight:650}.personal-machine-preview dl{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:12px 0;display:grid}.personal-machine-preview dl div{background:#fff;border:1px solid #dfe5f3;border-radius:8px;min-width:0;padding:8px}.personal-machine-preview dt{color:var(--pw-muted);font-size:9.5px}.personal-machine-preview dd{overflow-wrap:anywhere;margin:4px 0 0;font-family:SFMono-Regular,Consolas,monospace;font-size:10.5px;font-weight:650}.personal-machine-preview p{color:#52627f;margin:0;font-size:10.5px;line-height:1.5}.personal-machine-rollback{border:1px solid var(--pw-line);background:#faf9f6;border-radius:12px;justify-content:space-between;align-items:center;gap:18px;margin:0 20px 18px;padding:13px 14px;display:flex}.personal-machine-rollback strong{font-size:12px}.personal-machine-rollback p{color:var(--pw-muted);margin:3px 0 0;font-size:10.5px;line-height:1.45}.personal-machine-rollback .personal-secondary-action{flex:none;width:auto;min-height:40px;margin:0;padding:0 13px}.personal-machine-editor>footer{border-top:1px solid var(--pw-line);background:#faf9f6;justify-content:flex-end;gap:10px;padding:15px 20px;display:flex}.personal-machine-editor>footer .personal-primary-action,.personal-machine-editor>footer .personal-secondary-action,.personal-machine-editor>footer .personal-danger-action{width:auto;min-height:42px;margin:0;padding:0 15px}.personal-machine-unavailable{border:1px dashed var(--pw-line-strong);min-height:180px;color:var(--pw-muted);background:#fff;border-radius:14px;justify-items:start;gap:8px;padding:26px;display:grid}.personal-machine-unavailable strong{color:var(--pw-text);font-size:13px}.personal-machine-unavailable p{max-width:540px;margin:0;font-size:11px;line-height:1.6}.personal-lark-loading,.personal-lark-empty{min-height:130px;color:var(--pw-muted);justify-content:center;align-items:center;gap:8px;font-size:13px;display:flex}.personal-lark-apps{max-width:1180px;margin:0 auto}.personal-lark-app-toolbar{color:var(--pw-muted);justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;font-size:11px;display:flex}.personal-lark-app-toolbar .personal-primary-action{width:auto;min-height:40px;margin:0;padding:0 16px}.personal-lark-app-grid{grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px;display:grid}.personal-lark-app-card{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:15px;grid-template-columns:42px minmax(0,1fr) auto;align-items:center;gap:11px;padding:18px;display:grid}.personal-lark-app-avatar{background:var(--pw-blue-soft);width:42px;height:42px;color:var(--pw-blue);border-radius:12px;place-items:center;display:grid}.personal-lark-app-card div{gap:3px;display:grid}.personal-lark-app-card small,.personal-lark-app-card p{color:var(--pw-muted);font-size:11px}.personal-lark-app-card em{border-radius:99px;padding:3px 9px;font-size:10px;font-style:normal;font-weight:650}.personal-lark-app-card em.is-ready{background:var(--pw-green-bg);color:var(--pw-green)}.personal-lark-app-card em.is-off{color:var(--pw-muted);background:#f1f1ee}.personal-lark-app-card p{grid-column:2/-1;margin:0}.personal-lark-connections{max-width:1180px;margin:0 auto}.personal-lark-route-readiness{background:var(--pw-amber-bg);color:var(--pw-amber);border:1px solid #ead49a;border-radius:10px;align-items:center;gap:8px;margin:0 0 12px;padding:10px 12px;font-size:12px;font-weight:650;line-height:1.5;display:flex}.personal-lark-route-readiness svg{flex:none}.personal-lark-toolbar{justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;display:flex}.personal-lark-toolbar>label{border:1px solid var(--pw-line);max-width:680px;height:40px;color:var(--pw-faint);background:#fff;border-radius:10px;flex:1;align-items:center;gap:8px;padding:0 12px;display:flex}.personal-lark-toolbar input{width:100%;font:inherit;background:0 0;border:0;outline:0}.personal-lark-toolbar .personal-primary-action{flex:none;width:auto;min-height:40px;margin-top:0;padding:0 16px}.personal-lark-table{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:14px;overflow:hidden}.personal-lark-table-head,.personal-lark-table-row{grid-template-columns:1.35fr 1.35fr .72fr .72fr 100px;align-items:center;gap:16px;padding:12px 16px;display:grid}.personal-lark-table-head{border-bottom:1px solid var(--pw-line);min-height:42px;color:var(--pw-faint);letter-spacing:.04em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-lark-table-row{border-bottom:1px solid var(--pw-line);min-height:70px;font-size:12px}.personal-lark-table-row:last-of-type{border-bottom:0}.personal-lark-table-row>span{gap:3px;min-width:0;display:grid}.personal-lark-table-row strong,.personal-lark-table-row small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.personal-lark-table-row small{color:var(--pw-muted);font-size:10px}.personal-lark-row-actions{justify-content:flex-end;display:flex!important}.personal-lark-row-actions button,.personal-lark-modal header button{border:1px solid var(--pw-line);min-height:30px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:8px;align-items:center;gap:4px;padding:0 8px;font-size:10px;display:inline-flex}.personal-lark-row-actions button.is-confirm{background:var(--pw-red-bg);color:var(--pw-red);border-color:#e6b0aa}.personal-lark-modal-backdrop{z-index:80;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background:#1e1f2361;place-items:center;padding:24px;display:grid;position:fixed;inset:0}.personal-lark-modal{border:1px solid var(--pw-line);background:#fff;border-radius:18px;gap:14px;width:min(560px,100%);max-height:calc(100vh - 48px);padding:22px;display:grid;overflow:auto;box-shadow:0 24px 70px #14182340}.personal-lark-modal header{justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.personal-lark-modal header small{color:var(--pw-muted);font-size:10px}.personal-lark-modal h2{letter-spacing:-.02em;margin:3px 0 0;font-size:20px}.personal-lark-modal>label{color:var(--pw-muted);gap:7px;font-size:11px;font-weight:650;display:grid}.personal-lark-modal>label>small{color:var(--pw-faint);font-size:10px;font-weight:450;line-height:1.45}.personal-lark-modal input[type=search],.personal-lark-modal input[type=text],.personal-lark-modal input:not([type]),.personal-lark-modal select{border:1px solid var(--pw-line-strong);width:100%;min-height:40px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 11px}.personal-lark-modal label:has(input[type=search]){grid-template-columns:1fr}.personal-lark-modal label:has(input[type=search]) input{margin-bottom:2px}.personal-lark-group-state{border:1px dashed var(--pw-line-strong);min-height:40px;color:var(--pw-muted);background:#fafaf8;border-radius:9px;align-items:center;gap:7px;padding:9px 11px;font-size:11px;font-weight:500;line-height:1.45;display:flex}.personal-lark-group-state.is-error{background:var(--pw-red-bg);color:var(--pw-red);border-style:solid;border-color:#efc3bd}.personal-lark-check{border:1px solid var(--pw-line);background:#fafaf8;border-radius:10px;align-items:flex-start;padding:12px;gap:10px!important;display:flex!important}.personal-lark-check input{accent-color:var(--pw-blue);margin-top:2px}.personal-lark-check span{gap:2px;display:grid}.personal-lark-check strong{color:var(--pw-text)}.personal-lark-check small{font-weight:400}.personal-lark-agent-apps{color:var(--pw-muted);border:0;gap:7px;margin:0;padding:0;display:grid}.personal-lark-agent-apps legend{margin-bottom:1px;font-size:11px;font-weight:650}.personal-lark-agent-apps>small{color:var(--pw-faint);font-size:10px;line-height:1.45}.personal-lark-agent-apps>div{gap:8px;display:grid}.personal-lark-agent-apps label{border:1px solid var(--pw-line);background:#fafaf8;border-radius:10px;grid-template-columns:minmax(0,1fr) minmax(180px,1fr);align-items:center;gap:12px;padding:10px 11px;display:grid}.personal-lark-agent-apps label>span{gap:2px;min-width:0;display:grid}.personal-lark-agent-apps label strong{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;font-size:11px;overflow:hidden}.personal-lark-agent-apps label small{color:var(--pw-faint);text-overflow:ellipsis;white-space:nowrap;font-size:9px;overflow:hidden}.personal-lark-agent-apps select{min-width:0}.personal-lark-ingress{color:var(--pw-muted);border:0;gap:7px;margin:0;padding:0;display:grid}.personal-lark-ingress legend{margin-bottom:1px;font-size:11px;font-weight:650}.personal-lark-ingress>div{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;display:grid}.personal-lark-ingress label{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:10px;min-height:84px;padding:11px;display:block;position:relative}.personal-lark-ingress label.is-active{border-color:var(--pw-blue);background:#2f69eb0f;box-shadow:0 0 0 1px #2f69eb24}.personal-lark-ingress input{opacity:0;width:1px;height:1px;position:absolute}.personal-lark-ingress span{gap:5px;display:grid}.personal-lark-ingress strong{color:var(--pw-text);font-size:11px}.personal-lark-ingress small{color:var(--pw-faint);font-size:9px;font-weight:450;line-height:1.35}.personal-lark-topic-preview{border:1px solid var(--pw-line);min-height:40px;color:var(--pw-text);background:#f7f7f4;border-radius:9px;align-items:center;gap:8px;padding:0 11px;font-size:12px;font-weight:500;display:flex}.personal-lark-topic-preview.is-locked{color:var(--pw-muted)}.personal-lark-cardinality{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:9px;align-items:center;gap:8px;margin:0;padding:10px 12px;font-size:11px;display:flex}.personal-lark-modal footer{z-index:2;border-top:1px solid var(--pw-line);background:#fff;justify-content:flex-end;gap:9px;margin:0 -22px -22px;padding:12px 22px 22px;display:flex;position:sticky;bottom:-22px}.personal-lark-modal footer button{width:auto;min-width:96px;margin-top:0;padding:0 16px}@media (width<=640px){.personal-lark-agent-apps label{grid-template-columns:1fr}}.personal-lark-modal-backdrop.is-setup{z-index:90}.personal-lark-setup-modal{width:min(620px,100%)}.personal-lark-setup-copy{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-lark-setup-progress{border:1px solid var(--pw-line);background:#fafaf8;border-radius:13px;grid-template-columns:46px minmax(0,1fr);align-items:center;gap:13px;min-height:132px;padding:18px;display:grid}.personal-lark-setup-progress>div{gap:5px;display:grid}.personal-lark-setup-progress p{color:var(--pw-muted);margin:0;font-size:11px;line-height:1.5}.personal-lark-setup-progress a{width:fit-content;color:var(--pw-blue);grid-column:2;align-items:center;gap:6px;font-size:11px;font-weight:650;text-decoration:none;display:inline-flex}.personal-lark-setup-icon{background:var(--pw-blue-soft);width:46px;height:46px;color:var(--pw-blue);border-radius:13px;place-items:center;display:grid}.personal-lark-setup-icon.is-ready{background:var(--pw-green-bg);color:var(--pw-green)}.personal-lark-setup-icon.is-failed,.personal-row-status.is-blocking{background:var(--pw-red-bg);color:var(--pw-red)}.personal-proposal-row{width:100%;color:inherit;cursor:pointer;text-align:left;background:#f5f8ff;border:1px solid #c3d3f9;border-radius:14px;grid-template-columns:36px minmax(0,1fr) auto;align-items:center;gap:12px;padding:14px;display:grid}.personal-proposal-row:hover{border-color:#8fabe9;box-shadow:0 2px 10px #2f66e814}.personal-proposal-row>span:first-child{color:#315fc8;background:#e4ebff;border-radius:11px;place-items:center;width:36px;height:36px;display:grid}.personal-proposal-row>span:nth-child(2){gap:3px;min-width:0;display:grid}.personal-proposal-row small{color:#5f74ad;font-size:10px}.personal-proposal-row strong{font-size:13px}.personal-proposal-row p{color:#686f7c;margin:0;font-size:11px}.personal-proposal-row>b{color:#315fc8;font-size:11px}.personal-proposal-row.is-applied{background:#f3fbf7;border-color:#b5ddcc}.personal-proposal-row.is-error,.personal-proposal-row.is-stale{background:#fff7f7;border-color:#efc3c3}.personal-proposal-row.is-gated{background:#fffaf0;border-color:#ead39c}.personal-gated-summary{background:#fffaf0;border:1px solid #ead39c;border-radius:14px}.personal-gated-summary>summary{color:#6d5620;cursor:pointer;align-items:center;gap:9px;padding:12px 14px;list-style:none;display:flex}.personal-gated-summary>summary::-webkit-details-marker{display:none}.personal-gated-summary>summary>span{color:#9a741d;background:#fff1c9;border-radius:9px;place-items:center;width:30px;height:30px;display:grid}.personal-gated-summary>summary small{color:#927d4c;margin-left:auto}.personal-gated-summary>div{gap:8px;padding:0 8px 8px;display:grid}.personal-gated-summary .personal-proposal-row{background:#fffdf7}.personal-schedule-row{border:1px solid var(--pw-line);background:var(--pw-card);width:100%;color:inherit;cursor:pointer;text-align:left;border-radius:14px;grid-template-columns:36px minmax(0,1fr) auto 16px;align-items:center;gap:12px;padding:13px 15px;display:grid}.personal-schedule-row:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-schedule-icon{width:34px;height:34px;color:var(--pw-muted);background:#f2f1ed;border-radius:11px;place-items:center;display:grid}.personal-schedule-copy{gap:2px;min-width:0;display:grid}.personal-schedule-copy small,.personal-schedule-copy p{color:var(--pw-muted);margin:0;font-size:10px}.personal-schedule-copy strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;overflow:hidden}.personal-schedule-status{background:var(--pw-green-bg);color:var(--pw-green);border-radius:99px;align-items:center;padding:2.5px 10px;font-size:11px;font-weight:600;display:inline-flex}.personal-schedule-status.is-paused{color:var(--pw-muted);background:#f2f1ed}.personal-timeline-empty{text-align:center;place-items:center;padding:70px 20px;display:grid}.personal-timeline-empty>span{background:var(--pw-blue-soft);width:44px;height:44px;color:var(--pw-blue);border-radius:14px;place-items:center;margin-bottom:14px;display:grid}.personal-timeline-empty p{max-width:420px;color:var(--pw-muted);font-size:13px}.personal-object-list{border:1px solid var(--pw-line);background:#fff;border-radius:14px;overflow:hidden}.personal-object-list>header,.personal-object-list>button{border:0;border-bottom:1px solid var(--pw-line);width:100%;min-height:52px;color:inherit;text-align:left;background:0 0;grid-template-columns:28px minmax(0,1fr) auto;align-items:center;gap:10px;padding:10px 15px;display:grid}.personal-object-list>header{min-height:46px;color:var(--pw-faint);letter-spacing:.06em;grid-template-columns:minmax(0,1fr) auto;font-size:12px;font-weight:650}.personal-object-list>button{cursor:pointer}.personal-object-list>button:hover{background:#faf9f6}.personal-object-list>button:last-child{border-bottom:0}.personal-object-list>button>p{color:var(--pw-muted);text-overflow:ellipsis;white-space:nowrap;grid-column:2/-1;margin:-3px 0 0;font-size:12px;line-height:1.45;overflow:hidden}.personal-object-list>button>em{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:999px;justify-self:end;padding:2px 7px;font-size:10px;font-style:normal;font-weight:700}.personal-object-list small{color:var(--pw-muted)}.personal-object-list>button>small{white-space:nowrap;align-items:center;gap:8px;display:inline-flex}.personal-object-list-state{border-bottom:1px solid var(--pw-line);color:var(--pw-muted);align-items:center;gap:8px;margin:0;padding:14px 15px;font-size:12px;line-height:1.5;display:flex}.personal-object-list-state.is-error{color:var(--pw-red);background:var(--pw-red-bg)}.personal-object-list .is-done{color:var(--pw-green)}.personal-object-list .is-attention{color:var(--pw-amber);font-weight:700}.personal-task-age{color:var(--pw-faint);font-size:11px}.personal-task-empty{color:var(--pw-muted);margin:0;padding:4px 15px 16px;font-size:12.5px}.personal-task-lane-filter{border:1px solid var(--pw-line);background:#fff;border-radius:10px;justify-content:space-between;align-items:center;gap:16px;min-height:50px;padding:8px 12px;display:flex}.personal-capability-settings{grid-template-rows:auto minmax(0,1fr);gap:16px;width:100%;min-width:0;max-width:1050px;min-height:0;display:grid;overflow:hidden}.personal-capability-scope-note{overscroll-behavior:contain;max-height:120px;color:var(--pw-muted);padding:12px 0;overflow:auto}.personal-capability-scope-note summary{cursor:pointer;align-items:center;gap:8px;font-size:12px;display:flex}.personal-capability-scope-note p{padding:10px 0 0 25px}.personal-capability-scope-note svg{flex:none;margin-top:2px}.personal-capability-scope-note p{margin:0;font-size:12px;line-height:1.55}.personal-capability-scope-note strong{color:var(--pw-text);display:block}.personal-capability-layout{grid-template-columns:220px minmax(0,1fr);align-items:stretch;gap:24px;min-width:0;min-height:0;display:grid;overflow:hidden}.personal-capability-list{overscroll-behavior:contain;scrollbar-gutter:stable;align-content:start;gap:6px;min-height:0;padding:3px;display:grid;overflow-y:auto}.personal-capability-list button{min-height:44px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border:1px solid #0000;border-radius:6px;justify-content:space-between;align-items:center;gap:8px;padding:10px 12px;display:flex}.personal-capability-list button:hover{border-color:#b8c9f5}.personal-capability-list button[aria-current=page]{background:#f4f7ff;border-color:#8cacf0;box-shadow:0 0 0 3px #2f66e914}.personal-capability-list button>span{gap:2px;min-width:0;display:grid}.personal-capability-list em{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:999px;flex:none;padding:3px 6px;font-size:9px;font-style:normal;font-weight:750}.personal-capability-list strong{overflow-wrap:anywhere;font-size:13px;font-weight:500;line-height:1.5}.personal-capability-detail{overscroll-behavior:contain;scrollbar-gutter:stable;border:1px solid var(--pw-line);background:#fff;border-radius:14px;align-self:start;min-width:0;min-height:0;max-height:100%;overflow:auto}.personal-capability-detail>header{border-bottom:1px solid var(--pw-line);align-items:flex-start;gap:12px;padding:24px;display:flex}.personal-capability-detail>header>div{flex:1;min-width:0}.personal-capability-help{color:var(--pw-muted);margin-top:8px;font-size:12px}.personal-capability-help summary{cursor:pointer}.personal-capability-help p{padding-top:12px}.personal-capability-help dl{gap:12px;margin-bottom:0;display:grid}.personal-capability-help dt{color:var(--pw-text);font-weight:500}.personal-capability-help dd{margin:4px 0 0;line-height:1.6}.personal-capability-detail h2{margin:2px 0 4px;font-size:17px}.personal-capability-detail p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.55}.personal-capability-value-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:16px 18px;display:grid}.personal-capability-raw-values{border-top:1px solid var(--pw-line)}.personal-capability-raw-values>summary{cursor:pointer;color:var(--pw-text);padding:16px 18px;font-size:12px}.personal-capability-raw-values>summary:focus-visible{outline:2px solid var(--pw-blue);outline-offset:-2px}.personal-capability-value-grid section{min-width:0}.personal-capability-value-grid strong,.personal-capability-field-summary>strong{font-size:11px}.personal-capability-value-grid pre{border:1px solid var(--pw-line);min-height:72px;max-height:220px;color:var(--pw-text);background:#faf9f6;border-radius:9px;margin:7px 0 0;padding:11px;font-size:10.5px;line-height:1.5;overflow:auto}.personal-capability-editor-status{border-radius:10px;align-items:flex-start;gap:10px;margin:20px 24px;padding:12px;display:flex}.personal-capability-heading-row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;display:flex}.personal-capability-heading-row .personal-capability-effective-source{color:var(--pw-muted);align-items:center;gap:6px;margin:0;display:flex}.personal-capability-effective-source span{color:var(--pw-muted);flex-wrap:wrap;gap:6px;font-size:11px;display:flex}.personal-capability-effective-source strong{color:var(--pw-text)}.personal-capability-editor-status svg{flex:none;margin-top:1px}.personal-capability-editor-status strong{font-size:12px}.personal-capability-editor-status p{margin-top:3px}.personal-capability-editor-status.is-preview{background:var(--pw-blue-soft);color:var(--pw-blue-ink)}.personal-capability-editor-status.is-read-only{color:#9a5a10;background:#fff5e8}.personal-capability-behavior-note{border:1px solid var(--pw-line);background:var(--pw-amber-bg);color:var(--pw-amber);border-radius:6px;align-items:flex-start;gap:10px;margin:16px 24px;padding:12px;display:flex}.personal-capability-behavior-note svg{flex:none;margin-top:1px}.personal-capability-behavior-note strong{font-size:12px}.personal-capability-behavior-note p{color:inherit;margin-top:3px}.personal-capability-editor-mode{color:var(--pw-muted);justify-content:flex-end;align-items:center;gap:12px;margin:8px 24px 0;font-size:11px;display:flex}.personal-capability-editor-mode button{min-height:44px;color:var(--pw-muted);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;gap:6px;padding:0 12px;font-size:11px;font-weight:650;display:inline-flex}.personal-capability-editor-mode button:hover{background:var(--pw-blue-soft);color:var(--pw-text)}.personal-capability-editor-mode button:disabled{cursor:not-allowed;opacity:.45}.personal-capability-field-summary{padding:20px 24px 24px}.personal-capability-field-summary .personal-capability-fields{margin-top:0}.personal-capability-fields{border:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:0;padding:0;display:grid}.personal-report-schedule{grid-column:1/-1;grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr));gap:12px;min-width:0;display:grid}.personal-report-schedule p{color:var(--pw-muted);overflow-wrap:anywhere;grid-column:1/-1;margin:0;font-size:12px}.personal-capability-fields label{align-content:start;gap:6px;min-width:0;display:grid}.personal-capability-fields label>span{font-size:12px;font-weight:650}.personal-capability-fields input:not([type=checkbox]),.personal-capability-fields select,.personal-capability-fields textarea{border:1px solid var(--pw-line-strong);width:100%;min-width:0;min-height:42px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:8px 11px;font-size:13px}.personal-capability-fields .is-boolean{border-bottom:1px solid var(--pw-line);grid-column:1/-1;grid-template-columns:minmax(0,1fr) auto;align-items:center;min-height:48px;padding-bottom:12px}.personal-capability-enabled-row{border-bottom:1px solid var(--pw-line);grid-column:1/-1;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:16px;min-width:0;min-height:60px;padding-bottom:12px;display:grid}.personal-capability-enabled-row>.is-boolean{display:contents}.personal-capability-enabled-row>.is-boolean>span{grid-area:1/1}.personal-capability-enabled-row>.is-boolean>input{grid-area:1/3}.personal-capability-enabled-row>.personal-capability-edit-json{grid-area:1/2}.personal-capability-edit-json{min-height:44px;color:var(--pw-muted);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;align-items:center;gap:6px;padding:0 8px;font-size:11px;display:inline-flex}.personal-capability-edit-json:hover{background:var(--pw-blue-soft);color:var(--pw-text)}.personal-capability-edit-json:disabled{cursor:not-allowed;opacity:.45}.personal-capability-fields .is-boolean input{appearance:none;border:1px solid var(--pw-line-strong);background:var(--pw-line);cursor:pointer;border-radius:999px;width:40px;height:24px;margin:0;padding:2px}.personal-capability-fields .is-boolean input:before{content:"";background:#fff;border-radius:50%;width:18px;height:18px;display:block}.personal-capability-fields .is-boolean input:checked{background:var(--pw-text)}.personal-capability-fields .is-boolean input:checked:before{transform:translate(16px)}.personal-capability-fields .is-boolean input:focus-visible{outline:2px solid var(--pw-blue);outline-offset:3px}.personal-capability-fields:disabled{opacity:.62}.personal-capability-json-editor{gap:7px;margin:0;padding:0 18px 18px;display:grid}.personal-capability-json-editor>span{font-size:11px;font-weight:650}.personal-capability-json-editor>small{color:var(--pw-muted);font-size:10.5px;line-height:1.5}.personal-capability-json-editor textarea{resize:vertical;border:1px solid var(--pw-line-strong);width:100%;min-width:0;color:var(--pw-text);tab-size:2;background:#fafafa;border-radius:9px;padding:12px 13px;font:12px/1.6 SFMono-Regular,Consolas,monospace}.personal-capability-json-editor textarea:focus-visible{outline:2px solid var(--pw-blue);outline-offset:2px}.personal-capability-preview{background:#f4f7ff;border:1px solid #9fb9f4;border-radius:10px;grid-template-columns:minmax(0,1fr) auto;gap:3px 12px;margin:0 18px 16px;padding:12px;display:grid}.personal-capability-preview strong{font-size:12px}.personal-capability-preview span{color:var(--pw-blue-ink);font-size:11px;font-weight:700}.personal-capability-preview small{color:var(--pw-muted);grid-column:1/-1;font-size:10.5px}.personal-capability-actions{border-top:1px solid var(--pw-line);background:0 0;justify-content:flex-end;gap:9px;padding:14px 18px;display:flex}.personal-capability-actions button{border:1px solid var(--pw-line-strong);min-height:44px;color:var(--pw-text);cursor:pointer;font:inherit;background:#fff;border-radius:9px;padding:0 14px;font-size:12px;font-weight:700}.personal-capability-actions button.is-primary{border-color:var(--pw-blue);background:var(--pw-blue);color:#fff}.personal-capability-actions button.is-danger{color:var(--pw-red);align-items:center;gap:6px;margin-right:auto;display:inline-flex}.personal-capability-actions button:disabled{cursor:not-allowed;opacity:.5}.personal-capability-empty,.personal-capability-error{border:1px solid var(--pw-line);max-width:720px;min-height:56px;color:var(--pw-muted);background:#fff;border-radius:11px;align-items:center;gap:9px;margin:0;padding:14px;font-size:12px;display:flex}.personal-capability-error{color:var(--pw-red);border-color:#efc1ba}.personal-capability-error span{gap:2px;display:grid}.personal-capability-error small{color:var(--pw-muted)}.personal-capability-error button{min-height:44px;color:inherit;cursor:pointer;background:0 0;border:1px solid;border-radius:9px;align-items:center;gap:6px;margin-left:auto;padding:0 12px;display:inline-flex}.personal-capability-recovery{color:#74530d;background:#fffaf0;border:1px solid #dfc98d;border-radius:10px;grid-template-columns:auto minmax(0,1fr) auto;align-items:start;gap:9px;margin:0 20px 16px;padding:12px;font-size:11px;line-height:1.5;display:grid}.personal-capability-recovery div{gap:3px;display:grid}.personal-capability-recovery p{margin:0}.personal-capability-recovery small{color:var(--pw-muted);overflow-wrap:anywhere}.personal-capability-recovery button{min-height:40px;color:inherit;cursor:pointer;background:0 0;border:1px solid;border-radius:8px;align-items:center;gap:6px;padding:0 10px;display:inline-flex}.personal-task-lane-filter>div{min-width:0;color:var(--pw-muted);align-items:center;gap:9px;display:flex}.personal-task-lane-filter>div>span{gap:1px;display:grid}.personal-task-lane-filter strong{color:var(--pw-text);font-size:12px}.personal-task-lane-filter small{color:var(--pw-faint);font-size:10.5px}.personal-task-lane-filter label{border:1px solid var(--pw-line-strong);background:var(--pw-bg);border-radius:8px;align-items:center;gap:6px;min-height:34px;padding:0 9px;display:flex}.personal-task-lane-filter select{max-width:300px;color:var(--pw-text);font:inherit;appearance:none;background:0 0;border:0;outline:0;font-size:11.5px;font-weight:600}.personal-task-board{flex-direction:column;gap:12px;height:100%;min-height:0;display:flex}.personal-channel-scroll:has(.personal-task-board.is-list-view){overflow-y:auto}.personal-task-board.is-list-view{gap:24px;height:auto;min-height:100%}.personal-task-view-toolbar{flex:none;justify-content:space-between;align-items:center;gap:16px;display:flex}.personal-task-view-toolbar>div:first-child{gap:4px;display:grid}.personal-task-view-toolbar strong{font-size:16px;font-weight:600}.personal-task-view-toolbar span{color:var(--pw-muted);font-size:12px}.personal-task-view-switch{border:1px solid var(--pw-line);background:var(--pw-bg);border-radius:8px;flex:none;padding:3px;display:flex}.personal-task-view-switch button{min-height:36px;color:var(--pw-muted);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:5px;padding:0 14px;font-size:13px}.personal-task-view-switch button[aria-pressed=true]{background:var(--pw-text);color:var(--pw-bg)}.personal-task-grouped-list{gap:24px;padding-bottom:24px;display:grid}.personal-completed-list{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px}.personal-completed-list>header{min-height:48px;color:var(--pw-text);padding:2px 16px}.personal-completed-list>header>button{color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;min-height:44px;padding:0}.personal-completed-list .personal-task-lane-scroll{height:480px;max-height:60vh;overflow-y:auto}.personal-completed-list .personal-task-lane-scroll[hidden]{display:none}.personal-completed-list .personal-completed-row>button{border:0;border-bottom:1px solid var(--pw-line);text-align:left;background:0 0;grid-template-columns:20px minmax(0,1fr);gap:8px 12px;width:100%;height:100%;padding:16px;display:grid}.personal-completed-list .personal-completed-row>button>strong{-webkit-line-clamp:2}.personal-completed-list .personal-completed-row>button>small{grid-column:2}.personal-task-group{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;min-width:0}.personal-task-group>summary{cursor:pointer;align-items:center;gap:8px;min-height:48px;padding:10px 16px;list-style:none;display:flex}.personal-task-group>summary::-webkit-details-marker{display:none}.personal-task-group>summary strong{font-size:12px;font-weight:600;line-height:18px}.personal-task-group>summary span{background:var(--pw-line);color:var(--pw-muted);border-radius:6px;padding:2px 7px;font-size:12px}.personal-task-group>summary svg{color:var(--pw-muted);transform:rotate(-90deg)}.personal-task-group[open]>summary svg{transform:none}.personal-task-group.tone-attention>summary{color:var(--pw-amber)}.personal-task-list-rows{padding:0 16px 8px}.personal-task-list-rows>button,.personal-task-list-rows>.personal-task-card>button{border:0;border-top:1px solid var(--pw-line);width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border-radius:0;grid-template-columns:20px minmax(0,1fr);gap:8px 12px;padding:16px 4px;display:grid}.personal-task-list-rows>button:hover,.personal-task-list-rows>.personal-task-card>button:hover{background:var(--pw-line)}.personal-task-list-rows>button>strong,.personal-task-list-rows>.personal-task-card>button>strong{-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;font-size:14px;font-weight:500;line-height:20px;display:-webkit-box;overflow:hidden}.personal-task-list-rows>button>small,.personal-task-list-rows>.personal-task-card>button>small{color:var(--pw-muted);overflow-wrap:anywhere;flex-wrap:wrap;grid-column:2;align-items:center;gap:8px;font-size:12px;line-height:16px;display:flex}.personal-task-list-rows .personal-task-card-actions{background:var(--pw-card);top:auto;bottom:12px}@media (width>=721px){.personal-channel-header:has(~.personal-channel-scroll .is-list-view){flex-wrap:wrap}.personal-channel-header:has(~.personal-channel-scroll .is-list-view) .personal-channel-title{flex-basis:100%}}.personal-task-kanban{flex:1;grid-template-columns:repeat(auto-fit,minmax(172px,1fr));align-items:stretch;gap:12px;min-height:0;display:grid}.personal-task-chat-receipt{background:#f8faff;border:1px solid #d8e2f8;border-radius:10px;grid-template-columns:28px minmax(0,1fr) auto;align-items:center;gap:10px;padding:8px 12px;display:grid;box-shadow:0 1px 3px #2f66e90a}.personal-task-chat-icon{background:var(--pw-blue-soft);width:28px;height:28px;color:var(--pw-blue-ink);border-radius:8px;place-items:center;display:grid}.personal-task-chat-receipt>div{min-width:0}.personal-task-chat-receipt header{align-items:center;gap:8px;display:flex}.personal-task-chat-receipt header strong{font-size:12px;font-weight:650}.personal-task-chat-receipt header small{color:var(--pw-faint);font-size:10px}.personal-task-chat-receipt p{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;grid-template-columns:36px minmax(0,1fr);gap:5px;margin:3px 0;font-size:12px;line-height:1.4;display:grid;overflow:hidden}.personal-task-chat-receipt p b{color:var(--pw-faint);font-size:10px;font-weight:650}.personal-task-chat-receipt p.is-assistant{max-height:2.8em;color:var(--pw-muted);white-space:normal}.personal-task-chat-receipt>div>small{color:var(--pw-muted);font-size:10.5px;line-height:1.4}.personal-task-chat-receipt footer{gap:6px;display:flex}.personal-task-chat-receipt footer button{min-height:26px;color:var(--pw-blue-ink);cursor:pointer;white-space:nowrap;background:#fff;border:1px solid #b9c9ee;border-radius:7px;align-items:center;gap:4px;padding:3px 8px;font-size:10.5px;font-weight:650;display:inline-flex}.personal-task-chat-receipt footer button:hover{border-color:var(--pw-blue);background:var(--pw-blue-soft)}.personal-task-kanban .personal-object-list{background:#f6f4ee;flex-direction:column;min-height:0;padding:0;display:flex}.personal-task-kanban .personal-object-list>header{background:#f6f4ee;border-bottom:1px solid #e0ddd4b8;flex:none;align-items:center;gap:8px;min-height:38px;padding:10px 16px 7px;display:flex}.personal-task-kanban .personal-object-list>header>strong{align-items:center;gap:7px;min-width:0;font-size:12px;display:inline-flex}.personal-task-kanban .personal-object-list>header>span{margin-left:auto}.personal-task-lane-scroll{overscroll-behavior-y:contain;scrollbar-color:#bebbb2 transparent;scrollbar-gutter:stable;scrollbar-width:thin;-webkit-overflow-scrolling:touch;flex-direction:column;flex:auto;gap:8px;min-height:0;padding:8px;scroll-padding-block:8px;display:flex;overflow-y:auto}.personal-task-lane-scroll:focus-visible{outline:2px solid var(--pw-blue);outline-offset:-3px}.personal-task-lane-scroll.has-overflow-before{box-shadow:inset 0 12px 10px -13px #34312b94}.personal-task-lane-scroll.has-overflow-after{box-shadow:inset 0 -16px 12px -15px #34312bb3}.personal-task-lane-scroll.has-overflow-before.has-overflow-after{box-shadow:inset 0 12px 10px -13px #34312b94,inset 0 -16px 12px -15px #34312bb3}.personal-task-lane-scroll::-webkit-scrollbar{width:10px}.personal-task-lane-scroll::-webkit-scrollbar-track{background:0 0}.personal-task-lane-scroll::-webkit-scrollbar-thumb{background:#bebbb2 padding-box padding-box;border:3px solid #0000;border-radius:999px;min-height:40px}.personal-task-lane-scroll::-webkit-scrollbar-thumb:hover{background:#97938a padding-box padding-box}.personal-kanban-dot{background:var(--pw-faint);border-radius:50%;width:8px;height:8px}.personal-kanban-dot.tone-attention{background:var(--pw-amber)}.personal-kanban-dot.tone-progress{background:var(--pw-blue)}.personal-kanban-dot.tone-schedule{background:#8a6fd6}.personal-kanban-dot.tone-done{background:var(--pw-green)}.personal-task-kanban .personal-task-lane-scroll>button,.personal-task-kanban .personal-task-card>button{border:1px solid var(--pw-line);width:100%;min-height:0;color:inherit;text-align:left;cursor:pointer;background:#fff;border-radius:10px;grid-template-columns:18px minmax(0,1fr);align-items:center;gap:6px 8px;padding:10px 12px;display:grid;box-shadow:0 1px 3px #1e1c140f}.personal-task-kanban .personal-task-lane-scroll>button:hover,.personal-task-kanban .personal-task-card>button:hover{border-color:var(--pw-line-strong);background:#fff;box-shadow:0 2px 8px #1e1c1417}.personal-task-kanban .personal-task-lane-scroll>button>small,.personal-task-kanban .personal-task-card>button>small{white-space:normal;text-align:left;flex-wrap:wrap;grid-column:1/-1;justify-content:flex-start;align-items:center;gap:8px;display:inline-flex}.personal-task-kanban .personal-task-lane-scroll>button:last-child{border-bottom:1px solid var(--pw-line)}.personal-task-kanban .personal-task-lane-scroll>button:last-child:hover{border-color:var(--pw-line-strong)}.personal-task-lane-scroll>button,.personal-task-card{flex:none;min-width:0}.personal-task-lane-scroll>button>small,.personal-task-card>button>small{font-size:12px;line-height:16px}.personal-task-lane-scroll>button>strong,.personal-task-card>button>strong{-webkit-line-clamp:3;overflow-wrap:anywhere;-webkit-box-orient:vertical;font-size:14px;font-weight:500;line-height:20px;display:-webkit-box;overflow:hidden}.personal-task-card{position:relative}.personal-completed-window{flex-shrink:0;position:relative}.personal-completed-row{padding-bottom:8px;position:absolute;inset-inline:0}.personal-completed-row>button{width:100%;height:100%}.personal-completed-row>button>strong{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.personal-completed-footer{color:var(--pw-muted);text-align:center;flex-shrink:0;padding:12px 4px;font-size:12px}.personal-completed-footer button{border:1px solid var(--pw-line);min-height:32px;color:inherit;cursor:pointer;background:0 0;border-radius:6px}.personal-task-card>button{width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:start;display:grid}.personal-task-card-actions{opacity:0;gap:4px;transition:opacity .12s;display:flex;position:absolute;top:6px;right:6px}.personal-task-card:hover .personal-task-card-actions,.personal-task-card:focus-within .personal-task-card-actions,.personal-task-card.has-session .personal-task-card-actions{opacity:1}.personal-task-card.is-selected>button,.personal-task-kanban .personal-task-lane-scroll>button.is-selected{background:#f5f8ff;border-color:#7c9df1;box-shadow:0 0 0 2px #2f66e91f,0 4px 14px #1e34681a}.personal-task-card.is-selected:before{z-index:2;background:var(--pw-blue);content:"";border-radius:0 3px 3px 0;width:3px;position:absolute;top:8px;bottom:8px;left:0}.personal-task-card-actions button{border:1px solid var(--pw-line-strong);width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:7px;place-items:center;padding:0;display:grid;box-shadow:0 1px 3px #1e1c141f}.personal-task-card-actions button:hover{color:var(--pw-text);border-color:var(--pw-text)}.personal-task-card-actions button:disabled{cursor:wait;opacity:.72}.personal-task-card-actions .personal-task-session-link{width:auto;color:var(--pw-blue-ink);opacity:1;gap:5px;padding:0 8px;display:flex}.personal-task-session-link span{white-space:nowrap;font-size:10.5px;font-weight:650}.personal-task-session-status{color:var(--pw-blue-ink);font-weight:650}.personal-task-kanban .personal-task-empty{border:1px dashed var(--pw-line-strong);text-align:center;border-radius:10px;margin:2px 0 4px;padding:16px 10px;font-size:12px}.personal-workspace-shell.has-drawer .personal-task-kanban{grid-template-columns:repeat(2,minmax(0,1fr))}.personal-workspace-shell.has-task-inspector .personal-channel-scroll:has(.personal-task-kanban){padding-inline:20px}.personal-workspace-shell.has-task-inspector .personal-task-kanban{grid-template-columns:repeat(4,260px);width:max-content;min-width:100%}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-receipt{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-icon{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-receipt footer button{color:#141414;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-composer-wrap{background:linear-gradient(transparent, var(--pw-bg) 22%);padding:10px max(26px,50% - 410px) 20px}.personal-read-only-notice{border:1px solid var(--pw-line);min-height:46px;color:var(--pw-muted);background:#f5f4f1;border-radius:12px;justify-content:center;align-items:center;gap:8px;padding:10px 16px;font-size:11.5px;display:flex}.personal-read-only-notice strong{color:var(--pw-text);white-space:nowrap}.personal-manager-conversation-tray{width:100%;max-height:320px;color:inherit;font:inherit;text-align:left;background:#fffffff7;border:1px solid #bfcdf1;border-radius:14px;gap:9px;margin-bottom:10px;padding:12px 14px;animation:.16s cubic-bezier(.16,1,.3,1) pw-tray-in;display:grid;overflow:hidden;box-shadow:0 5px 20px #223e781a}@keyframes pw-tray-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}.personal-manager-conversation-tray:hover{border-color:#8fa9ee;box-shadow:0 7px 24px #223e7824}.personal-manager-conversation-tray:focus-within{border-color:var(--pw-blue);box-shadow:0 0 0 3px #2f66e921,0 5px 20px #223e781a}.personal-manager-conversation-tray>header{justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-manager-conversation-tray>header>span{color:var(--pw-blue-ink);align-items:center;gap:7px;display:flex}.personal-manager-conversation-tray>header strong{font-size:16px;font-weight:600;line-height:24px}.personal-manager-conversation-tray>header small{color:var(--pw-faint);font-size:12px;font-weight:500;line-height:16px}.personal-manager-conversation-actions{align-items:center;gap:8px;display:flex}.personal-manager-conversation-btn{min-height:32px;color:var(--pw-blue-ink);cursor:pointer;background:#f4f7fe;border:1px solid #b9c9ee;border-radius:8px;align-items:center;gap:5px;padding:5px 10px;font-size:12px;font-weight:600;line-height:16px;transition:all .12s;display:inline-flex}.personal-manager-conversation-btn:hover{background:var(--pw-blue-soft);border-color:var(--pw-blue)}.personal-manager-conversation-link{min-height:32px;color:var(--pw-blue);cursor:pointer;background:0 0;border:0;border-radius:7px;align-items:center;padding:5px 8px;font-size:14px;font-weight:500;line-height:20px;transition:background .12s;display:inline-flex}.personal-manager-conversation-link:hover{background:var(--pw-blue-soft)}.personal-manager-conversation-close{width:32px;height:32px;color:var(--pw-faint);cursor:pointer;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;padding:0;transition:all .12s;display:inline-flex}.personal-manager-conversation-close:hover{color:#ef4444;background:#fee2e2}.personal-manager-conversation-messages{gap:7px;max-height:220px;display:grid;overflow-y:auto}.personal-manager-conversation-messages article{background:#f5f7fc;border-radius:10px;grid-template-columns:86px minmax(0,1fr);gap:10px;padding:10px 12px;font-size:14px;line-height:20px;display:grid}.personal-manager-conversation-messages article.is-user{background:#edf3ff}.personal-manager-conversation-messages article strong{color:var(--pw-muted);font-size:12px;font-weight:500;line-height:16px}.personal-manager-conversation-bubble{min-width:0}.personal-manager-conversation-bubble p{white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.personal-manager-conversation-bubble .personal-md{font-size:14px;line-height:20px}.personal-manager-conversation-bubble small{color:var(--pw-blue);margin-top:4px;font-size:12px;line-height:16px;display:inline-block}.personal-quick-prompts{flex-wrap:wrap;gap:8px;margin-bottom:9px;display:flex}.personal-quick-prompts button{border:1px solid var(--pw-line-strong);min-height:32px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:99px;align-items:center;gap:6px;padding:5px 12px;font-size:12.5px;transition:all .14s;display:inline-flex}.personal-quick-prompts button:hover{border-color:var(--pw-blue);color:var(--pw-blue-ink)}.personal-quick-prompts button.is-draft{color:var(--pw-body);border-color:#dbe4f8}.personal-quick-prompts button.is-draft:hover{color:var(--pw-blue-ink);background:#fafaf8;border-color:#9cbdf8}.personal-quick-prompts button.is-immediate{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-color:#9cbdf8;font-weight:600}.personal-quick-prompts button.is-immediate:hover{border-color:var(--pw-blue);background:#dce7fe;box-shadow:0 1px 4px #2f66e92e}.personal-prompt-badge{color:#fff;letter-spacing:.02em;background:#2f66e9;border-radius:99px;padding:1px 6px;font-size:10px;font-style:normal;font-weight:600;line-height:1.3}.personal-prompt-subtle{color:var(--pw-faint);font-size:10.5px;font-weight:400}.personal-goal-draft-status{color:var(--pw-muted);background:#f5f7ff;border:1px solid #cfd9f5;border-radius:10px;align-items:center;gap:8px;margin-bottom:9px;padding:8px 11px;font-size:11px;display:flex}.personal-goal-draft-status strong{color:var(--pw-text)}.personal-channel-composer{border:1px solid var(--pw-line-strong);background:#fff;border-radius:16px;grid-template-columns:auto 36px minmax(0,1fr) 40px;align-items:center;min-height:56px;padding:7px 7px 7px 14px;transition:border-color .15s,box-shadow .15s;display:grid;box-shadow:0 2px 10px #1e1c1412}.personal-channel-composer:focus-within{border-color:var(--pw-blue);box-shadow:0 0 0 3px #2f66e921,0 2px 10px #1e1c1412}.personal-channel-composer>span{color:#535b68;align-items:center;gap:7px;padding-right:12px;font-size:12.5px;font-weight:650;display:flex}.personal-channel-composer textarea{resize:none;border:0;border-left:1px solid var(--pw-line);width:100%;max-height:120px;color:inherit;font:inherit;background:0 0;outline:0;padding:9px 12px;line-height:1.4}.personal-channel-composer>button,.personal-correction-composer button{background:var(--pw-blue);color:#fff;cursor:pointer;border:0;border-radius:12px;place-items:center;width:40px;height:40px;display:grid;box-shadow:0 2px 6px #2f66e952}.personal-channel-composer>button:hover{background:var(--pw-blue-ink)}.personal-channel-composer>button:disabled,.personal-correction-composer button:disabled{opacity:.4;cursor:default;box-shadow:none}.personal-channel-composer>.personal-composer-attach{width:34px;height:34px;color:var(--pw-muted);box-shadow:none;background:0 0;border-radius:9px}.personal-channel-composer>.personal-composer-attach:hover{background:var(--pw-blue-soft);color:var(--pw-blue-ink)}.personal-composer-images{gap:8px;margin:0 0 8px;display:flex;overflow-x:auto}.personal-composer-images figure{flex:0 0 74px;height:58px;margin:0;position:relative}.personal-composer-images img{object-fit:cover;border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;width:100%;height:100%}.personal-composer-images button{border:1px solid var(--pw-line-strong);width:20px;height:20px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:50%;place-items:center;padding:0;display:grid;position:absolute;top:-5px;right:-5px;box-shadow:0 1px 4px #1e1c142e}.personal-composer-error{color:var(--pw-red);margin:0 0 7px;font-size:11.5px}.personal-context-drawer{grid-template-rows:auto minmax(0,1fr);height:100vh;display:grid}.personal-drawer-header{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:flex-start;min-height:84px;padding:20px 18px 16px;display:flex}.personal-drawer-header h2{letter-spacing:-.01em;margin:0;font-size:15.5px;font-weight:700}.personal-drawer-header p{color:var(--pw-faint);letter-spacing:.07em;text-transform:uppercase;margin:4px 0 0;font-size:11px;font-weight:650}.personal-drawer-close{flex:0 0 44px;width:44px;height:44px;margin-top:2px}.personal-drawer-body{padding:18px;overflow:auto}.personal-context-drawer[data-context-kind=todo]{background:#fbfbfc}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header{background:#fff;min-height:68px;padding:11px 22px}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header h2{font-size:14px}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header p{text-overflow:ellipsis;white-space:nowrap;max-width:330px;overflow:hidden}.personal-drawer-header-actions{align-items:center;gap:6px;display:flex}.personal-drawer-header-actions .personal-icon-button{flex:none}.personal-context-drawer[data-context-kind=todo] .personal-drawer-body{padding:0}.personal-task-inspector-summary{border-bottom:1px solid var(--pw-line);background:#fff;padding:24px 24px 20px}.personal-task-inspector-summary h3{letter-spacing:-.015em;overflow-wrap:anywhere;margin:14px 0 0;font-size:18px;font-weight:680;line-height:1.55}.personal-task-inspector-status{flex-wrap:wrap;align-items:center;gap:7px;display:flex}.personal-task-inspector-status>span{color:#62697a;background:#f1f2f5;border-radius:6px;align-items:center;gap:6px;min-height:24px;padding:2px 8px;font-size:11px;font-weight:650;display:inline-flex}.personal-task-inspector-status>span:first-child{padding-left:7px}.personal-task-inspector-status i{background:var(--pw-blue);border-radius:50%;width:7px;height:7px}.personal-task-inspector-status .is-done{background:var(--pw-green-bg);color:var(--pw-green)}.personal-task-inspector-status .is-done i{background:var(--pw-green)}.personal-task-inspector-status .is-blocked{background:var(--pw-red-bg);color:var(--pw-red)}.personal-task-inspector-status .is-blocked i{background:var(--pw-red)}.personal-task-inspector-fields{background:#fff;padding:20px 24px 22px}.personal-task-inspector-fields h4{color:var(--pw-text);margin:0 0 9px;font-size:12px;font-weight:700}.personal-task-inspector-fields dl{border-top:1px solid var(--pw-line);margin:0}.personal-task-inspector-fields dl div{border-bottom:1px solid var(--pw-line);grid-template-columns:92px minmax(0,1fr);gap:14px;min-height:44px;padding:11px 0;font-size:12px;line-height:1.55;display:grid}.personal-task-inspector-fields dt{color:var(--pw-muted)}.personal-task-inspector-fields dd{color:var(--pw-text);overflow-wrap:anywhere;margin:0}.personal-task-inspector-actions{border-top:1px solid var(--pw-line-strong);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fffffff5;grid-template-columns:auto minmax(170px,1fr);gap:10px;padding:13px 18px;display:grid;position:sticky;bottom:0;box-shadow:0 -8px 26px #1e284012}.personal-task-inspector-actions>.personal-primary-action{min-height:40px;margin:0}.personal-task-management{position:relative}.personal-task-management>summary{border:1px solid var(--pw-line-strong);min-width:128px;min-height:40px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:9px;justify-content:center;align-items:center;gap:7px;padding:0 14px;font-size:12px;font-weight:650;list-style:none;display:flex}.personal-task-management>summary::-webkit-details-marker{display:none}.personal-task-management[open]>summary{color:var(--pw-blue-ink);border-color:#9db3e9}.personal-task-management>div{border:1px solid var(--pw-line-strong);background:#fff;border-radius:12px;gap:9px;width:390px;padding:14px;display:grid;position:absolute;bottom:calc(100% + 9px);left:0;box-shadow:0 16px 38px #1e284029}.personal-task-management>div>strong{color:var(--pw-muted);font-size:10.5px;font-weight:650}.personal-task-management-secondary{border-top:1px solid var(--pw-line);grid-template-columns:1fr 1fr;gap:7px;padding-top:4px;display:grid}.personal-task-management-secondary button{border:1px solid var(--pw-line-strong);min-height:34px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:8px;font-size:11.5px}.personal-task-management-secondary button:hover{background:#f6f7fa}.personal-task-completed-note{background:var(--pw-green-bg);color:var(--pw-green);border:1px solid #cde4d8;border-radius:10px;align-items:center;gap:10px;margin:12px 24px 24px;padding:12px 14px;display:flex}.personal-task-completed-note>span{gap:2px;display:grid}.personal-task-completed-note strong{font-size:12px}.personal-task-completed-note small{color:#5d786c;font-size:10.5px}.personal-detail-card,.personal-correction-panel{border:1px solid var(--pw-line);background:#fff;border-radius:14px;padding:15px}.personal-proposal-card{background:#f5f8ff;border:1px solid #c3d3f9;border-radius:14px;padding:16px}.personal-proposal-card>small{color:#5270bd;letter-spacing:.05em;font-size:11px;font-weight:650}.personal-proposal-card h3{margin:8px 0;font-size:15.5px}.personal-proposal-card p{color:#5f6570;font-size:12px;line-height:1.55}.personal-proposal-card dl{gap:8px;margin:14px 0 0;display:grid}.personal-proposal-card dl div{grid-template-columns:82px minmax(0,1fr);gap:10px;font-size:11.5px;display:grid}.personal-proposal-card dt{color:var(--pw-faint)}.personal-proposal-card dd{overflow-wrap:anywhere;margin:0}.personal-proposal-state{border-radius:9px;align-items:center;gap:7px;margin:10px 0 0;padding:10px 12px;font-size:11px;display:flex}.personal-proposal-state.is-applied{background:var(--pw-green-bg);color:var(--pw-green)}.personal-proposal-state.is-stale,.personal-proposal-state.is-error{background:var(--pw-red-bg);color:var(--pw-red)}.personal-proposal-state.is-gated{color:#825a00;background:#fff6df;gap:6px;display:grid}.personal-proposal-state.is-gated>span{gap:3px;display:grid}.personal-proposal-state.is-gated small{line-height:1.5}.personal-workspace-candidates{gap:8px;margin-top:10px;display:grid}.personal-workspace-candidates button{color:#263e76;cursor:pointer;text-align:left;background:#fff;border:1px solid #c3d3f9;border-radius:10px;gap:3px;min-height:48px;padding:9px 12px;display:grid}.personal-workspace-candidates small{color:var(--pw-muted)}.personal-detail-card.is-attention{background:#fffdf7;border-color:#f1d8ac}.personal-detail-card small{color:var(--pw-muted);font-size:11px}.personal-detail-card h3{margin:7px 0;font-size:14.5px;line-height:1.5}.personal-detail-card p,.personal-correction-panel p{color:var(--pw-muted);font-size:12px;line-height:1.55}.personal-detail-card dl{gap:9px;margin:14px 0 0;display:grid}.personal-detail-card dl div{grid-template-columns:74px minmax(0,1fr);gap:10px;font-size:12px;display:grid}.personal-detail-card dt{color:var(--pw-faint)}.personal-detail-card dd{overflow-wrap:anywhere;margin:0}.personal-run-drawer-tabs{background:#efefec;border-radius:11px;grid-template-columns:1fr 1fr;gap:4px;padding:4px;display:grid}.personal-run-drawer-tabs button{min-height:36px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;padding:0 8px;font-size:12px;font-weight:650}.personal-run-drawer-tabs button[aria-selected=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c141f}.personal-session-summary{margin-top:12px}.personal-session-message-record{margin-top:14px}.personal-session-message-record>h3{color:var(--pw-faint);letter-spacing:.06em;text-transform:uppercase;margin:0 0 10px;font-size:11px}.personal-session-message-record ol{gap:0;margin:0;padding:0;list-style:none;display:grid}.personal-session-message-record li{grid-template-columns:13px minmax(0,1fr);gap:9px;padding-bottom:15px;display:grid}.personal-session-message-record li>i,.personal-session-active-step>i{background:var(--pw-green);width:9px;height:9px;box-shadow:0 0 0 3px var(--pw-green-bg);border-radius:50%;margin-top:5px}.personal-session-message-record li.is-user>i{background:var(--pw-blue);box-shadow:0 0 0 3px var(--pw-blue-soft)}.personal-session-message-record li.is-error>i{background:var(--pw-red);box-shadow:0 0 0 3px var(--pw-red-bg)}.personal-session-message-record li>div{border-bottom:1px solid var(--pw-line);gap:5px;min-width:0;padding:0 0 15px;display:grid}.personal-session-message-record li header{justify-content:space-between;align-items:center;gap:8px;display:flex}.personal-session-message-record li strong{font-size:12px}.personal-session-message-record time{color:var(--pw-faint);font-size:10px}.personal-session-message-record li p{max-height:180px;color:var(--pw-muted);white-space:pre-wrap;margin:0;font-size:11.5px;line-height:1.6;overflow:auto}.personal-session-empty{border:1px dashed var(--pw-line-strong);color:var(--pw-muted);text-align:center;border-radius:10px;margin:0;padding:18px 12px;font-size:11.5px}.personal-session-active-step{grid-template-columns:13px minmax(0,1fr);align-items:start;gap:9px;padding-top:4px;display:grid}.personal-session-active-step>i{background:var(--pw-blue);box-shadow:0 0 0 3px var(--pw-blue-soft);animation:1.4s ease-in-out infinite personal-session-pulse}.personal-session-active-step>span{gap:3px;display:grid}.personal-session-active-step strong{font-size:12px}.personal-session-active-step small{color:var(--pw-muted);font-size:10.5px}@keyframes personal-session-pulse{50%{opacity:.35}}.personal-todo-actions{grid-template-columns:1fr 1fr;gap:8px;margin-top:12px;display:grid}.personal-todo-actions>button{margin-top:0}.personal-todo-actions-title{color:var(--pw-faint);letter-spacing:.06em;grid-column:1/-1;font-size:11px;font-weight:650}.personal-todo-actions .personal-primary-action,.personal-todo-actions .personal-compact-menu{grid-column:1/-1;margin-top:0}.personal-inline-agent-select{border:1px solid var(--pw-line);color:var(--pw-muted);border-radius:10px;grid-column:1/-1;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px;padding:8px;font-size:11px;display:grid}.personal-inline-agent-select select{border:1px solid var(--pw-line-strong);color:#333;background:#fff;border-radius:8px;min-width:0;min-height:36px;padding:0 8px}.personal-inline-agent-select .personal-secondary-action{width:auto;min-height:36px;margin:0;padding:0 12px}.personal-inline-resume-when input{border:1px solid var(--pw-line-strong);color:#333;background:#fff;border-radius:8px;min-width:0;min-height:36px;padding:0 8px}.personal-inline-resume-when small{color:var(--pw-faint);grid-column:2/-1}.personal-primary-action,.personal-secondary-action,.personal-danger-action{cursor:pointer;border-radius:11px;justify-content:center;align-items:center;gap:8px;width:100%;min-height:42px;margin-top:12px;font-size:13.5px;font-weight:650;display:flex}.personal-primary-action{border:1px solid var(--pw-blue);background:var(--pw-blue);color:#fff;box-shadow:0 2px 6px #2f66e947}.personal-primary-action:hover{background:var(--pw-blue-ink)}.personal-secondary-action{border:1px solid var(--pw-line-strong);color:var(--pw-text);background:#fff}.personal-secondary-action:hover{border-color:var(--pw-faint)}.personal-danger-action{color:var(--pw-red);background:#fff;border:1px solid #efd2cd}.personal-danger-action:hover{background:var(--pw-red-bg)}.personal-primary-action:disabled,.personal-secondary-action:disabled,.personal-danger-action:disabled{opacity:.46;cursor:default;box-shadow:none}.personal-drawer-action-grid{grid-template-columns:1fr 1fr;gap:8px;display:grid}.personal-correction-panel{margin-top:12px}.personal-correction-panel header{justify-content:space-between;align-items:center;display:flex}.personal-correction-panel header span{align-items:center;gap:7px;font-size:12px;font-weight:700;display:flex}.personal-correction-panel header button{color:var(--pw-muted);cursor:pointer;background:0 0;border:0}.personal-correction-composer{border:1px solid var(--pw-line-strong);border-radius:12px;position:relative;overflow:hidden}.personal-correction-composer:focus-within{border-color:var(--pw-blue)}.personal-correction-composer textarea{resize:vertical;width:100%;min-height:84px;font:inherit;border:0;outline:0;padding:10px 56px 10px 12px;font-size:12.5px}.personal-correction-composer button{border-radius:10px;width:34px;height:34px;position:absolute;bottom:6px;right:6px}.personal-recovery-panel{background:#fffaf0;border:1px solid #eccf94;border-radius:12px;margin-top:12px;padding:14px}.personal-recovery-panel>strong{font-size:13px}.personal-recovery-panel>p,.personal-preview-unavailable{color:var(--pw-muted);font-size:12px;line-height:1.5}.personal-compact-menu{margin-top:12px;position:relative}.personal-compact-menu>summary{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:11px;justify-content:center;align-items:center;gap:8px;min-height:42px;padding:0 12px;font-size:12.5px;font-weight:650;list-style:none;display:flex}.personal-compact-menu>summary::-webkit-details-marker{display:none}.personal-compact-menu[open]>summary{border-color:var(--pw-faint)}.personal-compact-menu>div{border:1px solid var(--pw-line);background:#fff;border-radius:11px;margin-top:6px;padding:6px;display:grid;box-shadow:0 8px 24px #1e1c141a}.personal-compact-menu>div button{min-height:40px;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;align-items:center;gap:8px;padding:0 10px;display:flex}.personal-compact-menu>div button:hover{background:#f5f4f1}.personal-compact-menu>div button:disabled{color:var(--pw-faint);cursor:default;opacity:.55}.personal-safe-preview{border:1px solid var(--pw-line);color:#333943;white-space:pre-wrap;overflow-wrap:anywhere;background:#f7f6f3;border-radius:11px;max-height:280px;margin:12px 0 0;padding:14px;font:12px/1.6 Geist Mono,SFMono-Regular,Consolas,monospace;overflow:auto}.personal-report-detail{border:1px solid var(--pw-line);background:#fff;border-radius:14px;margin-top:12px;padding:14px}.personal-report-detail>header{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;display:grid}.personal-report-detail>header span{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:10px;flex-direction:column;gap:2px;padding:10px;font-size:10px;font-weight:650;display:flex}.personal-report-detail>header strong{font-size:18px}.personal-report-detail>p{color:var(--pw-muted);margin:10px 0;font-size:11px}.personal-report-detail ol{gap:8px;margin:0;padding:0;list-style:none;display:grid}.personal-report-detail li{border:1px solid var(--pw-line);border-radius:10px;gap:4px;padding:10px;display:grid}.personal-report-detail li[data-change-kind=changed]{background:#fffaf0;border-color:#e8d3a5}.personal-report-detail li small{color:var(--pw-muted);text-transform:uppercase;font-size:10px}.personal-report-detail li strong{font-size:12px;line-height:1.45}.personal-report-detail li p{color:var(--pw-muted);margin:0;font-size:11px;line-height:1.5}.personal-report-detail>footer{color:var(--pw-faint);overflow-wrap:anywhere;gap:4px;margin-top:10px;font:10px/1.5 Geist Mono,SFMono-Regular,Consolas,monospace;display:grid}.personal-execution-history{margin-top:18px}.personal-execution-history h3{letter-spacing:.07em;text-transform:uppercase;color:var(--pw-faint);margin:0 0 10px;font-size:11.5px;font-weight:650}.personal-execution-history>p{color:var(--pw-muted);font-size:12px}.personal-execution-history ol{border-top:1px solid var(--pw-line);margin:0;padding:0;list-style:none}.personal-execution-history li{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:center;gap:12px;min-height:50px;display:flex}.personal-execution-history li>span{gap:3px;display:grid}.personal-execution-history li strong{font-size:12px}.personal-execution-history li small{color:var(--pw-muted);font-size:10px}.personal-execution-history li em{color:var(--pw-muted);font-size:10px;font-style:normal}.personal-execution-history li em.is-completed{color:var(--pw-green)}.personal-execution-history li em.is-failed{color:var(--pw-red)}.personal-mobile-back{display:none}.personal-message:not(.is-user)>div{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:4px 16px 16px;flex:1;min-width:0;padding:10px 14px}.personal-md{gap:8px;margin-top:5px;font-size:13.5px;line-height:1.7;display:grid}.personal-md p{white-space:normal;overflow-wrap:anywhere;margin:0}.personal-md-heading{letter-spacing:-.01em;font-weight:700}.personal-md-heading.is-h1{font-size:15.5px}.personal-md-heading.is-h2{font-size:14.5px}.personal-md-heading.is-h3,.personal-md-heading.is-h4{font-size:13.5px}.personal-md-list{gap:4px;margin:0;padding-left:20px;display:grid}.personal-md ul.personal-md-list{list-style-type:disc}.personal-md ol.personal-md-list{list-style-type:decimal}.personal-md-list li{overflow-wrap:anywhere;padding-left:2px}.personal-md-list li::marker{color:var(--pw-faint)}.personal-md-code{border:1px solid var(--pw-line);overflow-wrap:anywhere;background:#f5f4f1;border-radius:6px;padding:1px 5px;font:12px/1.5 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-md-pre{border:1px solid var(--pw-line);background:#f7f6f3;border-radius:11px;margin:0;padding:12px 14px;overflow-x:auto}.personal-md-pre code{color:#333943;white-space:pre;font:12px/1.65 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-md-link{color:var(--pw-blue-ink);border-bottom:1px solid #c3d3f9;text-decoration:none}.personal-md-link:hover{border-bottom-color:var(--pw-blue-ink)}.personal-agent-persona-head{align-items:center;gap:12px;display:flex}.personal-agent-avatar{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:14px;flex:0 0 46px;place-items:center;height:46px;font-size:19px;font-weight:700;display:grid;box-shadow:0 2px 8px #2f66e942}.personal-agent-persona-id{flex:1;min-width:0}.personal-agent-persona-id h3{margin:0}.personal-agent-persona-id p{margin:2px 0 0}.personal-agent-health{border-radius:99px;flex:none;padding:2.5px 10px;font-size:11px;font-weight:650}.personal-agent-health.is-ok{background:var(--pw-green-bg);color:var(--pw-green)}.personal-agent-health.is-off,.personal-row-status.is-blocking{background:var(--pw-red-bg);color:var(--pw-red)}.personal-row-status.is-pending{background:var(--pw-amber-bg);color:var(--pw-amber)}.personal-row-status.is-failed{background:var(--pw-red-bg);color:var(--pw-red)}.personal-row-status.is-completed{background:var(--pw-green-bg);color:var(--pw-green)}.personal-row-status.is-queued,.personal-row-status.is-waiting,.personal-row-status.is-interrupted{color:var(--pw-muted);background:#f2f1ed}.personal-diagnostics-trigger{border:0;border-top:1px solid var(--pw-line);width:100%;color:var(--pw-muted);cursor:pointer;background:0 0;justify-content:space-between;align-items:center;margin-top:18px;padding:12px 0;font-size:12.5px;display:flex}.personal-diagnostics-trigger svg{transition:transform .16s}.personal-diagnostics-trigger svg.is-open{transform:rotate(180deg)}.personal-diagnostics{color:var(--pw-muted);overflow-wrap:anywhere;background:#f5f4f1;border-radius:10px;gap:7px;padding:12px;font-size:10.5px;display:grid}.personal-copy-feedback{color:var(--pw-green);margin:7px 0 0;font-size:11px}.personal-copy-feedback.is-error{color:var(--pw-red)}@media (width<=1300px){.personal-workspace-shell.has-drawer .personal-live-indicator{display:none}.personal-workspace-shell.has-drawer .personal-channel-title p{max-width:260px}.personal-home-lanes{grid-template-columns:repeat(2,minmax(190px,1fr))}}@media (width<=1100px){.personal-machine-layout{grid-template-columns:1fr;gap:14px}.personal-machine-namespaces nav{overscroll-behavior-x:contain;scroll-snap-type:x proximity;display:flex;overflow-x:auto}.personal-machine-namespaces button{scroll-snap-align:start;flex:0 0 180px}.personal-machine-summary{flex-wrap:wrap;align-items:flex-start}.personal-machine-editor-bar{flex-direction:column;align-items:stretch}.personal-machine-editor-mode{width:100%}.personal-machine-editor-mode button{flex:1 1 0}.personal-machine-editor fieldset{grid-template-columns:1fr}.personal-machine-editor fieldset label:last-child{grid-column:auto}.personal-machine-preview dl{grid-template-columns:1fr}}@media (width<=1050px){.personal-workspace-shell,.personal-workspace-shell.has-drawer{grid-template-columns:minmax(0,1fr)}.personal-workspace-sidebar{z-index:40;width:min(310px,86vw);display:none;position:fixed;inset:0 auto 0 0;box-shadow:18px 0 50px #1e1c1429}.personal-workspace-shell.mobile-sidebar-open .personal-workspace-sidebar{display:block}.personal-sidebar-backdrop{z-index:35;cursor:default;background:#14182047;border:0;display:block;position:fixed;inset:0}.personal-icon-button.personal-mobile-menu{flex:0 0 36px;display:inline-grid}.personal-workspace-drawer{z-index:30;width:min(410px,90vw);position:fixed;inset:0 0 0 auto}.personal-workspace-drawer[data-drawer-mode=inspector],.personal-workspace-drawer[data-drawer-mode=inspector-full]{width:min(520px,92vw);position:fixed;inset:0 0 0 auto;box-shadow:-18px 0 44px #1e284024}.personal-run-row{grid-template-columns:36px minmax(0,1fr) auto 16px}.personal-run-identity,.personal-run-progress{display:none}.personal-home-lanes{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (width<=720px){.personal-workspace-shell,.personal-workspace-shell.has-drawer{grid-template-columns:1fr}.personal-workspace-shell,.personal-workspace-main,.personal-channel{width:100%;max-width:100vw;overflow-x:hidden}.personal-workspace-sidebar{z-index:40;width:min(310px,86vw);display:none;position:fixed;inset:0 auto 0 0;box-shadow:18px 0 50px #1e1c1429}.personal-workspace-shell.mobile-sidebar-open .personal-workspace-sidebar{display:block}.personal-icon-button.personal-mobile-menu{flex:0 0 36px;display:inline-grid}.personal-channel-header{grid-template-columns:36px minmax(0,1fr) auto;gap:10px;min-height:60px;padding:10px 14px;display:grid}.personal-channel-title p{display:none}.personal-channel-actions{min-width:0}.personal-agent-select{min-width:0;max-width:132px}.personal-channel-actions>.personal-icon-button{display:none}.personal-goal-tools-trigger{width:40px;height:40px;padding:0}.personal-goal-tools-trigger span,.personal-goal-tools-trigger>svg:last-child{display:none}.personal-goal-tools-menu{position:fixed;top:60px;right:14px}.personal-goal-tabs{order:4;grid-column:1/-1;align-self:auto;margin-left:0;overflow-x:auto}.personal-channel-actions .personal-live-indicator{display:none}.personal-channel-scroll,.personal-composer-wrap{padding-left:14px;padding-right:14px}.personal-channel-scroll:has(.personal-task-board){overflow-y:auto}.personal-task-board{height:auto;min-height:100%}.personal-task-kanban,.personal-workspace-shell.has-drawer .personal-task-kanban,.personal-workspace-shell.has-task-inspector .personal-task-kanban{grid-template-columns:minmax(0,1fr);width:100%;height:auto}.personal-task-kanban .personal-object-list{min-height:auto}.personal-task-lane-scroll,.personal-task-lane-scroll.has-overflow-before,.personal-task-lane-scroll.has-overflow-after{min-height:auto;box-shadow:none;scrollbar-gutter:auto;flex:none;padding-right:8px;overflow:visible}.personal-quick-prompts{overflow-x:auto}.personal-quick-prompts button{flex:none;min-height:36px}.personal-manager-conversation-tray>header{flex-wrap:wrap;align-items:flex-start}.personal-manager-conversation-actions{justify-content:flex-end;width:100%}.personal-manager-conversation-messages article{grid-template-columns:minmax(0,1fr);gap:4px}.personal-timeline-row,.personal-output-row{grid-template-columns:34px minmax(0,1fr) 14px;gap:9px;padding:10px 12px}.personal-timeline-row>time,.personal-timeline-row>.personal-row-status,.personal-timeline-row .personal-priority-dot{display:none}.personal-channel-composer{grid-template-columns:40px 36px minmax(0,1fr) 40px}.personal-task-chat-receipt{grid-template-columns:32px minmax(0,1fr);padding:11px}.personal-task-lane-filter{flex-direction:column;align-items:stretch;gap:8px}.personal-task-lane-filter label,.personal-task-lane-filter select{width:100%;max-width:none}.personal-capability-layout,.personal-capability-value-grid,.personal-capability-fields{grid-template-columns:minmax(0,1fr)}.personal-capability-layout{grid-template-rows:auto minmax(0,1fr)}.personal-capability-list{min-width:0;max-height:90px;padding:3px;display:flex;overflow-x:auto}.personal-capability-list button{flex:0 0 180px}.personal-task-chat-icon{width:32px;height:32px}.personal-task-chat-receipt footer{grid-column:1/-1;justify-content:flex-end}.personal-channel-composer>span{justify-content:center;min-width:0;padding:0;font-size:0}.personal-composer-wrap{max-width:100vw}.personal-workspace-drawer,.personal-workspace-drawer[data-drawer-mode=inspector],.personal-workspace-drawer[data-drawer-mode=inspector-full]{width:100vw}.personal-inspector-size{display:none!important}.personal-context-drawer{height:100dvh}.personal-drawer-body{padding-bottom:max(18px, env(safe-area-inset-bottom))}.personal-composer-wrap{padding-bottom:max(16px, env(safe-area-inset-bottom))}.personal-mobile-back{display:block}.personal-desktop-close{display:none}.personal-goal-tabs button{min-height:34px}.personal-correction-composer{padding-bottom:2px}.personal-correction-composer textarea{min-height:84px;padding-right:56px;padding-bottom:max(14px, env(safe-area-inset-bottom))}.personal-correction-composer button{width:40px;height:40px}.personal-todo-actions{grid-template-columns:1fr}.personal-task-management>div{width:calc(100vw - 28px)}.personal-home-lanes{grid-template-columns:1fr}.personal-home-lane{min-height:0}.personal-session-record,.personal-session-record dl{grid-template-columns:1fr}.personal-session-record>.personal-secondary-action{grid-area:auto/1}.personal-settings-page{grid-template-rows:auto minmax(0,1fr);grid-template-columns:minmax(0,1fr)}.personal-settings-sidebar{border-right:0;border-bottom:1px solid var(--pw-line);gap:10px;height:auto;max-height:30dvh;padding:12px 14px;position:static;overflow:auto}.personal-settings-title{display:none}.personal-settings-tabs{display:flex;overflow-x:auto}.personal-settings-tabs button{flex:0 0 180px}.personal-settings-body{padding:20px 14px}.personal-settings-header{align-items:center;gap:14px}.personal-settings-header h1{font-size:24px}.personal-machine-layout{grid-template-columns:1fr;gap:14px}.personal-machine-namespaces nav{overscroll-behavior-x:contain;scroll-snap-type:x proximity;display:flex;overflow-x:auto}.personal-machine-namespaces button{scroll-snap-align:start;flex:0 0 180px}.personal-machine-summary{align-items:flex-start}.personal-machine-editor-bar{flex-direction:column;align-items:stretch}.personal-machine-editor-mode{width:100%}.personal-machine-editor-mode button{flex:1 1 0}.personal-machine-summary dl{flex-direction:column;gap:8px}.personal-machine-editor fieldset{grid-template-columns:1fr}.personal-machine-editor fieldset label:last-child{grid-column:auto}.personal-machine-preview dl{grid-template-columns:1fr}.personal-machine-rollback{flex-direction:column;align-items:stretch}.personal-machine-rollback .personal-secondary-action{width:100%}.personal-lark-settings.is-embedded .personal-lark-tabs{overflow-x:auto}.personal-lark-settings.is-embedded .personal-lark-tabs button{flex:none}}@media (prefers-reduced-motion:reduce){.personal-timeline-row,.personal-diagnostics-trigger svg,.personal-workspace-sidebar,.personal-stopped-goals>summary>svg:first-child,.personal-subagent-switch>span,.personal-subagent-switch>span:after{transition:none}.personal-goal-lifecycle.is-pending svg,.personal-spin{animation:none}}.personal-workspace-shell[data-pw-theme=loopx],.personal-settings-page[data-pw-theme=loopx]{--pw-bg:#fafafa;--pw-card:#fff;--pw-line:#ebebeb;--pw-line-strong:#dedede;--pw-muted:#6b6b6b;--pw-faint:#8f8f8f;--pw-text:#171717;--pw-blue:#0070f3;--pw-blue-ink:#0060d1;--pw-blue-soft:#edf6ff;--pw-amber:#9a6200;--pw-amber-bg:#fff7df;--pw-red:#d90000;--pw-red-bg:#fff0f0;--pw-green:#197342;--pw-green-bg:#edf9f1;font-family:Geist Variable,Geist,Inter,Helvetica Neue,Arial,PingFang SC,Microsoft YaHei,sans-serif}.personal-workspace-shell[data-pw-theme=loopx] .personal-workspace-sidebar,.personal-settings-page[data-pw-theme=loopx] .personal-settings-sidebar{background:#fff}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-header{box-shadow:none;background:#fafafaf0}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-title h1{letter-spacing:0;font-size:20px;font-weight:600;line-height:28px}.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-section-title{letter-spacing:0;font-size:12px;font-weight:500;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link-copy strong,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane>header span,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card>strong{font-size:14px;font-weight:600;line-height:20px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link-copy small,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane>p,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card>p{font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-select-trigger,.personal-workspace-shell[data-pw-theme=loopx] .personal-select-option{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-workspace-drawer{box-shadow:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-brand-mark{box-shadow:none;background:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-icon{color:#171717;background:#f2f2f2;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-greeting>span{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-utility,.personal-settings-page[data-pw-theme=loopx] .personal-settings-back,.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-utility:hover,.personal-settings-page[data-pw-theme=loopx] .personal-settings-back:hover,.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button:hover{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link[aria-current=page],.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link[aria-current=page],.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button[aria-current=page]{box-shadow:none;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes{background:#f2f2f2;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes button{border-radius:4px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page],.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes button[aria-selected=true]{box-shadow:0 1px 2px #0000000f}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs{background:0 0;border-radius:0;align-self:stretch;gap:20px;padding:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button{border-radius:0;min-height:46px;padding:0 1px;font-size:12px;font-weight:500;position:relative}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page]{box-shadow:none;color:#171717;background:0 0}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page]:after{content:"";background:#171717;height:2px;position:absolute;bottom:-1px;left:0;right:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-count{color:#4d4d4d;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-state-dot,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-row:nth-child(n) .personal-goal-state-dot{background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-agent-select .personal-select-trigger,.personal-workspace-shell[data-pw-theme=loopx] .personal-read-only-source,.personal-workspace-shell[data-pw-theme=loopx] .personal-icon-button,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-select .personal-select-trigger,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action,.personal-settings-page[data-pw-theme=loopx] .personal-secondary-action{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane,.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row,.personal-workspace-shell[data-pw-theme=loopx] .personal-detail-card,.personal-settings-page[data-pw-theme=loopx] .personal-detail-card,.personal-settings-page[data-pw-theme=loopx] .personal-settings-card,.personal-settings-page[data-pw-theme=loopx] .personal-lark-app-card,.personal-settings-page[data-pw-theme=loopx] .personal-lark-table,.personal-settings-page[data-pw-theme=loopx] .personal-lark-topic-panel{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lanes{border-block:1px solid #ebebeb;gap:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane{border:0;background:0 0;border-left:1px solid #ebebeb;border-radius:0;min-height:260px;padding:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane:first-child{border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card{box-shadow:none;border-radius:12px;transform:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card:hover{box-shadow:none;border-color:#a1a1a1;transform:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-timeline{gap:8px}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row,.personal-workspace-shell[data-pw-theme=loopx] .personal-schedule-row{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-schedule-row:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-row-icon{color:#4d4d4d;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-run-open-label{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-run-progress b{background:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-message.is-user{background:#f2f2f2;border-color:#dedede;border-radius:12px 12px 4px;padding:10px 12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message-avatar{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message:not(.is-user)>div{box-shadow:none;border-radius:4px 12px 12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message p,.personal-workspace-shell[data-pw-theme=loopx] .personal-md{font-size:13px;line-height:1.65}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-empty>span{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row{box-shadow:none;background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row>span:first-child{color:#171717;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row small,.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row>b{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record{background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record>header span{color:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record dl div{background:#fafafa;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt{box-shadow:none;background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-icon{color:#171717;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt footer button{color:#171717;border-color:#dedede;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt footer button:hover{background:#f2f2f2;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban{border-block:1px solid #ebebeb;gap:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list{border:0;background:0 0;border-left:1px solid #ebebeb;border-radius:0;gap:8px;padding:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list:first-child{border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>header{padding:4px 2px 8px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>header>strong{font-size:12px;font-weight:600}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-lane-scroll>button>strong,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button>strong{overflow-wrap:anywhere;font-size:14px;font-weight:500;line-height:20px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button>small,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button>small{color:#6b6b6b;font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card.is-selected>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button.is-selected{background:#fff;border-color:#171717;box-shadow:0 0 0 1px #171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card.is-selected:before{background:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card-actions button{box-shadow:none;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card-actions .personal-task-session-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-session-status{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-empty{border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>header{letter-spacing:0;min-height:44px;padding:8px 14px;font-weight:500}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button{min-height:58px;padding:10px 14px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button:hover{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-file-icon{color:#4d4d4d;background:#fafafa;border:1px solid #ebebeb;border-radius:6px;place-items:center;width:28px;height:28px;display:grid}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>strong{font-size:13px;font-weight:600}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>p,.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>small{font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-primary-action,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action{box-shadow:none;background:#171717;border-color:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-primary-action:hover,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action:hover{background:#333;border-color:#333}.personal-workspace-shell[data-pw-theme=loopx] .personal-md-code,.personal-workspace-shell[data-pw-theme=loopx] .personal-safe-preview,.personal-workspace-shell[data-pw-theme=loopx] .personal-diagnostics{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-md-pre{color:#fafafa;background:#171717;border:1px solid #242424}.personal-workspace-shell[data-pw-theme=loopx] .personal-digest-card{background:#fff;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-action-feedback{color:#171717;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button{color:#4d4d4d;background:#fff;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button.is-draft,.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button.is-immediate{color:#171717;box-shadow:none;background:#fff;border-color:#dedede}.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button.is-draft:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button.is-immediate:hover{color:#171717;box-shadow:none;background:#f2f2f2;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-prompt-badge{color:#fff;background:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-draft-status{color:#6b6b6b;background:#f2f2f2;border-color:#dedede;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-draft-status strong{color:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer{box-shadow:none;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer:focus-within{border-color:#0070f3;box-shadow:0 0 0 2px #0070f31f}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-correction-composer button{box-shadow:none;background:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-correction-composer button:hover{background:#333}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>.personal-composer-attach{color:#6b6b6b;background:0 0}.personal-settings-theme-swatch.is-loopx{background:linear-gradient(135deg,#171717 0 48%,#fafafa 48% 78%,#fff 78%)}.personal-settings-page[data-pw-theme=loopx] .personal-settings-header small,.personal-settings-page[data-pw-theme=loopx] .personal-lark-header small,.personal-settings-page[data-pw-theme=loopx] .personal-lark-section-heading small{color:#0070f3;font-family:Geist Mono Variable,Geist Mono,JetBrains Mono,SFMono-Regular,monospace;font-weight:500}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button{box-shadow:none;border-radius:12px}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button:hover{box-shadow:none;border-color:#c8c8c8}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button[aria-checked=true]{background:#fff;border-color:#171717;box-shadow:0 0 0 1px #171717}@media (width<=720px){.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list{border-top:1px solid #ebebeb;border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane:first-child,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list:first-child{border-top:0}}.personal-workspace-shell[data-pw-theme=brutal],.personal-settings-page[data-pw-theme=brutal]{--pw-bg:#fdf8e7;--pw-card:#fff;--pw-line:#141414;--pw-line-strong:#141414;--pw-muted:#3f3f3f;--pw-faint:#666;--pw-text:#141414;--pw-blue:#141414;--pw-blue-ink:#141414;--pw-blue-soft:#ffe23f;--pw-amber:#141414;--pw-amber-bg:#ffd23f;--pw-red:#141414;--pw-red-bg:#ff9d8a;--pw-green:#141414;--pw-green-bg:#8fe6a4}.personal-workspace-shell[data-pw-theme=brutal] :focus-visible:not(textarea):not(input),.personal-settings-page[data-pw-theme=brutal] :focus-visible:not(textarea):not(input){outline-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-workspace-sidebar{background:#ffd91a;border-right:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-brand{border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-brand-mark{color:#ffd91a;box-shadow:none;background:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-icon{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-link:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-link:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-utility:hover{background:#ffffff8c}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-link[aria-current=page],.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-link[aria-current=page]{background:#ff8fd0;border:2px solid #141414;border-radius:4px;font-weight:700;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-count{color:#141414;background:#fff;border:2px solid #141414;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-section-title{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-title-actions button:hover{box-shadow:none;background:#fff;border:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-footer{border-top:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-sidebar{background:#ffd91a;border-right:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-title{border-bottom:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-title small,.personal-settings-page[data-pw-theme=brutal] .personal-settings-header small,.personal-settings-page[data-pw-theme=brutal] .personal-settings-back,.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button{color:#141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-back:hover,.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button:hover{background:#ffffff8c}.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button[aria-current=page]{color:#141414;background:#ff8fd0;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-detail-card,.personal-settings-page[data-pw-theme=brutal] .personal-machine-editor,.personal-settings-page[data-pw-theme=brutal] .personal-machine-summary,.personal-settings-page[data-pw-theme=brutal] .personal-lark-app-card,.personal-settings-page[data-pw-theme=brutal] .personal-lark-table,.personal-settings-page[data-pw-theme=brutal] .personal-lark-topic-panel{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-machine-namespaces button[aria-current=page],.personal-settings-page[data-pw-theme=brutal] .personal-machine-preview,.personal-settings-page[data-pw-theme=brutal] .personal-machine-scope-note,.personal-settings-page[data-pw-theme=brutal] .personal-machine-rollback{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button:hover{background:#fff8d6;border-color:#141414;transform:translate(-1px,-1px);box-shadow:4px 4px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button[aria-checked=true]{background:#ffe23f;border-color:#141414;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-primary-action,.personal-settings-page[data-pw-theme=brutal] .personal-secondary-action,.personal-settings-page[data-pw-theme=brutal] .personal-lark-toolbar label{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-primary-action{background:#ffe23f}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs{border-bottom:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs button[aria-current=page]{color:#141414;border-color:#141414}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs span,.personal-settings-page[data-pw-theme=brutal] .personal-lark-app-card em,.personal-settings-page[data-pw-theme=brutal] .personal-connection-status{color:#141414;background:#ffe23f;border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-header{background:#fdf8e7;border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs{background:0 0;gap:6px;padding:0}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs button{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs button[aria-current=page]{background:#ffe23f;font-weight:700;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-agent-select .personal-select-trigger,.personal-workspace-shell[data-pw-theme=brutal] .personal-icon-button{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-live-indicator i{border:1.5px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-message.is-user{background:#8fdcff;border:2px solid #141414;border-radius:8px 8px 2px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-message-avatar{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-pre{color:#fdf8e7;background:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-code{color:#141414;background:#ffe23f;border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-link{color:#141414;text-decoration-thickness:2px}.personal-workspace-shell[data-pw-theme=brutal] .personal-object-list{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-object-list>button:hover{background:#fff8d6}.personal-workspace-shell[data-pw-theme=brutal] .personal-row-status{border:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list{background:#fff}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list>header{background:#fff;border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-lane-scroll>button,.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-card>button{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-lane-scroll>button:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-card:hover>button{background:#fff;border-color:#141414;transform:translate(-1px,-1px);box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list>header>span{color:#fff;background:#141414;border-radius:3px;padding:1px 7px}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot{border:2px solid #141414;border-radius:2px;width:10px;height:10px}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-attention{background:#ff9d5c}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-progress{background:#35c5f0}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-schedule{background:#b49bf0}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-done{background:#7ddb8a}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-empty{border:2px dashed #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-card-actions button{color:#141414;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-composer-wrap{background:linear-gradient(transparent, var(--pw-bg) 22%)}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-banner{color:#141414;background:#fee2e2;border:2px solid #141414;border-radius:6px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-header{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-header small{color:#555}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-issues{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray{background:#fff;border:2px solid #141414;border-radius:6px;box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray:focus-within{border-color:#141414;box-shadow:5px 5px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-btn{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-btn:hover{background:#ffd91a}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-link{color:#141414;text-decoration:underline}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-close{color:#141414;border:1.5px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-messages article{background:#fdf8e7;border:1.5px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-messages article.is-user{background:#8fdcff}.personal-workspace-shell[data-pw-theme=brutal] .personal-prompt-badge{color:#ffe23f;background:#141414;border:1px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-quick-prompts button{color:#141414;background:#fff;border:2px solid #141414;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-quick-prompts button:hover{color:#141414;background:#ffe23f;border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer{border:2px solid #141414;border-radius:6px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer:focus-within{border-color:#141414;box-shadow:5px 5px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer textarea{border-left:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>button,.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>.personal-composer-attach,.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer button{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>button:hover{background:#ffd91a;transform:translate(1px,1px);box-shadow:1px 1px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer{border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer:focus-within{border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-workspace-drawer{box-shadow:none;border-left:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-detail-card,.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-panel{border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-detail-card.is-attention{background:#fff3c9;border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-primary-action{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-primary-action:hover{background:#ffd91a;transform:translate(1px,1px);box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-secondary-action{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-secondary-action:hover{border-color:#141414;transform:translate(1px,1px);box-shadow:1px 1px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-danger-action{color:#141414;background:#ff9d8a;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>summary{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>div{border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>div button:hover{background:#fff8d6}.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-agent-select{border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-agent-select select,.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-resume-when input,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-fields input:not([type=checkbox]),.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-fields select,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-domain-option,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-preview{color:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch{background:#fff;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch[aria-checked=true]{background:#baf2c7}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch>span{background:#777}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch[aria-checked=true]>span{background:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-preview{background:#fff3c9;box-shadow:2px 2px #141414}.personal-digest-card{border:1px solid var(--pw-line);background:linear-gradient(135deg,#fff,#fbf7ee);border-radius:14px;justify-content:space-between;align-items:center;gap:14px;margin-bottom:12px;padding:13px 16px;display:flex}.personal-digest-card>strong{letter-spacing:.01em;font-size:13px}.personal-digest-stats{gap:8px;display:flex}.personal-digest-stats span{border:1px solid var(--pw-line-strong);color:var(--pw-muted);background:#fff;border-radius:99px;align-items:baseline;gap:6px;padding:6px 13px;font-size:12px;display:inline-flex}.personal-digest-stats b{color:var(--pw-text);font-size:14px}.personal-composer-hint{color:var(--pw-faint);margin:0 0 8px;font-size:11.5px}.personal-priority-badge{color:var(--pw-muted);background:#f2f1ed;border-radius:6px;padding:1px 7px;font-size:10.5px;font-weight:700}.personal-priority-badge.is-p0{background:var(--pw-red-bg);color:var(--pw-red)}.personal-priority-badge.is-p1{background:var(--pw-amber-bg);color:var(--pw-amber)}.personal-priority-badge.is-blocked{background:var(--pw-red-bg);color:var(--pw-red)}.personal-workspace-shell[data-pw-theme=brutal] .personal-digest-card{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-digest-stats span{color:#141414;border:2px solid #141414;border-radius:99px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-priority-badge{border:1.5px solid #141414;border-radius:3px}.personal-goal-notification code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);word-break:break-all;border-radius:5px;padding:1px 5px;font-size:11px}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-notification code{background:#fff;border:1.5px solid #141414;border-radius:3px}.personal-proposal-state.is-error:has(small){align-items:start;gap:4px;display:grid}.personal-proposal-state.is-error small{word-break:break-all;line-height:1.5}.personal-gate-cli-hint{gap:6px;margin-top:10px;display:grid}.personal-gate-cli-hint code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);-webkit-user-select:all;user-select:all;word-break:break-all;border-radius:7px;padding:8px 10px;font-size:11.5px;line-height:1.5;display:block}.personal-gate-cli-hint small{color:var(--pw-muted);line-height:1.5}.personal-notification-list{gap:0;margin:12px 0 0;padding:0;list-style:none;display:grid}.personal-notification-row{border-top:1px solid var(--pw-line);gap:8px;padding:12px 0;display:grid}.personal-notification-row:first-child{border-top:0;padding-top:4px}.personal-notification-row-head{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-notification-row-head strong{font-size:13px}.personal-notification-badge{border-radius:99px;flex:none;padding:2px 8px;font-size:11px;font-weight:650}.personal-notification-badge.is-on{background:var(--pw-green-bg);color:var(--pw-green)}.personal-notification-badge.is-off{background:var(--pw-bg,#f5f4ef);color:var(--pw-muted)}.personal-notification-meta{color:var(--pw-muted);flex-wrap:wrap;gap:4px 12px;font-size:11.5px;display:flex}.personal-notification-toggle{color:var(--pw-text);cursor:pointer;align-items:center;gap:8px;font-size:12.5px;display:flex}.personal-notification-toggle input{accent-color:var(--pw-blue);cursor:pointer;width:15px;height:15px}.personal-notification-bind{gap:8px;display:flex}.personal-notification-bind select{border:1px solid var(--pw-line-strong);min-width:0;height:34px;color:var(--pw-text);background:#fff;border-radius:8px;flex:1;padding:0 10px;font-size:12.5px}.personal-notification-bind .personal-secondary-action{flex:none}.personal-notification-confirm{border:1px solid var(--pw-line);background:var(--pw-bg,#faf9f5);border-radius:9px;gap:8px;padding:10px 12px;display:grid}.personal-notification-confirm p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-notification-actions{gap:8px;display:flex}.personal-notification-error{color:var(--pw-red);margin:0;font-size:12px;line-height:1.5}.personal-notification-hint{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-notification-hint code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);-webkit-user-select:all;user-select:all;border-radius:5px;margin-top:4px;padding:2px 7px;font-size:11px;display:inline-block}.is-spinning{animation:.9s linear infinite personal-notification-spin}@keyframes personal-notification-spin{to{transform:rotate(360deg)}}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-badge{border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-bind select{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-confirm{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-settings-card{border:2px solid #141414;border-radius:4px;box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-settings-icon{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-language-options>button{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-language-options>button.is-selected{color:#141414;background:#8fdcff}@media (width<=720px){.personal-lark-settings{padding:20px 16px calc(24px + env(safe-area-inset-bottom))}.personal-lark-header h1{font-size:24px}.personal-lark-tabs{gap:18px;margin-top:20px}.personal-settings-card>header,.personal-language-options{padding-left:15px;padding-right:15px}}.personal-goal-acceptance h4{margin:16px 0 8px;font-size:14px}.personal-goal-acceptance .personal-acceptance-observation{border-top:1px solid var(--color-border,#ebebeb);padding:8px 0}.personal-goal-acceptance dd,.personal-goal-acceptance p{overflow-wrap:anywhere}.personal-goal-acceptance details{margin-top:16px}.benchmark-page{--benchmark-ink:#171717;--benchmark-body:#4d4d4d;--benchmark-muted:#767676;--benchmark-canvas:#fafafa;--benchmark-surface:#fff;--benchmark-soft:#f2f2f2;--benchmark-border:#e5e5e5;--benchmark-link:#0068d7;width:100%;max-width:100vw;min-height:100vh;color:var(--benchmark-ink);background:var(--benchmark-canvas);font-family:Geist,Inter,Helvetica Neue,Arial,sans-serif;overflow-x:clip}.benchmark-page,.benchmark-page *{box-sizing:border-box}.benchmark-hero{border-bottom:1px solid var(--benchmark-border);background:var(--benchmark-surface);padding:24px max(24px,50vw - 600px)}.benchmark-hero-topline,.benchmark-title-row,.benchmark-card-heading,.benchmark-footer>div{align-items:center;display:flex}.benchmark-hero-topline{justify-content:space-between;margin-bottom:64px}.benchmark-wordmark{color:var(--benchmark-ink);letter-spacing:-.04em;font-weight:650;text-decoration:none}.benchmark-readonly{color:var(--benchmark-muted);align-items:center;gap:8px;font-size:12px;display:inline-flex}.benchmark-hero-grid{grid-template-columns:minmax(0,1.5fr) minmax(260px,.5fr);align-items:end;gap:64px;display:grid}.benchmark-kicker,.benchmark-mono{color:var(--benchmark-muted);letter-spacing:.08em;text-transform:uppercase;margin:0 0 8px;font:500 11px/16px Geist Mono,JetBrains Mono,monospace}.benchmark-title-row{align-items:baseline;gap:16px}.benchmark-title-row h1{letter-spacing:-.05em;max-width:780px;margin:0;font-size:clamp(32px,4.5vw,48px);font-weight:600;line-height:1}.benchmark-lead{max-width:680px;color:var(--benchmark-body);margin:20px 0 0;font-size:16px;line-height:24px}.benchmark-identity,.benchmark-stat-list{margin:0}.benchmark-identity>div{border-top:1px solid var(--benchmark-border);grid-template-columns:80px minmax(0,1fr);gap:16px;padding:10px 0;display:grid}.benchmark-identity dt,.benchmark-stat-list dt{color:var(--benchmark-muted);font-size:12px}.benchmark-identity dd{text-overflow:ellipsis;white-space:nowrap;margin:0;font:500 12px/18px Geist Mono,monospace;overflow:hidden}.benchmark-kpi-grid{border:1px solid var(--benchmark-border);border-radius:12px;grid-template-columns:repeat(4,minmax(0,1fr));margin-top:64px;display:grid;overflow:hidden}.benchmark-kpi-grid article{border-right:1px solid var(--benchmark-border);min-width:0;padding:20px 24px}.benchmark-kpi-grid article:last-child{border-right:0}.benchmark-kpi-grid svg{color:var(--benchmark-muted)}.benchmark-kpi-grid span{color:var(--benchmark-muted);margin-top:16px;font-size:12px;display:block}.benchmark-kpi-grid strong{letter-spacing:-.04em;font-variant-numeric:tabular-nums;margin-top:6px;font-size:30px;font-weight:600;display:block}.benchmark-kpi-grid strong small{color:var(--benchmark-muted);letter-spacing:0;font-size:14px;font-weight:400}.benchmark-kpi-grid p{color:var(--benchmark-body);margin:8px 0 0;font-size:12px}.benchmark-state{border:1px solid var(--benchmark-border);width:fit-content;color:var(--benchmark-body);background:var(--benchmark-soft);text-transform:capitalize;border-radius:999px;align-items:center;padding:3px 8px;font:500 11px/16px Geist Mono,monospace;display:inline-flex}.benchmark-state-success{color:#087a44;background:#ecf9f2;border-color:#b8e7ce}.benchmark-state-warning{color:#8a5100;background:#fff8e8;border-color:#f0d2a3}.benchmark-state-info{color:#0057b8;background:#eef6ff;border-color:#b9d7f5}.benchmark-tabs{z-index:3;border-bottom:1px solid var(--benchmark-border);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fafafaf0;align-items:center;gap:4px;padding:12px max(24px,50vw - 600px);display:flex;position:sticky;top:0}.benchmark-tabs button,.benchmark-loading button{min-height:40px;color:var(--benchmark-body);cursor:pointer;background:0 0;border:0;border-radius:6px;padding:0 14px;font-size:13px;font-weight:500}.benchmark-tabs button[aria-current=page]{color:#fff;background:var(--benchmark-ink)}.benchmark-tabs .benchmark-refresh{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);align-items:center;gap:7px;margin-left:auto;display:inline-flex}.benchmark-tabs button:focus-visible,.benchmark-cell-link:focus-visible,.benchmark-run-link:focus-visible,.benchmark-loading button:focus-visible{outline:2px solid var(--benchmark-link);outline-offset:2px}.benchmark-content{width:min(100vw - 48px,1200px);min-width:0;margin:0 auto;padding:40px 0 64px}.benchmark-view-stack{gap:48px;min-width:0;display:grid}.benchmark-view-stack>section{min-width:0}.benchmark-section-heading{justify-content:space-between;align-items:end;gap:24px;margin-bottom:16px;display:flex}.benchmark-section-heading h2,.benchmark-detail-card h2,.benchmark-run-detail h2{letter-spacing:-.02em;margin:0;font-size:20px;line-height:28px}.benchmark-section-heading>p{max-width:420px;color:var(--benchmark-muted);text-align:right;margin:0;font-size:12px;line-height:18px}.benchmark-arm-grid,.benchmark-detail-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;display:grid}.benchmark-arm-card,.benchmark-detail-card,.benchmark-run-detail{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:12px;padding:24px}.benchmark-card-heading{justify-content:space-between;align-items:start;gap:24px}.benchmark-card-heading h3{letter-spacing:-.02em;margin:0;font-size:16px;line-height:24px}.benchmark-stat-list{margin-top:24px}.benchmark-stat-list>div{border-top:1px solid var(--benchmark-border);grid-template-columns:minmax(0,1fr) auto;gap:16px;padding:11px 0;display:grid}.benchmark-stat-list dd{font-variant-numeric:tabular-nums;text-align:right;margin:0;font:500 12px/18px Geist Mono,monospace}.benchmark-factor-row{flex-wrap:wrap;gap:8px;margin-top:20px;display:flex}.benchmark-factor-row span{color:var(--benchmark-muted);background:var(--benchmark-soft);border-radius:6px;padding:5px 8px;font-size:11px}.benchmark-runtime-list{flex-wrap:wrap;gap:8px;display:flex}.benchmark-runtime-list>div{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:6px;align-items:center;gap:20px;padding:9px 11px;font:500 11px/16px Geist Mono,monospace;display:inline-flex}.benchmark-runtime-list>div span{color:var(--benchmark-muted)}.benchmark-runtime-list>div strong{font-weight:600}.benchmark-table-shell{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:12px;width:100%;max-width:100%;overflow:auto}.benchmark-table-shell table{border-collapse:collapse;width:100%;font-size:12px}.benchmark-table-shell th,.benchmark-table-shell td{border-bottom:1px solid var(--benchmark-border);text-align:left;white-space:nowrap;padding:14px 16px}.benchmark-table-shell tr:last-child td{border-bottom:0}.benchmark-table-shell th{color:var(--benchmark-muted);background:var(--benchmark-soft);letter-spacing:.03em;text-transform:uppercase;font-size:11px;font-weight:500}.benchmark-table-shell td{color:var(--benchmark-body)}.benchmark-positive{color:#087a44!important}.benchmark-negative{color:#b42318!important}.benchmark-muted{color:var(--benchmark-muted)}.benchmark-wide-table{min-height:300px}.benchmark-cell-link,.benchmark-run-link{color:var(--benchmark-ink);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:0}.benchmark-cell-link span{font-family:Geist Mono,monospace;display:block}.benchmark-cell-link small{color:var(--benchmark-link);align-items:center;gap:4px;margin-top:5px;display:flex}.benchmark-cell-link small+small{color:var(--benchmark-muted)}.benchmark-cell-link .benchmark-cell-metric{color:var(--benchmark-body);font-family:Geist Mono,monospace}.benchmark-run-link{max-width:280px;color:var(--benchmark-link);text-overflow:ellipsis;overflow:hidden}.benchmark-runs-layout{grid-template-columns:minmax(0,1.3fr) minmax(340px,.7fr);align-items:start;gap:16px;display:grid}.benchmark-table-shell tr[aria-selected=true] td{background:#f3f7fb}.benchmark-run-detail{position:sticky;top:82px}.benchmark-run-detail h2{overflow-wrap:anywhere;max-width:340px}.benchmark-run-facts dd{overflow-wrap:anywhere;white-space:normal;max-width:310px}.benchmark-run-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:20px;display:grid}.benchmark-run-metrics>div{background:var(--benchmark-soft);border-radius:6px;padding:10px}.benchmark-run-metrics span,.benchmark-run-metrics strong{display:block}.benchmark-run-metrics span{color:var(--benchmark-muted);font-size:10px}.benchmark-run-metrics strong{margin-top:5px;font:600 12px/18px Geist Mono,monospace}.benchmark-insight{border-left:2px solid var(--benchmark-link);margin-top:20px;padding:4px 0 4px 14px}.benchmark-insight p{color:var(--benchmark-body);margin:8px 0;font-size:13px;line-height:20px}.benchmark-insight small{color:var(--benchmark-muted);line-height:18px}.benchmark-footer{border-top:1px solid var(--benchmark-border);color:var(--benchmark-muted);background:var(--benchmark-surface);justify-content:space-between;gap:24px;padding:20px max(24px,50vw - 600px);font-size:11px;display:flex}.benchmark-footer>div{flex-wrap:wrap;gap:12px}.benchmark-footer code{text-overflow:ellipsis;white-space:nowrap;max-width:360px;overflow:hidden}.benchmark-loading{text-align:center;place-content:center;min-height:100vh;display:grid}.benchmark-loading svg{color:var(--benchmark-muted);margin:0 auto}.benchmark-loading h1{margin:18px 0 0;font-size:24px}.benchmark-loading p{max-width:520px;color:var(--benchmark-muted);margin:8px auto 0}.benchmark-loading button{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);align-items:center;gap:8px;margin:20px auto 0;display:inline-flex}@media (width<=900px){.benchmark-hero-grid,.benchmark-runs-layout{grid-template-columns:1fr}.benchmark-hero-grid{gap:32px}.benchmark-kpi-grid{grid-template-columns:repeat(2,1fr)}.benchmark-kpi-grid article:nth-child(2){border-right:0}.benchmark-kpi-grid article:nth-child(-n+2){border-bottom:1px solid var(--benchmark-border)}.benchmark-run-detail{position:static}}@media (width<=640px){.benchmark-hero{padding-inline:20px}.benchmark-hero-topline{margin-bottom:40px}.benchmark-title-row,.benchmark-section-heading,.benchmark-footer{flex-direction:column;align-items:flex-start}.benchmark-title-row h1{font-size:34px}.benchmark-kpi-grid,.benchmark-arm-grid,.benchmark-detail-grid{grid-template-columns:1fr}.benchmark-kpi-grid article{border-right:0;border-bottom:1px solid var(--benchmark-border)}.benchmark-kpi-grid article:last-child{border-bottom:0}.benchmark-tabs{padding-inline:20px;overflow-x:auto}.benchmark-tabs .benchmark-refresh{display:none}.benchmark-content{width:calc(100vw - 40px);padding-top:28px}.benchmark-section-heading>p{text-align:left}.benchmark-footer code{max-width:100%}}@media (prefers-reduced-motion:reduce){.benchmark-page *,.benchmark-page :before,.benchmark-page :after{scroll-behavior:auto!important;transition:none!important}}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-latin-wght-normal-BgDaEnEv.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2)format("woff2-variations");unicode-range:U+2000-2001,U+2004-2008,U+200A,U+23B8-23BD,U+2500-259F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-amber-950:oklch(27.9% .077 45.635);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-800:oklch(43.2% .095 166.913);--color-emerald-900:oklch(37.8% .077 168.94);--color-emerald-950:oklch(26.2% .051 172.552);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-800:oklch(44.3% .11 240.79);--color-sky-900:oklch(39.1% .09 240.876);--color-sky-950:oklch(29.3% .066 243.157);--color-rose-50:oklch(96.9% .015 12.422);--color-rose-100:oklch(94.1% .03 12.58);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-600:oklch(58.6% .253 17.585);--color-rose-700:oklch(51.4% .222 16.935);--color-rose-800:oklch(45.5% .188 13.697);--color-rose-900:oklch(41% .159 10.272);--color-rose-950:oklch(27.1% .105 12.094);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-zinc-50:oklch(98.5% 0 0);--color-zinc-100:oklch(96.7% .001 286.375);--color-zinc-200:oklch(92% .004 286.32);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-400:oklch(70.5% .015 286.067);--color-zinc-500:oklch(55.2% .016 285.938);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-zinc-950:oklch(14.1% .005 285.823);--color-white:#fff;--spacing:.25rem;--container-xl:36rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-normal:0em;--radius-md:.375rem;--radius-lg:.5rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.\!visible{visibility:visible!important}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.fixed{position:fixed}.relative{position:relative}.static{position:static}.m-0{margin:calc(var(--spacing) * 0)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-8{margin-top:calc(var(--spacing) * 8)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-64{min-height:calc(var(--spacing) * 64)}.min-h-\[calc\(100vh-80px\)\]{min-height:calc(100vh - 80px)}.min-h-screen{min-height:100vh}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-9{width:calc(var(--spacing) * 9)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[1500px\]{max-width:1500px}.max-w-xl{max-width:var(--container-xl)}.min-w-\[260px\]{min-width:260px}.min-w-full{min-width:100%}.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.border-separate{border-collapse:separate}.border-spacing-0{--tw-border-spacing-x:calc(var(--spacing) * 0);--tw-border-spacing-y:calc(var(--spacing) * 0);border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}.animate-spin{animation:var(--animate-spin)}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-slate-100>:not(:last-child)){border-color:var(--color-slate-100)}.overflow-x-auto{overflow-x:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-200{border-color:var(--color-amber-200)}.border-emerald-200{border-color:var(--color-emerald-200)}.border-rose-200{border-color:var(--color-rose-200)}.border-sky-200{border-color:var(--color-sky-200)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-200\/80{border-color:#e2e8f0cc}@supports (color:color-mix(in lab, red, red)){.border-slate-200\/80{border-color:color-mix(in oklab, var(--color-slate-200) 80%, transparent)}}.border-slate-300{border-color:var(--color-slate-300)}.border-slate-900{border-color:var(--color-slate-900)}.border-transparent{border-color:#0000}.bg-\[\#f6f7f9\]{background-color:#f6f7f9}.bg-\[\#f7f7f4\]{background-color:#f7f7f4}.bg-amber-50{background-color:var(--color-amber-50)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-rose-50{background-color:var(--color-rose-50)}.bg-sky-50{background-color:var(--color-sky-50)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-slate-950{background-color:var(--color-slate-950)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.bg-white\/70{background-color:color-mix(in oklab, var(--color-white) 70%, transparent)}}.bg-white\/95{background-color:#fffffff2}@supports (color:color-mix(in lab, red, red)){.bg-white\/95{background-color:color-mix(in oklab, var(--color-white) 95%, transparent)}}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.pt-0{padding-top:calc(var(--spacing) * 0)}.text-center{text-align:center}.text-left{text-align:left}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[11px\]{font-size:11px}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-7{--tw-leading:calc(var(--spacing) * 7);line-height:calc(var(--spacing) * 7)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\[0\.14em\]{--tw-tracking:.14em;letter-spacing:.14em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-amber-900{color:var(--color-amber-900)}.text-amber-950{color:var(--color-amber-950)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-emerald-800{color:var(--color-emerald-800)}.text-emerald-950{color:var(--color-emerald-950)}.text-rose-600{color:var(--color-rose-600)}.text-rose-700{color:var(--color-rose-700)}.text-rose-800{color:var(--color-rose-800)}.text-rose-900{color:var(--color-rose-900)}.text-sky-800{color:var(--color-sky-800)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-slate-900{color:var(--color-slate-900)}.text-slate-950{color:var(--color-slate-950)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_1px_2px_rgba\(15\,23\,42\,0\.04\)\]{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0f172a0a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.hover\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\:bg-slate-100:hover{background-color:var(--color-slate-100)}.hover\:bg-slate-800:hover{background-color:var(--color-slate-800)}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-slate-400:focus{--tw-ring-color:var(--color-slate-400)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-slate-400:focus-visible{--tw-ring-color:var(--color-slate-400)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:block{display:block}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-\[240px_1fr\]{grid-template-columns:240px 1fr}.sm\:p-8{padding:calc(var(--spacing) * 8)}.sm\:px-5{padding-inline:calc(var(--spacing) * 5)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}}@media (width>=48rem){.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=80rem){.xl\:sticky{position:sticky}.xl\:top-4{top:calc(var(--spacing) * 4)}.xl\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-\[260px_minmax\(0\,1fr\)\]{grid-template-columns:260px minmax(0,1fr)}.xl\:grid-cols-\[minmax\(0\,1\.35fr\)_minmax\(360px\,0\.65fr\)\]{grid-template-columns:minmax(0,1.35fr) minmax(360px,.65fr)}.xl\:grid-cols-\[minmax\(0\,1fr\)_420px\]{grid-template-columns:minmax(0,1fr) 420px}.xl\:self-start{align-self:flex-start}}:where(.dark\:divide-zinc-900:where(.dark,.dark *)>:not(:last-child)){border-color:var(--color-zinc-900)}.dark\:border-amber-900:where(.dark,.dark *){border-color:var(--color-amber-900)}.dark\:border-emerald-900:where(.dark,.dark *){border-color:var(--color-emerald-900)}.dark\:border-rose-900:where(.dark,.dark *){border-color:var(--color-rose-900)}.dark\:border-sky-900:where(.dark,.dark *){border-color:var(--color-sky-900)}.dark\:border-zinc-100:where(.dark,.dark *){border-color:var(--color-zinc-100)}.dark\:border-zinc-700:where(.dark,.dark *){border-color:var(--color-zinc-700)}.dark\:border-zinc-800:where(.dark,.dark *){border-color:var(--color-zinc-800)}.dark\:bg-\[\#09090b\]:where(.dark,.dark *){background-color:#09090b}.dark\:bg-amber-950:where(.dark,.dark *){background-color:var(--color-amber-950)}.dark\:bg-amber-950\/40:where(.dark,.dark *){background-color:#46190166}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-950\/40:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-amber-950) 40%, transparent)}}.dark\:bg-emerald-950:where(.dark,.dark *){background-color:var(--color-emerald-950)}.dark\:bg-rose-950:where(.dark,.dark *){background-color:var(--color-rose-950)}.dark\:bg-sky-950:where(.dark,.dark *){background-color:var(--color-sky-950)}.dark\:bg-zinc-50:where(.dark,.dark *){background-color:var(--color-zinc-50)}.dark\:bg-zinc-900:where(.dark,.dark *){background-color:var(--color-zinc-900)}.dark\:bg-zinc-950:where(.dark,.dark *){background-color:var(--color-zinc-950)}.dark\:bg-zinc-950\/40:where(.dark,.dark *){background-color:#09090b66}@supports (color:color-mix(in lab, red, red)){.dark\:bg-zinc-950\/40:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-zinc-950) 40%, transparent)}}.dark\:text-amber-100:where(.dark,.dark *){color:var(--color-amber-100)}.dark\:text-amber-200:where(.dark,.dark *){color:var(--color-amber-200)}.dark\:text-amber-300:where(.dark,.dark *){color:var(--color-amber-300)}.dark\:text-emerald-200:where(.dark,.dark *){color:var(--color-emerald-200)}.dark\:text-emerald-300:where(.dark,.dark *){color:var(--color-emerald-300)}.dark\:text-rose-100:where(.dark,.dark *){color:var(--color-rose-100)}.dark\:text-rose-200:where(.dark,.dark *){color:var(--color-rose-200)}.dark\:text-rose-300:where(.dark,.dark *){color:var(--color-rose-300)}.dark\:text-sky-200:where(.dark,.dark *){color:var(--color-sky-200)}.dark\:text-zinc-50:where(.dark,.dark *){color:var(--color-zinc-50)}.dark\:text-zinc-100:where(.dark,.dark *){color:var(--color-zinc-100)}.dark\:text-zinc-200:where(.dark,.dark *){color:var(--color-zinc-200)}.dark\:text-zinc-300:where(.dark,.dark *){color:var(--color-zinc-300)}.dark\:text-zinc-400:where(.dark,.dark *){color:var(--color-zinc-400)}.dark\:text-zinc-500:where(.dark,.dark *){color:var(--color-zinc-500)}.dark\:text-zinc-950:where(.dark,.dark *){color:var(--color-zinc-950)}@media (hover:hover){.dark\:hover\:bg-zinc-200:where(.dark,.dark *):hover{background-color:var(--color-zinc-200)}.dark\:hover\:bg-zinc-900:where(.dark,.dark *):hover{background-color:var(--color-zinc-900)}}.dark\:focus\:ring-zinc-500:where(.dark,.dark *):focus,.dark\:focus-visible\:ring-zinc-500:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--color-zinc-500)}}:root{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;font-family:Geist Variable,Geist,Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.dark{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}body{-webkit-font-smoothing:antialiased;text-rendering:geometricprecision;margin:0}button,input,select{font:inherit}.personal-home{--personal-accent:#2563eb;--personal-border:#e2ded6;color:#23272d;background:#f8f7f3;grid-template-columns:196px minmax(0,1fr);width:100%;min-height:100vh;display:grid;overflow-x:clip}.personal-sidebar{border-right:1px solid var(--personal-border);background:#fcfbf8;flex-direction:column;height:100vh;padding:1.5rem 1rem;display:flex;position:sticky;top:0}.personal-wordmark{color:#181d24;letter-spacing:-.01em;align-items:center;gap:.625rem;padding-inline:.5rem;font-size:.9375rem;font-weight:700;text-decoration:none;display:flex}.personal-wordmark-mark,.personal-manager-icon{color:#fff;background:#1e40af;border-radius:.625rem;flex:none;place-items:center;width:1.875rem;height:1.875rem;display:grid;box-shadow:0 1px 2px #0f172a24}.personal-nav{gap:.25rem;margin-top:2rem;display:grid}.personal-nav-item{color:#646971;text-align:left;background:0 0;border:0;border-radius:.625rem;align-items:center;gap:.625rem;width:100%;padding:.625rem .75rem;font-size:.875rem;font-weight:500;text-decoration:none;display:flex}.personal-nav-item-active{color:#1e40af;background:#e8eefc}.personal-nav-item:disabled{cursor:default;opacity:.72}.personal-health{color:#71717a;align-items:center;gap:.5rem;margin-top:auto;padding:.75rem .5rem 0;font-size:.75rem;display:flex}.personal-health-dot,.personal-state-dot{background:#94a3b8;border-radius:9999px;flex:none;width:.5rem;height:.5rem}.personal-health-dot.is-healthy{background:#22c55e;box-shadow:0 0 0 3px #22c55e1f}.personal-health-dot.is-unhealthy{background:#e11d48;box-shadow:0 0 0 3px #e11d481f}.personal-main{min-width:0;padding-bottom:6rem;position:relative}.personal-header{border-bottom:1px solid var(--personal-border);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fcfbf8eb;justify-content:space-between;align-items:center;gap:1.5rem;min-height:7rem;padding:1.5rem clamp(1.5rem,5vw,4.5rem);display:flex}.personal-header h1{color:#181d24;letter-spacing:-.035em;margin:0;font-size:clamp(1.625rem,2.5vw,2rem);font-weight:650}.personal-header p{color:#71717a;margin:.375rem 0 0;font-size:.875rem}.personal-primary-link,.personal-row-action{color:#fff;background:var(--personal-accent);border-radius:.625rem;flex:none;justify-content:center;align-items:center;gap:.375rem;font-size:.8125rem;font-weight:600;text-decoration:none;display:inline-flex;box-shadow:0 1px 2px #2563eb33}.personal-primary-link{min-height:2.375rem;padding-inline:.875rem}.personal-content{width:min(100%,70rem);margin-inline:auto;padding:2rem clamp(1.5rem,5vw,4.5rem)}.personal-manager-summary{background:#ffffffb8;border:1px solid #dbe0e8;border-radius:.75rem;align-items:center;gap:.875rem;padding:.875rem 1rem;display:flex;box-shadow:0 1px 2px #0f172a09}.personal-manager-summary p{color:#474f5b;margin:0;font-size:.875rem;line-height:1.5}.personal-manager-icon{color:#1e40af;width:1.75rem;height:1.75rem;box-shadow:none;background:#e2e9f9}.personal-section{margin-top:2.25rem}.personal-section-heading{justify-content:space-between;align-items:end;gap:1rem;margin-bottom:.75rem;display:flex}.personal-section-heading h2{color:#23272d;letter-spacing:-.01em;margin:0;font-size:1rem;font-weight:650}.personal-section-heading p{color:#7d7d85;margin:.25rem 0 0;font-size:.75rem}.personal-section-heading>span{color:#7d7d85;font-variant-numeric:tabular-nums;font-size:.75rem}.personal-list{border:1px solid var(--personal-border);background:#ffffffdb;border-radius:.75rem;overflow:hidden;box-shadow:0 2px 8px #1d232b09}.personal-list-row{border-bottom:1px solid #ebe8e2;align-items:center;gap:1rem;min-width:0;padding:1rem;display:grid}.personal-list-row:last-child{border-bottom:0}.personal-needs-row{grid-template-columns:auto minmax(0,1fr) auto auto}.personal-goal-row{color:inherit;grid-template-columns:minmax(0,1fr) auto auto;text-decoration:none;transition:background-color .12s}.personal-goal-row:hover{background:#f8fafc}.personal-goal-meta{align-items:center;gap:.75rem;display:inline-flex}.personal-state-dot.is-blocking{background:#d97706;box-shadow:0 0 0 3px #d977061f}.personal-row-copy{min-width:0}.personal-row-copy strong,.personal-row-copy span{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.personal-row-copy strong{color:#2a2f36;font-size:.875rem;font-weight:580}.personal-row-copy span{color:#7d7d85;margin-top:.3125rem;font-size:.75rem}.personal-row-action{color:#1e40af;min-height:2rem;box-shadow:none;background:#e8eefc;padding-inline:.75rem}.personal-empty{color:#7d7d85;text-align:center;padding:1.5rem 1rem;font-size:.8125rem}.personal-source-tools{color:#94949c;justify-content:flex-end;align-items:center;gap:.25rem;margin-top:1rem;font-size:.6875rem;display:flex}.personal-source-tools button{min-height:1.75rem;color:inherit;background:0 0;border:0;border-radius:.375rem;align-items:center;gap:.25rem;padding-inline:.375rem;display:inline-flex}.personal-source-tools button:not(:disabled):hover{color:#475569;background:#f1efea}.personal-manager-input{color:#7d7d85;text-align:left;cursor:pointer;background:#fffffff0;border:1px solid #d8d6d0;border-radius:9999px;align-items:center;gap:.625rem;min-width:12rem;padding:.75rem 1rem;font-size:.8125rem;transition:border-color .12s,box-shadow .12s,color .12s;display:inline-flex;position:fixed;bottom:1.5rem;right:1.5rem;box-shadow:0 8px 24px #0f172a14}.personal-manager-input:hover{color:#475569;border-color:#bfc9da;box-shadow:0 10px 28px #0f172a1f}.personal-manager-backdrop{z-index:50;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a33;justify-content:flex-end;display:flex;position:fixed;inset:0}.personal-manager-drawer{color:#23272d;background:#fcfbf8;grid-template-rows:auto auto minmax(0,1fr) auto;width:min(26.25rem,100vw);min-width:0;height:100%;display:grid;box-shadow:-12px 0 36px #0f172a29}.personal-manager-drawer-header{border-bottom:1px solid var(--personal-border);grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;padding:1rem;display:grid}.personal-manager-drawer-header h2,.personal-manager-drawer-header p{margin:0}.personal-manager-drawer-header h2{color:#181d24;font-size:.9375rem;font-weight:650}.personal-manager-drawer-header p{color:#7d7d85;margin-top:.125rem;font-size:.6875rem}.personal-manager-source{color:#475569;background:#f1efea;border-radius:9999px;padding:.25rem .5rem;font-size:.6875rem}.personal-manager-drawer-header button,.personal-manager-composer button{color:#646971;cursor:pointer;background:0 0;border:0;border-radius:.5rem;flex:none;place-items:center;width:2rem;height:2rem;display:inline-grid}.personal-manager-drawer-header button:hover{color:#23272d;background:#f1efea}.personal-manager-quick-actions{border-bottom:1px solid #ebe8e2;gap:.5rem;padding:.75rem 1rem;display:flex;overflow-x:auto}.personal-manager-thread{min-width:0;padding:1rem;overflow-y:auto}.personal-message-answer{white-space:pre-wrap;color:#323944;line-height:1.7}.personal-message-pending{color:#64748b}.personal-message-activity{color:#646a74;border-top:1px solid #d6d3cc;margin-top:.625rem;padding-top:.5rem}.personal-message-activity summary{cursor:pointer;width:fit-content;font-size:.6875rem;font-weight:600}.personal-message-activity ol{gap:.25rem;margin:.5rem 0 0;padding-left:1.125rem;font-size:.6875rem;display:grid}.personal-message-reconnect{color:#1e40af;background:#fff;border:1px solid #cbd5e1;border-radius:.5rem;margin-top:.625rem;padding:.35rem .65rem;font-size:.6875rem;font-weight:700}.personal-message-reconnect:hover{background:#eff6ff;border-color:#93c5fd}.personal-manager-composer{border-top:1px solid var(--personal-border);padding:.875rem 1rem max(.875rem, env(safe-area-inset-bottom));background:#fcfbf8;align-items:center;gap:.5rem;display:flex}.personal-manager-composer input{color:#23272d;background:#fff;border:1px solid #d8d6d0;border-radius:.625rem;outline:none;width:100%;min-width:0;height:2.5rem;padding-inline:.75rem}.personal-manager-composer input:focus{border-color:#60a5fa;box-shadow:0 0 0 3px #3b82f61f}.personal-manager-composer button{color:#fff;background:var(--personal-accent)}.personal-manager-composer button:disabled{cursor:default;opacity:.42}@media (width<=760px){.personal-home{display:block}.personal-sidebar{border-right:0;border-bottom:1px solid var(--personal-border);grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;height:auto;padding:.75rem 1rem;display:grid;position:static}.personal-nav{justify-content:flex-end;min-width:0;margin-top:0;display:flex}.personal-nav-item{width:auto;padding:.5rem}.personal-nav-item:not(.personal-nav-item-active){font-size:0}.personal-health{margin-top:0;padding:0;font-size:0}.personal-header{min-height:auto;padding:1.25rem 1rem}.personal-content{padding:1.5rem 1rem}.personal-list{box-shadow:none;background:0 0;border:0;overflow:visible}.personal-list-row{border:1px solid var(--personal-border);background:#ffffffe6;border-radius:.75rem;margin-bottom:.625rem}.personal-needs-row{grid-template-columns:auto minmax(0,1fr) auto}.personal-needs-row .personal-row-action{grid-column:2/-1;justify-self:start}.personal-manager-input{bottom:1rem;right:1rem}}@media (width<=640px){.personal-manager-backdrop{align-items:flex-end}.personal-manager-drawer{width:100%;max-width:none;height:100dvh}}@media (width<=420px){.personal-wordmark-mark{display:none}.personal-sidebar{grid-template-columns:auto minmax(0,1fr) auto;padding-inline:.75rem}.personal-nav{gap:0}.personal-nav-item{gap:.25rem;padding-inline:.375rem}.personal-header{align-items:flex-start}.personal-primary-link{padding-inline:.625rem}.personal-primary-link svg{display:none}.personal-needs-row,.personal-goal-row{grid-template-columns:minmax(0,1fr) auto}.personal-needs-row .personal-state-dot{display:none}.personal-manager-input{min-width:0;max-width:calc(100vw - 2rem)}.personal-goal-meta svg{display:none}.personal-manager-drawer-header{grid-template-columns:auto minmax(0,1fr) auto auto}}.personal-workspace{--workspace-accent:#2563eb;--workspace-border:#e5e2dc;--workspace-muted:#70747e;color:#1e2228;background:#faf9f6;grid-template-columns:4.5rem 20rem minmax(0,1fr);height:100vh;min-height:42rem;display:grid;overflow:hidden}.personal-global-rail{border-right:1px solid var(--workspace-border);background:#fcfbf8;flex-direction:column;align-items:center;min-height:0;padding:1.125rem .75rem;display:flex}.personal-rail-logo{color:#fff;background:#1e40af;border-radius:.75rem;place-items:center;width:2.5rem;height:2.5rem;display:grid;box-shadow:0 4px 12px #1e40af2e}.personal-global-rail nav{gap:.5rem;margin-top:2rem;display:grid}.personal-global-rail nav button,.personal-global-rail>button{color:#80848c;cursor:pointer;background:0 0;border:0;border-radius:.625rem;place-items:center;width:2.5rem;height:2.5rem;display:grid}.personal-global-rail nav button.is-active{color:#1e40af;background:#e8eefc}.personal-global-rail nav button:disabled{cursor:default;opacity:.42}.personal-global-rail .personal-health-dot{margin-top:auto}.personal-goal-sidebar{border-right:1px solid var(--workspace-border);background:#fcfbf8;grid-template-rows:auto auto minmax(0,1fr) auto;min-width:0;min-height:0;display:grid}.personal-goal-sidebar>header{justify-content:space-between;align-items:center;height:4.75rem;padding:0 1.25rem;display:flex}.personal-goal-sidebar>header h1{letter-spacing:-.02em;margin:0;font-size:1rem;font-weight:680}.personal-goal-sidebar>header button,.personal-goal-sidebar>footer button{color:#70747e;background:0 0;border:0;border-radius:.5rem;place-items:center;width:2rem;height:2rem;display:grid}.personal-goal-sidebar>header button:disabled{opacity:.4}.personal-manager-row,.personal-goal-list-row{width:calc(100% - 1.5rem);min-width:0;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:.75rem;align-items:center;gap:.75rem;margin:0 .75rem;padding:.75rem;display:grid}.personal-manager-row{grid-template-columns:auto minmax(0,1fr);margin-bottom:.5rem}.personal-manager-row.is-selected,.personal-goal-list-row.is-selected{background:#e9eefa}.personal-goal-icon{color:#2563eb;background:#ffffffe6;border-radius:.625rem;place-items:center;width:2.25rem;height:2.25rem;display:grid;box-shadow:0 1px 2px #0f172a0f}.personal-manager-row strong,.personal-manager-row small,.personal-goal-list-copy strong,.personal-goal-list-copy small{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.personal-manager-row strong,.personal-goal-list-copy strong{font-size:.8125rem;font-weight:620}.personal-manager-row small,.personal-goal-list-copy small{color:var(--workspace-muted);margin-top:.25rem;font-size:.6875rem}.personal-goal-scroll{min-height:0;padding-bottom:1rem;overflow-y:auto}.personal-goal-list-row{grid-template-columns:auto minmax(0,1fr) auto;margin-bottom:.25rem}.personal-goal-list-row:hover{background:#f5f3ef}.personal-goal-list-row.is-selected:hover{background:#e9eefa}.personal-goal-list-row .personal-state-dot{width:.4375rem;height:.4375rem}.personal-state-dot.is-progressing{background:#10b981}.personal-state-dot.is-repair{background:#f43f5e}.personal-goal-list-row .rounded-full{padding-inline:.45rem;font-size:.625rem}.personal-goal-sidebar>footer{border-top:1px solid var(--workspace-border);min-height:3.25rem;color:var(--workspace-muted);justify-content:space-between;align-items:center;padding:0 1.25rem;font-size:.6875rem;display:flex}.personal-chat-pane{background:#faf9f6;grid-template-rows:auto minmax(0,1fr) auto;min-width:0;min-height:0;display:grid}.personal-chat-header{z-index:20;border-bottom:1px solid var(--workspace-border);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);background:#fcfbf8f0;justify-content:space-between;align-items:center;gap:1rem;min-width:0;min-height:4.75rem;padding:.75rem clamp(1rem,2.5vw,2rem);display:flex;position:relative}.personal-chat-title,.personal-chat-actions{align-items:center;gap:.75rem;min-width:0;display:flex}.personal-chat-title{flex:auto;overflow:hidden}.personal-chat-title>div{min-width:0}.personal-chat-actions{flex:none}.personal-chat-title h2,.personal-chat-title p{margin:0}.personal-chat-title h2{color:#181d24;letter-spacing:-.02em;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;font-weight:680;overflow:hidden}.personal-chat-title p{max-width:28rem;color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.15rem;font-size:.6875rem;overflow:hidden}.personal-chat-back,.personal-mobile-goals-button,.personal-chat-actions>button{color:#5b606a;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:.625rem;flex:none;place-items:center;width:2.25rem;height:2.25rem;display:grid}.personal-mobile-goals-button,.personal-agent-menu-backdrop{display:none}.personal-chat-back:hover,.personal-chat-actions>button:hover{border-color:var(--workspace-border);background:#fff}.personal-chat-actions>button.personal-progress-trigger{border-color:var(--workspace-border);color:#3c434e;background:#fffc;gap:.4rem;width:auto;padding-inline:.75rem;font-size:.6875rem;font-weight:620;display:inline-flex}.personal-agent-picker{position:relative}.personal-agent-trigger{color:#292e36;cursor:pointer;background:#fff;border:1px solid #dadadc;border-radius:.625rem;align-items:center;gap:.45rem;min-height:2.25rem;padding:0 .75rem;font-size:.75rem;font-weight:600;display:inline-flex}.personal-agent-menu{z-index:40;border:1px solid var(--workspace-border);background:#fffffffa;border-radius:.875rem;width:min(21rem,100vw - 2rem);padding:.5rem;position:absolute;top:calc(100% + .5rem);right:0;box-shadow:0 18px 48px #0f172a29}.personal-agent-menu-title,.personal-agent-menu-footer{color:var(--workspace-muted);padding:.5rem .625rem;font-size:.6875rem}.personal-agent-menu-title{color:#23272d;font-weight:650}.personal-agent-menu-footer{border-top:1px solid var(--workspace-border);margin-top:.375rem}.personal-agent-menu>button{width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:.625rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.625rem;padding:.625rem;display:grid}.personal-agent-menu>button:hover,.personal-agent-menu>button.is-selected{background:#eff3fc}.personal-agent-menu>button:disabled{cursor:not-allowed;opacity:.52}.personal-agent-menu strong,.personal-agent-menu small{display:block}.personal-agent-menu strong{font-size:.75rem}.personal-agent-menu small{color:var(--workspace-muted);margin-top:.125rem;font-size:.65rem}.personal-agent-avatar{color:#1e40af;background:#e2e9f9;border-radius:.625rem;flex:none;place-items:center;width:2rem;height:2rem;font-size:.75rem;font-weight:700;display:grid}.personal-agent-online{background:#10b981;border-radius:9999px;width:.4375rem;height:.4375rem}.personal-agent-online.is-offline{background:#94a3b8}.personal-live-badge{color:#33634e;background:#f5fcf8;border:1px solid #d1eddf;border-radius:9999px;align-items:center;gap:.375rem;padding:.35rem .625rem;font-size:.65rem;display:inline-flex}.personal-live-badge>span{background:#10b981;border-radius:9999px;width:.375rem;height:.375rem}.personal-chat-scroll{width:100%;min-height:0;padding:2rem clamp(1rem,5vw,5rem) 1.5rem;overflow-y:auto}.personal-chat-scroll>*{width:min(100%,56rem);margin-inline:auto}.personal-chat-welcome{background:#f1efea;border-radius:1rem;align-items:flex-start;gap:.875rem;margin-top:clamp(4rem,14vh,9rem);padding:1rem 1.125rem;display:flex}.personal-chat-welcome h3,.personal-chat-welcome p{margin:0}.personal-chat-welcome h3{font-size:.875rem;font-weight:650}.personal-chat-welcome p{color:#474f5b;margin-top:.25rem;font-size:.8125rem;line-height:1.55}.personal-manager-quick-actions{border:0;justify-content:center;gap:.625rem;padding:1rem 0;display:flex;overflow-x:auto}.personal-manager-quick-actions button{color:#3c434e;cursor:pointer;background:#ffffffc7;border:1px solid #d7dae1;border-radius:.625rem;flex:none;padding:.625rem .875rem;font-size:.75rem}.personal-manager-quick-actions button:hover{color:#1e40af;border-color:#a3b5dc}.personal-goal-summary{border:1px solid var(--workspace-border);background:#ffffffd1;border-radius:.875rem;overflow:hidden;box-shadow:0 2px 8px #0f172a08}.personal-goal-summary>div{border-bottom:1px solid #ebe8e2;grid-template-columns:7rem minmax(0,1fr);gap:1rem;padding:.8rem 1rem;font-size:.75rem;display:grid}.personal-goal-summary>div:last-child{border-bottom:0}.personal-goal-summary span{color:var(--workspace-muted)}.personal-goal-summary strong{min-width:0;font-weight:560}.personal-goal-summary .is-attention{background:#fffbeb}.personal-goal-summary .is-attention span,.personal-goal-summary .is-attention strong{color:#92400e}.personal-goal-projection{gap:.75rem;display:grid}.personal-projection-author{align-items:center;gap:.75rem;padding:0 .125rem .25rem;display:flex}.personal-projection-author strong,.personal-projection-author small{display:block}.personal-projection-author strong{color:#23272d;font-size:.8125rem;font-weight:660}.personal-projection-author small{color:var(--workspace-muted);margin-top:.15rem;font-size:.65rem}.personal-plan-card{border:1px solid var(--workspace-border);background:#ffffffdb;border-radius:.875rem;overflow:hidden;box-shadow:0 2px 8px #0f172a06}.personal-plan-card>header{border-bottom:1px solid #ebe8e2;justify-content:space-between;align-items:center;gap:1rem;min-height:3.25rem;padding:.75rem 1rem;display:flex}.personal-plan-card>header strong,.personal-plan-card>header small{display:block}.personal-plan-card>header strong{font-size:.75rem;font-weight:660}.personal-plan-card>header small{color:var(--workspace-muted);margin-top:.2rem;font-size:.625rem}.personal-plan-card>header>span{color:#5a5e65;background:#faf9f6;border:1px solid #e0ddd7;border-radius:.5rem;flex:none;padding:.25rem .45rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.65rem}.personal-plan-row{color:#343a43;border-bottom:1px solid #f0eee9;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;min-height:2.625rem;padding:.625rem 1rem;font-size:.75rem;display:grid}.personal-plan-row svg{color:#2563eb}.personal-plan-row.is-done svg{color:#059669}.personal-plan-row.is-done>span{color:#5c626b}.personal-plan-row small{color:var(--workspace-muted);font-size:.625rem}.personal-plan-card>button{color:#545b66;cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;gap:.25rem;width:100%;min-height:2.625rem;font-size:.6875rem;display:flex}.personal-plan-card>button:hover{color:#1e40af;background:#f8f9fc}.personal-plan-card.is-empty>header{border-bottom:0}.personal-plan-card.is-empty>p{color:var(--workspace-muted);margin:-.25rem 0 0;padding:0 1rem 1rem;font-size:.75rem;line-height:1.55}.personal-run-evidence-card{border:1px solid var(--workspace-border);width:100%;min-height:3.75rem;color:inherit;text-align:left;cursor:pointer;background:#ffffffd1;border-radius:.875rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;padding:.75rem 1rem;display:grid}.personal-run-evidence-card:hover{background:#fff;border-color:#c7ccd6}.personal-evidence-icon{color:#059669;background:#ecfdf5;border-radius:.625rem;place-items:center;width:2rem;height:2rem;display:grid}.personal-run-evidence-card strong,.personal-run-evidence-card small{display:block}.personal-run-evidence-card strong{font-size:.75rem;font-weight:650}.personal-run-evidence-card small{max-width:38rem;color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.2rem;font-size:.65rem;overflow:hidden}.personal-run-evidence-card em{color:var(--workspace-muted);white-space:nowrap;font-size:.625rem;font-style:normal}.personal-decision-card{background:#fffaee;border:1px solid #f5c068;border-radius:.875rem;justify-content:space-between;align-items:center;gap:1.5rem;margin-top:1rem;padding:1rem;display:flex}.personal-decision-card span{color:#b45309;text-transform:uppercase;font-size:.6875rem;font-weight:700}.personal-decision-card h3,.personal-decision-card p{margin:0}.personal-decision-card h3{margin-top:.25rem;font-size:.9375rem;font-weight:650}.personal-decision-card p{color:var(--workspace-muted);margin-top:.25rem;font-size:.75rem}.personal-decision-actions{flex:none;gap:.5rem;display:flex}.personal-decision-actions button,.personal-execution-card button,.personal-ops-link{color:#1e40af;cursor:pointer;background:#fff;border:1px solid #bbc9ea;border-radius:.625rem;justify-content:center;align-items:center;min-height:2.25rem;padding:0 .75rem;font-size:.75rem;font-weight:600;text-decoration:none;display:inline-flex}.personal-decision-actions button:last-child{border-color:var(--workspace-accent);color:#fff;background:var(--workspace-accent)}.personal-manager-thread{min-width:0;padding:1.25rem 0 0;overflow:visible}.personal-manager-message{color:#474f5b;background:#f1efea;border-radius:.875rem;width:fit-content;max-width:min(88%,43rem);margin-bottom:1rem;padding:.75rem .875rem;font-size:.8125rem;line-height:1.55}.personal-manager-message.is-user{color:#fff;background:#2563eb;margin-left:auto}.personal-message-author{color:#1e40af;margin-bottom:.25rem;font-size:.6875rem;font-weight:700;display:block}.personal-manager-message p,.personal-manager-message ul{margin:0}.personal-manager-message ul{gap:.375rem;margin-top:.5rem;padding-left:1rem;display:grid}.personal-manager-message small{color:#7d7d85;margin-top:.5rem;font-size:.625rem;display:block}.personal-manager-message.is-user small{color:#dbeafe}.personal-manager-message.is-pending{color:#64748b;background:#f8fafc}.personal-proposal-list{gap:.75rem;width:min(100%,43rem);margin:0 0 1.25rem;display:grid}.personal-proposal-card{background:#f9fbff;border:1px solid #d3dcee;border-radius:.875rem;gap:.625rem;padding:.875rem;display:grid}.personal-proposal-card>header{align-items:center;gap:.5rem;display:flex}.personal-proposal-card>header span{color:#1e40af;background:#dbeafe;border-radius:999px;padding:.125rem .5rem;font-size:.625rem;font-weight:700}.personal-proposal-card>header strong{font-size:.75rem}.personal-proposal-card>header small{color:var(--workspace-muted);margin-left:auto;font-size:.625rem}.personal-proposal-card>p,.personal-proposal-card>small{margin:0}.personal-proposal-card>p{color:#1e293b;font-size:.8125rem;font-weight:600;line-height:1.5}.personal-proposal-card>small,.personal-proposal-status{color:#64748b;font-size:.6875rem;line-height:1.5}.personal-proposal-card>code{color:#475569;background:#f1f5f9;border-radius:.375rem;width:fit-content;padding:.25rem .375rem;font-size:.625rem}.personal-proposal-card.is-approved{background:#f7fefa;border-color:#a7f3d0}.personal-proposal-card.is-stale,.personal-proposal-card.is-error{background:#fffbeb;border-color:#fdba74}.personal-proposal-actions{flex-wrap:wrap;gap:.5rem;display:flex}.personal-proposal-actions button{color:#475569;cursor:pointer;background:#fff;border:1px solid #cbd5e1;border-radius:.625rem;min-height:2.25rem;padding:0 .75rem;font-size:.6875rem;font-weight:650}.personal-proposal-actions button:first-child{border-color:var(--workspace-accent);color:#fff;background:var(--workspace-accent)}.personal-proposal-actions button:disabled{cursor:wait;opacity:.55}.personal-execution-card{border:1px solid var(--workspace-border);background:#fffc;border-radius:.875rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;margin-top:1.25rem;padding:.875rem;display:grid}.personal-execution-card strong,.personal-execution-card p{margin:0}.personal-execution-card strong{font-size:.8125rem}.personal-execution-card p{color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.25rem;font-size:.6875rem;overflow:hidden}.personal-manager-composer{background:#fffffff5;border:1px solid #d5d5d6;border-radius:1rem;grid-template-rows:1fr;grid-template-columns:auto minmax(0,1fr) auto;gap:.5rem;width:min(100% - 2rem,58rem);min-height:4rem;margin:0 auto 1rem;padding:.5rem .625rem;display:grid;position:relative;box-shadow:0 10px 30px #0f172a14}.personal-manager-composer input{color:#23272d;background:0 0;border:0;outline:none;grid-area:1/2;height:2.75rem;padding:0 .25rem}.personal-manager-composer input:focus{box-shadow:none;border:0}.personal-composer-tools{grid-area:1/1;align-self:center;align-items:center;min-width:0;display:flex}.personal-composer-tools button{color:#334155;cursor:pointer;background:#f5f3ef;border:0;border-radius:.75rem;align-items:center;gap:.35rem;width:auto;min-width:0;height:2.5rem;min-height:2.5rem;padding:0 .625rem;font-size:.6875rem;font-weight:620;display:inline-flex}.personal-composer-tools button span{text-overflow:ellipsis;white-space:nowrap;max-width:8rem;display:block;overflow:hidden}.personal-manager-composer .personal-send-button{color:#fff;background:var(--workspace-accent);cursor:pointer;border:0;border-radius:.75rem;grid-area:1/3;align-self:center;place-items:center;width:2.5rem;height:2.5rem;display:grid}.personal-manager-composer .personal-send-button:disabled{cursor:default;opacity:.34}.personal-details-backdrop{z-index:70;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a2e;justify-content:flex-end;display:flex;position:fixed;inset:0}.personal-running-details{background:#fcfbf8;width:min(28rem,100vw);height:100%;padding:1rem;overflow-y:auto;box-shadow:-12px 0 36px #0f172a29}.personal-running-details>header{justify-content:space-between;align-items:center;gap:1rem;padding-bottom:1rem;display:flex}.personal-running-details h2,.personal-running-details header p{margin:0}.personal-running-details h2{font-size:1rem;font-weight:680}.personal-running-details header p{color:var(--workspace-muted);margin-top:.25rem;font-size:.6875rem}.personal-running-details header button{cursor:pointer;background:#f1efea;border:0;border-radius:.625rem;place-items:center;width:2.25rem;height:2.25rem;display:grid}.personal-diagnosis-card{border:1px solid var(--workspace-border);background:#fff;border-radius:.875rem;padding:1rem}.personal-diagnosis-card>span{color:#059669;font-size:.6875rem;font-weight:700}.personal-diagnosis-card h3{margin:.375rem 0 1rem;font-size:.875rem;line-height:1.5}.personal-diagnosis-card dl,.personal-diagnosis-card dd{margin:0}.personal-diagnosis-card dl{gap:.625rem;display:grid}.personal-diagnosis-card dl>div{grid-template-columns:3.5rem minmax(0,1fr);gap:.75rem;font-size:.75rem;display:grid}.personal-diagnosis-card dt{color:var(--workspace-muted)}.personal-running-details details{border-bottom:1px solid var(--workspace-border);padding:1rem .25rem}.personal-running-details summary{cursor:pointer;font-size:.8125rem;font-weight:620}.personal-running-details details p{color:var(--workspace-muted);margin:.75rem 0 0;font-size:.75rem;line-height:1.55}.personal-details-todo-list{gap:.375rem;margin:.75rem 0 0;padding:0;list-style:none;display:grid}.personal-details-todo-list li{color:#484f59;padding-left:1rem;font-size:.71875rem;line-height:1.45;position:relative}.personal-details-todo-list li:before{content:"";background:#2563eb;border-radius:9999px;width:.375rem;height:.375rem;position:absolute;top:.45em;left:0}.personal-details-todo-list li.is-done{color:#7e838b}.personal-details-todo-list li.is-done:before{background:#059669}.personal-ops-link{gap:.375rem;width:100%;margin-top:1rem}.dark .personal-workspace,.dark .personal-chat-pane{color:#f4f4f5;background:#131417}.dark .personal-global-rail,.dark .personal-goal-sidebar,.dark .personal-chat-header,.dark .personal-running-details{color:#f4f4f5;background:#191a1e}.dark .personal-plan-card,.dark .personal-run-evidence-card,.dark .personal-projection-author strong{color:#f4f4f5;background:#1e1f23}.dark .personal-plan-card>header,.dark .personal-plan-row{border-color:#3f3f46}.dark .personal-plan-row,.dark .personal-plan-row.is-done>span{color:#d4d4d8}.dark .personal-decision-card{background:#45290d;border-color:#92400e}@media (width<=1000px){.personal-workspace{grid-template-columns:3.75rem 16.5rem minmax(0,1fr)}.personal-live-badge{display:none}.personal-chat-scroll{padding-inline:1.25rem}}@media (width<=720px){.personal-workspace{grid-template-rows:minmax(0,1fr);grid-template-columns:1fr;height:100dvh;min-height:100dvh;overflow:hidden}.personal-global-rail{display:none}.personal-goal-sidebar{border-right:0;height:100dvh;display:none}.personal-workspace.mobile-goals-visible .personal-goal-sidebar{display:grid}.personal-workspace.mobile-goals-visible .personal-chat-pane{display:none}.personal-chat-pane{height:100dvh;min-height:0}.personal-chat-header{-webkit-backdrop-filter:none;backdrop-filter:none;gap:.5rem;min-height:4.25rem;padding-inline:.75rem}.personal-mobile-goals-button{display:grid}.personal-goal-sidebar>header button,.personal-goal-sidebar>footer button{width:2.75rem;height:2.75rem}.personal-chat-title p,.personal-chat-title>span,.personal-chat-actions>button:first-of-type,.personal-chat-actions>button.personal-progress-trigger span{display:none}.personal-chat-actions>button.personal-progress-trigger{width:2.75rem;padding:0}.personal-chat-back,.personal-mobile-goals-button,.personal-chat-actions>button{width:2.75rem;height:2.75rem}.personal-agent-trigger{min-height:2.75rem;padding-inline:.5rem}.personal-agent-menu-backdrop{z-index:35;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a33;border:0;display:block;position:fixed;inset:0}.personal-agent-menu{z-index:40;border-radius:1rem;width:auto;max-height:calc(100dvh - 1.5rem);position:fixed;inset:auto .75rem .75rem;overflow-y:auto}.personal-agent-menu>button{min-height:3.5rem}.personal-chat-scroll{padding:1rem .75rem}.personal-chat-welcome{margin-top:1rem}.personal-manager-quick-actions{grid-template-columns:repeat(2,minmax(0,1fr));display:grid;overflow:visible}.personal-manager-quick-actions button{white-space:normal;width:100%}.personal-manager-quick-actions button:last-child{grid-column:1/-1}.personal-goal-summary>div{grid-template-columns:5.5rem minmax(0,1fr)}.personal-decision-card{flex-direction:column;align-items:stretch}.personal-run-evidence-card{grid-template-columns:auto minmax(0,1fr) auto}.personal-run-evidence-card em,.personal-plan-row small{display:none}.personal-decision-actions{grid-template-columns:1fr 1fr;display:grid}.personal-decision-actions button,.personal-manager-quick-actions button,.personal-execution-card button,.personal-ops-link,.personal-running-details header button{min-height:2.75rem}.personal-running-details header button{width:2.75rem;height:2.75rem}.personal-execution-card{grid-template-columns:auto minmax(0,1fr) auto}.personal-execution-card .rounded-full{display:none}.personal-execution-card button{grid-column:2/-1;justify-self:start}.personal-manager-composer{margin-bottom:.5rem;position:sticky;bottom:.5rem}.personal-composer-tools button,.personal-send-button{min-width:2.75rem;min-height:2.75rem}}.chat-shell{background:radial-gradient(circle at 48% 0,#ffffffeb,#0000 30rem),#f7f8f6}.chat-goal-map{isolation:isolate;position:relative;overflow:hidden}.chat-goal-map:before{z-index:0;content:"";opacity:.44;background-image:radial-gradient(#94a3b83b .7px,#0000 .7px);background-size:18px 18px;position:absolute;inset:0;-webkit-mask-image:linear-gradient(#0000,#000 18% 84%,#0000);mask-image:linear-gradient(#0000,#000 18% 84%,#0000)}.chat-map-goal:after{content:"";background:#cbd5e1;width:1px;height:3rem;position:absolute;top:100%;left:50%}.chat-map-branches:before{content:"";background:#cbd5e1;height:1px;position:absolute;top:-1.5rem;left:16.666%;right:16.666%}.chat-map-branches>div{position:relative}.chat-map-branches>div:before{content:"";background:#cbd5e1;width:1px;height:1.5rem;position:absolute;bottom:100%;left:50%}.chat-map-branches:after{content:"";background:#cbd5e1;width:1px;height:2.5rem;position:absolute;top:100%;left:50%}@media (width<=767px){.chat-map-goal:after,.chat-map-branches:before,.chat-map-branches:after,.chat-map-branches>div:before{display:none}}@property --tw-border-spacing-x{syntax:"";inherits:false;initial-value:0}@property --tw-border-spacing-y{syntax:"";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/loopx/web/chat/assets/index-Mlk4kS9d.js b/loopx/web/chat/assets/index-CSsrBwtA.js similarity index 80% rename from loopx/web/chat/assets/index-Mlk4kS9d.js rename to loopx/web/chat/assets/index-CSsrBwtA.js index d16cf01515..a88877e931 100644 --- a/loopx/web/chat/assets/index-Mlk4kS9d.js +++ b/loopx/web/chat/assets/index-CSsrBwtA.js @@ -25,7 +25,7 @@ Notification: Only notify me when needed`,"composer.heartbeatTemplateWithoutGoal Goal: Frequency: Daily Stop condition: Goal completes -Notification: Only notify me when needed`,"composer.nextAction":`Ask what’s next`,"composer.nextActionPrompt":`What should I do next?`,"composer.prepareDraft":`Insert a draft and review before sending`,"composer.send":`Send`,"composer.sendMessage":`Send a message to LoopX`,"composer.sendMessageHint":`Send message`,"composer.sentImageAlt":`Remove image {name}`,"conversation.agentPending":`Working…`,"conversation.close":`Close conversation receipt`,"conversation.convertHint":`Turn the Agent’s latest reply into a Task draft`,"conversation.full":`View full conversation`,"conversation.receipt":`Conversation receipt`,"conversation.replying":`Replying`,"conversation.title":`Manager conversation`,"conversation.toTask":`Convert to Task`,"digest.away":`Runs since your previous visit`,"digest.completed":`new completions`,"digest.failed":`new failed/interrupted runs`,"digest.needsYou":`currently need confirmation`,"feedback.applying":`Running: {title}`,"feedback.cancelFailed":`Cancel failed: {error}`,"feedback.completed":`Completed: {title}`,"feedback.executionFailed":`Execution failed: {error}`,"feedback.gateRequired":`Your confirmation is required: {summary}`,"feedback.notCompleted":`Not completed: {status}`,"feedback.goalRefreshFailed":`The Goal opened, but its latest state could not be refreshed. Use Refresh to try again.`,"feedback.preparingPreview":`Preparing confirmation preview: {title}`,"feedback.previewFailed":`Could not prepare the confirmation preview: {error}`,"feedback.sendFailed":`Send failed: {error}`,"feedback.sendGenericError":`Could not send the message. Try again later.`,"feedback.stale":`State changed, so nothing was applied. Generate a new confirmation preview.`,"feedback.taskDraftCreated":`Created a Task draft from the reply. Edit and send it to review the confirmation preview.`,"goal.defaultTitle":`New personal Goal`,"goal.initialTodo":`Work toward the completion criteria: {criteria}`,"goal.objectiveBoundary":`Execution boundary: {boundary}`,"goal.objectiveCompletion":`Completion criteria: {criteria}`,"drawer.advancedDiagnostics":`Advanced diagnostics`,"drawer.agentWorking":`Agent is continuing; the record updates automatically.`,"drawer.analysis":`Analyzing`,"drawer.apply":`Confirm and apply`,"drawer.applying":`Applying…`,"drawer.attentionBlocking":`Blocking an Agent`,"drawer.attentionWaiting":`Waiting for your decision`,"drawer.autoNotify":`Human-gate auto notifications`,"drawer.branch":`Branch`,"drawer.closeDetail":`Close details and return to {context}`,"drawer.connected":`Connected`,"drawer.correctionDescription":`The message keeps the current Goal, Todo, and Agent Session context.`,"drawer.correctionLabel":`Guide {agent}`,"drawer.correctionPlaceholder":`For example: focus on permission risks first and do not commit yet…`,"drawer.correctionSend":`Send guidance`,"drawer.correctionTextarea":`Enter guidance for Goal {goal}, Agent {agent}, Run {run}`,"drawer.copyRepository":`Copy repository identity`,"drawer.copyRepositoryDone":`Repository identity copied`,"drawer.copyRepositoryError":`Copy failed. Check browser clipboard permission.`,"drawer.copyRepositorySuccess":`Copied. You can paste it into another tool.`,"drawer.cost":`Cost 24h / 7d`,"drawer.costShort":`Cost`,"drawer.durationShort":`Duration`,"drawer.period24h":`24h`,"drawer.period7d":`7d`,"drawer.tokens":`Tokens 24h / 7d`,"drawer.tokensShort":`tokens`,"drawer.usageNotMeasured":`Not measured`,"drawer.currentGoal":`Current Goal`,"attentionDetail.title":`Request details`,"attentionDetail.request":`What is requested`,"attentionDetail.decision":`Decision requested`,"attentionDetail.unknownRequest":`Not specified; review the source before deciding`,"attentionDetail.open":`Open in current projection`,"attentionDetail.closed":`Closed`,"attentionDetail.deferred":`Deferred`,"attentionDetail.superseded":`Replaced`,"attentionDetail.unknown":`Status not provided`,"attentionDetail.unavailable":`The source has not confirmed this item; refresh before acting`,"attentionDetail.unknownReason":`The source has not provided a reason.`,"attentionDetail.targetTodo":`Linked Todo to unblock`,"attentionDetail.targetAgent":`Agent named by the request`,"attentionDetail.scope":`Declared decision scope`,"attentionDetail.notProvided":`Not provided`,"attentionDetail.replacement":`Replacement Todo`,"attentionDetail.openReplacement":`Open replacement`,"attentionDetail.boundary":`Reading this detail does not resolve a gate or grant authority. Available decisions require a fresh preview.`,"drawer.decisionDefaultEvidence":`No additional public-safe evidence is attached. The next step will still show a Preview first.`,"drawer.decisionDefaultReason":`This decision affects the next step of the current Todo.`,"drawer.decisionDefer":`Decide later`,"drawer.decisionMore":`More decisions`,"drawer.decisionReject":`Reject`,"drawer.decisionReview":`Review impact and decide`,"drawer.dependencies":`Dependencies`,"drawer.detailsAndActions":`Details & actions`,"drawer.duration":`Duration 24h / 7d`,"drawer.evidence":`Evidence`,"drawer.executionHistory":`Execution history`,"drawer.executionRecord":`Run record`,"drawer.executionRecordAndResult":`Execution & result`,"drawer.explainDecision":`Explain this decision`,"drawer.gateApproveHint":`Run one command in the terminal to complete approval:`,"drawer.gateRejectHint":`Replace approve with reject at the end to decline. This notice disappears after the command runs.`,"drawer.gateRequiresHost":`Host confirmation required`,"drawer.gateRequiresHostDescription":`This page cannot approve this protected permission change. Nothing was written by your click.`,"drawer.goalAutoRun":`Automatic runs for this Goal`,"drawer.goalChanges":`Pending changes for this Goal`,"drawer.goalDetails":`Goal details`,"drawer.group":`Group`,"drawer.inspectorFull":`Switch to full screen`,"drawer.inspectorFullView":`Full-screen view`,"drawer.inspectorHalf":`Switch to half screen`,"drawer.inspectorHalfView":`Half-screen view`,"drawer.lastNotification":`Latest notification`,"drawer.larkConfigure":`Configure Lark connection`,"drawer.larkConnect":`Connect Lark App`,"drawer.larkConnection":`Lark connection`,"drawer.larkNotConfigured":`Not configured`,"drawer.larkNotConfiguredDescription":`After setup, LoopX sends a Feishu notification when this Goal needs your confirmation.`,"drawer.managerChanges":`Pending Manager changes`,"drawer.moreActions":`More actions`,"drawer.moreRunActions":`More run actions`,"drawer.nextTransition":`Next transition`,"drawer.noExecutionHistory":`No execution history yet.`,"drawer.noRun":`Execution Session has not started`,"drawer.noRunDescription":`Run records will appear here after an Agent starts execution.`,"drawer.notAssigned":`Unassigned`,"drawer.notLinked":`Not linked`,"drawer.notSet":`Not set`,"drawer.outputDetails":`Output details`,"drawer.outputRecorded":`This output is recorded on the current Goal.`,"drawer.outputSafePreview":`Public-safe output preview`,"drawer.outputRun":`Run`,"drawer.outputTodo":`Todo`,"drawer.outputs":`Outputs from this run`,"drawer.previewUnavailable":`No public-safe inline preview is available for this output.`,"drawer.priority":`Priority`,"drawer.progress":`Progress`,"drawer.proposalApplied":`Applied. LoopX state will refresh.`,"drawer.proposalApplyFailed":`Apply failed. No changes were written.`,"drawer.proposalApplyFailedHint":`Refresh the Goal state and regenerate. If it still fails, keep this page open and inspect advanced diagnostics.`,"drawer.proposalClose":`Close`,"drawer.proposalDefer":`Later`,"drawer.proposalDeferred":`Deferred. You can apply it later or regenerate it.`,"drawer.proposalEnterGoal":`Open new Goal`,"drawer.proposalExplainer":`After confirmation, LoopX applies this change and shows the write result. Closing or canceling changes nothing.`,"drawer.proposalRecheck":`Recheck against latest state`,"drawer.proposalRegenerate":`Retry with latest state`,"drawer.proposalRejected":`Rejected. This change will not be written.`,"drawer.proposalStale":`Source state changed. Recheck against the latest state.`,"drawer.proposalViewGoal":`View updated Goal`,"drawer.reassign":`Reassign to`,"drawer.reassignSummary":`Reassign: {task}`,"drawer.reason":`Reason`,"drawer.recoveryDescription":`Local history is preserved. Choose a recovery path.`,"drawer.recoveryFailed":`Upstream Session recovery failed`,"drawer.recoveryNewSession":`Start a new Session with context`,"drawer.recoveryRetry":`Retry recovery`,"drawer.repositoryRole":`Execution workspace`,"drawer.repository":`Repository`,"drawer.replyMode":`Reply mode`,"drawer.subagentApplied":`Applied and verified against the shared Goal state.`,"drawer.subagentAppliedRefreshFailed":`Applied and verified. The status view could not refresh; retry the page refresh later.`,"drawer.subagentApplying":`Applying and verifying shared-state readback…`,"drawer.subagentApplyFailed":`Could not apply the sub-agent setting.`,"drawer.subagentChildLimit":`Current limit`,"drawer.subagentConfirmDisable":`Confirm turning off sub-agent execution`,"drawer.subagentConfirmEnable":`Confirm turning on sub-agent execution`,"drawer.subagentCurrentBoundary":`Current task-domain restriction`,"drawer.subagentDescription":`Allows the runtime to create temporary child agents for independent tasks only after Todo, quota, capability, and write-scope gates pass. It does not force parallel work or grant durable authority.`,"drawer.subagentDisable":`Preview turning off sub-agent execution`,"drawer.subagentDisableSummary":`New child-agent execution will be disabled for this Goal. Existing Todo ownership and execution records stay unchanged.`,"drawer.subagentDomainInvalid":`The selected task-domain restriction is invalid.`,"drawer.subagentDomainTodoCount":`{count} matching open Todos`,"drawer.subagentDomains":`Task-domain restriction (optional)`,"drawer.subagentDomainsEmpty":`No open advancement Todo declares task_domain. Leave this empty to keep child execution unrestricted by task domain.`,"drawer.subagentDomainsHint":`Leave every option clear to apply no task-domain filter. Selecting domains admits only matching typed Todos; all other execution gates still apply.`,"drawer.subagentDomainsUnrestricted":`No task-domain restriction`,"drawer.subagentEnable":`Preview turning on sub-agent execution`,"drawer.subagentLabel":`Per-Goal execution boundary`,"drawer.subagentModel":`Child model`,"drawer.subagentEffort":`Child reasoning effort`,"drawer.subagentModelDefault":`Host default`,"drawer.subagentLunaPreset":`Use Luna / max`,"drawer.subagentClearModel":`Clear model preference`,"drawer.subagentModelHint":`Use Preview configuration update to save this preference. It can be saved while execution is off; host support is checked at launch.`,"drawer.subagentModelRequired":`Choose a child model before setting reasoning effort.`,"drawer.subagentMaxChildren":`Maximum child agents`,"drawer.subagentNoChange":`The current Goal already matches this setting; nothing was written.`,"drawer.subagentPending":`Pending confirmation`,"drawer.subagentPreviewBoundary":`Preview configuration update`,"drawer.subagentPreviewFailed":`Could not create the sub-agent setting preview.`,"drawer.subagentPreviewing":`Checking the latest Goal state…`,"drawer.subagentPreviewReady":`Preview locked. Confirm to apply this Goal setting.`,"drawer.subagentPreviewSummary":`Allow up to {count} child agents. Task-domain restriction: {domains}.`,"drawer.subagentRemoteReadOnly":`This source is read only. Open the Goal on its host to change the setting.`,"drawer.subagentTitle":`Adaptive sub-agent execution`,"drawer.remoteDetailsDescription":`SSH sources expose public-safe status only and do not read connection settings from the source host.`,"drawer.remoteDetailsUnavailable":`Remote details are not projected`,"drawer.resumeNo":`No`,"drawer.resumeYes":`Yes`,"drawer.runDetails":`Execution Session`,"drawer.runInterrupt":`Interrupt this run`,"drawer.runLatest":`View latest execution`,"drawer.runNewSession":`Start new Session`,"drawer.runCloseSession":`Close Session`,"drawer.runRecordEmpty":`No run record yet. The Agent has not started this execution. Check waiting conditions or resume the Session under Details & actions.`,"drawer.runRecordProjected":`No step-by-step record is available. LoopX read {completed}/{total} projected steps{outputs}; inspect the Session under Details & actions.`,"drawer.runRecordProjectedOutputs":` and {count} outputs`,"drawer.runRoleAssistant":`Completed`,"drawer.runRoleSystem":`Needs review`,"drawer.runRoleUser":`Task received`,"drawer.runView":`Session views`,"drawer.scheduleAdd":`Add scheduled check`,"drawer.scheduleDefaultNotification":`Notify only when you are needed`,"drawer.scheduleDefaultStop":`Goal completes or owner stops it`,"drawer.scheduleDefaultTarget":`Wake according to this Goal’s LoopX schedule.`,"drawer.scheduleEdit":`Change to every 2 hours`,"drawer.scheduleLast":`Last run`,"drawer.scheduleLocalTimezone":`Local timezone`,"drawer.scheduleNext":`Next run`,"drawer.scheduleNeverRun":`Not run yet`,"drawer.scheduleNotification":`Notification`,"drawer.schedulePause":`Pause`,"drawer.schedulePending":`Waiting for schedule`,"drawer.scheduleResume":`Resume`,"drawer.scheduleRunNow":`Run now`,"drawer.scheduleStop":`Stop {kind}`,"drawer.scheduleStopCondition":`Stop condition`,"drawer.scheduleTimezone":`Timezone`,"drawer.sessionRecoverable":`Resumable`,"drawer.sessionStatus":`Session status`,"drawer.setupHeartbeat":`Set up Heartbeat`,"drawer.taskActions":`Pending Todo actions`,"drawer.taskAdvancement":`Advancement task`,"drawer.taskBlock":`Mark blocked`,"drawer.taskComplete":`Mark complete`,"drawer.taskCompletedNote":`This task is retained as a read-only record.`,"drawer.taskCompletedTitle":`Task completed`,"drawer.taskDefer":`Defer`,"drawer.taskDeferCondition":`Todo defer resume condition`,"drawer.taskDeferInvalid":`Unsupported condition format; use one of the deterministic conditions below.`,"drawer.taskDeferPlaceholder":`For example, resume_at:2026-09-14T09:00:00+08:00`,"drawer.taskDeferReview":`Review defer`,"drawer.taskDeferSupported":`Supports todo_done, pr_merged, capacity_available, and timezone-aware resume_at conditions.`,"drawer.taskDeferUntil":`Defer until`,"drawer.taskDetails":`Todo details`,"drawer.taskInfo":`Task information`,"drawer.taskManage":`Manage task`,"drawer.taskNextCompleted":`Create a follow-up task`,"drawer.taskNextOpen":`Advance or update status`,"drawer.taskOrdinary":`Task`,"drawer.taskStatusBlocked":`Blocked`,"drawer.taskStatusDeferred":`Deferred`,"drawer.resumeWhen":`Resume condition`,"drawer.resumeState":`Resume state`,"drawer.resumePending":`Waiting for condition`,"drawer.resumeReady":`Ready to resume`,"drawer.resumeReceipt":`Resume receipt`,"drawer.taskNextDeferred":`Wait for the resume condition, then reassess`,"drawer.taskNextResumeReady":`Resume condition met; awaiting lifecycle replan`,"drawer.taskStatusCompleted":`Completed`,"drawer.taskStatusOpen":`Ready`,"drawer.taskSuccessor":`Create follow-up Todo`,"drawer.taskSuccessorNote":`Owner marked this blocked while waiting for more context.`,"drawer.taskSuccessorSummary":`Create follow-up Todo: {task}`,"drawer.taskSuccessorText":`Follow-up work for {task}`,"drawer.taskType":`Task type`,"drawer.topic":`Topic`,"drawer.trigger":`Trigger`,"drawer.titleAttention":`Needs you`,"drawer.titleOutput":`Output details`,"drawer.titleProposalApplied":`Execution result`,"drawer.titleProposalConfirm":`Confirm execution`,"drawer.titleSchedule":`Scheduled check`,"drawer.unconfigured":`Not configured`,"drawer.workspaceCandidates":`Available workspaces`,"files.emptySummary":`Public-safe output`,"files.empty":`No files, outputs, or verified reports yet.`,"files.loadingReports":`Loading verified milestone reports…`,"files.reportDelta":`+{added} added · {changed} changed`,"files.reportAdded":`added`,"files.reportChanged":`changed`,"files.reportGeneration":`Generation`,"files.reportLoadFailed":`Could not load verified reports`,"files.reportPublication":`Publication`,"files.title":`Files & Outputs`,"files.verifiedReport":`Verified milestone report`,"header.agentUnavailable":`Unavailable`,"header.chatRuntime":`Chat`,"header.workAgentCount":`{count} work Agents`,"header.chat":`Chat`,"header.files":`Files`,"header.goalCapabilities":`Capability settings`,"header.goalCapabilitiesDescription":`Manage overrides and inherited machine defaults.`,"header.goalDetails":`Goal details`,"header.goalDetailsDescription":`Review status, usage, repository, notifications, and sessions.`,"header.goalSettings":`Goal settings`,"header.goalSettingsDescription":`Open Goal details or capability settings`,"header.goalNavigation":`Goal navigation`,"header.goalView":`Goal view`,"header.live":`Live`,"header.manager":`LoopX Manager`,"header.managerDescription":`Your personal workspace across Goals`,"header.managerRuntime":`{profile} · {sandbox}`,"header.managerRuntimeFallback":`Configuration invalid; fell back to {profile} · {sandbox}. Repair it in Machine capabilities.`,"header.managerOverview":`Overview`,"header.managerView":`Manager view`,"header.openGoalNavigation":`Open Goal navigation`,"header.readOnlySourceDescription":`{source} is displayed read-only through an SSH tunnel`,"header.refresh":`Refresh status`,"header.refreshDone":`Updated just now`,"header.refreshFailed":`Refresh failed`,"header.refreshing":`Refreshing`,"header.selectAgent":`Select Agent`,"header.selectChatRuntime":`Select chat runtime`,"header.tasks":`Tasks`,"header.themeBrutal":`Switch to brutal theme`,"header.themePaper":`Switch to default theme`,"home.blockingSummary":`{count} are blocking an Agent.`,"home.completedGoals":`Completed Goals`,"home.empty":`Nothing here`,"startup.goalLoading":`Loading status…`,"startup.goalError":`Could not load status`,"startup.progress":`{loaded} of {total} active Goals loaded`,"startup.partial":`Goal states are updating. Counts are incomplete.`,"startup.independent":`Other Goals remain available while this Goal loads.`,"startup.error.timeout":`The request timed out. Retry when the local service is ready.`,"startup.error.network":`The connection was interrupted. Retry to reconnect.`,"startup.error.service":`The Goal status could not be read. Retry later; if the problem continues, check the status source.`,"startup.error.access":`The status source cannot access files or runtime directories required for this Goal. Check the permissions of the account running that source, then retry.`,"startup.error.revision":`The Goal directory changed during loading. Refresh to synchronize.`,"startup.error.scope":`This Goal is no longer available in the selected source. Refresh the directory.`,"startup.error.invalid":`The status response could not be read. Refresh or check for a LoopX update.`,"startup.retry":`Retry`,"startup.retryFailed":`Retry failed Goals`,"startup.failedCount":`{count} Goals could not be loaded. Ready Goals remain available.`,"home.greeting":`Hi, I’m your LoopX Manager`,"home.history":`History`,"home.lane.needsYou":`Needs you`,"home.lane.needsYouDescription":`Waiting for your decision, authorization, or context`,"home.lane.observing":`Observing`,"home.lane.observingDescription":`Monitoring continuously and notifying you when something changes`,"home.lane.running":`Running`,"home.lane.runningDescription":`Agents are making progress and reporting back`,"home.lane.scheduled":`Scheduled`,"home.lane.scheduledDescription":`Queued until its time or prerequisite arrives`,"home.noActivity":`No activity yet`,"home.noFirstActivity":`Waiting for first activity`,"home.noCompletedGoals":`No completed Goals yet`,"home.preservedState":`State is preserved and can be resumed`,"home.stopped":`Stopped`,"home.systemHealth":`System health: {summary}`,"home.taskCount":`{count} Tasks`,"home.todayAt":`Today {time}`,"home.waitingCount":`You have {count} items to handle.`,"home.workspace":`Goal workspace`,"lark.allMessages":`All messages in this topic`,"lark.allTopicMessages":`All topic messages`,"lark.agentIngress":`Agent ingress`,"lark.agentAppPermissions":`Every selected Agent needs a Lark App that is ready for group mentions and replies.`,"lark.agentApps":`Lark App per Agent`,"lark.agentAppsDescription":`The default App is preselected. Assign a different compatible App when an Agent needs its own bot identity.`,"lark.agentAppSelection":`Lark App for {agent}`,"lark.appCreated":`App created`,"lark.appCreateFailed":`Creation failed`,"lark.appLoading":`Loading available Lark Apps…`,"lark.appPermissions":`This App can send connection messages, but lacks the bot permissions required to receive group mentions or reply automatically. Enable im:message.group_at_msg:readonly, im:message.send_as_bot, and the im.message.receive_v1 event, publish a new version, then refresh.`,"lark.appProfile":`Lark App`,"lark.apps":`Lark Apps`,"lark.autoReplyUnavailable":`Auto reply unavailable`,"lark.autoReplyReady":`Auto reply ready`,"lark.bindGoal":`Bind to Goal`,"lark.cancel":`Cancel`,"lark.cardinality":`One Lark App · many Goals · one isolated route per Agent`,"lark.capture":`Capture`,"lark.captureAddressed":`Only messages that mention or reply to the App`,"lark.captureAll":`All messages in this Goal topic`,"lark.captureScope":`Capture scope`,"lark.captureScopeDescription":`Controls which Topic messages enter LoopX without expanding Agent permissions.`,"lark.closeConnection":`Close connection dialog`,"lark.closeCreate":`Close create dialog`,"lark.closeSettings":`Close Lark settings`,"lark.connect":`Connect`,"lark.connectAllAgents":`Connect every registered Agent`,"lark.connectAllAgentsAction":`Connect {count} Agents`,"lark.connectAllAgentsDescription":`Create {count} isolated Agent Topics in one guided action. Send requests inside the matching Topic; each Agent keeps its own route and inbox.`,"lark.connectApp":`Connect Lark App`,"lark.connection":`Connection`,"lark.connections":`Connections`,"lark.configuration":`Lark configuration`,"lark.continueFeishu":`Continue in Feishu`,"lark.createAutomatically":`Create Goal topic automatically`,"lark.createAutomaticallyDescription":`A dedicated, Agent-labelled Topic will be created for every selected Agent.`,"lark.defaultAgentAppDescription":`Used to find the target group and as the default for every selected Agent. Per-Agent choices below override it.`,"lark.description":`Manage reusable Lark Apps and connect group chats to Goals through dedicated topics.`,"lark.editConnection":`Edit Lark Connection`,"lark.goalConnections":`{count} Goal connections`,"lark.goalTopicConnections":`Lark Goal Topic connections`,"lark.groupChat":`Group chat`,"lark.groupEmpty":`This bot has not joined a group that can be connected. Add it to a Feishu group first, then return to refresh or search.`,"lark.groupLoading":`Reading groups joined by this bot…`,"lark.groupSearch":`Search groups joined by this bot`,"lark.historyPermission":`Group-history permission (separate capability)`,"lark.health.contextCaptured":`Group context captured`,"lark.health.contextCapturedDetail":`The message is retained as non-authoritative context. It did not start or steer a Manager turn; send a direct @ mention or verified reply when action is required.`,"lark.health.eventProcessed":`{events} events processed, {replies} replies sent.`,"lark.health.eventUnverified":`Event subscription needs verification`,"lark.health.eventUnverifiedDetail":`The provider listener is ready, but no event has arrived. Enable im.message.receive_v1 and group mention permissions, publish a new version, then send a new @ mention inside this Agent Topic. Group-level messages fail closed when multiple Agent routes exist.`,"lark.health.ignoredSelf":`The bot’s own message was ignored to prevent duplicate replies.`,"lark.health.invalidRouting":`Invalid routing configuration`,"lark.health.invalidRoutingDetail":`The connection was safely disabled. Select a processing mode again and save.`,"lark.health.lastStatus":`Latest event status: {status}`,"lark.health.listening":`Listening`,"lark.health.messageContextPermission":`Message permission required`,"lark.health.messageContextPermissionDetail":`A message event arrived, but group context could not be read. Publish and authorize group message read access for this App.`,"lark.health.notAddressed":`Latest message did not directly @ the bot`,"lark.health.notAddressedDetail":`Listening is healthy. This connection only responds to direct @ mentions or replies to the bot.`,"lark.health.notStarted":`Listener not started`,"lark.health.notStartedDetail":`Refresh the connection or restart LoopX, then try again.`,"lark.health.processingFailed":`Message processing failed`,"lark.health.processingFailedDetail":`The message event arrived, but Agent processing failed. Review local diagnostics and retry.`,"lark.health.queued":`Queued in the Agent inbox`,"lark.health.queuedDetail":`The message will be processed asynchronously by {agent} without starting a general Chat Session.`,"lark.health.sourceDisconnected":`Event connection disconnected`,"lark.health.sourceDisconnectedDetail":`The event consumer exited unexpectedly. Check that the app profile uses Feishu for Feishu apps or Lark for international Lark, then inspect connection and subscription errors. LoopX is retrying; successful history queries do not prove live delivery.`,"lark.health.retrying":`Retrying listener`,"lark.health.retryingDetail":`Event listening was interrupted and LoopX is retrying automatically.`,"lark.health.routeAmbiguous":`Message matches multiple Goals`,"lark.health.routeAmbiguousDetail":`The same bot and group have multiple full-group capture connections. Use a separate bot for each Agent or keep only one full-group connection.`,"lark.health.routeMismatch":`Message did not match this Goal Topic`,"lark.health.routeMismatchDetail":`The event came from another group or Topic. Reconnect this Goal to the correct group, then send a new @ mention.`,"lark.health.routeUnavailable":`Message cannot be routed to the Goal`,"lark.health.routeUnavailableDetail":`Connection data is incomplete. Reconnect this Goal, then send a new @ mention.`,"lark.health.starting":`Starting`,"lark.health.startingDetail":`LoopX is starting message event listening for this App.`,"lark.health.unavailable":`Auto reply unavailable`,"lark.health.waiting":`Waiting`,"lark.incomingMessages":`Incoming messages`,"lark.ingressAsync":`Async inbox`,"lark.ingressAsyncDescription":`Write to the Agent private inbox for a later explicit drain.`,"lark.editPreservesIdentity":`Saving preserves this App, group and Topic. Old connections upgrade to the Agent inbox by default.`,"lark.conversationKind":`Connection purpose`,"lark.managerConversation":`Manager · live conversation`,"lark.workerConversation":`Worker Agent · background tasks`,"lark.managerConversationDescription":`The built-in manager responds as you chat and delegates long-running work to background Agents. Group and private conversations keep separate histories.`,"lark.ingressLegacy":`Upgrade available`,"lark.ingressLegacyDescription":`Save this connection to upgrade to the Agent inbox. Existing messages remain in the same Topic.`,"lark.ingressQueue":`Queuing`,"lark.ingressQueueDescription":`Enter the same Agent Session's bounded FIFO queue and run after the current Turn.`,"lark.ingressSteering":`Steering`,"lark.ingressSteeringDescription":`Deliver to the active Turn and reject safely when no exact active Turn exists.`,"lark.loading":`Loading Lark configuration…`,"lark.management":`Lark management`,"lark.openEventSettings":`Open Feishu event settings`,"lark.mentions":`Mentions`,"lark.mentionsOnly":`Mentions only`,"lark.needsMessagePermissions":`Needs message permissions`,"lark.needsSetup":`Needs setup`,"lark.newApp":`New Lark App`,"lark.noAgentConfigured":`No Agent configured`,"lark.noConnections":`No matching connections.`,"lark.noProfiles":`No lark-cli App profiles are available yet.`,"lark.profileName":`Profile name`,"lark.profileValidation":`Profile can contain only letters, numbers, periods, underscores, and hyphens.`,"lark.processing":`Processing`,"lark.region":`Region`,"lark.registerAnother":`+ Register another Lark App — Create through Feishu`,"lark.reopenFeishu":`Reopen Feishu`,"lark.settingsConfigure":`Configure {goal}`,"lark.settingsDisconnect":`Disconnect {goal}`,"lark.replyMode":`Reply mode`,"lark.replyModeDescription":`Replies are limited to the source Topic to prevent cross-group or cross-Goal delivery.`,"lark.reusableApps":`{count} reusable Apps`,"lark.reusableWorkspaceApp":`Reusable workspace App`,"lark.routesUnverified":`{count} Lark routes pending verification`,"lark.saveConnection":`Save connection`,"lark.searchConnections":`Search Lark connections`,"lark.searchPlaceholder":`Search Apps, groups, Goals, or topics`,"lark.setupCopy":`LoopX opens the official Feishu creation page through lark-cli. App credentials stay in the system Keychain; LoopX stores only the profile reference.`,"lark.someoneMentions":`Someone mentions the Agent`,"lark.targetAgent":`Target Agent`,"lark.targetAgentDescription":`Choose a registered Agent in this Goal. This connection delivers to one Agent; it does not broadcast or grant permissions. Steering and Queuing require that Agent's exact active Session.`,"lark.agentUnavailable":`{agent} · no longer available`,"lark.selectRegisteredAgent":`Select an available registered Agent before connecting. The previous Agent will not be replaced automatically.`,"lark.topicPreview":`Topic preview`,"lark.topicReply":`Topic reply`,"lark.trigger":`Trigger`,"lark.waitingFeishu":`Waiting for Feishu`,"lark.waitingFeishuDescription":`Complete Feishu authorization in the new window. This page updates automatically when it is ready.`,"lark.waitingLink":`Generating the official Feishu creation link…`,"lark.error.appCreate":`Lark App creation failed`,"lark.error.appRequired":`Select a Lark App profile.`,"lark.error.bind":`Connection failed`,"lark.error.bindPreview":`Connection preview failed`,"lark.error.configuration":`Could not load Lark configuration`,"lark.error.groupLookup":`Could not read groups joined by this bot. Check the bot status and try again.`,"lark.error.groupLoad":`Could not load group chats`,"lark.error.invalidApp":`The Lark App profile is unavailable or has not completed authorization.`,"lark.error.messagePermissions":`This App lacks the bot permissions required for automatic replies. Enable im:message.group_at_msg:readonly and im:message:send_as_bot, publish a new version, then refresh.`,"lark.error.provider":`The Feishu API call failed without a verified receipt. Try again later.`,"lark.error.setupPoll":`Could not read creation status`,"lark.error.setupStart":`Could not start Lark App creation`,"lark.error.cliExecutable":`The configured lark-cli was found but cannot run. Check the installation or launch arguments.`,"lark.error.cliMissing":`lark-cli was not found. Install lark-cli and restart LoopX.`,"lark.error.cliStart":`lark-cli failed to start. Check the installation and restart LoopX.`,"lark.error.disconnect":`Disconnect failed`,"notifications.autoNotify":`Send automatically when your confirmation is required`,"notifications.bind":`Bind notification group`,"notifications.bindConfirm":`Bind “{goal}” to “{target}”. LoopX will verify that the bot is in the group and send a confirmation message.`,"notifications.bindFailed":`Binding failed`,"notifications.bound":`Bound`,"notifications.confirmBind":`Confirm binding`,"notifications.description":`Send Goal changes that need your confirmation to a Feishu group. Bindings and automatic delivery use the existing channel.`,"notifications.disabled":`Disabled`,"notifications.group":`Notification group: {target}`,"notifications.loadFailed":`Could not load notification groups`,"notifications.noTargets":`No notification groups are available. Group delivery uses a private bot identity; configure one from the terminal first:`,"notifications.notBound":`Not bound`,"notifications.recent":`Latest {time}`,"notifications.sentCount":`{count} sent`,"notifications.settings":`Goal notification bindings`,"notifications.setupFailed":`Could not update settings`,"notifications.title":`Feishu group notifications`,"proposal.field.agentId":`Agent`,"proposal.field.cadence":`Frequency`,"proposal.field.completionCriteria":`Completion criteria`,"proposal.field.executionBoundary":`Execution boundary`,"proposal.field.goalId":`Goal ID`,"proposal.field.heartbeat":`Heartbeat`,"proposal.field.initialTodos":`Initial tasks`,"proposal.field.objective":`Objective`,"proposal.field.operation":`Operation`,"proposal.field.operationState":`Operation state`,"proposal.field.resultDelivery":`Result delivery`,"proposal.field.confirmationBoundary":`Confirmation boundary`,"proposal.field.expiresAt":`Expires at`,"proposal.field.permission":`Permission`,"proposal.field.reason":`Reason`,"proposal.field.stopCondition":`Stop condition`,"proposal.field.target":`Check target`,"proposal.field.timezone":`Timezone`,"proposal.field.title":`Title`,"proposal.field.workspace":`Execution workspace`,"actionReview.targetChanged":`The preview target does not match the requested Goal and operation. Generate a new preview.`,"actionReview.ready_stop":`Pausing is reversible. This validated preview can apply directly; completion still requires verified readback.`,"actionReview.resume_review":`Review before restoring automatic scheduling. Quota, gates and Todo constraints still apply.`,"actionReview.delete_review":`Review removal of this stopped Goal from the registries. Project files and history are preserved.`,"actionReview.action_review":`Review the target and impact before applying this proposal.`,"actionReview.protected_action":`This action needs explicit review. Confirmation cannot replace required authority.`,"actionReview.unknown_permission":`The permission classification is not recognized. Recheck the proposal before continuing.`,"actionReview.unknown_action":`This lifecycle operation is not recognized. Recheck the proposal before continuing.`,"actionReview.incomplete_proposal":`The preview is missing validation or an available apply transition. Generate a new preview.`,"actionReview.authority_gate":`A gate prevents execution. Resolve its requirements, then recheck the proposal.`,"actionReview.stale_proposal":`The source state changed. Generate a new preview; the previous decision no longer applies.`,"actionReview.apply_pending":`Execution is in progress. Wait for its result before retrying.`,"actionReview.readback_verified":`The action completed and its resulting state was verified.`,"actionReview.readback_unverified":`The action returned without verified readback. Completion is not confirmed; recheck the state.`,"actionReview.operation_group_confirmation":`This exact request can only be confirmed on its original card in the bound Feishu group. The Dashboard does not expose a local execution control.`,"actionReview.operation_result_delivery_pending":`The operation outcome was recorded, but the original group result card has not passed readback verification yet.`,"actionReview.apply_failed":`Execution did not complete. Check the failure and regenerate the preview before retrying.`,"actionReview.inactive_proposal":`This proposal is no longer ready to execute. Recheck it before continuing.`,"proposal.gate.default":`Host confirmation required`,"proposal.impact.default":`After confirmation, the canonical LoopX service will write the state change.`,"proposal.impact.goalCreate":`After confirmation, LoopX will create the Goal and its initial Todo, then let the selected Agent start the first run.`,"proposal.impact.lifecycleDelete":`After confirmation, this stopped Goal is removed from the source and global registries. Project files, history state, and backups are preserved.`,"proposal.impact.lifecycleResume":`After confirmation, the Goal becomes eligible for automatic scheduling and returns to Active Goals. Actual execution still follows quota, Gate, and Todo constraints.`,"proposal.impact.lifecycleStop":`After confirmation, automatic progress stops and the Goal moves to the collapsed Stopped list. History, Todos, and evidence remain available for resuming.`,"proposal.impact.protected":`This action must be completed through the protected LoopX write service.`,"proposal.impact.operation":`The exact terms are read-only here. Confirm or reject the same immutable request in the bound Feishu group; confirmation consumes one canonical claim.`,"proposal.primary.apply":`Confirm and apply`,"proposal.primary.goalCreate":`Create Goal and start first run`,"proposal.primary.lifecycleDelete":`Delete Goal`,"proposal.primary.lifecycleResume":`Resume Goal`,"proposal.primary.lifecycleStop":`Stop Goal`,"proposal.primary.todoStart":`Create task and start execution`,"proposal.primary.operationGroup":`Confirm in Feishu group`,"proposal.primary.operationResultPending":`Result card delivery pending`,"proposal.primary.operationResultVerified":`Verified result`,"proposal.resultDelivery.verified":`Verified in the original group card`,"proposal.resultDelivery.pending":`Pending verified return to the original group card`,"proposal.summary.goalCreate":`Create Goal: {title}`,"proposal.summary.heartbeat":`Set a Heartbeat for the current Goal`,"proposal.summary.lifecycleDelete":`Delete Goal: {title}`,"proposal.summary.lifecycleResume":`Resume Goal: {title}`,"proposal.summary.lifecycleStop":`Stop Goal: {title}`,"proposal.summary.monitor":`Create a scheduled check for the current Goal: {target}`,"proposal.workspace.current":`Current local workspace (no Repository bound)`,"proposal.workspace.named":`{workspace} (execution environment only; does not bind a repository)`,"proposal.workspaceGate.agentImpact":`Bind an Agent identity, then recheck the original action. No Goal has been written.`,"proposal.workspaceGate.agentTitle":`Bind an Agent first`,"proposal.workspaceGate.defaultSummary":`Select the Goal workspace.`,"proposal.workspaceGate.selectionImpact":`After selecting a workspace, LoopX will show the confirmation preview again. The selection itself does not write state.`,"proposal.workspaceGate.selectionTitle":`Select Goal workspace`,"projection.agentAdvancingGoal":`Agent is advancing the current Goal`,"projection.agentIdle":`Nothing needs your attention`,"projection.agentNeedsDecision":`Agent is waiting for your decision`,"projection.agentPreparingNextStep":`Agent is preparing the next step`,"projection.agentStopped":`Stopped by you; history, Todos, and evidence are preserved`,"projection.agentWaitingExternal":`Waiting for an external condition`,"projection.confirmAgentDecision":`Confirm the permission or decision the Agent needs next`,"projection.events24h":`{count} events in the last 24 hours`,"projection.firstReadOnlyAdapterCheck":`Run the first read-only adapter check and save progress`,"projection.goalVerified":`Goal state, Todos, and registration information verified`,"projection.latestRun":`Latest run`,"projection.latestValidation":`Latest validation`,"projection.nextUpdatePending":`Waiting for LoopX to update the next step`,"projection.publicSafeProjection":`Public-safe status projection`,"projection.refreshState":`Refresh LoopX status and confirm the current progress is still valid`,"projection.runEvidenceAvailable":`Run evidence is available`,"projection.runRecorded":`The latest LoopX run is recorded`,"projection.statusRefreshNeeded":`LoopX status needs to be refreshed`,"projection.todoStatusUpdated":`Todo status updated; confirming the next step`,"projection.validationRecorded":`The latest validation is recorded`,"runs.completed":`Completed`,"runs.failed":`Needs review`,"runs.interrupted":`Interrupted`,"runs.queued":`Scheduled`,"runs.ready":`Ready`,"runs.resumeFailed":`Recovery failed`,"runs.running":`Running`,"runs.unknown":`Unknown`,"runs.waiting":`Waiting`,"schedule.active":`Running`,"schedule.heartbeat":`Goal Heartbeat`,"schedule.monitor":`Scheduled & continuous task`,"schedule.paused":`Paused`,"schedule.summary":`Continuously checked under LoopX scheduling constraints`,"schedule.defaultTarget":`Check the current Goal for blockers, progress, and new outputs`,"schedule.unsupportedCalendar":`Scheduled checks do not currently support an exact weekday or time. Use a fixed interval such as “Every 30 minutes,” “Every 2 hours,” or “Daily.” The draft was preserved and no confirmation preview was created.`,"source.add":`Add source`,"source.addConfigured":`Add read-only source`,"source.addMethod":`Source setup method`,"source.addSsh":`Add SSH source`,"source.closeForm":`Close source form`,"source.configured":`Configured SSH`,"source.configuredCount":`Local SSH Hosts · {count}`,"source.configuredGroup":`Configured SSH Hosts · {count} (select to add)`,"source.connected":`Connected`,"source.connecting":`Connecting`,"source.controlPlane":`Control plane source`,"source.copy":`Copy`,"source.copyCommand":`Copy SSH tunnel command`,"source.copyError":`Could not copy the command. Copy it manually below.`,"source.copied":`Copied`,"source.description":`All explicit Hosts are loaded, including Include files. Wildcards are not listed. Run the command first; LoopX never reads SSH keys or configuration details.`,"source.host":`Local SSH Host`,"source.hostEmpty":`No explicit SSH Hosts are available in ~/.ssh/config.`,"source.hostLoadError":`Could not read local SSH Hosts.`,"source.hostPlaceholder":`Enter or search for a Host`,"source.invalid":`The SSH source settings are invalid.`,"source.loadingHosts":`Loading…`,"source.localInteractive":`Local interactive`,"source.localPort":`Local port`,"source.manual":`Manual URL`,"source.manualDescription":`Remote sources always remain read-only projections and never inherit local write permissions.`,"source.name":`Name`,"source.namePlaceholder":`Remote development machine`,"source.notAvailable":`Unavailable`,"source.readOnly":`SSH tunnel · read only`,"source.readOnlyNoticeDescription":`You can view Goals, Tasks, evidence, and run status. Writes, guidance, and Agent sessions remain on the source host.`,"source.readOnlyNoticeTitle":`Remote read-only projection`,"source.readOnlyWriteError":`Remote SSH tunnel sources are read-only projections and cannot perform control-plane writes.`,"source.refreshHosts":`Reload SSH Hosts`,"source.remove":`Remove source {source}`,"source.removeCurrent":`Remove current source`,"source.select":`Select control plane source`,"source.selectHost":`Select a configured SSH Host.`,"source.statusUrl":`Local forwarded URL`,"source.tunnelCommandPending":`Select a Host to generate the tunnel command`,"machine.absent":`Not configured`,"machine.action.create":`Create machine policy`,"machine.action.delete":`Remove machine policy`,"machine.action.unchanged":`No write required`,"machine.action.update":`Update machine policy`,"machine.applied":`Machine policy applied and read back successfully.`,"machine.applyError":`Machine policy could not be applied.`,"machine.applyPreview":`Apply reviewed preview`,"machine.changedNamespaces":`Changed namespaces`,"machine.capabilityCatalog":`Machine capability catalog`,"machine.capabilityEmpty":`No machine-configurable capabilities are registered.`,"machine.configured":`Configured`,"machine.confirmRollback":`Confirm rollback`,"machine.currentRevision":`Current revision`,"machine.currentValue":`Current machine value`,"machine.description":`Browse the same capability catalog as Goal settings. Configure supported machine defaults here; Goal-only capabilities are labeled explicitly.`,"capabilities.rawJson":`Advanced: raw JSON`,"machine.goalOnly":`This capability currently supports Goal configuration only. Open a Goal’s capability settings to configure it; no machine-wide default is applied.`,"machine.desiredRevision":`Desired revision`,"machine.editorUnavailable":`No editor is installed for this namespace`,"machine.editorUnavailableDescription":`The namespace remains visible in the registry. Install or upgrade its Dashboard editor before changing it.`,"machine.editorMode":`Editor mode`,"machine.liveDefault":`Live default; Goal override wins`,"machine.liveDefaultDescription":`Goals without an explicit override read the current machine policy at the capability’s next decision point. Changes and removal affect those existing Goals immediately; an explicit Goal override stays pinned.`,"machine.genericNamespaceDescription":`Edit this registered namespace as JSON. LoopX validates it with the capability-owned schema before previewing any write.`,"machine.jsonConfiguration":`Namespace configuration (JSON)`,"machine.jsonConfigurationHelp":`Only this namespace is updated. Other machine configuration is preserved, and Apply remains locked to the reviewed preview revision.`,"machine.jsonEditor":`JSON`,"machine.editJson":`Edit JSON`,"capabilities.jsonConfiguration":`Goal configuration (JSON)`,"capabilities.jsonHelp":`Edit registered fields for this Goal. Changes require a new preview before applying.`,"capabilities.jsonInvalid":`Enter a valid JSON object using only registered editable fields.`,"machine.backToForm":`Back to form`,"machine.jsonInvalid":`Enter one valid JSON object before previewing changes.`,"machine.loadError":`Machine configuration could not be loaded.`,"machine.invalidStoredConfiguration":`Stored machine configuration needs repair`,"machine.invalidStoredConfigurationDescription":`Stored values are hidden because they no longer match the installed contract. Review the affected capability, then Preview and Apply its replacement; unrelated namespaces remain unchanged.`,"machine.machinePolicy":`Machine policy`,"machine.namespaceCount":`Registered namespaces`,"machine.namespaces":`Configuration namespaces`,"machine.periodicReport":`Periodic reports`,"machine.periodicReportDescription":`Default report policy for every Goal without an explicit override. Goal scheduling and delivery consume the effective configuration.`,"machine.periodicReportActivation":`Enabled means automatic delivery at validated stage boundaries`,"machine.periodicReportActivationDescription":`This is not a weekly timer. When LoopX validates a Goal stage completion, an Agent prepares and freezes the report, then automatically delivers it through the configured Goal Channel. The enabled subscription is standing delivery authority; failures and route drift stop closed for repair.`,"machine.changeQualityActivation":`Qualification is a quality gate, not new authority`,"machine.changeQualityActivationDescription":`Goals that inherit this policy qualify their exact final diff. safe_fix allows at most one bounded fix pass inside existing write authority; this setting never grants file, permission, or merge authority.`,"machine.replanCadenceActivation":`Review cadence changes timing, not execution authority`,"machine.replanCadenceActivationDescription":`Goals without an explicit override read this threshold before the next review decision. It does not create Turns, spend quota, or grant authority.`,"machine.preview":`Review exact machine change`,"machine.previewChanges":`Preview changes`,"machine.previewError":`A machine-policy preview could not be created.`,"machine.previewLocked":`Apply is locked to this exact revision. If machine state changes, LoopX requires a new preview.`,"machine.previewRollback":`Preview rollback`,"machine.previewRemoval":`Preview removal`,"machine.profilePreset":`Profile preset`,"machine.profilePresetHelp":`A capability-owned preset, such as weekly-progress.`,"machine.registry":`Typed registry`,"machine.requiredFields":`Enable requires a profile preset, Goal Channel route, and valid timezone.`,"machine.revision":`Machine revision`,"machine.revisionLockedReady":`All changes require a preview and apply only while that exact machine revision remains current.`,"machine.rollbackAvailable":`Rollback is available for the last apply`,"machine.rollbackDescription":`Preview the stored prior revision before restoring it.`,"machine.rollbackError":`The rollback could not be completed.`,"machine.rollbackPreviewDescription":`The prior revision is ready to restore. Confirm to apply this rollback.`,"machine.rolledBack":`The prior machine policy was restored and verified.`,"machine.removed":`Machine policy removed and the resulting configuration read back successfully.`,"machine.routeRef":`Goal Channel route`,"machine.routeRefHelp":`Use a public route alias; credentials and provider identifiers never enter this form.`,"machine.timezone":`Timezone`,"machine.timezoneHelp":`Use an IANA timezone, for example Asia/Shanghai.`,"machine.title":`Machine configuration`,"machine.unchanged":`Machine policy already matches this preview; nothing was written.`,"machine.visualEditor":`Guided`,"capabilities.atomicOverride":`Goal override is atomic`,"capabilities.atomicOverrideDescription":`A complete Goal value wins over the machine default. LoopX never mixes individual fields across scopes.`,"capabilities.applyFailed":`Goal capability changes were not applied.`,"capabilities.applyPreview":`Apply preview`,"capabilities.catalog":`Goal capability catalog`,"capabilities.chooseGoal":`Choose a Goal before inspecting its capabilities.`,"capabilities.defaultValue":`Declared default`,"capabilities.description":`Inspect the capabilities available to this Goal and the exact scope of each setting.`,"capabilities.editorPrepared":`Typed editor contract available`,"capabilities.effectiveSource":`Effective source`,"capabilities.empty":`No capability descriptors are available for this Goal.`,"capabilities.fields":`Registered fields`,"capabilities.goalPolicy":`Goal capability policy`,"capabilities.goalScope":`Goal`,"capabilities.goalValue":`Current Goal value`,"capabilities.loadFailed":`Could not load Goal capabilities`,"capabilities.loading":`Loading Goal capabilities…`,"capabilities.machineOnly":`This capability is configured only at machine scope.`,"capabilities.machineValue":`Live machine default`,"capabilities.machineScope":`Machine`,"capabilities.previewOnly":`Inspection is live. Goal writes remain unavailable until the revision-locked preview and apply path is connected.`,"capabilities.preview":`Revision-locked preview`,"capabilities.previewChanges":`Preview changes`,"capabilities.restoreInheritance":`Restore machine-default inheritance`,"capabilities.previewFailed":`Could not preview Goal capability changes.`,"capabilities.previewLocked":`Apply will re-check this exact plan revision and reject stale changes.`,"capabilities.partialWrite":`Goal value saved; shared projection needs reconciliation`,"capabilities.partialWriteDescription":`The source Goal configuration was written and read back. Its shared runtime projection did not synchronize, so do not submit the change again.`,"capabilities.refreshSource":`Refresh source value`,"capabilities.readOnly":`Read-only capability`,"capabilities.revisionLockedReady":`Changes require a preview and are applied only when its exact revision is still current.`,"capabilities.retry":`Retry`,"capabilities.source.capability_default":`Capability default`,"capabilities.source.goal_override":`Goal override`,"capabilities.source.machine_default":`Live machine default`,"capabilities.source.not_configured":`Not configured`,"capabilities.title":`Goal capabilities`,"settings.close":`Close settings`,"settings.appearance":`Appearance`,"settings.appearanceDescription":`Manage workspace display preferences in this browser.`,"settings.appearanceTabDescription":`Theme and display preferences`,"settings.capabilitiesTabDescription":`Capability overrides for this Goal`,"settings.back":`Back to workspace`,"settings.categories":`Settings categories`,"settings.description":`Manage workspace preferences and integrations.`,"settings.eyebrow":`Workspace preferences`,"settings.general":`General`,"settings.goalConnections":`Goal connections`,"settings.language":`Language`,"settings.languageDescription":`Choose the language used by the LoopX desktop workspace.`,"settings.languageEnglishDescription":`Use English for navigation, settings, and workspace controls.`,"settings.languageEnglish":`English`,"settings.languageSimplifiedChineseDescription":`Use Simplified Chinese for navigation, settings, and workspace controls.`,"settings.languageSimplifiedChinese":`Simplified Chinese`,"settings.languageStoredLocally":`This preference is stored only on this device.`,"settings.languageTabDescription":`Interface language for this device`,"settings.larkTabDescription":`Apps, group chats, and Goal Topic connections`,"settings.machineTabDescription":`Typed defaults shared by capabilities on this machine`,"settings.notifications":`Notifications`,"settings.open":`Settings`,"settings.themeDefault":`Paper`,"settings.themeDefaultDescription":`Calm and lightweight for long-running work.`,"settings.themeDescription":`Choose the workspace visual style. This preference is stored in the current browser.`,"settings.themeHighContrast":`High contrast`,"settings.themeHighContrastDescription":`Stronger borders and more prominent state blocks.`,"settings.themeLoopx":`LoopX standard`,"settings.themeLoopxDescription":`Precise monochrome surfaces, Geist type, and quiet hairline structure.`,"settings.title":`Settings`,"settings.workspaceDisplay":`Workspace display`,"settings.workspaceTheme":`Workspace theme`,"session.closeRecord":`Exit run record`,"session.details":`Session details`,"session.record":`Execution Session · Run record`,"session.recordDescription":`The timeline now shows messages and Turn records from this Session.`,"sidebar.createGoal":`Create Goal`,"sidebar.delete":`Delete`,"sidebar.deleteGoal":`Delete Goal`,"sidebar.manager":`LoopX Manager`,"sidebar.notifications":`Settings`,"sidebar.owner":`Personal workspace`,"sidebar.product":`Personal Agent workspace`,"sidebar.resume":`Resume`,"sidebar.resumeGoal":`Resume Goal`,"sidebar.stop":`Stop`,"tasks.historyLoading":`Loading history…`,"tasks.historyError":`History could not be loaded.`,"tasks.historyExpired":`History snapshot expired. Reload to continue.`,"tasks.historyRetry":`Reload`,"tasks.historyEnd":`End of completed history`,"tasks.historyMore":`Load more`,"tasks.historyLocalOnly":`Open this machine’s Dashboard to browse full history.`,"sidebar.sortGoals":`Reorder Goals`,"sidebar.dragGoal":`Drag to reorder, or use Reorder Goals`,"sidebar.moveUp":`Move {goal} up`,"sidebar.moveDown":`Move {goal} down`,"sidebar.goalMoved":`{goal} moved to position {position}`,"sidebar.orderNotSaved":`Order changed for this visit; browser storage is unavailable.`,"sidebar.stopGoal":`Stop Goal`,"sidebar.stopped":`Stopped`,"sidebar.stoppedLoading":`Loading stopped Goals`,"sidebar.stoppedLoadFailed":`Stopped Goals could not be loaded. Active Goals remain available.`,"sidebar.retryStopped":`Retry`,"state.completed":`Completed`,"state.needsRepair":`Needs repair`,"state.needsYou":`Needs you`,"state.quiet":`Quiet`,"state.running":`Running`,"state.stopped":`Stopped`,"state.waiting":`Waiting`,"tasks.blocked":`Blocked`,"tasks.agentLane":`Work Agent`,"tasks.agentLaneDescription":`Filter this Goal's projected work lanes`,"tasks.agentLaneFilter":`Filter by work Agent`,"tasks.allAgentLanes":`All Agents ({count})`,"tasks.chatAgentReplied":`Agent replied`,"tasks.chatPending":`Sent to Agent`,"tasks.chatPendingDescription":`Processing. Tasks update only after a task operation is confirmed.`,"tasks.chatRecent":`Recent conversation`,"tasks.chatUnchangedDescription":`This conversation did not directly change Tasks. Convert the reply to a Task draft and confirm it when execution is needed.`,"tasks.chatViewReply":`View reply`,"tasks.convertToTask":`Convert to Task`,"tasks.completed":`Completed`,"runs.discoveryPartial":`Some execution details are unavailable. Reconnecting; task summaries are not live execution status.`,"runs.discoveryOffline":`Execution service unavailable. Reconnecting; retained task summaries may be stale.`,"files.openConversation":`Go to conversation`,"files.exportSummary":`Export summary`,"tasks.viewDescription":`Decisions first, then work and recent completions`,"tasks.viewLabel":`Task view`,"tasks.listView":`List`,"tasks.boardView":`Board`,"tasks.completedSummary":`{count} tasks completed. Recent details are projected by the control plane when needed.`,"tasks.emptyCompleted":`No completed tasks yet.`,"tasks.emptyConfirm":`No tasks waiting for confirmation.`,"tasks.emptyRunning":`No queued or running tasks.`,"tasks.emptySchedules":`No scheduled tasks.`,"tasks.emptyGoal":`This Goal has no tasks yet. Describe the next step below and LoopX will show a confirmation preview first.`,"tasks.markComplete":`Mark complete: {name}`,"tasks.moreActions":`More actions: {name}`,"tasks.openExecution":`View execution: {name}`,"tasks.pending":`Pending`,"tasks.pendingAndRunning":`Queued / Running`,"tasks.scheduled":`Scheduled & continuous`,"tasks.sessionError":`Session issue`,"tasks.waiting":`Queued`,"tasks.waitingAge":`Waiting {age}`,"tasks.viewExecution":`View execution`,"tasks.viewResult":`View result`,"time.days":`{count} days`,"time.hours":`{count} hours`,"timeline.emptyGoal":`This Goal has no new activity`,"timeline.emptyGoalDescription":`Ask for progress or send new guidance.`,"timeline.emptyWorkspace":`Your workspace is quiet today`,"timeline.emptyWorkspaceDescription":`Describe a Goal to the LoopX Manager, or ask what deserves attention today.`,"timeline.gateHistory":`{count} historical Gates`,"timeline.pending":`Working…`,"timeline.runCompleted":`{run}: completed`,"timeline.review":`Review`,"timeline.reviewAndConfirm":`Review and confirm`,"timeline.waitingConfirmation":`Needs your confirmation`},"zh-CN":{"acceptance.connected":`已连接`,"acceptance.mapped":`已建立项目映射`,"acceptance.refreshed":`已刷新状态`,"acceptance.inspected":`已检查适配器`,"acceptance.recorded":`已记录执行`,"acceptance.judged":`已记录反馈`,"acceptance.approved":`已记录批准`,"acceptance.ready":`已记录控制器就绪`,"acceptance.attentionSource":`当前状态`,"acceptance.visionSource":`Agent 验收条件`,"acceptance.todoSource":`任务状态`,"acceptance.runSource":`最新执行证据`,"acceptance.title":`验收观察`,"acceptance.unavailable":`验收观测不可用,Goal 是否达成仍未知。`,"acceptance.partial":`当前仅有部分观测。任务完成或缺口列表为空,都不能证明 Goal 已通过验收。`,"acceptance.gaps":`仍需补充的证据`,"acceptance.reasonUnknown":`来源未提供原因`,"acceptance.unknown":`未知`,"acceptance.required":`所需证据或条件`,"acceptance.observed":`观测时间`,"acceptance.noGaps":`现有观测中没有缺口,尚未评估完整验收条件。`,"acceptance.guards":`待处理的门禁决策`,"acceptance.noGuards":`现有观测中没有待处理的门禁决策。`,"acceptance.scope":`决策范围`,"acceptance.next":`当前状态给出的下一步`,"acceptance.historical_progress":`已记录的历史进展`,"acceptance.historical":`历史生命周期记录不授予权限,也不代表通过验收。`,"acceptance.missing":`未获取的来源:`,"acceptance.truncated":`仅展示前 12 条观测。`,"common.actions":`操作`,"common.agent":`Agent`,"common.allMessages":`所有消息`,"common.cancel":`取消`,"common.close":`关闭`,"common.closeActionReceipt":`关闭操作回执`,"common.confirm":`确认`,"common.export":`导出`,"common.failed":`失败`,"common.goal":`Goal`,"common.loading":`加载中…`,"common.none":`无`,"common.off":`关闭`,"common.on":`开启`,"common.open":`打开`,"common.owner":`Owner`,"common.readOnly":`只读`,"common.recently":`刚刚`,"common.status":`状态`,"common.task":`Task`,"common.you":`你`,"common.waiting":`等待中`,"composer.addImage":`添加图片`,"composer.agentProgress":`向 Agent 获取进度报告`,"composer.agentProgressPrompt":`请给我一份当前 Goal 的进度报告:已完成、执行中、阻塞和下一步。`,"composer.attachImageHint":`选择、粘贴或拖入图片`,"composer.clarifyDefer":`暂缓 Todo 需要可自动判断的恢复条件。请补充 todo_done:、pr_merged:[owner/repo]#、capacity_available: 或 resume_at:<带时区 RFC3339 时间>。`,"composer.clarifySingleAction":`这句话包含多个可能修改状态的操作。请一次描述一项操作,我会逐项展示确认预览。`,"composer.createGoal":`创建新 Goal`,"composer.createGoalDraft":`Goal 草稿`,"composer.createGoalDraftDescription":`补充内容后发送,LoopX 会先展示待确认操作。`,"composer.createGoalDraftLead":`我想创建一个长期 Goal:`,"composer.createGoalTemplate":`我想创建一个长期 Goal: +Notification: Only notify me when needed`,"composer.nextAction":`Ask what’s next`,"composer.nextActionPrompt":`What should I do next?`,"composer.prepareDraft":`Insert a draft and review before sending`,"composer.send":`Send`,"composer.sendMessage":`Send a message to LoopX`,"composer.sendMessageHint":`Send message`,"composer.sentImageAlt":`Remove image {name}`,"conversation.agentPending":`Working…`,"conversation.close":`Close conversation receipt`,"conversation.convertHint":`Turn the Agent’s latest reply into a Task draft`,"conversation.full":`View full conversation`,"conversation.receipt":`Conversation receipt`,"conversation.replying":`Replying`,"conversation.title":`Manager conversation`,"conversation.toTask":`Convert to Task`,"digest.away":`Runs since your previous visit`,"digest.completed":`new completions`,"digest.failed":`new failed/interrupted runs`,"digest.needsYou":`currently need confirmation`,"feedback.applying":`Running: {title}`,"feedback.cancelFailed":`Cancel failed: {error}`,"feedback.completed":`Completed: {title}`,"feedback.executionFailed":`Execution failed: {error}`,"feedback.gateRequired":`Your confirmation is required: {summary}`,"feedback.notCompleted":`Not completed: {status}`,"feedback.goalRefreshFailed":`The Goal opened, but its latest state could not be refreshed. Use Refresh to try again.`,"feedback.preparingPreview":`Preparing confirmation preview: {title}`,"feedback.previewFailed":`Could not prepare the confirmation preview: {error}`,"feedback.sendFailed":`Send failed: {error}`,"feedback.sendGenericError":`Could not send the message. Try again later.`,"feedback.stale":`State changed, so nothing was applied. Generate a new confirmation preview.`,"feedback.taskDraftCreated":`Created a Task draft from the reply. Edit and send it to review the confirmation preview.`,"goal.defaultTitle":`New personal Goal`,"goal.initialTodo":`Work toward the completion criteria: {criteria}`,"goal.objectiveBoundary":`Execution boundary: {boundary}`,"goal.objectiveCompletion":`Completion criteria: {criteria}`,"drawer.advancedDiagnostics":`Advanced diagnostics`,"drawer.agentWorking":`Agent is continuing; the record updates automatically.`,"drawer.analysis":`Analyzing`,"drawer.apply":`Confirm and apply`,"drawer.applying":`Applying…`,"drawer.attentionBlocking":`Blocking an Agent`,"drawer.attentionWaiting":`Waiting for your decision`,"drawer.autoNotify":`Human-gate auto notifications`,"drawer.branch":`Branch`,"drawer.closeDetail":`Close details and return to {context}`,"drawer.connected":`Connected`,"drawer.correctionDescription":`The message keeps the current Goal, Todo, and Agent Session context.`,"drawer.correctionLabel":`Guide {agent}`,"drawer.correctionPlaceholder":`For example: focus on permission risks first and do not commit yet…`,"drawer.correctionSend":`Send guidance`,"drawer.correctionTextarea":`Enter guidance for Goal {goal}, Agent {agent}, Run {run}`,"drawer.copyRepository":`Copy repository identity`,"drawer.copyRepositoryDone":`Repository identity copied`,"drawer.copyRepositoryError":`Copy failed. Check browser clipboard permission.`,"drawer.copyRepositorySuccess":`Copied. You can paste it into another tool.`,"drawer.cost":`Cost 24h / 7d`,"drawer.costShort":`Cost`,"drawer.durationShort":`Duration`,"drawer.period24h":`24h`,"drawer.period7d":`7d`,"drawer.tokens":`Tokens 24h / 7d`,"drawer.tokensShort":`tokens`,"drawer.usageNotMeasured":`Not measured`,"drawer.currentGoal":`Current Goal`,"attentionDetail.title":`Request details`,"attentionDetail.request":`What is requested`,"attentionDetail.decision":`Decision requested`,"attentionDetail.unknownRequest":`Not specified; review the source before deciding`,"attentionDetail.open":`Open in current projection`,"attentionDetail.closed":`Closed`,"attentionDetail.deferred":`Deferred`,"attentionDetail.superseded":`Replaced`,"attentionDetail.unknown":`Status not provided`,"attentionDetail.unavailable":`The source has not confirmed this item; refresh before acting`,"attentionDetail.unknownReason":`The source has not provided a reason.`,"attentionDetail.targetTodo":`Linked Todo to unblock`,"attentionDetail.targetAgent":`Agent named by the request`,"attentionDetail.scope":`Declared decision scope`,"attentionDetail.notProvided":`Not provided`,"attentionDetail.replacement":`Replacement Todo`,"attentionDetail.openReplacement":`Open replacement`,"attentionDetail.boundary":`Reading this detail does not resolve a gate or grant authority. Available decisions require a fresh preview.`,"drawer.decisionDefaultEvidence":`No additional public-safe evidence is attached. The next step will still show a Preview first.`,"drawer.decisionDefaultReason":`This decision affects the next step of the current Todo.`,"drawer.decisionDefer":`Decide later`,"drawer.decisionMore":`More decisions`,"drawer.decisionReject":`Reject`,"drawer.decisionReview":`Review impact and decide`,"drawer.dependencies":`Dependencies`,"drawer.detailsAndActions":`Details & actions`,"drawer.duration":`Duration 24h / 7d`,"drawer.evidence":`Evidence`,"drawer.executionHistory":`Execution history`,"drawer.executionRecord":`Run record`,"drawer.executionRecordAndResult":`Execution & result`,"drawer.explainDecision":`Explain this decision`,"drawer.gateApproveHint":`Run one command in the terminal to complete approval:`,"drawer.gateRejectHint":`Replace approve with reject at the end to decline. This notice disappears after the command runs.`,"drawer.gateRequiresHost":`Host confirmation required`,"drawer.gateRequiresHostDescription":`This page cannot approve this protected permission change. Nothing was written by your click.`,"drawer.goalAutoRun":`Automatic runs for this Goal`,"drawer.goalChanges":`Pending changes for this Goal`,"drawer.goalDetails":`Goal details`,"drawer.group":`Group`,"drawer.inspectorFull":`Switch to full screen`,"drawer.inspectorFullView":`Full-screen view`,"drawer.inspectorHalf":`Switch to half screen`,"drawer.inspectorHalfView":`Half-screen view`,"drawer.lastNotification":`Latest notification`,"drawer.larkConfigure":`Configure Lark connection`,"drawer.larkConnect":`Connect Lark App`,"drawer.larkConnection":`Lark connection`,"drawer.larkNotConfigured":`Not configured`,"drawer.larkNotConfiguredDescription":`After setup, LoopX sends a Feishu notification when this Goal needs your confirmation.`,"drawer.managerChanges":`Pending Manager changes`,"drawer.moreActions":`More actions`,"drawer.moreRunActions":`More run actions`,"drawer.nextTransition":`Next transition`,"drawer.noExecutionHistory":`No execution history yet.`,"drawer.noRun":`Execution Session has not started`,"drawer.noRunDescription":`Run records will appear here after an Agent starts execution.`,"drawer.notAssigned":`Unassigned`,"drawer.notLinked":`Not linked`,"drawer.notSet":`Not set`,"drawer.outputDetails":`Output details`,"drawer.outputRecorded":`This output is recorded on the current Goal.`,"drawer.outputSafePreview":`Public-safe output preview`,"drawer.outputRun":`Run`,"drawer.outputTodo":`Todo`,"drawer.outputs":`Outputs from this run`,"drawer.previewUnavailable":`No public-safe inline preview is available for this output.`,"drawer.priority":`Priority`,"drawer.progress":`Progress`,"drawer.proposalApplied":`Applied. LoopX state will refresh.`,"drawer.proposalApplyFailed":`Apply failed. No changes were written.`,"drawer.proposalApplyFailedHint":`Refresh the Goal state and regenerate. If it still fails, keep this page open and inspect advanced diagnostics.`,"drawer.proposalClose":`Close`,"drawer.proposalDefer":`Later`,"drawer.proposalDeferred":`Deferred. You can apply it later or regenerate it.`,"drawer.proposalEnterGoal":`Open new Goal`,"drawer.proposalExplainer":`After confirmation, LoopX applies this change and shows the write result. Closing or canceling changes nothing.`,"drawer.proposalRecheck":`Recheck against latest state`,"drawer.proposalRegenerate":`Retry with latest state`,"drawer.proposalRejected":`Rejected. This change will not be written.`,"drawer.proposalStale":`Source state changed. Recheck against the latest state.`,"drawer.proposalViewGoal":`View updated Goal`,"drawer.reassign":`Reassign to`,"drawer.reassignSummary":`Reassign: {task}`,"drawer.reason":`Reason`,"drawer.recoveryDescription":`Local history is preserved. Choose a recovery path.`,"drawer.recoveryFailed":`Upstream Session recovery failed`,"drawer.recoveryNewSession":`Start a new Session with context`,"drawer.recoveryRetry":`Retry recovery`,"drawer.repositoryRole":`Execution workspace`,"drawer.repository":`Repository`,"drawer.replyMode":`Reply mode`,"drawer.subagentApplied":`Applied and verified against the shared Goal state.`,"drawer.subagentAppliedRefreshFailed":`Applied and verified. The status view could not refresh; retry the page refresh later.`,"drawer.subagentApplying":`Applying and verifying shared-state readback…`,"drawer.subagentApplyFailed":`Could not apply the sub-agent setting.`,"drawer.subagentChildLimit":`Current limit`,"drawer.subagentConfirmDisable":`Confirm turning off sub-agent execution`,"drawer.subagentConfirmEnable":`Confirm turning on sub-agent execution`,"drawer.subagentCurrentBoundary":`Current task-domain restriction`,"drawer.subagentDescription":`Allows the runtime to create temporary child agents for independent tasks only after Todo, quota, capability, and write-scope gates pass. It does not force parallel work or grant durable authority.`,"drawer.subagentDisable":`Preview turning off sub-agent execution`,"drawer.subagentDisableSummary":`New child-agent execution will be disabled for this Goal. Existing Todo ownership and execution records stay unchanged.`,"drawer.subagentDomainInvalid":`The selected task-domain restriction is invalid.`,"drawer.subagentDomainTodoCount":`{count} matching open Todos`,"drawer.subagentDomains":`Task-domain restriction (optional)`,"drawer.subagentDomainsEmpty":`No open advancement Todo declares task_domain. Leave this empty to keep child execution unrestricted by task domain.`,"drawer.subagentDomainsHint":`Leave every option clear to apply no task-domain filter. Selecting domains admits only matching typed Todos; all other execution gates still apply.`,"drawer.subagentDomainsUnrestricted":`No task-domain restriction`,"drawer.subagentEnable":`Preview turning on sub-agent execution`,"drawer.subagentLabel":`Per-Goal execution boundary`,"drawer.subagentModel":`Child model`,"drawer.subagentEffort":`Child reasoning effort`,"drawer.subagentModelDefault":`Host default`,"drawer.subagentLunaPreset":`Use Luna / max`,"drawer.subagentClearModel":`Clear model preference`,"drawer.subagentModelHint":`Use Preview configuration update to save this preference. It can be saved while execution is off; host support is checked at launch.`,"drawer.subagentModelRequired":`Choose a child model before setting reasoning effort.`,"drawer.subagentMaxChildren":`Maximum child agents`,"drawer.subagentNoChange":`The current Goal already matches this setting; nothing was written.`,"drawer.subagentPending":`Pending confirmation`,"drawer.subagentPreviewBoundary":`Preview configuration update`,"drawer.subagentPreviewFailed":`Could not create the sub-agent setting preview.`,"drawer.subagentPreviewing":`Checking the latest Goal state…`,"drawer.subagentPreviewReady":`Preview locked. Confirm to apply this Goal setting.`,"drawer.subagentPreviewSummary":`Allow up to {count} child agents. Task-domain restriction: {domains}.`,"drawer.subagentRemoteReadOnly":`This source is read only. Open the Goal on its host to change the setting.`,"drawer.subagentTitle":`Adaptive sub-agent execution`,"drawer.remoteDetailsDescription":`SSH sources expose public-safe status only and do not read connection settings from the source host.`,"drawer.remoteDetailsUnavailable":`Remote details are not projected`,"drawer.resumeNo":`No`,"drawer.resumeYes":`Yes`,"drawer.runDetails":`Execution Session`,"drawer.runInterrupt":`Interrupt this run`,"drawer.runLatest":`View latest execution`,"drawer.runNewSession":`Start new Session`,"drawer.runCloseSession":`Close Session`,"drawer.runRecordEmpty":`No run record yet. The Agent has not started this execution. Check waiting conditions or resume the Session under Details & actions.`,"drawer.runRecordProjected":`No step-by-step record is available. LoopX read {completed}/{total} projected steps{outputs}; inspect the Session under Details & actions.`,"drawer.runRecordProjectedOutputs":` and {count} outputs`,"drawer.runRoleAssistant":`Completed`,"drawer.runRoleSystem":`Needs review`,"drawer.runRoleUser":`Task received`,"drawer.runView":`Session views`,"drawer.scheduleAdd":`Add scheduled check`,"drawer.scheduleDefaultNotification":`Notify only when you are needed`,"drawer.scheduleDefaultStop":`Goal completes or owner stops it`,"drawer.scheduleDefaultTarget":`Wake according to this Goal’s LoopX schedule.`,"drawer.scheduleEdit":`Change to every 2 hours`,"drawer.scheduleLast":`Last run`,"drawer.scheduleLocalTimezone":`Local timezone`,"drawer.scheduleNext":`Next run`,"drawer.scheduleNeverRun":`Not run yet`,"drawer.scheduleNotification":`Notification`,"drawer.schedulePause":`Pause`,"drawer.schedulePending":`Waiting for schedule`,"drawer.scheduleResume":`Resume`,"drawer.scheduleRunNow":`Run now`,"drawer.scheduleStop":`Stop {kind}`,"drawer.scheduleStopCondition":`Stop condition`,"drawer.scheduleTimezone":`Timezone`,"drawer.sessionRecoverable":`Resumable`,"drawer.sessionStatus":`Session status`,"drawer.setupHeartbeat":`Set up Heartbeat`,"drawer.taskActions":`Pending Todo actions`,"drawer.taskAdvancement":`Advancement task`,"drawer.taskBlock":`Mark blocked`,"drawer.taskComplete":`Mark complete`,"drawer.taskCompletedNote":`This task is retained as a read-only record.`,"drawer.taskCompletedTitle":`Task completed`,"drawer.taskDefer":`Defer`,"drawer.taskDeferCondition":`Todo defer resume condition`,"drawer.taskDeferInvalid":`Unsupported condition format; use one of the deterministic conditions below.`,"drawer.taskDeferPlaceholder":`For example, resume_at:2026-09-14T09:00:00+08:00`,"drawer.taskDeferReview":`Review defer`,"drawer.taskDeferSupported":`Supports todo_done, pr_merged, capacity_available, and timezone-aware resume_at conditions.`,"drawer.taskDeferUntil":`Defer until`,"drawer.taskDetails":`Todo details`,"drawer.taskInfo":`Task information`,"drawer.taskManage":`Manage task`,"drawer.taskNextCompleted":`Create a follow-up task`,"drawer.taskNextOpen":`Advance or update status`,"drawer.taskOrdinary":`Task`,"drawer.taskStatusBlocked":`Blocked`,"drawer.taskStatusDeferred":`Deferred`,"drawer.resumeWhen":`Resume condition`,"drawer.resumeState":`Resume state`,"drawer.resumePending":`Waiting for condition`,"drawer.resumeReady":`Ready to resume`,"drawer.resumeReceipt":`Resume receipt`,"drawer.taskNextDeferred":`Wait for the resume condition, then reassess`,"drawer.taskNextResumeReady":`Resume condition met; awaiting lifecycle replan`,"drawer.taskStatusCompleted":`Completed`,"drawer.taskStatusOpen":`Ready`,"drawer.taskSuccessor":`Create follow-up Todo`,"drawer.taskSuccessorNote":`Owner marked this blocked while waiting for more context.`,"drawer.taskSuccessorSummary":`Create follow-up Todo: {task}`,"drawer.taskSuccessorText":`Follow-up work for {task}`,"drawer.taskType":`Task type`,"drawer.topic":`Topic`,"drawer.trigger":`Trigger`,"drawer.titleAttention":`Needs you`,"drawer.titleOutput":`Output details`,"drawer.titleProposalApplied":`Execution result`,"drawer.titleProposalConfirm":`Confirm execution`,"drawer.titleSchedule":`Scheduled check`,"drawer.unconfigured":`Not configured`,"drawer.workspaceCandidates":`Available workspaces`,"files.emptySummary":`Public-safe output`,"files.empty":`No files, outputs, or verified reports yet.`,"files.loadingReports":`Loading verified milestone reports…`,"files.reportDelta":`+{added} added · {changed} changed`,"files.reportAdded":`added`,"files.reportChanged":`changed`,"files.reportGeneration":`Generation`,"files.reportLoadFailed":`Could not load verified reports`,"files.reportPublication":`Publication`,"files.title":`Files & Outputs`,"files.verifiedReport":`Verified milestone report`,"header.agentUnavailable":`Unavailable`,"header.chatRuntime":`Chat`,"header.workAgentCount":`{count} work Agents`,"header.chat":`Chat`,"header.files":`Files`,"header.goalCapabilities":`Capability settings`,"header.goalCapabilitiesDescription":`Manage overrides and inherited machine defaults.`,"header.goalDetails":`Goal details`,"header.goalDetailsDescription":`Review status, usage, repository, notifications, and sessions.`,"header.goalSettings":`Goal settings`,"header.goalSettingsDescription":`Open Goal details or capability settings`,"header.goalNavigation":`Goal navigation`,"header.goalView":`Goal view`,"header.live":`Live`,"header.manager":`LoopX Manager`,"header.managerDescription":`Your personal workspace across Goals`,"header.managerRuntime":`{profile} · {sandbox}`,"header.managerRuntimeFallback":`Configuration invalid; fell back to {profile} · {sandbox}. Repair it in Machine capabilities.`,"header.managerOverview":`Overview`,"header.managerView":`Manager view`,"header.openGoalNavigation":`Open Goal navigation`,"header.readOnlySourceDescription":`{source} is displayed read-only through an SSH tunnel`,"header.refresh":`Refresh status`,"header.refreshDone":`Updated just now`,"header.refreshFailed":`Refresh failed`,"header.refreshing":`Refreshing`,"header.selectAgent":`Select Agent`,"header.selectChatRuntime":`Select chat runtime`,"header.tasks":`Tasks`,"header.themeBrutal":`Switch to brutal theme`,"header.themePaper":`Switch to default theme`,"home.blockingSummary":`{count} are blocking an Agent.`,"home.completedGoals":`Completed Goals`,"home.empty":`Nothing here`,"startup.goalLoading":`Loading status…`,"startup.goalError":`Could not load status`,"startup.progress":`{loaded} of {total} active Goals loaded`,"startup.partial":`Goal states are updating. Counts are incomplete.`,"startup.independent":`Other Goals remain available while this Goal loads.`,"startup.error.timeout":`The request timed out. Retry when the local service is ready.`,"startup.error.network":`The connection was interrupted. Retry to reconnect.`,"startup.error.service":`The Goal status could not be read. Retry later; if the problem continues, check the status source.`,"startup.error.access":`The status source cannot access files or runtime directories required for this Goal. Check the permissions of the account running that source, then retry.`,"startup.error.revision":`The Goal directory changed during loading. Refresh to synchronize.`,"startup.error.scope":`This Goal is no longer available in the selected source. Refresh the directory.`,"startup.error.invalid":`The status response could not be read. Refresh or check for a LoopX update.`,"startup.retry":`Retry`,"startup.retryFailed":`Retry failed Goals`,"startup.failedCount":`{count} Goals could not be loaded. Ready Goals remain available.`,"home.greeting":`Hi, I’m your LoopX Manager`,"home.history":`History`,"home.lane.needsYou":`Needs you`,"home.lane.needsYouDescription":`Waiting for your decision, authorization, or context`,"home.lane.observing":`Observing`,"home.lane.observingDescription":`Monitoring continuously and notifying you when something changes`,"home.lane.running":`Running`,"home.lane.runningDescription":`Agents are making progress and reporting back`,"home.lane.scheduled":`Scheduled`,"home.lane.scheduledDescription":`Queued until its time or prerequisite arrives`,"home.noActivity":`No activity yet`,"home.noFirstActivity":`Waiting for first activity`,"home.noCompletedGoals":`No completed Goals yet`,"home.preservedState":`State is preserved and can be resumed`,"home.stopped":`Stopped`,"home.systemHealth":`System health: {summary}`,"home.taskCount":`{count} Tasks`,"home.todayAt":`Today {time}`,"home.waitingCount":`You have {count} items to handle.`,"home.workspace":`Goal workspace`,"lark.allMessages":`All messages in this topic`,"lark.allTopicMessages":`All topic messages`,"lark.agentIngress":`Agent ingress`,"lark.agentAppPermissions":`Every selected Agent needs a Lark App that is ready for group mentions and replies.`,"lark.agentApps":`Lark App per Agent`,"lark.agentAppsDescription":`The default App is preselected. Assign a different compatible App when an Agent needs its own bot identity.`,"lark.agentAppSelection":`Lark App for {agent}`,"lark.appCreated":`App created`,"lark.appCreateFailed":`Creation failed`,"lark.appLoading":`Loading available Lark Apps…`,"lark.appPermissions":`This App can send connection messages, but lacks the bot permissions required to receive group mentions or reply automatically. Enable im:message.group_at_msg:readonly, im:message.send_as_bot, and the im.message.receive_v1 event, publish a new version, then refresh.`,"lark.appProfile":`Lark App`,"lark.apps":`Lark Apps`,"lark.autoReplyUnavailable":`Auto reply unavailable`,"lark.autoReplyReady":`Auto reply ready`,"lark.bindGoal":`Bind to Goal`,"lark.cancel":`Cancel`,"lark.cardinality":`One Lark App · many Goals · one isolated route per Agent`,"lark.capture":`Capture`,"lark.captureAddressed":`Only messages that mention or reply to the App`,"lark.captureAll":`All messages in this Goal topic`,"lark.captureScope":`Capture scope`,"lark.captureScopeDescription":`Controls which Topic messages enter LoopX without expanding Agent permissions.`,"lark.closeConnection":`Close connection dialog`,"lark.closeCreate":`Close create dialog`,"lark.closeSettings":`Close Lark settings`,"lark.connect":`Connect`,"lark.connectAllAgents":`Connect every registered Agent`,"lark.connectAllAgentsAction":`Connect {count} Agents`,"lark.connectAllAgentsDescription":`Create {count} isolated Agent Topics in one guided action. Send requests inside the matching Topic; each Agent keeps its own route and inbox.`,"lark.connectApp":`Connect Lark App`,"lark.connection":`Connection`,"lark.connections":`Connections`,"lark.configuration":`Lark configuration`,"lark.continueFeishu":`Continue in Feishu`,"lark.createAutomatically":`Create Goal topic automatically`,"lark.createAutomaticallyDescription":`A dedicated, Agent-labelled Topic will be created for every selected Agent.`,"lark.defaultAgentAppDescription":`Used to find the target group and as the default for every selected Agent. Per-Agent choices below override it.`,"lark.description":`Manage reusable Lark Apps and connect group chats to Goals through dedicated topics.`,"lark.editConnection":`Edit Lark Connection`,"lark.goalConnections":`{count} Goal connections`,"lark.goalTopicConnections":`Lark Goal Topic connections`,"lark.groupChat":`Group chat`,"lark.groupEmpty":`This bot has not joined a group that can be connected. Add it to a Feishu group first, then return to refresh or search.`,"lark.groupLoading":`Reading groups joined by this bot…`,"lark.groupSearch":`Search groups joined by this bot`,"lark.historyPermission":`Group-history permission (separate capability)`,"lark.health.contextCaptured":`Group context captured`,"lark.health.contextCapturedDetail":`The message is retained as non-authoritative context. It did not start or steer a Manager turn; send a direct @ mention or verified reply when action is required.`,"lark.health.eventProcessed":`{events} events processed, {replies} replies sent.`,"lark.health.eventUnverified":`Event subscription needs verification`,"lark.health.eventUnverifiedDetail":`The provider listener is ready, but no event has arrived. Enable im.message.receive_v1 and group mention permissions, publish a new version, then send a new @ mention inside this Agent Topic. Group-level messages fail closed when multiple Agent routes exist.`,"lark.health.ignoredSelf":`The bot’s own message was ignored to prevent duplicate replies.`,"lark.health.invalidRouting":`Invalid routing configuration`,"lark.health.invalidRoutingDetail":`The connection was safely disabled. Select a processing mode again and save.`,"lark.health.lastStatus":`Latest event status: {status}`,"lark.health.listening":`Listening`,"lark.health.messageContextPermission":`Message permission required`,"lark.health.messageContextPermissionDetail":`A message event arrived, but group context could not be read. Publish and authorize group message read access for this App.`,"lark.health.notAddressed":`Latest message did not directly @ the bot`,"lark.health.notAddressedDetail":`Listening is healthy. This connection only responds to direct @ mentions or replies to the bot.`,"lark.health.notStarted":`Listener not started`,"lark.health.notStartedDetail":`Refresh the connection or restart LoopX, then try again.`,"lark.health.processingFailed":`Message processing failed`,"lark.health.processingFailedDetail":`The message event arrived, but Agent processing failed. Review local diagnostics and retry.`,"lark.health.queued":`Queued in the Agent inbox`,"lark.health.queuedDetail":`The message will be processed asynchronously by {agent} without starting a general Chat Session.`,"lark.health.sourceDisconnected":`Event connection disconnected`,"lark.health.sourceDisconnectedDetail":`The event consumer exited unexpectedly. Check that the app profile uses Feishu for Feishu apps or Lark for international Lark, then inspect connection and subscription errors. LoopX is retrying; successful history queries do not prove live delivery.`,"lark.health.retrying":`Retrying listener`,"lark.health.retryingDetail":`Event listening was interrupted and LoopX is retrying automatically.`,"lark.health.routeAmbiguous":`Message matches multiple Goals`,"lark.health.routeAmbiguousDetail":`The same bot and group have multiple full-group capture connections. Use a separate bot for each Agent or keep only one full-group connection.`,"lark.health.routeMismatch":`Message did not match this Goal Topic`,"lark.health.routeMismatchDetail":`The event came from another group or Topic. Reconnect this Goal to the correct group, then send a new @ mention.`,"lark.health.routeUnavailable":`Message cannot be routed to the Goal`,"lark.health.routeUnavailableDetail":`Connection data is incomplete. Reconnect this Goal, then send a new @ mention.`,"lark.health.starting":`Starting`,"lark.health.startingDetail":`LoopX is starting message event listening for this App.`,"lark.health.unavailable":`Auto reply unavailable`,"lark.health.waiting":`Waiting`,"lark.incomingMessages":`Incoming messages`,"lark.ingressAsync":`Async inbox`,"lark.ingressAsyncDescription":`Write to the Agent private inbox for a later explicit drain.`,"lark.editPreservesIdentity":`Saving preserves this App, group and Topic. Old connections upgrade to the Agent inbox by default.`,"lark.conversationKind":`Connection purpose`,"lark.managerConversation":`Manager · live conversation`,"lark.workerConversation":`Worker Agent · background tasks`,"lark.managerConversationDescription":`The built-in manager responds as you chat and delegates long-running work to background Agents. Group and private conversations keep separate histories.`,"lark.ingressLegacy":`Upgrade available`,"lark.ingressLegacyDescription":`Save this connection to upgrade to the Agent inbox. Existing messages remain in the same Topic.`,"lark.ingressQueue":`Queuing`,"lark.ingressQueueDescription":`Enter the same Agent Session's bounded FIFO queue and run after the current Turn.`,"lark.ingressSteering":`Steering`,"lark.ingressSteeringDescription":`Deliver to the active Turn and reject safely when no exact active Turn exists.`,"lark.loading":`Loading Lark configuration…`,"lark.management":`Lark management`,"lark.openEventSettings":`Open Feishu event settings`,"lark.mentions":`Mentions`,"lark.mentionsOnly":`Mentions only`,"lark.needsMessagePermissions":`Needs message permissions`,"lark.needsSetup":`Needs setup`,"lark.newApp":`New Lark App`,"lark.noAgentConfigured":`No Agent configured`,"lark.noConnections":`No matching connections.`,"lark.noProfiles":`No lark-cli App profiles are available yet.`,"lark.profileName":`Profile name`,"lark.profileValidation":`Profile can contain only letters, numbers, periods, underscores, and hyphens.`,"lark.processing":`Processing`,"lark.region":`Region`,"lark.registerAnother":`+ Register another Lark App — Create through Feishu`,"lark.reopenFeishu":`Reopen Feishu`,"lark.settingsConfigure":`Configure {goal}`,"lark.settingsDisconnect":`Disconnect {goal}`,"lark.replyMode":`Reply mode`,"lark.replyModeDescription":`Replies are limited to the source Topic to prevent cross-group or cross-Goal delivery.`,"lark.reusableApps":`{count} reusable Apps`,"lark.reusableWorkspaceApp":`Reusable workspace App`,"lark.routesUnverified":`{count} Lark routes pending verification`,"lark.saveConnection":`Save connection`,"lark.searchConnections":`Search Lark connections`,"lark.searchPlaceholder":`Search Apps, groups, Goals, or topics`,"lark.setupCopy":`LoopX opens the official Feishu creation page through lark-cli. App credentials stay in the system Keychain; LoopX stores only the profile reference.`,"lark.someoneMentions":`Someone mentions the Agent`,"lark.targetAgent":`Target Agent`,"lark.targetAgentDescription":`Choose a registered Agent in this Goal. This connection delivers to one Agent; it does not broadcast or grant permissions. Steering and Queuing require that Agent's exact active Session.`,"lark.agentUnavailable":`{agent} · no longer available`,"lark.selectRegisteredAgent":`Select an available registered Agent before connecting. The previous Agent will not be replaced automatically.`,"lark.topicPreview":`Topic preview`,"lark.topicReply":`Topic reply`,"lark.trigger":`Trigger`,"lark.waitingFeishu":`Waiting for Feishu`,"lark.waitingFeishuDescription":`Complete Feishu authorization in the new window. This page updates automatically when it is ready.`,"lark.waitingLink":`Generating the official Feishu creation link…`,"lark.error.appCreate":`Lark App creation failed`,"lark.error.appRequired":`Select a Lark App profile.`,"lark.error.bind":`Connection failed`,"lark.error.bindPreview":`Connection preview failed`,"lark.error.configuration":`Could not load Lark configuration`,"lark.error.groupLookup":`Could not read groups joined by this bot. Check the bot status and try again.`,"lark.error.groupLoad":`Could not load group chats`,"lark.error.invalidApp":`The Lark App profile is unavailable or has not completed authorization.`,"lark.error.messagePermissions":`This App lacks the bot permissions required for automatic replies. Enable im:message.group_at_msg:readonly and im:message:send_as_bot, publish a new version, then refresh.`,"lark.error.provider":`The Feishu API call failed without a verified receipt. Try again later.`,"lark.error.setupPoll":`Could not read creation status`,"lark.error.setupStart":`Could not start Lark App creation`,"lark.error.cliExecutable":`The configured lark-cli was found but cannot run. Check the installation or launch arguments.`,"lark.error.cliMissing":`lark-cli was not found. Install lark-cli and restart LoopX.`,"lark.error.cliStart":`lark-cli failed to start. Check the installation and restart LoopX.`,"lark.error.disconnect":`Disconnect failed`,"notifications.autoNotify":`Send automatically when your confirmation is required`,"notifications.bind":`Bind notification group`,"notifications.bindConfirm":`Bind “{goal}” to “{target}”. LoopX will verify that the bot is in the group and send a confirmation message.`,"notifications.bindFailed":`Binding failed`,"notifications.bound":`Bound`,"notifications.confirmBind":`Confirm binding`,"notifications.description":`Send Goal changes that need your confirmation to a Feishu group. Bindings and automatic delivery use the existing channel.`,"notifications.disabled":`Disabled`,"notifications.group":`Notification group: {target}`,"notifications.loadFailed":`Could not load notification groups`,"notifications.noTargets":`No notification groups are available. Group delivery uses a private bot identity; configure one from the terminal first:`,"notifications.notBound":`Not bound`,"notifications.recent":`Latest {time}`,"notifications.sentCount":`{count} sent`,"notifications.settings":`Goal notification bindings`,"notifications.setupFailed":`Could not update settings`,"notifications.title":`Feishu group notifications`,"proposal.field.agentId":`Agent`,"proposal.field.cadence":`Frequency`,"proposal.field.completionCriteria":`Completion criteria`,"proposal.field.executionBoundary":`Execution boundary`,"proposal.field.goalId":`Goal ID`,"proposal.field.heartbeat":`Heartbeat`,"proposal.field.initialTodos":`Initial tasks`,"proposal.field.objective":`Objective`,"proposal.field.operation":`Operation`,"proposal.field.operationState":`Operation state`,"proposal.field.resultDelivery":`Result delivery`,"proposal.field.confirmationBoundary":`Confirmation boundary`,"proposal.field.expiresAt":`Expires at`,"proposal.field.permission":`Permission`,"proposal.field.reason":`Reason`,"proposal.field.stopCondition":`Stop condition`,"proposal.field.target":`Check target`,"proposal.field.timezone":`Timezone`,"proposal.field.title":`Title`,"proposal.field.workspace":`Execution workspace`,"actionReview.targetChanged":`The preview target does not match the requested Goal and operation. Generate a new preview.`,"actionReview.ready_stop":`Pausing is reversible. This validated preview can apply directly; completion still requires verified readback.`,"actionReview.resume_review":`Review before restoring automatic scheduling. Quota, gates and Todo constraints still apply.`,"actionReview.delete_review":`Review removal of this stopped Goal from the registries. Project files and history are preserved.`,"actionReview.action_review":`Review the target and impact before applying this proposal.`,"actionReview.protected_action":`This action needs explicit review. Confirmation cannot replace required authority.`,"actionReview.unknown_permission":`The permission classification is not recognized. Recheck the proposal before continuing.`,"actionReview.unknown_action":`This lifecycle operation is not recognized. Recheck the proposal before continuing.`,"actionReview.incomplete_proposal":`The preview is missing validation or an available apply transition. Generate a new preview.`,"actionReview.authority_gate":`A gate prevents execution. Resolve its requirements, then recheck the proposal.`,"actionReview.stale_proposal":`The source state changed. Generate a new preview; the previous decision no longer applies.`,"actionReview.apply_pending":`Execution is in progress. Wait for its result before retrying.`,"actionReview.readback_verified":`The action completed and its resulting state was verified.`,"actionReview.readback_unverified":`The action returned without verified readback. Completion is not confirmed; recheck the state.`,"actionReview.operation_group_confirmation":`This exact request can only be confirmed on its original card in the bound Feishu group. The Dashboard does not expose a local execution control.`,"actionReview.operation_result_delivery_pending":`The operation outcome was recorded, but the original group result card has not passed readback verification yet.`,"actionReview.apply_failed":`Execution did not complete. Check the failure and regenerate the preview before retrying.`,"actionReview.inactive_proposal":`This proposal is no longer ready to execute. Recheck it before continuing.`,"proposal.gate.default":`Host confirmation required`,"proposal.impact.default":`After confirmation, the canonical LoopX service will write the state change.`,"proposal.impact.goalCreate":`After confirmation, LoopX will create the Goal and its initial Todo, then let the selected Agent start the first run.`,"proposal.impact.lifecycleDelete":`After confirmation, this stopped Goal is removed from the source and global registries. Project files, history state, and backups are preserved.`,"proposal.impact.lifecycleResume":`After confirmation, the Goal becomes eligible for automatic scheduling and returns to Active Goals. Actual execution still follows quota, Gate, and Todo constraints.`,"proposal.impact.lifecycleStop":`After confirmation, automatic progress stops and the Goal moves to the collapsed Stopped list. History, Todos, and evidence remain available for resuming.`,"proposal.impact.protected":`This action must be completed through the protected LoopX write service.`,"proposal.impact.operation":`The exact terms are read-only here. Confirm or reject the same immutable request in the bound Feishu group; confirmation consumes one canonical claim.`,"proposal.primary.apply":`Confirm and apply`,"proposal.primary.goalCreate":`Create Goal and start first run`,"proposal.primary.lifecycleDelete":`Delete Goal`,"proposal.primary.lifecycleResume":`Resume Goal`,"proposal.primary.lifecycleStop":`Stop Goal`,"proposal.primary.todoStart":`Create task and start execution`,"proposal.primary.operationGroup":`Confirm in Feishu group`,"proposal.primary.operationResultPending":`Result card delivery pending`,"proposal.primary.operationResultVerified":`Verified result`,"proposal.resultDelivery.verified":`Verified in the original group card`,"proposal.resultDelivery.pending":`Pending verified return to the original group card`,"proposal.summary.goalCreate":`Create Goal: {title}`,"proposal.summary.heartbeat":`Set a Heartbeat for the current Goal`,"proposal.summary.lifecycleDelete":`Delete Goal: {title}`,"proposal.summary.lifecycleResume":`Resume Goal: {title}`,"proposal.summary.lifecycleStop":`Stop Goal: {title}`,"proposal.summary.monitor":`Create a scheduled check for the current Goal: {target}`,"proposal.workspace.current":`Current local workspace (no Repository bound)`,"proposal.workspace.named":`{workspace} (execution environment only; does not bind a repository)`,"proposal.workspaceGate.agentImpact":`Bind an Agent identity, then recheck the original action. No Goal has been written.`,"proposal.workspaceGate.agentTitle":`Bind an Agent first`,"proposal.workspaceGate.defaultSummary":`Select the Goal workspace.`,"proposal.workspaceGate.selectionImpact":`After selecting a workspace, LoopX will show the confirmation preview again. The selection itself does not write state.`,"proposal.workspaceGate.selectionTitle":`Select Goal workspace`,"projection.agentAdvancingGoal":`Agent is advancing the current Goal`,"projection.agentIdle":`Nothing needs your attention`,"projection.agentNeedsDecision":`Agent is waiting for your decision`,"projection.agentPreparingNextStep":`Agent is preparing the next step`,"projection.agentStopped":`Stopped by you; history, Todos, and evidence are preserved`,"projection.agentWaitingExternal":`Waiting for an external condition`,"projection.confirmAgentDecision":`Confirm the permission or decision the Agent needs next`,"projection.events24h":`{count} events in the last 24 hours`,"projection.firstReadOnlyAdapterCheck":`Run the first read-only adapter check and save progress`,"projection.goalVerified":`Goal state, Todos, and registration information verified`,"projection.latestRun":`Latest run`,"projection.latestValidation":`Latest validation`,"projection.nextUpdatePending":`Waiting for LoopX to update the next step`,"projection.publicSafeProjection":`Public-safe status projection`,"projection.refreshState":`Refresh LoopX status and confirm the current progress is still valid`,"projection.runEvidenceAvailable":`Run evidence is available`,"projection.runRecorded":`The latest LoopX run is recorded`,"projection.statusRefreshNeeded":`LoopX status needs to be refreshed`,"projection.todoStatusUpdated":`Todo status updated; confirming the next step`,"projection.validationRecorded":`The latest validation is recorded`,"runs.completed":`Completed`,"runs.failed":`Needs review`,"runs.interrupted":`Interrupted`,"runs.queued":`Scheduled`,"runs.ready":`Ready`,"runs.resumeFailed":`Recovery failed`,"runs.running":`Running`,"runs.unknown":`Unknown`,"runs.waiting":`Waiting`,"schedule.active":`Running`,"schedule.heartbeat":`Goal Heartbeat`,"schedule.monitor":`Scheduled & continuous task`,"schedule.paused":`Paused`,"schedule.summary":`Continuously checked under LoopX scheduling constraints`,"schedule.defaultTarget":`Check the current Goal for blockers, progress, and new outputs`,"schedule.unsupportedCalendar":`Scheduled checks do not currently support an exact weekday or time. Use a fixed interval such as “Every 30 minutes,” “Every 2 hours,” or “Daily.” The draft was preserved and no confirmation preview was created.`,"source.add":`Add source`,"source.addConfigured":`Add read-only source`,"source.addMethod":`Source setup method`,"source.addSsh":`Add SSH source`,"source.closeForm":`Close source form`,"source.configured":`Configured SSH`,"source.configuredCount":`Local SSH Hosts · {count}`,"source.configuredGroup":`Configured SSH Hosts · {count} (select to add)`,"source.connected":`Connected`,"source.connecting":`Connecting`,"source.controlPlane":`Control plane source`,"source.copy":`Copy`,"source.copyCommand":`Copy SSH tunnel command`,"source.copyError":`Could not copy the command. Copy it manually below.`,"source.copied":`Copied`,"source.description":`All explicit Hosts are loaded, including Include files. Wildcards are not listed. Run the command first; LoopX never reads SSH keys or configuration details.`,"source.host":`Local SSH Host`,"source.hostEmpty":`No explicit SSH Hosts are available in ~/.ssh/config.`,"source.hostLoadError":`Could not read local SSH Hosts.`,"source.hostPlaceholder":`Enter or search for a Host`,"source.invalid":`The SSH source settings are invalid.`,"source.loadingHosts":`Loading…`,"source.localInteractive":`Local interactive`,"source.localPort":`Local port`,"source.manual":`Manual URL`,"source.manualDescription":`Remote sources always remain read-only projections and never inherit local write permissions.`,"source.name":`Name`,"source.namePlaceholder":`Remote development machine`,"source.notAvailable":`Unavailable`,"source.readOnly":`SSH tunnel · read only`,"source.readOnlyNoticeDescription":`You can view Goals, Tasks, evidence, and run status. Writes, guidance, and Agent sessions remain on the source host.`,"source.readOnlyNoticeTitle":`Remote read-only projection`,"source.readOnlyWriteError":`Remote SSH tunnel sources are read-only projections and cannot perform control-plane writes.`,"source.refreshHosts":`Reload SSH Hosts`,"source.remove":`Remove source {source}`,"source.removeCurrent":`Remove current source`,"source.select":`Select control plane source`,"source.selectHost":`Select a configured SSH Host.`,"source.statusUrl":`Local forwarded URL`,"source.tunnelCommandPending":`Select a Host to generate the tunnel command`,"machine.absent":`Not configured`,"machine.action.create":`Create machine policy`,"machine.action.delete":`Remove machine policy`,"machine.action.unchanged":`No write required`,"machine.action.update":`Update machine policy`,"machine.applied":`Machine policy applied and read back successfully.`,"machine.applyError":`Machine policy could not be applied.`,"machine.applyPreview":`Apply reviewed preview`,"machine.changedNamespaces":`Changed namespaces`,"machine.capabilityCatalog":`Machine capability catalog`,"machine.capabilityEmpty":`No machine-configurable capabilities are registered.`,"machine.configured":`Configured`,"machine.confirmRollback":`Confirm rollback`,"machine.currentRevision":`Current revision`,"machine.currentValue":`Current machine value`,"machine.description":`Browse the same capability catalog as Goal settings. Configure supported machine defaults here; Goal-only capabilities are labeled explicitly.`,"capabilities.rawJson":`Advanced: raw JSON`,"machine.goalOnly":`This capability currently supports Goal configuration only. Open a Goal’s capability settings to configure it; no machine-wide default is applied.`,"machine.desiredRevision":`Desired revision`,"machine.editorUnavailable":`No editor is installed for this namespace`,"machine.editorUnavailableDescription":`The namespace remains visible in the registry. Install or upgrade its Dashboard editor before changing it.`,"machine.editorMode":`Editor mode`,"machine.liveDefault":`Live default; Goal override wins`,"machine.liveDefaultDescription":`Goals without an explicit override read the current machine policy at the capability’s next decision point. Changes and removal affect those existing Goals immediately; an explicit Goal override stays pinned.`,"machine.genericNamespaceDescription":`Edit this registered namespace as JSON. LoopX validates it with the capability-owned schema before previewing any write.`,"machine.jsonConfiguration":`Namespace configuration (JSON)`,"machine.jsonConfigurationHelp":`Only this namespace is updated. Other machine configuration is preserved, and Apply remains locked to the reviewed preview revision.`,"machine.jsonEditor":`JSON`,"machine.editJson":`Edit JSON`,"capabilities.jsonConfiguration":`Goal configuration (JSON)`,"capabilities.jsonHelp":`Edit registered fields for this Goal. Changes require a new preview before applying.`,"capabilities.jsonInvalid":`Enter a valid JSON object using only registered editable fields.`,"machine.backToForm":`Back to form`,"machine.jsonInvalid":`Enter one valid JSON object before previewing changes.`,"machine.loadError":`Machine configuration could not be loaded.`,"machine.invalidStoredConfiguration":`Stored machine configuration needs repair`,"machine.invalidStoredConfigurationDescription":`Stored values are hidden because they no longer match the installed contract. Review the affected capability, then Preview and Apply its replacement; unrelated namespaces remain unchanged.`,"machine.machinePolicy":`Machine policy`,"machine.namespaceCount":`Registered namespaces`,"machine.namespaces":`Configuration namespaces`,"machine.periodicReport":`Periodic reports`,"machine.periodicReportDescription":`Default report policy for every Goal without an explicit override. Goal scheduling and delivery consume the effective configuration.`,"machine.periodicReportActivation":`Enabled means automatic delivery at validated stage boundaries`,"machine.periodicReportActivationDescription":`This is not a weekly timer. When LoopX validates a Goal stage completion, an Agent prepares and freezes the report, then automatically delivers it through the configured Goal Channel. The enabled subscription is standing delivery authority; failures and route drift stop closed for repair.`,"machine.changeQualityActivation":`Qualification is a quality gate, not new authority`,"machine.changeQualityActivationDescription":`Goals that inherit this policy qualify their exact final diff. safe_fix allows at most one bounded fix pass inside existing write authority; this setting never grants file, permission, or merge authority.`,"machine.replanCadenceActivation":`Review cadence changes timing, not execution authority`,"machine.replanCadenceActivationDescription":`Goals without an explicit override read this threshold before the next review decision. It does not create Turns, spend quota, or grant authority.`,"machine.preview":`Review exact machine change`,"machine.previewChanges":`Preview changes`,"machine.previewError":`A machine-policy preview could not be created.`,"machine.previewLocked":`Apply is locked to this exact revision. If machine state changes, LoopX requires a new preview.`,"machine.previewRollback":`Preview rollback`,"machine.previewRemoval":`Preview removal`,"machine.profilePreset":`Profile preset`,"machine.profilePresetHelp":`A capability-owned preset, such as weekly-progress.`,"machine.registry":`Typed registry`,"machine.requiredFields":`Enable requires a profile preset, Goal Channel route, and valid timezone.`,"machine.revision":`Machine revision`,"machine.revisionLockedReady":`All changes require a preview and apply only while that exact machine revision remains current.`,"machine.rollbackAvailable":`Rollback is available for the last apply`,"machine.rollbackDescription":`Preview the stored prior revision before restoring it.`,"machine.rollbackError":`The rollback could not be completed.`,"machine.rollbackPreviewDescription":`The prior revision is ready to restore. Confirm to apply this rollback.`,"machine.rolledBack":`The prior machine policy was restored and verified.`,"machine.removed":`Machine policy removed and the resulting configuration read back successfully.`,"machine.routeRef":`Goal Channel route`,"machine.routeRefHelp":`Use a public route alias; credentials and provider identifiers never enter this form.`,"machine.timezone":`Timezone`,"machine.timezoneHelp":`Use an IANA timezone, for example Asia/Shanghai.`,"machine.title":`Machine configuration`,"machine.unchanged":`Machine policy already matches this preview; nothing was written.`,"machine.visualEditor":`Guided`,"capabilities.atomicOverride":`Goal override is atomic`,"capabilities.atomicOverrideDescription":`A complete Goal value wins over the machine default. LoopX never mixes individual fields across scopes.`,"capabilities.applyFailed":`Goal capability changes were not applied.`,"capabilities.applyPreview":`Apply preview`,"capabilities.catalog":`Goal capability catalog`,"capabilities.chooseGoal":`Choose a Goal before inspecting its capabilities.`,"capabilities.defaultValue":`Declared default`,"capabilities.description":`Inspect the capabilities available to this Goal and the exact scope of each setting.`,"capabilities.editorPrepared":`Typed editor contract available`,"capabilities.effectiveSource":`Effective source`,"capabilities.empty":`No capability descriptors are available for this Goal.`,"capabilities.fields":`Registered fields`,"capabilities.goalPolicy":`Goal capability policy`,"capabilities.goalScope":`Goal`,"capabilities.goalValue":`Current Goal value`,"capabilities.loadFailed":`Could not load Goal capabilities`,"capabilities.loading":`Loading Goal capabilities…`,"capabilities.machineOnly":`This capability is configured only at machine scope.`,"capabilities.machineValue":`Live machine default`,"capabilities.machineScope":`Machine`,"capabilities.previewOnly":`Inspection is live. Goal writes remain unavailable until the revision-locked preview and apply path is connected.`,"capabilities.preview":`Revision-locked preview`,"capabilities.previewChanges":`Preview changes`,"capabilities.restoreInheritance":`Restore machine-default inheritance`,"capabilities.previewFailed":`Could not preview Goal capability changes.`,"capabilities.previewLocked":`Apply will re-check this exact plan revision and reject stale changes.`,"capabilities.partialWrite":`Goal value saved; shared projection needs reconciliation`,"capabilities.partialWriteDescription":`The source Goal configuration was written and read back. Its shared runtime projection did not synchronize, so do not submit the change again.`,"capabilities.refreshSource":`Refresh source value`,"capabilities.readOnly":`Read-only capability`,"capabilities.revisionLockedReady":`Changes require a preview and are applied only when its exact revision is still current.`,"capabilities.retry":`Retry`,"capabilities.source.capability_default":`Capability default`,"capabilities.source.goal_override":`Goal override`,"capabilities.source.machine_default":`Live machine default`,"capabilities.source.not_configured":`Not configured`,"capabilities.title":`Goal capabilities`,"settings.close":`Close settings`,"settings.appearance":`Appearance`,"settings.appearanceDescription":`Manage workspace display preferences in this browser.`,"settings.appearanceTabDescription":`Theme and display preferences`,"settings.capabilitiesTabDescription":`Capability overrides for this Goal`,"settings.back":`Back to workspace`,"settings.categories":`Settings categories`,"settings.description":`Manage workspace preferences and integrations.`,"settings.eyebrow":`Workspace preferences`,"settings.general":`General`,"settings.goalConnections":`Goal connections`,"settings.language":`Language`,"settings.languageDescription":`Choose the language used by the LoopX desktop workspace.`,"settings.languageEnglishDescription":`Use English for navigation, settings, and workspace controls.`,"settings.languageEnglish":`English`,"settings.languageSimplifiedChineseDescription":`Use Simplified Chinese for navigation, settings, and workspace controls.`,"settings.languageSimplifiedChinese":`Simplified Chinese`,"settings.languageStoredLocally":`This preference is stored only on this device.`,"settings.languageTabDescription":`Interface language for this device`,"settings.larkTabDescription":`Apps, group chats, and Goal Topic connections`,"settings.machineTabDescription":`Typed defaults shared by capabilities on this machine`,"settings.notifications":`Notifications`,"settings.open":`Settings`,"settings.themeDefault":`Paper`,"settings.themeDefaultDescription":`Calm and lightweight for long-running work.`,"settings.themeDescription":`Choose the workspace visual style. This preference is stored in the current browser.`,"settings.themeHighContrast":`High contrast`,"settings.themeHighContrastDescription":`Stronger borders and more prominent state blocks.`,"settings.themeLoopx":`LoopX standard`,"settings.themeLoopxDescription":`Precise monochrome surfaces, Geist type, and quiet hairline structure.`,"settings.title":`Settings`,"settings.workspaceDisplay":`Workspace display`,"settings.workspaceTheme":`Workspace theme`,"session.closeRecord":`Exit run record`,"session.details":`Session details`,"session.record":`Execution Session · Run record`,"session.recordDescription":`The timeline now shows messages and Turn records from this Session.`,"sidebar.createGoal":`Create Goal`,"sidebar.delete":`Delete`,"sidebar.deleteGoal":`Delete Goal`,"sidebar.manager":`LoopX Manager`,"sidebar.notifications":`Settings`,"sidebar.owner":`Personal workspace`,"sidebar.product":`Personal Agent workspace`,"sidebar.resume":`Resume`,"sidebar.resumeGoal":`Resume Goal`,"sidebar.stop":`Stop`,"tasks.historyLoading":`Loading history…`,"tasks.historyError":`History could not be loaded.`,"tasks.historyExpired":`History snapshot expired. Reload to continue.`,"tasks.historyRetry":`Reload`,"tasks.historyEnd":`End of completed history`,"tasks.historyMore":`Load more`,"tasks.historyLocalOnly":`Open this machine’s Dashboard to browse full history.`,"sidebar.sortGoals":`Reorder Goals`,"sidebar.dragGoal":`Drag to reorder, or use Reorder Goals`,"sidebar.moveUp":`Move {goal} up`,"sidebar.moveDown":`Move {goal} down`,"sidebar.goalMoved":`{goal} moved to position {position}`,"sidebar.orderNotSaved":`Order changed for this visit; browser storage is unavailable.`,"sidebar.stopGoal":`Stop Goal`,"sidebar.stopped":`Stopped`,"sidebar.stoppedLoading":`Loading stopped Goals`,"sidebar.stoppedLoadFailed":`Stopped Goals could not be loaded. Active Goals remain available.`,"sidebar.retryStopped":`Retry`,"state.completed":`Completed`,"state.needsRepair":`Needs repair`,"state.needsYou":`Needs you`,"state.quiet":`Quiet`,"state.running":`Running`,"state.stopped":`Stopped`,"state.waiting":`Waiting`,"tasks.blocked":`Blocked`,"tasks.agentLane":`Work Agent`,"tasks.agentLaneDescription":`Filter this Goal's projected work lanes`,"tasks.agentLaneFilter":`Filter by work Agent`,"tasks.allAgentLanes":`All Agents ({count})`,"tasks.chatAgentReplied":`Agent replied`,"tasks.chatPending":`Sent to Agent`,"tasks.chatPendingDescription":`Processing. Tasks update only after a task operation is confirmed.`,"tasks.chatRecent":`Recent conversation`,"tasks.chatUnchangedDescription":`This conversation did not directly change Tasks. Convert the reply to a Task draft and confirm it when execution is needed.`,"tasks.chatViewReply":`View reply`,"tasks.convertToTask":`Convert to Task`,"tasks.completed":`Completed`,"runs.discoveryPartial":`Some execution details are unavailable. Reconnecting; task summaries are not live execution status.`,"runs.discoveryOffline":`Execution service unavailable. Reconnecting; retained task summaries may be stale.`,"files.openConversation":`Go to conversation`,"files.exportSummary":`Export summary`,"tasks.viewDescription":`Decisions first, then work and recent completions`,"tasks.viewLabel":`Task view`,"tasks.listView":`List`,"tasks.boardView":`Board`,"tasks.completedSummary":`{count} tasks completed. Recent details are projected by the control plane when needed.`,"tasks.emptyCompleted":`No completed tasks yet.`,"tasks.emptyConfirm":`No tasks waiting for confirmation.`,"tasks.emptyRunning":`No queued or running tasks.`,"tasks.emptySchedules":`No scheduled tasks.`,"tasks.emptyGoal":`This Goal has no tasks yet. Describe the next step below and LoopX will show a confirmation preview first.`,"tasks.markComplete":`Mark complete: {name}`,"tasks.moreActions":`More actions: {name}`,"tasks.openExecution":`View execution: {name}`,"tasks.pending":`Pending`,"tasks.pendingAndRunning":`Queued / Running`,"tasks.scheduled":`Scheduled & continuous`,"tasks.sessionError":`Session issue`,"tasks.waiting":`Queued`,"tasks.waitingAge":`Waiting {age}`,"tasks.viewExecution":`View execution`,"tasks.viewResult":`View result`,"time.days":`{count} days`,"time.hours":`{count} hours`,"timeline.emptyGoal":`This Goal has no new activity`,"timeline.emptyGoalDescription":`Ask for progress or send new guidance.`,"timeline.emptyWorkspace":`Your workspace is quiet today`,"timeline.emptyWorkspaceDescription":`Describe a Goal to the LoopX Manager, or ask what deserves attention today.`,"timeline.gateHistory":`{count} historical Gates`,"timeline.pending":`Working…`,"returnDelivery.queued":`Return queued`,"returnDelivery.verifying":`Verifying delivery without resending`,"returnDelivery.delivered":`Delivered to the original audience`,"returnDelivery.reconciled":`Delivery verified after recovery`,"returnDelivery.unverified":`Delivery remains explicitly unverified`,"timeline.runCompleted":`{run}: completed`,"timeline.review":`Review`,"timeline.reviewAndConfirm":`Review and confirm`,"timeline.waitingConfirmation":`Needs your confirmation`},"zh-CN":{"acceptance.connected":`已连接`,"acceptance.mapped":`已建立项目映射`,"acceptance.refreshed":`已刷新状态`,"acceptance.inspected":`已检查适配器`,"acceptance.recorded":`已记录执行`,"acceptance.judged":`已记录反馈`,"acceptance.approved":`已记录批准`,"acceptance.ready":`已记录控制器就绪`,"acceptance.attentionSource":`当前状态`,"acceptance.visionSource":`Agent 验收条件`,"acceptance.todoSource":`任务状态`,"acceptance.runSource":`最新执行证据`,"acceptance.title":`验收观察`,"acceptance.unavailable":`验收观测不可用,Goal 是否达成仍未知。`,"acceptance.partial":`当前仅有部分观测。任务完成或缺口列表为空,都不能证明 Goal 已通过验收。`,"acceptance.gaps":`仍需补充的证据`,"acceptance.reasonUnknown":`来源未提供原因`,"acceptance.unknown":`未知`,"acceptance.required":`所需证据或条件`,"acceptance.observed":`观测时间`,"acceptance.noGaps":`现有观测中没有缺口,尚未评估完整验收条件。`,"acceptance.guards":`待处理的门禁决策`,"acceptance.noGuards":`现有观测中没有待处理的门禁决策。`,"acceptance.scope":`决策范围`,"acceptance.next":`当前状态给出的下一步`,"acceptance.historical_progress":`已记录的历史进展`,"acceptance.historical":`历史生命周期记录不授予权限,也不代表通过验收。`,"acceptance.missing":`未获取的来源:`,"acceptance.truncated":`仅展示前 12 条观测。`,"common.actions":`操作`,"common.agent":`Agent`,"common.allMessages":`所有消息`,"common.cancel":`取消`,"common.close":`关闭`,"common.closeActionReceipt":`关闭操作回执`,"common.confirm":`确认`,"common.export":`导出`,"common.failed":`失败`,"common.goal":`Goal`,"common.loading":`加载中…`,"common.none":`无`,"common.off":`关闭`,"common.on":`开启`,"common.open":`打开`,"common.owner":`Owner`,"common.readOnly":`只读`,"common.recently":`刚刚`,"common.status":`状态`,"common.task":`Task`,"common.you":`你`,"common.waiting":`等待中`,"composer.addImage":`添加图片`,"composer.agentProgress":`向 Agent 获取进度报告`,"composer.agentProgressPrompt":`请给我一份当前 Goal 的进度报告:已完成、执行中、阻塞和下一步。`,"composer.attachImageHint":`选择、粘贴或拖入图片`,"composer.clarifyDefer":`暂缓 Todo 需要可自动判断的恢复条件。请补充 todo_done:、pr_merged:[owner/repo]#、capacity_available: 或 resume_at:<带时区 RFC3339 时间>。`,"composer.clarifySingleAction":`这句话包含多个可能修改状态的操作。请一次描述一项操作,我会逐项展示确认预览。`,"composer.createGoal":`创建新 Goal`,"composer.createGoalDraft":`Goal 草稿`,"composer.createGoalDraftDescription":`补充内容后发送,LoopX 会先展示待确认操作。`,"composer.createGoalDraftLead":`我想创建一个长期 Goal:`,"composer.createGoalTemplate":`我想创建一个长期 Goal: 目标: 完成标准: 执行边界(可选): @@ -44,7 +44,7 @@ Goal: Goal: 频率:每天 停止条件:Goal 完成 -通知:仅在需要我时`,"composer.nextAction":`询问下一步`,"composer.nextActionPrompt":`我现在该做什么?`,"composer.prepareDraft":`填入编辑框,确认后再发送`,"composer.send":`发送`,"composer.sendMessage":`向 LoopX 发送消息`,"composer.sendMessageHint":`发送消息`,"composer.sentImageAlt":`移除图片 {name}`,"conversation.agentPending":`正在整理…`,"conversation.close":`关闭对话回执`,"conversation.convertHint":`将 Agent 最新回复转为 Task 草稿`,"conversation.full":`查看完整对话`,"conversation.receipt":`对话回执`,"conversation.replying":`正在回复`,"conversation.title":`管家对话`,"conversation.toTask":`转为 Task`,"digest.away":`自上次访问以来的运行记录`,"digest.completed":`新增完成运行`,"digest.failed":`新增失败或中断`,"digest.needsYou":`当前待确认`,"feedback.applying":`正在执行:{title}`,"feedback.cancelFailed":`取消失败:{error}`,"feedback.completed":`已完成:{title}`,"feedback.executionFailed":`执行失败:{error}`,"feedback.gateRequired":`需要你确认:{summary}`,"feedback.notCompleted":`操作未完成:{status}`,"feedback.goalRefreshFailed":`已打开 Goal,但暂时无法刷新最新状态。请点击刷新重试。`,"feedback.preparingPreview":`正在准备确认预览:{title}`,"feedback.previewFailed":`无法准备确认预览:{error}`,"feedback.sendFailed":`发送失败:{error}`,"feedback.sendGenericError":`消息发送失败,请稍后重试。`,"feedback.stale":`状态已变化,操作未执行,请重新生成确认预览。`,"feedback.taskDraftCreated":`已根据回复生成 Task 草稿。编辑后发送,LoopX 会先展示确认预览。`,"goal.defaultTitle":`新的个人 Goal`,"goal.initialTodo":`按完成标准推进:{criteria}`,"goal.objectiveBoundary":`执行边界:{boundary}`,"goal.objectiveCompletion":`完成标准:{criteria}`,"drawer.advancedDiagnostics":`高级诊断`,"drawer.agentWorking":`Agent 正在继续执行,记录会自动更新。`,"drawer.analysis":`正在分析`,"drawer.apply":`确认并应用`,"drawer.applying":`正在应用…`,"drawer.attentionBlocking":`正在阻塞 Agent`,"drawer.attentionWaiting":`等待你的决定`,"drawer.autoNotify":`Human-gate 自动通知`,"drawer.branch":`分支`,"drawer.closeDetail":`关闭详情:返回{context}`,"drawer.connected":`已连接`,"drawer.correctionDescription":`消息会沿用当前 Goal、Todo 与 Agent Session 上下文。`,"drawer.correctionLabel":`与 {agent} 纠偏`,"drawer.correctionPlaceholder":`例如:先关注权限风险,暂时不要提交…`,"drawer.correctionSend":`发送纠偏`,"drawer.correctionTextarea":`输入纠偏信息:Goal {goal},Agent {agent},Run {run}`,"drawer.copyRepository":`复制仓库标识`,"drawer.copyRepositoryDone":`已复制仓库标识`,"drawer.copyRepositoryError":`复制失败,请检查浏览器剪贴板权限。`,"drawer.copyRepositorySuccess":`已复制,可粘贴到其他工具。`,"drawer.cost":`成本 24h / 7d`,"drawer.costShort":`成本`,"drawer.durationShort":`时长`,"drawer.period24h":`24 小时`,"drawer.period7d":`7 天`,"drawer.tokens":`Token 24 小时 / 7 天`,"drawer.tokensShort":`Token`,"drawer.usageNotMeasured":`未采集`,"drawer.currentGoal":`当前 Goal`,"attentionDetail.title":`事项说明`,"attentionDetail.request":`需要你做什么`,"attentionDetail.decision":`需要作出决定`,"attentionDetail.unknownRequest":`来源未明确,请先查看来源再判断`,"attentionDetail.open":`当前投影中待处理`,"attentionDetail.closed":`已关闭`,"attentionDetail.deferred":`已推迟`,"attentionDetail.superseded":`已被替代`,"attentionDetail.unknown":`来源未提供状态`,"attentionDetail.unavailable":`来源尚未确认当前事项,请刷新后再操作`,"attentionDetail.unknownReason":`来源尚未提供原因。`,"attentionDetail.targetTodo":`关联的待解锁 Todo`,"attentionDetail.targetAgent":`事项指定的 Agent`,"attentionDetail.scope":`声明的决策范围`,"attentionDetail.notProvided":`来源未提供`,"attentionDetail.replacement":`替代 Todo`,"attentionDetail.openReplacement":`打开替代事项`,"attentionDetail.boundary":`阅读详情不会关闭 gate 或授予权限;作出决定前仍需新的操作预览。`,"drawer.decisionDefaultEvidence":`当前状态没有附加公开安全证据;下一步仍会先展示 Preview。`,"drawer.decisionDefaultReason":`该决定会影响当前 Todo 的下一步执行。`,"drawer.decisionDefer":`稍后决定`,"drawer.decisionMore":`更多决定`,"drawer.decisionReject":`拒绝`,"drawer.decisionReview":`查看影响并决定`,"drawer.dependencies":`依赖`,"drawer.detailsAndActions":`详情与操作`,"drawer.duration":`运行时长 24h / 7d`,"drawer.evidence":`证据`,"drawer.executionHistory":`执行历史`,"drawer.executionRecord":`运行记录`,"drawer.executionRecordAndResult":`执行过程与结果`,"drawer.explainDecision":`解释此决定`,"drawer.gateApproveHint":`在终端执行一条命令即可完成审批:`,"drawer.gateRejectHint":`不同意就把末尾的 approve 换成 reject。执行后这条提醒会自动消失。`,"drawer.gateRequiresHost":`需要宿主确认`,"drawer.gateRequiresHostDescription":`页面无权直接批准这类权限变更,你的点击没有写入任何内容。`,"drawer.goalAutoRun":`当前 Goal 的自动运行`,"drawer.goalChanges":`当前 Goal 的待确认变更`,"drawer.goalDetails":`Goal 详情`,"drawer.group":`群聊`,"drawer.inspectorFull":`切换到全屏`,"drawer.inspectorFullView":`全屏查看`,"drawer.inspectorHalf":`切换到半屏`,"drawer.inspectorHalfView":`半屏查看`,"drawer.lastNotification":`最近通知`,"drawer.larkConfigure":`管理 Lark connection`,"drawer.larkConnect":`连接 Lark App`,"drawer.larkConnection":`Lark connection`,"drawer.larkNotConfigured":`未配置`,"drawer.larkNotConfiguredDescription":`配置后,当这个 Goal 出现需要你确认的变更时,会自动发飞书通知。`,"drawer.managerChanges":`管家待确认变更`,"drawer.moreActions":`更多操作`,"drawer.moreRunActions":`更多运行操作`,"drawer.nextTransition":`下一转换`,"drawer.noExecutionHistory":`暂无执行记录。`,"drawer.noRun":`尚未启动执行 Session`,"drawer.noRunDescription":`Agent 开始执行后,运行记录会稳定显示在这里。`,"drawer.notAssigned":`未分配`,"drawer.notLinked":`未关联`,"drawer.notSet":`未设置`,"drawer.outputDetails":`产出详情`,"drawer.outputRecorded":`该产出已记录到当前 Goal。`,"drawer.outputSafePreview":`公开安全产出预览`,"drawer.outputRun":`Run`,"drawer.outputTodo":`Todo`,"drawer.outputs":`本次运行产出`,"drawer.previewUnavailable":`此产出没有可用的公开安全内联预览。`,"drawer.priority":`优先级`,"drawer.progress":`进度`,"drawer.proposalApplied":`已应用,LoopX 状态将刷新。`,"drawer.proposalApplyFailed":`应用失败,没有写入任何变更。`,"drawer.proposalApplyFailedHint":`请刷新 Goal 状态后重新生成;若仍失败,可保留此页并查看高级诊断。`,"drawer.proposalClose":`关闭`,"drawer.proposalDefer":`稍后`,"drawer.proposalDeferred":`已暂缓,可稍后继续应用或重新生成。`,"drawer.proposalEnterGoal":`进入新 Goal`,"drawer.proposalExplainer":`确认后,LoopX 会执行这项变更并显示写入结果。关闭或取消不会修改任何状态。`,"drawer.proposalRecheck":`按最新状态重新检查`,"drawer.proposalRegenerate":`基于最新状态重试`,"drawer.proposalRejected":`已拒绝,这项变更不会写入。`,"drawer.proposalStale":`来源状态已变化,请按最新状态重新检查。`,"drawer.proposalViewGoal":`查看更新后的 Goal`,"drawer.reassign":`改派给`,"drawer.reassignSummary":`重新分配:{task}`,"drawer.reason":`原因`,"drawer.recoveryDescription":`本地历史已经保留,请选择恢复路径。`,"drawer.recoveryFailed":`上游 Session 恢复失败`,"drawer.recoveryNewSession":`携带上下文开始新 Session`,"drawer.recoveryRetry":`重试恢复`,"drawer.repositoryRole":`执行工作区`,"drawer.repository":`仓库`,"drawer.replyMode":`回复方式`,"drawer.subagentApplied":`已写入,并通过共享 Goal 状态读回校验。`,"drawer.subagentAppliedRefreshFailed":`已写入并通过共享 Goal 状态读回;状态投影刷新失败,可稍后手动刷新。`,"drawer.subagentApplying":`正在写入并校验共享状态读回…`,"drawer.subagentApplyFailed":`子代理设置写入失败。`,"drawer.subagentChildLimit":`当前上限`,"drawer.subagentConfirmDisable":`确认关闭子代理执行`,"drawer.subagentConfirmEnable":`确认开启子代理执行`,"drawer.subagentCurrentBoundary":`当前任务领域限制`,"drawer.subagentDescription":`仅在 Todo、配额、能力和写入范围门禁全部通过后,允许运行时为相互独立的任务临时创建子代理;不会强制并行,也不会授予持久权限。`,"drawer.subagentDisable":`预览关闭子代理执行`,"drawer.subagentDisableSummary":`这个 Goal 将不再创建新的子代理;现有 Todo 归属和执行记录不受影响。`,"drawer.subagentDomainInvalid":`所选任务领域限制无效。`,"drawer.subagentDomainTodoCount":`匹配 {count} 个开放 Todo`,"drawer.subagentDomains":`任务领域限制(可选)`,"drawer.subagentDomainsEmpty":`当前没有开放的 advancement Todo 声明 task_domain;保持为空即可不按任务领域限制子代理执行。`,"drawer.subagentDomainsHint":`全部不选表示不按任务领域过滤;选择后只放行匹配且已声明领域的 Todo,其他执行门禁始终生效。`,"drawer.subagentDomainsUnrestricted":`不限制任务领域`,"drawer.subagentEnable":`预览开启子代理执行`,"drawer.subagentLabel":`Per-Goal 执行边界`,"drawer.subagentModel":`子 Agent 模型`,"drawer.subagentEffort":`子 Agent 推理档位`,"drawer.subagentModelDefault":`宿主默认`,"drawer.subagentLunaPreset":`使用 Luna / max`,"drawer.subagentClearModel":`清除模型偏好`,"drawer.subagentModelHint":`填写后通过“预览配置调整”保存,执行关闭时也可保存偏好;启动时须核验宿主支持情况。`,"drawer.subagentModelRequired":`设置推理档位前请先指定子 Agent 模型。`,"drawer.subagentMaxChildren":`最多子代理数`,"drawer.subagentNoChange":`当前 Goal 已是这个设置,没有写入任何内容。`,"drawer.subagentPending":`待确认`,"drawer.subagentPreviewBoundary":`预览配置调整`,"drawer.subagentPreviewFailed":`无法生成子代理设置预览。`,"drawer.subagentPreviewing":`正在核对最新 Goal 状态…`,"drawer.subagentPreviewReady":`预览已锁定,确认后才会写入这个 Goal。`,"drawer.subagentPreviewSummary":`最多允许创建 {count} 个子代理;任务领域限制:{domains}。`,"drawer.subagentRemoteReadOnly":`当前来源只读,请在 Goal 所在主机上修改。`,"drawer.subagentTitle":`自适应子代理执行`,"drawer.remoteDetailsDescription":`SSH 来源只展示公开安全状态,不读取来源主机上的连接配置。`,"drawer.remoteDetailsUnavailable":`远端详情未投影`,"drawer.resumeNo":`否`,"drawer.resumeYes":`是`,"drawer.runDetails":`执行 Session`,"drawer.runInterrupt":`中断本次运行`,"drawer.runLatest":`查看最近执行过程`,"drawer.runNewSession":`开始新 Session`,"drawer.runCloseSession":`关闭 Session`,"drawer.runRecordEmpty":`还没有运行记录。Agent 尚未开始这次执行;请在“详情与操作”查看等待条件或恢复 Session。`,"drawer.runRecordProjected":`当前没有可展示的逐步运行记录。LoopX 已读取到 {completed}/{total} 的投影进度{outputs};请在“详情与操作”检查 Session 状态。`,"drawer.runRecordProjectedOutputs":`和 {count} 项产出`,"drawer.runRoleAssistant":`已完成`,"drawer.runRoleSystem":`需检查`,"drawer.runRoleUser":`收到任务`,"drawer.runView":`Session 视图`,"drawer.scheduleAdd":`添加定时检查`,"drawer.scheduleDefaultNotification":`仅在需要你时通知`,"drawer.scheduleDefaultStop":`Goal 完成或 owner 停止`,"drawer.scheduleDefaultTarget":`由 LoopX 调度器按 Goal 配置唤醒。`,"drawer.scheduleEdit":`改为每 2 小时`,"drawer.scheduleLast":`上次执行`,"drawer.scheduleLocalTimezone":`本地时区`,"drawer.scheduleNext":`下次执行`,"drawer.scheduleNeverRun":`尚未执行`,"drawer.scheduleNotification":`通知`,"drawer.schedulePause":`暂停`,"drawer.schedulePending":`等待调度`,"drawer.scheduleResume":`恢复`,"drawer.scheduleRunNow":`立即运行`,"drawer.scheduleStop":`停止{kind}`,"drawer.scheduleStopCondition":`停止条件`,"drawer.scheduleTimezone":`时区`,"drawer.sessionRecoverable":`可恢复`,"drawer.sessionStatus":`会话状态`,"drawer.setupHeartbeat":`设置 Heartbeat`,"drawer.taskActions":`Todo 待确认操作`,"drawer.taskAdvancement":`推进任务`,"drawer.taskBlock":`标记阻塞`,"drawer.taskComplete":`标记完成`,"drawer.taskCompletedNote":`该任务保留为只读记录。`,"drawer.taskCompletedTitle":`任务已完成`,"drawer.taskDefer":`暂缓`,"drawer.taskDeferCondition":`Todo 暂缓恢复条件`,"drawer.taskDeferInvalid":`条件格式不受支持;请使用下列可判定条件。`,"drawer.taskDeferPlaceholder":`例如 resume_at:2026-09-14T09:00:00+08:00`,"drawer.taskDeferReview":`检查暂缓`,"drawer.taskDeferSupported":`支持 todo_done、pr_merged、capacity_available 与带时区的 resume_at 条件。`,"drawer.taskDeferUntil":`暂缓至`,"drawer.taskDetails":`Todo 详情`,"drawer.taskInfo":`任务信息`,"drawer.taskManage":`管理任务`,"drawer.taskNextCompleted":`可创建后续任务`,"drawer.taskNextOpen":`推进或更新状态`,"drawer.taskOrdinary":`普通任务`,"drawer.taskStatusBlocked":`受阻`,"drawer.taskStatusDeferred":`已延期`,"drawer.resumeWhen":`恢复条件`,"drawer.resumeState":`恢复状态`,"drawer.resumePending":`等待条件满足`,"drawer.resumeReady":`可恢复`,"drawer.resumeReceipt":`恢复回执`,"drawer.taskNextDeferred":`等待恢复条件满足后重新评估`,"drawer.taskNextResumeReady":`恢复条件已满足,等待生命周期重新规划`,"drawer.taskStatusCompleted":`已完成`,"drawer.taskStatusOpen":`待执行`,"drawer.taskSuccessor":`创建后续 Todo`,"drawer.taskSuccessorNote":`Owner 标记为阻塞,等待补充上下文。`,"drawer.taskSuccessorSummary":`创建后续 Todo:{task}`,"drawer.taskSuccessorText":`{task} 的后续工作`,"drawer.taskType":`任务类型`,"drawer.topic":`Topic`,"drawer.trigger":`触发方式`,"drawer.titleAttention":`需要你`,"drawer.titleOutput":`产出详情`,"drawer.titleProposalApplied":`执行结果`,"drawer.titleProposalConfirm":`确认执行`,"drawer.titleSchedule":`定时检查`,"drawer.unconfigured":`未配置`,"drawer.workspaceCandidates":`可选择的工作区`,"files.emptySummary":`公开安全产出`,"files.empty":`还没有文件、产出或已验证的阶段周报。`,"files.loadingReports":`正在加载已验证的阶段周报…`,"files.reportDelta":`+{added} 新增 · {changed} 变化`,"files.reportAdded":`新增`,"files.reportChanged":`变化`,"files.reportGeneration":`生成批次`,"files.reportLoadFailed":`无法加载已验证周报`,"files.reportPublication":`发布批次`,"files.title":`Files & Outputs`,"files.verifiedReport":`已验证阶段周报`,"header.agentUnavailable":`不可用`,"header.chatRuntime":`Chat`,"header.workAgentCount":`{count} 个工作 Agent`,"header.chat":`Chat`,"header.files":`Files`,"header.goalCapabilities":`能力配置`,"header.goalCapabilitiesDescription":`管理 Goal override 与继承的本机默认值。`,"header.goalDetails":`Goal 详情`,"header.goalDetailsDescription":`查看状态、用量、仓库、通知与 Session。`,"header.goalSettings":`Goal 设置`,"header.goalSettingsDescription":`打开 Goal 详情或能力配置`,"header.goalNavigation":`Goal 导航`,"header.goalView":`Goal 视图`,"header.live":`实时`,"header.manager":`LoopX 管家`,"header.managerDescription":`跨 Goal 的个人工作入口`,"header.managerRuntime":`{profile} · {sandbox}`,"header.managerRuntimeFallback":`配置无效,已回退到 {profile} · {sandbox};请在机器能力设置中修复。`,"header.managerOverview":`总览`,"header.managerView":`管家视图`,"header.openGoalNavigation":`打开 Goal 导航`,"header.readOnlySourceDescription":`{source} 通过 SSH 隧道只读展示`,"header.refresh":`刷新状态`,"header.refreshDone":`刚刚更新`,"header.refreshFailed":`刷新失败`,"header.refreshing":`刷新中`,"header.selectAgent":`选择 Agent`,"header.selectChatRuntime":`选择聊天 Runtime`,"header.tasks":`Tasks`,"header.themeBrutal":`切换到野兽主题`,"header.themePaper":`切换到默认主题`,"home.blockingSummary":`其中 {count} 项正在阻塞 Agent。`,"home.completedGoals":`已完成的 Goal`,"home.empty":`当前没有`,"startup.goalLoading":`正在加载状态…`,"startup.goalError":`状态加载失败`,"startup.progress":`已加载 {loaded} / {total} 个活跃 Goal`,"startup.partial":`Goal 状态正在逐个更新,当前统计尚不完整。`,"startup.independent":`此 Goal 的加载不会阻塞其他 Goal,你可以先查看已加载的内容。`,"startup.error.timeout":`读取超时,可在本地服务就绪后重试。`,"startup.error.network":`连接中断,请重试以重新连接。`,"startup.error.service":`Goal 状态读取失败。请稍后重试;若问题持续,请检查状态来源。`,"startup.error.access":`状态来源无法访问此 Goal 所需的文件或运行时目录。请检查该来源运行账户的访问权限,修复后重试。`,"startup.error.revision":`加载期间 Goal 目录发生变化,请刷新以同步。`,"startup.error.scope":`该 Goal 已不在当前来源中,请刷新目录。`,"startup.error.invalid":`无法解析状态响应,请刷新或检查 LoopX 更新。`,"startup.retry":`重试`,"startup.retryFailed":`重试失败的 Goal`,"startup.failedCount":`{count} 个 Goal 加载失败,已加载的 Goal 可继续使用。`,"home.greeting":`你好,我是 LoopX 管家`,"home.history":`历史`,"home.lane.needsYou":`需要你`,"home.lane.needsYouDescription":`等待你的决定、授权或补充信息`,"home.lane.observing":`观察中`,"home.lane.observingDescription":`持续监控,出现变化时再提醒你`,"home.lane.running":`执行中`,"home.lane.runningDescription":`Agent 正在推进并持续回传进展`,"home.lane.scheduled":`已安排`,"home.lane.scheduledDescription":`已经安排,等待时间或前置条件`,"home.noActivity":`尚无活动`,"home.noFirstActivity":`等待首次活动`,"home.noCompletedGoals":`还没有已完成的 Goal`,"home.preservedState":`保留状态,可随时恢复`,"home.stopped":`已停止`,"home.systemHealth":`系统健康:{summary}`,"home.taskCount":`{count} 个 Task`,"home.todayAt":`今天 {time}`,"home.waitingCount":`你有 {count} 项需要处理。`,"home.workspace":`Goal 工作区`,"lark.allMessages":`此 Topic 中的所有消息`,"lark.allTopicMessages":`所有 Topic 消息`,"lark.agentIngress":`Agent 入站方式`,"lark.agentAppPermissions":`每个选中的 Agent 都需要一个已具备群聊提及和回复能力的 Lark App。`,"lark.agentApps":`每个 Agent 的 Lark App`,"lark.agentAppsDescription":`默认使用上方 App;需要独立机器人身份时,可为 Agent 选择另一个兼容 App。`,"lark.agentAppSelection":`{agent} 的 Lark App`,"lark.appCreated":`App 已创建`,"lark.appCreateFailed":`创建失败`,"lark.appLoading":`正在加载可用的 Lark Apps…`,"lark.appPermissions":`该 App 能发送建联消息,但缺少接收群聊 @ 消息或自动回复所需的机器人权限。请开启 im:message.group_at_msg:readonly、im:message.send_as_bot 和事件 im.message.receive_v1,发布新版后刷新。`,"lark.appProfile":`Lark App`,"lark.apps":`Lark Apps`,"lark.autoReplyUnavailable":`自动回复暂不可用`,"lark.autoReplyReady":`自动回复可用`,"lark.bindGoal":`绑定到 Goal`,"lark.cancel":`取消`,"lark.cardinality":`一个 Lark App · 多个 Goal · 每个 Agent 一条隔离路由`,"lark.capture":`接收范围`,"lark.captureAddressed":`仅接收提及 App 或回复 App 的消息`,"lark.captureAll":`接收此 Goal Topic 中的所有消息`,"lark.captureScope":`接收范围`,"lark.captureScopeDescription":`决定哪些 Topic 消息会进入 LoopX;不会扩大 Agent 权限。`,"lark.closeConnection":`关闭连接弹窗`,"lark.closeCreate":`关闭创建弹窗`,"lark.closeSettings":`关闭 Lark 设置`,"lark.connect":`连接`,"lark.connectAllAgents":`连接全部已注册 Agent`,"lark.connectAllAgentsAction":`一键连接 {count} 个 Agent`,"lark.connectAllAgentsDescription":`一次引导创建 {count} 个隔离的 Agent Topic;请在对应 Topic 内发送请求,每个 Agent 保留独立路由和收件箱。`,"lark.connectApp":`连接 Lark App`,"lark.connection":`连接`,"lark.connections":`连接`,"lark.configuration":`Lark 配置`,"lark.continueFeishu":`在飞书中继续`,"lark.createAutomatically":`自动创建 Goal Topic`,"lark.createAutomaticallyDescription":`将为每个选中的 Agent 创建带 Agent 标识的专属 Topic。`,"lark.defaultAgentAppDescription":`用于查找目标群聊,并作为所有选中 Agent 的默认 App;下方的逐 Agent 选择可覆盖它。`,"lark.description":`管理可复用的 Lark App,并用独立 Topic 将群聊连接到 Goal。`,"lark.editConnection":`编辑 Lark 连接`,"lark.goalConnections":`{count} 个 Goal 连接`,"lark.goalTopicConnections":`Lark Goal Topic 连接`,"lark.groupChat":`群聊`,"lark.groupEmpty":`该机器人尚未加入可连接的群。请先在飞书群设置中添加这个机器人,再回来刷新或搜索。`,"lark.groupLoading":`正在读取该机器人已加入的群…`,"lark.groupSearch":`搜索该机器人已加入的群`,"lark.historyPermission":`历史补读权限(独立能力)`,"lark.health.contextCaptured":`已捕获群聊上下文`,"lark.health.contextCapturedDetail":`该消息仅作为非权威上下文保留,不会启动或引导管家 Turn;需要执行时请直接 @ 机器人或回复机器人的消息。`,"lark.health.eventProcessed":`已处理 {events} 条事件,成功回复 {replies} 条。`,"lark.health.eventUnverified":`事件订阅待验证`,"lark.health.eventUnverifiedDetail":`Provider listener 已就绪,但尚未收到消息事件。请启用 im.message.receive_v1、开通群聊 @ 消息权限并发布新版,然后在这个 Agent Topic 内发送新的 @ 消息;存在多条 Agent 路由时,群顶层消息会 fail closed。`,"lark.health.ignoredSelf":`已忽略机器人自身发送的消息,避免重复回复。`,"lark.health.invalidRouting":`路由配置无效`,"lark.health.invalidRoutingDetail":`连接已安全停用,请重新选择处理方式并保存。`,"lark.health.lastStatus":`最近事件状态:{status}`,"lark.health.listening":`监听中`,"lark.health.messageContextPermission":`消息权限不足`,"lark.health.messageContextPermissionDetail":`已收到消息事件,但无法读取群消息上下文。请发布并授权该 App 的群消息读取权限。`,"lark.health.notAddressed":`最近消息未直接 @ 机器人`,"lark.health.notAddressedDetail":`监听正常;当前连接只响应直接 @ 机器人或对机器人的回复。`,"lark.health.notStarted":`监听未启动`,"lark.health.notStartedDetail":`请刷新连接或重新启动 LoopX 后再试。`,"lark.health.processingFailed":`消息处理失败`,"lark.health.processingFailedDetail":`已收到消息事件,但 Agent 处理失败。请查看本地诊断后重试。`,"lark.health.queued":`已进入 Agent 收件箱`,"lark.health.queuedDetail":`消息由 {agent} 异步处理,不会启动通用 Chat Session。`,"lark.health.sourceDisconnected":`实时消息连接断开`,"lark.health.sourceDisconnectedDetail":`消息监听进程意外退出。请核对应用档案的平台:飞书应用选飞书,国际版 Lark 应用选 Lark,再检查连接及订阅错误。LoopX 正在重试;历史消息能读取,不代表能实时收消息。`,"lark.health.retrying":`监听重试中`,"lark.health.retryingDetail":`事件监听暂时中断,LoopX 正在自动重试。`,"lark.health.routeAmbiguous":`消息匹配多个 Goal`,"lark.health.routeAmbiguousDetail":`同一 Bot 和群聊存在多个完整群捕获连接。请让每个 Agent 使用独立 Bot,或只保留一个完整群连接。`,"lark.health.routeMismatch":`消息未匹配当前 Goal Topic`,"lark.health.routeMismatchDetail":`事件来自其他群聊或 Topic。请重新选择群聊并连接该 Goal,然后发送一条新的 @ 消息。`,"lark.health.routeUnavailable":`消息无法路由到 Goal`,"lark.health.routeUnavailableDetail":`当前连接信息不完整。请重新连接该 Goal 后再发送一条新的 @ 消息。`,"lark.health.starting":`正在启动`,"lark.health.startingDetail":`LoopX 正在启动该 App 的消息事件监听。`,"lark.health.unavailable":`自动回复不可用`,"lark.health.waiting":`等待处理`,"lark.incomingMessages":`接收消息`,"lark.ingressAsync":`异步收件箱`,"lark.ingressAsyncDescription":`写入 Agent 私有收件箱,等待后续显式处理。`,"lark.editPreservesIdentity":`保存会保留此 App、群和 Topic;旧连接默认升级为 Agent 异步收件箱。`,"lark.conversationKind":`连接用途`,"lark.managerConversation":`管家 · 同步对话`,"lark.workerConversation":`工作 Agent · 后台任务`,"lark.managerConversationDescription":`内置管家即时回应对话,长任务交给后台 Agent。群聊与私聊分别保存上下文。`,"lark.ingressLegacy":`待升级`,"lark.ingressLegacyDescription":`保存连接即可升级为 Agent 异步收件箱,已有消息保留在原 Topic 中。`,"lark.ingressQueue":`排队`,"lark.ingressQueueDescription":`进入同一 Agent Session 的有界 FIFO 队列,当前 Turn 完成后处理。`,"lark.ingressSteering":`实时引导`,"lark.ingressSteeringDescription":`投到当前活跃 Turn;没有精确活跃 Turn 时安全拒绝。`,"lark.loading":`加载 Lark 配置…`,"lark.management":`Lark 管理`,"lark.openEventSettings":`查看飞书事件配置`,"lark.mentions":`提及机器人`,"lark.mentionsOnly":`仅提及消息`,"lark.needsMessagePermissions":`需要消息权限`,"lark.needsSetup":`需要设置`,"lark.newApp":`新建 Lark App`,"lark.noAgentConfigured":`未配置 Agent`,"lark.noConnections":`暂无匹配的连接。`,"lark.noProfiles":`还没有可用的 lark-cli App profile。`,"lark.profileName":`Profile 名称`,"lark.profileValidation":`Profile 只能包含字母、数字、点、下划线和连字符。`,"lark.processing":`处理方式`,"lark.region":`区域`,"lark.registerAnother":`+ 注册另一个 Lark App — 通过飞书创建`,"lark.reopenFeishu":`重新打开飞书`,"lark.settingsConfigure":`配置 {goal}`,"lark.settingsDisconnect":`解绑 {goal}`,"lark.replyMode":`回复方式`,"lark.replyModeDescription":`当前只支持在来源 Topic 内回复,避免跨群或跨 Goal 投递。`,"lark.reusableApps":`{count} 个可复用 App`,"lark.reusableWorkspaceApp":`可复用工作区 App`,"lark.routesUnverified":`{count} 条 Lark 路由尚未验证`,"lark.saveConnection":`保存连接`,"lark.searchConnections":`搜索 Lark 连接`,"lark.searchPlaceholder":`搜索 App、群、Goal 或 Topic`,"lark.setupCopy":`LoopX 将通过 lark-cli 打开飞书官方创建页面。应用凭证保存在系统 Keychain,LoopX 只保留 profile 引用。`,"lark.someoneMentions":`有人提及 Agent`,"lark.targetAgent":`目标 Agent`,"lark.targetAgentDescription":`选择该 Goal 内已注册的 Agent。此连接只投递给一个 Agent,不广播、不授予新权限。实时引导与排队需要该 Agent 的精确活跃 Session。`,"lark.agentUnavailable":`{agent} · 已不可用`,"lark.selectRegisteredAgent":`请先选择可用的已注册 Agent;不会自动替换原先的接收者。`,"lark.topicPreview":`Topic 预览`,"lark.topicReply":`Topic 回复`,"lark.trigger":`触发方式`,"lark.waitingFeishu":`等待飞书完成创建`,"lark.waitingFeishuDescription":`请在新窗口中完成飞书授权,完成后会自动回到这里。`,"lark.waitingLink":`正在生成飞书官方创建链接…`,"lark.error.appCreate":`Lark App 创建失败`,"lark.error.appRequired":`请选择一个 Lark App profile。`,"lark.error.bind":`绑定失败`,"lark.error.bindPreview":`绑定预览失败`,"lark.error.configuration":`Lark 配置加载失败`,"lark.error.groupLookup":`无法读取该机器人已加入的群。请检查机器人状态后重试。`,"lark.error.groupLoad":`群聊加载失败`,"lark.error.invalidApp":`Lark App profile 不可用或尚未完成授权。`,"lark.error.messagePermissions":`该 App 缺少自动回复所需的机器人权限。请开启 im:message.group_at_msg:readonly 和 im:message:send_as_bot,发布新版后回来刷新重试。`,"lark.error.provider":`飞书 API 调用失败,且没有生成已验证回执。请稍后重试。`,"lark.error.setupPoll":`创建状态查询失败`,"lark.error.setupStart":`无法启动 Lark App 创建流程`,"lark.error.cliExecutable":`已找到配置的 lark-cli,但当前无法执行。请检查安装或启动参数。`,"lark.error.cliMissing":`未发现 lark-cli。请先安装 lark-cli,然后重新启动 LoopX。`,"lark.error.cliStart":`lark-cli 启动失败。请检查安装状态,然后重新启动 LoopX。`,"lark.error.disconnect":`解绑失败`,"notifications.autoNotify":`需要你确认时自动推送到群里`,"notifications.bind":`绑定到通知群`,"notifications.bindConfirm":`将把「{goal}」绑定到通知群「{target}」,绑定时会验证机器人在群内并发送一条确认消息。`,"notifications.bindFailed":`绑定失败`,"notifications.bound":`已绑定`,"notifications.confirmBind":`确认绑定`,"notifications.description":`把 Goal 里需要你确认的变更推送到飞书群。绑定和开关在这里完成,推送逻辑沿用现有通道。`,"notifications.disabled":`已停用`,"notifications.group":`通知群:{target}`,"notifications.loadFailed":`通知群列表加载失败`,"notifications.noTargets":`还没有可用的通知群。通知群涉及机器人私有身份,请先在终端配置一次:`,"notifications.notBound":`未绑定`,"notifications.recent":`最近 {time}`,"notifications.sentCount":`已发送 {count} 条`,"notifications.settings":`Goal 通知绑定`,"notifications.setupFailed":`设置失败`,"notifications.title":`飞书群通知`,"proposal.field.agentId":`Agent`,"proposal.field.cadence":`频率`,"proposal.field.completionCriteria":`完成标准`,"proposal.field.executionBoundary":`执行边界`,"proposal.field.goalId":`Goal ID`,"proposal.field.heartbeat":`Heartbeat`,"proposal.field.initialTodos":`首个任务`,"proposal.field.objective":`目标`,"proposal.field.operation":`操作`,"proposal.field.operationState":`操作状态`,"proposal.field.resultDelivery":`结果回传`,"proposal.field.confirmationBoundary":`确认边界`,"proposal.field.expiresAt":`过期时间`,"proposal.field.permission":`权限`,"proposal.field.reason":`原因`,"proposal.field.stopCondition":`停止条件`,"proposal.field.target":`检查内容`,"proposal.field.timezone":`时区`,"proposal.field.title":`标题`,"proposal.field.workspace":`执行工作区`,"actionReview.targetChanged":`预览目标与请求的 Goal 或操作不一致,请重新生成预览。`,"actionReview.ready_stop":`暂停可恢复。此预览已通过检查,可直接执行;完成仍需要读回验证。`,"actionReview.resume_review":`恢复自动调度前需要确认。实际执行仍受额度、Gate 和 Todo 约束。`,"actionReview.delete_review":`请确认从注册表移除这个已停止 Goal。项目文件与历史记录会保留。`,"actionReview.action_review":`执行前请检查此提案的目标与影响。`,"actionReview.protected_action":`此操作需要明确审阅。确认不能替代所需授权。`,"actionReview.unknown_permission":`无法识别权限分类。请重新检查提案后再继续。`,"actionReview.unknown_action":`无法识别此生命周期操作。请重新检查提案后再继续。`,"actionReview.incomplete_proposal":`预览缺少验证信息或可执行转换。请重新生成预览。`,"actionReview.authority_gate":`Gate 阻止执行。请满足其要求后重新检查提案。`,"actionReview.stale_proposal":`来源状态已变化。请重新生成预览,原决定不再适用。`,"actionReview.apply_pending":`正在执行,请等待读回结果后再重试。`,"actionReview.readback_verified":`操作已完成,结果状态已通过读回验证。`,"actionReview.readback_unverified":`操作返回但未通过读回验证。尚不能确认完成,请重新检查状态。`,"actionReview.operation_group_confirmation":`这份精确请求只能在已绑定飞书群的原始卡片确认;Dashboard 不提供本地执行入口。`,"actionReview.operation_result_delivery_pending":`操作结果已经记录,但原群结果卡尚未通过回读核验。`,"actionReview.apply_failed":`执行未完成。请检查失败原因并重新生成预览后再试。`,"actionReview.inactive_proposal":`此提案当前不可执行。请重新检查后再继续。`,"proposal.gate.default":`需要宿主确认`,"proposal.impact.default":`确认后会调用规范 LoopX 服务写入状态。`,"proposal.impact.goalCreate":`确认后会创建 Goal 和首个 Todo,并让选定 Agent 开始首轮推进。`,"proposal.impact.lifecycleDelete":`确认后会从 source registry 和 global registry 移除这个已停止 Goal;项目文件、历史状态文件和备份不会被删除。`,"proposal.impact.lifecycleResume":`确认后会恢复 Goal 的自动调度资格并移回 Active Goals;实际执行仍受 quota、Gate 和 Todo 约束。`,"proposal.impact.lifecycleStop":`确认后会停止自动推进,并将 Goal 移入折叠的「已停止」列表;历史、Todo 和证据都会保留,可随时恢复。`,"proposal.impact.protected":`该操作需要通过受保护的 LoopX 写入服务完成。`,"proposal.impact.operation":`这里仅展示同一份不可变条款。请在已绑定的飞书群确认或拒绝;确认只会消费一个规范 claim。`,"proposal.primary.apply":`确认并应用`,"proposal.primary.goalCreate":`创建 Goal 并开始首轮`,"proposal.primary.lifecycleDelete":`删除 Goal`,"proposal.primary.lifecycleResume":`恢复 Goal`,"proposal.primary.lifecycleStop":`停止 Goal`,"proposal.primary.todoStart":`创建任务并开始执行`,"proposal.primary.operationGroup":`前往飞书群确认`,"proposal.primary.operationResultPending":`结果卡回传待恢复`,"proposal.primary.operationResultVerified":`结果已核验`,"proposal.resultDelivery.verified":`已在原群卡片完成回读核验`,"proposal.resultDelivery.pending":`等待回传并核验原群卡片`,"proposal.summary.goalCreate":`创建 Goal:{title}`,"proposal.summary.heartbeat":`为当前 Goal 设置 Heartbeat`,"proposal.summary.lifecycleDelete":`删除 Goal:{title}`,"proposal.summary.lifecycleResume":`恢复 Goal:{title}`,"proposal.summary.lifecycleStop":`停止 Goal:{title}`,"proposal.summary.monitor":`为当前 Goal 创建定时检查:{target}`,"proposal.workspace.current":`当前本地工作区(未绑定 Repository)`,"proposal.workspace.named":`{workspace}(仅提供执行环境,不会自动关联仓库)`,"proposal.workspaceGate.agentImpact":`先完成 Agent 身份绑定,再重新检查原操作;当前没有写入 Goal。`,"proposal.workspaceGate.agentTitle":`先绑定 Agent`,"proposal.workspaceGate.defaultSummary":`请选择 Goal 所属工作区。`,"proposal.workspaceGate.selectionImpact":`选择工作区后会重新展示待确认操作,选择本身不会写入状态。`,"proposal.workspaceGate.selectionTitle":`选择 Goal 工作区`,"projection.agentAdvancingGoal":`Agent 正在推进当前 Goal`,"projection.agentIdle":`暂无需要你处理`,"projection.agentNeedsDecision":`Agent 等待你的决定`,"projection.agentPreparingNextStep":`Agent 正在整理下一步`,"projection.agentStopped":`已由你停止;历史、Todo 和证据仍保留`,"projection.agentWaitingExternal":`正在等待外部条件`,"projection.confirmAgentDecision":`请确认 Agent 下一步需要的权限或决策`,"projection.events24h":`24 小时内 {count} 个事件`,"projection.firstReadOnlyAdapterCheck":`执行首次只读适配检查并保存进度`,"projection.goalVerified":`Goal 状态、Todo 与注册信息已验证`,"projection.latestRun":`最近运行`,"projection.latestValidation":`最近验证`,"projection.nextUpdatePending":`等待 LoopX 更新下一步`,"projection.publicSafeProjection":`公开安全状态投影`,"projection.refreshState":`刷新 LoopX 状态,确认当前进度仍然有效`,"projection.runEvidenceAvailable":`存在可查看的运行证据`,"projection.runRecorded":`最近一次 LoopX 运行已经记录`,"projection.statusRefreshNeeded":`LoopX 状态需要刷新`,"projection.todoStatusUpdated":`Todo 状态已经更新,正在确认下一步`,"projection.validationRecorded":`最近验证已经记录`,"runs.completed":`已完成`,"runs.failed":`需检查`,"runs.interrupted":`已中断`,"runs.queued":`已安排`,"runs.ready":`可继续`,"runs.resumeFailed":`恢复失败`,"runs.running":`执行中`,"runs.unknown":`状态未知`,"runs.waiting":`等待条件`,"schedule.active":`执行中`,"schedule.heartbeat":`Goal Heartbeat`,"schedule.monitor":`定时与持续任务`,"schedule.paused":`已暂停`,"schedule.summary":`按 LoopX 调度约束持续检查`,"schedule.defaultTarget":`检查当前 Goal 的阻塞、进度与新产出`,"schedule.unsupportedCalendar":`当前定时检查不支持精确到星期或时刻的日历计划。请改用固定间隔,例如“每 30 分钟”“每 2 小时”或“每天”;草稿已保留,没有生成待确认操作。`,"source.add":`添加来源`,"source.addConfigured":`添加只读来源`,"source.addMethod":`来源添加方式`,"source.addSsh":`添加 SSH 隧道来源`,"source.closeForm":`关闭来源表单`,"source.configured":`已配置 SSH`,"source.configuredCount":`本机 SSH Host · {count} 个`,"source.configuredGroup":`已配置 SSH Host · {count}(点击快速添加)`,"source.connected":`已连接`,"source.connecting":`连接中`,"source.controlPlane":`控制面来源`,"source.copy":`复制`,"source.copyCommand":`复制 SSH 隧道命令`,"source.copyError":`无法复制命令,请手动复制下方命令。`,"source.copied":`已复制`,"source.description":`已读取全部显式 Host(含 Include);通配规则不会作为具体来源。先运行命令,LoopX 不读取密钥或配置细节。`,"source.host":`本机 SSH Host`,"source.hostEmpty":`~/.ssh/config 中没有可直接选择的显式 Host。`,"source.hostLoadError":`无法读取本机 SSH Host。`,"source.hostPlaceholder":`输入或搜索 Host`,"source.invalid":`SSH 来源参数无效。`,"source.loadingHosts":`正在读取…`,"source.localInteractive":`本机交互`,"source.localPort":`本地端口`,"source.manual":`手动 URL`,"source.manualDescription":`远端来源始终按只读投影处理,不继承本机写权限。`,"source.name":`名称`,"source.namePlaceholder":`远程开发机`,"source.notAvailable":`不可用`,"source.readOnly":`SSH 隧道 · 只读`,"source.readOnlyNoticeDescription":`你可以查看 Goal、Task、证据与运行状态;写入、纠偏和 Agent 会话仍留在来源主机。`,"source.readOnlyNoticeTitle":`远端只读投影`,"source.readOnlyWriteError":`远端 SSH 隧道来源是只读投影,不能执行控制面写入。`,"source.refreshHosts":`重新读取 SSH Host`,"source.remove":`移除来源 {source}`,"source.removeCurrent":`移除当前来源`,"source.select":`选择控制面来源`,"source.selectHost":`请选择已配置的 SSH Host。`,"source.statusUrl":`本地转发 URL`,"source.tunnelCommandPending":`选择 Host 后生成隧道命令`,"machine.absent":`尚未配置`,"machine.action.create":`创建机器策略`,"machine.action.delete":`移除机器策略`,"machine.action.unchanged":`无需写入`,"machine.action.update":`更新机器策略`,"machine.applied":`机器策略已应用,并通过回读校验。`,"machine.applyError":`无法应用机器策略。`,"machine.applyPreview":`应用已审阅预览`,"machine.changedNamespaces":`变更的 Namespace`,"machine.capabilityCatalog":`机器能力目录`,"machine.capabilityEmpty":`当前没有注册可在机器作用域配置的能力。`,"machine.configured":`已配置`,"machine.confirmRollback":`确认回滚`,"machine.currentRevision":`当前 Revision`,"machine.currentValue":`当前机器值`,"machine.description":`与 Goal 设置共用能力目录。在这里管理受支持的机器默认值;仅支持 Goal 配置的能力会明确标注。`,"capabilities.rawJson":`高级:原始 JSON`,"machine.goalOnly":`此能力目前仅支持 Goal 级配置。请打开具体 Goal 的能力设置进行配置;这里不会设置机器级默认值。`,"machine.desiredRevision":`目标 Revision`,"machine.editorUnavailable":`当前版本未安装此 Namespace 的编辑器`,"machine.editorUnavailableDescription":`它仍会显示在 Registry 中;安装或升级对应的 Dashboard 编辑器后才能修改。`,"machine.editorMode":`编辑模式`,"machine.liveDefault":`实时默认值;Goal 显式覆盖优先`,"machine.liveDefaultDescription":`没有显式覆盖的 Goal 会在该能力下一次决策时读取当前机器策略。修改或移除策略会立即影响这些已有 Goal;显式 Goal 覆盖保持固定。`,"machine.genericNamespaceDescription":`使用 JSON 编辑这个已注册 Namespace。LoopX 会先按 capability 自己拥有的 schema 校验,再允许预览写入。`,"machine.jsonConfiguration":`Namespace 配置(JSON)`,"machine.jsonConfigurationHelp":`只更新当前 Namespace;其他机器配置会保留,Apply 仍锁定到已审阅的 Preview Revision。`,"machine.jsonEditor":`JSON`,"machine.editJson":`编辑 JSON`,"capabilities.jsonConfiguration":`Goal 配置(JSON)`,"capabilities.jsonHelp":`仅编辑当前 Goal 的已注册字段。修改后需重新预览才能应用。`,"capabilities.jsonInvalid":`请输入合法的 JSON 对象,且仅包含已注册的可编辑字段。`,"machine.backToForm":`返回表单`,"machine.jsonInvalid":`请先填写一个合法的 JSON object,再预览变更。`,"machine.loadError":`无法读取机器配置。`,"machine.invalidStoredConfiguration":`已保存的机器配置需要修复`,"machine.invalidStoredConfigurationDescription":`已保存值不再符合当前契约,因此不会在这里显示。请检查已定位的能力,并通过“预览”和“应用”替换它;无关 namespace 保持不变。`,"machine.machinePolicy":`机器策略`,"machine.namespaceCount":`已注册 Namespace`,"machine.namespaces":`配置 Namespace`,"machine.periodicReport":`周期报告`,"machine.periodicReportDescription":`为所有未显式覆盖的 Goal 提供默认报告策略;Goal 调度与发送消费解析后的有效配置。`,"machine.periodicReportActivation":`开启后将在已验证的阶段节点自动投递`,"machine.periodicReportActivationDescription":`这不是每周定时器。当 LoopX 验证 Goal 已完成一个阶段时,Agent 会生成并冻结报告,随后通过配置的 Goal Channel 自动发送。启用此订阅即授予持续投递权;发送失败或路由漂移会 fail closed 并进入修复。`,"machine.changeQualityActivation":`质量验证是质量门禁,不是新增授权`,"machine.changeQualityActivationDescription":`继承该策略的 Goal 会验证最终精确 diff。safe_fix 只允许在既有写入权限内执行至多一次有界修复;此设置不会授予文件、权限或合并权。`,"machine.replanCadenceActivation":`复核周期只改变时机,不改变执行权限`,"machine.replanCadenceActivationDescription":`没有显式覆盖的 Goal 会在下一次复核决策前读取此阈值;它不会创建 Turn、消耗配额或授予权限。`,"machine.preview":`审阅机器配置变更`,"machine.previewChanges":`预览变更`,"machine.previewError":`无法生成机器策略预览。`,"machine.previewLocked":`应用操作锁定到当前 Revision;若机器状态变化,LoopX 会要求重新预览。`,"machine.previewRollback":`预览回滚`,"machine.previewRemoval":`预览移除`,"machine.profilePreset":`Profile preset`,"machine.profilePresetHelp":`由 capability 管理的 preset,例如 weekly-progress。`,"machine.registry":`Typed Registry`,"machine.requiredFields":`开启后必须填写 profile preset、Goal Channel route 与有效时区。`,"machine.revision":`机器 Revision`,"machine.revisionLockedReady":`所有变更必须先预览;只有对应的机器 Revision 仍然有效时才会应用。`,"machine.rollbackAvailable":`可回滚上一次应用`,"machine.rollbackDescription":`先预览已保存的前一 Revision,再决定是否恢复。`,"machine.rollbackError":`无法完成回滚。`,"machine.rollbackPreviewDescription":`前一 Revision 已准备恢复,请确认执行本次回滚。`,"machine.rolledBack":`已恢复前一版机器策略,并通过校验。`,"machine.removed":`机器策略已移除,并通过回读校验。`,"machine.routeRef":`Goal Channel route`,"machine.routeRefHelp":`只填写公开 route alias;凭据与 provider identifier 不会进入此表单。`,"machine.timezone":`时区`,"machine.timezoneHelp":`填写 IANA 时区,例如 Asia/Shanghai。`,"machine.title":`机器配置`,"machine.unchanged":`机器策略已与预览一致,本次没有写入。`,"machine.visualEditor":`引导式`,"capabilities.atomicOverride":`Goal override 按完整配置生效`,"capabilities.atomicOverrideDescription":`Goal 的完整配置优先于机器默认值;LoopX 不会在两个作用域之间逐字段拼接。`,"capabilities.applyFailed":`Goal 能力变更未写入。`,"capabilities.applyPreview":`应用此预览`,"capabilities.catalog":`Goal 能力目录`,"capabilities.chooseGoal":`请先选择一个 Goal,再查看它的能力配置。`,"capabilities.defaultValue":`声明的默认值`,"capabilities.description":`查看当前 Goal 可用的能力,以及每项配置的准确作用域。`,"capabilities.editorPrepared":`已注册 typed editor contract`,"capabilities.effectiveSource":`当前生效来源`,"capabilities.empty":`当前 Goal 没有可用的能力描述。`,"capabilities.fields":`已注册字段`,"capabilities.goalPolicy":`Goal 能力策略`,"capabilities.goalScope":`Goal`,"capabilities.goalValue":`当前 Goal 值`,"capabilities.loadFailed":`无法加载 Goal 能力`,"capabilities.loading":`正在加载 Goal 能力…`,"capabilities.machineOnly":`此能力只能在机器作用域配置。`,"capabilities.machineValue":`实时机器默认值`,"capabilities.machineScope":`机器`,"capabilities.previewOnly":`当前读取结果来自真实配置;在 revision-locked preview/apply 路径接通前,Dashboard 不会提供 Goal 写入控件。`,"capabilities.preview":`锁定 revision 的变更预览`,"capabilities.previewChanges":`预览变更`,"capabilities.restoreInheritance":`恢复继承机器默认值`,"capabilities.previewFailed":`无法预览 Goal 能力变更。`,"capabilities.previewLocked":`应用时会重新校验这一个 plan revision;过期变更将被拒绝。`,"capabilities.partialWrite":`Goal 值已保存;共享投影仍需修复`,"capabilities.partialWriteDescription":`源 Goal 配置已经写入并回读,但共享 runtime 投影尚未同步;请勿重复提交本次变更。`,"capabilities.refreshSource":`刷新源配置`,"capabilities.readOnly":`只读能力`,"capabilities.revisionLockedReady":`所有变更必须先预览;只有对应的精确 revision 仍然有效时才会写入。`,"capabilities.retry":`重试`,"capabilities.source.capability_default":`能力默认值`,"capabilities.source.goal_override":`Goal override`,"capabilities.source.machine_default":`实时机器默认值`,"capabilities.source.not_configured":`未配置`,"capabilities.title":`Goal 能力`,"settings.close":`关闭设置`,"settings.appearance":`外观`,"settings.appearanceDescription":`管理当前浏览器里的工作区显示偏好。`,"settings.appearanceTabDescription":`主题和显示偏好`,"settings.capabilitiesTabDescription":`当前 Goal 的能力覆盖配置`,"settings.back":`返回工作区`,"settings.categories":`设置分类`,"settings.description":`管理工作区偏好与集成。`,"settings.eyebrow":`工作区偏好`,"settings.general":`通用`,"settings.goalConnections":`Goal 连接`,"settings.language":`语言`,"settings.languageDescription":`选择 LoopX Desktop 工作区使用的界面语言。`,"settings.languageEnglishDescription":`使用英文显示导航、设置和工作区控件。`,"settings.languageEnglish":`English`,"settings.languageSimplifiedChineseDescription":`使用简体中文显示导航、设置和工作区控件。`,"settings.languageSimplifiedChinese":`简体中文`,"settings.languageStoredLocally":`此偏好仅保存在当前设备。`,"settings.languageTabDescription":`当前设备的界面语言`,"settings.larkTabDescription":`App、群聊和 Goal Topic 连接`,"settings.machineTabDescription":`本机各 Capability 共享的 typed defaults`,"settings.notifications":`通知`,"settings.open":`设置`,"settings.themeDefault":`纸张`,"settings.themeDefaultDescription":`安静、轻量,适合长期查看。`,"settings.themeDescription":`选择工作区的视觉风格。设置会保存在当前浏览器本地。`,"settings.themeHighContrast":`高对比`,"settings.themeHighContrastDescription":`更强边框和更醒目的状态块。`,"settings.themeLoopx":`LoopX 标准`,"settings.themeLoopxDescription":`精确的黑白界面、Geist 字体与安静的细线结构。`,"settings.title":`设置`,"settings.workspaceDisplay":`工作区显示`,"settings.workspaceTheme":`工作区主题`,"session.closeRecord":`退出运行记录`,"session.details":`Session 详情`,"session.record":`执行 Session · 运行记录`,"session.recordDescription":`当前时间线已切换到这次 Session 的消息与 Turn 记录。`,"sidebar.createGoal":`创建 Goal`,"sidebar.delete":`删除`,"sidebar.deleteGoal":`删除 Goal`,"sidebar.manager":`LoopX 管家`,"sidebar.notifications":`设置`,"sidebar.owner":`个人工作区`,"sidebar.product":`个人 Agent 工作区`,"sidebar.resume":`恢复`,"sidebar.resumeGoal":`恢复 Goal`,"sidebar.stop":`停止`,"tasks.historyLoading":`正在加载历史…`,"tasks.historyError":`历史加载失败,已显示的内容仍可查看。`,"tasks.historyExpired":`历史快照已过期,重新加载后可继续查看。`,"tasks.historyRetry":`重新加载`,"tasks.historyEnd":`已显示全部完成记录`,"tasks.historyMore":`加载更多`,"tasks.historyLocalOnly":`请打开这台机器的 Dashboard 查看完整历史。`,"sidebar.sortGoals":`调整 Goal 顺序`,"sidebar.dragGoal":`拖拽调整顺序,或使用列表排序按钮`,"sidebar.moveUp":`上移 {goal}`,"sidebar.moveDown":`下移 {goal}`,"sidebar.goalMoved":`{goal} 已移至第 {position} 位`,"sidebar.orderNotSaved":`顺序已在本次页面生效;浏览器存储不可用,无法保存。`,"sidebar.stopGoal":`停止 Goal`,"sidebar.stopped":`已停止`,"sidebar.stoppedLoading":`正在加载已停止 Goal`,"sidebar.stoppedLoadFailed":`已停止 Goal 加载失败,其他 Goal 仍可使用。`,"sidebar.retryStopped":`重试`,"state.completed":`已完成`,"state.needsRepair":`需修复`,"state.needsYou":`等你`,"state.quiet":`安静运行`,"state.running":`推进中`,"state.stopped":`已停止`,"state.waiting":`等待条件`,"tasks.blocked":`受阻`,"tasks.agentLane":`工作 Agent`,"tasks.agentLaneDescription":`筛选这个 Goal 下的工作泳道`,"tasks.agentLaneFilter":`按工作 Agent 筛选`,"tasks.allAgentLanes":`全部 Agent({count})`,"tasks.chatAgentReplied":`Agent 已回复`,"tasks.chatPending":`已发送给 Agent`,"tasks.chatPendingDescription":`正在处理;只有经过确认的任务操作才会更新 Tasks。`,"tasks.chatRecent":`最近对话`,"tasks.chatUnchangedDescription":`本次对话没有直接修改 Tasks。需要执行时,可先转成 Task 草稿并确认。`,"tasks.chatViewReply":`查看回复`,"tasks.convertToTask":`转为 Task`,"tasks.completed":`已完成`,"runs.discoveryPartial":`部分执行详情暂不可用,正在重连;任务摘要不代表实时执行状态。`,"runs.discoveryOffline":`执行服务暂不可用,正在重连;保留的任务摘要可能已过时。`,"files.openConversation":`前往会话`,"files.exportSummary":`导出摘要`,"tasks.viewDescription":`先处理待确认,再查看工作与完成记录`,"tasks.viewLabel":`任务视图`,"tasks.listView":`列表`,"tasks.boardView":`看板`,"tasks.completedSummary":`已完成 {count} 项,近期完成明细由控制面按需投影。`,"tasks.emptyCompleted":`还没有完成的任务。`,"tasks.emptyConfirm":`没有待确认的任务。`,"tasks.emptyRunning":`没有待执行或进行中的任务。`,"tasks.emptySchedules":`没有定时任务。`,"tasks.emptyGoal":`这个 Goal 还没有任务。用下面的输入框描述下一步,LoopX 会先展示待确认操作。`,"tasks.markComplete":`标记完成:{name}`,"tasks.moreActions":`更多操作:{name}`,"tasks.openExecution":`查看执行过程:{name}`,"tasks.pending":`待处理`,"tasks.pendingAndRunning":`待执行 / 进行中`,"tasks.scheduled":`定时与持续`,"tasks.sessionError":`Session 异常`,"tasks.waiting":`待执行`,"tasks.waitingAge":`已等待 {age}`,"tasks.viewExecution":`查看执行过程`,"tasks.viewResult":`查看结果`,"time.days":`{count} 天`,"time.hours":`{count} 小时`,"timeline.emptyGoal":`这个 Goal 还没有新动态`,"timeline.emptyGoalDescription":`你可以直接询问进度或下发新的纠偏信息。`,"timeline.emptyWorkspace":`今天的工作区很安静`,"timeline.emptyWorkspaceDescription":`向 LoopX 管家描述一个 Goal,或询问今天最值得关注的事情。`,"timeline.gateHistory":`{count} 项历史 Gate`,"timeline.pending":`正在整理…`,"timeline.runCompleted":`{run}:已完成`,"timeline.review":`查看处理方式`,"timeline.reviewAndConfirm":`查看并确认`,"timeline.waitingConfirmation":`待你确认`}};function Wi(e,t){return t?Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e):e}function Gi(){try{return window.localStorage.getItem(`loopx-pw-locale`)===`en`?`en`:`zh-CN`}catch{return`zh-CN`}}function Ki({children:e}){let[t,n]=(0,V.useState)(Gi);function r(e){n(e);try{window.localStorage.setItem(Hi,e)}catch{}}(0,V.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,V.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Wi(Ui[t][e],n)}),[t]);return(0,H.jsx)(Vi.Provider,{value:i,children:e})}function qi(){let e=(0,V.useContext)(Vi);if(!e)throw Error(`useWorkspaceI18n must be used within WorkspaceI18nProvider`);return e}function Ji(e,t){let n={安静运行:`state.quiet`,等你:`state.needsYou`,等待条件:`state.waiting`,推进中:`state.running`,需修复:`state.needsRepair`,已完成:`state.completed`,已停止:`state.stopped`}[e];return n?Ui[t][n]:e}function Yi(e,t){let n={busy:`runs.running`,completed:`runs.completed`,failed:`runs.failed`,queued:`runs.queued`,ready:`runs.ready`,resume_failed:`runs.resumeFailed`,running:`runs.running`,waiting:`runs.waiting`};return e?n[e]?t(n[e]):e:t(`runs.unknown`)}function Xi(e,t){if(!e)return null;let n=new Date(e).getTime();if(Number.isNaN(n))return null;let r=Date.now()-n;if(r<36e5)return null;let i=Math.floor(r/864e5);return i>=1?t(`time.days`,{count:i}):t(`time.hours`,{count:Math.floor(r/36e5)})}var Zi;function U(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;en?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Qi=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},$i=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Zi=globalThis).__zod_globalConfig??(Zi.__zod_globalConfig={});var ea=globalThis.__zod_globalConfig;function ta(e){return e&&Object.assign(ea,e),ea}function na(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ra(e,t){return typeof t==`bigint`?t.toString():t}function ia(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function aa(e){return e==null}function oa(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function sa(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){};function ha(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ga=ia(()=>{if(ea.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function _a(e){if(ha(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ha(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function va(e){return _a(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ya=new Set([`string`,`number`,`symbol`]);function ba(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xa(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function W(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Sa(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Ca={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function wa(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return xa(e,da(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ua(this,`shape`,e),e},checks:[]}))}function Ta(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return xa(e,da(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ua(this,`shape`,r),r},checks:[]}))}function Ea(e,t){if(!_a(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xa(e,da(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ua(this,`shape`,n),n}}))}function Da(e,t){if(!_a(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return xa(e,da(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ua(this,`shape`,n),n}}))}function Oa(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return xa(e,da(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ua(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ka(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return xa(t,da(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return ua(this,`shape`,i),i},checks:[]}))}function Aa(e,t,n){return xa(t,da(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return ua(this,`shape`,i),i}}))}function ja(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Pa(e){return typeof e==`string`?e:e?.message}function Fa(e,t,n){let r=e.message?e.message:Pa(e.inst?._zod.def?.error?.(e))??Pa(t?.error?.(e))??Pa(n.customError?.(e))??Pa(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Ia(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function La(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ra=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ra,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},za=U(`$ZodError`,Ra),Ba=U(`$ZodError`,Ra,{Parent:Error});function Va(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ha(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Qi;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Fa(e,a,ta())));throw ma(t,i?.callee),t}return o.value},Wa=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Fa(e,a,ta())));throw ma(t,i?.callee),t}return o.value},Ga=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Qi;return a.issues.length?{success:!1,error:new(e??za)(a.issues.map(e=>Fa(e,i,ta())))}:{success:!0,data:a.value}},Ka=Ga(Ba),qa=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Fa(e,i,ta())))}:{success:!0,data:a.value}},Ja=qa(Ba),Ya=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ua(e)(t,n,i)},Xa=e=>(t,n,r)=>Ua(e)(t,n,r),Za=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Wa(e)(t,n,i)},Qa=e=>async(t,n,r)=>Wa(e)(t,n,r),$a=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ga(e)(t,n,i)},eo=e=>(t,n,r)=>Ga(e)(t,n,r),to=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qa(e)(t,n,i)},no=e=>async(t,n,r)=>qa(e)(t,n,r),ro=/^[cC][0-9a-z]{6,}$/,io=/^[0-9a-z]+$/,ao=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,oo=/^[0-9a-vA-V]{20}$/,so=/^[A-Za-z0-9]{27}$/,co=/^[a-zA-Z0-9_-]{21}$/,lo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,uo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,fo=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,po=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,mo=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function ho(){return new RegExp(mo,`u`)}var go=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_o=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,vo=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,yo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,xo=/^[A-Za-z0-9_-]*$/,So=/^https?$/,Co=/^\+[1-9]\d{6,14}$/,wo=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,To=RegExp(`^${wo}$`);function Eo(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Do(e){return RegExp(`^${Eo(e)}$`)}function Oo(e){let t=Eo({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${wo}T(?:${r})$`)}var ko=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ao=/^-?\d+$/,jo=/^-?\d+(?:\.\d+)?$/,Mo=/^(?:true|false)$/i,No=/^null$/i,Po=/^[^A-Z]*$/,Fo=/^[^a-z]*$/,Io=U(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Lo={number:`number`,bigint:`bigint`,object:`date`},Ro=U(`$ZodCheckLessThan`,(e,t)=>{Io.init(e,t);let n=Lo[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{Io.init(e,t);let n=Lo[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bo=U(`$ZodCheckMultipleOf`,(e,t)=>{Io.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):sa(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Vo=U(`$ZodCheckNumberFormat`,(e,t)=>{Io.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ca[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Ao)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Ho=U(`$ZodCheckMaxLength`,(e,t)=>{var n;Io.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!aa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value;if(r.length<=t.maximum)return;let i=Ia(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Uo=U(`$ZodCheckMinLength`,(e,t)=>{var n;Io.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!aa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ia(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wo=U(`$ZodCheckLengthEquals`,(e,t)=>{var n;Io.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!aa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ia(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Go=U(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Io.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ko=U(`$ZodCheckRegex`,(e,t)=>{Go.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),qo=U(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Po,Go.init(e,t)}),Jo=U(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Fo,Go.init(e,t)}),Yo=U(`$ZodCheckIncludes`,(e,t)=>{Io.init(e,t);let n=ba(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Xo=U(`$ZodCheckStartsWith`,(e,t)=>{Io.init(e,t);let n=RegExp(`^${ba(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Zo=U(`$ZodCheckEndsWith`,(e,t)=>{Io.init(e,t);let n=RegExp(`.*${ba(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Qo=U(`$ZodCheckOverwrite`,(e,t)=>{Io.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),$o=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` +通知:仅在需要我时`,"composer.nextAction":`询问下一步`,"composer.nextActionPrompt":`我现在该做什么?`,"composer.prepareDraft":`填入编辑框,确认后再发送`,"composer.send":`发送`,"composer.sendMessage":`向 LoopX 发送消息`,"composer.sendMessageHint":`发送消息`,"composer.sentImageAlt":`移除图片 {name}`,"conversation.agentPending":`正在整理…`,"conversation.close":`关闭对话回执`,"conversation.convertHint":`将 Agent 最新回复转为 Task 草稿`,"conversation.full":`查看完整对话`,"conversation.receipt":`对话回执`,"conversation.replying":`正在回复`,"conversation.title":`管家对话`,"conversation.toTask":`转为 Task`,"digest.away":`自上次访问以来的运行记录`,"digest.completed":`新增完成运行`,"digest.failed":`新增失败或中断`,"digest.needsYou":`当前待确认`,"feedback.applying":`正在执行:{title}`,"feedback.cancelFailed":`取消失败:{error}`,"feedback.completed":`已完成:{title}`,"feedback.executionFailed":`执行失败:{error}`,"feedback.gateRequired":`需要你确认:{summary}`,"feedback.notCompleted":`操作未完成:{status}`,"feedback.goalRefreshFailed":`已打开 Goal,但暂时无法刷新最新状态。请点击刷新重试。`,"feedback.preparingPreview":`正在准备确认预览:{title}`,"feedback.previewFailed":`无法准备确认预览:{error}`,"feedback.sendFailed":`发送失败:{error}`,"feedback.sendGenericError":`消息发送失败,请稍后重试。`,"feedback.stale":`状态已变化,操作未执行,请重新生成确认预览。`,"feedback.taskDraftCreated":`已根据回复生成 Task 草稿。编辑后发送,LoopX 会先展示确认预览。`,"goal.defaultTitle":`新的个人 Goal`,"goal.initialTodo":`按完成标准推进:{criteria}`,"goal.objectiveBoundary":`执行边界:{boundary}`,"goal.objectiveCompletion":`完成标准:{criteria}`,"drawer.advancedDiagnostics":`高级诊断`,"drawer.agentWorking":`Agent 正在继续执行,记录会自动更新。`,"drawer.analysis":`正在分析`,"drawer.apply":`确认并应用`,"drawer.applying":`正在应用…`,"drawer.attentionBlocking":`正在阻塞 Agent`,"drawer.attentionWaiting":`等待你的决定`,"drawer.autoNotify":`Human-gate 自动通知`,"drawer.branch":`分支`,"drawer.closeDetail":`关闭详情:返回{context}`,"drawer.connected":`已连接`,"drawer.correctionDescription":`消息会沿用当前 Goal、Todo 与 Agent Session 上下文。`,"drawer.correctionLabel":`与 {agent} 纠偏`,"drawer.correctionPlaceholder":`例如:先关注权限风险,暂时不要提交…`,"drawer.correctionSend":`发送纠偏`,"drawer.correctionTextarea":`输入纠偏信息:Goal {goal},Agent {agent},Run {run}`,"drawer.copyRepository":`复制仓库标识`,"drawer.copyRepositoryDone":`已复制仓库标识`,"drawer.copyRepositoryError":`复制失败,请检查浏览器剪贴板权限。`,"drawer.copyRepositorySuccess":`已复制,可粘贴到其他工具。`,"drawer.cost":`成本 24h / 7d`,"drawer.costShort":`成本`,"drawer.durationShort":`时长`,"drawer.period24h":`24 小时`,"drawer.period7d":`7 天`,"drawer.tokens":`Token 24 小时 / 7 天`,"drawer.tokensShort":`Token`,"drawer.usageNotMeasured":`未采集`,"drawer.currentGoal":`当前 Goal`,"attentionDetail.title":`事项说明`,"attentionDetail.request":`需要你做什么`,"attentionDetail.decision":`需要作出决定`,"attentionDetail.unknownRequest":`来源未明确,请先查看来源再判断`,"attentionDetail.open":`当前投影中待处理`,"attentionDetail.closed":`已关闭`,"attentionDetail.deferred":`已推迟`,"attentionDetail.superseded":`已被替代`,"attentionDetail.unknown":`来源未提供状态`,"attentionDetail.unavailable":`来源尚未确认当前事项,请刷新后再操作`,"attentionDetail.unknownReason":`来源尚未提供原因。`,"attentionDetail.targetTodo":`关联的待解锁 Todo`,"attentionDetail.targetAgent":`事项指定的 Agent`,"attentionDetail.scope":`声明的决策范围`,"attentionDetail.notProvided":`来源未提供`,"attentionDetail.replacement":`替代 Todo`,"attentionDetail.openReplacement":`打开替代事项`,"attentionDetail.boundary":`阅读详情不会关闭 gate 或授予权限;作出决定前仍需新的操作预览。`,"drawer.decisionDefaultEvidence":`当前状态没有附加公开安全证据;下一步仍会先展示 Preview。`,"drawer.decisionDefaultReason":`该决定会影响当前 Todo 的下一步执行。`,"drawer.decisionDefer":`稍后决定`,"drawer.decisionMore":`更多决定`,"drawer.decisionReject":`拒绝`,"drawer.decisionReview":`查看影响并决定`,"drawer.dependencies":`依赖`,"drawer.detailsAndActions":`详情与操作`,"drawer.duration":`运行时长 24h / 7d`,"drawer.evidence":`证据`,"drawer.executionHistory":`执行历史`,"drawer.executionRecord":`运行记录`,"drawer.executionRecordAndResult":`执行过程与结果`,"drawer.explainDecision":`解释此决定`,"drawer.gateApproveHint":`在终端执行一条命令即可完成审批:`,"drawer.gateRejectHint":`不同意就把末尾的 approve 换成 reject。执行后这条提醒会自动消失。`,"drawer.gateRequiresHost":`需要宿主确认`,"drawer.gateRequiresHostDescription":`页面无权直接批准这类权限变更,你的点击没有写入任何内容。`,"drawer.goalAutoRun":`当前 Goal 的自动运行`,"drawer.goalChanges":`当前 Goal 的待确认变更`,"drawer.goalDetails":`Goal 详情`,"drawer.group":`群聊`,"drawer.inspectorFull":`切换到全屏`,"drawer.inspectorFullView":`全屏查看`,"drawer.inspectorHalf":`切换到半屏`,"drawer.inspectorHalfView":`半屏查看`,"drawer.lastNotification":`最近通知`,"drawer.larkConfigure":`管理 Lark connection`,"drawer.larkConnect":`连接 Lark App`,"drawer.larkConnection":`Lark connection`,"drawer.larkNotConfigured":`未配置`,"drawer.larkNotConfiguredDescription":`配置后,当这个 Goal 出现需要你确认的变更时,会自动发飞书通知。`,"drawer.managerChanges":`管家待确认变更`,"drawer.moreActions":`更多操作`,"drawer.moreRunActions":`更多运行操作`,"drawer.nextTransition":`下一转换`,"drawer.noExecutionHistory":`暂无执行记录。`,"drawer.noRun":`尚未启动执行 Session`,"drawer.noRunDescription":`Agent 开始执行后,运行记录会稳定显示在这里。`,"drawer.notAssigned":`未分配`,"drawer.notLinked":`未关联`,"drawer.notSet":`未设置`,"drawer.outputDetails":`产出详情`,"drawer.outputRecorded":`该产出已记录到当前 Goal。`,"drawer.outputSafePreview":`公开安全产出预览`,"drawer.outputRun":`Run`,"drawer.outputTodo":`Todo`,"drawer.outputs":`本次运行产出`,"drawer.previewUnavailable":`此产出没有可用的公开安全内联预览。`,"drawer.priority":`优先级`,"drawer.progress":`进度`,"drawer.proposalApplied":`已应用,LoopX 状态将刷新。`,"drawer.proposalApplyFailed":`应用失败,没有写入任何变更。`,"drawer.proposalApplyFailedHint":`请刷新 Goal 状态后重新生成;若仍失败,可保留此页并查看高级诊断。`,"drawer.proposalClose":`关闭`,"drawer.proposalDefer":`稍后`,"drawer.proposalDeferred":`已暂缓,可稍后继续应用或重新生成。`,"drawer.proposalEnterGoal":`进入新 Goal`,"drawer.proposalExplainer":`确认后,LoopX 会执行这项变更并显示写入结果。关闭或取消不会修改任何状态。`,"drawer.proposalRecheck":`按最新状态重新检查`,"drawer.proposalRegenerate":`基于最新状态重试`,"drawer.proposalRejected":`已拒绝,这项变更不会写入。`,"drawer.proposalStale":`来源状态已变化,请按最新状态重新检查。`,"drawer.proposalViewGoal":`查看更新后的 Goal`,"drawer.reassign":`改派给`,"drawer.reassignSummary":`重新分配:{task}`,"drawer.reason":`原因`,"drawer.recoveryDescription":`本地历史已经保留,请选择恢复路径。`,"drawer.recoveryFailed":`上游 Session 恢复失败`,"drawer.recoveryNewSession":`携带上下文开始新 Session`,"drawer.recoveryRetry":`重试恢复`,"drawer.repositoryRole":`执行工作区`,"drawer.repository":`仓库`,"drawer.replyMode":`回复方式`,"drawer.subagentApplied":`已写入,并通过共享 Goal 状态读回校验。`,"drawer.subagentAppliedRefreshFailed":`已写入并通过共享 Goal 状态读回;状态投影刷新失败,可稍后手动刷新。`,"drawer.subagentApplying":`正在写入并校验共享状态读回…`,"drawer.subagentApplyFailed":`子代理设置写入失败。`,"drawer.subagentChildLimit":`当前上限`,"drawer.subagentConfirmDisable":`确认关闭子代理执行`,"drawer.subagentConfirmEnable":`确认开启子代理执行`,"drawer.subagentCurrentBoundary":`当前任务领域限制`,"drawer.subagentDescription":`仅在 Todo、配额、能力和写入范围门禁全部通过后,允许运行时为相互独立的任务临时创建子代理;不会强制并行,也不会授予持久权限。`,"drawer.subagentDisable":`预览关闭子代理执行`,"drawer.subagentDisableSummary":`这个 Goal 将不再创建新的子代理;现有 Todo 归属和执行记录不受影响。`,"drawer.subagentDomainInvalid":`所选任务领域限制无效。`,"drawer.subagentDomainTodoCount":`匹配 {count} 个开放 Todo`,"drawer.subagentDomains":`任务领域限制(可选)`,"drawer.subagentDomainsEmpty":`当前没有开放的 advancement Todo 声明 task_domain;保持为空即可不按任务领域限制子代理执行。`,"drawer.subagentDomainsHint":`全部不选表示不按任务领域过滤;选择后只放行匹配且已声明领域的 Todo,其他执行门禁始终生效。`,"drawer.subagentDomainsUnrestricted":`不限制任务领域`,"drawer.subagentEnable":`预览开启子代理执行`,"drawer.subagentLabel":`Per-Goal 执行边界`,"drawer.subagentModel":`子 Agent 模型`,"drawer.subagentEffort":`子 Agent 推理档位`,"drawer.subagentModelDefault":`宿主默认`,"drawer.subagentLunaPreset":`使用 Luna / max`,"drawer.subagentClearModel":`清除模型偏好`,"drawer.subagentModelHint":`填写后通过“预览配置调整”保存,执行关闭时也可保存偏好;启动时须核验宿主支持情况。`,"drawer.subagentModelRequired":`设置推理档位前请先指定子 Agent 模型。`,"drawer.subagentMaxChildren":`最多子代理数`,"drawer.subagentNoChange":`当前 Goal 已是这个设置,没有写入任何内容。`,"drawer.subagentPending":`待确认`,"drawer.subagentPreviewBoundary":`预览配置调整`,"drawer.subagentPreviewFailed":`无法生成子代理设置预览。`,"drawer.subagentPreviewing":`正在核对最新 Goal 状态…`,"drawer.subagentPreviewReady":`预览已锁定,确认后才会写入这个 Goal。`,"drawer.subagentPreviewSummary":`最多允许创建 {count} 个子代理;任务领域限制:{domains}。`,"drawer.subagentRemoteReadOnly":`当前来源只读,请在 Goal 所在主机上修改。`,"drawer.subagentTitle":`自适应子代理执行`,"drawer.remoteDetailsDescription":`SSH 来源只展示公开安全状态,不读取来源主机上的连接配置。`,"drawer.remoteDetailsUnavailable":`远端详情未投影`,"drawer.resumeNo":`否`,"drawer.resumeYes":`是`,"drawer.runDetails":`执行 Session`,"drawer.runInterrupt":`中断本次运行`,"drawer.runLatest":`查看最近执行过程`,"drawer.runNewSession":`开始新 Session`,"drawer.runCloseSession":`关闭 Session`,"drawer.runRecordEmpty":`还没有运行记录。Agent 尚未开始这次执行;请在“详情与操作”查看等待条件或恢复 Session。`,"drawer.runRecordProjected":`当前没有可展示的逐步运行记录。LoopX 已读取到 {completed}/{total} 的投影进度{outputs};请在“详情与操作”检查 Session 状态。`,"drawer.runRecordProjectedOutputs":`和 {count} 项产出`,"drawer.runRoleAssistant":`已完成`,"drawer.runRoleSystem":`需检查`,"drawer.runRoleUser":`收到任务`,"drawer.runView":`Session 视图`,"drawer.scheduleAdd":`添加定时检查`,"drawer.scheduleDefaultNotification":`仅在需要你时通知`,"drawer.scheduleDefaultStop":`Goal 完成或 owner 停止`,"drawer.scheduleDefaultTarget":`由 LoopX 调度器按 Goal 配置唤醒。`,"drawer.scheduleEdit":`改为每 2 小时`,"drawer.scheduleLast":`上次执行`,"drawer.scheduleLocalTimezone":`本地时区`,"drawer.scheduleNext":`下次执行`,"drawer.scheduleNeverRun":`尚未执行`,"drawer.scheduleNotification":`通知`,"drawer.schedulePause":`暂停`,"drawer.schedulePending":`等待调度`,"drawer.scheduleResume":`恢复`,"drawer.scheduleRunNow":`立即运行`,"drawer.scheduleStop":`停止{kind}`,"drawer.scheduleStopCondition":`停止条件`,"drawer.scheduleTimezone":`时区`,"drawer.sessionRecoverable":`可恢复`,"drawer.sessionStatus":`会话状态`,"drawer.setupHeartbeat":`设置 Heartbeat`,"drawer.taskActions":`Todo 待确认操作`,"drawer.taskAdvancement":`推进任务`,"drawer.taskBlock":`标记阻塞`,"drawer.taskComplete":`标记完成`,"drawer.taskCompletedNote":`该任务保留为只读记录。`,"drawer.taskCompletedTitle":`任务已完成`,"drawer.taskDefer":`暂缓`,"drawer.taskDeferCondition":`Todo 暂缓恢复条件`,"drawer.taskDeferInvalid":`条件格式不受支持;请使用下列可判定条件。`,"drawer.taskDeferPlaceholder":`例如 resume_at:2026-09-14T09:00:00+08:00`,"drawer.taskDeferReview":`检查暂缓`,"drawer.taskDeferSupported":`支持 todo_done、pr_merged、capacity_available 与带时区的 resume_at 条件。`,"drawer.taskDeferUntil":`暂缓至`,"drawer.taskDetails":`Todo 详情`,"drawer.taskInfo":`任务信息`,"drawer.taskManage":`管理任务`,"drawer.taskNextCompleted":`可创建后续任务`,"drawer.taskNextOpen":`推进或更新状态`,"drawer.taskOrdinary":`普通任务`,"drawer.taskStatusBlocked":`受阻`,"drawer.taskStatusDeferred":`已延期`,"drawer.resumeWhen":`恢复条件`,"drawer.resumeState":`恢复状态`,"drawer.resumePending":`等待条件满足`,"drawer.resumeReady":`可恢复`,"drawer.resumeReceipt":`恢复回执`,"drawer.taskNextDeferred":`等待恢复条件满足后重新评估`,"drawer.taskNextResumeReady":`恢复条件已满足,等待生命周期重新规划`,"drawer.taskStatusCompleted":`已完成`,"drawer.taskStatusOpen":`待执行`,"drawer.taskSuccessor":`创建后续 Todo`,"drawer.taskSuccessorNote":`Owner 标记为阻塞,等待补充上下文。`,"drawer.taskSuccessorSummary":`创建后续 Todo:{task}`,"drawer.taskSuccessorText":`{task} 的后续工作`,"drawer.taskType":`任务类型`,"drawer.topic":`Topic`,"drawer.trigger":`触发方式`,"drawer.titleAttention":`需要你`,"drawer.titleOutput":`产出详情`,"drawer.titleProposalApplied":`执行结果`,"drawer.titleProposalConfirm":`确认执行`,"drawer.titleSchedule":`定时检查`,"drawer.unconfigured":`未配置`,"drawer.workspaceCandidates":`可选择的工作区`,"files.emptySummary":`公开安全产出`,"files.empty":`还没有文件、产出或已验证的阶段周报。`,"files.loadingReports":`正在加载已验证的阶段周报…`,"files.reportDelta":`+{added} 新增 · {changed} 变化`,"files.reportAdded":`新增`,"files.reportChanged":`变化`,"files.reportGeneration":`生成批次`,"files.reportLoadFailed":`无法加载已验证周报`,"files.reportPublication":`发布批次`,"files.title":`Files & Outputs`,"files.verifiedReport":`已验证阶段周报`,"header.agentUnavailable":`不可用`,"header.chatRuntime":`Chat`,"header.workAgentCount":`{count} 个工作 Agent`,"header.chat":`Chat`,"header.files":`Files`,"header.goalCapabilities":`能力配置`,"header.goalCapabilitiesDescription":`管理 Goal override 与继承的本机默认值。`,"header.goalDetails":`Goal 详情`,"header.goalDetailsDescription":`查看状态、用量、仓库、通知与 Session。`,"header.goalSettings":`Goal 设置`,"header.goalSettingsDescription":`打开 Goal 详情或能力配置`,"header.goalNavigation":`Goal 导航`,"header.goalView":`Goal 视图`,"header.live":`实时`,"header.manager":`LoopX 管家`,"header.managerDescription":`跨 Goal 的个人工作入口`,"header.managerRuntime":`{profile} · {sandbox}`,"header.managerRuntimeFallback":`配置无效,已回退到 {profile} · {sandbox};请在机器能力设置中修复。`,"header.managerOverview":`总览`,"header.managerView":`管家视图`,"header.openGoalNavigation":`打开 Goal 导航`,"header.readOnlySourceDescription":`{source} 通过 SSH 隧道只读展示`,"header.refresh":`刷新状态`,"header.refreshDone":`刚刚更新`,"header.refreshFailed":`刷新失败`,"header.refreshing":`刷新中`,"header.selectAgent":`选择 Agent`,"header.selectChatRuntime":`选择聊天 Runtime`,"header.tasks":`Tasks`,"header.themeBrutal":`切换到野兽主题`,"header.themePaper":`切换到默认主题`,"home.blockingSummary":`其中 {count} 项正在阻塞 Agent。`,"home.completedGoals":`已完成的 Goal`,"home.empty":`当前没有`,"startup.goalLoading":`正在加载状态…`,"startup.goalError":`状态加载失败`,"startup.progress":`已加载 {loaded} / {total} 个活跃 Goal`,"startup.partial":`Goal 状态正在逐个更新,当前统计尚不完整。`,"startup.independent":`此 Goal 的加载不会阻塞其他 Goal,你可以先查看已加载的内容。`,"startup.error.timeout":`读取超时,可在本地服务就绪后重试。`,"startup.error.network":`连接中断,请重试以重新连接。`,"startup.error.service":`Goal 状态读取失败。请稍后重试;若问题持续,请检查状态来源。`,"startup.error.access":`状态来源无法访问此 Goal 所需的文件或运行时目录。请检查该来源运行账户的访问权限,修复后重试。`,"startup.error.revision":`加载期间 Goal 目录发生变化,请刷新以同步。`,"startup.error.scope":`该 Goal 已不在当前来源中,请刷新目录。`,"startup.error.invalid":`无法解析状态响应,请刷新或检查 LoopX 更新。`,"startup.retry":`重试`,"startup.retryFailed":`重试失败的 Goal`,"startup.failedCount":`{count} 个 Goal 加载失败,已加载的 Goal 可继续使用。`,"home.greeting":`你好,我是 LoopX 管家`,"home.history":`历史`,"home.lane.needsYou":`需要你`,"home.lane.needsYouDescription":`等待你的决定、授权或补充信息`,"home.lane.observing":`观察中`,"home.lane.observingDescription":`持续监控,出现变化时再提醒你`,"home.lane.running":`执行中`,"home.lane.runningDescription":`Agent 正在推进并持续回传进展`,"home.lane.scheduled":`已安排`,"home.lane.scheduledDescription":`已经安排,等待时间或前置条件`,"home.noActivity":`尚无活动`,"home.noFirstActivity":`等待首次活动`,"home.noCompletedGoals":`还没有已完成的 Goal`,"home.preservedState":`保留状态,可随时恢复`,"home.stopped":`已停止`,"home.systemHealth":`系统健康:{summary}`,"home.taskCount":`{count} 个 Task`,"home.todayAt":`今天 {time}`,"home.waitingCount":`你有 {count} 项需要处理。`,"home.workspace":`Goal 工作区`,"lark.allMessages":`此 Topic 中的所有消息`,"lark.allTopicMessages":`所有 Topic 消息`,"lark.agentIngress":`Agent 入站方式`,"lark.agentAppPermissions":`每个选中的 Agent 都需要一个已具备群聊提及和回复能力的 Lark App。`,"lark.agentApps":`每个 Agent 的 Lark App`,"lark.agentAppsDescription":`默认使用上方 App;需要独立机器人身份时,可为 Agent 选择另一个兼容 App。`,"lark.agentAppSelection":`{agent} 的 Lark App`,"lark.appCreated":`App 已创建`,"lark.appCreateFailed":`创建失败`,"lark.appLoading":`正在加载可用的 Lark Apps…`,"lark.appPermissions":`该 App 能发送建联消息,但缺少接收群聊 @ 消息或自动回复所需的机器人权限。请开启 im:message.group_at_msg:readonly、im:message.send_as_bot 和事件 im.message.receive_v1,发布新版后刷新。`,"lark.appProfile":`Lark App`,"lark.apps":`Lark Apps`,"lark.autoReplyUnavailable":`自动回复暂不可用`,"lark.autoReplyReady":`自动回复可用`,"lark.bindGoal":`绑定到 Goal`,"lark.cancel":`取消`,"lark.cardinality":`一个 Lark App · 多个 Goal · 每个 Agent 一条隔离路由`,"lark.capture":`接收范围`,"lark.captureAddressed":`仅接收提及 App 或回复 App 的消息`,"lark.captureAll":`接收此 Goal Topic 中的所有消息`,"lark.captureScope":`接收范围`,"lark.captureScopeDescription":`决定哪些 Topic 消息会进入 LoopX;不会扩大 Agent 权限。`,"lark.closeConnection":`关闭连接弹窗`,"lark.closeCreate":`关闭创建弹窗`,"lark.closeSettings":`关闭 Lark 设置`,"lark.connect":`连接`,"lark.connectAllAgents":`连接全部已注册 Agent`,"lark.connectAllAgentsAction":`一键连接 {count} 个 Agent`,"lark.connectAllAgentsDescription":`一次引导创建 {count} 个隔离的 Agent Topic;请在对应 Topic 内发送请求,每个 Agent 保留独立路由和收件箱。`,"lark.connectApp":`连接 Lark App`,"lark.connection":`连接`,"lark.connections":`连接`,"lark.configuration":`Lark 配置`,"lark.continueFeishu":`在飞书中继续`,"lark.createAutomatically":`自动创建 Goal Topic`,"lark.createAutomaticallyDescription":`将为每个选中的 Agent 创建带 Agent 标识的专属 Topic。`,"lark.defaultAgentAppDescription":`用于查找目标群聊,并作为所有选中 Agent 的默认 App;下方的逐 Agent 选择可覆盖它。`,"lark.description":`管理可复用的 Lark App,并用独立 Topic 将群聊连接到 Goal。`,"lark.editConnection":`编辑 Lark 连接`,"lark.goalConnections":`{count} 个 Goal 连接`,"lark.goalTopicConnections":`Lark Goal Topic 连接`,"lark.groupChat":`群聊`,"lark.groupEmpty":`该机器人尚未加入可连接的群。请先在飞书群设置中添加这个机器人,再回来刷新或搜索。`,"lark.groupLoading":`正在读取该机器人已加入的群…`,"lark.groupSearch":`搜索该机器人已加入的群`,"lark.historyPermission":`历史补读权限(独立能力)`,"lark.health.contextCaptured":`已捕获群聊上下文`,"lark.health.contextCapturedDetail":`该消息仅作为非权威上下文保留,不会启动或引导管家 Turn;需要执行时请直接 @ 机器人或回复机器人的消息。`,"lark.health.eventProcessed":`已处理 {events} 条事件,成功回复 {replies} 条。`,"lark.health.eventUnverified":`事件订阅待验证`,"lark.health.eventUnverifiedDetail":`Provider listener 已就绪,但尚未收到消息事件。请启用 im.message.receive_v1、开通群聊 @ 消息权限并发布新版,然后在这个 Agent Topic 内发送新的 @ 消息;存在多条 Agent 路由时,群顶层消息会 fail closed。`,"lark.health.ignoredSelf":`已忽略机器人自身发送的消息,避免重复回复。`,"lark.health.invalidRouting":`路由配置无效`,"lark.health.invalidRoutingDetail":`连接已安全停用,请重新选择处理方式并保存。`,"lark.health.lastStatus":`最近事件状态:{status}`,"lark.health.listening":`监听中`,"lark.health.messageContextPermission":`消息权限不足`,"lark.health.messageContextPermissionDetail":`已收到消息事件,但无法读取群消息上下文。请发布并授权该 App 的群消息读取权限。`,"lark.health.notAddressed":`最近消息未直接 @ 机器人`,"lark.health.notAddressedDetail":`监听正常;当前连接只响应直接 @ 机器人或对机器人的回复。`,"lark.health.notStarted":`监听未启动`,"lark.health.notStartedDetail":`请刷新连接或重新启动 LoopX 后再试。`,"lark.health.processingFailed":`消息处理失败`,"lark.health.processingFailedDetail":`已收到消息事件,但 Agent 处理失败。请查看本地诊断后重试。`,"lark.health.queued":`已进入 Agent 收件箱`,"lark.health.queuedDetail":`消息由 {agent} 异步处理,不会启动通用 Chat Session。`,"lark.health.sourceDisconnected":`实时消息连接断开`,"lark.health.sourceDisconnectedDetail":`消息监听进程意外退出。请核对应用档案的平台:飞书应用选飞书,国际版 Lark 应用选 Lark,再检查连接及订阅错误。LoopX 正在重试;历史消息能读取,不代表能实时收消息。`,"lark.health.retrying":`监听重试中`,"lark.health.retryingDetail":`事件监听暂时中断,LoopX 正在自动重试。`,"lark.health.routeAmbiguous":`消息匹配多个 Goal`,"lark.health.routeAmbiguousDetail":`同一 Bot 和群聊存在多个完整群捕获连接。请让每个 Agent 使用独立 Bot,或只保留一个完整群连接。`,"lark.health.routeMismatch":`消息未匹配当前 Goal Topic`,"lark.health.routeMismatchDetail":`事件来自其他群聊或 Topic。请重新选择群聊并连接该 Goal,然后发送一条新的 @ 消息。`,"lark.health.routeUnavailable":`消息无法路由到 Goal`,"lark.health.routeUnavailableDetail":`当前连接信息不完整。请重新连接该 Goal 后再发送一条新的 @ 消息。`,"lark.health.starting":`正在启动`,"lark.health.startingDetail":`LoopX 正在启动该 App 的消息事件监听。`,"lark.health.unavailable":`自动回复不可用`,"lark.health.waiting":`等待处理`,"lark.incomingMessages":`接收消息`,"lark.ingressAsync":`异步收件箱`,"lark.ingressAsyncDescription":`写入 Agent 私有收件箱,等待后续显式处理。`,"lark.editPreservesIdentity":`保存会保留此 App、群和 Topic;旧连接默认升级为 Agent 异步收件箱。`,"lark.conversationKind":`连接用途`,"lark.managerConversation":`管家 · 同步对话`,"lark.workerConversation":`工作 Agent · 后台任务`,"lark.managerConversationDescription":`内置管家即时回应对话,长任务交给后台 Agent。群聊与私聊分别保存上下文。`,"lark.ingressLegacy":`待升级`,"lark.ingressLegacyDescription":`保存连接即可升级为 Agent 异步收件箱,已有消息保留在原 Topic 中。`,"lark.ingressQueue":`排队`,"lark.ingressQueueDescription":`进入同一 Agent Session 的有界 FIFO 队列,当前 Turn 完成后处理。`,"lark.ingressSteering":`实时引导`,"lark.ingressSteeringDescription":`投到当前活跃 Turn;没有精确活跃 Turn 时安全拒绝。`,"lark.loading":`加载 Lark 配置…`,"lark.management":`Lark 管理`,"lark.openEventSettings":`查看飞书事件配置`,"lark.mentions":`提及机器人`,"lark.mentionsOnly":`仅提及消息`,"lark.needsMessagePermissions":`需要消息权限`,"lark.needsSetup":`需要设置`,"lark.newApp":`新建 Lark App`,"lark.noAgentConfigured":`未配置 Agent`,"lark.noConnections":`暂无匹配的连接。`,"lark.noProfiles":`还没有可用的 lark-cli App profile。`,"lark.profileName":`Profile 名称`,"lark.profileValidation":`Profile 只能包含字母、数字、点、下划线和连字符。`,"lark.processing":`处理方式`,"lark.region":`区域`,"lark.registerAnother":`+ 注册另一个 Lark App — 通过飞书创建`,"lark.reopenFeishu":`重新打开飞书`,"lark.settingsConfigure":`配置 {goal}`,"lark.settingsDisconnect":`解绑 {goal}`,"lark.replyMode":`回复方式`,"lark.replyModeDescription":`当前只支持在来源 Topic 内回复,避免跨群或跨 Goal 投递。`,"lark.reusableApps":`{count} 个可复用 App`,"lark.reusableWorkspaceApp":`可复用工作区 App`,"lark.routesUnverified":`{count} 条 Lark 路由尚未验证`,"lark.saveConnection":`保存连接`,"lark.searchConnections":`搜索 Lark 连接`,"lark.searchPlaceholder":`搜索 App、群、Goal 或 Topic`,"lark.setupCopy":`LoopX 将通过 lark-cli 打开飞书官方创建页面。应用凭证保存在系统 Keychain,LoopX 只保留 profile 引用。`,"lark.someoneMentions":`有人提及 Agent`,"lark.targetAgent":`目标 Agent`,"lark.targetAgentDescription":`选择该 Goal 内已注册的 Agent。此连接只投递给一个 Agent,不广播、不授予新权限。实时引导与排队需要该 Agent 的精确活跃 Session。`,"lark.agentUnavailable":`{agent} · 已不可用`,"lark.selectRegisteredAgent":`请先选择可用的已注册 Agent;不会自动替换原先的接收者。`,"lark.topicPreview":`Topic 预览`,"lark.topicReply":`Topic 回复`,"lark.trigger":`触发方式`,"lark.waitingFeishu":`等待飞书完成创建`,"lark.waitingFeishuDescription":`请在新窗口中完成飞书授权,完成后会自动回到这里。`,"lark.waitingLink":`正在生成飞书官方创建链接…`,"lark.error.appCreate":`Lark App 创建失败`,"lark.error.appRequired":`请选择一个 Lark App profile。`,"lark.error.bind":`绑定失败`,"lark.error.bindPreview":`绑定预览失败`,"lark.error.configuration":`Lark 配置加载失败`,"lark.error.groupLookup":`无法读取该机器人已加入的群。请检查机器人状态后重试。`,"lark.error.groupLoad":`群聊加载失败`,"lark.error.invalidApp":`Lark App profile 不可用或尚未完成授权。`,"lark.error.messagePermissions":`该 App 缺少自动回复所需的机器人权限。请开启 im:message.group_at_msg:readonly 和 im:message:send_as_bot,发布新版后回来刷新重试。`,"lark.error.provider":`飞书 API 调用失败,且没有生成已验证回执。请稍后重试。`,"lark.error.setupPoll":`创建状态查询失败`,"lark.error.setupStart":`无法启动 Lark App 创建流程`,"lark.error.cliExecutable":`已找到配置的 lark-cli,但当前无法执行。请检查安装或启动参数。`,"lark.error.cliMissing":`未发现 lark-cli。请先安装 lark-cli,然后重新启动 LoopX。`,"lark.error.cliStart":`lark-cli 启动失败。请检查安装状态,然后重新启动 LoopX。`,"lark.error.disconnect":`解绑失败`,"notifications.autoNotify":`需要你确认时自动推送到群里`,"notifications.bind":`绑定到通知群`,"notifications.bindConfirm":`将把「{goal}」绑定到通知群「{target}」,绑定时会验证机器人在群内并发送一条确认消息。`,"notifications.bindFailed":`绑定失败`,"notifications.bound":`已绑定`,"notifications.confirmBind":`确认绑定`,"notifications.description":`把 Goal 里需要你确认的变更推送到飞书群。绑定和开关在这里完成,推送逻辑沿用现有通道。`,"notifications.disabled":`已停用`,"notifications.group":`通知群:{target}`,"notifications.loadFailed":`通知群列表加载失败`,"notifications.noTargets":`还没有可用的通知群。通知群涉及机器人私有身份,请先在终端配置一次:`,"notifications.notBound":`未绑定`,"notifications.recent":`最近 {time}`,"notifications.sentCount":`已发送 {count} 条`,"notifications.settings":`Goal 通知绑定`,"notifications.setupFailed":`设置失败`,"notifications.title":`飞书群通知`,"proposal.field.agentId":`Agent`,"proposal.field.cadence":`频率`,"proposal.field.completionCriteria":`完成标准`,"proposal.field.executionBoundary":`执行边界`,"proposal.field.goalId":`Goal ID`,"proposal.field.heartbeat":`Heartbeat`,"proposal.field.initialTodos":`首个任务`,"proposal.field.objective":`目标`,"proposal.field.operation":`操作`,"proposal.field.operationState":`操作状态`,"proposal.field.resultDelivery":`结果回传`,"proposal.field.confirmationBoundary":`确认边界`,"proposal.field.expiresAt":`过期时间`,"proposal.field.permission":`权限`,"proposal.field.reason":`原因`,"proposal.field.stopCondition":`停止条件`,"proposal.field.target":`检查内容`,"proposal.field.timezone":`时区`,"proposal.field.title":`标题`,"proposal.field.workspace":`执行工作区`,"actionReview.targetChanged":`预览目标与请求的 Goal 或操作不一致,请重新生成预览。`,"actionReview.ready_stop":`暂停可恢复。此预览已通过检查,可直接执行;完成仍需要读回验证。`,"actionReview.resume_review":`恢复自动调度前需要确认。实际执行仍受额度、Gate 和 Todo 约束。`,"actionReview.delete_review":`请确认从注册表移除这个已停止 Goal。项目文件与历史记录会保留。`,"actionReview.action_review":`执行前请检查此提案的目标与影响。`,"actionReview.protected_action":`此操作需要明确审阅。确认不能替代所需授权。`,"actionReview.unknown_permission":`无法识别权限分类。请重新检查提案后再继续。`,"actionReview.unknown_action":`无法识别此生命周期操作。请重新检查提案后再继续。`,"actionReview.incomplete_proposal":`预览缺少验证信息或可执行转换。请重新生成预览。`,"actionReview.authority_gate":`Gate 阻止执行。请满足其要求后重新检查提案。`,"actionReview.stale_proposal":`来源状态已变化。请重新生成预览,原决定不再适用。`,"actionReview.apply_pending":`正在执行,请等待读回结果后再重试。`,"actionReview.readback_verified":`操作已完成,结果状态已通过读回验证。`,"actionReview.readback_unverified":`操作返回但未通过读回验证。尚不能确认完成,请重新检查状态。`,"actionReview.operation_group_confirmation":`这份精确请求只能在已绑定飞书群的原始卡片确认;Dashboard 不提供本地执行入口。`,"actionReview.operation_result_delivery_pending":`操作结果已经记录,但原群结果卡尚未通过回读核验。`,"actionReview.apply_failed":`执行未完成。请检查失败原因并重新生成预览后再试。`,"actionReview.inactive_proposal":`此提案当前不可执行。请重新检查后再继续。`,"proposal.gate.default":`需要宿主确认`,"proposal.impact.default":`确认后会调用规范 LoopX 服务写入状态。`,"proposal.impact.goalCreate":`确认后会创建 Goal 和首个 Todo,并让选定 Agent 开始首轮推进。`,"proposal.impact.lifecycleDelete":`确认后会从 source registry 和 global registry 移除这个已停止 Goal;项目文件、历史状态文件和备份不会被删除。`,"proposal.impact.lifecycleResume":`确认后会恢复 Goal 的自动调度资格并移回 Active Goals;实际执行仍受 quota、Gate 和 Todo 约束。`,"proposal.impact.lifecycleStop":`确认后会停止自动推进,并将 Goal 移入折叠的「已停止」列表;历史、Todo 和证据都会保留,可随时恢复。`,"proposal.impact.protected":`该操作需要通过受保护的 LoopX 写入服务完成。`,"proposal.impact.operation":`这里仅展示同一份不可变条款。请在已绑定的飞书群确认或拒绝;确认只会消费一个规范 claim。`,"proposal.primary.apply":`确认并应用`,"proposal.primary.goalCreate":`创建 Goal 并开始首轮`,"proposal.primary.lifecycleDelete":`删除 Goal`,"proposal.primary.lifecycleResume":`恢复 Goal`,"proposal.primary.lifecycleStop":`停止 Goal`,"proposal.primary.todoStart":`创建任务并开始执行`,"proposal.primary.operationGroup":`前往飞书群确认`,"proposal.primary.operationResultPending":`结果卡回传待恢复`,"proposal.primary.operationResultVerified":`结果已核验`,"proposal.resultDelivery.verified":`已在原群卡片完成回读核验`,"proposal.resultDelivery.pending":`等待回传并核验原群卡片`,"proposal.summary.goalCreate":`创建 Goal:{title}`,"proposal.summary.heartbeat":`为当前 Goal 设置 Heartbeat`,"proposal.summary.lifecycleDelete":`删除 Goal:{title}`,"proposal.summary.lifecycleResume":`恢复 Goal:{title}`,"proposal.summary.lifecycleStop":`停止 Goal:{title}`,"proposal.summary.monitor":`为当前 Goal 创建定时检查:{target}`,"proposal.workspace.current":`当前本地工作区(未绑定 Repository)`,"proposal.workspace.named":`{workspace}(仅提供执行环境,不会自动关联仓库)`,"proposal.workspaceGate.agentImpact":`先完成 Agent 身份绑定,再重新检查原操作;当前没有写入 Goal。`,"proposal.workspaceGate.agentTitle":`先绑定 Agent`,"proposal.workspaceGate.defaultSummary":`请选择 Goal 所属工作区。`,"proposal.workspaceGate.selectionImpact":`选择工作区后会重新展示待确认操作,选择本身不会写入状态。`,"proposal.workspaceGate.selectionTitle":`选择 Goal 工作区`,"projection.agentAdvancingGoal":`Agent 正在推进当前 Goal`,"projection.agentIdle":`暂无需要你处理`,"projection.agentNeedsDecision":`Agent 等待你的决定`,"projection.agentPreparingNextStep":`Agent 正在整理下一步`,"projection.agentStopped":`已由你停止;历史、Todo 和证据仍保留`,"projection.agentWaitingExternal":`正在等待外部条件`,"projection.confirmAgentDecision":`请确认 Agent 下一步需要的权限或决策`,"projection.events24h":`24 小时内 {count} 个事件`,"projection.firstReadOnlyAdapterCheck":`执行首次只读适配检查并保存进度`,"projection.goalVerified":`Goal 状态、Todo 与注册信息已验证`,"projection.latestRun":`最近运行`,"projection.latestValidation":`最近验证`,"projection.nextUpdatePending":`等待 LoopX 更新下一步`,"projection.publicSafeProjection":`公开安全状态投影`,"projection.refreshState":`刷新 LoopX 状态,确认当前进度仍然有效`,"projection.runEvidenceAvailable":`存在可查看的运行证据`,"projection.runRecorded":`最近一次 LoopX 运行已经记录`,"projection.statusRefreshNeeded":`LoopX 状态需要刷新`,"projection.todoStatusUpdated":`Todo 状态已经更新,正在确认下一步`,"projection.validationRecorded":`最近验证已经记录`,"runs.completed":`已完成`,"runs.failed":`需检查`,"runs.interrupted":`已中断`,"runs.queued":`已安排`,"runs.ready":`可继续`,"runs.resumeFailed":`恢复失败`,"runs.running":`执行中`,"runs.unknown":`状态未知`,"runs.waiting":`等待条件`,"schedule.active":`执行中`,"schedule.heartbeat":`Goal Heartbeat`,"schedule.monitor":`定时与持续任务`,"schedule.paused":`已暂停`,"schedule.summary":`按 LoopX 调度约束持续检查`,"schedule.defaultTarget":`检查当前 Goal 的阻塞、进度与新产出`,"schedule.unsupportedCalendar":`当前定时检查不支持精确到星期或时刻的日历计划。请改用固定间隔,例如“每 30 分钟”“每 2 小时”或“每天”;草稿已保留,没有生成待确认操作。`,"source.add":`添加来源`,"source.addConfigured":`添加只读来源`,"source.addMethod":`来源添加方式`,"source.addSsh":`添加 SSH 隧道来源`,"source.closeForm":`关闭来源表单`,"source.configured":`已配置 SSH`,"source.configuredCount":`本机 SSH Host · {count} 个`,"source.configuredGroup":`已配置 SSH Host · {count}(点击快速添加)`,"source.connected":`已连接`,"source.connecting":`连接中`,"source.controlPlane":`控制面来源`,"source.copy":`复制`,"source.copyCommand":`复制 SSH 隧道命令`,"source.copyError":`无法复制命令,请手动复制下方命令。`,"source.copied":`已复制`,"source.description":`已读取全部显式 Host(含 Include);通配规则不会作为具体来源。先运行命令,LoopX 不读取密钥或配置细节。`,"source.host":`本机 SSH Host`,"source.hostEmpty":`~/.ssh/config 中没有可直接选择的显式 Host。`,"source.hostLoadError":`无法读取本机 SSH Host。`,"source.hostPlaceholder":`输入或搜索 Host`,"source.invalid":`SSH 来源参数无效。`,"source.loadingHosts":`正在读取…`,"source.localInteractive":`本机交互`,"source.localPort":`本地端口`,"source.manual":`手动 URL`,"source.manualDescription":`远端来源始终按只读投影处理,不继承本机写权限。`,"source.name":`名称`,"source.namePlaceholder":`远程开发机`,"source.notAvailable":`不可用`,"source.readOnly":`SSH 隧道 · 只读`,"source.readOnlyNoticeDescription":`你可以查看 Goal、Task、证据与运行状态;写入、纠偏和 Agent 会话仍留在来源主机。`,"source.readOnlyNoticeTitle":`远端只读投影`,"source.readOnlyWriteError":`远端 SSH 隧道来源是只读投影,不能执行控制面写入。`,"source.refreshHosts":`重新读取 SSH Host`,"source.remove":`移除来源 {source}`,"source.removeCurrent":`移除当前来源`,"source.select":`选择控制面来源`,"source.selectHost":`请选择已配置的 SSH Host。`,"source.statusUrl":`本地转发 URL`,"source.tunnelCommandPending":`选择 Host 后生成隧道命令`,"machine.absent":`尚未配置`,"machine.action.create":`创建机器策略`,"machine.action.delete":`移除机器策略`,"machine.action.unchanged":`无需写入`,"machine.action.update":`更新机器策略`,"machine.applied":`机器策略已应用,并通过回读校验。`,"machine.applyError":`无法应用机器策略。`,"machine.applyPreview":`应用已审阅预览`,"machine.changedNamespaces":`变更的 Namespace`,"machine.capabilityCatalog":`机器能力目录`,"machine.capabilityEmpty":`当前没有注册可在机器作用域配置的能力。`,"machine.configured":`已配置`,"machine.confirmRollback":`确认回滚`,"machine.currentRevision":`当前 Revision`,"machine.currentValue":`当前机器值`,"machine.description":`与 Goal 设置共用能力目录。在这里管理受支持的机器默认值;仅支持 Goal 配置的能力会明确标注。`,"capabilities.rawJson":`高级:原始 JSON`,"machine.goalOnly":`此能力目前仅支持 Goal 级配置。请打开具体 Goal 的能力设置进行配置;这里不会设置机器级默认值。`,"machine.desiredRevision":`目标 Revision`,"machine.editorUnavailable":`当前版本未安装此 Namespace 的编辑器`,"machine.editorUnavailableDescription":`它仍会显示在 Registry 中;安装或升级对应的 Dashboard 编辑器后才能修改。`,"machine.editorMode":`编辑模式`,"machine.liveDefault":`实时默认值;Goal 显式覆盖优先`,"machine.liveDefaultDescription":`没有显式覆盖的 Goal 会在该能力下一次决策时读取当前机器策略。修改或移除策略会立即影响这些已有 Goal;显式 Goal 覆盖保持固定。`,"machine.genericNamespaceDescription":`使用 JSON 编辑这个已注册 Namespace。LoopX 会先按 capability 自己拥有的 schema 校验,再允许预览写入。`,"machine.jsonConfiguration":`Namespace 配置(JSON)`,"machine.jsonConfigurationHelp":`只更新当前 Namespace;其他机器配置会保留,Apply 仍锁定到已审阅的 Preview Revision。`,"machine.jsonEditor":`JSON`,"machine.editJson":`编辑 JSON`,"capabilities.jsonConfiguration":`Goal 配置(JSON)`,"capabilities.jsonHelp":`仅编辑当前 Goal 的已注册字段。修改后需重新预览才能应用。`,"capabilities.jsonInvalid":`请输入合法的 JSON 对象,且仅包含已注册的可编辑字段。`,"machine.backToForm":`返回表单`,"machine.jsonInvalid":`请先填写一个合法的 JSON object,再预览变更。`,"machine.loadError":`无法读取机器配置。`,"machine.invalidStoredConfiguration":`已保存的机器配置需要修复`,"machine.invalidStoredConfigurationDescription":`已保存值不再符合当前契约,因此不会在这里显示。请检查已定位的能力,并通过“预览”和“应用”替换它;无关 namespace 保持不变。`,"machine.machinePolicy":`机器策略`,"machine.namespaceCount":`已注册 Namespace`,"machine.namespaces":`配置 Namespace`,"machine.periodicReport":`周期报告`,"machine.periodicReportDescription":`为所有未显式覆盖的 Goal 提供默认报告策略;Goal 调度与发送消费解析后的有效配置。`,"machine.periodicReportActivation":`开启后将在已验证的阶段节点自动投递`,"machine.periodicReportActivationDescription":`这不是每周定时器。当 LoopX 验证 Goal 已完成一个阶段时,Agent 会生成并冻结报告,随后通过配置的 Goal Channel 自动发送。启用此订阅即授予持续投递权;发送失败或路由漂移会 fail closed 并进入修复。`,"machine.changeQualityActivation":`质量验证是质量门禁,不是新增授权`,"machine.changeQualityActivationDescription":`继承该策略的 Goal 会验证最终精确 diff。safe_fix 只允许在既有写入权限内执行至多一次有界修复;此设置不会授予文件、权限或合并权。`,"machine.replanCadenceActivation":`复核周期只改变时机,不改变执行权限`,"machine.replanCadenceActivationDescription":`没有显式覆盖的 Goal 会在下一次复核决策前读取此阈值;它不会创建 Turn、消耗配额或授予权限。`,"machine.preview":`审阅机器配置变更`,"machine.previewChanges":`预览变更`,"machine.previewError":`无法生成机器策略预览。`,"machine.previewLocked":`应用操作锁定到当前 Revision;若机器状态变化,LoopX 会要求重新预览。`,"machine.previewRollback":`预览回滚`,"machine.previewRemoval":`预览移除`,"machine.profilePreset":`Profile preset`,"machine.profilePresetHelp":`由 capability 管理的 preset,例如 weekly-progress。`,"machine.registry":`Typed Registry`,"machine.requiredFields":`开启后必须填写 profile preset、Goal Channel route 与有效时区。`,"machine.revision":`机器 Revision`,"machine.revisionLockedReady":`所有变更必须先预览;只有对应的机器 Revision 仍然有效时才会应用。`,"machine.rollbackAvailable":`可回滚上一次应用`,"machine.rollbackDescription":`先预览已保存的前一 Revision,再决定是否恢复。`,"machine.rollbackError":`无法完成回滚。`,"machine.rollbackPreviewDescription":`前一 Revision 已准备恢复,请确认执行本次回滚。`,"machine.rolledBack":`已恢复前一版机器策略,并通过校验。`,"machine.removed":`机器策略已移除,并通过回读校验。`,"machine.routeRef":`Goal Channel route`,"machine.routeRefHelp":`只填写公开 route alias;凭据与 provider identifier 不会进入此表单。`,"machine.timezone":`时区`,"machine.timezoneHelp":`填写 IANA 时区,例如 Asia/Shanghai。`,"machine.title":`机器配置`,"machine.unchanged":`机器策略已与预览一致,本次没有写入。`,"machine.visualEditor":`引导式`,"capabilities.atomicOverride":`Goal override 按完整配置生效`,"capabilities.atomicOverrideDescription":`Goal 的完整配置优先于机器默认值;LoopX 不会在两个作用域之间逐字段拼接。`,"capabilities.applyFailed":`Goal 能力变更未写入。`,"capabilities.applyPreview":`应用此预览`,"capabilities.catalog":`Goal 能力目录`,"capabilities.chooseGoal":`请先选择一个 Goal,再查看它的能力配置。`,"capabilities.defaultValue":`声明的默认值`,"capabilities.description":`查看当前 Goal 可用的能力,以及每项配置的准确作用域。`,"capabilities.editorPrepared":`已注册 typed editor contract`,"capabilities.effectiveSource":`当前生效来源`,"capabilities.empty":`当前 Goal 没有可用的能力描述。`,"capabilities.fields":`已注册字段`,"capabilities.goalPolicy":`Goal 能力策略`,"capabilities.goalScope":`Goal`,"capabilities.goalValue":`当前 Goal 值`,"capabilities.loadFailed":`无法加载 Goal 能力`,"capabilities.loading":`正在加载 Goal 能力…`,"capabilities.machineOnly":`此能力只能在机器作用域配置。`,"capabilities.machineValue":`实时机器默认值`,"capabilities.machineScope":`机器`,"capabilities.previewOnly":`当前读取结果来自真实配置;在 revision-locked preview/apply 路径接通前,Dashboard 不会提供 Goal 写入控件。`,"capabilities.preview":`锁定 revision 的变更预览`,"capabilities.previewChanges":`预览变更`,"capabilities.restoreInheritance":`恢复继承机器默认值`,"capabilities.previewFailed":`无法预览 Goal 能力变更。`,"capabilities.previewLocked":`应用时会重新校验这一个 plan revision;过期变更将被拒绝。`,"capabilities.partialWrite":`Goal 值已保存;共享投影仍需修复`,"capabilities.partialWriteDescription":`源 Goal 配置已经写入并回读,但共享 runtime 投影尚未同步;请勿重复提交本次变更。`,"capabilities.refreshSource":`刷新源配置`,"capabilities.readOnly":`只读能力`,"capabilities.revisionLockedReady":`所有变更必须先预览;只有对应的精确 revision 仍然有效时才会写入。`,"capabilities.retry":`重试`,"capabilities.source.capability_default":`能力默认值`,"capabilities.source.goal_override":`Goal override`,"capabilities.source.machine_default":`实时机器默认值`,"capabilities.source.not_configured":`未配置`,"capabilities.title":`Goal 能力`,"settings.close":`关闭设置`,"settings.appearance":`外观`,"settings.appearanceDescription":`管理当前浏览器里的工作区显示偏好。`,"settings.appearanceTabDescription":`主题和显示偏好`,"settings.capabilitiesTabDescription":`当前 Goal 的能力覆盖配置`,"settings.back":`返回工作区`,"settings.categories":`设置分类`,"settings.description":`管理工作区偏好与集成。`,"settings.eyebrow":`工作区偏好`,"settings.general":`通用`,"settings.goalConnections":`Goal 连接`,"settings.language":`语言`,"settings.languageDescription":`选择 LoopX Desktop 工作区使用的界面语言。`,"settings.languageEnglishDescription":`使用英文显示导航、设置和工作区控件。`,"settings.languageEnglish":`English`,"settings.languageSimplifiedChineseDescription":`使用简体中文显示导航、设置和工作区控件。`,"settings.languageSimplifiedChinese":`简体中文`,"settings.languageStoredLocally":`此偏好仅保存在当前设备。`,"settings.languageTabDescription":`当前设备的界面语言`,"settings.larkTabDescription":`App、群聊和 Goal Topic 连接`,"settings.machineTabDescription":`本机各 Capability 共享的 typed defaults`,"settings.notifications":`通知`,"settings.open":`设置`,"settings.themeDefault":`纸张`,"settings.themeDefaultDescription":`安静、轻量,适合长期查看。`,"settings.themeDescription":`选择工作区的视觉风格。设置会保存在当前浏览器本地。`,"settings.themeHighContrast":`高对比`,"settings.themeHighContrastDescription":`更强边框和更醒目的状态块。`,"settings.themeLoopx":`LoopX 标准`,"settings.themeLoopxDescription":`精确的黑白界面、Geist 字体与安静的细线结构。`,"settings.title":`设置`,"settings.workspaceDisplay":`工作区显示`,"settings.workspaceTheme":`工作区主题`,"session.closeRecord":`退出运行记录`,"session.details":`Session 详情`,"session.record":`执行 Session · 运行记录`,"session.recordDescription":`当前时间线已切换到这次 Session 的消息与 Turn 记录。`,"sidebar.createGoal":`创建 Goal`,"sidebar.delete":`删除`,"sidebar.deleteGoal":`删除 Goal`,"sidebar.manager":`LoopX 管家`,"sidebar.notifications":`设置`,"sidebar.owner":`个人工作区`,"sidebar.product":`个人 Agent 工作区`,"sidebar.resume":`恢复`,"sidebar.resumeGoal":`恢复 Goal`,"sidebar.stop":`停止`,"tasks.historyLoading":`正在加载历史…`,"tasks.historyError":`历史加载失败,已显示的内容仍可查看。`,"tasks.historyExpired":`历史快照已过期,重新加载后可继续查看。`,"tasks.historyRetry":`重新加载`,"tasks.historyEnd":`已显示全部完成记录`,"tasks.historyMore":`加载更多`,"tasks.historyLocalOnly":`请打开这台机器的 Dashboard 查看完整历史。`,"sidebar.sortGoals":`调整 Goal 顺序`,"sidebar.dragGoal":`拖拽调整顺序,或使用列表排序按钮`,"sidebar.moveUp":`上移 {goal}`,"sidebar.moveDown":`下移 {goal}`,"sidebar.goalMoved":`{goal} 已移至第 {position} 位`,"sidebar.orderNotSaved":`顺序已在本次页面生效;浏览器存储不可用,无法保存。`,"sidebar.stopGoal":`停止 Goal`,"sidebar.stopped":`已停止`,"sidebar.stoppedLoading":`正在加载已停止 Goal`,"sidebar.stoppedLoadFailed":`已停止 Goal 加载失败,其他 Goal 仍可使用。`,"sidebar.retryStopped":`重试`,"state.completed":`已完成`,"state.needsRepair":`需修复`,"state.needsYou":`等你`,"state.quiet":`安静运行`,"state.running":`推进中`,"state.stopped":`已停止`,"state.waiting":`等待条件`,"tasks.blocked":`受阻`,"tasks.agentLane":`工作 Agent`,"tasks.agentLaneDescription":`筛选这个 Goal 下的工作泳道`,"tasks.agentLaneFilter":`按工作 Agent 筛选`,"tasks.allAgentLanes":`全部 Agent({count})`,"tasks.chatAgentReplied":`Agent 已回复`,"tasks.chatPending":`已发送给 Agent`,"tasks.chatPendingDescription":`正在处理;只有经过确认的任务操作才会更新 Tasks。`,"tasks.chatRecent":`最近对话`,"tasks.chatUnchangedDescription":`本次对话没有直接修改 Tasks。需要执行时,可先转成 Task 草稿并确认。`,"tasks.chatViewReply":`查看回复`,"tasks.convertToTask":`转为 Task`,"tasks.completed":`已完成`,"runs.discoveryPartial":`部分执行详情暂不可用,正在重连;任务摘要不代表实时执行状态。`,"runs.discoveryOffline":`执行服务暂不可用,正在重连;保留的任务摘要可能已过时。`,"files.openConversation":`前往会话`,"files.exportSummary":`导出摘要`,"tasks.viewDescription":`先处理待确认,再查看工作与完成记录`,"tasks.viewLabel":`任务视图`,"tasks.listView":`列表`,"tasks.boardView":`看板`,"tasks.completedSummary":`已完成 {count} 项,近期完成明细由控制面按需投影。`,"tasks.emptyCompleted":`还没有完成的任务。`,"tasks.emptyConfirm":`没有待确认的任务。`,"tasks.emptyRunning":`没有待执行或进行中的任务。`,"tasks.emptySchedules":`没有定时任务。`,"tasks.emptyGoal":`这个 Goal 还没有任务。用下面的输入框描述下一步,LoopX 会先展示待确认操作。`,"tasks.markComplete":`标记完成:{name}`,"tasks.moreActions":`更多操作:{name}`,"tasks.openExecution":`查看执行过程:{name}`,"tasks.pending":`待处理`,"tasks.pendingAndRunning":`待执行 / 进行中`,"tasks.scheduled":`定时与持续`,"tasks.sessionError":`Session 异常`,"tasks.waiting":`待执行`,"tasks.waitingAge":`已等待 {age}`,"tasks.viewExecution":`查看执行过程`,"tasks.viewResult":`查看结果`,"time.days":`{count} 天`,"time.hours":`{count} 小时`,"timeline.emptyGoal":`这个 Goal 还没有新动态`,"timeline.emptyGoalDescription":`你可以直接询问进度或下发新的纠偏信息。`,"timeline.emptyWorkspace":`今天的工作区很安静`,"timeline.emptyWorkspaceDescription":`向 LoopX 管家描述一个 Goal,或询问今天最值得关注的事情。`,"timeline.gateHistory":`{count} 项历史 Gate`,"timeline.pending":`正在整理…`,"returnDelivery.queued":`结论等待回传`,"returnDelivery.verifying":`正在核验送达,不会重复发送`,"returnDelivery.delivered":`已送达原受众`,"returnDelivery.reconciled":`恢复后已核验送达`,"returnDelivery.unverified":`送达仍明确未核验`,"timeline.runCompleted":`{run}:已完成`,"timeline.review":`查看处理方式`,"timeline.reviewAndConfirm":`查看并确认`,"timeline.waitingConfirmation":`待你确认`}};function Wi(e,t){return t?Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e):e}function Gi(){try{return window.localStorage.getItem(`loopx-pw-locale`)===`en`?`en`:`zh-CN`}catch{return`zh-CN`}}function Ki({children:e}){let[t,n]=(0,V.useState)(Gi);function r(e){n(e);try{window.localStorage.setItem(Hi,e)}catch{}}(0,V.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,V.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Wi(Ui[t][e],n)}),[t]);return(0,H.jsx)(Vi.Provider,{value:i,children:e})}function qi(){let e=(0,V.useContext)(Vi);if(!e)throw Error(`useWorkspaceI18n must be used within WorkspaceI18nProvider`);return e}function Ji(e,t){let n={安静运行:`state.quiet`,等你:`state.needsYou`,等待条件:`state.waiting`,推进中:`state.running`,需修复:`state.needsRepair`,已完成:`state.completed`,已停止:`state.stopped`}[e];return n?Ui[t][n]:e}function Yi(e,t){let n={busy:`runs.running`,completed:`runs.completed`,failed:`runs.failed`,queued:`runs.queued`,ready:`runs.ready`,resume_failed:`runs.resumeFailed`,running:`runs.running`,waiting:`runs.waiting`};return e?n[e]?t(n[e]):e:t(`runs.unknown`)}function Xi(e,t){if(!e)return null;let n=new Date(e).getTime();if(Number.isNaN(n))return null;let r=Date.now()-n;if(r<36e5)return null;let i=Math.floor(r/864e5);return i>=1?t(`time.days`,{count:i}):t(`time.hours`,{count:Math.floor(r/36e5)})}var Zi;function U(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;en?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Qi=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},$i=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Zi=globalThis).__zod_globalConfig??(Zi.__zod_globalConfig={});var ea=globalThis.__zod_globalConfig;function ta(e){return e&&Object.assign(ea,e),ea}function na(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ra(e,t){return typeof t==`bigint`?t.toString():t}function ia(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function aa(e){return e==null}function oa(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function sa(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){};function ha(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ga=ia(()=>{if(ea.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function _a(e){if(ha(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ha(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function va(e){return _a(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ya=new Set([`string`,`number`,`symbol`]);function ba(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xa(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function W(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Sa(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Ca={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function wa(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return xa(e,da(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ua(this,`shape`,e),e},checks:[]}))}function Ta(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return xa(e,da(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ua(this,`shape`,r),r},checks:[]}))}function Ea(e,t){if(!_a(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xa(e,da(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ua(this,`shape`,n),n}}))}function Da(e,t){if(!_a(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return xa(e,da(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ua(this,`shape`,n),n}}))}function Oa(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return xa(e,da(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ua(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ka(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return xa(t,da(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return ua(this,`shape`,i),i},checks:[]}))}function Aa(e,t,n){return xa(t,da(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return ua(this,`shape`,i),i}}))}function ja(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Pa(e){return typeof e==`string`?e:e?.message}function Fa(e,t,n){let r=e.message?e.message:Pa(e.inst?._zod.def?.error?.(e))??Pa(t?.error?.(e))??Pa(n.customError?.(e))??Pa(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Ia(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function La(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ra=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ra,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},za=U(`$ZodError`,Ra),Ba=U(`$ZodError`,Ra,{Parent:Error});function Va(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ha(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Qi;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Fa(e,a,ta())));throw ma(t,i?.callee),t}return o.value},Wa=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Fa(e,a,ta())));throw ma(t,i?.callee),t}return o.value},Ga=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Qi;return a.issues.length?{success:!1,error:new(e??za)(a.issues.map(e=>Fa(e,i,ta())))}:{success:!0,data:a.value}},Ka=Ga(Ba),qa=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Fa(e,i,ta())))}:{success:!0,data:a.value}},Ja=qa(Ba),Ya=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ua(e)(t,n,i)},Xa=e=>(t,n,r)=>Ua(e)(t,n,r),Za=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Wa(e)(t,n,i)},Qa=e=>async(t,n,r)=>Wa(e)(t,n,r),$a=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ga(e)(t,n,i)},eo=e=>(t,n,r)=>Ga(e)(t,n,r),to=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qa(e)(t,n,i)},no=e=>async(t,n,r)=>qa(e)(t,n,r),ro=/^[cC][0-9a-z]{6,}$/,io=/^[0-9a-z]+$/,ao=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,oo=/^[0-9a-vA-V]{20}$/,so=/^[A-Za-z0-9]{27}$/,co=/^[a-zA-Z0-9_-]{21}$/,lo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,uo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,fo=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,po=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,mo=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function ho(){return new RegExp(mo,`u`)}var go=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_o=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,vo=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,yo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,xo=/^[A-Za-z0-9_-]*$/,So=/^https?$/,Co=/^\+[1-9]\d{6,14}$/,wo=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,To=RegExp(`^${wo}$`);function Eo(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Do(e){return RegExp(`^${Eo(e)}$`)}function Oo(e){let t=Eo({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${wo}T(?:${r})$`)}var ko=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ao=/^-?\d+$/,jo=/^-?\d+(?:\.\d+)?$/,Mo=/^(?:true|false)$/i,No=/^null$/i,Po=/^[^A-Z]*$/,Fo=/^[^a-z]*$/,Io=U(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Lo={number:`number`,bigint:`bigint`,object:`date`},Ro=U(`$ZodCheckLessThan`,(e,t)=>{Io.init(e,t);let n=Lo[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{Io.init(e,t);let n=Lo[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bo=U(`$ZodCheckMultipleOf`,(e,t)=>{Io.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):sa(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Vo=U(`$ZodCheckNumberFormat`,(e,t)=>{Io.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ca[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Ao)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Ho=U(`$ZodCheckMaxLength`,(e,t)=>{var n;Io.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!aa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value;if(r.length<=t.maximum)return;let i=Ia(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Uo=U(`$ZodCheckMinLength`,(e,t)=>{var n;Io.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!aa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ia(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wo=U(`$ZodCheckLengthEquals`,(e,t)=>{var n;Io.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!aa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ia(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Go=U(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Io.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ko=U(`$ZodCheckRegex`,(e,t)=>{Go.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),qo=U(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Po,Go.init(e,t)}),Jo=U(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Fo,Go.init(e,t)}),Yo=U(`$ZodCheckIncludes`,(e,t)=>{Io.init(e,t);let n=ba(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Xo=U(`$ZodCheckStartsWith`,(e,t)=>{Io.init(e,t);let n=RegExp(`^${ba(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Zo=U(`$ZodCheckEndsWith`,(e,t)=>{Io.init(e,t);let n=RegExp(`.*${ba(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Qo=U(`$ZodCheckOverwrite`,(e,t)=>{Io.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),$o=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(` `))}},es={major:4,minor:4,patch:3},ts=U(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=es;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=ja(e),i;for(let a of t){if(a._zod.def.when){if(Ma(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Qi;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=ja(e,t))});else{if(e.issues.length===t)continue;r||=ja(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(ja(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Qi;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Qi;return o.then(e=>t(e,r,a))}return t(o,r,a)}}la(e,`~standard`,()=>({validate:t=>{try{let n=Ka(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ja(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),ns=U(`$ZodString`,(e,t)=>{ts.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ko(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),rs=U(`$ZodStringFormat`,(e,t)=>{Go.init(e,t),ns.init(e,t)}),is=U(`$ZodGUID`,(e,t)=>{t.pattern??=uo,rs.init(e,t)}),as=U(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=fo(e)}else t.pattern??=fo();rs.init(e,t)}),os=U(`$ZodEmail`,(e,t)=>{t.pattern??=po,rs.init(e,t)}),ss=U(`$ZodURL`,(e,t)=>{rs.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===So.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),cs=U(`$ZodEmoji`,(e,t)=>{t.pattern??=ho(),rs.init(e,t)}),ls=U(`$ZodNanoID`,(e,t)=>{t.pattern??=co,rs.init(e,t)}),us=U(`$ZodCUID`,(e,t)=>{t.pattern??=ro,rs.init(e,t)}),ds=U(`$ZodCUID2`,(e,t)=>{t.pattern??=io,rs.init(e,t)}),fs=U(`$ZodULID`,(e,t)=>{t.pattern??=ao,rs.init(e,t)}),ps=U(`$ZodXID`,(e,t)=>{t.pattern??=oo,rs.init(e,t)}),ms=U(`$ZodKSUID`,(e,t)=>{t.pattern??=so,rs.init(e,t)}),hs=U(`$ZodISODateTime`,(e,t)=>{t.pattern??=Oo(t),rs.init(e,t)}),gs=U(`$ZodISODate`,(e,t)=>{t.pattern??=To,rs.init(e,t)}),_s=U(`$ZodISOTime`,(e,t)=>{t.pattern??=Do(t),rs.init(e,t)}),vs=U(`$ZodISODuration`,(e,t)=>{t.pattern??=lo,rs.init(e,t)}),ys=U(`$ZodIPv4`,(e,t)=>{t.pattern??=go,rs.init(e,t),e._zod.bag.format=`ipv4`}),bs=U(`$ZodIPv6`,(e,t)=>{t.pattern??=_o,rs.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),xs=U(`$ZodCIDRv4`,(e,t)=>{t.pattern??=vo,rs.init(e,t)}),Ss=U(`$ZodCIDRv6`,(e,t)=>{t.pattern??=yo,rs.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Cs(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var ws=U(`$ZodBase64`,(e,t)=>{t.pattern??=bo,rs.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Cs(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Ts(e){if(!xo.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Cs(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Es=U(`$ZodBase64URL`,(e,t)=>{t.pattern??=xo,rs.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Ts(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ds=U(`$ZodE164`,(e,t)=>{t.pattern??=Co,rs.init(e,t)});function Os(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var ks=U(`$ZodJWT`,(e,t)=>{rs.init(e,t),e._zod.check=n=>{Os(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),As=U(`$ZodNumber`,(e,t)=>{ts.init(e,t),e._zod.pattern=e._zod.bag.pattern??jo,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),js=U(`$ZodNumberFormat`,(e,t)=>{Vo.init(e,t),As.init(e,t)}),Ms=U(`$ZodBoolean`,(e,t)=>{ts.init(e,t),e._zod.pattern=Mo,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Ns=U(`$ZodNull`,(e,t)=>{ts.init(e,t),e._zod.pattern=No,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Ps=U(`$ZodUnknown`,(e,t)=>{ts.init(e,t),e._zod.parse=e=>e}),Fs=U(`$ZodNever`,(e,t)=>{ts.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Is(e,t,n){e.issues.length&&t.issues.push(...Na(n,e.issues)),t.value[n]=e.value}var Ls=U(`$ZodArray`,(e,t)=>{ts.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;eIs(t,n,e))):Is(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Rs(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Na(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function zs(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Sa(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Bs(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Rs(e,n,i,t,u,d))):Rs(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Vs=U(`$ZodObject`,(e,t)=>{if(ts.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=ia(()=>zs(t));la(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=ha,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Rs(n,t,e,s,r,i))):Rs(a,t,e,s,r,i)}return i?Bs(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Hs=U(`$ZodObjectJIT`,(e,t)=>{Vs.init(e,t);let n=e._zod.parse,r=ia(()=>zs(t)),i=e=>{let t=new $o([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=fa(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=fa(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(` if (${n}.issues.length) { @@ -117,13 +117,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs. `)}if(e||a)break}i=a?i:i+1}catch(e){if(n?.aborted||(i+=1,i>=4))throw e;await new Promise(e=>globalThis.setTimeout(e,250*2**(i-1)))}}if(!a)throw new Eh(`Agent 事件流连接已断开。`,{reconnect_attempts:i})}async function Jh(e,t){return Lh(`/api/chat/sessions/${e}/turns/${t}/interrupt`,{method:`POST`,body:`{}`})}async function Yh(e,t,n={}){let r=await Gh(e,t,n.clientTurnId??crypto.randomUUID(),n.attachments);return n.onPhase?.(`turn.accepted`,r.turn_id),Xh(e,r.turn_id,r.events_url,n)}async function Xh(e,t,n,r={}){let i=null,a={failure:null,interrupted:null};try{await qh(n,e=>{r.onPhase?.(e.kind,t),(e.kind===`answer.delta`||e.kind===`assistant.delta`)&&r.onDelta?.(String(e.payload.text??``)),e.kind===`agent.phase`&&r.onActivity?.(String(e.payload.label??`Agent 正在处理`)),e.kind===`turn.completed`&&(i=e.payload.response),e.kind===`turn.failed`&&(a.failure=e.payload),e.kind===`turn.interrupted`&&(a.interrupted=e.payload)},r.signal)}catch(i){throw i instanceof Eh&&!r.signal?.aborted?new Eh(i.message,{...i.payload,events_url:n,reconnectable:!0,session_id:e,turn_id:t}):i}if(a.failure)throw new Eh(String(a.failure.message||`Agent 回合失败。`),a.failure);if(a.interrupted)throw new Eh(`Agent 回合已中断。`,{...a.interrupted,error_code:`turn_interrupted`,session_id:e,turn_id:t});return{response:bh.parse(i),sessionId:e,turnId:t}}async function Zh(e,t,n={}){return Xh(e,t,`/api/chat/sessions/${e}/turns/${t}/events`,n)}async function Qh(e){let t=xh.parse(await Lh(`/api/chat/sessions/${e}`,{keepalive:!0,method:`DELETE`}));if(t.session_id!==e)throw new Eh(`Agent 会话关闭回执与本次请求不一致。`,{session_id:t.session_id});return t}async function $h(e){return Lh(`/api/chat/sessions/${e}/resume`,{method:`POST`,body:`{}`})}function eg(e){return{goal_id:e.goalId,enabled:e.enabled,...e.modelConfig===void 0?{}:{model_config:e.modelConfig},...e.enabled?{max_children:e.maxChildren,allowed_domains:e.allowedDomains}:{}}}function tg(e,t){let n=e.after.orchestration,r=[...new Set(t.allowedDomains)],i=e.feature_summary.multi_subagent===`enabled`;if(!(e.goal_id===t.goalId&&i===t.enabled&&(t.modelConfig===void 0||JSON.stringify(n.model_config??null)===JSON.stringify(t.modelConfig))&&(t.enabled?n.max_children===t.maxChildren&&JSON.stringify(n.allowed_domains)===JSON.stringify(r):n.spawn_allowed===!1&&n.max_children===0)))throw new Eh(`Goal 子代理配置回执与本次请求不一致,界面已停止更新。`,{after:e.after,goal_id:e.goal_id});return e}async function ng(e){let t=wh.parse(await Lh(`/api/chat/goal-subagents/dry-run`,{method:`POST`,body:JSON.stringify(eg(e))}));if(!t.dry_run||t.execute||t.written)throw new Eh(`Goal 子代理预览返回了非预览回执,已停止进入确认状态。`,{result:t});return tg(t,e)}async function rg(e,t){let n=wh.parse(await Lh(`/api/chat/goal-subagents/apply`,{method:`POST`,body:JSON.stringify({...eg(e),preview_id:t})}));if(n.preview_id!==t||n.dry_run||!n.execute)throw new Eh(`Goal 子代理写入回执与本次确认不一致,界面已停止更新。`,{result:n});if(n.changed&&(!n.written||!n.global_sync.executed||!n.global_sync.readback.verified))throw new Eh(`Goal 子代理设置未通过共享状态读回验证。`,{result:n});return tg(n,e)}var ig=Y({ok:X(!0),targets:J(Y({enabled:q(),provider:G(),target_name:G()}))});async function ag(){return ig.parse(await Lh(`/api/chat/goal-channel/targets`)).targets}var og=Y({ok:q(),blocker:G().optional(),public_summary:G().optional(),status:G().optional()});async function sg(e){return og.parse(await Lh(`/api/chat/goal-channel/setup`,{method:`POST`,body:JSON.stringify({execute:e.execute,goal_id:e.goalId,target:e.target})}))}async function cg(e){return og.parse(await Lh(`/api/chat/goal-channel/configure`,{method:`POST`,body:JSON.stringify({auto_notify_human_gates:e.autoNotify,goal_id:e.goalId})}))}var lg=Y({schema_version:X(`periodic_report_schedule_v0`),schedule_id:G(),rrule:G(),timezone:G()});Y({schema_version:X(`periodic_report_machine_defaults_v0`),enabled:q(),inheritance:X(`live_machine_default`),profile_preset:G().optional(),route_ref:G().optional(),timezone:G(),schedule:lg.nullable().optional()});var ug=Y({schema_version:X(`loopx_machine_configuration_v0`),namespaces:hd(G(),hd(G(),rd()))}),dg=Y({namespace:G(),title:G(),description:G(),schema_versions:J(G()).min(1),configuration_template:hd(G(),rd()),template_status:_d([`ready`,`schema_only`])}),fg=Y({schema_version:X(`machine_configuration_catalog_v0`),namespaces:J(dg)}),pg=Y({key:G(),label:G(),description:G(),input_kind:_d([`boolean`,`number`,`select`,`string_list`,`text`,`periodic_report_schedule`]),nullable:q().optional(),required:q(),minimum:K().int().optional(),maximum:K().int().optional(),options:J(G()).optional()}),mg=Y({schema_version:X(`capability_configuration_editor_v0`),editable:q(),supported_scopes:J(_d([`goal`,`machine`])),writable_scopes:J(_d([`goal`,`machine`])),fields:J(pg),read_only_reason:G().optional()}),hg=Y({schema_version:X(`capability_configuration_catalog_v0`),capabilities:J(Y({capability_id:G(),display_name:G(),description:G(),available_scopes:J(_d([`goal`,`machine`])),machine_namespace:G().optional(),goal_feature_id:G().optional(),effective_value_policy:X(`goal_override_over_live_machine_default`).optional(),availability:G().optional(),default:hd(G(),rd()).optional(),current:hd(G(),rd()).optional(),machine_current:hd(G(),rd()).optional(),effective_configuration:Y({schema_version:X(`capability_configuration_resolution_v0`),capability_id:G(),source:_d([`goal_override`,`machine_default`,`capability_default`,`not_configured`]),configuration:hd(G(),rd()).nullable(),inherited:q(),goal_override_present:q(),machine_default_present:q(),effective_revision:G()}).optional(),documentation:hd(G(),rd()).optional(),context_contribution:Y({supported_phases:J(_d([`before_plan`,`before_delegate`,`after_delegate_result`])),target:X(`coordinator`),activation:X(`with_capability`),receipt_required:X(!0)}).optional(),configuration_editor:mg}))}),gg=Y({ok:X(!0),schema_version:X(`goal_configuration_inspection_v0`),status:X(`configured`),goal_id:G(),revision:G(),available_capabilities:J(G()),capability_catalog:hg}),_g=Y({ok:X(!0),goal_id:G(),capability_id:G(),changed_fields:J(G()),goal_configuration:hd(G(),rd()).nullable(),capability_catalog:hg}),vg=_g.extend({schema_version:X(`goal_configuration_update_plan_v0`),status:X(`preview`),action:_d([`create`,`update`,`delete`,`unchanged`]),current_revision:G(),desired_revision:G(),base_revision:G(),plan_revision:G(),writes_required:K().int().nonnegative()}),yg=ld([_g.extend({schema_version:X(`goal_configuration_transaction_v0`),status:_d([`applied`,`unchanged`]),plan_revision:G(),applied_revision:G(),readback_verified:X(!0)}),Y({ok:X(!1),schema_version:X(`goal_configuration_transaction_v0`),status:X(`partial_write`),goal_id:G(),capability_id:G(),plan_revision:G(),applied_revision:G().nullable(),source_written:X(!0),shared_sync_pending:X(!0),readback_verified:q(),changed_fields:J(G()),goal_configuration:hd(G(),rd()).nullable(),capability_catalog:hg,error:G(),recommended_action:G()})]),bg=Y({ok:X(!0),available_namespaces:J(G()),namespace_catalog:fg.optional().default({schema_version:`machine_configuration_catalog_v0`,namespaces:[]}),capability_catalog:hg,changed_namespaces:J(G()).optional().default([]),invalid_namespaces:J(G()).optional().default([]),machine_configuration:ug.nullable().optional()}),xg=bg.extend({schema_version:X(`machine_configuration_inspection_v0`),status:_d([`configured`,`absent`,`invalid`]),revision:G()}),Sg=bg.extend({schema_version:X(`machine_configuration_update_plan_v0`),status:X(`preview`),action:_d([`create`,`update`,`delete`,`unchanged`]),current_revision:G(),desired_revision:G(),plan_revision:G(),writes_required:K().int().nonnegative(),machine_configuration:ug.nullable()}),Cg=bg.extend({schema_version:X(`machine_configuration_transaction_v0`),status:_d([`applied`,`unchanged`]),plan_revision:G(),transaction_id:G().nullable(),readback_verified:X(!0),rollback_available:q(),applied_revision:G().optional(),prior_revision:G().optional()}),wg=bg.extend({schema_version:X(`machine_configuration_rollback_plan_v0`),status:X(`preview`),action:_d([`delete`,`restore`,`unchanged`,`blocked`]),reason:G(),transaction_id:G(),plan_revision:G(),rollback_allowed:q(),writes_required:K().int().nonnegative()}),Tg=bg.extend({schema_version:X(`machine_configuration_rollback_receipt_v0`),status:_d([`rolled_back`,`unchanged`]),transaction_id:G(),plan_revision:G(),rollback_id:G().nullable(),readback_verified:X(!0)});async function Eg(){return xg.parse(await Lh(`/api/chat/machine-configuration`))}async function Dg(e){let t=new URLSearchParams({goal_id:e});return gg.parse(await Lh(`/api/chat/goal-configuration?${t.toString()}`))}async function Og(e,t,n){return vg.parse(await Lh(`/api/chat/goal-configuration/preview`,{method:`POST`,body:JSON.stringify({goal_id:e,capability_id:t,configuration:n})}))}async function kg(e,t,n,r){return yg.parse(await Lh(`/api/chat/goal-configuration/apply`,{method:`POST`,body:JSON.stringify({goal_id:e,capability_id:t,configuration:n,expected_plan_revision:r})}))}async function Ag(e,t){return Sg.parse(await Lh(`/api/chat/machine-configuration/preview`,{method:`POST`,body:JSON.stringify({namespace:e,namespace_configuration:t})}))}async function jg(e,t,n){return Cg.parse(await Lh(`/api/chat/machine-configuration/apply`,{method:`POST`,body:JSON.stringify({expected_plan_revision:n,namespace:e,namespace_configuration:t})}))}async function Mg(e){return Sg.parse(await Lh(`/api/chat/machine-configuration/preview`,{method:`POST`,body:JSON.stringify({namespace:e,operation:`remove`})}))}async function Ng(e,t){return Cg.parse(await Lh(`/api/chat/machine-configuration/apply`,{method:`POST`,body:JSON.stringify({expected_plan_revision:t,namespace:e,operation:`remove`})}))}async function Pg(e){return wg.parse(await Lh(`/api/chat/machine-configuration/rollback`,{method:`POST`,body:JSON.stringify({execute:!1,transaction_id:e})}))}async function Fg(e,t){return Tg.parse(await Lh(`/api/chat/machine-configuration/rollback`,{method:`POST`,body:JSON.stringify({execute:!0,expected_plan_revision:t,transaction_id:e})}))}var Ig=Y({ok:X(!0),goals:J(Y({goal_id:G(),repository:Y({branch:G(),identity:G(),label:G(),read_only:X(!0)})}))});async function Lg(){return Ig.parse(await Lh(`/api/chat/goals/contexts`)).goals}var Rg=Y({ok:X(!0),apps:J(Y({active:q(),app_ref:G(),brand:G(),health_error_code:G().nullable().default(null),label:G(),ready:q(),reply_ready:q().default(!1)}))});async function zg(){return Rg.parse(await Lh(`/api/chat/lark/apps`)).apps}var Bg=Y({ok:X(!0),app_ref:G(),error:G().nullable(),setup_id:G(),status:_d([`starting`,`waiting_for_feishu`,`ready`,`failed`,`cancelled`]),verification_url:G().url().nullable()});async function Vg(e){return Bg.parse(await Lh(`/api/chat/lark/app-setups`,{method:`POST`,body:JSON.stringify({app_ref:e.appRef,brand:e.brand})}))}async function Hg(e){return Bg.parse(await Lh(`/api/chat/lark/app-setups/${encodeURIComponent(e)}`))}async function Ug(e){return Bg.parse(await Lh(`/api/chat/lark/app-setups/${encodeURIComponent(e)}`,{method:`DELETE`}))}var Wg=[`invalid_event`,`binding_unavailable`,`chat_mismatch`,`topic_mismatch`,`route_ambiguous`,`self_message`,`invalid_routing_state`,`not_addressed`],Gg=Y({ok:X(!0),chats:J(Y({chat_id:G(),chat_name:G()}))});async function Kg(e,t){let n=new URLSearchParams({app_ref:e});return t&&n.set(`query`,t),Gg.parse(await Lh(`/api/chat/lark/chats?${n.toString()}`)).chats}var qg=Y({ok:X(!0),connections:J(Y({conversation_kind:_d([`goal`,`manager`]).default(`goal`),agent_id:G().nullable().default(null),connection_id:G(),app_label:G(),app_ref:G(),capture_scope:_d([`addressed_only`,`configured_chat_all`]).default(`addressed_only`),chat_name:G(),enabled:q(),goal_id:G(),goal_title:G(),health_error_code:G().nullable().default(null),history_permission_guidance:Y({action:X(`enable_application_scopes_and_publish`),api_document_url:G().url(),capability:X(`group_history_pagination`),identity:X(`bot`),required_scopes:pd([X(`im:message.group_msg`),X(`im:message.group_msg.include_bot:read`)]),schema_version:X(`lark_bot_group_history_permission_guidance_v0`)}).nullable().default(null),incoming_mode:_d([`mentions`,`all`]),ingress_mode:_d([`live_steering`,`session_queue`,`async_inbox`,`direct_session`]).default(`async_inbox`),event_count:K().int().nonnegative().default(0),last_event_reason:_d(Wg).nullable().default(null).catch(null),last_event_status:G().nullable().default(null),listener_error_code:G().nullable().default(null),listener_status:_d([`starting`,`listening`,`retrying`,`stopped`]).nullable().default(null),replied_count:K().int().nonnegative().default(0),reply_ready:q().default(!1),reply_mode:X(`topic_reply`),session_bound:q().default(!1),target_ref:G(),topic_name:G(),topic_setup_required:q()}))});async function Jg(){return qg.parse(await Lh(`/api/chat/lark/connections`)).connections}async function Yg(e){return og.parse(await Lh(`/api/chat/lark/connections`,{method:`POST`,body:JSON.stringify({...e.agentBindings?{agent_bindings:e.agentBindings.map(e=>({agent_id:e.agentId,app_ref:e.appRef}))}:{},...e.agentId?{agent_id:e.agentId}:{},...e.appRef?{app_ref:e.appRef}:{},...e.connectionId?{connection_id:e.connectionId}:{},conversation_kind:e.conversationKind??`goal`,capture_scope:e.captureScope,chat_id:e.chatId,chat_name:e.chatName,execute:e.execute,goal_id:e.goalId,incoming_mode:e.incomingMode,ingress_mode:e.ingressMode,reply_mode:e.replyMode})}))}async function Xg(e,t){let n=new URLSearchParams({goal_id:e,connection_id:t});return og.parse(await Lh(`/api/chat/lark/connections?${n.toString()}`,{method:`DELETE`}))}function Zg(e){return{loadedUrl:null,projectionRevision:0,requestedUrl:e,selectionRevision:0,requestGeneration:0}}function Qg(e,t){return e.selectionRevision+=1,e.requestedUrl=t,e.selectionRevision}function $g(e,t,n){if(n.background)return e.requestedUrl!==null||e.loadedUrl!==t?null:(e.requestGeneration+=1,{background:!0,projectionRevision:e.projectionRevision,selectionRevision:e.selectionRevision,url:t,generation:e.requestGeneration});let r=n.selectionRevision??e.selectionRevision+1;return n.selectionRevision!==void 0&&e.selectionRevision!==r?null:(e.selectionRevision=r,e.projectionRevision+=1,e.requestedUrl=t,e.requestGeneration+=1,{background:!1,projectionRevision:e.projectionRevision,selectionRevision:r,url:t,generation:e.requestGeneration})}function e_(e,t){return t.generation===e.requestGeneration&&e.projectionRevision===t.projectionRevision&&e.selectionRevision===t.selectionRevision}function t_(e,t){return e_(e,t)&&(!t.background||e.requestedUrl===null&&e.loadedUrl===t.url)}function n_(e,t,n){return t.get(e)===n}function r_(e,t,n,r){return e.filter(e=>n_(r(e),n,t))}function i_(e,t,n){let r=new Set,i=[];for(let a of[...e,...t]){let e=n(a);e==null||r.has(e)||(r.add(e),i.push(a))}return i}var a_=[`runs_24h`,`runs_7d`,`quota_spend_slots_24h`,`quota_spend_slots_7d`,`automation_run_count_24h`,`automation_run_count_7d`,`progress_signal_run_count_24h`,`progress_signal_run_count_7d`],o_=[`input_tokens_24h`,`input_tokens_7d`,`output_tokens_24h`,`output_tokens_7d`,`cache_tokens_24h`,`cache_tokens_7d`,`cost_usd_24h`,`cost_usd_7d`,`duration_ms_24h`,`duration_ms_7d`],s_=[`accounting`,`decision`,`evidence`,`state`,`work`],c_={accounting:0,decision:0,evidence:0,state:0,work:0},l_={runs_24h:0,runs_7d:0,quota_spend_slots_24h:0,quota_spend_slots_7d:0,automation_run_count_24h:0,automation_run_count_7d:0,progress_signal_run_count_24h:0,progress_signal_run_count_7d:0};function u_(e,t){let n={...e};for(let r of a_)n[r]=(Number(e[r])||0)+(Number(t[r])||0);for(let r of o_)(e[r]!==void 0||t[r]!==void 0)&&(n[r]=(e[r]??0)+(t[r]??0));return n}function d_(e,t){return!e.length||t<=0?e:e.map(e=>({...e,project_share_24h:Math.round((Number(e.runs_24h)||0)/t*1e3)/1e3}))}function f_(e,t){let n={...e};for(let r of s_)n[r]=(e[r]??0)+(t[r]??0);return n}function p_(e){let t={events_24h:0,events_7d:0,by_class_24h:{...c_},by_class_7d:{...c_}};for(let n of e)t.events_24h+=n.events_24h,t.events_7d+=n.events_7d,t.by_class_24h=f_(t.by_class_24h,n.by_class_24h),t.by_class_7d=f_(t.by_class_7d,n.by_class_7d);return t}function m_(e,t,n){if(!e&&!t)return null;let r=r_(e?.goals??[],`active`,n,e=>e.goal_id),i=r_(t?.goals??[],`stopped`,n,e=>e.goal_id),a=i_(r,i,e=>e.goal_id),o=p_(r),s=p_(i),c={events_24h:o.events_24h+s.events_24h,events_7d:o.events_7d+s.events_7d,by_class_24h:f_(o.by_class_24h,s.by_class_24h),by_class_7d:f_(o.by_class_7d,s.by_class_7d)};return{...e??t,goals:a,sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),totals:c}}function h_(e,t,n){if(!e&&!t)return null;let r=i_([...r_(e?.items??[],`active`,n,e=>e.goal_id),...r_(t?.items??[],`stopped`,n,e=>e.goal_id)],[],e=>`${e.goal_id}:${e.decision_kind??``}:${e.decision_at??``}`),i={decision_count:(e?.summary.decision_count??0)+(t?.summary.decision_count??0),stale_count:r.filter(e=>e.stale_by_age).length,rebase_required_count:(e?.summary.rebase_required_count??0)+(t?.summary.rebase_required_count??0),fresh_count:(e?.summary.fresh_count??0)+(t?.summary.fresh_count??0)};return{...e??t,items:r,sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),summary:i}}function g_(e,t){return i_([...e,...t].sort((e,t)=>t.generated_at.localeCompare(e.generated_at)),[],e=>`${e.goal_id}:${e.generated_at}:${e.classification??``}`)}function __(e,t,n){let r=i_(r_(e.items,`active`,n,e=>e.goal_id),r_(t.items,`stopped`,n,e=>e.goal_id),e=>e.goal_id);return{...e,item_count:r.length,items:r,needs_controller:r.filter(e=>e.waiting_on===`controller`).length,needs_codex:r.filter(e=>e.waiting_on===`codex`).length,needs_user_or_controller:r.filter(e=>[`user_or_controller`,`controller`].includes(e.waiting_on)).length,watching_external_evidence:r.filter(e=>e.waiting_on===`external_evidence`).length}}function v_(e){let t=e.todo_id?.trim()||``;return t?`${e.goal_id}:${t}`:`${e.goal_id}:synthetic:${e.role??``}:${e.index??``}:${e.text??``}`}function y_(e){let t={...l_};for(let n of e){for(let e of a_)t[e]+=Number(n[e])||0;for(let e of o_)n[e]!==void 0&&(t[e]=(t[e]??0)+n[e])}return t}function b_(e,t,n){if(!e&&!t)return null;let r=r_(e?.items??[],`active`,n,e=>e.goal_id),i=r_(t?.items??[],`stopped`,n,e=>e.goal_id),a=i_(r,i,v_);return{...e??t,current_projected_count:r.length+i.length,items:a,rollout_event_count:a.reduce((e,t)=>e+(t.event_count??0),0),total_count:a.length}}function x_(e,t,n){if(!e&&!t)return null;let r=r_(e?.goals??[],`active`,n,e=>e.goal_id),i=r_(t?.goals??[],`stopped`,n,e=>e.goal_id),a=i_(r,i,e=>e.goal_id),o=u_(y_(r),y_(i));return{...e??t,goals:d_(a,Number(o.runs_24h)||0),sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),totals:o}}function S_(e,t,n){if(!e&&!t)return null;let r=(e?.agents??[]).filter(e=>e.goal_ids.some(e=>n_(e,n,`active`))||(e.current_todo?.goal_id?n_(e.current_todo.goal_id,n,`active`):!1)),i=(t?.agents??[]).filter(e=>e.goal_ids.some(e=>n_(e,n,`stopped`))||(e.current_todo?.goal_id?n_(e.current_todo.goal_id,n,`stopped`):!1)),a=i_(r,i,e=>e.agent_id).map(e=>{let t=i.find(t=>t.agent_id===e.agent_id);return t?{...e,goal_ids:Array.from(new Set([...e.goal_ids??[],...t.goal_ids]))}:e});return{...e??t,agents:a,source_summary:(e??t)?.source_summary?{...(e??t).source_summary,projected_agent_count:a.length,registered_agent_count:new Set(a.map(e=>e.agent_id)).size}:(e??t)?.source_summary}}function C_(e,t,n){if(!e&&!t)return null;let r=i_(r_(e?.goals??[],`active`,n,e=>e.goal_id),r_(t?.goals??[],`stopped`,n,e=>e.goal_id),e=>e.goal_id);return{...e??t,goals:r}}function w_(e,t){let n=t.goal_projection?.scope;if(n!==`active`&&n!==`stopped`)return t;let r=n,i=t.run_history.goals,a=e.run_history.goals,o=i_(r===`active`?i:a.filter(e=>e.activation_state!==`stopped`),r===`stopped`?i:a.filter(e=>e.activation_state===`stopped`),e=>e.id),s=new Map(o.map(e=>[e.id,e.activation_state])),c=r===`active`?t:e,l=r===`stopped`?t:e,u=e.goal_projection?.registry_revision??null,d=t.goal_projection?.registry_revision??null,f=u===null||d===null||u===d;return{...e,agent_management_projection:S_(c.agent_management_projection,l.agent_management_projection,s),attention_queue:__(c.attention_queue,l.attention_queue,s),decision_freshness_summary:h_(c.decision_freshness_summary,l.decision_freshness_summary,s),event_ledger_summary:m_(c.event_ledger_summary,l.event_ledger_summary,s),goal_channel_notification_projection:C_(c.goal_channel_notification_projection,l.goal_channel_notification_projection,s),goal_projection:{schema_version:`loopx_goal_projection_scope_v0`,...t.goal_projection,complete:f,projected_goal_count:o.length,registry_goal_count:t.goal_projection?.registry_goal_count??0,scope:`all`},run_history:{...e.run_history,goal_count:o.length,goals:o,recent_runs:g_(c.run_history.recent_runs,l.run_history.recent_runs),run_count:c.run_history.run_count+l.run_history.run_count},todo_index:b_(c.todo_index,l.todo_index,s),usage_summary:x_(c.usage_summary,l.usage_summary,s)}}function T_(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,O_=E_,k_=(e,t)=>n=>{if(t?.variants==null)return O_(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=D_(t)||D_(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return O_(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},A_=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t({classGroupId:e,validator:t}),M_=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),N_=`-`,P_=[],F_=`arbitrary..`,I_=e=>{let t=z_(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return R_(e);let n=e.split(N_);return L_(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?A_(i,t):t:i||P_}return n[e]||P_}}},L_=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=L_(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(N_):e.slice(t).join(N_),s=a.length;for(let e=0;ee.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?F_+r:void 0})(),z_=e=>{let{theme:t,classGroups:n}=e;return B_(n,t)},B_=(e,t)=>{let n=M_();for(let r in e){let i=e[r];V_(i,n,r,t)}return n},V_=(e,t,n,r)=>{let i=e.length;for(let a=0;a{if(typeof e==`string`){U_(e,t,n);return}if(typeof e==`function`){W_(e,t,n,r);return}G_(e,t,n,r)},U_=(e,t,n)=>{let r=e===``?t:K_(t,e);r.classGroupId=n},W_=(e,t,n,r)=>{if(q_(e)){V_(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(j_(n,e))},G_=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e{let n=e,r=t.split(N_),i=r.length;for(let e=0;e`isThemeGetter`in e&&e.isThemeGetter===!0,J_=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Y_=`!`,X_=`:`,Z_=[],Q_=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),$_=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;si?a-i:void 0;return Q_(t,l,c,u)};if(t){let e=t+X_,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Q_(Z_,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ev=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},tv=e=>({cache:J_(e.cacheSize),parseClassName:$_(e),sortModifiers:ev(e),postfixLookupClassGroupIds:nv(e),...I_(e)}),nv=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(rv),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Y_:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e0?` `+l:l)}return l},av=(...e)=>{let t=0,n,r,i=``;for(;t{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r{let n,r,i,a,o=o=>(n=tv(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=iv(e,n);return i(e,a),a};return a=o,(...e)=>a(av(...e))},cv=[],lv=e=>{let t=t=>t[e]||cv;return t.isThemeGetter=!0,t},uv=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,dv=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fv=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,pv=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,mv=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,hv=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_v=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vv=e=>fv.test(e),yv=e=>!!e&&!Number.isNaN(Number(e)),bv=e=>!!e&&Number.isInteger(Number(e)),xv=e=>e.endsWith(`%`)&&yv(e.slice(0,-1)),Sv=e=>pv.test(e),Cv=()=>!0,wv=e=>mv.test(e)&&!hv.test(e),Tv=()=>!1,Ev=e=>gv.test(e),Dv=e=>_v.test(e),Ov=e=>!Q(e)&&!$(e),kv=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Av=e=>Gv(e,Yv,Tv),Q=e=>uv.test(e),jv=e=>Gv(e,Xv,wv),Mv=e=>Gv(e,Zv,yv),Nv=e=>Gv(e,$v,Cv),Pv=e=>Gv(e,Qv,Tv),Fv=e=>Gv(e,qv,Tv),Iv=e=>Gv(e,Jv,Dv),Lv=e=>Gv(e,ey,Ev),$=e=>dv.test(e),Rv=e=>Kv(e,Xv),zv=e=>Kv(e,Qv),Bv=e=>Kv(e,qv),Vv=e=>Kv(e,Yv),Hv=e=>Kv(e,Jv),Uv=e=>Kv(e,ey,!0),Wv=e=>Kv(e,$v,!0),Gv=(e,t,n)=>{let r=uv.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Kv=(e,t,n=!1)=>{let r=dv.exec(e);return r?r[1]?t(r[1]):n:!1},qv=e=>e===`position`||e===`percentage`,Jv=e=>e===`image`||e===`url`,Yv=e=>e===`length`||e===`size`||e===`bg-size`,Xv=e=>e===`length`,Zv=e=>e===`number`,Qv=e=>e===`family-name`,$v=e=>e===`number`||e===`weight`,ey=e=>e===`shadow`,ty=sv(()=>{let e=lv(`color`),t=lv(`font`),n=lv(`text`),r=lv(`font-weight`),i=lv(`tracking`),a=lv(`leading`),o=lv(`breakpoint`),s=lv(`container`),c=lv(`spacing`),l=lv(`radius`),u=lv(`shadow`),d=lv(`inset-shadow`),f=lv(`text-shadow`),p=lv(`drop-shadow`),m=lv(`blur`),h=lv(`perspective`),g=lv(`aspect`),_=lv(`ease`),v=lv(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),$,Q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$,Q,c],T=()=>[vv,`full`,`auto`,...w()],E=()=>[bv,`none`,`subgrid`,$,Q],D=()=>[`auto`,{span:[`full`,bv,$,Q]},bv,$,Q],O=()=>[bv,`auto`,$,Q],k=()=>[`auto`,`min`,`max`,`fr`,$,Q],ee=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],te=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],A=()=>[`auto`,...w()],j=()=>[vv,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],M=()=>[vv,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],N=()=>[vv,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,$,Q],F=()=>[...b(),Bv,Fv,{position:[$,Q]}],ne=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],re=()=>[`auto`,`cover`,`contain`,Vv,Av,{size:[$,Q]}],I=()=>[xv,Rv,jv],L=()=>[``,`none`,`full`,l,$,Q],ie=()=>[``,yv,Rv,jv],R=()=>[`solid`,`dashed`,`dotted`,`double`],ae=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],oe=()=>[yv,xv,Bv,Fv],se=()=>[``,`none`,m,$,Q],ce=()=>[`none`,yv,$,Q],le=()=>[`none`,yv,$,Q],ue=()=>[yv,$,Q],z=()=>[vv,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Sv],breakpoint:[Sv],color:[Cv],container:[Sv],"drop-shadow":[Sv],ease:[`in`,`out`,`in-out`],font:[Ov],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Sv],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Sv],shadow:[Sv],spacing:[`px`,yv],text:[Sv],"text-shadow":[Sv],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,vv,Q,$,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,$,Q]}],"container-named":[kv],columns:[{columns:[yv,Q,$,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[bv,`auto`,$,Q]}],basis:[{basis:[vv,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[yv,vv,`auto`,`initial`,`none`,Q]}],grow:[{grow:[``,yv,$,Q]}],shrink:[{shrink:[``,yv,$,Q]}],order:[{order:[bv,`first`,`last`,`none`,$,Q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ee(),`normal`]}],"justify-items":[{"justify-items":[...te(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...te()]}],"align-content":[{content:[`normal`,...ee()]}],"align-items":[{items:[...te(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...te(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...te(),`baseline`]}],"place-self":[{"place-self":[`auto`,...te()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:j()}],"inline-size":[{inline:[`auto`,...M()]}],"min-inline-size":[{"min-inline":[`auto`,...M()]}],"max-inline-size":[{"max-inline":[`none`,...M()]}],"block-size":[{block:[`auto`,...N()]}],"min-block-size":[{"min-block":[`auto`,...N()]}],"max-block-size":[{"max-block":[`none`,...N()]}],w:[{w:[s,`screen`,...j()]}],"min-w":[{"min-w":[s,`screen`,`none`,...j()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...j()]}],h:[{h:[`screen`,`lh`,...j()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...j()]}],"max-h":[{"max-h":[`screen`,`lh`,...j()]}],"font-size":[{text:[`base`,n,Rv,jv]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Wv,Nv]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,xv,Q]}],"font-family":[{font:[zv,Pv,t]}],"font-features":[{"font-features":[Q]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,$,Q]}],"line-clamp":[{"line-clamp":[yv,`none`,$,Mv]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$,Q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$,Q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...R(),`wavy`]}],"text-decoration-thickness":[{decoration:[yv,`from-font`,`auto`,$,jv]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[yv,`auto`,$,Q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[bv,$,Q]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$,Q]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,$,Q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:ne()}],"bg-size":[{bg:re()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},bv,$,Q],radial:[``,$,Q],conic:[bv,$,Q]},Hv,Iv]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-bs":[{"border-bs":ie()}],"border-w-be":[{"border-be":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...R(),`hidden`,`none`]}],"divide-style":[{divide:[...R(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...R(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[yv,$,Q]}],"outline-w":[{outline:[``,yv,Rv,jv]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,Uv,Lv]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,Uv,Lv]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:ie()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[yv,jv]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,Uv,Lv]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[yv,$,Q]}],"mix-blend":[{"mix-blend":[...ae(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ae()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[yv]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[$,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[yv]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:ne()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,$,Q]}],filter:[{filter:[``,`none`,$,Q]}],blur:[{blur:se()}],brightness:[{brightness:[yv,$,Q]}],contrast:[{contrast:[yv,$,Q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Uv,Lv]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,yv,$,Q]}],"hue-rotate":[{"hue-rotate":[yv,$,Q]}],invert:[{invert:[``,yv,$,Q]}],saturate:[{saturate:[yv,$,Q]}],sepia:[{sepia:[``,yv,$,Q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$,Q]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[yv,$,Q]}],"backdrop-contrast":[{"backdrop-contrast":[yv,$,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,yv,$,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[yv,$,Q]}],"backdrop-invert":[{"backdrop-invert":[``,yv,$,Q]}],"backdrop-opacity":[{"backdrop-opacity":[yv,$,Q]}],"backdrop-saturate":[{"backdrop-saturate":[yv,$,Q]}],"backdrop-sepia":[{"backdrop-sepia":[``,yv,$,Q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,$,Q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[yv,`initial`,$,Q]}],ease:[{ease:[`linear`,`initial`,_,$,Q]}],delay:[{delay:[yv,$,Q]}],animate:[{animate:[`none`,v,$,Q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$,Q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":[`scale-3d`],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[$,Q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:z()}],"translate-x":[{"translate-x":z()}],"translate-y":[{"translate-y":z()}],"translate-z":[{"translate-z":z()}],"translate-none":[`translate-none`],zoom:[{zoom:[bv,$,Q]}],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,$,Q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":P()}],"scrollbar-track-color":[{"scrollbar-track":P()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,$,Q]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[yv,Rv,jv,Mv]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function ny(...e){return ty(E_(e))}var ry=k_(`inline-flex h-9 shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md border px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 disabled:pointer-events-none disabled:opacity-50 dark:focus-visible:ring-zinc-500`,{variants:{variant:{primary:`border-slate-900 bg-slate-950 text-white hover:bg-slate-800 dark:border-zinc-100 dark:bg-zinc-50 dark:text-zinc-950 dark:hover:bg-zinc-200`,secondary:`border-slate-200 bg-white text-slate-900 hover:bg-slate-50 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-100 dark:hover:bg-zinc-900`,ghost:`border-transparent bg-transparent text-slate-700 hover:bg-slate-100 dark:text-zinc-300 dark:hover:bg-zinc-900`},size:{sm:`h-8 px-2 text-xs`,md:`h-9 px-3 text-sm`,icon:`h-9 w-9 px-0`}},defaultVariants:{variant:`secondary`,size:`md`}});function iy({className:e,variant:t,size:n,...r}){return(0,H.jsx)(`button`,{className:ny(ry({variant:t,size:n}),e),type:`button`,...r})}function ay({className:e,...t}){return(0,H.jsx)(`section`,{className:ny(`rounded-lg border border-slate-200/80 bg-white/95 text-slate-950 shadow-[0_1px_2px_rgba(15,23,42,0.04)] dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50`,e),...t})}function oy({className:e,...t}){return(0,H.jsx)(`div`,{className:ny(`p-4 pt-0`,e),...t})}var sy=[`codex`,`claude`,`kiro`,`trae`,`coco`,`openai`,`anthropic`],cy=new Set([`acp`,`status_projection`]);function ly(e){let t=e.trim().toLowerCase().replace(/_/gu,`-`);for(let e of sy)if(t===e||t.startsWith(`${e}-`))return e;return t}function uy(e,t){let n=t?.trim().toLowerCase()??``;return n.length>0&&!cy.has(n)?ly(n):ly(e)}var dy={stop:`ready_stop`,resume:`resume_review`,delete:`delete_review`};function fy(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function py(e){return typeof e==`string`&&e.trim().length>0?e:null}function my(e){let t=fy(e.projection);if(t?.schema_version!==`loopx_operation_projection_v0`)return null;let n=py(t.title),r=py(t.subtitle),i=py(t.focus),a=py(t.warning);if(!n||!r||!i||!a||!Array.isArray(t.fields))return null;let o=[];for(let e of t.fields){let t=fy(e),n=py(t?.label),r=py(t?.value);if(!n||!r)return null;o.push({label:n,value:r})}return{title:n,subtitle:r,focus:i,fields:o,warning:a}}function hy(e){let t=fy(e);if(t?.action_kind!==`operation.execute`)return;let n=fy(t.normalized_parameters),r=fy(t.operation);if(!n||r?.schema_version!==`loopx_operation_envelope_v0`)return;let i=py(r.operation_id),a=py(r.confirmation_digest),o=py(r.expires_at),s=my(n);if(!i||!a||!o||!s||i!==t.proposal_id)return;let c=r.lifecycle_state;if(c!==`awaiting_confirmation`&&c!==`claimed`&&c!==`outcome_observed`)return;let l={schemaVersion:`operation_review_frame_v0`,operationId:i,confirmationDigest:a,lifecycleState:c,simulated:fy(n.projection).simulated===!0,expiresAt:o,content:s};if(c===`awaiting_confirmation`)return{...l,kind:`confirmation`,attentionKind:`authority`,interactionMode:`confirm_reject`,decisions:[`confirm`,`reject`]};if(c===`claimed`)return{...l,kind:`pending`,attentionKind:`progress`,interactionMode:`inform`};let u=fy(r.outcome);if(!u)return;let d=u.outcome===`rejected_by_operator`,f=u.simulation===!0||l.simulated;return{...l,kind:`result`,attentionKind:`progress`,interactionMode:`inform`,resultKind:d?`rejected`:f?`simulation_completed`:`completed`,resultDeliveryVerified:fy(r.result_delivery)!==null,summary:py(u.summary)??``}}function gy(e){let t=fy(e)??{},n={schemaVersion:`action_review_plan_v0`,proposalId:typeof t.proposal_id==`string`?t.proposal_id:``,sourceFingerprint:typeof t.expected_state_fingerprint==`string`?t.expected_state_fingerprint:``},r=hy(t),i=e=>({...n,...e,...r?{operationFrame:r}:{}}),a=(e,t)=>i({interaction:e,reason:t,canApply:!1}),o=t.action_kind===`goal.lifecycle`;if(o&&t.gate!=null||t.status===`gated`)return a(`gated`,`authority_gate`);if(o&&t.stale!=null||t.status===`stale`)return a(`refresh`,`stale_proposal`);if(t.status===`applied`)return fy(t.receipt)?.projection_verified===!0&&(t.action_kind!==`operation.execute`||fy(fy(t.operation)?.result_delivery)!==null)?a(`completed`,`readback_verified`):a(`repair`,`readback_unverified`);if(t.status===`applying`)return a(`pending`,`apply_pending`);if(t.status===`failed`||t.error!=null)return a(`repair`,`apply_failed`);if(t.status!==`preview_ready`&&t.status!==`deferred`)return a(`inactive`,`inactive_proposal`);let s=(e,t=!0)=>i({interaction:`review`,reason:e,canApply:t});if(t.action_kind!==`goal.lifecycle`)return s(t.permission_classification===`protected`?`protected_action`:`action_review`);let c=t.validation_evidence,l=t.available_transitions;if(!(py(t.proposal_id)!==null&&py(t.expected_state_fingerprint)!==null&&Array.isArray(c)&&c.length>0&&c.every(e=>py(e)!==null)&&Array.isArray(l)&&l.includes(`apply`)))return a(`refresh`,`incomplete_proposal`);let u=fy(t.normalized_parameters),d=fy(t.context),f=u?.operation,p=py(u?.goal_id);if(!p||d?.goal_id!=null&&d.goal_id!==p)return a(`refresh`,`incomplete_proposal`);if(f!==`stop`&&f!==`resume`&&f!==`delete`)return s(`unknown_action`,!1);if(t.permission_classification===`protected`)return s(`protected_action`);if(t.permission_classification!==`durable_write`)return s(`unknown_permission`,!1);let m=dy[f];return m===`ready_stop`&&t.status===`preview_ready`?i({interaction:`direct`,reason:m,canApply:!0}):s(m===`ready_stop`?`action_review`:m)}function _y(e){return e.error_code===`action_stale`||e.error_code===`action_conflict`||fy(e.proposal)?.status===`stale`}function vy(e){return{blockingTodoCount:e.blockingTodoCount,goalNotifications:e.goalNotifications,goals:e.goals,openUserTodoCount:e.openUserTodoCount,systemHealth:e.systemHealth,attentionHistory:e.attentionHistory,userTodos:e.userTodos,workers:e.workers}}function yy(e,t){return e.goals.find(e=>e.goalId===t)?.title??t}function by(e){return e.activationState===`stopped`||e.state===`已停止`?`stopped`:e.state===`已完成`?`history`:e.needsYou||e.state===`等你`?`needs_you`:e.state===`推进中`||e.state===`需修复`?`running`:e.state===`安静运行`?`observing`:`scheduled`}function xy(e){let t=e;return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Sy(e){return`$${e.toFixed(2)}`}function Cy(e){let t=e;return t>=36e5?`${(t/36e5).toFixed(1)}h`:t>=6e4?`${(t/6e4).toFixed(1)}m`:t>=1e3?`${Math.round(t/1e3)}s`:`${t}ms`}function wy(e,t,n){return e==null?t:n(e)}function Ty(e){return!!(e&&[e.tokens24h,e.tokens7d,e.costUsd24h,e.costUsd7d,e.durationMs24h,e.durationMs7d].some(e=>e!=null))}function Ey(e,t){if(!Ty(e))return null;let n=(e,n,r,i)=>{let a=[n==null?null:`${xy(n)} ${t.tokens}`,r==null?null:`${t.cost}: ${Sy(r)}`,i==null?null:`${t.duration}: ${Cy(i)}`].filter(e=>e!==null);return a.length?`${e} ${a.join(` · `)}`:null};return n(t.period7d,e.tokens7d,e.costUsd7d,e.durationMs7d)??n(t.period24h,e.tokens24h,e.costUsd24h,e.durationMs24h)}function Dy({ariaLabel:e,className:t,icon:n,onChange:r,options:i,prefixLabel:a,value:o}){let s=(0,V.useId)(),c=(0,V.useRef)(null),l=(0,V.useRef)(null),u=(0,V.useRef)(new Map),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(o),h=i.find(e=>e.value===o)??i[0],g=i.filter(e=>!e.disabled);(0,V.useEffect)(()=>{if(!d)return;let e=e=>{c.current?.contains(e.target)||f(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[d]),(0,V.useEffect)(()=>{d&&u.current.get(p)?.focus()},[p,d]);function _(e){m(e)}function v(e=`selected`){let t=e===`last`?g.at(-1):g[0],n=e===`selected`&&h&&!h.disabled?h:t;n&&(f(!0),_(n.value))}function y({restoreFocus:e=!1}={}){f(!1),e&&l.current?.focus()}function b(e){e.disabled||(r(e.value),y({restoreFocus:!0}))}function x(e){if(!g.length)return;let t=g.findIndex(e=>e.value===p),n=t<0?0:(t+e+g.length)%g.length;_(g[n].value)}function S(e){e.key===`ArrowDown`||e.key===`Enter`||e.key===` `?(e.preventDefault(),v(`selected`)):e.key===`ArrowUp`&&(e.preventDefault(),v(`last`))}function C(e,t){if(e.key===`ArrowDown`)e.preventDefault(),x(1);else if(e.key===`ArrowUp`)e.preventDefault(),x(-1);else if(e.key===`Home`)e.preventDefault(),g[0]&&_(g[0].value);else if(e.key===`End`){e.preventDefault();let t=g.at(-1);t&&_(t.value)}else e.key===`Enter`||e.key===` `?(e.preventDefault(),b(t)):e.key===`Escape`?(e.preventDefault(),y({restoreFocus:!0})):e.key===`Tab`&&y()}let w;return(0,H.jsxs)(`div`,{className:`personal-select${t?` ${t}`:``}`,ref:c,children:[(0,H.jsxs)(`button`,{"aria-controls":s,"aria-expanded":d,"aria-haspopup":`listbox`,"aria-label":e,className:`personal-select-trigger`,"data-value":o,onClick:()=>d?y():v(),onKeyDown:S,ref:l,role:`combobox`,type:`button`,children:[n?(0,H.jsx)(`span`,{className:`personal-select-icon`,children:n}):null,(0,H.jsxs)(`span`,{className:`personal-select-value`,children:[a?(0,H.jsx)(`small`,{children:a}):null,(0,H.jsx)(`span`,{children:h?.label??o})]}),(0,H.jsx)(nm,{"aria-hidden":!0,className:d?`is-open`:void 0,size:14})]}),d?(0,H.jsx)(`div`,{"aria-label":e,className:`personal-select-listbox`,id:s,role:`listbox`,children:i.map(e=>{let t=e.group&&e.group!==w;return w=e.group,(0,H.jsxs)(`div`,{className:`personal-select-option-wrap`,children:[t?(0,H.jsx)(`div`,{className:`personal-select-group-label`,children:e.group}):null,(0,H.jsxs)(`button`,{"aria-disabled":e.disabled||void 0,"aria-selected":e.value===o,className:`personal-select-option`,disabled:e.disabled,id:`${s}-${e.value.replace(/[^a-z0-9_-]/gi,`-`)}`,onClick:()=>b(e),onFocus:()=>m(e.value),onKeyDown:t=>C(t,e),ref:t=>{t?u.current.set(e.value,t):u.current.delete(e.value)},role:`option`,tabIndex:e.value===p?0:-1,type:`button`,children:[(0,H.jsx)(`span`,{children:e.label}),e.value===o?(0,H.jsx)(tm,{"aria-hidden":!0,size:15}):null]})]},e.value)})}):null]})}function Oy({agents:e,managerChatOpen:t,managerRuntime:n,mobileNavigationOpen:r,onOpenGoalCapabilities:i,onOpenGoalDetail:a,onOpenManagerChat:o,onRefresh:s,onOpenNavigation:c,onSelectGoalTab:l,onSelectAgent:u,onReturnManagerHome:d,refreshState:f,readOnlySourceLabel:p,selectedAgentId:m,selectedGoal:h,selectedGoalTab:g}){let{locale:_,t:v}=qi(),[y,b]=(0,V.useState)(!1),x=(0,V.useRef)(null),S=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!y)return;function e(e){S.current?.contains(e.target)||b(!1)}function t(e){e.key===`Escape`&&(b(!1),x.current?.focus())}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[y]),(0,V.useEffect)(()=>b(!1),[h?.goalId]);function C(e){b(!1),e?.()}let w=h?Ey(h.usage,{cost:v(`drawer.costShort`),duration:v(`drawer.durationShort`),period24h:v(`drawer.period24h`),period7d:v(`drawer.period7d`),tokens:v(`drawer.tokensShort`)}):null;return(0,H.jsxs)(`header`,{className:`personal-channel-header`,children:[(0,H.jsx)(`button`,{"aria-expanded":r??!1,"aria-label":v(`header.openGoalNavigation`),className:`personal-icon-button personal-mobile-menu`,onClick:c,type:`button`,children:(0,H.jsx)(Em,{size:18})}),(0,H.jsxs)(`div`,{className:`personal-channel-title`,children:[(0,H.jsx)(`h1`,{children:h?.title??v(`header.manager`)}),!h&&n?(0,H.jsx)(`p`,{children:n.status===`ready`?v(`header.managerRuntime`,{profile:n.runtime_profile,sandbox:n.sandbox}):v(`header.managerRuntimeFallback`,{profile:n.runtime_profile,sandbox:n.sandbox})}):null,h?(0,H.jsx)(`p`,{children:h.loadState?v(h.loadState===`error`?`startup.goalError`:`startup.goalLoading`):`${h.agentLaneCount&&h.agentLaneCount>1?v(`header.workAgentCount`,{count:h.agentLaneCount}):h.agentLabel??h.agentId} · ${h.loadState?v(h.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Ji(h.state,_)}${w?` · ${w}`:``} · ${h.nextSentence}`}):null]}),h?(0,H.jsxs)(`nav`,{"aria-label":v(`header.goalView`),className:`personal-goal-tabs`,children:[(0,H.jsx)(`button`,{"aria-current":g===`chat`?`page`:void 0,onClick:()=>l(`chat`),type:`button`,children:v(`header.chat`)}),(0,H.jsx)(`button`,{"aria-current":g===`tasks`?`page`:void 0,onClick:()=>l(`tasks`),type:`button`,children:v(`header.tasks`)}),(0,H.jsx)(`button`,{"aria-current":g===`files`?`page`:void 0,onClick:()=>l(`files`),type:`button`,children:v(`header.files`)})]}):(0,H.jsxs)(`nav`,{"aria-label":v(`header.managerView`),className:`personal-goal-tabs`,children:[(0,H.jsx)(`button`,{"aria-current":t?void 0:`page`,onClick:d,type:`button`,children:v(`header.managerOverview`)}),(0,H.jsx)(`button`,{"aria-current":t?`page`:void 0,onClick:o,type:`button`,children:v(`header.chat`)})]}),(0,H.jsxs)(`div`,{className:`personal-channel-actions`,children:[h&&a&&i?(0,H.jsxs)(`div`,{className:`personal-goal-tools`,ref:S,children:[(0,H.jsxs)(`button`,{"aria-expanded":y,"aria-haspopup":`menu`,"aria-label":v(`header.goalSettingsDescription`),className:`personal-goal-tools-trigger`,onClick:()=>b(e=>!e),ref:x,title:v(`header.goalSettingsDescription`),type:`button`,children:[(0,H.jsx)(Km,{"aria-hidden":!0,size:16}),(0,H.jsx)(`span`,{children:v(`header.goalSettings`)}),(0,H.jsx)(nm,{"aria-hidden":!0,size:13})]}),y?(0,H.jsxs)(`fieldset`,{"aria-label":v(`header.goalSettings`),className:`personal-goal-tools-menu`,children:[(0,H.jsxs)(`button`,{onClick:()=>C(a),type:`button`,children:[(0,H.jsx)(bm,{"aria-hidden":!0,size:17}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:v(`header.goalDetails`)})})]}),(0,H.jsxs)(`button`,{onClick:()=>C(i),type:`button`,children:[(0,H.jsx)(Km,{"aria-hidden":!0,size:17}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:v(`header.goalCapabilities`)})})]})]}):null]}):null,p?(0,H.jsxs)(`span`,{className:`personal-read-only-source`,title:v(`header.readOnlySourceDescription`,{source:p}),children:[(0,H.jsx)(mm,{size:15}),p,(0,H.jsx)(`small`,{children:v(`common.readOnly`)})]}):(0,H.jsx)(Dy,{ariaLabel:v(`header.selectChatRuntime`),className:`personal-agent-select`,icon:(0,H.jsx)(Qp,{size:16}),onChange:u,options:e.map(e=>({disabled:!e.available,label:`${e.label}${e.available?``:` · ${v(`header.agentUnavailable`)}`}`,value:e.agentId})),prefixLabel:v(`header.chatRuntime`),value:m}),(0,H.jsxs)(`span`,{className:`personal-live-indicator`,children:[(0,H.jsx)(`i`,{}),v(`header.live`)]}),s?(0,H.jsxs)(`span`,{className:`personal-refresh-control is-${f??`idle`}`,children:[f===`loading`?(0,H.jsx)(`small`,{children:v(`header.refreshing`)}):f===`done`?(0,H.jsx)(`small`,{children:v(`header.refreshDone`)}):f===`error`?(0,H.jsx)(`small`,{children:v(`header.refreshFailed`)}):null,(0,H.jsx)(`button`,{"aria-label":v(f===`loading`?`header.refreshing`:`header.refresh`),className:`personal-icon-button`,disabled:f===`loading`,onClick:s,type:`button`,children:(0,H.jsx)(Lm,{className:f===`loading`?`is-spinning`:void 0,size:17})})]}):null]})]})}function ky({attention:e,onSelect:t}){let{t:n}=qi(),r=Xi(e.updatedAt,n);return(0,H.jsxs)(`button`,{className:`personal-timeline-row personal-attention-row`,"data-testid":`personal-browse-row`,onClick:t,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-row-icon is-attention`,children:(0,H.jsx)(am,{size:18})}),(0,H.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,H.jsxs)(`small`,{children:[e.goalTitle??e.goalId,` · `,n(`home.lane.needsYou`),r?` · ${n(`tasks.waitingAge`,{age:r})}`:``]}),(0,H.jsx)(`strong`,{children:e.text})]}),(0,H.jsx)(`span`,{className:`personal-priority-dot is-${e.priority??(e.blocking?`high`:`medium`)}`}),(0,H.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?n(`tasks.blocked`):n(`tasks.pending`)}),(0,H.jsx)(rm,{size:17})]})}var Ay=/(`[^`\n]+`)|(\*\*[^*\n]+(\*[^*\n]*)?\*\*)|(\[[^\]\n]{1,120}\]\(https?:\/\/[^)\s]+\))/g;function jy(e,t){let n=[],r=0,i=0;for(let a of e.matchAll(Ay)){let o=a.index??0;o>r&&n.push(e.slice(r,o));let s=a[0],c=`${t}-i${i++}`;if(s.startsWith("`"))n.push((0,H.jsx)(`code`,{className:`personal-md-code`,children:s.slice(1,-1)},c));else if(s.startsWith(`**`))n.push((0,H.jsx)(`strong`,{children:s.slice(2,-2)},c));else{let e=s.indexOf(`](`),t=s.slice(1,e),r=s.slice(e+2,-1);n.push((0,H.jsx)(`a`,{className:`personal-md-link`,href:r,rel:`noreferrer`,target:`_blank`,children:t},c))}r=o+s.length}return r{r.length>0&&(n.push({type:`paragraph`,lines:r}),r=[])},a=0;for(;a{let n=`b${t}`;if(e.type===`code`)return(0,H.jsx)(`pre`,{className:`personal-md-pre`,children:(0,H.jsx)(`code`,{children:e.text})},n);if(e.type===`heading`)return(0,H.jsx)(`p`,{className:`personal-md-heading is-h${e.level}`,children:jy(e.text,n)},n);if(e.type===`list`){let t=e.items.map((e,t)=>(0,H.jsx)(`li`,{children:jy(e,`${n}-${t}`)},`${n}-${t}`));return e.ordered?(0,H.jsx)(`ol`,{className:`personal-md-list`,children:t},n):(0,H.jsx)(`ul`,{className:`personal-md-list`,children:t},n)}return(0,H.jsx)(`p`,{children:e.lines.map((e,t)=>(0,H.jsxs)(V.Fragment,{children:[t>0?(0,H.jsx)(`br`,{}):null,jy(e,`${n}-${t}`)]},`${n}-${t}`))},n)})})}function Iy({onSelect:e,output:t}){let{t:n}=qi(),r=t.kind===`report`?_m:gm;return(0,H.jsxs)(`button`,{className:`personal-timeline-row personal-output-row`,"data-output-kind":t.kind,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-row-icon is-output`,children:(0,H.jsx)(r,{size:18})}),(0,H.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,H.jsxs)(`small`,{children:[t.goalTitle??t.goalId,` · `,t.agentLabel??`LoopX`]}),(0,H.jsx)(`strong`,{children:t.title}),t.summary?(0,H.jsx)(`span`,{children:t.summary}):null,t.report?(0,H.jsxs)(`small`,{children:[n(`files.reportDelta`,{added:t.report.addedCount,changed:t.report.changedCount}),` · `,n(`files.verifiedReport`)]}):null]}),t.createdAt?(0,H.jsx)(`time`,{children:t.createdAt}):null,(0,H.jsx)(rm,{size:17})]})}var Ly={completed:`runs.completed`,failed:`runs.failed`,interrupted:`runs.interrupted`,queued:`runs.queued`,running:`runs.running`,waiting:`runs.waiting`};function Ry({onSelect:e,run:t}){let{t:n}=qi(),r=t.totalSteps>0?Math.min(100,t.completedSteps/t.totalSteps*100):0;return(0,H.jsxs)(`button`,{"aria-label":`${n(`tasks.viewExecution`)}:${t.title}`,className:`personal-timeline-row personal-run-row`,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-row-icon is-run`,children:(0,H.jsx)(Qp,{size:18})}),(0,H.jsxs)(`span`,{className:`personal-run-identity`,children:[(0,H.jsx)(`small`,{children:t.goalTitle}),(0,H.jsx)(`strong`,{children:t.agentLabel})]}),(0,H.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,H.jsx)(`strong`,{children:t.title}),(0,H.jsx)(`small`,{children:t.latestActivity})]}),(0,H.jsxs)(`span`,{className:`personal-run-progress`,"aria-label":`${t.completedSteps}/${t.totalSteps}`,children:[(0,H.jsxs)(`small`,{children:[t.completedSteps,`/`,t.totalSteps]}),(0,H.jsx)(`i`,{children:(0,H.jsx)(`b`,{style:{width:`${r}%`}})})]}),(0,H.jsxs)(`span`,{className:`personal-row-status is-${t.status}`,children:[t.status===`running`?(0,H.jsx)(wm,{className:`personal-spin`,size:14}):null,n(Ly[t.status])]}),t.sessionId?(0,H.jsx)(`span`,{className:`personal-run-open-label`,children:n(`tasks.viewExecution`)}):null,(0,H.jsx)(rm,{size:17})]})}function zy({onSelect:e,schedule:t}){let{t:n}=qi(),r=t.scheduleKind===`heartbeat`;return(0,H.jsxs)(`button`,{"aria-label":`${r?`Heartbeat`:n(`tasks.scheduled`)}:${t.label};${t.status??`active`}`,className:`personal-schedule-row`,onClick:e,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-schedule-icon`,children:r?(0,H.jsx)(Im,{size:17}):(0,H.jsx)(em,{size:17})}),(0,H.jsxs)(`span`,{className:`personal-schedule-copy`,children:[(0,H.jsx)(`small`,{children:n(r?`schedule.heartbeat`:`schedule.monitor`)}),(0,H.jsx)(`strong`,{children:t.label}),(0,H.jsx)(`p`,{children:t.schedule??n(`schedule.summary`)})]}),(0,H.jsx)(`span`,{className:`personal-schedule-status is-${t.status??`active`}`,children:t.status===`paused`?n(`schedule.paused`):n(`schedule.active`)}),(0,H.jsx)(rm,{size:16})]})}function By({items:e,onSelect:t,selectedGoal:n}){let{t:r}=qi();if(e.length===0)return(0,H.jsxs)(`div`,{className:`personal-timeline-empty`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(qm,{size:20})}),(0,H.jsx)(`strong`,{children:r(n?`timeline.emptyGoal`:`timeline.emptyWorkspace`)}),(0,H.jsx)(`p`,{children:r(n?`timeline.emptyGoalDescription`:`timeline.emptyWorkspaceDescription`)})]});let i=[...e].reverse().find(e=>e.kind===`message`&&e.message.role!==`user`||e.kind===`proposal`&&[`applied`,`stale`,`error`,`gated`].includes(e.proposal.status)||e.kind===`run`&&e.run.status===`completed`),a=i?.kind===`message`?`${i.message.agentLabel??r(`header.manager`)}:${i.message.pending?r(`timeline.pending`):i.message.text}`:i?.kind===`proposal`?`${i.proposal.title}:${i.proposal.status}`:i?.kind===`run`?r(`timeline.runCompleted`,{run:i.run.title}):``,o=e.filter(e=>e.kind===`proposal`&&e.proposal.status===`gated`),s=e.filter(e=>e.kind!==`proposal`),c=e.filter(e=>e.kind===`proposal`&&e.proposal.status!==`gated`);function l(e){return e.kind===`attention`?(0,H.jsx)(ky,{attention:e.attention,onSelect:()=>t({item:e.attention,kind:`attention`})},e.id):e.kind===`run`?(0,H.jsx)(Ry,{onSelect:()=>t({item:e.run,kind:`run`}),run:e.run},e.id):e.kind===`output`?(0,H.jsx)(Iy,{onSelect:()=>t({item:e.output,kind:`output`}),output:e.output},e.id):e.kind===`schedule`?(0,H.jsx)(zy,{onSelect:()=>t({item:e.schedule,kind:`schedule`}),schedule:e.schedule},e.id):e.kind===`proposal`?(0,H.jsxs)(`button`,{className:`personal-proposal-row is-${e.proposal.status}`,onClick:()=>t({item:e.proposal,kind:`proposal`}),type:`button`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(qm,{size:17})}),(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(`small`,{children:[e.proposal.actionKind,` · `,e.proposal.status]}),(0,H.jsx)(`strong`,{children:e.proposal.title}),(0,H.jsx)(`p`,{children:e.proposal.impact})]}),(0,H.jsx)(`b`,{children:e.proposal.status===`gated`&&e.proposal.actionKind!==`operation.execute`?r(`timeline.review`):e.proposal.primaryLabel??r(`timeline.reviewAndConfirm`)})]},e.id):(0,H.jsxs)(`article`,{className:`personal-message is-${e.message.role}`,children:[e.message.role===`user`?null:(0,H.jsx)(`span`,{className:`personal-message-avatar`,children:(0,H.jsx)(Qp,{size:17})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:e.message.role===`user`?r(`common.you`):e.message.agentLabel??r(`header.manager`)}),e.message.time?(0,H.jsx)(`time`,{children:e.message.time}):null]}),e.message.attachments?.length?(0,H.jsx)(`div`,{className:`personal-message-images`,children:e.message.attachments.map(e=>(0,H.jsx)(`img`,{alt:e.name,src:e.dataUrl},e.id))}):null,e.message.role===`user`?(0,H.jsx)(`p`,{children:e.message.text}):(0,H.jsx)(Fy,{text:e.message.text}),e.message.pending?(0,H.jsx)(`span`,{className:`personal-message-pending`,children:r(`timeline.pending`)}):null]})]},e.id)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{"aria-atomic":`true`,"aria-live":`polite`,className:`personal-live-region`,role:`status`,children:a}),(0,H.jsxs)(`div`,{className:`personal-channel-timeline`,children:[s.map(l),o.length?(0,H.jsxs)(`details`,{className:`personal-gated-summary`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(qm,{size:16})}),(0,H.jsx)(`strong`,{children:r(`timeline.waitingConfirmation`)}),(0,H.jsx)(`small`,{children:r(`timeline.gateHistory`,{count:o.length})})]}),(0,H.jsx)(`div`,{children:o.map(l)})]}):null,c.map(l)]})]})}function Vy({goal:e}){let{t}=qi(),n={connected:t(`acceptance.connected`),mapped:t(`acceptance.mapped`),refreshed:t(`acceptance.refreshed`),adapter_inspected:t(`acceptance.inspected`),run_recorded:t(`acceptance.recorded`),reward_judged:t(`acceptance.judged`),operator_approved:t(`acceptance.approved`),controller_ready:t(`acceptance.ready`),attention_queue:t(`acceptance.attentionSource`),agent_vision:t(`acceptance.visionSource`),todo_projection:t(`acceptance.todoSource`),current_run:t(`acceptance.runSource`)},r=e=>n[e]??t(`acceptance.unknown`),i=e.acceptanceObservation,a=e.loadState||!i||i.goal_id!==e.goalId||i.coverage===`unavailable`;return(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-acceptance`,"aria-label":t(`acceptance.title`),children:[(0,H.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,H.jsx)(`h3`,{children:t(`acceptance.title`)}),(0,H.jsx)(`em`,{children:t(`common.readOnly`)})]}),(0,H.jsx)(`p`,{role:`status`,children:t(a?`acceptance.unavailable`:`acceptance.partial`)}),!a&&i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h4`,{children:t(`acceptance.gaps`)}),i.acceptance_gaps.length?i.acceptance_gaps.map((e,n)=>(0,H.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,H.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.owner`)}),(0,H.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,H.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.observed`)}),(0,H.jsx)(`dd`,{children:e.observed_at??t(`acceptance.unknown`)})]})]})]},`${e.kind}:${e.owner}:${n}`)):(0,H.jsx)(`p`,{children:t(`acceptance.noGaps`)}),(0,H.jsx)(`h4`,{children:t(`acceptance.guards`)}),i.guards.length?i.guards.map((e,n)=>(0,H.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,H.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.owner`)}),(0,H.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),e.blocks_agent?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.agent`)}),(0,H.jsx)(`dd`,{children:e.blocks_agent})]}):null,e.todo_id?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.task`)}),(0,H.jsx)(`dd`,{children:e.todo_id})]}):null,(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,H.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.scope`)}),(0,H.jsx)(`dd`,{children:e.decision_scope??t(`acceptance.unknown`)})]})]})]},`${e.todo_id}:${n}`)):(0,H.jsx)(`p`,{children:t(`acceptance.noGuards`)}),(0,H.jsx)(`h4`,{children:t(`acceptance.next`)}),(0,H.jsx)(`p`,{children:i.next_action??t(`acceptance.unknown`)}),(0,H.jsxs)(`details`,{children:[(0,H.jsxs)(`summary`,{children:[t(`acceptance.historical_progress`),` · `,i.historical_progress.length]}),(0,H.jsx)(`p`,{children:t(`acceptance.historical`)}),i.historical_progress.map(e=>(0,H.jsxs)(`p`,{children:[(0,H.jsx)(`strong`,{children:r(e.kind)}),` · `,e.observed_at??t(`acceptance.unknown`),` `,e.evidence_refs.join(`, `)]},e.kind))]}),i.missing_sources.length?(0,H.jsxs)(`p`,{children:[t(`acceptance.missing`),` `,i.missing_sources.map(r).join(`, `)]}):null,i.truncated?(0,H.jsx)(`p`,{children:t(`acceptance.truncated`)}):null]}):null]})}function Hy({item:e,successor:t,onSelect:n}){let{t:r}=qi(),i=e.details;return(0,H.jsxs)(`section`,{className:`personal-detail-card`,"aria-label":r(`attentionDetail.title`),children:[(0,H.jsx)(`h3`,{children:r(`attentionDetail.title`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.request`)}),(0,H.jsx)(`dd`,{children:r(i?.interaction===`decision`?`attentionDetail.decision`:`attentionDetail.unknownRequest`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`common.status`)}),(0,H.jsx)(`dd`,{children:r(`attentionDetail.${i?.lifecycle??`unknown`}`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`drawer.reason`)}),(0,H.jsx)(`dd`,{children:i?.reason??e.explanation??r(`attentionDetail.unknownReason`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Todo`}),(0,H.jsx)(`dd`,{children:e.todoId})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.targetTodo`)}),(0,H.jsx)(`dd`,{children:i?.unblocksTodoId??r(`attentionDetail.notProvided`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.targetAgent`)}),(0,H.jsx)(`dd`,{children:i?.blocksAgent??r(`attentionDetail.notProvided`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.scope`)}),(0,H.jsx)(`dd`,{children:i?.decisionScope?`${i.decisionScope.kind} · ${i.decisionScope.granularity} · ${i.decisionScope.scopeKey}`:r(`attentionDetail.notProvided`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`drawer.evidence`)}),(0,H.jsx)(`dd`,{children:i?.evidence??e.evidence??r(`drawer.decisionDefaultEvidence`)})]})]}),i?.supersededBy?(0,H.jsxs)(`p`,{children:[r(`attentionDetail.replacement`),`: `,i.supersededBy]}):null,t&&n?(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>n(t),type:`button`,children:r(`attentionDetail.openReplacement`)}):null,(0,H.jsx)(`p`,{children:r(`attentionDetail.boundary`)})]})}function Uy(e){return e.replace(/\s+/gu,` `).trim()}function Wy(e,t){let n=RegExp(`(?:不要|不需要|无需|禁止|别|暂不|do not\\b|don't\\b|without\\b).{0,10}(?:${t.source})`,`iu`),r=RegExp(`(?:${t.source}).{0,10}(?:不要|不需要|无需|禁止|关闭)`,`iu`),i=RegExp(`disable\\b.{0,10}(?:${t.source})|(?:turn|switch|set)\\b.{0,10}(?:${t.source}).{0,10}\\boff\\b|(?:${t.source})\\s+(?:is\\s+)?disabled\\b`,`iu`);return n.test(e)||r.test(e)||i.test(e)}function Gy(e){return/(我现在该做什么|下一步|哪些\s*Goal\s*在等我|需要我|谁在等我|Agent\s*在做什么|当前进度|总结(?:今天)?进展)/iu.test(e)}function Ky(e){let t=/(怎么|如何|为什么|给.*建议|分析一下|解释|只读)/u.test(e),n=/(解决一下|修复一下|处理一下|执行一下|改一下|跑(?:一下)?测试|rebase|push|提交|推送)/iu.test(e);return!t&&n&&/(帮我|请|给我|直接|现在|开始|bytedcli|codebase|git|rebase|push|提交|推送)/iu.test(e)}function qy(e){return Uy(e).toLowerCase().match(/(?:^|[\s,,;;:((:]|到|至)(?todo_done:todo_[a-z0-9_-]{3,64}|pr_merged:(?:(?:[a-z0-9_.-]{1,80})\/(?:[a-z0-9_.-]{1,100}))?#[1-9][0-9]{0,8}|capacity_available:[a-z][a-z0-9_:-]{0,63}|resume_at:[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}t[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\.[0-9]{1,3})?(?:z|[+-][0-9]{2}:[0-9]{2}))(?=$|[\s,,。;;))])/iu)?.groups?.condition??null}function Jy(e,t){let n=Uy(e),r=[],i=t.agents.find(e=>{let t=n.toLowerCase();return t.includes(e.agentId.toLowerCase())||t.includes(e.label.toLowerCase())}),a=t.todos.find(e=>n.includes(e.todoId)||n.includes(e.text)),o=/(刚刚|已经|已)(?:经)?\s*(新增|创建|添加)(?:的)?\s*(todo|待办|任务)/iu.test(n),s=!!t.goalId&&!Wy(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n);if(!t.goalId&&!Wy(n,/goal|目标/iu)&&/(创建|新建|设置|create|start|set up).{0,24}(goal|目标)/iu.test(n)&&r.push({actionKind:`goal.create`,confidence:.97,normalizedParameters:{heartbeat_enabled:!Wy(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n)}}),t.goalId&&s&&r.push({actionKind:`heartbeat.bind`,confidence:.96,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&!s&&!Wy(n,/定时|监控|监测|持续观察|scheduled check|monitor/iu)&&/(定时|监控|监测|每.{0,8}(分钟|小时|天)|持续观察|scheduled check|monitor|every.{0,12}(minute|hour|day)|daily)/iu.test(n)&&r.push({actionKind:`monitor.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&i&&!Wy(n,/绑定|负责|接管|管理/iu)&&/((让|交给).{0,20}(管理|负责|接管).{0,8}(goal|目标)|(绑定).{0,12}(goal|目标)|(goal|目标).{0,12}(交给|绑定|负责|接管))/iu.test(n)&&r.push({actionKind:`agent.bind`,confidence:.96,normalizedParameters:{agent_id:i.agentId,goal_id:t.goalId}}),t.goalId&&!o&&!Wy(n,RegExp(`todo|待办|任务`,`iu`))&&/(创建|新建|新增|添加|加一个|记一个).{0,16}(todo|待办|任务)|(todo|待办|任务).{0,12}(创建|新建|新增|添加)|(?:create|add)(?:\s+(?:a|an|new))?\s+(?:todo|task)|(?:todo|task).{0,12}(?:create|add)/iu.test(n)&&r.push({actionKind:`todo.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&Ky(n)&&r.push({actionKind:`todo.create`,confidence:.9,normalizedParameters:{goal_id:t.goalId,start_execution:!0}}),t.goalId&&a){let e=!Wy(n,/完成|做完|关闭/u)&&/完成|做完|关闭/u.test(n)?`complete`:!Wy(n,/阻塞|卡住/u)&&/阻塞|卡住/u.test(n)?`block`:!Wy(n,/暂缓|稍后|推迟/u)&&/暂缓|稍后|推迟/u.test(n)?`defer`:i&&!Wy(n,/交给|分配给|改派/u)&&/交给|分配给|改派/u.test(n)?`reassign`:null;if(e){let i=e===`defer`?qy(n):null;if(e===`defer`&&!i)return{actionKind:`todo.update`,confidence:.97,missingFields:[`resume_when`],normalizedParameters:{goal_id:t.goalId,operation:e,todo_id:a.todoId},route:`clarify`};r.push({actionKind:`todo.update`,confidence:.97,normalizedParameters:{goal_id:t.goalId,operation:e,...i?{resume_when:i}:{},todo_id:a.todoId}})}}let c=[...new Map(r.map(e=>[e.actionKind,e])).values()];return c.length>1?{actionKind:null,confidence:.4,missingFields:[`single_intent`],normalizedParameters:{},route:`clarify`}:c.length===1?{...c[0],missingFields:[],route:`typed_action`}:!t.goalId&&Gy(n)?{actionKind:null,confidence:.98,missingFields:[],normalizedParameters:{},route:`projection`}:{actionKind:null,confidence:.75,missingFields:[],normalizedParameters:{},route:`agent_chat`}}function Yy(e,t,n){if(!e)return{};if(!t.trim())return{modelConfig:null};let r={model:t.trim()};return n&&(r.reasoning_effort=n),{modelConfig:r}}var Xy=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`select:not([disabled])`,`input:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`),Zy=[{key:`drawer.taskBlock`,operation:`block`},{key:`drawer.taskSuccessor`,operation:`successor_create`}],Qy=[{key:`drawer.decisionReject`,resolution:`reject`},{key:`drawer.decisionDefer`,resolution:`defer`}],$y=Array.from({length:32},(e,t)=>t+1),eb=/^[a-z][a-z0-9_.-]{0,63}$/u;function tb(e){let t=String(e??``).trim().toLowerCase();return eb.test(t)?t:null}function nb(e,t){return e.enabled===t.enabled&&e.maxChildren===t.maxChildren&&JSON.stringify(e.modelConfig??null)===JSON.stringify(t.modelConfig??null)&&[...e.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)===[...t.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)}function rb({agents:e,attentionHistory:t=[],onSelectAttention:n,callbacks:r,goalNotifications:i=[],goals:a=[],inspectorExpanded:o=!1,larkConnections:s=[],onClose:c,onToggleInspectorSize:l,readOnly:u=!1,runs:d=[],selection:f}){let{locale:p,t:m}=qi(),[h,g]=(0,V.useState)(``),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(`idle`),[x,S]=(0,V.useState)(`record`),[C,w]=(0,V.useState)([]),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(2),[k,ee]=(0,V.useState)(``),[te,A]=(0,V.useState)(``),[j,M]=(0,V.useState)(`idle`),[N,P]=(0,V.useState)(null),[F,ne]=(0,V.useState)(null),re=(0,V.useRef)(null),I=(0,V.useRef)(null),[L,ie]=(0,V.useState)(e.find(e=>e.available)?.agentId??`codex`),[R,ae]=(0,V.useState)(``),oe=(0,V.useRef)(null),se=(0,V.useRef)(null),ce=(0,V.useRef)(null),le=(0,V.useRef)(null),ue=f.kind===`run`?`run:${f.item.runId}`:f.kind===`proposal`?`proposal:${f.item.previewId}`:f.kind===`todo`?`todo:${f.item.todoId}`:f.kind===`attention`?`attention:${f.item.todoId}`:f.kind===`output`?`output:${f.item.outputId}`:f.kind===`schedule`?`schedule:${f.item.scheduleId}`:`goal:${f.item.goalId}`;(0,V.useEffect)(()=>{b(`idle`),v(!1),S(`record`),ae(``);let e=f.kind===`goal`?f.item.subagentExecution:void 0;w(e?.allowedDomains??[]),ee(e?.modelConfig?.model??``),A(e?.modelConfig?.reasoning_effort??``),O(e?.maxChildren?Math.min(e.maxChildren,32):2),E(null),M(`idle`),P(null),ne(null),re.current=e??null,I.current=null},[ue]);let z=f.kind===`goal`?f.item.subagentExecution:void 0;(0,V.useEffect)(()=>{let e=re.current,t=z?!e||!nb(e,z):e!==null;if(re.current=z??null,!F){t&&z&&(w(z.allowedDomains),ee(z.modelConfig?.model??``),A(z.modelConfig?.reasoning_effort??``),O(z.maxChildren||2),E(null),M(`idle`),P(null));return}let n=I.current;(!z||nb(F,z)||n&&!nb(n,z))&&(z&&(w(z.allowedDomains),ee(z.modelConfig?.model??``),A(z.modelConfig?.reasoning_effort??``),O(z.maxChildren||2)),I.current=null,ne(null))},[z,F]),(0,V.useEffect)(()=>{let e=document.activeElement;e instanceof HTMLElement&&!se.current?.contains(e)&&(ce.current=e);let t=window.requestAnimationFrame(()=>le.current?.focus());return()=>window.cancelAnimationFrame(t)},[ue]);let de=(0,V.useCallback)(()=>{let e=ce.current;c(),window.requestAnimationFrame(()=>e?.focus())},[c]);(0,V.useEffect)(()=>{function e(e){if(e.key===`Escape`){e.preventDefault(),de();return}if(e.key===`Tab`&&f.kind!==`todo`){let t=Array.from(se.current?.querySelectorAll(Xy)??[]).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`);if(t.length===0)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[de,f.kind]);let fe=f.kind===`attention`?m(`drawer.titleAttention`):f.kind===`todo`?m(`drawer.taskDetails`):f.kind===`run`?m(`drawer.runDetails`):f.kind===`output`?m(`drawer.titleOutput`):f.kind===`proposal`?m(f.item.status===`applied`?`drawer.titleProposalApplied`:`drawer.titleProposalConfirm`):f.kind===`schedule`?f.item.scheduleKind===`heartbeat`?`Heartbeat`:m(`drawer.titleSchedule`):m(`drawer.goalDetails`),pe=f.kind===`proposal`?f.item.goalId??`manager`:f.item.goalId,me=f.kind===`attention`?f.item.goalTitle??m(`drawer.currentGoal`):f.kind===`todo`||f.kind===`run`?f.item.goalTitle:f.kind===`output`?f.item.goalTitle??m(`drawer.currentGoal`):f.kind===`goal`?f.item.title:f.kind===`schedule`?m(`drawer.goalAutoRun`):f.item.goalId?m(`drawer.goalChanges`):m(`drawer.managerChanges`),he=f.kind===`goal`?d.find(e=>e.goalId===f.item.goalId&&!!e.sessionId)??d.find(e=>e.goalId===f.item.goalId):null,ge=f.kind===`run`&&(f.item.completedSteps>0||!!f.item.latestActivity||!!f.item.outputs?.length),_e=f.kind===`attention`?Xi(f.item.updatedAt,m):null,ve=qy(R);async function ye(){f.kind!==`run`||!h.trim()||(await r.onCorrectRun?.(f.item,h.trim()),g(``))}async function be(e,t,n,i){if(t===`successor_create`){await r.onPreviewAction?.({actionKind:`todo.create`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-successor-${e.todoId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,text:m(`drawer.taskSuccessorText`,{task:e.text})},summary:m(`drawer.taskSuccessorSummary`,{task:e.text})});return}await r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-${e.todoId}-${t}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:e.claimedBy??L,goal_id:e.goalId,operation:t,...t===`block`?{note:m(`drawer.taskSuccessorNote`)}:{},...t===`defer`&&i?{resume_when:i}:{},todo_id:e.todoId},summary:`${n}:${e.text}`})}async function xe(e,t,n){u||!qd(e)||await r.onPreviewAction?.({actionKind:`gate.resolve`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-decision-${e.todoId}-${t}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,decision:t,todo_id:e.todoId},summary:`${n}:${e.text}`})}let Se=f.kind===`goal`?F??f.item.subagentExecution??{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0}:{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0},Ce=j===`previewing`||j===`applying`,we=(()=>{if(f.kind!==`goal`)return[];let e=new Map;for(let t of Se.allowedDomains){let n=tb(t);n&&e.set(n,{matchingTodoCount:0,value:n})}if(Se.domainCandidates)for(let t of Se.domainCandidates){let n=tb(t.domain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+t.matchingTodoCount,value:n})}else for(let t of f.item.agentTodos){if(t.done||t.taskClass!==`advancement_task`)continue;let n=tb(t.taskDomain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+1,value:n})}return[...e.values()]})();function Te(){w(Se.allowedDomains),ee(Se.modelConfig?.model??``),A(Se.modelConfig?.reasoning_effort??``),O(Se.maxChildren||2),E(null),M(`idle`),P(null)}function B(){let e=[...new Set(C.map(e=>tb(e)))];return e.every(e=>!!e)?e:null}function Ee(e,t){w(n=>t?[...n,e].filter((e,t,n)=>n.indexOf(e)===t):n.filter(t=>t!==e)),P(null),M(`idle`),E(null)}async function De(e,t=e){if(f.kind!==`goal`||!r.onPreviewGoalSubagentConfiguration)return;let n=e?B():[];if(t&&!k.trim()&&te){M(`error`),E(m(`drawer.subagentModelRequired`));return}if(e&&!n){M(`error`),E(m(`drawer.subagentDomainInvalid`)),P(null);return}let i={allowedDomains:n??[],enabled:e,goalId:f.item.goalId,maxChildren:e?D:0,...Yy(t,k,te)};M(`previewing`),E(m(`drawer.subagentPreviewing`)),P(null);try{let e=await r.onPreviewGoalSubagentConfiguration(i);if(!e.changed){I.current=z??null,ne({...e.configuration,domainCandidates:Se.domainCandidates}),w(e.configuration.allowedDomains),ee(e.configuration.modelConfig?.model??``),A(e.configuration.modelConfig?.reasoning_effort??``),O(e.configuration.maxChildren||2),M(`success`),E(m(`drawer.subagentNoChange`));return}P({...i,changed:e.changed,previewId:e.previewId}),M(`ready`),E(m(`drawer.subagentPreviewReady`))}catch(e){M(`error`),E(e instanceof Error?e.message:m(`drawer.subagentPreviewFailed`))}}async function Oe(){if(!(!N||!r.onApplyGoalSubagentConfiguration)){M(`applying`),E(m(`drawer.subagentApplying`));try{let e=await r.onApplyGoalSubagentConfiguration({allowedDomains:N.allowedDomains,enabled:N.enabled,goalId:N.goalId,maxChildren:N.maxChildren,modelConfig:N.modelConfig,previewId:N.previewId});I.current=z??null,ne({...e,domainCandidates:Se.domainCandidates}),w(e.allowedDomains),ee(e.modelConfig?.model??``),A(e.modelConfig?.reasoning_effort??``),O(e.maxChildren||2),M(`success`),E(m(`drawer.subagentApplied`)),P(null);try{await r.onRefresh?.()}catch{M(`warning`),E(m(`drawer.subagentAppliedRefreshFailed`))}}catch(e){M(`error`),E(e instanceof Error?e.message:m(`drawer.subagentApplyFailed`))}}}return(0,H.jsxs)(`div`,{"aria-labelledby":`personal-drawer-title`,"aria-modal":f.kind===`todo`?void 0:`true`,className:`personal-context-drawer`,"data-context-kind":f.kind,ref:se,role:`dialog`,children:[(0,H.jsxs)(`header`,{className:`personal-drawer-header${f.kind===`todo`?` is-task-inspector`:``}`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{id:`personal-drawer-title`,ref:le,tabIndex:-1,children:fe}),(0,H.jsx)(`p`,{children:me})]}),(0,H.jsxs)(`div`,{className:`personal-drawer-header-actions`,children:[f.kind===`todo`&&l?(0,H.jsx)(`button`,{"aria-label":m(o?`drawer.inspectorHalf`:`drawer.inspectorFull`),className:`personal-icon-button personal-inspector-size`,onClick:l,title:m(o?`drawer.inspectorHalfView`:`drawer.inspectorFullView`),type:`button`,children:o?(0,H.jsx)(km,{size:17}):(0,H.jsx)(Tm,{size:17})}):null,(0,H.jsxs)(`button`,{"aria-label":m(`drawer.closeDetail`,{context:me}),className:`personal-icon-button personal-drawer-close`,onClick:de,ref:oe,type:`button`,children:[(0,H.jsx)(Kp,{className:`personal-mobile-back`,size:18}),(0,H.jsx)(eh,{className:`personal-desktop-close`,size:18})]})]})]}),(0,H.jsxs)(`div`,{className:`personal-drawer-body`,children:[f.kind===`attention`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card is-attention`,children:[(0,H.jsx)(`small`,{children:f.item.blocking?m(`drawer.attentionBlocking`):m(`drawer.attentionWaiting`)}),(0,H.jsx)(`h3`,{children:f.item.text}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,H.jsx)(`dd`,{children:f.item.priority??`medium`})]}),_e?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`common.waiting`)}),(0,H.jsx)(`dd`,{children:m(`tasks.waitingAge`,{age:_e})})]}):null]})]}),(0,H.jsx)(Hy,{item:f.item,onSelect:n,successor:Kd(f.item,t)}),!u&&qd(f.item)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void xe(f.item,`approve`,m(`common.confirm`)),type:`button`,children:[(0,H.jsx)(tm,{size:17}),m(`drawer.decisionReview`)]}),(0,H.jsxs)(`details`,{className:`personal-compact-menu`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(fm,{size:17}),m(`drawer.decisionMore`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{onClick:()=>void r.onExplainDecision?.(f.item),type:`button`,children:[(0,H.jsx)(Dm,{size:16}),m(`drawer.explainDecision`)]}),Qy.map(e=>(0,H.jsx)(`button`,{onClick:()=>void xe(f.item,e.resolution,m(e.key)),type:`button`,children:m(e.key)},e.resolution))]})]})]}):null]}):null,f.kind===`todo`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-task-inspector-summary`,children:[(0,H.jsxs)(`div`,{className:`personal-task-inspector-status`,children:[(0,H.jsxs)(`span`,{className:f.item.done?`is-done`:f.item.status===`blocked`?`is-blocked`:`is-open`,children:[(0,H.jsx)(`i`,{}),f.item.done?m(`drawer.taskStatusCompleted`):f.item.status===`deferred`?m(`drawer.taskStatusDeferred`):f.item.status===`blocked`?m(`drawer.taskStatusBlocked`):m(`drawer.taskStatusOpen`)]}),f.item.priority?(0,H.jsx)(`span`,{children:f.item.priority}):null,(0,H.jsx)(`span`,{children:f.item.taskClass===`advancement_task`?m(`drawer.taskAdvancement`):f.item.taskClass??m(`drawer.taskOrdinary`)})]}),(0,H.jsx)(`h3`,{children:f.item.text})]}),(0,H.jsxs)(`section`,{"aria-label":m(`drawer.taskInfo`),className:`personal-task-inspector-fields`,children:[(0,H.jsx)(`h4`,{children:m(`drawer.taskInfo`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`common.owner`)}),(0,H.jsx)(`dd`,{children:f.item.ownerLabel??f.item.claimedBy??m(`drawer.notAssigned`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`common.status`)}),(0,H.jsx)(`dd`,{children:f.item.done?m(`drawer.taskStatusCompleted`):f.item.status===`deferred`?m(`drawer.taskStatusDeferred`):f.item.status===`blocked`?m(`drawer.taskStatusBlocked`):m(`drawer.taskStatusOpen`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,H.jsx)(`dd`,{children:f.item.priority??m(`drawer.notSet`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.dependencies`)}),(0,H.jsx)(`dd`,{children:f.item.dependencies?.join(` · `)||m(`common.none`)})]}),f.item.status===`deferred`||f.item.resumeWhen?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.resumeWhen`)}),(0,H.jsx)(`dd`,{children:f.item.resumeWhen||m(`drawer.notSet`)})]}):null,f.item.resumeWhen?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.resumeState`)}),(0,H.jsx)(`dd`,{children:f.item.resumeReady?m(`drawer.resumeReady`):m(`drawer.resumePending`)})]}):null,f.item.resumeReceiptId?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.resumeReceipt`)}),(0,H.jsx)(`dd`,{children:f.item.resumeReceiptId})]}):null,(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.nextTransition`)}),(0,H.jsx)(`dd`,{children:f.item.nextTransition??(f.item.done?m(`drawer.taskNextCompleted`):f.item.resumeReady?m(`drawer.taskNextResumeReady`):f.item.status===`deferred`?m(`drawer.taskNextDeferred`):m(`drawer.taskNextOpen`))})]})]})]}),!u&&!f.item.done?(0,H.jsxs)(`div`,{className:`personal-task-inspector-actions`,"aria-label":m(`drawer.taskActions`),children:[(0,H.jsxs)(`details`,{className:`personal-task-management`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(fm,{size:16}),m(`drawer.taskManage`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:m(`drawer.reassign`)}),(0,H.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.reassign`),(0,H.jsx)(`select`,{"aria-label":m(`drawer.reassign`),onChange:e=>ie(e.target.value),value:L,children:e.filter(e=>e.available).map(e=>(0,H.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:f.item.goalId,kind:`todo`,todo_id:f.item.todoId},idempotencyKey:`workspace-todo-${f.item.todoId}-reassign-${L}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:L,goal_id:f.item.goalId,operation:`reassign`,todo_id:f.item.todoId},summary:m(`drawer.reassignSummary`,{task:f.item.text})}),type:`button`,children:m(`timeline.review`)})]}),(0,H.jsx)(`strong`,{children:m(`drawer.taskDeferUntil`)}),(0,H.jsxs)(`label`,{className:`personal-inline-agent-select personal-inline-resume-when`,children:[m(`drawer.taskDeferUntil`),(0,H.jsx)(`input`,{"aria-label":m(`drawer.taskDeferCondition`),"aria-invalid":!!R.trim()&&!ve,onChange:e=>ae(e.target.value),placeholder:m(`drawer.taskDeferPlaceholder`),value:R}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:!ve,onClick:()=>void be(f.item,`defer`,m(`drawer.taskDefer`),ve??void 0),type:`button`,children:m(`drawer.taskDeferReview`)}),(0,H.jsx)(`small`,{children:R.trim()&&!ve?m(`drawer.taskDeferInvalid`):m(`drawer.taskDeferSupported`)})]}),(0,H.jsx)(`div`,{className:`personal-task-management-secondary`,children:Zy.map(e=>(0,H.jsx)(`button`,{onClick:()=>void be(f.item,e.operation,m(e.key)),type:`button`,children:m(e.key)},e.operation))})]})]}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void be(f.item,`complete`,m(`drawer.taskComplete`)),type:`button`,children:[(0,H.jsx)(tm,{size:17}),m(`drawer.taskComplete`)]})]}):null,f.item.done?(0,H.jsxs)(`div`,{className:`personal-task-completed-note`,children:[(0,H.jsx)(tm,{size:16}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:m(`drawer.taskCompletedTitle`)}),(0,H.jsx)(`small`,{children:m(`drawer.taskCompletedNote`)})]})]}):null]}):null,f.kind===`goal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsx)(`small`,{children:Ji(f.item.state,p)}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.agentSentence}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.tokens`)}),(0,H.jsxs)(`dd`,{children:[wy(f.item.usage?.tokens24h,m(`drawer.usageNotMeasured`),xy),` / `,wy(f.item.usage?.tokens7d,m(`drawer.usageNotMeasured`),xy)]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.cost`)}),(0,H.jsxs)(`dd`,{children:[wy(f.item.usage?.costUsd24h,m(`drawer.usageNotMeasured`),Sy),` / `,wy(f.item.usage?.costUsd7d,m(`drawer.usageNotMeasured`),Sy)]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.duration`)}),(0,H.jsxs)(`dd`,{children:[wy(f.item.usage?.durationMs24h,m(`drawer.usageNotMeasured`),Cy),` / `,wy(f.item.usage?.durationMs7d,m(`drawer.usageNotMeasured`),Cy)]})]})]})]}),(0,H.jsx)(Vy,{goal:f.item}),(()=>{let e=i.find(e=>e.goalId===f.item.goalId),t=s.find(e=>e.goal_id===f.item.goalId);return(0,H.jsxs)(H.Fragment,{children:[f.item.repository?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-repository`,children:[(0,H.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,H.jsx)(`small`,{children:m(`drawer.repository`)}),(0,H.jsx)(`em`,{children:m(`common.readOnly`)})]}),(0,H.jsxs)(`h3`,{children:[(0,H.jsx)(vm,{size:16}),f.item.repository.label]}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.branch`)}),(0,H.jsx)(`dd`,{children:f.item.repository.branch||`detached`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Role`}),(0,H.jsx)(`dd`,{children:m(`drawer.repositoryRole`)})]})]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>{let e=navigator.clipboard?.writeText(f.item.repository?.identity??``);if(!e){b(`error`);return}e.then(()=>b(`copied`)).catch(()=>b(`error`))},type:`button`,children:[(0,H.jsx)(lm,{size:15}),m(y===`copied`?`drawer.copyRepositoryDone`:`drawer.copyRepository`)]}),y===`error`?(0,H.jsx)(`p`,{className:`personal-copy-feedback is-error`,role:`status`,children:m(`drawer.copyRepositoryError`)}):y===`copied`?(0,H.jsx)(`p`,{className:`personal-copy-feedback`,role:`status`,children:m(`drawer.copyRepositorySuccess`)}):null]}):null,u?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,H.jsx)(`small`,{children:m(`drawer.larkConnection`)}),(0,H.jsx)(`h3`,{children:m(`drawer.remoteDetailsUnavailable`)}),(0,H.jsx)(`p`,{children:m(`drawer.remoteDetailsDescription`)})]}):(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,H.jsx)(`small`,{children:m(`drawer.larkConnection`)}),t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{children:[t.app_label,(0,H.jsx)(`span`,{className:`personal-connection-status`,children:m(`drawer.connected`)})]}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.group`)}),(0,H.jsx)(`dd`,{children:t.chat_name})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.topic`)}),(0,H.jsxs)(`dd`,{children:[`# `,t.topic_name]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.trigger`)}),(0,H.jsx)(`dd`,{children:t.incoming_mode===`mentions`?m(`lark.someoneMentions`):m(`lark.allMessages`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.replyMode`)}),(0,H.jsx)(`dd`,{children:m(`lark.topicReply`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.autoNotify`)}),(0,H.jsx)(`dd`,{children:e?.humanGateAutoNotifyEnabled?m(`common.on`):m(`common.off`)})]}),e?.lastNotifiedAt?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.lastNotification`)}),(0,H.jsx)(`dd`,{children:e.lastNotifiedAt})]}):null]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{children:m(`drawer.larkNotConfigured`)}),(0,H.jsx)(`p`,{children:m(`drawer.larkNotConfiguredDescription`)})]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onOpenNotificationSettings?.(f.item.goalId),type:`button`,children:[(0,H.jsx)(Zp,{size:16}),m(t?`drawer.larkConfigure`:`drawer.larkConnect`)]})]})]})})(),(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-session`,children:[(0,H.jsx)(`small`,{children:m(`drawer.runDetails`)}),he?.sessionId?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{children:Yi(he.sessionStatus??he.status,m)}),(0,H.jsx)(`p`,{children:he.title}),r.onOpenRunSession?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onOpenRunSession?.(he),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.runLatest`)]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{children:m(`drawer.noRun`)}),(0,H.jsx)(`p`,{children:m(`drawer.noRunDescription`)})]})]}),u?null:(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`heartbeat`,f.item.goalId),type:`button`,children:[(0,H.jsx)(Im,{size:16}),m(`drawer.setupHeartbeat`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`monitor`,f.item.goalId),type:`button`,children:[(0,H.jsx)(em,{size:16}),m(`drawer.scheduleAdd`)]})]}),f.item.subagentExecution?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-subagents`,children:[(0,H.jsxs)(`div`,{className:`personal-subagent-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:m(`drawer.subagentLabel`)}),(0,H.jsxs)(`h3`,{children:[(0,H.jsx)(Qp,{size:16}),m(`drawer.subagentTitle`)]})]}),(0,H.jsxs)(`button`,{"aria-checked":Se.enabled,"aria-label":m(N&&j===`ready`?`drawer.subagentPending`:Se.enabled?`drawer.subagentDisable`:`drawer.subagentEnable`),className:`personal-subagent-switch`,"data-pending":N&&j===`ready`?`true`:void 0,disabled:u||Ce||!!N||!r.onPreviewGoalSubagentConfiguration,onClick:()=>void De(!Se.enabled),role:`switch`,type:`button`,children:[(0,H.jsx)(`span`,{}),m(N&&j===`ready`?`drawer.subagentPending`:Se.enabled?`common.on`:`common.off`)]})]}),(0,H.jsx)(`p`,{children:m(`drawer.subagentDescription`)}),N&&j===`ready`?(0,H.jsxs)(`div`,{className:`personal-subagent-preview`,children:[(0,H.jsx)(`strong`,{children:m(N.enabled?`drawer.subagentConfirmEnable`:`drawer.subagentConfirmDisable`)}),(0,H.jsx)(`p`,{children:N.enabled?m(`drawer.subagentPreviewSummary`,{count:N.maxChildren,domains:N.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)}):m(`drawer.subagentDisableSummary`)}),N.modelConfig===void 0?null:(0,H.jsxs)(`p`,{children:[m(`drawer.subagentModel`),`: `,N.modelConfig?.model||m(`drawer.subagentModelDefault`),` · `,N.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`button`,{className:`personal-primary-action`,onClick:()=>void Oe(),type:`button`,children:m(`common.confirm`)}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:Te,type:`button`,children:m(`common.cancel`)})]})]}):null,T?(0,H.jsxs)(`p`,{className:`personal-subagent-feedback is-${j}`,role:`status`,children:[j===`previewing`||j===`applying`?(0,H.jsx)(Rm,{className:`personal-spin`,size:13}):null,T]}):null,(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentModel`)}),(0,H.jsx)(`dd`,{children:Se.modelConfig?.model||m(`drawer.subagentModelDefault`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentEffort`)}),(0,H.jsx)(`dd`,{children:Se.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentCurrentBoundary`)}),(0,H.jsx)(`dd`,{children:Se.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentChildLimit`)}),(0,H.jsx)(`dd`,{children:Se.maxChildren||0})]})]}),u?(0,H.jsx)(`p`,{className:`personal-subagent-read-only`,children:m(`drawer.subagentRemoteReadOnly`)}):(0,H.jsxs)(`div`,{className:`personal-subagent-fields`,children:[(0,H.jsxs)(`fieldset`,{className:`personal-subagent-domain-picker`,disabled:Ce,children:[(0,H.jsx)(`legend`,{children:m(`drawer.subagentDomains`)}),we.length>0?(0,H.jsx)(`div`,{className:`personal-subagent-domain-options`,children:we.map(e=>{let t=C.includes(e.value);return(0,H.jsxs)(`label`,{className:`personal-subagent-domain-option${t?` is-selected`:``}`,children:[(0,H.jsx)(`input`,{"aria-label":e.value,checked:t,onChange:t=>Ee(e.value,t.target.checked),type:`checkbox`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.value}),(0,H.jsx)(`small`,{children:m(`drawer.subagentDomainTodoCount`,{count:e.matchingTodoCount})})]})]},e.value)})}):(0,H.jsx)(`p`,{className:`personal-subagent-domain-empty`,children:m(`drawer.subagentDomainsEmpty`)}),(0,H.jsx)(`small`,{children:m(`drawer.subagentDomainsHint`)})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:m(`drawer.subagentModel`)}),(0,H.jsx)(`input`,{"aria-label":m(`drawer.subagentModel`),disabled:Ce,value:k,placeholder:`gpt-5.6-luna`,onChange:e=>{ee(e.target.value),P(null),M(`idle`),E(null)}})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:m(`drawer.subagentEffort`)}),(0,H.jsxs)(`select`,{"aria-label":m(`drawer.subagentEffort`),disabled:Ce,value:te,onChange:e=>{A(e.target.value),P(null),M(`idle`),E(null)},children:[(0,H.jsx)(`option`,{value:``,children:m(`drawer.subagentModelDefault`)}),[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`].map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]})]}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:Ce,type:`button`,onClick:()=>{ee(`gpt-5.6-luna`),A(`max`),P(null),M(`idle`),E(null)},children:m(`drawer.subagentLunaPreset`)}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:Ce,type:`button`,onClick:()=>{ee(``),A(``),P(null),M(`idle`),E(null)},children:m(`drawer.subagentClearModel`)}),(0,H.jsx)(`p`,{children:m(`drawer.subagentModelHint`)}),(0,H.jsxs)(`label`,{className:`personal-subagent-limit-field`,children:[(0,H.jsx)(`span`,{children:m(`drawer.subagentMaxChildren`)}),(0,H.jsx)(`select`,{"aria-label":m(`drawer.subagentMaxChildren`),disabled:Ce,onChange:e=>{O(Number(e.target.value)),P(null),M(`idle`),E(null)},value:D,children:$y.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})]}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:Ce,onClick:()=>void De(Se.enabled,!0),type:`button`,children:m(`drawer.subagentPreviewBoundary`)})]})]}):null]}):null,f.kind===`run`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{"aria-label":m(`drawer.runView`),className:`personal-run-drawer-tabs`,role:`tablist`,children:[(0,H.jsx)(`button`,{"aria-selected":x===`record`,onClick:()=>S(`record`),role:`tab`,type:`button`,children:m(`drawer.executionRecordAndResult`)}),(0,H.jsx)(`button`,{"aria-selected":x===`details`,onClick:()=>S(`details`),role:`tab`,type:`button`,children:m(`drawer.detailsAndActions`)})]}),x===`record`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card personal-session-summary`,children:[(0,H.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Yi(f.item.sessionStatus??f.item.status,m)]}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.latestActivity}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,H.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]})]})]}),(0,H.jsxs)(`section`,{"aria-label":m(`drawer.executionRecord`),className:`personal-session-message-record`,children:[(0,H.jsx)(`h3`,{children:m(`drawer.executionRecord`)}),f.item.sessionMessages?.length?(0,H.jsx)(`ol`,{children:f.item.sessionMessages.map(e=>(0,H.jsxs)(`li`,{className:`is-${e.role}`,children:[(0,H.jsx)(`i`,{}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:e.role===`user`?m(`drawer.runRoleUser`):e.role===`assistant`?m(`drawer.runRoleAssistant`):m(`drawer.runRoleSystem`)}),e.createdAt?(0,H.jsx)(`time`,{children:new Date(e.createdAt).toLocaleTimeString(p,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}):null]}),(0,H.jsx)(`p`,{children:e.text})]})]},e.messageId))}):(0,H.jsx)(`p`,{className:`personal-session-empty`,children:ge?m(`drawer.runRecordProjected`,{completed:f.item.completedSteps,outputs:f.item.outputs?.length?m(`drawer.runRecordProjectedOutputs`,{count:f.item.outputs.length}):``,total:f.item.totalSteps}):m(`drawer.runRecordEmpty`)}),f.item.status===`running`?(0,H.jsxs)(`div`,{className:`personal-session-active-step`,children:[(0,H.jsx)(`i`,{}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:m(`drawer.analysis`)}),(0,H.jsx)(`small`,{children:m(`drawer.agentWorking`)})]})]}):null]}),f.item.outputs?.length?(0,H.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-run-outputs-title`,children:[(0,H.jsx)(`h3`,{id:`personal-run-outputs-title`,children:m(`drawer.outputs`)}),(0,H.jsx)(`ol`,{children:f.item.outputs.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsx)(`small`,{children:e.createdAt??e.kind??m(`files.emptySummary`)})]})},e.outputId))})]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Yi(f.item.status,m)]}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.latestActivity}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,H.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.sessionStatus`)}),(0,H.jsx)(`dd`,{children:Yi(f.item.sessionStatus??f.item.status,m)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.sessionRecoverable`)}),(0,H.jsx)(`dd`,{children:f.item.resumable===!1?m(`drawer.resumeNo`):m(`drawer.resumeYes`)})]})]})]}),f.item.sessionStatus===`resume_failed`&&!u?(0,H.jsxs)(`section`,{className:`personal-recovery-panel`,"aria-label":m(`drawer.recoveryFailed`),children:[(0,H.jsx)(`strong`,{children:m(`drawer.recoveryFailed`)}),(0,H.jsx)(`p`,{children:m(`drawer.recoveryDescription`)}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,H.jsx)(Rm,{size:16}),m(`drawer.recoveryRetry`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.recoveryNewSession`)]})]}):null,u?null:(0,H.jsxs)(`section`,{className:`personal-correction-panel`,children:[(0,H.jsx)(`header`,{children:(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:16}),m(`drawer.correctionLabel`,{agent:f.item.agentLabel})]})}),(0,H.jsx)(`p`,{children:m(`drawer.correctionDescription`)}),(0,H.jsxs)(`div`,{className:`personal-correction-composer`,children:[(0,H.jsx)(`textarea`,{"aria-label":m(`drawer.correctionTextarea`,{agent:f.item.agentLabel,goal:f.item.goalTitle,run:f.item.title}),onChange:e=>g(e.target.value),placeholder:m(`drawer.correctionPlaceholder`),rows:3,value:h}),(0,H.jsx)(`button`,{"aria-label":m(`drawer.correctionSend`),disabled:!h.trim(),onClick:()=>void ye(),type:`button`,children:(0,H.jsx)(Vm,{size:16})})]})]}),u?null:(0,H.jsxs)(`details`,{className:`personal-compact-menu personal-run-more`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(fm,{size:17}),m(`drawer.moreRunActions`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{disabled:!f.item.canInterrupt,onClick:()=>void r.onInterruptRun?.(f.item),type:`button`,children:[(0,H.jsx)(Nm,{size:16}),m(`drawer.runInterrupt`)]}),(0,H.jsxs)(`button`,{disabled:f.item.resumable===!1,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,H.jsx)(Rm,{size:16}),m(`drawer.recoveryRetry`)]}),(0,H.jsxs)(`button`,{onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.runNewSession`)]}),(0,H.jsxs)(`button`,{onClick:()=>void r.onCloseRunSession?.(f.item),type:`button`,children:[(0,H.jsx)(Jm,{size:16}),m(`drawer.runCloseSession`)]})]})]})]})]}):null,f.kind===`output`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsx)(`small`,{children:f.item.kind??`output`}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.summary??m(`drawer.outputRecorded`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.outputTodo`)}),(0,H.jsx)(`dd`,{children:f.item.todoId??m(`drawer.notLinked`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.outputRun`)}),(0,H.jsx)(`dd`,{children:f.item.runId??m(`drawer.notLinked`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Agent`}),(0,H.jsx)(`dd`,{children:f.item.agentLabel??f.item.agentId??`LoopX`})]})]})]}),f.item.report?(0,H.jsxs)(`section`,{className:`personal-report-detail`,"data-testid":`personal-periodic-report-detail`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(`strong`,{children:[`+`,f.item.report.addedCount]}),m(`files.reportAdded`)]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:f.item.report.changedCount}),m(`files.reportChanged`)]})]}),(0,H.jsxs)(`p`,{children:[f.item.report.periodStartAt,` → `,f.item.report.periodEndAt]}),(0,H.jsx)(`ol`,{children:f.item.report.items.map(e=>(0,H.jsxs)(`li`,{"data-change-kind":e.changeKind,children:[(0,H.jsxs)(`small`,{children:[e.changeKind,` · `,e.status]}),(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsx)(`p`,{children:e.summary})]},e.sourceRef))}),(0,H.jsxs)(`footer`,{children:[(0,H.jsxs)(`span`,{children:[m(`files.reportPublication`),`: `,f.item.report.publicationId]}),(0,H.jsxs)(`span`,{children:[m(`files.reportGeneration`),`: `,f.item.report.generationId]})]})]}):null,f.item.safePreview?(0,H.jsx)(`pre`,{"aria-label":m(`drawer.outputSafePreview`),className:`personal-safe-preview`,children:f.item.safePreview}):(0,H.jsx)(`p`,{className:`personal-preview-unavailable`,children:m(`drawer.previewUnavailable`)}),(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:!r.onOpenOutput,onClick:()=>{r.onOpenOutput?.(f.item),c()},type:`button`,children:[(0,H.jsx)(pm,{size:16}),m(`files.openConversation`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!r.onExportOutput,onClick:()=>void r.onExportOutput?.(f.item),type:`button`,children:[(0,H.jsx)(dm,{size:16}),m(`files.exportSummary`)]})]})]}):null,f.kind===`proposal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-proposal-card`,children:[(0,H.jsxs)(`small`,{children:[f.item.actionKind,` · `,f.item.status]}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.impact}),f.item.reviewPlan?(0,H.jsx)(`p`,{className:`personal-proposal-explainer`,"data-action-review":f.item.reviewPlan.interaction,children:f.item.actionKind===`operation.execute`&&f.item.status===`gated`?m(`actionReview.operation_group_confirmation`):f.item.actionKind===`operation.execute`&&f.item.reviewPlan.reason===`readback_unverified`?m(`actionReview.operation_result_delivery_pending`):m(`actionReview.${f.item.reviewPlan.reason}`)}):null,f.item.status===`ready`?(0,H.jsx)(`p`,{className:`personal-proposal-explainer`,children:m(`drawer.proposalExplainer`)}):null,(0,H.jsx)(`dl`,{children:f.item.fields.map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:e.label}),(0,H.jsx)(`dd`,{children:e.value})]},e.key))})]}),f.item.status===`applied`?(0,H.jsxs)(`p`,{className:`personal-proposal-state ${f.item.actionKind===`operation.execute`&&f.item.reviewPlan?.reason===`readback_unverified`?`is-gated`:`is-applied`}`,children:[(0,H.jsx)(tm,{size:16}),f.item.actionKind===`operation.execute`?f.item.primaryLabel:m(`drawer.proposalApplied`)]}):null,f.item.status===`applied`&&f.item.actionKind!==`operation.execute`&&f.item.goalId?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>{let e=f.item.goalId;c(),r.onOpenGoal?.(e)},type:`button`,children:[(0,H.jsx)(pm,{size:16}),f.item.actionKind===`goal.create`?m(`drawer.proposalEnterGoal`):m(`drawer.proposalViewGoal`)]}):null,f.item.status===`stale`?(0,H.jsx)(`p`,{className:`personal-proposal-state is-stale`,children:m(`drawer.proposalStale`)}):null,f.item.status===`error`?(0,H.jsxs)(`div`,{className:`personal-proposal-state is-error`,children:[(0,H.jsx)(`span`,{children:f.item.reviewPlan?.reason===`readback_unverified`?m(`actionReview.readback_unverified`):m(`drawer.proposalApplyFailed`)}),f.item.errorMessage?(0,H.jsx)(`small`,{children:f.item.errorMessage}):null,(0,H.jsx)(`small`,{children:m(`drawer.proposalApplyFailedHint`)})]}):null,f.item.status===`rejected`?(0,H.jsx)(`p`,{className:`personal-proposal-state is-error`,children:m(`drawer.proposalRejected`)}):null,f.item.status===`deferred`?(0,H.jsx)(`p`,{className:`personal-proposal-state is-gated`,children:m(`drawer.proposalDeferred`)}):null,f.item.status===`gated`?(0,H.jsxs)(`div`,{className:`personal-proposal-state is-gated`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:f.item.actionKind===`operation.execute`?f.item.primaryLabel:m(`drawer.gateRequiresHost`)}),f.item.actionKind===`operation.execute`?f.item.impact:m(`drawer.gateRequiresHostDescription`)]}),f.item.gate?.nextAction?(0,H.jsx)(`small`,{children:f.item.gate.nextAction}):null]}):null,f.item.status===`gated`&&f.item.actionKind===`gate.resolve`?(()=>{let e=e=>f.item.fields.find(t=>t.key===e)?.value,t=e(`goal_id`),n=e(`todo_id`);return!t||!n?null:(0,H.jsxs)(`section`,{className:`personal-detail-card personal-gate-cli-hint`,children:[(0,H.jsx)(`small`,{children:m(`drawer.gateApproveHint`)}),(0,H.jsxs)(`code`,{children:[`loopx todo complete --goal-id `,t,` --todo-id `,n,` --decision-outcome approve`]}),(0,H.jsx)(`small`,{children:m(`drawer.gateRejectHint`)})]})})():null,!u&&f.item.workspaceCandidates?.length?(0,H.jsx)(`div`,{className:`personal-workspace-candidates`,"aria-label":m(`drawer.workspaceCandidates`),children:f.item.workspaceCandidates.map(e=>(0,H.jsxs)(`button`,{onClick:()=>void r.onSelectWorkspaceCandidate?.(f.item,e.workspaceRef),type:`button`,children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsx)(`small`,{children:e.workspaceRef})]},e.workspaceRef))}):null,!u&&f.item.actionKind!==`operation.execute`&&f.item.status===`error`?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,H.jsx)(Rm,{size:17}),m(`drawer.proposalRegenerate`)]}):!u&&f.item.actionKind!==`operation.execute`&&f.item.status!==`gated`?(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:![`ready`,`deferred`].includes(f.item.status)||f.item.reviewPlan?.canApply===!1,onClick:()=>void r.onApplyProposal?.(f.item),type:`button`,children:[(0,H.jsx)(tm,{size:17}),f.item.status===`applying`?m(`drawer.applying`):f.item.primaryLabel??m(`drawer.apply`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&([`stale`,`gated`,`rejected`].includes(f.item.status)||f.item.status===`ready`&&f.item.reviewPlan?.canApply===!1)?(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,H.jsx)(Rm,{size:16}),m(`drawer.proposalRecheck`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&[`ready`,`gated`].includes(f.item.status)?(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`defer`),type:`button`,children:m(`drawer.proposalDefer`)}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`reject`),type:`button`,children:m(`drawer.decisionReject`)})]}):null,[`applied`,`applying`].includes(f.item.status)?null:(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:c,type:`button`,children:m(`drawer.proposalClose`)})]}):null,f.kind===`schedule`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsxs)(`small`,{children:[f.item.scheduleKind===`heartbeat`?`Goal Heartbeat`:`continuous_monitor`,` · `,f.item.status??`active`]}),(0,H.jsx)(`h3`,{children:f.item.label}),(0,H.jsx)(`p`,{children:f.item.target??f.item.schedule??m(`drawer.scheduleDefaultTarget`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleTimezone`)}),(0,H.jsx)(`dd`,{children:f.item.timezone??m(`drawer.scheduleLocalTimezone`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleNext`)}),(0,H.jsx)(`dd`,{children:f.item.nextRunAt??m(`drawer.schedulePending`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleLast`)}),(0,H.jsx)(`dd`,{children:f.item.previousRunAt??m(`drawer.scheduleNeverRun`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleNotification`)}),(0,H.jsx)(`dd`,{children:f.item.notificationRule??m(`drawer.scheduleDefaultNotification`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleStopCondition`)}),(0,H.jsx)(`dd`,{children:f.item.stopCondition??m(`drawer.scheduleDefaultStop`)})]})]})]}),!u&&f.item.scheduleKind===`monitor`?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`run_now`),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.scheduleRunNow`)]}):null,u?null:(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,f.item.status===`paused`?`resume`:`pause`),type:`button`,children:[f.item.status===`paused`?(0,H.jsx)(Pm,{size:16}):(0,H.jsx)(Nm,{size:16}),f.item.status===`paused`?m(`drawer.scheduleResume`):m(`drawer.schedulePause`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`edit`),type:`button`,children:[(0,H.jsx)(em,{size:16}),m(`drawer.scheduleEdit`)]})]}),u?null:(0,H.jsxs)(`button`,{className:`personal-danger-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`stop`),type:`button`,children:[(0,H.jsx)(Jm,{size:16}),m(`drawer.scheduleStop`,{kind:f.item.scheduleKind===`heartbeat`?` Heartbeat`:m(`drawer.titleSchedule`)})]}),(0,H.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-execution-history-title`,children:[(0,H.jsx)(`h3`,{id:`personal-execution-history-title`,children:m(`drawer.executionHistory`)}),f.item.executionHistory?.length?(0,H.jsx)(`ol`,{children:f.item.executionHistory.map((e,t)=>(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsx)(`small`,{children:e.timestamp})]}),(0,H.jsx)(`em`,{className:`is-${e.status}`,children:e.status})]},`${e.timestamp}:${e.runId??t}`))}):(0,H.jsx)(`p`,{children:m(`drawer.noExecutionHistory`)})]})]}):null,f.kind===`run`||f.kind===`proposal`||f.kind===`schedule`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{"aria-expanded":_,className:`personal-diagnostics-trigger`,onClick:()=>v(e=>!e),type:`button`,children:[(0,H.jsx)(`span`,{children:m(`drawer.advancedDiagnostics`)}),(0,H.jsx)(nm,{className:_?`is-open`:``,size:16})]}),_?(0,H.jsxs)(`div`,{className:`personal-diagnostics`,children:[(0,H.jsxs)(`code`,{children:[`goal_id: `,pe]}),(0,H.jsxs)(`code`,{children:[`kind: `,f.kind]}),f.kind===`run`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`code`,{children:[`session_id: `,f.item.sessionId??m(`drawer.notLinked`)]}),(0,H.jsxs)(`code`,{children:[`turn_id: `,f.item.turnId??m(`common.none`)]}),(0,H.jsxs)(`code`,{children:[`adapter: `,f.item.agentId]}),(0,H.jsxs)(`code`,{children:[`status: `,f.item.sessionStatus??f.item.status]})]}):f.kind===`proposal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`code`,{children:[`action: `,f.item.actionKind]}),(0,H.jsxs)(`code`,{children:[`status: `,f.item.status]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`code`,{children:[`schedule_id: `,f.item.scheduleId]}),(0,H.jsxs)(`code`,{children:[`status: `,f.item.status??`active`]})]})]}):null]}):null]})]})}var ib=[`checking`,`connecting`,`downloading`,`installing_app`,`installing_runtime`],ab={desktop_status_unavailable:[`无法读取 App 更新状态。请重启 App 后再试;若仍失败,请重新安装最新 App。`,`Cannot read the App update status. Restart the App; if this persists, reinstall the latest App.`],update_feed_unavailable:[`此通道的更新源尚未就绪或暂时不可用。可稍后重新检查,当前版本仍可继续使用。`,`This channel's update feed is not ready or temporarily unavailable. Check again later; you can keep using this version.`],update_feed_invalid:[`更新源格式异常。请稍后重新检查。`,`The update feed is invalid. Check again later.`],update_platform_unavailable:[`此通道尚无适用于本机的更新包。`,`This channel has no update package for this platform.`],update_check_timeout:[`检查更新超时。请稍后重试。`,`The update check timed out. Try again later.`],update_network_failed:[`无法连接更新服务器。请检查网络后重试。`,`Cannot reach the update server. Check your connection and retry.`],update_download_or_signature_failed:[`更新包下载或签名校验失败,尚未安装。请重新检查更新。`,`Download or signature verification failed; the update was not installed. Check for updates again.`]};function ob(e,t=`update_failed`){return{phase:`error`,details:{code:typeof e==`string`&&Object.hasOwn(ab,e)?e:t}}}function sb(){let{locale:e}=qi(),t=e===`zh-CN`,[n,r]=(0,V.useState)(!1),i=(0,V.useRef)(null),[a,o]=(0,V.useState)(`stable`),[s,c]=(0,V.useState)({phase:`idle`}),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(!1),p=(0,V.useRef)(!1),m=window.__TAURI__?.core.invoke,h=ib.includes(s.phase);(0,V.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>r(e.matches(`:popover-open`));return e.addEventListener(`toggle`,t),()=>e.removeEventListener(`toggle`,t)},[]),(0,V.useEffect)(()=>{if(!m)return;let e=!0;return m(`desktop_update_status`).then(t=>{if(!e)return;u(t.app_version),f(t.rollback_available===!0),t.state?.phase&&c(t.state);let n=t.state?.details?.channel??(t.app_version.includes(`-main.`)?`main`:`stable`);o(n),t.state?.phase||m(`desktop_update`,{action:`check`,channel:n}).then(t=>{e&&c(t)}).catch(t=>{e&&c(ob(t))})}).catch(()=>{e&&c(ob(null,`desktop_status_unavailable`))}),()=>{e=!1}},[m]),(0,V.useEffect)(()=>{if(!m||!h)return;let e=window.setInterval(()=>{m(`desktop_update_status`).then(e=>{e.state?.phase&&c(e.state)}).catch(()=>{})},1e3);return()=>window.clearInterval(e)},[m,h]);async function g(e){if(!(!m||p.current)){p.current=!0,c({phase:e===`check`?`checking`:e===`repair`?`installing_runtime`:`downloading`});try{if(!l){let e=await m(`desktop_update_status`);u(e.app_version),f(e.rollback_available===!0)}c(await m(`desktop_update`,{action:e,channel:a}))}catch(e){c(ob(e,l?`update_failed`:`desktop_status_unavailable`))}finally{p.current=!1}}}let _={service_error:t?`运行时已安装,但服务尚未连接。可重试更新、修复或恢复上版。`:`Runtime installed, but services are unavailable. Retry updates, repair, or restore the previous version.`,idle:t?`App 会检查可用更新,不会自动安装。`:`Updates are checked automatically, never installed without confirmation.`,runtime_required:t?`请完成匹配组件安装,或检查 App 更新。`:`Install matching components or check for an App update.`,connecting:t?`正在连接更新后的服务…`:`Connecting to updated services…`,checking:t?`正在检查更新…`:`Checking for updates…`,available:t?`新版本已就绪,一次更新 App 与匹配的运行时。`:`Update the App and its matching runtime together.`,up_to_date:t?`当前通道暂无更新。`:`No newer update on this channel.`,downloading:t?`正在下载并校验签名…`:`Downloading and verifying signature…`,installing_app:t?`正在安装 App,请保持窗口打开。`:`Installing the App. Keep this window open.`,installing_runtime:t?`正在安装匹配的运行时,请稍候…`:`Installing the matching runtime…`,restart_required:t?`重启后将自动完成运行时安装与服务连接。`:`Restart to finish runtime installation and reconnect services.`,ready:t?`更新完成,服务已就绪。`:`Update completed; services are ready.`,error:ab[s.details?.code??``]?.[+!t]??(t?`更新未完成。请重试;启动失败可尝试修复当前版本。`:`Update incomplete. Retry; repair this version if startup fails.`)},v=h?t?`正在更新…`:`Updating…`:s.phase===`available`?t?`有可用更新`:`Update available`:s.phase===`restart_required`?t?`重启完成更新`:`Restart to finish`:s.phase===`error`?t?`更新需重试`:`Retry update`:t?`更新 LoopX`:`Update LoopX`;return(0,H.jsxs)(`div`,{className:`personal-desktop-update`,children:[(0,H.jsxs)(`button`,{className:`personal-update-trigger`,type:`button`,"aria-expanded":n,"aria-controls":`desktop-update-panel`,onClick:e=>{i.current?.style.setProperty(`bottom`,`${window.innerHeight-e.currentTarget.getBoundingClientRect().top+8}px`),i.current?.togglePopover()},children:[(0,H.jsx)(dm,{size:16,"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:v}),(0,H.jsx)(im,{size:14,"aria-hidden":`true`})]}),(0,H.jsxs)(`section`,{ref:i,popover:`auto`,id:`desktop-update-panel`,className:`personal-update-panel`,"aria-label":t?`LoopX 更新`:`LoopX updates`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:t?`LoopX 更新`:`LoopX updates`}),(0,H.jsx)(`button`,{type:`button`,"aria-label":t?`关闭更新面板`:`Close updates`,onClick:()=>i.current?.hidePopover(),children:(0,H.jsx)(eh,{size:16,"aria-hidden":`true`})})]}),(0,H.jsxs)(`small`,{children:[l,` · `,a===`main`?t?`main 预览版`:`main preview`:t?`稳定版`:`Stable`]}),s.details?.version?(0,H.jsxs)(`p`,{children:[t?`目标版本:`:`Target: `,s.details.version]}):null,(0,H.jsxs)(`p`,{role:`status`,"aria-live":`polite`,children:[h?(0,H.jsx)(Lm,{className:`is-spinning`,size:14,"aria-hidden":`true`}):null,_[s.phase]]}),s.phase===`downloading`&&s.details?.total?(0,H.jsx)(`progress`,{"aria-label":t?`下载进度`:`Download progress`,max:s.details.total,value:s.details.received??0}):null,m?(0,H.jsx)(`div`,{className:`personal-update-actions`,children:s.phase===`restart_required`?(0,H.jsx)(`button`,{type:`button`,onClick:()=>void g(`restart`),children:t?`重启完成更新`:`Restart to finish`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void g(`check`),children:t?`检查更新`:`Check for updates`}),s.phase===`available`?(0,H.jsx)(`button`,{type:`button`,onClick:()=>void g(`apply`),children:t?`更新并准备重启`:`Install update`}):null]})}):(0,H.jsx)(`p`,{children:t?`请在 LoopX App 中更新;浏览器自身无需安装包。`:`Update from the LoopX App; the browser needs no installer.`}),(0,H.jsxs)(`details`,{children:[(0,H.jsx)(`summary`,{children:t?`高级选项`:`Advanced options`}),(0,H.jsxs)(`label`,{children:[t?`更新通道`:`Update channel`,(0,H.jsxs)(`select`,{disabled:h||s.phase===`restart_required`,value:a,onChange:e=>{o(e.target.value),c({phase:`idle`})},children:[(0,H.jsx)(`option`,{value:`stable`,children:t?`稳定版(推荐)`:`Stable (recommended)`}),(0,H.jsx)(`option`,{value:`main`,children:t?`main 预览版`:`main preview`})]})]}),(0,H.jsx)(`p`,{children:t?`App 与匹配的 CLI 一起更新,服务可能短暂断开。不删除 Goal 数据。`:`Updates the App and matching CLI. Services may briefly disconnect. Goal data is not deleted.`}),m?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{children:t?`启动失败时,可重装当前 App 随附的运行时。`:`If startup fails, reinstall this App's bundled runtime.`}),(0,H.jsx)(`button`,{disabled:h||s.phase===`restart_required`,type:`button`,onClick:()=>void g(`repair`),children:t?`修复当前版本`:`Repair this version`})]}):null,m&&d?(0,H.jsxs)(`details`,{children:[(0,H.jsx)(`summary`,{children:t?`恢复上个版本`:`Restore previous version`}),(0,H.jsx)(`p`,{children:t?`将恢复已保留的 App 和它的运行时,需要重启。`:`Restore the retained App and its runtime, then restart.`}),(0,H.jsx)(`button`,{disabled:h,type:`button`,onClick:()=>void g(`rollback`),children:t?`确认恢复上版`:`Restore previous version`})]}):null]})]})]})}var cb=e=>`loopx-sidebar-goal-order-v1:${encodeURIComponent(e)}`;function lb(e){try{let t=JSON.parse(e??`null`);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?[...new Set(t)]:[]}catch{return[]}}function ub(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.goalId)??1/0)-(n.get(t.goalId)??1/0))}function db(e,t,n,r,i){if(n===r||!t.includes(n)||!t.includes(r))return e;let a=[...new Set([...e,...t])].filter(e=>e!==n);return a.splice(a.indexOf(r)+Number(i),0,n),a}function fb(e,t){let n=cb(t),[r,i]=(0,V.useState)(()=>{try{return lb(localStorage.getItem(n))}catch{return[]}}),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),d=(0,V.useRef)(null),f=(0,V.useRef)(!1),p=ub(e,r),m=p.map(e=>e.goalId);function h(t,a,s){let l=db(r,m,t,a,s);if(l===r)return;i(l);let u=ub(e,l),d=u.findIndex(e=>e.goalId===t),f=u[d];f&&c({title:f.title,position:d+1});try{localStorage.setItem(n,JSON.stringify(l)),o(!1)}catch{o(!0)}}function g(){d.current=null,u(null)}return{sorted:p,target:l,saveFailed:a,lastMoved:s,move:h,moveBy(e,t){let n=p[m.indexOf(e)+t];n&&h(e,n.goalId,t===1)},pointerProps:e=>({onPointerDown(t){f.current=!1,t.pointerType===`mouse`&&t.button===0&&(d.current={id:e,x:t.clientX,y:t.clientY,dragging:!1},t.currentTarget.setPointerCapture(t.pointerId))},onPointerMove(e){let t=d.current;if(!t||!t.dragging&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<6)return;t.dragging=!0,f.current=!0;let n=document.elementFromPoint(e.clientX,e.clientY)?.closest(`[data-reorder-goal]`),r=e.currentTarget.closest(`.personal-goal-list`),i=n?.dataset.reorderGoal;if(!n||!i||!r?.contains(n)||i===t.id){u(null);return}let a=n.getBoundingClientRect();u({id:i,after:e.clientY>a.top+a.height/2})},onPointerUp(){d.current?.dragging&&l&&h(d.current.id,l.id,l.after),g()},onPointerCancel:g,onLostPointerCapture:g,onKeyDown(e){e.key===`Escape`&&g()},onClickCapture(e){f.current&&=(e.preventDefault(),e.stopPropagation(),!1)}})}}var pb=`/ssh-hosts`,mb=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/;function hb(e){return typeof e==`string`&&mb.test(e.trim())}function gb(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`SSH Host 列表响应无效。`);let t=e;if(t.ok!==!0||t.schema_version!==`ssh_host_catalog_v0`||!Array.isArray(t.hosts))throw Error(`SSH Host 列表协议不兼容,请更新本机 LoopX 服务。`);let n=new Set;return{hosts:t.hosts.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=String(e.alias??``).trim();return!hb(t)||n.has(t)?[]:(n.add(t),[{alias:t}])}),schemaVersion:`ssh_host_catalog_v0`}}async function _b(e=fetch,t=pb){let n=await e(t,{cache:`no-store`});if(!n.ok)throw Error(`无法读取本机 SSH Host(HTTP ${n.status})。`);return gb(await n.json())}function vb(e,t){let n=e.trim();if(!hb(n))return{error:`请选择有效的 SSH Host。`};let r=Number(t);return!Number.isInteger(r)||r<1024||r>65535?{error:`本地端口必须是 1024–65535 之间的整数。`}:{command:`ssh -N -L ${r}:127.0.0.1:8766 ${n}`,hostAlias:n,label:n,statusUrl:`http://127.0.0.1:${r}/status.json`}}var yb=`/api/ssh-source/ensure`,bb=`/api/ssh-source/goal-lifecycle`;async function xb(e,t){let n=await fetch(yb,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({host_alias:e,local_port:Number(t)})}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error??`无法建立 SSH 隧道来源。`);if(!r?.ok)throw Error(`无法建立 SSH 隧道来源。`);return r}async function Sb(e,t,n,r,i=fetch){let a=await i(bb,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({goal_id:t,host_alias:e,operation:n,reason:r})}),o=await a.json().catch(()=>null);if(!a.ok)throw Error(o?.error??`无法更新远端 Goal 生命周期。`);if(!o?.ok||o.schema_version!==`loopx_remote_goal_lifecycle_v1`||o.goal_id!==t||o.host_alias!==e||o.operation!==n||o.activation_state!==(n===`stop`?`stopped`:`active`)||o.projection_verified!==!0)throw Error(`远端 Goal 生命周期回读未验证。`);return o}function Cb({activeSource:e,connectionState:t,errorMessage:n,onAdd:r,onConfiguredHostsLoaded:i,onRemove:a,onSelect:o,sources:s}){let{t:c}=qi(),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)(`configured`),[h,g]=(0,V.useState)([]),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(``),[T,E]=(0,V.useState)(``),[D,O]=(0,V.useState)(`8876`),[k,ee]=(0,V.useState)(``),te=`configured:`,A=[...s.map(e=>({label:e.label,value:e.id})),...h.filter(e=>!s.some(t=>t.label===e.alias)).map(e=>({group:c(`source.configuredGroup`,{count:h.length}),label:e.alias,value:`${te}${e.alias}`}))],j=(0,V.useMemo)(()=>h.some(e=>e.alias===C)?vb(C,D):{error:c(`source.selectHost`)},[h,C,D,c]);(0,V.useEffect)(()=>{M()},[]);async function M(){b(!0),v(null);try{let e=await _b();g(e.hosts),i?.(e.hosts.map(e=>e.alias)),w(t=>t||e.hosts[0]?.alias||``),e.hosts.length||v(c(`source.hostEmpty`))}catch(e){v(e instanceof Error?e.message:c(`source.hostLoadError`))}finally{b(!1)}}function N(){u(!0),m(`configured`),f(null),M()}function P(){u(!1),m(`configured`),v(null),S(!1),w(``),f(null),E(``),O(`8876`),ee(``)}function F(){let e=r({label:T,statusUrl:k});if(e.error){f(e.error);return}P()}function ne(){if(`error`in j){f(j.error??c(`source.invalid`));return}let e=r({ensureTunnel:!0,hostAlias:j.hostAlias,label:j.label,statusUrl:j.statusUrl});if(e.error){f(e.error);return}P()}function re(e){let t=new Set;for(let e of s)try{t.add(new URL(e.statusUrl).port)}catch{}let n=`8877`;for(let e=8877;e<9077;e+=1)if(!t.has(String(e))){n=String(e);break}let i=vb(e,n);if(`error`in i){f(i.error??c(`source.invalid`));return}let a=r({ensureTunnel:!0,hostAlias:i.hostAlias,label:i.label,statusUrl:i.statusUrl});a.error?f(a.error):f(null),O(n)}async function I(){if(`error`in j){f(j.error??c(`source.invalid`));return}try{await navigator.clipboard.writeText(j.command),S(!0),f(null)}catch{f(c(`source.copyError`))}}return(0,H.jsxs)(`section`,{"aria-label":c(`source.controlPlane`),className:`personal-status-source`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`span`,{children:`Control plane`}),(0,H.jsx)(`button`,{"aria-label":c(`source.addSsh`),onClick:N,title:c(`source.add`),type:`button`,children:(0,H.jsx)(Fm,{size:14})})]}),(0,H.jsx)(Dy,{ariaLabel:c(`source.select`),className:`personal-status-source-select`,icon:(0,H.jsx)(Um,{size:15}),onChange:e=>{if(e.startsWith(te)){re(e.slice(11));return}o(e)},options:A,value:e.id}),(0,H.jsxs)(`div`,{className:`personal-status-source-meta`,children:[(0,H.jsxs)(`span`,{className:`is-${t}`,children:[(0,H.jsx)(`i`,{}),c(t===`loading`?`source.connecting`:t===`error`?`source.notAvailable`:`source.connected`)]}),(0,H.jsx)(`small`,{children:e.readOnly?c(`source.readOnly`):c(`source.localInteractive`)}),e.kind===`ssh_tunnel`?(0,H.jsx)(`button`,{"aria-label":c(`source.remove`,{source:e.label}),onClick:()=>a(e.id),title:c(`source.removeCurrent`),type:`button`,children:(0,H.jsx)(Zm,{size:12})}):null]}),n?(0,H.jsx)(`p`,{className:`personal-status-source-error`,role:`alert`,children:n}):null,l?(0,H.jsxs)(`div`,{className:`personal-status-source-form`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:c(`source.addSsh`)}),(0,H.jsx)(`button`,{"aria-label":c(`source.closeForm`),onClick:P,type:`button`,children:(0,H.jsx)(eh,{size:13})})]}),(0,H.jsxs)(`div`,{"aria-label":c(`source.addMethod`),className:`personal-status-source-modes`,role:`tablist`,children:[(0,H.jsx)(`button`,{"aria-selected":p===`configured`,onClick:()=>{m(`configured`),f(null)},role:`tab`,type:`button`,children:c(`source.configured`)}),(0,H.jsx)(`button`,{"aria-selected":p===`manual`,onClick:()=>{m(`manual`),f(null)},role:`tab`,type:`button`,children:c(`source.manual`)})]}),p===`configured`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.configuredCount`,{count:h.length})}),(0,H.jsxs)(`span`,{className:`personal-status-source-field-row`,children:[(0,H.jsx)(`input`,{"aria-label":c(`source.host`),disabled:y||!h.length,list:`loopx-configured-ssh-hosts`,onChange:e=>{w(e.target.value),S(!1)},placeholder:c(y?`source.loadingHosts`:`source.hostPlaceholder`),value:C}),(0,H.jsx)(`datalist`,{id:`loopx-configured-ssh-hosts`,children:h.map(e=>(0,H.jsx)(`option`,{value:e.alias},e.alias))}),(0,H.jsx)(`button`,{"aria-label":c(`source.refreshHosts`),disabled:y,onClick:()=>void M(),title:c(`source.refreshHosts`),type:`button`,children:(0,H.jsx)(zm,{size:13})})]})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.localPort`)}),(0,H.jsx)(`input`,{"aria-label":c(`source.localPort`),inputMode:`numeric`,onChange:e=>{O(e.target.value),S(!1)},value:D})]}),(0,H.jsxs)(`div`,{className:`personal-status-source-command`,children:[(0,H.jsx)(`code`,{children:`error`in j?c(`source.tunnelCommandPending`):j.command}),(0,H.jsxs)(`button`,{"aria-label":c(`source.copyCommand`),disabled:`error`in j,onClick:()=>void I(),type:`button`,children:[(0,H.jsx)(lm,{size:12}),c(x?`source.copied`:`source.copy`)]})]}),_?(0,H.jsx)(`p`,{className:`is-error`,children:_}):null,(0,H.jsx)(`p`,{children:c(`source.description`)}),(0,H.jsx)(`button`,{className:`personal-status-source-add`,disabled:`error`in j,onClick:ne,type:`button`,children:c(`source.addConfigured`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.name`)}),(0,H.jsx)(`input`,{autoFocus:!0,maxLength:48,onChange:e=>E(e.target.value),placeholder:c(`source.namePlaceholder`),value:T})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.statusUrl`)}),(0,H.jsx)(`input`,{onChange:e=>ee(e.target.value),placeholder:`http://127.0.0.1:8876/status.json`,value:k})]}),(0,H.jsx)(`p`,{children:(0,H.jsx)(`code`,{children:`ssh -N -L 8876:127.0.0.1:8766 `})}),(0,H.jsx)(`p`,{children:c(`source.manualDescription`)}),(0,H.jsx)(`button`,{className:`personal-status-source-add`,onClick:F,type:`button`,children:c(`source.addConfigured`)})]}),d?(0,H.jsx)(`p`,{className:`is-error`,role:`alert`,children:d}):null]}):null]})}var wb={需修复:`is-danger`,等你:`is-warning`,等待条件:`is-info`,推进中:`is-success`,安静运行:`is-quiet`,已完成:`is-quiet`,已停止:`is-stopped`};function Tb({attentionCount:e,goals:t,goalArchiveLoadState:n={error:null,phase:`ready`},lifecycleBusyGoalIds:r,goalLifecycleOperations:i,onRequestGoalCreate:a,onOpenSettings:o,onRetryGoalArchive:s,onRequestGoalLifecycle:c,onSelectGoal:l,selectedGoalId:u,statusSourceControl:d}){let{locale:f,t:p}=qi(),[m,h]=(0,V.useState)(!1),g=fb(t.filter(e=>e.activationState!==`stopped`),d?.activeSource.statusUrl??`/status.json`),_=g.sorted,v=t.filter(e=>e.activationState===`stopped`),y=e=>!!c&&(!i||i.includes(e)),b=(e,t)=>(0,H.jsxs)(`div`,{className:`personal-goal-row${g.target?.id===e.goalId?g.target.after?` is-drop-after`:` is-drop-before`:``}`,"data-reorder-goal":t?void 0:e.goalId,"data-load-error":e.loadError,children:[(0,H.jsxs)(`button`,{...t?{}:g.pointerProps(e.goalId),title:t?void 0:p(`sidebar.dragGoal`),"aria-current":u===e.goalId?`page`:void 0,className:`personal-goal-link`,onClick:()=>l(e.goalId),type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-goal-state-dot ${e.loadState?``:wb[e.state]}`}),(0,H.jsxs)(`span`,{className:`personal-goal-link-copy`,children:[(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsxs)(`small`,{children:[e.loadState&&(!t||u===e.goalId)?p(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Ji(e.state,f),e.needsYou&&!t?` · ${p(`home.lane.needsYou`)}`:``]})]}),(0,H.jsx)(rm,{size:15})]}),!t&&m?(0,H.jsxs)(`div`,{className:`personal-goal-move-actions`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":p(`sidebar.moveUp`,{goal:e.title}),disabled:_[0]?.goalId===e.goalId,onClick:()=>g.moveBy(e.goalId,-1),children:(0,H.jsx)(Yp,{"aria-hidden":`true`,size:13})}),(0,H.jsx)(`button`,{type:`button`,"aria-label":p(`sidebar.moveDown`,{goal:e.title}),disabled:_.at(-1)?.goalId===e.goalId,onClick:()=>g.moveBy(e.goalId,1),children:(0,H.jsx)(Gp,{"aria-hidden":`true`,size:13})})]}):null,c&&y(t?`resume`:`stop`)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{"aria-label":`${p(t?`sidebar.resume`:`sidebar.stop`)} ${e.title}`,"aria-busy":r?.has(e.goalId)||void 0,className:`personal-goal-lifecycle${r?.has(e.goalId)?` is-pending`:``}`,disabled:r?.has(e.goalId),onClick:()=>c(e,t?`resume`:`stop`),title:p(t?`sidebar.resumeGoal`:`sidebar.stopGoal`),type:`button`,children:r?.has(e.goalId)?(0,H.jsx)(wm,{size:13}):t?(0,H.jsx)(Rm,{size:13}):(0,H.jsx)(Nm,{size:13})}),t&&y(`delete`)?(0,H.jsx)(`button`,{"aria-label":`${p(`sidebar.delete`)} ${e.title}`,className:`personal-goal-lifecycle personal-goal-delete`,onClick:()=>c(e,`delete`),title:p(`sidebar.deleteGoal`),type:`button`,children:(0,H.jsx)(Zm,{size:13})}):null]}):null]},e.goalId);return(0,H.jsxs)(`div`,{className:`personal-goal-directory`,children:[(0,H.jsxs)(`div`,{className:`personal-sidebar-brand`,children:[(0,H.jsx)(`span`,{className:`personal-brand-mark`,children:(0,H.jsx)(Qp,{size:18})}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:`LoopX`})})]}),d?(0,H.jsx)(Cb,{...d}):null,(0,H.jsxs)(`nav`,{"aria-label":p(`home.workspace`),className:`personal-sidebar-nav`,children:[(0,H.jsxs)(`button`,{"aria-current":u===null?`page`:void 0,className:`personal-manager-link`,onClick:()=>l(null),type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-manager-icon`,children:(0,H.jsx)(Qp,{size:17})}),(0,H.jsx)(`span`,{children:p(`sidebar.manager`)}),e>0?(0,H.jsx)(`span`,{className:`personal-sidebar-count`,children:e}):null,(0,H.jsx)(rm,{size:15})]}),(0,H.jsxs)(`div`,{className:`personal-sidebar-section-title`,children:[(0,H.jsx)(`span`,{children:`Goals`}),(0,H.jsxs)(`span`,{className:`personal-sidebar-title-actions`,children:[(0,H.jsx)(`small`,{children:_.length}),(0,H.jsx)(`button`,{"aria-label":p(`sidebar.sortGoals`),title:p(`sidebar.sortGoals`),"aria-pressed":m,onClick:()=>h(!m),type:`button`,children:(0,H.jsx)(Jp,{"aria-hidden":`true`,size:15})}),a?(0,H.jsx)(`button`,{"aria-label":p(`sidebar.createGoal`),onClick:a,type:`button`,children:(0,H.jsx)(Fm,{size:15})}):null]})]}),g.saveFailed?(0,H.jsx)(`p`,{role:`status`,children:p(`sidebar.orderNotSaved`)}):null,(0,H.jsx)(`span`,{className:`personal-sr-only`,role:`status`,children:g.lastMoved?p(`sidebar.goalMoved`,{goal:g.lastMoved.title,position:g.lastMoved.position}):``}),(0,H.jsx)(`div`,{className:`personal-goal-list`,children:_.map(e=>b(e,!1))}),v.length||n.phase===`loading`||n.phase===`error`?(0,H.jsxs)(`details`,{className:`personal-stopped-goals`,open:n.phase===`error`||void 0,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(nm,{size:13}),(0,H.jsx)(`span`,{children:p(`sidebar.stopped`)}),n.phase===`loading`?(0,H.jsx)(wm,{"aria-label":p(`sidebar.stoppedLoading`),className:`is-spinning`,size:13}):(0,H.jsx)(`small`,{children:v.length})]}),(0,H.jsxs)(`div`,{className:`personal-goal-list is-stopped`,children:[n.phase===`error`?(0,H.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`alert`,children:[(0,H.jsx)(`span`,{children:p(`sidebar.stoppedLoadFailed`)}),s?(0,H.jsx)(`button`,{onClick:s,type:`button`,children:p(`sidebar.retryStopped`)}):null]}):null,v.map(e=>b(e,!0))]})]}):null]}),(0,H.jsxs)(`div`,{className:`personal-sidebar-footer`,children:[(0,H.jsx)(sb,{}),o?(0,H.jsxs)(`button`,{"aria-label":p(`settings.open`),className:`personal-sidebar-utility`,onClick:o,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-sidebar-utility-icon`,children:(0,H.jsx)(Wm,{size:17})}),(0,H.jsx)(`span`,{className:`personal-sidebar-utility-copy`,children:(0,H.jsx)(`strong`,{children:p(`settings.open`)})}),(0,H.jsx)(rm,{"aria-hidden":`true`,size:15})]}):null]})]})}var Eb=Y({ok:X(!0),total:K().int().nonnegative(),next_cursor:G().nullable(),items:J(Y({todo_id:G(),text:G(),claimed_by:G().nullable(),evidence:G().nullable(),priority:G().nullable(),task_class:G().nullable()})).max(40)});function Db({goal:e,agentId:t,seed:n,enabled:r,listView:i=!1,onSelect:a}){let{t:o}=qi(),s=(0,V.useId)(),[c,l]=(0,V.useState)(!1),u=!i||c,d=i?96:148,[f,p]=(0,V.useState)(n),[m,h]=(0,V.useState)(t===`all`?e.doneTodoCount??n.length:n.length),[g,_]=(0,V.useState)(void 0),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(!1),[w,T]=(0,V.useState)({top:0,height:600}),[E,D]=(0,V.useState)(null),O=(0,V.useRef)(null),k=(0,V.useRef)(null),[ee,te]=(0,V.useState)(0);(0,V.useEffect)(()=>{let e=O.current;if(!e)return;let t=new ResizeObserver(()=>T({top:e.scrollTop,height:e.clientHeight}));return t.observe(e),()=>{t.disconnect(),k.current?.abort()}},[]);let A=g===void 0||w.top+w.height>=f.length*d-d*2;(0,V.useEffect)(()=>{if(!r||!u||!A||g===null||b||k.current)return;let n=new AbortController;k.current=n,y(!0);let i=new URLSearchParams({goal_id:e.goalId});t!==`all`&&i.set(`agent_id`,t),g&&i.set(`cursor`,g),fetch(`/api/chat/completed-todos?${i}`,{signal:n.signal}).then(async e=>{if(e.status===409&&C(!0),!e.ok)throw Error(`history unavailable`);let t=Eb.parse(await e.json());if(n.signal.aborted)return;let r=t.items.map(e=>({todoId:e.todo_id,text:e.text,claimedBy:e.claimed_by,evidence:e.evidence,priority:e.priority,taskClass:e.task_class,done:!0,status:`done`}));p(e=>g===void 0?r:[...e,...r.filter(t=>!e.some(e=>e.todoId===t.todoId))]),h(t.total),_(t.next_cursor)}).catch(()=>{n.signal.aborted||x(!0)}).finally(()=>{n.signal.aborted||(k.current=null,y(!1))})},[r,u,A,g,b,ee,e.goalId,t,v]),(0,V.useEffect)(()=>{O.current&&(O.current.scrollTop=0),T({top:0,height:O.current?.clientHeight??600}),D(null)},[i]);let j=Math.max(0,Math.floor(w.top/d)-3),M=Math.min(f.length,Math.ceil((w.top+w.height)/d)+3),N=Array.from({length:Math.max(0,M-j)},(e,t)=>j+t);return E!==null&&El(e=>!e),children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,children:c?`▾`:`▸`}),` `,o(`tasks.completed`)]}):(0,H.jsxs)(`strong`,{children:[(0,H.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-done`}),o(`tasks.completed`)]}),(0,H.jsx)(`span`,{children:m})]}),(0,H.jsxs)(`div`,{id:s,hidden:!u,"aria-label":o(`tasks.completed`),className:`personal-task-lane-scroll`,ref:O,role:`region`,tabIndex:0,onScroll:e=>T({top:e.currentTarget.scrollTop,height:e.currentTarget.clientHeight}),children:[(0,H.jsx)(`div`,{className:`personal-completed-window`,style:{height:f.length*d},children:N.map(t=>{let n=f[t];return(0,H.jsx)(`div`,{className:`personal-task-card personal-completed-row`,style:{top:t*d,height:d},children:(0,H.jsxs)(`button`,{type:`button`,onFocus:()=>D(t),onBlur:()=>D(null),onClick:()=>a({kind:`todo`,item:{...n,goalId:e.goalId,goalTitle:e.title,ownerLabel:n.claimedBy??e.agentLabel??e.agentId}}),children:[(0,H.jsx)(`span`,{className:`is-done`,children:`✓`}),(0,H.jsx)(`strong`,{children:n.text}),(0,H.jsx)(`small`,{children:n.claimedBy??e.agentLabel??e.agentId})]})},n.todoId)})}),(0,H.jsx)(`div`,{className:`personal-completed-footer`,role:`status`,children:v?o(`tasks.historyLoading`):b?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:o(S?`tasks.historyExpired`:`tasks.historyError`)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{S&&(_(void 0),O.current&&(O.current.scrollTop=0)),C(!1),x(!1),te(e=>e+1)},children:o(`tasks.historyRetry`)})]}):r?g===null?o(`tasks.historyEnd`):(0,H.jsx)(`button`,{type:`button`,onClick:()=>{O.current&&(O.current.scrollTop=f.length*d)},children:o(`tasks.historyMore`)}):o(`tasks.historyLocalOnly`)})]})]})}function Ob({children:e,count:t,label:n,tone:r,listView:i=!1}){let a=(0,V.useId)(),o=(0,V.useRef)(null),s=(0,V.useRef)([]),c=(0,V.useRef)(null),[l,u]=(0,V.useState)({after:!1,before:!1}),d=(0,V.useCallback)(()=>{let e=o.current;if(!e)return;let t={after:Math.max(0,e.scrollHeight-e.clientHeight)-e.scrollTop>1,before:e.scrollTop>1};u(e=>e.after===t.after&&e.before===t.before?e:t)},[]);return(0,V.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(d);return c.current=t,t.observe(e),e.addEventListener(`scroll`,d,{passive:!0}),d(),()=>{t.disconnect(),c.current=null,s.current=[],e.removeEventListener(`scroll`,d)}},[i,d]),(0,V.useEffect)(()=>{let e=o.current,t=c.current;if(!e||!t)return;for(let e of s.current)t.unobserve(e);let n=Array.from(e.children).filter(e=>e instanceof HTMLElement);for(let e of n)t.observe(e);s.current=n,d()},[e,t,i,d]),i?!t&&r!==`done`?null:(0,H.jsxs)(`details`,{className:`personal-task-group tone-${r}`,open:!0,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(nm,{size:16}),(0,H.jsx)(`strong`,{children:n}),(0,H.jsx)(`span`,{children:t})]}),(0,H.jsx)(`div`,{className:`personal-task-list-rows`,children:e})]}):(0,H.jsxs)(`section`,{className:`personal-object-list personal-task-lane`,children:[(0,H.jsxs)(`header`,{id:a,children:[(0,H.jsxs)(`strong`,{children:[(0,H.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-${r}`}),n]}),(0,H.jsx)(`span`,{children:t})]}),(0,H.jsx)(`div`,{"aria-labelledby":a,className:`personal-task-lane-scroll${l.before?` has-overflow-before`:``}${l.after?` has-overflow-after`:``}`,ref:o,role:`region`,tabIndex:t>0?0:-1,children:e})]})}function kb({historyEnabled:e=!1,goal:t,items:n,onDraftTaskFromMessage:r,onOpenChat:i,onQuickComplete:a,quickCompletingTodoIds:o,onSelect:s,selectedTodoId:c=null,userTodos:l}){let{t:u}=qi(),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)({goalId:``,laneId:`all`}),h=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!c)return;let e=window.requestAnimationFrame(()=>h.current?.scrollIntoView({block:`nearest`,inline:`nearest`}));return()=>window.cancelAnimationFrame(e)},[c]);let g=l.filter(e=>e.goalId===t.goalId).map(e=>({...e,goalTitle:t.title})),_=e=>e.priority===`P0`?0:e.priority===`P1`?1:e.priority===`P2`?2:3,v=(0,V.useMemo)(()=>{let e=new Map((t.agentLanes??[]).map(e=>[e.agentId,e]));for(let n of t.agentTodos)n.claimedBy&&!e.has(n.claimedBy)&&e.set(n.claimedBy,{agentId:n.claimedBy,label:n.claimedBy});return[...e.values()]},[t.agentLanes,t.agentTodos]),y=p.goalId===t.goalId&&v.some(e=>e.agentId===p.laneId)?p.laneId:`all`,b=e=>y===`all`||e===y,x=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&!e.done).filter(e=>b(e.claimedBy)).sort((e,t)=>_(e)-_(t)),S=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&e.done).filter(e=>b(e.claimedBy)),C=n.filter(e=>e.kind===`schedule`&&b(e.schedule.agentId)),w=n.filter(e=>e.kind===`run`&&!!e.run.todoId&&b(e.run.agentId)),T=!g.length&&!x.length&&!S.length&&!C.length,E=n.filter(e=>e.kind===`message`&&(e.message.role===`user`||e.message.role===`assistant`)),D=E.reduce((e,t,n)=>t.message.role===`user`?n:e,-1),O=D>=0?E[D]?.message:null,k=D>=0?E.slice(D+1).reverse().find(e=>e.message.role===`assistant`)?.message:null,ee=D>=0&&E.slice(D+1).some(e=>e.message.role===`assistant`&&e.message.pending);return(0,H.jsxs)(`section`,{"aria-label":u(`header.tasks`),className:`personal-task-board${d?` is-list-view`:``}`,children:[(0,H.jsxs)(`header`,{className:`personal-task-view-toolbar`,children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(`strong`,{children:u(`header.tasks`)})}),(0,H.jsxs)(`div`,{className:`personal-task-view-switch`,role:`group`,"aria-label":u(`tasks.viewLabel`),children:[(0,H.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(!0),children:u(`tasks.listView`)}),(0,H.jsx)(`button`,{type:`button`,"aria-pressed":!d,onClick:()=>f(!1),children:u(`tasks.boardView`)})]})]}),v.length>1?(0,H.jsxs)(`section`,{"aria-label":u(`tasks.agentLaneFilter`),className:`personal-task-lane-filter`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Qp,{size:15}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:u(`tasks.agentLane`)})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`sr-only`,children:u(`tasks.agentLaneFilter`)}),(0,H.jsxs)(`select`,{"aria-label":u(`tasks.agentLaneFilter`),onChange:e=>m({goalId:t.goalId,laneId:e.target.value}),value:y,children:[(0,H.jsx)(`option`,{value:`all`,children:u(`tasks.allAgentLanes`,{count:v.length})}),v.map(e=>(0,H.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))]}),(0,H.jsx)(nm,{"aria-hidden":!0,size:14})]})]}):null,O?(0,H.jsxs)(`section`,{"aria-label":u(`tasks.chatRecent`),className:`personal-task-chat-receipt`,children:[(0,H.jsx)(`span`,{className:`personal-task-chat-icon`,children:(0,H.jsx)(Om,{size:18})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:u(ee?`tasks.chatPending`:k?`tasks.chatAgentReplied`:`tasks.chatRecent`)}),(0,H.jsx)(`small`,{children:t.agentLabel??t.agentId})]}),(0,H.jsxs)(`p`,{className:`is-user`,children:[(0,H.jsx)(`b`,{children:u(`common.you`)}),O.text]}),k&&!k.pending?(0,H.jsxs)(`p`,{className:`is-assistant`,children:[(0,H.jsx)(`b`,{children:u(`common.agent`)}),k.text]}):null,(0,H.jsx)(`small`,{children:u(ee?`tasks.chatPendingDescription`:`tasks.chatUnchangedDescription`)})]}),(0,H.jsxs)(`footer`,{children:[(0,H.jsxs)(`button`,{onClick:i,type:`button`,children:[(0,H.jsx)(Om,{size:14}),u(`tasks.chatViewReply`)]}),k&&!ee&&r?(0,H.jsxs)(`button`,{onClick:()=>r(k.text),type:`button`,children:[(0,H.jsx)(Cm,{size:14}),u(`tasks.convertToTask`)]}):null]})]}):null,(0,H.jsxs)(`div`,{className:d?`personal-task-grouped-list`:`personal-task-kanban`,children:[(0,H.jsxs)(Ob,{listView:d,count:g.length,label:u(`timeline.waitingConfirmation`),tone:`attention`,children:[g.map(e=>{let t=Xi(e.updatedAt,u);return(0,H.jsxs)(`button`,{onClick:()=>s({item:e,kind:`attention`}),type:`button`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`is-attention`,children:`!`}),(0,H.jsx)(`strong`,{children:e.text}),(0,H.jsxs)(`small`,{children:[(0,H.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?u(`tasks.blocked`):u(`tasks.pending`)}),t?(0,H.jsx)(`span`,{className:`personal-task-age`,children:u(`tasks.waitingAge`,{age:t})}):null]})]},e.todoId)}),g.length?null:(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyConfirm`)})]}),(0,H.jsxs)(Ob,{listView:d,count:x.length,label:u(`tasks.pendingAndRunning`),tone:`progress`,children:[x.map(e=>{let n={...e,goalId:t.goalId,goalTitle:t.title,ownerLabel:e.claimedBy??t.agentLabel??t.agentId},r=w.find(t=>t.run.todoId===e.todoId)?.run;return(0,H.jsxs)(`div`,{className:`personal-task-card${r?` has-session`:``}${c===e.todoId?` is-selected`:``}`,ref:c===e.todoId?e=>{h.current=e}:void 0,children:[(0,H.jsxs)(`button`,{"aria-pressed":c===e.todoId,onClick:()=>s({item:n,kind:`todo`}),type:`button`,children:[(0,H.jsx)(`span`,{children:`○`}),(0,H.jsx)(`strong`,{children:e.text}),(0,H.jsxs)(`small`,{children:[e.priority?(0,H.jsx)(`span`,{className:`personal-priority-badge is-${e.priority.toLowerCase()}`,children:e.priority}):null,e.status===`blocked`?(0,H.jsx)(`span`,{className:`personal-priority-badge is-blocked`,children:u(`tasks.blocked`)}):null,r?(0,H.jsx)(`span`,{className:`personal-task-session-status`,children:r.status===`running`||r.status===`queued`?u(`runs.running`):r.status===`failed`?u(`tasks.sessionError`):u(`common.waiting`)}):null,e.status===`deferred`?(0,H.jsx)(`span`,{className:`personal-task-session-status`,children:u(`drawer.taskStatusDeferred`)}):r?null:(0,H.jsx)(`span`,{className:`personal-task-session-status`,children:u(`tasks.waiting`)}),e.claimedBy??t.agentLabel??t.agentId]})]}),(0,H.jsxs)(`div`,{className:`personal-task-card-actions`,children:[r?(0,H.jsxs)(`button`,{className:`personal-task-session-link`,"aria-label":u(`tasks.openExecution`,{name:e.text}),onClick:()=>s({item:r,kind:`run`}),title:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`),type:`button`,children:[(0,H.jsx)(pm,{size:14}),(0,H.jsx)(`span`,{children:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`)})]}):null,a?(0,H.jsx)(`button`,{"aria-busy":o?.has(e.todoId)||void 0,"aria-label":u(`tasks.markComplete`,{name:e.text}),disabled:o?.has(e.todoId),onClick:()=>void a(n),title:u(`tasks.completed`),type:`button`,children:o?.has(e.todoId)?(0,H.jsx)(wm,{className:`personal-spin`,size:14}):(0,H.jsx)(tm,{size:14})}):null,(0,H.jsx)(`button`,{"aria-label":u(`tasks.moreActions`,{name:e.text}),onClick:()=>s({item:n,kind:`todo`}),title:u(`common.actions`),type:`button`,children:(0,H.jsx)(fm,{size:14})})]})]},e.todoId)}),x.length?null:(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyRunning`)})]}),(0,H.jsxs)(Ob,{listView:d,count:C.length,label:u(`tasks.scheduled`),tone:`schedule`,children:[C.map(e=>(0,H.jsxs)(`button`,{onClick:()=>s({item:e.schedule,kind:`schedule`}),type:`button`,children:[(0,H.jsx)(`span`,{children:`◷`}),(0,H.jsx)(`strong`,{children:e.schedule.label}),(0,H.jsx)(`small`,{children:e.schedule.status===`paused`?u(`schedule.paused`):u(`schedule.active`)})]},e.id)),C.length?null:(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptySchedules`)})]}),(0,H.jsx)(Db,{goal:t,agentId:y,seed:S,enabled:e,listView:d,onSelect:s},`${t.goalId}:${y}:${e}`)]}),T?(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyGoal`)}):null]})}function Ab(e,t){return{live_steering:{label:t(`lark.ingressSteering`),detail:t(`lark.ingressSteeringDescription`)},session_queue:{label:t(`lark.ingressQueue`),detail:t(`lark.ingressQueueDescription`)},async_inbox:{label:t(`lark.ingressAsync`),detail:t(`lark.ingressAsyncDescription`)},direct_session:{label:t(`lark.ingressLegacy`),detail:t(`lark.ingressLegacyDescription`)}}[e]}function jb(e,t){return e.listener_status===`starting`?{label:t(`lark.health.starting`),detail:t(`lark.health.startingDetail`),state:`not_ready`}:e.listener_status===`retrying`&&e.listener_error_code===`lark_event_source_disconnected`?{label:t(`lark.health.sourceDisconnected`),detail:t(`lark.health.sourceDisconnectedDetail`),state:`not_ready`}:e.listener_status===`retrying`?{label:t(`lark.health.retrying`),detail:t(`lark.health.retryingDetail`),state:`not_ready`}:e.listener_status===`stopped`||e.listener_status===null?{label:t(`lark.health.notStarted`),detail:t(`lark.health.notStartedDetail`),state:`not_ready`}:e.last_event_status===`message_context_permission_required`?{label:t(`lark.health.messageContextPermission`),detail:t(`lark.health.messageContextPermissionDetail`),state:`not_ready`}:e.last_event_status===`processing_failed`?{label:t(`lark.health.processingFailed`),detail:t(`lark.health.processingFailedDetail`),state:`not_ready`}:e.health_error_code===`invalid_routing_state`?{label:t(`lark.health.invalidRouting`),detail:t(`lark.health.invalidRoutingDetail`),state:`not_ready`}:e.last_event_status===`queued_for_agent`?{label:t(`lark.health.queued`),detail:t(`lark.health.queuedDetail`,{agent:e.agent_id??t(`lark.targetAgent`)}),state:`ready`}:e.last_event_status===`context_only_captured`||e.last_event_status===`context_only_already_captured`?{label:t(`lark.health.contextCaptured`),detail:t(`lark.health.contextCapturedDetail`),state:`ready`}:e.last_event_status===`ignored`&&e.last_event_reason===`not_addressed`?{label:t(`lark.health.notAddressed`),detail:t(`lark.health.notAddressedDetail`),state:`ready`}:e.last_event_status===`ignored`&&e.last_event_reason===`self_message`?{label:t(`lark.health.listening`),detail:t(`lark.health.ignoredSelf`),state:`ready`}:e.health_error_code===`lark_event_route_mismatch`||[`chat_mismatch`,`topic_mismatch`,`route_ambiguous`].includes(e.last_event_reason??``)?{label:e.last_event_reason===`route_ambiguous`?t(`lark.health.routeAmbiguous`):t(`lark.health.routeMismatch`),detail:e.last_event_reason===`route_ambiguous`?t(`lark.health.routeAmbiguousDetail`):t(`lark.health.routeMismatchDetail`),state:`not_ready`}:[`invalid_event`,`binding_unavailable`].includes(e.last_event_reason??``)?{label:t(`lark.health.routeUnavailable`),detail:t(`lark.health.routeUnavailableDetail`),state:`not_ready`}:e.last_event_status===`replied_and_acknowledged`?{label:t(`lark.health.listening`),detail:t(`lark.health.eventProcessed`,{events:e.event_count,replies:e.replied_count}),state:`ready`}:e.health_error_code===`lark_event_delivery_unverified`||e.event_count===0?{label:t(`lark.health.eventUnverified`),detail:t(`lark.health.eventUnverifiedDetail`),state:`unverified`}:{label:e.reply_ready?t(`lark.health.listening`):t(`lark.health.unavailable`),detail:t(`lark.health.lastStatus`,{status:e.last_event_status??t(`lark.health.waiting`)}),state:e.reply_ready?`ready`:`not_ready`}}function Mb(e){return e.history_permission_guidance?.api_document_url??null}function Nb(e,t,n){if(e instanceof Eh){let t=String(e.payload.error_code??``);return{lark_cli_not_installed:n(`lark.error.cliMissing`),lark_cli_not_executable:n(`lark.error.cliExecutable`),lark_cli_start_failed:n(`lark.error.cliStart`),lark_message_permissions_required:n(`lark.error.messagePermissions`),lark_app_required:n(`lark.error.appRequired`),invalid_lark_app:n(`lark.error.invalidApp`),lark_group_lookup_failed:n(`lark.error.groupLookup`),provider_api_failed:n(`lark.error.provider`)}[t]??e.message}return e instanceof Error?e.message:t}function Pb({embedded:e=!1,focusGoalConnection:t=!1,goals:n,initialGoalId:r,onChanged:i,onClose:a}){let{t:o}=qi(),[s,c]=(0,V.useState)(`connections`),[l,u]=(0,V.useState)([]),[d,f]=(0,V.useState)([]),[p,m]=(0,V.useState)(!0),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(``),[y,b]=(0,V.useState)(t),[x,S]=(0,V.useState)(``),[C,w]=(0,V.useState)(r??n[0]?.goalId??``),[T,E]=(0,V.useState)(``),[D,O]=(0,V.useState)([]),[k,ee]=(0,V.useState)(``),[te,A]=(0,V.useState)(!1),[j,M]=(0,V.useState)(null),[N,P]=(0,V.useState)(`addressed_only`),[F,ne]=(0,V.useState)(t&&r?`goal`:`manager`),[re,I]=(0,V.useState)(`async_inbox`),[L,ie]=(0,V.useState)(`topic_reply`),[R,ae]=(0,V.useState)(``),[oe,se]=(0,V.useState)(!1),[ce,le]=(0,V.useState)({}),[ue,z]=(0,V.useState)(!1),[de,fe]=(0,V.useState)(null),[pe,me]=(0,V.useState)(null),[he,ge]=(0,V.useState)(null),[_e,ve]=(0,V.useState)(null),[ye,be]=(0,V.useState)(!1),[xe,Se]=(0,V.useState)(`loopx-workspace-bot`),[Ce,we]=(0,V.useState)(`feishu`),[Te,B]=(0,V.useState)(null),[Ee,De]=(0,V.useState)(!1),[Oe,ke]=(0,V.useState)(null),Ae=(0,V.useRef)(null),je=(0,V.useRef)(null),Me=(0,V.useRef)(!1);async function Ne(){m(!0),g(null);try{let[e,t]=await Promise.all([zg(),Jg()]);u(e),f(t),S(t=>t||e.find(e=>e.reply_ready)?.app_ref||e.find(e=>e.ready)?.app_ref||e[0]?.app_ref||``)}catch(e){g(Nb(e,o(`lark.error.configuration`),o))}finally{m(!1)}}(0,V.useEffect)(()=>{Ne()},[]),(0,V.useEffect)(()=>{if(!t||p||Me.current||!r)return;Me.current=!0;let e=d.find(e=>e.goal_id===r);e?qe(e):Ke(n.find(e=>e.goalId===r))},[d,t,n,r,p]),(0,V.useEffect)(()=>{if(!y||!x||he){O([]),ee(``),A(!1),M(null);return}let e=!1;A(!0),M(null);let t=window.setTimeout(()=>{Kg(x,T).then(t=>{e||(O(t),ee(e=>t.some(t=>t.chat_id===e)?e:t[0]?.chat_id??``))}).catch(t=>{e||(O([]),ee(``),M(Nb(t,o(`lark.error.groupLoad`),o)))}).finally(()=>{e||A(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[x,T,y,he]),(0,V.useEffect)(()=>{if(!ye||!Te||[`ready`,`failed`,`cancelled`].includes(Te.status))return;let e=!1,t=window.setTimeout(()=>{Hg(Te.setup_id).then(async t=>{e||(B(t),t.verification_url&&je.current!==t.verification_url&&(je.current=t.verification_url,Ae.current&&!Ae.current.closed&&(Ae.current.location.href=t.verification_url)),t.status===`ready`&&(await Ne(),S(t.app_ref),le({}),be(!1)),t.status===`failed`&&ke(t.error??o(`lark.error.appCreate`)))}).catch(t=>{e||ke(Nb(t,o(`lark.error.setupPoll`),o))})},650);return()=>{e=!0,window.clearTimeout(t)}},[ye,Te]);let Pe=n.find(e=>e.goalId===C),Fe=Pe?.agentId?[{agentId:Pe.agentId,label:Pe.agentLabel??Pe.agentId}]:[],Ie=Pe?.agentLanes?.length?Pe.agentLanes:Fe,Le=Ie.some(e=>e.agentId===R),Re=[];oe?Re=Ie.map(e=>({agentId:e.agentId,appRef:ce[e.agentId]??x})):Le&&(Re=[{agentId:R,appRef:x}]);let ze=Re.map(e=>e.agentId),Be=!!he||Re.length>0&&Re.every(e=>l.some(t=>t.app_ref===e.appRef&&t.reply_ready)),Ve=o(`lark.connect`);pe?Ve=o(`lark.saveConnection`):oe&&(Ve=o(`lark.connectAllAgentsAction`,{count:ze.length}));let He=l.find(e=>e.app_ref===x),Ue=D.find(e=>e.chat_id===k),We=(0,V.useMemo)(()=>{let e=_.trim().toLocaleLowerCase();return e?d.filter(t=>[t.app_label,t.chat_name,t.goal_title,t.topic_name].some(t=>t.toLocaleLowerCase().includes(e))):d},[d,_]),Ge=(0,V.useMemo)(()=>d.filter(e=>jb(e,o).state===`unverified`).length,[d,o]);function Ke(e){let i=e??n.find(e=>e.goalId===r)??n[0];me(null),ge(null),ne(e||t?`goal`:`manager`),S(l.some(e=>e.app_ref===x)?x:l.find(e=>e.reply_ready)?.app_ref??l[0]?.app_ref??``),ee(``),w(i?.goalId??``),ae(i?.agentId??``),se(!1),le({}),P(`addressed_only`),I(`async_inbox`),ie(`topic_reply`),E(``),fe(null),b(!0)}function qe(e){me(e.goal_id),ge(e),ne(e.conversation_kind??`goal`),S(e.app_ref),w(e.goal_id);let t=n.find(t=>t.goalId===e.goal_id),r=t?.agentLanes?.length?t.agentLanes:t?.agentId?[{agentId:t.agentId}]:[];ae(e.agent_id??(r.length===1?r[0].agentId:``)),se(!1),le({}),P(e.capture_scope),I(e.ingress_mode===`direct_session`?`async_inbox`:e.ingress_mode),ie(e.reply_mode),E(e.chat_name),fe(null),b(!0)}function Je(){B(null),ke(null),je.current=null,be(!0)}async function Ye(){if(!(Ee||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(xe))){De(!0),ke(null),je.current=null,Ae.current=window.open(window.location.href,`_blank`);try{let e=await Vg({appRef:xe,brand:Ce});B(e)}catch(e){Ae.current?.close(),ke(Nb(e,o(`lark.error.setupStart`),o))}finally{De(!1)}}}async function Xe(){let e=Te;if(be(!1),Ae.current?.close(),e&&![`ready`,`failed`,`cancelled`].includes(e.status))try{await Ug(e.setup_id)}catch{}}async function Ze(){if(!(!x||!C||!he&&!Ue||F===`goal`&&ze.length===0||ue)){z(!0),fe(null);try{let e={...F===`manager`?{...he?{connectionId:he.connection_id}:{appRef:x,chatId:Ue.chat_id,chatName:Ue.chat_name}}:he?{connectionId:he.connection_id,agentId:R}:{agentBindings:Re,chatId:Ue.chat_id,chatName:Ue.chat_name},conversationKind:F,captureScope:F===`manager`?`addressed_only`:N,goalId:C,incomingMode:N===`configured_chat_all`?`all`:`mentions`,ingressMode:F===`manager`?`session_queue`:re,replyMode:L},t=await Yg({...e,execute:!1});if(!t.ok)throw new Eh(t.public_summary??t.blocker??o(`lark.error.bindPreview`),{error_code:t.blocker??`provider_api_failed`});let n=await Yg({...e,execute:!0});if(!n.ok)throw new Eh(n.public_summary??n.blocker??o(`lark.error.bind`),{error_code:n.blocker??`provider_api_failed`});b(!1),await Ne(),i?.()}catch(e){fe(Nb(e,o(`lark.error.bind`),o))}finally{z(!1)}}}async function Qe(e,t){if(_e!==t){ve(t);return}try{await Xg(e,t),ve(null),await Ne(),i?.()}catch(e){g(Nb(e,o(`lark.error.disconnect`),o))}}return(0,H.jsxs)(`section`,{className:`personal-lark-settings${e?` is-embedded`:``}`,"aria-label":o(`lark.configuration`),children:[e?null:(0,H.jsxs)(`header`,{className:`personal-lark-header`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:o(`settings.goalConnections`)}),(0,H.jsx)(`h1`,{children:`Lark`})]}),(0,H.jsx)(`button`,{"aria-label":o(`lark.closeSettings`),className:`personal-icon-button`,onClick:a,type:`button`,children:(0,H.jsx)(eh,{size:18})})]}),(0,H.jsxs)(`nav`,{className:`personal-lark-tabs`,"aria-label":o(`lark.management`),children:[(0,H.jsxs)(`button`,{"aria-current":s===`apps`?`page`:void 0,onClick:()=>c(`apps`),type:`button`,children:[o(`lark.apps`),` `,(0,H.jsx)(`span`,{children:p?`…`:l.length})]}),(0,H.jsxs)(`button`,{"aria-current":s===`connections`?`page`:void 0,onClick:()=>c(`connections`),type:`button`,children:[o(`lark.connections`),` `,(0,H.jsx)(`span`,{children:p?`…`:d.length})]})]}),h?(0,H.jsx)(`p`,{className:`personal-notification-error`,children:h}):null,p?(0,H.jsxs)(`div`,{className:`personal-lark-loading`,children:[(0,H.jsx)(wm,{className:`is-spinning`,size:18}),o(`lark.loading`)]}):null,!p&&s===`apps`?(0,H.jsxs)(`div`,{className:`personal-lark-apps`,children:[(0,H.jsxs)(`div`,{className:`personal-lark-app-toolbar`,children:[(0,H.jsx)(`span`,{children:o(`lark.reusableApps`,{count:l.length})}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:Je,type:`button`,children:[(0,H.jsx)(Fm,{size:16}),o(`lark.newApp`)]})]}),(0,H.jsxs)(`div`,{className:`personal-lark-app-grid`,children:[l.map(e=>(0,H.jsxs)(`article`,{className:`personal-lark-app-card`,children:[(0,H.jsx)(`span`,{className:`personal-lark-app-avatar`,children:(0,H.jsx)(Qp,{size:19})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsxs)(`small`,{children:[e.brand,` · lark-cli profile`]})]}),(0,H.jsx)(`em`,{className:e.reply_ready?`is-ready`:`is-off`,children:e.reply_ready?o(`lark.autoReplyReady`):e.ready?o(`lark.needsMessagePermissions`):o(`lark.needsSetup`)}),(0,H.jsxs)(`p`,{children:[o(`lark.goalConnections`,{count:d.filter(t=>t.app_ref===e.app_ref).length}),e.ready&&!e.reply_ready?` · ${o(`lark.autoReplyUnavailable`)}`:``]})]},e.app_ref)),l.length===0?(0,H.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noProfiles`)}):null]})]}):null,!p&&s===`connections`?(0,H.jsxs)(`div`,{className:`personal-lark-connections`,children:[Ge>0?(0,H.jsxs)(`p`,{className:`personal-lark-route-readiness`,role:`status`,children:[(0,H.jsx)(Om,{size:15}),o(`lark.routesUnverified`,{count:Ge})]}):null,(0,H.jsxs)(`div`,{className:`personal-lark-toolbar`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(Bm,{size:16}),(0,H.jsx)(`input`,{"aria-label":o(`lark.searchConnections`),onChange:e=>v(e.target.value),placeholder:o(`lark.searchPlaceholder`),type:`search`,value:_})]}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:l.length===0||n.length===0,onClick:()=>Ke(),type:`button`,children:[(0,H.jsx)(Fm,{size:16}),o(`lark.connectApp`)]})]}),(0,H.jsxs)(`div`,{className:`personal-lark-table`,role:`table`,"aria-label":o(`lark.goalTopicConnections`),children:[(0,H.jsxs)(`div`,{className:`personal-lark-table-head`,role:`row`,children:[(0,H.jsx)(`span`,{children:o(`lark.connection`)}),(0,H.jsx)(`span`,{children:o(`common.goal`)}),(0,H.jsx)(`span`,{children:o(`lark.capture`)}),(0,H.jsx)(`span`,{children:o(`lark.processing`)}),(0,H.jsx)(`span`,{children:o(`common.actions`)})]}),We.map(e=>{let t=jb(e,o);return(0,H.jsxs)(`div`,{className:`personal-lark-table-row`,role:`row`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.chat_name}),(0,H.jsxs)(`small`,{children:[e.app_label,` · `,t.label]}),(0,H.jsx)(`small`,{children:t.detail}),t.state===`unverified`?(0,H.jsxs)(`a`,{href:`https://open.feishu.cn/document/server-docs/im-v1/message/events/receive?lang=zh-CN`,rel:`noreferrer`,target:`_blank`,children:[(0,H.jsx)(pm,{size:12}),o(`lark.openEventSettings`)]}):null,Mb(e)?(0,H.jsxs)(`a`,{href:Mb(e)??void 0,rel:`noreferrer`,target:`_blank`,children:[(0,H.jsx)(pm,{size:12}),o(`lark.historyPermission`)]}):null]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.goal_title}),(0,H.jsxs)(`small`,{children:[`# `,e.topic_name]})]}),(0,H.jsx)(`span`,{children:e.capture_scope===`addressed_only`?o(`lark.mentionsOnly`):o(`lark.allTopicMessages`)}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.conversation_kind===`manager`?o(`lark.managerConversation`):Ab(e.ingress_mode,o).label}),(0,H.jsx)(`small`,{children:e.conversation_kind===`manager`?o(`lark.managerConversationDescription`):e.agent_id??Ab(e.ingress_mode,o).detail})]}),(0,H.jsxs)(`span`,{className:`personal-lark-row-actions`,children:[(0,H.jsx)(`button`,{"aria-label":o(`lark.settingsConfigure`,{goal:e.goal_title}),onClick:()=>qe(e),type:`button`,children:(0,H.jsx)(Wm,{size:15})}),(0,H.jsxs)(`button`,{"aria-label":o(`lark.settingsDisconnect`,{goal:e.goal_title}),className:_e===e.connection_id?`is-confirm`:``,onClick:()=>void Qe(e.goal_id,e.connection_id),type:`button`,children:[(0,H.jsx)($m,{size:15}),_e===e.connection_id?o(`common.confirm`):null]})]})]},e.connection_id)}),We.length===0?(0,H.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noConnections`)}):null]})]}):null,y?(0,H.jsx)(`div`,{className:`personal-lark-modal-backdrop`,role:`presentation`,children:(0,H.jsxs)(`section`,{"aria-labelledby":`connect-lark-title`,"aria-modal":`true`,className:`personal-lark-modal`,role:`dialog`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:`Goal Topic connection`}),(0,H.jsx)(`h2`,{id:`connect-lark-title`,children:o(pe?`lark.editConnection`:`lark.connectApp`)})]}),(0,H.jsx)(`button`,{"aria-label":o(`lark.closeConnection`),onClick:()=>b(!1),type:`button`,children:(0,H.jsx)(eh,{size:18})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.conversationKind`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.conversationKind`),disabled:!!he,value:F,onChange:e=>ne(e.target.value),children:[(0,H.jsx)(`option`,{value:`manager`,children:o(`lark.managerConversation`)}),(0,H.jsx)(`option`,{value:`goal`,children:o(`lark.workerConversation`)})]})]}),F===`manager`?(0,H.jsx)(`p`,{children:o(`lark.managerConversationDescription`)}):null,he?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,H.jsx)(`div`,{children:he.app_label})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,H.jsx)(`div`,{children:he.chat_name})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,H.jsx)(`div`,{children:he.goal_title})]}),(0,H.jsx)(`small`,{children:o(`lark.editPreservesIdentity`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,H.jsx)(`select`,{"aria-label":o(`lark.appProfile`),disabled:p,onChange:e=>{e.target.value===`__register__`?Je():(S(e.target.value),le({}))},value:x,children:p?(0,H.jsx)(`option`,{value:``,children:o(`lark.appLoading`)}):(0,H.jsxs)(H.Fragment,{children:[l.map(e=>(0,H.jsxs)(`option`,{disabled:!e.ready,value:e.app_ref,children:[e.label,e.reply_ready?``:e.ready?` · ${o(`lark.needsMessagePermissions`)}`:` · ${o(`lark.needsSetup`)}`]},e.app_ref)),(0,H.jsx)(`option`,{value:`__register__`,children:o(`lark.registerAnother`)})]})}),(0,H.jsx)(`small`,{children:o(`lark.defaultAgentAppDescription`)})]}),He?.ready&&!He.reply_ready?(0,H.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.appPermissions`)}):null,(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,H.jsx)(`input`,{"aria-label":o(`lark.groupSearch`),onChange:e=>E(e.target.value),placeholder:o(`lark.groupSearch`),type:`search`,value:T}),te?(0,H.jsxs)(`div`,{className:`personal-lark-group-state`,role:`status`,children:[(0,H.jsx)(wm,{className:`is-spinning`,size:15}),o(`lark.groupLoading`)]}):null,!te&&j?(0,H.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:j}):null,!te&&!j&&D.length===0?(0,H.jsx)(`div`,{className:`personal-lark-group-state`,role:`status`,children:o(`lark.groupEmpty`)}):null,!te&&!j&&D.length>0?(0,H.jsx)(`select`,{"aria-label":o(`lark.groupChat`),onChange:e=>ee(e.target.value),value:k,children:D.map(e=>(0,H.jsx)(`option`,{value:e.chat_id,children:e.chat_name},e.chat_id))}):null]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,H.jsx)(`select`,{"aria-label":o(`lark.bindGoal`),onChange:e=>{let t=e.target.value;w(t),ae(n.find(e=>e.goalId===t)?.agentId??``),le({})},value:C,children:n.map(e=>(0,H.jsx)(`option`,{value:e.goalId,children:e.title},e.goalId))})]})]}),(0,H.jsxs)(`label`,{className:`personal-lark-check`,children:[(0,H.jsx)(`input`,{checked:!0,readOnly:!0,type:`checkbox`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:o(`lark.createAutomatically`)}),(0,H.jsx)(`small`,{children:o(`lark.createAutomaticallyDescription`)})]})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.topicPreview`)}),(0,H.jsxs)(`div`,{className:`personal-lark-topic-preview`,children:[(0,H.jsx)(Om,{size:15}),`# `,Pe?.title??Pe?.goalId??`Goal`]})]}),F===`goal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.captureScope`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.captureScope`),disabled:he?.ingress_mode===`direct_session`,onChange:e=>P(e.target.value),value:N,children:[(0,H.jsx)(`option`,{value:`addressed_only`,children:o(`lark.captureAddressed`)}),(0,H.jsx)(`option`,{value:`configured_chat_all`,children:o(`lark.captureAll`)})]}),(0,H.jsx)(`small`,{children:o(`lark.captureScopeDescription`)})]}),(0,H.jsxs)(`fieldset`,{"aria-label":o(`lark.agentIngress`),className:`personal-lark-ingress`,children:[(0,H.jsx)(`legend`,{children:o(`lark.agentIngress`)}),(0,H.jsx)(`div`,{children:[`live_steering`,`session_queue`,`async_inbox`].map(e=>{let t=Ab(e,o);return(0,H.jsxs)(`label`,{className:re===e?`is-active`:``,children:[(0,H.jsx)(`input`,{"aria-label":t.label,checked:re===e,name:`lark-agent-ingress`,onChange:()=>I(e),type:`radio`,value:e}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:t.label}),(0,H.jsx)(`small`,{children:t.detail})]})]},e)})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.targetAgent`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.targetAgent`),disabled:!!he?.agent_id,onChange:e=>ae(e.target.value),value:R,children:[Le?null:(0,H.jsx)(`option`,{disabled:!0,value:R,children:R?o(`lark.agentUnavailable`,{agent:R}):o(`lark.noAgentConfigured`)}),Ie.map(e=>(0,H.jsx)(`option`,{value:e.agentId,children:e.label===e.agentId?e.agentId:`${e.label} · ${e.agentId}`},e.agentId))]}),(0,H.jsx)(`small`,{children:o(`lark.targetAgentDescription`)})]}),!pe&&Ie.length>1?(0,H.jsxs)(`label`,{"aria-label":o(`lark.connectAllAgents`),className:`personal-lark-check`,children:[(0,H.jsx)(`input`,{checked:oe,onChange:e=>se(e.target.checked),type:`checkbox`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:o(`lark.connectAllAgents`)}),(0,H.jsx)(`small`,{children:o(`lark.connectAllAgentsDescription`,{count:Ie.length})})]})]}):null,!pe&&oe&&Ie.length>1?(0,H.jsxs)(`fieldset`,{"aria-label":o(`lark.agentApps`),className:`personal-lark-agent-apps`,children:[(0,H.jsx)(`legend`,{children:o(`lark.agentApps`)}),(0,H.jsx)(`small`,{children:o(`lark.agentAppsDescription`)}),(0,H.jsx)(`div`,{children:Ie.map(e=>(0,H.jsxs)(`label`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsx)(`small`,{children:e.agentId})]}),(0,H.jsx)(`select`,{"aria-label":o(`lark.agentAppSelection`,{agent:e.label}),onChange:t=>le(n=>({...n,[e.agentId]:t.target.value})),value:ce[e.agentId]??x,children:l.map(e=>(0,H.jsxs)(`option`,{disabled:!e.ready,value:e.app_ref,children:[e.label,e.reply_ready?``:e.ready?` · ${o(`lark.needsMessagePermissions`)}`:` · ${o(`lark.needsSetup`)}`]},e.app_ref))})]},e.agentId))})]}):null,oe&&Re.length>0&&!Be?(0,H.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.agentAppPermissions`)}):null,ze.length===0?(0,H.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:o(`lark.selectRegisteredAgent`)}):null]}):null,(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.replyMode`)}),(0,H.jsx)(`select`,{"aria-label":o(`lark.replyMode`),onChange:e=>ie(e.target.value),value:L,children:(0,H.jsx)(`option`,{value:`topic_reply`,children:o(`lark.topicReply`)})}),(0,H.jsx)(`small`,{children:o(`lark.replyModeDescription`)})]}),(0,H.jsxs)(`p`,{className:`personal-lark-cardinality`,children:[(0,H.jsx)(tm,{size:15}),o(`lark.cardinality`)]}),de?(0,H.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:de}):null,(0,H.jsxs)(`footer`,{children:[(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>b(!1),type:`button`,children:o(`lark.cancel`)}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:p||!x||!he&&(!He?.reply_ready||!k)||F===`goal`&&(!Be||ze.length===0)||!C||ue,onClick:()=>void Ze(),type:`button`,children:[ue?(0,H.jsx)(wm,{className:`is-spinning`,size:15}):null,Ve]})]})]})}):null,ye?(0,H.jsx)(`div`,{className:`personal-lark-modal-backdrop is-setup`,role:`presentation`,children:(0,H.jsxs)(`section`,{"aria-labelledby":`new-lark-app-title`,"aria-modal":`true`,className:`personal-lark-modal personal-lark-setup-modal`,role:`dialog`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:o(`lark.reusableWorkspaceApp`)}),(0,H.jsx)(`h2`,{id:`new-lark-app-title`,children:o(`lark.newApp`)})]}),(0,H.jsx)(`button`,{"aria-label":o(`lark.closeCreate`),onClick:()=>void Xe(),type:`button`,children:(0,H.jsx)(eh,{size:18})})]}),Te?(0,H.jsxs)(`div`,{className:`personal-lark-setup-progress`,children:[(0,H.jsx)(`span`,{className:`personal-lark-setup-icon is-${Te.status}`,children:Te.status===`ready`?(0,H.jsx)(tm,{size:22}):(0,H.jsx)(wm,{className:Te.status===`failed`?``:`is-spinning`,size:22})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:Te.status===`ready`?o(`lark.appCreated`):Te.status===`failed`?o(`lark.appCreateFailed`):o(`lark.waitingFeishu`)}),(0,H.jsx)(`p`,{children:Te.status===`waiting_for_feishu`?o(`lark.waitingFeishuDescription`):Te.status===`starting`?o(`lark.waitingLink`):Te.error})]}),Te.verification_url?(0,H.jsxs)(`a`,{href:Te.verification_url,rel:`noreferrer`,target:`_blank`,children:[(0,H.jsx)(pm,{size:15}),o(`lark.reopenFeishu`)]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`personal-lark-setup-copy`,children:o(`lark.setupCopy`)}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.profileName`)}),(0,H.jsx)(`input`,{"aria-label":o(`lark.profileName`),autoComplete:`off`,onChange:e=>Se(e.target.value),placeholder:`loopx-workspace-bot`,value:xe})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.region`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.region`),onChange:e=>we(e.target.value),value:Ce,children:[(0,H.jsx)(`option`,{value:`feishu`,children:`Feishu`}),(0,H.jsx)(`option`,{value:`lark`,children:`Lark`})]})]}),xe&&!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(xe)?(0,H.jsx)(`p`,{className:`personal-notification-error`,children:o(`lark.profileValidation`)}):null]}),Oe?(0,H.jsx)(`p`,{className:`personal-notification-error`,children:Oe}):null,(0,H.jsxs)(`footer`,{children:[(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void Xe(),type:`button`,children:o(`lark.cancel`)}),Te?null:(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:Ee||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(xe),onClick:()=>void Ye(),type:`button`,children:[Ee?(0,H.jsx)(wm,{className:`is-spinning`,size:15}):(0,H.jsx)(pm,{size:15}),o(`lark.continueFeishu`)]})]})]})}):null]})}function Fb(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Ib(e,t,n){let r=Fb(t),i=Fb(n);return Object.fromEntries(e.fields.flatMap(({key:e,nullable:t})=>{let n=r[e],a=i[e];return Object.hasOwn(r,e)&&(n!=null||t&&n===null)?[[e,n]]:Object.hasOwn(i,e)&&a!=null?[[e,a]]:[]}))}function Lb(e,t){let n;try{n=JSON.parse(t)}catch{return null}if(!n||typeof n!=`object`||Array.isArray(n))return null;let r=new Set(e.fields.map(e=>e.key));return Object.keys(n).some(e=>!r.has(e))?null:n}function Rb(e,t,n){let r={...e,[t]:n},i=e.schedule;return t===`timezone`&&i&&typeof i==`object`&&`schema_version`in i&&i.schema_version===`periodic_report_schedule_v0`&&(r.schedule={...i,timezone:n}),r}function zb({id:e,value:t,timezone:n,onChange:r}){let{locale:i}=qi(),a=i===`zh-CN`,o=t&&typeof t==`object`&&!Array.isArray(t)?t:null,s=String(o?.rrule??``).split(`;`).map(e=>e.split(`=`)),c=Object.fromEntries(s.filter(e=>e.length===2)),l=[`MO`,`TU`,`WE`,`TH`,`FR`,`SA`,`SU`],u=(e,t)=>e!==void 0&&/^\d+$/.test(e)&&Number(e)<=t,d=!o||o.schema_version===`periodic_report_schedule_v0`&&[`DAILY`,`WEEKLY`].includes(c.FREQ)&&o.timezone===n&&s.every(e=>e.length===2&&[`FREQ`,`BYDAY`,`BYHOUR`,`BYMINUTE`,`INTERVAL`].includes(e[0]))&&new Set(s.map(([e])=>e)).size===s.length&&u(c.BYHOUR,23)&&u(c.BYMINUTE??`0`,59)&&(c.FREQ===`WEEKLY`?l.includes(c.BYDAY):!c.BYDAY)&&(!c.INTERVAL||c.INTERVAL===`1`),f=a?[`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`,`星期日`]:[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`];function p(e){let t={FREQ:`WEEKLY`,BYDAY:`MO`,BYHOUR:`9`,BYMINUTE:`0`,...c,...e};r?.({schema_version:`periodic_report_schedule_v0`,schedule_id:o?.schedule_id??`report-schedule`,timezone:n,rrule:[`FREQ=${t.FREQ}`,...t.FREQ===`WEEKLY`?[`BYDAY=${t.BYDAY}`]:[],`BYHOUR=${t.BYHOUR}`,`BYMINUTE=${t.BYMINUTE}`].join(`;`)})}return(0,H.jsxs)(`div`,{className:`personal-report-schedule`,children:[(0,H.jsxs)(`label`,{className:`is-boolean`,htmlFor:e,children:[(0,H.jsx)(`span`,{children:a?`按日历汇报`:`Calendar reports`}),(0,H.jsx)(`input`,{id:e,type:`checkbox`,role:`switch`,checked:!!o,disabled:!r,onChange:e=>e.target.checked?p({}):r?.(null)})]}),o?(0,H.jsxs)(H.Fragment,{children:[d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{htmlFor:`${e}-frequency`,children:[(0,H.jsx)(`span`,{children:a?`频率`:`Frequency`}),(0,H.jsxs)(`select`,{id:`${e}-frequency`,value:c.FREQ,disabled:!r,onChange:e=>p({FREQ:e.target.value}),children:[(0,H.jsx)(`option`,{value:`DAILY`,children:a?`每天`:`Daily`}),(0,H.jsx)(`option`,{value:`WEEKLY`,children:a?`每周`:`Weekly`})]})]}),c.FREQ===`WEEKLY`&&(0,H.jsxs)(`label`,{htmlFor:`${e}-day`,children:[(0,H.jsx)(`span`,{children:a?`星期`:`Weekday`}),(0,H.jsx)(`select`,{id:`${e}-day`,value:c.BYDAY,disabled:!r,onChange:e=>p({BYDAY:e.target.value}),children:l.map((e,t)=>(0,H.jsx)(`option`,{value:e,children:f[t]},e))})]}),(0,H.jsxs)(`label`,{htmlFor:`${e}-time`,children:[(0,H.jsxs)(`span`,{children:[a?`当地时间`:`Local time`,` (`,n,`)`]}),(0,H.jsx)(`input`,{id:`${e}-time`,type:`time`,required:!0,disabled:!r,value:`${(c.BYHOUR??`9`).padStart(2,`0`)}:${(c.BYMINUTE??`0`).padStart(2,`0`)}`,onChange:e=>{if(!/^\d{2}:\d{2}$/.test(e.target.value))return;let[t,n]=e.target.value.split(`:`);p({BYHOUR:t,BYMINUTE:n})}})]})]}):(0,H.jsx)(`p`,{role:`alert`,children:a?`此计划需在 JSON 模式中编辑;当前内容已保留。`:`Edit this schedule in JSON mode; its current value is preserved.`}),(0,H.jsx)(`p`,{children:a?`由现有唤醒检查到期计划;实际送达以回执为准。`:`Existing wakes check the schedule; delivery is confirmed by its receipt.`})]}):(0,H.jsx)(`p`,{children:a?`未设置日历计划;保持阶段结束时汇报。`:`No calendar schedule; report at validated stage boundaries.`})]})}function Bb({copy:e,field:t,id:n,onChange:r,value:i,timezone:a}){let o=e[t.key]?.label??t.label,s=!r;if(t.input_kind===`periodic_report_schedule`)return(0,H.jsx)(zb,{id:n,value:i,timezone:a,onChange:r?e=>r(t.key,e):void 0});if(t.input_kind===`boolean`)return(0,H.jsxs)(`label`,{className:`is-boolean`,htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsx)(`input`,{checked:i===!0,id:n,onChange:r?e=>r(t.key,e.target.checked):void 0,readOnly:s,role:`switch`,type:`checkbox`})]});if(t.input_kind===`select`)return(0,H.jsxs)(`label`,{htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsxs)(`select`,{id:n,onChange:r?e=>r(t.key,e.target.value):void 0,value:typeof i==`string`?i:``,children:[(0,H.jsx)(`option`,{value:``}),(t.options??[]).map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]})]});if(t.input_kind===`string_list`)return(0,H.jsxs)(`label`,{htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsx)(`textarea`,{id:n,onChange:r?e=>r(t.key,e.target.value.split(/\r?\n/u).filter(Boolean)):void 0,readOnly:s,rows:4,value:Array.isArray(i)?i.join(` -`):``})]});let c=t.input_kind===`number`;return(0,H.jsxs)(`label`,{htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsx)(`input`,{id:n,max:t.maximum,min:t.minimum,onChange:r?e=>r(t.key,c?Number(e.target.value):e.target.value):void 0,readOnly:s,required:t.required,type:c?`number`:`text`,value:typeof i==`number`||typeof i==`string`?i:``})]})}function Vb({copy:e={},disabled:t=!1,editor:n,enabledAction:r,omitKeys:i=[],onChange:a,value:o}){let s=(0,V.useId)(),c=new Set(i);return(0,H.jsx)(`fieldset`,{className:`personal-capability-fields`,disabled:t,children:n.fields.filter(e=>!c.has(e.key)).map(t=>{let n=(0,H.jsx)(Bb,{copy:e,field:t,id:`${s}-${t.key.replace(/[^a-z0-9_-]/gi,`-`)}`,onChange:a,value:o[t.key],timezone:String(o.timezone??`UTC`)},t.key);return t.key===`enabled`&&t.input_kind===`boolean`?(0,H.jsxs)(`div`,{className:`personal-capability-enabled-row`,children:[n,r]},t.key):n})})}var Hb={en:{manager_runtime:{displayName:`Manager runtime`,description:`Selects the persistent host-tool profile used by owner manager conversations.`},todo_replan_cadence:{displayName:`Goal review cadence`,description:`Configures the Goal review cadence.`},change_quality_qualification:{displayName:`Change quality qualification`,description:`Prepares a provider-neutral review packet, allows at most one policy-authorized safe-fix pass, and can require an exact-diff receipt.`},explore_graph:{displayName:`Explore Graph`,description:`Organizes bounded exploration as a typed evidence graph so branches, findings, and synthesis remain inspectable.`},explore_harness:{displayName:`Explore Harness`,description:`Selects a capability-owned planning and research harness profile for bounded multi-step exploration.`},lark_event_inbox:{displayName:`Lark event inbox`,description:`Receives provider events through a local-private inbox binding before LoopX projects them into governed work.`,readOnlyReason:`This capability requires a local-private inbox binding. Manage it in Lark settings or through the capability CLI.`},lark_kanban_heartbeat_sync:{displayName:`Lark Kanban heartbeat sync`,description:`Synchronizes accepted LoopX work state to the configured Lark Kanban heartbeat surface.`},local_authority_shadow:{displayName:`Local authority shadow`,description:`Observes post-commit Todo and task-lease state through the shared authority contract without taking write authority.`},multi_subagent:{displayName:`Adaptive child capacity`,description:`Sets bounded child-agent capacity and the public-safe responsibility domains in which parallel work may be delegated.`},peer_task_coordination:{displayName:`Registered-peer task coordination`,description:`Routes explicitly scoped peer-owned work to one registered coordinator without granting cross-owner mutation authority.`},periodic_report:{displayName:`Periodic reports`,description:`Turns validated Goal stage progress into a frozen report and automatically delivers it through the configured Goal Channel with exact readback.`},pull_request_review:{displayName:`Pull-request review`,description:`Ranks the public GitHub PR review queue with a machine-level default; it never grants GitHub, Todo, push, or merge authority.`},reward_memory:{displayName:`Reward Memory experiment`,description:`Configures a reviewed local-private provider binding for Goal-scoped Agent recall and evidence-backed outcome learning.`}},"zh-CN":{manager_runtime:{displayName:`管家 Runtime`,description:`选择管家会话持续生效的宿主工具模式。`},todo_replan_cadence:{displayName:`Goal 复核周期`,description:`配置 Goal 的复核周期。`},change_quality_qualification:{displayName:`变更质量验证`,description:`生成与 Provider 无关的审阅包,最多允许一次策略授权的安全修复,并可要求精确 diff 回执。`},explore_graph:{displayName:`探索图谱`,description:`把有界探索组织为 typed 证据图,让探索分支、发现与综合结论都可检查、可追溯。`},explore_harness:{displayName:`探索 Harness`,description:`为有界的多步探索选择由能力负责的规划与研究 Harness profile。`},lark_event_inbox:{displayName:`飞书事件收件箱`,description:`通过本机私有收件箱接收 Provider 事件,再由 LoopX 将其投影为受治理的工作。`,readOnlyReason:`此能力依赖本机私有的收件箱绑定,请在飞书设置或 capability CLI 中管理。`},lark_kanban_heartbeat_sync:{displayName:`飞书看板心跳同步`,description:`把 LoopX 已接受的工作状态同步到配置好的飞书看板心跳界面。`},local_authority_shadow:{displayName:`本地 Authority 影子观测`,description:`通过共享 Authority contract 观测提交后的 Todo 与 task lease 状态,但不取得写入权。`},multi_subagent:{displayName:`自适应子 Agent 容量`,description:`限定子 Agent 容量与可公开的职责域,只有落在这些边界内的工作才能并行委派。`},peer_task_coordination:{displayName:`已注册 Peer 任务协调`,description:`把明确限定的 Peer 工作路由给一个已注册协调者,不授予跨 Owner 修改权限。`},periodic_report:{displayName:`周期报告`,description:`把经过验证的 Goal 阶段进展整理为冻结报告,并通过配置的 Goal Channel 自动发送和精确回读。`},pull_request_review:{displayName:`Pull-request Review`,description:`配置公开 GitHub PR 审阅队列的本机默认排序;不会授予 GitHub、Todo、push 或 merge 权限。`},reward_memory:{displayName:`Reward Memory 实验`,description:`为 Goal 内 Agent 的召回与证据化结果学习配置经过审阅的本机私有 Provider 绑定。`}}},Ub={en:{runtime_profile:{label:`Runtime profile`,description:`Restricted keeps scoped LoopX reads only. Trusted owner enables normal host tools while protected operations retain separate checks.`},completed_todos:{label:`Completed Todos between Goal reviews`,description:`Machine default or explicit Goal override, from 1 to 5.`},allowed_domains:{label:`Allowed responsibility domains`,description:`Enter one bounded, public-safe domain per line.`},coordinator_agent_id:{label:`Coordinator Agent`,description:`Use an already registered Agent id; leave blank to disable coordination.`},enabled:{label:`Enabled`},model:{label:`Child model`,description:`For example gpt-5.6-luna. Blank clears the child model preference.`},reasoning_effort:{label:`Child reasoning effort`,description:`For example max; the host must support this model and effort.`},max_children:{label:`Maximum children`,description:`Hard upper bound for concurrently delegated child work.`},profile:{label:`Planner profile`,description:`Select one registered Explore Harness profile.`},profile_preset:{label:`Report profile`,description:`Capability-owned report profile, such as weekly-progress.`},review_priority:{label:`Review priority`,description:`Choose whether other developers' PRs or the authenticated reviewer's own PRs are ranked first.`},route_ref:{label:`Goal Channel route`,description:`Public route alias only; credentials and provider identifiers stay outside this form.`},safe_fix:{label:`Allow one bounded safe-fix pass`},strict_receipt:{label:`Require an exact-diff receipt`},timezone:{label:`Timezone`,description:`Use an IANA timezone, for example Asia/Shanghai.`},schedule:{label:`Calendar reports`,description:`Optional daily or weekly reports; no schedule preserves stage-only delivery.`},config_path:{label:`Local-private configuration path`,description:`Repo-relative ignored JSON under .loopx/config/. Leave blank to retain the current binding; the path is never returned.`},enabled_agents:{label:`Enabled Goal Agents`,description:`Enter one registered Goal-local Agent id per line. A private binding currently accepts exactly one Agent.`}},"zh-CN":{runtime_profile:{label:`运行模式`,description:`restricted 仅使用受限 LoopX 读取;trusted_owner 开放常规宿主工具,但受保护操作仍单独校验。`},completed_todos:{label:`两次 Goal 复核间的已完成 Todo 数`,description:`可设置 1–5;机器默认值可被 Goal 显式覆盖。`},allowed_domains:{label:`允许的职责域`,description:`每行填写一个有边界、可公开的职责域。`},coordinator_agent_id:{label:`协调 Agent`,description:`填写一个已经注册的 Agent ID;留空表示关闭协调。`},enabled:{label:`启用`},model:{label:`子 Agent 模型`,description:`例如 gpt-5.6-luna;留空清除模型偏好。`},reasoning_effort:{label:`子 Agent 推理档位`,description:`例如 max;宿主须支持所选模型与档位。`},max_children:{label:`最大子 Agent 数`,description:`可同时委派的子任务硬上限。`},profile:{label:`规划 Profile`,description:`选择一个已注册的 Explore Harness profile。`},profile_preset:{label:`报告 Profile`,description:`由该能力管理的报告 profile,例如 weekly-progress。`},review_priority:{label:`审阅优先级`,description:`选择先排其他开发者的 PR,还是先排当前已认证审阅者自己的 PR。`},route_ref:{label:`Goal Channel 路由`,description:`只填写公开 route alias;凭据与 Provider 标识不会进入此表单。`},safe_fix:{label:`允许一次有界安全修复`},strict_receipt:{label:`要求精确 diff 回执`},timezone:{label:`时区`,description:`使用 IANA 时区,例如 Asia/Shanghai。`},schedule:{label:`日历汇报`,description:`可选每日或每周计划;未设置时保持阶段结束汇报。`},config_path:{label:`本机私有配置路径`,description:`填写 .loopx/config/ 下、相对仓库且被忽略的 JSON;留空保留当前绑定,路径不会被回传。`},enabled_agents:{label:`已启用的 Goal Agent`,description:`每行填写一个已注册的 Goal 内 Agent ID;私有绑定当前只接受一个 Agent。`}}};function Wb(e,t){let n=Hb[t][e.capability_id];return n?{...e,display_name:n.displayName,description:n.description,configuration_editor:{...e.configuration_editor,...n.readOnlyReason?{read_only_reason:n.readOnlyReason}:{}}}:e}function Gb(e){return Ub[e]}Object.freeze(Object.keys(Hb.en).sort());function Kb(e,t){return e.available_scopes.includes(t)&&(t!==`machine`||!!e.machine_namespace)&&e.configuration_editor.editable&&e.configuration_editor.writable_scopes.includes(t)}function qb({values:e,t}){return(0,H.jsxs)(`details`,{className:`personal-capability-raw-values`,children:[(0,H.jsx)(`summary`,{children:t(`capabilities.rawJson`)}),(0,H.jsx)(`div`,{className:`personal-capability-value-grid`,children:e.map(({label:e,value:t})=>(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`strong`,{children:e}),(0,H.jsx)(`pre`,{children:t?JSON.stringify(t,null,2):`—`})]},e))})]})}function Jb({source:e,t}){return e?(0,H.jsxs)(`p`,{className:`personal-capability-effective-source`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:15}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:t(`capabilities.effectiveSource`)}),t(`capabilities.source.${e}`)]})]}):null}function Yb({available:e,description:t,t:n}){return e?null:(0,H.jsxs)(`section`,{className:`personal-capability-editor-status is-read-only`,children:[(0,H.jsx)(Qm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:n(`capabilities.readOnly`)}),(0,H.jsx)(`p`,{children:t})]})]})}function Xb(e){return e.availability?.includes(`experimental`)?4:e.capability_id===`multi_subagent`?3:e.configuration_editor.writable_scopes.length===0||e.availability===`supported_explicit_opt_in`?2:e.availability===`supported_explicit_override`?0:1}function Zb(e,t){return[...e].sort((e,n)=>{let r=Xb(e)-Xb(n);if(r!==0)return r;let i=Wb(e,t),a=Wb(n,t);return i.display_name.localeCompare(a.display_name,t)||e.capability_id.localeCompare(n.capability_id)})}function Qb({capabilities:e,locale:t,onSelect:n,scope:r,selectedCapabilityId:i,t:a}){return(0,H.jsx)(`nav`,{"aria-label":a(r===`goal`?`capabilities.catalog`:`machine.capabilityCatalog`),className:`personal-capability-list`,tabIndex:0,children:Zb(e,t).map(e=>{let o=Wb(e,t);return(0,H.jsxs)(`button`,{"aria-current":i===o.capability_id?`page`:void 0,onClick:()=>n(o.capability_id),type:`button`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:o.display_name})}),(0,H.jsx)(`em`,{children:a(o.available_scopes.includes(r)?r===`goal`?`capabilities.goalScope`:`capabilities.machineScope`:r===`machine`?`capabilities.goalScope`:`capabilities.machineScope`)})]},o.capability_id)})})}function $b({capability:e,locale:t,source:n}){let{t:r}=qi(),i=Wb(e,t);return(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`span`,{className:`personal-settings-icon`,children:(0,H.jsx)(Km,{"aria-hidden":!0,size:18})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`personal-capability-heading-row`,children:[(0,H.jsx)(`h2`,{children:i.display_name}),(0,H.jsx)(Jb,{source:n,t:r})]}),e.context_contribution&&(0,H.jsxs)(`details`,{className:`personal-capability-help`,"data-testid":`capability-context-phases`,children:[(0,H.jsx)(`summary`,{children:t===`zh-CN`?`主 Agent 协作指导`:`Coordinator workflow guidance`}),(0,H.jsx)(`p`,{children:t===`zh-CN`?`随能力开启。支持以下阶段;此处展示能力范围,不能证明某次运行已读取或采纳。`:`Enabled with this capability. These are supported phases, not proof that a run read or adopted the guidance.`}),(0,H.jsx)(`dl`,{children:e.context_contribution.supported_phases.map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:(0,H.jsx)(`code`,{children:e})}),(0,H.jsx)(`dd`,{children:ex[e][t===`zh-CN`?`zh`:`en`]})]},e))}),(0,H.jsx)(`p`,{children:t===`zh-CN`?`LoopX Turn 在请求与结果中提供上下文;原生工具入口由 LoopX skill 调用同一只读接口。执行与采纳需另看运行证据。`:`LoopX Turn includes context in requests and results. For native tools, the LoopX skill reads the same interface. Execution and adoption require run evidence.`})]}),(0,H.jsxs)(`details`,{className:`personal-capability-help`,children:[(0,H.jsx)(`summary`,{children:t===`zh-CN`?`配置说明`:`Configuration help`}),(0,H.jsx)(`p`,{children:i.description}),(0,H.jsx)(`dl`,{children:e.configuration_editor.fields.map(e=>{let n=Gb(t)[e.key],r=n?.description??e.description;return r?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:n?.label??e.label}),(0,H.jsx)(`dd`,{children:r})]},e.key):null})})]},e.capability_id)]})]})}var ex={before_plan:{zh:`规划前:识别独立问题并保留主 Agent 的核验与整合职责。`,en:`Before planning: identify independent questions and retain coordinator validation and integration.`},before_delegate:{zh:`委派前:明确子任务边界、模型偏好及预期证据。`,en:`Before delegation: specify task boundaries, model preferences and expected evidence.`},after_delegate_result:{zh:`回收后:核验结果,说明采纳决定并关联计划与成果。`,en:`After results: validate evidence, explain acceptance and link plans and deliverables.`}};function tx({goalId:e,onApplied:t,selected:n,t:r}){let[i,a]=(0,V.useState)({busy:null,draft:{},partialWrite:null,preview:null}),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(`guided`),[u,d]=(0,V.useState)(``),f=(0,V.useMemo)(()=>n?Lb(n.configuration_editor,u):null,[n,u]),p=c===`guided`||f!==null;(0,V.useEffect)(()=>{l(`guided`),d(``),a({busy:null,draft:Ib(n?.configuration_editor??{fields:[]},n?.current??n?.effective_configuration?.configuration??n?.default,n?.default),partialWrite:null,preview:null}),s(null)},[n]);async function m(t){if(!(!n||i.busy||!p)){a(e=>({...e,busy:`preview`,partialWrite:null})),s(null);try{let r=await Og(e,n.capability_id,t);a(e=>({...e,preview:r}))}catch(e){s(e instanceof Error?e.message:r(`capabilities.previewFailed`))}finally{a(e=>({...e,busy:null}))}}}async function h(){if(!(!n||!i.preview||i.busy||!p)){a(e=>({...e,busy:`apply`})),s(null);try{let r=Ib(n.configuration_editor,i.draft,n.default),o=await kg(e,n.capability_id,i.preview.action===`delete`?null:r,i.preview.plan_revision);a(e=>({...e,partialWrite:o.status===`partial_write`?o:null,preview:null})),o.status!==`partial_write`&&t()}catch(e){a(e=>({...e,preview:null})),s(e instanceof Error?e.message:r(`capabilities.applyFailed`))}finally{a(e=>({...e,busy:null}))}}}function g(e,t){a(r=>({...r,draft:n?.capability_id===`periodic_report`?Rb(r.draft,e,t):{...r.draft,[e]:t},preview:null})),s(null)}function _(e){if(!n||i.busy)return;d(e);let t=Lb(n.configuration_editor,e);a(e=>({...e,preview:null,draft:t?Ib(n.configuration_editor,t,n.default):e.draft})),s(null)}function v(){i.busy||!p||(c===`guided`&&d(JSON.stringify(i.draft,null,2)),l(c===`guided`?`json`:`guided`),a(e=>({...e,preview:null})))}return{apply:h,changeDraft:g,changeJson:_,changeMode:v,editorMode:c,jsonDraft:u,jsonValid:p,error:o,mutation:i,preview:m}}function nx({mutationError:e,onApplied:t,partialWrite:n,preview:r}){let{t:i}=qi();return(0,H.jsxs)(H.Fragment,{children:[e?(0,H.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:e}):null,n?(0,H.jsxs)(`section`,{"aria-live":`polite`,className:`personal-capability-recovery`,children:[(0,H.jsx)(Qm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:i(`capabilities.partialWrite`)}),(0,H.jsx)(`p`,{children:i(`capabilities.partialWriteDescription`)}),(0,H.jsx)(`small`,{children:n.recommended_action})]}),(0,H.jsxs)(`button`,{onClick:t,type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":!0,size:15}),i(`capabilities.refreshSource`)]})]}):null,r?(0,H.jsxs)(`section`,{className:`personal-capability-preview`,"aria-label":i(`capabilities.preview`),children:[(0,H.jsx)(`strong`,{children:i(`capabilities.preview`)}),(0,H.jsx)(`span`,{children:i(`machine.action.${r.action}`)}),(0,H.jsx)(`small`,{children:i(`capabilities.previewLocked`)})]}):null]})}function rx({catalog:e,goalId:t,onApplied:n}){let{locale:r,t:i}=qi(),a=(0,V.useMemo)(()=>Zb(e.capabilities,r),[e.capabilities,r]),[o,s]=(0,V.useState)(()=>a[0]?.capability_id??``),c=(0,V.useMemo)(()=>a.find(e=>e.capability_id===o)??a[0],[a,o]),l=(0,V.useMemo)(()=>c?Wb(c,r):void 0,[r,c]),{apply:u,changeDraft:d,changeJson:f,changeMode:p,editorMode:m,jsonDraft:h,jsonValid:g,error:_,mutation:v,preview:y}=tx({goalId:t,onApplied:n,selected:l,t:i}),{busy:b,draft:x,partialWrite:S,preview:C}=v;if(!c||!l)return(0,H.jsx)(`p`,{className:`personal-capability-empty`,children:i(`capabilities.empty`)});let w=l.available_scopes.includes(`goal`),T=Kb(l,`goal`),E=l.configuration_editor.read_only_reason??i(w?`capabilities.previewOnly`:`capabilities.machineOnly`);async function D(){if(!l||!T||b||!g)return;let e=Ib(l.configuration_editor,x,l.default);await y(e)}async function O(){!T||b||await y(null)}return(0,H.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,H.jsx)(Qb,{capabilities:e.capabilities,locale:r,onSelect:s,scope:`goal`,selectedCapabilityId:l.capability_id,t:i}),(0,H.jsxs)(`article`,{"aria-label":l.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,H.jsx)($b,{capability:c,locale:r,source:l.effective_configuration?.source}),(0,H.jsx)(Yb,{available:T,t:i,description:E}),T?(0,H.jsxs)(H.Fragment,{children:[m===`json`||!l.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,H.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,H.jsxs)(`button`,{disabled:!!b||!g,onClick:p,type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),i(m===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,m===`guided`?(0,H.jsx)(`section`,{className:`personal-capability-field-summary`,children:(0,H.jsx)(Vb,{disabled:!!b,copy:Gb(r),editor:l.configuration_editor,onChange:d,value:x,enabledAction:(0,H.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:p,type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),i(`machine.editJson`)]})})}):(0,H.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`goal-configuration-json`,children:[(0,H.jsx)(`span`,{children:i(`capabilities.jsonConfiguration`)}),(0,H.jsx)(`textarea`,{id:`goal-configuration-json`,"aria-describedby":`goal-configuration-json-help`,disabled:!!b,onChange:e=>f(e.target.value),rows:12,spellCheck:!1,value:h}),(0,H.jsx)(`small`,{id:`goal-configuration-json-help`,children:i(`capabilities.jsonHelp`)}),g?null:(0,H.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:i(`capabilities.jsonInvalid`)})]})]}):null,(0,H.jsx)(nx,{mutationError:_,onApplied:n,partialWrite:S,preview:C}),T?(0,H.jsxs)(`footer`,{className:`personal-capability-actions`,children:[l.current&&l.available_scopes.includes(`machine`)?(0,H.jsx)(`button`,{disabled:!!b||!g,onClick:()=>void O(),type:`button`,children:i(`capabilities.restoreInheritance`)}):null,(0,H.jsx)(`button`,{disabled:!!b||!g,onClick:()=>void D(),type:`button`,children:i(b===`preview`?`common.loading`:`capabilities.previewChanges`)}),(0,H.jsx)(`button`,{className:`is-primary`,disabled:!!b||!C||!g,onClick:()=>void u(),type:`button`,children:i(b===`apply`?`common.loading`:`capabilities.applyPreview`)})]}):null,(0,H.jsx)(qb,{values:[{label:i(`capabilities.goalValue`),value:l.current},{label:i(l.machine_current?`capabilities.machineValue`:`capabilities.defaultValue`),value:l.machine_current??l.default}],t:i},c.capability_id)]})]})}function ix({goalId:e}){let{t}=qi(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(!1);function c(){e&&(s(!0),a(null),Dg(e).then(r).catch(e=>a(e instanceof Error?e.message:t(`capabilities.loadFailed`))).finally(()=>s(!1)))}return(0,V.useEffect)(c,[e]),e?o&&!n?(0,H.jsxs)(`p`,{"aria-live":`polite`,className:`personal-capability-empty`,children:[(0,H.jsx)(wm,{className:`personal-spin`,size:18}),t(`capabilities.loading`)]}):i?(0,H.jsxs)(`section`,{className:`personal-capability-error`,role:`alert`,children:[(0,H.jsx)(Qm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:t(`capabilities.loadFailed`)}),(0,H.jsx)(`small`,{children:i})]}),(0,H.jsxs)(`button`,{onClick:c,type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":!0,size:15}),t(`capabilities.retry`)]})]}):n?(0,H.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n.revision,children:[(0,H.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:17}),t(`capabilities.atomicOverride`)]}),(0,H.jsx)(`p`,{children:t(`capabilities.atomicOverrideDescription`)})]}),(0,H.jsx)(rx,{catalog:n.capability_catalog,goalId:e,onApplied:c})]}):null:(0,H.jsx)(`p`,{className:`personal-capability-empty`,children:t(`capabilities.chooseGoal`)})}function ax(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function ox(e,t){let n=t?.machine_namespace;return n?e?.machine_configuration?.namespaces[n]:void 0}function sx(e,t,n){return{...ax(e.default),...ax(t),...n}}function cx(e,t){for(let n of e.configuration_editor.fields){let e=t[n.key];if(n.required&&(e==null||e===``))return!1}return e.capability_id===`periodic_report`&&t.enabled===!0?!!(String(t.profile_preset??``).trim()&&String(t.route_ref??``).trim()&&String(t.timezone??``).trim()):!0}function lx(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}catch{return null}}function ux(e){return e?e===`absent`?e:e.replace(/^sha256:/,``).slice(0,12):`—`}function dx(){let{locale:e,t}=qi(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)({}),[c,l]=(0,V.useState)(`{}`),[u,d]=(0,V.useState)(`guided`),[f,p]=(0,V.useState)(null),[m,h]=(0,V.useState)(`upsert`),[g,_]=(0,V.useState)(null),[v,y]=(0,V.useState)(null),[b,x]=(0,V.useState)(`load`),[S,C]=(0,V.useState)(null),[w,T]=(0,V.useState)(null),E=(0,V.useMemo)(()=>Zb(n?.capability_catalog.capabilities??[],e),[n,e]),D=n?.invalid_namespaces[0],O=E.find(e=>e.capability_id===i)??(D?E.find(e=>e.machine_namespace===D):void 0)??E.find(e=>Kb(e,`machine`))??E[0],k=O?Wb(O,e):void 0,ee=ox(n,k),te=!!(k?.machine_namespace&&ee),A=!!(k&&Kb(k,`machine`)),j=(0,V.useMemo)(()=>lx(c),[c]),M=k?u===`json`?j:sx(k,ee,o):null,N=!!(k&&(u===`json`?j:cx(k,M??{})));async function P(){r(await Eg())}(0,V.useEffect)(()=>{let e=!0;return Eg().then(t=>{e&&r(t)}).catch(n=>{e&&C(n instanceof Error?n.message:t(`machine.loadError`))}).finally(()=>{e&&x(null)}),()=>{e=!1}},[t]),(0,V.useEffect)(()=>{if(!k)return;let e=ox(n,k),t=Ib(k.configuration_editor,e??k.default,k.default),r=sx(k,e,t);s(t),l(JSON.stringify(r,null,2)),d(A?`guided`:`json`),p(null),h(`upsert`),y(null)},[n,i,e]);function F(e,t){s(n=>k?.capability_id===`periodic_report`?Rb(n,e,t):{...n,[e]:t}),p(null),h(`upsert`),C(null),T(null)}function ne(e){if(k){if(e===`json`)l(JSON.stringify(sx(k,ee,o),null,2));else if(j)s(Ib(k.configuration_editor,j,k.default));else{C(t(`machine.jsonInvalid`));return}d(e),p(null),h(`upsert`),C(null)}}async function re(){if(!(!A||!k?.machine_namespace||!M||!N||b)){x(`preview`),C(null),T(null);try{h(`upsert`),p(await Ag(k.machine_namespace,M))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function I(){if(!(!A||!k?.machine_namespace||!te||b)){x(`preview`),C(null),T(null);try{h(`remove`),p(await Mg(k.machine_namespace))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function L(){if(!A||!k?.machine_namespace||!f||b||m===`upsert`&&!M)return;x(`apply`),C(null);let e=m;try{let n=e===`remove`?await Ng(k.machine_namespace,f.plan_revision):await jg(k.machine_namespace,M,f.plan_revision);_(n),p(null),h(`upsert`),y(null),await P(),T(n.status===`applied`?t(e===`remove`?`machine.removed`:`machine.applied`):t(`machine.unchanged`))}catch(e){p(null),h(`upsert`),C(e instanceof Error?e.message:t(`machine.applyError`))}finally{x(null)}}async function ie(){if(!(!g?.transaction_id||b)){x(`rollback-preview`),C(null);try{y(await Pg(g.transaction_id))}catch(e){C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}async function R(){if(!(!g?.transaction_id||!v||b)){x(`rollback`),C(null);try{await Fg(g.transaction_id,v.plan_revision),_(null),y(null),p(null),await P(),T(t(`machine.rolledBack`))}catch(e){y(null),C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}return b===`load`?(0,H.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:t(`common.loading`)}):k?(0,H.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n?.revision,children:[(0,H.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:17}),t(`machine.liveDefault`)]}),(0,H.jsx)(`p`,{children:t(`machine.liveDefaultDescription`)})]}),n?.status===`invalid`?(0,H.jsxs)(`section`,{className:`personal-machine-error`,"data-testid":`machine-invalid-repair`,role:`alert`,children:[(0,H.jsx)(`strong`,{children:t(`machine.invalidStoredConfiguration`)}),(0,H.jsx)(`p`,{children:t(`machine.invalidStoredConfigurationDescription`)})]}):null,(0,H.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,H.jsx)(Qb,{capabilities:E,locale:e,onSelect:a,scope:`machine`,selectedCapabilityId:k.capability_id,t}),(0,H.jsxs)(`article`,{"aria-label":k.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,H.jsx)($b,{capability:O,locale:e,source:k.available_scopes.includes(`machine`)?te?`machine_default`:`capability_default`:void 0}),(0,H.jsx)(Yb,{available:A,t,description:k.available_scopes.includes(`machine`)?t(`machine.editorUnavailableDescription`):t(`machine.goalOnly`)}),k.capability_id===`periodic_report`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:ee?.schedule?e===`zh-CN`?`日历与阶段汇报`:`Calendar and stage reports`:t(`machine.periodicReportActivation`)}),(0,H.jsx)(`p`,{children:ee?.schedule?ee.enabled===!0?e===`zh-CN`?`已配置日历计划,由现有唤醒检查;是否送达请核对报告回执。`:`A calendar schedule is configured and checked by existing wakes. Verify delivery in the report receipt.`:e===`zh-CN`?`日历计划已保存;启用此能力后才会检查和投递。`:`The schedule is saved; enable this capability to check and deliver reports.`:t(`machine.periodicReportActivationDescription`)})]})]}):null,k.capability_id===`change_quality_qualification`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.changeQualityActivation`)}),(0,H.jsx)(`p`,{children:t(`machine.changeQualityActivationDescription`)})]})]}):null,k.capability_id===`todo_replan_cadence`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.replanCadenceActivation`)}),(0,H.jsx)(`p`,{children:t(`machine.replanCadenceActivationDescription`)})]})]}):null,k.capability_id===`pull_request_review`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:e===`zh-CN`?`只改变队列排序`:`Queue ordering only`}),(0,H.jsx)(`p`,{children:e===`zh-CN`?`默认先审阅其他开发者的 PR;选择 owner-first 才会优先当前已认证审阅者自己的 PR。此配置不会发布 review、写 Todo、push 或 merge。`:`The default reviews other developers' PRs first; choose owner-first only when the authenticated reviewer's own PRs should lead. This setting never posts a review, writes Todos, pushes, or merges.`})]})]}):null,A?(0,H.jsxs)(H.Fragment,{children:[u===`json`||!k.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,H.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,H.jsxs)(`button`,{onClick:()=>ne(u===`guided`?`json`:`guided`),type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),t(u===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,u===`guided`?(0,H.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,H.jsx)(Vb,{copy:Gb(e),disabled:!!b,editor:k.configuration_editor,onChange:F,value:o,enabledAction:(0,H.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:()=>ne(`json`),type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),t(`machine.editJson`)]})}),N?null:(0,H.jsx)(`p`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.requiredFields`)})]}):(0,H.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`machine-configuration-json`,children:[(0,H.jsx)(`span`,{children:t(`machine.jsonConfiguration`)}),(0,H.jsx)(`textarea`,{"aria-describedby":`machine-configuration-json-help`,disabled:!!b,id:`machine-configuration-json`,onChange:e=>{l(e.target.value),p(null),C(null)},rows:12,spellCheck:!1,value:c}),(0,H.jsx)(`small`,{id:`machine-configuration-json-help`,children:t(`machine.jsonConfigurationHelp`)}),j?null:(0,H.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.jsonInvalid`)})]})]}):null,S?(0,H.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:S}):null,w?(0,H.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(tm,{"aria-hidden":!0,size:16}),w]}):null,f?(0,H.jsxs)(`section`,{"aria-label":t(`machine.preview`),className:`personal-machine-preview`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.preview`)}),(0,H.jsx)(`span`,{children:t(`machine.action.${f.action}`)})]}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`machine.currentRevision`)}),(0,H.jsx)(`dd`,{title:f.current_revision,children:ux(f.current_revision)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`machine.desiredRevision`)}),(0,H.jsx)(`dd`,{title:f.desired_revision,children:ux(f.desired_revision)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`machine.changedNamespaces`)}),(0,H.jsx)(`dd`,{children:f.changed_namespaces.join(`, `)||t(`common.none`)})]})]}),(0,H.jsx)(`p`,{children:t(`machine.previewLocked`)})]}):null,g?.rollback_available&&g.transaction_id?(0,H.jsxs)(`section`,{className:`personal-machine-rollback`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.rollbackAvailable`)}),(0,H.jsx)(`p`,{children:t(v?`machine.rollbackPreviewDescription`:`machine.rollbackDescription`)})]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!!b||!!(v&&!v.rollback_allowed),onClick:()=>void(v?R():ie()),type:`button`,children:[(0,H.jsx)(Rm,{"aria-hidden":!0,size:15}),t(b===`rollback`||b===`rollback-preview`?`common.loading`:v?`machine.confirmRollback`:`machine.previewRollback`)]})]}):null,A?(0,H.jsxs)(`footer`,{className:`personal-capability-actions`,children:[te?(0,H.jsxs)(`button`,{className:`is-danger`,disabled:!!b,onClick:()=>void I(),type:`button`,children:[(0,H.jsx)(Zm,{"aria-hidden":!0,size:15}),t(`machine.previewRemoval`)]}):null,(0,H.jsx)(`button`,{disabled:!!b||!N,onClick:()=>void re(),type:`button`,children:t(b===`preview`?`common.loading`:`machine.previewChanges`)}),(0,H.jsx)(`button`,{className:`is-primary`,disabled:!!b||!f,onClick:()=>void L(),type:`button`,children:t(b===`apply`?`common.loading`:`machine.applyPreview`)})]}):null,k.available_scopes.includes(`machine`)?(0,H.jsx)(qb,{values:[{label:t(`machine.currentValue`),value:ee},{label:t(`capabilities.defaultValue`),value:k.default}],t},k.capability_id):null]})]})]}):(0,H.jsx)(`p`,{className:`personal-capability-empty`,children:t(`machine.capabilityEmpty`)})}var fx={appearance:jm,capabilities:Km,language:xm,lark:Wm,machine:Hm};function px({focusGoalConnection:e=!1,goals:t,initialGoalId:n,initialTab:r=`lark`,onChanged:i,onClose:a,onThemeChange:o,theme:s}){let{locale:c,setLocale:l,t:u}=qi(),[d,f]=(0,V.useState)(r),p=[...n?[{key:`capabilities`,label:u(`capabilities.title`)}]:[],{key:`machine`,label:u(`machine.title`)},{key:`lark`,label:`Lark`},{key:`appearance`,label:u(`settings.appearance`)},{key:`language`,label:u(`settings.language`)}],m=[{label:u(`settings.languageEnglish`),value:`en`},{label:u(`settings.languageSimplifiedChinese`),value:`zh-CN`}],h={appearance:{title:u(`settings.appearance`)},capabilities:{title:u(`capabilities.title`)},language:{title:u(`settings.language`)},lark:{title:`Lark`},machine:{title:u(`machine.title`)}}[d];return(0,H.jsxs)(`section`,{"aria-label":u(`settings.title`),className:`personal-settings-page`,"data-pw-theme":s,children:[(0,H.jsxs)(`aside`,{className:`personal-settings-sidebar`,children:[(0,H.jsxs)(`button`,{className:`personal-settings-back`,onClick:a,type:`button`,children:[(0,H.jsx)(Kp,{size:17}),(0,H.jsx)(`span`,{children:u(`settings.back`)})]}),(0,H.jsxs)(`div`,{className:`personal-settings-title`,children:[(0,H.jsx)(`small`,{children:u(`settings.eyebrow`)}),(0,H.jsx)(`strong`,{children:u(`settings.title`)})]}),(0,H.jsx)(`nav`,{"aria-label":u(`settings.categories`),className:`personal-settings-tabs`,children:p.map(e=>{let t=fx[e.key];return(0,H.jsxs)(`button`,{"aria-current":d===e.key?`page`:void 0,onClick:()=>f(e.key),type:`button`,children:[(0,H.jsx)(t,{size:17}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:e.label})})]},e.key)})})]}),(0,H.jsxs)(`main`,{className:`personal-settings-body`,children:[(0,H.jsx)(`header`,{className:`personal-settings-header`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(`h1`,{children:h.title})})}),d===`lark`?(0,H.jsx)(Pb,{embedded:!0,focusGoalConnection:e,goals:t,initialGoalId:n,onChanged:i,onClose:a}):null,d===`machine`?(0,H.jsx)(dx,{}):null,d===`capabilities`?(0,H.jsx)(ix,{goalId:n}):null,d===`appearance`?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-appearance-settings`,children:[(0,H.jsx)(`small`,{children:u(`settings.workspaceDisplay`)}),(0,H.jsx)(`h3`,{children:u(`settings.appearance`)}),(0,H.jsxs)(`div`,{className:`personal-settings-choice-group`,role:`radiogroup`,"aria-label":u(`settings.workspaceTheme`),children:[(0,H.jsxs)(`button`,{"aria-checked":s===`loopx`,onClick:()=>o(`loopx`),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-settings-theme-swatch is-loopx`}),(0,H.jsx)(`strong`,{children:u(`settings.themeLoopx`)})]}),(0,H.jsxs)(`button`,{"aria-checked":s===`paper`,onClick:()=>o(`paper`),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-settings-theme-swatch is-paper`}),(0,H.jsx)(`strong`,{children:u(`settings.themeDefault`)})]}),(0,H.jsxs)(`button`,{"aria-checked":s===`brutal`,onClick:()=>o(`brutal`),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-settings-theme-swatch is-brutal`}),(0,H.jsx)(`strong`,{children:u(`settings.themeHighContrast`)})]})]})]}):null,d===`language`?(0,H.jsxs)(`section`,{className:`personal-settings-card`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`span`,{className:`personal-settings-icon`,children:(0,H.jsx)(xm,{size:18})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(`h2`,{children:u(`settings.language`)})})]}),(0,H.jsx)(`div`,{"aria-label":u(`settings.language`),className:`personal-language-options`,role:`radiogroup`,children:m.map(e=>(0,H.jsxs)(`button`,{"aria-checked":c===e.value,className:c===e.value?`is-selected`:``,onClick:()=>l(e.value),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:e.label})}),c===e.value?(0,H.jsx)(tm,{"aria-hidden":!0,size:17}):null]},e.value))})]}):null]})]})}var mx=`loopx-pw-theme`,hx=`loopx`;function gx(){try{let e=window.localStorage.getItem(mx);return e===`loopx`||e===`paper`||e===`brutal`?e:hx}catch{return hx}}function _x(e){try{window.localStorage.setItem(mx,e)}catch{}}function vx({drawer:e,drawerMode:t=`panel`,drawerOpen:n,main:r,mobileSidebarOpen:i=!1,onCloseMobileSidebar:a,sidebar:o,theme:s=`loopx`}){let{t:c}=qi(),l=(0,V.useRef)(null),u=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(!i)return;u.current=document.activeElement instanceof HTMLElement?document.activeElement:null;let e=l.current?.querySelectorAll(`button:not([disabled]), a[href], select:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])`);e?.[0]?.focus();function t(t){if(t.key!==`Tab`||!e?.length)return;let n=e[0],r=e[e.length-1];t.shiftKey&&document.activeElement===n?(t.preventDefault(),r.focus()):!t.shiftKey&&document.activeElement===r&&(t.preventDefault(),n.focus())}return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),u.current?.focus(),u.current=null}},[i]),(0,H.jsxs)(`section`,{className:`personal-workspace-shell${n?` has-drawer`:``}${n&&t.startsWith(`inspector`)?` has-task-inspector`:``}${t===`inspector-full`?` is-task-inspector-full`:``}${i?` mobile-sidebar-open`:``}`,"data-pw-theme":s,children:[i?(0,H.jsx)(`button`,{"aria-hidden":!0,className:`personal-sidebar-backdrop`,onClick:a,tabIndex:-1,type:`button`}):null,(0,H.jsx)(`aside`,{"aria-label":i?c(`header.goalNavigation`):void 0,"aria-modal":i?!0:void 0,className:`personal-workspace-sidebar`,"data-workspace-sidebar":!0,ref:l,role:i?`dialog`:void 0,children:(0,H.jsxs)(`div`,{className:`personal-workspace-sidebar-inner`,children:[i?(0,H.jsxs)(`button`,{className:`personal-sr-only`,onClick:a,type:`button`,children:[c(`common.close`),` `,c(`header.goalNavigation`)]}):null,o]})}),(0,H.jsx)(`main`,{"aria-hidden":i||void 0,className:`personal-workspace-main`,inert:i||void 0,children:r}),n?(0,H.jsx)(`aside`,{className:`personal-workspace-drawer`,"data-context-drawer":!0,"data-drawer-mode":t,children:e}):null]})}function yx(e){let t=e.match(/(?:下一步|建议|行动项|待办)[::\s]*([^\n]+)/u),n=t?t[1]:e;n=n.replace(/```[\s\S]*?```/g,``).replace(/`([^`]+)`/g,`$1`).replace(/\[([^\]]+)\]\([^)]+\)/g,`$1`).replace(/[#*~_>]/g,``).replace(/^[-*•\d+.\s]+/u,``).replace(/^(好的|没问题|收到|建议如下|任务如下|分析如下|结论[::])[\s,,::]*/u,``);let r=(n.split(/\r?\n/).map(e=>e.trim()).filter(Boolean)[0]||n).replace(/\s+/gu,` `).trim();return Array.from(r).slice(0,120).join(``)}function bx(e){let t=new Map;return e.forEach(e=>{let n=e.fields.find(e=>e.key===`todo_id`)?.value??``,r=[e.actionKind,e.goalId??``,n,e.title].join(`:`);t.set(r,e)}),[...t.values()]}function xx(e,t,n){if(!e)return n(`home.noFirstActivity`);let r=new Date(e);if(Number.isNaN(r.getTime()))return e;let i=new Date,a=new Intl.DateTimeFormat(t,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);return r.toDateString()===i.toDateString()?n(`home.todayAt`,{time:a}):new Intl.DateTimeFormat(t,{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r)}function Sx({goals:e,onSelectGoal:t,onRetry:n,systemHealth:r}){let{locale:i,t:a}=qi(),o=e.filter(e=>e.activationState===`active`),s=o.filter(e=>e.loadState===`error`).length,c=[{key:`needs_you`,label:a(`home.lane.needsYou`)},{key:`running`,label:a(`home.lane.running`)},{key:`observing`,label:a(`home.lane.observing`)},{key:`scheduled`,label:a(`home.lane.scheduled`)}],l=Object.fromEntries(c.map(e=>[e.key,[]])),u=[],d=[];e.filter(e=>!e.loadState).forEach(e=>{let t=by(e);t===`history`?u.push(e):t===`stopped`?d.push(e):l[t].push(e)});let f=e=>(0,H.jsxs)(`button`,{className:`personal-home-goal-card`,"data-goal-state":e.loadState??e.state,"data-load-error":e.loadError,onClick:()=>t(e.goalId),type:`button`,children:[(0,H.jsxs)(`span`,{className:`personal-home-goal-meta`,children:[(0,H.jsx)(`i`,{}),e.agentLaneCount&&e.agentLaneCount>1?a(`header.workAgentCount`,{count:e.agentLaneCount}):e.agentLabel??e.agentId]}),(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsx)(`p`,{children:e.loadError?a(`startup.error.${e.loadError}`):e.needsYou??e.nextSentence}),(0,H.jsxs)(`footer`,{children:[(0,H.jsx)(`span`,{children:e.loadState?a(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Ji(e.state,i)}),(0,H.jsx)(`small`,{title:e.latestActivity,children:e.loadState?``:e.latestActivity?xx(e.latestActivity,i,a):e.agentTodos.length?a(`home.taskCount`,{count:e.agentTodos.length}):a(`home.noActivity`)})]})]},e.goalId);return(0,H.jsxs)(`section`,{"aria-label":a(`home.workspace`),className:`personal-home-board`,children:[r&&(!r.ok||r.issues.length>0||r.freshnessWarning)?(0,H.jsxs)(`div`,{className:`personal-system-health-banner`,role:`alert`,children:[(0,H.jsxs)(`div`,{className:`personal-system-health-header`,children:[(0,H.jsx)(am,{size:15}),(0,H.jsx)(`strong`,{children:a(`home.systemHealth`,{summary:r.summary})}),r.freshnessWarning?(0,H.jsxs)(`small`,{children:[`(`,r.freshnessWarning,`)`]}):null]}),r.issues.length>0?(0,H.jsx)(`ul`,{className:`personal-system-health-issues`,children:r.issues.map((e,t)=>(0,H.jsx)(`li`,{children:e},t))}):null]}):null,o.some(e=>e.loadState)?(0,H.jsxs)(`section`,{className:`personal-home-lane`,"aria-live":`polite`,children:[(0,H.jsx)(`header`,{children:a(`startup.progress`,{loaded:o.filter(e=>!e.loadState).length,total:o.length})}),s?(0,H.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`status`,children:[(0,H.jsx)(`span`,{children:a(`startup.failedCount`,{count:s})}),(0,H.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,onClick:n,type:`button`,children:a(`startup.retryFailed`)})]}):null,o.filter(e=>e.loadState).map(f)]}):null,(0,H.jsx)(`div`,{className:`personal-home-lanes`,children:c.map(e=>(0,H.jsxs)(`section`,{className:`personal-home-lane is-${e.key}`,"data-testid":`personal-home-lane-${e.key}`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`i`,{}),e.label]}),(0,H.jsx)(`b`,{children:l[e.key].length})]}),(0,H.jsx)(`div`,{className:`personal-home-lane-list`,children:l[e.key].length?l[e.key].map(f):(0,H.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.empty`)})})]},e.key))}),(0,H.jsxs)(`details`,{className:`personal-home-history`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{children:a(`home.history`)}),(0,H.jsx)(`b`,{children:u.length}),(0,H.jsx)(`small`,{children:a(`home.completedGoals`)})]}),(0,H.jsx)(`div`,{children:u.length?u.map(f):(0,H.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.noCompletedGoals`)})})]}),d.length?(0,H.jsxs)(`details`,{className:`personal-home-history is-stopped`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{children:a(`home.stopped`)}),(0,H.jsx)(`b`,{children:d.length}),(0,H.jsx)(`small`,{children:a(`home.preservedState`)})]}),(0,H.jsx)(`div`,{children:d.map(f)})]}):null]})}function Cx({items:e,onSelect:t,reportState:n}){let{locale:r,t:i}=qi();return(0,H.jsxs)(`section`,{className:`personal-object-list personal-files-list`,"data-testid":`personal-goal-outputs`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:i(`files.title`)}),(0,H.jsx)(`span`,{children:e.length})]}),n?.loading?(0,H.jsxs)(`p`,{className:`personal-object-list-state`,role:`status`,children:[(0,H.jsx)(Lm,{className:`is-spinning`,size:14}),i(`files.loadingReports`)]}):null,n?.error?(0,H.jsxs)(`p`,{className:`personal-object-list-state is-error`,role:`alert`,children:[(0,H.jsx)(am,{size:14}),i(`files.reportLoadFailed`),`: `,n.error]}):null,!n?.loading&&!n?.error&&e.length===0?(0,H.jsxs)(`p`,{className:`personal-object-list-state`,children:[(0,H.jsx)(_m,{size:14}),i(`files.empty`)]}):null,e.map(e=>(0,H.jsxs)(`button`,{"data-output-kind":e.output.kind,onClick:()=>t({item:e.output,kind:`output`}),type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-file-icon`,children:(0,H.jsx)(_m,{size:16})}),(0,H.jsx)(`strong`,{children:e.output.title}),e.output.report?(0,H.jsx)(`em`,{children:i(`files.reportDelta`,{added:e.output.report.addedCount,changed:e.output.report.changedCount})}):null,(0,H.jsx)(`p`,{children:e.output.summary??e.output.safePreview??e.output.kind??i(`files.emptySummary`)}),(0,H.jsx)(`small`,{title:e.output.createdAt,children:[e.output.goalTitle,e.output.kind===`report`?i(`files.verifiedReport`):null,e.output.todoId?`${i(`common.task`)} ${e.output.todoId}`:null,xx(e.output.createdAt,r,i)].filter(Boolean).join(` · `)})]},e.id))]})}function wx({agentLabel:e,messages:t,onClose:n,onDraftTask:r,onOpenConversation:i,title:a}){let{t:o}=qi(),s=t.reduce((e,t,n)=>t.role===`user`?n:e,0),c=t.slice(Math.max(0,s)).slice(-3),l=c.filter(e=>e.role===`assistant`&&!e.pending).at(-1);return(0,V.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,H.jsxs)(`aside`,{"aria-label":o(`conversation.receipt`),className:`personal-manager-conversation-tray`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:16}),(0,H.jsx)(`strong`,{children:a??o(`conversation.title`)}),(0,H.jsx)(`small`,{children:t.at(-1)?.pending?o(`conversation.replying`):o(`common.recently`)})]}),(0,H.jsxs)(`div`,{className:`personal-manager-conversation-actions`,children:[r&&l?(0,H.jsxs)(`button`,{className:`personal-manager-conversation-btn`,onClick:()=>r(l.text),title:o(`conversation.convertHint`),type:`button`,children:[(0,H.jsx)(Cm,{size:13}),(0,H.jsx)(`span`,{children:o(`conversation.toTask`)})]}):null,(0,H.jsx)(`button`,{className:`personal-manager-conversation-link`,onClick:i,type:`button`,children:o(`conversation.full`)}),n?(0,H.jsx)(`button`,{"aria-label":o(`conversation.close`),className:`personal-manager-conversation-close`,onClick:n,title:o(`conversation.close`),type:`button`,children:(0,H.jsx)(eh,{size:14})}):null]})]}),(0,H.jsx)(`div`,{"aria-live":`polite`,className:`personal-manager-conversation-messages`,children:c.map(t=>(0,H.jsxs)(`article`,{className:`is-${t.role}`,children:[(0,H.jsx)(`strong`,{children:t.role===`user`?o(`common.you`):t.agentLabel??e??o(`header.manager`)}),(0,H.jsxs)(`div`,{className:`personal-manager-conversation-bubble`,children:[t.role===`user`?(0,H.jsx)(`p`,{children:t.text}):(0,H.jsx)(Fy,{text:t.text}),t.pending?(0,H.jsx)(`small`,{children:o(`conversation.agentPending`)}):null]})]},t.id))})]})}function Tx({onClose:e,onOpenDetails:t,run:n}){let{t:r}=qi();return(0,H.jsxs)(`section`,{"aria-label":r(`session.record`),className:`personal-session-record`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:17}),r(`session.record`)]}),(0,H.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,H.jsx)(eh,{size:15})})]}),(0,H.jsx)(`div`,{children:(0,H.jsx)(`strong`,{children:n.title})}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Agent`}),(0,H.jsx)(`dd`,{children:n.agentLabel})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`common.status`)}),(0,H.jsx)(`dd`,{children:Yi(n.sessionStatus??n.status,r)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Session`}),(0,H.jsx)(`dd`,{title:n.sessionId,children:n.sessionId})]})]}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:t,type:`button`,children:r(`session.details`)})]})}function Ex(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??yy(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>by(e)===`running`).slice(0,4).forEach(e=>r.push({id:`run:${e.goalId}`,kind:`run`,run:{agentId:e.agentId,agentLabel:e.agentLabel??e.agentId,completedSteps:e.doneTodoCount??e.agentTodos.filter(e=>e.done).length,goalId:e.goalId,goalTitle:e.title,latestActivity:e.agentSentence,runId:`goal:${e.goalId}`,status:`running`,title:e.nextSentence,totalSteps:Math.max((e.doneTodoCount??0)+e.agentTodos.filter(e=>!e.done).length,1)}})),r;let i=e.goals.find(e=>e.goalId===t);if(!i)return r;if(i.needsYou){let t=e.userTodos.find(e=>e.goalId===i.goalId);r.push({attention:t?{...t,goalTitle:i.title}:{blocking:i.needsYouBlocking??!1,goalId:i.goalId,goalTitle:i.title,text:i.needsYou,todoId:`${i.goalId}:attention`},id:`attention:${i.goalId}`,kind:`attention`})}r.push({id:`run:${i.goalId}`,kind:`run`,run:{agentId:i.agentId,agentLabel:i.agentLabel??i.agentId,completedSteps:i.doneTodoCount??i.agentTodos.filter(e=>e.done).length,goalId:i.goalId,goalTitle:i.title,latestActivity:i.agentSentence,runId:`goal:${i.goalId}`,status:i.state===`推进中`?`running`:i.state===`需修复`?`failed`:`waiting`,title:i.nextSentence,totalSteps:Math.max((i.doneTodoCount??0)+i.agentTodos.filter(e=>!e.done).length,1)}}),i.agentTodos.filter(e=>e.taskClass===`continuous_monitor`).forEach(t=>{let a=e.timeline?.find(e=>e.kind===`run`&&e.run.goalId===i.goalId&&e.run.todoId===t.todoId&&!!e.run.sessionId);r.push({id:`schedule:${i.goalId}:${t.todoId}`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:a?[{label:a.run.latestActivity||a.run.title,runId:a.run.runId,status:a.run.status===`waiting`||a.run.status===`queued`?`running`:a.run.status,timestamp:i.latestActivity||n(`common.recently`)}]:[],goalId:i.goalId,label:t.text,schedule:t.evidence??n(`schedule.summary`),scheduleId:t.todoId,scheduleKind:`monitor`,sessionId:a?.run.sessionId,status:t.done||t.status===`paused`?`paused`:`active`,stopCondition:n(`drawer.scheduleDefaultStop`),target:t.text,timezone:`Asia/Shanghai`}})});let a=e.timeline?.find(e=>e.kind===`proposal`&&e.proposal.actionKind===`heartbeat.bind`&&e.proposal.goalId===i.goalId);if(a){let e=e=>a.proposal.fields.find(t=>t.key===e)?.value;r.push({id:`schedule:${i.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:[],goalId:i.goalId,label:`${n(`schedule.heartbeat`)} · ${i.title}`,nextRunAt:n(`drawer.schedulePending`),notificationRule:n(`drawer.scheduleDefaultNotification`),schedule:e(`cadence`)??n(`schedule.summary`),scheduleId:`${i.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:a.proposal.status===`applied`?`active`:`draft`,stopCondition:e(`stop_condition`)??n(`drawer.scheduleDefaultStop`),timezone:e(`timezone`)??`Asia/Shanghai`}})}return r}function Dx(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function Ox(e,t){let n={agent_id:t(`proposal.field.agentId`),cadence:t(`proposal.field.cadence`),completion_criteria:t(`proposal.field.completionCriteria`),execution_boundary:t(`proposal.field.executionBoundary`),goal_id:t(`proposal.field.goalId`),heartbeat:t(`proposal.field.heartbeat`),initial_todos:t(`proposal.field.initialTodos`),objective:t(`proposal.field.objective`),operation:t(`proposal.field.operation`),permission:t(`proposal.field.permission`),reason:t(`proposal.field.reason`),stop_condition:t(`proposal.field.stopCondition`),target:t(`proposal.field.target`),timezone:t(`proposal.field.timezone`),title:t(`proposal.field.title`),workspace_ref:t(`proposal.field.workspace`)},r=[`title`,`objective`,`completion_criteria`,`execution_boundary`,`permission`,`agent_id`,`workspace_ref`,`initial_todos`,`heartbeat`,`stop_condition`,`goal_id`];return Object.entries(e).sort(([e],[t])=>{let n=r.indexOf(e),i=r.indexOf(t);return(n<0?r.length:n)-(i<0?r.length:i)}).slice(0,10).map(([e,r])=>({key:e,label:n[e]??e.replaceAll(`_`,` `),value:e===`workspace_ref`?r===`current`?t(`proposal.workspace.current`):t(`proposal.workspace.named`,{workspace:String(r??`current`)}):Array.isArray(r)?r.join(` · `):typeof r==`object`&&r?JSON.stringify(r):String(r??`—`)}))}function kx(e,t,n){let r=t.operationFrame,i=r?.content.fields.map((e,t)=>({key:`projection:${t}`,label:e.label,value:e.value})).slice(0,8)??[];return[{key:`operation_state`,label:n(`proposal.field.operationState`),value:r?.lifecycleState??e.status},...r?.kind===`result`?[{key:`result_delivery`,label:n(`proposal.field.resultDelivery`),value:r.resultDeliveryVerified?n(`proposal.resultDelivery.verified`):n(`proposal.resultDelivery.pending`)}]:[],...i,...r?[{key:`warning`,label:n(`proposal.field.confirmationBoundary`),value:r.content.warning}]:[],...r?[{key:`expires_at`,label:n(`proposal.field.expiresAt`),value:r.expiresAt}]:[]].slice(0,10)}function Ax(e){if(e.action_kind!==`goal.lifecycle`)return;let t=e.normalized_parameters.operation;return t===`stop`||t===`resume`||t===`delete`?t:void 0}function jx(e,t){let n=Ax(e),r=gy(e),i=typeof e.normalized_parameters.title==`string`?e.normalized_parameters.title:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:``,a=typeof e.normalized_parameters.target==`string`?e.normalized_parameters.target:``,o=r.operationFrame,s=o?.content.title??e.summary,c=e.action_kind===`operation.execute`?s:e.action_kind===`goal.create`?t(`proposal.summary.goalCreate`,{title:i}):e.action_kind===`heartbeat.bind`?t(`proposal.summary.heartbeat`):e.action_kind===`monitor.create`?t(`proposal.summary.monitor`,{target:a}):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.summary.lifecycleStop`,{title:i}):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.summary.lifecycleDelete`,{title:i}):e.action_kind===`goal.lifecycle`?t(`proposal.summary.lifecycleResume`,{title:i}):e.summary;return{actionKind:e.action_kind,reviewPlan:r,fields:e.action_kind===`operation.execute`?kx(e,r,t):Ox(e.normalized_parameters,t),goalId:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:void 0,impact:e.action_kind===`operation.execute`?t(`proposal.impact.operation`):e.action_kind===`goal.create`?t(`proposal.impact.goalCreate`):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.impact.lifecycleStop`):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.impact.lifecycleDelete`):e.action_kind===`goal.lifecycle`?t(`proposal.impact.lifecycleResume`):e.permission_classification===`protected`?t(`proposal.impact.protected`):t(`proposal.impact.default`),previewId:e.proposal_id,lifecycleOperation:n,gate:e.gate?{kind:String(e.gate.kind??`protected_action`),nextAction:typeof e.gate.next_action==`string`?e.gate.next_action:void 0,summary:String(e.gate.summary??t(`proposal.gate.default`))}:void 0,primaryLabel:e.action_kind===`operation.execute`?o?.kind===`result`?o.resultDeliveryVerified?t(`proposal.primary.operationResultVerified`):t(`proposal.primary.operationResultPending`):t(`proposal.primary.operationGroup`):e.action_kind===`goal.create`?t(`proposal.primary.goalCreate`):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.primary.lifecycleStop`):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.primary.lifecycleDelete`):e.action_kind===`goal.lifecycle`?t(`proposal.primary.lifecycleResume`):e.action_kind===`todo.create`&&e.normalized_parameters.start_execution===!0?t(`proposal.primary.todoStart`):t(`proposal.primary.apply`),status:e.status===`applied`&&e.action_kind!==`operation.execute`&&r.interaction!==`completed`?`error`:Dx(e.status),title:c}}function Mx(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,42);if(t)return t;let n=2166136261;for(let t of e)n^=t.codePointAt(0)??0,n=Math.imul(n,16777619);return`goal-${(n>>>0).toString(36)}`}function Nx(e,t){let n=e.match(/[「“"]([^」”"]{2,80})[」”"]/u)?.[1];return n?n.trim():e.replace(/^(请|帮我|我想|给我|创建|新建|设置|please|i want to|create|set up)+/iu,``).replace(/(一个|新的)?\s*(goal|目标)/giu,``).replace(/[,。!?].*$/u,``).trim().slice(0,80)||t(`goal.defaultTitle`)}function Px(e,t){for(let n of e.split(/\r?\n/u)){let e=n.trim();for(let n of t){let t=e.match(RegExp(`^${n.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}\\s*[::]\\s*(.*)$`,`iu`));if(t?.[1]?.trim())return t[1].trim()}}return``}function Fx(e,t){let n=Px(e,[`目标`,`Objective`]),r=Px(e,[`完成标准`,`Completion criteria`]),i=Px(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||Nx(e,t)).split(/[。;;\n]/u)[0].trim().slice(0,80)||t(`goal.defaultTitle`),o=[n||a,r?t(`goal.objectiveCompletion`,{criteria:r}):``,i?t(`goal.objectiveBoundary`,{boundary:i}):``].filter(Boolean).join(` -`),s=/(只读|不调用外部工具|不修改(?:仓库|代码|状态)|read.?only|do not (?:call|use) external tools|do not modify (?:repositories|repository|code|state))/iu.test(i||e);return{completionCriteria:r,executionBoundary:i,initialTodos:r?[t(`goal.initialTodo`,{criteria:r})]:[],objective:o,permission:s?`read_only`:`workspace_write_on_confirmation`,title:a}}function Ix(e){let t=e.match(/(?:每|every)\s*(\d{1,3})\s*(?:分钟|minutes?)/iu)?.[1];if(t)return`${t}m`;let n=e.match(/(?:每|every)\s*(\d{1,2})\s*(?:小时|hours?)/iu)?.[1];return n?`${n}h`:/每小时|every hour|hourly/iu.test(e)?`1h`:(/每天|每日|早上|上午|daily|every day/iu.test(e),`1d`)}function Lx(e,t){return/(每周|星期|周[一二三四五六日天]|weekly|every\s+(?:mon|tues|wednes|thurs|fri|satur|sun)day|\d{1,2}\s*[::]\s*\d{2})/iu.test(e)?t(`schedule.unsupportedCalendar`):null}function Rx(e,t){return Px(e,[`检查内容`,`监控内容`,`目标`,`Check target`,`Monitor target`,`Target`])||e.replace(/^(?:为当前 Goal |for the current Goal )?(?:添加|配置|创建|add|configure|create)?\s*(?:定时检查|监控|scheduled check|monitor)[::]?/iu,``).split(/\r?\n/u)[0].trim()||t(`schedule.defaultTarget`)}function zx(e){return/(mr|pr).{0,8}(合并|merge)/iu.test(e)?`pr_merged`:/发布完成|上线完成|release (?:is )?complete|deployment (?:is )?complete/iu.test(e)?`release_complete`:`goal_complete`}function Bx(e,t){let n=e.toLowerCase();return t.find(e=>n.includes(e.agentId.toLowerCase())||n.includes(e.label.toLowerCase()))}function Vx(e){let t=Px(e,[`标题`,`任务标题`,`Todo 标题`]),n=Px(e,[`内容`,`任务内容`,`Todo 内容`]);if(t)return[t,n].filter(Boolean).join(`:`).slice(0,400);let r=e.match(/[「“"]([^」”"]{2,200})[」”"]/u)?.[1];return r?r.trim():e.replace(/^(请|帮我|给我|为当前 Goal |新增|新建|创建|添加|加上|加一个|记一个)+/u,``).replace(/^(一个\s*)?(普通\s*)?(todo|待办|任务)(?:\s*到\s*Tasks?)?[::\s]*/iu,``).replace(/[。;;,,]\s*(?:不要|不需要|无需|禁止|别|暂不).{0,80}(?:heartbeat|心跳|定时|监控|执行).*$/iu,``).replace(/[,,]\s*(并且|然后|再)?\s*(交给|分配给|让).+$/u,``).replace(/\s*(交给|分配给|让)\s+.+$/u,``).trim().slice(0,400)||`推进当前 Goal 的下一项工作`}var Hx=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),Ux=5242880,Wx=4;function Gx(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onerror=()=>r(Error(t(`composer.imageReadError`,{name:e.name}))),i.onload=()=>n({dataUrl:String(i.result??``),id:crypto.randomUUID(),mimeType:e.type,name:e.name,size:e.size}),i.readAsDataURL(e)})}function Kx({agents:e=[{agentId:`codex`,available:!0,capability:`代码与项目执行`,label:`Codex`}],callbacks:t={},goalArchiveLoadState:n={error:null,phase:`ready`},managerRuntime:r,model:i,readOnly:a=!1,selectedAgentId:o,selectedGoalId:s,statusSourceControl:c}){let{locale:l,t:u}=qi(),[d,f]=(0,V.useState)(s??null),[p,m]=(0,V.useState)(o??e.find(e=>e.available)?.agentId??`codex`),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(null),[x,S]=(0,V.useState)({}),[C,w]=(0,V.useState)(`chat`),[T,E]=(0,V.useState)(!1),[D,O]=(0,V.useState)(!1),[k,ee]=(0,V.useState)(!1),[te,A]=(0,V.useState)(()=>{try{let e=window.sessionStorage.getItem(`loopx-pw-composer-drafts`),t=e?JSON.parse(e):{};return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}),[j,M]=(0,V.useState)(!1),[N,P]=(0,V.useState)([]),[F,ne]=(0,V.useState)(null),[re,I]=(0,V.useState)(null),[L,ie]=(0,V.useState)(()=>new Set),[R,ae]=(0,V.useState)(()=>new Set),[oe,se]=(0,V.useState)(`idle`),[ce,le]=(0,V.useState)([]),[ue,z]=(0,V.useState)(!1),[de,fe]=(0,V.useState)(gx),[pe,me]=(0,V.useState)({}),[he,ge]=(0,V.useState)([]),_e=(0,V.useRef)(!1),ve=(0,V.useRef)(NaN),ye=(0,V.useRef)(null),be=(0,V.useRef)(null),xe=(0,V.useRef)(null),Se=(0,V.useRef)(new Set),Ce=(0,V.useRef)(new Set),[we,Te]=(0,V.useState)(null),B=s===void 0?d:s,Ee=o??p,De=`${B??`manager`}:${Ee}`,Oe=te[De]??``;(0,V.useEffect)(()=>{P([]),ne(null)},[De]);function ke(e,t){A(n=>{let r={...n};t?r[e]=t:delete r[e];try{window.sessionStorage.setItem(`loopx-pw-composer-drafts`,JSON.stringify(r))}catch{}return r})}function Ae(e){ke(De,e)}function je(e){let t=te[De]?.trimEnd();Ae(t?`${t}\n${e}`:e),window.requestAnimationFrame(()=>ye.current?.focus())}(0,V.useEffect)(()=>{let e=ye.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[Oe]);let Me=(0,V.useMemo)(()=>i.goals.map(e=>{let t=pe[e.goalId];return t?{...e,repository:{branch:t.branch,identity:t.identity,label:t.label,readOnly:!0}}:e}),[pe,i.goals]),Ne=(0,V.useMemo)(()=>Me.filter(e=>by(e)===`needs_you`).length,[Me]),Pe=(0,V.useMemo)(()=>Me.filter(e=>by(e)===`needs_you`&&(e.needsYouBlocking||e.state===`等你`)).length,[Me]),Fe=Me.find(e=>e.goalId===B)??null,Ie=h?.kind===`settings`,Le=B,Re=(0,V.useMemo)(()=>{let e=Object.values(x).filter(e=>e.actionKind===`heartbeat.bind`&&e.goalId&&e.status===`applied`).map(e=>({id:`schedule:${e.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:Ee,executionHistory:[],goalId:e.goalId,label:e.title,nextRunAt:u(`drawer.schedulePending`),notificationRule:u(`drawer.scheduleDefaultNotification`),schedule:e.fields.find(e=>e.key===`cadence`)?.value??u(`schedule.summary`),scheduleId:`${e.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:e.status===`applied`?`active`:`draft`,stopCondition:e.fields.find(e=>e.key===`stop_condition`)?.value??u(`drawer.scheduleDefaultStop`),timezone:e.fields.find(e=>e.key===`timezone`)?.value??`Asia/Shanghai`}})),t=[...Ex(i,Le,u),...i.timeline??[],...e,...bx(Object.values(x)).filter(e=>e.actionKind!==`heartbeat.bind`||e.status!==`applied`).map(e=>({id:`proposal:${e.previewId}`,kind:`proposal`,proposal:e}))];return[...new Map(t.map(e=>[e.id,e])).values()].filter(e=>e.kind!==`proposal`||![`stale`,`error`].includes(e.proposal.status)||ce.includes(e.proposal.previewId)).filter(e=>!B||e.kind===`message`?!0:e.kind===`proposal`?!e.proposal.goalId||e.proposal.goalId===B:e.kind===`attention`?e.attention.goalId===B:e.kind===`run`?e.run.goalId===B:e.kind===`schedule`?e.schedule.goalId===B:e.output.goalId===B)},[Le,i,x,Ee,B,ce,u]),ze=(0,V.useMemo)(()=>y?Re.filter(e=>e.kind===`message`?!0:e.kind===`run`?e.run.runId===y.runId:e.kind===`output`&&e.output.runId===y.runId):Re,[y,Re]);(0,V.useEffect)(()=>{if(!y)return;let e=Re.find(e=>e.kind===`run`&&e.run.runId===y.runId);!e||e.kind!==`run`||JSON.stringify({completedSteps:y.completedSteps,latestActivity:y.latestActivity,messages:y.sessionMessages,sessionStatus:y.sessionStatus,status:y.status,totalSteps:y.totalSteps})!==JSON.stringify({completedSteps:e.run.completedSteps,latestActivity:e.run.latestActivity,messages:e.run.sessionMessages,sessionStatus:e.run.sessionStatus,status:e.run.status,totalSteps:e.run.totalSteps})&&b(e.run)},[y,Re]);let Be=(0,V.useMemo)(()=>Re.flatMap(e=>e.kind===`message`?[e.message]:[]),[Re]),Ve=(0,V.useMemo)(()=>Fe?Re.flatMap(e=>e.kind===`message`?[e.message]:[]):[],[Re,Fe]);(0,V.useEffect)(()=>{Fe||T||Be.some(e=>e.pending)&&O(!0)},[T,Be,Fe]),(0,V.useEffect)(()=>{!Fe||C===`chat`||Ve.some(e=>e.pending)&&ee(!0)},[Ve,Fe,C]);let He=(0,V.useMemo)(()=>Re.filter(e=>e.kind===`message`||e.kind===`proposal`&&ce.includes(e.proposal.previewId)),[Re,ce]),Ue=He[He.length-1],We=Ue?.kind===`message`?Ue.message.text.length:0;(0,V.useEffect)(()=>{if(!T||!be.current)return;let e=window.requestAnimationFrame(()=>{be.current&&(be.current.scrollTop=be.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[He.length,T,We]);let Ge=(0,V.useMemo)(()=>{if(h?.kind===`settings`)return null;if(h?.kind===`attention`)return{kind:`attention`,item:Gd(h.item,i.attentionHistory??i.userTodos)};if(h?.kind===`goal`){let e=Me.find(e=>e.goalId===h.item.goalId);return e?{item:e,kind:`goal`}:h}if(h?.kind!==`run`)return h;let e=Re.find(e=>e.kind===`run`&&e.run.runId===h.item.runId);return e?{item:e.run,kind:`run`}:h},[Re,h,Me,i.attentionHistory,i.userTodos]);(0,V.useEffect)(()=>{if(a){me({}),ge([]);return}let e=!1;return Promise.all([Lg(),Jg()]).then(([t,n])=>{e||(me(Object.fromEntries(t.map(e=>[e.goal_id,e.repository]))),ge(n))}).catch(()=>{}),()=>{e=!0}},[a]),(0,V.useEffect)(()=>{if(!ue)return;function e(e){e.key===`Escape`&&z(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[ue]),(0,V.useEffect)(()=>{if(B||!Re.length)return;if(!_e.current){_e.current=!0;try{ve.current=Date.parse(window.localStorage.getItem(`loopx-pw-last-visit`)??``),window.localStorage.setItem(`loopx-pw-last-visit`,new Date().toISOString())}catch{ve.current=NaN}}let e=ve.current,t=Re.filter(e=>e.kind===`run`).map(e=>e.run),n=t=>{let n=Date.parse(t??``);return!Number.isNaN(e)&&!Number.isNaN(n)&&n>e},r={attention:Ne,done:t.filter(e=>e.status===`completed`&&n(e.latestActivity)).length,failed:t.filter(e=>(e.status===`failed`||e.status===`interrupted`)&&n(e.latestActivity)).length};Te(e=>e?.attention===r.attention&&e.done===r.done&&e.failed===r.failed?e:r)},[Re,Ne,B]),(0,V.useEffect)(()=>{if(a){S({});return}let e=!1;return Nh(B?{goalId:B}:{contextKind:`manager`}).then(t=>{if(e)return;let n=Object.fromEntries(t.filter(e=>[`preview_ready`,`gated`,`deferred`,`applying`].includes(e.status)||e.action_kind===`operation.execute`&&e.status===`applied`).map(e=>{let t=jx(e,u);return[t.previewId,t]}));S(e=>({...e,...n}))}).catch(()=>{}),()=>{e=!0}},[a,B,u]);async function Ke(e,n={}){if(a)throw Error(u(`source.readOnlyWriteError`));let r;try{r=t.onPreviewAction?await t.onPreviewAction(e):jx(await jh(e),u)}catch(t){if(!(t instanceof Eh)||t.payload.error_code!==`action_preview_gate`)throw t;let n=t.payload.gate&&typeof t.payload.gate==`object`?t.payload.gate:{},i=(Array.isArray(n.candidates)?n.candidates:[]).flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.workspace_ref==`string`&&typeof t.label==`string`?[{label:t.label,workspaceRef:t.workspace_ref}]:[]}),a=String(n.kind??`workspace_selection_required`),o=a===`agent_binding_required`||a===`agent_identity_selection_required`;r={actionKind:e.actionKind,fields:i.map(e=>({key:`workspace_ref:${e.workspaceRef}`,label:e.label,value:e.workspaceRef})),gate:{kind:a,nextAction:typeof n.next_action==`string`?n.next_action:void 0,summary:String(n.summary??u(`proposal.workspaceGate.defaultSummary`))},impact:u(o?`proposal.workspaceGate.agentImpact`:`proposal.workspaceGate.selectionImpact`),previewId:`workspace-choice-${Date.now().toString(36)}`,sourceRequest:e,status:`gated`,title:u(o?`proposal.workspaceGate.agentTitle`:`proposal.workspaceGate.selectionTitle`),workspaceCandidates:i}}return le(e=>e.includes(r.previewId)?e:[...e,r.previewId]),S(e=>({...e,[r.previewId]:r})),n.select!==!1&&g({item:r,kind:`proposal`}),r}function qe(){tt(null),ke(`manager:${Ee}`,u(`composer.createGoalTemplate`)),window.requestAnimationFrame(()=>ye.current?.focus())}async function Je(e,n){z(!1);let r={delete:`Deleted from the owner workspace`,resume:`Resumed from the owner workspace`,stop:`Stopped from the owner workspace`},i={delete:u(`proposal.summary.lifecycleDelete`,{title:e.title}),resume:u(`proposal.summary.lifecycleResume`,{title:e.title}),stop:u(`proposal.summary.lifecycleStop`,{title:e.title})},a=null,o=!1;try{if(n===`stop`){if(Se.current.has(e.goalId))return;Se.current.add(e.goalId),ie(new Set(Se.current)),g(null),a={goalId:e.goalId,next:`stopped`,optimisticApplied:!0,previous:e.activationState},I(u(`feedback.applying`,{title:i.stop})),t.onGoalActivationStateChange?.(e.goalId,`stopped`)}if(t.onExecuteGoalLifecycle){if(n===`delete`)throw Error(`The selected status source does not authorize Goal deletion.`);let a=await t.onExecuteGoalLifecycle({goalId:e.goalId,operation:n,reason:r[n]});if(!a.projectionVerified)throw Error(`Goal lifecycle projection did not verify.`);o=!0,t.onGoalActivationStateChange?.(e.goalId,a.activationState),I(u(`feedback.completed`,{title:i[n]})),n===`stop`&&tt(null),await(t.onReconcileStatus??t.onRefresh)?.();return}let s=await Ke({actionKind:`goal.lifecycle`,context:{kind:`goal_directory`,goal_id:e.goalId},idempotencyKey:`workspace-goal-${n}-${e.goalId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:n,reason:r[n]},summary:i[n]},{select:n!==`stop`});if(s.goalId!==e.goalId||s.lifecycleOperation!==n)throw g(null),Error(u(`actionReview.targetChanged`));n===`stop`&&(s.reviewPlan?.interaction===`direct`?(o=!0,await Qe(s,{lifecycleProjection:a??void 0,presentation:`feedback`})):(a&&t.onGoalActivationStateChange?.(a.goalId,a.previous),I(s.gate?u(`feedback.gateRequired`,{summary:s.gate.summary}):u(`feedback.notCompleted`,{status:s.status})),g({item:s,kind:`proposal`})))}catch(e){a&&!o&&t.onGoalActivationStateChange?.(a.goalId,a.previous),I(u(`feedback.executionFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{n===`stop`&&(Se.current.delete(e.goalId),ie(new Set(Se.current)))}}function Ye(e,t){Ae(u(t?e===`heartbeat`?`composer.heartbeatTemplate`:`composer.monitorTemplate`:e===`heartbeat`?`composer.heartbeatTemplateWithoutGoal`:`composer.monitorTemplateWithoutGoal`)),g(null),window.requestAnimationFrame(()=>ye.current?.focus())}async function Xe(e,n,r=``){let i=await t.onRequestScheduleConfig?.(e,n);if(i){le(e=>e.includes(i.previewId)?e:[...e,i.previewId]),S(e=>({...e,[i.previewId]:i})),g({item:i,kind:`proposal`});return}if(!n){Ae(u(e===`heartbeat`?`composer.heartbeatGoalQuestion`:`composer.monitorGoalQuestion`));return}let a=Date.now().toString(36);await Ke({actionKind:e===`heartbeat`?`heartbeat.bind`:`monitor.create`,context:{kind:`schedule`,goal_id:n},idempotencyKey:`workspace-${e}-${n}-${a}`,normalizedParameters:e===`heartbeat`?{agent_id:Ee,cadence:Ix(r),goal_id:n,stop_condition:zx(r),timezone:`Asia/Shanghai`}:{agent_id:Ee,cadence:Ix(r),goal_id:n,stop_condition:zx(r),target:Rx(r,u),target_key:`goal-${n}`,timezone:`Asia/Shanghai`},summary:e===`heartbeat`?u(`proposal.summary.heartbeat`):u(`proposal.summary.monitor`,{target:Rx(r,u)})})}async function Ze(e){if(!Ce.current.has(e.todoId)){Ce.current.add(e.todoId),ae(new Set(Ce.current)),I(u(`feedback.preparingPreview`,{title:e.text}));try{await Ke({actionKind:`todo.update`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-${e.todoId}-complete-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:`complete`,todo_id:e.todoId},summary:u(`tasks.markComplete`,{name:e.text})}),I(null)}catch(e){I(u(`feedback.previewFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{Ce.current.delete(e.todoId),ae(new Set(Ce.current))}}}async function Qe(e,n={}){if(e.reviewPlan&&!e.reviewPlan.canApply)return;let r=n.presentation!==`feedback`,a=e.actionKind===`goal.lifecycle`&&e.goalId&&(e.lifecycleOperation===`stop`||e.lifecycleOperation===`resume`)?{goalId:e.goalId,next:e.lifecycleOperation===`stop`?`stopped`:`active`,optimisticApplied:!1,previous:i.goals.find(t=>t.goalId===e.goalId)?.activationState??(e.lifecycleOperation===`stop`?`active`:`stopped`)}:null,o=n.lifecycleProjection??a;I(u(`feedback.applying`,{title:e.title}));let s={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`pending`,reason:`apply_pending`,canApply:!1}:void 0,status:`applying`};S(t=>({...t,[e.previewId]:s})),r&&g({item:s,kind:`proposal`}),o&&!o.optimisticApplied&&t.onGoalActivationStateChange?.(o.goalId,o.next);try{if(t.onApplyProposal){await t.onApplyProposal(e);let n={...e,status:`applied`};if(S(t=>({...t,[e.previewId]:n})),r&&g({item:n,kind:`proposal`}),I(u(`feedback.completed`,{title:e.title})),e.actionKind===`goal.lifecycle`){(e.lifecycleOperation===`stop`||e.lifecycleOperation===`delete`)&&tt(null),e.lifecycleOperation===`delete`&&e.goalId&&t.onGoalDeleted?.(e.goalId);let n=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>n?.()).catch(()=>void 0)}return}let n=await Ph(e.previewId);if(n.proposal.proposal_id!==e.previewId||n.proposal.action_kind!==e.actionKind||e.actionKind===`goal.lifecycle`&&(n.proposal.normalized_parameters.goal_id!==e.goalId||Ax(n.proposal)!==e.lifecycleOperation))throw new Eh(u(`actionReview.targetChanged`),{error_code:`action_response_mismatch`});let i=jx(n.proposal,u);if(S(t=>({...t,[e.previewId]:i})),r&&g({item:i,kind:`proposal`}),i.reviewPlan?.interaction!==`completed`){o&&t.onGoalActivationStateChange?.(o.goalId,o.previous),g({item:i,kind:`proposal`}),I(n.proposal.status===`stale`?u(`feedback.stale`):u(`actionReview.${i.reviewPlan.reason}`));return}if(I(u(`feedback.completed`,{title:i.title})),i.actionKind===`todo.create`&&await t.onRefresh?.(),i.actionKind===`goal.lifecycle`&&(i.lifecycleOperation===`stop`||i.lifecycleOperation===`delete`)&&tt(null),i.actionKind===`goal.lifecycle`&&i.lifecycleOperation===`delete`&&i.goalId&&t.onGoalDeleted?.(i.goalId),i.actionKind===`goal.lifecycle`){let e=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>e?.()).catch(()=>void 0)}}catch(n){if(o&&t.onGoalActivationStateChange?.(o.goalId,o.previous),n instanceof Eh&&n.payload.error_code===`protected_action`){let r=n.payload.gate,i=r&&typeof r==`object`?r:{},a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`gated`,reason:`authority_gate`,canApply:!1}:void 0,gate:{kind:String(i.kind??`protected_action`),nextAction:typeof i.next_action==`string`?i.next_action:void 0,summary:String(i.summary??n.message)},status:`gated`};S(t=>({...t,[e.previewId]:a})),g({item:a,kind:`proposal`}),I(u(`feedback.gateRequired`,{summary:a.gate.summary})),e.actionKind===`goal.create`&&e.goalId&&(t.onRefresh?.(),tt(e.goalId));return}let r=n instanceof Eh&&_y(n.payload),i=n instanceof Eh&&n.payload.error_code===`action_response_mismatch`,a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:r?`refresh`:`repair`,reason:i?`readback_unverified`:r?`stale_proposal`:`apply_failed`,canApply:!1}:void 0,errorMessage:n instanceof Error?n.message:String(n),status:r?`stale`:`error`};S(t=>({...t,[e.previewId]:a})),g({item:a,kind:`proposal`}),I(u(`feedback.executionFailed`,{error:a.errorMessage}))}}let $e={...t,onOpenRunSession:async e=>{e.goalId!==B&&tt(e.goalId),w(`chat`),await t.onOpenRunSession?.(e),b(e),g(null)},onOpenGoal:e=>{tt(e);let n=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>n?.()).catch(()=>{I(u(`feedback.goalRefreshFailed`))})},onOpenGoalView:e=>{w(e),e===`chat`&&b(null),g(null)},onOpenOutput:e=>{e.goalId!==B&&tt(e.goalId),w(`files`),t.onOpenOutput?.(e)},onApplyProposal:Qe,onCancelProposal:async e=>{g(null),S(t=>{let n={...t};return delete n[e.previewId],n});try{t.onCancelProposal?.(e),t.onCancelProposal||await Fh(e.previewId)}catch(t){S(t=>({...t,[e.previewId]:e})),I(u(`feedback.cancelFailed`,{error:t instanceof Error?t.message:String(t)}))}},onTransitionProposal:async(e,t)=>{let n=jx(await Ih(e.previewId,t),u);le(e=>e.includes(n.previewId)?e:[...e,n.previewId]),S(r=>{let i={...r};return t===`regenerate`&&delete i[e.previewId],i[n.previewId]=n,i}),g({item:n,kind:`proposal`})},onSelectWorkspaceCandidate:async(e,t)=>{e.sourceRequest&&(S(t=>{let n={...t};return delete n[e.previewId],n}),await Ke({...e.sourceRequest,idempotencyKey:`${e.sourceRequest.idempotencyKey}-${t}`,normalizedParameters:{...e.sourceRequest.normalizedParameters,workspace_ref:t}}))},onPreviewAction:Ke,onRequestScheduleConfig:(e,t)=>Ye(e,t),onOpenNotificationSettings:e=>g({goalId:e,kind:`settings`,tab:`lark`}),onFetchNotificationTargets:()=>ag(),onSetupGoalChannel:e=>sg(e),onToggleGoalAutoNotify:e=>cg(e),onUpdateSchedule:async(e,t)=>{let n=Date.now().toString(36),r=e.scheduleKind===`heartbeat`;await Ke({actionKind:r?`heartbeat.bind`:`monitor.update`,context:{kind:`schedule`,goal_id:e.goalId},idempotencyKey:`workspace-monitor-${e.scheduleId}-${t}-${n}`,normalizedParameters:{agent_id:e.agentId??Ee,...!r&&t===`run_now`?{endpoint_id:Ee}:{},...t===`edit`?{cadence:`2h`,...r?{timezone:e.timezone??`Asia/Shanghai`}:{}}:{},goal_id:e.goalId,operation:t,...!r&&t===`run_now`&&e.sessionId?{session_id:e.sessionId}:{},...r?{}:{todo_id:e.scheduleId}},summary:t===`pause`?`暂停自动运行:${e.label}`:t===`resume`?`恢复自动运行:${e.label}`:t===`run_now`?`立即运行:${e.label}`:t===`stop`?`停止自动运行:${e.label}`:`编辑自动运行生命周期:${e.label}`})}},et=a?{onOpenGoal:$e.onOpenGoal,onOpenGoalView:$e.onOpenGoalView,onOpenOutput:$e.onOpenOutput}:$e;function tt(e){f(e),E(!1),O(!1),ee(!1),b(null),g(null),w(`tasks`),z(!1),t.onSelectGoal?.(e)}function nt(e){m(e),t.onSelectAgent?.(e)}function rt(e){fe(e),_x(e)}async function it(n){let r=n?[]:N,i=(n??Oe).trim()||(r.length?u(`composer.imageAnalysisPrompt`):``);if(!(!i||j)){n||(Ae(``),P([])),ne(null),M(!0);try{if(r.length){B?C!==`chat`&&ee(!0):O(!0);let e=await t.onSendMessage?.(i,Ee,B,r);e&&await Ke(e);return}let n=Jy(i,{agents:e.map(e=>({agentId:e.agentId,label:e.label})),goalId:B,todos:(Fe?.agentTodos??[]).map(e=>({text:e.text,todoId:e.todoId}))});if(n.route===`clarify`){Ae(i);let e=u(`composer.clarifySingleAction`);n.missingFields.includes(`resume_when`)&&(e=u(`composer.clarifyDefer`)),I(e);return}if(n.actionKind===`goal.create`){let e=Fx(i,u),t=Mx(e.title);await Ke({actionKind:`goal.create`,context:{kind:`manager`,goal_id:null,natural_language:i},idempotencyKey:`workspace-goal-intent-${t}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Ee,completion_criteria:e.completionCriteria,execution_boundary:e.executionBoundary,goal_id:t,heartbeat:{cadence:Ix(i),enabled:n.normalizedParameters.heartbeat_enabled===!0,timezone:`Asia/Shanghai`},initial_todos:e.initialTodos,objective:e.objective,permission:e.permission,stop_condition:zx(i),title:e.title,workspace_ref:`current`},summary:u(`proposal.summary.goalCreate`,{title:e.title})});return}if(B&&n.actionKind===`heartbeat.bind`){await Xe(`heartbeat`,B,i);return}if(B&&n.actionKind===`monitor.create`){let e=Lx(i,u);if(e){Ae(i),I(e);return}await Xe(`monitor`,B,i);return}let a=Bx(i,e);if(B&&a&&n.actionKind===`agent.bind`){await Ke({actionKind:`agent.bind`,context:{kind:`goal`,goal_id:B,natural_language:i},idempotencyKey:`workspace-agent-bind-${B}-${a.agentId}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:a.agentId,goal_id:B},summary:`将 ${a.label} 绑定到 ${Fe?.title??B}`});return}if(B&&n.actionKind===`todo.create`){if(n.normalizedParameters.start_execution===!0){await Ke({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:i},idempotencyKey:`workspace-task-start-${B}-${Date.now().toString(36)}`,normalizedParameters:{endpoint_id:a?.agentId??Ee,goal_id:B,start_execution:!0,text:i},summary:`交给 Agent 执行:${i.slice(0,120)}`});return}let e=a?.agentId??(/(交给|分配给|让).{0,24}(agent|codex|claude|kiro|kimi)/iu.test(i)?Ee:null);await Ke({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:i},idempotencyKey:`workspace-todo-create-${B}-${Date.now().toString(36)}`,normalizedParameters:{...e?{endpoint_id:e}:{},goal_id:B,text:Vx(i)},summary:`创建 Todo:${Vx(i)}`});return}let o=Fe?.agentTodos.find(e=>i.includes(e.todoId)||i.includes(e.text)),s=typeof n.normalizedParameters.operation==`string`?n.normalizedParameters.operation:null;if(B&&o&&n.actionKind===`todo.update`&&s){await Ke({actionKind:`todo.update`,context:{kind:`todo`,goal_id:B,todo_id:o.todoId,natural_language:i},idempotencyKey:`workspace-todo-update-${o.todoId}-${s}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Ee,...s===`reassign`&&a?{endpoint_id:a.agentId}:{},...s===`block`?{note:i}:{},...s===`defer`&&typeof n.normalizedParameters.resume_when==`string`?{resume_when:n.normalizedParameters.resume_when}:{},goal_id:B,operation:s,todo_id:o.todoId},summary:`更新 Todo:${o.text}`});return}B?C!==`chat`&&ee(!0):O(!0);let c=await t.onSendMessage?.(i,Ee,B);c&&await Ke(c)}catch(e){n||(Ae(i),P(r));let t=e instanceof Error?e.message:u(`feedback.sendGenericError`);I(u(`feedback.sendFailed`,{error:t}))}finally{M(!1)}}}let at=e.find(e=>e.agentId===Ee)?.label??Ee,ot=!Fe&&Oe.startsWith(u(`composer.createGoalDraftLead`)),st=Re.filter(e=>e.kind===`run`&&!!e.run.sessionId&&!!e.run.canInterrupt&&(e.run.status===`running`||e.run.status===`queued`)).length;async function ct(e){if(!e?.length)return;let t=Wx-N.length,n=Array.from(e).slice(0,Math.max(0,t)),r=n.find(e=>!Hx.has(e.type)),i=n.find(e=>e.size>Ux);if(t<=0){ne(u(`composer.imageCountError`,{count:Wx}));return}if(r){ne(u(`composer.imageTypeError`));return}if(i){ne(u(`composer.imageSizeError`,{size:Ux/1024/1024}));return}try{let t=await Promise.all(n.map(e=>Gx(e,u)));P(e=>[...e,...t].slice(0,Wx)),ne(e.length>n.length?u(`composer.imageCountError`,{count:Wx}):null)}catch(e){ne(e instanceof Error?e.message:u(`composer.imageReadGenericError`))}finally{xe.current&&(xe.current.value=``)}}function lt(e){let t=Array.from(e.clipboardData.items).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).flatMap(e=>{let t=e.getAsFile();return t?[t]:[]});t.length&&(e.preventDefault(),ct(t))}async function ut(){let e=await Jg();ge(e)}async function dt(){await Promise.all([ut(),t.onRefresh?.()])}async function ft(){if(!(!t.onRefresh||oe===`loading`)){se(`loading`);try{await t.onRefresh(),se(`done`)}catch{se(`error`)}window.setTimeout(()=>se(`idle`),1800)}}return Ie?(0,H.jsx)(px,{focusGoalConnection:!!(h?.kind===`settings`&&h.goalId),goals:Me,initialGoalId:h?.kind===`settings`?h.goalId??B:B,initialTab:h?.kind===`settings`?h.tab??`lark`:`lark`,onChanged:()=>void dt(),onClose:()=>g(null),onThemeChange:rt,theme:de}):(0,H.jsx)(vx,{drawer:Ge?(0,H.jsx)(rb,{agents:e,attentionHistory:i.attentionHistory??i.userTodos,onSelectAttention:e=>g({kind:`attention`,item:e}),callbacks:et,goalNotifications:i.goalNotifications??[],goals:Me,inspectorExpanded:_,larkConnections:a?[]:he,onClose:()=>{Ge.kind===`proposal`&&[`applied`,`rejected`].includes(Ge.item.status)&&(Ge.item.actionKind!==`heartbeat.bind`||Ge.item.status!==`applied`)&&S(e=>{let t={...e};return delete t[Ge.item.previewId],t}),v(!1),g(null)},onToggleInspectorSize:()=>v(e=>!e),readOnly:a,runs:Re.flatMap(e=>e.kind===`run`?[e.run]:[]),selection:Ge}):null,drawerMode:Ge?.kind===`todo`?_?`inspector-full`:`inspector`:`panel`,drawerOpen:Ge!==null,mobileSidebarOpen:ue,onCloseMobileSidebar:()=>z(!1),theme:de,main:(0,H.jsxs)(`div`,{className:`personal-channel`,children:[(0,H.jsx)(Oy,{agents:e,managerChatOpen:T,managerRuntime:r,mobileNavigationOpen:ue,onOpenGoalCapabilities:Fe?()=>g({goalId:Fe.goalId,kind:`settings`,tab:`capabilities`}):void 0,onOpenGoalDetail:Fe&&!Fe.loadState?()=>g({item:Fe,kind:`goal`}):void 0,onRefresh:t.onRefresh?()=>void ft():void 0,onOpenNavigation:()=>z(!0),onOpenManagerChat:()=>{O(!1),E(!0)},onSelectGoalTab:e=>{w(e),e===`chat`&&(b(null),ee(!1))},onSelectAgent:nt,onReturnManagerHome:()=>{E(!1),O(!1),window.requestAnimationFrame(()=>be.current?.scrollTo({behavior:`smooth`,top:0}))},selectedAgentId:Ee,refreshState:oe,readOnlySourceLabel:a?c?.activeSource.label:void 0,selectedGoal:Fe,selectedGoalTab:C}),(0,H.jsxs)(`div`,{className:`personal-channel-scroll`,ref:be,children:[!Fe&&!T&&we&&we.done+we.failed+we.attention>0?(0,H.jsxs)(`section`,{className:`personal-digest-card`,"aria-label":u(`digest.away`),children:[(0,H.jsx)(`strong`,{children:u(`digest.away`)}),(0,H.jsxs)(`div`,{className:`personal-digest-stats`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{children:we.done}),u(`digest.completed`)]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{children:we.failed}),u(`digest.failed`)]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{children:we.attention}),u(`digest.needsYou`)]})]})]}):null,!Fe&&!T?(0,H.jsxs)(`section`,{className:`personal-manager-greeting`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(Qp,{size:20})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:u(`home.greeting`)}),(0,H.jsx)(`p`,{children:i.goals.some(e=>e.activationState===`active`&&e.loadState)?u(`startup.partial`):(0,H.jsxs)(H.Fragment,{children:[u(`home.waitingCount`,{count:Ne}),` `,u(`home.blockingSummary`,{count:Pe})]})})]})]}):null,Fe?.loadState?(0,H.jsx)(`section`,{className:`personal-manager-greeting`,role:`status`,"data-testid":`goal-status-loading`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:u(Fe.loadState===`error`?`startup.goalError`:`startup.goalLoading`)}),(0,H.jsx)(`p`,{children:u(Fe.loadError?`startup.error.${Fe.loadError}`:`startup.independent`)}),Fe.loadState===`error`?(0,H.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,type:`button`,onClick:()=>void t.onRefresh?.(),children:u(`startup.retry`)}):null]})}):Fe&&C===`tasks`?(0,H.jsx)(kb,{historyEnabled:!a,goal:Fe,items:Re,onDraftTaskFromMessage:a?void 0:e=>{Ae(`创建一个 Task:${yx(e)}`),I(u(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>ye.current?.focus())},onOpenChat:()=>w(`chat`),onQuickComplete:a?void 0:Ze,onSelect:g,quickCompletingTodoIds:R,selectedTodoId:Ge?.kind===`todo`?Ge.item.todoId:null,userTodos:i.userTodos}):Fe&&C===`files`?(0,H.jsx)(Cx,{items:Re.filter(e=>e.kind===`output`),onSelect:g,reportState:i.periodicReports}):!Fe&&!T?(0,H.jsx)(Sx,{goals:Me,onRetry:()=>void t.onRefresh?.(),onSelectGoal:tt,systemHealth:i.systemHealth}):Fe?(0,H.jsxs)(H.Fragment,{children:[Fe&&y?.goalId===Fe.goalId?(0,H.jsx)(Tx,{onClose:()=>b(null),onOpenDetails:()=>g({item:y,kind:`run`}),run:y}):null,(0,H.jsx)(By,{items:ze,onSelect:g,selectedGoal:Fe})]}):(0,H.jsx)(By,{items:He,onSelect:g,selectedGoal:null})]}),(0,H.jsx)(`div`,{className:`personal-composer-wrap`,children:a?(0,H.jsxs)(`div`,{className:`personal-read-only-notice`,children:[(0,H.jsx)(`strong`,{children:u(`source.readOnlyNoticeTitle`)}),(0,H.jsx)(`span`,{children:u(`source.readOnlyNoticeDescription`)})]}):(0,H.jsxs)(H.Fragment,{children:[!Fe&&!T&&D&&Be.length?(0,H.jsx)(wx,{messages:Be,onClose:()=>O(!1),onOpenConversation:()=>{O(!1),E(!0)}}):null,Fe&&C!==`chat`&&k&&Ve.length?(0,H.jsx)(wx,{agentLabel:at,messages:Ve,onClose:()=>ee(!1),onDraftTask:C===`tasks`?e=>{Ae(`创建一个 Task:${yx(e)}`),I(u(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>ye.current?.focus())}:void 0,onOpenConversation:()=>{ee(!1),w(`chat`)},title:`${Fe.title} · ${at}`}):null,re?(0,H.jsxs)(`div`,{className:`personal-action-feedback`,role:`status`,children:[(0,H.jsx)(`span`,{children:re}),(0,H.jsx)(`button`,{"aria-label":u(`common.closeActionReceipt`),onClick:()=>I(null),type:`button`,children:(0,H.jsx)(eh,{size:14})})]}):null,(0,H.jsx)(`p`,{className:`personal-composer-hint`,children:Fe?st>0?u(`composer.goalRunningHint`,{agent:at,count:st}):u(`composer.goalMessageHint`,{agent:at}):u(`composer.managerMessageHint`)}),Fe?(0,H.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,H.jsxs)(`button`,{"aria-label":u(`composer.nextAction`),className:`is-draft`,onClick:()=>je(u(`composer.nextActionPrompt`)),title:u(`composer.prepareDraft`),type:`button`,children:[(0,H.jsx)(Dm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.nextAction`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]}),(0,H.jsxs)(`button`,{className:`is-immediate`,disabled:j,onClick:()=>void it(u(`composer.agentProgressPrompt`)),title:u(`composer.immediate`),type:`button`,children:[(0,H.jsx)(Vm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.agentProgress`)}),(0,H.jsx)(`em`,{className:`personal-prompt-badge`,children:u(`composer.immediate`)})]}),(0,H.jsxs)(`button`,{"aria-label":u(`composer.monitor`),className:`is-draft`,onClick:()=>Ye(`monitor`,B),title:u(`composer.monitorHint`),type:`button`,children:[(0,H.jsx)(em,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.monitor`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]})]}):(0,H.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,H.jsxs)(`button`,{"aria-label":u(`composer.globalTasks`),className:`is-draft`,onClick:()=>je(u(`composer.globalTasksPrompt`)),title:u(`composer.prepareDraft`),type:`button`,children:[(0,H.jsx)(Dm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.globalTasks`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]}),(0,H.jsxs)(`button`,{className:`is-immediate`,disabled:j,onClick:()=>void it(u(`composer.globalProgressPrompt`)),title:u(`composer.immediate`),type:`button`,children:[(0,H.jsx)(Vm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.globalProgress`)}),(0,H.jsx)(`em`,{className:`personal-prompt-badge`,children:u(`composer.immediate`)})]}),(0,H.jsxs)(`button`,{"aria-label":u(`composer.createGoal`),className:`is-draft`,onClick:qe,title:u(`composer.createGoalHint`),type:`button`,children:[(0,H.jsx)(Fm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.createGoal`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]})]}),ot?(0,H.jsxs)(`div`,{className:`personal-goal-draft-status`,role:`status`,children:[(0,H.jsx)(`strong`,{children:u(`composer.createGoalDraft`)}),(0,H.jsx)(`span`,{children:u(`composer.createGoalDraftDescription`)})]}):null,N.length?(0,H.jsx)(`div`,{className:`personal-composer-images`,"aria-label":u(`composer.imagesPending`),children:N.map(e=>(0,H.jsxs)(`figure`,{children:[(0,H.jsx)(`img`,{alt:e.name,src:e.dataUrl}),(0,H.jsx)(`button`,{"aria-label":u(`composer.sentImageAlt`,{name:e.name}),onClick:()=>P(t=>t.filter(t=>t.id!==e.id)),type:`button`,children:(0,H.jsx)(eh,{size:13})})]},e.id))}):null,F?(0,H.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:F}):null,(0,H.jsxs)(`div`,{className:`personal-channel-composer`,onDragOver:e=>{[...e.dataTransfer.items].some(e=>e.kind===`file`&&e.type.startsWith(`image/`))&&e.preventDefault()},onDrop:e=>{let t=[...e.dataTransfer.files].filter(e=>e.type.startsWith(`image/`));t.length&&(e.preventDefault(),ct(t))},children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:17}),e.find(e=>e.agentId===Ee)?.label??Ee]}),(0,H.jsx)(`button`,{"aria-label":u(`composer.addImage`),className:`personal-composer-attach`,disabled:j||N.length>=Wx,onClick:()=>xe.current?.click(),title:u(`composer.attachImageHint`),type:`button`,children:(0,H.jsx)(Mm,{size:17})}),(0,H.jsx)(`input`,{accept:`image/png,image/jpeg,image/webp,image/gif`,"aria-label":u(`composer.imagePicker`),className:`personal-composer-file-input`,disabled:j||N.length>=Wx,multiple:!0,onChange:e=>void ct(e.target.files),ref:xe,type:`file`}),(0,H.jsx)(`textarea`,{"aria-label":u(`composer.sendMessage`),onChange:e=>Ae(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),it())},onPaste:lt,placeholder:Fe?u(`composer.goalPlaceholder`,{goal:Fe.title}):u(`composer.managerPlaceholder`),ref:ye,rows:1,value:Oe}),(0,H.jsx)(`button`,{"aria-label":u(ot?`composer.createGoal`:`composer.send`),disabled:!Oe.trim()&&N.length===0||j,onClick:()=>void it(),title:u(ot?`composer.createGoalHint`:`composer.sendMessageHint`),type:`button`,children:(0,H.jsx)(Vm,{size:18})})]})]})})]}),sidebar:(0,H.jsx)(Tb,{attentionCount:Ne,goals:Me,goalArchiveLoadState:n,goalLifecycleOperations:t.onExecuteGoalLifecycle?[`stop`,`resume`]:void 0,lifecycleBusyGoalIds:L,onRequestGoalCreate:a?void 0:qe,onRequestGoalLifecycle:a&&!t.onExecuteGoalLifecycle?void 0:(e,t)=>void Je(e,t),onRetryGoalArchive:t.onRetryGoalArchive||t.onRefresh?()=>void(t.onRetryGoalArchive??t.onRefresh)?.():void 0,onOpenSettings:a?void 0:()=>g({kind:`settings`}),onSelectGoal:tt,selectedGoalId:B,statusSourceControl:c},c?.activeSource.statusUrl??`/status.json`)})}function qx(e){return(e??``).replace(/\s+/gu,` `).trim()}function Jx(e,t=120){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t-1).join(``)}…`}function Yx(e,t,n){let r=qx(e);return!r||r===`暂无`?n?t(n):``:/refresh-state|latest_run|latest run-derived/iu.test(r)?t(`projection.refreshState`):/first read-only adapter tick|read-only adapter/iu.test(r)?t(`projection.firstReadOnlyAdapterCheck`):/todo update recorded for/iu.test(r)?t(`projection.todoStatusUpdated`):/^(loopx|python3|npm|git|run)\s|\s--[a-z0-9-]+|\b[a-z]+_[a-z_]+\b/iu.test(r)?t(n??`projection.agentPreparingNextStep`):Jx(r)}function Xx(e,t){return t({advancing:`projection.agentAdvancingGoal`,idle:`projection.agentIdle`,needs_you:`projection.agentNeedsDecision`,stopped:`projection.agentStopped`,waiting_external:`projection.agentWaitingExternal`}[e])}function Zx({eventCount:e,hasArtifact:t,hasLatestValidation:n},r){return{label:r(n?`projection.latestValidation`:`projection.latestRun`),metadata:e>0?r(`projection.events24h`,{count:e}):r(t?`projection.runEvidenceAvailable`:`projection.publicSafeProjection`)}}var Qx=`/status.json`,$x=`loopx-status-source-catalog-v1`,eS={id:`local`,kind:`local`,label:`本机`,readOnly:!1,statusUrl:Qx};function tS(e,t){let n=ah(e,t).source;if(!n||!n.isLoopback||n.isRelative)return{error:`SSH 隧道来源必须使用显式的 localhost、127.0.0.1 或 ::1 URL。`};let r=new URL(n.url,t);return[`http:`,`https:`].includes(r.protocol)?{url:r.toString()}:{error:`状态来源只支持 HTTP 或 HTTPS。`}}function nS(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return`ssh-${(t>>>0).toString(36)}`}function rS(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return null;let n=e;if(n.kind!==`ssh_tunnel`||typeof n.label!=`string`||typeof n.statusUrl!=`string`)return null;let r=n.label.trim(),i=tS(n.statusUrl,t);if(!r||r.length>48||!(`url`in i))return null;let a=hb(n.hostAlias)?n.hostAlias.trim():void 0;return{...a?{hostAlias:a}:{},id:nS(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url}}function iS(){return{schemaVersion:1,sources:[eS]}}function aS(e,t){try{let n=e.getItem($x);if(!n)return iS();let r=JSON.parse(n);if(r.schemaVersion!==1||!Array.isArray(r.sources))return iS();let i=new Set([eS.statusUrl]);return{schemaVersion:1,sources:[eS,...r.sources.flatMap(e=>{let n=rS(e,t);return!n||i.has(n.statusUrl)?[]:(i.add(n.statusUrl),[n])})]}}catch{return iS()}}function oS(e,t){e.setItem($x,JSON.stringify({schemaVersion:1,sources:t.sources.filter(e=>e.kind===`ssh_tunnel`)}))}function sS(e,t){let n=new Set(t.filter(hb).map(e=>e.trim())),r=!1,i=e.sources.map(e=>e.kind!==`ssh_tunnel`||e.hostAlias||!n.has(e.label)?e:(r=!0,{...e,hostAlias:e.label}));return r?{...e,sources:i}:e}function cS(e,t,n){let r=t.label.trim();if(!r)return{error:`请填写来源名称。`};if(r.length>48)return{error:`来源名称不能超过 48 个字符。`};let i=tS(t.statusUrl,n);if(!(`url`in i))return i;if(e.sources.some(e=>e.statusUrl===i.url))return{error:`这个状态 URL 已经在来源目录中。`};if(t.hostAlias!==void 0&&!hb(t.hostAlias))return{error:`请选择有效的 SSH Host。`};let a=t.hostAlias?.trim(),o={...a?{hostAlias:a}:{},id:nS(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url};return{catalog:{...e,sources:[...e.sources,o]},source:o}}function lS(e,t){return{...e,sources:e.sources.filter(e=>e.kind===`local`||e.id!==t)}}function uS(e,t,n){if(!t.trim()||ah(t,n).source?.isRelative)return eS;let r=t.trim();try{r=new URL(r,n).toString()}catch{return null}return e.sources.find(e=>e.statusUrl===r)??null}function dS(e,t,n){return uS(e,t,n)||(ah(t,n).source?.isRelative?eS:{id:`temporary`,kind:`ssh_tunnel`,label:`临时来源`,readOnly:!0,statusUrl:t.trim()})}function fS(e,t,n,r){return dS(e,t??n,r)}var pS={delete:`删除`,deploy:`部署`,merge:`合并`,payment:`付款`,release:`发布`};function mS(e,t,n){let r=t.replace(/\s+/gu,` `).trim().toLowerCase(),i=n.target.replace(/\s+/gu,` `).trim().toLowerCase();return!i||!r.includes(i)?null:{actionKind:`goal.update`,context:{goal_id:e,kind:`goal`,natural_language:t,semantic_proposal:{operation:n.operation,target:n.target}},idempotencyKey:`workspace-semantic-protected-${e}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e,status:`operator_gate_requested`},summary:`请求受保护操作:${pS[n.operation]} · ${n.target}`}}var hS=Qx;async function gS(e){let t=await fetch(e,{cache:`no-store`,signal:AbortSignal.timeout(3e4)});if(!t.ok)throw Error(`HTTP ${t.status} while loading ${e}`);return Ep(await t.json())}function _S(e,t){if(t?.controller_readiness?.decision_advisor_ready||t?.controller_readiness?.write_controller_ready)return`controller_ready`;if(t?.controller_readiness)return`controller_gated`;if(t?.human_reward)return`reward_judged`;if(t?.operator_gate?.decision===`approve`)return`operator_approved`;if(t?.operator_gate)return`operator_gated`;let n=e||t?.classification||``;return n===`connected_without_run`?`connected`:n===`read_only_project_map`||t?.project_map?`mapped`:n===`state_refreshed`?`refreshed`:n&&n!==`no_status`?`adapter_inspected`:`registered`}function vS(e,t){let n=new Map(t.map(e=>[e.goal_id,e])),r=new Set,i=e.map(e=>{r.add(e.id);let t=n.get(e.id),i=e.latest_runs[0],a=t?.lifecycle_phase??e.lifecycle_phase??i?.lifecycle_phase??_S(t?.status??i?.classification??e.status,i),o=t?.lifecycle_flags?.length?t.lifecycle_flags:e.lifecycle_flags?.length?e.lifecycle_flags:i?.lifecycle_flags?.length?i.lifecycle_flags:[a];return{goal:e,queueItem:t,latestRun:i,status:t?.status??i?.classification??e.status??`no_status`,waitingOn:t?.waiting_on??`clear`,severity:t?.severity??`clear`,lifecyclePhase:a,lifecycleFlags:o}});for(let e of t)r.has(e.goal_id)||i.push({goal:{activation_state:e.activation_state,id:e.goal_id,status:e.status,display_name:e.goal_id,latest_runs:[],lifecycle_flags:[e.lifecycle_phase??`registered`],registry_member:!0,legacy_runtime_goal:!1,index_exists:!1,raw_index_records:0,unique_runs:0},queueItem:e,status:e.status,waitingOn:e.waiting_on,severity:e.severity,lifecyclePhase:e.lifecycle_phase??`registered`,lifecycleFlags:e.lifecycle_flags??[`registered`]});return i}function yS(e){return(e??``).replace(/\s+/g,` `).trim()}function bS(e,t=132){let n=yS(e);return n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}…`}function xS(e){let t=new Map;for(let n of e?.goals??[])t.set(n.goal_id,n);return t}function SS(e,t){return e===void 0||t===void 0?void 0:e+t}function CS(e,t){if(!e)return null;let n=t===`user`?e.queueItem?.project_asset?.user_todos:e.queueItem?.project_asset?.agent_todos;if(n?.items?.length)return{done_count:n.done??n.items.filter(e=>e.done).length,items:n.items,open_count:n.open??n.items.filter(e=>!e.done).length,total_count:n.total??n.items.length};let r=t===`user`?e.queueItem?.user_todos:e.queueItem?.agent_todos;return r?.items?.length?r:null}function wS(e){return e?.items.find(e=>!e.done)}function TS(e,t,n=`todos`){return e?.items?.length?{advancement_done_count:e.advancement_done_count??t?.advancement_done_count,done_count:e.done??e.items.filter(e=>e.done).length,items:e.items,open_count:e.open??e.items.filter(e=>!e.done).length,total_count:e.total??e.items.length}:t??null}function ES(e){return e?.queueItem?.project_asset?.quota?.state??e?.queueItem?.quota?.state??e?.goal.quota?.state??`waiting`}function DS(e,t,n){let r=[];for(let t of e){let e=CS(t,`agent`);for(let n of e?.items??[])r.push({goalId:t.goal.id,role:`agent`,todo:n})}let i=new Map;for(let e of r){let t=e.todo.claimed_by||`codex`,n=i.get(t)??[];n.push(e),i.set(t,n)}let a=new Map((n?.agents??[]).map(e=>[e.agent_id,e]));return Array.from(new Set([...i.keys(),...a.keys()])).map(e=>{let t=i.get(e)??[],n=a.get(e),r=Array.from(new Set([...t.map(e=>e.goalId),n?.current_todo?.goal_id,...n?.goal_ids??[]].filter(Boolean))),o=(t.filter(e=>!e.todo.done)[0]??t[0])?.goalId??n?.current_todo?.goal_id??r[0]??``,s=n?.last_activity_at??null;return{agentId:e,claimedTodos:t,currentTodo:n?.current_todo??null,evidenceRefs:[],goalIds:r,handoffNote:null,lastActivity:s,nextSafeAction:n?.next_action?.trim()||`Inspect status projection before taking work`,primaryGoalId:o,quotaHints:[],staleClaimHint:null,status:{label:`可用`,summary:`正常运行`,variant:`success`},workspaceRef:null}})}function OS(e){return e?.map(e=>({dataUrl:e.data_url,id:e.id,mimeType:e.mime_type,name:e.name,size:e.size}))}var kS=`loopx.personal-agent-selection.v1`;function AS(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(kS)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[0]==`string`&&typeof e[1]==`string`))}catch{return{}}}var jS={需修复:`danger`,等你:`warning`,等待条件:`info`,推进中:`success`,安静运行:`neutral`,已停止:`neutral`,已完成:`neutral`};function MS(e,t){return yS(t)||e.replace(/^loopx[-_]/i,`LoopX `).split(/[-_]+/).filter(Boolean).map((e,t)=>t===0?`${e.slice(0,1).toUpperCase()}${e.slice(1)}`:e).join(` `)}function NS(e){return e.split(/\r?\n/u).filter(e=>!/^\s*GOAL_(STATUS|PROGRESS)\s*:/u.test(e)).map(e=>/^\s*GOAL_EVIDENCE\s*:/u.test(e)?e.replace(/^\s*GOAL_EVIDENCE\s*:/u,`验证依据:`):/^\s*NEXT_ACTION\s*:/u.test(e)?e.replace(/^\s*NEXT_ACTION\s*:/u,`下一步:`):e).join(` -`).trim()}function PS(e,t){return[`agent`,`assistant`].includes(e.trim().toLowerCase())&&t.trim().length>0}var FS=`已发现的项目 Agent`;function IS(e){switch(ly(e)){case`codex`:return`Codex`;case`claude`:return`Claude Code`;case`kiro`:return`Kiro CLI`;case`trae`:return`Trae CLI Agent`;case`coco`:return`Coco Agent`;default:return MS(e)}}function LS(e,t){switch(uy(e,t)){case`codex`:return`代码与项目执行`;case`claude`:return`复杂分析与长任务`;case`openai`:case`anthropic`:return`管家问答 · 无工具`;case`kiro`:return`终端编码 · 原生 /goal 循环`;case`trae`:return`前端与交互实现`;case`coco`:return`通用任务`;default:return FS}}function RS(e,t){let n=e.project_asset;return t===`user`?TS(n?.user_todos,e.user_todos,`project_asset.user_todos`):TS(n?.agent_todos,e.agent_todos,`project_asset.agent_todos`)}function zS(e){return bS(e.title??e.text,112)}function BS(e){let t=e.resume_condition?.resume_receipt;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.receipt_id;return typeof n==`string`&&n.trim()?n.trim():null}function VS(e,t){return{resumeWhen:e.resume_when??null,resumeReady:e.resume_ready??null,resumeReceiptId:BS(e),claimedBy:e.claimed_by??null,done:e.status!==`deferred`&&e.done,evidence:e.evidence?bS(e.evidence,96):null,index:e.index,priority:e.priority??null,status:e.status??null,taskClass:e.task_class??null,taskDomain:e.task_domain??null,text:zS(e),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.index}`}}function HS(e){let t=e.queueItem?.agent_todos,n=t?.items??e.queueItem?.project_asset?.agent_todos?.items??[],r=new Map(n.map(t=>[t.todo_id?.trim()||`${e.goal.id}:agent:${t.index}`,t]));for(let n of t?.deferred_items??[]){let t=n.todo_id?.trim()||`${e.goal.id}:agent:${n.index}`;r.has(t)||r.set(t,n)}return[...r.values()]}function US(e){return HS(e).map(t=>VS(t,e))}function WS(e,t,n){let r=new Map;for(let n of e.todo_index?.items??[]){if(n.goal_id!==t.goal.id||n.role!==`agent`)continue;let e=VS(n,t);r.set(e.todoId,e)}for(let e of n)r.has(e.todoId)||r.set(e.todoId,e);let i=new Map;for(let e of r.values()){if(e.done||e.taskClass!==`advancement_task`)continue;let t=e.taskDomain?.trim();t&&i.set(t,(i.get(t)??0)+1)}return[...i].map(([e,t])=>({domain:e,matchingTodoCount:t}))}function GS(e,t){return{claimedBy:e.claimed_by??null,done:e.status===`done`||e.status===`completed`,index:-1,priority:e.priority??null,status:e.status??null,taskClass:e.task_class??null,text:bS(e.title,112),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.claimed_by??`unknown`}:current`}}function KS(e,t,n){let r=new Map(e.map(e=>[e.todoId,e]));for(let e of t){let t=e.currentTodo;if(!t||t.goal_id!==n.goal.id)continue;let i=GS(t,n);r.has(i.todoId)||r.set(i.todoId,i)}return[...r.values()]}function qS(e){let t=e.queueItem?.project_asset?.agent_todos,n=e.queueItem?.agent_todos,r=HS(e),i=t?.advancement_done_count??n?.advancement_done_count??t?.done??n?.done_count??null,a=r.filter(e=>e.done&&e.status!==`deferred`).length,o=Math.max(i??0,a),s=new Set(r.map(e=>e.todo_id?.trim()).filter(e=>!!e)),c=(t?.recent_completed_advancement_items??[]).filter(e=>!e.todo_id?.trim()||!s.has(e.todo_id.trim())).map(t=>VS(t,e)),l=r.find(e=>!e.done);return{doneTodoCount:o,nextTodoText:yS(t?.next??``)||(l?yS(l.title??``)||yS(l.text??``):``)||null,recentCompleted:c}}function JS(e,t){let n=yS(e);return n?/\b(state_file|registry_goal|authority_sources|source_registry)\b|\b[a-z_]+\s+\d+\/\d+/i.test(n)?t(`projection.goalVerified`):Yx(n,t,`projection.validationRecorded`):``}function YS(e,t=4){if(e.length<=t)return e;let n=e.findIndex(e=>!e.done);if(n<0)return e.slice(-t);let r=Math.max(0,Math.min(n-2,e.length-t));return e.slice(r,r+t)}function XS(e,t,n){let r=t.queueItem?.project_asset?.latest_validation,i=t.latestRun,a=e.event_ledger_summary?.goals.find(e=>e.goal_id===t.goal.id);if(!r&&!i&&!a)return null;let o=[JS(r?.summary,n),Yx(i?.health_check,n),Yx(i?.recommended_action,n)].find(e=>e!==``&&e!==`暂无`)??n(`projection.runRecorded`),s=Zx({eventCount:a?.events_24h??0,hasArtifact:!!(i?.json_exists||i?.markdown_exists),hasLatestValidation:!!r},n);return{generatedAt:r?.generated_at??i?.generated_at??a?.latest_event_at??``,label:s.label,metadata:s.metadata,runId:i?`${t.goal.id}:${i.generated_at}`:null,safePreview:[o,s.metadata].filter(Boolean).join(` -`),summary:o,todoId:t.queueItem?.project_asset?.agent_todos?.items.find(e=>!e.done)?.todo_id??null}}function ZS(e){return[e.status,e.goal.status,e.latestRun?.classification,e.lifecyclePhase].filter(Boolean).some(e=>/(^|[_\s-])(done|complete|completed|finished|terminal|closed|success)([_\s-]|$)/i.test(e??``))}function QS(e,t){return e.global_registry?.findings?.find(e=>e.severity===`high`&&(e.goal_id===t.goal.id||e.goal_ids.includes(t.goal.id)))}function $S(e){return[e.status,e.goal.status,e.latestRun?.classification,e.lifecyclePhase].filter(Boolean).some(e=>/(^|[_\s-])(failure|failed|error|broken|unhealthy|blocked[_\s-]?health|health[_\s-]?blocked)([_\s-]|$)/i.test(e??``))}function eC(e,t){let n=t.queueItem?.stale_latest_run_warning;return t.severity===`high`||!!QS(e,t)||!!(n?.requires_refresh_state||n?.severity===`high`)||$S(t)}function tC(e,t){let n=QS(e,t);return t.queueItem?.stale_latest_run_warning?.recommended_action??t.queueItem?.stale_latest_run_warning?.reason??n?.recommended_action??n?.message??t.queueItem?.recommended_action??t.latestRun?.recommended_action??null}function nC(e){let t=e.latestRun?.operator_gate,n=t?.decision?.trim().toLowerCase()??``,r=new Set([`approve`,`approved`,`reject`,`rejected`,`defer`,`deferred`,`cancel`,`cancelled`]),i=[e.queueItem?.recommended_action,e.latestRun?.recommended_action].filter(Boolean).join(` `),a=/(?:等待|需要)(?:用户|你|owner).{0,24}(?:批准|确认|授权|补充|选择|决定)|(?:批准|确认|授权).{0,16}(?:后|才能|方可)/i.test(i);return!!(t&&!r.has(n))||e.lifecyclePhase===`operator_gated`&&!r.has(n)||a}function rC(e,t){let n=e.latestRun?.operator_gate;return Yx(n?.operator_question??n?.reason_summary??n?.follow_up??e.queueItem?.recommended_action??e.latestRun?.recommended_action,t,`projection.confirmAgentDecision`)}function iC(e,t){if(t.goal.activation_state===`stopped`)return`已停止`;let n=CS(t,`user`),r=CS(t,`agent`),i=!!wS(n),a=!!wS(r);return[`user_or_controller`,`controller`].includes(t.waitingOn)||i||nC(t)?`等你`:eC(e,t)?`需修复`:t.waitingOn===`external_evidence`?`等待条件`:ES(t)===`eligible`||a?`推进中`:ZS(t)?`已完成`:`安静运行`}function aC(e,t,n,r){if(n===`已停止`)return Xx(`stopped`,r);if(n===`需修复`)return Yx(tC(e,t),r,`projection.statusRefreshNeeded`);if(n===`等你`)return Xx(`needs_you`,r);if(n===`推进中`){let e=[(CS(t,`agent`)?.items??[]).filter(e=>!e.done).flatMap(e=>[e.title,e.text]).map(e=>yS(e)).find(e=>e!==``&&e!==`暂无`),t.queueItem?.recommended_action,t.latestRun?.recommended_action].map(e=>yS(e)).find(e=>e!==``&&e!==`暂无`);return e?Yx(e,r,`projection.agentAdvancingGoal`):Xx(`advancing`,r)}return Xx(n===`等待条件`?`waiting_external`:`idle`,r)}function oC(e,t){return t.some(t=>e.includes(t))}function sC(e,t,n){if(t.goals.some(e=>e.activationState===`active`&&e.loadState))return{text:`Goal 状态尚未全部加载,暂不能给出完整统计。可先打开已加载的 Goal,失败项可重试。`,lines:[]};if(oC(n,[`Agent`,`agent`,`推进`,`在做`])){let e=t.goals.filter(e=>![`安静运行`,`已完成`,`已停止`].includes(e.state)),n=(e.length>0?e:t.goals).slice(0,3);return n.length===0?{text:`当前状态里还没有 Goal 可供汇总。`,lines:[]}:{text:e.length>0?`Agent 当前关注这些 Goal:`:`当前 Goal 都比较安静:`,lines:n.map(e=>`${e.title} · ${e.state} · ${e.agentSentence}`)}}if(oC(n,[`现在`,`下一步`,`我该`,`该做什么`,`优先处理`])){let e=t.userTodos[0];if(e)return{text:e.blocking?`先处理「${MS(e.goalId)}」:${e.text}`:`当前最先处理「${MS(e.goalId)}」:${e.text}`,lines:[]};let n=t.goals.find(e=>e.state===`需修复`);if(n)return{text:`没有待办,但这个 Goal 需要先修复。`,lines:[`${n.title} · ${n.agentSentence}`]};let r=t.goals.find(e=>e.state===`推进中`);return r?{text:`目前不需要你介入,Agent 正在推进。`,lines:[`${r.title} · ${r.agentSentence}`]}:{text:`当前系统很安静,没有需要你立即处理的事项。`,lines:[]}}if(oC(n,[`等我`,`阻塞`,`需要我`,`全局待办`]))return t.userTodos.length===0?{text:`目前没有 Goal 在等你,开放用户待办为 0。`,lines:[]}:{text:`有 ${t.userTodos.length} 项开放用户待办,阻塞项优先:`,lines:t.userTodos.slice(0,3).map(e=>`${MS(e.goalId)} · ${e.blocking?`阻塞`:`待处理`} · ${e.text}`)};if(oC(n,[`状态`,`异常`,`修复`,`健康`])){let n=t.systemHealth?!t.systemHealth.ok:!e.ok||!e.contract?.ok||!e.global_registry?.ok||(e.global_registry?.summary?.high??0)>0,r=t.goals.filter(e=>e.state===`需修复`),i=r.slice(0,n?2:3).map(e=>`${e.title} · ${e.agentSentence}`);return n&&i.push(`全局状态、契约或注册表健康检查未通过,请进入管理页检查。`),i.length===0?{text:`当前没有发现 Goal 级或全局健康异常。`,lines:[]}:{text:r.length>0?`当前需要关注这些健康问题:`:`Goal 状态正常,但全局健康需要检查:`,lines:i}}return{text:`当前管家支持三类问题:下一步、等待你的事项、Agent 与健康状态。`,lines:[`问“我现在该做什么?”`,`问“哪些 Goal 在等我?”`,`问“Agent 在做什么?”或当前健康状态`]}}function cC(e,t,n,r=!1){let i=new Map(t.map(e=>[e.goal.id,e])),a=new Set(e.run_history.goals.filter(e=>e.activation_state===`stopped`).map(e=>e.id)),o=xS(e.usage_summary),s=DS(t,e.todo_index,e.agent_management_projection),c=e.attention_queue.items.flatMap((e,t)=>{if(a.has(e.goal_id))return[];let n=[`user_or_controller`,`controller`].includes(e.waiting_on);return(RS(e,`user`)?.items??[]).map((r,i)=>({projectedDone:r.done,details:Ud(r),actionKind:r.action_kind??null,blocking:n,goalId:e.goal_id,sourceOrder:t,taskClass:r.task_class??null,text:zS(r),todoId:r.todo_id?.trim()||`${e.goal_id}:user:${r.index}`,todoOrder:i,updatedAt:r.updated_at??null}))}),l=c.filter(e=>!e.projectedDone),u=new Set(l.map(e=>e.goalId)),d=t.flatMap((t,r)=>a.has(t.goal.id)||u.has(t.goal.id)||!nC(t)?[]:[{details:Ud({task_class:`user_gate`,status:`open`,note:t.latestRun?.operator_gate?.reason_summary}),actionKind:`gate.resolve`,blocking:!0,goalId:t.goal.id,sourceOrder:e.attention_queue.items.length+r,taskClass:`user_gate`,text:rC(t,n),todoId:`${t.goal.id}:operator-gate`,todoOrder:0,updatedAt:t.latestRun?.operator_gate?.recorded_at??t.latestRun?.generated_at??null}]),f=[...l,...d].sort((e,t)=>Number(t.blocking)-Number(e.blocking)||e.sourceOrder-t.sourceOrder||e.todoOrder-t.todoOrder),p=e.run_history.goals.flatMap(t=>{if(t.registry_member===!1)return[];let a=i.get(t.id);if(!a)return[];let c=iC(e,a),l=f.find(e=>e.goalId===t.id),u=l?.text??null,d=qS(a),p=t.coordination?.registered_agents??[],m=new Set(p),h=[...s.filter(e=>e.goalIds.includes(t.id)&&!/unassigned|unknown/i.test(e.agentId)&&(m.size===0||m.has(e.agentId))&&(e.currentTodo?.goal_id===t.id||e.claimedTodos.some(e=>e.goalId===t.id)))].sort((e,t)=>(t.lastActivity??``).localeCompare(e.lastActivity??``)),g=new Set(h.map(e=>e.agentId)),_=[...h.map(e=>({agentId:e.agentId,label:e.agentId,lastActivityAt:e.lastActivity,state:e.status.label})),...p.filter(e=>!g.has(e)).map(e=>({agentId:e,label:e,lastActivityAt:null,state:`registered`}))],v=h[0],y=KS(US(a),h,a),b=[d.nextTodoText,a.queueItem?.recommended_action,a.latestRun?.recommended_action,aC(e,a,c,n)].map(e=>Yx(e,n)).find(e=>e!==``&&e!==`暂无`)??n(`projection.nextUpdatePending`);return[{activationState:t.activation_state,agentId:v?.agentId??p[0]??`codex`,agentLaneCount:_.length,agentLanes:_,agentLabel:v?.agentId,agentSentence:aC(e,a,c,n),agentTodos:[...y,...d.recentCompleted],doneTodoCount:d.doneTodoCount,acceptanceObservation:t.acceptance_observation,goalId:t.id,latestActivity:a.latestRun?.generated_at??``,needsYou:u,needsYouActionKind:l?.actionKind??null,needsYouBlocking:l?.blocking??!1,needsYouTaskClass:l?.taskClass??null,needsYouTodoId:l?.todoId??null,nextSentence:b,runEvidence:XS(e,a,n),state:c,...r?{subagentExecution:{allowedDomains:t.spawn_policy?.allowed_domains??[],domainCandidates:WS(e,a,y),enabled:t.spawn_policy?.mode===`multi_subagent`&&t.spawn_policy.spawn_allowed===!0&&t.spawn_policy.max_children>0,maxChildren:t.spawn_policy?.max_children??0,modelConfig:t.spawn_policy?.model_config}}:{},title:MS(t.id,t.display_name),usage:(()=>{let e=o.get(t.id);return e?{costUsd24h:e.cost_usd_24h,costUsd7d:e.cost_usd_7d,durationMs24h:e.duration_ms_24h,durationMs7d:e.duration_ms_7d,tokens24h:SS(e.input_tokens_24h,e.output_tokens_24h),tokens7d:SS(e.input_tokens_7d,e.output_tokens_7d)}:null})()}]}),m=[];if(e.ok||m.push(`状态载荷未标记为正常 (payload.ok === false)`),e.contract&&!e.contract.ok){let t=e.contract.summary,n=t?`${t.errors} 项错误 / ${t.warnings} 项警告`:e.contract.errors?.[0]||`请检查控制面契约`;m.push(`契约检查未通过: ${n}`)}if(e.global_registry){e.global_registry.ok||m.push(`注册表状态异常: ${e.global_registry.summary.high} 项高危`);for(let t of e.global_registry.findings||[])t.severity===`high`&&m.push(`[${t.kind}] ${t.message}`)}let h=e.decision_freshness_summary?.summary?.stale_count?`${e.decision_freshness_summary.summary.stale_count} 项决策状态已过期`:null,g=m.length===0&&!h,_={ok:g,summary:g?`所有控制面契约与注册表检查均正常`:`发现 ${m.length+ +!!h} 项系统健康关注点`,issues:m,freshnessWarning:h};return{blockingTodoCount:f.filter(e=>e.blocking).length,goalNotifications:(e.goal_channel_notification_projection?.goals??[]).map(e=>({goalId:e.goal_id,configured:e.configured,enabled:e.enabled,humanGateAutoNotifyEnabled:e.human_gate_auto_notify_enabled,lastNotifiedAt:e.last_notified_at??null,receiptCount:e.receipt_count,targetRef:e.target_ref??null})),goals:p,openUserTodoCount:f.length,systemHealth:_,attentionHistory:[...c,...d],userTodos:f,visibleUserTodos:f.slice(0,5),workers:(e.agent_management_projection?.agents??[]).map(e=>({agentId:e.agent_id,currentTodoGoalId:e.current_todo?.goal_id??null,currentTodoText:e.current_todo?.title?bS(e.current_todo.title,96):null,lastActivityAt:e.last_activity_at??null,state:e.state??null}))}}function lC({goalArchiveLoadState:e,isLoading:t,onGoalActivationStateChange:n,onGoalDeleted:r,onSelectGoal:i,onReconcileStatus:a,onRefresh:o,onRetryGoalArchive:s,payload:c,progress:l,rows:u,selectedGoalId:d,statusSourceControl:f,theme:p,toggleTheme:m}){let h=f.activeSource.readOnly,g=f.activeSource.kind===`ssh_tunnel`?f.activeSource.hostAlias:void 0,{t:_}=qi(),[v,y]=(0,V.useState)([]),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(null),w=(0,V.useMemo)(()=>{let e=cC(c,u,_,b);if(!l)return e;let t=Object.values(l.snapshots).map(e=>cC(e,vS(e.run_history.goals,e.attention_queue.items),_,b)),n=new Map(t.flatMap(e=>e.goals).map(e=>[e.goalId,e])),r=e.goals.map(e=>n.get(e.goalId)??{...e,loadError:l.errors[e.goalId],loadState:l.errors[e.goalId]?`error`:`loading`,agentId:``,agentSentence:``,nextSentence:``,subagentExecution:void 0}),i=t.flatMap(e=>e.userTodos),a=r.some(e=>e.activationState===`active`&&e.loadState),o=[...new Set(t.flatMap(e=>e.systemHealth?.issues??[]))];return{...e,goals:r,userTodos:i,attentionHistory:t.flatMap(e=>e.attentionHistory??e.userTodos),visibleUserTodos:i.slice(0,5),openUserTodoCount:i.length,blockingTodoCount:i.filter(e=>e.blocking).length,workers:[...new Map(t.flatMap(e=>e.workers??[]).map(e=>[e.agentId,e])).values()],goalNotifications:t.flatMap(e=>e.goalNotifications??[]),systemHealth:a||t.length===0?void 0:{ok:t.every(e=>e.systemHealth?.ok),issues:o,summary:o.length?`发现 ${o.length} 项系统健康关注点`:`状态检查已完成`,freshnessWarning:t.map(e=>e.systemHealth?.freshnessWarning).filter(Boolean).join(`;`)||null}}},[c,u,l,b,_]),T=w.goals.find(e=>e.goalId===d)??null,E=l?.snapshots[d]??c,[D,O]=(0,V.useState)(null),[k,ee]=(0,V.useState)(null),[te,A]=(0,V.useState)(!1),j=w.goals.some(e=>e.activationState===`active`&&e.loadState===`loading`)?`loading`:w.goals.map(e=>`${e.goalId}:${e.agentId}`).join(`|`),M=T?.goalId??`manager`;w.goals.some(e=>e.activationState===`active`&&e.loadState)||(w.systemHealth?!w.systemHealth.ok:!c.ok)||w.openUserTodoCount>0&&`${w.openUserTodoCount}${w.blockingTodoCount}`;let N=v.length>0?v.map(e=>({agentId:e.agent_id,adapterKind:e.adapter_kind,available:e.available,capability:LS(e.agent_id,e.adapter_kind),interrupt:e.interrupt,label:e.display_name,location:e.location,resume:e.resume,source:e.source,statusLabel:e.available?`可用`:`需要配置`,streaming:e.streaming,toolCalls:e.tool_calls,trustScope:e.trust_scope})):[{agentId:`codex`,available:!0,capability:LS(`codex`),label:`Codex`,statusLabel:`正在检测`}],P=[...N,{agentId:`status-only`,available:!0,capability:`不调用模型`,adapterKind:`status_projection`,interrupt:!1,label:`仅查状态`,resume:!0,statusLabel:`只读`,streaming:!1,toolCalls:!1,trustScope:`read_only`}],F=N.find(e=>e.label===`Codex`&&e.available)?.agentId??N.find(e=>e.available)?.agentId??`status-only`,[ne,re]=(0,V.useState)(AS),I=dh(P,ne[M]??F,F),[L,ie]=(0,V.useState)(!1),[R,ae]=(0,V.useState)(!1),[oe,se]=(0,V.useState)(`chat`),[ce,le]=(0,V.useState)(``),[ue,z]=(0,V.useState)({}),[de,fe]=(0,V.useState)({}),[pe,me]=(0,V.useState)(null),[he,ge]=(0,V.useState)({}),[_e,ve]=(0,V.useState)([]),[ye,be]=(0,V.useState)(null),[xe,Se]=(0,V.useState)({}),Ce=(0,V.useRef)(1),we=(0,V.useRef)(1),Te=(0,V.useRef)(new Map),B=(0,V.useRef)(new Set),Ee=(0,V.useRef)(new Map),De=(0,V.useRef)(new Map),Oe=(0,V.useRef)(new Set),ke=(0,V.useRef)(new Set),Ae=(0,V.useRef)(null),je=(0,V.useRef)(null),Me=(0,V.useRef)(null),Ne=(0,V.useRef)(null);(0,V.useRef)(null);let Pe=ue[M]??[];de[M];let Fe=T?w.userTodos.filter(e=>e.goalId===T.goalId):w.userTodos,Ie=T?.agentTodos??[];YS(Ie,T?.needsYou?3:4);let Le=Ie.filter(e=>e.done).length,Re=Ie.length>0?`${Le}/${Ie.length}`:`暂无计划`;T&&({...w},Fe.filter(e=>e.blocking).length,Fe.length),(0,V.useEffect)(()=>{let e=ih(f.activeSource.statusUrl,window.location.href),t=e.source?ch(E,e.source):null;if(!T||!t?.indexUrl||!t.detailUrl){O(null),ee(null),A(!1);return}let{detailUrl:n,indexUrl:r}=t,i=!1;return O(null),ee(null),A(!0),lh(r,T.goalId).then(async e=>{let t=e.items[0]?.detail_ref;return t?uh(n,t):null}).then(e=>{i||O(e)}).catch(e=>{i||ee(Dp(e))}).finally(()=>{i||A(!1)}),()=>{i=!0}},[E,T?.goalId,f.activeSource.statusUrl]);let ze=T?void 0:he[M]?.sessionId;(0,V.useEffect)(()=>{if(h||!ze)return;let e=!1,t,n=async()=>{try{let t=await Vh(ze);if(e)return;let n=t.messages.filter(e=>e.origin===`manager_followup`);z(e=>{let t=e[M]??[],r=new Set(t.map(e=>e.sourceMessageId)),i=n.filter(e=>!r.has(e.message_id));return i.length?{...e,[M]:[...t,...i.map(e=>({id:Ce.current++,sourceMessageId:e.message_id,role:`assistant`,agentLabel:I.label,sourceLabel:`管家交接回执`,text:NS(e.text),lines:[]}))]}:e})}catch{}finally{e||(t=setTimeout(n,3e3))}};return n(),()=>{e=!0,t&&clearTimeout(t)}},[h,ze,M,I.label]);function Be(e,t){ge(n=>{if(t===null){let t={...n};return delete t[e],t}return{...n,[e]:t}})}(0,V.useEffect)(()=>{if(h){y([]),x(!1),C(null);return}let e=!1;return Rh().then(t=>{if(!e){y(t.adapters??[]);let e=t.manager?.runtime;C(e?{schema_version:`manager_runtime_session_readback_v0`,runtime_profile:e.runtime_profile,configuration_revision:e.configuration_revision,status:e.status,sandbox:e.sandbox,standing_grant:e.standing_grant,tool_classes:e.tool_classes}:null),x(t.goal_subagent_configuration===`preview_locked`)}}).catch(()=>{e||x(!1)}),()=>{e=!0}},[h]),(0,V.useEffect)(()=>{try{window.localStorage.setItem(kS,JSON.stringify(ne))}catch{}},[ne]),(0,V.useEffect)(()=>{if(h||!I.available)return;let e=M,t=`${e}:${I.agentId}`,n=T?`goal`:`manager`,r=T?`goal.${T.goalId}`:`manager`,i=!1,a=null,o=null;return(async()=>{try{let s=await Wh({agentId:I.agentId,channelId:r,goalId:T?.goalId});if(i||(z(t=>(t[e]?.length??0)>0?t:{...t,[e]:s.messages.map(e=>({sourceMessageId:e.message_id,agentLabel:e.role===`user`?void 0:I.label,attachments:OS(e.attachments),id:Ce.current++,lines:[],role:e.role===`user`?`user`:`assistant`,sourceLabel:e.role===`user`?void 0:e.role===`error`?`本地会话记录`:`恢复的 ${I.label} 会话`,text:e.role===`user`?e.text:NS(e.text)}))}),I.agentId===`status-only`))return;let c=s.sessions[0];if(o=c?.session_id??null,c&&!c.resumable){B.current.add(t),Be(e,{agentId:I.agentId,resumable:!1,sessionId:c.session_id,status:`resume_failed`});return}let l=n===`manager`?``:T?.goalId??``;if(n===`goal`&&!l)return;let u=await Bh(l,I.agentId,`resume_latest`,n);if(i)return;n===`manager`&&u.session.manager_runtime&&C(u.session.manager_runtime),Te.current.set(t,u.session_id);let d=s.snapshots.find(e=>e.session.session_id===u.session_id),f=d?.session.active_turn_id??``;if(Be(e,{agentId:I.agentId,resumable:!0,sessionId:u.session_id,status:f?`running`:`ready`,turnId:f||void 0}),B.current.delete(t),!f)return;let p=`${u.session_id}:${f}`;if(ke.current.has(p))return;ke.current.add(p),Ee.current.set(e,f),Be(e,{agentId:I.agentId,resumable:!0,sessionId:u.session_id,status:`running`,turnId:f}),me(e),a=new AbortController,De.current.set(e,a);let m=``,h=Ve(e,{activity:[`正在恢复进行中的 Agent 回合`],agentLabel:I.label,lines:[],pending:!0,sourceLabel:`恢复的 ${I.label} 会话`,text:``});try{let t=await Zh(u.session_id,f,{signal:a.signal,onDelta:t=>{m+=t,He(e,h,{text:m})},onActivity:t=>{z(n=>({...n,[e]:(n[e]??[]).map(e=>e.id===h?{...e,activity:[...new Set([...e.activity??[],t])].slice(-6)}:e)}))}});if(i)return;He(e,h,{lines:t.response.gate?[t.response.gate.summary,t.response.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:t.response.message||m.trim()||`${I.label} 已完成分析。`});let n=w.goals.find(e=>e.goalId===d?.session.goal_id)??T??w.goals[0]??null;if(n&&t.response.proposals.length>0){let r=t.response.proposals.map(e=>({goalId:n.goalId,id:we.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));fe(t=>({...t,[e]:[...t[e]??[],...r]}))}}catch(t){if(i)return;He(e,h,{activity:[],lines:[],pending:!1,reconnect:t instanceof Eh&&t.payload.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t instanceof Error?t.message:`无法恢复进行中的 Agent 回合。`})}finally{ke.current.delete(p),Ee.current.get(e)===f&&Ee.current.delete(e),Be(e,{agentId:I.agentId,resumable:!0,sessionId:u.session_id,status:`ready`}),De.current.get(e)===a&&De.current.delete(e),i||me(t=>t===e?null:t)}}catch(n){if(i)return;n instanceof Eh&&n.payload.error_code===`resume_failed`&&(B.current.add(t),o&&Be(e,{agentId:I.agentId,resumable:!1,sessionId:o,status:`resume_failed`}))}})(),()=>{i=!0,a?.abort()}},[M,w.goals[0]?.goalId,h,T?.goalId,I.agentId,I.available,I.label]),(0,V.useEffect)(()=>{if(h||T||w.goals.length===0||j===`loading`)return;let e=!1;return Promise.all(w.goals.filter(e=>!e.loadState).map(async e=>{let t=await Hh({agentId:e.agentId,channelId:`goal.${e.goalId}`,goalId:e.goalId});return{goalId:e.goalId,session:t.sessions[0]??null}})).then(t=>{e||ge(e=>{let n={...e};for(let e of t)e.session&&(n[e.goalId]={agentId:e.session.agent_id,resumable:e.session.resumable,sessionId:e.session.session_id,status:e.session.active_turn_id?`running`:e.session.status,turnId:e.session.active_turn_id??void 0});return n})}).catch(()=>{}),()=>{e=!0}},[h,j,T?.goalId]),(0,V.useEffect)(()=>{if(be(null),h){ve([]),Se({});return}if(!T){ve([]),Se({});return}let e=!1,t=0,n=0;ve([]),Se({});let r=async()=>{if(!e){if(document.hidden){t=window.setTimeout(()=>void r(),1e4);return}try{let t=await Hh({goalId:T.goalId});if(!e){let r=t.sessions.filter(e=>e.channel_id?.startsWith(`task.`));ve(r);let i=await Promise.allSettled(r.map(e=>Vh(e.session_id)));if(!e){let e=i.some(e=>e.status===`rejected`);n=e?n+1:0,be(e?`partial`:null),Se(Object.fromEntries(i.flatMap((e,t)=>e.status===`fulfilled`?[[r[t].session_id,e.value]]:[])))}}}catch{n+=1,e||be(`offline`)}e||(t=window.setTimeout(()=>void r(),Math.min(3e4,2e3*2**Math.min(n,4))))}};return r(),()=>{e=!0,window.clearTimeout(t)}},[h,T?.goalId]),(0,V.useEffect)(()=>{if(!L)return;let e=window.requestAnimationFrame(()=>{Ae.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()});return()=>{window.cancelAnimationFrame(e),je.current?.focus()}},[L]),(0,V.useEffect)(()=>{if(!R)return;let e=window.requestAnimationFrame(()=>Me.current?.focus());return()=>{window.cancelAnimationFrame(e),Ne.current?.focus()}},[R]),(0,V.useEffect)(()=>{if(!L&&!R)return;let e=e=>{e.key===`Escape`&&(ie(!1),ae(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[L,R]);function Ve(e,t){let n=Ce.current++;return z(r=>({...r,[e]:[...r[e]??[],{...t,id:n,role:`assistant`}]})),n}function He(e,t,n){z(r=>({...r,[e]:(r[e]??[]).map(e=>e.id===t?{...e,...n}:e)}))}async function Ue(e,t){let n=e.trim();if(!n)return;let r=t&&`goalId`in t?t.goalId??`manager`:M,i=r===`manager`?null:w.goals.find(e=>e.goalId===r)??null,a=t?.agentId?dh(P,t.agentId,F):I,o=r===`manager`?w:i?{...w,blockingTodoCount:w.userTodos.filter(e=>e.goalId===i.goalId&&e.blocking).length,goals:[i],openUserTodoCount:w.userTodos.filter(e=>e.goalId===i.goalId).length,userTodos:w.userTodos.filter(e=>e.goalId===i.goalId),visibleUserTodos:w.userTodos.filter(e=>e.goalId===i.goalId)}:w,s=Ce.current++;if(z(e=>({...e,[r]:[...e[r]??[],{attachments:t?.attachments,id:s,lines:[],role:`user`,text:n}]})),le(``),me(r),a.agentId===`status-only`||!i&&r!==`manager`){let e=sC(E,o,n),t=a.agentId===`status-only`;Ve(r,{agentLabel:t?`仅查状态`:`LoopX 管家`,lines:e.lines.slice(0,3),sourceLabel:t?`LoopX 状态投影 · 仅查状态`:`LoopX 状态投影`,text:e.text}),zh({answer:[e.text,...e.lines.slice(0,3)].filter(Boolean).join(` -`),contextKind:r===`manager`?`manager`:`goal`,goalId:r===`manager`?void 0:r,question:n}).catch(()=>{}),me(null);return}let c=`${r}:${a.agentId}`,l=null;try{let e=Te.current.get(c);if(!e){let t=B.current.has(c)?`new`:`resume_latest`,n=await Bh(r===`manager`?``:i.goalId,a.agentId,t,r===`manager`?`manager`:`goal`);r===`manager`&&n.session.manager_runtime&&C(n.session.manager_runtime),e=n.session_id,Te.current.set(c,e),Be(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),B.current.delete(c)}let o=``;l=Ve(r,{activity:[`正在连接 Agent`],agentLabel:a.label,lines:[],pending:!0,sourceLabel:r===`manager`?`${a.label} 管家 · 跨 Goal`:`${a.label} Agent · ${MS(i.goalId)}`,text:``});let s=(await Yh(e,n,{attachments:t?.attachments,signal:(()=>{let e=new AbortController;return De.current.set(r,e),e.signal})(),onDelta:e=>{o+=e,l!==null&&He(r,l,{text:o})},onActivity:e=>{l!==null&&z(t=>({...t,[r]:(t[r]??[]).map(t=>t.id===l?{...t,activity:[...new Set([...t.activity??[],e])].slice(-6)}:t)}))},onPhase:(t,n)=>{Ee.current.set(r,n),Be(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`running`,turnId:n})}})).response;if(He(r,l,{lines:s.gate?[s.gate.summary,s.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:NS(s.message||o.trim())||`${a.label} 已完成分析。`}),s.proposals.length>0&&!i&&He(r,l,{lines:[`请进入要修改的 Goal,预览并确认具体变更。`]}),s.proposals.length>0&&i){let e=s.proposals.map(e=>({goalId:i.goalId,id:we.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));fe(t=>({...t,[r]:[...t[r]??[],...e]}))}if(r!==`manager`&&s.protected_action){let e=mS(r,n,s.protected_action);if(e)return e}}catch(e){if(Oe.current.delete(r)){let e={agentLabel:a.label,lines:[],pending:!1,sourceLabel:`${a.label} 会话`,text:`已中断。你可以在当前会话继续发送消息。`};l===null?Ve(r,e):He(r,l,e);return}let t=e instanceof Eh?e.payload:null;t&&fh(t)&&Te.current.delete(c),t?.error_code===`resume_failed`&&(Te.current.delete(c),B.current.add(c),Be(r,{agentId:a.agentId,resumable:!1,sessionId:he[r]?.sessionId??`resume-failed`,status:`resume_failed`}));let n=t?.gate,i=n&&typeof n==`object`?String(n.summary??``):``,o={agentLabel:a.label,lines:i?[i]:[],pending:!1,reconnect:t?.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t?.error_code===`resume_failed`?`原 ${a.label} 会话无法恢复。本地历史已经保留,请在运行详情里选择“重试恢复”或“开始新 Session”。`:e instanceof Error?e.message:`${a.label} 会话暂时不可用。`};l===null?Ve(r,o):He(r,l,o)}finally{Ee.current.delete(r),De.current.delete(r);let e=Te.current.get(c);e&&Be(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),me(e=>e===r?null:e)}}async function We(e){let t=e?.goalId??M,n=he[t],r=e?.agentId??n?.agentId??I.agentId,i=`${t}:${r}`,a=e?.sessionId??n?.sessionId??Te.current.get(i),o=e?.turnId??n?.turnId??Ee.current.get(t);if(!(!a||!o))try{Oe.current.add(t),await Jh(a,o),De.current.get(t)?.abort()}catch(e){throw Oe.current.delete(t),e}finally{Ee.current.delete(t),Be(t,{agentId:r,resumable:!0,sessionId:a,status:`ready`}),De.current.delete(t),me(e=>e===t?null:e)}}async function Ge(e){let t=e.goalId,n=`${t}:${e.agentId}`,r=e.sessionId??he[t]?.sessionId??Te.current.get(n);if(r)try{let i=await $h(r);Te.current.set(n,r),B.current.delete(n),Be(t,{agentId:e.agentId,resumable:i.session.resumable,sessionId:r,status:i.session.status})}catch{Be(t,{agentId:e.agentId,resumable:!1,sessionId:r,status:`resume_failed`})}}function Ke(e){let t=`${e.goalId}:${e.agentId}`;Te.current.delete(t),B.current.add(t),Be(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:`new-session-pending`,status:`ready`})}async function qe(e){let t=`${e.goalId}:${e.agentId}`,n=e.sessionId??he[e.goalId]?.sessionId??Te.current.get(t);n&&n!==`new-session-pending`&&await Qh(n),Te.current.delete(t),B.current.add(t),Be(e.goalId,null)}function Je(e){P.some(t=>t.agentId===e&&t.available)&&(re(t=>({...t,[M]:e})),ie(!1))}function Ye(){i(``),se(`chat`)}function Xe(e){i(e),se(`chat`)}T&&jS[T.state],T&&(`${I.label}${T.state}`,Ie.length>0&&`${Re}`,Fe.length>0&&`${Fe.length}`),T?.state===`需修复`||!T&&!c.ok?(T&&IS(T.agentId),T?.nextSentence,T?.agentSentence):T?.state===`等你`?(T.needsYouBlocking,T.needsYouBlocking,T.needsYou??T.nextSentence,T.needsYou):(T&&IS(T.agentId),T?.nextSentence);let Ze=[...!T&&he.manager?.status===`resume_failed`?[{id:`run:manager:resume-failed`,kind:`run`,run:{agentId:he.manager.agentId,agentLabel:IS(he.manager.agentId),canInterrupt:!1,completedSteps:0,goalId:`manager`,goalTitle:`LoopX 管家`,latestActivity:`本地聊天记录已保留,点我查看恢复方式。`,resumable:!1,runId:`manager:resume-failed`,sessionId:he.manager.sessionId,sessionStatus:`resume_failed`,status:`failed`,title:`上次会话需要恢复`,totalSteps:1,outputs:[]}}]:[],...T?_e.map(e=>{let t=e.channel_id?.startsWith(`task.`)?e.channel_id.slice(5):void 0,n=T.agentTodos.find(e=>e.todoId===t),r=!!e.active_turn_id,i=xe[e.session_id],a=i?.messages.some(e=>PS(e.role,e.text))===!0;return{id:`run:task:${e.session_id}`,kind:`run`,run:{agentId:e.agent_id,agentLabel:IS(e.agent_id),canInterrupt:r,completedSteps:n?.done||a?1:0,goalId:T.goalId,goalTitle:T.title,latestActivity:r?`Agent 正在执行,可进入 Session 查看过程或发送纠偏。`:a?`Agent 已返回结果,点击查看结果与完整运行记录。`:`执行 Session 已保留,可继续纠偏或恢复。`,resumable:e.resumable,runId:e.session_id,sessionId:e.session_id,sessionMessages:i?.messages.map(e=>({createdAt:e.created_at,messageId:e.message_id,role:e.role===`user`?`user`:PS(e.role,e.text)?`assistant`:`error`,text:e.role===`user`?e.text:NS(e.text)})),sessionStatus:a?`completed`:e.status,status:n?.done||a?`completed`:r?`running`:e.status===`resume_failed`?`failed`:`waiting`,title:n?.text??`Agent 执行任务`,todoId:t,totalSteps:1,turnId:e.active_turn_id??void 0}}}):[],...T?[{id:`run:${T.goalId}`,kind:`run`,run:{agentId:he[T.goalId]?.agentId??T.agentId,agentLabel:IS(he[T.goalId]?.agentId??T.agentId),canInterrupt:!!he[T.goalId]?.turnId,completedSteps:T.agentTodos.filter(e=>e.done).length,goalId:T.goalId,goalTitle:T.title,latestActivity:T.agentSentence,resumable:he[T.goalId]?.resumable??!0,runId:`goal:${T.goalId}`,sessionId:he[T.goalId]?.sessionId,sessionStatus:he[T.goalId]?.status,status:he[T.goalId]?.turnId?`running`:T.state===`需修复`?`failed`:`waiting`,title:T.nextSentence,totalSteps:T.agentTodos.length||1,turnId:he[T.goalId]?.turnId,outputs:T.runEvidence?[{createdAt:T.runEvidence.generatedAt,kind:`evidence`,outputId:`${T.goalId}:latest-evidence`,title:T.runEvidence.label}]:[]}}]:[],...Pe.map(e=>({id:`message:${e.id}`,kind:`message`,message:{agentLabel:e.agentLabel,attachments:e.attachments,id:String(e.id),pending:e.pending,role:e.role,text:e.text||(e.pending?`Agent 正在处理…`:e.lines.join(` -`))}})),...(T?[T]:w.goals).flatMap(e=>e.runEvidence?[{id:`output:${e.goalId}:${e.runEvidence.generatedAt||`latest`}`,kind:`output`,output:{agentLabel:IS(e.agentId),createdAt:e.runEvidence.generatedAt,goalId:e.goalId,goalTitle:e.title,kind:`evidence`,outputId:`${e.goalId}:latest-evidence`,runId:e.runEvidence.runId??void 0,safePreview:e.runEvidence.safePreview,summary:e.runEvidence.summary,title:e.runEvidence.label,todoId:e.runEvidence.todoId??void 0}}]:[]),...T&&D?[{id:`output:${T.goalId}:report:${D.publication.publication_id}`,kind:`output`,output:{agentId:D.agent_id,agentLabel:IS(D.agent_id),createdAt:D.publication.delivered_at,goalId:T.goalId,goalTitle:T.title,kind:`report`,outputId:D.publication.publication_id,report:{addedCount:D.delta.added_count,changedCount:D.delta.changed_count,deliveredAt:D.publication.delivered_at,generationId:D.generation_id,items:D.delta.items.map(e=>({changeKind:e.change_kind,previousStatus:e.previous_status,sourceRef:e.source_ref,status:e.status,summary:e.summary,title:e.title})),periodEndAt:D.period_window.end_at,periodStartAt:D.period_window.start_at,predecessorPublicationId:D.publication.predecessor_publication_id,publicationId:D.publication.publication_id},safePreview:D.delta.items.map(e=>`${e.change_kind===`added`?`+`:`~`} ${e.title}\n${e.summary}`).join(` +`)});continue}let o=e.match(/^\s{0,3}#{1,4}\s+(.*)$/);if(o){i();let t=e.trimStart().match(/^#+/)?.[0].length??1;n.push({type:`heading`,level:t,text:o[1].trim()}),a+=1;continue}if(My.test(e)||Ny.test(e)){i();let r=Ny.test(e),o=r?Ny:My,s=[];for(;a{let n=`b${t}`;if(e.type===`code`)return(0,H.jsx)(`pre`,{className:`personal-md-pre`,children:(0,H.jsx)(`code`,{children:e.text})},n);if(e.type===`heading`)return(0,H.jsx)(`p`,{className:`personal-md-heading is-h${e.level}`,children:jy(e.text,n)},n);if(e.type===`list`){let t=e.items.map((e,t)=>(0,H.jsx)(`li`,{children:jy(e,`${n}-${t}`)},`${n}-${t}`));return e.ordered?(0,H.jsx)(`ol`,{className:`personal-md-list`,children:t},n):(0,H.jsx)(`ul`,{className:`personal-md-list`,children:t},n)}return(0,H.jsx)(`p`,{children:e.lines.map((e,t)=>(0,H.jsxs)(V.Fragment,{children:[t>0?(0,H.jsx)(`br`,{}):null,jy(e,`${n}-${t}`)]},`${n}-${t}`))},n)})})}function Iy({onSelect:e,output:t}){let{t:n}=qi(),r=t.kind===`report`?_m:gm;return(0,H.jsxs)(`button`,{className:`personal-timeline-row personal-output-row`,"data-output-kind":t.kind,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-row-icon is-output`,children:(0,H.jsx)(r,{size:18})}),(0,H.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,H.jsxs)(`small`,{children:[t.goalTitle??t.goalId,` · `,t.agentLabel??`LoopX`]}),(0,H.jsx)(`strong`,{children:t.title}),t.summary?(0,H.jsx)(`span`,{children:t.summary}):null,t.report?(0,H.jsxs)(`small`,{children:[n(`files.reportDelta`,{added:t.report.addedCount,changed:t.report.changedCount}),` · `,n(`files.verifiedReport`)]}):null]}),t.createdAt?(0,H.jsx)(`time`,{children:t.createdAt}):null,(0,H.jsx)(rm,{size:17})]})}var Ly={completed:`runs.completed`,failed:`runs.failed`,interrupted:`runs.interrupted`,queued:`runs.queued`,running:`runs.running`,waiting:`runs.waiting`};function Ry({onSelect:e,run:t}){let{t:n}=qi(),r=t.totalSteps>0?Math.min(100,t.completedSteps/t.totalSteps*100):0;return(0,H.jsxs)(`button`,{"aria-label":`${n(`tasks.viewExecution`)}:${t.title}`,className:`personal-timeline-row personal-run-row`,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-row-icon is-run`,children:(0,H.jsx)(Qp,{size:18})}),(0,H.jsxs)(`span`,{className:`personal-run-identity`,children:[(0,H.jsx)(`small`,{children:t.goalTitle}),(0,H.jsx)(`strong`,{children:t.agentLabel})]}),(0,H.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,H.jsx)(`strong`,{children:t.title}),(0,H.jsx)(`small`,{children:t.latestActivity})]}),(0,H.jsxs)(`span`,{className:`personal-run-progress`,"aria-label":`${t.completedSteps}/${t.totalSteps}`,children:[(0,H.jsxs)(`small`,{children:[t.completedSteps,`/`,t.totalSteps]}),(0,H.jsx)(`i`,{children:(0,H.jsx)(`b`,{style:{width:`${r}%`}})})]}),(0,H.jsxs)(`span`,{className:`personal-row-status is-${t.status}`,children:[t.status===`running`?(0,H.jsx)(wm,{className:`personal-spin`,size:14}):null,n(Ly[t.status])]}),t.sessionId?(0,H.jsx)(`span`,{className:`personal-run-open-label`,children:n(`tasks.viewExecution`)}):null,(0,H.jsx)(rm,{size:17})]})}function zy({onSelect:e,schedule:t}){let{t:n}=qi(),r=t.scheduleKind===`heartbeat`;return(0,H.jsxs)(`button`,{"aria-label":`${r?`Heartbeat`:n(`tasks.scheduled`)}:${t.label};${t.status??`active`}`,className:`personal-schedule-row`,onClick:e,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-schedule-icon`,children:r?(0,H.jsx)(Im,{size:17}):(0,H.jsx)(em,{size:17})}),(0,H.jsxs)(`span`,{className:`personal-schedule-copy`,children:[(0,H.jsx)(`small`,{children:n(r?`schedule.heartbeat`:`schedule.monitor`)}),(0,H.jsx)(`strong`,{children:t.label}),(0,H.jsx)(`p`,{children:t.schedule??n(`schedule.summary`)})]}),(0,H.jsx)(`span`,{className:`personal-schedule-status is-${t.status??`active`}`,children:t.status===`paused`?n(`schedule.paused`):n(`schedule.active`)}),(0,H.jsx)(rm,{size:16})]})}function By({delivery:e}){let{t}=qi();if(!e)return null;let n=e.status===`delivered`?e.verification===`reconciled_after_restart`?t(`returnDelivery.reconciled`):t(`returnDelivery.delivered`):e.status===`verification_required`?t(`returnDelivery.verifying`):e.status===`explicit_unverified`?t(`returnDelivery.unverified`):t(`returnDelivery.queued`),r=e.status===`delivered`?`delivered`:e.status===`verification_required`?`verification_required`:e.status===`explicit_unverified`?`explicit_unverified`:`queued`;return(0,H.jsx)(`small`,{className:`personal-return-delivery is-${r}`,role:`status`,children:n})}function Vy({items:e,onSelect:t,selectedGoal:n}){let{t:r}=qi();if(e.length===0)return(0,H.jsxs)(`div`,{className:`personal-timeline-empty`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(qm,{size:20})}),(0,H.jsx)(`strong`,{children:r(n?`timeline.emptyGoal`:`timeline.emptyWorkspace`)}),(0,H.jsx)(`p`,{children:r(n?`timeline.emptyGoalDescription`:`timeline.emptyWorkspaceDescription`)})]});let i=[...e].reverse().find(e=>e.kind===`message`&&e.message.role!==`user`||e.kind===`proposal`&&[`applied`,`stale`,`error`,`gated`].includes(e.proposal.status)||e.kind===`run`&&e.run.status===`completed`),a=i?.kind===`message`?`${i.message.agentLabel??r(`header.manager`)}:${i.message.pending?r(`timeline.pending`):i.message.text}`:i?.kind===`proposal`?`${i.proposal.title}:${i.proposal.status}`:i?.kind===`run`?r(`timeline.runCompleted`,{run:i.run.title}):``,o=e.filter(e=>e.kind===`proposal`&&e.proposal.status===`gated`),s=e.filter(e=>e.kind!==`proposal`),c=e.filter(e=>e.kind===`proposal`&&e.proposal.status!==`gated`);function l(e){return e.kind===`attention`?(0,H.jsx)(ky,{attention:e.attention,onSelect:()=>t({item:e.attention,kind:`attention`})},e.id):e.kind===`run`?(0,H.jsx)(Ry,{onSelect:()=>t({item:e.run,kind:`run`}),run:e.run},e.id):e.kind===`output`?(0,H.jsx)(Iy,{onSelect:()=>t({item:e.output,kind:`output`}),output:e.output},e.id):e.kind===`schedule`?(0,H.jsx)(zy,{onSelect:()=>t({item:e.schedule,kind:`schedule`}),schedule:e.schedule},e.id):e.kind===`proposal`?(0,H.jsxs)(`button`,{className:`personal-proposal-row is-${e.proposal.status}`,onClick:()=>t({item:e.proposal,kind:`proposal`}),type:`button`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(qm,{size:17})}),(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(`small`,{children:[e.proposal.actionKind,` · `,e.proposal.status]}),(0,H.jsx)(`strong`,{children:e.proposal.title}),(0,H.jsx)(`p`,{children:e.proposal.impact})]}),(0,H.jsx)(`b`,{children:e.proposal.status===`gated`&&e.proposal.actionKind!==`operation.execute`?r(`timeline.review`):e.proposal.primaryLabel??r(`timeline.reviewAndConfirm`)})]},e.id):(0,H.jsxs)(`article`,{className:`personal-message is-${e.message.role}`,children:[e.message.role===`user`?null:(0,H.jsx)(`span`,{className:`personal-message-avatar`,children:(0,H.jsx)(Qp,{size:17})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:e.message.role===`user`?r(`common.you`):e.message.agentLabel??r(`header.manager`)}),e.message.time?(0,H.jsx)(`time`,{children:e.message.time}):null]}),e.message.attachments?.length?(0,H.jsx)(`div`,{className:`personal-message-images`,children:e.message.attachments.map(e=>(0,H.jsx)(`img`,{alt:e.name,src:e.dataUrl},e.id))}):null,e.message.role===`user`?(0,H.jsx)(`p`,{children:e.message.text}):(0,H.jsx)(Fy,{text:e.message.text}),e.message.pending?(0,H.jsx)(`span`,{className:`personal-message-pending`,children:r(`timeline.pending`)}):null,(0,H.jsx)(By,{delivery:e.message.returnDelivery})]})]},e.id)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{"aria-atomic":`true`,"aria-live":`polite`,className:`personal-live-region`,role:`status`,children:a}),(0,H.jsxs)(`div`,{className:`personal-channel-timeline`,children:[s.map(l),o.length?(0,H.jsxs)(`details`,{className:`personal-gated-summary`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(qm,{size:16})}),(0,H.jsx)(`strong`,{children:r(`timeline.waitingConfirmation`)}),(0,H.jsx)(`small`,{children:r(`timeline.gateHistory`,{count:o.length})})]}),(0,H.jsx)(`div`,{children:o.map(l)})]}):null,c.map(l)]})]})}function Hy({goal:e}){let{t}=qi(),n={connected:t(`acceptance.connected`),mapped:t(`acceptance.mapped`),refreshed:t(`acceptance.refreshed`),adapter_inspected:t(`acceptance.inspected`),run_recorded:t(`acceptance.recorded`),reward_judged:t(`acceptance.judged`),operator_approved:t(`acceptance.approved`),controller_ready:t(`acceptance.ready`),attention_queue:t(`acceptance.attentionSource`),agent_vision:t(`acceptance.visionSource`),todo_projection:t(`acceptance.todoSource`),current_run:t(`acceptance.runSource`)},r=e=>n[e]??t(`acceptance.unknown`),i=e.acceptanceObservation,a=e.loadState||!i||i.goal_id!==e.goalId||i.coverage===`unavailable`;return(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-acceptance`,"aria-label":t(`acceptance.title`),children:[(0,H.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,H.jsx)(`h3`,{children:t(`acceptance.title`)}),(0,H.jsx)(`em`,{children:t(`common.readOnly`)})]}),(0,H.jsx)(`p`,{role:`status`,children:t(a?`acceptance.unavailable`:`acceptance.partial`)}),!a&&i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h4`,{children:t(`acceptance.gaps`)}),i.acceptance_gaps.length?i.acceptance_gaps.map((e,n)=>(0,H.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,H.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.owner`)}),(0,H.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,H.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.observed`)}),(0,H.jsx)(`dd`,{children:e.observed_at??t(`acceptance.unknown`)})]})]})]},`${e.kind}:${e.owner}:${n}`)):(0,H.jsx)(`p`,{children:t(`acceptance.noGaps`)}),(0,H.jsx)(`h4`,{children:t(`acceptance.guards`)}),i.guards.length?i.guards.map((e,n)=>(0,H.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,H.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.owner`)}),(0,H.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),e.blocks_agent?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.agent`)}),(0,H.jsx)(`dd`,{children:e.blocks_agent})]}):null,e.todo_id?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`common.task`)}),(0,H.jsx)(`dd`,{children:e.todo_id})]}):null,(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,H.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`acceptance.scope`)}),(0,H.jsx)(`dd`,{children:e.decision_scope??t(`acceptance.unknown`)})]})]})]},`${e.todo_id}:${n}`)):(0,H.jsx)(`p`,{children:t(`acceptance.noGuards`)}),(0,H.jsx)(`h4`,{children:t(`acceptance.next`)}),(0,H.jsx)(`p`,{children:i.next_action??t(`acceptance.unknown`)}),(0,H.jsxs)(`details`,{children:[(0,H.jsxs)(`summary`,{children:[t(`acceptance.historical_progress`),` · `,i.historical_progress.length]}),(0,H.jsx)(`p`,{children:t(`acceptance.historical`)}),i.historical_progress.map(e=>(0,H.jsxs)(`p`,{children:[(0,H.jsx)(`strong`,{children:r(e.kind)}),` · `,e.observed_at??t(`acceptance.unknown`),` `,e.evidence_refs.join(`, `)]},e.kind))]}),i.missing_sources.length?(0,H.jsxs)(`p`,{children:[t(`acceptance.missing`),` `,i.missing_sources.map(r).join(`, `)]}):null,i.truncated?(0,H.jsx)(`p`,{children:t(`acceptance.truncated`)}):null]}):null]})}function Uy({item:e,successor:t,onSelect:n}){let{t:r}=qi(),i=e.details;return(0,H.jsxs)(`section`,{className:`personal-detail-card`,"aria-label":r(`attentionDetail.title`),children:[(0,H.jsx)(`h3`,{children:r(`attentionDetail.title`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.request`)}),(0,H.jsx)(`dd`,{children:r(i?.interaction===`decision`?`attentionDetail.decision`:`attentionDetail.unknownRequest`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`common.status`)}),(0,H.jsx)(`dd`,{children:r(`attentionDetail.${i?.lifecycle??`unknown`}`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`drawer.reason`)}),(0,H.jsx)(`dd`,{children:i?.reason??e.explanation??r(`attentionDetail.unknownReason`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Todo`}),(0,H.jsx)(`dd`,{children:e.todoId})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.targetTodo`)}),(0,H.jsx)(`dd`,{children:i?.unblocksTodoId??r(`attentionDetail.notProvided`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.targetAgent`)}),(0,H.jsx)(`dd`,{children:i?.blocksAgent??r(`attentionDetail.notProvided`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`attentionDetail.scope`)}),(0,H.jsx)(`dd`,{children:i?.decisionScope?`${i.decisionScope.kind} · ${i.decisionScope.granularity} · ${i.decisionScope.scopeKey}`:r(`attentionDetail.notProvided`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`drawer.evidence`)}),(0,H.jsx)(`dd`,{children:i?.evidence??e.evidence??r(`drawer.decisionDefaultEvidence`)})]})]}),i?.supersededBy?(0,H.jsxs)(`p`,{children:[r(`attentionDetail.replacement`),`: `,i.supersededBy]}):null,t&&n?(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>n(t),type:`button`,children:r(`attentionDetail.openReplacement`)}):null,(0,H.jsx)(`p`,{children:r(`attentionDetail.boundary`)})]})}function Wy(e){return e.replace(/\s+/gu,` `).trim()}function Gy(e,t){let n=RegExp(`(?:不要|不需要|无需|禁止|别|暂不|do not\\b|don't\\b|without\\b).{0,10}(?:${t.source})`,`iu`),r=RegExp(`(?:${t.source}).{0,10}(?:不要|不需要|无需|禁止|关闭)`,`iu`),i=RegExp(`disable\\b.{0,10}(?:${t.source})|(?:turn|switch|set)\\b.{0,10}(?:${t.source}).{0,10}\\boff\\b|(?:${t.source})\\s+(?:is\\s+)?disabled\\b`,`iu`);return n.test(e)||r.test(e)||i.test(e)}function Ky(e){return/(我现在该做什么|下一步|哪些\s*Goal\s*在等我|需要我|谁在等我|Agent\s*在做什么|当前进度|总结(?:今天)?进展)/iu.test(e)}function qy(e){let t=/(怎么|如何|为什么|给.*建议|分析一下|解释|只读)/u.test(e),n=/(解决一下|修复一下|处理一下|执行一下|改一下|跑(?:一下)?测试|rebase|push|提交|推送)/iu.test(e);return!t&&n&&/(帮我|请|给我|直接|现在|开始|bytedcli|codebase|git|rebase|push|提交|推送)/iu.test(e)}function Jy(e){return Wy(e).toLowerCase().match(/(?:^|[\s,,;;:((:]|到|至)(?todo_done:todo_[a-z0-9_-]{3,64}|pr_merged:(?:(?:[a-z0-9_.-]{1,80})\/(?:[a-z0-9_.-]{1,100}))?#[1-9][0-9]{0,8}|capacity_available:[a-z][a-z0-9_:-]{0,63}|resume_at:[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}t[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\.[0-9]{1,3})?(?:z|[+-][0-9]{2}:[0-9]{2}))(?=$|[\s,,。;;))])/iu)?.groups?.condition??null}function Yy(e,t){let n=Wy(e),r=[],i=t.agents.find(e=>{let t=n.toLowerCase();return t.includes(e.agentId.toLowerCase())||t.includes(e.label.toLowerCase())}),a=t.todos.find(e=>n.includes(e.todoId)||n.includes(e.text)),o=/(刚刚|已经|已)(?:经)?\s*(新增|创建|添加)(?:的)?\s*(todo|待办|任务)/iu.test(n),s=!!t.goalId&&!Gy(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n);if(!t.goalId&&!Gy(n,/goal|目标/iu)&&/(创建|新建|设置|create|start|set up).{0,24}(goal|目标)/iu.test(n)&&r.push({actionKind:`goal.create`,confidence:.97,normalizedParameters:{heartbeat_enabled:!Gy(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n)}}),t.goalId&&s&&r.push({actionKind:`heartbeat.bind`,confidence:.96,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&!s&&!Gy(n,/定时|监控|监测|持续观察|scheduled check|monitor/iu)&&/(定时|监控|监测|每.{0,8}(分钟|小时|天)|持续观察|scheduled check|monitor|every.{0,12}(minute|hour|day)|daily)/iu.test(n)&&r.push({actionKind:`monitor.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&i&&!Gy(n,/绑定|负责|接管|管理/iu)&&/((让|交给).{0,20}(管理|负责|接管).{0,8}(goal|目标)|(绑定).{0,12}(goal|目标)|(goal|目标).{0,12}(交给|绑定|负责|接管))/iu.test(n)&&r.push({actionKind:`agent.bind`,confidence:.96,normalizedParameters:{agent_id:i.agentId,goal_id:t.goalId}}),t.goalId&&!o&&!Gy(n,RegExp(`todo|待办|任务`,`iu`))&&/(创建|新建|新增|添加|加一个|记一个).{0,16}(todo|待办|任务)|(todo|待办|任务).{0,12}(创建|新建|新增|添加)|(?:create|add)(?:\s+(?:a|an|new))?\s+(?:todo|task)|(?:todo|task).{0,12}(?:create|add)/iu.test(n)&&r.push({actionKind:`todo.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&qy(n)&&r.push({actionKind:`todo.create`,confidence:.9,normalizedParameters:{goal_id:t.goalId,start_execution:!0}}),t.goalId&&a){let e=!Gy(n,/完成|做完|关闭/u)&&/完成|做完|关闭/u.test(n)?`complete`:!Gy(n,/阻塞|卡住/u)&&/阻塞|卡住/u.test(n)?`block`:!Gy(n,/暂缓|稍后|推迟/u)&&/暂缓|稍后|推迟/u.test(n)?`defer`:i&&!Gy(n,/交给|分配给|改派/u)&&/交给|分配给|改派/u.test(n)?`reassign`:null;if(e){let i=e===`defer`?Jy(n):null;if(e===`defer`&&!i)return{actionKind:`todo.update`,confidence:.97,missingFields:[`resume_when`],normalizedParameters:{goal_id:t.goalId,operation:e,todo_id:a.todoId},route:`clarify`};r.push({actionKind:`todo.update`,confidence:.97,normalizedParameters:{goal_id:t.goalId,operation:e,...i?{resume_when:i}:{},todo_id:a.todoId}})}}let c=[...new Map(r.map(e=>[e.actionKind,e])).values()];return c.length>1?{actionKind:null,confidence:.4,missingFields:[`single_intent`],normalizedParameters:{},route:`clarify`}:c.length===1?{...c[0],missingFields:[],route:`typed_action`}:!t.goalId&&Ky(n)?{actionKind:null,confidence:.98,missingFields:[],normalizedParameters:{},route:`projection`}:{actionKind:null,confidence:.75,missingFields:[],normalizedParameters:{},route:`agent_chat`}}function Xy(e,t,n){if(!e)return{};if(!t.trim())return{modelConfig:null};let r={model:t.trim()};return n&&(r.reasoning_effort=n),{modelConfig:r}}var Zy=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`select:not([disabled])`,`input:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`),Qy=[{key:`drawer.taskBlock`,operation:`block`},{key:`drawer.taskSuccessor`,operation:`successor_create`}],$y=[{key:`drawer.decisionReject`,resolution:`reject`},{key:`drawer.decisionDefer`,resolution:`defer`}],eb=Array.from({length:32},(e,t)=>t+1),tb=/^[a-z][a-z0-9_.-]{0,63}$/u;function nb(e){let t=String(e??``).trim().toLowerCase();return tb.test(t)?t:null}function rb(e,t){return e.enabled===t.enabled&&e.maxChildren===t.maxChildren&&JSON.stringify(e.modelConfig??null)===JSON.stringify(t.modelConfig??null)&&[...e.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)===[...t.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)}function ib({agents:e,attentionHistory:t=[],onSelectAttention:n,callbacks:r,goalNotifications:i=[],goals:a=[],inspectorExpanded:o=!1,larkConnections:s=[],onClose:c,onToggleInspectorSize:l,readOnly:u=!1,runs:d=[],selection:f}){let{locale:p,t:m}=qi(),[h,g]=(0,V.useState)(``),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(`idle`),[x,S]=(0,V.useState)(`record`),[C,w]=(0,V.useState)([]),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(2),[k,ee]=(0,V.useState)(``),[te,A]=(0,V.useState)(``),[j,M]=(0,V.useState)(`idle`),[N,P]=(0,V.useState)(null),[F,ne]=(0,V.useState)(null),re=(0,V.useRef)(null),I=(0,V.useRef)(null),[L,ie]=(0,V.useState)(e.find(e=>e.available)?.agentId??`codex`),[R,ae]=(0,V.useState)(``),oe=(0,V.useRef)(null),se=(0,V.useRef)(null),ce=(0,V.useRef)(null),le=(0,V.useRef)(null),ue=f.kind===`run`?`run:${f.item.runId}`:f.kind===`proposal`?`proposal:${f.item.previewId}`:f.kind===`todo`?`todo:${f.item.todoId}`:f.kind===`attention`?`attention:${f.item.todoId}`:f.kind===`output`?`output:${f.item.outputId}`:f.kind===`schedule`?`schedule:${f.item.scheduleId}`:`goal:${f.item.goalId}`;(0,V.useEffect)(()=>{b(`idle`),v(!1),S(`record`),ae(``);let e=f.kind===`goal`?f.item.subagentExecution:void 0;w(e?.allowedDomains??[]),ee(e?.modelConfig?.model??``),A(e?.modelConfig?.reasoning_effort??``),O(e?.maxChildren?Math.min(e.maxChildren,32):2),E(null),M(`idle`),P(null),ne(null),re.current=e??null,I.current=null},[ue]);let z=f.kind===`goal`?f.item.subagentExecution:void 0;(0,V.useEffect)(()=>{let e=re.current,t=z?!e||!rb(e,z):e!==null;if(re.current=z??null,!F){t&&z&&(w(z.allowedDomains),ee(z.modelConfig?.model??``),A(z.modelConfig?.reasoning_effort??``),O(z.maxChildren||2),E(null),M(`idle`),P(null));return}let n=I.current;(!z||rb(F,z)||n&&!rb(n,z))&&(z&&(w(z.allowedDomains),ee(z.modelConfig?.model??``),A(z.modelConfig?.reasoning_effort??``),O(z.maxChildren||2)),I.current=null,ne(null))},[z,F]),(0,V.useEffect)(()=>{let e=document.activeElement;e instanceof HTMLElement&&!se.current?.contains(e)&&(ce.current=e);let t=window.requestAnimationFrame(()=>le.current?.focus());return()=>window.cancelAnimationFrame(t)},[ue]);let de=(0,V.useCallback)(()=>{let e=ce.current;c(),window.requestAnimationFrame(()=>e?.focus())},[c]);(0,V.useEffect)(()=>{function e(e){if(e.key===`Escape`){e.preventDefault(),de();return}if(e.key===`Tab`&&f.kind!==`todo`){let t=Array.from(se.current?.querySelectorAll(Zy)??[]).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`);if(t.length===0)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[de,f.kind]);let fe=f.kind===`attention`?m(`drawer.titleAttention`):f.kind===`todo`?m(`drawer.taskDetails`):f.kind===`run`?m(`drawer.runDetails`):f.kind===`output`?m(`drawer.titleOutput`):f.kind===`proposal`?m(f.item.status===`applied`?`drawer.titleProposalApplied`:`drawer.titleProposalConfirm`):f.kind===`schedule`?f.item.scheduleKind===`heartbeat`?`Heartbeat`:m(`drawer.titleSchedule`):m(`drawer.goalDetails`),pe=f.kind===`proposal`?f.item.goalId??`manager`:f.item.goalId,me=f.kind===`attention`?f.item.goalTitle??m(`drawer.currentGoal`):f.kind===`todo`||f.kind===`run`?f.item.goalTitle:f.kind===`output`?f.item.goalTitle??m(`drawer.currentGoal`):f.kind===`goal`?f.item.title:f.kind===`schedule`?m(`drawer.goalAutoRun`):f.item.goalId?m(`drawer.goalChanges`):m(`drawer.managerChanges`),he=f.kind===`goal`?d.find(e=>e.goalId===f.item.goalId&&!!e.sessionId)??d.find(e=>e.goalId===f.item.goalId):null,ge=f.kind===`run`&&(f.item.completedSteps>0||!!f.item.latestActivity||!!f.item.outputs?.length),_e=f.kind===`attention`?Xi(f.item.updatedAt,m):null,ve=Jy(R);async function ye(){f.kind!==`run`||!h.trim()||(await r.onCorrectRun?.(f.item,h.trim()),g(``))}async function be(e,t,n,i){if(t===`successor_create`){await r.onPreviewAction?.({actionKind:`todo.create`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-successor-${e.todoId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,text:m(`drawer.taskSuccessorText`,{task:e.text})},summary:m(`drawer.taskSuccessorSummary`,{task:e.text})});return}await r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-${e.todoId}-${t}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:e.claimedBy??L,goal_id:e.goalId,operation:t,...t===`block`?{note:m(`drawer.taskSuccessorNote`)}:{},...t===`defer`&&i?{resume_when:i}:{},todo_id:e.todoId},summary:`${n}:${e.text}`})}async function xe(e,t,n){u||!qd(e)||await r.onPreviewAction?.({actionKind:`gate.resolve`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-decision-${e.todoId}-${t}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,decision:t,todo_id:e.todoId},summary:`${n}:${e.text}`})}let Se=f.kind===`goal`?F??f.item.subagentExecution??{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0}:{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0},Ce=j===`previewing`||j===`applying`,we=(()=>{if(f.kind!==`goal`)return[];let e=new Map;for(let t of Se.allowedDomains){let n=nb(t);n&&e.set(n,{matchingTodoCount:0,value:n})}if(Se.domainCandidates)for(let t of Se.domainCandidates){let n=nb(t.domain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+t.matchingTodoCount,value:n})}else for(let t of f.item.agentTodos){if(t.done||t.taskClass!==`advancement_task`)continue;let n=nb(t.taskDomain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+1,value:n})}return[...e.values()]})();function Te(){w(Se.allowedDomains),ee(Se.modelConfig?.model??``),A(Se.modelConfig?.reasoning_effort??``),O(Se.maxChildren||2),E(null),M(`idle`),P(null)}function B(){let e=[...new Set(C.map(e=>nb(e)))];return e.every(e=>!!e)?e:null}function Ee(e,t){w(n=>t?[...n,e].filter((e,t,n)=>n.indexOf(e)===t):n.filter(t=>t!==e)),P(null),M(`idle`),E(null)}async function De(e,t=e){if(f.kind!==`goal`||!r.onPreviewGoalSubagentConfiguration)return;let n=e?B():[];if(t&&!k.trim()&&te){M(`error`),E(m(`drawer.subagentModelRequired`));return}if(e&&!n){M(`error`),E(m(`drawer.subagentDomainInvalid`)),P(null);return}let i={allowedDomains:n??[],enabled:e,goalId:f.item.goalId,maxChildren:e?D:0,...Xy(t,k,te)};M(`previewing`),E(m(`drawer.subagentPreviewing`)),P(null);try{let e=await r.onPreviewGoalSubagentConfiguration(i);if(!e.changed){I.current=z??null,ne({...e.configuration,domainCandidates:Se.domainCandidates}),w(e.configuration.allowedDomains),ee(e.configuration.modelConfig?.model??``),A(e.configuration.modelConfig?.reasoning_effort??``),O(e.configuration.maxChildren||2),M(`success`),E(m(`drawer.subagentNoChange`));return}P({...i,changed:e.changed,previewId:e.previewId}),M(`ready`),E(m(`drawer.subagentPreviewReady`))}catch(e){M(`error`),E(e instanceof Error?e.message:m(`drawer.subagentPreviewFailed`))}}async function Oe(){if(!(!N||!r.onApplyGoalSubagentConfiguration)){M(`applying`),E(m(`drawer.subagentApplying`));try{let e=await r.onApplyGoalSubagentConfiguration({allowedDomains:N.allowedDomains,enabled:N.enabled,goalId:N.goalId,maxChildren:N.maxChildren,modelConfig:N.modelConfig,previewId:N.previewId});I.current=z??null,ne({...e,domainCandidates:Se.domainCandidates}),w(e.allowedDomains),ee(e.modelConfig?.model??``),A(e.modelConfig?.reasoning_effort??``),O(e.maxChildren||2),M(`success`),E(m(`drawer.subagentApplied`)),P(null);try{await r.onRefresh?.()}catch{M(`warning`),E(m(`drawer.subagentAppliedRefreshFailed`))}}catch(e){M(`error`),E(e instanceof Error?e.message:m(`drawer.subagentApplyFailed`))}}}return(0,H.jsxs)(`div`,{"aria-labelledby":`personal-drawer-title`,"aria-modal":f.kind===`todo`?void 0:`true`,className:`personal-context-drawer`,"data-context-kind":f.kind,ref:se,role:`dialog`,children:[(0,H.jsxs)(`header`,{className:`personal-drawer-header${f.kind===`todo`?` is-task-inspector`:``}`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{id:`personal-drawer-title`,ref:le,tabIndex:-1,children:fe}),(0,H.jsx)(`p`,{children:me})]}),(0,H.jsxs)(`div`,{className:`personal-drawer-header-actions`,children:[f.kind===`todo`&&l?(0,H.jsx)(`button`,{"aria-label":m(o?`drawer.inspectorHalf`:`drawer.inspectorFull`),className:`personal-icon-button personal-inspector-size`,onClick:l,title:m(o?`drawer.inspectorHalfView`:`drawer.inspectorFullView`),type:`button`,children:o?(0,H.jsx)(km,{size:17}):(0,H.jsx)(Tm,{size:17})}):null,(0,H.jsxs)(`button`,{"aria-label":m(`drawer.closeDetail`,{context:me}),className:`personal-icon-button personal-drawer-close`,onClick:de,ref:oe,type:`button`,children:[(0,H.jsx)(Kp,{className:`personal-mobile-back`,size:18}),(0,H.jsx)(eh,{className:`personal-desktop-close`,size:18})]})]})]}),(0,H.jsxs)(`div`,{className:`personal-drawer-body`,children:[f.kind===`attention`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card is-attention`,children:[(0,H.jsx)(`small`,{children:f.item.blocking?m(`drawer.attentionBlocking`):m(`drawer.attentionWaiting`)}),(0,H.jsx)(`h3`,{children:f.item.text}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,H.jsx)(`dd`,{children:f.item.priority??`medium`})]}),_e?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`common.waiting`)}),(0,H.jsx)(`dd`,{children:m(`tasks.waitingAge`,{age:_e})})]}):null]})]}),(0,H.jsx)(Uy,{item:f.item,onSelect:n,successor:Kd(f.item,t)}),!u&&qd(f.item)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void xe(f.item,`approve`,m(`common.confirm`)),type:`button`,children:[(0,H.jsx)(tm,{size:17}),m(`drawer.decisionReview`)]}),(0,H.jsxs)(`details`,{className:`personal-compact-menu`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(fm,{size:17}),m(`drawer.decisionMore`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{onClick:()=>void r.onExplainDecision?.(f.item),type:`button`,children:[(0,H.jsx)(Dm,{size:16}),m(`drawer.explainDecision`)]}),$y.map(e=>(0,H.jsx)(`button`,{onClick:()=>void xe(f.item,e.resolution,m(e.key)),type:`button`,children:m(e.key)},e.resolution))]})]})]}):null]}):null,f.kind===`todo`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-task-inspector-summary`,children:[(0,H.jsxs)(`div`,{className:`personal-task-inspector-status`,children:[(0,H.jsxs)(`span`,{className:f.item.done?`is-done`:f.item.status===`blocked`?`is-blocked`:`is-open`,children:[(0,H.jsx)(`i`,{}),f.item.done?m(`drawer.taskStatusCompleted`):f.item.status===`deferred`?m(`drawer.taskStatusDeferred`):f.item.status===`blocked`?m(`drawer.taskStatusBlocked`):m(`drawer.taskStatusOpen`)]}),f.item.priority?(0,H.jsx)(`span`,{children:f.item.priority}):null,(0,H.jsx)(`span`,{children:f.item.taskClass===`advancement_task`?m(`drawer.taskAdvancement`):f.item.taskClass??m(`drawer.taskOrdinary`)})]}),(0,H.jsx)(`h3`,{children:f.item.text})]}),(0,H.jsxs)(`section`,{"aria-label":m(`drawer.taskInfo`),className:`personal-task-inspector-fields`,children:[(0,H.jsx)(`h4`,{children:m(`drawer.taskInfo`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`common.owner`)}),(0,H.jsx)(`dd`,{children:f.item.ownerLabel??f.item.claimedBy??m(`drawer.notAssigned`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`common.status`)}),(0,H.jsx)(`dd`,{children:f.item.done?m(`drawer.taskStatusCompleted`):f.item.status===`deferred`?m(`drawer.taskStatusDeferred`):f.item.status===`blocked`?m(`drawer.taskStatusBlocked`):m(`drawer.taskStatusOpen`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,H.jsx)(`dd`,{children:f.item.priority??m(`drawer.notSet`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.dependencies`)}),(0,H.jsx)(`dd`,{children:f.item.dependencies?.join(` · `)||m(`common.none`)})]}),f.item.status===`deferred`||f.item.resumeWhen?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.resumeWhen`)}),(0,H.jsx)(`dd`,{children:f.item.resumeWhen||m(`drawer.notSet`)})]}):null,f.item.resumeWhen?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.resumeState`)}),(0,H.jsx)(`dd`,{children:f.item.resumeReady?m(`drawer.resumeReady`):m(`drawer.resumePending`)})]}):null,f.item.resumeReceiptId?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.resumeReceipt`)}),(0,H.jsx)(`dd`,{children:f.item.resumeReceiptId})]}):null,(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.nextTransition`)}),(0,H.jsx)(`dd`,{children:f.item.nextTransition??(f.item.done?m(`drawer.taskNextCompleted`):f.item.resumeReady?m(`drawer.taskNextResumeReady`):f.item.status===`deferred`?m(`drawer.taskNextDeferred`):m(`drawer.taskNextOpen`))})]})]})]}),!u&&!f.item.done?(0,H.jsxs)(`div`,{className:`personal-task-inspector-actions`,"aria-label":m(`drawer.taskActions`),children:[(0,H.jsxs)(`details`,{className:`personal-task-management`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(fm,{size:16}),m(`drawer.taskManage`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:m(`drawer.reassign`)}),(0,H.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.reassign`),(0,H.jsx)(`select`,{"aria-label":m(`drawer.reassign`),onChange:e=>ie(e.target.value),value:L,children:e.filter(e=>e.available).map(e=>(0,H.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:f.item.goalId,kind:`todo`,todo_id:f.item.todoId},idempotencyKey:`workspace-todo-${f.item.todoId}-reassign-${L}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:L,goal_id:f.item.goalId,operation:`reassign`,todo_id:f.item.todoId},summary:m(`drawer.reassignSummary`,{task:f.item.text})}),type:`button`,children:m(`timeline.review`)})]}),(0,H.jsx)(`strong`,{children:m(`drawer.taskDeferUntil`)}),(0,H.jsxs)(`label`,{className:`personal-inline-agent-select personal-inline-resume-when`,children:[m(`drawer.taskDeferUntil`),(0,H.jsx)(`input`,{"aria-label":m(`drawer.taskDeferCondition`),"aria-invalid":!!R.trim()&&!ve,onChange:e=>ae(e.target.value),placeholder:m(`drawer.taskDeferPlaceholder`),value:R}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:!ve,onClick:()=>void be(f.item,`defer`,m(`drawer.taskDefer`),ve??void 0),type:`button`,children:m(`drawer.taskDeferReview`)}),(0,H.jsx)(`small`,{children:R.trim()&&!ve?m(`drawer.taskDeferInvalid`):m(`drawer.taskDeferSupported`)})]}),(0,H.jsx)(`div`,{className:`personal-task-management-secondary`,children:Qy.map(e=>(0,H.jsx)(`button`,{onClick:()=>void be(f.item,e.operation,m(e.key)),type:`button`,children:m(e.key)},e.operation))})]})]}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void be(f.item,`complete`,m(`drawer.taskComplete`)),type:`button`,children:[(0,H.jsx)(tm,{size:17}),m(`drawer.taskComplete`)]})]}):null,f.item.done?(0,H.jsxs)(`div`,{className:`personal-task-completed-note`,children:[(0,H.jsx)(tm,{size:16}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:m(`drawer.taskCompletedTitle`)}),(0,H.jsx)(`small`,{children:m(`drawer.taskCompletedNote`)})]})]}):null]}):null,f.kind===`goal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsx)(`small`,{children:Ji(f.item.state,p)}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.agentSentence}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.tokens`)}),(0,H.jsxs)(`dd`,{children:[wy(f.item.usage?.tokens24h,m(`drawer.usageNotMeasured`),xy),` / `,wy(f.item.usage?.tokens7d,m(`drawer.usageNotMeasured`),xy)]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.cost`)}),(0,H.jsxs)(`dd`,{children:[wy(f.item.usage?.costUsd24h,m(`drawer.usageNotMeasured`),Sy),` / `,wy(f.item.usage?.costUsd7d,m(`drawer.usageNotMeasured`),Sy)]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.duration`)}),(0,H.jsxs)(`dd`,{children:[wy(f.item.usage?.durationMs24h,m(`drawer.usageNotMeasured`),Cy),` / `,wy(f.item.usage?.durationMs7d,m(`drawer.usageNotMeasured`),Cy)]})]})]})]}),(0,H.jsx)(Hy,{goal:f.item}),(()=>{let e=i.find(e=>e.goalId===f.item.goalId),t=s.find(e=>e.goal_id===f.item.goalId);return(0,H.jsxs)(H.Fragment,{children:[f.item.repository?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-repository`,children:[(0,H.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,H.jsx)(`small`,{children:m(`drawer.repository`)}),(0,H.jsx)(`em`,{children:m(`common.readOnly`)})]}),(0,H.jsxs)(`h3`,{children:[(0,H.jsx)(vm,{size:16}),f.item.repository.label]}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.branch`)}),(0,H.jsx)(`dd`,{children:f.item.repository.branch||`detached`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Role`}),(0,H.jsx)(`dd`,{children:m(`drawer.repositoryRole`)})]})]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>{let e=navigator.clipboard?.writeText(f.item.repository?.identity??``);if(!e){b(`error`);return}e.then(()=>b(`copied`)).catch(()=>b(`error`))},type:`button`,children:[(0,H.jsx)(lm,{size:15}),m(y===`copied`?`drawer.copyRepositoryDone`:`drawer.copyRepository`)]}),y===`error`?(0,H.jsx)(`p`,{className:`personal-copy-feedback is-error`,role:`status`,children:m(`drawer.copyRepositoryError`)}):y===`copied`?(0,H.jsx)(`p`,{className:`personal-copy-feedback`,role:`status`,children:m(`drawer.copyRepositorySuccess`)}):null]}):null,u?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,H.jsx)(`small`,{children:m(`drawer.larkConnection`)}),(0,H.jsx)(`h3`,{children:m(`drawer.remoteDetailsUnavailable`)}),(0,H.jsx)(`p`,{children:m(`drawer.remoteDetailsDescription`)})]}):(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,H.jsx)(`small`,{children:m(`drawer.larkConnection`)}),t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{children:[t.app_label,(0,H.jsx)(`span`,{className:`personal-connection-status`,children:m(`drawer.connected`)})]}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.group`)}),(0,H.jsx)(`dd`,{children:t.chat_name})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.topic`)}),(0,H.jsxs)(`dd`,{children:[`# `,t.topic_name]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.trigger`)}),(0,H.jsx)(`dd`,{children:t.incoming_mode===`mentions`?m(`lark.someoneMentions`):m(`lark.allMessages`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.replyMode`)}),(0,H.jsx)(`dd`,{children:m(`lark.topicReply`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.autoNotify`)}),(0,H.jsx)(`dd`,{children:e?.humanGateAutoNotifyEnabled?m(`common.on`):m(`common.off`)})]}),e?.lastNotifiedAt?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.lastNotification`)}),(0,H.jsx)(`dd`,{children:e.lastNotifiedAt})]}):null]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{children:m(`drawer.larkNotConfigured`)}),(0,H.jsx)(`p`,{children:m(`drawer.larkNotConfiguredDescription`)})]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onOpenNotificationSettings?.(f.item.goalId),type:`button`,children:[(0,H.jsx)(Zp,{size:16}),m(t?`drawer.larkConfigure`:`drawer.larkConnect`)]})]})]})})(),(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-session`,children:[(0,H.jsx)(`small`,{children:m(`drawer.runDetails`)}),he?.sessionId?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{children:Yi(he.sessionStatus??he.status,m)}),(0,H.jsx)(`p`,{children:he.title}),r.onOpenRunSession?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onOpenRunSession?.(he),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.runLatest`)]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{children:m(`drawer.noRun`)}),(0,H.jsx)(`p`,{children:m(`drawer.noRunDescription`)})]})]}),u?null:(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`heartbeat`,f.item.goalId),type:`button`,children:[(0,H.jsx)(Im,{size:16}),m(`drawer.setupHeartbeat`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`monitor`,f.item.goalId),type:`button`,children:[(0,H.jsx)(em,{size:16}),m(`drawer.scheduleAdd`)]})]}),f.item.subagentExecution?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-goal-subagents`,children:[(0,H.jsxs)(`div`,{className:`personal-subagent-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:m(`drawer.subagentLabel`)}),(0,H.jsxs)(`h3`,{children:[(0,H.jsx)(Qp,{size:16}),m(`drawer.subagentTitle`)]})]}),(0,H.jsxs)(`button`,{"aria-checked":Se.enabled,"aria-label":m(N&&j===`ready`?`drawer.subagentPending`:Se.enabled?`drawer.subagentDisable`:`drawer.subagentEnable`),className:`personal-subagent-switch`,"data-pending":N&&j===`ready`?`true`:void 0,disabled:u||Ce||!!N||!r.onPreviewGoalSubagentConfiguration,onClick:()=>void De(!Se.enabled),role:`switch`,type:`button`,children:[(0,H.jsx)(`span`,{}),m(N&&j===`ready`?`drawer.subagentPending`:Se.enabled?`common.on`:`common.off`)]})]}),(0,H.jsx)(`p`,{children:m(`drawer.subagentDescription`)}),N&&j===`ready`?(0,H.jsxs)(`div`,{className:`personal-subagent-preview`,children:[(0,H.jsx)(`strong`,{children:m(N.enabled?`drawer.subagentConfirmEnable`:`drawer.subagentConfirmDisable`)}),(0,H.jsx)(`p`,{children:N.enabled?m(`drawer.subagentPreviewSummary`,{count:N.maxChildren,domains:N.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)}):m(`drawer.subagentDisableSummary`)}),N.modelConfig===void 0?null:(0,H.jsxs)(`p`,{children:[m(`drawer.subagentModel`),`: `,N.modelConfig?.model||m(`drawer.subagentModelDefault`),` · `,N.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`button`,{className:`personal-primary-action`,onClick:()=>void Oe(),type:`button`,children:m(`common.confirm`)}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:Te,type:`button`,children:m(`common.cancel`)})]})]}):null,T?(0,H.jsxs)(`p`,{className:`personal-subagent-feedback is-${j}`,role:`status`,children:[j===`previewing`||j===`applying`?(0,H.jsx)(Rm,{className:`personal-spin`,size:13}):null,T]}):null,(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentModel`)}),(0,H.jsx)(`dd`,{children:Se.modelConfig?.model||m(`drawer.subagentModelDefault`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentEffort`)}),(0,H.jsx)(`dd`,{children:Se.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentCurrentBoundary`)}),(0,H.jsx)(`dd`,{children:Se.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.subagentChildLimit`)}),(0,H.jsx)(`dd`,{children:Se.maxChildren||0})]})]}),u?(0,H.jsx)(`p`,{className:`personal-subagent-read-only`,children:m(`drawer.subagentRemoteReadOnly`)}):(0,H.jsxs)(`div`,{className:`personal-subagent-fields`,children:[(0,H.jsxs)(`fieldset`,{className:`personal-subagent-domain-picker`,disabled:Ce,children:[(0,H.jsx)(`legend`,{children:m(`drawer.subagentDomains`)}),we.length>0?(0,H.jsx)(`div`,{className:`personal-subagent-domain-options`,children:we.map(e=>{let t=C.includes(e.value);return(0,H.jsxs)(`label`,{className:`personal-subagent-domain-option${t?` is-selected`:``}`,children:[(0,H.jsx)(`input`,{"aria-label":e.value,checked:t,onChange:t=>Ee(e.value,t.target.checked),type:`checkbox`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.value}),(0,H.jsx)(`small`,{children:m(`drawer.subagentDomainTodoCount`,{count:e.matchingTodoCount})})]})]},e.value)})}):(0,H.jsx)(`p`,{className:`personal-subagent-domain-empty`,children:m(`drawer.subagentDomainsEmpty`)}),(0,H.jsx)(`small`,{children:m(`drawer.subagentDomainsHint`)})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:m(`drawer.subagentModel`)}),(0,H.jsx)(`input`,{"aria-label":m(`drawer.subagentModel`),disabled:Ce,value:k,placeholder:`gpt-5.6-luna`,onChange:e=>{ee(e.target.value),P(null),M(`idle`),E(null)}})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:m(`drawer.subagentEffort`)}),(0,H.jsxs)(`select`,{"aria-label":m(`drawer.subagentEffort`),disabled:Ce,value:te,onChange:e=>{A(e.target.value),P(null),M(`idle`),E(null)},children:[(0,H.jsx)(`option`,{value:``,children:m(`drawer.subagentModelDefault`)}),[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`].map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]})]}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:Ce,type:`button`,onClick:()=>{ee(`gpt-5.6-luna`),A(`max`),P(null),M(`idle`),E(null)},children:m(`drawer.subagentLunaPreset`)}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:Ce,type:`button`,onClick:()=>{ee(``),A(``),P(null),M(`idle`),E(null)},children:m(`drawer.subagentClearModel`)}),(0,H.jsx)(`p`,{children:m(`drawer.subagentModelHint`)}),(0,H.jsxs)(`label`,{className:`personal-subagent-limit-field`,children:[(0,H.jsx)(`span`,{children:m(`drawer.subagentMaxChildren`)}),(0,H.jsx)(`select`,{"aria-label":m(`drawer.subagentMaxChildren`),disabled:Ce,onChange:e=>{O(Number(e.target.value)),P(null),M(`idle`),E(null)},value:D,children:eb.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})]}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,disabled:Ce,onClick:()=>void De(Se.enabled,!0),type:`button`,children:m(`drawer.subagentPreviewBoundary`)})]})]}):null]}):null,f.kind===`run`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{"aria-label":m(`drawer.runView`),className:`personal-run-drawer-tabs`,role:`tablist`,children:[(0,H.jsx)(`button`,{"aria-selected":x===`record`,onClick:()=>S(`record`),role:`tab`,type:`button`,children:m(`drawer.executionRecordAndResult`)}),(0,H.jsx)(`button`,{"aria-selected":x===`details`,onClick:()=>S(`details`),role:`tab`,type:`button`,children:m(`drawer.detailsAndActions`)})]}),x===`record`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card personal-session-summary`,children:[(0,H.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Yi(f.item.sessionStatus??f.item.status,m)]}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.latestActivity}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,H.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]})]})]}),(0,H.jsxs)(`section`,{"aria-label":m(`drawer.executionRecord`),className:`personal-session-message-record`,children:[(0,H.jsx)(`h3`,{children:m(`drawer.executionRecord`)}),f.item.sessionMessages?.length?(0,H.jsx)(`ol`,{children:f.item.sessionMessages.map(e=>(0,H.jsxs)(`li`,{className:`is-${e.role}`,children:[(0,H.jsx)(`i`,{}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:e.role===`user`?m(`drawer.runRoleUser`):e.role===`assistant`?m(`drawer.runRoleAssistant`):m(`drawer.runRoleSystem`)}),e.createdAt?(0,H.jsx)(`time`,{children:new Date(e.createdAt).toLocaleTimeString(p,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}):null]}),(0,H.jsx)(`p`,{children:e.text})]})]},e.messageId))}):(0,H.jsx)(`p`,{className:`personal-session-empty`,children:ge?m(`drawer.runRecordProjected`,{completed:f.item.completedSteps,outputs:f.item.outputs?.length?m(`drawer.runRecordProjectedOutputs`,{count:f.item.outputs.length}):``,total:f.item.totalSteps}):m(`drawer.runRecordEmpty`)}),f.item.status===`running`?(0,H.jsxs)(`div`,{className:`personal-session-active-step`,children:[(0,H.jsx)(`i`,{}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:m(`drawer.analysis`)}),(0,H.jsx)(`small`,{children:m(`drawer.agentWorking`)})]})]}):null]}),f.item.outputs?.length?(0,H.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-run-outputs-title`,children:[(0,H.jsx)(`h3`,{id:`personal-run-outputs-title`,children:m(`drawer.outputs`)}),(0,H.jsx)(`ol`,{children:f.item.outputs.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsx)(`small`,{children:e.createdAt??e.kind??m(`files.emptySummary`)})]})},e.outputId))})]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Yi(f.item.status,m)]}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.latestActivity}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,H.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.sessionStatus`)}),(0,H.jsx)(`dd`,{children:Yi(f.item.sessionStatus??f.item.status,m)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.sessionRecoverable`)}),(0,H.jsx)(`dd`,{children:f.item.resumable===!1?m(`drawer.resumeNo`):m(`drawer.resumeYes`)})]})]})]}),f.item.sessionStatus===`resume_failed`&&!u?(0,H.jsxs)(`section`,{className:`personal-recovery-panel`,"aria-label":m(`drawer.recoveryFailed`),children:[(0,H.jsx)(`strong`,{children:m(`drawer.recoveryFailed`)}),(0,H.jsx)(`p`,{children:m(`drawer.recoveryDescription`)}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,H.jsx)(Rm,{size:16}),m(`drawer.recoveryRetry`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.recoveryNewSession`)]})]}):null,u?null:(0,H.jsxs)(`section`,{className:`personal-correction-panel`,children:[(0,H.jsx)(`header`,{children:(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:16}),m(`drawer.correctionLabel`,{agent:f.item.agentLabel})]})}),(0,H.jsx)(`p`,{children:m(`drawer.correctionDescription`)}),(0,H.jsxs)(`div`,{className:`personal-correction-composer`,children:[(0,H.jsx)(`textarea`,{"aria-label":m(`drawer.correctionTextarea`,{agent:f.item.agentLabel,goal:f.item.goalTitle,run:f.item.title}),onChange:e=>g(e.target.value),placeholder:m(`drawer.correctionPlaceholder`),rows:3,value:h}),(0,H.jsx)(`button`,{"aria-label":m(`drawer.correctionSend`),disabled:!h.trim(),onClick:()=>void ye(),type:`button`,children:(0,H.jsx)(Vm,{size:16})})]})]}),u?null:(0,H.jsxs)(`details`,{className:`personal-compact-menu personal-run-more`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(fm,{size:17}),m(`drawer.moreRunActions`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{disabled:!f.item.canInterrupt,onClick:()=>void r.onInterruptRun?.(f.item),type:`button`,children:[(0,H.jsx)(Nm,{size:16}),m(`drawer.runInterrupt`)]}),(0,H.jsxs)(`button`,{disabled:f.item.resumable===!1,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,H.jsx)(Rm,{size:16}),m(`drawer.recoveryRetry`)]}),(0,H.jsxs)(`button`,{onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.runNewSession`)]}),(0,H.jsxs)(`button`,{onClick:()=>void r.onCloseRunSession?.(f.item),type:`button`,children:[(0,H.jsx)(Jm,{size:16}),m(`drawer.runCloseSession`)]})]})]})]})]}):null,f.kind===`output`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsx)(`small`,{children:f.item.kind??`output`}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.summary??m(`drawer.outputRecorded`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Goal`}),(0,H.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.outputTodo`)}),(0,H.jsx)(`dd`,{children:f.item.todoId??m(`drawer.notLinked`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.outputRun`)}),(0,H.jsx)(`dd`,{children:f.item.runId??m(`drawer.notLinked`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Agent`}),(0,H.jsx)(`dd`,{children:f.item.agentLabel??f.item.agentId??`LoopX`})]})]})]}),f.item.report?(0,H.jsxs)(`section`,{className:`personal-report-detail`,"data-testid":`personal-periodic-report-detail`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(`strong`,{children:[`+`,f.item.report.addedCount]}),m(`files.reportAdded`)]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:f.item.report.changedCount}),m(`files.reportChanged`)]})]}),(0,H.jsxs)(`p`,{children:[f.item.report.periodStartAt,` → `,f.item.report.periodEndAt]}),(0,H.jsx)(`ol`,{children:f.item.report.items.map(e=>(0,H.jsxs)(`li`,{"data-change-kind":e.changeKind,children:[(0,H.jsxs)(`small`,{children:[e.changeKind,` · `,e.status]}),(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsx)(`p`,{children:e.summary})]},e.sourceRef))}),(0,H.jsxs)(`footer`,{children:[(0,H.jsxs)(`span`,{children:[m(`files.reportPublication`),`: `,f.item.report.publicationId]}),(0,H.jsxs)(`span`,{children:[m(`files.reportGeneration`),`: `,f.item.report.generationId]})]})]}):null,f.item.safePreview?(0,H.jsx)(`pre`,{"aria-label":m(`drawer.outputSafePreview`),className:`personal-safe-preview`,children:f.item.safePreview}):(0,H.jsx)(`p`,{className:`personal-preview-unavailable`,children:m(`drawer.previewUnavailable`)}),(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:!r.onOpenOutput,onClick:()=>{r.onOpenOutput?.(f.item),c()},type:`button`,children:[(0,H.jsx)(pm,{size:16}),m(`files.openConversation`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!r.onExportOutput,onClick:()=>void r.onExportOutput?.(f.item),type:`button`,children:[(0,H.jsx)(dm,{size:16}),m(`files.exportSummary`)]})]})]}):null,f.kind===`proposal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-proposal-card`,children:[(0,H.jsxs)(`small`,{children:[f.item.actionKind,` · `,f.item.status]}),(0,H.jsx)(`h3`,{children:f.item.title}),(0,H.jsx)(`p`,{children:f.item.impact}),f.item.reviewPlan?(0,H.jsx)(`p`,{className:`personal-proposal-explainer`,"data-action-review":f.item.reviewPlan.interaction,children:f.item.actionKind===`operation.execute`&&f.item.status===`gated`?m(`actionReview.operation_group_confirmation`):f.item.actionKind===`operation.execute`&&f.item.reviewPlan.reason===`readback_unverified`?m(`actionReview.operation_result_delivery_pending`):m(`actionReview.${f.item.reviewPlan.reason}`)}):null,f.item.status===`ready`?(0,H.jsx)(`p`,{className:`personal-proposal-explainer`,children:m(`drawer.proposalExplainer`)}):null,(0,H.jsx)(`dl`,{children:f.item.fields.map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:e.label}),(0,H.jsx)(`dd`,{children:e.value})]},e.key))})]}),f.item.status===`applied`?(0,H.jsxs)(`p`,{className:`personal-proposal-state ${f.item.actionKind===`operation.execute`&&f.item.reviewPlan?.reason===`readback_unverified`?`is-gated`:`is-applied`}`,children:[(0,H.jsx)(tm,{size:16}),f.item.actionKind===`operation.execute`?f.item.primaryLabel:m(`drawer.proposalApplied`)]}):null,f.item.status===`applied`&&f.item.actionKind!==`operation.execute`&&f.item.goalId?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>{let e=f.item.goalId;c(),r.onOpenGoal?.(e)},type:`button`,children:[(0,H.jsx)(pm,{size:16}),f.item.actionKind===`goal.create`?m(`drawer.proposalEnterGoal`):m(`drawer.proposalViewGoal`)]}):null,f.item.status===`stale`?(0,H.jsx)(`p`,{className:`personal-proposal-state is-stale`,children:m(`drawer.proposalStale`)}):null,f.item.status===`error`?(0,H.jsxs)(`div`,{className:`personal-proposal-state is-error`,children:[(0,H.jsx)(`span`,{children:f.item.reviewPlan?.reason===`readback_unverified`?m(`actionReview.readback_unverified`):m(`drawer.proposalApplyFailed`)}),f.item.errorMessage?(0,H.jsx)(`small`,{children:f.item.errorMessage}):null,(0,H.jsx)(`small`,{children:m(`drawer.proposalApplyFailedHint`)})]}):null,f.item.status===`rejected`?(0,H.jsx)(`p`,{className:`personal-proposal-state is-error`,children:m(`drawer.proposalRejected`)}):null,f.item.status===`deferred`?(0,H.jsx)(`p`,{className:`personal-proposal-state is-gated`,children:m(`drawer.proposalDeferred`)}):null,f.item.status===`gated`?(0,H.jsxs)(`div`,{className:`personal-proposal-state is-gated`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:f.item.actionKind===`operation.execute`?f.item.primaryLabel:m(`drawer.gateRequiresHost`)}),f.item.actionKind===`operation.execute`?f.item.impact:m(`drawer.gateRequiresHostDescription`)]}),f.item.gate?.nextAction?(0,H.jsx)(`small`,{children:f.item.gate.nextAction}):null]}):null,f.item.status===`gated`&&f.item.actionKind===`gate.resolve`?(()=>{let e=e=>f.item.fields.find(t=>t.key===e)?.value,t=e(`goal_id`),n=e(`todo_id`);return!t||!n?null:(0,H.jsxs)(`section`,{className:`personal-detail-card personal-gate-cli-hint`,children:[(0,H.jsx)(`small`,{children:m(`drawer.gateApproveHint`)}),(0,H.jsxs)(`code`,{children:[`loopx todo complete --goal-id `,t,` --todo-id `,n,` --decision-outcome approve`]}),(0,H.jsx)(`small`,{children:m(`drawer.gateRejectHint`)})]})})():null,!u&&f.item.workspaceCandidates?.length?(0,H.jsx)(`div`,{className:`personal-workspace-candidates`,"aria-label":m(`drawer.workspaceCandidates`),children:f.item.workspaceCandidates.map(e=>(0,H.jsxs)(`button`,{onClick:()=>void r.onSelectWorkspaceCandidate?.(f.item,e.workspaceRef),type:`button`,children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsx)(`small`,{children:e.workspaceRef})]},e.workspaceRef))}):null,!u&&f.item.actionKind!==`operation.execute`&&f.item.status===`error`?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,H.jsx)(Rm,{size:17}),m(`drawer.proposalRegenerate`)]}):!u&&f.item.actionKind!==`operation.execute`&&f.item.status!==`gated`?(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:![`ready`,`deferred`].includes(f.item.status)||f.item.reviewPlan?.canApply===!1,onClick:()=>void r.onApplyProposal?.(f.item),type:`button`,children:[(0,H.jsx)(tm,{size:17}),f.item.status===`applying`?m(`drawer.applying`):f.item.primaryLabel??m(`drawer.apply`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&([`stale`,`gated`,`rejected`].includes(f.item.status)||f.item.status===`ready`&&f.item.reviewPlan?.canApply===!1)?(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,H.jsx)(Rm,{size:16}),m(`drawer.proposalRecheck`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&[`ready`,`gated`].includes(f.item.status)?(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`defer`),type:`button`,children:m(`drawer.proposalDefer`)}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`reject`),type:`button`,children:m(`drawer.decisionReject`)})]}):null,[`applied`,`applying`].includes(f.item.status)?null:(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:c,type:`button`,children:m(`drawer.proposalClose`)})]}):null,f.kind===`schedule`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,H.jsxs)(`small`,{children:[f.item.scheduleKind===`heartbeat`?`Goal Heartbeat`:`continuous_monitor`,` · `,f.item.status??`active`]}),(0,H.jsx)(`h3`,{children:f.item.label}),(0,H.jsx)(`p`,{children:f.item.target??f.item.schedule??m(`drawer.scheduleDefaultTarget`)}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleTimezone`)}),(0,H.jsx)(`dd`,{children:f.item.timezone??m(`drawer.scheduleLocalTimezone`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleNext`)}),(0,H.jsx)(`dd`,{children:f.item.nextRunAt??m(`drawer.schedulePending`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleLast`)}),(0,H.jsx)(`dd`,{children:f.item.previousRunAt??m(`drawer.scheduleNeverRun`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleNotification`)}),(0,H.jsx)(`dd`,{children:f.item.notificationRule??m(`drawer.scheduleDefaultNotification`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:m(`drawer.scheduleStopCondition`)}),(0,H.jsx)(`dd`,{children:f.item.stopCondition??m(`drawer.scheduleDefaultStop`)})]})]})]}),!u&&f.item.scheduleKind===`monitor`?(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`run_now`),type:`button`,children:[(0,H.jsx)(Pm,{size:16}),m(`drawer.scheduleRunNow`)]}):null,u?null:(0,H.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,f.item.status===`paused`?`resume`:`pause`),type:`button`,children:[f.item.status===`paused`?(0,H.jsx)(Pm,{size:16}):(0,H.jsx)(Nm,{size:16}),f.item.status===`paused`?m(`drawer.scheduleResume`):m(`drawer.schedulePause`)]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`edit`),type:`button`,children:[(0,H.jsx)(em,{size:16}),m(`drawer.scheduleEdit`)]})]}),u?null:(0,H.jsxs)(`button`,{className:`personal-danger-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`stop`),type:`button`,children:[(0,H.jsx)(Jm,{size:16}),m(`drawer.scheduleStop`,{kind:f.item.scheduleKind===`heartbeat`?` Heartbeat`:m(`drawer.titleSchedule`)})]}),(0,H.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-execution-history-title`,children:[(0,H.jsx)(`h3`,{id:`personal-execution-history-title`,children:m(`drawer.executionHistory`)}),f.item.executionHistory?.length?(0,H.jsx)(`ol`,{children:f.item.executionHistory.map((e,t)=>(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsx)(`small`,{children:e.timestamp})]}),(0,H.jsx)(`em`,{className:`is-${e.status}`,children:e.status})]},`${e.timestamp}:${e.runId??t}`))}):(0,H.jsx)(`p`,{children:m(`drawer.noExecutionHistory`)})]})]}):null,f.kind===`run`||f.kind===`proposal`||f.kind===`schedule`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{"aria-expanded":_,className:`personal-diagnostics-trigger`,onClick:()=>v(e=>!e),type:`button`,children:[(0,H.jsx)(`span`,{children:m(`drawer.advancedDiagnostics`)}),(0,H.jsx)(nm,{className:_?`is-open`:``,size:16})]}),_?(0,H.jsxs)(`div`,{className:`personal-diagnostics`,children:[(0,H.jsxs)(`code`,{children:[`goal_id: `,pe]}),(0,H.jsxs)(`code`,{children:[`kind: `,f.kind]}),f.kind===`run`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`code`,{children:[`session_id: `,f.item.sessionId??m(`drawer.notLinked`)]}),(0,H.jsxs)(`code`,{children:[`turn_id: `,f.item.turnId??m(`common.none`)]}),(0,H.jsxs)(`code`,{children:[`adapter: `,f.item.agentId]}),(0,H.jsxs)(`code`,{children:[`status: `,f.item.sessionStatus??f.item.status]})]}):f.kind===`proposal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`code`,{children:[`action: `,f.item.actionKind]}),(0,H.jsxs)(`code`,{children:[`status: `,f.item.status]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`code`,{children:[`schedule_id: `,f.item.scheduleId]}),(0,H.jsxs)(`code`,{children:[`status: `,f.item.status??`active`]})]})]}):null]}):null]})]})}var ab=[`checking`,`connecting`,`downloading`,`installing_app`,`installing_runtime`],ob={desktop_status_unavailable:[`无法读取 App 更新状态。请重启 App 后再试;若仍失败,请重新安装最新 App。`,`Cannot read the App update status. Restart the App; if this persists, reinstall the latest App.`],update_feed_unavailable:[`此通道的更新源尚未就绪或暂时不可用。可稍后重新检查,当前版本仍可继续使用。`,`This channel's update feed is not ready or temporarily unavailable. Check again later; you can keep using this version.`],update_feed_invalid:[`更新源格式异常。请稍后重新检查。`,`The update feed is invalid. Check again later.`],update_platform_unavailable:[`此通道尚无适用于本机的更新包。`,`This channel has no update package for this platform.`],update_check_timeout:[`检查更新超时。请稍后重试。`,`The update check timed out. Try again later.`],update_network_failed:[`无法连接更新服务器。请检查网络后重试。`,`Cannot reach the update server. Check your connection and retry.`],update_download_or_signature_failed:[`更新包下载或签名校验失败,尚未安装。请重新检查更新。`,`Download or signature verification failed; the update was not installed. Check for updates again.`]};function sb(e,t=`update_failed`){return{phase:`error`,details:{code:typeof e==`string`&&Object.hasOwn(ob,e)?e:t}}}function cb(){let{locale:e}=qi(),t=e===`zh-CN`,[n,r]=(0,V.useState)(!1),i=(0,V.useRef)(null),[a,o]=(0,V.useState)(`stable`),[s,c]=(0,V.useState)({phase:`idle`}),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(!1),p=(0,V.useRef)(!1),m=window.__TAURI__?.core.invoke,h=ab.includes(s.phase);(0,V.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>r(e.matches(`:popover-open`));return e.addEventListener(`toggle`,t),()=>e.removeEventListener(`toggle`,t)},[]),(0,V.useEffect)(()=>{if(!m)return;let e=!0;return m(`desktop_update_status`).then(t=>{if(!e)return;u(t.app_version),f(t.rollback_available===!0),t.state?.phase&&c(t.state);let n=t.state?.details?.channel??(t.app_version.includes(`-main.`)?`main`:`stable`);o(n),t.state?.phase||m(`desktop_update`,{action:`check`,channel:n}).then(t=>{e&&c(t)}).catch(t=>{e&&c(sb(t))})}).catch(()=>{e&&c(sb(null,`desktop_status_unavailable`))}),()=>{e=!1}},[m]),(0,V.useEffect)(()=>{if(!m||!h)return;let e=window.setInterval(()=>{m(`desktop_update_status`).then(e=>{e.state?.phase&&c(e.state)}).catch(()=>{})},1e3);return()=>window.clearInterval(e)},[m,h]);async function g(e){if(!(!m||p.current)){p.current=!0,c({phase:e===`check`?`checking`:e===`repair`?`installing_runtime`:`downloading`});try{if(!l){let e=await m(`desktop_update_status`);u(e.app_version),f(e.rollback_available===!0)}c(await m(`desktop_update`,{action:e,channel:a}))}catch(e){c(sb(e,l?`update_failed`:`desktop_status_unavailable`))}finally{p.current=!1}}}let _={service_error:t?`运行时已安装,但服务尚未连接。可重试更新、修复或恢复上版。`:`Runtime installed, but services are unavailable. Retry updates, repair, or restore the previous version.`,idle:t?`App 会检查可用更新,不会自动安装。`:`Updates are checked automatically, never installed without confirmation.`,runtime_required:t?`请完成匹配组件安装,或检查 App 更新。`:`Install matching components or check for an App update.`,connecting:t?`正在连接更新后的服务…`:`Connecting to updated services…`,checking:t?`正在检查更新…`:`Checking for updates…`,available:t?`新版本已就绪,一次更新 App 与匹配的运行时。`:`Update the App and its matching runtime together.`,up_to_date:t?`当前通道暂无更新。`:`No newer update on this channel.`,downloading:t?`正在下载并校验签名…`:`Downloading and verifying signature…`,installing_app:t?`正在安装 App,请保持窗口打开。`:`Installing the App. Keep this window open.`,installing_runtime:t?`正在安装匹配的运行时,请稍候…`:`Installing the matching runtime…`,restart_required:t?`重启后将自动完成运行时安装与服务连接。`:`Restart to finish runtime installation and reconnect services.`,ready:t?`更新完成,服务已就绪。`:`Update completed; services are ready.`,error:ob[s.details?.code??``]?.[+!t]??(t?`更新未完成。请重试;启动失败可尝试修复当前版本。`:`Update incomplete. Retry; repair this version if startup fails.`)},v=h?t?`正在更新…`:`Updating…`:s.phase===`available`?t?`有可用更新`:`Update available`:s.phase===`restart_required`?t?`重启完成更新`:`Restart to finish`:s.phase===`error`?t?`更新需重试`:`Retry update`:t?`更新 LoopX`:`Update LoopX`;return(0,H.jsxs)(`div`,{className:`personal-desktop-update`,children:[(0,H.jsxs)(`button`,{className:`personal-update-trigger`,type:`button`,"aria-expanded":n,"aria-controls":`desktop-update-panel`,onClick:e=>{i.current?.style.setProperty(`bottom`,`${window.innerHeight-e.currentTarget.getBoundingClientRect().top+8}px`),i.current?.togglePopover()},children:[(0,H.jsx)(dm,{size:16,"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:v}),(0,H.jsx)(im,{size:14,"aria-hidden":`true`})]}),(0,H.jsxs)(`section`,{ref:i,popover:`auto`,id:`desktop-update-panel`,className:`personal-update-panel`,"aria-label":t?`LoopX 更新`:`LoopX updates`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:t?`LoopX 更新`:`LoopX updates`}),(0,H.jsx)(`button`,{type:`button`,"aria-label":t?`关闭更新面板`:`Close updates`,onClick:()=>i.current?.hidePopover(),children:(0,H.jsx)(eh,{size:16,"aria-hidden":`true`})})]}),(0,H.jsxs)(`small`,{children:[l,` · `,a===`main`?t?`main 预览版`:`main preview`:t?`稳定版`:`Stable`]}),s.details?.version?(0,H.jsxs)(`p`,{children:[t?`目标版本:`:`Target: `,s.details.version]}):null,(0,H.jsxs)(`p`,{role:`status`,"aria-live":`polite`,children:[h?(0,H.jsx)(Lm,{className:`is-spinning`,size:14,"aria-hidden":`true`}):null,_[s.phase]]}),s.phase===`downloading`&&s.details?.total?(0,H.jsx)(`progress`,{"aria-label":t?`下载进度`:`Download progress`,max:s.details.total,value:s.details.received??0}):null,m?(0,H.jsx)(`div`,{className:`personal-update-actions`,children:s.phase===`restart_required`?(0,H.jsx)(`button`,{type:`button`,onClick:()=>void g(`restart`),children:t?`重启完成更新`:`Restart to finish`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void g(`check`),children:t?`检查更新`:`Check for updates`}),s.phase===`available`?(0,H.jsx)(`button`,{type:`button`,onClick:()=>void g(`apply`),children:t?`更新并准备重启`:`Install update`}):null]})}):(0,H.jsx)(`p`,{children:t?`请在 LoopX App 中更新;浏览器自身无需安装包。`:`Update from the LoopX App; the browser needs no installer.`}),(0,H.jsxs)(`details`,{children:[(0,H.jsx)(`summary`,{children:t?`高级选项`:`Advanced options`}),(0,H.jsxs)(`label`,{children:[t?`更新通道`:`Update channel`,(0,H.jsxs)(`select`,{disabled:h||s.phase===`restart_required`,value:a,onChange:e=>{o(e.target.value),c({phase:`idle`})},children:[(0,H.jsx)(`option`,{value:`stable`,children:t?`稳定版(推荐)`:`Stable (recommended)`}),(0,H.jsx)(`option`,{value:`main`,children:t?`main 预览版`:`main preview`})]})]}),(0,H.jsx)(`p`,{children:t?`App 与匹配的 CLI 一起更新,服务可能短暂断开。不删除 Goal 数据。`:`Updates the App and matching CLI. Services may briefly disconnect. Goal data is not deleted.`}),m?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{children:t?`启动失败时,可重装当前 App 随附的运行时。`:`If startup fails, reinstall this App's bundled runtime.`}),(0,H.jsx)(`button`,{disabled:h||s.phase===`restart_required`,type:`button`,onClick:()=>void g(`repair`),children:t?`修复当前版本`:`Repair this version`})]}):null,m&&d?(0,H.jsxs)(`details`,{children:[(0,H.jsx)(`summary`,{children:t?`恢复上个版本`:`Restore previous version`}),(0,H.jsx)(`p`,{children:t?`将恢复已保留的 App 和它的运行时,需要重启。`:`Restore the retained App and its runtime, then restart.`}),(0,H.jsx)(`button`,{disabled:h,type:`button`,onClick:()=>void g(`rollback`),children:t?`确认恢复上版`:`Restore previous version`})]}):null]})]})]})}var lb=e=>`loopx-sidebar-goal-order-v1:${encodeURIComponent(e)}`;function ub(e){try{let t=JSON.parse(e??`null`);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?[...new Set(t)]:[]}catch{return[]}}function db(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.goalId)??1/0)-(n.get(t.goalId)??1/0))}function fb(e,t,n,r,i){if(n===r||!t.includes(n)||!t.includes(r))return e;let a=[...new Set([...e,...t])].filter(e=>e!==n);return a.splice(a.indexOf(r)+Number(i),0,n),a}function pb(e,t){let n=lb(t),[r,i]=(0,V.useState)(()=>{try{return ub(localStorage.getItem(n))}catch{return[]}}),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),d=(0,V.useRef)(null),f=(0,V.useRef)(!1),p=db(e,r),m=p.map(e=>e.goalId);function h(t,a,s){let l=fb(r,m,t,a,s);if(l===r)return;i(l);let u=db(e,l),d=u.findIndex(e=>e.goalId===t),f=u[d];f&&c({title:f.title,position:d+1});try{localStorage.setItem(n,JSON.stringify(l)),o(!1)}catch{o(!0)}}function g(){d.current=null,u(null)}return{sorted:p,target:l,saveFailed:a,lastMoved:s,move:h,moveBy(e,t){let n=p[m.indexOf(e)+t];n&&h(e,n.goalId,t===1)},pointerProps:e=>({onPointerDown(t){f.current=!1,t.pointerType===`mouse`&&t.button===0&&(d.current={id:e,x:t.clientX,y:t.clientY,dragging:!1},t.currentTarget.setPointerCapture(t.pointerId))},onPointerMove(e){let t=d.current;if(!t||!t.dragging&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<6)return;t.dragging=!0,f.current=!0;let n=document.elementFromPoint(e.clientX,e.clientY)?.closest(`[data-reorder-goal]`),r=e.currentTarget.closest(`.personal-goal-list`),i=n?.dataset.reorderGoal;if(!n||!i||!r?.contains(n)||i===t.id){u(null);return}let a=n.getBoundingClientRect();u({id:i,after:e.clientY>a.top+a.height/2})},onPointerUp(){d.current?.dragging&&l&&h(d.current.id,l.id,l.after),g()},onPointerCancel:g,onLostPointerCapture:g,onKeyDown(e){e.key===`Escape`&&g()},onClickCapture(e){f.current&&=(e.preventDefault(),e.stopPropagation(),!1)}})}}var mb=`/ssh-hosts`,hb=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/;function gb(e){return typeof e==`string`&&hb.test(e.trim())}function _b(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`SSH Host 列表响应无效。`);let t=e;if(t.ok!==!0||t.schema_version!==`ssh_host_catalog_v0`||!Array.isArray(t.hosts))throw Error(`SSH Host 列表协议不兼容,请更新本机 LoopX 服务。`);let n=new Set;return{hosts:t.hosts.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=String(e.alias??``).trim();return!gb(t)||n.has(t)?[]:(n.add(t),[{alias:t}])}),schemaVersion:`ssh_host_catalog_v0`}}async function vb(e=fetch,t=mb){let n=await e(t,{cache:`no-store`});if(!n.ok)throw Error(`无法读取本机 SSH Host(HTTP ${n.status})。`);return _b(await n.json())}function yb(e,t){let n=e.trim();if(!gb(n))return{error:`请选择有效的 SSH Host。`};let r=Number(t);return!Number.isInteger(r)||r<1024||r>65535?{error:`本地端口必须是 1024–65535 之间的整数。`}:{command:`ssh -N -L ${r}:127.0.0.1:8766 ${n}`,hostAlias:n,label:n,statusUrl:`http://127.0.0.1:${r}/status.json`}}var bb=`/api/ssh-source/ensure`,xb=`/api/ssh-source/goal-lifecycle`;async function Sb(e,t){let n=await fetch(bb,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({host_alias:e,local_port:Number(t)})}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error??`无法建立 SSH 隧道来源。`);if(!r?.ok)throw Error(`无法建立 SSH 隧道来源。`);return r}async function Cb(e,t,n,r,i=fetch){let a=await i(xb,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({goal_id:t,host_alias:e,operation:n,reason:r})}),o=await a.json().catch(()=>null);if(!a.ok)throw Error(o?.error??`无法更新远端 Goal 生命周期。`);if(!o?.ok||o.schema_version!==`loopx_remote_goal_lifecycle_v1`||o.goal_id!==t||o.host_alias!==e||o.operation!==n||o.activation_state!==(n===`stop`?`stopped`:`active`)||o.projection_verified!==!0)throw Error(`远端 Goal 生命周期回读未验证。`);return o}function wb({activeSource:e,connectionState:t,errorMessage:n,onAdd:r,onConfiguredHostsLoaded:i,onRemove:a,onSelect:o,sources:s}){let{t:c}=qi(),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)(`configured`),[h,g]=(0,V.useState)([]),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(``),[T,E]=(0,V.useState)(``),[D,O]=(0,V.useState)(`8876`),[k,ee]=(0,V.useState)(``),te=`configured:`,A=[...s.map(e=>({label:e.label,value:e.id})),...h.filter(e=>!s.some(t=>t.label===e.alias)).map(e=>({group:c(`source.configuredGroup`,{count:h.length}),label:e.alias,value:`${te}${e.alias}`}))],j=(0,V.useMemo)(()=>h.some(e=>e.alias===C)?yb(C,D):{error:c(`source.selectHost`)},[h,C,D,c]);(0,V.useEffect)(()=>{M()},[]);async function M(){b(!0),v(null);try{let e=await vb();g(e.hosts),i?.(e.hosts.map(e=>e.alias)),w(t=>t||e.hosts[0]?.alias||``),e.hosts.length||v(c(`source.hostEmpty`))}catch(e){v(e instanceof Error?e.message:c(`source.hostLoadError`))}finally{b(!1)}}function N(){u(!0),m(`configured`),f(null),M()}function P(){u(!1),m(`configured`),v(null),S(!1),w(``),f(null),E(``),O(`8876`),ee(``)}function F(){let e=r({label:T,statusUrl:k});if(e.error){f(e.error);return}P()}function ne(){if(`error`in j){f(j.error??c(`source.invalid`));return}let e=r({ensureTunnel:!0,hostAlias:j.hostAlias,label:j.label,statusUrl:j.statusUrl});if(e.error){f(e.error);return}P()}function re(e){let t=new Set;for(let e of s)try{t.add(new URL(e.statusUrl).port)}catch{}let n=`8877`;for(let e=8877;e<9077;e+=1)if(!t.has(String(e))){n=String(e);break}let i=yb(e,n);if(`error`in i){f(i.error??c(`source.invalid`));return}let a=r({ensureTunnel:!0,hostAlias:i.hostAlias,label:i.label,statusUrl:i.statusUrl});a.error?f(a.error):f(null),O(n)}async function I(){if(`error`in j){f(j.error??c(`source.invalid`));return}try{await navigator.clipboard.writeText(j.command),S(!0),f(null)}catch{f(c(`source.copyError`))}}return(0,H.jsxs)(`section`,{"aria-label":c(`source.controlPlane`),className:`personal-status-source`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`span`,{children:`Control plane`}),(0,H.jsx)(`button`,{"aria-label":c(`source.addSsh`),onClick:N,title:c(`source.add`),type:`button`,children:(0,H.jsx)(Fm,{size:14})})]}),(0,H.jsx)(Dy,{ariaLabel:c(`source.select`),className:`personal-status-source-select`,icon:(0,H.jsx)(Um,{size:15}),onChange:e=>{if(e.startsWith(te)){re(e.slice(11));return}o(e)},options:A,value:e.id}),(0,H.jsxs)(`div`,{className:`personal-status-source-meta`,children:[(0,H.jsxs)(`span`,{className:`is-${t}`,children:[(0,H.jsx)(`i`,{}),c(t===`loading`?`source.connecting`:t===`error`?`source.notAvailable`:`source.connected`)]}),(0,H.jsx)(`small`,{children:e.readOnly?c(`source.readOnly`):c(`source.localInteractive`)}),e.kind===`ssh_tunnel`?(0,H.jsx)(`button`,{"aria-label":c(`source.remove`,{source:e.label}),onClick:()=>a(e.id),title:c(`source.removeCurrent`),type:`button`,children:(0,H.jsx)(Zm,{size:12})}):null]}),n?(0,H.jsx)(`p`,{className:`personal-status-source-error`,role:`alert`,children:n}):null,l?(0,H.jsxs)(`div`,{className:`personal-status-source-form`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:c(`source.addSsh`)}),(0,H.jsx)(`button`,{"aria-label":c(`source.closeForm`),onClick:P,type:`button`,children:(0,H.jsx)(eh,{size:13})})]}),(0,H.jsxs)(`div`,{"aria-label":c(`source.addMethod`),className:`personal-status-source-modes`,role:`tablist`,children:[(0,H.jsx)(`button`,{"aria-selected":p===`configured`,onClick:()=>{m(`configured`),f(null)},role:`tab`,type:`button`,children:c(`source.configured`)}),(0,H.jsx)(`button`,{"aria-selected":p===`manual`,onClick:()=>{m(`manual`),f(null)},role:`tab`,type:`button`,children:c(`source.manual`)})]}),p===`configured`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.configuredCount`,{count:h.length})}),(0,H.jsxs)(`span`,{className:`personal-status-source-field-row`,children:[(0,H.jsx)(`input`,{"aria-label":c(`source.host`),disabled:y||!h.length,list:`loopx-configured-ssh-hosts`,onChange:e=>{w(e.target.value),S(!1)},placeholder:c(y?`source.loadingHosts`:`source.hostPlaceholder`),value:C}),(0,H.jsx)(`datalist`,{id:`loopx-configured-ssh-hosts`,children:h.map(e=>(0,H.jsx)(`option`,{value:e.alias},e.alias))}),(0,H.jsx)(`button`,{"aria-label":c(`source.refreshHosts`),disabled:y,onClick:()=>void M(),title:c(`source.refreshHosts`),type:`button`,children:(0,H.jsx)(zm,{size:13})})]})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.localPort`)}),(0,H.jsx)(`input`,{"aria-label":c(`source.localPort`),inputMode:`numeric`,onChange:e=>{O(e.target.value),S(!1)},value:D})]}),(0,H.jsxs)(`div`,{className:`personal-status-source-command`,children:[(0,H.jsx)(`code`,{children:`error`in j?c(`source.tunnelCommandPending`):j.command}),(0,H.jsxs)(`button`,{"aria-label":c(`source.copyCommand`),disabled:`error`in j,onClick:()=>void I(),type:`button`,children:[(0,H.jsx)(lm,{size:12}),c(x?`source.copied`:`source.copy`)]})]}),_?(0,H.jsx)(`p`,{className:`is-error`,children:_}):null,(0,H.jsx)(`p`,{children:c(`source.description`)}),(0,H.jsx)(`button`,{className:`personal-status-source-add`,disabled:`error`in j,onClick:ne,type:`button`,children:c(`source.addConfigured`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.name`)}),(0,H.jsx)(`input`,{autoFocus:!0,maxLength:48,onChange:e=>E(e.target.value),placeholder:c(`source.namePlaceholder`),value:T})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:c(`source.statusUrl`)}),(0,H.jsx)(`input`,{onChange:e=>ee(e.target.value),placeholder:`http://127.0.0.1:8876/status.json`,value:k})]}),(0,H.jsx)(`p`,{children:(0,H.jsx)(`code`,{children:`ssh -N -L 8876:127.0.0.1:8766 `})}),(0,H.jsx)(`p`,{children:c(`source.manualDescription`)}),(0,H.jsx)(`button`,{className:`personal-status-source-add`,onClick:F,type:`button`,children:c(`source.addConfigured`)})]}),d?(0,H.jsx)(`p`,{className:`is-error`,role:`alert`,children:d}):null]}):null]})}var Tb={需修复:`is-danger`,等你:`is-warning`,等待条件:`is-info`,推进中:`is-success`,安静运行:`is-quiet`,已完成:`is-quiet`,已停止:`is-stopped`};function Eb({attentionCount:e,goals:t,goalArchiveLoadState:n={error:null,phase:`ready`},lifecycleBusyGoalIds:r,goalLifecycleOperations:i,onRequestGoalCreate:a,onOpenSettings:o,onRetryGoalArchive:s,onRequestGoalLifecycle:c,onSelectGoal:l,selectedGoalId:u,statusSourceControl:d}){let{locale:f,t:p}=qi(),[m,h]=(0,V.useState)(!1),g=pb(t.filter(e=>e.activationState!==`stopped`),d?.activeSource.statusUrl??`/status.json`),_=g.sorted,v=t.filter(e=>e.activationState===`stopped`),y=e=>!!c&&(!i||i.includes(e)),b=(e,t)=>(0,H.jsxs)(`div`,{className:`personal-goal-row${g.target?.id===e.goalId?g.target.after?` is-drop-after`:` is-drop-before`:``}`,"data-reorder-goal":t?void 0:e.goalId,"data-load-error":e.loadError,children:[(0,H.jsxs)(`button`,{...t?{}:g.pointerProps(e.goalId),title:t?void 0:p(`sidebar.dragGoal`),"aria-current":u===e.goalId?`page`:void 0,className:`personal-goal-link`,onClick:()=>l(e.goalId),type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-goal-state-dot ${e.loadState?``:Tb[e.state]}`}),(0,H.jsxs)(`span`,{className:`personal-goal-link-copy`,children:[(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsxs)(`small`,{children:[e.loadState&&(!t||u===e.goalId)?p(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Ji(e.state,f),e.needsYou&&!t?` · ${p(`home.lane.needsYou`)}`:``]})]}),(0,H.jsx)(rm,{size:15})]}),!t&&m?(0,H.jsxs)(`div`,{className:`personal-goal-move-actions`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":p(`sidebar.moveUp`,{goal:e.title}),disabled:_[0]?.goalId===e.goalId,onClick:()=>g.moveBy(e.goalId,-1),children:(0,H.jsx)(Yp,{"aria-hidden":`true`,size:13})}),(0,H.jsx)(`button`,{type:`button`,"aria-label":p(`sidebar.moveDown`,{goal:e.title}),disabled:_.at(-1)?.goalId===e.goalId,onClick:()=>g.moveBy(e.goalId,1),children:(0,H.jsx)(Gp,{"aria-hidden":`true`,size:13})})]}):null,c&&y(t?`resume`:`stop`)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{"aria-label":`${p(t?`sidebar.resume`:`sidebar.stop`)} ${e.title}`,"aria-busy":r?.has(e.goalId)||void 0,className:`personal-goal-lifecycle${r?.has(e.goalId)?` is-pending`:``}`,disabled:r?.has(e.goalId),onClick:()=>c(e,t?`resume`:`stop`),title:p(t?`sidebar.resumeGoal`:`sidebar.stopGoal`),type:`button`,children:r?.has(e.goalId)?(0,H.jsx)(wm,{size:13}):t?(0,H.jsx)(Rm,{size:13}):(0,H.jsx)(Nm,{size:13})}),t&&y(`delete`)?(0,H.jsx)(`button`,{"aria-label":`${p(`sidebar.delete`)} ${e.title}`,className:`personal-goal-lifecycle personal-goal-delete`,onClick:()=>c(e,`delete`),title:p(`sidebar.deleteGoal`),type:`button`,children:(0,H.jsx)(Zm,{size:13})}):null]}):null]},e.goalId);return(0,H.jsxs)(`div`,{className:`personal-goal-directory`,children:[(0,H.jsxs)(`div`,{className:`personal-sidebar-brand`,children:[(0,H.jsx)(`span`,{className:`personal-brand-mark`,children:(0,H.jsx)(Qp,{size:18})}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:`LoopX`})})]}),d?(0,H.jsx)(wb,{...d}):null,(0,H.jsxs)(`nav`,{"aria-label":p(`home.workspace`),className:`personal-sidebar-nav`,children:[(0,H.jsxs)(`button`,{"aria-current":u===null?`page`:void 0,className:`personal-manager-link`,onClick:()=>l(null),type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-manager-icon`,children:(0,H.jsx)(Qp,{size:17})}),(0,H.jsx)(`span`,{children:p(`sidebar.manager`)}),e>0?(0,H.jsx)(`span`,{className:`personal-sidebar-count`,children:e}):null,(0,H.jsx)(rm,{size:15})]}),(0,H.jsxs)(`div`,{className:`personal-sidebar-section-title`,children:[(0,H.jsx)(`span`,{children:`Goals`}),(0,H.jsxs)(`span`,{className:`personal-sidebar-title-actions`,children:[(0,H.jsx)(`small`,{children:_.length}),(0,H.jsx)(`button`,{"aria-label":p(`sidebar.sortGoals`),title:p(`sidebar.sortGoals`),"aria-pressed":m,onClick:()=>h(!m),type:`button`,children:(0,H.jsx)(Jp,{"aria-hidden":`true`,size:15})}),a?(0,H.jsx)(`button`,{"aria-label":p(`sidebar.createGoal`),onClick:a,type:`button`,children:(0,H.jsx)(Fm,{size:15})}):null]})]}),g.saveFailed?(0,H.jsx)(`p`,{role:`status`,children:p(`sidebar.orderNotSaved`)}):null,(0,H.jsx)(`span`,{className:`personal-sr-only`,role:`status`,children:g.lastMoved?p(`sidebar.goalMoved`,{goal:g.lastMoved.title,position:g.lastMoved.position}):``}),(0,H.jsx)(`div`,{className:`personal-goal-list`,children:_.map(e=>b(e,!1))}),v.length||n.phase===`loading`||n.phase===`error`?(0,H.jsxs)(`details`,{className:`personal-stopped-goals`,open:n.phase===`error`||void 0,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(nm,{size:13}),(0,H.jsx)(`span`,{children:p(`sidebar.stopped`)}),n.phase===`loading`?(0,H.jsx)(wm,{"aria-label":p(`sidebar.stoppedLoading`),className:`is-spinning`,size:13}):(0,H.jsx)(`small`,{children:v.length})]}),(0,H.jsxs)(`div`,{className:`personal-goal-list is-stopped`,children:[n.phase===`error`?(0,H.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`alert`,children:[(0,H.jsx)(`span`,{children:p(`sidebar.stoppedLoadFailed`)}),s?(0,H.jsx)(`button`,{onClick:s,type:`button`,children:p(`sidebar.retryStopped`)}):null]}):null,v.map(e=>b(e,!0))]})]}):null]}),(0,H.jsxs)(`div`,{className:`personal-sidebar-footer`,children:[(0,H.jsx)(cb,{}),o?(0,H.jsxs)(`button`,{"aria-label":p(`settings.open`),className:`personal-sidebar-utility`,onClick:o,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-sidebar-utility-icon`,children:(0,H.jsx)(Wm,{size:17})}),(0,H.jsx)(`span`,{className:`personal-sidebar-utility-copy`,children:(0,H.jsx)(`strong`,{children:p(`settings.open`)})}),(0,H.jsx)(rm,{"aria-hidden":`true`,size:15})]}):null]})]})}var Db=Y({ok:X(!0),total:K().int().nonnegative(),next_cursor:G().nullable(),items:J(Y({todo_id:G(),text:G(),claimed_by:G().nullable(),evidence:G().nullable(),priority:G().nullable(),task_class:G().nullable()})).max(40)});function Ob({goal:e,agentId:t,seed:n,enabled:r,listView:i=!1,onSelect:a}){let{t:o}=qi(),s=(0,V.useId)(),[c,l]=(0,V.useState)(!1),u=!i||c,d=i?96:148,[f,p]=(0,V.useState)(n),[m,h]=(0,V.useState)(t===`all`?e.doneTodoCount??n.length:n.length),[g,_]=(0,V.useState)(void 0),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(!1),[w,T]=(0,V.useState)({top:0,height:600}),[E,D]=(0,V.useState)(null),O=(0,V.useRef)(null),k=(0,V.useRef)(null),[ee,te]=(0,V.useState)(0);(0,V.useEffect)(()=>{let e=O.current;if(!e)return;let t=new ResizeObserver(()=>T({top:e.scrollTop,height:e.clientHeight}));return t.observe(e),()=>{t.disconnect(),k.current?.abort()}},[]);let A=g===void 0||w.top+w.height>=f.length*d-d*2;(0,V.useEffect)(()=>{if(!r||!u||!A||g===null||b||k.current)return;let n=new AbortController;k.current=n,y(!0);let i=new URLSearchParams({goal_id:e.goalId});t!==`all`&&i.set(`agent_id`,t),g&&i.set(`cursor`,g),fetch(`/api/chat/completed-todos?${i}`,{signal:n.signal}).then(async e=>{if(e.status===409&&C(!0),!e.ok)throw Error(`history unavailable`);let t=Db.parse(await e.json());if(n.signal.aborted)return;let r=t.items.map(e=>({todoId:e.todo_id,text:e.text,claimedBy:e.claimed_by,evidence:e.evidence,priority:e.priority,taskClass:e.task_class,done:!0,status:`done`}));p(e=>g===void 0?r:[...e,...r.filter(t=>!e.some(e=>e.todoId===t.todoId))]),h(t.total),_(t.next_cursor)}).catch(()=>{n.signal.aborted||x(!0)}).finally(()=>{n.signal.aborted||(k.current=null,y(!1))})},[r,u,A,g,b,ee,e.goalId,t,v]),(0,V.useEffect)(()=>{O.current&&(O.current.scrollTop=0),T({top:0,height:O.current?.clientHeight??600}),D(null)},[i]);let j=Math.max(0,Math.floor(w.top/d)-3),M=Math.min(f.length,Math.ceil((w.top+w.height)/d)+3),N=Array.from({length:Math.max(0,M-j)},(e,t)=>j+t);return E!==null&&El(e=>!e),children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,children:c?`▾`:`▸`}),` `,o(`tasks.completed`)]}):(0,H.jsxs)(`strong`,{children:[(0,H.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-done`}),o(`tasks.completed`)]}),(0,H.jsx)(`span`,{children:m})]}),(0,H.jsxs)(`div`,{id:s,hidden:!u,"aria-label":o(`tasks.completed`),className:`personal-task-lane-scroll`,ref:O,role:`region`,tabIndex:0,onScroll:e=>T({top:e.currentTarget.scrollTop,height:e.currentTarget.clientHeight}),children:[(0,H.jsx)(`div`,{className:`personal-completed-window`,style:{height:f.length*d},children:N.map(t=>{let n=f[t];return(0,H.jsx)(`div`,{className:`personal-task-card personal-completed-row`,style:{top:t*d,height:d},children:(0,H.jsxs)(`button`,{type:`button`,onFocus:()=>D(t),onBlur:()=>D(null),onClick:()=>a({kind:`todo`,item:{...n,goalId:e.goalId,goalTitle:e.title,ownerLabel:n.claimedBy??e.agentLabel??e.agentId}}),children:[(0,H.jsx)(`span`,{className:`is-done`,children:`✓`}),(0,H.jsx)(`strong`,{children:n.text}),(0,H.jsx)(`small`,{children:n.claimedBy??e.agentLabel??e.agentId})]})},n.todoId)})}),(0,H.jsx)(`div`,{className:`personal-completed-footer`,role:`status`,children:v?o(`tasks.historyLoading`):b?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:o(S?`tasks.historyExpired`:`tasks.historyError`)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{S&&(_(void 0),O.current&&(O.current.scrollTop=0)),C(!1),x(!1),te(e=>e+1)},children:o(`tasks.historyRetry`)})]}):r?g===null?o(`tasks.historyEnd`):(0,H.jsx)(`button`,{type:`button`,onClick:()=>{O.current&&(O.current.scrollTop=f.length*d)},children:o(`tasks.historyMore`)}):o(`tasks.historyLocalOnly`)})]})]})}function kb({children:e,count:t,label:n,tone:r,listView:i=!1}){let a=(0,V.useId)(),o=(0,V.useRef)(null),s=(0,V.useRef)([]),c=(0,V.useRef)(null),[l,u]=(0,V.useState)({after:!1,before:!1}),d=(0,V.useCallback)(()=>{let e=o.current;if(!e)return;let t={after:Math.max(0,e.scrollHeight-e.clientHeight)-e.scrollTop>1,before:e.scrollTop>1};u(e=>e.after===t.after&&e.before===t.before?e:t)},[]);return(0,V.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(d);return c.current=t,t.observe(e),e.addEventListener(`scroll`,d,{passive:!0}),d(),()=>{t.disconnect(),c.current=null,s.current=[],e.removeEventListener(`scroll`,d)}},[i,d]),(0,V.useEffect)(()=>{let e=o.current,t=c.current;if(!e||!t)return;for(let e of s.current)t.unobserve(e);let n=Array.from(e.children).filter(e=>e instanceof HTMLElement);for(let e of n)t.observe(e);s.current=n,d()},[e,t,i,d]),i?!t&&r!==`done`?null:(0,H.jsxs)(`details`,{className:`personal-task-group tone-${r}`,open:!0,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(nm,{size:16}),(0,H.jsx)(`strong`,{children:n}),(0,H.jsx)(`span`,{children:t})]}),(0,H.jsx)(`div`,{className:`personal-task-list-rows`,children:e})]}):(0,H.jsxs)(`section`,{className:`personal-object-list personal-task-lane`,children:[(0,H.jsxs)(`header`,{id:a,children:[(0,H.jsxs)(`strong`,{children:[(0,H.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-${r}`}),n]}),(0,H.jsx)(`span`,{children:t})]}),(0,H.jsx)(`div`,{"aria-labelledby":a,className:`personal-task-lane-scroll${l.before?` has-overflow-before`:``}${l.after?` has-overflow-after`:``}`,ref:o,role:`region`,tabIndex:t>0?0:-1,children:e})]})}function Ab({historyEnabled:e=!1,goal:t,items:n,onDraftTaskFromMessage:r,onOpenChat:i,onQuickComplete:a,quickCompletingTodoIds:o,onSelect:s,selectedTodoId:c=null,userTodos:l}){let{t:u}=qi(),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)({goalId:``,laneId:`all`}),h=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!c)return;let e=window.requestAnimationFrame(()=>h.current?.scrollIntoView({block:`nearest`,inline:`nearest`}));return()=>window.cancelAnimationFrame(e)},[c]);let g=l.filter(e=>e.goalId===t.goalId).map(e=>({...e,goalTitle:t.title})),_=e=>e.priority===`P0`?0:e.priority===`P1`?1:e.priority===`P2`?2:3,v=(0,V.useMemo)(()=>{let e=new Map((t.agentLanes??[]).map(e=>[e.agentId,e]));for(let n of t.agentTodos)n.claimedBy&&!e.has(n.claimedBy)&&e.set(n.claimedBy,{agentId:n.claimedBy,label:n.claimedBy});return[...e.values()]},[t.agentLanes,t.agentTodos]),y=p.goalId===t.goalId&&v.some(e=>e.agentId===p.laneId)?p.laneId:`all`,b=e=>y===`all`||e===y,x=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&!e.done).filter(e=>b(e.claimedBy)).sort((e,t)=>_(e)-_(t)),S=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&e.done).filter(e=>b(e.claimedBy)),C=n.filter(e=>e.kind===`schedule`&&b(e.schedule.agentId)),w=n.filter(e=>e.kind===`run`&&!!e.run.todoId&&b(e.run.agentId)),T=!g.length&&!x.length&&!S.length&&!C.length,E=n.filter(e=>e.kind===`message`&&(e.message.role===`user`||e.message.role===`assistant`)),D=E.reduce((e,t,n)=>t.message.role===`user`?n:e,-1),O=D>=0?E[D]?.message:null,k=D>=0?E.slice(D+1).reverse().find(e=>e.message.role===`assistant`)?.message:null,ee=D>=0&&E.slice(D+1).some(e=>e.message.role===`assistant`&&e.message.pending);return(0,H.jsxs)(`section`,{"aria-label":u(`header.tasks`),className:`personal-task-board${d?` is-list-view`:``}`,children:[(0,H.jsxs)(`header`,{className:`personal-task-view-toolbar`,children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(`strong`,{children:u(`header.tasks`)})}),(0,H.jsxs)(`div`,{className:`personal-task-view-switch`,role:`group`,"aria-label":u(`tasks.viewLabel`),children:[(0,H.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(!0),children:u(`tasks.listView`)}),(0,H.jsx)(`button`,{type:`button`,"aria-pressed":!d,onClick:()=>f(!1),children:u(`tasks.boardView`)})]})]}),v.length>1?(0,H.jsxs)(`section`,{"aria-label":u(`tasks.agentLaneFilter`),className:`personal-task-lane-filter`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Qp,{size:15}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:u(`tasks.agentLane`)})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`sr-only`,children:u(`tasks.agentLaneFilter`)}),(0,H.jsxs)(`select`,{"aria-label":u(`tasks.agentLaneFilter`),onChange:e=>m({goalId:t.goalId,laneId:e.target.value}),value:y,children:[(0,H.jsx)(`option`,{value:`all`,children:u(`tasks.allAgentLanes`,{count:v.length})}),v.map(e=>(0,H.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))]}),(0,H.jsx)(nm,{"aria-hidden":!0,size:14})]})]}):null,O?(0,H.jsxs)(`section`,{"aria-label":u(`tasks.chatRecent`),className:`personal-task-chat-receipt`,children:[(0,H.jsx)(`span`,{className:`personal-task-chat-icon`,children:(0,H.jsx)(Om,{size:18})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:u(ee?`tasks.chatPending`:k?`tasks.chatAgentReplied`:`tasks.chatRecent`)}),(0,H.jsx)(`small`,{children:t.agentLabel??t.agentId})]}),(0,H.jsxs)(`p`,{className:`is-user`,children:[(0,H.jsx)(`b`,{children:u(`common.you`)}),O.text]}),k&&!k.pending?(0,H.jsxs)(`p`,{className:`is-assistant`,children:[(0,H.jsx)(`b`,{children:u(`common.agent`)}),k.text]}):null,(0,H.jsx)(`small`,{children:u(ee?`tasks.chatPendingDescription`:`tasks.chatUnchangedDescription`)})]}),(0,H.jsxs)(`footer`,{children:[(0,H.jsxs)(`button`,{onClick:i,type:`button`,children:[(0,H.jsx)(Om,{size:14}),u(`tasks.chatViewReply`)]}),k&&!ee&&r?(0,H.jsxs)(`button`,{onClick:()=>r(k.text),type:`button`,children:[(0,H.jsx)(Cm,{size:14}),u(`tasks.convertToTask`)]}):null]})]}):null,(0,H.jsxs)(`div`,{className:d?`personal-task-grouped-list`:`personal-task-kanban`,children:[(0,H.jsxs)(kb,{listView:d,count:g.length,label:u(`timeline.waitingConfirmation`),tone:`attention`,children:[g.map(e=>{let t=Xi(e.updatedAt,u);return(0,H.jsxs)(`button`,{onClick:()=>s({item:e,kind:`attention`}),type:`button`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`is-attention`,children:`!`}),(0,H.jsx)(`strong`,{children:e.text}),(0,H.jsxs)(`small`,{children:[(0,H.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?u(`tasks.blocked`):u(`tasks.pending`)}),t?(0,H.jsx)(`span`,{className:`personal-task-age`,children:u(`tasks.waitingAge`,{age:t})}):null]})]},e.todoId)}),g.length?null:(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyConfirm`)})]}),(0,H.jsxs)(kb,{listView:d,count:x.length,label:u(`tasks.pendingAndRunning`),tone:`progress`,children:[x.map(e=>{let n={...e,goalId:t.goalId,goalTitle:t.title,ownerLabel:e.claimedBy??t.agentLabel??t.agentId},r=w.find(t=>t.run.todoId===e.todoId)?.run;return(0,H.jsxs)(`div`,{className:`personal-task-card${r?` has-session`:``}${c===e.todoId?` is-selected`:``}`,ref:c===e.todoId?e=>{h.current=e}:void 0,children:[(0,H.jsxs)(`button`,{"aria-pressed":c===e.todoId,onClick:()=>s({item:n,kind:`todo`}),type:`button`,children:[(0,H.jsx)(`span`,{children:`○`}),(0,H.jsx)(`strong`,{children:e.text}),(0,H.jsxs)(`small`,{children:[e.priority?(0,H.jsx)(`span`,{className:`personal-priority-badge is-${e.priority.toLowerCase()}`,children:e.priority}):null,e.status===`blocked`?(0,H.jsx)(`span`,{className:`personal-priority-badge is-blocked`,children:u(`tasks.blocked`)}):null,r?(0,H.jsx)(`span`,{className:`personal-task-session-status`,children:r.status===`running`||r.status===`queued`?u(`runs.running`):r.status===`failed`?u(`tasks.sessionError`):u(`common.waiting`)}):null,e.status===`deferred`?(0,H.jsx)(`span`,{className:`personal-task-session-status`,children:u(`drawer.taskStatusDeferred`)}):r?null:(0,H.jsx)(`span`,{className:`personal-task-session-status`,children:u(`tasks.waiting`)}),e.claimedBy??t.agentLabel??t.agentId]})]}),(0,H.jsxs)(`div`,{className:`personal-task-card-actions`,children:[r?(0,H.jsxs)(`button`,{className:`personal-task-session-link`,"aria-label":u(`tasks.openExecution`,{name:e.text}),onClick:()=>s({item:r,kind:`run`}),title:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`),type:`button`,children:[(0,H.jsx)(pm,{size:14}),(0,H.jsx)(`span`,{children:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`)})]}):null,a?(0,H.jsx)(`button`,{"aria-busy":o?.has(e.todoId)||void 0,"aria-label":u(`tasks.markComplete`,{name:e.text}),disabled:o?.has(e.todoId),onClick:()=>void a(n),title:u(`tasks.completed`),type:`button`,children:o?.has(e.todoId)?(0,H.jsx)(wm,{className:`personal-spin`,size:14}):(0,H.jsx)(tm,{size:14})}):null,(0,H.jsx)(`button`,{"aria-label":u(`tasks.moreActions`,{name:e.text}),onClick:()=>s({item:n,kind:`todo`}),title:u(`common.actions`),type:`button`,children:(0,H.jsx)(fm,{size:14})})]})]},e.todoId)}),x.length?null:(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyRunning`)})]}),(0,H.jsxs)(kb,{listView:d,count:C.length,label:u(`tasks.scheduled`),tone:`schedule`,children:[C.map(e=>(0,H.jsxs)(`button`,{onClick:()=>s({item:e.schedule,kind:`schedule`}),type:`button`,children:[(0,H.jsx)(`span`,{children:`◷`}),(0,H.jsx)(`strong`,{children:e.schedule.label}),(0,H.jsx)(`small`,{children:e.schedule.status===`paused`?u(`schedule.paused`):u(`schedule.active`)})]},e.id)),C.length?null:(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptySchedules`)})]}),(0,H.jsx)(Ob,{goal:t,agentId:y,seed:S,enabled:e,listView:d,onSelect:s},`${t.goalId}:${y}:${e}`)]}),T?(0,H.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyGoal`)}):null]})}function jb(e,t){return{live_steering:{label:t(`lark.ingressSteering`),detail:t(`lark.ingressSteeringDescription`)},session_queue:{label:t(`lark.ingressQueue`),detail:t(`lark.ingressQueueDescription`)},async_inbox:{label:t(`lark.ingressAsync`),detail:t(`lark.ingressAsyncDescription`)},direct_session:{label:t(`lark.ingressLegacy`),detail:t(`lark.ingressLegacyDescription`)}}[e]}function Mb(e,t){return e.listener_status===`starting`?{label:t(`lark.health.starting`),detail:t(`lark.health.startingDetail`),state:`not_ready`}:e.listener_status===`retrying`&&e.listener_error_code===`lark_event_source_disconnected`?{label:t(`lark.health.sourceDisconnected`),detail:t(`lark.health.sourceDisconnectedDetail`),state:`not_ready`}:e.listener_status===`retrying`?{label:t(`lark.health.retrying`),detail:t(`lark.health.retryingDetail`),state:`not_ready`}:e.listener_status===`stopped`||e.listener_status===null?{label:t(`lark.health.notStarted`),detail:t(`lark.health.notStartedDetail`),state:`not_ready`}:e.last_event_status===`message_context_permission_required`?{label:t(`lark.health.messageContextPermission`),detail:t(`lark.health.messageContextPermissionDetail`),state:`not_ready`}:e.last_event_status===`processing_failed`?{label:t(`lark.health.processingFailed`),detail:t(`lark.health.processingFailedDetail`),state:`not_ready`}:e.health_error_code===`invalid_routing_state`?{label:t(`lark.health.invalidRouting`),detail:t(`lark.health.invalidRoutingDetail`),state:`not_ready`}:e.last_event_status===`queued_for_agent`?{label:t(`lark.health.queued`),detail:t(`lark.health.queuedDetail`,{agent:e.agent_id??t(`lark.targetAgent`)}),state:`ready`}:e.last_event_status===`context_only_captured`||e.last_event_status===`context_only_already_captured`?{label:t(`lark.health.contextCaptured`),detail:t(`lark.health.contextCapturedDetail`),state:`ready`}:e.last_event_status===`ignored`&&e.last_event_reason===`not_addressed`?{label:t(`lark.health.notAddressed`),detail:t(`lark.health.notAddressedDetail`),state:`ready`}:e.last_event_status===`ignored`&&e.last_event_reason===`self_message`?{label:t(`lark.health.listening`),detail:t(`lark.health.ignoredSelf`),state:`ready`}:e.health_error_code===`lark_event_route_mismatch`||[`chat_mismatch`,`topic_mismatch`,`route_ambiguous`].includes(e.last_event_reason??``)?{label:e.last_event_reason===`route_ambiguous`?t(`lark.health.routeAmbiguous`):t(`lark.health.routeMismatch`),detail:e.last_event_reason===`route_ambiguous`?t(`lark.health.routeAmbiguousDetail`):t(`lark.health.routeMismatchDetail`),state:`not_ready`}:[`invalid_event`,`binding_unavailable`].includes(e.last_event_reason??``)?{label:t(`lark.health.routeUnavailable`),detail:t(`lark.health.routeUnavailableDetail`),state:`not_ready`}:e.last_event_status===`replied_and_acknowledged`?{label:t(`lark.health.listening`),detail:t(`lark.health.eventProcessed`,{events:e.event_count,replies:e.replied_count}),state:`ready`}:e.health_error_code===`lark_event_delivery_unverified`||e.event_count===0?{label:t(`lark.health.eventUnverified`),detail:t(`lark.health.eventUnverifiedDetail`),state:`unverified`}:{label:e.reply_ready?t(`lark.health.listening`):t(`lark.health.unavailable`),detail:t(`lark.health.lastStatus`,{status:e.last_event_status??t(`lark.health.waiting`)}),state:e.reply_ready?`ready`:`not_ready`}}function Nb(e){return e.history_permission_guidance?.api_document_url??null}function Pb(e,t,n){if(e instanceof Eh){let t=String(e.payload.error_code??``);return{lark_cli_not_installed:n(`lark.error.cliMissing`),lark_cli_not_executable:n(`lark.error.cliExecutable`),lark_cli_start_failed:n(`lark.error.cliStart`),lark_message_permissions_required:n(`lark.error.messagePermissions`),lark_app_required:n(`lark.error.appRequired`),invalid_lark_app:n(`lark.error.invalidApp`),lark_group_lookup_failed:n(`lark.error.groupLookup`),provider_api_failed:n(`lark.error.provider`)}[t]??e.message}return e instanceof Error?e.message:t}function Fb({embedded:e=!1,focusGoalConnection:t=!1,goals:n,initialGoalId:r,onChanged:i,onClose:a}){let{t:o}=qi(),[s,c]=(0,V.useState)(`connections`),[l,u]=(0,V.useState)([]),[d,f]=(0,V.useState)([]),[p,m]=(0,V.useState)(!0),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(``),[y,b]=(0,V.useState)(t),[x,S]=(0,V.useState)(``),[C,w]=(0,V.useState)(r??n[0]?.goalId??``),[T,E]=(0,V.useState)(``),[D,O]=(0,V.useState)([]),[k,ee]=(0,V.useState)(``),[te,A]=(0,V.useState)(!1),[j,M]=(0,V.useState)(null),[N,P]=(0,V.useState)(`addressed_only`),[F,ne]=(0,V.useState)(t&&r?`goal`:`manager`),[re,I]=(0,V.useState)(`async_inbox`),[L,ie]=(0,V.useState)(`topic_reply`),[R,ae]=(0,V.useState)(``),[oe,se]=(0,V.useState)(!1),[ce,le]=(0,V.useState)({}),[ue,z]=(0,V.useState)(!1),[de,fe]=(0,V.useState)(null),[pe,me]=(0,V.useState)(null),[he,ge]=(0,V.useState)(null),[_e,ve]=(0,V.useState)(null),[ye,be]=(0,V.useState)(!1),[xe,Se]=(0,V.useState)(`loopx-workspace-bot`),[Ce,we]=(0,V.useState)(`feishu`),[Te,B]=(0,V.useState)(null),[Ee,De]=(0,V.useState)(!1),[Oe,ke]=(0,V.useState)(null),Ae=(0,V.useRef)(null),je=(0,V.useRef)(null),Me=(0,V.useRef)(!1);async function Ne(){m(!0),g(null);try{let[e,t]=await Promise.all([zg(),Jg()]);u(e),f(t),S(t=>t||e.find(e=>e.reply_ready)?.app_ref||e.find(e=>e.ready)?.app_ref||e[0]?.app_ref||``)}catch(e){g(Pb(e,o(`lark.error.configuration`),o))}finally{m(!1)}}(0,V.useEffect)(()=>{Ne()},[]),(0,V.useEffect)(()=>{if(!t||p||Me.current||!r)return;Me.current=!0;let e=d.find(e=>e.goal_id===r);e?qe(e):Ke(n.find(e=>e.goalId===r))},[d,t,n,r,p]),(0,V.useEffect)(()=>{if(!y||!x||he){O([]),ee(``),A(!1),M(null);return}let e=!1;A(!0),M(null);let t=window.setTimeout(()=>{Kg(x,T).then(t=>{e||(O(t),ee(e=>t.some(t=>t.chat_id===e)?e:t[0]?.chat_id??``))}).catch(t=>{e||(O([]),ee(``),M(Pb(t,o(`lark.error.groupLoad`),o)))}).finally(()=>{e||A(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[x,T,y,he]),(0,V.useEffect)(()=>{if(!ye||!Te||[`ready`,`failed`,`cancelled`].includes(Te.status))return;let e=!1,t=window.setTimeout(()=>{Hg(Te.setup_id).then(async t=>{e||(B(t),t.verification_url&&je.current!==t.verification_url&&(je.current=t.verification_url,Ae.current&&!Ae.current.closed&&(Ae.current.location.href=t.verification_url)),t.status===`ready`&&(await Ne(),S(t.app_ref),le({}),be(!1)),t.status===`failed`&&ke(t.error??o(`lark.error.appCreate`)))}).catch(t=>{e||ke(Pb(t,o(`lark.error.setupPoll`),o))})},650);return()=>{e=!0,window.clearTimeout(t)}},[ye,Te]);let Pe=n.find(e=>e.goalId===C),Fe=Pe?.agentId?[{agentId:Pe.agentId,label:Pe.agentLabel??Pe.agentId}]:[],Ie=Pe?.agentLanes?.length?Pe.agentLanes:Fe,Le=Ie.some(e=>e.agentId===R),Re=[];oe?Re=Ie.map(e=>({agentId:e.agentId,appRef:ce[e.agentId]??x})):Le&&(Re=[{agentId:R,appRef:x}]);let ze=Re.map(e=>e.agentId),Be=!!he||Re.length>0&&Re.every(e=>l.some(t=>t.app_ref===e.appRef&&t.reply_ready)),Ve=o(`lark.connect`);pe?Ve=o(`lark.saveConnection`):oe&&(Ve=o(`lark.connectAllAgentsAction`,{count:ze.length}));let He=l.find(e=>e.app_ref===x),Ue=D.find(e=>e.chat_id===k),We=(0,V.useMemo)(()=>{let e=_.trim().toLocaleLowerCase();return e?d.filter(t=>[t.app_label,t.chat_name,t.goal_title,t.topic_name].some(t=>t.toLocaleLowerCase().includes(e))):d},[d,_]),Ge=(0,V.useMemo)(()=>d.filter(e=>Mb(e,o).state===`unverified`).length,[d,o]);function Ke(e){let i=e??n.find(e=>e.goalId===r)??n[0];me(null),ge(null),ne(e||t?`goal`:`manager`),S(l.some(e=>e.app_ref===x)?x:l.find(e=>e.reply_ready)?.app_ref??l[0]?.app_ref??``),ee(``),w(i?.goalId??``),ae(i?.agentId??``),se(!1),le({}),P(`addressed_only`),I(`async_inbox`),ie(`topic_reply`),E(``),fe(null),b(!0)}function qe(e){me(e.goal_id),ge(e),ne(e.conversation_kind??`goal`),S(e.app_ref),w(e.goal_id);let t=n.find(t=>t.goalId===e.goal_id),r=t?.agentLanes?.length?t.agentLanes:t?.agentId?[{agentId:t.agentId}]:[];ae(e.agent_id??(r.length===1?r[0].agentId:``)),se(!1),le({}),P(e.capture_scope),I(e.ingress_mode===`direct_session`?`async_inbox`:e.ingress_mode),ie(e.reply_mode),E(e.chat_name),fe(null),b(!0)}function Je(){B(null),ke(null),je.current=null,be(!0)}async function Ye(){if(!(Ee||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(xe))){De(!0),ke(null),je.current=null,Ae.current=window.open(window.location.href,`_blank`);try{let e=await Vg({appRef:xe,brand:Ce});B(e)}catch(e){Ae.current?.close(),ke(Pb(e,o(`lark.error.setupStart`),o))}finally{De(!1)}}}async function Xe(){let e=Te;if(be(!1),Ae.current?.close(),e&&![`ready`,`failed`,`cancelled`].includes(e.status))try{await Ug(e.setup_id)}catch{}}async function Ze(){if(!(!x||!C||!he&&!Ue||F===`goal`&&ze.length===0||ue)){z(!0),fe(null);try{let e={...F===`manager`?{...he?{connectionId:he.connection_id}:{appRef:x,chatId:Ue.chat_id,chatName:Ue.chat_name}}:he?{connectionId:he.connection_id,agentId:R}:{agentBindings:Re,chatId:Ue.chat_id,chatName:Ue.chat_name},conversationKind:F,captureScope:F===`manager`?`addressed_only`:N,goalId:C,incomingMode:N===`configured_chat_all`?`all`:`mentions`,ingressMode:F===`manager`?`session_queue`:re,replyMode:L},t=await Yg({...e,execute:!1});if(!t.ok)throw new Eh(t.public_summary??t.blocker??o(`lark.error.bindPreview`),{error_code:t.blocker??`provider_api_failed`});let n=await Yg({...e,execute:!0});if(!n.ok)throw new Eh(n.public_summary??n.blocker??o(`lark.error.bind`),{error_code:n.blocker??`provider_api_failed`});b(!1),await Ne(),i?.()}catch(e){fe(Pb(e,o(`lark.error.bind`),o))}finally{z(!1)}}}async function Qe(e,t){if(_e!==t){ve(t);return}try{await Xg(e,t),ve(null),await Ne(),i?.()}catch(e){g(Pb(e,o(`lark.error.disconnect`),o))}}return(0,H.jsxs)(`section`,{className:`personal-lark-settings${e?` is-embedded`:``}`,"aria-label":o(`lark.configuration`),children:[e?null:(0,H.jsxs)(`header`,{className:`personal-lark-header`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:o(`settings.goalConnections`)}),(0,H.jsx)(`h1`,{children:`Lark`})]}),(0,H.jsx)(`button`,{"aria-label":o(`lark.closeSettings`),className:`personal-icon-button`,onClick:a,type:`button`,children:(0,H.jsx)(eh,{size:18})})]}),(0,H.jsxs)(`nav`,{className:`personal-lark-tabs`,"aria-label":o(`lark.management`),children:[(0,H.jsxs)(`button`,{"aria-current":s===`apps`?`page`:void 0,onClick:()=>c(`apps`),type:`button`,children:[o(`lark.apps`),` `,(0,H.jsx)(`span`,{children:p?`…`:l.length})]}),(0,H.jsxs)(`button`,{"aria-current":s===`connections`?`page`:void 0,onClick:()=>c(`connections`),type:`button`,children:[o(`lark.connections`),` `,(0,H.jsx)(`span`,{children:p?`…`:d.length})]})]}),h?(0,H.jsx)(`p`,{className:`personal-notification-error`,children:h}):null,p?(0,H.jsxs)(`div`,{className:`personal-lark-loading`,children:[(0,H.jsx)(wm,{className:`is-spinning`,size:18}),o(`lark.loading`)]}):null,!p&&s===`apps`?(0,H.jsxs)(`div`,{className:`personal-lark-apps`,children:[(0,H.jsxs)(`div`,{className:`personal-lark-app-toolbar`,children:[(0,H.jsx)(`span`,{children:o(`lark.reusableApps`,{count:l.length})}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,onClick:Je,type:`button`,children:[(0,H.jsx)(Fm,{size:16}),o(`lark.newApp`)]})]}),(0,H.jsxs)(`div`,{className:`personal-lark-app-grid`,children:[l.map(e=>(0,H.jsxs)(`article`,{className:`personal-lark-app-card`,children:[(0,H.jsx)(`span`,{className:`personal-lark-app-avatar`,children:(0,H.jsx)(Qp,{size:19})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsxs)(`small`,{children:[e.brand,` · lark-cli profile`]})]}),(0,H.jsx)(`em`,{className:e.reply_ready?`is-ready`:`is-off`,children:e.reply_ready?o(`lark.autoReplyReady`):e.ready?o(`lark.needsMessagePermissions`):o(`lark.needsSetup`)}),(0,H.jsxs)(`p`,{children:[o(`lark.goalConnections`,{count:d.filter(t=>t.app_ref===e.app_ref).length}),e.ready&&!e.reply_ready?` · ${o(`lark.autoReplyUnavailable`)}`:``]})]},e.app_ref)),l.length===0?(0,H.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noProfiles`)}):null]})]}):null,!p&&s===`connections`?(0,H.jsxs)(`div`,{className:`personal-lark-connections`,children:[Ge>0?(0,H.jsxs)(`p`,{className:`personal-lark-route-readiness`,role:`status`,children:[(0,H.jsx)(Om,{size:15}),o(`lark.routesUnverified`,{count:Ge})]}):null,(0,H.jsxs)(`div`,{className:`personal-lark-toolbar`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(Bm,{size:16}),(0,H.jsx)(`input`,{"aria-label":o(`lark.searchConnections`),onChange:e=>v(e.target.value),placeholder:o(`lark.searchPlaceholder`),type:`search`,value:_})]}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:l.length===0||n.length===0,onClick:()=>Ke(),type:`button`,children:[(0,H.jsx)(Fm,{size:16}),o(`lark.connectApp`)]})]}),(0,H.jsxs)(`div`,{className:`personal-lark-table`,role:`table`,"aria-label":o(`lark.goalTopicConnections`),children:[(0,H.jsxs)(`div`,{className:`personal-lark-table-head`,role:`row`,children:[(0,H.jsx)(`span`,{children:o(`lark.connection`)}),(0,H.jsx)(`span`,{children:o(`common.goal`)}),(0,H.jsx)(`span`,{children:o(`lark.capture`)}),(0,H.jsx)(`span`,{children:o(`lark.processing`)}),(0,H.jsx)(`span`,{children:o(`common.actions`)})]}),We.map(e=>{let t=Mb(e,o);return(0,H.jsxs)(`div`,{className:`personal-lark-table-row`,role:`row`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.chat_name}),(0,H.jsxs)(`small`,{children:[e.app_label,` · `,t.label]}),(0,H.jsx)(`small`,{children:t.detail}),t.state===`unverified`?(0,H.jsxs)(`a`,{href:`https://open.feishu.cn/document/server-docs/im-v1/message/events/receive?lang=zh-CN`,rel:`noreferrer`,target:`_blank`,children:[(0,H.jsx)(pm,{size:12}),o(`lark.openEventSettings`)]}):null,Nb(e)?(0,H.jsxs)(`a`,{href:Nb(e)??void 0,rel:`noreferrer`,target:`_blank`,children:[(0,H.jsx)(pm,{size:12}),o(`lark.historyPermission`)]}):null]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.goal_title}),(0,H.jsxs)(`small`,{children:[`# `,e.topic_name]})]}),(0,H.jsx)(`span`,{children:e.capture_scope===`addressed_only`?o(`lark.mentionsOnly`):o(`lark.allTopicMessages`)}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.conversation_kind===`manager`?o(`lark.managerConversation`):jb(e.ingress_mode,o).label}),(0,H.jsx)(`small`,{children:e.conversation_kind===`manager`?o(`lark.managerConversationDescription`):e.agent_id??jb(e.ingress_mode,o).detail})]}),(0,H.jsxs)(`span`,{className:`personal-lark-row-actions`,children:[(0,H.jsx)(`button`,{"aria-label":o(`lark.settingsConfigure`,{goal:e.goal_title}),onClick:()=>qe(e),type:`button`,children:(0,H.jsx)(Wm,{size:15})}),(0,H.jsxs)(`button`,{"aria-label":o(`lark.settingsDisconnect`,{goal:e.goal_title}),className:_e===e.connection_id?`is-confirm`:``,onClick:()=>void Qe(e.goal_id,e.connection_id),type:`button`,children:[(0,H.jsx)($m,{size:15}),_e===e.connection_id?o(`common.confirm`):null]})]})]},e.connection_id)}),We.length===0?(0,H.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noConnections`)}):null]})]}):null,y?(0,H.jsx)(`div`,{className:`personal-lark-modal-backdrop`,role:`presentation`,children:(0,H.jsxs)(`section`,{"aria-labelledby":`connect-lark-title`,"aria-modal":`true`,className:`personal-lark-modal`,role:`dialog`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:`Goal Topic connection`}),(0,H.jsx)(`h2`,{id:`connect-lark-title`,children:o(pe?`lark.editConnection`:`lark.connectApp`)})]}),(0,H.jsx)(`button`,{"aria-label":o(`lark.closeConnection`),onClick:()=>b(!1),type:`button`,children:(0,H.jsx)(eh,{size:18})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.conversationKind`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.conversationKind`),disabled:!!he,value:F,onChange:e=>ne(e.target.value),children:[(0,H.jsx)(`option`,{value:`manager`,children:o(`lark.managerConversation`)}),(0,H.jsx)(`option`,{value:`goal`,children:o(`lark.workerConversation`)})]})]}),F===`manager`?(0,H.jsx)(`p`,{children:o(`lark.managerConversationDescription`)}):null,he?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,H.jsx)(`div`,{children:he.app_label})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,H.jsx)(`div`,{children:he.chat_name})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,H.jsx)(`div`,{children:he.goal_title})]}),(0,H.jsx)(`small`,{children:o(`lark.editPreservesIdentity`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,H.jsx)(`select`,{"aria-label":o(`lark.appProfile`),disabled:p,onChange:e=>{e.target.value===`__register__`?Je():(S(e.target.value),le({}))},value:x,children:p?(0,H.jsx)(`option`,{value:``,children:o(`lark.appLoading`)}):(0,H.jsxs)(H.Fragment,{children:[l.map(e=>(0,H.jsxs)(`option`,{disabled:!e.ready,value:e.app_ref,children:[e.label,e.reply_ready?``:e.ready?` · ${o(`lark.needsMessagePermissions`)}`:` · ${o(`lark.needsSetup`)}`]},e.app_ref)),(0,H.jsx)(`option`,{value:`__register__`,children:o(`lark.registerAnother`)})]})}),(0,H.jsx)(`small`,{children:o(`lark.defaultAgentAppDescription`)})]}),He?.ready&&!He.reply_ready?(0,H.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.appPermissions`)}):null,(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,H.jsx)(`input`,{"aria-label":o(`lark.groupSearch`),onChange:e=>E(e.target.value),placeholder:o(`lark.groupSearch`),type:`search`,value:T}),te?(0,H.jsxs)(`div`,{className:`personal-lark-group-state`,role:`status`,children:[(0,H.jsx)(wm,{className:`is-spinning`,size:15}),o(`lark.groupLoading`)]}):null,!te&&j?(0,H.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:j}):null,!te&&!j&&D.length===0?(0,H.jsx)(`div`,{className:`personal-lark-group-state`,role:`status`,children:o(`lark.groupEmpty`)}):null,!te&&!j&&D.length>0?(0,H.jsx)(`select`,{"aria-label":o(`lark.groupChat`),onChange:e=>ee(e.target.value),value:k,children:D.map(e=>(0,H.jsx)(`option`,{value:e.chat_id,children:e.chat_name},e.chat_id))}):null]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,H.jsx)(`select`,{"aria-label":o(`lark.bindGoal`),onChange:e=>{let t=e.target.value;w(t),ae(n.find(e=>e.goalId===t)?.agentId??``),le({})},value:C,children:n.map(e=>(0,H.jsx)(`option`,{value:e.goalId,children:e.title},e.goalId))})]})]}),(0,H.jsxs)(`label`,{className:`personal-lark-check`,children:[(0,H.jsx)(`input`,{checked:!0,readOnly:!0,type:`checkbox`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:o(`lark.createAutomatically`)}),(0,H.jsx)(`small`,{children:o(`lark.createAutomaticallyDescription`)})]})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.topicPreview`)}),(0,H.jsxs)(`div`,{className:`personal-lark-topic-preview`,children:[(0,H.jsx)(Om,{size:15}),`# `,Pe?.title??Pe?.goalId??`Goal`]})]}),F===`goal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.captureScope`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.captureScope`),disabled:he?.ingress_mode===`direct_session`,onChange:e=>P(e.target.value),value:N,children:[(0,H.jsx)(`option`,{value:`addressed_only`,children:o(`lark.captureAddressed`)}),(0,H.jsx)(`option`,{value:`configured_chat_all`,children:o(`lark.captureAll`)})]}),(0,H.jsx)(`small`,{children:o(`lark.captureScopeDescription`)})]}),(0,H.jsxs)(`fieldset`,{"aria-label":o(`lark.agentIngress`),className:`personal-lark-ingress`,children:[(0,H.jsx)(`legend`,{children:o(`lark.agentIngress`)}),(0,H.jsx)(`div`,{children:[`live_steering`,`session_queue`,`async_inbox`].map(e=>{let t=jb(e,o);return(0,H.jsxs)(`label`,{className:re===e?`is-active`:``,children:[(0,H.jsx)(`input`,{"aria-label":t.label,checked:re===e,name:`lark-agent-ingress`,onChange:()=>I(e),type:`radio`,value:e}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:t.label}),(0,H.jsx)(`small`,{children:t.detail})]})]},e)})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.targetAgent`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.targetAgent`),disabled:!!he?.agent_id,onChange:e=>ae(e.target.value),value:R,children:[Le?null:(0,H.jsx)(`option`,{disabled:!0,value:R,children:R?o(`lark.agentUnavailable`,{agent:R}):o(`lark.noAgentConfigured`)}),Ie.map(e=>(0,H.jsx)(`option`,{value:e.agentId,children:e.label===e.agentId?e.agentId:`${e.label} · ${e.agentId}`},e.agentId))]}),(0,H.jsx)(`small`,{children:o(`lark.targetAgentDescription`)})]}),!pe&&Ie.length>1?(0,H.jsxs)(`label`,{"aria-label":o(`lark.connectAllAgents`),className:`personal-lark-check`,children:[(0,H.jsx)(`input`,{checked:oe,onChange:e=>se(e.target.checked),type:`checkbox`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:o(`lark.connectAllAgents`)}),(0,H.jsx)(`small`,{children:o(`lark.connectAllAgentsDescription`,{count:Ie.length})})]})]}):null,!pe&&oe&&Ie.length>1?(0,H.jsxs)(`fieldset`,{"aria-label":o(`lark.agentApps`),className:`personal-lark-agent-apps`,children:[(0,H.jsx)(`legend`,{children:o(`lark.agentApps`)}),(0,H.jsx)(`small`,{children:o(`lark.agentAppsDescription`)}),(0,H.jsx)(`div`,{children:Ie.map(e=>(0,H.jsxs)(`label`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.label}),(0,H.jsx)(`small`,{children:e.agentId})]}),(0,H.jsx)(`select`,{"aria-label":o(`lark.agentAppSelection`,{agent:e.label}),onChange:t=>le(n=>({...n,[e.agentId]:t.target.value})),value:ce[e.agentId]??x,children:l.map(e=>(0,H.jsxs)(`option`,{disabled:!e.ready,value:e.app_ref,children:[e.label,e.reply_ready?``:e.ready?` · ${o(`lark.needsMessagePermissions`)}`:` · ${o(`lark.needsSetup`)}`]},e.app_ref))})]},e.agentId))})]}):null,oe&&Re.length>0&&!Be?(0,H.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.agentAppPermissions`)}):null,ze.length===0?(0,H.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:o(`lark.selectRegisteredAgent`)}):null]}):null,(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.replyMode`)}),(0,H.jsx)(`select`,{"aria-label":o(`lark.replyMode`),onChange:e=>ie(e.target.value),value:L,children:(0,H.jsx)(`option`,{value:`topic_reply`,children:o(`lark.topicReply`)})}),(0,H.jsx)(`small`,{children:o(`lark.replyModeDescription`)})]}),(0,H.jsxs)(`p`,{className:`personal-lark-cardinality`,children:[(0,H.jsx)(tm,{size:15}),o(`lark.cardinality`)]}),de?(0,H.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:de}):null,(0,H.jsxs)(`footer`,{children:[(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>b(!1),type:`button`,children:o(`lark.cancel`)}),(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:p||!x||!he&&(!He?.reply_ready||!k)||F===`goal`&&(!Be||ze.length===0)||!C||ue,onClick:()=>void Ze(),type:`button`,children:[ue?(0,H.jsx)(wm,{className:`is-spinning`,size:15}):null,Ve]})]})]})}):null,ye?(0,H.jsx)(`div`,{className:`personal-lark-modal-backdrop is-setup`,role:`presentation`,children:(0,H.jsxs)(`section`,{"aria-labelledby":`new-lark-app-title`,"aria-modal":`true`,className:`personal-lark-modal personal-lark-setup-modal`,role:`dialog`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`small`,{children:o(`lark.reusableWorkspaceApp`)}),(0,H.jsx)(`h2`,{id:`new-lark-app-title`,children:o(`lark.newApp`)})]}),(0,H.jsx)(`button`,{"aria-label":o(`lark.closeCreate`),onClick:()=>void Xe(),type:`button`,children:(0,H.jsx)(eh,{size:18})})]}),Te?(0,H.jsxs)(`div`,{className:`personal-lark-setup-progress`,children:[(0,H.jsx)(`span`,{className:`personal-lark-setup-icon is-${Te.status}`,children:Te.status===`ready`?(0,H.jsx)(tm,{size:22}):(0,H.jsx)(wm,{className:Te.status===`failed`?``:`is-spinning`,size:22})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:Te.status===`ready`?o(`lark.appCreated`):Te.status===`failed`?o(`lark.appCreateFailed`):o(`lark.waitingFeishu`)}),(0,H.jsx)(`p`,{children:Te.status===`waiting_for_feishu`?o(`lark.waitingFeishuDescription`):Te.status===`starting`?o(`lark.waitingLink`):Te.error})]}),Te.verification_url?(0,H.jsxs)(`a`,{href:Te.verification_url,rel:`noreferrer`,target:`_blank`,children:[(0,H.jsx)(pm,{size:15}),o(`lark.reopenFeishu`)]}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`personal-lark-setup-copy`,children:o(`lark.setupCopy`)}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.profileName`)}),(0,H.jsx)(`input`,{"aria-label":o(`lark.profileName`),autoComplete:`off`,onChange:e=>Se(e.target.value),placeholder:`loopx-workspace-bot`,value:xe})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:o(`lark.region`)}),(0,H.jsxs)(`select`,{"aria-label":o(`lark.region`),onChange:e=>we(e.target.value),value:Ce,children:[(0,H.jsx)(`option`,{value:`feishu`,children:`Feishu`}),(0,H.jsx)(`option`,{value:`lark`,children:`Lark`})]})]}),xe&&!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(xe)?(0,H.jsx)(`p`,{className:`personal-notification-error`,children:o(`lark.profileValidation`)}):null]}),Oe?(0,H.jsx)(`p`,{className:`personal-notification-error`,children:Oe}):null,(0,H.jsxs)(`footer`,{children:[(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void Xe(),type:`button`,children:o(`lark.cancel`)}),Te?null:(0,H.jsxs)(`button`,{className:`personal-primary-action`,disabled:Ee||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(xe),onClick:()=>void Ye(),type:`button`,children:[Ee?(0,H.jsx)(wm,{className:`is-spinning`,size:15}):(0,H.jsx)(pm,{size:15}),o(`lark.continueFeishu`)]})]})]})}):null]})}function Ib(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Lb(e,t,n){let r=Ib(t),i=Ib(n);return Object.fromEntries(e.fields.flatMap(({key:e,nullable:t})=>{let n=r[e],a=i[e];return Object.hasOwn(r,e)&&(n!=null||t&&n===null)?[[e,n]]:Object.hasOwn(i,e)&&a!=null?[[e,a]]:[]}))}function Rb(e,t){let n;try{n=JSON.parse(t)}catch{return null}if(!n||typeof n!=`object`||Array.isArray(n))return null;let r=new Set(e.fields.map(e=>e.key));return Object.keys(n).some(e=>!r.has(e))?null:n}function zb(e,t,n){let r={...e,[t]:n},i=e.schedule;return t===`timezone`&&i&&typeof i==`object`&&`schema_version`in i&&i.schema_version===`periodic_report_schedule_v0`&&(r.schedule={...i,timezone:n}),r}function Bb({id:e,value:t,timezone:n,onChange:r}){let{locale:i}=qi(),a=i===`zh-CN`,o=t&&typeof t==`object`&&!Array.isArray(t)?t:null,s=String(o?.rrule??``).split(`;`).map(e=>e.split(`=`)),c=Object.fromEntries(s.filter(e=>e.length===2)),l=[`MO`,`TU`,`WE`,`TH`,`FR`,`SA`,`SU`],u=(e,t)=>e!==void 0&&/^\d+$/.test(e)&&Number(e)<=t,d=!o||o.schema_version===`periodic_report_schedule_v0`&&[`DAILY`,`WEEKLY`].includes(c.FREQ)&&o.timezone===n&&s.every(e=>e.length===2&&[`FREQ`,`BYDAY`,`BYHOUR`,`BYMINUTE`,`INTERVAL`].includes(e[0]))&&new Set(s.map(([e])=>e)).size===s.length&&u(c.BYHOUR,23)&&u(c.BYMINUTE??`0`,59)&&(c.FREQ===`WEEKLY`?l.includes(c.BYDAY):!c.BYDAY)&&(!c.INTERVAL||c.INTERVAL===`1`),f=a?[`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`,`星期日`]:[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`];function p(e){let t={FREQ:`WEEKLY`,BYDAY:`MO`,BYHOUR:`9`,BYMINUTE:`0`,...c,...e};r?.({schema_version:`periodic_report_schedule_v0`,schedule_id:o?.schedule_id??`report-schedule`,timezone:n,rrule:[`FREQ=${t.FREQ}`,...t.FREQ===`WEEKLY`?[`BYDAY=${t.BYDAY}`]:[],`BYHOUR=${t.BYHOUR}`,`BYMINUTE=${t.BYMINUTE}`].join(`;`)})}return(0,H.jsxs)(`div`,{className:`personal-report-schedule`,children:[(0,H.jsxs)(`label`,{className:`is-boolean`,htmlFor:e,children:[(0,H.jsx)(`span`,{children:a?`按日历汇报`:`Calendar reports`}),(0,H.jsx)(`input`,{id:e,type:`checkbox`,role:`switch`,checked:!!o,disabled:!r,onChange:e=>e.target.checked?p({}):r?.(null)})]}),o?(0,H.jsxs)(H.Fragment,{children:[d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{htmlFor:`${e}-frequency`,children:[(0,H.jsx)(`span`,{children:a?`频率`:`Frequency`}),(0,H.jsxs)(`select`,{id:`${e}-frequency`,value:c.FREQ,disabled:!r,onChange:e=>p({FREQ:e.target.value}),children:[(0,H.jsx)(`option`,{value:`DAILY`,children:a?`每天`:`Daily`}),(0,H.jsx)(`option`,{value:`WEEKLY`,children:a?`每周`:`Weekly`})]})]}),c.FREQ===`WEEKLY`&&(0,H.jsxs)(`label`,{htmlFor:`${e}-day`,children:[(0,H.jsx)(`span`,{children:a?`星期`:`Weekday`}),(0,H.jsx)(`select`,{id:`${e}-day`,value:c.BYDAY,disabled:!r,onChange:e=>p({BYDAY:e.target.value}),children:l.map((e,t)=>(0,H.jsx)(`option`,{value:e,children:f[t]},e))})]}),(0,H.jsxs)(`label`,{htmlFor:`${e}-time`,children:[(0,H.jsxs)(`span`,{children:[a?`当地时间`:`Local time`,` (`,n,`)`]}),(0,H.jsx)(`input`,{id:`${e}-time`,type:`time`,required:!0,disabled:!r,value:`${(c.BYHOUR??`9`).padStart(2,`0`)}:${(c.BYMINUTE??`0`).padStart(2,`0`)}`,onChange:e=>{if(!/^\d{2}:\d{2}$/.test(e.target.value))return;let[t,n]=e.target.value.split(`:`);p({BYHOUR:t,BYMINUTE:n})}})]})]}):(0,H.jsx)(`p`,{role:`alert`,children:a?`此计划需在 JSON 模式中编辑;当前内容已保留。`:`Edit this schedule in JSON mode; its current value is preserved.`}),(0,H.jsx)(`p`,{children:a?`由现有唤醒检查到期计划;实际送达以回执为准。`:`Existing wakes check the schedule; delivery is confirmed by its receipt.`})]}):(0,H.jsx)(`p`,{children:a?`未设置日历计划;保持阶段结束时汇报。`:`No calendar schedule; report at validated stage boundaries.`})]})}function Vb({copy:e,field:t,id:n,onChange:r,value:i,timezone:a}){let o=e[t.key]?.label??t.label,s=!r;if(t.input_kind===`periodic_report_schedule`)return(0,H.jsx)(Bb,{id:n,value:i,timezone:a,onChange:r?e=>r(t.key,e):void 0});if(t.input_kind===`boolean`)return(0,H.jsxs)(`label`,{className:`is-boolean`,htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsx)(`input`,{checked:i===!0,id:n,onChange:r?e=>r(t.key,e.target.checked):void 0,readOnly:s,role:`switch`,type:`checkbox`})]});if(t.input_kind===`select`)return(0,H.jsxs)(`label`,{htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsxs)(`select`,{id:n,onChange:r?e=>r(t.key,e.target.value):void 0,value:typeof i==`string`?i:``,children:[(0,H.jsx)(`option`,{value:``}),(t.options??[]).map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]})]});if(t.input_kind===`string_list`)return(0,H.jsxs)(`label`,{htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsx)(`textarea`,{id:n,onChange:r?e=>r(t.key,e.target.value.split(/\r?\n/u).filter(Boolean)):void 0,readOnly:s,rows:4,value:Array.isArray(i)?i.join(` +`):``})]});let c=t.input_kind===`number`;return(0,H.jsxs)(`label`,{htmlFor:n,children:[(0,H.jsx)(`span`,{children:o}),(0,H.jsx)(`input`,{id:n,max:t.maximum,min:t.minimum,onChange:r?e=>r(t.key,c?Number(e.target.value):e.target.value):void 0,readOnly:s,required:t.required,type:c?`number`:`text`,value:typeof i==`number`||typeof i==`string`?i:``})]})}function Hb({copy:e={},disabled:t=!1,editor:n,enabledAction:r,omitKeys:i=[],onChange:a,value:o}){let s=(0,V.useId)(),c=new Set(i);return(0,H.jsx)(`fieldset`,{className:`personal-capability-fields`,disabled:t,children:n.fields.filter(e=>!c.has(e.key)).map(t=>{let n=(0,H.jsx)(Vb,{copy:e,field:t,id:`${s}-${t.key.replace(/[^a-z0-9_-]/gi,`-`)}`,onChange:a,value:o[t.key],timezone:String(o.timezone??`UTC`)},t.key);return t.key===`enabled`&&t.input_kind===`boolean`?(0,H.jsxs)(`div`,{className:`personal-capability-enabled-row`,children:[n,r]},t.key):n})})}var Ub={en:{manager_runtime:{displayName:`Manager runtime`,description:`Selects the persistent host-tool profile used by owner manager conversations.`},todo_replan_cadence:{displayName:`Goal review cadence`,description:`Configures the Goal review cadence.`},change_quality_qualification:{displayName:`Change quality qualification`,description:`Prepares a provider-neutral review packet, allows at most one policy-authorized safe-fix pass, and can require an exact-diff receipt.`},explore_graph:{displayName:`Explore Graph`,description:`Organizes bounded exploration as a typed evidence graph so branches, findings, and synthesis remain inspectable.`},explore_harness:{displayName:`Explore Harness`,description:`Selects a capability-owned planning and research harness profile for bounded multi-step exploration.`},lark_event_inbox:{displayName:`Lark event inbox`,description:`Receives provider events through a local-private inbox binding before LoopX projects them into governed work.`,readOnlyReason:`This capability requires a local-private inbox binding. Manage it in Lark settings or through the capability CLI.`},lark_kanban_heartbeat_sync:{displayName:`Lark Kanban heartbeat sync`,description:`Synchronizes accepted LoopX work state to the configured Lark Kanban heartbeat surface.`},local_authority_shadow:{displayName:`Local authority shadow`,description:`Observes post-commit Todo and task-lease state through the shared authority contract without taking write authority.`},multi_subagent:{displayName:`Adaptive child capacity`,description:`Sets bounded child-agent capacity and the public-safe responsibility domains in which parallel work may be delegated.`},peer_task_coordination:{displayName:`Registered-peer task coordination`,description:`Routes explicitly scoped peer-owned work to one registered coordinator without granting cross-owner mutation authority.`},periodic_report:{displayName:`Periodic reports`,description:`Turns validated Goal stage progress into a frozen report and automatically delivers it through the configured Goal Channel with exact readback.`},pull_request_review:{displayName:`Pull-request review`,description:`Ranks the public GitHub PR review queue with a machine-level default; it never grants GitHub, Todo, push, or merge authority.`},reward_memory:{displayName:`Reward Memory experiment`,description:`Configures a reviewed local-private provider binding for Goal-scoped Agent recall and evidence-backed outcome learning.`}},"zh-CN":{manager_runtime:{displayName:`管家 Runtime`,description:`选择管家会话持续生效的宿主工具模式。`},todo_replan_cadence:{displayName:`Goal 复核周期`,description:`配置 Goal 的复核周期。`},change_quality_qualification:{displayName:`变更质量验证`,description:`生成与 Provider 无关的审阅包,最多允许一次策略授权的安全修复,并可要求精确 diff 回执。`},explore_graph:{displayName:`探索图谱`,description:`把有界探索组织为 typed 证据图,让探索分支、发现与综合结论都可检查、可追溯。`},explore_harness:{displayName:`探索 Harness`,description:`为有界的多步探索选择由能力负责的规划与研究 Harness profile。`},lark_event_inbox:{displayName:`飞书事件收件箱`,description:`通过本机私有收件箱接收 Provider 事件,再由 LoopX 将其投影为受治理的工作。`,readOnlyReason:`此能力依赖本机私有的收件箱绑定,请在飞书设置或 capability CLI 中管理。`},lark_kanban_heartbeat_sync:{displayName:`飞书看板心跳同步`,description:`把 LoopX 已接受的工作状态同步到配置好的飞书看板心跳界面。`},local_authority_shadow:{displayName:`本地 Authority 影子观测`,description:`通过共享 Authority contract 观测提交后的 Todo 与 task lease 状态,但不取得写入权。`},multi_subagent:{displayName:`自适应子 Agent 容量`,description:`限定子 Agent 容量与可公开的职责域,只有落在这些边界内的工作才能并行委派。`},peer_task_coordination:{displayName:`已注册 Peer 任务协调`,description:`把明确限定的 Peer 工作路由给一个已注册协调者,不授予跨 Owner 修改权限。`},periodic_report:{displayName:`周期报告`,description:`把经过验证的 Goal 阶段进展整理为冻结报告,并通过配置的 Goal Channel 自动发送和精确回读。`},pull_request_review:{displayName:`Pull-request Review`,description:`配置公开 GitHub PR 审阅队列的本机默认排序;不会授予 GitHub、Todo、push 或 merge 权限。`},reward_memory:{displayName:`Reward Memory 实验`,description:`为 Goal 内 Agent 的召回与证据化结果学习配置经过审阅的本机私有 Provider 绑定。`}}},Wb={en:{runtime_profile:{label:`Runtime profile`,description:`Restricted keeps scoped LoopX reads only. Trusted owner enables normal host tools while protected operations retain separate checks.`},completed_todos:{label:`Completed Todos between Goal reviews`,description:`Machine default or explicit Goal override, from 1 to 5.`},allowed_domains:{label:`Allowed responsibility domains`,description:`Enter one bounded, public-safe domain per line.`},coordinator_agent_id:{label:`Coordinator Agent`,description:`Use an already registered Agent id; leave blank to disable coordination.`},enabled:{label:`Enabled`},model:{label:`Child model`,description:`For example gpt-5.6-luna. Blank clears the child model preference.`},reasoning_effort:{label:`Child reasoning effort`,description:`For example max; the host must support this model and effort.`},max_children:{label:`Maximum children`,description:`Hard upper bound for concurrently delegated child work.`},profile:{label:`Planner profile`,description:`Select one registered Explore Harness profile.`},profile_preset:{label:`Report profile`,description:`Capability-owned report profile, such as weekly-progress.`},review_priority:{label:`Review priority`,description:`Choose whether other developers' PRs or the authenticated reviewer's own PRs are ranked first.`},route_ref:{label:`Goal Channel route`,description:`Public route alias only; credentials and provider identifiers stay outside this form.`},safe_fix:{label:`Allow one bounded safe-fix pass`},strict_receipt:{label:`Require an exact-diff receipt`},timezone:{label:`Timezone`,description:`Use an IANA timezone, for example Asia/Shanghai.`},schedule:{label:`Calendar reports`,description:`Optional daily or weekly reports; no schedule preserves stage-only delivery.`},config_path:{label:`Local-private configuration path`,description:`Repo-relative ignored JSON under .loopx/config/. Leave blank to retain the current binding; the path is never returned.`},enabled_agents:{label:`Enabled Goal Agents`,description:`Enter one registered Goal-local Agent id per line. A private binding currently accepts exactly one Agent.`}},"zh-CN":{runtime_profile:{label:`运行模式`,description:`restricted 仅使用受限 LoopX 读取;trusted_owner 开放常规宿主工具,但受保护操作仍单独校验。`},completed_todos:{label:`两次 Goal 复核间的已完成 Todo 数`,description:`可设置 1–5;机器默认值可被 Goal 显式覆盖。`},allowed_domains:{label:`允许的职责域`,description:`每行填写一个有边界、可公开的职责域。`},coordinator_agent_id:{label:`协调 Agent`,description:`填写一个已经注册的 Agent ID;留空表示关闭协调。`},enabled:{label:`启用`},model:{label:`子 Agent 模型`,description:`例如 gpt-5.6-luna;留空清除模型偏好。`},reasoning_effort:{label:`子 Agent 推理档位`,description:`例如 max;宿主须支持所选模型与档位。`},max_children:{label:`最大子 Agent 数`,description:`可同时委派的子任务硬上限。`},profile:{label:`规划 Profile`,description:`选择一个已注册的 Explore Harness profile。`},profile_preset:{label:`报告 Profile`,description:`由该能力管理的报告 profile,例如 weekly-progress。`},review_priority:{label:`审阅优先级`,description:`选择先排其他开发者的 PR,还是先排当前已认证审阅者自己的 PR。`},route_ref:{label:`Goal Channel 路由`,description:`只填写公开 route alias;凭据与 Provider 标识不会进入此表单。`},safe_fix:{label:`允许一次有界安全修复`},strict_receipt:{label:`要求精确 diff 回执`},timezone:{label:`时区`,description:`使用 IANA 时区,例如 Asia/Shanghai。`},schedule:{label:`日历汇报`,description:`可选每日或每周计划;未设置时保持阶段结束汇报。`},config_path:{label:`本机私有配置路径`,description:`填写 .loopx/config/ 下、相对仓库且被忽略的 JSON;留空保留当前绑定,路径不会被回传。`},enabled_agents:{label:`已启用的 Goal Agent`,description:`每行填写一个已注册的 Goal 内 Agent ID;私有绑定当前只接受一个 Agent。`}}};function Gb(e,t){let n=Ub[t][e.capability_id];return n?{...e,display_name:n.displayName,description:n.description,configuration_editor:{...e.configuration_editor,...n.readOnlyReason?{read_only_reason:n.readOnlyReason}:{}}}:e}function Kb(e){return Wb[e]}Object.freeze(Object.keys(Ub.en).sort());function qb(e,t){return e.available_scopes.includes(t)&&(t!==`machine`||!!e.machine_namespace)&&e.configuration_editor.editable&&e.configuration_editor.writable_scopes.includes(t)}function Jb({values:e,t}){return(0,H.jsxs)(`details`,{className:`personal-capability-raw-values`,children:[(0,H.jsx)(`summary`,{children:t(`capabilities.rawJson`)}),(0,H.jsx)(`div`,{className:`personal-capability-value-grid`,children:e.map(({label:e,value:t})=>(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`strong`,{children:e}),(0,H.jsx)(`pre`,{children:t?JSON.stringify(t,null,2):`—`})]},e))})]})}function Yb({source:e,t}){return e?(0,H.jsxs)(`p`,{className:`personal-capability-effective-source`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:15}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:t(`capabilities.effectiveSource`)}),t(`capabilities.source.${e}`)]})]}):null}function Xb({available:e,description:t,t:n}){return e?null:(0,H.jsxs)(`section`,{className:`personal-capability-editor-status is-read-only`,children:[(0,H.jsx)(Qm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:n(`capabilities.readOnly`)}),(0,H.jsx)(`p`,{children:t})]})]})}function Zb(e){return e.availability?.includes(`experimental`)?4:e.capability_id===`multi_subagent`?3:e.configuration_editor.writable_scopes.length===0||e.availability===`supported_explicit_opt_in`?2:e.availability===`supported_explicit_override`?0:1}function Qb(e,t){return[...e].sort((e,n)=>{let r=Zb(e)-Zb(n);if(r!==0)return r;let i=Gb(e,t),a=Gb(n,t);return i.display_name.localeCompare(a.display_name,t)||e.capability_id.localeCompare(n.capability_id)})}function $b({capabilities:e,locale:t,onSelect:n,scope:r,selectedCapabilityId:i,t:a}){return(0,H.jsx)(`nav`,{"aria-label":a(r===`goal`?`capabilities.catalog`:`machine.capabilityCatalog`),className:`personal-capability-list`,tabIndex:0,children:Qb(e,t).map(e=>{let o=Gb(e,t);return(0,H.jsxs)(`button`,{"aria-current":i===o.capability_id?`page`:void 0,onClick:()=>n(o.capability_id),type:`button`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:o.display_name})}),(0,H.jsx)(`em`,{children:a(o.available_scopes.includes(r)?r===`goal`?`capabilities.goalScope`:`capabilities.machineScope`:r===`machine`?`capabilities.goalScope`:`capabilities.machineScope`)})]},o.capability_id)})})}function ex({capability:e,locale:t,source:n}){let{t:r}=qi(),i=Gb(e,t);return(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`span`,{className:`personal-settings-icon`,children:(0,H.jsx)(Km,{"aria-hidden":!0,size:18})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`personal-capability-heading-row`,children:[(0,H.jsx)(`h2`,{children:i.display_name}),(0,H.jsx)(Yb,{source:n,t:r})]}),e.context_contribution&&(0,H.jsxs)(`details`,{className:`personal-capability-help`,"data-testid":`capability-context-phases`,children:[(0,H.jsx)(`summary`,{children:t===`zh-CN`?`主 Agent 协作指导`:`Coordinator workflow guidance`}),(0,H.jsx)(`p`,{children:t===`zh-CN`?`随能力开启。支持以下阶段;此处展示能力范围,不能证明某次运行已读取或采纳。`:`Enabled with this capability. These are supported phases, not proof that a run read or adopted the guidance.`}),(0,H.jsx)(`dl`,{children:e.context_contribution.supported_phases.map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:(0,H.jsx)(`code`,{children:e})}),(0,H.jsx)(`dd`,{children:tx[e][t===`zh-CN`?`zh`:`en`]})]},e))}),(0,H.jsx)(`p`,{children:t===`zh-CN`?`LoopX Turn 在请求与结果中提供上下文;原生工具入口由 LoopX skill 调用同一只读接口。执行与采纳需另看运行证据。`:`LoopX Turn includes context in requests and results. For native tools, the LoopX skill reads the same interface. Execution and adoption require run evidence.`})]}),(0,H.jsxs)(`details`,{className:`personal-capability-help`,children:[(0,H.jsx)(`summary`,{children:t===`zh-CN`?`配置说明`:`Configuration help`}),(0,H.jsx)(`p`,{children:i.description}),(0,H.jsx)(`dl`,{children:e.configuration_editor.fields.map(e=>{let n=Kb(t)[e.key],r=n?.description??e.description;return r?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:n?.label??e.label}),(0,H.jsx)(`dd`,{children:r})]},e.key):null})})]},e.capability_id)]})]})}var tx={before_plan:{zh:`规划前:识别独立问题并保留主 Agent 的核验与整合职责。`,en:`Before planning: identify independent questions and retain coordinator validation and integration.`},before_delegate:{zh:`委派前:明确子任务边界、模型偏好及预期证据。`,en:`Before delegation: specify task boundaries, model preferences and expected evidence.`},after_delegate_result:{zh:`回收后:核验结果,说明采纳决定并关联计划与成果。`,en:`After results: validate evidence, explain acceptance and link plans and deliverables.`}};function nx({goalId:e,onApplied:t,selected:n,t:r}){let[i,a]=(0,V.useState)({busy:null,draft:{},partialWrite:null,preview:null}),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(`guided`),[u,d]=(0,V.useState)(``),f=(0,V.useMemo)(()=>n?Rb(n.configuration_editor,u):null,[n,u]),p=c===`guided`||f!==null;(0,V.useEffect)(()=>{l(`guided`),d(``),a({busy:null,draft:Lb(n?.configuration_editor??{fields:[]},n?.current??n?.effective_configuration?.configuration??n?.default,n?.default),partialWrite:null,preview:null}),s(null)},[n]);async function m(t){if(!(!n||i.busy||!p)){a(e=>({...e,busy:`preview`,partialWrite:null})),s(null);try{let r=await Og(e,n.capability_id,t);a(e=>({...e,preview:r}))}catch(e){s(e instanceof Error?e.message:r(`capabilities.previewFailed`))}finally{a(e=>({...e,busy:null}))}}}async function h(){if(!(!n||!i.preview||i.busy||!p)){a(e=>({...e,busy:`apply`})),s(null);try{let r=Lb(n.configuration_editor,i.draft,n.default),o=await kg(e,n.capability_id,i.preview.action===`delete`?null:r,i.preview.plan_revision);a(e=>({...e,partialWrite:o.status===`partial_write`?o:null,preview:null})),o.status!==`partial_write`&&t()}catch(e){a(e=>({...e,preview:null})),s(e instanceof Error?e.message:r(`capabilities.applyFailed`))}finally{a(e=>({...e,busy:null}))}}}function g(e,t){a(r=>({...r,draft:n?.capability_id===`periodic_report`?zb(r.draft,e,t):{...r.draft,[e]:t},preview:null})),s(null)}function _(e){if(!n||i.busy)return;d(e);let t=Rb(n.configuration_editor,e);a(e=>({...e,preview:null,draft:t?Lb(n.configuration_editor,t,n.default):e.draft})),s(null)}function v(){i.busy||!p||(c===`guided`&&d(JSON.stringify(i.draft,null,2)),l(c===`guided`?`json`:`guided`),a(e=>({...e,preview:null})))}return{apply:h,changeDraft:g,changeJson:_,changeMode:v,editorMode:c,jsonDraft:u,jsonValid:p,error:o,mutation:i,preview:m}}function rx({mutationError:e,onApplied:t,partialWrite:n,preview:r}){let{t:i}=qi();return(0,H.jsxs)(H.Fragment,{children:[e?(0,H.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:e}):null,n?(0,H.jsxs)(`section`,{"aria-live":`polite`,className:`personal-capability-recovery`,children:[(0,H.jsx)(Qm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:i(`capabilities.partialWrite`)}),(0,H.jsx)(`p`,{children:i(`capabilities.partialWriteDescription`)}),(0,H.jsx)(`small`,{children:n.recommended_action})]}),(0,H.jsxs)(`button`,{onClick:t,type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":!0,size:15}),i(`capabilities.refreshSource`)]})]}):null,r?(0,H.jsxs)(`section`,{className:`personal-capability-preview`,"aria-label":i(`capabilities.preview`),children:[(0,H.jsx)(`strong`,{children:i(`capabilities.preview`)}),(0,H.jsx)(`span`,{children:i(`machine.action.${r.action}`)}),(0,H.jsx)(`small`,{children:i(`capabilities.previewLocked`)})]}):null]})}function ix({catalog:e,goalId:t,onApplied:n}){let{locale:r,t:i}=qi(),a=(0,V.useMemo)(()=>Qb(e.capabilities,r),[e.capabilities,r]),[o,s]=(0,V.useState)(()=>a[0]?.capability_id??``),c=(0,V.useMemo)(()=>a.find(e=>e.capability_id===o)??a[0],[a,o]),l=(0,V.useMemo)(()=>c?Gb(c,r):void 0,[r,c]),{apply:u,changeDraft:d,changeJson:f,changeMode:p,editorMode:m,jsonDraft:h,jsonValid:g,error:_,mutation:v,preview:y}=nx({goalId:t,onApplied:n,selected:l,t:i}),{busy:b,draft:x,partialWrite:S,preview:C}=v;if(!c||!l)return(0,H.jsx)(`p`,{className:`personal-capability-empty`,children:i(`capabilities.empty`)});let w=l.available_scopes.includes(`goal`),T=qb(l,`goal`),E=l.configuration_editor.read_only_reason??i(w?`capabilities.previewOnly`:`capabilities.machineOnly`);async function D(){if(!l||!T||b||!g)return;let e=Lb(l.configuration_editor,x,l.default);await y(e)}async function O(){!T||b||await y(null)}return(0,H.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,H.jsx)($b,{capabilities:e.capabilities,locale:r,onSelect:s,scope:`goal`,selectedCapabilityId:l.capability_id,t:i}),(0,H.jsxs)(`article`,{"aria-label":l.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,H.jsx)(ex,{capability:c,locale:r,source:l.effective_configuration?.source}),(0,H.jsx)(Xb,{available:T,t:i,description:E}),T?(0,H.jsxs)(H.Fragment,{children:[m===`json`||!l.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,H.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,H.jsxs)(`button`,{disabled:!!b||!g,onClick:p,type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),i(m===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,m===`guided`?(0,H.jsx)(`section`,{className:`personal-capability-field-summary`,children:(0,H.jsx)(Hb,{disabled:!!b,copy:Kb(r),editor:l.configuration_editor,onChange:d,value:x,enabledAction:(0,H.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:p,type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),i(`machine.editJson`)]})})}):(0,H.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`goal-configuration-json`,children:[(0,H.jsx)(`span`,{children:i(`capabilities.jsonConfiguration`)}),(0,H.jsx)(`textarea`,{id:`goal-configuration-json`,"aria-describedby":`goal-configuration-json-help`,disabled:!!b,onChange:e=>f(e.target.value),rows:12,spellCheck:!1,value:h}),(0,H.jsx)(`small`,{id:`goal-configuration-json-help`,children:i(`capabilities.jsonHelp`)}),g?null:(0,H.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:i(`capabilities.jsonInvalid`)})]})]}):null,(0,H.jsx)(rx,{mutationError:_,onApplied:n,partialWrite:S,preview:C}),T?(0,H.jsxs)(`footer`,{className:`personal-capability-actions`,children:[l.current&&l.available_scopes.includes(`machine`)?(0,H.jsx)(`button`,{disabled:!!b||!g,onClick:()=>void O(),type:`button`,children:i(`capabilities.restoreInheritance`)}):null,(0,H.jsx)(`button`,{disabled:!!b||!g,onClick:()=>void D(),type:`button`,children:i(b===`preview`?`common.loading`:`capabilities.previewChanges`)}),(0,H.jsx)(`button`,{className:`is-primary`,disabled:!!b||!C||!g,onClick:()=>void u(),type:`button`,children:i(b===`apply`?`common.loading`:`capabilities.applyPreview`)})]}):null,(0,H.jsx)(Jb,{values:[{label:i(`capabilities.goalValue`),value:l.current},{label:i(l.machine_current?`capabilities.machineValue`:`capabilities.defaultValue`),value:l.machine_current??l.default}],t:i},c.capability_id)]})]})}function ax({goalId:e}){let{t}=qi(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(!1);function c(){e&&(s(!0),a(null),Dg(e).then(r).catch(e=>a(e instanceof Error?e.message:t(`capabilities.loadFailed`))).finally(()=>s(!1)))}return(0,V.useEffect)(c,[e]),e?o&&!n?(0,H.jsxs)(`p`,{"aria-live":`polite`,className:`personal-capability-empty`,children:[(0,H.jsx)(wm,{className:`personal-spin`,size:18}),t(`capabilities.loading`)]}):i?(0,H.jsxs)(`section`,{className:`personal-capability-error`,role:`alert`,children:[(0,H.jsx)(Qm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:t(`capabilities.loadFailed`)}),(0,H.jsx)(`small`,{children:i})]}),(0,H.jsxs)(`button`,{onClick:c,type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":!0,size:15}),t(`capabilities.retry`)]})]}):n?(0,H.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n.revision,children:[(0,H.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:17}),t(`capabilities.atomicOverride`)]}),(0,H.jsx)(`p`,{children:t(`capabilities.atomicOverrideDescription`)})]}),(0,H.jsx)(ix,{catalog:n.capability_catalog,goalId:e,onApplied:c})]}):null:(0,H.jsx)(`p`,{className:`personal-capability-empty`,children:t(`capabilities.chooseGoal`)})}function ox(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function sx(e,t){let n=t?.machine_namespace;return n?e?.machine_configuration?.namespaces[n]:void 0}function cx(e,t,n){return{...ox(e.default),...ox(t),...n}}function lx(e,t){for(let n of e.configuration_editor.fields){let e=t[n.key];if(n.required&&(e==null||e===``))return!1}return e.capability_id===`periodic_report`&&t.enabled===!0?!!(String(t.profile_preset??``).trim()&&String(t.route_ref??``).trim()&&String(t.timezone??``).trim()):!0}function ux(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}catch{return null}}function dx(e){return e?e===`absent`?e:e.replace(/^sha256:/,``).slice(0,12):`—`}function fx(){let{locale:e,t}=qi(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)({}),[c,l]=(0,V.useState)(`{}`),[u,d]=(0,V.useState)(`guided`),[f,p]=(0,V.useState)(null),[m,h]=(0,V.useState)(`upsert`),[g,_]=(0,V.useState)(null),[v,y]=(0,V.useState)(null),[b,x]=(0,V.useState)(`load`),[S,C]=(0,V.useState)(null),[w,T]=(0,V.useState)(null),E=(0,V.useMemo)(()=>Qb(n?.capability_catalog.capabilities??[],e),[n,e]),D=n?.invalid_namespaces[0],O=E.find(e=>e.capability_id===i)??(D?E.find(e=>e.machine_namespace===D):void 0)??E.find(e=>qb(e,`machine`))??E[0],k=O?Gb(O,e):void 0,ee=sx(n,k),te=!!(k?.machine_namespace&&ee),A=!!(k&&qb(k,`machine`)),j=(0,V.useMemo)(()=>ux(c),[c]),M=k?u===`json`?j:cx(k,ee,o):null,N=!!(k&&(u===`json`?j:lx(k,M??{})));async function P(){r(await Eg())}(0,V.useEffect)(()=>{let e=!0;return Eg().then(t=>{e&&r(t)}).catch(n=>{e&&C(n instanceof Error?n.message:t(`machine.loadError`))}).finally(()=>{e&&x(null)}),()=>{e=!1}},[t]),(0,V.useEffect)(()=>{if(!k)return;let e=sx(n,k),t=Lb(k.configuration_editor,e??k.default,k.default),r=cx(k,e,t);s(t),l(JSON.stringify(r,null,2)),d(A?`guided`:`json`),p(null),h(`upsert`),y(null)},[n,i,e]);function F(e,t){s(n=>k?.capability_id===`periodic_report`?zb(n,e,t):{...n,[e]:t}),p(null),h(`upsert`),C(null),T(null)}function ne(e){if(k){if(e===`json`)l(JSON.stringify(cx(k,ee,o),null,2));else if(j)s(Lb(k.configuration_editor,j,k.default));else{C(t(`machine.jsonInvalid`));return}d(e),p(null),h(`upsert`),C(null)}}async function re(){if(!(!A||!k?.machine_namespace||!M||!N||b)){x(`preview`),C(null),T(null);try{h(`upsert`),p(await Ag(k.machine_namespace,M))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function I(){if(!(!A||!k?.machine_namespace||!te||b)){x(`preview`),C(null),T(null);try{h(`remove`),p(await Mg(k.machine_namespace))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function L(){if(!A||!k?.machine_namespace||!f||b||m===`upsert`&&!M)return;x(`apply`),C(null);let e=m;try{let n=e===`remove`?await Ng(k.machine_namespace,f.plan_revision):await jg(k.machine_namespace,M,f.plan_revision);_(n),p(null),h(`upsert`),y(null),await P(),T(n.status===`applied`?t(e===`remove`?`machine.removed`:`machine.applied`):t(`machine.unchanged`))}catch(e){p(null),h(`upsert`),C(e instanceof Error?e.message:t(`machine.applyError`))}finally{x(null)}}async function ie(){if(!(!g?.transaction_id||b)){x(`rollback-preview`),C(null);try{y(await Pg(g.transaction_id))}catch(e){C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}async function R(){if(!(!g?.transaction_id||!v||b)){x(`rollback`),C(null);try{await Fg(g.transaction_id,v.plan_revision),_(null),y(null),p(null),await P(),T(t(`machine.rolledBack`))}catch(e){y(null),C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}return b===`load`?(0,H.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:t(`common.loading`)}):k?(0,H.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n?.revision,children:[(0,H.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:17}),t(`machine.liveDefault`)]}),(0,H.jsx)(`p`,{children:t(`machine.liveDefaultDescription`)})]}),n?.status===`invalid`?(0,H.jsxs)(`section`,{className:`personal-machine-error`,"data-testid":`machine-invalid-repair`,role:`alert`,children:[(0,H.jsx)(`strong`,{children:t(`machine.invalidStoredConfiguration`)}),(0,H.jsx)(`p`,{children:t(`machine.invalidStoredConfigurationDescription`)})]}):null,(0,H.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,H.jsx)($b,{capabilities:E,locale:e,onSelect:a,scope:`machine`,selectedCapabilityId:k.capability_id,t}),(0,H.jsxs)(`article`,{"aria-label":k.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,H.jsx)(ex,{capability:O,locale:e,source:k.available_scopes.includes(`machine`)?te?`machine_default`:`capability_default`:void 0}),(0,H.jsx)(Xb,{available:A,t,description:k.available_scopes.includes(`machine`)?t(`machine.editorUnavailableDescription`):t(`machine.goalOnly`)}),k.capability_id===`periodic_report`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:ee?.schedule?e===`zh-CN`?`日历与阶段汇报`:`Calendar and stage reports`:t(`machine.periodicReportActivation`)}),(0,H.jsx)(`p`,{children:ee?.schedule?ee.enabled===!0?e===`zh-CN`?`已配置日历计划,由现有唤醒检查;是否送达请核对报告回执。`:`A calendar schedule is configured and checked by existing wakes. Verify delivery in the report receipt.`:e===`zh-CN`?`日历计划已保存;启用此能力后才会检查和投递。`:`The schedule is saved; enable this capability to check and deliver reports.`:t(`machine.periodicReportActivationDescription`)})]})]}):null,k.capability_id===`change_quality_qualification`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.changeQualityActivation`)}),(0,H.jsx)(`p`,{children:t(`machine.changeQualityActivationDescription`)})]})]}):null,k.capability_id===`todo_replan_cadence`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.replanCadenceActivation`)}),(0,H.jsx)(`p`,{children:t(`machine.replanCadenceActivationDescription`)})]})]}):null,k.capability_id===`pull_request_review`?(0,H.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,H.jsx)(Gm,{"aria-hidden":!0,size:18}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:e===`zh-CN`?`只改变队列排序`:`Queue ordering only`}),(0,H.jsx)(`p`,{children:e===`zh-CN`?`默认先审阅其他开发者的 PR;选择 owner-first 才会优先当前已认证审阅者自己的 PR。此配置不会发布 review、写 Todo、push 或 merge。`:`The default reviews other developers' PRs first; choose owner-first only when the authenticated reviewer's own PRs should lead. This setting never posts a review, writes Todos, pushes, or merges.`})]})]}):null,A?(0,H.jsxs)(H.Fragment,{children:[u===`json`||!k.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,H.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,H.jsxs)(`button`,{onClick:()=>ne(u===`guided`?`json`:`guided`),type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),t(u===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,u===`guided`?(0,H.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,H.jsx)(Hb,{copy:Kb(e),disabled:!!b,editor:k.configuration_editor,onChange:F,value:o,enabledAction:(0,H.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:()=>ne(`json`),type:`button`,children:[(0,H.jsx)(cm,{"aria-hidden":!0,size:14}),t(`machine.editJson`)]})}),N?null:(0,H.jsx)(`p`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.requiredFields`)})]}):(0,H.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`machine-configuration-json`,children:[(0,H.jsx)(`span`,{children:t(`machine.jsonConfiguration`)}),(0,H.jsx)(`textarea`,{"aria-describedby":`machine-configuration-json-help`,disabled:!!b,id:`machine-configuration-json`,onChange:e=>{l(e.target.value),p(null),C(null)},rows:12,spellCheck:!1,value:c}),(0,H.jsx)(`small`,{id:`machine-configuration-json-help`,children:t(`machine.jsonConfigurationHelp`)}),j?null:(0,H.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.jsonInvalid`)})]})]}):null,S?(0,H.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:S}):null,w?(0,H.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(tm,{"aria-hidden":!0,size:16}),w]}):null,f?(0,H.jsxs)(`section`,{"aria-label":t(`machine.preview`),className:`personal-machine-preview`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.preview`)}),(0,H.jsx)(`span`,{children:t(`machine.action.${f.action}`)})]}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`machine.currentRevision`)}),(0,H.jsx)(`dd`,{title:f.current_revision,children:dx(f.current_revision)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`machine.desiredRevision`)}),(0,H.jsx)(`dd`,{title:f.desired_revision,children:dx(f.desired_revision)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:t(`machine.changedNamespaces`)}),(0,H.jsx)(`dd`,{children:f.changed_namespaces.join(`, `)||t(`common.none`)})]})]}),(0,H.jsx)(`p`,{children:t(`machine.previewLocked`)})]}):null,g?.rollback_available&&g.transaction_id?(0,H.jsxs)(`section`,{className:`personal-machine-rollback`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:t(`machine.rollbackAvailable`)}),(0,H.jsx)(`p`,{children:t(v?`machine.rollbackPreviewDescription`:`machine.rollbackDescription`)})]}),(0,H.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!!b||!!(v&&!v.rollback_allowed),onClick:()=>void(v?R():ie()),type:`button`,children:[(0,H.jsx)(Rm,{"aria-hidden":!0,size:15}),t(b===`rollback`||b===`rollback-preview`?`common.loading`:v?`machine.confirmRollback`:`machine.previewRollback`)]})]}):null,A?(0,H.jsxs)(`footer`,{className:`personal-capability-actions`,children:[te?(0,H.jsxs)(`button`,{className:`is-danger`,disabled:!!b,onClick:()=>void I(),type:`button`,children:[(0,H.jsx)(Zm,{"aria-hidden":!0,size:15}),t(`machine.previewRemoval`)]}):null,(0,H.jsx)(`button`,{disabled:!!b||!N,onClick:()=>void re(),type:`button`,children:t(b===`preview`?`common.loading`:`machine.previewChanges`)}),(0,H.jsx)(`button`,{className:`is-primary`,disabled:!!b||!f,onClick:()=>void L(),type:`button`,children:t(b===`apply`?`common.loading`:`machine.applyPreview`)})]}):null,k.available_scopes.includes(`machine`)?(0,H.jsx)(Jb,{values:[{label:t(`machine.currentValue`),value:ee},{label:t(`capabilities.defaultValue`),value:k.default}],t},k.capability_id):null]})]})]}):(0,H.jsx)(`p`,{className:`personal-capability-empty`,children:t(`machine.capabilityEmpty`)})}var px={appearance:jm,capabilities:Km,language:xm,lark:Wm,machine:Hm};function mx({focusGoalConnection:e=!1,goals:t,initialGoalId:n,initialTab:r=`lark`,onChanged:i,onClose:a,onThemeChange:o,theme:s}){let{locale:c,setLocale:l,t:u}=qi(),[d,f]=(0,V.useState)(r),p=[...n?[{key:`capabilities`,label:u(`capabilities.title`)}]:[],{key:`machine`,label:u(`machine.title`)},{key:`lark`,label:`Lark`},{key:`appearance`,label:u(`settings.appearance`)},{key:`language`,label:u(`settings.language`)}],m=[{label:u(`settings.languageEnglish`),value:`en`},{label:u(`settings.languageSimplifiedChinese`),value:`zh-CN`}],h={appearance:{title:u(`settings.appearance`)},capabilities:{title:u(`capabilities.title`)},language:{title:u(`settings.language`)},lark:{title:`Lark`},machine:{title:u(`machine.title`)}}[d];return(0,H.jsxs)(`section`,{"aria-label":u(`settings.title`),className:`personal-settings-page`,"data-pw-theme":s,children:[(0,H.jsxs)(`aside`,{className:`personal-settings-sidebar`,children:[(0,H.jsxs)(`button`,{className:`personal-settings-back`,onClick:a,type:`button`,children:[(0,H.jsx)(Kp,{size:17}),(0,H.jsx)(`span`,{children:u(`settings.back`)})]}),(0,H.jsxs)(`div`,{className:`personal-settings-title`,children:[(0,H.jsx)(`small`,{children:u(`settings.eyebrow`)}),(0,H.jsx)(`strong`,{children:u(`settings.title`)})]}),(0,H.jsx)(`nav`,{"aria-label":u(`settings.categories`),className:`personal-settings-tabs`,children:p.map(e=>{let t=px[e.key];return(0,H.jsxs)(`button`,{"aria-current":d===e.key?`page`:void 0,onClick:()=>f(e.key),type:`button`,children:[(0,H.jsx)(t,{size:17}),(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:e.label})})]},e.key)})})]}),(0,H.jsxs)(`main`,{className:`personal-settings-body`,children:[(0,H.jsx)(`header`,{className:`personal-settings-header`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(`h1`,{children:h.title})})}),d===`lark`?(0,H.jsx)(Fb,{embedded:!0,focusGoalConnection:e,goals:t,initialGoalId:n,onChanged:i,onClose:a}):null,d===`machine`?(0,H.jsx)(fx,{}):null,d===`capabilities`?(0,H.jsx)(ax,{goalId:n}):null,d===`appearance`?(0,H.jsxs)(`section`,{className:`personal-detail-card personal-appearance-settings`,children:[(0,H.jsx)(`small`,{children:u(`settings.workspaceDisplay`)}),(0,H.jsx)(`h3`,{children:u(`settings.appearance`)}),(0,H.jsxs)(`div`,{className:`personal-settings-choice-group`,role:`radiogroup`,"aria-label":u(`settings.workspaceTheme`),children:[(0,H.jsxs)(`button`,{"aria-checked":s===`loopx`,onClick:()=>o(`loopx`),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-settings-theme-swatch is-loopx`}),(0,H.jsx)(`strong`,{children:u(`settings.themeLoopx`)})]}),(0,H.jsxs)(`button`,{"aria-checked":s===`paper`,onClick:()=>o(`paper`),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-settings-theme-swatch is-paper`}),(0,H.jsx)(`strong`,{children:u(`settings.themeDefault`)})]}),(0,H.jsxs)(`button`,{"aria-checked":s===`brutal`,onClick:()=>o(`brutal`),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-settings-theme-swatch is-brutal`}),(0,H.jsx)(`strong`,{children:u(`settings.themeHighContrast`)})]})]})]}):null,d===`language`?(0,H.jsxs)(`section`,{className:`personal-settings-card`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`span`,{className:`personal-settings-icon`,children:(0,H.jsx)(xm,{size:18})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(`h2`,{children:u(`settings.language`)})})]}),(0,H.jsx)(`div`,{"aria-label":u(`settings.language`),className:`personal-language-options`,role:`radiogroup`,children:m.map(e=>(0,H.jsxs)(`button`,{"aria-checked":c===e.value,className:c===e.value?`is-selected`:``,onClick:()=>l(e.value),role:`radio`,type:`button`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(`strong`,{children:e.label})}),c===e.value?(0,H.jsx)(tm,{"aria-hidden":!0,size:17}):null]},e.value))})]}):null]})]})}var hx=`loopx-pw-theme`,gx=`loopx`;function _x(){try{let e=window.localStorage.getItem(hx);return e===`loopx`||e===`paper`||e===`brutal`?e:gx}catch{return gx}}function vx(e){try{window.localStorage.setItem(hx,e)}catch{}}function yx({drawer:e,drawerMode:t=`panel`,drawerOpen:n,main:r,mobileSidebarOpen:i=!1,onCloseMobileSidebar:a,sidebar:o,theme:s=`loopx`}){let{t:c}=qi(),l=(0,V.useRef)(null),u=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(!i)return;u.current=document.activeElement instanceof HTMLElement?document.activeElement:null;let e=l.current?.querySelectorAll(`button:not([disabled]), a[href], select:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])`);e?.[0]?.focus();function t(t){if(t.key!==`Tab`||!e?.length)return;let n=e[0],r=e[e.length-1];t.shiftKey&&document.activeElement===n?(t.preventDefault(),r.focus()):!t.shiftKey&&document.activeElement===r&&(t.preventDefault(),n.focus())}return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),u.current?.focus(),u.current=null}},[i]),(0,H.jsxs)(`section`,{className:`personal-workspace-shell${n?` has-drawer`:``}${n&&t.startsWith(`inspector`)?` has-task-inspector`:``}${t===`inspector-full`?` is-task-inspector-full`:``}${i?` mobile-sidebar-open`:``}`,"data-pw-theme":s,children:[i?(0,H.jsx)(`button`,{"aria-hidden":!0,className:`personal-sidebar-backdrop`,onClick:a,tabIndex:-1,type:`button`}):null,(0,H.jsx)(`aside`,{"aria-label":i?c(`header.goalNavigation`):void 0,"aria-modal":i?!0:void 0,className:`personal-workspace-sidebar`,"data-workspace-sidebar":!0,ref:l,role:i?`dialog`:void 0,children:(0,H.jsxs)(`div`,{className:`personal-workspace-sidebar-inner`,children:[i?(0,H.jsxs)(`button`,{className:`personal-sr-only`,onClick:a,type:`button`,children:[c(`common.close`),` `,c(`header.goalNavigation`)]}):null,o]})}),(0,H.jsx)(`main`,{"aria-hidden":i||void 0,className:`personal-workspace-main`,inert:i||void 0,children:r}),n?(0,H.jsx)(`aside`,{className:`personal-workspace-drawer`,"data-context-drawer":!0,"data-drawer-mode":t,children:e}):null]})}function bx(e){let t=e.match(/(?:下一步|建议|行动项|待办)[::\s]*([^\n]+)/u),n=t?t[1]:e;n=n.replace(/```[\s\S]*?```/g,``).replace(/`([^`]+)`/g,`$1`).replace(/\[([^\]]+)\]\([^)]+\)/g,`$1`).replace(/[#*~_>]/g,``).replace(/^[-*•\d+.\s]+/u,``).replace(/^(好的|没问题|收到|建议如下|任务如下|分析如下|结论[::])[\s,,::]*/u,``);let r=(n.split(/\r?\n/).map(e=>e.trim()).filter(Boolean)[0]||n).replace(/\s+/gu,` `).trim();return Array.from(r).slice(0,120).join(``)}function xx(e){let t=new Map;return e.forEach(e=>{let n=e.fields.find(e=>e.key===`todo_id`)?.value??``,r=[e.actionKind,e.goalId??``,n,e.title].join(`:`);t.set(r,e)}),[...t.values()]}function Sx(e,t,n){if(!e)return n(`home.noFirstActivity`);let r=new Date(e);if(Number.isNaN(r.getTime()))return e;let i=new Date,a=new Intl.DateTimeFormat(t,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);return r.toDateString()===i.toDateString()?n(`home.todayAt`,{time:a}):new Intl.DateTimeFormat(t,{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r)}function Cx({goals:e,onSelectGoal:t,onRetry:n,systemHealth:r}){let{locale:i,t:a}=qi(),o=e.filter(e=>e.activationState===`active`),s=o.filter(e=>e.loadState===`error`).length,c=[{key:`needs_you`,label:a(`home.lane.needsYou`)},{key:`running`,label:a(`home.lane.running`)},{key:`observing`,label:a(`home.lane.observing`)},{key:`scheduled`,label:a(`home.lane.scheduled`)}],l=Object.fromEntries(c.map(e=>[e.key,[]])),u=[],d=[];e.filter(e=>!e.loadState).forEach(e=>{let t=by(e);t===`history`?u.push(e):t===`stopped`?d.push(e):l[t].push(e)});let f=e=>(0,H.jsxs)(`button`,{className:`personal-home-goal-card`,"data-goal-state":e.loadState??e.state,"data-load-error":e.loadError,onClick:()=>t(e.goalId),type:`button`,children:[(0,H.jsxs)(`span`,{className:`personal-home-goal-meta`,children:[(0,H.jsx)(`i`,{}),e.agentLaneCount&&e.agentLaneCount>1?a(`header.workAgentCount`,{count:e.agentLaneCount}):e.agentLabel??e.agentId]}),(0,H.jsx)(`strong`,{children:e.title}),(0,H.jsx)(`p`,{children:e.loadError?a(`startup.error.${e.loadError}`):e.needsYou??e.nextSentence}),(0,H.jsxs)(`footer`,{children:[(0,H.jsx)(`span`,{children:e.loadState?a(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Ji(e.state,i)}),(0,H.jsx)(`small`,{title:e.latestActivity,children:e.loadState?``:e.latestActivity?Sx(e.latestActivity,i,a):e.agentTodos.length?a(`home.taskCount`,{count:e.agentTodos.length}):a(`home.noActivity`)})]})]},e.goalId);return(0,H.jsxs)(`section`,{"aria-label":a(`home.workspace`),className:`personal-home-board`,children:[r&&(!r.ok||r.issues.length>0||r.freshnessWarning)?(0,H.jsxs)(`div`,{className:`personal-system-health-banner`,role:`alert`,children:[(0,H.jsxs)(`div`,{className:`personal-system-health-header`,children:[(0,H.jsx)(am,{size:15}),(0,H.jsx)(`strong`,{children:a(`home.systemHealth`,{summary:r.summary})}),r.freshnessWarning?(0,H.jsxs)(`small`,{children:[`(`,r.freshnessWarning,`)`]}):null]}),r.issues.length>0?(0,H.jsx)(`ul`,{className:`personal-system-health-issues`,children:r.issues.map((e,t)=>(0,H.jsx)(`li`,{children:e},t))}):null]}):null,o.some(e=>e.loadState)?(0,H.jsxs)(`section`,{className:`personal-home-lane`,"aria-live":`polite`,children:[(0,H.jsx)(`header`,{children:a(`startup.progress`,{loaded:o.filter(e=>!e.loadState).length,total:o.length})}),s?(0,H.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`status`,children:[(0,H.jsx)(`span`,{children:a(`startup.failedCount`,{count:s})}),(0,H.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,onClick:n,type:`button`,children:a(`startup.retryFailed`)})]}):null,o.filter(e=>e.loadState).map(f)]}):null,(0,H.jsx)(`div`,{className:`personal-home-lanes`,children:c.map(e=>(0,H.jsxs)(`section`,{className:`personal-home-lane is-${e.key}`,"data-testid":`personal-home-lane-${e.key}`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`i`,{}),e.label]}),(0,H.jsx)(`b`,{children:l[e.key].length})]}),(0,H.jsx)(`div`,{className:`personal-home-lane-list`,children:l[e.key].length?l[e.key].map(f):(0,H.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.empty`)})})]},e.key))}),(0,H.jsxs)(`details`,{className:`personal-home-history`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{children:a(`home.history`)}),(0,H.jsx)(`b`,{children:u.length}),(0,H.jsx)(`small`,{children:a(`home.completedGoals`)})]}),(0,H.jsx)(`div`,{children:u.length?u.map(f):(0,H.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.noCompletedGoals`)})})]}),d.length?(0,H.jsxs)(`details`,{className:`personal-home-history is-stopped`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{children:a(`home.stopped`)}),(0,H.jsx)(`b`,{children:d.length}),(0,H.jsx)(`small`,{children:a(`home.preservedState`)})]}),(0,H.jsx)(`div`,{children:d.map(f)})]}):null]})}function wx({items:e,onSelect:t,reportState:n}){let{locale:r,t:i}=qi();return(0,H.jsxs)(`section`,{className:`personal-object-list personal-files-list`,"data-testid":`personal-goal-outputs`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsx)(`strong`,{children:i(`files.title`)}),(0,H.jsx)(`span`,{children:e.length})]}),n?.loading?(0,H.jsxs)(`p`,{className:`personal-object-list-state`,role:`status`,children:[(0,H.jsx)(Lm,{className:`is-spinning`,size:14}),i(`files.loadingReports`)]}):null,n?.error?(0,H.jsxs)(`p`,{className:`personal-object-list-state is-error`,role:`alert`,children:[(0,H.jsx)(am,{size:14}),i(`files.reportLoadFailed`),`: `,n.error]}):null,!n?.loading&&!n?.error&&e.length===0?(0,H.jsxs)(`p`,{className:`personal-object-list-state`,children:[(0,H.jsx)(_m,{size:14}),i(`files.empty`)]}):null,e.map(e=>(0,H.jsxs)(`button`,{"data-output-kind":e.output.kind,onClick:()=>t({item:e.output,kind:`output`}),type:`button`,children:[(0,H.jsx)(`span`,{className:`personal-file-icon`,children:(0,H.jsx)(_m,{size:16})}),(0,H.jsx)(`strong`,{children:e.output.title}),e.output.report?(0,H.jsx)(`em`,{children:i(`files.reportDelta`,{added:e.output.report.addedCount,changed:e.output.report.changedCount})}):null,(0,H.jsx)(`p`,{children:e.output.summary??e.output.safePreview??e.output.kind??i(`files.emptySummary`)}),(0,H.jsx)(`small`,{title:e.output.createdAt,children:[e.output.goalTitle,e.output.kind===`report`?i(`files.verifiedReport`):null,e.output.todoId?`${i(`common.task`)} ${e.output.todoId}`:null,Sx(e.output.createdAt,r,i)].filter(Boolean).join(` · `)})]},e.id))]})}function Tx({agentLabel:e,messages:t,onClose:n,onDraftTask:r,onOpenConversation:i,title:a}){let{t:o}=qi(),s=t.reduce((e,t,n)=>t.role===`user`?n:e,0),c=t.slice(Math.max(0,s)).slice(-3),l=c.filter(e=>e.role===`assistant`&&!e.pending).at(-1);return(0,V.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,H.jsxs)(`aside`,{"aria-label":o(`conversation.receipt`),className:`personal-manager-conversation-tray`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:16}),(0,H.jsx)(`strong`,{children:a??o(`conversation.title`)}),(0,H.jsx)(`small`,{children:t.at(-1)?.pending?o(`conversation.replying`):o(`common.recently`)})]}),(0,H.jsxs)(`div`,{className:`personal-manager-conversation-actions`,children:[r&&l?(0,H.jsxs)(`button`,{className:`personal-manager-conversation-btn`,onClick:()=>r(l.text),title:o(`conversation.convertHint`),type:`button`,children:[(0,H.jsx)(Cm,{size:13}),(0,H.jsx)(`span`,{children:o(`conversation.toTask`)})]}):null,(0,H.jsx)(`button`,{className:`personal-manager-conversation-link`,onClick:i,type:`button`,children:o(`conversation.full`)}),n?(0,H.jsx)(`button`,{"aria-label":o(`conversation.close`),className:`personal-manager-conversation-close`,onClick:n,title:o(`conversation.close`),type:`button`,children:(0,H.jsx)(eh,{size:14})}):null]})]}),(0,H.jsx)(`div`,{"aria-live":`polite`,className:`personal-manager-conversation-messages`,children:c.map(t=>(0,H.jsxs)(`article`,{className:`is-${t.role}`,children:[(0,H.jsx)(`strong`,{children:t.role===`user`?o(`common.you`):t.agentLabel??e??o(`header.manager`)}),(0,H.jsxs)(`div`,{className:`personal-manager-conversation-bubble`,children:[t.role===`user`?(0,H.jsx)(`p`,{children:t.text}):(0,H.jsx)(Fy,{text:t.text}),t.pending?(0,H.jsx)(`small`,{children:o(`conversation.agentPending`)}):null,(0,H.jsx)(By,{delivery:t.returnDelivery})]})]},t.id))})]})}function Ex({onClose:e,onOpenDetails:t,run:n}){let{t:r}=qi();return(0,H.jsxs)(`section`,{"aria-label":r(`session.record`),className:`personal-session-record`,children:[(0,H.jsxs)(`header`,{children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:17}),r(`session.record`)]}),(0,H.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,H.jsx)(eh,{size:15})})]}),(0,H.jsx)(`div`,{children:(0,H.jsx)(`strong`,{children:n.title})}),(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Agent`}),(0,H.jsx)(`dd`,{children:n.agentLabel})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:r(`common.status`)}),(0,H.jsx)(`dd`,{children:Yi(n.sessionStatus??n.status,r)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Session`}),(0,H.jsx)(`dd`,{title:n.sessionId,children:n.sessionId})]})]}),(0,H.jsx)(`button`,{className:`personal-secondary-action`,onClick:t,type:`button`,children:r(`session.details`)})]})}function Dx(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??yy(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>by(e)===`running`).slice(0,4).forEach(e=>r.push({id:`run:${e.goalId}`,kind:`run`,run:{agentId:e.agentId,agentLabel:e.agentLabel??e.agentId,completedSteps:e.doneTodoCount??e.agentTodos.filter(e=>e.done).length,goalId:e.goalId,goalTitle:e.title,latestActivity:e.agentSentence,runId:`goal:${e.goalId}`,status:`running`,title:e.nextSentence,totalSteps:Math.max((e.doneTodoCount??0)+e.agentTodos.filter(e=>!e.done).length,1)}})),r;let i=e.goals.find(e=>e.goalId===t);if(!i)return r;if(i.needsYou){let t=e.userTodos.find(e=>e.goalId===i.goalId);r.push({attention:t?{...t,goalTitle:i.title}:{blocking:i.needsYouBlocking??!1,goalId:i.goalId,goalTitle:i.title,text:i.needsYou,todoId:`${i.goalId}:attention`},id:`attention:${i.goalId}`,kind:`attention`})}r.push({id:`run:${i.goalId}`,kind:`run`,run:{agentId:i.agentId,agentLabel:i.agentLabel??i.agentId,completedSteps:i.doneTodoCount??i.agentTodos.filter(e=>e.done).length,goalId:i.goalId,goalTitle:i.title,latestActivity:i.agentSentence,runId:`goal:${i.goalId}`,status:i.state===`推进中`?`running`:i.state===`需修复`?`failed`:`waiting`,title:i.nextSentence,totalSteps:Math.max((i.doneTodoCount??0)+i.agentTodos.filter(e=>!e.done).length,1)}}),i.agentTodos.filter(e=>e.taskClass===`continuous_monitor`).forEach(t=>{let a=e.timeline?.find(e=>e.kind===`run`&&e.run.goalId===i.goalId&&e.run.todoId===t.todoId&&!!e.run.sessionId);r.push({id:`schedule:${i.goalId}:${t.todoId}`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:a?[{label:a.run.latestActivity||a.run.title,runId:a.run.runId,status:a.run.status===`waiting`||a.run.status===`queued`?`running`:a.run.status,timestamp:i.latestActivity||n(`common.recently`)}]:[],goalId:i.goalId,label:t.text,schedule:t.evidence??n(`schedule.summary`),scheduleId:t.todoId,scheduleKind:`monitor`,sessionId:a?.run.sessionId,status:t.done||t.status===`paused`?`paused`:`active`,stopCondition:n(`drawer.scheduleDefaultStop`),target:t.text,timezone:`Asia/Shanghai`}})});let a=e.timeline?.find(e=>e.kind===`proposal`&&e.proposal.actionKind===`heartbeat.bind`&&e.proposal.goalId===i.goalId);if(a){let e=e=>a.proposal.fields.find(t=>t.key===e)?.value;r.push({id:`schedule:${i.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:[],goalId:i.goalId,label:`${n(`schedule.heartbeat`)} · ${i.title}`,nextRunAt:n(`drawer.schedulePending`),notificationRule:n(`drawer.scheduleDefaultNotification`),schedule:e(`cadence`)??n(`schedule.summary`),scheduleId:`${i.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:a.proposal.status===`applied`?`active`:`draft`,stopCondition:e(`stop_condition`)??n(`drawer.scheduleDefaultStop`),timezone:e(`timezone`)??`Asia/Shanghai`}})}return r}function Ox(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function kx(e,t){let n={agent_id:t(`proposal.field.agentId`),cadence:t(`proposal.field.cadence`),completion_criteria:t(`proposal.field.completionCriteria`),execution_boundary:t(`proposal.field.executionBoundary`),goal_id:t(`proposal.field.goalId`),heartbeat:t(`proposal.field.heartbeat`),initial_todos:t(`proposal.field.initialTodos`),objective:t(`proposal.field.objective`),operation:t(`proposal.field.operation`),permission:t(`proposal.field.permission`),reason:t(`proposal.field.reason`),stop_condition:t(`proposal.field.stopCondition`),target:t(`proposal.field.target`),timezone:t(`proposal.field.timezone`),title:t(`proposal.field.title`),workspace_ref:t(`proposal.field.workspace`)},r=[`title`,`objective`,`completion_criteria`,`execution_boundary`,`permission`,`agent_id`,`workspace_ref`,`initial_todos`,`heartbeat`,`stop_condition`,`goal_id`];return Object.entries(e).sort(([e],[t])=>{let n=r.indexOf(e),i=r.indexOf(t);return(n<0?r.length:n)-(i<0?r.length:i)}).slice(0,10).map(([e,r])=>({key:e,label:n[e]??e.replaceAll(`_`,` `),value:e===`workspace_ref`?r===`current`?t(`proposal.workspace.current`):t(`proposal.workspace.named`,{workspace:String(r??`current`)}):Array.isArray(r)?r.join(` · `):typeof r==`object`&&r?JSON.stringify(r):String(r??`—`)}))}function Ax(e,t,n){let r=t.operationFrame,i=r?.content.fields.map((e,t)=>({key:`projection:${t}`,label:e.label,value:e.value})).slice(0,8)??[];return[{key:`operation_state`,label:n(`proposal.field.operationState`),value:r?.lifecycleState??e.status},...r?.kind===`result`?[{key:`result_delivery`,label:n(`proposal.field.resultDelivery`),value:r.resultDeliveryVerified?n(`proposal.resultDelivery.verified`):n(`proposal.resultDelivery.pending`)}]:[],...i,...r?[{key:`warning`,label:n(`proposal.field.confirmationBoundary`),value:r.content.warning}]:[],...r?[{key:`expires_at`,label:n(`proposal.field.expiresAt`),value:r.expiresAt}]:[]].slice(0,10)}function jx(e){if(e.action_kind!==`goal.lifecycle`)return;let t=e.normalized_parameters.operation;return t===`stop`||t===`resume`||t===`delete`?t:void 0}function Mx(e,t){let n=jx(e),r=gy(e),i=typeof e.normalized_parameters.title==`string`?e.normalized_parameters.title:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:``,a=typeof e.normalized_parameters.target==`string`?e.normalized_parameters.target:``,o=r.operationFrame,s=o?.content.title??e.summary,c=e.action_kind===`operation.execute`?s:e.action_kind===`goal.create`?t(`proposal.summary.goalCreate`,{title:i}):e.action_kind===`heartbeat.bind`?t(`proposal.summary.heartbeat`):e.action_kind===`monitor.create`?t(`proposal.summary.monitor`,{target:a}):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.summary.lifecycleStop`,{title:i}):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.summary.lifecycleDelete`,{title:i}):e.action_kind===`goal.lifecycle`?t(`proposal.summary.lifecycleResume`,{title:i}):e.summary;return{actionKind:e.action_kind,reviewPlan:r,fields:e.action_kind===`operation.execute`?Ax(e,r,t):kx(e.normalized_parameters,t),goalId:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:void 0,impact:e.action_kind===`operation.execute`?t(`proposal.impact.operation`):e.action_kind===`goal.create`?t(`proposal.impact.goalCreate`):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.impact.lifecycleStop`):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.impact.lifecycleDelete`):e.action_kind===`goal.lifecycle`?t(`proposal.impact.lifecycleResume`):e.permission_classification===`protected`?t(`proposal.impact.protected`):t(`proposal.impact.default`),previewId:e.proposal_id,lifecycleOperation:n,gate:e.gate?{kind:String(e.gate.kind??`protected_action`),nextAction:typeof e.gate.next_action==`string`?e.gate.next_action:void 0,summary:String(e.gate.summary??t(`proposal.gate.default`))}:void 0,primaryLabel:e.action_kind===`operation.execute`?o?.kind===`result`?o.resultDeliveryVerified?t(`proposal.primary.operationResultVerified`):t(`proposal.primary.operationResultPending`):t(`proposal.primary.operationGroup`):e.action_kind===`goal.create`?t(`proposal.primary.goalCreate`):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.primary.lifecycleStop`):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.primary.lifecycleDelete`):e.action_kind===`goal.lifecycle`?t(`proposal.primary.lifecycleResume`):e.action_kind===`todo.create`&&e.normalized_parameters.start_execution===!0?t(`proposal.primary.todoStart`):t(`proposal.primary.apply`),status:e.status===`applied`&&e.action_kind!==`operation.execute`&&r.interaction!==`completed`?`error`:Ox(e.status),title:c}}function Nx(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,42);if(t)return t;let n=2166136261;for(let t of e)n^=t.codePointAt(0)??0,n=Math.imul(n,16777619);return`goal-${(n>>>0).toString(36)}`}function Px(e,t){let n=e.match(/[「“"]([^」”"]{2,80})[」”"]/u)?.[1];return n?n.trim():e.replace(/^(请|帮我|我想|给我|创建|新建|设置|please|i want to|create|set up)+/iu,``).replace(/(一个|新的)?\s*(goal|目标)/giu,``).replace(/[,。!?].*$/u,``).trim().slice(0,80)||t(`goal.defaultTitle`)}function Fx(e,t){for(let n of e.split(/\r?\n/u)){let e=n.trim();for(let n of t){let t=e.match(RegExp(`^${n.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}\\s*[::]\\s*(.*)$`,`iu`));if(t?.[1]?.trim())return t[1].trim()}}return``}function Ix(e,t){let n=Fx(e,[`目标`,`Objective`]),r=Fx(e,[`完成标准`,`Completion criteria`]),i=Fx(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||Px(e,t)).split(/[。;;\n]/u)[0].trim().slice(0,80)||t(`goal.defaultTitle`),o=[n||a,r?t(`goal.objectiveCompletion`,{criteria:r}):``,i?t(`goal.objectiveBoundary`,{boundary:i}):``].filter(Boolean).join(` +`),s=/(只读|不调用外部工具|不修改(?:仓库|代码|状态)|read.?only|do not (?:call|use) external tools|do not modify (?:repositories|repository|code|state))/iu.test(i||e);return{completionCriteria:r,executionBoundary:i,initialTodos:r?[t(`goal.initialTodo`,{criteria:r})]:[],objective:o,permission:s?`read_only`:`workspace_write_on_confirmation`,title:a}}function Lx(e){let t=e.match(/(?:每|every)\s*(\d{1,3})\s*(?:分钟|minutes?)/iu)?.[1];if(t)return`${t}m`;let n=e.match(/(?:每|every)\s*(\d{1,2})\s*(?:小时|hours?)/iu)?.[1];return n?`${n}h`:/每小时|every hour|hourly/iu.test(e)?`1h`:(/每天|每日|早上|上午|daily|every day/iu.test(e),`1d`)}function Rx(e,t){return/(每周|星期|周[一二三四五六日天]|weekly|every\s+(?:mon|tues|wednes|thurs|fri|satur|sun)day|\d{1,2}\s*[::]\s*\d{2})/iu.test(e)?t(`schedule.unsupportedCalendar`):null}function zx(e,t){return Fx(e,[`检查内容`,`监控内容`,`目标`,`Check target`,`Monitor target`,`Target`])||e.replace(/^(?:为当前 Goal |for the current Goal )?(?:添加|配置|创建|add|configure|create)?\s*(?:定时检查|监控|scheduled check|monitor)[::]?/iu,``).split(/\r?\n/u)[0].trim()||t(`schedule.defaultTarget`)}function Bx(e){return/(mr|pr).{0,8}(合并|merge)/iu.test(e)?`pr_merged`:/发布完成|上线完成|release (?:is )?complete|deployment (?:is )?complete/iu.test(e)?`release_complete`:`goal_complete`}function Vx(e,t){let n=e.toLowerCase();return t.find(e=>n.includes(e.agentId.toLowerCase())||n.includes(e.label.toLowerCase()))}function Hx(e){let t=Fx(e,[`标题`,`任务标题`,`Todo 标题`]),n=Fx(e,[`内容`,`任务内容`,`Todo 内容`]);if(t)return[t,n].filter(Boolean).join(`:`).slice(0,400);let r=e.match(/[「“"]([^」”"]{2,200})[」”"]/u)?.[1];return r?r.trim():e.replace(/^(请|帮我|给我|为当前 Goal |新增|新建|创建|添加|加上|加一个|记一个)+/u,``).replace(/^(一个\s*)?(普通\s*)?(todo|待办|任务)(?:\s*到\s*Tasks?)?[::\s]*/iu,``).replace(/[。;;,,]\s*(?:不要|不需要|无需|禁止|别|暂不).{0,80}(?:heartbeat|心跳|定时|监控|执行).*$/iu,``).replace(/[,,]\s*(并且|然后|再)?\s*(交给|分配给|让).+$/u,``).replace(/\s*(交给|分配给|让)\s+.+$/u,``).trim().slice(0,400)||`推进当前 Goal 的下一项工作`}var Ux=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),Wx=5242880,Gx=4;function Kx(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onerror=()=>r(Error(t(`composer.imageReadError`,{name:e.name}))),i.onload=()=>n({dataUrl:String(i.result??``),id:crypto.randomUUID(),mimeType:e.type,name:e.name,size:e.size}),i.readAsDataURL(e)})}function qx({agents:e=[{agentId:`codex`,available:!0,capability:`代码与项目执行`,label:`Codex`}],callbacks:t={},goalArchiveLoadState:n={error:null,phase:`ready`},managerRuntime:r,model:i,readOnly:a=!1,selectedAgentId:o,selectedGoalId:s,statusSourceControl:c}){let{locale:l,t:u}=qi(),[d,f]=(0,V.useState)(s??null),[p,m]=(0,V.useState)(o??e.find(e=>e.available)?.agentId??`codex`),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(null),[x,S]=(0,V.useState)({}),[C,w]=(0,V.useState)(`chat`),[T,E]=(0,V.useState)(!1),[D,O]=(0,V.useState)(!1),[k,ee]=(0,V.useState)(!1),[te,A]=(0,V.useState)(()=>{try{let e=window.sessionStorage.getItem(`loopx-pw-composer-drafts`),t=e?JSON.parse(e):{};return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}),[j,M]=(0,V.useState)(!1),[N,P]=(0,V.useState)([]),[F,ne]=(0,V.useState)(null),[re,I]=(0,V.useState)(null),[L,ie]=(0,V.useState)(()=>new Set),[R,ae]=(0,V.useState)(()=>new Set),[oe,se]=(0,V.useState)(`idle`),[ce,le]=(0,V.useState)([]),[ue,z]=(0,V.useState)(!1),[de,fe]=(0,V.useState)(_x),[pe,me]=(0,V.useState)({}),[he,ge]=(0,V.useState)([]),_e=(0,V.useRef)(!1),ve=(0,V.useRef)(NaN),ye=(0,V.useRef)(null),be=(0,V.useRef)(null),xe=(0,V.useRef)(null),Se=(0,V.useRef)(new Set),Ce=(0,V.useRef)(new Set),[we,Te]=(0,V.useState)(null),B=s===void 0?d:s,Ee=o??p,De=`${B??`manager`}:${Ee}`,Oe=te[De]??``;(0,V.useEffect)(()=>{P([]),ne(null)},[De]);function ke(e,t){A(n=>{let r={...n};t?r[e]=t:delete r[e];try{window.sessionStorage.setItem(`loopx-pw-composer-drafts`,JSON.stringify(r))}catch{}return r})}function Ae(e){ke(De,e)}function je(e){let t=te[De]?.trimEnd();Ae(t?`${t}\n${e}`:e),window.requestAnimationFrame(()=>ye.current?.focus())}(0,V.useEffect)(()=>{let e=ye.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[Oe]);let Me=(0,V.useMemo)(()=>i.goals.map(e=>{let t=pe[e.goalId];return t?{...e,repository:{branch:t.branch,identity:t.identity,label:t.label,readOnly:!0}}:e}),[pe,i.goals]),Ne=(0,V.useMemo)(()=>Me.filter(e=>by(e)===`needs_you`).length,[Me]),Pe=(0,V.useMemo)(()=>Me.filter(e=>by(e)===`needs_you`&&(e.needsYouBlocking||e.state===`等你`)).length,[Me]),Fe=Me.find(e=>e.goalId===B)??null,Ie=h?.kind===`settings`,Le=B,Re=(0,V.useMemo)(()=>{let e=Object.values(x).filter(e=>e.actionKind===`heartbeat.bind`&&e.goalId&&e.status===`applied`).map(e=>({id:`schedule:${e.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:Ee,executionHistory:[],goalId:e.goalId,label:e.title,nextRunAt:u(`drawer.schedulePending`),notificationRule:u(`drawer.scheduleDefaultNotification`),schedule:e.fields.find(e=>e.key===`cadence`)?.value??u(`schedule.summary`),scheduleId:`${e.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:e.status===`applied`?`active`:`draft`,stopCondition:e.fields.find(e=>e.key===`stop_condition`)?.value??u(`drawer.scheduleDefaultStop`),timezone:e.fields.find(e=>e.key===`timezone`)?.value??`Asia/Shanghai`}})),t=[...Dx(i,Le,u),...i.timeline??[],...e,...xx(Object.values(x)).filter(e=>e.actionKind!==`heartbeat.bind`||e.status!==`applied`).map(e=>({id:`proposal:${e.previewId}`,kind:`proposal`,proposal:e}))];return[...new Map(t.map(e=>[e.id,e])).values()].filter(e=>e.kind!==`proposal`||![`stale`,`error`].includes(e.proposal.status)||ce.includes(e.proposal.previewId)).filter(e=>!B||e.kind===`message`?!0:e.kind===`proposal`?!e.proposal.goalId||e.proposal.goalId===B:e.kind===`attention`?e.attention.goalId===B:e.kind===`run`?e.run.goalId===B:e.kind===`schedule`?e.schedule.goalId===B:e.output.goalId===B)},[Le,i,x,Ee,B,ce,u]),ze=(0,V.useMemo)(()=>y?Re.filter(e=>e.kind===`message`?!0:e.kind===`run`?e.run.runId===y.runId:e.kind===`output`&&e.output.runId===y.runId):Re,[y,Re]);(0,V.useEffect)(()=>{if(!y)return;let e=Re.find(e=>e.kind===`run`&&e.run.runId===y.runId);!e||e.kind!==`run`||JSON.stringify({completedSteps:y.completedSteps,latestActivity:y.latestActivity,messages:y.sessionMessages,sessionStatus:y.sessionStatus,status:y.status,totalSteps:y.totalSteps})!==JSON.stringify({completedSteps:e.run.completedSteps,latestActivity:e.run.latestActivity,messages:e.run.sessionMessages,sessionStatus:e.run.sessionStatus,status:e.run.status,totalSteps:e.run.totalSteps})&&b(e.run)},[y,Re]);let Be=(0,V.useMemo)(()=>Re.flatMap(e=>e.kind===`message`?[e.message]:[]),[Re]),Ve=(0,V.useMemo)(()=>Fe?Re.flatMap(e=>e.kind===`message`?[e.message]:[]):[],[Re,Fe]);(0,V.useEffect)(()=>{Fe||T||Be.some(e=>e.pending)&&O(!0)},[T,Be,Fe]),(0,V.useEffect)(()=>{!Fe||C===`chat`||Ve.some(e=>e.pending)&&ee(!0)},[Ve,Fe,C]);let He=(0,V.useMemo)(()=>Re.filter(e=>e.kind===`message`||e.kind===`proposal`&&ce.includes(e.proposal.previewId)),[Re,ce]),Ue=He[He.length-1],We=Ue?.kind===`message`?Ue.message.text.length:0;(0,V.useEffect)(()=>{if(!T||!be.current)return;let e=window.requestAnimationFrame(()=>{be.current&&(be.current.scrollTop=be.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[He.length,T,We]);let Ge=(0,V.useMemo)(()=>{if(h?.kind===`settings`)return null;if(h?.kind===`attention`)return{kind:`attention`,item:Gd(h.item,i.attentionHistory??i.userTodos)};if(h?.kind===`goal`){let e=Me.find(e=>e.goalId===h.item.goalId);return e?{item:e,kind:`goal`}:h}if(h?.kind!==`run`)return h;let e=Re.find(e=>e.kind===`run`&&e.run.runId===h.item.runId);return e?{item:e.run,kind:`run`}:h},[Re,h,Me,i.attentionHistory,i.userTodos]);(0,V.useEffect)(()=>{if(a){me({}),ge([]);return}let e=!1;return Promise.all([Lg(),Jg()]).then(([t,n])=>{e||(me(Object.fromEntries(t.map(e=>[e.goal_id,e.repository]))),ge(n))}).catch(()=>{}),()=>{e=!0}},[a]),(0,V.useEffect)(()=>{if(!ue)return;function e(e){e.key===`Escape`&&z(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[ue]),(0,V.useEffect)(()=>{if(B||!Re.length)return;if(!_e.current){_e.current=!0;try{ve.current=Date.parse(window.localStorage.getItem(`loopx-pw-last-visit`)??``),window.localStorage.setItem(`loopx-pw-last-visit`,new Date().toISOString())}catch{ve.current=NaN}}let e=ve.current,t=Re.filter(e=>e.kind===`run`).map(e=>e.run),n=t=>{let n=Date.parse(t??``);return!Number.isNaN(e)&&!Number.isNaN(n)&&n>e},r={attention:Ne,done:t.filter(e=>e.status===`completed`&&n(e.latestActivity)).length,failed:t.filter(e=>(e.status===`failed`||e.status===`interrupted`)&&n(e.latestActivity)).length};Te(e=>e?.attention===r.attention&&e.done===r.done&&e.failed===r.failed?e:r)},[Re,Ne,B]),(0,V.useEffect)(()=>{if(a){S({});return}let e=!1;return Nh(B?{goalId:B}:{contextKind:`manager`}).then(t=>{if(e)return;let n=Object.fromEntries(t.filter(e=>[`preview_ready`,`gated`,`deferred`,`applying`].includes(e.status)||e.action_kind===`operation.execute`&&e.status===`applied`).map(e=>{let t=Mx(e,u);return[t.previewId,t]}));S(e=>({...e,...n}))}).catch(()=>{}),()=>{e=!0}},[a,B,u]);async function Ke(e,n={}){if(a)throw Error(u(`source.readOnlyWriteError`));let r;try{r=t.onPreviewAction?await t.onPreviewAction(e):Mx(await jh(e),u)}catch(t){if(!(t instanceof Eh)||t.payload.error_code!==`action_preview_gate`)throw t;let n=t.payload.gate&&typeof t.payload.gate==`object`?t.payload.gate:{},i=(Array.isArray(n.candidates)?n.candidates:[]).flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.workspace_ref==`string`&&typeof t.label==`string`?[{label:t.label,workspaceRef:t.workspace_ref}]:[]}),a=String(n.kind??`workspace_selection_required`),o=a===`agent_binding_required`||a===`agent_identity_selection_required`;r={actionKind:e.actionKind,fields:i.map(e=>({key:`workspace_ref:${e.workspaceRef}`,label:e.label,value:e.workspaceRef})),gate:{kind:a,nextAction:typeof n.next_action==`string`?n.next_action:void 0,summary:String(n.summary??u(`proposal.workspaceGate.defaultSummary`))},impact:u(o?`proposal.workspaceGate.agentImpact`:`proposal.workspaceGate.selectionImpact`),previewId:`workspace-choice-${Date.now().toString(36)}`,sourceRequest:e,status:`gated`,title:u(o?`proposal.workspaceGate.agentTitle`:`proposal.workspaceGate.selectionTitle`),workspaceCandidates:i}}return le(e=>e.includes(r.previewId)?e:[...e,r.previewId]),S(e=>({...e,[r.previewId]:r})),n.select!==!1&&g({item:r,kind:`proposal`}),r}function qe(){tt(null),ke(`manager:${Ee}`,u(`composer.createGoalTemplate`)),window.requestAnimationFrame(()=>ye.current?.focus())}async function Je(e,n){z(!1);let r={delete:`Deleted from the owner workspace`,resume:`Resumed from the owner workspace`,stop:`Stopped from the owner workspace`},i={delete:u(`proposal.summary.lifecycleDelete`,{title:e.title}),resume:u(`proposal.summary.lifecycleResume`,{title:e.title}),stop:u(`proposal.summary.lifecycleStop`,{title:e.title})},a=null,o=!1;try{if(n===`stop`){if(Se.current.has(e.goalId))return;Se.current.add(e.goalId),ie(new Set(Se.current)),g(null),a={goalId:e.goalId,next:`stopped`,optimisticApplied:!0,previous:e.activationState},I(u(`feedback.applying`,{title:i.stop})),t.onGoalActivationStateChange?.(e.goalId,`stopped`)}if(t.onExecuteGoalLifecycle){if(n===`delete`)throw Error(`The selected status source does not authorize Goal deletion.`);let a=await t.onExecuteGoalLifecycle({goalId:e.goalId,operation:n,reason:r[n]});if(!a.projectionVerified)throw Error(`Goal lifecycle projection did not verify.`);o=!0,t.onGoalActivationStateChange?.(e.goalId,a.activationState),I(u(`feedback.completed`,{title:i[n]})),n===`stop`&&tt(null),await(t.onReconcileStatus??t.onRefresh)?.();return}let s=await Ke({actionKind:`goal.lifecycle`,context:{kind:`goal_directory`,goal_id:e.goalId},idempotencyKey:`workspace-goal-${n}-${e.goalId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:n,reason:r[n]},summary:i[n]},{select:n!==`stop`});if(s.goalId!==e.goalId||s.lifecycleOperation!==n)throw g(null),Error(u(`actionReview.targetChanged`));n===`stop`&&(s.reviewPlan?.interaction===`direct`?(o=!0,await Qe(s,{lifecycleProjection:a??void 0,presentation:`feedback`})):(a&&t.onGoalActivationStateChange?.(a.goalId,a.previous),I(s.gate?u(`feedback.gateRequired`,{summary:s.gate.summary}):u(`feedback.notCompleted`,{status:s.status})),g({item:s,kind:`proposal`})))}catch(e){a&&!o&&t.onGoalActivationStateChange?.(a.goalId,a.previous),I(u(`feedback.executionFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{n===`stop`&&(Se.current.delete(e.goalId),ie(new Set(Se.current)))}}function Ye(e,t){Ae(u(t?e===`heartbeat`?`composer.heartbeatTemplate`:`composer.monitorTemplate`:e===`heartbeat`?`composer.heartbeatTemplateWithoutGoal`:`composer.monitorTemplateWithoutGoal`)),g(null),window.requestAnimationFrame(()=>ye.current?.focus())}async function Xe(e,n,r=``){let i=await t.onRequestScheduleConfig?.(e,n);if(i){le(e=>e.includes(i.previewId)?e:[...e,i.previewId]),S(e=>({...e,[i.previewId]:i})),g({item:i,kind:`proposal`});return}if(!n){Ae(u(e===`heartbeat`?`composer.heartbeatGoalQuestion`:`composer.monitorGoalQuestion`));return}let a=Date.now().toString(36);await Ke({actionKind:e===`heartbeat`?`heartbeat.bind`:`monitor.create`,context:{kind:`schedule`,goal_id:n},idempotencyKey:`workspace-${e}-${n}-${a}`,normalizedParameters:e===`heartbeat`?{agent_id:Ee,cadence:Lx(r),goal_id:n,stop_condition:Bx(r),timezone:`Asia/Shanghai`}:{agent_id:Ee,cadence:Lx(r),goal_id:n,stop_condition:Bx(r),target:zx(r,u),target_key:`goal-${n}`,timezone:`Asia/Shanghai`},summary:e===`heartbeat`?u(`proposal.summary.heartbeat`):u(`proposal.summary.monitor`,{target:zx(r,u)})})}async function Ze(e){if(!Ce.current.has(e.todoId)){Ce.current.add(e.todoId),ae(new Set(Ce.current)),I(u(`feedback.preparingPreview`,{title:e.text}));try{await Ke({actionKind:`todo.update`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-${e.todoId}-complete-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:`complete`,todo_id:e.todoId},summary:u(`tasks.markComplete`,{name:e.text})}),I(null)}catch(e){I(u(`feedback.previewFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{Ce.current.delete(e.todoId),ae(new Set(Ce.current))}}}async function Qe(e,n={}){if(e.reviewPlan&&!e.reviewPlan.canApply)return;let r=n.presentation!==`feedback`,a=e.actionKind===`goal.lifecycle`&&e.goalId&&(e.lifecycleOperation===`stop`||e.lifecycleOperation===`resume`)?{goalId:e.goalId,next:e.lifecycleOperation===`stop`?`stopped`:`active`,optimisticApplied:!1,previous:i.goals.find(t=>t.goalId===e.goalId)?.activationState??(e.lifecycleOperation===`stop`?`active`:`stopped`)}:null,o=n.lifecycleProjection??a;I(u(`feedback.applying`,{title:e.title}));let s={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`pending`,reason:`apply_pending`,canApply:!1}:void 0,status:`applying`};S(t=>({...t,[e.previewId]:s})),r&&g({item:s,kind:`proposal`}),o&&!o.optimisticApplied&&t.onGoalActivationStateChange?.(o.goalId,o.next);try{if(t.onApplyProposal){await t.onApplyProposal(e);let n={...e,status:`applied`};if(S(t=>({...t,[e.previewId]:n})),r&&g({item:n,kind:`proposal`}),I(u(`feedback.completed`,{title:e.title})),e.actionKind===`goal.lifecycle`){(e.lifecycleOperation===`stop`||e.lifecycleOperation===`delete`)&&tt(null),e.lifecycleOperation===`delete`&&e.goalId&&t.onGoalDeleted?.(e.goalId);let n=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>n?.()).catch(()=>void 0)}return}let n=await Ph(e.previewId);if(n.proposal.proposal_id!==e.previewId||n.proposal.action_kind!==e.actionKind||e.actionKind===`goal.lifecycle`&&(n.proposal.normalized_parameters.goal_id!==e.goalId||jx(n.proposal)!==e.lifecycleOperation))throw new Eh(u(`actionReview.targetChanged`),{error_code:`action_response_mismatch`});let i=Mx(n.proposal,u);if(S(t=>({...t,[e.previewId]:i})),r&&g({item:i,kind:`proposal`}),i.reviewPlan?.interaction!==`completed`){o&&t.onGoalActivationStateChange?.(o.goalId,o.previous),g({item:i,kind:`proposal`}),I(n.proposal.status===`stale`?u(`feedback.stale`):u(`actionReview.${i.reviewPlan.reason}`));return}if(I(u(`feedback.completed`,{title:i.title})),i.actionKind===`todo.create`&&await t.onRefresh?.(),i.actionKind===`goal.lifecycle`&&(i.lifecycleOperation===`stop`||i.lifecycleOperation===`delete`)&&tt(null),i.actionKind===`goal.lifecycle`&&i.lifecycleOperation===`delete`&&i.goalId&&t.onGoalDeleted?.(i.goalId),i.actionKind===`goal.lifecycle`){let e=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>e?.()).catch(()=>void 0)}}catch(n){if(o&&t.onGoalActivationStateChange?.(o.goalId,o.previous),n instanceof Eh&&n.payload.error_code===`protected_action`){let r=n.payload.gate,i=r&&typeof r==`object`?r:{},a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`gated`,reason:`authority_gate`,canApply:!1}:void 0,gate:{kind:String(i.kind??`protected_action`),nextAction:typeof i.next_action==`string`?i.next_action:void 0,summary:String(i.summary??n.message)},status:`gated`};S(t=>({...t,[e.previewId]:a})),g({item:a,kind:`proposal`}),I(u(`feedback.gateRequired`,{summary:a.gate.summary})),e.actionKind===`goal.create`&&e.goalId&&(t.onRefresh?.(),tt(e.goalId));return}let r=n instanceof Eh&&_y(n.payload),i=n instanceof Eh&&n.payload.error_code===`action_response_mismatch`,a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:r?`refresh`:`repair`,reason:i?`readback_unverified`:r?`stale_proposal`:`apply_failed`,canApply:!1}:void 0,errorMessage:n instanceof Error?n.message:String(n),status:r?`stale`:`error`};S(t=>({...t,[e.previewId]:a})),g({item:a,kind:`proposal`}),I(u(`feedback.executionFailed`,{error:a.errorMessage}))}}let $e={...t,onOpenRunSession:async e=>{e.goalId!==B&&tt(e.goalId),w(`chat`),await t.onOpenRunSession?.(e),b(e),g(null)},onOpenGoal:e=>{tt(e);let n=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>n?.()).catch(()=>{I(u(`feedback.goalRefreshFailed`))})},onOpenGoalView:e=>{w(e),e===`chat`&&b(null),g(null)},onOpenOutput:e=>{e.goalId!==B&&tt(e.goalId),w(`files`),t.onOpenOutput?.(e)},onApplyProposal:Qe,onCancelProposal:async e=>{g(null),S(t=>{let n={...t};return delete n[e.previewId],n});try{t.onCancelProposal?.(e),t.onCancelProposal||await Fh(e.previewId)}catch(t){S(t=>({...t,[e.previewId]:e})),I(u(`feedback.cancelFailed`,{error:t instanceof Error?t.message:String(t)}))}},onTransitionProposal:async(e,t)=>{let n=Mx(await Ih(e.previewId,t),u);le(e=>e.includes(n.previewId)?e:[...e,n.previewId]),S(r=>{let i={...r};return t===`regenerate`&&delete i[e.previewId],i[n.previewId]=n,i}),g({item:n,kind:`proposal`})},onSelectWorkspaceCandidate:async(e,t)=>{e.sourceRequest&&(S(t=>{let n={...t};return delete n[e.previewId],n}),await Ke({...e.sourceRequest,idempotencyKey:`${e.sourceRequest.idempotencyKey}-${t}`,normalizedParameters:{...e.sourceRequest.normalizedParameters,workspace_ref:t}}))},onPreviewAction:Ke,onRequestScheduleConfig:(e,t)=>Ye(e,t),onOpenNotificationSettings:e=>g({goalId:e,kind:`settings`,tab:`lark`}),onFetchNotificationTargets:()=>ag(),onSetupGoalChannel:e=>sg(e),onToggleGoalAutoNotify:e=>cg(e),onUpdateSchedule:async(e,t)=>{let n=Date.now().toString(36),r=e.scheduleKind===`heartbeat`;await Ke({actionKind:r?`heartbeat.bind`:`monitor.update`,context:{kind:`schedule`,goal_id:e.goalId},idempotencyKey:`workspace-monitor-${e.scheduleId}-${t}-${n}`,normalizedParameters:{agent_id:e.agentId??Ee,...!r&&t===`run_now`?{endpoint_id:Ee}:{},...t===`edit`?{cadence:`2h`,...r?{timezone:e.timezone??`Asia/Shanghai`}:{}}:{},goal_id:e.goalId,operation:t,...!r&&t===`run_now`&&e.sessionId?{session_id:e.sessionId}:{},...r?{}:{todo_id:e.scheduleId}},summary:t===`pause`?`暂停自动运行:${e.label}`:t===`resume`?`恢复自动运行:${e.label}`:t===`run_now`?`立即运行:${e.label}`:t===`stop`?`停止自动运行:${e.label}`:`编辑自动运行生命周期:${e.label}`})}},et=a?{onOpenGoal:$e.onOpenGoal,onOpenGoalView:$e.onOpenGoalView,onOpenOutput:$e.onOpenOutput}:$e;function tt(e){f(e),E(!1),O(!1),ee(!1),b(null),g(null),w(`tasks`),z(!1),t.onSelectGoal?.(e)}function nt(e){m(e),t.onSelectAgent?.(e)}function rt(e){fe(e),vx(e)}async function it(n){let r=n?[]:N,i=(n??Oe).trim()||(r.length?u(`composer.imageAnalysisPrompt`):``);if(!(!i||j)){n||(Ae(``),P([])),ne(null),M(!0);try{if(r.length){B?C!==`chat`&&ee(!0):O(!0);let e=await t.onSendMessage?.(i,Ee,B,r);e&&await Ke(e);return}let n=Yy(i,{agents:e.map(e=>({agentId:e.agentId,label:e.label})),goalId:B,todos:(Fe?.agentTodos??[]).map(e=>({text:e.text,todoId:e.todoId}))});if(n.route===`clarify`){Ae(i);let e=u(`composer.clarifySingleAction`);n.missingFields.includes(`resume_when`)&&(e=u(`composer.clarifyDefer`)),I(e);return}if(n.actionKind===`goal.create`){let e=Ix(i,u),t=Nx(e.title);await Ke({actionKind:`goal.create`,context:{kind:`manager`,goal_id:null,natural_language:i},idempotencyKey:`workspace-goal-intent-${t}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Ee,completion_criteria:e.completionCriteria,execution_boundary:e.executionBoundary,goal_id:t,heartbeat:{cadence:Lx(i),enabled:n.normalizedParameters.heartbeat_enabled===!0,timezone:`Asia/Shanghai`},initial_todos:e.initialTodos,objective:e.objective,permission:e.permission,stop_condition:Bx(i),title:e.title,workspace_ref:`current`},summary:u(`proposal.summary.goalCreate`,{title:e.title})});return}if(B&&n.actionKind===`heartbeat.bind`){await Xe(`heartbeat`,B,i);return}if(B&&n.actionKind===`monitor.create`){let e=Rx(i,u);if(e){Ae(i),I(e);return}await Xe(`monitor`,B,i);return}let a=Vx(i,e);if(B&&a&&n.actionKind===`agent.bind`){await Ke({actionKind:`agent.bind`,context:{kind:`goal`,goal_id:B,natural_language:i},idempotencyKey:`workspace-agent-bind-${B}-${a.agentId}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:a.agentId,goal_id:B},summary:`将 ${a.label} 绑定到 ${Fe?.title??B}`});return}if(B&&n.actionKind===`todo.create`){if(n.normalizedParameters.start_execution===!0){await Ke({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:i},idempotencyKey:`workspace-task-start-${B}-${Date.now().toString(36)}`,normalizedParameters:{endpoint_id:a?.agentId??Ee,goal_id:B,start_execution:!0,text:i},summary:`交给 Agent 执行:${i.slice(0,120)}`});return}let e=a?.agentId??(/(交给|分配给|让).{0,24}(agent|codex|claude|kiro|kimi)/iu.test(i)?Ee:null);await Ke({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:i},idempotencyKey:`workspace-todo-create-${B}-${Date.now().toString(36)}`,normalizedParameters:{...e?{endpoint_id:e}:{},goal_id:B,text:Hx(i)},summary:`创建 Todo:${Hx(i)}`});return}let o=Fe?.agentTodos.find(e=>i.includes(e.todoId)||i.includes(e.text)),s=typeof n.normalizedParameters.operation==`string`?n.normalizedParameters.operation:null;if(B&&o&&n.actionKind===`todo.update`&&s){await Ke({actionKind:`todo.update`,context:{kind:`todo`,goal_id:B,todo_id:o.todoId,natural_language:i},idempotencyKey:`workspace-todo-update-${o.todoId}-${s}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Ee,...s===`reassign`&&a?{endpoint_id:a.agentId}:{},...s===`block`?{note:i}:{},...s===`defer`&&typeof n.normalizedParameters.resume_when==`string`?{resume_when:n.normalizedParameters.resume_when}:{},goal_id:B,operation:s,todo_id:o.todoId},summary:`更新 Todo:${o.text}`});return}B?C!==`chat`&&ee(!0):O(!0);let c=await t.onSendMessage?.(i,Ee,B);c&&await Ke(c)}catch(e){n||(Ae(i),P(r));let t=e instanceof Error?e.message:u(`feedback.sendGenericError`);I(u(`feedback.sendFailed`,{error:t}))}finally{M(!1)}}}let at=e.find(e=>e.agentId===Ee)?.label??Ee,ot=!Fe&&Oe.startsWith(u(`composer.createGoalDraftLead`)),st=Re.filter(e=>e.kind===`run`&&!!e.run.sessionId&&!!e.run.canInterrupt&&(e.run.status===`running`||e.run.status===`queued`)).length;async function ct(e){if(!e?.length)return;let t=Gx-N.length,n=Array.from(e).slice(0,Math.max(0,t)),r=n.find(e=>!Ux.has(e.type)),i=n.find(e=>e.size>Wx);if(t<=0){ne(u(`composer.imageCountError`,{count:Gx}));return}if(r){ne(u(`composer.imageTypeError`));return}if(i){ne(u(`composer.imageSizeError`,{size:Wx/1024/1024}));return}try{let t=await Promise.all(n.map(e=>Kx(e,u)));P(e=>[...e,...t].slice(0,Gx)),ne(e.length>n.length?u(`composer.imageCountError`,{count:Gx}):null)}catch(e){ne(e instanceof Error?e.message:u(`composer.imageReadGenericError`))}finally{xe.current&&(xe.current.value=``)}}function lt(e){let t=Array.from(e.clipboardData.items).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).flatMap(e=>{let t=e.getAsFile();return t?[t]:[]});t.length&&(e.preventDefault(),ct(t))}async function ut(){let e=await Jg();ge(e)}async function dt(){await Promise.all([ut(),t.onRefresh?.()])}async function ft(){if(!(!t.onRefresh||oe===`loading`)){se(`loading`);try{await t.onRefresh(),se(`done`)}catch{se(`error`)}window.setTimeout(()=>se(`idle`),1800)}}return Ie?(0,H.jsx)(mx,{focusGoalConnection:!!(h?.kind===`settings`&&h.goalId),goals:Me,initialGoalId:h?.kind===`settings`?h.goalId??B:B,initialTab:h?.kind===`settings`?h.tab??`lark`:`lark`,onChanged:()=>void dt(),onClose:()=>g(null),onThemeChange:rt,theme:de}):(0,H.jsx)(yx,{drawer:Ge?(0,H.jsx)(ib,{agents:e,attentionHistory:i.attentionHistory??i.userTodos,onSelectAttention:e=>g({kind:`attention`,item:e}),callbacks:et,goalNotifications:i.goalNotifications??[],goals:Me,inspectorExpanded:_,larkConnections:a?[]:he,onClose:()=>{Ge.kind===`proposal`&&[`applied`,`rejected`].includes(Ge.item.status)&&(Ge.item.actionKind!==`heartbeat.bind`||Ge.item.status!==`applied`)&&S(e=>{let t={...e};return delete t[Ge.item.previewId],t}),v(!1),g(null)},onToggleInspectorSize:()=>v(e=>!e),readOnly:a,runs:Re.flatMap(e=>e.kind===`run`?[e.run]:[]),selection:Ge}):null,drawerMode:Ge?.kind===`todo`?_?`inspector-full`:`inspector`:`panel`,drawerOpen:Ge!==null,mobileSidebarOpen:ue,onCloseMobileSidebar:()=>z(!1),theme:de,main:(0,H.jsxs)(`div`,{className:`personal-channel`,children:[(0,H.jsx)(Oy,{agents:e,managerChatOpen:T,managerRuntime:r,mobileNavigationOpen:ue,onOpenGoalCapabilities:Fe?()=>g({goalId:Fe.goalId,kind:`settings`,tab:`capabilities`}):void 0,onOpenGoalDetail:Fe&&!Fe.loadState?()=>g({item:Fe,kind:`goal`}):void 0,onRefresh:t.onRefresh?()=>void ft():void 0,onOpenNavigation:()=>z(!0),onOpenManagerChat:()=>{O(!1),E(!0)},onSelectGoalTab:e=>{w(e),e===`chat`&&(b(null),ee(!1))},onSelectAgent:nt,onReturnManagerHome:()=>{E(!1),O(!1),window.requestAnimationFrame(()=>be.current?.scrollTo({behavior:`smooth`,top:0}))},selectedAgentId:Ee,refreshState:oe,readOnlySourceLabel:a?c?.activeSource.label:void 0,selectedGoal:Fe,selectedGoalTab:C}),(0,H.jsxs)(`div`,{className:`personal-channel-scroll`,ref:be,children:[!Fe&&!T&&we&&we.done+we.failed+we.attention>0?(0,H.jsxs)(`section`,{className:`personal-digest-card`,"aria-label":u(`digest.away`),children:[(0,H.jsx)(`strong`,{children:u(`digest.away`)}),(0,H.jsxs)(`div`,{className:`personal-digest-stats`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{children:we.done}),u(`digest.completed`)]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{children:we.failed}),u(`digest.failed`)]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{children:we.attention}),u(`digest.needsYou`)]})]})]}):null,!Fe&&!T?(0,H.jsxs)(`section`,{className:`personal-manager-greeting`,children:[(0,H.jsx)(`span`,{children:(0,H.jsx)(Qp,{size:20})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:u(`home.greeting`)}),(0,H.jsx)(`p`,{children:i.goals.some(e=>e.activationState===`active`&&e.loadState)?u(`startup.partial`):(0,H.jsxs)(H.Fragment,{children:[u(`home.waitingCount`,{count:Ne}),` `,u(`home.blockingSummary`,{count:Pe})]})})]})]}):null,Fe?.loadState?(0,H.jsx)(`section`,{className:`personal-manager-greeting`,role:`status`,"data-testid":`goal-status-loading`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:u(Fe.loadState===`error`?`startup.goalError`:`startup.goalLoading`)}),(0,H.jsx)(`p`,{children:u(Fe.loadError?`startup.error.${Fe.loadError}`:`startup.independent`)}),Fe.loadState===`error`?(0,H.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,type:`button`,onClick:()=>void t.onRefresh?.(),children:u(`startup.retry`)}):null]})}):Fe&&C===`tasks`?(0,H.jsx)(Ab,{historyEnabled:!a,goal:Fe,items:Re,onDraftTaskFromMessage:a?void 0:e=>{Ae(`创建一个 Task:${bx(e)}`),I(u(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>ye.current?.focus())},onOpenChat:()=>w(`chat`),onQuickComplete:a?void 0:Ze,onSelect:g,quickCompletingTodoIds:R,selectedTodoId:Ge?.kind===`todo`?Ge.item.todoId:null,userTodos:i.userTodos}):Fe&&C===`files`?(0,H.jsx)(wx,{items:Re.filter(e=>e.kind===`output`),onSelect:g,reportState:i.periodicReports}):!Fe&&!T?(0,H.jsx)(Cx,{goals:Me,onRetry:()=>void t.onRefresh?.(),onSelectGoal:tt,systemHealth:i.systemHealth}):Fe?(0,H.jsxs)(H.Fragment,{children:[Fe&&y?.goalId===Fe.goalId?(0,H.jsx)(Ex,{onClose:()=>b(null),onOpenDetails:()=>g({item:y,kind:`run`}),run:y}):null,(0,H.jsx)(Vy,{items:ze,onSelect:g,selectedGoal:Fe})]}):(0,H.jsx)(Vy,{items:He,onSelect:g,selectedGoal:null})]}),(0,H.jsx)(`div`,{className:`personal-composer-wrap`,children:a?(0,H.jsxs)(`div`,{className:`personal-read-only-notice`,children:[(0,H.jsx)(`strong`,{children:u(`source.readOnlyNoticeTitle`)}),(0,H.jsx)(`span`,{children:u(`source.readOnlyNoticeDescription`)})]}):(0,H.jsxs)(H.Fragment,{children:[!Fe&&!T&&D&&Be.length?(0,H.jsx)(Tx,{messages:Be,onClose:()=>O(!1),onOpenConversation:()=>{O(!1),E(!0)}}):null,Fe&&C!==`chat`&&k&&Ve.length?(0,H.jsx)(Tx,{agentLabel:at,messages:Ve,onClose:()=>ee(!1),onDraftTask:C===`tasks`?e=>{Ae(`创建一个 Task:${bx(e)}`),I(u(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>ye.current?.focus())}:void 0,onOpenConversation:()=>{ee(!1),w(`chat`)},title:`${Fe.title} · ${at}`}):null,re?(0,H.jsxs)(`div`,{className:`personal-action-feedback`,role:`status`,children:[(0,H.jsx)(`span`,{children:re}),(0,H.jsx)(`button`,{"aria-label":u(`common.closeActionReceipt`),onClick:()=>I(null),type:`button`,children:(0,H.jsx)(eh,{size:14})})]}):null,(0,H.jsx)(`p`,{className:`personal-composer-hint`,children:Fe?st>0?u(`composer.goalRunningHint`,{agent:at,count:st}):u(`composer.goalMessageHint`,{agent:at}):u(`composer.managerMessageHint`)}),Fe?(0,H.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,H.jsxs)(`button`,{"aria-label":u(`composer.nextAction`),className:`is-draft`,onClick:()=>je(u(`composer.nextActionPrompt`)),title:u(`composer.prepareDraft`),type:`button`,children:[(0,H.jsx)(Dm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.nextAction`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]}),(0,H.jsxs)(`button`,{className:`is-immediate`,disabled:j,onClick:()=>void it(u(`composer.agentProgressPrompt`)),title:u(`composer.immediate`),type:`button`,children:[(0,H.jsx)(Vm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.agentProgress`)}),(0,H.jsx)(`em`,{className:`personal-prompt-badge`,children:u(`composer.immediate`)})]}),(0,H.jsxs)(`button`,{"aria-label":u(`composer.monitor`),className:`is-draft`,onClick:()=>Ye(`monitor`,B),title:u(`composer.monitorHint`),type:`button`,children:[(0,H.jsx)(em,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.monitor`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]})]}):(0,H.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,H.jsxs)(`button`,{"aria-label":u(`composer.globalTasks`),className:`is-draft`,onClick:()=>je(u(`composer.globalTasksPrompt`)),title:u(`composer.prepareDraft`),type:`button`,children:[(0,H.jsx)(Dm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.globalTasks`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]}),(0,H.jsxs)(`button`,{className:`is-immediate`,disabled:j,onClick:()=>void it(u(`composer.globalProgressPrompt`)),title:u(`composer.immediate`),type:`button`,children:[(0,H.jsx)(Vm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.globalProgress`)}),(0,H.jsx)(`em`,{className:`personal-prompt-badge`,children:u(`composer.immediate`)})]}),(0,H.jsxs)(`button`,{"aria-label":u(`composer.createGoal`),className:`is-draft`,onClick:qe,title:u(`composer.createGoalHint`),type:`button`,children:[(0,H.jsx)(Fm,{size:13}),(0,H.jsx)(`span`,{children:u(`composer.createGoal`)}),(0,H.jsx)(`small`,{className:`personal-prompt-subtle`,children:u(`composer.draft`)})]})]}),ot?(0,H.jsxs)(`div`,{className:`personal-goal-draft-status`,role:`status`,children:[(0,H.jsx)(`strong`,{children:u(`composer.createGoalDraft`)}),(0,H.jsx)(`span`,{children:u(`composer.createGoalDraftDescription`)})]}):null,N.length?(0,H.jsx)(`div`,{className:`personal-composer-images`,"aria-label":u(`composer.imagesPending`),children:N.map(e=>(0,H.jsxs)(`figure`,{children:[(0,H.jsx)(`img`,{alt:e.name,src:e.dataUrl}),(0,H.jsx)(`button`,{"aria-label":u(`composer.sentImageAlt`,{name:e.name}),onClick:()=>P(t=>t.filter(t=>t.id!==e.id)),type:`button`,children:(0,H.jsx)(eh,{size:13})})]},e.id))}):null,F?(0,H.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:F}):null,(0,H.jsxs)(`div`,{className:`personal-channel-composer`,onDragOver:e=>{[...e.dataTransfer.items].some(e=>e.kind===`file`&&e.type.startsWith(`image/`))&&e.preventDefault()},onDrop:e=>{let t=[...e.dataTransfer.files].filter(e=>e.type.startsWith(`image/`));t.length&&(e.preventDefault(),ct(t))},children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Qp,{size:17}),e.find(e=>e.agentId===Ee)?.label??Ee]}),(0,H.jsx)(`button`,{"aria-label":u(`composer.addImage`),className:`personal-composer-attach`,disabled:j||N.length>=Gx,onClick:()=>xe.current?.click(),title:u(`composer.attachImageHint`),type:`button`,children:(0,H.jsx)(Mm,{size:17})}),(0,H.jsx)(`input`,{accept:`image/png,image/jpeg,image/webp,image/gif`,"aria-label":u(`composer.imagePicker`),className:`personal-composer-file-input`,disabled:j||N.length>=Gx,multiple:!0,onChange:e=>void ct(e.target.files),ref:xe,type:`file`}),(0,H.jsx)(`textarea`,{"aria-label":u(`composer.sendMessage`),onChange:e=>Ae(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),it())},onPaste:lt,placeholder:Fe?u(`composer.goalPlaceholder`,{goal:Fe.title}):u(`composer.managerPlaceholder`),ref:ye,rows:1,value:Oe}),(0,H.jsx)(`button`,{"aria-label":u(ot?`composer.createGoal`:`composer.send`),disabled:!Oe.trim()&&N.length===0||j,onClick:()=>void it(),title:u(ot?`composer.createGoalHint`:`composer.sendMessageHint`),type:`button`,children:(0,H.jsx)(Vm,{size:18})})]})]})})]}),sidebar:(0,H.jsx)(Eb,{attentionCount:Ne,goals:Me,goalArchiveLoadState:n,goalLifecycleOperations:t.onExecuteGoalLifecycle?[`stop`,`resume`]:void 0,lifecycleBusyGoalIds:L,onRequestGoalCreate:a?void 0:qe,onRequestGoalLifecycle:a&&!t.onExecuteGoalLifecycle?void 0:(e,t)=>void Je(e,t),onRetryGoalArchive:t.onRetryGoalArchive||t.onRefresh?()=>void(t.onRetryGoalArchive??t.onRefresh)?.():void 0,onOpenSettings:a?void 0:()=>g({kind:`settings`}),onSelectGoal:tt,selectedGoalId:B,statusSourceControl:c},c?.activeSource.statusUrl??`/status.json`)})}function Jx(e){return(e??``).replace(/\s+/gu,` `).trim()}function Yx(e,t=120){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t-1).join(``)}…`}function Xx(e,t,n){let r=Jx(e);return!r||r===`暂无`?n?t(n):``:/refresh-state|latest_run|latest run-derived/iu.test(r)?t(`projection.refreshState`):/first read-only adapter tick|read-only adapter/iu.test(r)?t(`projection.firstReadOnlyAdapterCheck`):/todo update recorded for/iu.test(r)?t(`projection.todoStatusUpdated`):/^(loopx|python3|npm|git|run)\s|\s--[a-z0-9-]+|\b[a-z]+_[a-z_]+\b/iu.test(r)?t(n??`projection.agentPreparingNextStep`):Yx(r)}function Zx(e,t){return t({advancing:`projection.agentAdvancingGoal`,idle:`projection.agentIdle`,needs_you:`projection.agentNeedsDecision`,stopped:`projection.agentStopped`,waiting_external:`projection.agentWaitingExternal`}[e])}function Qx({eventCount:e,hasArtifact:t,hasLatestValidation:n},r){return{label:r(n?`projection.latestValidation`:`projection.latestRun`),metadata:e>0?r(`projection.events24h`,{count:e}):r(t?`projection.runEvidenceAvailable`:`projection.publicSafeProjection`)}}var $x=`/status.json`,eS=`loopx-status-source-catalog-v1`,tS={id:`local`,kind:`local`,label:`本机`,readOnly:!1,statusUrl:$x};function nS(e,t){let n=ah(e,t).source;if(!n||!n.isLoopback||n.isRelative)return{error:`SSH 隧道来源必须使用显式的 localhost、127.0.0.1 或 ::1 URL。`};let r=new URL(n.url,t);return[`http:`,`https:`].includes(r.protocol)?{url:r.toString()}:{error:`状态来源只支持 HTTP 或 HTTPS。`}}function rS(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return`ssh-${(t>>>0).toString(36)}`}function iS(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return null;let n=e;if(n.kind!==`ssh_tunnel`||typeof n.label!=`string`||typeof n.statusUrl!=`string`)return null;let r=n.label.trim(),i=nS(n.statusUrl,t);if(!r||r.length>48||!(`url`in i))return null;let a=gb(n.hostAlias)?n.hostAlias.trim():void 0;return{...a?{hostAlias:a}:{},id:rS(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url}}function aS(){return{schemaVersion:1,sources:[tS]}}function oS(e,t){try{let n=e.getItem(eS);if(!n)return aS();let r=JSON.parse(n);if(r.schemaVersion!==1||!Array.isArray(r.sources))return aS();let i=new Set([tS.statusUrl]);return{schemaVersion:1,sources:[tS,...r.sources.flatMap(e=>{let n=iS(e,t);return!n||i.has(n.statusUrl)?[]:(i.add(n.statusUrl),[n])})]}}catch{return aS()}}function sS(e,t){e.setItem(eS,JSON.stringify({schemaVersion:1,sources:t.sources.filter(e=>e.kind===`ssh_tunnel`)}))}function cS(e,t){let n=new Set(t.filter(gb).map(e=>e.trim())),r=!1,i=e.sources.map(e=>e.kind!==`ssh_tunnel`||e.hostAlias||!n.has(e.label)?e:(r=!0,{...e,hostAlias:e.label}));return r?{...e,sources:i}:e}function lS(e,t,n){let r=t.label.trim();if(!r)return{error:`请填写来源名称。`};if(r.length>48)return{error:`来源名称不能超过 48 个字符。`};let i=nS(t.statusUrl,n);if(!(`url`in i))return i;if(e.sources.some(e=>e.statusUrl===i.url))return{error:`这个状态 URL 已经在来源目录中。`};if(t.hostAlias!==void 0&&!gb(t.hostAlias))return{error:`请选择有效的 SSH Host。`};let a=t.hostAlias?.trim(),o={...a?{hostAlias:a}:{},id:rS(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url};return{catalog:{...e,sources:[...e.sources,o]},source:o}}function uS(e,t){return{...e,sources:e.sources.filter(e=>e.kind===`local`||e.id!==t)}}function dS(e,t,n){if(!t.trim()||ah(t,n).source?.isRelative)return tS;let r=t.trim();try{r=new URL(r,n).toString()}catch{return null}return e.sources.find(e=>e.statusUrl===r)??null}function fS(e,t,n){return dS(e,t,n)||(ah(t,n).source?.isRelative?tS:{id:`temporary`,kind:`ssh_tunnel`,label:`临时来源`,readOnly:!0,statusUrl:t.trim()})}function pS(e,t,n,r){return fS(e,t??n,r)}var mS={delete:`删除`,deploy:`部署`,merge:`合并`,payment:`付款`,release:`发布`};function hS(e,t,n){let r=t.replace(/\s+/gu,` `).trim().toLowerCase(),i=n.target.replace(/\s+/gu,` `).trim().toLowerCase();return!i||!r.includes(i)?null:{actionKind:`goal.update`,context:{goal_id:e,kind:`goal`,natural_language:t,semantic_proposal:{operation:n.operation,target:n.target}},idempotencyKey:`workspace-semantic-protected-${e}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e,status:`operator_gate_requested`},summary:`请求受保护操作:${mS[n.operation]} · ${n.target}`}}var gS=$x;async function _S(e){let t=await fetch(e,{cache:`no-store`,signal:AbortSignal.timeout(3e4)});if(!t.ok)throw Error(`HTTP ${t.status} while loading ${e}`);return Ep(await t.json())}function vS(e,t){if(t?.controller_readiness?.decision_advisor_ready||t?.controller_readiness?.write_controller_ready)return`controller_ready`;if(t?.controller_readiness)return`controller_gated`;if(t?.human_reward)return`reward_judged`;if(t?.operator_gate?.decision===`approve`)return`operator_approved`;if(t?.operator_gate)return`operator_gated`;let n=e||t?.classification||``;return n===`connected_without_run`?`connected`:n===`read_only_project_map`||t?.project_map?`mapped`:n===`state_refreshed`?`refreshed`:n&&n!==`no_status`?`adapter_inspected`:`registered`}function yS(e,t){let n=new Map(t.map(e=>[e.goal_id,e])),r=new Set,i=e.map(e=>{r.add(e.id);let t=n.get(e.id),i=e.latest_runs[0],a=t?.lifecycle_phase??e.lifecycle_phase??i?.lifecycle_phase??vS(t?.status??i?.classification??e.status,i),o=t?.lifecycle_flags?.length?t.lifecycle_flags:e.lifecycle_flags?.length?e.lifecycle_flags:i?.lifecycle_flags?.length?i.lifecycle_flags:[a];return{goal:e,queueItem:t,latestRun:i,status:t?.status??i?.classification??e.status??`no_status`,waitingOn:t?.waiting_on??`clear`,severity:t?.severity??`clear`,lifecyclePhase:a,lifecycleFlags:o}});for(let e of t)r.has(e.goal_id)||i.push({goal:{activation_state:e.activation_state,id:e.goal_id,status:e.status,display_name:e.goal_id,latest_runs:[],lifecycle_flags:[e.lifecycle_phase??`registered`],registry_member:!0,legacy_runtime_goal:!1,index_exists:!1,raw_index_records:0,unique_runs:0},queueItem:e,status:e.status,waitingOn:e.waiting_on,severity:e.severity,lifecyclePhase:e.lifecycle_phase??`registered`,lifecycleFlags:e.lifecycle_flags??[`registered`]});return i}function bS(e){return(e??``).replace(/\s+/g,` `).trim()}function xS(e,t=132){let n=bS(e);return n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}…`}function SS(e){let t=new Map;for(let n of e?.goals??[])t.set(n.goal_id,n);return t}function CS(e,t){return e===void 0||t===void 0?void 0:e+t}function wS(e,t){if(!e)return null;let n=t===`user`?e.queueItem?.project_asset?.user_todos:e.queueItem?.project_asset?.agent_todos;if(n?.items?.length)return{done_count:n.done??n.items.filter(e=>e.done).length,items:n.items,open_count:n.open??n.items.filter(e=>!e.done).length,total_count:n.total??n.items.length};let r=t===`user`?e.queueItem?.user_todos:e.queueItem?.agent_todos;return r?.items?.length?r:null}function TS(e){return e?.items.find(e=>!e.done)}function ES(e,t,n=`todos`){return e?.items?.length?{advancement_done_count:e.advancement_done_count??t?.advancement_done_count,done_count:e.done??e.items.filter(e=>e.done).length,items:e.items,open_count:e.open??e.items.filter(e=>!e.done).length,total_count:e.total??e.items.length}:t??null}function DS(e){return e?.queueItem?.project_asset?.quota?.state??e?.queueItem?.quota?.state??e?.goal.quota?.state??`waiting`}function OS(e,t,n){let r=[];for(let t of e){let e=wS(t,`agent`);for(let n of e?.items??[])r.push({goalId:t.goal.id,role:`agent`,todo:n})}let i=new Map;for(let e of r){let t=e.todo.claimed_by||`codex`,n=i.get(t)??[];n.push(e),i.set(t,n)}let a=new Map((n?.agents??[]).map(e=>[e.agent_id,e]));return Array.from(new Set([...i.keys(),...a.keys()])).map(e=>{let t=i.get(e)??[],n=a.get(e),r=Array.from(new Set([...t.map(e=>e.goalId),n?.current_todo?.goal_id,...n?.goal_ids??[]].filter(Boolean))),o=(t.filter(e=>!e.todo.done)[0]??t[0])?.goalId??n?.current_todo?.goal_id??r[0]??``,s=n?.last_activity_at??null;return{agentId:e,claimedTodos:t,currentTodo:n?.current_todo??null,evidenceRefs:[],goalIds:r,handoffNote:null,lastActivity:s,nextSafeAction:n?.next_action?.trim()||`Inspect status projection before taking work`,primaryGoalId:o,quotaHints:[],staleClaimHint:null,status:{label:`可用`,summary:`正常运行`,variant:`success`},workspaceRef:null}})}function kS(e){return e?.map(e=>({dataUrl:e.data_url,id:e.id,mimeType:e.mime_type,name:e.name,size:e.size}))}var AS=`loopx.personal-agent-selection.v1`;function jS(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(AS)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[0]==`string`&&typeof e[1]==`string`))}catch{return{}}}var MS={需修复:`danger`,等你:`warning`,等待条件:`info`,推进中:`success`,安静运行:`neutral`,已停止:`neutral`,已完成:`neutral`};function NS(e,t){return bS(t)||e.replace(/^loopx[-_]/i,`LoopX `).split(/[-_]+/).filter(Boolean).map((e,t)=>t===0?`${e.slice(0,1).toUpperCase()}${e.slice(1)}`:e).join(` `)}function PS(e){return e.split(/\r?\n/u).filter(e=>!/^\s*GOAL_(STATUS|PROGRESS)\s*:/u.test(e)).map(e=>/^\s*GOAL_EVIDENCE\s*:/u.test(e)?e.replace(/^\s*GOAL_EVIDENCE\s*:/u,`验证依据:`):/^\s*NEXT_ACTION\s*:/u.test(e)?e.replace(/^\s*NEXT_ACTION\s*:/u,`下一步:`):e).join(` +`).trim()}function FS(e,t){return[`agent`,`assistant`].includes(e.trim().toLowerCase())&&t.trim().length>0}var IS=`已发现的项目 Agent`;function LS(e){switch(ly(e)){case`codex`:return`Codex`;case`claude`:return`Claude Code`;case`kiro`:return`Kiro CLI`;case`trae`:return`Trae CLI Agent`;case`coco`:return`Coco Agent`;default:return NS(e)}}function RS(e,t){switch(uy(e,t)){case`codex`:return`代码与项目执行`;case`claude`:return`复杂分析与长任务`;case`openai`:case`anthropic`:return`管家问答 · 无工具`;case`kiro`:return`终端编码 · 原生 /goal 循环`;case`trae`:return`前端与交互实现`;case`coco`:return`通用任务`;default:return IS}}function zS(e,t){let n=e.project_asset;return t===`user`?ES(n?.user_todos,e.user_todos,`project_asset.user_todos`):ES(n?.agent_todos,e.agent_todos,`project_asset.agent_todos`)}function BS(e){return xS(e.title??e.text,112)}function VS(e){let t=e.resume_condition?.resume_receipt;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.receipt_id;return typeof n==`string`&&n.trim()?n.trim():null}function HS(e,t){return{resumeWhen:e.resume_when??null,resumeReady:e.resume_ready??null,resumeReceiptId:VS(e),claimedBy:e.claimed_by??null,done:e.status!==`deferred`&&e.done,evidence:e.evidence?xS(e.evidence,96):null,index:e.index,priority:e.priority??null,status:e.status??null,taskClass:e.task_class??null,taskDomain:e.task_domain??null,text:BS(e),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.index}`}}function US(e){let t=e.queueItem?.agent_todos,n=t?.items??e.queueItem?.project_asset?.agent_todos?.items??[],r=new Map(n.map(t=>[t.todo_id?.trim()||`${e.goal.id}:agent:${t.index}`,t]));for(let n of t?.deferred_items??[]){let t=n.todo_id?.trim()||`${e.goal.id}:agent:${n.index}`;r.has(t)||r.set(t,n)}return[...r.values()]}function WS(e){return US(e).map(t=>HS(t,e))}function GS(e,t,n){let r=new Map;for(let n of e.todo_index?.items??[]){if(n.goal_id!==t.goal.id||n.role!==`agent`)continue;let e=HS(n,t);r.set(e.todoId,e)}for(let e of n)r.has(e.todoId)||r.set(e.todoId,e);let i=new Map;for(let e of r.values()){if(e.done||e.taskClass!==`advancement_task`)continue;let t=e.taskDomain?.trim();t&&i.set(t,(i.get(t)??0)+1)}return[...i].map(([e,t])=>({domain:e,matchingTodoCount:t}))}function KS(e,t){return{claimedBy:e.claimed_by??null,done:e.status===`done`||e.status===`completed`,index:-1,priority:e.priority??null,status:e.status??null,taskClass:e.task_class??null,text:xS(e.title,112),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.claimed_by??`unknown`}:current`}}function qS(e,t,n){let r=new Map(e.map(e=>[e.todoId,e]));for(let e of t){let t=e.currentTodo;if(!t||t.goal_id!==n.goal.id)continue;let i=KS(t,n);r.has(i.todoId)||r.set(i.todoId,i)}return[...r.values()]}function JS(e){let t=e.queueItem?.project_asset?.agent_todos,n=e.queueItem?.agent_todos,r=US(e),i=t?.advancement_done_count??n?.advancement_done_count??t?.done??n?.done_count??null,a=r.filter(e=>e.done&&e.status!==`deferred`).length,o=Math.max(i??0,a),s=new Set(r.map(e=>e.todo_id?.trim()).filter(e=>!!e)),c=(t?.recent_completed_advancement_items??[]).filter(e=>!e.todo_id?.trim()||!s.has(e.todo_id.trim())).map(t=>HS(t,e)),l=r.find(e=>!e.done);return{doneTodoCount:o,nextTodoText:bS(t?.next??``)||(l?bS(l.title??``)||bS(l.text??``):``)||null,recentCompleted:c}}function YS(e,t){let n=bS(e);return n?/\b(state_file|registry_goal|authority_sources|source_registry)\b|\b[a-z_]+\s+\d+\/\d+/i.test(n)?t(`projection.goalVerified`):Xx(n,t,`projection.validationRecorded`):``}function XS(e,t=4){if(e.length<=t)return e;let n=e.findIndex(e=>!e.done);if(n<0)return e.slice(-t);let r=Math.max(0,Math.min(n-2,e.length-t));return e.slice(r,r+t)}function ZS(e,t,n){let r=t.queueItem?.project_asset?.latest_validation,i=t.latestRun,a=e.event_ledger_summary?.goals.find(e=>e.goal_id===t.goal.id);if(!r&&!i&&!a)return null;let o=[YS(r?.summary,n),Xx(i?.health_check,n),Xx(i?.recommended_action,n)].find(e=>e!==``&&e!==`暂无`)??n(`projection.runRecorded`),s=Qx({eventCount:a?.events_24h??0,hasArtifact:!!(i?.json_exists||i?.markdown_exists),hasLatestValidation:!!r},n);return{generatedAt:r?.generated_at??i?.generated_at??a?.latest_event_at??``,label:s.label,metadata:s.metadata,runId:i?`${t.goal.id}:${i.generated_at}`:null,safePreview:[o,s.metadata].filter(Boolean).join(` +`),summary:o,todoId:t.queueItem?.project_asset?.agent_todos?.items.find(e=>!e.done)?.todo_id??null}}function QS(e){return[e.status,e.goal.status,e.latestRun?.classification,e.lifecyclePhase].filter(Boolean).some(e=>/(^|[_\s-])(done|complete|completed|finished|terminal|closed|success)([_\s-]|$)/i.test(e??``))}function $S(e,t){return e.global_registry?.findings?.find(e=>e.severity===`high`&&(e.goal_id===t.goal.id||e.goal_ids.includes(t.goal.id)))}function eC(e){return[e.status,e.goal.status,e.latestRun?.classification,e.lifecyclePhase].filter(Boolean).some(e=>/(^|[_\s-])(failure|failed|error|broken|unhealthy|blocked[_\s-]?health|health[_\s-]?blocked)([_\s-]|$)/i.test(e??``))}function tC(e,t){let n=t.queueItem?.stale_latest_run_warning;return t.severity===`high`||!!$S(e,t)||!!(n?.requires_refresh_state||n?.severity===`high`)||eC(t)}function nC(e,t){let n=$S(e,t);return t.queueItem?.stale_latest_run_warning?.recommended_action??t.queueItem?.stale_latest_run_warning?.reason??n?.recommended_action??n?.message??t.queueItem?.recommended_action??t.latestRun?.recommended_action??null}function rC(e){let t=e.latestRun?.operator_gate,n=t?.decision?.trim().toLowerCase()??``,r=new Set([`approve`,`approved`,`reject`,`rejected`,`defer`,`deferred`,`cancel`,`cancelled`]),i=[e.queueItem?.recommended_action,e.latestRun?.recommended_action].filter(Boolean).join(` `),a=/(?:等待|需要)(?:用户|你|owner).{0,24}(?:批准|确认|授权|补充|选择|决定)|(?:批准|确认|授权).{0,16}(?:后|才能|方可)/i.test(i);return!!(t&&!r.has(n))||e.lifecyclePhase===`operator_gated`&&!r.has(n)||a}function iC(e,t){let n=e.latestRun?.operator_gate;return Xx(n?.operator_question??n?.reason_summary??n?.follow_up??e.queueItem?.recommended_action??e.latestRun?.recommended_action,t,`projection.confirmAgentDecision`)}function aC(e,t){if(t.goal.activation_state===`stopped`)return`已停止`;let n=wS(t,`user`),r=wS(t,`agent`),i=!!TS(n),a=!!TS(r);return[`user_or_controller`,`controller`].includes(t.waitingOn)||i||rC(t)?`等你`:tC(e,t)?`需修复`:t.waitingOn===`external_evidence`?`等待条件`:DS(t)===`eligible`||a?`推进中`:QS(t)?`已完成`:`安静运行`}function oC(e,t,n,r){if(n===`已停止`)return Zx(`stopped`,r);if(n===`需修复`)return Xx(nC(e,t),r,`projection.statusRefreshNeeded`);if(n===`等你`)return Zx(`needs_you`,r);if(n===`推进中`){let e=[(wS(t,`agent`)?.items??[]).filter(e=>!e.done).flatMap(e=>[e.title,e.text]).map(e=>bS(e)).find(e=>e!==``&&e!==`暂无`),t.queueItem?.recommended_action,t.latestRun?.recommended_action].map(e=>bS(e)).find(e=>e!==``&&e!==`暂无`);return e?Xx(e,r,`projection.agentAdvancingGoal`):Zx(`advancing`,r)}return Zx(n===`等待条件`?`waiting_external`:`idle`,r)}function sC(e,t){return t.some(t=>e.includes(t))}function cC(e,t,n){if(t.goals.some(e=>e.activationState===`active`&&e.loadState))return{text:`Goal 状态尚未全部加载,暂不能给出完整统计。可先打开已加载的 Goal,失败项可重试。`,lines:[]};if(sC(n,[`Agent`,`agent`,`推进`,`在做`])){let e=t.goals.filter(e=>![`安静运行`,`已完成`,`已停止`].includes(e.state)),n=(e.length>0?e:t.goals).slice(0,3);return n.length===0?{text:`当前状态里还没有 Goal 可供汇总。`,lines:[]}:{text:e.length>0?`Agent 当前关注这些 Goal:`:`当前 Goal 都比较安静:`,lines:n.map(e=>`${e.title} · ${e.state} · ${e.agentSentence}`)}}if(sC(n,[`现在`,`下一步`,`我该`,`该做什么`,`优先处理`])){let e=t.userTodos[0];if(e)return{text:e.blocking?`先处理「${NS(e.goalId)}」:${e.text}`:`当前最先处理「${NS(e.goalId)}」:${e.text}`,lines:[]};let n=t.goals.find(e=>e.state===`需修复`);if(n)return{text:`没有待办,但这个 Goal 需要先修复。`,lines:[`${n.title} · ${n.agentSentence}`]};let r=t.goals.find(e=>e.state===`推进中`);return r?{text:`目前不需要你介入,Agent 正在推进。`,lines:[`${r.title} · ${r.agentSentence}`]}:{text:`当前系统很安静,没有需要你立即处理的事项。`,lines:[]}}if(sC(n,[`等我`,`阻塞`,`需要我`,`全局待办`]))return t.userTodos.length===0?{text:`目前没有 Goal 在等你,开放用户待办为 0。`,lines:[]}:{text:`有 ${t.userTodos.length} 项开放用户待办,阻塞项优先:`,lines:t.userTodos.slice(0,3).map(e=>`${NS(e.goalId)} · ${e.blocking?`阻塞`:`待处理`} · ${e.text}`)};if(sC(n,[`状态`,`异常`,`修复`,`健康`])){let n=t.systemHealth?!t.systemHealth.ok:!e.ok||!e.contract?.ok||!e.global_registry?.ok||(e.global_registry?.summary?.high??0)>0,r=t.goals.filter(e=>e.state===`需修复`),i=r.slice(0,n?2:3).map(e=>`${e.title} · ${e.agentSentence}`);return n&&i.push(`全局状态、契约或注册表健康检查未通过,请进入管理页检查。`),i.length===0?{text:`当前没有发现 Goal 级或全局健康异常。`,lines:[]}:{text:r.length>0?`当前需要关注这些健康问题:`:`Goal 状态正常,但全局健康需要检查:`,lines:i}}return{text:`当前管家支持三类问题:下一步、等待你的事项、Agent 与健康状态。`,lines:[`问“我现在该做什么?”`,`问“哪些 Goal 在等我?”`,`问“Agent 在做什么?”或当前健康状态`]}}function lC(e,t,n,r=!1){let i=new Map(t.map(e=>[e.goal.id,e])),a=new Set(e.run_history.goals.filter(e=>e.activation_state===`stopped`).map(e=>e.id)),o=SS(e.usage_summary),s=OS(t,e.todo_index,e.agent_management_projection),c=e.attention_queue.items.flatMap((e,t)=>{if(a.has(e.goal_id))return[];let n=[`user_or_controller`,`controller`].includes(e.waiting_on);return(zS(e,`user`)?.items??[]).map((r,i)=>({projectedDone:r.done,details:Ud(r),actionKind:r.action_kind??null,blocking:n,goalId:e.goal_id,sourceOrder:t,taskClass:r.task_class??null,text:BS(r),todoId:r.todo_id?.trim()||`${e.goal_id}:user:${r.index}`,todoOrder:i,updatedAt:r.updated_at??null}))}),l=c.filter(e=>!e.projectedDone),u=new Set(l.map(e=>e.goalId)),d=t.flatMap((t,r)=>a.has(t.goal.id)||u.has(t.goal.id)||!rC(t)?[]:[{details:Ud({task_class:`user_gate`,status:`open`,note:t.latestRun?.operator_gate?.reason_summary}),actionKind:`gate.resolve`,blocking:!0,goalId:t.goal.id,sourceOrder:e.attention_queue.items.length+r,taskClass:`user_gate`,text:iC(t,n),todoId:`${t.goal.id}:operator-gate`,todoOrder:0,updatedAt:t.latestRun?.operator_gate?.recorded_at??t.latestRun?.generated_at??null}]),f=[...l,...d].sort((e,t)=>Number(t.blocking)-Number(e.blocking)||e.sourceOrder-t.sourceOrder||e.todoOrder-t.todoOrder),p=e.run_history.goals.flatMap(t=>{if(t.registry_member===!1)return[];let a=i.get(t.id);if(!a)return[];let c=aC(e,a),l=f.find(e=>e.goalId===t.id),u=l?.text??null,d=JS(a),p=t.coordination?.registered_agents??[],m=new Set(p),h=[...s.filter(e=>e.goalIds.includes(t.id)&&!/unassigned|unknown/i.test(e.agentId)&&(m.size===0||m.has(e.agentId))&&(e.currentTodo?.goal_id===t.id||e.claimedTodos.some(e=>e.goalId===t.id)))].sort((e,t)=>(t.lastActivity??``).localeCompare(e.lastActivity??``)),g=new Set(h.map(e=>e.agentId)),_=[...h.map(e=>({agentId:e.agentId,label:e.agentId,lastActivityAt:e.lastActivity,state:e.status.label})),...p.filter(e=>!g.has(e)).map(e=>({agentId:e,label:e,lastActivityAt:null,state:`registered`}))],v=h[0],y=qS(WS(a),h,a),b=[d.nextTodoText,a.queueItem?.recommended_action,a.latestRun?.recommended_action,oC(e,a,c,n)].map(e=>Xx(e,n)).find(e=>e!==``&&e!==`暂无`)??n(`projection.nextUpdatePending`);return[{activationState:t.activation_state,agentId:v?.agentId??p[0]??`codex`,agentLaneCount:_.length,agentLanes:_,agentLabel:v?.agentId,agentSentence:oC(e,a,c,n),agentTodos:[...y,...d.recentCompleted],doneTodoCount:d.doneTodoCount,acceptanceObservation:t.acceptance_observation,goalId:t.id,latestActivity:a.latestRun?.generated_at??``,needsYou:u,needsYouActionKind:l?.actionKind??null,needsYouBlocking:l?.blocking??!1,needsYouTaskClass:l?.taskClass??null,needsYouTodoId:l?.todoId??null,nextSentence:b,runEvidence:ZS(e,a,n),state:c,...r?{subagentExecution:{allowedDomains:t.spawn_policy?.allowed_domains??[],domainCandidates:GS(e,a,y),enabled:t.spawn_policy?.mode===`multi_subagent`&&t.spawn_policy.spawn_allowed===!0&&t.spawn_policy.max_children>0,maxChildren:t.spawn_policy?.max_children??0,modelConfig:t.spawn_policy?.model_config}}:{},title:NS(t.id,t.display_name),usage:(()=>{let e=o.get(t.id);return e?{costUsd24h:e.cost_usd_24h,costUsd7d:e.cost_usd_7d,durationMs24h:e.duration_ms_24h,durationMs7d:e.duration_ms_7d,tokens24h:CS(e.input_tokens_24h,e.output_tokens_24h),tokens7d:CS(e.input_tokens_7d,e.output_tokens_7d)}:null})()}]}),m=[];if(e.ok||m.push(`状态载荷未标记为正常 (payload.ok === false)`),e.contract&&!e.contract.ok){let t=e.contract.summary,n=t?`${t.errors} 项错误 / ${t.warnings} 项警告`:e.contract.errors?.[0]||`请检查控制面契约`;m.push(`契约检查未通过: ${n}`)}if(e.global_registry){e.global_registry.ok||m.push(`注册表状态异常: ${e.global_registry.summary.high} 项高危`);for(let t of e.global_registry.findings||[])t.severity===`high`&&m.push(`[${t.kind}] ${t.message}`)}let h=e.decision_freshness_summary?.summary?.stale_count?`${e.decision_freshness_summary.summary.stale_count} 项决策状态已过期`:null,g=m.length===0&&!h,_={ok:g,summary:g?`所有控制面契约与注册表检查均正常`:`发现 ${m.length+ +!!h} 项系统健康关注点`,issues:m,freshnessWarning:h};return{blockingTodoCount:f.filter(e=>e.blocking).length,goalNotifications:(e.goal_channel_notification_projection?.goals??[]).map(e=>({goalId:e.goal_id,configured:e.configured,enabled:e.enabled,humanGateAutoNotifyEnabled:e.human_gate_auto_notify_enabled,lastNotifiedAt:e.last_notified_at??null,receiptCount:e.receipt_count,targetRef:e.target_ref??null})),goals:p,openUserTodoCount:f.length,systemHealth:_,attentionHistory:[...c,...d],userTodos:f,visibleUserTodos:f.slice(0,5),workers:(e.agent_management_projection?.agents??[]).map(e=>({agentId:e.agent_id,currentTodoGoalId:e.current_todo?.goal_id??null,currentTodoText:e.current_todo?.title?xS(e.current_todo.title,96):null,lastActivityAt:e.last_activity_at??null,state:e.state??null}))}}function uC({goalArchiveLoadState:e,isLoading:t,onGoalActivationStateChange:n,onGoalDeleted:r,onSelectGoal:i,onReconcileStatus:a,onRefresh:o,onRetryGoalArchive:s,payload:c,progress:l,rows:u,selectedGoalId:d,statusSourceControl:f,theme:p,toggleTheme:m}){let h=f.activeSource.readOnly,g=f.activeSource.kind===`ssh_tunnel`?f.activeSource.hostAlias:void 0,{t:_}=qi(),[v,y]=(0,V.useState)([]),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(null),w=(0,V.useMemo)(()=>{let e=lC(c,u,_,b);if(!l)return e;let t=Object.values(l.snapshots).map(e=>lC(e,yS(e.run_history.goals,e.attention_queue.items),_,b)),n=new Map(t.flatMap(e=>e.goals).map(e=>[e.goalId,e])),r=e.goals.map(e=>n.get(e.goalId)??{...e,loadError:l.errors[e.goalId],loadState:l.errors[e.goalId]?`error`:`loading`,agentId:``,agentSentence:``,nextSentence:``,subagentExecution:void 0}),i=t.flatMap(e=>e.userTodos),a=r.some(e=>e.activationState===`active`&&e.loadState),o=[...new Set(t.flatMap(e=>e.systemHealth?.issues??[]))];return{...e,goals:r,userTodos:i,attentionHistory:t.flatMap(e=>e.attentionHistory??e.userTodos),visibleUserTodos:i.slice(0,5),openUserTodoCount:i.length,blockingTodoCount:i.filter(e=>e.blocking).length,workers:[...new Map(t.flatMap(e=>e.workers??[]).map(e=>[e.agentId,e])).values()],goalNotifications:t.flatMap(e=>e.goalNotifications??[]),systemHealth:a||t.length===0?void 0:{ok:t.every(e=>e.systemHealth?.ok),issues:o,summary:o.length?`发现 ${o.length} 项系统健康关注点`:`状态检查已完成`,freshnessWarning:t.map(e=>e.systemHealth?.freshnessWarning).filter(Boolean).join(`;`)||null}}},[c,u,l,b,_]),T=w.goals.find(e=>e.goalId===d)??null,E=l?.snapshots[d]??c,[D,O]=(0,V.useState)(null),[k,ee]=(0,V.useState)(null),[te,A]=(0,V.useState)(!1),j=w.goals.some(e=>e.activationState===`active`&&e.loadState===`loading`)?`loading`:w.goals.map(e=>`${e.goalId}:${e.agentId}`).join(`|`),M=T?.goalId??`manager`;w.goals.some(e=>e.activationState===`active`&&e.loadState)||(w.systemHealth?!w.systemHealth.ok:!c.ok)||w.openUserTodoCount>0&&`${w.openUserTodoCount}${w.blockingTodoCount}`;let N=v.length>0?v.map(e=>({agentId:e.agent_id,adapterKind:e.adapter_kind,available:e.available,capability:RS(e.agent_id,e.adapter_kind),interrupt:e.interrupt,label:e.display_name,location:e.location,resume:e.resume,source:e.source,statusLabel:e.available?`可用`:`需要配置`,streaming:e.streaming,toolCalls:e.tool_calls,trustScope:e.trust_scope})):[{agentId:`codex`,available:!0,capability:RS(`codex`),label:`Codex`,statusLabel:`正在检测`}],P=[...N,{agentId:`status-only`,available:!0,capability:`不调用模型`,adapterKind:`status_projection`,interrupt:!1,label:`仅查状态`,resume:!0,statusLabel:`只读`,streaming:!1,toolCalls:!1,trustScope:`read_only`}],F=N.find(e=>e.label===`Codex`&&e.available)?.agentId??N.find(e=>e.available)?.agentId??`status-only`,[ne,re]=(0,V.useState)(jS),I=dh(P,ne[M]??F,F),[L,ie]=(0,V.useState)(!1),[R,ae]=(0,V.useState)(!1),[oe,se]=(0,V.useState)(`chat`),[ce,le]=(0,V.useState)(``),[ue,z]=(0,V.useState)({}),[de,fe]=(0,V.useState)({}),[pe,me]=(0,V.useState)(null),[he,ge]=(0,V.useState)({}),[_e,ve]=(0,V.useState)([]),[ye,be]=(0,V.useState)(null),[xe,Se]=(0,V.useState)({}),Ce=(0,V.useRef)(1),we=(0,V.useRef)(1),Te=(0,V.useRef)(new Map),B=(0,V.useRef)(new Set),Ee=(0,V.useRef)(new Map),De=(0,V.useRef)(new Map),Oe=(0,V.useRef)(new Set),ke=(0,V.useRef)(new Set),Ae=(0,V.useRef)(null),je=(0,V.useRef)(null),Me=(0,V.useRef)(null),Ne=(0,V.useRef)(null);(0,V.useRef)(null);let Pe=ue[M]??[];de[M];let Fe=T?w.userTodos.filter(e=>e.goalId===T.goalId):w.userTodos,Ie=T?.agentTodos??[];XS(Ie,T?.needsYou?3:4);let Le=Ie.filter(e=>e.done).length,Re=Ie.length>0?`${Le}/${Ie.length}`:`暂无计划`;T&&({...w},Fe.filter(e=>e.blocking).length,Fe.length),(0,V.useEffect)(()=>{let e=ih(f.activeSource.statusUrl,window.location.href),t=e.source?ch(E,e.source):null;if(!T||!t?.indexUrl||!t.detailUrl){O(null),ee(null),A(!1);return}let{detailUrl:n,indexUrl:r}=t,i=!1;return O(null),ee(null),A(!0),lh(r,T.goalId).then(async e=>{let t=e.items[0]?.detail_ref;return t?uh(n,t):null}).then(e=>{i||O(e)}).catch(e=>{i||ee(Dp(e))}).finally(()=>{i||A(!1)}),()=>{i=!0}},[E,T?.goalId,f.activeSource.statusUrl]);let ze=T?void 0:he[M]?.sessionId;(0,V.useEffect)(()=>{if(h||!ze)return;let e=!1,t,n=async()=>{try{let t=await Vh(ze);if(e)return;let n=t.messages.filter(e=>e.origin===`manager_followup`);z(e=>{let t=e[M]??[],r=new Set(t.map(e=>e.sourceMessageId)),i=n.filter(e=>!r.has(e.message_id)),a=new Map(n.map(e=>[e.message_id,e.return_delivery])),o=!1,s=t.map(e=>{let t=e.sourceMessageId?a.get(e.sourceMessageId):void 0;return JSON.stringify(t)===JSON.stringify(e.returnDelivery)?e:(o=!0,{...e,returnDelivery:t})});return!i.length&&!o?e:{...e,[M]:[...s,...i.map(e=>({id:Ce.current++,sourceMessageId:e.message_id,role:`assistant`,agentLabel:I.label,sourceLabel:`管家交接回执`,text:PS(e.text),lines:[],returnDelivery:e.return_delivery}))]}})}catch{}finally{e||(t=setTimeout(n,3e3))}};return n(),()=>{e=!0,t&&clearTimeout(t)}},[h,ze,M,I.label]);function Be(e,t){ge(n=>{if(t===null){let t={...n};return delete t[e],t}return{...n,[e]:t}})}(0,V.useEffect)(()=>{if(h){y([]),x(!1),C(null);return}let e=!1;return Rh().then(t=>{if(!e){y(t.adapters??[]);let e=t.manager?.runtime;C(e?{schema_version:`manager_runtime_session_readback_v0`,runtime_profile:e.runtime_profile,configuration_revision:e.configuration_revision,status:e.status,sandbox:e.sandbox,standing_grant:e.standing_grant,tool_classes:e.tool_classes}:null),x(t.goal_subagent_configuration===`preview_locked`)}}).catch(()=>{e||x(!1)}),()=>{e=!0}},[h]),(0,V.useEffect)(()=>{try{window.localStorage.setItem(AS,JSON.stringify(ne))}catch{}},[ne]),(0,V.useEffect)(()=>{if(h||!I.available)return;let e=M,t=`${e}:${I.agentId}`,n=T?`goal`:`manager`,r=T?`goal.${T.goalId}`:`manager`,i=!1,a=null,o=null;return(async()=>{try{let s=await Wh({agentId:I.agentId,channelId:r,goalId:T?.goalId});if(i||(z(t=>(t[e]?.length??0)>0?t:{...t,[e]:s.messages.map(e=>({sourceMessageId:e.message_id,agentLabel:e.role===`user`?void 0:I.label,attachments:kS(e.attachments),id:Ce.current++,lines:[],role:e.role===`user`?`user`:`assistant`,returnDelivery:e.return_delivery,sourceLabel:e.role===`user`?void 0:e.role===`error`?`本地会话记录`:`恢复的 ${I.label} 会话`,text:e.role===`user`?e.text:PS(e.text)}))}),I.agentId===`status-only`))return;let c=s.sessions[0];if(o=c?.session_id??null,c&&!c.resumable){B.current.add(t),Be(e,{agentId:I.agentId,resumable:!1,sessionId:c.session_id,status:`resume_failed`});return}let l=n===`manager`?``:T?.goalId??``;if(n===`goal`&&!l)return;let u=await Bh(l,I.agentId,`resume_latest`,n);if(i)return;n===`manager`&&u.session.manager_runtime&&C(u.session.manager_runtime),Te.current.set(t,u.session_id);let d=s.snapshots.find(e=>e.session.session_id===u.session_id),f=d?.session.active_turn_id??``;if(Be(e,{agentId:I.agentId,resumable:!0,sessionId:u.session_id,status:f?`running`:`ready`,turnId:f||void 0}),B.current.delete(t),!f)return;let p=`${u.session_id}:${f}`;if(ke.current.has(p))return;ke.current.add(p),Ee.current.set(e,f),Be(e,{agentId:I.agentId,resumable:!0,sessionId:u.session_id,status:`running`,turnId:f}),me(e),a=new AbortController,De.current.set(e,a);let m=``,h=Ve(e,{activity:[`正在恢复进行中的 Agent 回合`],agentLabel:I.label,lines:[],pending:!0,sourceLabel:`恢复的 ${I.label} 会话`,text:``});try{let t=await Zh(u.session_id,f,{signal:a.signal,onDelta:t=>{m+=t,He(e,h,{text:m})},onActivity:t=>{z(n=>({...n,[e]:(n[e]??[]).map(e=>e.id===h?{...e,activity:[...new Set([...e.activity??[],t])].slice(-6)}:e)}))}});if(i)return;He(e,h,{lines:t.response.gate?[t.response.gate.summary,t.response.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:t.response.message||m.trim()||`${I.label} 已完成分析。`});let n=w.goals.find(e=>e.goalId===d?.session.goal_id)??T??w.goals[0]??null;if(n&&t.response.proposals.length>0){let r=t.response.proposals.map(e=>({goalId:n.goalId,id:we.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));fe(t=>({...t,[e]:[...t[e]??[],...r]}))}}catch(t){if(i)return;He(e,h,{activity:[],lines:[],pending:!1,reconnect:t instanceof Eh&&t.payload.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t instanceof Error?t.message:`无法恢复进行中的 Agent 回合。`})}finally{ke.current.delete(p),Ee.current.get(e)===f&&Ee.current.delete(e),Be(e,{agentId:I.agentId,resumable:!0,sessionId:u.session_id,status:`ready`}),De.current.get(e)===a&&De.current.delete(e),i||me(t=>t===e?null:t)}}catch(n){if(i)return;n instanceof Eh&&n.payload.error_code===`resume_failed`&&(B.current.add(t),o&&Be(e,{agentId:I.agentId,resumable:!1,sessionId:o,status:`resume_failed`}))}})(),()=>{i=!0,a?.abort()}},[M,w.goals[0]?.goalId,h,T?.goalId,I.agentId,I.available,I.label]),(0,V.useEffect)(()=>{if(h||T||w.goals.length===0||j===`loading`)return;let e=!1;return Promise.all(w.goals.filter(e=>!e.loadState).map(async e=>{let t=await Hh({agentId:e.agentId,channelId:`goal.${e.goalId}`,goalId:e.goalId});return{goalId:e.goalId,session:t.sessions[0]??null}})).then(t=>{e||ge(e=>{let n={...e};for(let e of t)e.session&&(n[e.goalId]={agentId:e.session.agent_id,resumable:e.session.resumable,sessionId:e.session.session_id,status:e.session.active_turn_id?`running`:e.session.status,turnId:e.session.active_turn_id??void 0});return n})}).catch(()=>{}),()=>{e=!0}},[h,j,T?.goalId]),(0,V.useEffect)(()=>{if(be(null),h){ve([]),Se({});return}if(!T){ve([]),Se({});return}let e=!1,t=0,n=0;ve([]),Se({});let r=async()=>{if(!e){if(document.hidden){t=window.setTimeout(()=>void r(),1e4);return}try{let t=await Hh({goalId:T.goalId});if(!e){let r=t.sessions.filter(e=>e.channel_id?.startsWith(`task.`));ve(r);let i=await Promise.allSettled(r.map(e=>Vh(e.session_id)));if(!e){let e=i.some(e=>e.status===`rejected`);n=e?n+1:0,be(e?`partial`:null),Se(Object.fromEntries(i.flatMap((e,t)=>e.status===`fulfilled`?[[r[t].session_id,e.value]]:[])))}}}catch{n+=1,e||be(`offline`)}e||(t=window.setTimeout(()=>void r(),Math.min(3e4,2e3*2**Math.min(n,4))))}};return r(),()=>{e=!0,window.clearTimeout(t)}},[h,T?.goalId]),(0,V.useEffect)(()=>{if(!L)return;let e=window.requestAnimationFrame(()=>{Ae.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()});return()=>{window.cancelAnimationFrame(e),je.current?.focus()}},[L]),(0,V.useEffect)(()=>{if(!R)return;let e=window.requestAnimationFrame(()=>Me.current?.focus());return()=>{window.cancelAnimationFrame(e),Ne.current?.focus()}},[R]),(0,V.useEffect)(()=>{if(!L&&!R)return;let e=e=>{e.key===`Escape`&&(ie(!1),ae(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[L,R]);function Ve(e,t){let n=Ce.current++;return z(r=>({...r,[e]:[...r[e]??[],{...t,id:n,role:`assistant`}]})),n}function He(e,t,n){z(r=>({...r,[e]:(r[e]??[]).map(e=>e.id===t?{...e,...n}:e)}))}async function Ue(e,t){let n=e.trim();if(!n)return;let r=t&&`goalId`in t?t.goalId??`manager`:M,i=r===`manager`?null:w.goals.find(e=>e.goalId===r)??null,a=t?.agentId?dh(P,t.agentId,F):I,o=r===`manager`?w:i?{...w,blockingTodoCount:w.userTodos.filter(e=>e.goalId===i.goalId&&e.blocking).length,goals:[i],openUserTodoCount:w.userTodos.filter(e=>e.goalId===i.goalId).length,userTodos:w.userTodos.filter(e=>e.goalId===i.goalId),visibleUserTodos:w.userTodos.filter(e=>e.goalId===i.goalId)}:w,s=Ce.current++;if(z(e=>({...e,[r]:[...e[r]??[],{attachments:t?.attachments,id:s,lines:[],role:`user`,text:n}]})),le(``),me(r),a.agentId===`status-only`||!i&&r!==`manager`){let e=cC(E,o,n),t=a.agentId===`status-only`;Ve(r,{agentLabel:t?`仅查状态`:`LoopX 管家`,lines:e.lines.slice(0,3),sourceLabel:t?`LoopX 状态投影 · 仅查状态`:`LoopX 状态投影`,text:e.text}),zh({answer:[e.text,...e.lines.slice(0,3)].filter(Boolean).join(` +`),contextKind:r===`manager`?`manager`:`goal`,goalId:r===`manager`?void 0:r,question:n}).catch(()=>{}),me(null);return}let c=`${r}:${a.agentId}`,l=null;try{let e=Te.current.get(c);if(!e){let t=B.current.has(c)?`new`:`resume_latest`,n=await Bh(r===`manager`?``:i.goalId,a.agentId,t,r===`manager`?`manager`:`goal`);r===`manager`&&n.session.manager_runtime&&C(n.session.manager_runtime),e=n.session_id,Te.current.set(c,e),Be(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),B.current.delete(c)}let o=``;l=Ve(r,{activity:[`正在连接 Agent`],agentLabel:a.label,lines:[],pending:!0,sourceLabel:r===`manager`?`${a.label} 管家 · 跨 Goal`:`${a.label} Agent · ${NS(i.goalId)}`,text:``});let s=(await Yh(e,n,{attachments:t?.attachments,signal:(()=>{let e=new AbortController;return De.current.set(r,e),e.signal})(),onDelta:e=>{o+=e,l!==null&&He(r,l,{text:o})},onActivity:e=>{l!==null&&z(t=>({...t,[r]:(t[r]??[]).map(t=>t.id===l?{...t,activity:[...new Set([...t.activity??[],e])].slice(-6)}:t)}))},onPhase:(t,n)=>{Ee.current.set(r,n),Be(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`running`,turnId:n})}})).response;if(He(r,l,{lines:s.gate?[s.gate.summary,s.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:PS(s.message||o.trim())||`${a.label} 已完成分析。`}),s.proposals.length>0&&!i&&He(r,l,{lines:[`请进入要修改的 Goal,预览并确认具体变更。`]}),s.proposals.length>0&&i){let e=s.proposals.map(e=>({goalId:i.goalId,id:we.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));fe(t=>({...t,[r]:[...t[r]??[],...e]}))}if(r!==`manager`&&s.protected_action){let e=hS(r,n,s.protected_action);if(e)return e}}catch(e){if(Oe.current.delete(r)){let e={agentLabel:a.label,lines:[],pending:!1,sourceLabel:`${a.label} 会话`,text:`已中断。你可以在当前会话继续发送消息。`};l===null?Ve(r,e):He(r,l,e);return}let t=e instanceof Eh?e.payload:null;t&&fh(t)&&Te.current.delete(c),t?.error_code===`resume_failed`&&(Te.current.delete(c),B.current.add(c),Be(r,{agentId:a.agentId,resumable:!1,sessionId:he[r]?.sessionId??`resume-failed`,status:`resume_failed`}));let n=t?.gate,i=n&&typeof n==`object`?String(n.summary??``):``,o={agentLabel:a.label,lines:i?[i]:[],pending:!1,reconnect:t?.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t?.error_code===`resume_failed`?`原 ${a.label} 会话无法恢复。本地历史已经保留,请在运行详情里选择“重试恢复”或“开始新 Session”。`:e instanceof Error?e.message:`${a.label} 会话暂时不可用。`};l===null?Ve(r,o):He(r,l,o)}finally{Ee.current.delete(r),De.current.delete(r);let e=Te.current.get(c);e&&Be(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),me(e=>e===r?null:e)}}async function We(e){let t=e?.goalId??M,n=he[t],r=e?.agentId??n?.agentId??I.agentId,i=`${t}:${r}`,a=e?.sessionId??n?.sessionId??Te.current.get(i),o=e?.turnId??n?.turnId??Ee.current.get(t);if(!(!a||!o))try{Oe.current.add(t),await Jh(a,o),De.current.get(t)?.abort()}catch(e){throw Oe.current.delete(t),e}finally{Ee.current.delete(t),Be(t,{agentId:r,resumable:!0,sessionId:a,status:`ready`}),De.current.delete(t),me(e=>e===t?null:e)}}async function Ge(e){let t=e.goalId,n=`${t}:${e.agentId}`,r=e.sessionId??he[t]?.sessionId??Te.current.get(n);if(r)try{let i=await $h(r);Te.current.set(n,r),B.current.delete(n),Be(t,{agentId:e.agentId,resumable:i.session.resumable,sessionId:r,status:i.session.status})}catch{Be(t,{agentId:e.agentId,resumable:!1,sessionId:r,status:`resume_failed`})}}function Ke(e){let t=`${e.goalId}:${e.agentId}`;Te.current.delete(t),B.current.add(t),Be(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:`new-session-pending`,status:`ready`})}async function qe(e){let t=`${e.goalId}:${e.agentId}`,n=e.sessionId??he[e.goalId]?.sessionId??Te.current.get(t);n&&n!==`new-session-pending`&&await Qh(n),Te.current.delete(t),B.current.add(t),Be(e.goalId,null)}function Je(e){P.some(t=>t.agentId===e&&t.available)&&(re(t=>({...t,[M]:e})),ie(!1))}function Ye(){i(``),se(`chat`)}function Xe(e){i(e),se(`chat`)}T&&MS[T.state],T&&(`${I.label}${T.state}`,Ie.length>0&&`${Re}`,Fe.length>0&&`${Fe.length}`),T?.state===`需修复`||!T&&!c.ok?(T&&LS(T.agentId),T?.nextSentence,T?.agentSentence):T?.state===`等你`?(T.needsYouBlocking,T.needsYouBlocking,T.needsYou??T.nextSentence,T.needsYou):(T&&LS(T.agentId),T?.nextSentence);let Ze=[...!T&&he.manager?.status===`resume_failed`?[{id:`run:manager:resume-failed`,kind:`run`,run:{agentId:he.manager.agentId,agentLabel:LS(he.manager.agentId),canInterrupt:!1,completedSteps:0,goalId:`manager`,goalTitle:`LoopX 管家`,latestActivity:`本地聊天记录已保留,点我查看恢复方式。`,resumable:!1,runId:`manager:resume-failed`,sessionId:he.manager.sessionId,sessionStatus:`resume_failed`,status:`failed`,title:`上次会话需要恢复`,totalSteps:1,outputs:[]}}]:[],...T?_e.map(e=>{let t=e.channel_id?.startsWith(`task.`)?e.channel_id.slice(5):void 0,n=T.agentTodos.find(e=>e.todoId===t),r=!!e.active_turn_id,i=xe[e.session_id],a=i?.messages.some(e=>FS(e.role,e.text))===!0;return{id:`run:task:${e.session_id}`,kind:`run`,run:{agentId:e.agent_id,agentLabel:LS(e.agent_id),canInterrupt:r,completedSteps:n?.done||a?1:0,goalId:T.goalId,goalTitle:T.title,latestActivity:r?`Agent 正在执行,可进入 Session 查看过程或发送纠偏。`:a?`Agent 已返回结果,点击查看结果与完整运行记录。`:`执行 Session 已保留,可继续纠偏或恢复。`,resumable:e.resumable,runId:e.session_id,sessionId:e.session_id,sessionMessages:i?.messages.map(e=>({createdAt:e.created_at,messageId:e.message_id,role:e.role===`user`?`user`:FS(e.role,e.text)?`assistant`:`error`,text:e.role===`user`?e.text:PS(e.text)})),sessionStatus:a?`completed`:e.status,status:n?.done||a?`completed`:r?`running`:e.status===`resume_failed`?`failed`:`waiting`,title:n?.text??`Agent 执行任务`,todoId:t,totalSteps:1,turnId:e.active_turn_id??void 0}}}):[],...T?[{id:`run:${T.goalId}`,kind:`run`,run:{agentId:he[T.goalId]?.agentId??T.agentId,agentLabel:LS(he[T.goalId]?.agentId??T.agentId),canInterrupt:!!he[T.goalId]?.turnId,completedSteps:T.agentTodos.filter(e=>e.done).length,goalId:T.goalId,goalTitle:T.title,latestActivity:T.agentSentence,resumable:he[T.goalId]?.resumable??!0,runId:`goal:${T.goalId}`,sessionId:he[T.goalId]?.sessionId,sessionStatus:he[T.goalId]?.status,status:he[T.goalId]?.turnId?`running`:T.state===`需修复`?`failed`:`waiting`,title:T.nextSentence,totalSteps:T.agentTodos.length||1,turnId:he[T.goalId]?.turnId,outputs:T.runEvidence?[{createdAt:T.runEvidence.generatedAt,kind:`evidence`,outputId:`${T.goalId}:latest-evidence`,title:T.runEvidence.label}]:[]}}]:[],...Pe.map(e=>({id:`message:${e.id}`,kind:`message`,message:{agentLabel:e.agentLabel,attachments:e.attachments,id:String(e.id),pending:e.pending,returnDelivery:e.returnDelivery,role:e.role,text:e.text||(e.pending?`Agent 正在处理…`:e.lines.join(` +`))}})),...(T?[T]:w.goals).flatMap(e=>e.runEvidence?[{id:`output:${e.goalId}:${e.runEvidence.generatedAt||`latest`}`,kind:`output`,output:{agentLabel:LS(e.agentId),createdAt:e.runEvidence.generatedAt,goalId:e.goalId,goalTitle:e.title,kind:`evidence`,outputId:`${e.goalId}:latest-evidence`,runId:e.runEvidence.runId??void 0,safePreview:e.runEvidence.safePreview,summary:e.runEvidence.summary,title:e.runEvidence.label,todoId:e.runEvidence.todoId??void 0}}]:[]),...T&&D?[{id:`output:${T.goalId}:report:${D.publication.publication_id}`,kind:`output`,output:{agentId:D.agent_id,agentLabel:LS(D.agent_id),createdAt:D.publication.delivered_at,goalId:T.goalId,goalTitle:T.title,kind:`report`,outputId:D.publication.publication_id,report:{addedCount:D.delta.added_count,changedCount:D.delta.changed_count,deliveredAt:D.publication.delivered_at,generationId:D.generation_id,items:D.delta.items.map(e=>({changeKind:e.change_kind,previousStatus:e.previous_status,sourceRef:e.source_ref,status:e.status,summary:e.summary,title:e.title})),periodEndAt:D.period_window.end_at,periodStartAt:D.period_window.start_at,predecessorPublicationId:D.publication.predecessor_publication_id,publicationId:D.publication.publication_id},safePreview:D.delta.items.map(e=>`${e.change_kind===`added`?`+`:`~`} ${e.title}\n${e.summary}`).join(` -`),summary:D.summary,title:D.title}}]:[]],Qe=f.connectionState===`connected`,$e=new Map(w.goals.map(e=>[e.goalId,e.title])),et=e=>Wd(e,f.activeSource.statusUrl,Qe&&!l?.errors[e.goalId],$e.get(e.goalId)),tt={...vy(w),userTodos:w.userTodos.map(et),attentionHistory:(w.attentionHistory??w.userTodos).map(et),periodicReports:{error:k,loading:te},timeline:Ze};return(0,H.jsxs)(`div`,{className:p===`dark`?`dark`:``,"data-testid":`personal-goal-home`,children:[ye?(0,H.jsx)(`p`,{role:`status`,className:`m-0 bg-amber-50 px-4 py-2 text-sm text-amber-900`,children:_(ye===`partial`?`runs.discoveryPartial`:`runs.discoveryOffline`)}):null,(0,H.jsx)(Kx,{agents:P.map(e=>({adapterKind:e.adapterKind,agentId:e.agentId,available:e.available,capability:e.capability,interrupt:e.interrupt,label:e.label,location:e.location,resume:e.resume,source:e.source,streaming:e.streaming,toolCalls:e.toolCalls,trustScope:e.trustScope,workspaceCompatibility:e.available?`当前 Goal 写入前验证`:`不可用,需先修复 Endpoint`})),callbacks:{onApplyAttention:e=>Xe(e.goalId),onCorrectRun:async(e,t)=>{if(!e.sessionId)throw Error(`这个 Run 还没有可纠偏的执行 Session。`);let n=await Ph((await jh({actionKind:`run.correct`,context:{kind:`run`,goal_id:e.goalId,todo_id:e.todoId},idempotencyKey:`workspace-run-correct-${e.sessionId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,message:t,session_id:e.sessionId},summary:`纠偏执行任务:${e.title}`})).proposal_id),r=typeof n.turn?.turn_id==`string`?n.turn.turn_id:void 0;if(Be(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:r?`running`:`ready`,turnId:r}),r){Ee.current.set(e.goalId,r);let t=new AbortController;De.current.set(e.goalId,t);let n=``,i=Ve(e.goalId,{activity:[`正在把纠偏送入原执行 Session`],agentLabel:e.agentLabel,lines:[],pending:!0,sourceLabel:`${e.agentLabel} · 执行 Session`,text:``});try{let a=await Zh(e.sessionId,r,{signal:t.signal,onDelta:t=>{n+=t,He(e.goalId,i,{text:n})}});He(e.goalId,i,{activity:[],pending:!1,text:NS(a.response.message||n.trim())||`${e.agentLabel} 已完成纠偏。`})}catch(t){let n=Oe.current.delete(e.goalId);He(e.goalId,i,{activity:[],pending:!1,text:n?`已中断。你可以在当前会话继续发送消息。`:t instanceof Error?t.message:`纠偏回合失败。`})}finally{Ee.current.delete(e.goalId),De.current.delete(e.goalId),Be(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:`ready`})}}},onCloseRunSession:qe,onInterruptRun:async e=>We(e),onOpenGoal:Xe,onOpenRunSession:async e=>{if(!e.sessionId)return;let t=e.sessionId,n=await Vh(t);Se(e=>({...e,[t]:n})),Xe(e.goalId),z(t=>({...t,[e.goalId]:n.messages.map(t=>({agentLabel:t.role===`user`?void 0:e.agentLabel,attachments:OS(t.attachments),id:Ce.current++,lines:[],role:t.role===`user`?`user`:`assistant`,sourceLabel:t.role===`user`?void 0:`${e.agentLabel} · 执行 Session`,text:t.role===`user`?t.text:NS(t.text)}))})),Be(e.goalId,{agentId:e.agentId,resumable:n.session.resumable,sessionId:t,status:n.session.active_turn_id?`running`:n.session.status,turnId:n.session.active_turn_id??void 0})},onOpenOutput:e=>Xe(e.goalId),...b?{onPreviewGoalSubagentConfiguration:async e=>{let t=await ng(e);return{changed:t.changed,configuration:{allowedDomains:t.after.orchestration.allowed_domains,enabled:t.feature_summary.multi_subagent===`enabled`,maxChildren:t.after.orchestration.max_children,modelConfig:t.after.orchestration.model_config},previewId:t.preview_id}},onApplyGoalSubagentConfiguration:async({previewId:e,...t})=>{let n=await rg(t,e);return{allowedDomains:n.after.orchestration.allowed_domains,enabled:n.feature_summary.multi_subagent===`enabled`,maxChildren:n.after.orchestration.max_children,modelConfig:n.after.orchestration.model_config}}}:{},...g?{onExecuteGoalLifecycle:async({goalId:e,operation:t,reason:n})=>{let r=await Sb(g,e,t,n);return{activationState:r.activation_state,projectionVerified:r.projection_verified}}}:{},onGoalActivationStateChange:n,onGoalDeleted:r,onReconcileStatus:a,onRetryGoalArchive:s,onExportOutput:async e=>{let t=[`# ${e.title}`,``,e.summary??``,``,e.safePreview??`此产出没有可用的公开安全预览。`,``,`Goal: ${e.goalId}`,`Todo: ${e.todoId??`unlinked`}`,`Run: ${e.runId??`unlinked`}`].join(` -`),n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),r=document.createElement(`a`);r.href=n,r.download=`${e.outputId.replace(/[^a-z0-9._-]+/gi,`-`)}.md`,r.click(),URL.revokeObjectURL(n)},onRefresh:o,onRetryResumeRun:Ge,onSelectAgent:Je,onSelectGoal:e=>e?Xe(e):Ye(),onSendMessage:async(e,t,n,r)=>Ue(e,{agentId:t,goalId:n,attachments:r}),onStartNewRunSession:Ke},goalArchiveLoadState:e,managerRuntime:S,model:tt,readOnly:h,selectedAgentId:I.agentId,selectedGoalId:T?.goalId??null,statusSourceControl:f})]})}function uC({error:e,isLoading:t,onRetry:n,requestedUrl:r,theme:i,toggleTheme:a}){let o=!!(e&&/failed to fetch|networkerror|load failed/i.test(e)&&r.includes(`status.json`));return(0,H.jsx)(`div`,{className:i===`dark`?`dark`:``,children:(0,H.jsxs)(`main`,{className:`min-h-screen bg-[#f6f7f9] text-slate-950 dark:bg-[#09090b] dark:text-zinc-50`,children:[(0,H.jsxs)(`header`,{className:`flex min-h-16 flex-wrap items-center justify-between gap-3 border-b border-slate-200 bg-white px-4 py-3 dark:border-zinc-800 dark:bg-zinc-950 sm:px-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold`,children:`LoopX Workspace`}),(0,H.jsx)(`p`,{className:`mt-1 break-all text-sm text-slate-500 dark:text-zinc-400`,children:`Personal Workspace`})]}),(0,H.jsx)(iy,{"aria-label":`切换主题`,onClick:a,size:`icon`,variant:`secondary`,children:i===`dark`?(0,H.jsx)(Ym,{className:`h-4 w-4`}):(0,H.jsx)(Am,{className:`h-4 w-4`})})]}),(0,H.jsxs)(`div`,{className:`grid min-h-[calc(100vh-80px)] sm:grid-cols-[240px_1fr]`,children:[(0,H.jsxs)(`aside`,{className:`hidden border-r border-slate-200 p-6 dark:border-zinc-800 sm:block`,"aria-label":`Workspace`,children:[(0,H.jsx)(`strong`,{children:`LoopX`}),(0,H.jsx)(`p`,{className:`mt-6 text-sm`,children:`Workspace`}),(0,H.jsx)(`p`,{className:`mt-8 text-xs text-slate-500`,children:`Goals`}),[1,2,3].map(e=>(0,H.jsx)(`div`,{className:`mt-4 h-8 rounded bg-slate-100 dark:bg-zinc-900`},e))]}),(0,H.jsx)(`div`,{className:`p-4 sm:p-8`,children:(0,H.jsx)(ay,{"data-testid":`initial-status-state`,children:(0,H.jsx)(oy,{className:`flex min-h-64 items-center justify-center p-6`,children:(0,H.jsxs)(`div`,{className:`max-w-xl text-center`,children:[e?(0,H.jsx)(am,{className:`mx-auto h-6 w-6 text-rose-600 dark:text-rose-300`}):(0,H.jsx)(Lm,{className:`mx-auto h-6 w-6 animate-spin text-slate-500 dark:text-zinc-400`}),(0,H.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e?`无法加载实时状态`:`正在加载实时状态`}),e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`mt-2 break-words text-sm leading-6 text-slate-500 dark:text-zinc-400`,children:o?`本地状态服务暂时未连接。升级或启动期间可能短暂断开,请重试;仍失败时重新打开 LoopX App,或运行 loopx doctor。`:e}),o?(0,H.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-slate-400 dark:text-zinc-500`,children:`重新加载不会执行任务,也不会改变 Goal 配置。`}):null,(0,H.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:(0,H.jsxs)(iy,{disabled:t,onClick:n,children:[(0,H.jsx)(Lm,{className:`h-4 w-4`}),`重试`]})})]}):(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-500 dark:text-zinc-400`,role:`status`,children:`正在连接 Workspace,Goal 列表将先出现,详细状态会逐个补齐。 / Connecting to your Workspace. Goals load independently.`})]})})})})]})]})})}function dC(){let e=cw.useSearch(),t=cw.useNavigate(),[n,r]=(0,V.useState)(`light`),[i,a]=(0,V.useState)(null),o=(0,V.useRef)(null),s=(0,V.useRef)(e.goalId);s.current=e.goalId;let[c,l]=(0,V.useState)(Op),[u,d]=(0,V.useState)({kind:`example`,label:`bundled example`}),[f,p]=(0,V.useState)(()=>aS(window.localStorage,window.location.href)),m=(0,V.useRef)(f);m.current=f;let[h,g]=(0,V.useState)(e.statusUrl),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)({error:null,phase:`idle`}),[C,w]=(0,V.useState)(e.statusUrl.trim()||null),[T,E]=(0,V.useState)(!1),D=(0,V.useRef)(null),O=(0,V.useRef)(Zg(e.statusUrl.trim()||null)),k=!T&&u.kind===`example`?e.statusUrl.trim():``,ee=C??k,te=u.kind===`url`?u.label:hS,A=!!(_&&C),j=fS(f,C,te,window.location.href),M=u.kind===`example`&&!T,N=c.attention_queue,P=c.run_history,F=(0,V.useMemo)(()=>vS(P.goals,N.items),[P.goals,N.items]);function ne(e,t,n=0){S({error:null,phase:`loading`}),gS(oh(e,`stopped`,window.location.href)).then(r=>{if(!t_(O.current,t))return;let i=r.goal_projection?.registry_revision??null,a=t.registryRevision!==null&&t.registryRevision!==void 0&&i!==null&&t.registryRevision!==i;if(l(e=>w_(e,r)),a&&n<1){L(e,{background:!0,resyncAttempt:n+1});return}S(a?{error:`Goal 状态在加载历史时发生变化,请重试。`,phase:`error`}:{error:null,phase:`ready`})}).catch(e=>{t_(O.current,t)&&S({error:Dp(e),phase:`error`})})}function re(){let e=u.kind===`url`?u.label:h||hS,t=$g(O.current,e,{background:!0});if(i){L(e);return}t&&ne(e,t)}async function I(e,n,r){if(r.background)return l(e=>w_(e,n)),!0;let i={kind:`url`,label:e};return O.current.loadedUrl=e,l(n),d(i),g(e),await t({search:t=>({...t,statusUrl:e})}),e_(O.current,r)?(O.current.requestedUrl=null,w(null),!0):!1}async function L(e,t={}){let n=e.trim(),r=t.background===!0;if(!n){r||v(`状态地址不能为空`);return}let c=$g(O.current,n,{background:r,selectionRevision:t.selectionRevision});if(!c)return;o.current?.abort();let d=new AbortController;o.current=d,r||(D.current=null,E(!1),w(n),b(!0),v(null),S({error:null,phase:`idle`}));try{let e=await jp(n,window.location.href).catch(()=>null);if(!t_(O.current,c))return;if(e){let o=t.retryOnly&&u.kind===`url`&&u.label===n&&i?.directory.registry_revision===e.registry_revision?i.snapshots:{};a({directory:e,snapshots:o,errors:{}});let f={...e,goals:e.goals.filter(e=>!o[e.id])},p=!1,m=Mp(e);if(r)l(m);else if(!await I(n,m,c))return;if(S({error:null,phase:`loading`}),await Pp(n,window.location.href,f,(e,t,n)=>{n===`revision`&&(p=!0),a(r=>r&&{...r,snapshots:t?{...r.snapshots,[e]:t}:r.snapshots,errors:n?{...r.errors,[e]:n}:r.errors})},()=>t_(O.current,c),()=>s.current,d.signal),p&&(t.resyncAttempt??0)<1&&t_(O.current,c)){await L(n,{resyncAttempt:1});return}t_(O.current,c)&&S({error:null,phase:`ready`});return}let o=await gS(oh(n,`active`,window.location.href));if(!t_(O.current,c)||(a(null),c.registryRevision=o.goal_projection?.registry_revision??null,!await I(n,o,c)))return;if(o.goal_projection?.scope!==`active`||o.goal_projection.complete){S({error:null,phase:`ready`});return}ne(n,c,t.resyncAttempt??0)}catch(e){if(!e_(O.current,c))return;r||v(Dp(e))}finally{!r&&e_(O.current,c)&&b(!1)}}function ie(e,t={}){o.current?.abort();let n=Qg(O.current,e.statusUrl);D.current=null,E(!1),w(e.statusUrl),b(!0),v(null),(async()=>{if(t.ensureTunnel&&e.kind===`ssh_tunnel`){let t=new URL(e.statusUrl,window.location.href).port;if(t)try{await xb(e.label,t)}catch{}}O.current.selectionRevision===n&&await L(e.statusUrl,{selectionRevision:n})})()}function R(e){m.current=e,p(e);try{oS(window.localStorage,e)}catch{}}let ae={activeSource:j,connectionState:y?`loading`:A?`error`:`connected`,errorMessage:A?`未切换到 ${C??`所选来源`}:${_}`:null,onAdd:e=>{let t=cS(f,e,window.location.href);return`error`in t?{error:t.error}:(R(t.catalog),ie(t.source,{ensureTunnel:e.ensureTunnel}),{})},onConfiguredHostsLoaded:e=>{let t=m.current,n=sS(t,e);n!==t&&R(n)},onRemove:e=>{R(lS(f,e)),j.id===e&&ie(eS)},onSelect:e=>{let t=f.sources.find(t=>t.id===e);t&&ie(t,{ensureTunnel:t.kind===`ssh_tunnel`})},sources:j.id===`temporary`?[...f.sources,j]:f.sources};(0,V.useEffect)(()=>{let t=e.statusUrl.trim();if(t){if(D.current===t||C&&C!==t)return;(u.kind!==`url`||u.label!==t)&&L(t);return}D.current=null,!T&&(C||u.kind===`example`&&L(hS))},[T,C,e.statusUrl,u.kind,u.label]),(0,V.useEffect)(()=>{if(e.statusUrl&&u.kind===`example`)return;let n=new Set(F.map(e=>e.goal.id));if(F.length===0){e.goalId&&t({search:e=>({...e,goalId:``})});return}e.goalId&&!n.has(e.goalId)&&x.phase!==`loading`&&t({search:e=>({...e,goalId:``})})},[x.phase,F,t,e.goalId,e.statusUrl,u.kind]),(0,V.useEffect)(()=>{if(!i||y||!e.goalId||u.kind!==`url`)return;let t=i.directory.goals.find(t=>t.id===e.goalId);t?.activation_state===`stopped`&&!i.snapshots[t.id]&&!i.errors[t.id]&&L(u.label,{retryOnly:!0})},[e.goalId,y,i,u]);function oe(e){t({search:t=>({...t,goalId:e})})}return M?(0,H.jsx)(uC,{error:_,isLoading:y,onRetry:()=>void L(ee||hS),requestedUrl:ee||hS,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)}):(0,H.jsx)(lC,{goalArchiveLoadState:x,isLoading:y,onGoalActivationStateChange:(e,t)=>{O.current.projectionRevision+=1,l(n=>wp(n,e,t)),a(n=>n&&{...n,snapshots:Object.fromEntries(Object.entries(n.snapshots).map(([n,r])=>[n,wp(r,e,t)]))})},onGoalDeleted:e=>{O.current.projectionRevision+=1,l(t=>Tp(t,e)),a(t=>t&&{...t,snapshots:Object.fromEntries(Object.entries(t.snapshots).filter(([t])=>t!==e))})},onSelectGoal:oe,onReconcileStatus:()=>L(u.kind===`url`?u.label:h||hS,{background:!0}),onRetryGoalArchive:re,onRefresh:()=>L(u.kind===`url`?u.label:h||hS,{retryOnly:!!(i&&Object.keys(i.errors).length)}),payload:c,progress:i,rows:F,selectedGoalId:e.goalId,statusSourceControl:ae,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)})}var fC=k_(`inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium`,{variants:{variant:{neutral:`border-slate-200 bg-white text-slate-700 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-300`,success:`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-200`,warning:`border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200`,info:`border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-900 dark:bg-sky-950 dark:text-sky-200`,danger:`border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-900 dark:bg-rose-950 dark:text-rose-200`}},defaultVariants:{variant:`neutral`}});function pC({className:e,variant:t,...n}){return(0,H.jsx)(`span`,{className:ny(fC({variant:t}),e),...n})}var mC=[{label:`status payload`,source:`apps/presentation/dashboard/src/data/status.ts`,detail:`status_contract, attention_queue, local_dashboard_api, run_history`},{label:`channel projection`,source:`apps/presentation/dashboard/src/data/goal-channel-frontstage.ts`,detail:`decision_frame, todos, gates, leases, artifacts, truth_contract`},{label:`public showcase catalog`,source:`docs/showcases/showcase-catalog.json`,detail:`case metadata, visual hints, evidence boundaries, story beats`},{label:`route smoke`,source:`apps/presentation/dashboard/smoke/frontstage-route-smoke.ts`,detail:`static route contract, source guards, component expectations`}],hC=[{axis:`schema`,current:`goal_channel_projection_v0`,proposed:`new optional projection field`,gate:`parser default plus route smoke assertion`},{axis:`truth`,current:`event ledger and active state remain source of truth`,proposed:`derived UI state only`,gate:`truth_contract must stay read-only`},{axis:`privacy`,current:`compact source refs and warnings`,proposed:`public-safe fixture field`,gate:`loopx check and browser fake-private fixture`},{axis:`interaction`,current:`render, filter, select, inspect`,proposed:`no browser write by default`,gate:`write affordance requires explicit loopback capability`}],gC=[{title:`Fixture sources`,body:`Use examples/status.example.json, browser-smoke fixtures, and docs/showcases/showcase-catalog.json.`},{title:`Required proof`,body:`Every projection addition needs parser coverage, route smoke assertions, and one browser or bundle check when UI output changes.`},{title:`Never include`,body:`Raw task text, trajectories, transcripts, local paths, private registry state, credentials, or internal document links.`}],_C=[`npm --prefix apps/presentation/dashboard run smoke:frontstage-route`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-browser`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-share-bundle`,`npm --prefix apps/presentation/dashboard run build`,`loopx check --scan-path apps/presentation/dashboard --scan-path docs/status-data-contract.md`],vC=[{name:`Projection lane`,badges:[`read-only`,`schema v0`],body:`Summarizes one compact projection lane without mutating the underlying LoopX state.`},{name:`Capability badge`,badges:[`loopback`,`dry-run`],body:`Shows an advertised local capability only after the status feed declares it.`},{name:`Boundary warning`,badges:[`public-safe`,`omitted`],body:`Names omitted private material and points contributors back to compact source references.`}];function yC({children:e,icon:t,title:n}){return(0,H.jsxs)(`section`,{className:`rounded-lg border border-slate-200 bg-white shadow-sm`,children:[(0,H.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,H.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,H.jsx)(t,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function bC(){return(0,H.jsx)(yC,{icon:$p,title:`Status Contract Explorer`,children:(0,H.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,"data-testid":`developer-contract-explorer`,children:mC.map(e=>(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(pC,{variant:`info`,children:e.label}),(0,H.jsx)(pC,{variant:`neutral`,children:`public contract`})]}),(0,H.jsx)(`div`,{className:`mt-2 break-words font-mono text-xs text-slate-700`,children:e.source}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.detail})]},e.label))})})}function xC(){return(0,H.jsx)(yC,{icon:ym,title:`Projection Diffing`,children:(0,H.jsx)(`div`,{className:`overflow-x-auto`,"data-testid":`developer-projection-diffing`,children:(0,H.jsxs)(`table`,{className:`min-w-full border-separate border-spacing-0 text-left text-sm`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{className:`bg-slate-50 text-xs uppercase tracking-normal text-slate-500`,children:[(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Axis`}),(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Current`}),(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Proposed`}),(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Gate`})]})}),(0,H.jsx)(`tbody`,{children:hC.map(e=>(0,H.jsxs)(`tr`,{className:`align-top`,children:[(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 font-semibold text-slate-950`,children:e.axis}),(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.current}),(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.proposed}),(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.gate})]},e.axis))})]})})})}function SC(){return(0,H.jsx)(yC,{icon:hm,title:`Fixture Generation`,children:(0,H.jsx)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-fixture-generation`,children:gC.map(e=>(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:e.title}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.title))})})}function CC(){return(0,H.jsx)(yC,{icon:sm,title:`Smoke Checklist`,children:(0,H.jsx)(`div`,{className:`space-y-2 p-4`,"data-testid":`developer-smoke-checklist`,children:_C.map(e=>(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,H.jsx)(Xp,{className:`mt-0.5 h-4 w-4 shrink-0 text-emerald-600`}),(0,H.jsx)(`code`,{className:`break-all text-xs font-semibold leading-5 text-slate-700`,children:e})]},e))})})}function wC(){return(0,H.jsx)(yC,{icon:cm,title:`Component Examples`,children:(0,H.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-3`,"data-testid":`developer-component-examples`,children:vC.map(e=>(0,H.jsxs)(`article`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.badges.map(e=>(0,H.jsx)(pC,{variant:e===`read-only`||e===`public-safe`?`success`:`neutral`,children:e},e))}),(0,H.jsx)(`h3`,{className:`mt-3 text-sm font-semibold leading-6 text-slate-950`,children:e.name}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.name))})})}function TC(){return(0,H.jsx)(`main`,{className:`min-h-screen bg-[#f7f7f4] px-4 py-4 text-slate-950 sm:px-5`,"data-testid":`frontstage-developer-cockpit`,children:(0,H.jsxs)(`div`,{className:`mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,H.jsxs)(`aside`,{className:`rounded-lg border border-slate-200 bg-white p-4 shadow-sm xl:sticky xl:top-4 xl:self-start`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md border border-slate-200 bg-slate-950 text-white`,children:(0,H.jsx)(Xm,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:`Developer Cockpit`}),(0,H.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Projection extension`})]})]}),(0,H.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,H.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://huangruiteng.github.io/loopx/`,children:[(0,H.jsx)(Sm,{className:`h-4 w-4`}),`LoopX home`]}),(0,H.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://huangruiteng.github.io/loopx/docs/showcases/index.en.html`,children:[(0,H.jsx)(pm,{className:`h-4 w-4`}),`Public cases`]}),(0,H.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md bg-slate-950 px-3 py-2 text-sm font-medium text-white`,href:`/chat/developers/projections/`,children:[(0,H.jsx)(cm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,H.jsxs)(`div`,{className:`mt-5 space-y-2 rounded-md border border-emerald-200 bg-emerald-50 p-3 text-xs leading-5 text-emerald-950`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(pC,{variant:`success`,children:`read-only`}),(0,H.jsx)(pC,{variant:`neutral`,children:`public fixtures`})]}),(0,H.jsx)(`p`,{children:`This route uses static public contracts only; live status feeds, registry files, and browser write APIs stay outside the cockpit.`})]})]}),(0,H.jsxs)(`section`,{className:`space-y-4`,children:[(0,H.jsx)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(pC,{variant:`info`,children:`developers/projections`}),(0,H.jsx)(pC,{variant:`success`,children:`public-safe`}),(0,H.jsx)(pC,{variant:`neutral`,children:`no browser writes`})]}),(0,H.jsx)(`h1`,{className:`mt-3 text-3xl font-semibold tracking-normal text-slate-950`,children:`LoopX Projection Developer Cockpit`}),(0,H.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-slate-600`,children:`A read-only contributor workbench for adding dashboard/frontstage projections without reverse-engineering the large operator page.`})]}),(0,H.jsxs)(`div`,{className:`grid min-w-[260px] gap-2 text-sm`,children:[(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Source of truth`}),(0,H.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`status contract + compact fixtures`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Boundary`}),(0,H.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`read-only extension surface`})]})]})]})}),(0,H.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,H.jsx)(bC,{}),(0,H.jsx)(xC,{})]}),(0,H.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,H.jsx)(SC,{}),(0,H.jsx)(CC,{})]}),(0,H.jsx)(wC,{}),(0,H.jsx)(yC,{icon:Gm,title:`Extension Boundary`,children:(0,H.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-extension-boundary`,children:[(0,H.jsxs)(`div`,{className:`rounded-md border border-emerald-200 bg-emerald-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Allowed`}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Versioned parser defaults, public fixtures, read-only route panels, and focused smoke assertions.`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Review`}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`New dashboard dependencies, status contract fields, loopback capability display, and browser-visible workflows.`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-rose-200 bg-rose-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Stop`}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Credentials, private registry material, raw logs, transcripts, production actions, or default browser write authority.`})]})]})})]})]})})}var EC=Y({value:K().finite(),total:K().finite().positive().optional(),unit:G().optional(),higher_is_better:q()}).passthrough(),DC=hd(G(),K().finite()).default({}),OC=Y({outcome_status:G().optional(),failure_class:G(),causal_summary:G(),expectedness:G(),implication:G(),next_probe:G(),confidence:G(),evidence_refs:J(G()).optional()}).passthrough(),kC=Y({arm_id:G(),selected_run_id:G().nullable(),score_countable:q(),metrics:hd(G(),EC),effort:DC,insight:OC.nullable().optional()}),AC=Y({run_id:G(),case_id:G(),arm_id:G(),arm_role:G(),status:G(),protocol_id:G(),runner_revision:G().optional(),observed_at:G(),metrics:hd(G(),EC),countability:Y({integrity_qualified:q(),official_result_present:q(),score_countable:q()}).passthrough(),treatment_fidelity:G(),effort:DC,redacted_insight:OC.nullable().optional(),upload_provenance:Y({producer_id:G(),producer_version:G(),observed_at:G(),source_revision:G()}).passthrough()}).passthrough(),jC=Y({case_denominator:K().int().nonnegative(),value_sum:K().finite(),value_mean:K().finite().nullable(),value_median:K().finite().nullable(),value_min:K().finite().nullable(),value_max:K().finite().nullable(),case_macro_rate:K().finite().optional(),suite_micro_rate:K().finite().optional(),suite_micro_numerator:K().finite().optional(),suite_micro_denominator:K().finite().positive().optional()}).passthrough(),MC=Y({arm_id:G(),arm_role:G(),factor_assignments:hd(G(),G()),protocol_counts:hd(G(),K().int().nonnegative()).default({}),runner_revision_counts:hd(G(),K().int().nonnegative()).default({}),orchestrator_runtime_counts:hd(G(),K().int().nonnegative()).default({}),intended_case_count:K().int().positive(),run_count:K().int().nonnegative(),terminal_run_count:K().int().nonnegative(),selected_score_countable_case_count:K().int().nonnegative(),coverage_rate:K().finite().min(0).max(1),metrics:hd(G(),jC),binary_outcomes:hd(G(),Y({success_count:K().int().nonnegative(),case_denominator:K().int().nonnegative(),success_rate:K().finite().min(0).max(1).nullable()})),effort:hd(G(),Y({denominator:K().int().nonnegative(),mean:K().finite().nullable(),median:K().finite().nullable()})),failure_class_counts:hd(G(),K().int().nonnegative())}).passthrough(),NC=Y({baseline_value:K().finite(),candidate_value:K().finite(),delta:K().finite(),direction:_d([`improved`,`flat`,`regressed`]).optional()}).passthrough(),PC=Y({comparison_id:G(),comparison_anchor_run_id:G(),candidate_run_id:G(),candidate_arm_id:G(),primary_metric:G(),matched_pair_countable:X(!0),metric_deltas:hd(G(),NC)}).passthrough(),FC=Y({ok:X(!0),schema_version:X(`benchmark_study_dashboard_v0`),benchmark_id:G(),study_id:G(),status:_d([`complete`,`provisional`]),design:Y({protocol_id:G(),comparison_protocol_id:G(),baseline_arm_id:G(),case_set:Y({case_set_id:G(),case_ids:J(G())}),metric_catalog:J(Y({metric_name:G(),role:_d([`primary`,`guardrail`,`supporting`]),unit:G().optional(),higher_is_better:q(),binary:q()})),labels:hd(G(),G())}).passthrough(),campaign:Y({intended_case_count:K().int().positive(),intended_arm_count:K().int().positive(),intended_cell_denominator:K().int().positive(),selected_score_countable_cell_count:K().int().nonnegative(),selected_score_countable_coverage_rate:K().finite().min(0).max(1),complete_declared_design_case_count:K().int().nonnegative(),ambiguous_score_countable_cell_count:K().int().nonnegative(),in_flight_run_count:K().int().nonnegative(),matched_pair_countable_count:K().int().nonnegative(),factorial_contrast_count:K().int().nonnegative(),factorial_contrast_countable_count:K().int().nonnegative(),runtime_observation_count:K().int().nonnegative(),runtime_classification_counts:hd(G(),K().int().nonnegative())}),arms:J(MC),contrasts:hd(G(),Y({matched_pair_denominator:K().int().nonnegative(),primary_metric_directions:Y({improved:K().int().nonnegative(),flat:K().int().nonnegative(),regressed:K().int().nonnegative()}),binary_metric_transitions:hd(G(),Y({"0_to_1":K().int().nonnegative(),"1_to_0":K().int().nonnegative(),same:K().int().nonnegative()}))})),cases:J(Y({case_id:G(),complete_declared_design:q(),arms:J(kC),eligible_comparisons:J(PC),largest_eligible_primary_contrast:PC.nullable()})),runs:J(AC),authority:Y({score_source:G(),matched_comparison_source:G(),factorial_comparison_source:G().nullable(),manifest_changes_scores:X(!1),dashboard_is_execution_authority:X(!1)}),public_boundary:Y({raw_task_recorded:X(!1),raw_trajectory_recorded:X(!1),hidden_evaluation_recorded:X(!1),raw_verifier_output_recorded:X(!1),credentials_recorded:X(!1),local_paths_recorded:X(!1)}),write_performed:X(!1),network_access_performed:X(!1)});function IC(e){return FC.parse(e)}function LC(e,t){let n=new URL(t),r=new URL(e||`/benchmark-study.example.json`,n);if(!new Set([`http:`,`https:`]).has(r.protocol))throw Error(`Benchmark dashboard source must use HTTP or HTTPS`);if(r.origin!==n.origin)throw Error(`Benchmark dashboard source must use same-origin local readback`);return r.toString()}var RC=[{id:`campaign`,label:`Campaign`},{id:`arms`,label:`Arms`},{id:`cases`,label:`Cases`},{id:`runs`,label:`Runs`}];function zC(e){return e==null?`—`:`${(e*100).toFixed(e>=.995?0:1)}%`}function BC(e){return e==null?`—`:new Intl.NumberFormat(`en`,{maximumFractionDigits:2,notation:`compact`}).format(e)}function VC(e){if(e==null)return`—`;let t=e/6e4;return t>=120?`${(t/60).toFixed(1)} h`:`${BC(t)} min`}function HC(e){let t=Object.entries(e);return t.length?t.map(([e,t])=>`${e} (${t})`).join(`, `):`—`}function UC(e){if(!e)return`—`;let t=e.total==null?BC(e.value):`${BC(e.value)}/${BC(e.total)}`;return e.unit?`${t} ${e.unit}`:t}function WC(e,t){let n=e.metrics[t];return!n||n.case_denominator===0?`—`:n.suite_micro_rate==null?`${BC(n.value_mean)} mean`:`${zC(n.suite_micro_rate)} · ${BC(n.suite_micro_numerator)}/${BC(n.suite_micro_denominator)}`}function GC(e,t){let n=e.largest_eligible_primary_contrast,r=n?.metric_deltas[t];if(!n||!r)return null;let i=r.delta>0?`+`:``;return{direction:r.direction,text:`${n.candidate_arm_id}: ${i}${BC(r.delta)}`}}function KC({children:e,tone:t=`neutral`}){return(0,H.jsx)(`span`,{className:`benchmark-state benchmark-state-${t}`,children:e})}function qC({packet:e,primaryMetric:t}){return(0,H.jsxs)(`div`,{className:`benchmark-view-stack`,children:[(0,H.jsxs)(`section`,{"aria-labelledby":`arm-summary-title`,children:[(0,H.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`benchmark-kicker`,children:`ARM SUMMARY`}),(0,H.jsx)(`h2`,{id:`arm-summary-title`,children:`Comparable outcomes, denominator first`})]}),(0,H.jsx)(`p`,{children:`Only one score-countable run per declared case × arm cell is selected.`})]}),(0,H.jsx)(`div`,{className:`benchmark-arm-grid`,children:e.arms.map(e=>{let n=Object.values(e.binary_outcomes)[0];return(0,H.jsxs)(`article`,{className:`benchmark-arm-card`,children:[(0,H.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`benchmark-mono`,children:e.arm_role}),(0,H.jsx)(`h3`,{children:e.arm_id})]}),(0,H.jsx)(KC,{tone:e.coverage_rate===1?`success`:`warning`,children:e.coverage_rate===1?`Complete`:`Provisional`})]}),(0,H.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`dt`,{children:[`Primary · `,t]}),(0,H.jsx)(`dd`,{children:WC(e,t)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Score-countable coverage`}),(0,H.jsxs)(`dd`,{children:[e.selected_score_countable_case_count,`/`,e.intended_case_count]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Binary success`}),(0,H.jsx)(`dd`,{children:n?`${n.success_count}/${n.case_denominator}`:`Not declared`})]})]})]},e.arm_id)})})]}),(0,H.jsxs)(`section`,{"aria-labelledby":`contrast-title`,children:[(0,H.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`benchmark-kicker`,children:`MATCHED CONTRASTS`}),(0,H.jsx)(`h2`,{id:`contrast-title`,children:`Direction counts on eligible pairs`})]}),(0,H.jsx)(`p`,{children:`Raw run volume is never used as a comparison denominator.`})]}),(0,H.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Candidate arm`}),(0,H.jsx)(`th`,{children:`Matched denominator`}),(0,H.jsx)(`th`,{children:`Improved`}),(0,H.jsx)(`th`,{children:`Flat`}),(0,H.jsx)(`th`,{children:`Regressed`}),(0,H.jsx)(`th`,{children:`Binary transitions`})]})}),(0,H.jsxs)(`tbody`,{children:[Object.entries(e.contrasts).map(([e,t])=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`strong`,{children:e})}),(0,H.jsx)(`td`,{children:t.matched_pair_denominator}),(0,H.jsx)(`td`,{className:`benchmark-positive`,children:t.primary_metric_directions.improved}),(0,H.jsx)(`td`,{children:t.primary_metric_directions.flat}),(0,H.jsx)(`td`,{className:`benchmark-negative`,children:t.primary_metric_directions.regressed}),(0,H.jsx)(`td`,{children:Object.entries(t.binary_metric_transitions).map(([e,t])=>`${e}: 0→1 ${t[`0_to_1`]}, 1→0 ${t[`1_to_0`]}, same ${t.same}`).join(` · `)||`—`})]},e)),Object.keys(e.contrasts).length===0&&(0,H.jsx)(`tr`,{children:(0,H.jsx)(`td`,{colSpan:6,children:`No matched comparisons are countable yet.`})})]})]})})]}),(0,H.jsxs)(`section`,{"aria-labelledby":`runtime-health-title`,children:[(0,H.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`benchmark-kicker`,children:`RUNTIME HEALTH`}),(0,H.jsx)(`h2`,{id:`runtime-health-title`,children:`Qualified observations, without execution authority`})]}),(0,H.jsxs)(`p`,{children:[e.campaign.runtime_observation_count,` public-safe runtime observations.`]})]}),(0,H.jsxs)(`div`,{className:`benchmark-runtime-list`,children:[Object.entries(e.campaign.runtime_classification_counts).map(([e,t])=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{children:e}),(0,H.jsx)(`strong`,{children:t})]},e)),e.campaign.runtime_observation_count===0&&(0,H.jsx)(`p`,{className:`benchmark-muted`,children:`No runtime observations uploaded.`})]})]})]})}function JC({packet:e}){return(0,H.jsx)(`div`,{className:`benchmark-detail-grid`,children:e.arms.map(t=>(0,H.jsxs)(`article`,{className:`benchmark-detail-card`,children:[(0,H.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`benchmark-mono`,children:t.arm_role}),(0,H.jsx)(`h2`,{children:t.arm_id})]}),(0,H.jsxs)(KC,{tone:t.coverage_rate===1?`success`:`warning`,children:[t.selected_score_countable_case_count,`/`,t.intended_case_count,` countable`]})]}),(0,H.jsx)(`div`,{className:`benchmark-factor-row`,children:Object.entries(t.factor_assignments).map(([e,t])=>(0,H.jsxs)(`span`,{children:[e,`: `,(0,H.jsx)(`strong`,{children:t})]},e))}),(0,H.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[e.design.metric_catalog.map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`dt`,{children:[e.role,` · `,e.metric_name]}),(0,H.jsx)(`dd`,{children:WC(t,e.metric_name)})]},e.metric_name)),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Runs terminal / observed`}),(0,H.jsxs)(`dd`,{children:[t.terminal_run_count,`/`,t.run_count]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Median duration`}),(0,H.jsx)(`dd`,{children:VC(t.effort.duration_ms?.median)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Protocols`}),(0,H.jsx)(`dd`,{children:HC(t.protocol_counts)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Runner revisions`}),(0,H.jsx)(`dd`,{children:HC(t.runner_revision_counts)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Orchestrator runtimes`}),(0,H.jsxs)(`dd`,{children:[Object.keys(t.orchestrator_runtime_counts).length||0,` distinct`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Failure classes`}),(0,H.jsx)(`dd`,{children:HC(t.failure_class_counts)})]})]})]},t.arm_id))})}function YC({packet:e,primaryMetric:t,onOpenRun:n}){return(0,H.jsx)(`div`,{className:`benchmark-table-shell benchmark-wide-table`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Case`}),(0,H.jsx)(`th`,{children:`Design status`}),(0,H.jsx)(`th`,{children:`Largest eligible delta`}),e.arms.map(e=>(0,H.jsx)(`th`,{children:e.arm_id},e.arm_id))]})}),(0,H.jsx)(`tbody`,{children:e.cases.map(r=>{let i=GC(r,t);return(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`strong`,{children:r.case_id})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(KC,{tone:r.complete_declared_design?`success`:`warning`,children:r.complete_declared_design?`Complete`:`Provisional`})}),(0,H.jsx)(`td`,{className:i?.direction===`improved`?`benchmark-positive`:i?.direction===`regressed`?`benchmark-negative`:void 0,children:i?.text??`—`}),r.arms.map(r=>(0,H.jsx)(`td`,{children:r.selected_run_id&&r.score_countable?(0,H.jsxs)(`button`,{className:`benchmark-cell-link`,onClick:()=>n(r.selected_run_id),type:`button`,children:[(0,H.jsxs)(`span`,{children:[t,`: `,UC(r.metrics[t])]}),e.design.metric_catalog.filter(e=>e.metric_name!==t).map(e=>(0,H.jsxs)(`small`,{className:`benchmark-cell-metric`,children:[e.metric_name,`: `,UC(r.metrics[e.metric_name])]},e.metric_name)),(0,H.jsxs)(`small`,{children:[`Countable · `,VC(r.effort.duration_ms),` `,(0,H.jsx)(qp,{"aria-hidden":`true`,size:12})]}),r.insight&&(0,H.jsxs)(`small`,{children:[r.insight.failure_class,` · `,r.insight.confidence]})]}):(0,H.jsx)(`span`,{className:`benchmark-muted`,children:`Not countable`})},r.arm_id))]},r.case_id)})})]})})}function XC({run:e,packet:t}){return(0,H.jsxs)(`aside`,{"aria-label":`Run detail for ${e.run_id}`,className:`benchmark-run-detail`,children:[(0,H.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`benchmark-mono`,children:`RUN DETAIL`}),(0,H.jsx)(`h2`,{children:e.run_id})]}),(0,H.jsx)(KC,{tone:e.countability.score_countable?`success`:`warning`,children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]}),(0,H.jsxs)(`dl`,{className:`benchmark-stat-list benchmark-run-facts`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Case / arm`}),(0,H.jsxs)(`dd`,{children:[e.case_id,` · `,e.arm_id]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Lifecycle`}),(0,H.jsxs)(`dd`,{children:[e.status,` · `,e.observed_at]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Protocol`}),(0,H.jsx)(`dd`,{children:e.protocol_id})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Qualification`}),(0,H.jsxs)(`dd`,{children:[`Integrity `,e.countability.integrity_qualified?`qualified`:`not qualified`,` · result `,e.countability.official_result_present?`present`:`missing`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Treatment fidelity`}),(0,H.jsx)(`dd`,{children:e.treatment_fidelity})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Effort`}),(0,H.jsxs)(`dd`,{children:[VC(e.effort.duration_ms),` · `,BC(e.effort.agent_steps),` steps · `,BC(e.effort.token_count),` tokens`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Runner revision`}),(0,H.jsx)(`dd`,{children:e.runner_revision??`—`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Upload provenance`}),(0,H.jsxs)(`dd`,{children:[e.upload_provenance.producer_id,` · `,e.upload_provenance.source_revision]})]})]}),(0,H.jsx)(`div`,{className:`benchmark-run-metrics`,children:t.design.metric_catalog.map(t=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{children:t.metric_name}),(0,H.jsx)(`strong`,{children:UC(e.metrics[t.metric_name])})]},t.metric_name))}),e.redacted_insight&&(0,H.jsxs)(`div`,{className:`benchmark-insight`,children:[(0,H.jsxs)(`span`,{className:`benchmark-mono`,children:[`REDACTED CASE INSIGHT · `,e.redacted_insight.confidence]}),(0,H.jsx)(`p`,{children:e.redacted_insight.causal_summary}),(0,H.jsxs)(`small`,{children:[`Implication: `,e.redacted_insight.implication]}),(0,H.jsx)(`br`,{}),(0,H.jsxs)(`small`,{children:[`Next probe: `,e.redacted_insight.next_probe]}),!!e.redacted_insight.evidence_refs?.length&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`br`,{}),(0,H.jsxs)(`small`,{children:[`Evidence: `,e.redacted_insight.evidence_refs.join(`, `)]})]})]})]})}function ZC({packet:e,selectedRunId:t,onSelectRun:n}){let r=e.runs.find(e=>e.run_id===t)??e.runs[0];return(0,H.jsxs)(`div`,{className:`benchmark-runs-layout`,children:[(0,H.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Run`}),(0,H.jsx)(`th`,{children:`Case`}),(0,H.jsx)(`th`,{children:`Arm`}),(0,H.jsx)(`th`,{children:`Status`}),(0,H.jsx)(`th`,{children:`Countability`})]})}),(0,H.jsx)(`tbody`,{children:e.runs.map(e=>(0,H.jsxs)(`tr`,{"aria-selected":e.run_id===r?.run_id,children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`button`,{className:`benchmark-run-link`,onClick:()=>n(e.run_id),type:`button`,children:e.run_id})}),(0,H.jsx)(`td`,{children:e.case_id}),(0,H.jsx)(`td`,{children:e.arm_id}),(0,H.jsx)(`td`,{children:e.status}),(0,H.jsx)(`td`,{children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]},e.run_id))})]})}),r&&(0,H.jsx)(XC,{packet:e,run:r})]})}function QC(){let e=pw.useSearch(),t=pw.useNavigate(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(0),c=(0,V.useMemo)(()=>{let t=e.dashboardUrl||`/chat/benchmark-study.example.json`;try{return{url:LC(t,window.location.href),error:null}}catch(e){return{url:``,error:e instanceof Error?e.message:`Invalid dashboard source`}}},[e.dashboardUrl]);if((0,V.useEffect)(()=>{let e=!0;return r(null),a(null),c.error?(a(c.error),()=>{e=!1}):(fetch(c.url,{cache:`no-store`}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status} while loading the dashboard packet`);return IC(await e.json())}).then(t=>{e&&r(t)}).catch(t=>{e&&a(t instanceof Error?t.message:`Unable to load dashboard packet`)}),()=>{e=!1})},[o,c]),(0,V.useEffect)(()=>{n&&(document.title=`${n.design.labels.title??n.study_id} · LoopX Benchmark`)},[n]),i)return(0,H.jsxs)(`main`,{className:`benchmark-page benchmark-loading`,children:[(0,H.jsx)(am,{"aria-hidden":`true`}),(0,H.jsx)(`h1`,{children:`Dashboard packet unavailable`}),(0,H.jsx)(`p`,{children:i}),(0,H.jsxs)(`button`,{onClick:()=>s(e=>e+1),type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":`true`,size:16}),` Retry readback`]})]});if(!n)return(0,H.jsxs)(`main`,{"aria-busy":`true`,className:`benchmark-page benchmark-loading`,children:[(0,H.jsx)(Wp,{"aria-hidden":`true`}),(0,H.jsx)(`h1`,{children:`Reading benchmark study`}),(0,H.jsx)(`p`,{children:`Validating the public-safe dashboard packet…`})]});let l=n.design.metric_catalog.find(e=>e.role===`primary`)?.metric_name??`primary`,u=(n,r=e.runId)=>t({search:e=>({...e,view:n,runId:r})}),d=new URL(c.url).pathname;return(0,H.jsxs)(`main`,{className:`benchmark-page`,children:[(0,H.jsxs)(`header`,{className:`benchmark-hero`,children:[(0,H.jsxs)(`div`,{className:`benchmark-hero-topline`,children:[(0,H.jsx)(`a`,{className:`benchmark-wordmark`,href:`/chat/`,children:`LoopX`}),(0,H.jsxs)(`div`,{className:`benchmark-readonly`,children:[(0,H.jsx)(Gm,{"aria-hidden":`true`,size:15}),` Derived read-only projection`]})]}),(0,H.jsxs)(`div`,{className:`benchmark-hero-grid`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`p`,{className:`benchmark-kicker`,children:[`BENCHMARK STUDY / `,n.benchmark_id]}),(0,H.jsxs)(`div`,{className:`benchmark-title-row`,children:[(0,H.jsx)(`h1`,{children:n.design.labels.title??n.study_id}),(0,H.jsx)(KC,{tone:n.status===`complete`?`success`:`warning`,children:n.status})]}),(0,H.jsx)(`p`,{className:`benchmark-lead`,children:`One declared study, explicit denominators, and the same countability rules from campaign summary to exact run.`})]}),(0,H.jsxs)(`dl`,{className:`benchmark-identity`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Study`}),(0,H.jsx)(`dd`,{children:n.study_id})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Protocol`}),(0,H.jsx)(`dd`,{children:n.design.protocol_id})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Case set`}),(0,H.jsx)(`dd`,{children:n.design.case_set.case_set_id})]})]})]}),(0,H.jsxs)(`div`,{className:`benchmark-kpi-grid`,children:[(0,H.jsxs)(`article`,{children:[(0,H.jsx)(um,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Score-countable cells`}),(0,H.jsxs)(`strong`,{children:[n.campaign.selected_score_countable_cell_count,(0,H.jsxs)(`small`,{children:[` / `,n.campaign.intended_cell_denominator]})]}),(0,H.jsxs)(`p`,{children:[zC(n.campaign.selected_score_countable_coverage_rate),` declared coverage`]})]}),(0,H.jsxs)(`article`,{children:[(0,H.jsx)(om,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Complete designs`}),(0,H.jsxs)(`strong`,{children:[n.campaign.complete_declared_design_case_count,(0,H.jsxs)(`small`,{children:[` / `,n.campaign.intended_case_count]})]}),(0,H.jsx)(`p`,{children:`Cases with every declared arm`})]}),(0,H.jsxs)(`article`,{children:[(0,H.jsx)(qp,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Matched comparisons`}),(0,H.jsx)(`strong`,{children:n.campaign.matched_pair_countable_count}),(0,H.jsx)(`p`,{children:`Eligible pairs only`})]}),(0,H.jsxs)(`article`,{children:[(0,H.jsx)(Wp,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`In flight`}),(0,H.jsx)(`strong`,{children:n.campaign.in_flight_run_count}),(0,H.jsx)(`p`,{children:n.status===`provisional`?`Coverage remains provisional`:`Declared coverage complete`})]})]})]}),(0,H.jsxs)(`nav`,{"aria-label":`Benchmark dashboard views`,className:`benchmark-tabs`,children:[RC.map(t=>(0,H.jsx)(`button`,{"aria-current":e.view===t.id?`page`:void 0,onClick:()=>u(t.id),type:`button`,children:t.label},t.id)),(0,H.jsxs)(`button`,{className:`benchmark-refresh`,onClick:()=>s(e=>e+1),type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":`true`,size:14}),` Refresh local readback`]})]}),(0,H.jsxs)(`div`,{className:`benchmark-content`,children:[e.view===`campaign`&&(0,H.jsx)(qC,{packet:n,primaryMetric:l}),e.view===`arms`&&(0,H.jsx)(JC,{packet:n}),e.view===`cases`&&(0,H.jsx)(YC,{onOpenRun:e=>u(`runs`,e),packet:n,primaryMetric:l}),e.view===`runs`&&(0,H.jsx)(ZC,{onSelectRun:e=>u(`runs`,e),packet:n,selectedRunId:e.runId})]}),(0,H.jsxs)(`footer`,{className:`benchmark-footer`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Gm,{"aria-hidden":`true`,size:16}),(0,H.jsxs)(`span`,{children:[`Scores: `,n.authority.score_source]}),(0,H.jsx)(`span`,{children:`Dashboard cannot launch, grade, or mutate runs.`})]}),(0,H.jsxs)(`code`,{title:d,children:[`local`,d]})]})]})}var $C=Y({goalId:G().optional().default(``),statusUrl:G().optional().default(``)}),ew=Y({goalId:G().optional().default(``),mode:_d([`showcase`,`developer`,`ops`]).optional().default(`showcase`),statusUrl:G().optional().default(``),todoLane:_d([`all`,`user`,`agent`]).optional().default(`all`),todoQuery:G().optional().default(``)}),tw=ew.omit({mode:!0}),nw=Y({dashboardUrl:G().optional().default(``),view:_d([`campaign`,`arms`,`cases`,`runs`]).optional().default(`campaign`),runId:G().optional().default(``)});function rw(){let e=`https://huangruiteng.github.io/loopx/docs/showcases/index.en.html`;return(0,V.useEffect)(()=>{window.location.replace(e)},[]),(0,H.jsx)(`a`,{href:e,children:`Open LoopX cases / 浏览案例`})}function iw({goalId:e,statusUrl:t}){let n=t?ih(t,window.location.href):null;return n?.error?(0,H.jsx)(`main`,{role:`alert`,children:n.error}):(0,H.jsx)(ri,{replace:!0,to:`/`,search:{goalId:e,statusUrl:t}})}function aw(){let e=lw.useSearch();return e.mode===`ops`?(0,H.jsx)(iw,{...e}):e.mode===`developer`?(0,H.jsx)(ri,{replace:!0,to:`/developers/projections`}):(0,H.jsx)(rw,{})}function ow(){return(0,H.jsx)(iw,{...uw.useSearch()})}var sw=Si({component:()=>(0,H.jsx)(ji,{}),errorComponent:()=>(0,H.jsxs)(`main`,{role:`alert`,className:`p-8`,children:[(0,H.jsx)(`h1`,{children:`页面暂时无法显示 / Page unavailable`}),(0,H.jsx)(`p`,{children:`请重新加载页面;这不会执行任务。 / Reloading does not execute tasks.`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`重新加载 / Reload`})]})}),cw=bi({getParentRoute:()=>sw,path:`/`,validateSearch:e=>$C.parse(e),component:dC}),lw=bi({getParentRoute:()=>sw,path:`/frontstage`,validateSearch:e=>ew.parse(e),component:aw}),uw=bi({getParentRoute:()=>sw,path:`/deprecated/frontstage/ops`,validateSearch:e=>tw.parse(e),component:ow}),dw=bi({getParentRoute:()=>sw,path:`/frontstage/developer`,component:()=>(0,H.jsx)(ri,{replace:!0,to:`/developers/projections`})}),fw=bi({getParentRoute:()=>sw,path:`/developers/projections`,component:TC}),pw=bi({getParentRoute:()=>sw,path:`/benchmarks/study`,validateSearch:e=>nw.parse(e),component:QC}),mw=sw.addChildren([cw,lw,uw,dw,fw,pw]);function hw(e){return!e||e===`/`||e===`./`?`/`:(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``)||`/`}var gw=Ii({routeTree:mw,basepath:hw(`/chat/`),trailingSlash:`preserve`}),_w=document.getElementById(`root`);if(!_w)throw Error(`Root element not found`);var vw=new Oe({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}});(0,Bi.createRoot)(_w).render((0,H.jsx)(Me,{client:vw,children:(0,H.jsx)(Ki,{children:(0,H.jsx)(zi,{router:gw})})})); \ No newline at end of file +`),summary:D.summary,title:D.title}}]:[]],Qe=f.connectionState===`connected`,$e=new Map(w.goals.map(e=>[e.goalId,e.title])),et=e=>Wd(e,f.activeSource.statusUrl,Qe&&!l?.errors[e.goalId],$e.get(e.goalId)),tt={...vy(w),userTodos:w.userTodos.map(et),attentionHistory:(w.attentionHistory??w.userTodos).map(et),periodicReports:{error:k,loading:te},timeline:Ze};return(0,H.jsxs)(`div`,{className:p===`dark`?`dark`:``,"data-testid":`personal-goal-home`,children:[ye?(0,H.jsx)(`p`,{role:`status`,className:`m-0 bg-amber-50 px-4 py-2 text-sm text-amber-900`,children:_(ye===`partial`?`runs.discoveryPartial`:`runs.discoveryOffline`)}):null,(0,H.jsx)(qx,{agents:P.map(e=>({adapterKind:e.adapterKind,agentId:e.agentId,available:e.available,capability:e.capability,interrupt:e.interrupt,label:e.label,location:e.location,resume:e.resume,source:e.source,streaming:e.streaming,toolCalls:e.toolCalls,trustScope:e.trustScope,workspaceCompatibility:e.available?`当前 Goal 写入前验证`:`不可用,需先修复 Endpoint`})),callbacks:{onApplyAttention:e=>Xe(e.goalId),onCorrectRun:async(e,t)=>{if(!e.sessionId)throw Error(`这个 Run 还没有可纠偏的执行 Session。`);let n=await Ph((await jh({actionKind:`run.correct`,context:{kind:`run`,goal_id:e.goalId,todo_id:e.todoId},idempotencyKey:`workspace-run-correct-${e.sessionId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,message:t,session_id:e.sessionId},summary:`纠偏执行任务:${e.title}`})).proposal_id),r=typeof n.turn?.turn_id==`string`?n.turn.turn_id:void 0;if(Be(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:r?`running`:`ready`,turnId:r}),r){Ee.current.set(e.goalId,r);let t=new AbortController;De.current.set(e.goalId,t);let n=``,i=Ve(e.goalId,{activity:[`正在把纠偏送入原执行 Session`],agentLabel:e.agentLabel,lines:[],pending:!0,sourceLabel:`${e.agentLabel} · 执行 Session`,text:``});try{let a=await Zh(e.sessionId,r,{signal:t.signal,onDelta:t=>{n+=t,He(e.goalId,i,{text:n})}});He(e.goalId,i,{activity:[],pending:!1,text:PS(a.response.message||n.trim())||`${e.agentLabel} 已完成纠偏。`})}catch(t){let n=Oe.current.delete(e.goalId);He(e.goalId,i,{activity:[],pending:!1,text:n?`已中断。你可以在当前会话继续发送消息。`:t instanceof Error?t.message:`纠偏回合失败。`})}finally{Ee.current.delete(e.goalId),De.current.delete(e.goalId),Be(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:`ready`})}}},onCloseRunSession:qe,onInterruptRun:async e=>We(e),onOpenGoal:Xe,onOpenRunSession:async e=>{if(!e.sessionId)return;let t=e.sessionId,n=await Vh(t);Se(e=>({...e,[t]:n})),Xe(e.goalId),z(t=>({...t,[e.goalId]:n.messages.map(t=>({agentLabel:t.role===`user`?void 0:e.agentLabel,attachments:kS(t.attachments),id:Ce.current++,lines:[],role:t.role===`user`?`user`:`assistant`,sourceLabel:t.role===`user`?void 0:`${e.agentLabel} · 执行 Session`,text:t.role===`user`?t.text:PS(t.text)}))})),Be(e.goalId,{agentId:e.agentId,resumable:n.session.resumable,sessionId:t,status:n.session.active_turn_id?`running`:n.session.status,turnId:n.session.active_turn_id??void 0})},onOpenOutput:e=>Xe(e.goalId),...b?{onPreviewGoalSubagentConfiguration:async e=>{let t=await ng(e);return{changed:t.changed,configuration:{allowedDomains:t.after.orchestration.allowed_domains,enabled:t.feature_summary.multi_subagent===`enabled`,maxChildren:t.after.orchestration.max_children,modelConfig:t.after.orchestration.model_config},previewId:t.preview_id}},onApplyGoalSubagentConfiguration:async({previewId:e,...t})=>{let n=await rg(t,e);return{allowedDomains:n.after.orchestration.allowed_domains,enabled:n.feature_summary.multi_subagent===`enabled`,maxChildren:n.after.orchestration.max_children,modelConfig:n.after.orchestration.model_config}}}:{},...g?{onExecuteGoalLifecycle:async({goalId:e,operation:t,reason:n})=>{let r=await Cb(g,e,t,n);return{activationState:r.activation_state,projectionVerified:r.projection_verified}}}:{},onGoalActivationStateChange:n,onGoalDeleted:r,onReconcileStatus:a,onRetryGoalArchive:s,onExportOutput:async e=>{let t=[`# ${e.title}`,``,e.summary??``,``,e.safePreview??`此产出没有可用的公开安全预览。`,``,`Goal: ${e.goalId}`,`Todo: ${e.todoId??`unlinked`}`,`Run: ${e.runId??`unlinked`}`].join(` +`),n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),r=document.createElement(`a`);r.href=n,r.download=`${e.outputId.replace(/[^a-z0-9._-]+/gi,`-`)}.md`,r.click(),URL.revokeObjectURL(n)},onRefresh:o,onRetryResumeRun:Ge,onSelectAgent:Je,onSelectGoal:e=>e?Xe(e):Ye(),onSendMessage:async(e,t,n,r)=>Ue(e,{agentId:t,goalId:n,attachments:r}),onStartNewRunSession:Ke},goalArchiveLoadState:e,managerRuntime:S,model:tt,readOnly:h,selectedAgentId:I.agentId,selectedGoalId:T?.goalId??null,statusSourceControl:f})]})}function dC({error:e,isLoading:t,onRetry:n,requestedUrl:r,theme:i,toggleTheme:a}){let o=!!(e&&/failed to fetch|networkerror|load failed/i.test(e)&&r.includes(`status.json`));return(0,H.jsx)(`div`,{className:i===`dark`?`dark`:``,children:(0,H.jsxs)(`main`,{className:`min-h-screen bg-[#f6f7f9] text-slate-950 dark:bg-[#09090b] dark:text-zinc-50`,children:[(0,H.jsxs)(`header`,{className:`flex min-h-16 flex-wrap items-center justify-between gap-3 border-b border-slate-200 bg-white px-4 py-3 dark:border-zinc-800 dark:bg-zinc-950 sm:px-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold`,children:`LoopX Workspace`}),(0,H.jsx)(`p`,{className:`mt-1 break-all text-sm text-slate-500 dark:text-zinc-400`,children:`Personal Workspace`})]}),(0,H.jsx)(iy,{"aria-label":`切换主题`,onClick:a,size:`icon`,variant:`secondary`,children:i===`dark`?(0,H.jsx)(Ym,{className:`h-4 w-4`}):(0,H.jsx)(Am,{className:`h-4 w-4`})})]}),(0,H.jsxs)(`div`,{className:`grid min-h-[calc(100vh-80px)] sm:grid-cols-[240px_1fr]`,children:[(0,H.jsxs)(`aside`,{className:`hidden border-r border-slate-200 p-6 dark:border-zinc-800 sm:block`,"aria-label":`Workspace`,children:[(0,H.jsx)(`strong`,{children:`LoopX`}),(0,H.jsx)(`p`,{className:`mt-6 text-sm`,children:`Workspace`}),(0,H.jsx)(`p`,{className:`mt-8 text-xs text-slate-500`,children:`Goals`}),[1,2,3].map(e=>(0,H.jsx)(`div`,{className:`mt-4 h-8 rounded bg-slate-100 dark:bg-zinc-900`},e))]}),(0,H.jsx)(`div`,{className:`p-4 sm:p-8`,children:(0,H.jsx)(ay,{"data-testid":`initial-status-state`,children:(0,H.jsx)(oy,{className:`flex min-h-64 items-center justify-center p-6`,children:(0,H.jsxs)(`div`,{className:`max-w-xl text-center`,children:[e?(0,H.jsx)(am,{className:`mx-auto h-6 w-6 text-rose-600 dark:text-rose-300`}):(0,H.jsx)(Lm,{className:`mx-auto h-6 w-6 animate-spin text-slate-500 dark:text-zinc-400`}),(0,H.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e?`无法加载实时状态`:`正在加载实时状态`}),e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`mt-2 break-words text-sm leading-6 text-slate-500 dark:text-zinc-400`,children:o?`本地状态服务暂时未连接。升级或启动期间可能短暂断开,请重试;仍失败时重新打开 LoopX App,或运行 loopx doctor。`:e}),o?(0,H.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-slate-400 dark:text-zinc-500`,children:`重新加载不会执行任务,也不会改变 Goal 配置。`}):null,(0,H.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:(0,H.jsxs)(iy,{disabled:t,onClick:n,children:[(0,H.jsx)(Lm,{className:`h-4 w-4`}),`重试`]})})]}):(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-500 dark:text-zinc-400`,role:`status`,children:`正在连接 Workspace,Goal 列表将先出现,详细状态会逐个补齐。 / Connecting to your Workspace. Goals load independently.`})]})})})})]})]})})}function fC(){let e=lw.useSearch(),t=lw.useNavigate(),[n,r]=(0,V.useState)(`light`),[i,a]=(0,V.useState)(null),o=(0,V.useRef)(null),s=(0,V.useRef)(e.goalId);s.current=e.goalId;let[c,l]=(0,V.useState)(Op),[u,d]=(0,V.useState)({kind:`example`,label:`bundled example`}),[f,p]=(0,V.useState)(()=>oS(window.localStorage,window.location.href)),m=(0,V.useRef)(f);m.current=f;let[h,g]=(0,V.useState)(e.statusUrl),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)({error:null,phase:`idle`}),[C,w]=(0,V.useState)(e.statusUrl.trim()||null),[T,E]=(0,V.useState)(!1),D=(0,V.useRef)(null),O=(0,V.useRef)(Zg(e.statusUrl.trim()||null)),k=!T&&u.kind===`example`?e.statusUrl.trim():``,ee=C??k,te=u.kind===`url`?u.label:gS,A=!!(_&&C),j=pS(f,C,te,window.location.href),M=u.kind===`example`&&!T,N=c.attention_queue,P=c.run_history,F=(0,V.useMemo)(()=>yS(P.goals,N.items),[P.goals,N.items]);function ne(e,t,n=0){S({error:null,phase:`loading`}),_S(oh(e,`stopped`,window.location.href)).then(r=>{if(!t_(O.current,t))return;let i=r.goal_projection?.registry_revision??null,a=t.registryRevision!==null&&t.registryRevision!==void 0&&i!==null&&t.registryRevision!==i;if(l(e=>w_(e,r)),a&&n<1){L(e,{background:!0,resyncAttempt:n+1});return}S(a?{error:`Goal 状态在加载历史时发生变化,请重试。`,phase:`error`}:{error:null,phase:`ready`})}).catch(e=>{t_(O.current,t)&&S({error:Dp(e),phase:`error`})})}function re(){let e=u.kind===`url`?u.label:h||gS,t=$g(O.current,e,{background:!0});if(i){L(e);return}t&&ne(e,t)}async function I(e,n,r){if(r.background)return l(e=>w_(e,n)),!0;let i={kind:`url`,label:e};return O.current.loadedUrl=e,l(n),d(i),g(e),await t({search:t=>({...t,statusUrl:e})}),e_(O.current,r)?(O.current.requestedUrl=null,w(null),!0):!1}async function L(e,t={}){let n=e.trim(),r=t.background===!0;if(!n){r||v(`状态地址不能为空`);return}let c=$g(O.current,n,{background:r,selectionRevision:t.selectionRevision});if(!c)return;o.current?.abort();let d=new AbortController;o.current=d,r||(D.current=null,E(!1),w(n),b(!0),v(null),S({error:null,phase:`idle`}));try{let e=await jp(n,window.location.href).catch(()=>null);if(!t_(O.current,c))return;if(e){let o=t.retryOnly&&u.kind===`url`&&u.label===n&&i?.directory.registry_revision===e.registry_revision?i.snapshots:{};a({directory:e,snapshots:o,errors:{}});let f={...e,goals:e.goals.filter(e=>!o[e.id])},p=!1,m=Mp(e);if(r)l(m);else if(!await I(n,m,c))return;if(S({error:null,phase:`loading`}),await Pp(n,window.location.href,f,(e,t,n)=>{n===`revision`&&(p=!0),a(r=>r&&{...r,snapshots:t?{...r.snapshots,[e]:t}:r.snapshots,errors:n?{...r.errors,[e]:n}:r.errors})},()=>t_(O.current,c),()=>s.current,d.signal),p&&(t.resyncAttempt??0)<1&&t_(O.current,c)){await L(n,{resyncAttempt:1});return}t_(O.current,c)&&S({error:null,phase:`ready`});return}let o=await _S(oh(n,`active`,window.location.href));if(!t_(O.current,c)||(a(null),c.registryRevision=o.goal_projection?.registry_revision??null,!await I(n,o,c)))return;if(o.goal_projection?.scope!==`active`||o.goal_projection.complete){S({error:null,phase:`ready`});return}ne(n,c,t.resyncAttempt??0)}catch(e){if(!e_(O.current,c))return;r||v(Dp(e))}finally{!r&&e_(O.current,c)&&b(!1)}}function ie(e,t={}){o.current?.abort();let n=Qg(O.current,e.statusUrl);D.current=null,E(!1),w(e.statusUrl),b(!0),v(null),(async()=>{if(t.ensureTunnel&&e.kind===`ssh_tunnel`){let t=new URL(e.statusUrl,window.location.href).port;if(t)try{await Sb(e.label,t)}catch{}}O.current.selectionRevision===n&&await L(e.statusUrl,{selectionRevision:n})})()}function R(e){m.current=e,p(e);try{sS(window.localStorage,e)}catch{}}let ae={activeSource:j,connectionState:y?`loading`:A?`error`:`connected`,errorMessage:A?`未切换到 ${C??`所选来源`}:${_}`:null,onAdd:e=>{let t=lS(f,e,window.location.href);return`error`in t?{error:t.error}:(R(t.catalog),ie(t.source,{ensureTunnel:e.ensureTunnel}),{})},onConfiguredHostsLoaded:e=>{let t=m.current,n=cS(t,e);n!==t&&R(n)},onRemove:e=>{R(uS(f,e)),j.id===e&&ie(tS)},onSelect:e=>{let t=f.sources.find(t=>t.id===e);t&&ie(t,{ensureTunnel:t.kind===`ssh_tunnel`})},sources:j.id===`temporary`?[...f.sources,j]:f.sources};(0,V.useEffect)(()=>{let t=e.statusUrl.trim();if(t){if(D.current===t||C&&C!==t)return;(u.kind!==`url`||u.label!==t)&&L(t);return}D.current=null,!T&&(C||u.kind===`example`&&L(gS))},[T,C,e.statusUrl,u.kind,u.label]),(0,V.useEffect)(()=>{if(e.statusUrl&&u.kind===`example`)return;let n=new Set(F.map(e=>e.goal.id));if(F.length===0){e.goalId&&t({search:e=>({...e,goalId:``})});return}e.goalId&&!n.has(e.goalId)&&x.phase!==`loading`&&t({search:e=>({...e,goalId:``})})},[x.phase,F,t,e.goalId,e.statusUrl,u.kind]),(0,V.useEffect)(()=>{if(!i||y||!e.goalId||u.kind!==`url`)return;let t=i.directory.goals.find(t=>t.id===e.goalId);t?.activation_state===`stopped`&&!i.snapshots[t.id]&&!i.errors[t.id]&&L(u.label,{retryOnly:!0})},[e.goalId,y,i,u]);function oe(e){t({search:t=>({...t,goalId:e})})}return M?(0,H.jsx)(dC,{error:_,isLoading:y,onRetry:()=>void L(ee||gS),requestedUrl:ee||gS,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)}):(0,H.jsx)(uC,{goalArchiveLoadState:x,isLoading:y,onGoalActivationStateChange:(e,t)=>{O.current.projectionRevision+=1,l(n=>wp(n,e,t)),a(n=>n&&{...n,snapshots:Object.fromEntries(Object.entries(n.snapshots).map(([n,r])=>[n,wp(r,e,t)]))})},onGoalDeleted:e=>{O.current.projectionRevision+=1,l(t=>Tp(t,e)),a(t=>t&&{...t,snapshots:Object.fromEntries(Object.entries(t.snapshots).filter(([t])=>t!==e))})},onSelectGoal:oe,onReconcileStatus:()=>L(u.kind===`url`?u.label:h||gS,{background:!0}),onRetryGoalArchive:re,onRefresh:()=>L(u.kind===`url`?u.label:h||gS,{retryOnly:!!(i&&Object.keys(i.errors).length)}),payload:c,progress:i,rows:F,selectedGoalId:e.goalId,statusSourceControl:ae,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)})}var pC=k_(`inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium`,{variants:{variant:{neutral:`border-slate-200 bg-white text-slate-700 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-300`,success:`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-200`,warning:`border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200`,info:`border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-900 dark:bg-sky-950 dark:text-sky-200`,danger:`border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-900 dark:bg-rose-950 dark:text-rose-200`}},defaultVariants:{variant:`neutral`}});function mC({className:e,variant:t,...n}){return(0,H.jsx)(`span`,{className:ny(pC({variant:t}),e),...n})}var hC=[{label:`status payload`,source:`apps/presentation/dashboard/src/data/status.ts`,detail:`status_contract, attention_queue, local_dashboard_api, run_history`},{label:`channel projection`,source:`apps/presentation/dashboard/src/data/goal-channel-frontstage.ts`,detail:`decision_frame, todos, gates, leases, artifacts, truth_contract`},{label:`public showcase catalog`,source:`docs/showcases/showcase-catalog.json`,detail:`case metadata, visual hints, evidence boundaries, story beats`},{label:`route smoke`,source:`apps/presentation/dashboard/smoke/frontstage-route-smoke.ts`,detail:`static route contract, source guards, component expectations`}],gC=[{axis:`schema`,current:`goal_channel_projection_v0`,proposed:`new optional projection field`,gate:`parser default plus route smoke assertion`},{axis:`truth`,current:`event ledger and active state remain source of truth`,proposed:`derived UI state only`,gate:`truth_contract must stay read-only`},{axis:`privacy`,current:`compact source refs and warnings`,proposed:`public-safe fixture field`,gate:`loopx check and browser fake-private fixture`},{axis:`interaction`,current:`render, filter, select, inspect`,proposed:`no browser write by default`,gate:`write affordance requires explicit loopback capability`}],_C=[{title:`Fixture sources`,body:`Use examples/status.example.json, browser-smoke fixtures, and docs/showcases/showcase-catalog.json.`},{title:`Required proof`,body:`Every projection addition needs parser coverage, route smoke assertions, and one browser or bundle check when UI output changes.`},{title:`Never include`,body:`Raw task text, trajectories, transcripts, local paths, private registry state, credentials, or internal document links.`}],vC=[`npm --prefix apps/presentation/dashboard run smoke:frontstage-route`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-browser`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-share-bundle`,`npm --prefix apps/presentation/dashboard run build`,`loopx check --scan-path apps/presentation/dashboard --scan-path docs/status-data-contract.md`],yC=[{name:`Projection lane`,badges:[`read-only`,`schema v0`],body:`Summarizes one compact projection lane without mutating the underlying LoopX state.`},{name:`Capability badge`,badges:[`loopback`,`dry-run`],body:`Shows an advertised local capability only after the status feed declares it.`},{name:`Boundary warning`,badges:[`public-safe`,`omitted`],body:`Names omitted private material and points contributors back to compact source references.`}];function bC({children:e,icon:t,title:n}){return(0,H.jsxs)(`section`,{className:`rounded-lg border border-slate-200 bg-white shadow-sm`,children:[(0,H.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,H.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,H.jsx)(t,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function xC(){return(0,H.jsx)(bC,{icon:$p,title:`Status Contract Explorer`,children:(0,H.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,"data-testid":`developer-contract-explorer`,children:hC.map(e=>(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(mC,{variant:`info`,children:e.label}),(0,H.jsx)(mC,{variant:`neutral`,children:`public contract`})]}),(0,H.jsx)(`div`,{className:`mt-2 break-words font-mono text-xs text-slate-700`,children:e.source}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.detail})]},e.label))})})}function SC(){return(0,H.jsx)(bC,{icon:ym,title:`Projection Diffing`,children:(0,H.jsx)(`div`,{className:`overflow-x-auto`,"data-testid":`developer-projection-diffing`,children:(0,H.jsxs)(`table`,{className:`min-w-full border-separate border-spacing-0 text-left text-sm`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{className:`bg-slate-50 text-xs uppercase tracking-normal text-slate-500`,children:[(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Axis`}),(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Current`}),(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Proposed`}),(0,H.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Gate`})]})}),(0,H.jsx)(`tbody`,{children:gC.map(e=>(0,H.jsxs)(`tr`,{className:`align-top`,children:[(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 font-semibold text-slate-950`,children:e.axis}),(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.current}),(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.proposed}),(0,H.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.gate})]},e.axis))})]})})})}function CC(){return(0,H.jsx)(bC,{icon:hm,title:`Fixture Generation`,children:(0,H.jsx)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-fixture-generation`,children:_C.map(e=>(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:e.title}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.title))})})}function wC(){return(0,H.jsx)(bC,{icon:sm,title:`Smoke Checklist`,children:(0,H.jsx)(`div`,{className:`space-y-2 p-4`,"data-testid":`developer-smoke-checklist`,children:vC.map(e=>(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,H.jsx)(Xp,{className:`mt-0.5 h-4 w-4 shrink-0 text-emerald-600`}),(0,H.jsx)(`code`,{className:`break-all text-xs font-semibold leading-5 text-slate-700`,children:e})]},e))})})}function TC(){return(0,H.jsx)(bC,{icon:cm,title:`Component Examples`,children:(0,H.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-3`,"data-testid":`developer-component-examples`,children:yC.map(e=>(0,H.jsxs)(`article`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.badges.map(e=>(0,H.jsx)(mC,{variant:e===`read-only`||e===`public-safe`?`success`:`neutral`,children:e},e))}),(0,H.jsx)(`h3`,{className:`mt-3 text-sm font-semibold leading-6 text-slate-950`,children:e.name}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.name))})})}function EC(){return(0,H.jsx)(`main`,{className:`min-h-screen bg-[#f7f7f4] px-4 py-4 text-slate-950 sm:px-5`,"data-testid":`frontstage-developer-cockpit`,children:(0,H.jsxs)(`div`,{className:`mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,H.jsxs)(`aside`,{className:`rounded-lg border border-slate-200 bg-white p-4 shadow-sm xl:sticky xl:top-4 xl:self-start`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md border border-slate-200 bg-slate-950 text-white`,children:(0,H.jsx)(Xm,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:`Developer Cockpit`}),(0,H.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Projection extension`})]})]}),(0,H.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,H.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://huangruiteng.github.io/loopx/`,children:[(0,H.jsx)(Sm,{className:`h-4 w-4`}),`LoopX home`]}),(0,H.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://huangruiteng.github.io/loopx/docs/showcases/index.en.html`,children:[(0,H.jsx)(pm,{className:`h-4 w-4`}),`Public cases`]}),(0,H.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md bg-slate-950 px-3 py-2 text-sm font-medium text-white`,href:`/chat/developers/projections/`,children:[(0,H.jsx)(cm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,H.jsxs)(`div`,{className:`mt-5 space-y-2 rounded-md border border-emerald-200 bg-emerald-50 p-3 text-xs leading-5 text-emerald-950`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(mC,{variant:`success`,children:`read-only`}),(0,H.jsx)(mC,{variant:`neutral`,children:`public fixtures`})]}),(0,H.jsx)(`p`,{children:`This route uses static public contracts only; live status feeds, registry files, and browser write APIs stay outside the cockpit.`})]})]}),(0,H.jsxs)(`section`,{className:`space-y-4`,children:[(0,H.jsx)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(mC,{variant:`info`,children:`developers/projections`}),(0,H.jsx)(mC,{variant:`success`,children:`public-safe`}),(0,H.jsx)(mC,{variant:`neutral`,children:`no browser writes`})]}),(0,H.jsx)(`h1`,{className:`mt-3 text-3xl font-semibold tracking-normal text-slate-950`,children:`LoopX Projection Developer Cockpit`}),(0,H.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-slate-600`,children:`A read-only contributor workbench for adding dashboard/frontstage projections without reverse-engineering the large operator page.`})]}),(0,H.jsxs)(`div`,{className:`grid min-w-[260px] gap-2 text-sm`,children:[(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Source of truth`}),(0,H.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`status contract + compact fixtures`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Boundary`}),(0,H.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`read-only extension surface`})]})]})]})}),(0,H.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,H.jsx)(xC,{}),(0,H.jsx)(SC,{})]}),(0,H.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,H.jsx)(CC,{}),(0,H.jsx)(wC,{})]}),(0,H.jsx)(TC,{}),(0,H.jsx)(bC,{icon:Gm,title:`Extension Boundary`,children:(0,H.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-extension-boundary`,children:[(0,H.jsxs)(`div`,{className:`rounded-md border border-emerald-200 bg-emerald-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Allowed`}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Versioned parser defaults, public fixtures, read-only route panels, and focused smoke assertions.`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Review`}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`New dashboard dependencies, status contract fields, loopback capability display, and browser-visible workflows.`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-rose-200 bg-rose-50 px-3 py-3`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Stop`}),(0,H.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Credentials, private registry material, raw logs, transcripts, production actions, or default browser write authority.`})]})]})})]})]})})}var DC=Y({value:K().finite(),total:K().finite().positive().optional(),unit:G().optional(),higher_is_better:q()}).passthrough(),OC=hd(G(),K().finite()).default({}),kC=Y({outcome_status:G().optional(),failure_class:G(),causal_summary:G(),expectedness:G(),implication:G(),next_probe:G(),confidence:G(),evidence_refs:J(G()).optional()}).passthrough(),AC=Y({arm_id:G(),selected_run_id:G().nullable(),score_countable:q(),metrics:hd(G(),DC),effort:OC,insight:kC.nullable().optional()}),jC=Y({run_id:G(),case_id:G(),arm_id:G(),arm_role:G(),status:G(),protocol_id:G(),runner_revision:G().optional(),observed_at:G(),metrics:hd(G(),DC),countability:Y({integrity_qualified:q(),official_result_present:q(),score_countable:q()}).passthrough(),treatment_fidelity:G(),effort:OC,redacted_insight:kC.nullable().optional(),upload_provenance:Y({producer_id:G(),producer_version:G(),observed_at:G(),source_revision:G()}).passthrough()}).passthrough(),MC=Y({case_denominator:K().int().nonnegative(),value_sum:K().finite(),value_mean:K().finite().nullable(),value_median:K().finite().nullable(),value_min:K().finite().nullable(),value_max:K().finite().nullable(),case_macro_rate:K().finite().optional(),suite_micro_rate:K().finite().optional(),suite_micro_numerator:K().finite().optional(),suite_micro_denominator:K().finite().positive().optional()}).passthrough(),NC=Y({arm_id:G(),arm_role:G(),factor_assignments:hd(G(),G()),protocol_counts:hd(G(),K().int().nonnegative()).default({}),runner_revision_counts:hd(G(),K().int().nonnegative()).default({}),orchestrator_runtime_counts:hd(G(),K().int().nonnegative()).default({}),intended_case_count:K().int().positive(),run_count:K().int().nonnegative(),terminal_run_count:K().int().nonnegative(),selected_score_countable_case_count:K().int().nonnegative(),coverage_rate:K().finite().min(0).max(1),metrics:hd(G(),MC),binary_outcomes:hd(G(),Y({success_count:K().int().nonnegative(),case_denominator:K().int().nonnegative(),success_rate:K().finite().min(0).max(1).nullable()})),effort:hd(G(),Y({denominator:K().int().nonnegative(),mean:K().finite().nullable(),median:K().finite().nullable()})),failure_class_counts:hd(G(),K().int().nonnegative())}).passthrough(),PC=Y({baseline_value:K().finite(),candidate_value:K().finite(),delta:K().finite(),direction:_d([`improved`,`flat`,`regressed`]).optional()}).passthrough(),FC=Y({comparison_id:G(),comparison_anchor_run_id:G(),candidate_run_id:G(),candidate_arm_id:G(),primary_metric:G(),matched_pair_countable:X(!0),metric_deltas:hd(G(),PC)}).passthrough(),IC=Y({ok:X(!0),schema_version:X(`benchmark_study_dashboard_v0`),benchmark_id:G(),study_id:G(),status:_d([`complete`,`provisional`]),design:Y({protocol_id:G(),comparison_protocol_id:G(),baseline_arm_id:G(),case_set:Y({case_set_id:G(),case_ids:J(G())}),metric_catalog:J(Y({metric_name:G(),role:_d([`primary`,`guardrail`,`supporting`]),unit:G().optional(),higher_is_better:q(),binary:q()})),labels:hd(G(),G())}).passthrough(),campaign:Y({intended_case_count:K().int().positive(),intended_arm_count:K().int().positive(),intended_cell_denominator:K().int().positive(),selected_score_countable_cell_count:K().int().nonnegative(),selected_score_countable_coverage_rate:K().finite().min(0).max(1),complete_declared_design_case_count:K().int().nonnegative(),ambiguous_score_countable_cell_count:K().int().nonnegative(),in_flight_run_count:K().int().nonnegative(),matched_pair_countable_count:K().int().nonnegative(),factorial_contrast_count:K().int().nonnegative(),factorial_contrast_countable_count:K().int().nonnegative(),runtime_observation_count:K().int().nonnegative(),runtime_classification_counts:hd(G(),K().int().nonnegative())}),arms:J(NC),contrasts:hd(G(),Y({matched_pair_denominator:K().int().nonnegative(),primary_metric_directions:Y({improved:K().int().nonnegative(),flat:K().int().nonnegative(),regressed:K().int().nonnegative()}),binary_metric_transitions:hd(G(),Y({"0_to_1":K().int().nonnegative(),"1_to_0":K().int().nonnegative(),same:K().int().nonnegative()}))})),cases:J(Y({case_id:G(),complete_declared_design:q(),arms:J(AC),eligible_comparisons:J(FC),largest_eligible_primary_contrast:FC.nullable()})),runs:J(jC),authority:Y({score_source:G(),matched_comparison_source:G(),factorial_comparison_source:G().nullable(),manifest_changes_scores:X(!1),dashboard_is_execution_authority:X(!1)}),public_boundary:Y({raw_task_recorded:X(!1),raw_trajectory_recorded:X(!1),hidden_evaluation_recorded:X(!1),raw_verifier_output_recorded:X(!1),credentials_recorded:X(!1),local_paths_recorded:X(!1)}),write_performed:X(!1),network_access_performed:X(!1)});function LC(e){return IC.parse(e)}function RC(e,t){let n=new URL(t),r=new URL(e||`/benchmark-study.example.json`,n);if(!new Set([`http:`,`https:`]).has(r.protocol))throw Error(`Benchmark dashboard source must use HTTP or HTTPS`);if(r.origin!==n.origin)throw Error(`Benchmark dashboard source must use same-origin local readback`);return r.toString()}var zC=[{id:`campaign`,label:`Campaign`},{id:`arms`,label:`Arms`},{id:`cases`,label:`Cases`},{id:`runs`,label:`Runs`}];function BC(e){return e==null?`—`:`${(e*100).toFixed(e>=.995?0:1)}%`}function VC(e){return e==null?`—`:new Intl.NumberFormat(`en`,{maximumFractionDigits:2,notation:`compact`}).format(e)}function HC(e){if(e==null)return`—`;let t=e/6e4;return t>=120?`${(t/60).toFixed(1)} h`:`${VC(t)} min`}function UC(e){let t=Object.entries(e);return t.length?t.map(([e,t])=>`${e} (${t})`).join(`, `):`—`}function WC(e){if(!e)return`—`;let t=e.total==null?VC(e.value):`${VC(e.value)}/${VC(e.total)}`;return e.unit?`${t} ${e.unit}`:t}function GC(e,t){let n=e.metrics[t];return!n||n.case_denominator===0?`—`:n.suite_micro_rate==null?`${VC(n.value_mean)} mean`:`${BC(n.suite_micro_rate)} · ${VC(n.suite_micro_numerator)}/${VC(n.suite_micro_denominator)}`}function KC(e,t){let n=e.largest_eligible_primary_contrast,r=n?.metric_deltas[t];if(!n||!r)return null;let i=r.delta>0?`+`:``;return{direction:r.direction,text:`${n.candidate_arm_id}: ${i}${VC(r.delta)}`}}function qC({children:e,tone:t=`neutral`}){return(0,H.jsx)(`span`,{className:`benchmark-state benchmark-state-${t}`,children:e})}function JC({packet:e,primaryMetric:t}){return(0,H.jsxs)(`div`,{className:`benchmark-view-stack`,children:[(0,H.jsxs)(`section`,{"aria-labelledby":`arm-summary-title`,children:[(0,H.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`benchmark-kicker`,children:`ARM SUMMARY`}),(0,H.jsx)(`h2`,{id:`arm-summary-title`,children:`Comparable outcomes, denominator first`})]}),(0,H.jsx)(`p`,{children:`Only one score-countable run per declared case × arm cell is selected.`})]}),(0,H.jsx)(`div`,{className:`benchmark-arm-grid`,children:e.arms.map(e=>{let n=Object.values(e.binary_outcomes)[0];return(0,H.jsxs)(`article`,{className:`benchmark-arm-card`,children:[(0,H.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`benchmark-mono`,children:e.arm_role}),(0,H.jsx)(`h3`,{children:e.arm_id})]}),(0,H.jsx)(qC,{tone:e.coverage_rate===1?`success`:`warning`,children:e.coverage_rate===1?`Complete`:`Provisional`})]}),(0,H.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`dt`,{children:[`Primary · `,t]}),(0,H.jsx)(`dd`,{children:GC(e,t)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Score-countable coverage`}),(0,H.jsxs)(`dd`,{children:[e.selected_score_countable_case_count,`/`,e.intended_case_count]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Binary success`}),(0,H.jsx)(`dd`,{children:n?`${n.success_count}/${n.case_denominator}`:`Not declared`})]})]})]},e.arm_id)})})]}),(0,H.jsxs)(`section`,{"aria-labelledby":`contrast-title`,children:[(0,H.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`benchmark-kicker`,children:`MATCHED CONTRASTS`}),(0,H.jsx)(`h2`,{id:`contrast-title`,children:`Direction counts on eligible pairs`})]}),(0,H.jsx)(`p`,{children:`Raw run volume is never used as a comparison denominator.`})]}),(0,H.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Candidate arm`}),(0,H.jsx)(`th`,{children:`Matched denominator`}),(0,H.jsx)(`th`,{children:`Improved`}),(0,H.jsx)(`th`,{children:`Flat`}),(0,H.jsx)(`th`,{children:`Regressed`}),(0,H.jsx)(`th`,{children:`Binary transitions`})]})}),(0,H.jsxs)(`tbody`,{children:[Object.entries(e.contrasts).map(([e,t])=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`strong`,{children:e})}),(0,H.jsx)(`td`,{children:t.matched_pair_denominator}),(0,H.jsx)(`td`,{className:`benchmark-positive`,children:t.primary_metric_directions.improved}),(0,H.jsx)(`td`,{children:t.primary_metric_directions.flat}),(0,H.jsx)(`td`,{className:`benchmark-negative`,children:t.primary_metric_directions.regressed}),(0,H.jsx)(`td`,{children:Object.entries(t.binary_metric_transitions).map(([e,t])=>`${e}: 0→1 ${t[`0_to_1`]}, 1→0 ${t[`1_to_0`]}, same ${t.same}`).join(` · `)||`—`})]},e)),Object.keys(e.contrasts).length===0&&(0,H.jsx)(`tr`,{children:(0,H.jsx)(`td`,{colSpan:6,children:`No matched comparisons are countable yet.`})})]})]})})]}),(0,H.jsxs)(`section`,{"aria-labelledby":`runtime-health-title`,children:[(0,H.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`benchmark-kicker`,children:`RUNTIME HEALTH`}),(0,H.jsx)(`h2`,{id:`runtime-health-title`,children:`Qualified observations, without execution authority`})]}),(0,H.jsxs)(`p`,{children:[e.campaign.runtime_observation_count,` public-safe runtime observations.`]})]}),(0,H.jsxs)(`div`,{className:`benchmark-runtime-list`,children:[Object.entries(e.campaign.runtime_classification_counts).map(([e,t])=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{children:e}),(0,H.jsx)(`strong`,{children:t})]},e)),e.campaign.runtime_observation_count===0&&(0,H.jsx)(`p`,{className:`benchmark-muted`,children:`No runtime observations uploaded.`})]})]})]})}function YC({packet:e}){return(0,H.jsx)(`div`,{className:`benchmark-detail-grid`,children:e.arms.map(t=>(0,H.jsxs)(`article`,{className:`benchmark-detail-card`,children:[(0,H.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`benchmark-mono`,children:t.arm_role}),(0,H.jsx)(`h2`,{children:t.arm_id})]}),(0,H.jsxs)(qC,{tone:t.coverage_rate===1?`success`:`warning`,children:[t.selected_score_countable_case_count,`/`,t.intended_case_count,` countable`]})]}),(0,H.jsx)(`div`,{className:`benchmark-factor-row`,children:Object.entries(t.factor_assignments).map(([e,t])=>(0,H.jsxs)(`span`,{children:[e,`: `,(0,H.jsx)(`strong`,{children:t})]},e))}),(0,H.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[e.design.metric_catalog.map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`dt`,{children:[e.role,` · `,e.metric_name]}),(0,H.jsx)(`dd`,{children:GC(t,e.metric_name)})]},e.metric_name)),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Runs terminal / observed`}),(0,H.jsxs)(`dd`,{children:[t.terminal_run_count,`/`,t.run_count]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Median duration`}),(0,H.jsx)(`dd`,{children:HC(t.effort.duration_ms?.median)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Protocols`}),(0,H.jsx)(`dd`,{children:UC(t.protocol_counts)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Runner revisions`}),(0,H.jsx)(`dd`,{children:UC(t.runner_revision_counts)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Orchestrator runtimes`}),(0,H.jsxs)(`dd`,{children:[Object.keys(t.orchestrator_runtime_counts).length||0,` distinct`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Failure classes`}),(0,H.jsx)(`dd`,{children:UC(t.failure_class_counts)})]})]})]},t.arm_id))})}function XC({packet:e,primaryMetric:t,onOpenRun:n}){return(0,H.jsx)(`div`,{className:`benchmark-table-shell benchmark-wide-table`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Case`}),(0,H.jsx)(`th`,{children:`Design status`}),(0,H.jsx)(`th`,{children:`Largest eligible delta`}),e.arms.map(e=>(0,H.jsx)(`th`,{children:e.arm_id},e.arm_id))]})}),(0,H.jsx)(`tbody`,{children:e.cases.map(r=>{let i=KC(r,t);return(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`strong`,{children:r.case_id})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(qC,{tone:r.complete_declared_design?`success`:`warning`,children:r.complete_declared_design?`Complete`:`Provisional`})}),(0,H.jsx)(`td`,{className:i?.direction===`improved`?`benchmark-positive`:i?.direction===`regressed`?`benchmark-negative`:void 0,children:i?.text??`—`}),r.arms.map(r=>(0,H.jsx)(`td`,{children:r.selected_run_id&&r.score_countable?(0,H.jsxs)(`button`,{className:`benchmark-cell-link`,onClick:()=>n(r.selected_run_id),type:`button`,children:[(0,H.jsxs)(`span`,{children:[t,`: `,WC(r.metrics[t])]}),e.design.metric_catalog.filter(e=>e.metric_name!==t).map(e=>(0,H.jsxs)(`small`,{className:`benchmark-cell-metric`,children:[e.metric_name,`: `,WC(r.metrics[e.metric_name])]},e.metric_name)),(0,H.jsxs)(`small`,{children:[`Countable · `,HC(r.effort.duration_ms),` `,(0,H.jsx)(qp,{"aria-hidden":`true`,size:12})]}),r.insight&&(0,H.jsxs)(`small`,{children:[r.insight.failure_class,` · `,r.insight.confidence]})]}):(0,H.jsx)(`span`,{className:`benchmark-muted`,children:`Not countable`})},r.arm_id))]},r.case_id)})})]})})}function ZC({run:e,packet:t}){return(0,H.jsxs)(`aside`,{"aria-label":`Run detail for ${e.run_id}`,className:`benchmark-run-detail`,children:[(0,H.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`benchmark-mono`,children:`RUN DETAIL`}),(0,H.jsx)(`h2`,{children:e.run_id})]}),(0,H.jsx)(qC,{tone:e.countability.score_countable?`success`:`warning`,children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]}),(0,H.jsxs)(`dl`,{className:`benchmark-stat-list benchmark-run-facts`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Case / arm`}),(0,H.jsxs)(`dd`,{children:[e.case_id,` · `,e.arm_id]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Lifecycle`}),(0,H.jsxs)(`dd`,{children:[e.status,` · `,e.observed_at]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Protocol`}),(0,H.jsx)(`dd`,{children:e.protocol_id})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Qualification`}),(0,H.jsxs)(`dd`,{children:[`Integrity `,e.countability.integrity_qualified?`qualified`:`not qualified`,` · result `,e.countability.official_result_present?`present`:`missing`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Treatment fidelity`}),(0,H.jsx)(`dd`,{children:e.treatment_fidelity})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Effort`}),(0,H.jsxs)(`dd`,{children:[HC(e.effort.duration_ms),` · `,VC(e.effort.agent_steps),` steps · `,VC(e.effort.token_count),` tokens`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Runner revision`}),(0,H.jsx)(`dd`,{children:e.runner_revision??`—`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Upload provenance`}),(0,H.jsxs)(`dd`,{children:[e.upload_provenance.producer_id,` · `,e.upload_provenance.source_revision]})]})]}),(0,H.jsx)(`div`,{className:`benchmark-run-metrics`,children:t.design.metric_catalog.map(t=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{children:t.metric_name}),(0,H.jsx)(`strong`,{children:WC(e.metrics[t.metric_name])})]},t.metric_name))}),e.redacted_insight&&(0,H.jsxs)(`div`,{className:`benchmark-insight`,children:[(0,H.jsxs)(`span`,{className:`benchmark-mono`,children:[`REDACTED CASE INSIGHT · `,e.redacted_insight.confidence]}),(0,H.jsx)(`p`,{children:e.redacted_insight.causal_summary}),(0,H.jsxs)(`small`,{children:[`Implication: `,e.redacted_insight.implication]}),(0,H.jsx)(`br`,{}),(0,H.jsxs)(`small`,{children:[`Next probe: `,e.redacted_insight.next_probe]}),!!e.redacted_insight.evidence_refs?.length&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`br`,{}),(0,H.jsxs)(`small`,{children:[`Evidence: `,e.redacted_insight.evidence_refs.join(`, `)]})]})]})]})}function QC({packet:e,selectedRunId:t,onSelectRun:n}){let r=e.runs.find(e=>e.run_id===t)??e.runs[0];return(0,H.jsxs)(`div`,{className:`benchmark-runs-layout`,children:[(0,H.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,H.jsxs)(`table`,{children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Run`}),(0,H.jsx)(`th`,{children:`Case`}),(0,H.jsx)(`th`,{children:`Arm`}),(0,H.jsx)(`th`,{children:`Status`}),(0,H.jsx)(`th`,{children:`Countability`})]})}),(0,H.jsx)(`tbody`,{children:e.runs.map(e=>(0,H.jsxs)(`tr`,{"aria-selected":e.run_id===r?.run_id,children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`button`,{className:`benchmark-run-link`,onClick:()=>n(e.run_id),type:`button`,children:e.run_id})}),(0,H.jsx)(`td`,{children:e.case_id}),(0,H.jsx)(`td`,{children:e.arm_id}),(0,H.jsx)(`td`,{children:e.status}),(0,H.jsx)(`td`,{children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]},e.run_id))})]})}),r&&(0,H.jsx)(ZC,{packet:e,run:r})]})}function $C(){let e=mw.useSearch(),t=mw.useNavigate(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(0),c=(0,V.useMemo)(()=>{let t=e.dashboardUrl||`/chat/benchmark-study.example.json`;try{return{url:RC(t,window.location.href),error:null}}catch(e){return{url:``,error:e instanceof Error?e.message:`Invalid dashboard source`}}},[e.dashboardUrl]);if((0,V.useEffect)(()=>{let e=!0;return r(null),a(null),c.error?(a(c.error),()=>{e=!1}):(fetch(c.url,{cache:`no-store`}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status} while loading the dashboard packet`);return LC(await e.json())}).then(t=>{e&&r(t)}).catch(t=>{e&&a(t instanceof Error?t.message:`Unable to load dashboard packet`)}),()=>{e=!1})},[o,c]),(0,V.useEffect)(()=>{n&&(document.title=`${n.design.labels.title??n.study_id} · LoopX Benchmark`)},[n]),i)return(0,H.jsxs)(`main`,{className:`benchmark-page benchmark-loading`,children:[(0,H.jsx)(am,{"aria-hidden":`true`}),(0,H.jsx)(`h1`,{children:`Dashboard packet unavailable`}),(0,H.jsx)(`p`,{children:i}),(0,H.jsxs)(`button`,{onClick:()=>s(e=>e+1),type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":`true`,size:16}),` Retry readback`]})]});if(!n)return(0,H.jsxs)(`main`,{"aria-busy":`true`,className:`benchmark-page benchmark-loading`,children:[(0,H.jsx)(Wp,{"aria-hidden":`true`}),(0,H.jsx)(`h1`,{children:`Reading benchmark study`}),(0,H.jsx)(`p`,{children:`Validating the public-safe dashboard packet…`})]});let l=n.design.metric_catalog.find(e=>e.role===`primary`)?.metric_name??`primary`,u=(n,r=e.runId)=>t({search:e=>({...e,view:n,runId:r})}),d=new URL(c.url).pathname;return(0,H.jsxs)(`main`,{className:`benchmark-page`,children:[(0,H.jsxs)(`header`,{className:`benchmark-hero`,children:[(0,H.jsxs)(`div`,{className:`benchmark-hero-topline`,children:[(0,H.jsx)(`a`,{className:`benchmark-wordmark`,href:`/chat/`,children:`LoopX`}),(0,H.jsxs)(`div`,{className:`benchmark-readonly`,children:[(0,H.jsx)(Gm,{"aria-hidden":`true`,size:15}),` Derived read-only projection`]})]}),(0,H.jsxs)(`div`,{className:`benchmark-hero-grid`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`p`,{className:`benchmark-kicker`,children:[`BENCHMARK STUDY / `,n.benchmark_id]}),(0,H.jsxs)(`div`,{className:`benchmark-title-row`,children:[(0,H.jsx)(`h1`,{children:n.design.labels.title??n.study_id}),(0,H.jsx)(qC,{tone:n.status===`complete`?`success`:`warning`,children:n.status})]}),(0,H.jsx)(`p`,{className:`benchmark-lead`,children:`One declared study, explicit denominators, and the same countability rules from campaign summary to exact run.`})]}),(0,H.jsxs)(`dl`,{className:`benchmark-identity`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Study`}),(0,H.jsx)(`dd`,{children:n.study_id})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Protocol`}),(0,H.jsx)(`dd`,{children:n.design.protocol_id})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Case set`}),(0,H.jsx)(`dd`,{children:n.design.case_set.case_set_id})]})]})]}),(0,H.jsxs)(`div`,{className:`benchmark-kpi-grid`,children:[(0,H.jsxs)(`article`,{children:[(0,H.jsx)(um,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Score-countable cells`}),(0,H.jsxs)(`strong`,{children:[n.campaign.selected_score_countable_cell_count,(0,H.jsxs)(`small`,{children:[` / `,n.campaign.intended_cell_denominator]})]}),(0,H.jsxs)(`p`,{children:[BC(n.campaign.selected_score_countable_coverage_rate),` declared coverage`]})]}),(0,H.jsxs)(`article`,{children:[(0,H.jsx)(om,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Complete designs`}),(0,H.jsxs)(`strong`,{children:[n.campaign.complete_declared_design_case_count,(0,H.jsxs)(`small`,{children:[` / `,n.campaign.intended_case_count]})]}),(0,H.jsx)(`p`,{children:`Cases with every declared arm`})]}),(0,H.jsxs)(`article`,{children:[(0,H.jsx)(qp,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`Matched comparisons`}),(0,H.jsx)(`strong`,{children:n.campaign.matched_pair_countable_count}),(0,H.jsx)(`p`,{children:`Eligible pairs only`})]}),(0,H.jsxs)(`article`,{children:[(0,H.jsx)(Wp,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:`In flight`}),(0,H.jsx)(`strong`,{children:n.campaign.in_flight_run_count}),(0,H.jsx)(`p`,{children:n.status===`provisional`?`Coverage remains provisional`:`Declared coverage complete`})]})]})]}),(0,H.jsxs)(`nav`,{"aria-label":`Benchmark dashboard views`,className:`benchmark-tabs`,children:[zC.map(t=>(0,H.jsx)(`button`,{"aria-current":e.view===t.id?`page`:void 0,onClick:()=>u(t.id),type:`button`,children:t.label},t.id)),(0,H.jsxs)(`button`,{className:`benchmark-refresh`,onClick:()=>s(e=>e+1),type:`button`,children:[(0,H.jsx)(Lm,{"aria-hidden":`true`,size:14}),` Refresh local readback`]})]}),(0,H.jsxs)(`div`,{className:`benchmark-content`,children:[e.view===`campaign`&&(0,H.jsx)(JC,{packet:n,primaryMetric:l}),e.view===`arms`&&(0,H.jsx)(YC,{packet:n}),e.view===`cases`&&(0,H.jsx)(XC,{onOpenRun:e=>u(`runs`,e),packet:n,primaryMetric:l}),e.view===`runs`&&(0,H.jsx)(QC,{onSelectRun:e=>u(`runs`,e),packet:n,selectedRunId:e.runId})]}),(0,H.jsxs)(`footer`,{className:`benchmark-footer`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Gm,{"aria-hidden":`true`,size:16}),(0,H.jsxs)(`span`,{children:[`Scores: `,n.authority.score_source]}),(0,H.jsx)(`span`,{children:`Dashboard cannot launch, grade, or mutate runs.`})]}),(0,H.jsxs)(`code`,{title:d,children:[`local`,d]})]})]})}var ew=Y({goalId:G().optional().default(``),statusUrl:G().optional().default(``)}),tw=Y({goalId:G().optional().default(``),mode:_d([`showcase`,`developer`,`ops`]).optional().default(`showcase`),statusUrl:G().optional().default(``),todoLane:_d([`all`,`user`,`agent`]).optional().default(`all`),todoQuery:G().optional().default(``)}),nw=tw.omit({mode:!0}),rw=Y({dashboardUrl:G().optional().default(``),view:_d([`campaign`,`arms`,`cases`,`runs`]).optional().default(`campaign`),runId:G().optional().default(``)});function iw(){let e=`https://huangruiteng.github.io/loopx/docs/showcases/index.en.html`;return(0,V.useEffect)(()=>{window.location.replace(e)},[]),(0,H.jsx)(`a`,{href:e,children:`Open LoopX cases / 浏览案例`})}function aw({goalId:e,statusUrl:t}){let n=t?ih(t,window.location.href):null;return n?.error?(0,H.jsx)(`main`,{role:`alert`,children:n.error}):(0,H.jsx)(ri,{replace:!0,to:`/`,search:{goalId:e,statusUrl:t}})}function ow(){let e=uw.useSearch();return e.mode===`ops`?(0,H.jsx)(aw,{...e}):e.mode===`developer`?(0,H.jsx)(ri,{replace:!0,to:`/developers/projections`}):(0,H.jsx)(iw,{})}function sw(){return(0,H.jsx)(aw,{...dw.useSearch()})}var cw=Si({component:()=>(0,H.jsx)(ji,{}),errorComponent:()=>(0,H.jsxs)(`main`,{role:`alert`,className:`p-8`,children:[(0,H.jsx)(`h1`,{children:`页面暂时无法显示 / Page unavailable`}),(0,H.jsx)(`p`,{children:`请重新加载页面;这不会执行任务。 / Reloading does not execute tasks.`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`重新加载 / Reload`})]})}),lw=bi({getParentRoute:()=>cw,path:`/`,validateSearch:e=>ew.parse(e),component:fC}),uw=bi({getParentRoute:()=>cw,path:`/frontstage`,validateSearch:e=>tw.parse(e),component:ow}),dw=bi({getParentRoute:()=>cw,path:`/deprecated/frontstage/ops`,validateSearch:e=>nw.parse(e),component:sw}),fw=bi({getParentRoute:()=>cw,path:`/frontstage/developer`,component:()=>(0,H.jsx)(ri,{replace:!0,to:`/developers/projections`})}),pw=bi({getParentRoute:()=>cw,path:`/developers/projections`,component:EC}),mw=bi({getParentRoute:()=>cw,path:`/benchmarks/study`,validateSearch:e=>rw.parse(e),component:$C}),hw=cw.addChildren([lw,uw,dw,fw,pw,mw]);function gw(e){return!e||e===`/`||e===`./`?`/`:(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``)||`/`}var _w=Ii({routeTree:hw,basepath:gw(`/chat/`),trailingSlash:`preserve`}),vw=document.getElementById(`root`);if(!vw)throw Error(`Root element not found`);var yw=new Oe({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}});(0,Bi.createRoot)(vw).render((0,H.jsx)(Me,{client:yw,children:(0,H.jsx)(Ki,{children:(0,H.jsx)(zi,{router:_w})})})); \ No newline at end of file diff --git a/loopx/web/chat/index.html b/loopx/web/chat/index.html index 928a503111..e0d7b2c74e 100644 --- a/loopx/web/chat/index.html +++ b/loopx/web/chat/index.html @@ -18,7 +18,7 @@ content="LoopX 个人 Agent 工作区:在同一个频道里查看、纠偏并推进 Goal。" /> LoopX 个人 Agent 工作区 - + diff --git a/tests/extensions/test_lark_inbox_reactions.py b/tests/extensions/test_lark_inbox_reactions.py index fef5be6f01..1d448fee0f 100644 --- a/tests/extensions/test_lark_inbox_reactions.py +++ b/tests/extensions/test_lark_inbox_reactions.py @@ -1002,6 +1002,31 @@ def test_read_only_recovery_rejects_changed_intent_without_provider_call( assert runner.calls == [] +def test_reply_fails_closed_after_send_when_locator_persistence_fails( + tmp_path: Path, +) -> None: + config, _, project = _fixture(tmp_path, lifecycle=False) + runner = ReplyRunner() + + result = reply_lark_event_inbox( + project=project, + config_path=config, + message_id="om_reaction_fixture", + text="处理完成", + execute=True, + runner=runner, + delivery_attempt_recorder=lambda _attempt: (_ for _ in ()).throw( + OSError("synthetic private persistence failure") + ), + ) + + assert result["external_write_performed"] is True + assert result["reply_verified"] is False + assert result["blocker"] == "lark_inbox_reply_delivery_attempt_not_persisted" + assert sum("+messages-reply" in call and "--dry-run" not in call for call in runner.calls) == 1 + assert not any("+messages-mget" in call for call in runner.calls) + + def test_verified_reply_accepts_provider_token_or_rendered_mention_name( tmp_path: Path, ) -> None: diff --git a/tests/test_manager_context_roundtrip.py b/tests/test_manager_context_roundtrip.py index eeae64a877..9b46b83c66 100644 --- a/tests/test_manager_context_roundtrip.py +++ b/tests/test_manager_context_roundtrip.py @@ -521,6 +521,23 @@ def verify(self, *_args): assert transport.verify_calls == 0 +def test_public_delivery_projection_normalizes_unknown_private_state(flow): + root, _, _, create = flow + _, _, receipt = create(True) + rid = receipt["request_id"] + acknowledge(root, "research", "worker", rid, "adopt", "Checked") + report(root, "research", "worker", rid, "conclusion", "Bounded result.") + _write( + _root(root) / "replies" / rid / "conclusion.delivery.json", + {"status": "verification_required", "error": "private provider detail"}, + ) + + state = reply_status(root, receipt)[0] + assert state["status"] == "explicit_unverified" + assert state["error"] == "delivery_state_unreadable" + assert "private" not in str(state) + + def test_background_service_delivers_without_another_agent_or_query(flow): root, registry, store, create = flow _, _, receipt = create(True) From a883609c13826143e1d159c5a11f810171f14c49 Mon Sep 17 00:00:00 2001 From: Lihua <1017343802@qq.com> Date: Mon, 14 Sep 2026 00:40:01 -0700 Subject: [PATCH 5/9] refactor(chat): keep return projection in its owner Signed-off-by: Lihua <1017343802@qq.com> --- loopx/capabilities/manager_context/roundtrip.py | 10 ++++++++++ loopx/chat_server.py | 16 ++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/loopx/capabilities/manager_context/roundtrip.py b/loopx/capabilities/manager_context/roundtrip.py index 699be60d27..76b568eaad 100644 --- a/loopx/capabilities/manager_context/roundtrip.py +++ b/loopx/capabilities/manager_context/roundtrip.py @@ -260,6 +260,16 @@ def project_chat_return_deliveries(root, session_id, messages): ] +def project_chat_session_snapshot(root, store, session_id): + """Project return delivery state into one existing Chat snapshot.""" + + snapshot = store.session_snapshot(session_id) + snapshot["messages"] = project_chat_return_deliveries( + root, session_id, snapshot["messages"] + ) + return snapshot + + def drain(root, registry, store, external_sender, *, now=None, cancelled=lambda: False): """Restart-safe return delivery; transport retries never rerun the worker/model.""" now = now or datetime.now(timezone.utc) diff --git a/loopx/chat_server.py b/loopx/chat_server.py index 57f2ce7f78..28b6dc4c77 100644 --- a/loopx/chat_server.py +++ b/loopx/chat_server.py @@ -37,6 +37,7 @@ from .chat_ssh_source_api import SshSourceRequestMixin from .chat_store import ChatSessionStore from .capabilities.manager_runtime import manager_runtime_capability_projection +from .capabilities.manager_context.roundtrip import project_chat_session_snapshot from .control_plane.status.ssh_host_catalog import ( SSH_HOST_CATALOG_PATH, ssh_host_catalog_payload, @@ -64,9 +65,7 @@ from .extensions.lark.goal_topic_connections import list_lark_apps from .extensions.lark.goal_topic_runtime import LarkGoalTopicRuntimeService from .extensions.lark.manager_routing import authorized_manager_goal_ids -from .extensions.lark.presentation.kanban import ( - CommandRunner, -) +from .extensions.lark.presentation.kanban import CommandRunner from .extensions.runtime import ( default_extension_state_file, resolve_extension_activation, @@ -758,15 +757,8 @@ def _session_turn(self, session_id: str) -> None: def _session_snapshot(self, session_id: str) -> None: try: - snapshot = self.server.chat_store.session_snapshot(session_id) - from .capabilities.manager_context.roundtrip import ( - project_chat_return_deliveries, - ) - - snapshot["messages"] = project_chat_return_deliveries( - self.server.runtime_root, session_id, snapshot["messages"] - ) - self._send_json(snapshot) + self._send_json(project_chat_session_snapshot( + self.server.runtime_root, self.server.chat_store, session_id)) except KeyError: self._send_error("chat session was not found", status=404) From 544915263e43d248ca50db9a77b1067b838ec68f Mon Sep 17 00:00:00 2001 From: Lihua <1017343802@qq.com> Date: Mon, 14 Sep 2026 00:52:47 -0700 Subject: [PATCH 6/9] refactor(manager): type return verification rules Signed-off-by: Lihua <1017343802@qq.com> --- loopx/capabilities/manager_context/README.md | 5 +- .../capabilities/manager_context/roundtrip.py | 66 ++++------- .../collaboration/return_delivery.ts | 103 ++++++++++++++++++ .../control_plane/effect_runtime_handlers.ts | 12 ++ .../manager_return_delivery.test.ts | 65 +++++++++++ 5 files changed, 203 insertions(+), 48 deletions(-) create mode 100644 loopx/control_plane/collaboration/return_delivery.ts create mode 100644 tests/control_plane_ts/manager_return_delivery.test.ts diff --git a/loopx/capabilities/manager_context/README.md b/loopx/capabilities/manager_context/README.md index 73fe555a1a..b028bc3011 100644 --- a/loopx/capabilities/manager_context/README.md +++ b/loopx/capabilities/manager_context/README.md @@ -176,7 +176,10 @@ read-only verification. A matching message advances the original delivery to message, or verified mismatch becomes `explicit_unverified`. CLI, Manager read, and Chat expose the same public-safe state and reason without returning the provider locator. The Lark adapter keeps locator interpretation and provider -readback; `manager-context` remains the sole result/delivery writer. +readback; `manager-context` remains the sole result/delivery writer. The typed +`control_plane/collaboration/return_delivery.ts` boundary owns provider-neutral +attempt validation and verification classification; Python retains file-lock, +persistence and adapter orchestration only. New handoffs persist their exact original return route. Legacy requests remain queryable; a receiver can explicitly report one only when its exact persisted diff --git a/loopx/capabilities/manager_context/roundtrip.py b/loopx/capabilities/manager_context/roundtrip.py index 76b568eaad..979e31eecf 100644 --- a/loopx/capabilities/manager_context/roundtrip.py +++ b/loopx/capabilities/manager_context/roundtrip.py @@ -15,6 +15,7 @@ from .tracking import _entry, _now, _receipt from ...file_lock import exclusive_file_lock from ...presentation.public_safety import scan_public_boundary_text +from ...control_plane.effect_runtime import effect_runtime_result PHASES = ("decision", "conclusion") DELIVERY_STATUSES = { @@ -39,43 +40,20 @@ "original_route_or_return_delivery_unavailable", "delivery_state_unreadable", } -DELIVERY_ATTEMPT_SCHEMA = "manager_return_delivery_attempt_v0" -_PROVIDER = re.compile(r"[a-z][a-z0-9_-]{0,31}") -_OPAQUE_REF = re.compile(r"[A-Za-z0-9][A-Za-z0-9._:-]{0,511}") -_DIGEST = re.compile(r"sha256:[0-9a-f]{64}") +def _delivery_attempt(value): + return dict( + effect_runtime_result( + "manager.return_delivery.normalize_attempt", {"attempt": value} + ) + ) -def _delivery_attempt(value): - if not isinstance(value, dict) or set(value) != { - "schema_version", - "provider", - "message_ref", - "intent_digest", - "provider_receipt", - }: - raise ValueError("invalid manager return delivery attempt") - if value.get("schema_version") != DELIVERY_ATTEMPT_SCHEMA: - raise ValueError("invalid manager return delivery attempt") - if not _PROVIDER.fullmatch(str(value.get("provider") or "")): - raise ValueError("invalid manager return delivery attempt") - if not _OPAQUE_REF.fullmatch(str(value.get("message_ref") or "")): - raise ValueError("invalid manager return delivery attempt") - if not _DIGEST.fullmatch(str(value.get("intent_digest") or "")): - raise ValueError("invalid manager return delivery attempt") - if not _DIGEST.fullmatch(str(value.get("provider_receipt") or "")): - raise ValueError("invalid manager return delivery attempt") - return dict(value) - - -def _verification_error(outcome): - blocker = str(outcome.get("blocker") or "") - if blocker in { - "provider_delivery_intent_conflict", - "provider_message_missing", - "provider_verification_unavailable", - }: - return blocker - return "provider_delivery_mismatch" +def _verification_decision(outcome): + return dict( + effect_runtime_result( + "manager.return_delivery.classify_verification", {"outcome": outcome} + ) + ) def _verification_exception_error(exc): @@ -375,11 +353,8 @@ def drain(root, registry, store, external_sender, *, now=None, cancelled=lambda: ) continue verified = verifier(route, session, turn, text, attempt) - if ( - isinstance(verified, dict) - and verified.get("verification_performed") is True - and verified.get("reply_verified") is True - ): + decision = _verification_decision(verified) + if decision["status"] == "delivered": _write( state_path, { @@ -388,19 +363,16 @@ def drain(root, registry, store, external_sender, *, now=None, cancelled=lambda: "message_id": mid, "provider_receipt": attempt["provider_receipt"], "reply_verified": True, - "verification": "reconciled_after_restart", + "verification": decision["verification"], }, ) continue - if ( - isinstance(verified, dict) - and verified.get("verification_performed") is True - ): + if decision["status"] == "explicit_unverified": _write( state_path, { "status": "explicit_unverified", - "error": _verification_error(verified), + "error": decision["error"], }, ) continue @@ -411,7 +383,7 @@ def drain(root, registry, store, external_sender, *, now=None, cancelled=lambda: **state, "status": "verification_required", "attempts": attempts, - "error": "provider_verification_unavailable", + "error": decision["error"], "retry_at": ( now + timedelta( diff --git a/loopx/control_plane/collaboration/return_delivery.ts b/loopx/control_plane/collaboration/return_delivery.ts new file mode 100644 index 0000000000..68855f81db --- /dev/null +++ b/loopx/control_plane/collaboration/return_delivery.ts @@ -0,0 +1,103 @@ +import type { JsonObject } from "../effect_program.ts"; +import { EffectRuntimeRequestError } from "../effect_runtime_errors.ts"; +import { + requireBoolean, + requireJsonObject, + requireNonEmptyString, +} from "../runtime_decode.ts"; + +export const MANAGER_RETURN_DELIVERY_ATTEMPT_SCHEMA = + "manager_return_delivery_attempt_v0"; + +const PROVIDER = /^[a-z][a-z0-9_-]{0,31}$/; +const OPAQUE_REF = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,511}$/; +const DIGEST = /^sha256:[0-9a-f]{64}$/; +const ATTEMPT_KEYS = [ + "schema_version", + "provider", + "message_ref", + "intent_digest", + "provider_receipt", +] as const; + +function matchingString(value: unknown, label: string, pattern: RegExp): string { + const result = requireNonEmptyString(value, label); + if (!pattern.test(result)) { + throw new EffectRuntimeRequestError(`${label} is invalid`); + } + return result; +} + +export function normalizeManagerReturnDeliveryAttempt(value: unknown): JsonObject { + const attempt = requireJsonObject(value, "attempt"); + const keys = Object.keys(attempt).sort(); + if (keys.length !== ATTEMPT_KEYS.length + || ATTEMPT_KEYS.some((key) => !keys.includes(key))) { + throw new EffectRuntimeRequestError( + "manager return delivery attempt has unsupported or missing fields", + ); + } + if (attempt.schema_version !== MANAGER_RETURN_DELIVERY_ATTEMPT_SCHEMA) { + throw new EffectRuntimeRequestError( + "manager return delivery attempt schema is invalid", + ); + } + return { + schema_version: MANAGER_RETURN_DELIVERY_ATTEMPT_SCHEMA, + provider: matchingString(attempt.provider, "attempt.provider", PROVIDER), + message_ref: matchingString( + attempt.message_ref, + "attempt.message_ref", + OPAQUE_REF, + ), + intent_digest: matchingString( + attempt.intent_digest, + "attempt.intent_digest", + DIGEST, + ), + provider_receipt: matchingString( + attempt.provider_receipt, + "attempt.provider_receipt", + DIGEST, + ), + }; +} + +export function classifyManagerReturnVerification(value: unknown): JsonObject { + const outcome = requireJsonObject(value, "outcome"); + const performed = requireBoolean( + outcome.verification_performed, + "outcome.verification_performed", + ); + const verified = requireBoolean( + outcome.reply_verified, + "outcome.reply_verified", + ); + if (verified && !performed) { + throw new EffectRuntimeRequestError( + "a verified return requires a completed verification read", + ); + } + if (verified) { + return { + status: "delivered", + error: null, + verification: "reconciled_after_restart", + }; + } + if (!performed) { + return { + status: "verification_required", + error: "provider_verification_unavailable", + verification: null, + }; + } + const blocker = typeof outcome.blocker === "string" ? outcome.blocker : ""; + const error = [ + "provider_delivery_intent_conflict", + "provider_message_missing", + ].includes(blocker) + ? blocker + : "provider_delivery_mismatch"; + return { status: "explicit_unverified", error, verification: null }; +} diff --git a/loopx/control_plane/effect_runtime_handlers.ts b/loopx/control_plane/effect_runtime_handlers.ts index 0ff5a2276b..80f0c02ec2 100644 --- a/loopx/control_plane/effect_runtime_handlers.ts +++ b/loopx/control_plane/effect_runtime_handlers.ts @@ -175,6 +175,10 @@ import { } from "./capability_hooks.ts"; import { evaluatePostWritebackHookTransaction } from "./post_writeback_hook_transaction.ts"; import { compileActionReviewPlan } from "./presentation/action_review_plan.ts"; +import { + classifyManagerReturnVerification, + normalizeManagerReturnDeliveryAttempt, +} from "./collaboration/return_delivery.ts"; type EffectRuntimeHandler = (params: JsonObject) => unknown | Promise; @@ -598,6 +602,14 @@ export function createEffectRuntimeHandlers( "capability_hook.post_writeback.transaction", evaluatePostWritebackHookTransaction, ], + [ + "manager.return_delivery.normalize_attempt", + (params) => normalizeManagerReturnDeliveryAttempt(params.attempt), + ], + [ + "manager.return_delivery.classify_verification", + (params) => classifyManagerReturnVerification(params.outcome), + ], [ "settlement.identity", (params) => settlementIdentity(settlementIdentityInput(params)), diff --git a/tests/control_plane_ts/manager_return_delivery.test.ts b/tests/control_plane_ts/manager_return_delivery.test.ts new file mode 100644 index 0000000000..1f6e7d6235 --- /dev/null +++ b/tests/control_plane_ts/manager_return_delivery.test.ts @@ -0,0 +1,65 @@ +import assert from "node:assert/strict"; +import test from "node:test"; + +import { + classifyManagerReturnVerification, + normalizeManagerReturnDeliveryAttempt, +} from "../../loopx/control_plane/collaboration/return_delivery.ts"; + +const attempt = { + schema_version: "manager_return_delivery_attempt_v0", + provider: "lark", + message_ref: "om_provider_reply", + intent_digest: `sha256:${"a".repeat(64)}`, + provider_receipt: `sha256:${"b".repeat(64)}`, +}; + +test("normalizes the exact provider-neutral delivery attempt", () => { + assert.deepEqual(normalizeManagerReturnDeliveryAttempt(attempt), attempt); + assert.throws( + () => normalizeManagerReturnDeliveryAttempt({ ...attempt, private_payload: "no" }), + /unsupported or missing fields/, + ); + assert.throws( + () => normalizeManagerReturnDeliveryAttempt({ ...attempt, message_ref: "bad ref" }), + /message_ref is invalid/, + ); +}); + +test("classifies verification without exposing provider prose", () => { + assert.deepEqual( + classifyManagerReturnVerification({ + verification_performed: true, + reply_verified: true, + }), + { + status: "delivered", + error: null, + verification: "reconciled_after_restart", + }, + ); + assert.deepEqual( + classifyManagerReturnVerification({ + verification_performed: false, + reply_verified: false, + blocker: "private provider outage detail", + }), + { + status: "verification_required", + error: "provider_verification_unavailable", + verification: null, + }, + ); + assert.deepEqual( + classifyManagerReturnVerification({ + verification_performed: true, + reply_verified: false, + blocker: "private provider mismatch detail", + }), + { + status: "explicit_unverified", + error: "provider_delivery_mismatch", + verification: null, + }, + ); +}); From f15b6eb4b77da7ee287839a115c0e5313e5e00fe Mon Sep 17 00:00:00 2001 From: Lihua <1017343802@qq.com> Date: Mon, 14 Sep 2026 01:01:30 -0700 Subject: [PATCH 7/9] fix(package): include collaboration TypeScript contract Signed-off-by: Lihua <1017343802@qq.com> --- loopx/control_plane/collaboration/__init__.py | 1 + pyproject.toml | 1 + 2 files changed, 2 insertions(+) create mode 100644 loopx/control_plane/collaboration/__init__.py diff --git a/loopx/control_plane/collaboration/__init__.py b/loopx/control_plane/collaboration/__init__.py new file mode 100644 index 0000000000..38e47d104d --- /dev/null +++ b/loopx/control_plane/collaboration/__init__.py @@ -0,0 +1 @@ +"""Provider-neutral collaboration contracts owned by the typed control plane.""" diff --git a/pyproject.toml b/pyproject.toml index f559e7b879..360df4ae3f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,7 @@ include = ["loopx*"] "loopx" = ["web/chat/*.html", "web/chat/assets/*", "web/chat/manifest.webmanifest", "web/chat/pwa/*"] "loopx.control_plane" = ["*.json", "*.ts", "presentation/*.ts"] "loopx.control_plane.agents" = ["*.ts"] +"loopx.control_plane.collaboration" = ["*.ts"] "loopx.control_plane.coordination" = ["*.ts", "*.json"] "loopx.control_plane.goals" = ["*.ts"] "loopx.control_plane.quota" = ["*.ts"] From e7e681a00e3dd9499d5555aba7c0cc4b9ea2c7cf Mon Sep 17 00:00:00 2001 From: Lihua <1017343802@qq.com> Date: Mon, 14 Sep 2026 06:13:56 -0700 Subject: [PATCH 8/9] fix(chat): preserve return delivery projection completeness Signed-off-by: Lihua <1017343802@qq.com> --- .../capabilities/manager_context/roundtrip.py | 21 +++++- tests/test_manager_context_roundtrip.py | 69 +++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/loopx/capabilities/manager_context/roundtrip.py b/loopx/capabilities/manager_context/roundtrip.py index 979e31eecf..e1865151d7 100644 --- a/loopx/capabilities/manager_context/roundtrip.py +++ b/loopx/capabilities/manager_context/roundtrip.py @@ -207,9 +207,18 @@ def reply_status(root, row): def project_chat_return_deliveries(root, session_id, messages): """Attach public-safe delivery readback to returned Chat transcript rows.""" + pending_message_ids = { + message_id + for message in messages + if message.get("origin") == "manager_followup" + and isinstance((message_id := message.get("message_id")), str) + and message_id.startswith("handoff.") + } + if not pending_message_ids: + return list(messages) statuses = {} paths = sorted((_root(root) / "roundtrips").glob("*.json")) - for path in paths[:2000]: + for path in paths: try: route = _read(path) if route.get("session_id") != session_id: @@ -217,15 +226,25 @@ def project_chat_return_deliveries(root, session_id, messages): request_id = str(route.get("request_id") or "") if path.stem != request_id or not re.fullmatch(r"[a-f0-9]{64}", request_id): continue + route_message_ids = { + "handoff." + _hash([request_id, phase]) for phase in PHASES + } + if pending_message_ids.isdisjoint(route_message_ids): + continue for item in reply_status(root, route): phase = item.get("phase") if phase not in PHASES: continue message_id = "handoff." + _hash([request_id, phase]) + if message_id not in pending_message_ids: + continue statuses[message_id] = { "schema_version": "manager_return_delivery_status_v0", **item, } + pending_message_ids.discard(message_id) + if not pending_message_ids: + break except (OSError, ValueError, KeyError, TypeError): continue return [ diff --git a/tests/test_manager_context_roundtrip.py b/tests/test_manager_context_roundtrip.py index 9b46b83c66..1ad6c3ccff 100644 --- a/tests/test_manager_context_roundtrip.py +++ b/tests/test_manager_context_roundtrip.py @@ -18,8 +18,10 @@ ) from loopx.capabilities.manager_context.roundtrip import ( ReturnService, + _hash, drain, project_chat_return_deliveries, + project_chat_session_snapshot, report, reply_status, ) @@ -402,6 +404,73 @@ def verify(self, route, session, turn, text, attempt): } +def test_chat_snapshot_keeps_current_session_delivery_after_unrelated_route_limit(flow): + root, _, store, _ = flow + session = store.create_session( + goal_id="loopx-manager", + agent_id="codex", + adapter_kind="codex_app_server", + upstream_thread_id="projection-limit", + channel_id="manager", + ) + turn, _ = store.create_turn( + session["session_id"], + client_turn_id="projection-limit", + message="Check delivery projection completeness", + origin="web", + ) + + expected = {} + for request_id, status in ( + ("e" * 64, "delivered"), + ("f" * 64, "verification_required"), + ): + _write( + _root(root) / "roundtrips" / f"{request_id}.json", + {"request_id": request_id, "session_id": session["session_id"]}, + ) + _write( + _root(root) / "replies" / request_id / "conclusion.json", + { + "request_id": request_id, + "phase": "conclusion", + "created_at": "2026-09-14T00:00:00+00:00", + }, + ) + delivery = {"status": status} + if status == "verification_required": + delivery["error"] = "provider_delivery_unverified" + _write( + _root(root) / "replies" / request_id / "conclusion.delivery.json", + delivery, + ) + message_id = "handoff." + _hash([request_id, "conclusion"]) + store.append_message( + session["session_id"], + role="agent", + text=f"Projected {status}", + turn_id=turn["turn_id"], + origin="manager_followup", + message_id=message_id, + ) + expected[message_id] = status + + for index in range(2000): + request_id = f"{index:064x}" + _write( + _root(root) / "roundtrips" / f"{request_id}.json", + {"request_id": request_id, "session_id": f"unrelated-{index}"}, + ) + + snapshot = project_chat_session_snapshot(root, store, session["session_id"]) + returned = { + row["message_id"]: row["return_delivery"]["status"] + for row in snapshot["messages"] + if row.get("message_id") in expected + } + assert returned == expected + + def test_provider_verification_outage_retries_read_only_without_resend(flow): root, registry, store, create = flow _, _, receipt = create(True) From 196e67174ec7c2d3dd27ddbac370ea0901143bb1 Mon Sep 17 00:00:00 2001 From: huangruiteng <14976749+huangruiteng@users.noreply.github.com> Date: Tue, 15 Sep 2026 16:20:53 +0800 Subject: [PATCH 9/9] fix(manager): terminalize unverifiable returns without resend or hot loop A return that cannot be re-verified could still leave the state machine, so an ambiguous delegated result either duplicated its external message or re-ran the provider readback until the process stopped. - A `verification_required` record written before locators were persisted has no trustworthy provider identity, but `_delivery_attempt(None)` raises the effect runtime's rejection, which is a `RuntimeError`, so the existing `except ValueError` never fired. The record fell through to the generic retry branch, became `retry_pending`, and the next pump sent the already published conclusion again. Locator-less and un-normalizable attempts now terminalize as `explicit_unverified`/`provider_locator_unavailable` before that branch. - Adapters raise the new typed `ReturnResolutionBlocked(reason, message)` so delivery state stops depending on provider prose: `context return authority revoked` matched no token, so a revoked return neither terminalized nor backed off and re-ran the full readback every ~3s. Prose classification is retained for text that still arrives that way, now including `authority`. - An unclassified readback failure keeps the locator and stays retryable, but records `attempts`/`retry_at` instead of re-running the provider on every pump. Backoff stays scoped to the verification read so the send-interruption recovery path still reconciles on the next pump. Regression coverage: a legacy locator-less record is never resent (send count 0, including after the backoff window); authority revocation terminalizes for the typed reason and both prose wordings and is never re-read; an unclassified readback failure backs off and then retries. The Lark adapter tests now assert the typed reason alongside the existing message expectations. Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com> --- .../capabilities/manager_context/roundtrip.py | 92 +++++++++++- loopx/extensions/lark/manager_returns.py | 28 +++- tests/extensions/test_lark_manager_returns.py | 6 +- tests/test_manager_context_roundtrip.py | 136 ++++++++++++++++++ 4 files changed, 249 insertions(+), 13 deletions(-) diff --git a/loopx/capabilities/manager_context/roundtrip.py b/loopx/capabilities/manager_context/roundtrip.py index e1865151d7..09780a3df3 100644 --- a/loopx/capabilities/manager_context/roundtrip.py +++ b/loopx/capabilities/manager_context/roundtrip.py @@ -15,7 +15,7 @@ from .tracking import _entry, _now, _receipt from ...file_lock import exclusive_file_lock from ...presentation.public_safety import scan_public_boundary_text -from ...control_plane.effect_runtime import effect_runtime_result +from ...control_plane.effect_runtime import EffectRuntimeRejected, effect_runtime_result PHASES = ("decision", "conclusion") DELIVERY_STATUSES = { @@ -40,6 +40,33 @@ "original_route_or_return_delivery_unavailable", "delivery_state_unreadable", } + +# Bounded reasons why one return cannot be resolved at all. Adapters raise +# ``ReturnResolutionBlocked`` with one of these instead of relying on their prose +# being re-parsed, so delivery state never depends on message substrings. +RETURN_RESOLUTION_REASONS = frozenset( + { + "return_authorization_unavailable", + "original_route_unavailable", + "initial_delivery_receipt_unavailable", + } +) + + +class ReturnResolutionBlocked(ValueError, RuntimeError): + """A return cannot be resolved; ``reason`` is the provider-neutral code. + + Inheriting ``ValueError`` keeps existing adapter call sites and their + handling unchanged while the typed reason is what the state machine reads. + """ + + def __init__(self, reason, message): + if reason not in RETURN_RESOLUTION_REASONS: + raise ValueError("unsupported return resolution reason") + self.reason = reason + super().__init__(message) + + def _delivery_attempt(value): return dict( effect_runtime_result( @@ -57,8 +84,17 @@ def _verification_decision(outcome): def _verification_exception_error(exc): + reason = getattr(exc, "reason", None) + if reason in RETURN_RESOLUTION_REASONS: + return reason + # Compatibility fallback for adapter text that still arrives as prose. New + # adapter failures must raise ReturnResolutionBlocked with a typed reason. message = str(exc) - if "authorization" in message or "authorized" in message: + if ( + "authorization" in message + or "authorized" in message + or "authority" in message + ): return "return_authorization_unavailable" if any(token in message for token in ("conversation", "route", "binding", "target")): return "original_route_unavailable" @@ -350,9 +386,21 @@ def drain(root, registry, store, external_sender, *, now=None, cancelled=lambda: transport = {} if route["channel_id"] != "manager": if state.get("status") == "verification_required": + if state.get("attempt") is None: + # A record written before locators were persisted has + # no trustworthy provider identity: never guess and + # never resend the conclusion. + _write( + state_path, + { + "status": "explicit_unverified", + "error": "provider_locator_unavailable", + }, + ) + continue try: attempt = _delivery_attempt(state.get("attempt")) - except ValueError: + except (ValueError, EffectRuntimeRejected): _write( state_path, { @@ -371,8 +419,42 @@ def drain(root, registry, store, external_sender, *, now=None, cancelled=lambda: }, ) continue - verified = verifier(route, session, turn, text, attempt) - decision = _verification_decision(verified) + try: + verified = verifier(route, session, turn, text, attempt) + decision = _verification_decision(verified) + except ( + OSError, + ValueError, + KeyError, + TypeError, + RuntimeError, + ) as exc: + error = _verification_exception_error(exc) + if error: + _write( + state_path, + {"status": "explicit_unverified", "error": error}, + ) + continue + # An unclassified readback failure keeps the locator and + # stays retryable, but must never re-run the provider on + # every pump without backoff. + attempts = int(state.get("attempts", 0)) + 1 + _write( + state_path, + { + **state, + "status": "verification_required", + "attempts": attempts, + "retry_at": ( + now + + timedelta( + seconds=min(300, 5 * 2 ** min(attempts, 6)) + ) + ).isoformat(), + }, + ) + continue if decision["status"] == "delivered": _write( state_path, diff --git a/loopx/extensions/lark/manager_returns.py b/loopx/extensions/lark/manager_returns.py index dd532c1a34..cb0508083b 100644 --- a/loopx/extensions/lark/manager_returns.py +++ b/loopx/extensions/lark/manager_returns.py @@ -9,6 +9,7 @@ from .event_inbox import load_lark_event_inbox_config, _load_processed from .inbox_reply import reply_lark_event_inbox, verify_lark_inbox_reply from ...capabilities.manager_context import authority +from ...capabilities.manager_context.roundtrip import ReturnResolutionBlocked def _resolve_return( @@ -20,14 +21,19 @@ def _resolve_return( # Validate live binding/session independently of the worker's target Goal. # Delegation grants permit only this request's audience-ready reply. if not authorized_manager_goal_ids(snapshot, session, runtime_root=root): - raise ValueError("manager connection no longer authorized") + raise ReturnResolutionBlocked( + "return_authorization_unavailable", + "manager connection no longer authorized", + ) target = {k: route[k] for k in ("goal_id", "agent_id")} grant = authority(root, registry, session, turn) if ( target not in grant["targets"] or grant.get("source_id") != route["source_id"] ): - raise ValueError("context return authority revoked") + raise ReturnResolutionBlocked( + "return_authorization_unavailable", "context return authority revoked" + ) matches = [] for gid, payload in snapshot.get("binding_payloads", {}).items(): for binding in bindings_for_goal(payload, gid): @@ -39,13 +45,17 @@ def _resolve_return( ): matches.append(binding) if len(matches) != 1: - raise ValueError("manager return binding ambiguous") + raise ReturnResolutionBlocked( + "original_route_unavailable", "manager return binding ambiguous" + ) binding = matches[0] target_config = goal_channel_target_for_name( snapshot["target_payload"], binding["target_ref"] ) if not target_config or target_config.get("enabled") is not True: - raise ValueError("manager return target disabled") + raise ReturnResolutionBlocked( + "original_route_unavailable", "manager return target disabled" + ) routing = { "target_ref": binding["target_ref"], "conversation_kind": "manager", @@ -89,7 +99,10 @@ def resolve(): message_id = route["source_id"].removeprefix("lark:") config = load_lark_event_inbox_config(project=root, config_path=config_path) if message_id not in _load_processed(config["inbox_path"] / "processed.json"): - raise ValueError("initial reply has not been acknowledged") + raise ReturnResolutionBlocked( + "initial_delivery_receipt_unavailable", + "initial reply has not been acknowledged", + ) def before_send(_intent): current = resolve() @@ -136,7 +149,10 @@ def verify_return( message_id = route["source_id"].removeprefix("lark:") config = load_lark_event_inbox_config(project=root, config_path=config_path) if message_id not in _load_processed(config["inbox_path"] / "processed.json"): - raise ValueError("initial reply has not been acknowledged") + raise ReturnResolutionBlocked( + "initial_delivery_receipt_unavailable", + "initial reply has not been acknowledged", + ) return verify_lark_inbox_reply( project=root, config_path=config_path, diff --git a/tests/extensions/test_lark_manager_returns.py b/tests/extensions/test_lark_manager_returns.py index 398ebb11d8..316707588f 100644 --- a/tests/extensions/test_lark_manager_returns.py +++ b/tests/extensions/test_lark_manager_returns.py @@ -155,8 +155,9 @@ def invoke(): runner=transport, ) - with pytest.raises(ValueError, match="initial reply"): + with pytest.raises(ValueError, match="initial reply") as pending: invoke() + assert pending.value.reason == "initial_delivery_receipt_unavailable" assert not calls acknowledge_lark_event_inbox( project=root, @@ -170,8 +171,9 @@ def invoke(): reaction_id="reaction_Get", emoji_type="Get", ) if revoke_before_send: - with pytest.raises(ValueError, match="revoked"): + with pytest.raises(ValueError, match="revoked") as revoked: invoke() + assert revoked.value.reason == "return_authorization_unavailable" assert not sent else: result = invoke() diff --git a/tests/test_manager_context_roundtrip.py b/tests/test_manager_context_roundtrip.py index 1ad6c3ccff..c01054df62 100644 --- a/tests/test_manager_context_roundtrip.py +++ b/tests/test_manager_context_roundtrip.py @@ -18,6 +18,7 @@ ) from loopx.capabilities.manager_context.roundtrip import ( ReturnService, + ReturnResolutionBlocked, _hash, drain, project_chat_return_deliveries, @@ -590,6 +591,141 @@ def verify(self, *_args): assert transport.verify_calls == 0 +def test_legacy_verification_required_without_locator_is_never_resent(flow): + """A record from before locators were persisted must not be guessed or resent.""" + root, registry, store, create = flow + _, _, receipt = create(True) + rid = receipt["request_id"] + acknowledge(root, "research", "worker", rid, "adopt", "Checked") + report(root, "research", "worker", rid, "conclusion", "Legacy ambiguous result.") + _write( + _root(root) / "replies" / rid / "conclusion.delivery.json", + {"status": "verification_required", "error": "provider_delivery_unverified"}, + ) + + class Transport: + send_calls = 0 + + def send_with_attempt(self, route, session, turn, text, record_attempt): + self.send_calls += 1 + return {"reply_verified": True} + + def verify(self, *_args): + raise AssertionError("a locatorless return has nothing to verify") + + transport = Transport() + drain(root, registry, store, transport) + drain(root, registry, ChatSessionStore(root), transport) + state = reply_status(root, receipt)[0] + assert state["status"] == "explicit_unverified" + assert state["error"] == "provider_locator_unavailable" + # Terminal: no later pump may resend the already published conclusion. + drain( + root, + registry, + ChatSessionStore(root), + transport, + now=datetime.now(timezone.utc) + timedelta(days=2), + ) + assert transport.send_calls == 0 + + +def accepted_attempt(): + return { + "schema_version": "manager_return_delivery_attempt_v0", + "provider": "lark", + "message_ref": "om_provider_reply", + "intent_digest": "sha256:" + "a" * 64, + "provider_receipt": "sha256:" + "b" * 64, + } + + +@pytest.mark.parametrize( + "failure", + [ + lambda: ReturnResolutionBlocked( + "return_authorization_unavailable", "context return authority revoked" + ), + lambda: ValueError("context return authority revoked"), + lambda: ValueError("manager connection no longer authorized"), + ], + ids=["typed-reason", "prose-revoked", "prose-unauthorized"], +) +def test_return_authority_revocation_terminalizes_without_repeating_readback( + flow, failure +): + root, registry, store, create = flow + _, _, receipt = create(True) + rid = receipt["request_id"] + acknowledge(root, "research", "worker", rid, "adopt", "Checked") + report(root, "research", "worker", rid, "conclusion", "Bounded result.") + + class Transport: + verify_calls = 0 + + def send_with_attempt(self, route, session, turn, text, record_attempt): + record_attempt(accepted_attempt()) + return {"external_write_performed": True, "reply_verified": False} + + def verify(self, *_args): + self.verify_calls += 1 + raise failure() + + transport = Transport() + drain(root, registry, store, transport) + drain(root, registry, ChatSessionStore(root), transport) + state = reply_status(root, receipt)[0] + assert state["status"] == "explicit_unverified" + assert state["error"] == "return_authorization_unavailable" + assert transport.verify_calls == 1 + # A terminal reason is never re-read, not even after the backoff window. + drain( + root, + registry, + ChatSessionStore(root), + transport, + now=datetime.now(timezone.utc) + timedelta(days=2), + ) + assert transport.verify_calls == 1 + + +def test_unclassified_verification_failure_backs_off_instead_of_hot_looping(flow): + root, registry, store, create = flow + _, _, receipt = create(True) + rid = receipt["request_id"] + acknowledge(root, "research", "worker", rid, "adopt", "Checked") + report(root, "research", "worker", rid, "conclusion", "Bounded result.") + + class Transport: + verify_calls = 0 + + def send_with_attempt(self, route, session, turn, text, record_attempt): + record_attempt(accepted_attempt()) + return {"external_write_performed": True, "reply_verified": False} + + def verify(self, *_args): + self.verify_calls += 1 + raise RuntimeError("provider readback transport failed") + + transport = Transport() + drain(root, registry, store, transport) + drain(root, registry, ChatSessionStore(root), transport) + assert reply_status(root, receipt)[0]["status"] == "verification_required" + assert transport.verify_calls == 1 + # The kept locator stays retryable, but the next pump must respect the + # backoff instead of re-running the provider readback every few seconds. + drain(root, registry, ChatSessionStore(root), transport) + assert transport.verify_calls == 1 + drain( + root, + registry, + ChatSessionStore(root), + transport, + now=datetime.now(timezone.utc) + timedelta(days=2), + ) + assert transport.verify_calls == 2 + + def test_public_delivery_projection_normalizes_unknown_private_state(flow): root, _, _, create = flow _, _, receipt = create(True)