From 3753166875b34998d080c93301da373847b13e84 Mon Sep 17 00:00:00 2001 From: huangruiteng <14976749+huangruiteng@users.noreply.github.com> Date: Thu, 24 Sep 2026 06:19:58 +0800 Subject: [PATCH 1/5] fix(workspace): keep run observations out of delivered files Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com> --- .../smoke/projection-localization-smoke.ts | 21 ----- .../src/features/personal-workspace/i18n.tsx | 20 +---- .../projection-localization.ts | 32 +------ .../dashboard/src/views/dashboard-page.tsx | 87 ++----------------- .../typed-actions.mjs | 7 +- loopx/web/chat/asset-retention.json | 6 +- .../{index-CFEaAATG.js => index-BxY1Qe0B.js} | 19 ++-- loopx/web/chat/index.html | 2 +- 8 files changed, 27 insertions(+), 167 deletions(-) rename loopx/web/chat/assets/{index-CFEaAATG.js => index-BxY1Qe0B.js} (79%) diff --git a/apps/presentation/dashboard/smoke/projection-localization-smoke.ts b/apps/presentation/dashboard/smoke/projection-localization-smoke.ts index abf0dca94b..9e3e34ae51 100644 --- a/apps/presentation/dashboard/smoke/projection-localization-smoke.ts +++ b/apps/presentation/dashboard/smoke/projection-localization-smoke.ts @@ -1,7 +1,6 @@ import { agentStatusSentence, projectionSentence, - runEvidenceCopy, } from "../src/features/personal-workspace/projection-localization.js"; type Values = Record; @@ -14,19 +13,11 @@ const english = { "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", } as const; const chinese = { @@ -97,16 +88,4 @@ equal( "English stopped status", ); -const latestRun = runEvidenceCopy({ eventCount: 0, hasArtifact: true, hasLatestValidation: false }, en); -equal(latestRun.label, "Latest run", "English latest-run label"); -equal(latestRun.metadata, "Run evidence is available", "English run-evidence metadata"); - -const latestValidation = runEvidenceCopy({ eventCount: 3, hasArtifact: false, hasLatestValidation: true }, en); -equal(latestValidation.label, "Latest validation", "English latest-validation label"); -equal(latestValidation.metadata, "3 events in the last 24 hours", "English event-count metadata"); - -const chineseRun = runEvidenceCopy({ eventCount: 0, hasArtifact: false, hasLatestValidation: false }, zhCN); -equal(chineseRun.label, "最近运行", "Chinese latest-run label"); -equal(chineseRun.metadata, "公开安全状态投影", "Chinese public-safe metadata"); - console.log("projection localization smoke passed"); diff --git a/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx b/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx index ea2b730647..8793c3c1cb 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx @@ -389,7 +389,7 @@ const en = { "drawer.unconfigured": "Not configured", "drawer.workspaceCandidates": "Available workspaces", "files.emptySummary": "Public-safe output", - "files.empty": "No files, outputs, or verified reports yet.", + "files.empty": "No delivered files or verified reports yet. Run and validation status remain in Tasks.", "files.loadingReports": "Loading verified milestone reports…", "files.reportDelta": "+{added} added · {changed} changed", "files.reportAdded": "added", @@ -763,19 +763,11 @@ const en = { "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", @@ -1477,7 +1469,7 @@ const zhCN: Record = { "drawer.unconfigured": "未配置", "drawer.workspaceCandidates": "可选择的工作区", "files.emptySummary": "公开安全产出", - "files.empty": "还没有文件、产出或已验证的阶段周报。", + "files.empty": "还没有已交付文件或已验证报告。运行和验证状态请在任务中查看。", "files.loadingReports": "正在加载已验证的阶段周报…", "files.reportDelta": "+{added} 新增 · {changed} 变化", "files.reportAdded": "新增", @@ -1851,19 +1843,11 @@ const zhCN: Record = { "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": "已中断", diff --git a/apps/presentation/dashboard/src/features/personal-workspace/projection-localization.ts b/apps/presentation/dashboard/src/features/personal-workspace/projection-localization.ts index ff4b5ce489..a7bbfa99e8 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/projection-localization.ts +++ b/apps/presentation/dashboard/src/features/personal-workspace/projection-localization.ts @@ -6,19 +6,11 @@ export type ProjectionMessageKey = | "projection.agentStopped" | "projection.agentWaitingExternal" | "projection.confirmAgentDecision" - | "projection.events24h" | "projection.firstReadOnlyAdapterCheck" - | "projection.goalVerified" - | "projection.latestRun" - | "projection.latestValidation" | "projection.nextUpdatePending" - | "projection.publicSafeProjection" | "projection.refreshState" - | "projection.runEvidenceAvailable" - | "projection.runRecorded" | "projection.statusRefreshNeeded" - | "projection.todoStatusUpdated" - | "projection.validationRecorded"; + | "projection.todoStatusUpdated"; export type ProjectionTranslate = ( key: ProjectionMessageKey, @@ -70,25 +62,3 @@ export function agentStatusSentence(status: ProjectionAgentStatus, t: Projection }; return t(keyByStatus[status]); } - -export function runEvidenceCopy( - { - eventCount, - hasArtifact, - hasLatestValidation, - }: { - eventCount: number; - hasArtifact: boolean; - hasLatestValidation: boolean; - }, - t: ProjectionTranslate, -) { - return { - label: t(hasLatestValidation ? "projection.latestValidation" : "projection.latestRun"), - metadata: eventCount > 0 - ? t("projection.events24h", { count: eventCount }) - : hasArtifact - ? t("projection.runEvidenceAvailable") - : t("projection.publicSafeProjection"), - }; -} diff --git a/apps/presentation/dashboard/src/views/dashboard-page.tsx b/apps/presentation/dashboard/src/views/dashboard-page.tsx index fc9bfceb04..1648679d1d 100644 --- a/apps/presentation/dashboard/src/views/dashboard-page.tsx +++ b/apps/presentation/dashboard/src/views/dashboard-page.tsx @@ -88,7 +88,6 @@ import { useWorkspaceI18n, type WorkspaceTranslate } from "../features/personal- import { agentStatusSentence, projectionSentence, - runEvidenceCopy, } from "../features/personal-workspace/projection-localization"; import { goalHasExecutionSummary, @@ -440,16 +439,6 @@ function buildAgentManagementRows( type PersonalGoalState = "需修复" | "等你" | "等待条件" | "推进中" | "已完成" | "安静运行" | "已停止"; -type PersonalRunEvidence = { - generatedAt: string; - label: string; - metadata: string; - runId: string | null; - safePreview: string; - summary: string; - todoId: string | null; -}; - type PersonalGoalItem = { acceptanceObservation?: GoalAcceptanceObservation | null; loadState?: "loading" | "error"; @@ -467,7 +456,7 @@ type PersonalGoalItem = { needsYouTaskClass?: string | null; needsYouTodoId?: string | null; nextSentence: string; - runEvidence?: PersonalRunEvidence | null; + hasRunObservation: boolean; state: PersonalGoalState; subagentExecution?: { allowedDomains: string[]; @@ -855,17 +844,6 @@ function personalAgentTodoFacts(row: GoalDirectoryRow): { return { doneTodoCount, nextTodoText, recentCompleted }; } -function personalValidationSentence(value: string | null | undefined, t: WorkspaceTranslate) { - const cleaned = cleanShareText(value); - if (!cleaned) { - return ""; - } - if (/\b(state_file|registry_goal|authority_sources|source_registry)\b|\b[a-z_]+\s+\d+\/\d+/i.test(cleaned)) { - return t("projection.goalVerified"); - } - return projectionSentence(cleaned, t, "projection.validationRecorded"); -} - function personalVisiblePlanTodos(todos: PersonalAgentTodoItem[], limit = 4) { if (todos.length <= limit) { return todos; @@ -878,37 +856,6 @@ function personalVisiblePlanTodos(todos: PersonalAgentTodoItem[], limit = 4) { return todos.slice(start, start + limit); } -function personalRunEvidence(payload: StatusPayload, row: GoalDirectoryRow, t: WorkspaceTranslate): PersonalRunEvidence | null { - const latestValidation = row.queueItem?.project_asset?.latest_validation; - const latestRun = row.latestRun; - const eventSummary = payload.event_ledger_summary?.goals.find((goal) => goal.goal_id === row.goal.id); - if (!latestValidation && !latestRun && !eventSummary) { - return null; - } - const summary = [ - personalValidationSentence(latestValidation?.summary, t), - projectionSentence(latestRun?.health_check, t), - projectionSentence(latestRun?.recommended_action, t), - ] - .find((value) => value !== "" && value !== "暂无") - ?? t("projection.runRecorded"); - const eventCount = eventSummary?.events_24h ?? 0; - const copy = runEvidenceCopy({ - eventCount, - hasArtifact: Boolean(latestRun?.json_exists || latestRun?.markdown_exists), - hasLatestValidation: Boolean(latestValidation), - }, t); - return { - generatedAt: latestValidation?.generated_at ?? latestRun?.generated_at ?? eventSummary?.latest_event_at ?? "", - label: copy.label, - metadata: copy.metadata, - runId: latestRun ? `${row.goal.id}:${latestRun.generated_at}` : null, - safePreview: [summary, copy.metadata].filter(Boolean).join("\n"), - summary, - todoId: row.queueItem?.project_asset?.agent_todos?.items.find((todo) => !todo.done)?.todo_id ?? null, - }; -} - function personalDecisionPrimaryLabel(goal: PersonalGoalItem) { const signal = `${goal.needsYouTaskClass ?? ""} ${goal.needsYouActionKind ?? ""}`.toLowerCase(); return /approve|approval|merge|release|submit|write|publish/.test(signal) ? "确认处理" : "回复 Agent"; @@ -1270,7 +1217,9 @@ function buildPersonalHomeModel( needsYouTaskClass: needsYouTodo?.taskClass ?? null, needsYouTodoId: needsYouTodo?.todoId ?? null, nextSentence, - runEvidence: personalRunEvidence(payload, row, t), + hasRunObservation: Boolean(row.queueItem?.project_asset?.latest_validation + || row.latestRun + || payload.event_ledger_summary?.goals.some((item) => item.goal_id === goal.id)), state, ...(goalSubagentConfigurationEnabled ? { subagentExecution: { @@ -2626,9 +2575,10 @@ function PersonalGoalHome({ }; }) : []), // A persistent chat session is not itself waiting work. Only surface a - // Goal-level execution row when there is execution, evidence, or a wait/fault. + // Goal-level execution row when there is execution, a status observation, + // or a wait/fault. Observations are not deliverable Files. ...(selectedGoal && (runtimeBindings[selectedGoal.goalId]?.turnId - || selectedGoal.runEvidence || goalHasExecutionSummary(selectedGoal)) ? [{ + || selectedGoal.hasRunObservation || goalHasExecutionSummary(selectedGoal)) ? [{ id: `run:${selectedGoal.goalId}`, kind: "run" as const, run: { @@ -2651,12 +2601,6 @@ function PersonalGoalHome({ title: selectedGoal.nextSentence, totalSteps: selectedGoal.agentTodos.length || 1, turnId: runtimeBindings[selectedGoal.goalId]?.turnId, - outputs: selectedGoal.runEvidence ? [{ - createdAt: selectedGoal.runEvidence.generatedAt, - kind: "evidence" as const, - outputId: `${selectedGoal.goalId}:latest-evidence`, - title: selectedGoal.runEvidence.label, - }] : [], }, }] : []), ...contextMessages.map((message): WorkspaceTimelineItem => ({ @@ -2673,23 +2617,6 @@ function PersonalGoalHome({ text: message.text || (message.pending ? "Agent 正在处理…" : message.lines.join("\n")), }, })), - ...(selectedGoal ? [selectedGoal] : model.goals).flatMap((goal) => goal.runEvidence ? [{ - id: `output:${goal.goalId}:${goal.runEvidence.generatedAt || "latest"}`, - kind: "output" as const, - output: { - agentLabel: personalAgentLabel(goal.agentId), - createdAt: goal.runEvidence.generatedAt, - goalId: goal.goalId, - goalTitle: goal.title, - kind: "evidence" as const, - outputId: `${goal.goalId}:latest-evidence`, - runId: goal.runEvidence.runId ?? undefined, - safePreview: goal.runEvidence.safePreview, - summary: goal.runEvidence.summary, - title: goal.runEvidence.label, - todoId: goal.runEvidence.todoId ?? undefined, - }, - }] : []), ...(selectedGoal && periodicReport ? [{ id: `output:${selectedGoal.goalId}:report:${periodicReport.publication.publication_id}`, kind: "output" as const, diff --git a/examples/personal-workspace-browser/typed-actions.mjs b/examples/personal-workspace-browser/typed-actions.mjs index 8f6bee62d8..f82425f6f4 100644 --- a/examples/personal-workspace-browser/typed-actions.mjs +++ b/examples/personal-workspace-browser/typed-actions.mjs @@ -583,8 +583,8 @@ export const typedActionsScenario = { await englishGoalNavigation.getByRole("button", { name: /^(Chat|对话)$/, exact: true }).click(); await page.locator('[data-goal-panel="chat"]').getByText("Agent is waiting for your decision", { exact: true }).first().waitFor({ state: "visible" }); await englishGoalNavigation.getByRole("button", { name: /^(Files|成果)$/, exact: true }).click(); - const latestRunOutput = page.locator('[data-output-kind="evidence"]', { hasText: "Latest run" }).first(); - await latestRunOutput.waitFor({ state: "visible" }); + if (await page.locator('[data-output-kind="evidence"]').count() !== 0) throw new Error("Run status appeared as a delivered file"); + await page.getByText("No delivered files or verified reports yet. Run and validation status remain in Tasks.", { exact: true }).waitFor({ state: "visible" }); const englishProjectionText = await page.locator(".personal-workspace-main").innerText(); for (const forbidden of ["最近运行", "最近验证", "Agent 正在整理下一步", "Agent 正在推进当前 Goal", "Agent 等待你的决定"]) { if (englishProjectionText.includes(forbidden)) throw new Error(`English projection exposed Chinese UI copy ${forbidden}: ${englishProjectionText}`); @@ -755,7 +755,8 @@ export const typedActionsScenario = { await page.screenshot({ path: resolve(outputDir, "goal-tasks-loopx-theme.png"), fullPage: false, animations: "disabled" }); await goalNavigation.getByRole("button", { name: /^(Files|成果)$/ }).click(); const publicFiles = page.locator(".personal-files-list > button"); - await publicFiles.first().waitFor({ state: "visible" }); + if (await publicFiles.count() !== 0) throw new Error("A status or run observation appeared as a delivered file"); + await page.getByText("还没有已交付文件或已验证报告。运行和验证状态请在任务中查看。", { exact: true }).waitFor({ state: "visible" }); await page.screenshot({ path: resolve(outputDir, "goal-files-loopx-theme.png"), fullPage: false, animations: "disabled" }); await goalNavigation.getByRole("button", { name: /^(Chat|对话)$/ }).click(); await page.locator(".personal-channel-timeline").waitFor({ state: "visible" }); diff --git a/loopx/web/chat/asset-retention.json b/loopx/web/chat/asset-retention.json index 43ca88ff52..fc69aa96de 100644 --- a/loopx/web/chat/asset-retention.json +++ b/loopx/web/chat/asset-retention.json @@ -13,7 +13,7 @@ "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-BGlmetKk.js", + "assets/index-BxY1Qe0B.js", "assets/index-C_Imc7ZG.css" ], [ @@ -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-CFEaAATG.js", - "assets/index-C_Imc7ZG.css" + "assets/index-C_Imc7ZG.css", + "assets/index-BGlmetKk.js" ] ] } diff --git a/loopx/web/chat/assets/index-CFEaAATG.js b/loopx/web/chat/assets/index-BxY1Qe0B.js similarity index 79% rename from loopx/web/chat/assets/index-CFEaAATG.js rename to loopx/web/chat/assets/index-BxY1Qe0B.js index 14b088ac03..511142be3c 100644 --- a/loopx/web/chat/assets/index-CFEaAATG.js +++ b/loopx/web/chat/assets/index-BxY1Qe0B.js @@ -28,7 +28,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.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.validationRevision":`Validation revision`,"drawer.validationDigest":`Validation declaration digest`,"drawer.validationRevisionActor":`Revised by`,"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.subagentAppliedRestart":`Applied and verified. The raised Codex child-agent limit takes effect in new Sessions.`,"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.subagentExecutionConfig":`Delegation bindings`,"drawer.subagentExecutionConfigHint":`Optional repo-relative ignored JSON under .loopx/config/. Planning sees only authorized route status; the file remains the execution-grant owner.`,"drawer.subagentExecutionConfigNone":`Not configured`,"drawer.subagentMaxChildren":`Maximum child agents`,"drawer.subagentHostCapacityImplicit":`implicit default`,"drawer.subagentHostCapacityRaise":`Confirming also raises the Codex child-agent limit to at least {required} (currently {configured}). Existing higher values are preserved; new Sessions are required.`,"drawer.subagentHostCapacityReady":`Codex child-agent capacity ({configured}) already satisfies this Goal ({required}).`,"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.taskPriority":`Priority`,"drawer.taskPriorityChoose":`Choose priority`,"drawer.taskPriorityClear":`No priority`,"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.overview":`Overview`,"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":`Configure this Goal’s capabilities`,"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.managerExecutorKindIndividual":`individual CLI login`,"header.managerExecutorKindManaged":`operator credential`,"header.managerExecutorKindRegistered":`registered endpoint`,"header.managerExecutionUnavailable":`Selected {executor} cannot start here; this channel does not fall back to an individual CLI login.`,"header.managerExecutionUnavailableCredential":`Selected {executor} needs the operator credential {credential} before this channel can start it.`,"header.managerExecutionUnavailableRuntime":`Selected {executor} cannot start here because its runtime is not installed on this machine.`,"header.managerExecutionUnavailableEffort":`Selected {executor} rejected the configured reasoning effort; set a supported effort and reload.`,"header.managerExecutionUnavailableOutputBudget":`Selected {executor} has an invalid per-request output-token limit; set a positive integer and reload.`,"header.managerEndpointStewardDefault":`Runs {executor}, the steward channel's shipped default. Select an executor explicitly to move it.`,"header.managerOutputTokenBudget":`{tokens} tok/request`,"header.managerAllocation":`Selection: {policy} · {reason}`,"header.managerSelectionPreferred":`preferred`,"header.managerSelectionPinned":`pinned`,"header.managerSelectionFlexible":`flexible pool`,"header.managerAllocationUser":`explicit user choice`,"header.managerAllocationPinned":`pinned by machine configuration`,"header.managerAllocationFallback":`primary unavailable; used an eligible fallback`,"header.managerAllocationUnavailable":`no eligible route is currently available`,"header.managerAllocationPrimary":`primary route is available`,"header.managerAllocationProductDefault":`product default`,"header.managerAllocationService":`service environment override`,"header.managerAllocationConfigured":`configured route`,"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.`,"drawer.recoverEditResult":`Recover operation result`,"drawer.retryOriginal":`Retry original operation`,"actionReview.canonical_update_retry":`The edit is not yet verified. Retry this operation to recover its result.`,"actionReview.canonical_update_projection_pending":`The operation was committed; display delivery is pending. Retry this operation to restore the current view.`,"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.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.teamPlan.gapReason.capabilityNotGranted":`Required capability not granted`,"proposal.teamPlan.gapReason.audienceNotAuthorized":`Required access not authorized`,"proposal.teamPlan.pending":`Pending`,"proposal.teamPlan.assignedHint":`Assignment recorded. See the Goal for execution progress.`,"proposal.teamPlan.recoveredHint":`No new tasks created. See the Goal for current progress.`,"proposal.teamPlan.originalPlan":`View original plan`,"proposal.teamPlan.viewResult":`View result`,"proposal.teamPlan.openGoal":`Open Goal`,"proposal.teamPlan.resultTitle":`Assignment result`,"proposal.teamPlan.retry":`Retry assignment`,"proposal.teamPlan.retryHint":`Retry this assignment to recover its result without duplicating tasks.`,"proposal.summary.teamPlan":`Assign {count} tasks for {goal}`,"proposal.impact.teamPlan":`Confirm to assign the ready tasks. Unavailable assignments stay pending.`,"proposal.primary.teamPlan":`Confirm assignment`,"proposal.field.laneGaps":`Unstaffed lanes`,"proposal.field.quotaEnvelope":`Quota envelope`,"proposal.teamPlan.acceptanceShort":`acceptance reference`,"proposal.teamPlan.advisory":`planning context; not enforced by this confirmation`,"proposal.teamPlan.appliedPartially":`{created} assigned · {gaps} pending`,"proposal.teamPlan.appliedAlreadyPresent":`Original assignment recovered`,"proposal.teamPlan.applied":`{count} tasks assigned`,"proposal.teamPlan.gapLane":`unstaffed`,"proposal.teamPlan.laneUnstaffed":`staffing gap, no first Todo`,"proposal.teamPlan.gapReason.agentNotRegistered":`the Agent is not registered for this Goal`,"proposal.teamPlan.gapReason.actionKindNotSupported":`this host does not ship that action kind`,"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.credentialTitle":`Operator model credential`,"machine.credentialDescription":`The key and endpoint the steward channel and the managed host authenticate with on this machine. The key is stored in its own owner-only file, never in the machine configuration that is projected here, and it is never read back — only its fingerprint is.`,"machine.credentialApiKey":`API key`,"machine.credentialApiKeyPlaceholder":`Paste a key to store it; leave blank to keep the stored one`,"machine.credentialBaseUrl":`Endpoint base URL`,"machine.credentialBaseUrlPlaceholder":`https://endpoint.example/v1 (blank keeps the endpoint default)`,"machine.credentialStore":`Store credential`,"machine.credentialClearKey":`Clear stored key`,"machine.credentialClearUrl":`Clear stored endpoint`,"machine.credentialConfigured":`configured`,"machine.credentialAbsent":`not configured`,"machine.credentialInvalid":`unreadable — repair required`,"machine.credentialSourceMachine":`this machine's stored credential`,"machine.credentialSourceEnvironment":`the service environment`,"machine.credentialSourceUnset":`no source`,"machine.credentialFingerprint":`fingerprint`,"machine.credentialStored":`Credential stored. The next turn uses it; no restart is needed.`,"machine.credentialCleared":`Stored credential cleared.`,"machine.credentialError":`The credential could not be stored.`,"machine.credentialBoundary":`Storing a credential grants no authority: it does not select an executor, model, or reasoning effort.`,"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.larkInboxNotificationDescription":`This switch controls automatic group messages for human gates. Incoming Lark events remain available when it is off.`,"capabilities.larkInboxNotificationSetting":`Human-gate group notifications`,"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.hostCapacityPartialWrite":`Goal value saved; Codex host capacity still needs alignment`,"capabilities.hostCapacityPartialWriteDescription":`The Goal configuration and shared projection were verified, but the Codex host limit was not updated. Refresh the preview after repairing the host configuration; do not resubmit the Goal change.`,"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.modelProvider":`Model provider`,"settings.globalCapabilities":`Global capabilities`,"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":`New conversation reply`,"tasks.chatPending":`Conversation in progress`,"tasks.chatReturn":`Collaboration receipt`,"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":`Draft a 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.blockers":`看阻塞`,"composer.attachImageHint":`选择、粘贴或拖入图片`,"composer.clarifyDefer":`暂缓 Todo 需要可自动判断的恢复条件。请补充 todo_done:、pr_merged:[owner/repo]#、capacity_available: 或 resume_at:<带时区 RFC3339 时间>。`,"composer.clarifySingleAction":`这句话包含多个可能修改状态的操作。请一次描述一项操作,我会逐项展示确认预览。`,"composer.evidence":`查证据`,"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.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.validationRevision":`Validation revision`,"drawer.validationDigest":`Validation declaration digest`,"drawer.validationRevisionActor":`Revised by`,"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.subagentAppliedRestart":`Applied and verified. The raised Codex child-agent limit takes effect in new Sessions.`,"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.subagentExecutionConfig":`Delegation bindings`,"drawer.subagentExecutionConfigHint":`Optional repo-relative ignored JSON under .loopx/config/. Planning sees only authorized route status; the file remains the execution-grant owner.`,"drawer.subagentExecutionConfigNone":`Not configured`,"drawer.subagentMaxChildren":`Maximum child agents`,"drawer.subagentHostCapacityImplicit":`implicit default`,"drawer.subagentHostCapacityRaise":`Confirming also raises the Codex child-agent limit to at least {required} (currently {configured}). Existing higher values are preserved; new Sessions are required.`,"drawer.subagentHostCapacityReady":`Codex child-agent capacity ({configured}) already satisfies this Goal ({required}).`,"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.taskPriority":`Priority`,"drawer.taskPriorityChoose":`Choose priority`,"drawer.taskPriorityClear":`No priority`,"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 delivered files or verified reports yet. Run and validation status remain in Tasks.`,"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.overview":`Overview`,"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":`Configure this Goal’s capabilities`,"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.managerExecutorKindIndividual":`individual CLI login`,"header.managerExecutorKindManaged":`operator credential`,"header.managerExecutorKindRegistered":`registered endpoint`,"header.managerExecutionUnavailable":`Selected {executor} cannot start here; this channel does not fall back to an individual CLI login.`,"header.managerExecutionUnavailableCredential":`Selected {executor} needs the operator credential {credential} before this channel can start it.`,"header.managerExecutionUnavailableRuntime":`Selected {executor} cannot start here because its runtime is not installed on this machine.`,"header.managerExecutionUnavailableEffort":`Selected {executor} rejected the configured reasoning effort; set a supported effort and reload.`,"header.managerExecutionUnavailableOutputBudget":`Selected {executor} has an invalid per-request output-token limit; set a positive integer and reload.`,"header.managerEndpointStewardDefault":`Runs {executor}, the steward channel's shipped default. Select an executor explicitly to move it.`,"header.managerOutputTokenBudget":`{tokens} tok/request`,"header.managerAllocation":`Selection: {policy} · {reason}`,"header.managerSelectionPreferred":`preferred`,"header.managerSelectionPinned":`pinned`,"header.managerSelectionFlexible":`flexible pool`,"header.managerAllocationUser":`explicit user choice`,"header.managerAllocationPinned":`pinned by machine configuration`,"header.managerAllocationFallback":`primary unavailable; used an eligible fallback`,"header.managerAllocationUnavailable":`no eligible route is currently available`,"header.managerAllocationPrimary":`primary route is available`,"header.managerAllocationProductDefault":`product default`,"header.managerAllocationService":`service environment override`,"header.managerAllocationConfigured":`configured route`,"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.`,"drawer.recoverEditResult":`Recover operation result`,"drawer.retryOriginal":`Retry original operation`,"actionReview.canonical_update_retry":`The edit is not yet verified. Retry this operation to recover its result.`,"actionReview.canonical_update_projection_pending":`The operation was committed; display delivery is pending. Retry this operation to restore the current view.`,"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.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.teamPlan.gapReason.capabilityNotGranted":`Required capability not granted`,"proposal.teamPlan.gapReason.audienceNotAuthorized":`Required access not authorized`,"proposal.teamPlan.pending":`Pending`,"proposal.teamPlan.assignedHint":`Assignment recorded. See the Goal for execution progress.`,"proposal.teamPlan.recoveredHint":`No new tasks created. See the Goal for current progress.`,"proposal.teamPlan.originalPlan":`View original plan`,"proposal.teamPlan.viewResult":`View result`,"proposal.teamPlan.openGoal":`Open Goal`,"proposal.teamPlan.resultTitle":`Assignment result`,"proposal.teamPlan.retry":`Retry assignment`,"proposal.teamPlan.retryHint":`Retry this assignment to recover its result without duplicating tasks.`,"proposal.summary.teamPlan":`Assign {count} tasks for {goal}`,"proposal.impact.teamPlan":`Confirm to assign the ready tasks. Unavailable assignments stay pending.`,"proposal.primary.teamPlan":`Confirm assignment`,"proposal.field.laneGaps":`Unstaffed lanes`,"proposal.field.quotaEnvelope":`Quota envelope`,"proposal.teamPlan.acceptanceShort":`acceptance reference`,"proposal.teamPlan.advisory":`planning context; not enforced by this confirmation`,"proposal.teamPlan.appliedPartially":`{created} assigned · {gaps} pending`,"proposal.teamPlan.appliedAlreadyPresent":`Original assignment recovered`,"proposal.teamPlan.applied":`{count} tasks assigned`,"proposal.teamPlan.gapLane":`unstaffed`,"proposal.teamPlan.laneUnstaffed":`staffing gap, no first Todo`,"proposal.teamPlan.gapReason.agentNotRegistered":`the Agent is not registered for this Goal`,"proposal.teamPlan.gapReason.actionKindNotSupported":`this host does not ship that action kind`,"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.firstReadOnlyAdapterCheck":`Run the first read-only adapter check and save progress`,"projection.nextUpdatePending":`Waiting for LoopX to update the next step`,"projection.refreshState":`Refresh LoopX status and confirm the current progress is still valid`,"projection.statusRefreshNeeded":`LoopX status needs to be refreshed`,"projection.todoStatusUpdated":`Todo status updated; confirming the next step`,"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.credentialTitle":`Operator model credential`,"machine.credentialDescription":`The key and endpoint the steward channel and the managed host authenticate with on this machine. The key is stored in its own owner-only file, never in the machine configuration that is projected here, and it is never read back — only its fingerprint is.`,"machine.credentialApiKey":`API key`,"machine.credentialApiKeyPlaceholder":`Paste a key to store it; leave blank to keep the stored one`,"machine.credentialBaseUrl":`Endpoint base URL`,"machine.credentialBaseUrlPlaceholder":`https://endpoint.example/v1 (blank keeps the endpoint default)`,"machine.credentialStore":`Store credential`,"machine.credentialClearKey":`Clear stored key`,"machine.credentialClearUrl":`Clear stored endpoint`,"machine.credentialConfigured":`configured`,"machine.credentialAbsent":`not configured`,"machine.credentialInvalid":`unreadable — repair required`,"machine.credentialSourceMachine":`this machine's stored credential`,"machine.credentialSourceEnvironment":`the service environment`,"machine.credentialSourceUnset":`no source`,"machine.credentialFingerprint":`fingerprint`,"machine.credentialStored":`Credential stored. The next turn uses it; no restart is needed.`,"machine.credentialCleared":`Stored credential cleared.`,"machine.credentialError":`The credential could not be stored.`,"machine.credentialBoundary":`Storing a credential grants no authority: it does not select an executor, model, or reasoning effort.`,"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.larkInboxNotificationDescription":`This switch controls automatic group messages for human gates. Incoming Lark events remain available when it is off.`,"capabilities.larkInboxNotificationSetting":`Human-gate group notifications`,"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.hostCapacityPartialWrite":`Goal value saved; Codex host capacity still needs alignment`,"capabilities.hostCapacityPartialWriteDescription":`The Goal configuration and shared projection were verified, but the Codex host limit was not updated. Refresh the preview after repairing the host configuration; do not resubmit the Goal change.`,"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.modelProvider":`Model provider`,"settings.globalCapabilities":`Global capabilities`,"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":`New conversation reply`,"tasks.chatPending":`Conversation in progress`,"tasks.chatReturn":`Collaboration receipt`,"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":`Draft a 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.blockers":`看阻塞`,"composer.attachImageHint":`选择、粘贴或拖入图片`,"composer.clarifyDefer":`暂缓 Todo 需要可自动判断的恢复条件。请补充 todo_done:、pr_merged:[owner/repo]#、capacity_available: 或 resume_at:<带时区 RFC3339 时间>。`,"composer.clarifySingleAction":`这句话包含多个可能修改状态的操作。请一次描述一项操作,我会逐项展示确认预览。`,"composer.evidence":`查证据`,"composer.createGoal":`创建新 Goal`,"composer.createGoalDraft":`Goal 草稿`,"composer.createGoalDraftDescription":`补充内容后发送,LoopX 会先展示待确认操作。`,"composer.createGoalDraftLead":`我想创建一个长期 Goal:`,"composer.createGoalTemplate":`我想创建一个长期 Goal: 目标: 完成标准: 执行边界(可选): @@ -50,7 +50,7 @@ Goal: Goal: 频率:每天 停止条件:Goal 完成 -通知:仅在需要我时`,"composer.nextAction":`询问下一步`,"composer.nextActionPrompt":`我现在该做什么?`,"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.validationRevision":`验证声明修订`,"drawer.validationDigest":`验证声明摘要`,"drawer.validationRevisionActor":`修订者`,"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.subagentAppliedRestart":`已写入并完成读回校验;提升后的 Codex 子 Agent 上限将在新 Session 中生效。`,"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.subagentExecutionConfig":`委托执行绑定`,"drawer.subagentExecutionConfigHint":`可选;填写 .loopx/config/ 下仓库相对、已忽略的 JSON。规划只读取已授权路由状态,执行授权仍由该文件持有。`,"drawer.subagentExecutionConfigNone":`未配置`,"drawer.subagentMaxChildren":`最多子代理数`,"drawer.subagentHostCapacityImplicit":`隐式默认值`,"drawer.subagentHostCapacityRaise":`确认后还会把 Codex 子 Agent 上限从当前 {configured} 提升到至少 {required};已有更高值不会降低,并需新建 Session 生效。`,"drawer.subagentHostCapacityReady":`Codex 子 Agent 容量({configured})已满足该 Goal({required})。`,"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.taskPriority":`优先级`,"drawer.taskPriorityChoose":`选择优先级`,"drawer.taskPriorityClear":`不设优先级`,"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.overview":`概览`,"header.chat":`对话`,"header.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.managerExecutorKindIndividual":`个人 CLI 登录`,"header.managerExecutorKindManaged":`operator 凭据`,"header.managerExecutorKindRegistered":`注册端点`,"header.managerExecutionUnavailable":`所选执行器 {executor} 无法在本机启动;该通道不会回落到个人 CLI 登录。`,"header.managerExecutionUnavailableCredential":`所选执行器 {executor} 需要 operator 凭据 {credential},配置后该通道才能启动它。`,"header.managerExecutionUnavailableRuntime":`所选执行器 {executor} 无法在本机启动:本机未安装其 runtime。`,"header.managerExecutionUnavailableEffort":`所选执行器 {executor} 拒绝了当前配置的推理档位;请改为受支持的档位后刷新。`,"header.managerExecutionUnavailableOutputBudget":`所选执行器 {executor} 的每请求输出 token 上限无效;请设置为正整数后刷新。`,"header.managerEndpointStewardDefault":`当前运行 {executor},管家通道的出货默认值;如需改指请显式选择执行器。`,"header.managerOutputTokenBudget":`每次请求 {tokens} token`,"header.managerAllocation":`选择:{policy} · {reason}`,"header.managerSelectionPreferred":`偏好`,"header.managerSelectionPinned":`锁定`,"header.managerSelectionFlexible":`灵活资源池`,"header.managerAllocationUser":`用户明确选择`,"header.managerAllocationPinned":`由本机配置锁定`,"header.managerAllocationFallback":`首选不可用,使用池内合格替代`,"header.managerAllocationUnavailable":`当前没有可用的合格路径`,"header.managerAllocationPrimary":`首选路径可用`,"header.managerAllocationProductDefault":`产品默认路径`,"header.managerAllocationService":`服务环境覆盖`,"header.managerAllocationConfigured":`按已配置路径`,"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":`任务`,"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":`操作结果已经记录,但原群结果卡尚未通过回读核验。`,"drawer.recoverEditResult":`恢复操作结果`,"drawer.retryOriginal":`重试原操作`,"actionReview.canonical_update_retry":`编辑结果尚未确认。重试此操作以恢复原结果。`,"actionReview.canonical_update_projection_pending":`操作已提交,展示尚未同步。重试此操作以恢复当前视图。`,"actionReview.apply_failed":`执行未完成。请检查失败原因并重新生成预览后再试。`,"actionReview.inactive_proposal":`此提案当前不可执行。请重新检查后再继续。`,"proposal.gate.default":`需要宿主确认`,"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.teamPlan.gapReason.capabilityNotGranted":`尚未授予所需能力`,"proposal.teamPlan.gapReason.audienceNotAuthorized":`尚未获得所需访问权限`,"proposal.teamPlan.pending":`待安排`,"proposal.teamPlan.assignedHint":`分配已记录,执行进度请查看目标。`,"proposal.teamPlan.recoveredHint":`未新增任务,当前进度请查看目标。`,"proposal.teamPlan.originalPlan":`查看原计划`,"proposal.teamPlan.viewResult":`查看结果`,"proposal.teamPlan.openGoal":`打开目标`,"proposal.teamPlan.resultTitle":`分配结果`,"proposal.teamPlan.retry":`重试分配`,"proposal.teamPlan.retryHint":`重试会恢复本次分配结果,不会重复创建任务。`,"proposal.summary.teamPlan":`为 {goal} 分配 {count} 项任务`,"proposal.impact.teamPlan":`确认后分配可安排的任务,其余保留为待安排。`,"proposal.primary.teamPlan":`确认分配`,"proposal.field.laneGaps":`未配齐的 lane`,"proposal.field.quotaEnvelope":`配额包络`,"proposal.teamPlan.acceptanceShort":`验收参考`,"proposal.teamPlan.advisory":`计划参考;本次确认不执行该约束`,"proposal.teamPlan.appliedPartially":`已分配 {created} 项,{gaps} 项待安排`,"proposal.teamPlan.appliedAlreadyPresent":`已恢复原分配结果`,"proposal.teamPlan.applied":`已分配 {count} 项任务`,"proposal.teamPlan.gapLane":`待安排`,"proposal.teamPlan.laneUnstaffed":`待安排,尚无任务`,"proposal.teamPlan.gapReason.agentNotRegistered":`尚未加入此目标`,"proposal.teamPlan.gapReason.actionKindNotSupported":`当前环境不支持此任务类型`,"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.credentialTitle":`操作者模型凭据`,"machine.credentialDescription":`管家通道与托管宿主在本机认证用的 key 与 endpoint。key 单独存放于仅属主可读的文件,不会进入这里展示的机器配置,也不会被回读——回读的是它的指纹。`,"machine.credentialApiKey":`API key`,"machine.credentialApiKeyPlaceholder":`粘贴 key 以保存;留空则保留已存的 key`,"machine.credentialBaseUrl":`Endpoint base URL`,"machine.credentialBaseUrlPlaceholder":`https://endpoint.example/v1(留空则使用 endpoint 默认值)`,"machine.credentialStore":`保存凭据`,"machine.credentialClearKey":`清除已存 key`,"machine.credentialClearUrl":`清除已存 endpoint`,"machine.credentialConfigured":`已配置`,"machine.credentialAbsent":`未配置`,"machine.credentialInvalid":`无法读取——需要修复`,"machine.credentialSourceMachine":`本机已存凭据`,"machine.credentialSourceEnvironment":`服务环境变量`,"machine.credentialSourceUnset":`无来源`,"machine.credentialFingerprint":`指纹`,"machine.credentialStored":`凭据已保存。下一轮即生效,无需重启。`,"machine.credentialCleared":`已清除本机存储的凭据。`,"machine.credentialError":`凭据保存失败。`,"machine.credentialBoundary":`保存凭据不授予任何权限:它不会选择执行器、模型或推理强度。`,"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.larkInboxNotificationDescription":`此开关只控制遇到人工 Gate 时是否自动发群消息;关闭后仍会保留飞书事件收件箱能力。`,"capabilities.larkInboxNotificationSetting":`Gate 群通知`,"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.hostCapacityPartialWrite":`Goal 值已保存;Codex 宿主容量仍待对齐`,"capabilities.hostCapacityPartialWriteDescription":`Goal 配置与共享投影均已校验,但 Codex 宿主上限尚未更新。修复宿主配置后请重新预览容量对齐,不要重复提交 Goal 变更。`,"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.modelProvider":`模型 Provider 配置`,"settings.globalCapabilities":`全局能力配置`,"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":`对话有新回复`,"tasks.chatPending":`对话处理中`,"tasks.chatReturn":`协作回执`,"tasks.chatPendingDescription":`正在处理;只有经过确认的任务操作才会更新 Tasks。`,"tasks.chatRecent":`最近对话`,"tasks.chatUnchangedDescription":`本次对话没有直接修改 Tasks。需要执行时,可先转成 Task 草稿并确认。`,"tasks.chatViewReply":`查看回复`,"tasks.convertToTask":`转为任务草稿`,"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 Gi(e,t){return t?Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e):e}function Ki(){try{return window.localStorage.getItem(`loopx-pw-locale`)===`en`?`en`:`zh-CN`}catch{return`zh-CN`}}function qi({children:e}){let[t,n]=(0,R.useState)(Ki);function r(e){n(e);try{window.localStorage.setItem(Ui,e)}catch{}}(0,R.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,R.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Gi(Wi[t][e],n)}),[t]);return(0,z.jsx)(Hi.Provider,{value:i,children:e})}function Ji(){let e=(0,R.useContext)(Hi);if(!e)throw Error(`useWorkspaceI18n must be used within WorkspaceI18nProvider`);return e}function Yi(e,t){let n={安静运行:`state.quiet`,等你:`state.needsYou`,等待条件:`state.waiting`,推进中:`state.running`,需修复:`state.needsRepair`,已完成:`state.completed`,已停止:`state.stopped`}[e];return n?Wi[t][n]:e}function Xi(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 Zi(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 Qi;function H(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 $i=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ea=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Qi=globalThis).__zod_globalConfig??(Qi.__zod_globalConfig={});var ta=globalThis.__zod_globalConfig;function na(e){return e&&Object.assign(ta,e),ta}function ra(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 ia(e,t){return typeof t==`bigint`?t.toString():t}function aa(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function oa(e){return e==null}function sa(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ca(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 ga(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var _a=aa(()=>{if(ta.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function va(e){if(ga(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ga(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ya(e){return va(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ba=new Set([`string`,`number`,`symbol`]);function xa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Sa(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function U(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 Ca(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var wa={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ta(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 Sa(e,fa(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 da(this,`shape`,e),e},checks:[]}))}function Ea(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 Sa(e,fa(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 da(this,`shape`,r),r},checks:[]}))}function Da(e,t){if(!va(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 Sa(e,fa(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return da(this,`shape`,n),n}}))}function Oa(e,t){if(!va(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Sa(e,fa(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return da(this,`shape`,n),n}}))}function ka(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Sa(e,fa(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return da(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Aa(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 Sa(t,fa(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 da(this,`shape`,i),i},checks:[]}))}function ja(e,t,n){return Sa(t,fa(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 da(this,`shape`,i),i}}))}function Ma(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 Fa(e){return typeof e==`string`?e:e?.message}function Ia(e,t,n){let r=e.message?e.message:Fa(e.inst?._zod.def?.error?.(e))??Fa(t?.error?.(e))??Fa(n.customError?.(e))??Fa(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 La(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ra(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var za=(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,ia,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ba=H(`$ZodError`,za),Va=H(`$ZodError`,za,{Parent:Error});function Ha(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 Ua(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 $i;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ia(e,a,na())));throw ha(t,i?.callee),t}return o.value},Ga=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=>Ia(e,a,na())));throw ha(t,i?.callee),t}return o.value},Ka=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 $i;return a.issues.length?{success:!1,error:new(e??Ba)(a.issues.map(e=>Ia(e,i,na())))}:{success:!0,data:a.value}},qa=Ka(Va),Ja=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=>Ia(e,i,na())))}:{success:!0,data:a.value}},Ya=Ja(Va),Xa=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Wa(e)(t,n,i)},Za=e=>(t,n,r)=>Wa(e)(t,n,r),Qa=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ga(e)(t,n,i)},$a=e=>async(t,n,r)=>Ga(e)(t,n,r),eo=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ka(e)(t,n,i)},to=e=>(t,n,r)=>Ka(e)(t,n,r),no=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ja(e)(t,n,i)},ro=e=>async(t,n,r)=>Ja(e)(t,n,r),io=/^[cC][0-9a-z]{6,}$/,ao=/^[0-9a-z]+$/,oo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,so=/^[0-9a-vA-V]{20}$/,co=/^[A-Za-z0-9]{27}$/,lo=/^[a-zA-Z0-9_-]{21}$/,uo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fo=/^([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})$/,po=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)$/,mo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ho=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function go(){return new RegExp(ho,`u`)}var _o=/^(?:(?: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])$/,vo=/^(([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}|:))$/,yo=/^((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])$/,bo=/^(([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])$/,xo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,So=/^[A-Za-z0-9_-]*$/,Co=/^https?$/,wo=/^\+[1-9]\d{6,14}$/,To=`(?:(?:\\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])))`,Eo=RegExp(`^${To}$`);function Do(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 Oo(e){return RegExp(`^${Do(e)}$`)}function ko(e){let t=Do({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(`^${To}T(?:${r})$`)}var Ao=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},jo=/^-?\d+$/,Mo=/^-?\d+(?:\.\d+)?$/,No=/^(?:true|false)$/i,Po=/^null$/i,Fo=/^[^A-Z]*$/,Io=/^[^a-z]*$/,Lo=H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ro={number:`number`,bigint:`bigint`,object:`date`},zo=H(`$ZodCheckLessThan`,(e,t)=>{Lo.init(e,t);let n=Ro[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{Lo.init(e,t);let n=Ro[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})}}),Vo=H(`$ZodCheckMultipleOf`,(e,t)=>{Lo.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):ca(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})}}),Ho=H(`$ZodCheckNumberFormat`,(e,t)=>{Lo.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=wa[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=jo)}),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})}}),Uo=H(`$ZodCheckMaxLength`,(e,t)=>{var n;Lo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!oa(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=La(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wo=H(`$ZodCheckMinLength`,(e,t)=>{var n;Lo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!oa(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=La(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Go=H(`$ZodCheckLengthEquals`,(e,t)=>{var n;Lo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!oa(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=La(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})}}),Ko=H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Lo.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=()=>{})}),qo=H(`$ZodCheckRegex`,(e,t)=>{Ko.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})}}),Jo=H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Fo,Ko.init(e,t)}),Yo=H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Io,Ko.init(e,t)}),Xo=H(`$ZodCheckIncludes`,(e,t)=>{Lo.init(e,t);let n=xa(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})}}),Zo=H(`$ZodCheckStartsWith`,(e,t)=>{Lo.init(e,t);let n=RegExp(`^${xa(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})}}),Qo=H(`$ZodCheckEndsWith`,(e,t)=>{Lo.init(e,t);let n=RegExp(`.*${xa(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})}}),$o=H(`$ZodCheckOverwrite`,(e,t)=>{Lo.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),es=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.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.validationRevision":`验证声明修订`,"drawer.validationDigest":`验证声明摘要`,"drawer.validationRevisionActor":`修订者`,"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.subagentAppliedRestart":`已写入并完成读回校验;提升后的 Codex 子 Agent 上限将在新 Session 中生效。`,"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.subagentExecutionConfig":`委托执行绑定`,"drawer.subagentExecutionConfigHint":`可选;填写 .loopx/config/ 下仓库相对、已忽略的 JSON。规划只读取已授权路由状态,执行授权仍由该文件持有。`,"drawer.subagentExecutionConfigNone":`未配置`,"drawer.subagentMaxChildren":`最多子代理数`,"drawer.subagentHostCapacityImplicit":`隐式默认值`,"drawer.subagentHostCapacityRaise":`确认后还会把 Codex 子 Agent 上限从当前 {configured} 提升到至少 {required};已有更高值不会降低,并需新建 Session 生效。`,"drawer.subagentHostCapacityReady":`Codex 子 Agent 容量({configured})已满足该 Goal({required})。`,"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.taskPriority":`优先级`,"drawer.taskPriorityChoose":`选择优先级`,"drawer.taskPriorityClear":`不设优先级`,"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.overview":`概览`,"header.chat":`对话`,"header.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.managerExecutorKindIndividual":`个人 CLI 登录`,"header.managerExecutorKindManaged":`operator 凭据`,"header.managerExecutorKindRegistered":`注册端点`,"header.managerExecutionUnavailable":`所选执行器 {executor} 无法在本机启动;该通道不会回落到个人 CLI 登录。`,"header.managerExecutionUnavailableCredential":`所选执行器 {executor} 需要 operator 凭据 {credential},配置后该通道才能启动它。`,"header.managerExecutionUnavailableRuntime":`所选执行器 {executor} 无法在本机启动:本机未安装其 runtime。`,"header.managerExecutionUnavailableEffort":`所选执行器 {executor} 拒绝了当前配置的推理档位;请改为受支持的档位后刷新。`,"header.managerExecutionUnavailableOutputBudget":`所选执行器 {executor} 的每请求输出 token 上限无效;请设置为正整数后刷新。`,"header.managerEndpointStewardDefault":`当前运行 {executor},管家通道的出货默认值;如需改指请显式选择执行器。`,"header.managerOutputTokenBudget":`每次请求 {tokens} token`,"header.managerAllocation":`选择:{policy} · {reason}`,"header.managerSelectionPreferred":`偏好`,"header.managerSelectionPinned":`锁定`,"header.managerSelectionFlexible":`灵活资源池`,"header.managerAllocationUser":`用户明确选择`,"header.managerAllocationPinned":`由本机配置锁定`,"header.managerAllocationFallback":`首选不可用,使用池内合格替代`,"header.managerAllocationUnavailable":`当前没有可用的合格路径`,"header.managerAllocationPrimary":`首选路径可用`,"header.managerAllocationProductDefault":`产品默认路径`,"header.managerAllocationService":`服务环境覆盖`,"header.managerAllocationConfigured":`按已配置路径`,"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":`任务`,"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":`操作结果已经记录,但原群结果卡尚未通过回读核验。`,"drawer.recoverEditResult":`恢复操作结果`,"drawer.retryOriginal":`重试原操作`,"actionReview.canonical_update_retry":`编辑结果尚未确认。重试此操作以恢复原结果。`,"actionReview.canonical_update_projection_pending":`操作已提交,展示尚未同步。重试此操作以恢复当前视图。`,"actionReview.apply_failed":`执行未完成。请检查失败原因并重新生成预览后再试。`,"actionReview.inactive_proposal":`此提案当前不可执行。请重新检查后再继续。`,"proposal.gate.default":`需要宿主确认`,"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.teamPlan.gapReason.capabilityNotGranted":`尚未授予所需能力`,"proposal.teamPlan.gapReason.audienceNotAuthorized":`尚未获得所需访问权限`,"proposal.teamPlan.pending":`待安排`,"proposal.teamPlan.assignedHint":`分配已记录,执行进度请查看目标。`,"proposal.teamPlan.recoveredHint":`未新增任务,当前进度请查看目标。`,"proposal.teamPlan.originalPlan":`查看原计划`,"proposal.teamPlan.viewResult":`查看结果`,"proposal.teamPlan.openGoal":`打开目标`,"proposal.teamPlan.resultTitle":`分配结果`,"proposal.teamPlan.retry":`重试分配`,"proposal.teamPlan.retryHint":`重试会恢复本次分配结果,不会重复创建任务。`,"proposal.summary.teamPlan":`为 {goal} 分配 {count} 项任务`,"proposal.impact.teamPlan":`确认后分配可安排的任务,其余保留为待安排。`,"proposal.primary.teamPlan":`确认分配`,"proposal.field.laneGaps":`未配齐的 lane`,"proposal.field.quotaEnvelope":`配额包络`,"proposal.teamPlan.acceptanceShort":`验收参考`,"proposal.teamPlan.advisory":`计划参考;本次确认不执行该约束`,"proposal.teamPlan.appliedPartially":`已分配 {created} 项,{gaps} 项待安排`,"proposal.teamPlan.appliedAlreadyPresent":`已恢复原分配结果`,"proposal.teamPlan.applied":`已分配 {count} 项任务`,"proposal.teamPlan.gapLane":`待安排`,"proposal.teamPlan.laneUnstaffed":`待安排,尚无任务`,"proposal.teamPlan.gapReason.agentNotRegistered":`尚未加入此目标`,"proposal.teamPlan.gapReason.actionKindNotSupported":`当前环境不支持此任务类型`,"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.firstReadOnlyAdapterCheck":`执行首次只读适配检查并保存进度`,"projection.nextUpdatePending":`等待 LoopX 更新下一步`,"projection.refreshState":`刷新 LoopX 状态,确认当前进度仍然有效`,"projection.statusRefreshNeeded":`LoopX 状态需要刷新`,"projection.todoStatusUpdated":`Todo 状态已经更新,正在确认下一步`,"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.credentialTitle":`操作者模型凭据`,"machine.credentialDescription":`管家通道与托管宿主在本机认证用的 key 与 endpoint。key 单独存放于仅属主可读的文件,不会进入这里展示的机器配置,也不会被回读——回读的是它的指纹。`,"machine.credentialApiKey":`API key`,"machine.credentialApiKeyPlaceholder":`粘贴 key 以保存;留空则保留已存的 key`,"machine.credentialBaseUrl":`Endpoint base URL`,"machine.credentialBaseUrlPlaceholder":`https://endpoint.example/v1(留空则使用 endpoint 默认值)`,"machine.credentialStore":`保存凭据`,"machine.credentialClearKey":`清除已存 key`,"machine.credentialClearUrl":`清除已存 endpoint`,"machine.credentialConfigured":`已配置`,"machine.credentialAbsent":`未配置`,"machine.credentialInvalid":`无法读取——需要修复`,"machine.credentialSourceMachine":`本机已存凭据`,"machine.credentialSourceEnvironment":`服务环境变量`,"machine.credentialSourceUnset":`无来源`,"machine.credentialFingerprint":`指纹`,"machine.credentialStored":`凭据已保存。下一轮即生效,无需重启。`,"machine.credentialCleared":`已清除本机存储的凭据。`,"machine.credentialError":`凭据保存失败。`,"machine.credentialBoundary":`保存凭据不授予任何权限:它不会选择执行器、模型或推理强度。`,"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.larkInboxNotificationDescription":`此开关只控制遇到人工 Gate 时是否自动发群消息;关闭后仍会保留飞书事件收件箱能力。`,"capabilities.larkInboxNotificationSetting":`Gate 群通知`,"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.hostCapacityPartialWrite":`Goal 值已保存;Codex 宿主容量仍待对齐`,"capabilities.hostCapacityPartialWriteDescription":`Goal 配置与共享投影均已校验,但 Codex 宿主上限尚未更新。修复宿主配置后请重新预览容量对齐,不要重复提交 Goal 变更。`,"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.modelProvider":`模型 Provider 配置`,"settings.globalCapabilities":`全局能力配置`,"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":`对话有新回复`,"tasks.chatPending":`对话处理中`,"tasks.chatReturn":`协作回执`,"tasks.chatPendingDescription":`正在处理;只有经过确认的任务操作才会更新 Tasks。`,"tasks.chatRecent":`最近对话`,"tasks.chatUnchangedDescription":`本次对话没有直接修改 Tasks。需要执行时,可先转成 Task 草稿并确认。`,"tasks.chatViewReply":`查看回复`,"tasks.convertToTask":`转为任务草稿`,"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 Gi(e,t){return t?Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e):e}function Ki(){try{return window.localStorage.getItem(`loopx-pw-locale`)===`en`?`en`:`zh-CN`}catch{return`zh-CN`}}function qi({children:e}){let[t,n]=(0,R.useState)(Ki);function r(e){n(e);try{window.localStorage.setItem(Ui,e)}catch{}}(0,R.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,R.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Gi(Wi[t][e],n)}),[t]);return(0,z.jsx)(Hi.Provider,{value:i,children:e})}function Ji(){let e=(0,R.useContext)(Hi);if(!e)throw Error(`useWorkspaceI18n must be used within WorkspaceI18nProvider`);return e}function Yi(e,t){let n={安静运行:`state.quiet`,等你:`state.needsYou`,等待条件:`state.waiting`,推进中:`state.running`,需修复:`state.needsRepair`,已完成:`state.completed`,已停止:`state.stopped`}[e];return n?Wi[t][n]:e}function Xi(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 Zi(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 Qi;function H(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 $i=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ea=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Qi=globalThis).__zod_globalConfig??(Qi.__zod_globalConfig={});var ta=globalThis.__zod_globalConfig;function na(e){return e&&Object.assign(ta,e),ta}function ra(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 ia(e,t){return typeof t==`bigint`?t.toString():t}function aa(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function oa(e){return e==null}function sa(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ca(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 ga(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var _a=aa(()=>{if(ta.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function va(e){if(ga(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ga(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ya(e){return va(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ba=new Set([`string`,`number`,`symbol`]);function xa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Sa(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function U(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 Ca(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var wa={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ta(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 Sa(e,fa(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 da(this,`shape`,e),e},checks:[]}))}function Ea(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 Sa(e,fa(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 da(this,`shape`,r),r},checks:[]}))}function Da(e,t){if(!va(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 Sa(e,fa(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return da(this,`shape`,n),n}}))}function Oa(e,t){if(!va(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Sa(e,fa(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return da(this,`shape`,n),n}}))}function ka(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Sa(e,fa(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return da(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Aa(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 Sa(t,fa(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 da(this,`shape`,i),i},checks:[]}))}function ja(e,t,n){return Sa(t,fa(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 da(this,`shape`,i),i}}))}function Ma(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 Fa(e){return typeof e==`string`?e:e?.message}function Ia(e,t,n){let r=e.message?e.message:Fa(e.inst?._zod.def?.error?.(e))??Fa(t?.error?.(e))??Fa(n.customError?.(e))??Fa(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 La(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ra(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var za=(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,ia,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ba=H(`$ZodError`,za),Va=H(`$ZodError`,za,{Parent:Error});function Ha(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 Ua(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 $i;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ia(e,a,na())));throw ha(t,i?.callee),t}return o.value},Ga=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=>Ia(e,a,na())));throw ha(t,i?.callee),t}return o.value},Ka=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 $i;return a.issues.length?{success:!1,error:new(e??Ba)(a.issues.map(e=>Ia(e,i,na())))}:{success:!0,data:a.value}},qa=Ka(Va),Ja=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=>Ia(e,i,na())))}:{success:!0,data:a.value}},Ya=Ja(Va),Xa=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Wa(e)(t,n,i)},Za=e=>(t,n,r)=>Wa(e)(t,n,r),Qa=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ga(e)(t,n,i)},$a=e=>async(t,n,r)=>Ga(e)(t,n,r),eo=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ka(e)(t,n,i)},to=e=>(t,n,r)=>Ka(e)(t,n,r),no=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ja(e)(t,n,i)},ro=e=>async(t,n,r)=>Ja(e)(t,n,r),io=/^[cC][0-9a-z]{6,}$/,ao=/^[0-9a-z]+$/,oo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,so=/^[0-9a-vA-V]{20}$/,co=/^[A-Za-z0-9]{27}$/,lo=/^[a-zA-Z0-9_-]{21}$/,uo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fo=/^([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})$/,po=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)$/,mo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ho=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function go(){return new RegExp(ho,`u`)}var _o=/^(?:(?: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])$/,vo=/^(([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}|:))$/,yo=/^((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])$/,bo=/^(([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])$/,xo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,So=/^[A-Za-z0-9_-]*$/,Co=/^https?$/,wo=/^\+[1-9]\d{6,14}$/,To=`(?:(?:\\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])))`,Eo=RegExp(`^${To}$`);function Do(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 Oo(e){return RegExp(`^${Do(e)}$`)}function ko(e){let t=Do({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(`^${To}T(?:${r})$`)}var Ao=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},jo=/^-?\d+$/,Mo=/^-?\d+(?:\.\d+)?$/,No=/^(?:true|false)$/i,Po=/^null$/i,Fo=/^[^A-Z]*$/,Io=/^[^a-z]*$/,Lo=H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ro={number:`number`,bigint:`bigint`,object:`date`},zo=H(`$ZodCheckLessThan`,(e,t)=>{Lo.init(e,t);let n=Ro[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{Lo.init(e,t);let n=Ro[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})}}),Vo=H(`$ZodCheckMultipleOf`,(e,t)=>{Lo.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):ca(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})}}),Ho=H(`$ZodCheckNumberFormat`,(e,t)=>{Lo.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=wa[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=jo)}),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})}}),Uo=H(`$ZodCheckMaxLength`,(e,t)=>{var n;Lo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!oa(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=La(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wo=H(`$ZodCheckMinLength`,(e,t)=>{var n;Lo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!oa(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=La(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Go=H(`$ZodCheckLengthEquals`,(e,t)=>{var n;Lo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!oa(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=La(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})}}),Ko=H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Lo.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=()=>{})}),qo=H(`$ZodCheckRegex`,(e,t)=>{Ko.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})}}),Jo=H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Fo,Ko.init(e,t)}),Yo=H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Io,Ko.init(e,t)}),Xo=H(`$ZodCheckIncludes`,(e,t)=>{Lo.init(e,t);let n=xa(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})}}),Zo=H(`$ZodCheckStartsWith`,(e,t)=>{Lo.init(e,t);let n=RegExp(`^${xa(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})}}),Qo=H(`$ZodCheckEndsWith`,(e,t)=>{Lo.init(e,t);let n=RegExp(`.*${xa(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})}}),$o=H(`$ZodCheckOverwrite`,(e,t)=>{Lo.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),es=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(` `))}},ts={major:4,minor:4,patch:3},ns=H(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ts;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=Ma(e),i;for(let a of t){if(a._zod.def.when){if(Na(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 $i;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Ma(e,t))});else{if(e.issues.length===t)continue;r||=Ma(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Ma(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new $i;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 $i;return o.then(e=>t(e,r,a))}return t(o,r,a)}}ua(e,`~standard`,()=>({validate:t=>{try{let n=qa(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ya(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),rs=H(`$ZodString`,(e,t)=>{ns.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ao(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}}),is=H(`$ZodStringFormat`,(e,t)=>{Ko.init(e,t),rs.init(e,t)}),as=H(`$ZodGUID`,(e,t)=>{t.pattern??=fo,is.init(e,t)}),os=H(`$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??=po(e)}else t.pattern??=po();is.init(e,t)}),ss=H(`$ZodEmail`,(e,t)=>{t.pattern??=mo,is.init(e,t)}),cs=H(`$ZodURL`,(e,t)=>{is.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Co.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})}}}),ls=H(`$ZodEmoji`,(e,t)=>{t.pattern??=go(),is.init(e,t)}),us=H(`$ZodNanoID`,(e,t)=>{t.pattern??=lo,is.init(e,t)}),ds=H(`$ZodCUID`,(e,t)=>{t.pattern??=io,is.init(e,t)}),fs=H(`$ZodCUID2`,(e,t)=>{t.pattern??=ao,is.init(e,t)}),ps=H(`$ZodULID`,(e,t)=>{t.pattern??=oo,is.init(e,t)}),ms=H(`$ZodXID`,(e,t)=>{t.pattern??=so,is.init(e,t)}),hs=H(`$ZodKSUID`,(e,t)=>{t.pattern??=co,is.init(e,t)}),gs=H(`$ZodISODateTime`,(e,t)=>{t.pattern??=ko(t),is.init(e,t)}),_s=H(`$ZodISODate`,(e,t)=>{t.pattern??=Eo,is.init(e,t)}),vs=H(`$ZodISOTime`,(e,t)=>{t.pattern??=Oo(t),is.init(e,t)}),ys=H(`$ZodISODuration`,(e,t)=>{t.pattern??=uo,is.init(e,t)}),bs=H(`$ZodIPv4`,(e,t)=>{t.pattern??=_o,is.init(e,t),e._zod.bag.format=`ipv4`}),xs=H(`$ZodIPv6`,(e,t)=>{t.pattern??=vo,is.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})}}}),Ss=H(`$ZodCIDRv4`,(e,t)=>{t.pattern??=yo,is.init(e,t)}),Cs=H(`$ZodCIDRv6`,(e,t)=>{t.pattern??=bo,is.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 ws(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Ts=H(`$ZodBase64`,(e,t)=>{t.pattern??=xo,is.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{ws(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Es(e){if(!So.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ws(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Ds=H(`$ZodBase64URL`,(e,t)=>{t.pattern??=So,is.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Es(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Os=H(`$ZodE164`,(e,t)=>{t.pattern??=wo,is.init(e,t)});function ks(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 As=H(`$ZodJWT`,(e,t)=>{is.init(e,t),e._zod.check=n=>{ks(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),js=H(`$ZodNumber`,(e,t)=>{ns.init(e,t),e._zod.pattern=e._zod.bag.pattern??Mo,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}}),Ms=H(`$ZodNumberFormat`,(e,t)=>{Ho.init(e,t),js.init(e,t)}),Ns=H(`$ZodBoolean`,(e,t)=>{ns.init(e,t),e._zod.pattern=No,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}}),Ps=H(`$ZodNull`,(e,t)=>{ns.init(e,t),e._zod.pattern=Po,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}}),Fs=H(`$ZodUnknown`,(e,t)=>{ns.init(e,t),e._zod.parse=e=>e}),Is=H(`$ZodNever`,(e,t)=>{ns.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Ls(e,t,n){e.issues.length&&t.issues.push(...Pa(n,e.issues)),t.value[n]=e.value}var Rs=H(`$ZodArray`,(e,t)=>{ns.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;eLs(t,n,e))):Ls(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function zs(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Pa(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 Bs(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=Ca(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Vs(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=>zs(e,n,i,t,u,d))):zs(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 Hs=H(`$ZodObject`,(e,t)=>{if(ns.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=aa(()=>Bs(t));ua(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=ga,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=>zs(n,t,e,s,r,i))):zs(a,t,e,s,r,i)}return i?Vs(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Us=H(`$ZodObjectJIT`,(e,t)=>{Hs.init(e,t);let n=e._zod.parse,r=aa(()=>Bs(t)),i=e=>{let t=new es([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=pa(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=pa(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) { @@ -130,12 +130,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs. `)};S.current=r,_(!0),y(``);try{let t=await Sg(e,r.text,`inbox`,r.id);x({id:r.id,status:t.status})}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}let E=b?i.find(e=>e.client_ingress_id===b.id)?.status??b.status:``,D=E===`pending`?n?`已进入协调员收件箱,等待读取`:`In the coordinator inbox; awaiting read`:E===`delivered`?n?`已交给协调员;尚无应用回执`:`Delivered to coordinator; application not confirmed`:n?`投递状态待核实`:`Delivery requires reconciliation`;return(0,z.jsxs)(`section`,{className:`goal-team-evidence`,"aria-label":n?`执行证据`:`Execution evidence`,"aria-busy":u,children:[(0,z.jsxs)(`div`,{className:`goal-team-work-actions`,children:[(0,z.jsx)(`h3`,{children:n?`执行证据`:`Execution evidence`}),(0,z.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>void w(),children:n?`重新读取证据`:`Recheck evidence`})]}),u?(0,z.jsx)(`p`,{role:`status`,children:n?`正在核验绑定、验收与文件…`:`Checking bindings, acceptance and files…`}):null,f?(0,z.jsxs)(`p`,{role:`alert`,children:[n?`无法核验,已清除上次证据。`:`Cannot verify; previous evidence cleared.`,` `,f]}):null,o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{role:`status`,children:[(0,z.jsxs)(`strong`,{children:[o.agent_id,` · `,vg(o,n)]}),` · `,c]}),(0,z.jsx)(`p`,{children:n?`按需读取的当前观察,不是持续在线状态;验收不代表协调员已采用。`:`An on-demand observation, not continuous liveness; acceptance does not establish coordinator adoption.`}),(0,z.jsx)(Ob,{sessionId:e,result:o,zh:n}),(0,z.jsx)(mb,{result:o,zh:n,onInspect:a}),o.error?(0,z.jsx)(`p`,{role:`alert`,children:o.error}):null,o.status===`accepted`&&!o.error&&!o.recovery_required&&o.artifacts?.length?o.artifacts.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(Db,{artifact:e,zh:n}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n?`版本与来源标识`:`Version and source identifiers`}),(0,z.jsx)(`code`,{children:t}),(0,z.jsx)(`code`,{children:o.request_id}),(0,z.jsx)(`code`,{children:o.todo_id})]})]},`${e.ref}:${e.sha256}`)):(0,z.jsx)(`p`,{children:n?`本次读取没有可展示的已验收产物。`:`No accepted artifact is available in this readback.`}),(0,z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),T()},children:[(0,z.jsxs)(`label`,{children:[n?`向协调员反馈此执行`:`Send feedback about this execution`,(0,z.jsx)(`textarea`,{value:m,maxLength:6e3,rows:3,disabled:!!S.current,onChange:e=>h(e.target.value)})]}),(0,z.jsx)(`p`,{children:n?`附上执行标识及当前产物版本,交给原协调员收件箱;不会直接改写任务或中断成员。`:`Includes the operation and observed artifact versions in the original coordinator inbox; does not change tasks or interrupt members.`}),r?null:(0,z.jsx)(`p`,{children:n?`协调员未在执行或当前观察不可用;恢复执行后可发送。`:`Coordinator inactive or observation unavailable; resume execution to send.`}),(0,z.jsx)(`button`,{type:`submit`,disabled:!r||g||!!b||!m.trim(),children:g?n?`正在投递…`:`Sending…`:v?n?`重试同一条反馈`:`Retry this feedback`:n?`发送反馈`:`Send feedback`})]})]}):null,v?(0,z.jsxs)(`p`,{role:`alert`,children:[n?`未确认投递,请重试同一条反馈,避免重复发送。`:`Delivery not confirmed; retry the same feedback to avoid duplicates.`,` `,v]}):null,b?(0,z.jsx)(`p`,{role:`status`,children:D}):null]})}var Ab={authority_unavailable:{en:`Canonical authority unavailable`,zh:`缺少规范权限状态`},turn_blocked:{en:`Task admission blocked`,zh:`当前任务未获准执行`},acceptance_unavailable:{en:`Acceptance binding unavailable`,zh:`缺少有效验收绑定`},runtime_unavailable:{en:`Runtime unavailable`,zh:`运行时不可用`},runtime_unverified:{en:`Runtime availability unverified`,zh:`运行时可用性尚未验证`},launchable:{en:`Local launch prerequisites met`,zh:`本机启动条件已满足`}};function jb({check:e,zh:t}){let n=e.executor?[e.executor.host,e.executor.reason].filter(Boolean).join(` · `):e.authority_reason,r=e.state===`authority_unavailable`?t?`未检查或启动执行器`:`No executor was inspected or launched`:t?`不代表正在执行`:`Does not mean executing`,i=e.authority_next_action===`preview_reviewed_goal_authority_promotion`?t?`下一步:预览整 Goal 协调 Authority 晋级`:`Next: preview whole-Goal coordination-authority promotion`:e.authority_next_action===`repair_canonical_authority`?t?`下一步:修复规范 Authority 读回`:`Next: repair canonical authority readback`:null;return(0,z.jsxs)(`p`,{role:`status`,children:[t?Ab[e.state].zh:Ab[e.state].en,n?` · ${n}`:``,i?` · ${i}`:``,` · ${r}`]})}function Mb({sessionId:e,members:t,zh:n,canMessage:r,ingress:i}){let[a,o]=(0,R.useState)(null),s=(0,R.useRef)(null),c=(0,R.useRef)(null),l=(0,R.useRef)(null),[u,d]=(0,R.useState)(null),[f,p]=(0,R.useState)({}),[m,h]=(0,R.useState)(!1),[g,_]=(0,R.useState)(``),v=(0,R.useRef)(0);(0,R.useEffect)(()=>{(a?s.current:l.current)?.focus()},[a]),(0,R.useEffect)(()=>(v.current++,d(null),p({}),_(``),h(!1),y(),()=>{v.current++}),[e]);async function y(t){let n=++v.current;h(!0),_(``),d(null),o(null);try{let r=await yg(e,t);n===v.current&&d(r)}catch(e){n===v.current&&_(e instanceof Error?e.message:String(e))}finally{n===v.current&&h(!1)}}async function b(t){let n=++v.current;h(!0),_(``),p(e=>{let n={...e};return delete n[t],n});try{let r=await bg(e,t);n===v.current&&p(e=>({...e,[t]:r}))}catch(e){n===v.current&&_(e instanceof Error?e.message:String(e))}finally{n===v.current&&h(!1)}}return a?(0,z.jsxs)(`div`,{className:`goal-team-work`,children:[(0,z.jsx)(`button`,{ref:s,type:`button`,onClick:()=>o(null),children:n?`返回执行列表`:`Back to executions`}),(0,z.jsx)(kb,{sessionId:e,operationId:a,zh:n,canMessage:r,ingress:i,onInspect:o},`${e}:${a}`)]}):(0,z.jsx)(`div`,{className:`goal-team-work`,children:(0,z.jsxs)(`section`,{"aria-label":n?`团队执行详情`:`Team execution details`,children:[(0,z.jsx)(`p`,{children:n?`检查不会启动成员。暂停协调员后,已派发的工作仍会继续。`:`Inspection starts no members. Dispatched work continues when the coordinator is paused.`}),(0,z.jsx)(`h3`,{children:n?`已绑定成员`:`Bound members`}),(0,z.jsx)(`ul`,{className:`goal-team-bindings`,children:t.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e.agent_id}),(0,z.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void b(e.id),children:n?`检查启动条件`:`Check prerequisites`})]}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n?`任务与执行配置`:`Task and execution details`}),(0,z.jsx)(`code`,{children:e.todo_id}),f[e.id]?.executor?.profile?(0,z.jsx)(`code`,{children:f[e.id]?.executor?.profile}):null]}),f[e.id]?(0,z.jsx)(jb,{check:f[e.id],zh:n}):null]},e.id))}),(0,z.jsxs)(`div`,{className:`goal-team-work-actions`,children:[(0,z.jsx)(`strong`,{children:n?`此协调身份的持久工作`:`Durable work for this coordinator`}),(0,z.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>{p({}),y()},children:n?`重新核验`:`Refresh`}),u?.has_more&&u.next_cursor?(0,z.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void y(u.next_cursor),children:n?`下一页`:`Next page`}):null]}),m?(0,z.jsx)(`p`,{role:`status`,children:n?`正在读取当前事实…`:`Reading current facts…`}):null,g?(0,z.jsx)(`p`,{role:`alert`,children:g}):null,u?(0,z.jsxs)(z.Fragment,{children:[u.page_readback_complete?null:(0,z.jsx)(`p`,{role:`status`,children:n?`本页有无法核验的工作,请检查原请求;不要直接重新派工。`:`Some work cannot be verified. Reconcile the original request before redispatching.`}),u.items.length?null:(0,z.jsx)(`p`,{children:n?`此页没有委派记录;不代表整个团队没有工作或 Goal 已完成。`:`No records on this page; this does not establish an idle team or a completed Goal.`}),(0,z.jsx)(`ul`,{className:`goal-team-operations`,children:u.items.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`strong`,{children:[e.agent_id??(n?`记录不可读`:`Unreadable record`),` · `,vg(e,n)]}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n?`执行标识`:`Execution identifier`}),(0,z.jsx)(`code`,{children:e.operation_id??e.record_id})]}),e.operation_id?(0,z.jsx)(`button`,{ref:e.operation_id===c.current?l:void 0,type:`button`,onClick:()=>{c.current=e.operation_id,o(e.operation_id)},children:n?`查看证据与反馈`:`Evidence and feedback`}):null]},e.record_id))}),(0,z.jsxs)(`p`,{children:[n?`仅限当前协调身份;分页不是团队快照。`:`Scoped to this coordinator; paging is not a team snapshot.`,u.has_more?n?` 还有下一页。`:` More pages remain.`:``]})]}):null]})})}function Nb({sessionId:e,onPrepare:t,onExecute:n,onChange:r}){let{locale:i}=Ji(),a=i===`zh-CN`,[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(null),u=c===`settings`,d=e=>l(e?`settings`:null),f=(0,R.useRef)(null);(0,R.useEffect)(()=>{c&&!f.current?.open?f.current?.showModal():!c&&f.current?.open&&f.current.close()},[c]);let[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(``),[y,b]=(0,R.useState)({agent_id:``,token_budget:0});(0,R.useEffect)(()=>{let t=!0,n=!1;if(s(null),r(null),g(``),v(``),d(!1),!e||e===`new-session-pending`)return;async function i(){if(!n){n=!0;try{let n=await gg(e);t&&(s(n),r(n),v(``))}catch(e){t&&v(e instanceof Error?e.message:String(e))}finally{n=!1}}}i();let a=window.setInterval(()=>{document.hidden||i()},2500);return()=>{t=!1,window.clearInterval(a)}},[e]);let x=!!(o?.enabled&&o.active_turn_id),S=o?.native.status??`absent`,C=![`absent`,`complete`].includes(S),w=!!(o?.settings.agent_id&&o.settings.token_budget&&o.settings.execution_config),T=e=>{b({agent_id:e.settings.agent_id??``,token_budget:e.settings.token_budget??0}),d(!0)},E=o?.enabled?o.recovery_required?a?`LoopX · 需要恢复连接`:`LoopX · Reconnect required`:S===`blocked`?a?`LoopX · 需要处理阻塞`:`LoopX · Blocked`:x?a?`LoopX · 正在推进`:`LoopX · Working`:S===`complete`?a?`LoopX · 本轮已结束`:`LoopX · Run finished`:[`budgetLimited`,`usageLimited`].includes(S)?a?`LoopX · 已到额度限制`:`LoopX · Usage limit`:a?`LoopX · 已暂停`:`LoopX · Paused`:a?`普通对话`:`Conversation`,D=()=>{o&&!u?T(o):d(!1)};async function O(){m(!0),g(``);try{let e=await gg(await t());s(e),r(e),T(e)}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function k(t){if(e){m(!0),g(``);try{let n=await xg(e,t,t===`configure`?y:void 0);s(n),r(n),(t===`configure`||t===`exit`)&&d(!1)}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}}}let A=o?.deliveries.some(e=>[`rejected`,`unavailable`].includes(e.status)),ee=o?.ingress.filter(e=>e.status!==`delivered`)??[];return(0,z.jsxs)(`section`,{className:`goal-loopx-mode`,"aria-label":a?`LoopX 运行模式`:`LoopX execution mode`,children:[(0,z.jsxs)(`div`,{className:`goal-loopx-mode-bar`,children:[(0,z.jsxs)(`span`,{className:`goal-loopx-mode-status`,"data-active":x,role:`status`,children:[(0,z.jsx)(`i`,{"aria-hidden":`true`}),E]}),(0,z.jsxs)(`div`,{className:`goal-loopx-mode-actions`,children:[w&&e?(0,z.jsxs)(`button`,{type:`button`,className:`goal-loopx-team-trigger`,onClick:()=>l(`team`),"aria-haspopup":`dialog`,children:[(0,z.jsx)(hh,{size:16}),a?`团队执行情况`:`Team execution`,A?(0,z.jsx)(`span`,{className:`goal-loopx-alert-dot`,"aria-label":a?`最近回读需要核验`:`Last observations need review`}):null]}):null,(0,z.jsx)(`button`,{type:`button`,disabled:p||o?.conversation_busy||!o,onClick:D,"aria-label":a?`运行设置`:`Settings`,title:a?`运行设置与用量`:`Settings and usage`,"aria-haspopup":`dialog`,children:(0,z.jsx)(ah,{size:16})}),(0,z.jsxs)(`button`,{type:`button`,className:`goal-loopx-primary`,disabled:p||!!(o?.conversation_busy&&!x),title:x?a?`暂停协调员;已派发的成员继续执行`:`Pause coordinator; dispatched members keep working`:void 0,onClick:async()=>{if(!o){await O();return}x?k(`pause`):!w||Number(o.settings.token_budget??0)<=Number(o.native.tokensUsed??0)?D():n(C?`resume`:`start`)},children:[x?(0,z.jsx)(Jm,{size:14}):(0,z.jsx)(Ym,{size:14}),x?a?`暂停协调员`:`Pause coordinator`:o?.enabled?S===`complete`?a?`开启新一轮`:`Start new run`:a?`恢复推进`:`Continue`:a?`开启 LoopX 模式`:`Enable LoopX`]})]})]}),ee.length?(0,z.jsxs)(`p`,{role:`status`,children:[a?`待处理消息:`:`Pending messages: `,ee.map(e=>`${e.mode===`loopx_queue`?`queue`:`inbox`} · ${e.status}`).join(` / `)]}):null,A?(0,z.jsx)(`button`,{className:`goal-loopx-review-notice`,type:`button`,onClick:()=>l(`team`),children:a?`最近成员回读有未通过或无法核验的结果 · 查看团队`:`Last member observations include rejected or unverified results · View team`}):null,(h||_)&&!c?(0,z.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:h||_}):null,(0,z.jsx)(`dialog`,{className:`goal-loopx-dialog`,ref:f,"aria-labelledby":`goal-loopx-dialog-title`,onClose:()=>l(null),onClick:e=>{e.target===e.currentTarget&&l(null)},children:c?(0,z.jsxs)(`div`,{className:`goal-loopx-dialog-content`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h2`,{id:`goal-loopx-dialog-title`,children:c===`team`?a?`团队执行情况`:`Team execution`:a?`运行设置`:`Execution settings`}),(0,z.jsx)(`button`,{type:`button`,autoFocus:!0,"aria-label":a?`关闭`:`Close`,onClick:()=>l(null),children:(0,z.jsx)(gh,{size:18})})]}),h||_?(0,z.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:h||_}):null,c===`team`&&e&&!_?(0,z.jsx)(Mb,{sessionId:e,members:o?.members??[],zh:a,canMessage:x&&!o?.paused&&!_,ingress:o?.ingress??[]},`${e}:${o?.settings.agent_id}:${o?.settings.execution_config}`):null,c===`team`?(0,z.jsxs)(`div`,{className:`goal-team-control`,children:[(0,z.jsx)(`button`,{type:`button`,disabled:p||!x||!!_,onClick:()=>void k(`pause`),children:a?`暂停协调员`:`Pause coordinator`}),(0,z.jsxs)(`p`,{role:`status`,children:[o?.paused?x?a?`已暂停后续调度,等待当前协调轮次停止回读。`:`Further dispatch paused; awaiting coordinator turn stop readback.`:a?`协调员已暂停。`:`Coordinator paused.`:null,a?`此操作不会停止已派发成员;成员状态以上次执行回读为准。当前入口不支持停止整个团队。`:`This does not stop dispatched members; their states are last-read observations. Whole-team stop is unavailable here.`]})]}):null,u?(0,z.jsxs)(`div`,{className:`goal-loopx-mode-settings`,children:[(0,z.jsxs)(`label`,{children:[a?`已注册的协调身份`:`Registered coordinator`,(0,z.jsxs)(`select`,{value:y.agent_id,onChange:e=>b({...y,agent_id:e.target.value}),children:[(0,z.jsx)(`option`,{value:``,children:a?`选择已授权身份`:`Select authorized identity`}),o?.registered_agents.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})]}),(0,z.jsxs)(`label`,{children:[a?`协调员总 token 额度`:`Coordinator total token allowance`,(0,z.jsx)(`input`,{type:`number`,min:1,max:2147483647,value:y.token_budget||``,onChange:e=>b({...y,token_budget:Number(e.target.value)})})]}),(0,z.jsxs)(`label`,{children:[a?`成员执行绑定文件(Goal 配置)`:`Member execution bindings (Goal configuration)`,(0,z.jsx)(`input`,{readOnly:!0,value:o?.settings.execution_config??(a?`未配置`:`Not configured`)})]}),(0,z.jsx)(`p`,{children:a?`绑定文件由 Goal 子代理设置统一管理;额度包含协调员历史用量,成员授权不会因开启模式而扩大。`:`Manage the binding file in Goal sub-agent settings. The allowance includes coordinator history; enabling this mode does not expand member grants.`}),(0,z.jsx)(`button`,{type:`button`,disabled:p||!y.agent_id||y.token_budget<1||!o?.settings.execution_config,onClick:()=>void k(`configure`),children:a?`保存设置`:`Save settings`})]}):null,c===`settings`&&o?.enabled&&o.native.tokensUsed!==void 0?(0,z.jsxs)(`p`,{className:`goal-loopx-mode-usage`,children:[a?`协调员累计用量`:`Coordinator usage`,` `,o.native.tokensUsed.toLocaleString(),` / `,o.native.tokenBudget?.toLocaleString()??`—`,` tokens`]}):null,c===`settings`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{children:a?`开启后,当前协调员持续推进本 Goal。暂停仅影响协调员,已派发成员继续执行;本轮结束不等于 Goal 完成。`:`The coordinator continues this Goal. Pausing affects only the coordinator; dispatched members keep working. A finished run does not complete the Goal.`}),o?.enabled&&!x?(0,z.jsx)(`button`,{type:`button`,disabled:p,onClick:()=>void k(`exit`),children:a?`退出模式`:`Exit mode`}):null]}):null]}):null})]})}var Pb=e=>e.items.filter(e=>e.operation_id&&e.status===`accepted`&&!e.recovery_required&&e.artifacts?.length);function Fb({sessionId:e,zh:t,refreshKey:n}){let[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(``),d=(0,R.useRef)(0),f=(0,R.useRef)(null),p=(0,R.useRef)(void 0),m=(0,R.useRef)(!1),h=(0,R.useRef)(null);(0,R.useEffect)(()=>{f.current=null,p.current=void 0},[e]),(0,R.useEffect)(()=>(v(p.current),()=>{d.current++}),[e,n]),(0,R.useEffect)(()=>{a&&m.current&&(h.current?.focus(),m.current=!1)},[a]);let g=t?`产物或验收已变化,未展示旧报告。请重新选择可核验的产物。`:`Artifact or acceptance changed. Previous report cleared; select a verified artifact again.`;async function _(t,n,r){let i=await _g(e,t);if(r!==d.current)return;let a=i.artifacts??[],s=n?.ref?a.filter(e=>e.ref===n.ref):[],c=n?.ref?s.length===1&&s[0].sha256===n.sha256?s[0]:void 0:a.find(e=>Tb(e.ref))??a[0];i.operation_id!==t||i.status!==`accepted`||i.error||i.recovery_required||!c?u(g):(f.current={operationId:t,ref:c.ref,sha256:c.sha256},o({result:i,artifact:c}))}async function v(n,r=!1){let a=++d.current;r&&(f.current=null),p.current=n,m.current=!1,c(!0),u(``),i(null),o(null);try{let t=await yg(e,n);if(a!==d.current)return;i(t);let r=f.current;if(!r){let e=Pb(t)[0],n=e?.artifacts?.find(e=>Tb(e.ref))??e?.artifacts?.[0];e?.operation_id&&n&&(r={operationId:e.operation_id,...n})}r&&(f.current=r,await _(r.operationId,r,a))}catch(e){a===d.current&&u(`${t?`无法核验,已清除上次报告。`:`Cannot verify; previous report cleared.`} ${String(e)}`)}finally{a===d.current&&c(!1)}}async function y(e,n){let r=++d.current;m.current=!0,c(!0),u(``),o(null);let i={operationId:e,...n};f.current=i;try{await _(e,i,r)}catch(e){r===d.current&&u(`${t?`无法核验,已清除上次报告。`:`Cannot verify; previous report cleared.`} ${String(e)}`)}finally{r===d.current&&c(!1)}}let b=r?Pb(r):[];return(0,z.jsxs)(`section`,{className:`goal-team-results`,"aria-label":t?`团队成果`:`Team results`,"aria-busy":s,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h3`,{children:t?`团队成果`:`Team results`}),(0,z.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>void v(p.current),children:[(0,z.jsx)(Qm,{size:14,"aria-hidden":`true`}),t?`刷新成果`:`Refresh results`]})]}),s?(0,z.jsx)(`p`,{role:`status`,children:t?`正在核验产物…`:`Verifying artifacts…`}):null,l?(0,z.jsx)(`p`,{role:`alert`,children:l}):null,r&&!r.page_readback_complete?(0,z.jsx)(`p`,{role:`status`,children:t?`部分工作无法核验,请在团队执行中检查。`:`Some work cannot be verified; inspect Team execution.`}):null,(0,z.jsxs)(`div`,{className:`goal-team-results-layout`,children:[r?(0,z.jsxs)(`nav`,{className:`goal-team-result-list`,"aria-label":t?`选择团队产物`:`Choose a team artifact`,children:[b.map(e=>{let t=e.artifacts.find(e=>Tb(e.ref))??e.artifacts[0];return(0,z.jsxs)(`button`,{type:`button`,disabled:s,"aria-label":`${e.agent_id} · ${t.ref}`,"aria-pressed":a?.result.operation_id===e.operation_id,onClick:()=>void y(e.operation_id,t),children:[(0,z.jsx)(jm,{size:16,"aria-hidden":`true`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.agent_id}),(0,z.jsx)(`small`,{children:t.ref})]}),(0,z.jsx)(hm,{className:`goal-team-result-check`,size:14,"aria-hidden":`true`})]},e.record_id)}),b.length?null:(0,z.jsx)(`p`,{children:t?`本页没有可读取的已验收产物。`:`No accepted artifact is available on this page.`}),r.has_more&&r.next_cursor?(0,z.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>void v(r.next_cursor,!0),children:t?`下一页成果`:`Next results page`}):null]}):null,a?(0,z.jsxs)(`div`,{ref:h,tabIndex:-1,className:`goal-team-result-reader`,"aria-label":t?`当前报告`:`Current report`,children:[(0,z.jsx)(Db,{artifact:a.artifact,zh:t,heading:t?`已通过当前验收`:`Currently accepted`},`${a.result.operation_id}:${a.artifact.sha256}`),a.result.artifacts&&a.result.artifacts.length>1?(0,z.jsxs)(`label`,{children:[t?`其他产物`:`Other artifacts`,(0,z.jsx)(`select`,{value:a.artifact.ref,onChange:e=>{let t=a.result.artifacts.find(t=>t.ref===e.target.value);t&&(f.current={operationId:a.result.operation_id,ref:t.ref,sha256:t.sha256},o({...a,artifact:t}))},children:a.result.artifacts.map(e=>(0,z.jsx)(`option`,{value:e.ref,children:e.ref},e.ref))})]}):null,(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t?`验收与采用关系`:`Acceptance and adoption`}),(0,z.jsx)(mb,{result:a.result,zh:t,onInspect:e=>void y(e)})]})]}):null]})]})}function Ib({attention:e,onSelect:t}){let{t:n}=Ji(),r=Zi(e.updatedAt,n);return(0,z.jsxs)(`button`,{className:`personal-timeline-row personal-attention-row`,"data-testid":`personal-browse-row`,onClick:t,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-row-icon is-attention`,children:(0,z.jsx)(ym,{size:18})}),(0,z.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,z.jsxs)(`small`,{children:[e.goalTitle??e.goalId,` · `,n(`home.lane.needsYou`),r?` · ${n(`tasks.waitingAge`,{age:r})}`:``]}),(0,z.jsx)(`strong`,{children:e.text})]}),(0,z.jsx)(`span`,{className:`personal-priority-dot is-${e.priority??(e.blocking?`high`:`medium`)}`}),(0,z.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?n(`tasks.blocked`):n(`tasks.pending`)}),(0,z.jsx)(_m,{size:17})]})}function Lb({onSelect:e,output:t}){let{t:n}=Ji(),r=t.kind===`report`?jm:Am;return(0,z.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,z.jsx)(`span`,{className:`personal-row-icon is-output`,children:(0,z.jsx)(r,{size:18})}),(0,z.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,z.jsxs)(`small`,{children:[t.goalTitle??t.goalId,` · `,t.agentLabel??`LoopX`]}),(0,z.jsx)(`strong`,{children:t.title}),t.summary?(0,z.jsx)(`span`,{children:t.summary}):null,t.report?(0,z.jsxs)(`small`,{children:[n(`files.reportDelta`,{added:t.report.addedCount,changed:t.report.changedCount}),` · `,n(`files.verifiedReport`)]}):null]}),t.createdAt?(0,z.jsx)(`time`,{children:t.createdAt}):null,(0,z.jsx)(_m,{size:17})]})}var Rb={completed:`runs.completed`,failed:`runs.failed`,interrupted:`runs.interrupted`,queued:`runs.queued`,running:`runs.running`,waiting:`runs.waiting`};function zb({onSelect:e,run:t,showGoal:n=!0}){let{t:r}=Ji();return(0,z.jsxs)(`button`,{"aria-label":`${r(`tasks.viewExecution`)}:${t.title}`,className:`personal-timeline-row personal-run-row`,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-row-icon is-run`,children:(0,z.jsx)(fm,{size:18})}),(0,z.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,z.jsxs)(`small`,{children:[n?`${t.goalTitle} · `:``,t.agentLabel]}),(0,z.jsx)(`strong`,{children:t.title}),t.latestActivity===t.title?null:(0,z.jsx)(`small`,{children:t.latestActivity})]}),(0,z.jsxs)(`span`,{className:`personal-row-status is-${t.status}`,children:[t.status===`running`?(0,z.jsx)(zm,{className:`personal-spin`,size:14}):null,r(Rb[t.status])]}),(0,z.jsx)(_m,{size:17})]})}function Bb({onSelect:e,schedule:t}){let{t:n}=Ji(),r=t.scheduleKind===`heartbeat`;return(0,z.jsxs)(`button`,{"aria-label":`${r?`Heartbeat`:n(`tasks.scheduled`)}:${t.label};${t.status??`active`}`,className:`personal-schedule-row`,onClick:e,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-schedule-icon`,children:r?(0,z.jsx)(Zm,{size:17}):(0,z.jsx)(mm,{size:17})}),(0,z.jsxs)(`span`,{className:`personal-schedule-copy`,children:[(0,z.jsx)(`small`,{children:n(r?`schedule.heartbeat`:`schedule.monitor`)}),(0,z.jsx)(`strong`,{children:t.label}),(0,z.jsx)(`p`,{children:t.schedule??n(`schedule.summary`)})]}),(0,z.jsx)(`span`,{className:`personal-schedule-status is-${t.status??`active`}`,children:t.status===`paused`?n(`schedule.paused`):n(`schedule.active`)}),(0,z.jsx)(_m,{size:16})]})}function Vb({delivery:e}){let{t}=Ji();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,z.jsx)(`small`,{className:`personal-return-delivery is-${r}`,role:`status`,children:n})}function Hb({items:e,onSelect:t,selectedGoal:n}){let{locale:r,t:i}=Ji();if(e.length===0)return(0,z.jsxs)(`div`,{className:`personal-timeline-empty`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(ch,{size:20})}),(0,z.jsx)(`strong`,{children:i(n?`timeline.emptyGoal`:`timeline.emptyWorkspace`)}),(0,z.jsx)(`p`,{children:i(n?`timeline.emptyGoalDescription`:`timeline.emptyWorkspaceDescription`)})]});let a=[...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`),o=a?.kind===`message`?`${a.message.agentLabel??i(`header.manager`)}:${a.message.pending?i(`timeline.pending`):a.message.text}`:a?.kind===`proposal`?`${a.proposal.title}:${a.proposal.status}`:a?.kind===`run`?i(`timeline.runCompleted`,{run:a.run.title}):``,s=e.filter(e=>e.kind===`proposal`&&e.proposal.status===`gated`),c=e.filter(e=>e.kind===`run`&&[`queued`,`running`,`completed`].includes(e.run.status)),l=new Set(c.map(e=>e.id)),u=e.filter(e=>e.kind!==`proposal`&&!l.has(e.id)),d=c.filter(e=>e.run.status===`running`&&!!e.run.sessionId&&!!e.run.canInterrupt).length,f=c.filter(e=>e.run.status===`queued`).length,p=c.filter(e=>e.run.status===`completed`).length,m=c.length-d-f-p,h=r===`zh-CN`?[d&&`${d} 个执行中`,f&&`${f} 个排队中`,p&&`${p} 次执行已结束`,m&&`${m} 项进展更新`].filter(Boolean).join(` · `):[d&&`${d} running`,f&&`${f} queued`,p&&`${p} runs finished`,m&&`${m} progress updates`].filter(Boolean).join(` · `),g=e.filter(e=>e.kind===`proposal`&&e.proposal.status!==`gated`);function _(e){return e.kind===`attention`?(0,z.jsx)(Ib,{attention:e.attention,onSelect:()=>t({item:e.attention,kind:`attention`})},e.id):e.kind===`run`?(0,z.jsx)(zb,{showGoal:!n,onSelect:()=>t({item:e.run,kind:`run`}),run:e.run},e.id):e.kind===`output`?(0,z.jsx)(Lb,{onSelect:()=>t({item:e.output,kind:`output`}),output:e.output},e.id):e.kind===`schedule`?(0,z.jsx)(Bb,{onSelect:()=>t({item:e.schedule,kind:`schedule`}),schedule:e.schedule},e.id):e.kind===`proposal`?(0,z.jsxs)(`button`,{className:`personal-proposal-row is-${e.proposal.status}`,onClick:()=>t({item:e.proposal,kind:`proposal`}),type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(ch,{size:17})}),(0,z.jsxs)(`span`,{children:[(0,z.jsxs)(`small`,{children:[e.proposal.actionKind,` · `,e.proposal.status]}),(0,z.jsx)(`strong`,{children:e.proposal.title}),e.proposal.impact?(0,z.jsx)(`p`,{children:e.proposal.impact}):null]}),(0,z.jsx)(`b`,{children:e.proposal.status===`gated`&&e.proposal.actionKind!==`operation.execute`?i(`timeline.review`):e.proposal.primaryLabel??i(`timeline.reviewAndConfirm`)})]},e.id):(0,z.jsxs)(`article`,{className:`personal-message is-${e.message.role}`,children:[e.message.role===`user`?null:(0,z.jsx)(`span`,{className:`personal-message-avatar`,children:(0,z.jsx)(fm,{size:17})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:e.message.role===`user`?i(`common.you`):e.message.agentLabel??i(`header.manager`)}),e.message.time?(0,z.jsx)(`time`,{children:e.message.time}):null]}),e.message.attachments?.length?(0,z.jsx)(`div`,{className:`personal-message-images`,children:e.message.attachments.map(e=>(0,z.jsx)(`img`,{alt:e.name,src:e.dataUrl},e.id))}):null,e.message.role===`user`?(0,z.jsx)(`p`,{children:e.message.text}):(0,z.jsx)(wb,{text:e.message.text}),e.message.pending?(0,z.jsx)(`span`,{className:`personal-message-pending`,children:i(`timeline.pending`)}):null,(0,z.jsx)(Wy,{request:e.message.collaboration}),(0,z.jsx)(Vb,{delivery:e.message.returnDelivery})]})]},e.id)}return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{"aria-atomic":`true`,"aria-live":`polite`,className:`personal-live-region`,role:`status`,children:o}),(0,z.jsxs)(`div`,{className:`personal-channel-timeline`,children:[c.length?(0,z.jsxs)(`details`,{className:`personal-activity-summary`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(im,{size:16,"aria-hidden":`true`}),(0,z.jsx)(`strong`,{children:r===`zh-CN`?`执行动态`:`Execution activity`}),(0,z.jsx)(`span`,{children:h})]}),(0,z.jsx)(`div`,{children:c.map(_)})]}):null,u.map(_),s.length?(0,z.jsxs)(`details`,{className:`personal-gated-summary`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(ch,{size:16})}),(0,z.jsx)(`strong`,{children:i(`timeline.waitingConfirmation`)}),(0,z.jsx)(`small`,{children:i(`timeline.gateHistory`,{count:s.length})})]}),(0,z.jsx)(`div`,{children:s.map(_)})]}):null,g.map(_)]})]})}function Ub({goal:e}){let{t,locale:n}=Ji(),r=n===`zh-CN`?{checkpoint_satisfied:`检查点满足`,checkpoint_fresh:`检查点有效`,path_outcome_valid:`路径决策有效`,evidence_refs_present:`证据引用齐全`,final_outcome_claim_present:`最终成果声明齐全`,no_reported_outcome_gap:`无已报告成果缺口`}:{checkpoint_satisfied:`Checkpoint satisfied`,checkpoint_fresh:`Checkpoint current`,path_outcome_valid:`Valid path decision`,evidence_refs_present:`Evidence refs present`,final_outcome_claim_present:`Final outcome claim present`,no_reported_outcome_gap:`No reported outcome gap`},i={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`)},a=e=>i[e]??t(`acceptance.unknown`),o=e.acceptanceObservation,s=e.loadState||!o||o.goal_id!==e.goalId||o.coverage===`unavailable`;return(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-acceptance`,"aria-label":t(`acceptance.title`),children:[(0,z.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,z.jsx)(`h3`,{children:t(`acceptance.title`)}),(0,z.jsx)(`em`,{children:t(`common.readOnly`)})]}),(0,z.jsx)(`p`,{role:`status`,children:t(s?`acceptance.unavailable`:`acceptance.partial`)}),!s&&o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h4`,{children:t(`acceptance.gaps`)}),o.acceptance_gaps.length?o.acceptance_gaps.map((e,i)=>(0,z.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,z.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),e.resolution_hint?(0,z.jsx)(`p`,{children:e.resolution_hint}):null,e.component_checks?(0,z.jsx)(`div`,{children:Object.entries(e.component_checks).map(([e,t])=>(0,z.jsxs)(`p`,{children:[r[e],`: `,n===`zh-CN`?t?`通过`:`未通过`:t?`Passed`:`Failed`]},e))}):null,(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.owner`)}),(0,z.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,z.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.observed`)}),(0,z.jsx)(`dd`,{children:e.observed_at??t(`acceptance.unknown`)})]})]})]},`${e.kind}:${e.owner}:${i}`)):(0,z.jsx)(`p`,{children:t(`acceptance.noGaps`)}),(0,z.jsx)(`h4`,{children:t(`acceptance.guards`)}),o.guards.length?o.guards.map((e,n)=>(0,z.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,z.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.owner`)}),(0,z.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),e.blocks_agent?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.agent`)}),(0,z.jsx)(`dd`,{children:e.blocks_agent})]}):null,e.todo_id?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.task`)}),(0,z.jsx)(`dd`,{children:e.todo_id})]}):null,(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,z.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.scope`)}),(0,z.jsx)(`dd`,{children:e.decision_scope??t(`acceptance.unknown`)})]})]})]},`${e.todo_id}:${n}`)):(0,z.jsx)(`p`,{children:t(`acceptance.noGuards`)}),(0,z.jsx)(`h4`,{children:t(`acceptance.next`)}),(0,z.jsx)(`p`,{children:o.next_action??t(`acceptance.unknown`)}),(0,z.jsxs)(`details`,{children:[(0,z.jsxs)(`summary`,{children:[t(`acceptance.historical_progress`),` · `,o.historical_progress.length]}),(0,z.jsx)(`p`,{children:t(`acceptance.historical`)}),o.historical_progress.map(e=>(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`strong`,{children:a(e.kind)}),` · `,e.observed_at??t(`acceptance.unknown`),` `,e.evidence_refs.join(`, `)]},e.kind))]}),o.missing_sources.length?(0,z.jsxs)(`p`,{children:[t(`acceptance.missing`),` `,o.missing_sources.map(a).join(`, `)]}):null,o.truncated?(0,z.jsx)(`p`,{children:t(`acceptance.truncated`)}):null]}):null]})}function Wb({item:e,successor:t,onSelect:n}){let{t:r}=Ji(),i=e.details;return(0,z.jsxs)(`section`,{className:`personal-detail-card`,"aria-label":r(`attentionDetail.title`),children:[(0,z.jsx)(`h3`,{children:r(`attentionDetail.title`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.request`)}),(0,z.jsx)(`dd`,{children:r(i?.interaction===`decision`?`attentionDetail.decision`:`attentionDetail.unknownRequest`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`common.status`)}),(0,z.jsx)(`dd`,{children:r(`attentionDetail.${i?.lifecycle??`unknown`}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`drawer.reason`)}),(0,z.jsx)(`dd`,{children:i?.reason??e.explanation??r(`attentionDetail.unknownReason`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Todo`}),(0,z.jsx)(`dd`,{children:e.todoId})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.targetTodo`)}),(0,z.jsx)(`dd`,{children:i?.unblocksTodoId??r(`attentionDetail.notProvided`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.targetAgent`)}),(0,z.jsx)(`dd`,{children:i?.blocksAgent??r(`attentionDetail.notProvided`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.scope`)}),(0,z.jsx)(`dd`,{children:i?.decisionScope?`${i.decisionScope.kind} · ${i.decisionScope.granularity} · ${i.decisionScope.scopeKey}`:r(`attentionDetail.notProvided`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`drawer.evidence`)}),(0,z.jsx)(`dd`,{children:i?.evidence??e.evidence??r(`drawer.decisionDefaultEvidence`)})]})]}),i?.supersededBy?(0,z.jsxs)(`p`,{children:[r(`attentionDetail.replacement`),`: `,i.supersededBy]}):null,t&&n?(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>n(t),type:`button`,children:r(`attentionDetail.openReplacement`)}):null,(0,z.jsx)(`p`,{children:r(`attentionDetail.boundary`)})]})}function Gb({proposal:e,t}){let n=e.teamPlanOutcome?.kind===`already_present`;return(0,z.jsxs)(`section`,{className:`personal-proposal-card personal-team-plan-result`,children:[(0,z.jsx)(`h3`,{children:db(e.teamPlanOutcome??null,t)}),(0,z.jsxs)(`dl`,{className:`personal-team-plan-assignments`,children:[e.teamPlanAssignments?.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.agentId||e.laneId}),(0,z.jsx)(`dd`,{children:e.task})]},e.laneId)),e.teamPlanGapLanes?.map(e=>(0,z.jsxs)(`div`,{className:`is-pending`,children:[(0,z.jsx)(`dt`,{children:e.agentId||e.laneId}),(0,z.jsxs)(`dd`,{children:[e.task||e.laneId,(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[t(`proposal.teamPlan.pending`),` · `,lb(e.reasonCode,t)]})]})]},e.laneId))]}),(0,z.jsx)(`p`,{children:t(n?`proposal.teamPlan.recoveredHint`:`proposal.teamPlan.assignedHint`)}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t(`proposal.teamPlan.originalPlan`)}),(0,z.jsx)(`dl`,{children:e.fields.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.label}),(0,z.jsx)(`dd`,{children:e.value})]},e.key))})]})]})}function Kb(e){return e.replace(/\s+/gu,` `).trim()}function qb(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 Jb(e){return/(我现在该做什么|下一步|哪些\s*Goal\s*在等我|需要我|谁在等我|Agent\s*在做什么|当前进度|总结(?:今天)?进展)/iu.test(e)}function Yb(e){let t=/(怎么|如何|为什么|给.*建议|分析一下|解释|只读)/u.test(e),n=/(解决一下|修复一下|处理一下|执行一下|改一下|跑(?:一下)?测试|rebase|push|提交|推送)/iu.test(e);return!t&&n&&/(帮我|请|给我|直接|现在|开始|bytedcli|codebase|git|rebase|push|提交|推送)/iu.test(e)}function Xb(e){return Kb(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 Zb(e,t){let n=Kb(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&&!qb(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n);if(!t.goalId&&!qb(n,/goal|目标/iu)&&/(创建|新建|设置|create|start|set up).{0,24}(goal|目标)/iu.test(n)&&r.push({actionKind:`goal.create`,confidence:.97,normalizedParameters:{heartbeat_enabled:!qb(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&&!qb(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&&!qb(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&&!qb(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&&Yb(n)&&r.push({actionKind:`todo.create`,confidence:.9,normalizedParameters:{goal_id:t.goalId,start_execution:!0}}),t.goalId&&a){let e=!qb(n,/完成|做完|关闭/u)&&/完成|做完|关闭/u.test(n)?`complete`:!qb(n,/阻塞|卡住/u)&&/阻塞|卡住/u.test(n)?`block`:!qb(n,/暂缓|稍后|推迟/u)&&/暂缓|稍后|推迟/u.test(n)?`defer`:i&&!qb(n,/交给|分配给|改派/u)&&/交给|分配给|改派/u.test(n)?`reassign`:null;if(e){let i=e===`defer`?Xb(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&&Jb(n)?{actionKind:null,confidence:.98,missingFields:[],normalizedParameters:{},route:`projection`}:{actionKind:null,confidence:.75,missingFields:[],normalizedParameters:{},route:`agent_chat`}}function Qb(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 $b=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`select:not([disabled])`,`input:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`),ex=[{key:`drawer.taskBlock`,operation:`block`},{key:`drawer.taskSuccessor`,operation:`successor_create`}],tx=[{key:`drawer.decisionReject`,resolution:`reject`},{key:`drawer.decisionDefer`,resolution:`defer`}],nx=Array.from({length:32},(e,t)=>t+1),rx=/^[a-z][a-z0-9_.-]{0,63}$/u;function ix(e){let t=String(e??``).trim().toLowerCase();return rx.test(t)?t:null}function ax(e,t){return e.enabled===t.enabled&&e.maxChildren===t.maxChildren&&JSON.stringify(e.modelConfig??null)===JSON.stringify(t.modelConfig??null)&&(e.executionConfig??``)===(t.executionConfig??``)&&[...e.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)===[...t.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)}function ox({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}=Ji(),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(!1),[y,b]=(0,R.useState)(`idle`),[x,S]=(0,R.useState)(`record`),[C,w]=(0,R.useState)([]),[T,E]=(0,R.useState)(null),[D,O]=(0,R.useState)(2),[k,A]=(0,R.useState)(``),[ee,j]=(0,R.useState)(``),[M,te]=(0,R.useState)(``),[ne,N]=(0,R.useState)(`idle`),[P,re]=(0,R.useState)(null),[ie,ae]=(0,R.useState)(null),F=(0,R.useRef)(null),oe=(0,R.useRef)(null),[I,se]=(0,R.useState)(e.find(e=>e.available)?.agentId??`codex`),[L,ce]=(0,R.useState)(``),[le,ue]=(0,R.useState)(``),de=(0,R.useRef)(null),fe=(0,R.useRef)(null),pe=(0,R.useRef)(null),me=(0,R.useRef)(null),he=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,R.useEffect)(()=>{b(`idle`),v(!1),S(`record`),ue(``);let e=f.kind===`goal`?f.item.subagentExecution:void 0;w(e?.allowedDomains??[]),A(e?.modelConfig?.model??``),j(e?.modelConfig?.reasoning_effort??``),te(e?.executionConfig??``),O(e?.maxChildren?Math.min(e.maxChildren,32):2),E(null),N(`idle`),re(null),ae(null),F.current=e??null,oe.current=null},[he]);let ge=f.kind===`goal`?f.item.subagentExecution:void 0;(0,R.useEffect)(()=>{let e=F.current,t=ge?!e||!ax(e,ge):e!==null;if(F.current=ge??null,!ie){t&&ge&&(w(ge.allowedDomains),A(ge.modelConfig?.model??``),j(ge.modelConfig?.reasoning_effort??``),te(ge.executionConfig??``),O(ge.maxChildren||2),E(null),N(`idle`),re(null));return}let n=oe.current;(!ge||ax(ie,ge)||n&&!ax(n,ge))&&(ge&&(w(ge.allowedDomains),A(ge.modelConfig?.model??``),j(ge.modelConfig?.reasoning_effort??``),te(ge.executionConfig??``),O(ge.maxChildren||2)),oe.current=null,ae(null))},[ge,ie]),(0,R.useEffect)(()=>{let e=document.activeElement;e instanceof HTMLElement&&!fe.current?.contains(e)&&(pe.current=e);let t=window.requestAnimationFrame(()=>me.current?.focus());return()=>window.cancelAnimationFrame(t)},[he]);let _e=(0,R.useCallback)(()=>{let e=pe.current;c(),window.requestAnimationFrame(()=>e?.focus())},[c]);(0,R.useEffect)(()=>{function e(e){if(e.key===`Escape`){e.preventDefault(),_e();return}if(e.key===`Tab`&&f.kind!==`todo`){let t=Array.from(fe.current?.querySelectorAll($b)??[]).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)}},[_e,f.kind]);let ve=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`&&f.item.actionKind===`team.plan`&&f.item.status===`applied`?m(`proposal.teamPlan.resultTitle`):f.kind===`proposal`?m(f.item.reviewPlan?.retryOriginal?`drawer.recoverEditResult`:f.item.status===`applied`?`drawer.titleProposalApplied`:`drawer.titleProposalConfirm`):f.kind===`schedule`?f.item.scheduleKind===`heartbeat`?`Heartbeat`:m(`drawer.titleSchedule`):m(`drawer.goalDetails`),ye=f.kind===`proposal`?f.item.goalId??`manager`:f.item.goalId,be=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.kind===`proposal`&&f.item.status===`applied`&&f.item.actionKind===`team.plan`?f.item.goalId??m(`drawer.currentGoal`):f.item.goalId?m(`drawer.goalChanges`):m(`drawer.managerChanges`),xe=f.kind===`goal`?d.find(e=>e.goalId===f.item.goalId&&!!e.sessionId)??d.find(e=>e.goalId===f.item.goalId):null,Se=f.kind===`run`&&(f.item.completedSteps>0||!!f.item.latestActivity||!!f.item.outputs?.length),Ce=f.kind===`attention`?Zi(f.item.updatedAt,m):null,we=Xb(le);async function Te(){f.kind!==`run`||!h.trim()||(await r.onCorrectRun?.(f.item,h.trim()),g(``))}async function Ee(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??I,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 De(e,t,n){u||!of(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 Oe=f.kind===`goal`?ie??f.item.subagentExecution??{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0}:{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0},ke=ne===`previewing`||ne===`applying`,Ae=(()=>{if(f.kind!==`goal`)return[];let e=new Map;for(let t of Oe.allowedDomains){let n=ix(t);n&&e.set(n,{matchingTodoCount:0,value:n})}if(Oe.domainCandidates)for(let t of Oe.domainCandidates){let n=ix(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=ix(t.taskDomain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+1,value:n})}return[...e.values()]})();function je(){w(Oe.allowedDomains),A(Oe.modelConfig?.model??``),j(Oe.modelConfig?.reasoning_effort??``),te(Oe.executionConfig??``),O(Oe.maxChildren||2),E(null),N(`idle`),re(null)}function Me(){let e=[...new Set(C.map(e=>ix(e)))];return e.every(e=>!!e)?e:null}function Ne(e,t){w(n=>t?[...n,e].filter((e,t,n)=>n.indexOf(e)===t):n.filter(t=>t!==e)),re(null),N(`idle`),E(null)}async function Pe(e,t=e){if(f.kind!==`goal`||!r.onPreviewGoalSubagentConfiguration)return;let n=e?Me():[];if(t&&!k.trim()&&ee){N(`error`),E(m(`drawer.subagentModelRequired`));return}if(e&&!n){N(`error`),E(m(`drawer.subagentDomainInvalid`)),re(null);return}let i={alignCodexHostCapacity:e,allowedDomains:n??[],enabled:e,goalId:f.item.goalId,maxChildren:e?D:0,executionConfig:M.trim(),...Qb(t,k,ee)};N(`previewing`),E(m(`drawer.subagentPreviewing`)),re(null);try{let e=await r.onPreviewGoalSubagentConfiguration(i);if(!e.changed){oe.current=ge??null,ae({...e.configuration,domainCandidates:Oe.domainCandidates}),w(e.configuration.allowedDomains),A(e.configuration.modelConfig?.model??``),j(e.configuration.modelConfig?.reasoning_effort??``),te(e.configuration.executionConfig??``),O(e.configuration.maxChildren||2),N(`success`),E(m(`drawer.subagentNoChange`));return}re({...i,codexHostCapacity:e.configuration.codexHostCapacity,changed:e.changed,previewId:e.previewId}),N(`ready`),E(m(`drawer.subagentPreviewReady`))}catch(e){N(`error`),E(e instanceof Error?e.message:m(`drawer.subagentPreviewFailed`))}}async function Fe(){if(!(!P||!r.onApplyGoalSubagentConfiguration)){N(`applying`),E(m(`drawer.subagentApplying`));try{let e=await r.onApplyGoalSubagentConfiguration({allowedDomains:P.allowedDomains,alignCodexHostCapacity:P.enabled,enabled:P.enabled,goalId:P.goalId,maxChildren:P.maxChildren,modelConfig:P.modelConfig,executionConfig:P.executionConfig,previewId:P.previewId});oe.current=ge??null,ae({...e,domainCandidates:Oe.domainCandidates}),w(e.allowedDomains),A(e.modelConfig?.model??``),j(e.modelConfig?.reasoning_effort??``),te(e.executionConfig??``),O(e.maxChildren||2),N(`success`),E(m(e.codexHostCapacity?.newSessionRequired?`drawer.subagentAppliedRestart`:`drawer.subagentApplied`)),re(null);try{await r.onRefresh?.()}catch{N(`warning`),E(m(`drawer.subagentAppliedRefreshFailed`))}}catch(e){N(`error`),E(e instanceof Error?e.message:m(`drawer.subagentApplyFailed`))}}}return(0,z.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:fe,role:`dialog`,children:[(0,z.jsxs)(`header`,{className:`personal-drawer-header${f.kind===`todo`?` is-task-inspector`:``}`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{id:`personal-drawer-title`,ref:me,tabIndex:-1,children:ve}),(0,z.jsx)(`p`,{children:be})]}),(0,z.jsxs)(`div`,{className:`personal-drawer-header-actions`,children:[f.kind===`todo`&&l?(0,z.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,z.jsx)(Wm,{size:17}):(0,z.jsx)(Bm,{size:17})}):null,(0,z.jsxs)(`button`,{"aria-label":m(`drawer.closeDetail`,{context:be}),className:`personal-icon-button personal-drawer-close`,onClick:_e,ref:de,type:`button`,children:[(0,z.jsx)(om,{className:`personal-mobile-back`,size:18}),(0,z.jsx)(gh,{className:`personal-desktop-close`,size:18})]})]})]}),(0,z.jsxs)(`div`,{className:`personal-drawer-body`,children:[f.kind===`attention`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card is-attention`,children:[(0,z.jsx)(`small`,{children:f.item.blocking?m(`drawer.attentionBlocking`):m(`drawer.attentionWaiting`)}),(0,z.jsx)(`h3`,{children:f.item.text}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,z.jsx)(`dd`,{children:f.item.priority??`medium`})]}),Ce?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`common.waiting`)}),(0,z.jsx)(`dd`,{children:m(`tasks.waitingAge`,{age:Ce})})]}):null]})]}),(0,z.jsx)(Wb,{item:f.item,onSelect:n,successor:af(f.item,t)}),!u&&of(f.item)?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void De(f.item,`approve`,m(`common.confirm`)),type:`button`,children:[(0,z.jsx)(hm,{size:17}),m(`drawer.decisionReview`)]}),(0,z.jsxs)(`details`,{className:`personal-compact-menu`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(Em,{size:17}),m(`drawer.decisionMore`)]}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`button`,{onClick:()=>void r.onExplainDecision?.(f.item),type:`button`,children:[(0,z.jsx)(Hm,{size:16}),m(`drawer.explainDecision`)]}),tx.map(e=>(0,z.jsx)(`button`,{onClick:()=>void De(f.item,e.resolution,m(e.key)),type:`button`,children:m(e.key)},e.resolution))]})]})]}):null]}):null,f.kind===`todo`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-task-inspector-summary`,children:[(0,z.jsxs)(`div`,{className:`personal-task-inspector-status`,children:[(0,z.jsxs)(`span`,{className:f.item.done?`is-done`:f.item.status===`blocked`?`is-blocked`:`is-open`,children:[(0,z.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,z.jsx)(`span`,{children:f.item.priority}):null,(0,z.jsx)(`span`,{children:f.item.taskClass===`advancement_task`?m(`drawer.taskAdvancement`):f.item.taskClass??m(`drawer.taskOrdinary`)})]}),(0,z.jsx)(`h3`,{children:f.item.text})]}),(0,z.jsxs)(`section`,{"aria-label":m(`drawer.taskInfo`),className:`personal-task-inspector-fields`,children:[(0,z.jsx)(`h4`,{children:m(`drawer.taskInfo`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`common.owner`)}),(0,z.jsx)(`dd`,{children:f.item.ownerLabel??f.item.claimedBy??m(`drawer.notAssigned`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`common.status`)}),(0,z.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,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,z.jsx)(`dd`,{children:f.item.priority??m(`drawer.notSet`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.dependencies`)}),(0,z.jsx)(`dd`,{children:f.item.dependencies?.join(` · `)||m(`common.none`)})]}),f.item.status===`deferred`||f.item.resumeWhen?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.resumeWhen`)}),(0,z.jsx)(`dd`,{children:f.item.resumeWhen||m(`drawer.notSet`)})]}):null,f.item.resumeWhen?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.resumeState`)}),(0,z.jsx)(`dd`,{children:f.item.resumeReady?m(`drawer.resumeReady`):m(`drawer.resumePending`)})]}):null,f.item.resumeReceiptId?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.resumeReceipt`)}),(0,z.jsx)(`dd`,{children:f.item.resumeReceiptId})]}):null,f.item.validationDigest?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.validationRevision`)}),(0,z.jsx)(`dd`,{children:f.item.validationRevision??0})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.validationDigest`)}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:f.item.validationDigest})})]}),f.item.validationRevisionActor?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.validationRevisionActor`)}),(0,z.jsx)(`dd`,{children:f.item.validationRevisionActor})]}):null]}):null,(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.nextTransition`)}),(0,z.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,z.jsxs)(`div`,{className:`personal-task-inspector-actions`,"aria-label":m(`drawer.taskActions`),children:[(0,z.jsxs)(`details`,{className:`personal-task-management`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(Em,{size:16}),m(`drawer.taskManage`)]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:m(`drawer.reassign`)}),(0,z.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.reassign`),(0,z.jsx)(`select`,{"aria-label":m(`drawer.reassign`),onChange:e=>se(e.target.value),value:I,children:e.filter(e=>e.available).map(e=>(0,z.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))}),(0,z.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-${I}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:I,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,z.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.taskPriority`),(0,z.jsxs)(`select`,{"aria-label":m(`drawer.taskPriority`),value:L,onChange:e=>ce(e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:m(`drawer.taskPriorityChoose`)}),[`P0`,`P1`,`P2`,`P3`,`P4`].map(e=>(0,z.jsx)(`option`,{value:e,children:e},e)),(0,z.jsx)(`option`,{value:`clear`,children:m(`drawer.taskPriorityClear`)})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:!L,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}-priority-${L}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:f.item.goalId,todo_id:f.item.todoId,operation:`edit`,...L===`clear`?{clear_priority:!0}:{priority:L}},summary:`${m(`drawer.taskPriority`)}: ${L===`clear`?m(`drawer.taskPriorityClear`):L}`}),type:`button`,children:m(`timeline.review`)})]}),(0,z.jsx)(`strong`,{children:m(`drawer.taskDeferUntil`)}),(0,z.jsxs)(`label`,{className:`personal-inline-agent-select personal-inline-resume-when`,children:[m(`drawer.taskDeferUntil`),(0,z.jsx)(`input`,{"aria-label":m(`drawer.taskDeferCondition`),"aria-invalid":!!le.trim()&&!we,onChange:e=>ue(e.target.value),placeholder:m(`drawer.taskDeferPlaceholder`),value:le}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:!we,onClick:()=>void Ee(f.item,`defer`,m(`drawer.taskDefer`),we??void 0),type:`button`,children:m(`drawer.taskDeferReview`)}),(0,z.jsx)(`small`,{children:le.trim()&&!we?m(`drawer.taskDeferInvalid`):m(`drawer.taskDeferSupported`)})]}),(0,z.jsx)(`div`,{className:`personal-task-management-secondary`,children:ex.map(e=>(0,z.jsx)(`button`,{onClick:()=>void Ee(f.item,e.operation,m(e.key)),type:`button`,children:m(e.key)},e.operation))})]})]}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void Ee(f.item,`complete`,m(`drawer.taskComplete`)),type:`button`,children:[(0,z.jsx)(hm,{size:17}),m(`drawer.taskComplete`)]})]}):null,f.item.done?(0,z.jsxs)(`div`,{className:`personal-task-completed-note`,children:[(0,z.jsx)(hm,{size:16}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:m(`drawer.taskCompletedTitle`)}),(0,z.jsx)(`small`,{children:m(`drawer.taskCompletedNote`)})]})]}):null]}):null,f.kind===`goal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsx)(`small`,{children:Yi(f.item.state,p)}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.agentSentence}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.tokens`)}),(0,z.jsxs)(`dd`,{children:[Qd(f.item.usage?.tokens24h,m(`drawer.usageNotMeasured`),Yd),` / `,Qd(f.item.usage?.tokens7d,m(`drawer.usageNotMeasured`),Yd)]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.cost`)}),(0,z.jsxs)(`dd`,{children:[Qd(f.item.usage?.costUsd24h,m(`drawer.usageNotMeasured`),Xd),` / `,Qd(f.item.usage?.costUsd7d,m(`drawer.usageNotMeasured`),Xd)]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.duration`)}),(0,z.jsxs)(`dd`,{children:[Qd(f.item.usage?.durationMs24h,m(`drawer.usageNotMeasured`),Zd),` / `,Qd(f.item.usage?.durationMs7d,m(`drawer.usageNotMeasured`),Zd)]})]})]})]}),(0,z.jsx)(Ub,{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,z.jsxs)(z.Fragment,{children:[f.item.repository?(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-repository`,children:[(0,z.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,z.jsx)(`small`,{children:m(`drawer.repository`)}),(0,z.jsx)(`em`,{children:m(`common.readOnly`)})]}),(0,z.jsxs)(`h3`,{children:[(0,z.jsx)(Mm,{size:16}),f.item.repository.label]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.branch`)}),(0,z.jsx)(`dd`,{children:f.item.repository.branch||`detached`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Role`}),(0,z.jsx)(`dd`,{children:m(`drawer.repositoryRole`)})]})]}),(0,z.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,z.jsx)(Cm,{size:15}),m(y===`copied`?`drawer.copyRepositoryDone`:`drawer.copyRepository`)]}),y===`error`?(0,z.jsx)(`p`,{className:`personal-copy-feedback is-error`,role:`status`,children:m(`drawer.copyRepositoryError`)}):y===`copied`?(0,z.jsx)(`p`,{className:`personal-copy-feedback`,role:`status`,children:m(`drawer.copyRepositorySuccess`)}):null]}):null,u?(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,z.jsx)(`small`,{children:m(`drawer.larkConnection`)}),(0,z.jsx)(`h3`,{children:m(`drawer.remoteDetailsUnavailable`)}),(0,z.jsx)(`p`,{children:m(`drawer.remoteDetailsDescription`)})]}):(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,z.jsx)(`small`,{children:m(`drawer.larkConnection`)}),t?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`h3`,{children:[t.app_label,(0,z.jsx)(`span`,{className:`personal-connection-status`,children:m(`drawer.connected`)})]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.group`)}),(0,z.jsx)(`dd`,{children:t.chat_name})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.topic`)}),(0,z.jsxs)(`dd`,{children:[`# `,t.topic_name]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.trigger`)}),(0,z.jsx)(`dd`,{children:t.incoming_mode===`mentions`?m(`lark.someoneMentions`):m(`lark.allMessages`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.replyMode`)}),(0,z.jsx)(`dd`,{children:m(`lark.topicReply`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.autoNotify`)}),(0,z.jsx)(`dd`,{children:e?.humanGateAutoNotifyEnabled?m(`common.on`):m(`common.off`)})]}),e?.lastNotifiedAt?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.lastNotification`)}),(0,z.jsx)(`dd`,{children:e.lastNotifiedAt})]}):null]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:m(`drawer.larkNotConfigured`)}),(0,z.jsx)(`p`,{children:m(`drawer.larkNotConfiguredDescription`)})]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onOpenNotificationSettings?.(f.item.goalId),type:`button`,children:[(0,z.jsx)(dm,{size:16}),m(t?`drawer.larkConfigure`:`drawer.larkConnect`)]})]})]})})(),(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-session`,children:[(0,z.jsx)(`small`,{children:m(`drawer.runDetails`)}),xe?.sessionId?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:Xi(xe.sessionStatus??xe.status,m)}),(0,z.jsx)(`p`,{children:xe.title}),r.onOpenRunSession?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onOpenRunSession?.(xe),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.runLatest`)]}):null]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:m(`drawer.noRun`)}),(0,z.jsx)(`p`,{children:m(`drawer.noRunDescription`)})]})]}),u?null:(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`heartbeat`,f.item.goalId),type:`button`,children:[(0,z.jsx)(Zm,{size:16}),m(`drawer.setupHeartbeat`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`monitor`,f.item.goalId),type:`button`,children:[(0,z.jsx)(mm,{size:16}),m(`drawer.scheduleAdd`)]})]}),f.item.subagentExecution?(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-subagents`,children:[(0,z.jsxs)(`div`,{className:`personal-subagent-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:m(`drawer.subagentLabel`)}),(0,z.jsxs)(`h3`,{children:[(0,z.jsx)(fm,{size:16}),m(`drawer.subagentTitle`)]})]}),(0,z.jsxs)(`button`,{"aria-checked":Oe.enabled,"aria-label":m(P&&ne===`ready`?`drawer.subagentPending`:Oe.enabled?`drawer.subagentDisable`:`drawer.subagentEnable`),className:`personal-subagent-switch`,"data-pending":P&&ne===`ready`?`true`:void 0,disabled:u||ke||!!P||!r.onPreviewGoalSubagentConfiguration,onClick:()=>void Pe(!Oe.enabled),role:`switch`,type:`button`,children:[(0,z.jsx)(`span`,{}),m(P&&ne===`ready`?`drawer.subagentPending`:Oe.enabled?`common.on`:`common.off`)]})]}),(0,z.jsx)(`p`,{children:m(`drawer.subagentDescription`)}),P&&ne===`ready`?(0,z.jsxs)(`div`,{className:`personal-subagent-preview`,children:[(0,z.jsx)(`strong`,{children:m(P.enabled?`drawer.subagentConfirmEnable`:`drawer.subagentConfirmDisable`)}),(0,z.jsx)(`p`,{children:P.enabled?m(`drawer.subagentPreviewSummary`,{count:P.maxChildren,domains:P.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)}):m(`drawer.subagentDisableSummary`)}),P.modelConfig===void 0?null:(0,z.jsxs)(`p`,{children:[m(`drawer.subagentModel`),`: `,P.modelConfig?.model||m(`drawer.subagentModelDefault`),` · `,P.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)]}),(0,z.jsxs)(`p`,{children:[m(`drawer.subagentExecutionConfig`),`: `,P.executionConfig||m(`drawer.subagentExecutionConfigNone`)]}),P.enabled&&P.codexHostCapacity?(0,z.jsx)(`p`,{children:m(P.codexHostCapacity.writeRequired?`drawer.subagentHostCapacityRaise`:`drawer.subagentHostCapacityReady`,{configured:P.codexHostCapacity.configuredChildren??m(`drawer.subagentHostCapacityImplicit`),required:P.codexHostCapacity.requiredChildren})}):null,(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`button`,{className:`personal-primary-action`,onClick:()=>void Fe(),type:`button`,children:m(`common.confirm`)}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:je,type:`button`,children:m(`common.cancel`)})]})]}):null,T?(0,z.jsxs)(`p`,{className:`personal-subagent-feedback is-${ne}`,role:`status`,children:[ne===`previewing`||ne===`applying`?(0,z.jsx)($m,{className:`personal-spin`,size:13}):null,T]}):null,(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentModel`)}),(0,z.jsx)(`dd`,{children:Oe.modelConfig?.model||m(`drawer.subagentModelDefault`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentEffort`)}),(0,z.jsx)(`dd`,{children:Oe.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentCurrentBoundary`)}),(0,z.jsx)(`dd`,{children:Oe.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentChildLimit`)}),(0,z.jsx)(`dd`,{children:Oe.maxChildren||0})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentExecutionConfig`)}),(0,z.jsx)(`dd`,{children:Oe.executionConfig||m(`drawer.subagentExecutionConfigNone`)})]})]}),u?(0,z.jsx)(`p`,{className:`personal-subagent-read-only`,children:m(`drawer.subagentRemoteReadOnly`)}):(0,z.jsxs)(`div`,{className:`personal-subagent-fields`,children:[(0,z.jsxs)(`fieldset`,{className:`personal-subagent-domain-picker`,disabled:ke,children:[(0,z.jsx)(`legend`,{children:m(`drawer.subagentDomains`)}),Ae.length>0?(0,z.jsx)(`div`,{className:`personal-subagent-domain-options`,children:Ae.map(e=>{let t=C.includes(e.value);return(0,z.jsxs)(`label`,{className:`personal-subagent-domain-option${t?` is-selected`:``}`,children:[(0,z.jsx)(`input`,{"aria-label":e.value,checked:t,onChange:t=>Ne(e.value,t.target.checked),type:`checkbox`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.value}),(0,z.jsx)(`small`,{children:m(`drawer.subagentDomainTodoCount`,{count:e.matchingTodoCount})})]})]},e.value)})}):(0,z.jsx)(`p`,{className:`personal-subagent-domain-empty`,children:m(`drawer.subagentDomainsEmpty`)}),(0,z.jsx)(`small`,{children:m(`drawer.subagentDomainsHint`)})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentModel`)}),(0,z.jsx)(`input`,{"aria-label":m(`drawer.subagentModel`),disabled:ke,value:k,placeholder:`gpt-5.6-luna`,onChange:e=>{A(e.target.value),re(null),N(`idle`),E(null)}})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentEffort`)}),(0,z.jsxs)(`select`,{"aria-label":m(`drawer.subagentEffort`),disabled:ke,value:ee,onChange:e=>{j(e.target.value),re(null),N(`idle`),E(null)},children:[(0,z.jsx)(`option`,{value:``,children:m(`drawer.subagentModelDefault`)}),[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`].map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:ke,type:`button`,onClick:()=>{A(`gpt-5.6-luna`),j(`max`),re(null),N(`idle`),E(null)},children:m(`drawer.subagentLunaPreset`)}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:ke,type:`button`,onClick:()=>{A(``),j(``),re(null),N(`idle`),E(null)},children:m(`drawer.subagentClearModel`)}),(0,z.jsx)(`p`,{children:m(`drawer.subagentModelHint`)}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentExecutionConfig`)}),(0,z.jsx)(`input`,{"aria-label":m(`drawer.subagentExecutionConfig`),disabled:ke,onChange:e=>{te(e.target.value),re(null),N(`idle`),E(null)},placeholder:`.loopx/config/delegations.json`,value:M})]}),(0,z.jsx)(`p`,{children:m(`drawer.subagentExecutionConfigHint`)}),(0,z.jsxs)(`label`,{className:`personal-subagent-limit-field`,children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentMaxChildren`)}),(0,z.jsx)(`select`,{"aria-label":m(`drawer.subagentMaxChildren`),disabled:ke,onChange:e=>{O(Number(e.target.value)),re(null),N(`idle`),E(null)},value:D,children:nx.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:ke,onClick:()=>void Pe(Oe.enabled,!0),type:`button`,children:m(`drawer.subagentPreviewBoundary`)})]})]}):null]}):null,f.kind===`run`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{"aria-label":m(`drawer.runView`),className:`personal-run-drawer-tabs`,role:`tablist`,children:[(0,z.jsx)(`button`,{"aria-selected":x===`record`,onClick:()=>S(`record`),role:`tab`,type:`button`,children:m(`drawer.executionRecordAndResult`)}),(0,z.jsx)(`button`,{"aria-selected":x===`details`,onClick:()=>S(`details`),role:`tab`,type:`button`,children:m(`drawer.detailsAndActions`)})]}),x===`record`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card personal-session-summary`,children:[(0,z.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Xi(f.item.sessionStatus??f.item.status,m)]}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.latestActivity}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,z.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]})]})]}),(0,z.jsxs)(`section`,{"aria-label":m(`drawer.executionRecord`),className:`personal-session-message-record`,children:[(0,z.jsx)(`h3`,{children:m(`drawer.executionRecord`)}),f.item.sessionMessages?.length?(0,z.jsx)(`ol`,{children:f.item.sessionMessages.map(e=>(0,z.jsxs)(`li`,{className:`is-${e.role}`,children:[(0,z.jsx)(`i`,{}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:e.role===`user`?m(`drawer.runRoleUser`):e.role===`assistant`?m(`drawer.runRoleAssistant`):m(`drawer.runRoleSystem`)}),e.createdAt?(0,z.jsx)(`time`,{children:new Date(e.createdAt).toLocaleTimeString(p,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}):null]}),(0,z.jsx)(`p`,{children:e.text})]})]},e.messageId))}):(0,z.jsx)(`p`,{className:`personal-session-empty`,children:Se?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,z.jsxs)(`div`,{className:`personal-session-active-step`,children:[(0,z.jsx)(`i`,{}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:m(`drawer.analysis`)}),(0,z.jsx)(`small`,{children:m(`drawer.agentWorking`)})]})]}):null]}),f.item.outputs?.length?(0,z.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-run-outputs-title`,children:[(0,z.jsx)(`h3`,{id:`personal-run-outputs-title`,children:m(`drawer.outputs`)}),(0,z.jsx)(`ol`,{children:f.item.outputs.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`small`,{children:e.createdAt??e.kind??m(`files.emptySummary`)})]})},e.outputId))})]}):null]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Xi(f.item.status,m)]}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.latestActivity}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,z.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.sessionStatus`)}),(0,z.jsx)(`dd`,{children:Xi(f.item.sessionStatus??f.item.status,m)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.sessionRecoverable`)}),(0,z.jsx)(`dd`,{children:f.item.resumable===!1?m(`drawer.resumeNo`):m(`drawer.resumeYes`)})]})]})]}),f.item.sessionStatus===`resume_failed`&&!u?(0,z.jsxs)(`section`,{className:`personal-recovery-panel`,"aria-label":m(`drawer.recoveryFailed`),children:[(0,z.jsx)(`strong`,{children:m(`drawer.recoveryFailed`)}),(0,z.jsx)(`p`,{children:m(`drawer.recoveryDescription`)}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,z.jsx)($m,{size:16}),m(`drawer.recoveryRetry`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.recoveryNewSession`)]})]}):null,u?null:(0,z.jsxs)(`section`,{className:`personal-correction-panel`,children:[(0,z.jsx)(`header`,{children:(0,z.jsxs)(`span`,{children:[(0,z.jsx)(fm,{size:16}),m(`drawer.correctionLabel`,{agent:f.item.agentLabel})]})}),(0,z.jsx)(`p`,{children:m(`drawer.correctionDescription`)}),(0,z.jsxs)(`div`,{className:`personal-correction-composer`,children:[(0,z.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,z.jsx)(`button`,{"aria-label":m(`drawer.correctionSend`),disabled:!h.trim(),onClick:()=>void Te(),type:`button`,children:(0,z.jsx)(nh,{size:16})})]})]}),u?null:(0,z.jsxs)(`details`,{className:`personal-compact-menu personal-run-more`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(Em,{size:17}),m(`drawer.moreRunActions`)]}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`button`,{disabled:!f.item.canInterrupt,onClick:()=>void r.onInterruptRun?.(f.item),type:`button`,children:[(0,z.jsx)(Jm,{size:16}),m(`drawer.runInterrupt`)]}),(0,z.jsxs)(`button`,{disabled:f.item.resumable===!1,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,z.jsx)($m,{size:16}),m(`drawer.recoveryRetry`)]}),(0,z.jsxs)(`button`,{onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.runNewSession`)]}),(0,z.jsxs)(`button`,{onClick:()=>void r.onCloseRunSession?.(f.item),type:`button`,children:[(0,z.jsx)(lh,{size:16}),m(`drawer.runCloseSession`)]})]})]})]})]}):null,f.kind===`output`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsx)(`small`,{children:f.item.kind??`output`}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.summary??m(`drawer.outputRecorded`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.outputTodo`)}),(0,z.jsx)(`dd`,{children:f.item.todoId??m(`drawer.notLinked`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.outputRun`)}),(0,z.jsx)(`dd`,{children:f.item.runId??m(`drawer.notLinked`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Agent`}),(0,z.jsx)(`dd`,{children:f.item.agentLabel??f.item.agentId??`LoopX`})]})]})]}),f.item.report?(0,z.jsxs)(`section`,{className:`personal-report-detail`,"data-testid":`personal-periodic-report-detail`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsxs)(`strong`,{children:[`+`,f.item.report.addedCount]}),m(`files.reportAdded`)]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:f.item.report.changedCount}),m(`files.reportChanged`)]})]}),(0,z.jsxs)(`p`,{children:[f.item.report.periodStartAt,` → `,f.item.report.periodEndAt]}),(0,z.jsx)(`ol`,{children:f.item.report.items.map(e=>(0,z.jsxs)(`li`,{"data-change-kind":e.changeKind,children:[(0,z.jsxs)(`small`,{children:[e.changeKind,` · `,e.status]}),(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`p`,{children:e.summary})]},e.sourceRef))}),(0,z.jsxs)(`footer`,{children:[(0,z.jsxs)(`span`,{children:[m(`files.reportPublication`),`: `,f.item.report.publicationId]}),(0,z.jsxs)(`span`,{children:[m(`files.reportGeneration`),`: `,f.item.report.generationId]})]})]}):null,f.item.safePreview?(0,z.jsx)(`pre`,{"aria-label":m(`drawer.outputSafePreview`),className:`personal-safe-preview`,children:f.item.safePreview}):(0,z.jsx)(`p`,{className:`personal-preview-unavailable`,children:m(`drawer.previewUnavailable`)}),(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:!r.onOpenOutput,onClick:()=>{r.onOpenOutput?.(f.item),c()},type:`button`,children:[(0,z.jsx)(Dm,{size:16}),m(`files.openConversation`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!r.onExportOutput,onClick:()=>void r.onExportOutput?.(f.item),type:`button`,children:[(0,z.jsx)(Tm,{size:16}),m(`files.exportSummary`)]})]})]}):null,f.kind===`proposal`?(0,z.jsxs)(z.Fragment,{children:[f.item.actionKind===`team.plan`&&f.item.status===`applied`?(0,z.jsx)(Gb,{proposal:f.item,t:m}):(0,z.jsxs)(`section`,{className:`personal-proposal-card`,children:[(0,z.jsxs)(`small`,{children:[f.item.actionKind,` · `,f.item.status]}),(0,z.jsx)(`h3`,{children:f.item.title}),f.item.impact?(0,z.jsx)(`p`,{children:f.item.impact}):null,f.item.reviewPlan&&!f.item.reviewPlan.retryOriginal&&f.item.actionKind!==`team.plan`?(0,z.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`&&f.item.actionKind!==`team.plan`?(0,z.jsx)(`p`,{className:`personal-proposal-explainer`,children:m(`drawer.proposalExplainer`)}):null,(0,z.jsx)(`dl`,{children:f.item.fields.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.label}),(0,z.jsx)(`dd`,{children:e.value})]},e.key))})]}),f.item.status===`applied`&&f.item.actionKind!==`team.plan`?(0,z.jsxs)(`p`,{className:`personal-proposal-state ${f.item.actionKind===`operation.execute`&&f.item.reviewPlan?.reason===`readback_unverified`?`is-gated`:`is-applied`}`,children:[(0,z.jsx)(hm,{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,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>{let e=f.item.goalId;c(),r.onOpenGoal?.(e)},type:`button`,children:[(0,z.jsx)(Dm,{size:16}),f.item.actionKind===`goal.create`?m(`drawer.proposalEnterGoal`):m(f.item.actionKind===`team.plan`?`proposal.teamPlan.openGoal`:`drawer.proposalViewGoal`)]}):null,f.item.status===`stale`?(0,z.jsx)(`p`,{className:`personal-proposal-state is-stale`,children:m(`drawer.proposalStale`)}):null,f.item.status===`error`&&!f.item.reviewPlan?.retryOriginal?(0,z.jsxs)(`div`,{className:`personal-proposal-state is-error`,children:[(0,z.jsx)(`span`,{children:f.item.reviewPlan?.reason===`readback_unverified`?m(`actionReview.readback_unverified`):m(`drawer.proposalApplyFailed`)}),f.item.errorMessage?(0,z.jsx)(`small`,{children:f.item.errorMessage}):null,(0,z.jsx)(`small`,{children:m(f.item.actionKind===`team.plan`?`proposal.teamPlan.retryHint`:`drawer.proposalApplyFailedHint`)})]}):null,f.item.status===`rejected`?(0,z.jsx)(`p`,{className:`personal-proposal-state is-error`,children:m(`drawer.proposalRejected`)}):null,f.item.status===`deferred`?(0,z.jsx)(`p`,{className:`personal-proposal-state is-gated`,children:m(`drawer.proposalDeferred`)}):null,f.item.status===`gated`?(0,z.jsxs)(`div`,{className:`personal-proposal-state is-gated`,children:[(0,z.jsxs)(`span`,{children:[(0,z.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,z.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,z.jsxs)(`section`,{className:`personal-detail-card personal-gate-cli-hint`,children:[(0,z.jsx)(`small`,{children:m(`drawer.gateApproveHint`)}),(0,z.jsxs)(`code`,{children:[`loopx todo complete --goal-id `,t,` --todo-id `,n,` --decision-outcome approve`]}),(0,z.jsx)(`small`,{children:m(`drawer.gateRejectHint`)})]})})():null,!u&&f.item.workspaceCandidates?.length?(0,z.jsx)(`div`,{className:`personal-workspace-candidates`,"aria-label":m(`drawer.workspaceCandidates`),children:f.item.workspaceCandidates.map(e=>(0,z.jsxs)(`button`,{onClick:()=>void r.onSelectWorkspaceCandidate?.(f.item,e.workspaceRef),type:`button`,children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsx)(`small`,{children:e.workspaceRef})]},e.workspaceRef))}):null,!u&&f.item.actionKind!==`operation.execute`&&f.item.status===`error`?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void(f.item.actionKind===`team.plan`||f.item.reviewPlan?.retryOriginal?r.onApplyProposal?.(f.item):r.onTransitionProposal?.(f.item,`regenerate`)),type:`button`,children:[(0,z.jsx)($m,{size:17}),m(f.item.reviewPlan?.retryOriginal?`drawer.retryOriginal`:f.item.actionKind===`team.plan`?`proposal.teamPlan.retry`:`drawer.proposalRegenerate`)]}):!u&&f.item.actionKind!==`operation.execute`&&f.item.status!==`gated`&&(f.item.actionKind!==`team.plan`||f.item.status!==`applied`)?(0,z.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,z.jsx)(hm,{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,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,z.jsx)($m,{size:16}),m(`drawer.proposalRecheck`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&[`ready`,`gated`].includes(f.item.status)?(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`defer`),type:`button`,children:m(`drawer.proposalDefer`)}),(0,z.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,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:c,type:`button`,children:m(`drawer.proposalClose`)})]}):null,f.kind===`schedule`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsxs)(`small`,{children:[f.item.scheduleKind===`heartbeat`?`Goal Heartbeat`:`continuous_monitor`,` · `,f.item.status??`active`]}),(0,z.jsx)(`h3`,{children:f.item.label}),(0,z.jsx)(`p`,{children:f.item.target??f.item.schedule??m(`drawer.scheduleDefaultTarget`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleTimezone`)}),(0,z.jsx)(`dd`,{children:f.item.timezone??m(`drawer.scheduleLocalTimezone`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleNext`)}),(0,z.jsx)(`dd`,{children:f.item.nextRunAt??m(`drawer.schedulePending`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleLast`)}),(0,z.jsx)(`dd`,{children:f.item.previousRunAt??m(`drawer.scheduleNeverRun`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleNotification`)}),(0,z.jsx)(`dd`,{children:f.item.notificationRule??m(`drawer.scheduleDefaultNotification`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleStopCondition`)}),(0,z.jsx)(`dd`,{children:f.item.stopCondition??m(`drawer.scheduleDefaultStop`)})]})]})]}),!u&&f.item.scheduleKind===`monitor`?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`run_now`),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.scheduleRunNow`)]}):null,u?null:(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.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,z.jsx)(Ym,{size:16}):(0,z.jsx)(Jm,{size:16}),f.item.status===`paused`?m(`drawer.scheduleResume`):m(`drawer.schedulePause`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`edit`),type:`button`,children:[(0,z.jsx)(mm,{size:16}),m(`drawer.scheduleEdit`)]})]}),u?null:(0,z.jsxs)(`button`,{className:`personal-danger-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`stop`),type:`button`,children:[(0,z.jsx)(lh,{size:16}),m(`drawer.scheduleStop`,{kind:f.item.scheduleKind===`heartbeat`?` Heartbeat`:m(`drawer.titleSchedule`)})]}),(0,z.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-execution-history-title`,children:[(0,z.jsx)(`h3`,{id:`personal-execution-history-title`,children:m(`drawer.executionHistory`)}),f.item.executionHistory?.length?(0,z.jsx)(`ol`,{children:f.item.executionHistory.map((e,t)=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsx)(`small`,{children:e.timestamp})]}),(0,z.jsx)(`em`,{className:`is-${e.status}`,children:e.status})]},`${e.timestamp}:${e.runId??t}`))}):(0,z.jsx)(`p`,{children:m(`drawer.noExecutionHistory`)})]})]}):null,f.kind===`run`||f.kind===`proposal`||f.kind===`schedule`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`button`,{"aria-expanded":_,className:`personal-diagnostics-trigger`,onClick:()=>v(e=>!e),type:`button`,children:[(0,z.jsx)(`span`,{children:m(`drawer.advancedDiagnostics`)}),(0,z.jsx)(gm,{className:_?`is-open`:``,size:16})]}),_?(0,z.jsxs)(`div`,{className:`personal-diagnostics`,children:[(0,z.jsxs)(`code`,{children:[`goal_id: `,ye]}),(0,z.jsxs)(`code`,{children:[`kind: `,f.kind]}),f.kind===`run`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`code`,{children:[`session_id: `,f.item.sessionId??m(`drawer.notLinked`)]}),(0,z.jsxs)(`code`,{children:[`turn_id: `,f.item.turnId??m(`common.none`)]}),(0,z.jsxs)(`code`,{children:[`adapter: `,f.item.agentId]}),(0,z.jsxs)(`code`,{children:[`status: `,f.item.sessionStatus??f.item.status]})]}):f.kind===`proposal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`code`,{children:[`action: `,f.item.actionKind]}),(0,z.jsxs)(`code`,{children:[`status: `,f.item.status]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`code`,{children:[`schedule_id: `,f.item.scheduleId]}),(0,z.jsxs)(`code`,{children:[`status: `,f.item.status??`active`]})]})]}):null]}):null]})]})}var sx=[`checking`,`connecting`,`downloading`,`installing_app`,`installing_runtime`],cx={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 lx(e,t=`update_failed`){return{phase:`error`,details:{code:typeof e==`string`&&Object.hasOwn(cx,e)?e:t}}}function ux(){let{locale:e}=Ji(),t=e===`zh-CN`,[n,r]=(0,R.useState)(!1),i=(0,R.useRef)(null),[a,o]=(0,R.useState)(`stable`),[s,c]=(0,R.useState)({phase:`idle`}),[l,u]=(0,R.useState)(``),[d,f]=(0,R.useState)(!1),p=(0,R.useRef)(!1),m=window.__TAURI__?.core.invoke,h=sx.includes(s.phase);(0,R.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,R.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(lx(t))})}).catch(()=>{e&&c(lx(null,`desktop_status_unavailable`))}),()=>{e=!1}},[m]),(0,R.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(lx(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.`,runtime_pairing_required:t?`本机 CLI 运行时与 App 自带运行时不一致。回到 App 启动界面可「更新 App 与运行时」或「回退 CLI」。`:`This host's CLI runtime and the App's bundled runtime differ. On the App boot screen, update both or use the App's runtime.`,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:cx[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,z.jsxs)(`div`,{className:`personal-desktop-update`,children:[(0,z.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,z.jsx)(Tm,{size:16,"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:v}),(0,z.jsx)(vm,{size:14,"aria-hidden":`true`})]}),(0,z.jsxs)(`section`,{ref:i,popover:`auto`,id:`desktop-update-panel`,className:`personal-update-panel`,"aria-label":t?`LoopX 更新`:`LoopX updates`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:t?`LoopX 更新`:`LoopX updates`}),(0,z.jsx)(`button`,{type:`button`,"aria-label":t?`关闭更新面板`:`Close updates`,onClick:()=>i.current?.hidePopover(),children:(0,z.jsx)(gh,{size:16,"aria-hidden":`true`})})]}),(0,z.jsxs)(`small`,{children:[l,` · `,a===`main`?t?`main 预览版`:`main preview`:t?`稳定版`:`Stable`]}),s.details?.version?(0,z.jsxs)(`p`,{children:[t?`目标版本:`:`Target: `,s.details.version]}):null,(0,z.jsxs)(`p`,{role:`status`,"aria-live":`polite`,children:[h?(0,z.jsx)(Qm,{className:`is-spinning`,size:14,"aria-hidden":`true`}):null,_[s.phase]]}),s.phase===`downloading`&&s.details?.total?(0,z.jsx)(`progress`,{"aria-label":t?`下载进度`:`Download progress`,max:s.details.total,value:s.details.received??0}):null,m?(0,z.jsx)(`div`,{className:`personal-update-actions`,children:s.phase===`restart_required`?(0,z.jsx)(`button`,{type:`button`,onClick:()=>void g(`restart`),children:t?`重启完成更新`:`Restart to finish`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void g(`check`),children:t?`检查更新`:`Check for updates`}),s.phase===`available`?(0,z.jsx)(`button`,{type:`button`,onClick:()=>void g(`apply`),children:t?`更新并准备重启`:`Install update`}):null]})}):(0,z.jsx)(`p`,{children:t?`请在 LoopX App 中更新;浏览器自身无需安装包。`:`Update from the LoopX App; the browser needs no installer.`}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t?`高级选项`:`Advanced options`}),(0,z.jsxs)(`label`,{children:[t?`更新通道`:`Update channel`,(0,z.jsxs)(`select`,{disabled:h||s.phase===`restart_required`,value:a,onChange:e=>{o(e.target.value),c({phase:`idle`})},children:[(0,z.jsx)(`option`,{value:`stable`,children:t?`稳定版(推荐)`:`Stable (recommended)`}),(0,z.jsx)(`option`,{value:`main`,children:t?`main 预览版`:`main preview`})]})]}),(0,z.jsx)(`p`,{children:t?`App 与匹配的 CLI 一起更新,服务可能短暂断开。不删除 Goal 数据。`:`Updates the App and matching CLI. Services may briefly disconnect. Goal data is not deleted.`}),m?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{children:t?`启动失败时,可重装当前 App 随附的运行时。`:`If startup fails, reinstall this App's bundled runtime.`}),(0,z.jsx)(`button`,{disabled:h||s.phase===`restart_required`,type:`button`,onClick:()=>void g(`repair`),children:t?`修复当前版本`:`Repair this version`})]}):null,m&&d?(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t?`恢复上个版本`:`Restore previous version`}),(0,z.jsx)(`p`,{children:t?`将恢复已保留的 App 和它的运行时,需要重启。`:`Restore the retained App and its runtime, then restart.`}),(0,z.jsx)(`button`,{disabled:h,type:`button`,onClick:()=>void g(`rollback`),children:t?`确认恢复上版`:`Restore previous version`})]}):null]})]})]})}var dx=e=>`loopx-sidebar-goal-order-v1:${encodeURIComponent(e)}`;function fx(e){try{let t=JSON.parse(e??`null`);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?[...new Set(t)]:[]}catch{return[]}}function px(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 mx(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 hx(e,t){let n=dx(t),[r,i]=(0,R.useState)(()=>{try{return fx(localStorage.getItem(n))}catch{return[]}}),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(null),d=(0,R.useRef)(null),f=(0,R.useRef)(!1),p=px(e,r),m=p.map(e=>e.goalId);function h(t,a,s){let l=mx(r,m,t,a,s);if(l===r)return;i(l);let u=px(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 gx=`/ssh-hosts`,_x=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/;function vx(e){return typeof e==`string`&&_x.test(e.trim())}function yx(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!vx(t)||n.has(t)?[]:(n.add(t),[{alias:t}])}),schemaVersion:`ssh_host_catalog_v0`}}async function bx(e=fetch,t=gx){let n=await e(t,{cache:`no-store`});if(!n.ok)throw Error(`无法读取本机 SSH Host(HTTP ${n.status})。`);return yx(await n.json())}function xx(e,t){let n=e.trim();if(!vx(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 Sx=`/api/ssh-source/ensure`,Cx=`/api/ssh-source/goal-lifecycle`;async function wx(e,t){let n=await fetch(Sx,{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 Tx(e,t,n,r,i=fetch){let a=await i(Cx,{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 Ex({activeSource:e,connectionState:t,errorMessage:n,onAdd:r,onConfiguredHostsLoaded:i,onRemove:a,onSelect:o,sources:s}){let{t:c}=Ji(),[l,u]=(0,R.useState)(!1),[d,f]=(0,R.useState)(null),[p,m]=(0,R.useState)(`configured`),[h,g]=(0,R.useState)([]),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(!1),[C,w]=(0,R.useState)(``),[T,E]=(0,R.useState)(``),[D,O]=(0,R.useState)(`8876`),[k,A]=(0,R.useState)(``),ee=`configured:`,j=[...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:`${ee}${e.alias}`}))],M=(0,R.useMemo)(()=>h.some(e=>e.alias===C)?xx(C,D):{error:c(`source.selectHost`)},[h,C,D,c]);(0,R.useEffect)(()=>{te()},[]);async function te(){b(!0),v(null);try{let e=await bx();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 ne(){u(!0),m(`configured`),f(null),te()}function N(){u(!1),m(`configured`),v(null),S(!1),w(``),f(null),E(``),O(`8876`),A(``)}function P(){let e=r({label:T,statusUrl:k});if(e.error){f(e.error);return}N()}function re(){if(`error`in M){f(M.error??c(`source.invalid`));return}let e=r({ensureTunnel:!0,hostAlias:M.hostAlias,label:M.label,statusUrl:M.statusUrl});if(e.error){f(e.error);return}N()}function ie(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=xx(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 ae(){if(`error`in M){f(M.error??c(`source.invalid`));return}try{await navigator.clipboard.writeText(M.command),S(!0),f(null)}catch{f(c(`source.copyError`))}}return(0,z.jsxs)(`section`,{"aria-label":c(`source.controlPlane`),className:`personal-status-source`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`span`,{children:`Control plane`}),(0,z.jsx)(`button`,{"aria-label":c(`source.addSsh`),onClick:ne,title:c(`source.add`),type:`button`,children:(0,z.jsx)(Xm,{size:14})})]}),(0,z.jsx)(fb,{ariaLabel:c(`source.select`),className:`personal-status-source-select`,icon:(0,z.jsx)(ih,{size:15}),onChange:e=>{if(e.startsWith(ee)){ie(e.slice(11));return}o(e)},options:j,value:e.id}),(0,z.jsxs)(`div`,{className:`personal-status-source-meta`,children:[(0,z.jsxs)(`span`,{className:`is-${t}`,children:[(0,z.jsx)(`i`,{}),c(t===`loading`?`source.connecting`:t===`error`?`source.notAvailable`:`source.connected`)]}),(0,z.jsx)(`small`,{children:e.readOnly?c(`source.readOnly`):c(`source.localInteractive`)}),e.kind===`ssh_tunnel`?(0,z.jsx)(`button`,{"aria-label":c(`source.remove`,{source:e.label}),onClick:()=>a(e.id),title:c(`source.removeCurrent`),type:`button`,children:(0,z.jsx)(fh,{size:12})}):null]}),n?(0,z.jsx)(`p`,{className:`personal-status-source-error`,role:`alert`,children:n}):null,l?(0,z.jsxs)(`div`,{className:`personal-status-source-form`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:c(`source.addSsh`)}),(0,z.jsx)(`button`,{"aria-label":c(`source.closeForm`),onClick:N,type:`button`,children:(0,z.jsx)(gh,{size:13})})]}),(0,z.jsxs)(`div`,{"aria-label":c(`source.addMethod`),className:`personal-status-source-modes`,role:`tablist`,children:[(0,z.jsx)(`button`,{"aria-selected":p===`configured`,onClick:()=>{m(`configured`),f(null)},role:`tab`,type:`button`,children:c(`source.configured`)}),(0,z.jsx)(`button`,{"aria-selected":p===`manual`,onClick:()=>{m(`manual`),f(null)},role:`tab`,type:`button`,children:c(`source.manual`)})]}),p===`configured`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.configuredCount`,{count:h.length})}),(0,z.jsxs)(`span`,{className:`personal-status-source-field-row`,children:[(0,z.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,z.jsx)(`datalist`,{id:`loopx-configured-ssh-hosts`,children:h.map(e=>(0,z.jsx)(`option`,{value:e.alias},e.alias))}),(0,z.jsx)(`button`,{"aria-label":c(`source.refreshHosts`),disabled:y,onClick:()=>void te(),title:c(`source.refreshHosts`),type:`button`,children:(0,z.jsx)(eh,{size:13})})]})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.localPort`)}),(0,z.jsx)(`input`,{"aria-label":c(`source.localPort`),inputMode:`numeric`,onChange:e=>{O(e.target.value),S(!1)},value:D})]}),(0,z.jsxs)(`div`,{className:`personal-status-source-command`,children:[(0,z.jsx)(`code`,{children:`error`in M?c(`source.tunnelCommandPending`):M.command}),(0,z.jsxs)(`button`,{"aria-label":c(`source.copyCommand`),disabled:`error`in M,onClick:()=>void ae(),type:`button`,children:[(0,z.jsx)(Cm,{size:12}),c(x?`source.copied`:`source.copy`)]})]}),_?(0,z.jsx)(`p`,{className:`is-error`,children:_}):null,(0,z.jsx)(`p`,{children:c(`source.description`)}),(0,z.jsx)(`button`,{className:`personal-status-source-add`,disabled:`error`in M,onClick:re,type:`button`,children:c(`source.addConfigured`)})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.name`)}),(0,z.jsx)(`input`,{autoFocus:!0,maxLength:48,onChange:e=>E(e.target.value),placeholder:c(`source.namePlaceholder`),value:T})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.statusUrl`)}),(0,z.jsx)(`input`,{onChange:e=>A(e.target.value),placeholder:`http://127.0.0.1:8876/status.json`,value:k})]}),(0,z.jsx)(`p`,{children:(0,z.jsx)(`code`,{children:`ssh -N -L 8876:127.0.0.1:8766 `})}),(0,z.jsx)(`p`,{children:c(`source.manualDescription`)}),(0,z.jsx)(`button`,{className:`personal-status-source-add`,onClick:P,type:`button`,children:c(`source.addConfigured`)})]}),d?(0,z.jsx)(`p`,{className:`is-error`,role:`alert`,children:d}):null]}):null]})}var Dx={需修复:`is-danger`,等你:`is-warning`,等待条件:`is-info`,推进中:`is-success`,安静运行:`is-quiet`,已完成:`is-quiet`,已停止:`is-stopped`};function Ox({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}=Ji(),[m,h]=(0,R.useState)(!1),g=hx(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,z.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,z.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,z.jsx)(`span`,{className:`personal-goal-state-dot ${e.loadState?``:Dx[e.state]}`}),(0,z.jsxs)(`span`,{className:`personal-goal-link-copy`,children:[(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsxs)(`small`,{children:[e.loadState&&(!t||u===e.goalId)?p(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Yi(e.state,f),e.needsYou&&!t?` · ${p(`home.lane.needsYou`)}`:``]})]}),(0,z.jsx)(_m,{size:15})]}),!t&&m?(0,z.jsxs)(`div`,{className:`personal-goal-move-actions`,children:[(0,z.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,z.jsx)(lm,{"aria-hidden":`true`,size:13})}),(0,z.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,z.jsx)(am,{"aria-hidden":`true`,size:13})})]}):null,c&&y(t?`resume`:`stop`)?(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.jsx)(zm,{size:13}):t?(0,z.jsx)($m,{size:13}):(0,z.jsx)(Jm,{size:13})}),t&&y(`delete`)?(0,z.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,z.jsx)(fh,{size:13})}):null]}):null]},e.goalId);return(0,z.jsxs)(`div`,{className:`personal-goal-directory`,children:[(0,z.jsxs)(`div`,{className:`personal-sidebar-brand`,children:[(0,z.jsx)(`span`,{className:`personal-brand-mark`,children:(0,z.jsx)(fm,{size:18})}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:`LoopX`})})]}),d?(0,z.jsx)(Ex,{...d}):null,(0,z.jsxs)(`nav`,{"aria-label":p(`home.workspace`),className:`personal-sidebar-nav`,children:[(0,z.jsxs)(`button`,{"aria-current":u===null?`page`:void 0,className:`personal-manager-link`,onClick:()=>l(null),type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-manager-icon`,children:(0,z.jsx)(fm,{size:17})}),(0,z.jsx)(`span`,{children:p(`sidebar.manager`)}),e>0?(0,z.jsx)(`span`,{className:`personal-sidebar-count`,children:e}):null,(0,z.jsx)(_m,{size:15})]}),(0,z.jsxs)(`div`,{className:`personal-sidebar-section-title`,children:[(0,z.jsx)(`span`,{children:`Goals`}),(0,z.jsxs)(`span`,{className:`personal-sidebar-title-actions`,children:[(0,z.jsx)(`small`,{children:_.length}),(0,z.jsx)(`button`,{"aria-label":p(`sidebar.sortGoals`),title:p(`sidebar.sortGoals`),"aria-pressed":m,onClick:()=>h(!m),type:`button`,children:(0,z.jsx)(cm,{"aria-hidden":`true`,size:15})}),a?(0,z.jsx)(`button`,{"aria-label":p(`sidebar.createGoal`),onClick:a,type:`button`,children:(0,z.jsx)(Xm,{size:15})}):null]})]}),g.saveFailed?(0,z.jsx)(`p`,{role:`status`,children:p(`sidebar.orderNotSaved`)}):null,(0,z.jsx)(`span`,{className:`personal-sr-only`,role:`status`,children:g.lastMoved?p(`sidebar.goalMoved`,{goal:g.lastMoved.title,position:g.lastMoved.position}):``}),(0,z.jsx)(`div`,{className:`personal-goal-list`,children:_.map(e=>b(e,!1))}),v.length||n.phase===`loading`||n.phase===`error`?(0,z.jsxs)(`details`,{className:`personal-stopped-goals`,open:n.phase===`error`||void 0,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(gm,{size:13}),(0,z.jsx)(`span`,{children:p(`sidebar.stopped`)}),n.phase===`loading`?(0,z.jsx)(zm,{"aria-label":p(`sidebar.stoppedLoading`),className:`is-spinning`,size:13}):(0,z.jsx)(`small`,{children:v.length})]}),(0,z.jsxs)(`div`,{className:`personal-goal-list is-stopped`,children:[n.phase===`error`?(0,z.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`alert`,children:[(0,z.jsx)(`span`,{children:p(`sidebar.stoppedLoadFailed`)}),s?(0,z.jsx)(`button`,{onClick:s,type:`button`,children:p(`sidebar.retryStopped`)}):null]}):null,v.map(e=>b(e,!0))]})]}):null]}),(0,z.jsxs)(`div`,{className:`personal-sidebar-footer`,children:[(0,z.jsx)(ux,{}),o?(0,z.jsxs)(`button`,{"aria-label":p(`settings.open`),className:`personal-sidebar-utility`,onClick:o,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-sidebar-utility-icon`,children:(0,z.jsx)(ah,{size:17})}),(0,z.jsx)(`span`,{className:`personal-sidebar-utility-copy`,children:(0,z.jsx)(`strong`,{children:p(`settings.open`)})}),(0,z.jsx)(_m,{"aria-hidden":`true`,size:15})]}):null]})]})}var kx=J({ok:X(!0),total:G().int().nonnegative(),next_cursor:W().nullable(),items:q(J({todo_id:W(),text:W(),claimed_by:W().nullable(),evidence:W().nullable(),priority:W().nullable(),task_class:W().nullable()})).max(40)});function Ax({goal:e,agentId:t,seed:n,enabled:r,listView:i=!1,onSelect:a}){let{t:o}=Ji(),s=(0,R.useId)(),[c,l]=(0,R.useState)(!1),u=!i||c,d=i?96:148,[f,p]=(0,R.useState)(n),[m,h]=(0,R.useState)(t===`all`?e.doneTodoCount??n.length:n.length),[g,_]=(0,R.useState)(void 0),[v,y]=(0,R.useState)(!1),[b,x]=(0,R.useState)(!1),[S,C]=(0,R.useState)(!1),[w,T]=(0,R.useState)({top:0,height:600}),[E,D]=(0,R.useState)(null),O=(0,R.useRef)(null),k=(0,R.useRef)(null),[A,ee]=(0,R.useState)(0);(0,R.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 j=g===void 0||w.top+w.height>=f.length*d-d*2;(0,R.useEffect)(()=>{if(!r||!u||!j||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=kx.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,j,g,b,A,e.goalId,t,v]),(0,R.useEffect)(()=>{O.current&&(O.current.scrollTop=0),T({top:0,height:O.current?.clientHeight??600}),D(null)},[i]);let M=Math.max(0,Math.floor(w.top/d)-3),te=Math.min(f.length,Math.ceil((w.top+w.height)/d)+3),ne=Array.from({length:Math.max(0,te-M)},(e,t)=>M+t);return E!==null&&El(e=>!e),children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,children:c?`▾`:`▸`}),` `,o(`tasks.completed`)]}):(0,z.jsxs)(`strong`,{children:[(0,z.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-done`}),o(`tasks.completed`)]}),(0,z.jsx)(`span`,{children:m})]}),(0,z.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,z.jsx)(`div`,{className:`personal-completed-window`,style:{height:f.length*d},children:ne.map(t=>{let n=f[t];return(0,z.jsx)(`div`,{className:`personal-task-card personal-completed-row`,style:{top:t*d,height:d},children:(0,z.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,z.jsx)(`span`,{className:`is-done`,children:`✓`}),(0,z.jsx)(`strong`,{children:$d(n.text,112)}),(0,z.jsx)(`small`,{children:n.claimedBy??e.agentLabel??e.agentId})]})},n.todoId)})}),(0,z.jsx)(`div`,{className:`personal-completed-footer`,role:`status`,children:v?o(`tasks.historyLoading`):b?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{children:o(S?`tasks.historyExpired`:`tasks.historyError`)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>{S&&(_(void 0),O.current&&(O.current.scrollTop=0)),C(!1),x(!1),ee(e=>e+1)},children:o(`tasks.historyRetry`)})]}):r?g===null?o(`tasks.historyEnd`):(0,z.jsx)(`button`,{type:`button`,onClick:()=>{O.current&&(O.current.scrollTop=f.length*d)},children:o(`tasks.historyMore`)}):o(`tasks.historyLocalOnly`)})]})]})}function jx({children:e,count:t,label:n,tone:r,listView:i=!1}){let a=(0,R.useId)(),o=(0,R.useRef)(null),s=(0,R.useRef)([]),c=(0,R.useRef)(null),[l,u]=(0,R.useState)({after:!1,before:!1}),d=(0,R.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,R.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,R.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,z.jsxs)(`details`,{className:`personal-task-group tone-${r}`,open:!0,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(gm,{size:16}),(0,z.jsx)(`strong`,{children:n}),(0,z.jsx)(`span`,{children:t})]}),(0,z.jsx)(`div`,{className:`personal-task-list-rows`,children:e})]}):(0,z.jsxs)(`section`,{className:`personal-object-list personal-task-lane`,children:[(0,z.jsxs)(`header`,{id:a,children:[(0,z.jsxs)(`strong`,{children:[(0,z.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-${r}`}),n]}),(0,z.jsx)(`span`,{children:t})]}),(0,z.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 Mx({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}=Ji(),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)({goalId:``,laneId:`all`}),h=(0,R.useRef)(null);(0,R.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:e.priority===`P3`?3:e.priority===`P4`?4:50,v=(0,R.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,A=D>=0&&E.slice(D+1).some(e=>e.message.role===`assistant`&&e.message.pending);return(0,z.jsxs)(`section`,{"aria-label":u(`header.tasks`),className:`personal-task-board${d?` is-list-view`:``}`,children:[(0,z.jsxs)(`header`,{className:`personal-task-view-toolbar`,children:[(0,z.jsx)(`div`,{children:(0,z.jsx)(`strong`,{children:u(`header.tasks`)})}),(0,z.jsxs)(`div`,{className:`personal-task-view-switch`,role:`group`,"aria-label":u(`tasks.viewLabel`),children:[(0,z.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(!0),children:u(`tasks.listView`)}),(0,z.jsx)(`button`,{type:`button`,"aria-pressed":!d,onClick:()=>f(!1),children:u(`tasks.boardView`)})]})]}),v.length>1?(0,z.jsxs)(`section`,{"aria-label":u(`tasks.agentLaneFilter`),className:`personal-task-lane-filter`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(fm,{size:15}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:u(`tasks.agentLane`)})})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{className:`sr-only`,children:u(`tasks.agentLaneFilter`)}),(0,z.jsxs)(`select`,{"aria-label":u(`tasks.agentLaneFilter`),onChange:e=>m({goalId:t.goalId,laneId:e.target.value}),value:y,children:[(0,z.jsx)(`option`,{value:`all`,children:u(`tasks.allAgentLanes`,{count:v.length})}),v.map(e=>(0,z.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))]}),(0,z.jsx)(gm,{"aria-hidden":!0,size:14})]})]}):null,O?(0,z.jsxs)(`section`,{"aria-label":u(`tasks.chatRecent`),className:`personal-task-chat-receipt`,children:[(0,z.jsx)(`span`,{className:`personal-task-chat-icon`,children:(0,z.jsx)(Um,{size:18})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:u(A?`tasks.chatPending`:k?`tasks.chatAgentReplied`:`tasks.chatRecent`)}),(0,z.jsx)(`small`,{children:k?.returnDelivery?u(`tasks.chatReturn`):k?.agentLabel})]}),(0,z.jsx)(`div`,{className:`personal-task-reply-preview`,children:(0,z.jsx)(wb,{text:A?u(`tasks.chatPendingDescription`):(k?.text??O.text).trim().split(/\r?\n/,1)[0]})})]}),(0,z.jsxs)(`footer`,{children:[(0,z.jsxs)(`button`,{onClick:i,type:`button`,children:[(0,z.jsx)(Um,{size:14}),u(`tasks.chatViewReply`)]}),k&&!A&&r?(0,z.jsxs)(`button`,{onClick:()=>r(k.text),type:`button`,children:[(0,z.jsx)(Rm,{size:14}),u(`tasks.convertToTask`)]}):null]})]}):null,(0,z.jsxs)(`div`,{className:d?`personal-task-grouped-list`:`personal-task-kanban`,children:[(0,z.jsxs)(jx,{listView:d,count:g.length,label:u(`timeline.waitingConfirmation`),tone:`attention`,children:[g.map(e=>{let t=Zi(e.updatedAt,u);return(0,z.jsxs)(`button`,{onClick:()=>s({item:e,kind:`attention`}),type:`button`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`is-attention`,children:`!`}),(0,z.jsx)(`strong`,{children:e.text}),(0,z.jsxs)(`small`,{children:[(0,z.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?u(`tasks.blocked`):u(`tasks.pending`)}),t?(0,z.jsx)(`span`,{className:`personal-task-age`,children:u(`tasks.waitingAge`,{age:t})}):null]})]},e.todoId)}),g.length?null:(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyConfirm`)})]}),(0,z.jsxs)(jx,{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,z.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,z.jsxs)(`button`,{"aria-pressed":c===e.todoId,onClick:()=>s({item:n,kind:`todo`}),type:`button`,children:[(0,z.jsx)(`span`,{children:`○`}),(0,z.jsx)(`strong`,{children:e.text}),(0,z.jsxs)(`small`,{children:[e.priority?(0,z.jsx)(`span`,{className:`personal-priority-badge is-${e.priority.toLowerCase()}`,children:e.priority}):null,e.status===`blocked`?(0,z.jsx)(`span`,{className:`personal-priority-badge is-blocked`,children:u(`tasks.blocked`)}):null,r?(0,z.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,z.jsx)(`span`,{className:`personal-task-session-status`,children:u(`drawer.taskStatusDeferred`)}):r?null:(0,z.jsx)(`span`,{className:`personal-task-session-status`,children:u(`tasks.waiting`)}),e.claimedBy??t.agentLabel??t.agentId]})]}),(0,z.jsxs)(`div`,{className:`personal-task-card-actions`,children:[r?(0,z.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,z.jsx)(Dm,{size:14}),(0,z.jsx)(`span`,{children:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`)})]}):null,a?(0,z.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,z.jsx)(zm,{className:`personal-spin`,size:14}):(0,z.jsx)(hm,{size:14})}):null,(0,z.jsx)(`button`,{"aria-label":u(`tasks.moreActions`,{name:e.text}),onClick:()=>s({item:n,kind:`todo`}),title:u(`common.actions`),type:`button`,children:(0,z.jsx)(Em,{size:14})})]})]},e.todoId)}),x.length?null:(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyRunning`)})]}),(0,z.jsxs)(jx,{listView:d,count:C.length,label:u(`tasks.scheduled`),tone:`schedule`,children:[C.map(e=>(0,z.jsxs)(`button`,{onClick:()=>s({item:e.schedule,kind:`schedule`}),type:`button`,children:[(0,z.jsx)(`span`,{children:`◷`}),(0,z.jsx)(`strong`,{children:e.schedule.label}),(0,z.jsx)(`small`,{children:e.schedule.status===`paused`?u(`schedule.paused`):u(`schedule.active`)})]},e.id)),C.length?null:(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptySchedules`)})]}),(0,z.jsx)(Ax,{goal:t,agentId:y,seed:S,enabled:e,listView:d,onSelect:s},`${t.goalId}:${y}:${e}`)]}),T?(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyGoal`)}):null]})}var Nx=yd(W(),q(W())),Px=J({node_id:W().min(1),kind:Y([`deliverable`,`gate`,`gate_summary`,`lease`,`validation`,`repair`,`handoff`,`evidence`]),title:W(),state:Y([`open`,`ready`,`blocked`,`done`,`waiting`,`unknown`]),refs:Nx,owner_agent:W().optional(),actor_agent:W().optional(),from_agent:W().optional(),to_agent:W().optional()}),Fx=J({edge_id:W().min(1),from_node_id:W(),to_node_id:W(),relation:Y([`depends_on`,`blocks`,`validates`,`repairs`,`audits`,`continues`,`hands_off_to`,`supersedes`]),reason:W(),refs:Nx.optional()}),Ix=J({schema_version:X(`task_graph_projection_v0`),mode:X(`read_only`),goal_id:W(),generated_at:W().nullable(),truth_contract:J({projection_is_writable:X(!1),write_api:X(!1)}),limits:J({user_gate_node_limit:G().int().nonnegative(),user_gate_open_count:G().int().nonnegative(),user_gate_truncated_count:G().int().nonnegative(),source_truncated:K().optional(),predecessor_truncated:K().optional(),missing_predecessor_count:G().int().nonnegative().optional(),topology_complete:K().optional()}),nodes:q(Px),edges:q(Fx)}).superRefine((e,t)=>{let n=new Set(e.nodes.map(e=>e.node_id)),r=new Set(e.edges.map(e=>e.edge_id));(n.size!==e.nodes.length||r.size!==e.edges.length||e.edges.some(e=>!n.has(e.from_node_id)||!n.has(e.to_node_id)))&&t.addIssue({code:`custom`,message:`Graph identities or endpoints are invalid`})}),Lx=J({ok:X(!0),goal_id:W(),observed_at:W().datetime({offset:!0}),graph:Ix.nullable(),acceptance:uf.nullable()});function Rx(e,t){let n=Lx.parse(e);if(n.goal_id!==t||n.graph&&n.graph.goal_id!==t||n.acceptance&&n.acceptance.goal_id!==t)throw Error(`Review source does not match the selected Goal`);return n}async function zx(e,t){let n=new URLSearchParams({goal_id:e}),r=await fetch(`/api/chat/delivery-review?${n}`,{signal:t,cache:`no-store`});if(!r.ok)throw Error(`Review unavailable (${r.status})`);return Rx(await r.json(),e)}function Bx(e,t,n,r){let i=new Set([r]);for(let t of e.edges)t.from_node_id===r&&i.add(t.to_node_id),t.to_node_id===r&&i.add(t.from_node_id);let a=t.trim().toLocaleLowerCase();return e.nodes.filter(e=>{let t=[e.title,e.owner_agent,e.actor_agent,e.from_agent,e.to_agent,...Object.values(e.refs).flat()].some(e=>e?.toLocaleLowerCase().includes(a)),r=n===`all`||n===`related`&&i.has(e.node_id)||n===`conditions`&&[`gate`,`gate_summary`,`lease`].includes(e.kind)||n===`evidence`&&[`evidence`,`validation`,`repair`,`handoff`].includes(e.kind);return t&&r})}function Vx(e){let t=e.limits;return t.topology_complete!==!0||t.source_truncated===!0||t.predecessor_truncated===!0||(t.missing_predecessor_count??0)>0||t.user_gate_truncated_count>0}function Hx(e){return[`gate`,`gate_summary`,`lease`].includes(e.kind)?0:e.kind===`deliverable`?1:2}function Ux(e,t){let n=e=>String(e??t.unavailable).replace(/[\\`*_{}[\]<>|#]/g,`\\$&`).replace(/[\r\n]+/g,` `),r=[`# ${t.title}`,``,`Goal: ${n(e.goal_id)}`,`${t.observed}: ${n(e.observed_at)}`,``,t.scope,``,t.acceptanceBoundary,``,`## ${t.chain}`,``],i=e.graph;if(!i)r.push(t.noGraph);else{Vx(i)&&r.push(t.incomplete,``),r.push("```json",JSON.stringify(i.limits,null,2),"```",``);for(let e of i.nodes)r.push(`- ${n(e.title)} · ${t.kind[e.kind]} · ${t.state[e.state]}${e.owner_agent?` · ${n(e.owner_agent)}`:``}`,` ${t.refs}: ${n(e.node_id)}; ${n(JSON.stringify(e.refs))}`),(e.from_agent||e.to_agent)&&r.push(` ${n(e.from_agent)} → ${n(e.to_agent)}`),e.actor_agent&&r.push(` actor: ${n(e.actor_agent)}`);let e=new Map(i.nodes.map(e=>[e.node_id,e.title]));r.push(``,`## ${t.relations}`,``);for(let a of i.edges)r.push(`- ${n(e.get(a.from_node_id))} → ${t.relation[a.relation]} → ${n(e.get(a.to_node_id))}: ${n(a.reason)} (${n(a.edge_id)})`,` ${t.refs}: ${n(JSON.stringify(a.refs??{}))}`)}r.push(``,`## ${t.acceptance}`,``);let a=e.acceptance;if(!a)r.push(t.unavailable);else{let e=a.coverage===`partial`;r.push(`${t.required}: ${e?a.acceptance_gaps.length:t.unavailable}`,`${t.guards}: ${e?a.guards.length:t.unavailable}`,``);for(let e of a.acceptance_gaps)r.push(`### ${n(e.evidence_required)}`,``,`${t.owner}: ${n(e.owner)}`,`${t.reason}: ${n(e.reason)}`,`${t.observed}: ${n(e.observed_at)}`,`${t.refs}: ${n(e.source)}`),e.resolution_hint&&r.push(n(e.resolution_hint)),e.component_checks&&r.push(`${t.checks}:`,"```json",JSON.stringify(e.component_checks,null,2),"```"),r.push(``);r.push(`### ${t.guards}`,``);for(let e of a.guards)r.push(`- ${n(e.reason)}`,` ${t.owner}: ${n(e.owner)}; ${t.required}: ${n(e.evidence_required)}`,` ${t.refs}: ${n(e.todo_id)}; ${n(e.blocks_agent)}; ${n(e.decision_scope)}`);r.push(``,`### ${t.historical}`,``);for(let e of a.historical_progress)r.push(`- ${n(e.kind)} · ${n(e.observed_at)} · ${n(e.source)} · ${n(e.evidence_refs.join(`, `))}`);r.push(``,`${t.observedScope}: ${n(a.coverage)}; truncated=${a.truncated}`,`${t.missingSources}: ${n(a.missing_sources.join(`, `))}`,`${t.next}: ${n(a.next_action)} (${n(a.next_action_source)})`)}let o=a?.goal_acceptance_contract;if(o?.enabled===!0){let i=t.contract;r.push(``,`## ${i.title}`,``,i.boundary,`${i.source}: ${n(e.goal_id)}`,`${i.revision}: ${o.revision}`,`${i.digest}: ${n(o.digest)}`,``,`### ${i.objective}`,n(o.objective||i.unknown),``,`### ${i.criteria}`),o.non_goals.length&&r.push(`${i.nonGoals}: ${n(o.non_goals.join(`; `))}`),o.criteria.length||r.push(i.noCriteria);for(let e of o.criteria)r.push(`- ${n(e.id)}: ${n(e.description)}`);r.push(``,`### ${i.tasks}`),o.tasks.length||r.push(i.noTasks);for(let e of o.tasks)r.push(`- ${n(e.todo_id)}: ${i.taskState[e.state]}`,` ${i.criteria}: ${n(e.criterion_ids.join(`, `)||i.unknown)}`),e.reason&&r.push(` ${n(e.reason)}`),e.applicable===!1&&r.push(` ${i.notApplicable}`);r.push(``,`### ${i.verification}`,i.verificationState[o.status]),o.held_todo_ids.length&&r.push(`${i.heldTasks}: ${n(o.held_todo_ids.join(`, `))}`),r.push(``,`### ${i.receipt}`);let a=o.verification;if(!a)r.push(i.unknown);else{r.push(i.receiptNote,`${i.operation}: ${n(a.operation_id)}`,`${i.revision}: ${a.contract_revision}`,`${i.digest}: ${n(a.contract_digest)}`,`${i.verificationScope}: ${n(a.todo_id??i.allCriteria)}`);for(let e of a.results)r.push(`- ${n(e.criterion_id)}: ${e.passed?i.passed:i.failed}; ${i.exitCode}: ${e.exit_code??i.unknown}`)}}return r.join(` `)+` `}function Wx({goalId:e,contract:t,copy:n,current:r}){if(t?.enabled!==!0)return null;let i=`loopx --format json goal-acceptance inspect --goal-id '${e.replace(/'/g,`'\\''`)}'`;return(0,z.jsxs)(`details`,{className:`delivery-acceptance-contract`,children:[(0,z.jsx)(`summary`,{children:n.title}),(0,z.jsxs)(`div`,{className:`delivery-acceptance-content`,children:[(0,z.jsx)(`p`,{children:n.boundary}),r?null:(0,z.jsx)(`p`,{role:`status`,className:`delivery-notice`,children:n.retained}),(0,z.jsxs)(`dl`,{className:`delivery-acceptance-source`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.source}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:e})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.revision}),(0,z.jsx)(`dd`,{children:t.revision})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.digest}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.digest})})]})]}),(0,z.jsx)(`h3`,{children:n.objective}),(0,z.jsx)(`p`,{children:t.objective||n.unknown}),t.non_goals.length?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:n.nonGoals}),(0,z.jsx)(`ul`,{children:t.non_goals.map((e,t)=>(0,z.jsx)(`li`,{children:e},t))})]}):null,(0,z.jsx)(`h3`,{children:n.criteria}),t.criteria.length?(0,z.jsx)(`ul`,{children:t.criteria.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(`code`,{children:e.id}),` · `,e.description]},e.id))}):(0,z.jsx)(`p`,{children:n.noCriteria}),(0,z.jsx)(`h3`,{children:n.tasks}),t.tasks.length?(0,z.jsx)(`ul`,{className:`delivery-acceptance-tasks`,children:t.tasks.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`code`,{children:e.todo_id}),` · `,(0,z.jsx)(`strong`,{children:n.taskState[e.state]})]}),(0,z.jsxs)(`p`,{children:[n.criteria,`: `,e.criterion_ids.length?e.criterion_ids.join(`, `):n.unknown]}),e.applicable===!1?(0,z.jsx)(`p`,{children:n.notApplicable}):null,e.reason?(0,z.jsx)(`p`,{children:e.reason}):null]},e.todo_id))}):(0,z.jsx)(`p`,{children:n.noTasks}),(0,z.jsx)(`h3`,{children:n.verification}),(0,z.jsx)(`p`,{children:n.verificationState[t.status]}),t.held_todo_ids.length?(0,z.jsxs)(`p`,{children:[n.heldTasks,`: `,t.held_todo_ids.join(`, `)]}):null,(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n.receipt}),t.verification?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{children:n.receiptNote}),(0,z.jsxs)(`dl`,{className:`delivery-acceptance-source`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.operation}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.verification.operation_id})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.revision}),(0,z.jsx)(`dd`,{children:t.verification.contract_revision})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.digest}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.verification.contract_digest})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.verificationScope}),(0,z.jsx)(`dd`,{children:t.verification.todo_id??n.allCriteria})]})]}),(0,z.jsx)(`ul`,{children:t.verification.results.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(`code`,{children:e.criterion_id}),` · `,e.passed?n.passed:n.failed,` · `,n.exitCode,`: `,e.exit_code??n.unknown]},e.criterion_id))})]}):(0,z.jsx)(`p`,{children:n.unknown})]}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n.help}),(0,z.jsx)(`p`,{children:n.guidance}),(0,z.jsx)(`p`,{children:(0,z.jsx)(`code`,{children:i})}),(0,z.jsx)(`p`,{children:(0,z.jsx)(`code`,{children:`loopx goal-acceptance --help`})}),(0,z.jsx)(`a`,{href:`https://github.com/huangruiteng/loopx/blob/main/docs/reference/goal-acceptance-observations.md#owner-authorized-contract-v0`,target:`_blank`,rel:`noreferrer`,children:n.guide})]})]})]})}var Gx={en:{title:`Goal acceptance contract`,boundary:`Read-only owner contract. Task association and artifact checks are separate; neither automatically approves or completes the Goal.`,source:`Goal source`,revision:`Contract revision`,digest:`Contract digest`,objective:`Objective`,criteria:`Acceptance criteria`,nonGoals:`Outside scope`,tasks:`Task associations`,verification:`Artifact verification`,unknown:`Unknown`,noTasks:`No task associations reported. Coverage is unknown.`,noCriteria:`No acceptance criteria reported.`,retained:`Retained snapshot; refresh to read current acceptance facts.`,taskState:{ready:`Task association confirmed`,unbound:`Task association missing`,stale:`Task association stale`},verificationState:{unverified:`Artifact checks not verified`,accepted:`Artifact checks passed`,failed:`Artifact checks failed`,stale:`Artifact checks stale`,partial:`Task checks passed; Goal-wide verification unknown`,held:`Task associations require confirmation`},notApplicable:`Outside the current task gate`,heldTasks:`Tasks held`,receipt:`Recorded artifact checks`,receiptNote:`Recorded results use the revision below. The current contract status above accounts for stale checks and task holds.`,operation:`Verification reference`,verificationScope:`Verification scope`,allCriteria:`All contract criteria`,passed:`Passed`,failed:`Failed`,exitCode:`Exit code`,help:`Setup and readback`,guide:`Owner setup guide (v0)`,guidance:`The local Goal owner configures this contract through the CLI using configure --document and the inspected --expected-provider-revision. Changes and verification require --execute. Inspect before changing the contract; refresh this snapshot afterward. Disable with the current provider revision to hide this section.`},"zh-CN":{title:`Goal 验收合同`,boundary:`只读的所有者合同。任务关联与产物检查是独立事实,均不会自动批准或完成 Goal。`,source:`Goal 来源`,revision:`合同版本`,digest:`合同摘要`,objective:`目标`,criteria:`验收条件`,nonGoals:`范围之外`,tasks:`任务关联`,verification:`产物验证`,unknown:`未知`,noTasks:`未提供任务关联,覆盖范围未知。`,noCriteria:`未提供验收条件。`,retained:`当前保留旧快照,请刷新读取最新验收事实。`,taskState:{ready:`任务关联已确认`,unbound:`任务关联缺失`,stale:`任务关联已过期`},verificationState:{unverified:`产物检查未验证`,accepted:`产物检查通过`,failed:`产物检查失败`,stale:`产物检查已过期`,partial:`任务检查通过;Goal 整体验证未知`,held:`任务关联需要确认`},notApplicable:`不属于当前任务门禁范围`,heldTasks:`受阻任务`,receipt:`已记录的产物检查`,receiptNote:`记录对应下方版本。上方当前合同状态已考虑检查过期和任务阻塞。`,operation:`验证引用`,verificationScope:`验证范围`,allCriteria:`全部合同条件`,passed:`通过`,failed:`失败`,exitCode:`退出码`,help:`配置与读回`,guide:`所有者配置指南(v0)`,guidance:`本地 Goal 所有者通过 CLI 的 configure --document 配置合同,并提供 inspect 读到的 --expected-provider-revision。变更和验证都需要 --execute。变更前先检查合同,操作后刷新此快照;使用当前 provider revision 执行 disable 可隐藏本区块。`}},Kx={en:{contract:Gx.en,title:`Delivery & evidence`,scope:`Current work and a limited set of predecessors. Use Tasks for the full task inventory.`,observed:`Snapshot read`,chain:`Delivery chain`,relations:`Relationships`,acceptance:`Acceptance observations`,acceptanceBoundary:`Completed tasks and recorded evidence do not certify Goal acceptance.`,noGraph:`No delivery chain is available in this snapshot. This does not mean all work is complete.`,incomplete:`Some related information is missing or not expanded.`,unavailable:`Unknown`,refs:`Source references`,required:`Evidence still required`,guards:`Pending decisions`,next:`Next action`,owner:`Owner`,reason:`Reason`,historical:`Historical observations`,checks:`Component checks`,missingSources:`Missing sources`,observedScope:`Observation coverage`,kind:{deliverable:`Work`,gate:`Decision`,gate_summary:`Other decisions`,lease:`Ownership`,validation:`Validation`,repair:`Recovery`,handoff:`Handoff`,evidence:`Evidence`},state:{open:`Open`,ready:`Ready`,blocked:`Blocked`,done:`Done`,waiting:`Waiting`,unknown:`Unknown`},relation:{depends_on:`depends on`,blocks:`blocks`,validates:`validates / contextualizes`,repairs:`repairs`,audits:`audits`,continues:`continues`,hands_off_to:`hands off to`,supersedes:`supersedes`},refresh:`Refresh snapshot`,export:`Export delivery snapshot`,exported:`Snapshot downloaded`,loading:`Reading the current delivery chain…`,error:`The delivery snapshot could not be read. Refresh to retry.`,refreshError:`Refresh failed. The previous snapshot remains visible; refresh before opening linked work or exporting.`,changed:`Workspace facts changed after this snapshot. Refresh before opening linked work or exporting.`,search:`Search title, owner or reference`,all:`All nodes`,conditions:`Conditions & owners`,evidence:`Evidence & handoffs`,related:`Directly related`,map:`Map`,list:`List`,view:`Delivery chain layout`,filter:`Delivery chain focus`,visible:`Visible`,empty:`No nodes match these filters.`,reset:`Reset filters`,select:`Select a node to trace its relationships and open its source.`,work:`Work`,context:`Evidence & recovery`,details:`Selected item`,noRelations:`No relationships are recorded for this item.`,openTask:`Open task`,openGate:`Review decision`,openRun:`Open execution`,sourceUnavailable:`The linked item is not in the current workspace. Use its reference in the task board or CLI.`,omittedGates:`Decisions not expanded`,missing:`Missing predecessors`,clipped:`Expansion limited`,sourceClipped:`Source truncated`,yes:`Yes`,no:`No`,chainOnly:`Bounded chain`,exportFailed:`Download failed. Please retry.`},"zh-CN":{contract:Gx[`zh-CN`],title:`交付与依据`,scope:`仅含当前工作及有限前序,完整任务清单见任务页。`,observed:`快照读取时间`,chain:`交付链`,relations:`关联关系`,acceptance:`验收观察`,acceptanceBoundary:`任务完成、已有证据均不等于 Goal 已通过验收。`,noGraph:`当前快照没有可展示的交付链,这不代表工作已经全部完成。`,incomplete:`部分关联信息缺失或未展开。`,unavailable:`未知`,refs:`来源引用`,required:`仍需补齐的证据`,guards:`待你处理`,next:`下一步`,owner:`负责人`,reason:`原因`,historical:`历史观察`,checks:`组成检查`,missingSources:`缺失来源`,observedScope:`观察范围`,kind:{deliverable:`工作`,gate:`决策`,gate_summary:`其他决策`,lease:`责任归属`,validation:`验证`,repair:`恢复`,handoff:`交接`,evidence:`证据`},state:{open:`待处理`,ready:`就绪`,blocked:`受阻`,done:`已完成`,waiting:`等待`,unknown:`未知`},relation:{depends_on:`依赖`,blocks:`阻塞`,validates:`验证 / 提供背景`,repairs:`修复`,audits:`复核`,continues:`延续`,hands_off_to:`交接给`,supersedes:`替代`},refresh:`刷新快照`,export:`导出交付快照`,exported:`快照已下载`,loading:`正在读取当前交付链…`,error:`交付快照读取失败,请刷新重试。`,refreshError:`刷新失败,当前保留上次快照;请刷新后再打开关联工作或导出。`,changed:`工作区状态已在此快照之后变化,请刷新后再打开关联工作或导出。`,search:`搜索标题、负责人或引用`,all:`全部节点`,conditions:`条件与责任`,evidence:`证据与交接`,related:`直接关联`,map:`关系图`,list:`列表`,view:`交付链布局`,filter:`交付链范围`,visible:`当前显示`,empty:`没有匹配当前筛选的节点。`,reset:`重置筛选`,select:`选择一个节点,追溯关联关系并打开来源。`,work:`工作`,context:`证据与恢复`,details:`选中事项`,noRelations:`当前快照未记录此事项的关联关系。`,openTask:`打开任务`,openGate:`查看决策`,openRun:`打开执行`,sourceUnavailable:`关联事项未出现在当前工作区,可使用其引用到任务看板或 CLI 查找。`,omittedGates:`未展开决策`,missing:`缺失前序`,clipped:`展开受限`,sourceClipped:`来源被裁剪`,yes:`是`,no:`否`,chainOnly:`当前局部链`,exportFailed:`下载失败,请重试。`}};function qx({graph:e,nodes:t,selected:n,onSelect:r,copy:i}){let a=(0,R.useId)().replace(/:/g,``),o=[0,1,2].map(e=>t.filter(t=>Hx(t)===e)),s=new Map(o.flatMap((e,t)=>e.map((e,n)=>[e.node_id,{x:t*320+12,y:n*124+48}]))),c=Math.max(1,...o.map(e=>e.length))*124+48;return(0,z.jsx)(`div`,{className:`delivery-map-scroll`,role:`region`,"aria-label":i.map,tabIndex:0,children:(0,z.jsxs)(`div`,{className:`delivery-map`,style:{height:c},children:[[i.conditions,i.work,i.context].map((e,t)=>(0,z.jsx)(`strong`,{className:`delivery-map-heading`,style:{left:t*320+12},children:e},e)),(0,z.jsxs)(`svg`,{"aria-hidden":`true`,width:`960`,height:c,children:[(0,z.jsx)(`defs`,{children:(0,z.jsx)(`marker`,{id:a,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto-start-reverse`,children:(0,z.jsx)(`path`,{d:`M 0 0 L 10 5 L 0 10 z`,fill:`currentColor`})})}),e.edges.map(e=>{let t=s.get(e.from_node_id),r=s.get(e.to_node_id);if(!t||!r)return null;let i=t.x{let t=s.get(e.node_id);return(0,z.jsxs)(`button`,{className:`delivery-map-node`,style:{left:t.x,top:t.y},"aria-pressed":n===e.node_id,onClick:()=>r(e.node_id),type:`button`,children:[(0,z.jsxs)(`span`,{children:[i.kind[e.kind],(0,z.jsx)(`em`,{"data-state":e.state,children:i.state[e.state]})]}),(0,z.jsx)(`strong`,{title:e.title,children:e.title}),(0,z.jsx)(`small`,{children:e.owner_agent??i.unavailable})]},e.node_id)})]})})}function Jx({goal:e,items:t,userTodos:n,onSelect:r,active:i}){let{locale:a}=Ji(),o=Kx[a],[s,c]=(0,R.useState)({kind:`loading`}),[l,u]=(0,R.useState)(0),[d,f]=(0,R.useState)(``),[p,m]=(0,R.useState)(`all`),[h,g]=(0,R.useState)(null),[_,v]=(0,R.useState)(()=>window.matchMedia(`(min-width: 1024px)`).matches),[y,b]=(0,R.useState)(``),x=(0,R.useRef)(null),S=n.filter(t=>t.goalId===e.goalId),C=JSON.stringify([e.agentTodos,e.acceptanceObservation,S]),w=(0,R.useRef)(C);w.current=C,(0,R.useEffect)(()=>{if(!i)return;let t=new AbortController,n=w.current;return c(e=>({...e,kind:`loading`})),b(``),zx(e.goalId,t.signal).then(e=>{t.signal.aborted||c({kind:`ready`,snapshot:e,sourceKey:n})}).catch(()=>{t.signal.aborted||c(e=>({...e,kind:`error`}))}),()=>t.abort()},[e.goalId,l,i]);let T=s.snapshot?.goal_id===e.goalId?s.snapshot:null,E=!!T&&s.sourceKey!==C,D=!!T&&s.kind===`ready`&&!E,O=T?.graph,k=O?.nodes.find(e=>e.node_id===h),A=p===`related`&&!k?`all`:p,ee=(0,R.useMemo)(()=>O?Bx(O,d,A,h):[],[O,d,A,h]),j=O?.edges.filter(e=>e.from_node_id===h||e.to_node_id===h)??[],M=new Map(O?.nodes.map(e=>[e.node_id,e])),te=()=>{f(``),m(`all`)},ne=e=>{g(e),b(``),window.requestAnimationFrame(()=>x.current?.scrollIntoView({block:`nearest`}))};function N(n){let r=new Set(n.refs.todo_ids??[]),i=new Set(n.refs.gate_ids??[]),a=new Set(n.refs.run_ids??[]);return[...e.agentTodos.filter(e=>r.has(e.todoId)).map(t=>({kind:`todo`,item:{...t,goalId:e.goalId,goalTitle:e.title,ownerLabel:t.claimedBy}})),...S.filter(e=>i.has(e.todoId)||r.has(e.todoId)).map(e=>({kind:`attention`,item:e})),...t.filter(t=>t.kind===`run`&&t.run.goalId===e.goalId&&a.has(t.run.runId)).map(e=>({kind:`run`,item:e.run}))]}let P=k?N(k):[];function re(){if(!T||!D)return;let e;try{e=URL.createObjectURL(new Blob([Ux(T,o)],{type:`text/markdown;charset=utf-8`}));let t=document.createElement(`a`);t.href=e,t.download=`loopx-delivery-review.md`,t.click(),b(o.exported)}catch{b(o.exportFailed)}finally{e&&window.setTimeout(()=>URL.revokeObjectURL(e),1e3)}}return(0,z.jsxs)(`section`,{className:`delivery-review`,"aria-label":o.title,children:[(0,z.jsxs)(`header`,{className:`delivery-review-toolbar`,children:[(0,z.jsx)(`h2`,{children:o.title}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`button`,{type:`button`,disabled:s.kind===`loading`,onClick:()=>u(e=>e+1),children:[(0,z.jsx)(Qm,{size:15}),o.refresh]}),(0,z.jsxs)(`button`,{type:`button`,disabled:!D,onClick:re,children:[(0,z.jsx)(Tm,{size:15}),o.export]})]})]}),y?(0,z.jsx)(`p`,{role:`status`,children:y}):null,T?(0,z.jsxs)(z.Fragment,{children:[s.kind===`ready`?null:(0,z.jsx)(`p`,{role:s.kind===`error`?`alert`:`status`,className:`delivery-notice`,children:s.kind===`error`?o.refreshError:o.loading}),(0,z.jsxs)(`p`,{className:`delivery-snapshot-time`,children:[o.observed,` · `,(0,z.jsx)(`time`,{dateTime:T.observed_at,children:new Date(T.observed_at).toLocaleString(a)})]}),E?(0,z.jsx)(`p`,{role:`alert`,className:`delivery-notice`,children:o.changed}):null,(0,z.jsxs)(`p`,{className:`delivery-boundary`,children:[o.scope,` `,o.acceptanceBoundary]}),O?(0,z.jsxs)(z.Fragment,{children:[Vx(O)?(0,z.jsxs)(`details`,{className:`delivery-notice`,children:[(0,z.jsx)(`summary`,{children:o.incomplete}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:o.omittedGates}),(0,z.jsx)(`dd`,{children:O.limits.user_gate_truncated_count})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:o.missing}),(0,z.jsx)(`dd`,{children:O.limits.missing_predecessor_count??o.unavailable})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:o.clipped}),(0,z.jsx)(`dd`,{children:O.limits.predecessor_truncated===void 0?o.unavailable:O.limits.predecessor_truncated?o.yes:o.no})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:o.sourceClipped}),(0,z.jsx)(`dd`,{children:O.limits.source_truncated===void 0?o.unavailable:O.limits.source_truncated?o.yes:o.no})]})]})]}):null,(0,z.jsxs)(`section`,{className:`delivery-chain`,"aria-label":o.chain,children:[(0,z.jsxs)(`header`,{className:`delivery-chain-toolbar`,children:[(0,z.jsx)(`h3`,{children:o.chain}),(0,z.jsxs)(`span`,{children:[o.visible,` `,ee.length,`/`,O.nodes.length]}),(0,z.jsxs)(`div`,{role:`group`,"aria-label":o.view,children:[(0,z.jsx)(`button`,{type:`button`,"aria-pressed":_,onClick:()=>v(!0),children:o.map}),(0,z.jsx)(`button`,{type:`button`,"aria-pressed":!_,onClick:()=>v(!1),children:o.list})]})]}),(0,z.jsxs)(`div`,{className:`delivery-filters`,children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(th,{size:16}),(0,z.jsx)(`input`,{"aria-label":o.search,placeholder:o.search,value:d,onChange:e=>f(e.target.value)})]}),(0,z.jsxs)(`select`,{"aria-label":o.filter,value:A,onChange:e=>m(e.target.value),children:[(0,z.jsx)(`option`,{value:`all`,children:o.all}),(0,z.jsx)(`option`,{value:`conditions`,children:o.conditions}),(0,z.jsx)(`option`,{value:`evidence`,children:o.evidence}),(0,z.jsx)(`option`,{value:`related`,disabled:!k,children:o.related})]}),(0,z.jsx)(`button`,{type:`button`,onClick:te,children:o.reset})]}),ee.length?_?(0,z.jsx)(qx,{graph:O,nodes:ee,selected:h,onSelect:ne,copy:o}):(0,z.jsx)(`ul`,{className:`delivery-node-list`,children:ee.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`button`,{type:`button`,"aria-pressed":h===e.node_id,onClick:()=>ne(e.node_id),children:[(0,z.jsx)(`span`,{children:o.kind[e.kind]}),(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`small`,{children:e.owner_agent??o.unavailable}),(0,z.jsx)(`em`,{"data-state":e.state,children:o.state[e.state]})]})},e.node_id))}):(0,z.jsx)(`p`,{className:`delivery-empty`,role:`status`,children:o.empty})]}),(0,z.jsx)(`section`,{className:`delivery-node-detail`,"aria-label":o.details,ref:x,children:k?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[o.kind[k.kind],` · `,o.state[k.state]]}),(0,z.jsx)(`h3`,{children:k.title}),k.owner_agent?(0,z.jsx)(`p`,{children:k.owner_agent}):null]}),k.from_agent||k.to_agent?(0,z.jsxs)(`p`,{children:[k.from_agent??o.unavailable,` → `,k.to_agent??o.unavailable]}):null,(0,z.jsx)(`div`,{className:`delivery-source-actions`,children:P.length?P.map((e,t)=>(0,z.jsxs)(`button`,{type:`button`,disabled:!D,onClick:()=>r(e),children:[(0,z.jsx)(Dm,{size:15}),e.kind===`todo`?o.openTask:e.kind===`attention`?o.openGate:o.openRun]},`${e.kind}:${t}`)):(0,z.jsx)(`p`,{children:o.sourceUnavailable})}),(0,z.jsx)(`h4`,{children:o.relations}),j.length?(0,z.jsx)(`ul`,{className:`delivery-relations`,children:j.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>ne(e.from_node_id),children:M.get(e.from_node_id).title}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(sm,{size:13}),o.relation[e.relation],(0,z.jsx)(sm,{size:13})]}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>ne(e.to_node_id),children:M.get(e.to_node_id).title})]}),(0,z.jsx)(`p`,{children:e.reason})]},e.edge_id))}):(0,z.jsx)(`p`,{children:o.noRelations}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:o.refs}),(0,z.jsx)(`code`,{children:k.node_id}),Object.entries(k.refs).map(([e,t])=>(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`strong`,{children:e}),` `,t.join(`, `)]},e))]})]}):(0,z.jsx)(`p`,{children:o.select})})]}):(0,z.jsx)(`p`,{className:`delivery-notice`,children:o.noGraph})]}):(0,z.jsx)(`p`,{role:s.kind===`error`?`alert`:`status`,className:`delivery-notice`,children:s.kind===`error`?o.error:o.loading}),(0,z.jsx)(Wx,{goalId:e.goalId,contract:T?.acceptance?.goal_acceptance_contract,copy:o.contract,current:D}),(0,z.jsx)(Ub,{goal:T?{...e,acceptanceObservation:T.acceptance}:e})]})}function Yx({active:e,goal:t,items:n,userTodos:r,readOnly:i,onOpenDetails:a,onSelect:o,onView:s}){let{t:c,locale:l}=Ji(),u=l===`zh-CN`?{progress:`当前进展`,attention:`需要你`,none:`当前没有已加载的待处理决定。`,details:`Goal 信息`,tasks:`查看任务`,usage:`最近 24 小时`,execution:`执行记录`,remote:`此来源仅提供同步的状态与验收观察,交付链需要实时本机来源。`}:{progress:`Current progress`,attention:`Needs you`,none:`No pending decisions are loaded.`,details:`Goal information`,tasks:`View tasks`,usage:`Last 24 hours`,execution:`Execution`,remote:`This source provides synchronized status and acceptance observations. The delivery chain requires the live local source.`},d=r.filter(e=>e.goalId===t.goalId),f=n.find(e=>e.kind===`run`&&e.run.goalId===t.goalId);return(0,z.jsxs)(`section`,{className:`goal-overview`,"aria-label":c(`header.overview`),children:[(0,z.jsxs)(`header`,{className:`goal-overview-heading`,children:[(0,z.jsx)(`h2`,{children:c(`header.overview`)}),(0,z.jsxs)(`button`,{onClick:a,type:`button`,children:[(0,z.jsx)(Pm,{size:15}),u.details]})]}),(0,z.jsxs)(`div`,{className:`goal-overview-summary${d.length?` has-attention`:``}`,children:[(0,z.jsxs)(`section`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h3`,{children:u.progress}),(0,z.jsx)(`span`,{children:Yi(t.state,l)})]}),(0,z.jsx)(`strong`,{children:t.nextSentence}),t.agentSentence&&t.agentSentence!==t.nextSentence?(0,z.jsx)(`p`,{children:t.agentSentence}):null,d.length?null:(0,z.jsx)(`p`,{className:`goal-overview-quiet`,children:u.none}),f?(0,z.jsxs)(`button`,{className:`goal-overview-run`,type:`button`,onClick:()=>o({kind:`run`,item:f.run}),children:[(0,z.jsxs)(`small`,{children:[u.execution,` · `,f.run.agentLabel]}),(0,z.jsx)(`strong`,{children:f.run.title}),(0,z.jsx)(sm,{size:15})]}):null]}),d.length?(0,z.jsxs)(`section`,{className:`goal-overview-attention`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h3`,{children:u.attention}),(0,z.jsx)(`span`,{children:d.length})]}),(0,z.jsx)(`ul`,{children:d.slice(0,3).map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`button`,{type:`button`,onClick:()=>o({kind:`attention`,item:e}),children:[(0,z.jsx)(`span`,{children:e.text}),(0,z.jsx)(sm,{size:15})]})},e.todoId))}),d.length>3?(0,z.jsxs)(`button`,{type:`button`,onClick:()=>s(`tasks`),children:[u.tasks,` (`,d.length,`)`,(0,z.jsx)(sm,{size:14})]}):null]}):null]}),(0,z.jsxs)(`section`,{className:`goal-overview-usage`,"aria-label":u.usage,children:[(0,z.jsx)(`h3`,{children:u.usage}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:c(`drawer.tokensShort`)}),(0,z.jsx)(`dd`,{children:Qd(t.usage?.tokens24h,c(`drawer.usageNotMeasured`),Yd)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:c(`drawer.costShort`)}),(0,z.jsx)(`dd`,{children:Qd(t.usage?.costUsd24h,c(`drawer.usageNotMeasured`),Xd)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:c(`drawer.durationShort`)}),(0,z.jsx)(`dd`,{children:Qd(t.usage?.durationMs24h,c(`drawer.usageNotMeasured`),Zd)})]})]})]}),i?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`goal-overview-source-note`,children:u.remote}),(0,z.jsx)(Ub,{goal:t})]}):(0,z.jsx)(Jx,{active:e,goal:t,items:n,userTodos:r,onSelect:o})]})}function Xx({activeTab:e,panels:t,scrollRef:n}){let[r,i]=(0,R.useState)(()=>new Set([e])),a=(0,R.useRef)({});return(0,R.useEffect)(()=>i(t=>t.has(e)?t:new Set([...t,e])),[e]),(0,R.useLayoutEffect)(()=>{let t=n.current;if(!t)return;t.scrollTop=a.current[e]??0;let r=()=>{a.current[e]=t.scrollTop};return t.addEventListener(`scroll`,r,{passive:!0}),()=>t.removeEventListener(`scroll`,r)},[e,n]),Object.keys(t).map(n=>r.has(n)||n===e?(0,z.jsx)(`div`,{className:`personal-goal-view-panel`,"data-goal-panel":n,hidden:n!==e,children:t[n]},n):null)}function Zx(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 Qx(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 $x(e){return e.history_permission_guidance?.api_document_url??null}function eS(e,t,n){if(e instanceof qh){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 tS({embedded:e=!1,focusGoalConnection:t=!1,goals:n,initialGoalId:r,onChanged:i,onClose:a}){let{t:o}=Ji(),[s,c]=(0,R.useState)(`connections`),[l,u]=(0,R.useState)([]),[d,f]=(0,R.useState)([]),[p,m]=(0,R.useState)(!0),[h,g]=(0,R.useState)(null),[_,v]=(0,R.useState)(``),[y,b]=(0,R.useState)(t),[x,S]=(0,R.useState)(``),[C,w]=(0,R.useState)(r??n[0]?.goalId??``),[T,E]=(0,R.useState)(``),[D,O]=(0,R.useState)([]),[k,A]=(0,R.useState)(``),[ee,j]=(0,R.useState)(!1),[M,te]=(0,R.useState)(null),[ne,N]=(0,R.useState)(`addressed_only`),[P,re]=(0,R.useState)(t&&r?`goal`:`manager`),[ie,ae]=(0,R.useState)(`async_inbox`),[F,oe]=(0,R.useState)(`topic_reply`),[I,se]=(0,R.useState)(``),[L,ce]=(0,R.useState)(!1),[le,ue]=(0,R.useState)({}),[de,fe]=(0,R.useState)(!1),[pe,me]=(0,R.useState)(null),[he,ge]=(0,R.useState)(null),[_e,ve]=(0,R.useState)(null),[ye,be]=(0,R.useState)(null),[xe,Se]=(0,R.useState)(!1),[Ce,we]=(0,R.useState)(`loopx-workspace-bot`),[Te,Ee]=(0,R.useState)(`feishu`),[De,Oe]=(0,R.useState)(null),[ke,Ae]=(0,R.useState)(!1),[je,Me]=(0,R.useState)(null),Ne=(0,R.useRef)(null),Pe=(0,R.useRef)(null),Fe=(0,R.useRef)(!1);async function Ie(){m(!0),g(null);try{let[e,t]=await Promise.all([__(),E_()]);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(eS(e,o(`lark.error.configuration`),o))}finally{m(!1)}}(0,R.useEffect)(()=>{Ie()},[]),(0,R.useEffect)(()=>{if(!t||p||Fe.current||!r)return;Fe.current=!0;let e=d.find(e=>e.goal_id===r);e?Je(e):V(n.find(e=>e.goalId===r))},[d,t,n,r,p]),(0,R.useEffect)(()=>{if(!y||!x||_e){O([]),A(``),j(!1),te(null);return}let e=!1;j(!0),te(null);let t=window.setTimeout(()=>{w_(x,T).then(t=>{e||(O(t),A(e=>t.some(t=>t.chat_id===e)?e:t[0]?.chat_id??``))}).catch(t=>{e||(O([]),A(``),te(eS(t,o(`lark.error.groupLoad`),o)))}).finally(()=>{e||j(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[x,T,y,_e]),(0,R.useEffect)(()=>{if(!xe||!De||[`ready`,`failed`,`cancelled`].includes(De.status))return;let e=!1,t=window.setTimeout(()=>{b_(De.setup_id).then(async t=>{e||(Oe(t),t.verification_url&&Pe.current!==t.verification_url&&(Pe.current=t.verification_url,Ne.current&&!Ne.current.closed&&(Ne.current.location.href=t.verification_url)),t.status===`ready`&&(await Ie(),S(t.app_ref),ue({}),Se(!1)),t.status===`failed`&&Me(t.error??o(`lark.error.appCreate`)))}).catch(t=>{e||Me(eS(t,o(`lark.error.setupPoll`),o))})},650);return()=>{e=!0,window.clearTimeout(t)}},[xe,De]);let Le=n.find(e=>e.goalId===C),Re=Le?.agentId?[{agentId:Le.agentId,label:Le.agentLabel??Le.agentId}]:[],B=Le?.agentLanes?.length?Le.agentLanes:Re,ze=B.some(e=>e.agentId===I),Be=[];L?Be=B.map(e=>({agentId:e.agentId,appRef:le[e.agentId]??x})):ze&&(Be=[{agentId:I,appRef:x}]);let Ve=Be.map(e=>e.agentId),He=!!_e||Be.length>0&&Be.every(e=>l.some(t=>t.app_ref===e.appRef&&t.reply_ready)),Ue=o(`lark.connect`);he?Ue=o(`lark.saveConnection`):L&&(Ue=o(`lark.connectAllAgentsAction`,{count:Ve.length}));let We=l.find(e=>e.app_ref===x),Ge=D.find(e=>e.chat_id===k),Ke=(0,R.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,_]),qe=(0,R.useMemo)(()=>d.filter(e=>Qx(e,o).state===`unverified`).length,[d,o]);function V(e){let i=e??n.find(e=>e.goalId===r)??n[0];ge(null),ve(null),re(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??``),A(``),w(i?.goalId??``),se(i?.agentId??``),ce(!1),ue({}),N(`addressed_only`),ae(`async_inbox`),oe(`topic_reply`),E(``),me(null),b(!0)}function Je(e){ge(e.goal_id),ve(e),re(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}]:[];se(e.agent_id??(r.length===1?r[0].agentId:``)),ce(!1),ue({}),N(e.capture_scope),ae(e.ingress_mode===`direct_session`?`async_inbox`:e.ingress_mode),oe(e.reply_mode),E(e.chat_name),me(null),b(!0)}function Ye(){Oe(null),Me(null),Pe.current=null,Se(!0)}async function Xe(){if(!(ke||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(Ce))){Ae(!0),Me(null),Pe.current=null,Ne.current=window.open(window.location.href,`_blank`);try{let e=await y_({appRef:Ce,brand:Te});Oe(e)}catch(e){Ne.current?.close(),Me(eS(e,o(`lark.error.setupStart`),o))}finally{Ae(!1)}}}async function Ze(){let e=De;if(Se(!1),Ne.current?.close(),e&&![`ready`,`failed`,`cancelled`].includes(e.status))try{await x_(e.setup_id)}catch{}}async function Qe(){if(!(!x||!C||!_e&&!Ge||P===`goal`&&Ve.length===0||de)){fe(!0),me(null);try{let e={...P===`manager`?{..._e?{connectionId:_e.connection_id}:{appRef:x,chatId:Ge.chat_id,chatName:Ge.chat_name}}:_e?{connectionId:_e.connection_id,agentId:I}:{agentBindings:Be,chatId:Ge.chat_id,chatName:Ge.chat_name},conversationKind:P,captureScope:P===`manager`?`addressed_only`:ne,goalId:C,incomingMode:ne===`configured_chat_all`?`all`:`mentions`,ingressMode:P===`manager`?`session_queue`:ie,replyMode:F},t=await D_({...e,execute:!1});if(!t.ok)throw new qh(t.public_summary??t.blocker??o(`lark.error.bindPreview`),{error_code:t.blocker??`provider_api_failed`});let n=await D_({...e,execute:!0});if(!n.ok)throw new qh(n.public_summary??n.blocker??o(`lark.error.bind`),{error_code:n.blocker??`provider_api_failed`});b(!1),await Ie(),i?.()}catch(e){me(eS(e,o(`lark.error.bind`),o))}finally{fe(!1)}}}async function $e(e,t){if(ye!==t){be(t);return}try{await O_(e,t),be(null),await Ie(),i?.()}catch(e){g(eS(e,o(`lark.error.disconnect`),o))}}return(0,z.jsxs)(`section`,{className:`personal-lark-settings${e?` is-embedded`:``}`,"aria-label":o(`lark.configuration`),children:[e?null:(0,z.jsxs)(`header`,{className:`personal-lark-header`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:o(`settings.goalConnections`)}),(0,z.jsx)(`h1`,{children:`Lark`})]}),(0,z.jsx)(`button`,{"aria-label":o(`lark.closeSettings`),className:`personal-icon-button`,onClick:a,type:`button`,children:(0,z.jsx)(gh,{size:18})})]}),(0,z.jsxs)(`nav`,{className:`personal-lark-tabs`,"aria-label":o(`lark.management`),children:[(0,z.jsxs)(`button`,{"aria-current":s===`apps`?`page`:void 0,onClick:()=>c(`apps`),type:`button`,children:[o(`lark.apps`),` `,(0,z.jsx)(`span`,{children:p?`…`:l.length})]}),(0,z.jsxs)(`button`,{"aria-current":s===`connections`?`page`:void 0,onClick:()=>c(`connections`),type:`button`,children:[o(`lark.connections`),` `,(0,z.jsx)(`span`,{children:p?`…`:d.length})]})]}),h?(0,z.jsx)(`p`,{className:`personal-notification-error`,children:h}):null,p?(0,z.jsxs)(`div`,{className:`personal-lark-loading`,children:[(0,z.jsx)(zm,{className:`is-spinning`,size:18}),o(`lark.loading`)]}):null,!p&&s===`apps`?(0,z.jsxs)(`div`,{className:`personal-lark-apps`,children:[(0,z.jsxs)(`div`,{className:`personal-lark-app-toolbar`,children:[(0,z.jsx)(`span`,{children:o(`lark.reusableApps`,{count:l.length})}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:Ye,type:`button`,children:[(0,z.jsx)(Xm,{size:16}),o(`lark.newApp`)]})]}),(0,z.jsxs)(`div`,{className:`personal-lark-app-grid`,children:[l.map(e=>(0,z.jsxs)(`article`,{className:`personal-lark-app-card`,children:[(0,z.jsx)(`span`,{className:`personal-lark-app-avatar`,children:(0,z.jsx)(fm,{size:19})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsxs)(`small`,{children:[e.brand,` · lark-cli profile`]})]}),(0,z.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,z.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,z.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noProfiles`)}):null]})]}):null,!p&&s===`connections`?(0,z.jsxs)(`div`,{className:`personal-lark-connections`,children:[qe>0?(0,z.jsxs)(`p`,{className:`personal-lark-route-readiness`,role:`status`,children:[(0,z.jsx)(Um,{size:15}),o(`lark.routesUnverified`,{count:qe})]}):null,(0,z.jsxs)(`div`,{className:`personal-lark-toolbar`,children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(th,{size:16}),(0,z.jsx)(`input`,{"aria-label":o(`lark.searchConnections`),onChange:e=>v(e.target.value),placeholder:o(`lark.searchPlaceholder`),type:`search`,value:_})]}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:l.length===0||n.length===0,onClick:()=>V(),type:`button`,children:[(0,z.jsx)(Xm,{size:16}),o(`lark.connectApp`)]})]}),(0,z.jsxs)(`div`,{className:`personal-lark-table`,role:`table`,"aria-label":o(`lark.goalTopicConnections`),children:[(0,z.jsxs)(`div`,{className:`personal-lark-table-head`,role:`row`,children:[(0,z.jsx)(`span`,{children:o(`lark.connection`)}),(0,z.jsx)(`span`,{children:o(`common.goal`)}),(0,z.jsx)(`span`,{children:o(`lark.capture`)}),(0,z.jsx)(`span`,{children:o(`lark.processing`)}),(0,z.jsx)(`span`,{children:o(`common.actions`)})]}),Ke.map(e=>{let t=Qx(e,o);return(0,z.jsxs)(`div`,{className:`personal-lark-table-row`,role:`row`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.chat_name}),(0,z.jsxs)(`small`,{children:[e.app_label,` · `,t.label]}),(0,z.jsx)(`small`,{children:t.detail}),t.state===`unverified`?(0,z.jsxs)(`a`,{href:`https://open.feishu.cn/document/server-docs/im-v1/message/events/receive?lang=zh-CN`,rel:`noreferrer`,target:`_blank`,children:[(0,z.jsx)(Dm,{size:12}),o(`lark.openEventSettings`)]}):null,$x(e)?(0,z.jsxs)(`a`,{href:$x(e)??void 0,rel:`noreferrer`,target:`_blank`,children:[(0,z.jsx)(Dm,{size:12}),o(`lark.historyPermission`)]}):null]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.goal_title}),(0,z.jsxs)(`small`,{children:[`# `,e.topic_name]})]}),(0,z.jsx)(`span`,{children:e.capture_scope===`addressed_only`?o(`lark.mentionsOnly`):o(`lark.allTopicMessages`)}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.conversation_kind===`manager`?o(`lark.managerConversation`):Zx(e.ingress_mode,o).label}),(0,z.jsx)(`small`,{children:e.conversation_kind===`manager`?o(`lark.managerConversationDescription`):e.agent_id??Zx(e.ingress_mode,o).detail})]}),(0,z.jsxs)(`span`,{className:`personal-lark-row-actions`,children:[(0,z.jsx)(`button`,{"aria-label":o(`lark.settingsConfigure`,{goal:e.goal_title}),onClick:()=>Je(e),type:`button`,children:(0,z.jsx)(ah,{size:15})}),(0,z.jsxs)(`button`,{"aria-label":o(`lark.settingsDisconnect`,{goal:e.goal_title}),className:ye===e.connection_id?`is-confirm`:``,onClick:()=>void $e(e.goal_id,e.connection_id),type:`button`,children:[(0,z.jsx)(mh,{size:15}),ye===e.connection_id?o(`common.confirm`):null]})]})]},e.connection_id)}),Ke.length===0?(0,z.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noConnections`)}):null]})]}):null,y?(0,z.jsx)(`div`,{className:`personal-lark-modal-backdrop`,role:`presentation`,children:(0,z.jsxs)(`section`,{"aria-labelledby":`connect-lark-title`,"aria-modal":`true`,className:`personal-lark-modal`,role:`dialog`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:`Goal Topic connection`}),(0,z.jsx)(`h2`,{id:`connect-lark-title`,children:o(he?`lark.editConnection`:`lark.connectApp`)})]}),(0,z.jsx)(`button`,{"aria-label":o(`lark.closeConnection`),onClick:()=>b(!1),type:`button`,children:(0,z.jsx)(gh,{size:18})})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.conversationKind`)}),(0,z.jsxs)(`select`,{"aria-label":o(`lark.conversationKind`),disabled:!!_e,value:P,onChange:e=>re(e.target.value),children:[(0,z.jsx)(`option`,{value:`manager`,children:o(`lark.managerConversation`)}),(0,z.jsx)(`option`,{value:`goal`,children:o(`lark.workerConversation`)})]})]}),P===`manager`?(0,z.jsx)(`p`,{children:o(`lark.managerConversationDescription`)}):null,_e?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,z.jsx)(`div`,{children:_e.app_label})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,z.jsx)(`div`,{children:_e.chat_name})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,z.jsx)(`div`,{children:_e.goal_title})]}),(0,z.jsx)(`small`,{children:o(`lark.editPreservesIdentity`)})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,z.jsx)(`select`,{"aria-label":o(`lark.appProfile`),disabled:p,onChange:e=>{e.target.value===`__register__`?Ye():(S(e.target.value),ue({}))},value:x,children:p?(0,z.jsx)(`option`,{value:``,children:o(`lark.appLoading`)}):(0,z.jsxs)(z.Fragment,{children:[l.map(e=>(0,z.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,z.jsx)(`option`,{value:`__register__`,children:o(`lark.registerAnother`)})]})}),(0,z.jsx)(`small`,{children:o(`lark.defaultAgentAppDescription`)})]}),We?.ready&&!We.reply_ready?(0,z.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.appPermissions`)}):null,(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,z.jsx)(`input`,{"aria-label":o(`lark.groupSearch`),onChange:e=>E(e.target.value),placeholder:o(`lark.groupSearch`),type:`search`,value:T}),ee?(0,z.jsxs)(`div`,{className:`personal-lark-group-state`,role:`status`,children:[(0,z.jsx)(zm,{className:`is-spinning`,size:15}),o(`lark.groupLoading`)]}):null,!ee&&M?(0,z.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:M}):null,!ee&&!M&&D.length===0?(0,z.jsx)(`div`,{className:`personal-lark-group-state`,role:`status`,children:o(`lark.groupEmpty`)}):null,!ee&&!M&&D.length>0?(0,z.jsx)(`select`,{"aria-label":o(`lark.groupChat`),onChange:e=>A(e.target.value),value:k,children:D.map(e=>(0,z.jsx)(`option`,{value:e.chat_id,children:e.chat_name},e.chat_id))}):null]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,z.jsx)(`select`,{"aria-label":o(`lark.bindGoal`),onChange:e=>{let t=e.target.value;w(t),se(n.find(e=>e.goalId===t)?.agentId??``),ue({})},value:C,children:n.map(e=>(0,z.jsx)(`option`,{value:e.goalId,children:e.title},e.goalId))})]})]}),(0,z.jsxs)(`label`,{className:`personal-lark-check`,children:[(0,z.jsx)(`input`,{checked:!0,readOnly:!0,type:`checkbox`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:o(`lark.createAutomatically`)}),(0,z.jsx)(`small`,{children:o(`lark.createAutomaticallyDescription`)})]})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.topicPreview`)}),(0,z.jsxs)(`div`,{className:`personal-lark-topic-preview`,children:[(0,z.jsx)(Um,{size:15}),`# `,Le?.title??Le?.goalId??`Goal`]})]}),P===`goal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.captureScope`)}),(0,z.jsxs)(`select`,{"aria-label":o(`lark.captureScope`),disabled:_e?.ingress_mode===`direct_session`,onChange:e=>N(e.target.value),value:ne,children:[(0,z.jsx)(`option`,{value:`addressed_only`,children:o(`lark.captureAddressed`)}),(0,z.jsx)(`option`,{value:`configured_chat_all`,children:o(`lark.captureAll`)})]}),(0,z.jsx)(`small`,{children:o(`lark.captureScopeDescription`)})]}),(0,z.jsxs)(`fieldset`,{"aria-label":o(`lark.agentIngress`),className:`personal-lark-ingress`,children:[(0,z.jsx)(`legend`,{children:o(`lark.agentIngress`)}),(0,z.jsx)(`div`,{children:[`live_steering`,`session_queue`,`async_inbox`].map(e=>{let t=Zx(e,o);return(0,z.jsxs)(`label`,{className:ie===e?`is-active`:``,children:[(0,z.jsx)(`input`,{"aria-label":t.label,checked:ie===e,name:`lark-agent-ingress`,onChange:()=>ae(e),type:`radio`,value:e}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:t.label}),(0,z.jsx)(`small`,{children:t.detail})]})]},e)})})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.targetAgent`)}),(0,z.jsxs)(`select`,{"aria-label":o(`lark.targetAgent`),disabled:!!_e?.agent_id,onChange:e=>se(e.target.value),value:I,children:[ze?null:(0,z.jsx)(`option`,{disabled:!0,value:I,children:I?o(`lark.agentUnavailable`,{agent:I}):o(`lark.noAgentConfigured`)}),B.map(e=>(0,z.jsx)(`option`,{value:e.agentId,children:e.label===e.agentId?e.agentId:`${e.label} · ${e.agentId}`},e.agentId))]}),(0,z.jsx)(`small`,{children:o(`lark.targetAgentDescription`)})]}),!he&&B.length>1?(0,z.jsxs)(`label`,{"aria-label":o(`lark.connectAllAgents`),className:`personal-lark-check`,children:[(0,z.jsx)(`input`,{checked:L,onChange:e=>ce(e.target.checked),type:`checkbox`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:o(`lark.connectAllAgents`)}),(0,z.jsx)(`small`,{children:o(`lark.connectAllAgentsDescription`,{count:B.length})})]})]}):null,!he&&L&&B.length>1?(0,z.jsxs)(`fieldset`,{"aria-label":o(`lark.agentApps`),className:`personal-lark-agent-apps`,children:[(0,z.jsx)(`legend`,{children:o(`lark.agentApps`)}),(0,z.jsx)(`small`,{children:o(`lark.agentAppsDescription`)}),(0,z.jsx)(`div`,{children:B.map(e=>(0,z.jsxs)(`label`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsx)(`small`,{children:e.agentId})]}),(0,z.jsx)(`select`,{"aria-label":o(`lark.agentAppSelection`,{agent:e.label}),onChange:t=>ue(n=>({...n,[e.agentId]:t.target.value})),value:le[e.agentId]??x,children:l.map(e=>(0,z.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,L&&Be.length>0&&!He?(0,z.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.agentAppPermissions`)}):null,Ve.length===0?(0,z.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:o(`lark.selectRegisteredAgent`)}):null]}):null,(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.replyMode`)}),(0,z.jsx)(`select`,{"aria-label":o(`lark.replyMode`),onChange:e=>oe(e.target.value),value:F,children:(0,z.jsx)(`option`,{value:`topic_reply`,children:o(`lark.topicReply`)})}),(0,z.jsx)(`small`,{children:o(`lark.replyModeDescription`)})]}),(0,z.jsxs)(`p`,{className:`personal-lark-cardinality`,children:[(0,z.jsx)(hm,{size:15}),o(`lark.cardinality`)]}),pe?(0,z.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:pe}):null,(0,z.jsxs)(`footer`,{children:[(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>b(!1),type:`button`,children:o(`lark.cancel`)}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:p||!x||!_e&&(!We?.reply_ready||!k)||P===`goal`&&(!He||Ve.length===0)||!C||de,onClick:()=>void Qe(),type:`button`,children:[de?(0,z.jsx)(zm,{className:`is-spinning`,size:15}):null,Ue]})]})]})}):null,xe?(0,z.jsx)(`div`,{className:`personal-lark-modal-backdrop is-setup`,role:`presentation`,children:(0,z.jsxs)(`section`,{"aria-labelledby":`new-lark-app-title`,"aria-modal":`true`,className:`personal-lark-modal personal-lark-setup-modal`,role:`dialog`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:o(`lark.reusableWorkspaceApp`)}),(0,z.jsx)(`h2`,{id:`new-lark-app-title`,children:o(`lark.newApp`)})]}),(0,z.jsx)(`button`,{"aria-label":o(`lark.closeCreate`),onClick:()=>void Ze(),type:`button`,children:(0,z.jsx)(gh,{size:18})})]}),De?(0,z.jsxs)(`div`,{className:`personal-lark-setup-progress`,children:[(0,z.jsx)(`span`,{className:`personal-lark-setup-icon is-${De.status}`,children:De.status===`ready`?(0,z.jsx)(hm,{size:22}):(0,z.jsx)(zm,{className:De.status===`failed`?``:`is-spinning`,size:22})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:De.status===`ready`?o(`lark.appCreated`):De.status===`failed`?o(`lark.appCreateFailed`):o(`lark.waitingFeishu`)}),(0,z.jsx)(`p`,{children:De.status===`waiting_for_feishu`?o(`lark.waitingFeishuDescription`):De.status===`starting`?o(`lark.waitingLink`):De.error})]}),De.verification_url?(0,z.jsxs)(`a`,{href:De.verification_url,rel:`noreferrer`,target:`_blank`,children:[(0,z.jsx)(Dm,{size:15}),o(`lark.reopenFeishu`)]}):null]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`personal-lark-setup-copy`,children:o(`lark.setupCopy`)}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.profileName`)}),(0,z.jsx)(`input`,{"aria-label":o(`lark.profileName`),autoComplete:`off`,onChange:e=>we(e.target.value),placeholder:`loopx-workspace-bot`,value:Ce})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.region`)}),(0,z.jsxs)(`select`,{"aria-label":o(`lark.region`),onChange:e=>Ee(e.target.value),value:Te,children:[(0,z.jsx)(`option`,{value:`feishu`,children:`Feishu`}),(0,z.jsx)(`option`,{value:`lark`,children:`Lark`})]})]}),Ce&&!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(Ce)?(0,z.jsx)(`p`,{className:`personal-notification-error`,children:o(`lark.profileValidation`)}):null]}),je?(0,z.jsx)(`p`,{className:`personal-notification-error`,children:je}):null,(0,z.jsxs)(`footer`,{children:[(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void Ze(),type:`button`,children:o(`lark.cancel`)}),De?null:(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:ke||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(Ce),onClick:()=>void Xe(),type:`button`,children:[ke?(0,z.jsx)(zm,{className:`is-spinning`,size:15}):(0,z.jsx)(Dm,{size:15}),o(`lark.continueFeishu`)]})]})]})}):null]})}function nS(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function rS(e,t,n){let r=nS(t),i=nS(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 iS(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 aS(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 oS({id:e,value:t,timezone:n,onChange:r}){let{locale:i}=Ji(),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,z.jsxs)(`div`,{className:`personal-report-schedule`,children:[(0,z.jsxs)(`label`,{className:`is-boolean`,htmlFor:e,children:[(0,z.jsx)(`span`,{children:a?`按日历汇报`:`Calendar reports`}),(0,z.jsx)(`input`,{id:e,type:`checkbox`,role:`switch`,checked:!!o,disabled:!r,onChange:e=>e.target.checked?p({}):r?.(null)})]}),o?(0,z.jsxs)(z.Fragment,{children:[d?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{htmlFor:`${e}-frequency`,children:[(0,z.jsx)(`span`,{children:a?`频率`:`Frequency`}),(0,z.jsxs)(`select`,{id:`${e}-frequency`,value:c.FREQ,disabled:!r,onChange:e=>p({FREQ:e.target.value}),children:[(0,z.jsx)(`option`,{value:`DAILY`,children:a?`每天`:`Daily`}),(0,z.jsx)(`option`,{value:`WEEKLY`,children:a?`每周`:`Weekly`})]})]}),c.FREQ===`WEEKLY`&&(0,z.jsxs)(`label`,{htmlFor:`${e}-day`,children:[(0,z.jsx)(`span`,{children:a?`星期`:`Weekday`}),(0,z.jsx)(`select`,{id:`${e}-day`,value:c.BYDAY,disabled:!r,onChange:e=>p({BYDAY:e.target.value}),children:l.map((e,t)=>(0,z.jsx)(`option`,{value:e,children:f[t]},e))})]}),(0,z.jsxs)(`label`,{htmlFor:`${e}-time`,children:[(0,z.jsxs)(`span`,{children:[a?`当地时间`:`Local time`,` (`,n,`)`]}),(0,z.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,z.jsx)(`p`,{role:`alert`,children:a?`此计划需在 JSON 模式中编辑;当前内容已保留。`:`Edit this schedule in JSON mode; its current value is preserved.`}),(0,z.jsx)(`p`,{children:a?`由现有唤醒检查到期计划;实际送达以回执为准。`:`Existing wakes check the schedule; delivery is confirmed by its receipt.`})]}):(0,z.jsx)(`p`,{children:a?`未设置日历计划;保持阶段结束时汇报。`:`No calendar schedule; report at validated stage boundaries.`})]})}function sS({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,z.jsx)(oS,{id:n,value:i,timezone:a,onChange:r?e=>r(t.key,e):void 0});if(t.input_kind===`boolean`)return(0,z.jsxs)(`label`,{className:`is-boolean`,htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.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,z.jsxs)(`label`,{htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.jsxs)(`select`,{id:n,onChange:r?e=>r(t.key,e.target.value):void 0,value:typeof i==`string`?i:``,children:[(0,z.jsx)(`option`,{value:``}),(t.options??[]).map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})]});if(t.input_kind===`string_list`)return(0,z.jsxs)(`label`,{htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.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,z.jsxs)(`label`,{htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.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 cS({copy:e={},disabled:t=!1,editor:n,enabledAction:r,omitKeys:i=[],onChange:a,value:o}){let s=(0,R.useId)(),c=new Set(i);return(0,z.jsx)(`fieldset`,{className:`personal-capability-fields`,disabled:t,children:n.fields.filter(e=>!c.has(e.key)).map(t=>{let n=(0,z.jsx)(sS,{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,z.jsxs)(`div`,{className:`personal-capability-enabled-row`,children:[n,r]},t.key):n})})}var lS={en:{manager_runtime:{displayName:`Manager runtime`,description:`Selects the persistent host-tool profile used by owner manager conversations.`},steward_executor:{displayName:`Steward executor`,description:`Guides the steward executor, model, and selection boundary for this machine. A pinned route blocks substitution; a flexible pool permits only authorized fallback.`},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.`},coordination_runtime_shadow:{displayName:`Coordination runtime shadow`,description:`Captures transaction-bound Todo and task-lease mutations for reviewed whole-Goal coordination-authority promotion.`},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:`选择管家会话持续生效的宿主工具模式。`},steward_executor:{displayName:`管家执行器`,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 状态,但不取得写入权。`},coordination_runtime_shadow:{displayName:`协调 Runtime 影子`,description:`捕获事务绑定的 Todo 与 task lease 变更,为经评审的整 Goal 协调 Authority 晋级提供证据。`},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 绑定。`}}},uS={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.`},selection_policy:{label:`Selection policy`,description:`Preferred allows an explicit user choice; pinned rejects another executor; flexible permits fallback only inside the eligible pool.`},executor_endpoint:{label:`Primary steward executor`,description:`The preferred or pinned executor for this machine. In a flexible pool it is tried first when available.`},eligible_endpoints:{label:`Flexible eligible executors`,description:`One authorized executor per line. Use only with flexible selection and include the primary executor.`},executor_model:{label:`Model`,description:`Optional model for the selected executor. Leave blank to keep the executor's own default.`},executor_reasoning_effort:{label:`Reasoning effort`,description:`Optional reasoning effort for the selected executor. Leave blank to keep the executor's own default.`},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.`},wait_for_ci:{label:`Wait for CI`,description:`Disable to use local validation without querying or waiting for CI. Merge authority is unchanged.`},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 开放常规宿主工具,但受保护操作仍单独校验。`},selection_policy:{label:`选择策略`,description:`preferred 允许用户显式改选;pinned 拒绝其他执行器;flexible 只在已授权资源池内回退。`},executor_endpoint:{label:`首选管家执行器`,description:`本机首选或锁定的执行器;灵活池模式下优先尝试它。`},eligible_endpoints:{label:`灵活池可用执行器`,description:`每行一个已授权执行器,仅用于 flexible;必须包含首选执行器。`},executor_model:{label:`模型`,description:`所选执行器使用的模型,可留空;留空表示沿用执行器自身的默认模型。`},executor_reasoning_effort:{label:`推理档位`,description:`所选执行器使用的推理档位,可留空;留空表示沿用执行器自身的默认档位。`},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。`},wait_for_ci:{label:`等待 CI`,description:`关闭后使用本地验证,不查询或等待 CI;不改变合并权限。`},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 dS(e,t){let n=lS[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 fS(e){return uS[e]}Object.freeze(Object.keys(lS.en).sort());function pS(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 mS({values:e,t}){return(0,z.jsxs)(`details`,{className:`personal-capability-raw-values`,children:[(0,z.jsx)(`summary`,{children:t(`capabilities.rawJson`)}),(0,z.jsx)(`div`,{className:`personal-capability-value-grid`,children:e.map(({label:e,value:t})=>(0,z.jsxs)(`section`,{children:[(0,z.jsx)(`strong`,{children:e}),(0,z.jsx)(`pre`,{children:t?JSON.stringify(t,null,2):`—`})]},e))})]})}function hS({source:e,t}){return e?(0,z.jsxs)(`p`,{className:`personal-capability-effective-source`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:15}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:t(`capabilities.effectiveSource`)}),t(`capabilities.source.${e}`)]})]}):null}function gS({available:e,description:t,t:n}){return e?null:(0,z.jsxs)(`section`,{className:`personal-capability-editor-status is-read-only`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:n(`capabilities.readOnly`)}),(0,z.jsx)(`p`,{children:t})]})]})}function _S(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 vS(e,t){return[...e].sort((e,n)=>{let r=_S(e)-_S(n);if(r!==0)return r;let i=dS(e,t),a=dS(n,t);return i.display_name.localeCompare(a.display_name,t)||e.capability_id.localeCompare(n.capability_id)})}function yS({capabilities:e,locale:t,onSelect:n,scope:r,selectedCapabilityId:i,t:a}){return(0,z.jsx)(`nav`,{"aria-label":a(r===`goal`?`capabilities.catalog`:`machine.capabilityCatalog`),className:`personal-capability-list`,tabIndex:0,children:vS(e,t).map(e=>{let o=dS(e,t);return(0,z.jsxs)(`button`,{"aria-current":i===o.capability_id?`page`:void 0,onClick:()=>n(o.capability_id),type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:o.display_name})}),(0,z.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 bS({capability:e,locale:t,source:n}){let{t:r}=Ji(),i=dS(e,t);return(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`span`,{className:`personal-settings-icon`,children:(0,z.jsx)(sh,{"aria-hidden":!0,size:18})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`personal-capability-heading-row`,children:[(0,z.jsx)(`h2`,{children:i.display_name}),(0,z.jsx)(hS,{source:n,t:r})]}),e.context_contribution&&(0,z.jsxs)(`details`,{className:`personal-capability-help`,"data-testid":`capability-context-phases`,children:[(0,z.jsx)(`summary`,{children:t===`zh-CN`?`主 Agent 协作指导`:`Coordinator workflow guidance`}),(0,z.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,z.jsx)(`dl`,{children:e.context_contribution.supported_phases.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:(0,z.jsx)(`code`,{children:e})}),(0,z.jsx)(`dd`,{children:xS[e][t===`zh-CN`?`zh`:`en`]})]},e))}),(0,z.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,z.jsxs)(`details`,{className:`personal-capability-help`,children:[(0,z.jsx)(`summary`,{children:t===`zh-CN`?`配置说明`:`Configuration help`}),(0,z.jsx)(`p`,{children:i.description}),(0,z.jsx)(`dl`,{children:e.configuration_editor.fields.map(e=>{let n=fS(t)[e.key],r=n?.description??e.description;return r?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n?.label??e.label}),(0,z.jsx)(`dd`,{children:r})]},e.key):null})})]},e.capability_id)]})]})}var xS={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 SS({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null);async function l(n){if(e.onToggleGoalAutoNotify){o(!0),c(null);try{let a=await e.onToggleGoalAutoNotify({autoNotify:n,goalId:t});if(!a.ok){c(a.public_summary??a.blocker??i(`notifications.setupFailed`));return}r()}catch(e){c(e instanceof Error?e.message:i(`notifications.setupFailed`))}finally{o(!1)}}}return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{className:`personal-notification-toggle`,children:[(0,z.jsx)(`input`,{checked:n?.humanGateAutoNotifyEnabled??!1,disabled:a||n?.configured!==!0||!e.onToggleGoalAutoNotify,onChange:e=>void l(e.target.checked),type:`checkbox`}),(0,z.jsx)(`span`,{children:i(`notifications.autoNotify`)}),a?(0,z.jsx)(zm,{"aria-hidden":!0,className:`is-spinning`,size:14}):null]}),s?(0,z.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:s}):null]})}function CS({goalId:e,onApplied:t,selected:n,t:r}){let[i,a]=(0,R.useState)({busy:null,draft:{},partialWrite:null,preview:null}),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(`guided`),[u,d]=(0,R.useState)(``),f=(0,R.useMemo)(()=>n?iS(n.configuration_editor,u):null,[n,u]),p=c===`guided`||f!==null;(0,R.useEffect)(()=>{l(`guided`),d(``),a({busy:null,draft:rS(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 o_(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=rS(n.configuration_editor,i.draft,n.default),o=await s_(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`?aS(r.draft,e,t):{...r.draft,[e]:t},preview:null})),s(null)}function _(e){if(!n||i.busy)return;d(e);let t=iS(n.configuration_editor,e);a(e=>({...e,preview:null,draft:t?rS(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 wS({mutationError:e,onApplied:t,partialWrite:n,preview:r}){let{t:i}=Ji();return(0,z.jsxs)(z.Fragment,{children:[e?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:e}):null,n?(0,z.jsxs)(`section`,{"aria-live":`polite`,className:`personal-capability-recovery`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:i(n.host_capacity_pending?`capabilities.hostCapacityPartialWrite`:`capabilities.partialWrite`)}),(0,z.jsx)(`p`,{children:i(n.host_capacity_pending?`capabilities.hostCapacityPartialWriteDescription`:`capabilities.partialWriteDescription`)}),(0,z.jsx)(`small`,{children:n.recommended_action})]}),(0,z.jsxs)(`button`,{onClick:t,type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":!0,size:15}),i(`capabilities.refreshSource`)]})]}):null,r?(0,z.jsxs)(`section`,{className:`personal-capability-preview`,"aria-label":i(`capabilities.preview`),children:[(0,z.jsx)(`strong`,{children:i(`capabilities.preview`)}),(0,z.jsx)(`span`,{children:i(`machine.action.${r.action}`)}),r.codex_host_capacity?(0,z.jsx)(`span`,{children:i(r.codex_host_capacity.write_required?`drawer.subagentHostCapacityRaise`:`drawer.subagentHostCapacityReady`,{configured:r.codex_host_capacity.configured_children??i(`drawer.subagentHostCapacityImplicit`),required:r.codex_host_capacity.required_children})}):null,(0,z.jsx)(`small`,{children:i(`capabilities.previewLocked`)})]}):null]})}function TS({callbacks:e,catalog:t,goalId:n,notification:r,onApplied:i,onNotificationChanged:a}){let{locale:o,t:s}=Ji(),c=(0,R.useMemo)(()=>vS(t.capabilities,o),[t.capabilities,o]),[l,u]=(0,R.useState)(()=>c[0]?.capability_id??``),d=(0,R.useMemo)(()=>c.find(e=>e.capability_id===l)??c[0],[c,l]),f=(0,R.useMemo)(()=>d?dS(d,o):void 0,[o,d]),{apply:p,changeDraft:m,changeJson:h,changeMode:g,editorMode:_,jsonDraft:v,jsonValid:y,error:b,mutation:x,preview:S}=CS({goalId:n,onApplied:i,selected:f,t:s}),{busy:C,draft:w,partialWrite:T,preview:E}=x;if(!d||!f)return(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:s(`capabilities.empty`)});let D=f.available_scopes.includes(`goal`),O=pS(f,`goal`),k=f.configuration_editor.read_only_reason??s(D?`capabilities.previewOnly`:`capabilities.machineOnly`);async function A(){if(!f||!O||C||!y)return;let e=rS(f.configuration_editor,w,f.default);await S(e)}async function ee(){!O||C||await S(null)}return(0,z.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,z.jsx)(yS,{capabilities:t.capabilities,locale:o,onSelect:u,scope:`goal`,selectedCapabilityId:f.capability_id,t:s}),(0,z.jsxs)(`article`,{"aria-label":f.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,z.jsx)(bS,{capability:d,locale:o,source:f.effective_configuration?.source}),(0,z.jsx)(gS,{available:O,t:s,description:k}),f.capability_id===`lark_event_inbox`?(0,z.jsxs)(`section`,{className:`personal-capability-linked-setting`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:s(`capabilities.larkInboxNotificationSetting`)}),(0,z.jsx)(`p`,{children:s(`capabilities.larkInboxNotificationDescription`)})]}),(0,z.jsx)(SS,{callbacks:e,goalId:n,notification:r,onChanged:a})]}):null,O?(0,z.jsxs)(z.Fragment,{children:[_===`json`||!f.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,z.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,z.jsxs)(`button`,{disabled:!!C||!y,onClick:g,type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),s(_===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,_===`guided`?(0,z.jsx)(`section`,{className:`personal-capability-field-summary`,children:(0,z.jsx)(cS,{disabled:!!C,copy:fS(o),editor:f.configuration_editor,onChange:m,value:w,enabledAction:(0,z.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:g,type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),s(`machine.editJson`)]})})}):(0,z.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`goal-configuration-json`,children:[(0,z.jsx)(`span`,{children:s(`capabilities.jsonConfiguration`)}),(0,z.jsx)(`textarea`,{id:`goal-configuration-json`,"aria-describedby":`goal-configuration-json-help`,disabled:!!C,onChange:e=>h(e.target.value),rows:12,spellCheck:!1,value:v}),(0,z.jsx)(`small`,{id:`goal-configuration-json-help`,children:s(`capabilities.jsonHelp`)}),y?null:(0,z.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:s(`capabilities.jsonInvalid`)})]})]}):null,(0,z.jsx)(wS,{mutationError:b,onApplied:i,partialWrite:T,preview:E}),O?(0,z.jsxs)(`footer`,{className:`personal-capability-actions`,children:[f.current&&f.available_scopes.includes(`machine`)?(0,z.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void ee(),type:`button`,children:s(`capabilities.restoreInheritance`)}):null,(0,z.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void A(),type:`button`,children:s(C===`preview`?`common.loading`:`capabilities.previewChanges`)}),(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!C||!E||!y,onClick:()=>void p(),type:`button`,children:s(C===`apply`?`common.loading`:`capabilities.applyPreview`)})]}):null,(0,z.jsx)(mS,{values:[{label:s(`capabilities.goalValue`),value:f.current},{label:s(f.machine_current?`capabilities.machineValue`:`capabilities.defaultValue`),value:f.machine_current??f.default}],t:s},d.capability_id)]})]})}function ES({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1);function d(){t&&(u(!0),c(null),a_(t).then(o).catch(e=>c(e instanceof Error?e.message:i(`capabilities.loadFailed`))).finally(()=>u(!1)))}return(0,R.useEffect)(d,[t]),t?l&&!a?(0,z.jsxs)(`p`,{"aria-live":`polite`,className:`personal-capability-empty`,children:[(0,z.jsx)(zm,{className:`personal-spin`,size:18}),i(`capabilities.loading`)]}):s?(0,z.jsxs)(`section`,{className:`personal-capability-error`,role:`alert`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:i(`capabilities.loadFailed`)}),(0,z.jsx)(`small`,{children:s})]}),(0,z.jsxs)(`button`,{onClick:d,type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":!0,size:15}),i(`capabilities.retry`)]})]}):a?(0,z.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":a.revision,children:[(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),i(`capabilities.atomicOverride`)]}),(0,z.jsx)(`p`,{children:i(`capabilities.atomicOverrideDescription`)})]}),(0,z.jsx)(TS,{callbacks:e,catalog:a.capability_catalog,goalId:t,notification:n,onApplied:d,onNotificationChanged:r})]}):null:(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:i(`capabilities.chooseGoal`)})}function DS(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function OS(e,t){let n=t?.machine_namespace;return n?e?.machine_configuration?.namespaces[n]:void 0}function kS(e,t,n){let r={...DS(e.default),...DS(t),...n};return e.capability_id===`steward_executor`&&(Object.hasOwn(n,`selection_policy`)||Object.hasOwn(n,`eligible_endpoints`))&&(r.schema_version=DS(e.default).schema_version),r}function AS(e,t){for(let n of e.configuration_editor.fields){let e=t[n.key];if(n.required&&(e==null||e===``))return!1}if(e.capability_id===`periodic_report`&&t.enabled===!0)return!!(String(t.profile_preset??``).trim()&&String(t.route_ref??``).trim()&&String(t.timezone??``).trim());if(e.capability_id===`steward_executor`){let e=String(t.selection_policy??`preferred`),n=String(t.executor_endpoint??``),r=Array.isArray(t.eligible_endpoints)?t.eligible_endpoints.map(e=>String(e)):[];return e===`flexible`?r.length>0&&r.includes(n)&&new Set(r).size===r.length:r.length===0}return!0}function jS(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}catch{return null}}function MS(e){return e?e===`absent`?e:e.replace(/^sha256:/,``).slice(0,12):`—`}function NS(){let{locale:e,t}=Ji(),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)({}),[c,l]=(0,R.useState)(`{}`),[u,d]=(0,R.useState)(`guided`),[f,p]=(0,R.useState)(null),[m,h]=(0,R.useState)(`upsert`),[g,_]=(0,R.useState)(null),[v,y]=(0,R.useState)(null),[b,x]=(0,R.useState)(`load`),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),E=(0,R.useMemo)(()=>vS(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=>pS(e,`machine`))??E[0],k=O?dS(O,e):void 0,A=OS(n,k),ee=!!(k?.machine_namespace&&A),j=!!(k&&pS(k,`machine`)),M=(0,R.useMemo)(()=>jS(c),[c]),te=k?u===`json`?M:kS(k,A,o):null,ne=!!(k&&(u===`json`?M:AS(k,te??{})));async function N(){r(await i_())}(0,R.useEffect)(()=>{let e=!0;return i_().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,R.useEffect)(()=>{if(!k)return;let e=OS(n,k),t=rS(k.configuration_editor,e??k.default,k.default),r=kS(k,e,t);s(t),l(JSON.stringify(r,null,2)),d(j?`guided`:`json`),p(null),h(`upsert`),y(null)},[n,i,e]);function P(e,t){s(n=>k?.capability_id===`periodic_report`?aS(n,e,t):{...n,[e]:t}),p(null),h(`upsert`),C(null),T(null)}function re(e){if(k){if(e===`json`)l(JSON.stringify(kS(k,A,o),null,2));else if(M)s(rS(k.configuration_editor,M,k.default));else{C(t(`machine.jsonInvalid`));return}d(e),p(null),h(`upsert`),C(null)}}async function ie(){if(!(!j||!k?.machine_namespace||!te||!ne||b)){x(`preview`),C(null),T(null);try{h(`upsert`),p(await c_(k.machine_namespace,te))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function ae(){if(!(!j||!k?.machine_namespace||!ee||b)){x(`preview`),C(null),T(null);try{h(`remove`),p(await u_(k.machine_namespace))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function F(){if(!j||!k?.machine_namespace||!f||b||m===`upsert`&&!te)return;x(`apply`),C(null);let e=m;try{let n=e===`remove`?await d_(k.machine_namespace,f.plan_revision):await l_(k.machine_namespace,te,f.plan_revision);_(n),p(null),h(`upsert`),y(null),await N(),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 oe(){if(!(!g?.transaction_id||b)){x(`rollback-preview`),C(null);try{y(await f_(g.transaction_id))}catch(e){C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}async function I(){if(!(!g?.transaction_id||!v||b)){x(`rollback`),C(null);try{await p_(g.transaction_id,v.plan_revision),_(null),y(null),p(null),await N(),T(t(`machine.rolledBack`))}catch(e){y(null),C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}return b===`load`?(0,z.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:t(`common.loading`)}):k?(0,z.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n?.revision,children:[(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),t(`machine.liveDefault`)]}),(0,z.jsx)(`p`,{children:t(`machine.liveDefaultDescription`)})]}),(0,z.jsxs)(`div`,{className:`personal-capability-body`,children:[n?.status===`invalid`?(0,z.jsxs)(`section`,{className:`personal-machine-error`,"data-testid":`machine-invalid-repair`,role:`alert`,children:[(0,z.jsx)(`strong`,{children:t(`machine.invalidStoredConfiguration`)}),(0,z.jsx)(`p`,{children:t(`machine.invalidStoredConfigurationDescription`)})]}):null,(0,z.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,z.jsx)(yS,{capabilities:E,locale:e,onSelect:a,scope:`machine`,selectedCapabilityId:k.capability_id,t}),(0,z.jsxs)(`article`,{"aria-label":k.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,z.jsx)(bS,{capability:O,locale:e,source:k.available_scopes.includes(`machine`)?ee?`machine_default`:`capability_default`:void 0}),(0,z.jsx)(gS,{available:j,t,description:k.available_scopes.includes(`machine`)?t(`machine.editorUnavailableDescription`):t(`machine.goalOnly`)}),k.capability_id===`periodic_report`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:A?.schedule?e===`zh-CN`?`日历与阶段汇报`:`Calendar and stage reports`:t(`machine.periodicReportActivation`)}),(0,z.jsx)(`p`,{children:A?.schedule?A.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,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.changeQualityActivation`)}),(0,z.jsx)(`p`,{children:t(`machine.changeQualityActivationDescription`)})]})]}):null,k.capability_id===`todo_replan_cadence`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.replanCadenceActivation`)}),(0,z.jsx)(`p`,{children:t(`machine.replanCadenceActivationDescription`)})]})]}):null,k.capability_id===`pull_request_review`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e===`zh-CN`?`只改变队列排序`:`Queue ordering only`}),(0,z.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,j?(0,z.jsxs)(z.Fragment,{children:[u===`json`||!k.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,z.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,z.jsxs)(`button`,{onClick:()=>re(u===`guided`?`json`:`guided`),type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),t(u===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,u===`guided`?(0,z.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,z.jsx)(cS,{copy:fS(e),disabled:!!b,editor:k.configuration_editor,onChange:P,value:o,enabledAction:(0,z.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:()=>re(`json`),type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),t(`machine.editJson`)]})}),ne?null:(0,z.jsx)(`p`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.requiredFields`)})]}):(0,z.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`machine-configuration-json`,children:[(0,z.jsx)(`span`,{children:t(`machine.jsonConfiguration`)}),(0,z.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,z.jsx)(`small`,{id:`machine-configuration-json-help`,children:t(`machine.jsonConfigurationHelp`)}),M?null:(0,z.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.jsonInvalid`)})]})]}):null,S?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:S}):null,w?(0,z.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,z.jsx)(hm,{"aria-hidden":!0,size:16}),w]}):null,f?(0,z.jsxs)(`section`,{"aria-label":t(`machine.preview`),className:`personal-machine-preview`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.preview`)}),(0,z.jsx)(`span`,{children:t(`machine.action.${f.action}`)})]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.currentRevision`)}),(0,z.jsx)(`dd`,{title:f.current_revision,children:MS(f.current_revision)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.desiredRevision`)}),(0,z.jsx)(`dd`,{title:f.desired_revision,children:MS(f.desired_revision)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.changedNamespaces`)}),(0,z.jsx)(`dd`,{children:f.changed_namespaces.join(`, `)||t(`common.none`)})]})]}),(0,z.jsx)(`p`,{children:t(`machine.previewLocked`)})]}):null,g?.rollback_available&&g.transaction_id?(0,z.jsxs)(`section`,{className:`personal-machine-rollback`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.rollbackAvailable`)}),(0,z.jsx)(`p`,{children:t(v?`machine.rollbackPreviewDescription`:`machine.rollbackDescription`)})]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!!b||!!(v&&!v.rollback_allowed),onClick:()=>void(v?I():oe()),type:`button`,children:[(0,z.jsx)($m,{"aria-hidden":!0,size:15}),t(b===`rollback`||b===`rollback-preview`?`common.loading`:v?`machine.confirmRollback`:`machine.previewRollback`)]})]}):null,j?(0,z.jsxs)(`footer`,{className:`personal-capability-actions`,children:[ee?(0,z.jsxs)(`button`,{className:`is-danger`,disabled:!!b,onClick:()=>void ae(),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),t(`machine.previewRemoval`)]}):null,(0,z.jsx)(`button`,{disabled:!!b||!ne,onClick:()=>void ie(),type:`button`,children:t(b===`preview`?`common.loading`:`machine.previewChanges`)}),(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!b||!f,onClick:()=>void F(),type:`button`,children:t(b===`apply`?`common.loading`:`machine.applyPreview`)})]}):null,k.available_scopes.includes(`machine`)?(0,z.jsx)(mS,{values:[{label:t(`machine.currentValue`),value:A},{label:t(`capabilities.defaultValue`),value:k.default}],t},k.capability_id):null]})]})]})]}):(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:t(`machine.capabilityEmpty`)})}function PS(e,t){return t(e===`invalid`?`machine.credentialInvalid`:e===`configured`?`machine.credentialConfigured`:`machine.credentialAbsent`)}function FS(e,t){return t(e===`machine_store`?`machine.credentialSourceMachine`:e===`service_environment`?`machine.credentialSourceEnvironment`:`machine.credentialSourceUnset`)}function IS(){let{t:e}=Ji(),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(null),p=(0,R.useCallback)(async()=>{c(`load`);try{let e=await n_();n(e),o(String(e.base_url.value??``))}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}},[e]);(0,R.useEffect)(()=>{p()},[p]);async function m(t,r){c(`store`),u(null),f(null);try{let e=await r_(t);n(e),o(String(e.base_url.value??``)),i(``),f(r)}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}}if(!t&&s===`load`)return(0,z.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:e(`common.loading`)});let h=t?`${PS(t.provider_key.configured?`configured`:`absent`,e)} · ${FS(t.provider_key.source,e)}`:``,g=t?`${t.base_url.value??e(`machine.credentialAbsent`)} · ${FS(t.base_url.source,e)}`:``;return(0,z.jsxs)(`section`,{className:`personal-operator-credential`,"data-testid":`operator-credential-settings`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(Fm,{"aria-hidden":!0,size:17}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e(`machine.credentialTitle`)}),(0,z.jsx)(`p`,{children:e(`machine.credentialDescription`)})]}),(0,z.jsx)(`span`,{className:`personal-operator-credential-status`,children:t?PS(t.status,e):e(`common.loading`)})]}),t?(0,z.jsxs)(`dl`,{className:`personal-operator-credential-readback`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialApiKey`)}),(0,z.jsx)(`dd`,{children:h})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialFingerprint`)}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.provider_key.fingerprint??e(`common.none`)})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialBaseUrl`)}),(0,z.jsx)(`dd`,{children:g})]})]}):null,t?.status===`invalid`&&t.repair?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:t.repair}):null,(0,z.jsxs)(`label`,{htmlFor:`operator-credential-api-key`,children:[(0,z.jsx)(`span`,{children:e(`machine.credentialApiKey`)}),(0,z.jsx)(`input`,{autoComplete:`off`,disabled:!!s,id:`operator-credential-api-key`,onChange:e=>i(e.target.value),placeholder:e(`machine.credentialApiKeyPlaceholder`),type:`password`,value:r})]}),(0,z.jsxs)(`label`,{htmlFor:`operator-credential-base-url`,children:[(0,z.jsx)(`span`,{children:e(`machine.credentialBaseUrl`)}),(0,z.jsx)(`input`,{autoComplete:`off`,disabled:!!s,id:`operator-credential-base-url`,onChange:e=>o(e.target.value),placeholder:e(`machine.credentialBaseUrlPlaceholder`),type:`text`,value:a})]}),l?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:l}):null,d?(0,z.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,z.jsx)(hm,{"aria-hidden":!0,size:16}),d]}):null,(0,z.jsxs)(`footer`,{className:`personal-operator-credential-actions`,children:[(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!s||!r.trim()&&!a.trim(),onClick:()=>void m({...r.trim()?{provider_key:r}:{},...a.trim()?{base_url:a}:{}},e(`machine.credentialStored`)),type:`button`,children:e(s===`store`?`common.loading`:`machine.credentialStore`)}),(0,z.jsxs)(`button`,{disabled:!!s||t?.provider_key.configured!==!0,onClick:()=>void m({clear_provider_key:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearKey`)]}),(0,z.jsxs)(`button`,{disabled:!!s||t?.base_url.configured!==!0,onClick:()=>void m({clear_base_url:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearUrl`)]})]}),(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),e(`machine.credentialTitle`)]}),(0,z.jsx)(`p`,{children:e(`machine.credentialBoundary`)})]})]})}var LS={appearance:Km,capabilities:sh,language:Im,lark:ah,machine:rh,provider:Fm};function RS({callbacks:e,focusGoalConnection:t=!1,goals:n,initialGoalId:r,initialTab:i=`lark`,goalNotifications:a,onChanged:o,onClose:s,onThemeChange:c,theme:l}){let{locale:u,setLocale:d,t:f}=Ji(),[p,m]=(0,R.useState)(i),h=(0,R.useRef)(null);(0,R.useEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{if(e.scrollWidth<=e.clientWidth)return;let t=e.querySelector(`[aria-current="page"]`);if(!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=r.leftn.right?r.right-n.right:0;i&&(e.scrollLeft+=i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[p]);let g=[...r?[{key:`capabilities`,label:f(`capabilities.title`)}]:[],{key:`provider`,label:f(`settings.modelProvider`)},{key:`machine`,label:f(`settings.globalCapabilities`)},{key:`lark`,label:`Lark`},{key:`appearance`,label:f(`settings.appearance`)},{key:`language`,label:f(`settings.language`)}],_=[{label:f(`settings.languageEnglish`),value:`en`},{label:f(`settings.languageSimplifiedChinese`),value:`zh-CN`}],v={appearance:{title:f(`settings.appearance`)},capabilities:{title:f(`capabilities.title`)},language:{title:f(`settings.language`)},lark:{title:`Lark`},machine:{title:f(`settings.globalCapabilities`)},provider:{title:f(`settings.modelProvider`)}}[p];return(0,z.jsxs)(`section`,{"aria-label":f(`settings.title`),className:`personal-settings-page`,"data-pw-theme":l,children:[(0,z.jsxs)(`aside`,{className:`personal-settings-sidebar`,children:[(0,z.jsxs)(`button`,{autoFocus:!0,className:`personal-settings-back`,onClick:s,type:`button`,children:[(0,z.jsx)(om,{size:17}),(0,z.jsx)(`span`,{children:f(`settings.back`)})]}),(0,z.jsx)(`div`,{className:`personal-settings-title`,children:(0,z.jsx)(`strong`,{children:f(`settings.title`)})}),(0,z.jsx)(`nav`,{"aria-label":f(`settings.categories`),className:`personal-settings-tabs`,ref:h,children:g.map(e=>{let t=LS[e.key];return(0,z.jsxs)(`button`,{"aria-current":p===e.key?`page`:void 0,onClick:()=>m(e.key),type:`button`,children:[(0,z.jsx)(t,{size:17}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:e.label})})]},e.key)})})]}),(0,z.jsxs)(`main`,{className:`personal-settings-body`,children:[(0,z.jsx)(`header`,{className:`personal-settings-header`,children:(0,z.jsx)(`div`,{children:(0,z.jsx)(`h1`,{children:v.title})})}),p===`lark`?(0,z.jsx)(tS,{embedded:!0,focusGoalConnection:t,goals:n,initialGoalId:r,onChanged:o,onClose:s}):null,p===`provider`?(0,z.jsx)(`div`,{className:`personal-provider-settings`,children:(0,z.jsx)(IS,{})}):null,p===`machine`?(0,z.jsx)(NS,{}):null,p===`capabilities`?(0,z.jsx)(ES,{callbacks:e,goalId:r,notification:a.find(e=>e.goalId===r),onChanged:o}):null,p===`appearance`?(0,z.jsx)(`section`,{className:`personal-detail-card personal-appearance-settings`,children:(0,z.jsxs)(`div`,{className:`personal-settings-choice-group`,role:`radiogroup`,"aria-label":f(`settings.workspaceTheme`),children:[(0,z.jsxs)(`button`,{"aria-checked":l===`loopx`,onClick:()=>c(`loopx`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-loopx`}),(0,z.jsx)(`strong`,{children:f(`settings.themeLoopx`)})]}),(0,z.jsxs)(`button`,{"aria-checked":l===`paper`,onClick:()=>c(`paper`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-paper`}),(0,z.jsx)(`strong`,{children:f(`settings.themeDefault`)})]}),(0,z.jsxs)(`button`,{"aria-checked":l===`brutal`,onClick:()=>c(`brutal`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-brutal`}),(0,z.jsx)(`strong`,{children:f(`settings.themeHighContrast`)})]})]})}):null,p===`language`?(0,z.jsx)(`section`,{className:`personal-settings-card`,children:(0,z.jsx)(`div`,{"aria-label":f(`settings.language`),className:`personal-language-options`,role:`radiogroup`,children:_.map(e=>(0,z.jsxs)(`button`,{"aria-checked":u===e.value,className:u===e.value?`is-selected`:``,onClick:()=>d(e.value),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:e.label})}),u===e.value?(0,z.jsx)(hm,{"aria-hidden":!0,size:17}):null]},e.value))})}):null]})]})}var zS=`loopx-pw-theme`,BS=`loopx`;function VS(){try{let e=window.localStorage.getItem(zS);return e===`loopx`||e===`paper`||e===`brutal`?e:BS}catch{return BS}}function HS(e){try{window.localStorage.setItem(zS,e)}catch{}}function US({drawer:e,drawerMode:t=`panel`,drawerOpen:n,main:r,mobileSidebarOpen:i=!1,onCloseMobileSidebar:a,sidebar:o,theme:s=`loopx`}){let{t:c}=Ji(),l=(0,R.useRef)(null),u=(0,R.useRef)(null);return(0,R.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,z.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,z.jsx)(`button`,{"aria-hidden":!0,className:`personal-sidebar-backdrop`,onClick:a,tabIndex:-1,type:`button`}):null,(0,z.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,z.jsxs)(`div`,{className:`personal-workspace-sidebar-inner`,children:[i?(0,z.jsxs)(`button`,{className:`personal-sr-only`,onClick:a,type:`button`,children:[c(`common.close`),` `,c(`header.goalNavigation`)]}):null,o]})}),(0,z.jsx)(`main`,{"aria-hidden":i||void 0,className:`personal-workspace-main`,inert:i||void 0,children:r}),n?(0,z.jsx)(`aside`,{className:`personal-workspace-drawer`,"data-context-drawer":!0,"data-drawer-mode":t,children:e}):null]})}function WS(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 GS(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 KS(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 qS({goals:e,onSelectGoal:t,onRetry:n,systemHealth:r}){let{locale:i,t:a}=Ji(),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=[];e.filter(e=>!e.loadState).forEach(e=>{let t=Jd(e);t===`history`?u.push(e):t!==`stopped`&&l[t].push(e)});let d=e=>(0,z.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,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`span`,{className:`personal-home-goal-meta`,children:e.agentLaneCount&&e.agentLaneCount>1?a(`header.workAgentCount`,{count:e.agentLaneCount}):e.agentLabel??e.agentId}),(0,z.jsx)(`p`,{children:e.loadError?a(`startup.error.${e.loadError}`):e.needsYou??e.nextSentence}),(0,z.jsxs)(`footer`,{children:[(0,z.jsx)(`span`,{children:e.loadState?a(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Yi(e.state,i)}),(0,z.jsx)(`small`,{title:e.latestActivity,children:e.loadState?``:e.latestActivity?KS(e.latestActivity,i,a):e.agentTodos.length?a(`home.taskCount`,{count:e.agentTodos.length}):a(`home.noActivity`)})]})]},e.goalId);return(0,z.jsxs)(`section`,{"aria-label":a(`home.workspace`),className:`personal-home-board`,children:[r&&(!r.ok||r.issues.length>0||r.freshnessWarning)?(0,z.jsxs)(`div`,{className:`personal-system-health-banner`,role:`alert`,children:[(0,z.jsxs)(`div`,{className:`personal-system-health-header`,children:[(0,z.jsx)(ym,{size:15}),(0,z.jsx)(`strong`,{children:a(`home.systemHealth`,{summary:r.summary})}),r.freshnessWarning?(0,z.jsxs)(`small`,{children:[`(`,r.freshnessWarning,`)`]}):null]}),r.issues.length>0?(0,z.jsx)(`ul`,{className:`personal-system-health-issues`,children:r.issues.map((e,t)=>(0,z.jsx)(`li`,{children:e},t))}):null]}):null,o.some(e=>e.loadState)?(0,z.jsxs)(`section`,{className:`personal-home-lane`,"aria-live":`polite`,children:[(0,z.jsx)(`header`,{children:a(`startup.progress`,{loaded:o.filter(e=>!e.loadState).length,total:o.length})}),s?(0,z.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`status`,children:[(0,z.jsx)(`span`,{children:a(`startup.failedCount`,{count:s})}),(0,z.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(d)]}):null,(0,z.jsx)(`div`,{className:`personal-home-lanes`,children:c.filter(e=>l[e.key].length>0).map(e=>(0,z.jsxs)(`section`,{className:`personal-home-lane is-${e.key}`,"data-testid":`personal-home-lane-${e.key}`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`i`,{}),e.label]}),(0,z.jsx)(`b`,{children:l[e.key].length})]}),(0,z.jsx)(`div`,{className:`personal-home-lane-list`,children:l[e.key].map(d)})]},e.key))}),u.length?(0,z.jsxs)(`details`,{className:`personal-home-history`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:a(`home.history`)}),(0,z.jsx)(`b`,{children:u.length}),(0,z.jsx)(`small`,{children:a(`home.completedGoals`)})]}),(0,z.jsx)(`div`,{children:u.map(d)})]}):null]})}function JS({items:e,onSelect:t,reportState:n}){let{locale:r,t:i}=Ji();return(0,z.jsxs)(`section`,{className:`personal-object-list personal-files-list`,"data-testid":`personal-goal-outputs`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:i(`files.title`)}),(0,z.jsx)(`span`,{children:e.length})]}),n?.loading?(0,z.jsxs)(`p`,{className:`personal-object-list-state`,role:`status`,children:[(0,z.jsx)(Qm,{className:`is-spinning`,size:14}),i(`files.loadingReports`)]}):null,n?.error?(0,z.jsxs)(`p`,{className:`personal-object-list-state is-error`,role:`alert`,children:[(0,z.jsx)(ym,{size:14}),i(`files.reportLoadFailed`),`: `,n.error]}):null,!n?.loading&&!n?.error&&e.length===0?(0,z.jsxs)(`p`,{className:`personal-object-list-state`,children:[(0,z.jsx)(jm,{size:14}),i(`files.empty`)]}):null,e.map(e=>(0,z.jsxs)(`button`,{"data-output-kind":e.output.kind,onClick:()=>t({item:e.output,kind:`output`}),type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-file-icon`,children:(0,z.jsx)(jm,{size:16})}),(0,z.jsx)(`strong`,{children:e.output.title}),e.output.report?(0,z.jsx)(`em`,{children:i(`files.reportDelta`,{added:e.output.report.addedCount,changed:e.output.report.changedCount})}):null,(0,z.jsx)(`p`,{children:e.output.summary??e.output.safePreview??e.output.kind??i(`files.emptySummary`)}),(0,z.jsx)(`small`,{title:e.output.createdAt,children:[e.output.kind===`report`?i(`files.verifiedReport`):null,KS(e.output.createdAt,r,i)].filter(Boolean).join(` · `)})]},e.id))]})}function YS({agentLabel:e,messages:t,onClose:n,onDraftTask:r,onOpenConversation:i,title:a}){let{t:o}=Ji(),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,R.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,z.jsxs)(`aside`,{"aria-label":o(`conversation.receipt`),className:`personal-manager-conversation-tray`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(fm,{size:16}),(0,z.jsx)(`strong`,{children:a??o(`conversation.title`)}),(0,z.jsx)(`small`,{children:t.at(-1)?.pending?o(`conversation.replying`):o(`common.recently`)})]}),(0,z.jsxs)(`div`,{className:`personal-manager-conversation-actions`,children:[r&&l?(0,z.jsxs)(`button`,{className:`personal-manager-conversation-btn`,onClick:()=>r(l.text),title:o(`conversation.convertHint`),type:`button`,children:[(0,z.jsx)(Rm,{size:13}),(0,z.jsx)(`span`,{children:o(`conversation.toTask`)})]}):null,(0,z.jsx)(`button`,{className:`personal-manager-conversation-link`,onClick:i,type:`button`,children:o(`conversation.full`)}),n?(0,z.jsx)(`button`,{"aria-label":o(`conversation.close`),className:`personal-manager-conversation-close`,onClick:n,title:o(`conversation.close`),type:`button`,children:(0,z.jsx)(gh,{size:14})}):null]})]}),(0,z.jsx)(`div`,{"aria-live":`polite`,className:`personal-manager-conversation-messages`,children:c.map(t=>(0,z.jsxs)(`article`,{className:`is-${t.role}`,children:[(0,z.jsx)(`strong`,{children:t.role===`user`?o(`common.you`):t.agentLabel??e??o(`header.manager`)}),(0,z.jsxs)(`div`,{className:`personal-manager-conversation-bubble`,children:[t.role===`user`?(0,z.jsx)(`p`,{children:t.text}):(0,z.jsx)(wb,{text:t.text}),t.pending?(0,z.jsx)(`small`,{children:o(`conversation.agentPending`)}):null,(0,z.jsx)(Wy,{request:t.collaboration}),(0,z.jsx)(Vb,{delivery:t.returnDelivery})]})]},t.id))})]})}function XS({onClose:e,onOpenDetails:t,run:n}){let{t:r}=Ji();return(0,z.jsxs)(`section`,{"aria-label":r(`session.record`),className:`personal-session-record`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(fm,{size:17}),r(`session.record`)]}),(0,z.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,z.jsx)(gh,{size:15})})]}),(0,z.jsx)(`div`,{children:(0,z.jsx)(`strong`,{children:n.title})}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Agent`}),(0,z.jsx)(`dd`,{children:n.agentLabel})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`common.status`)}),(0,z.jsx)(`dd`,{children:Xi(n.sessionStatus??n.status,r)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Session`}),(0,z.jsx)(`dd`,{title:n.sessionId,children:n.sessionId})]})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:t,type:`button`,children:r(`session.details`)})]})}function ZS(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??Kd(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>Jd(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`})}qd(i)&&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 QS(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function $S(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 eC(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 tC(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 nC(e,t){let n=tC(e),r=eb(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===`team.plan`?e.status===`applied`?db(ub(e.receipt),t):t(`proposal.summary.teamPlan`,{goal:ob(e.normalized_parameters),count:ab(e.normalized_parameters)}):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`?eC(e,r,t):e.action_kind===`team.plan`?ib(e.normalized_parameters,t):$S(e.normalized_parameters,t),goalId:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:void 0,impact:r.retryOriginal?t(`actionReview.${r.reason}`):e.action_kind===`operation.execute`?t(`proposal.impact.operation`):e.action_kind===`team.plan`?e.status===`applied`?t(`proposal.teamPlan.assignedHint`):t(`proposal.impact.teamPlan`):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`):``,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:r.retryOriginal?t(`drawer.retryOriginal`):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===`team.plan`?t(e.status===`applied`?`proposal.teamPlan.viewResult`:`proposal.primary.teamPlan`):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:r.retryOriginal||e.status===`applied`&&e.action_kind!==`operation.execute`&&r.interaction!==`completed`?`error`:QS(e.status),teamPlanOutcome:e.action_kind===`team.plan`?ub(e.receipt)??void 0:void 0,teamPlanAssignments:e.action_kind===`team.plan`?sb(e.receipt,e.normalized_parameters):void 0,teamPlanGapLanes:e.action_kind===`team.plan`?cb(e.receipt,e.normalized_parameters):void 0,title:c}}function rC(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 iC(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 aC(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 oC(e,t){let n=aC(e,[`目标`,`Objective`]),r=aC(e,[`完成标准`,`Completion criteria`]),i=aC(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||iC(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 sC(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 cC(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 lC(e,t){return aC(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 uC(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 dC(e,t){let n=e.toLowerCase();return t.find(e=>n.includes(e.agentId.toLowerCase())||n.includes(e.label.toLowerCase()))}function fC(e){let t=aC(e,[`标题`,`任务标题`,`Todo 标题`]),n=aC(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 pC=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),mC=5242880,hC=4;function gC(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 _C({conversationSessionId:e,agents:t=[{agentId:`codex`,available:!0,capability:`代码与项目执行`,label:`Codex`}],callbacks:n={},goalArchiveLoadState:r={error:null,phase:`ready`},managerChannelBinding:i,managerRuntime:a,model:o,readOnly:s=!1,selectedAgentId:c,selectedGoalId:l,statusSourceControl:u}){let{locale:d,t:f}=Ji(),[p,m]=(0,R.useState)(l??null),[h,g]=(0,R.useState)(c??t.find(e=>e.available)?.agentId??`codex`),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(null),[C,w]=(0,R.useState)({}),[T,E]=(0,R.useState)(`chat`),[D,O]=(0,R.useState)(!1),[k,A]=(0,R.useState)(!1),[ee,j]=(0,R.useState)(!1),[M,te]=(0,R.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{}}}),[ne,N]=(0,R.useState)(!1),[P,re]=(0,R.useState)(null),[ie,ae]=(0,R.useState)(`queue`),[F,oe]=(0,R.useState)(``),[I,se]=(0,R.useState)([]),[L,ce]=(0,R.useState)(null),[le,ue]=(0,R.useState)(null),[de,fe]=(0,R.useState)(()=>new Set),[pe,me]=(0,R.useState)(()=>new Set),[he,ge]=(0,R.useState)(`idle`),[_e,ve]=(0,R.useState)([]),[ye,be]=(0,R.useState)([]),[xe,Se]=(0,R.useState)(!1),[Ce,we]=(0,R.useState)(VS),[Te,Ee]=(0,R.useState)({}),[De,Oe]=(0,R.useState)([]),ke=(0,R.useRef)(!1),Ae=(0,R.useRef)(NaN),je=(0,R.useRef)(null),Me=(0,R.useRef)(null),Ne=(0,R.useRef)(null),Pe=(0,R.useRef)(null),Fe=(0,R.useRef)(new Set),Ie=(0,R.useRef)(new Set),[Le,Re]=(0,R.useState)(null),B=l===void 0?p:l,ze=c??h,Be=`${B??`manager`}:${ze}`,Ve=M[Be]??``;(0,R.useEffect)(()=>{se([]),ce(null)},[Be]);function He(e,t){te(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 Ue(e){He(Be,e)}function We(e){return kh.find(t=>t.id===e)?.prompt??``}(0,R.useEffect)(()=>{let e=je.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[Ve]);let Ge=(0,R.useMemo)(()=>o.goals.map(e=>{let t=Te[e.goalId];return t?{...e,repository:{branch:t.branch,identity:t.identity,label:t.label,readOnly:!0}}:e}),[Te,o.goals]),Ke=(0,R.useMemo)(()=>Ge.filter(e=>Jd(e)===`needs_you`).length,[Ge]),qe=(0,R.useMemo)(()=>Ge.filter(e=>Jd(e)===`needs_you`&&(e.needsYouBlocking||e.state===`等你`)).length,[Ge]),V=Ge.find(e=>e.goalId===B)??null;function Je(e){Ne.current=document.activeElement instanceof HTMLElement?document.activeElement:null,Se(!1),v(e)}function Ye(){v(null),window.requestAnimationFrame(()=>{let e=Ne.current;e?.isConnected&&e.getClientRects().length?e.focus({preventScroll:!0}):document.querySelector(`.personal-mobile-menu`)?.focus({preventScroll:!0})})}let Xe=_?.kind===`settings`,Ze=B,Qe=(0,R.useMemo)(()=>{let e=Object.values(C).filter(e=>e.actionKind===`heartbeat.bind`&&e.goalId&&e.status===`applied`).map(e=>({id:`schedule:${e.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:ze,executionHistory:[],goalId:e.goalId,label:e.title,nextRunAt:f(`drawer.schedulePending`),notificationRule:f(`drawer.scheduleDefaultNotification`),schedule:e.fields.find(e=>e.key===`cadence`)?.value??f(`schedule.summary`),scheduleId:`${e.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:e.status===`applied`?`active`:`draft`,stopCondition:e.fields.find(e=>e.key===`stop_condition`)?.value??f(`drawer.scheduleDefaultStop`),timezone:e.fields.find(e=>e.key===`timezone`)?.value??`Asia/Shanghai`}})),t=[...ZS(o,Ze,f),...o.timeline??[],...e,...GS(Object.values(C)).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)||e.proposal.reviewPlan?.retryOriginal===!0||_e.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)},[Ze,o,C,ze,B,_e,f]),$e=(0,R.useMemo)(()=>x?Qe.filter(e=>e.kind===`message`?!0:e.kind===`run`?e.run.runId===x.runId:e.kind===`output`&&e.output.runId===x.runId):Qe,[x,Qe]);(0,R.useEffect)(()=>{if(!x)return;let e=Qe.find(e=>e.kind===`run`&&e.run.runId===x.runId);!e||e.kind!==`run`||JSON.stringify({completedSteps:x.completedSteps,latestActivity:x.latestActivity,messages:x.sessionMessages,sessionStatus:x.sessionStatus,status:x.status,totalSteps:x.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})&&S(e.run)},[x,Qe]);let et=(0,R.useMemo)(()=>Qe.flatMap(e=>e.kind===`message`?[e.message]:[]),[Qe]),tt=(0,R.useMemo)(()=>V?Qe.flatMap(e=>e.kind===`message`?[e.message]:[]):[],[Qe,V]);(0,R.useEffect)(()=>{V||D||et.some(e=>e.pending)&&A(!0)},[D,et,V]),(0,R.useEffect)(()=>{!V||T===`chat`||tt.some(e=>e.pending)&&j(!0)},[tt,V,T]);let nt=(0,R.useMemo)(()=>Qe.filter(e=>e.kind===`message`||e.kind===`proposal`&&(_e.includes(e.proposal.previewId)||ye.includes(e.proposal.previewId))),[Qe,_e,ye]),rt=nt[nt.length-1],it=rt?.kind===`message`?rt.message.text.length:0;(0,R.useEffect)(()=>{if(!D||!Me.current)return;let e=window.requestAnimationFrame(()=>{Me.current&&(Me.current.scrollTop=Me.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[nt.length,D,it]);let at=(0,R.useMemo)(()=>{if(_?.kind===`settings`)return null;if(_?.kind===`attention`)return{kind:`attention`,item:rf(_.item,o.attentionHistory??o.userTodos)};if(_?.kind===`goal`){let e=Ge.find(e=>e.goalId===_.item.goalId);return e?{item:e,kind:`goal`}:_}if(_?.kind!==`run`)return _;let e=Qe.find(e=>e.kind===`run`&&e.run.runId===_.item.runId);return e?{item:e.run,kind:`run`}:_},[Qe,_,Ge,o.attentionHistory,o.userTodos]);(0,R.useEffect)(()=>{if(s){Ee({}),Oe([]);return}let e=!1;return Promise.all([h_(),E_()]).then(([t,n])=>{e||(Ee(Object.fromEntries(t.map(e=>[e.goal_id,e.repository]))),Oe(n))}).catch(()=>{}),()=>{e=!0}},[s]),(0,R.useEffect)(()=>{if(!xe)return;function e(e){e.key===`Escape`&&Se(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[xe]),(0,R.useEffect)(()=>{if(B||!Qe.length)return;if(!ke.current){ke.current=!0;try{Ae.current=Date.parse(window.localStorage.getItem(`loopx-pw-last-visit`)??``),window.localStorage.setItem(`loopx-pw-last-visit`,new Date().toISOString())}catch{Ae.current=NaN}}let e=Ae.current,t=Qe.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={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};Re(e=>e?.done===r.done&&e.failed===r.failed?e:r)},[Qe,B]),(0,R.useEffect)(()=>{if(s){w({});return}let e=!1;return eg(B?{goalId:B}:{contextKind:`manager`}).then(t=>{if(e)return;let n=t.filter(e=>[`preview_ready`,`gated`,`deferred`,`applying`].includes(e.status)||eb(e).retryOriginal===!0||e.action_kind===`operation.execute`&&e.status===`applied`).map(e=>nC(e,f)),r=Object.fromEntries(n.map(e=>[e.previewId,e]));w(e=>({...e,...r})),B||be(n.map(e=>e.previewId))}).catch(()=>{}),()=>{e=!0}},[s,B,f]);async function ot(e,t={}){if(s)throw Error(f(`source.readOnlyWriteError`));let r;try{r=n.onPreviewAction?await n.onPreviewAction(e):nC(await Qh(e),f)}catch(t){if(!(t instanceof qh)||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??f(`proposal.workspaceGate.defaultSummary`))},impact:f(o?`proposal.workspaceGate.agentImpact`:`proposal.workspaceGate.selectionImpact`),previewId:`workspace-choice-${Date.now().toString(36)}`,sourceRequest:e,status:`gated`,title:f(o?`proposal.workspaceGate.agentTitle`:`proposal.workspaceGate.selectionTitle`),workspaceCandidates:i}}return ve(e=>e.includes(r.previewId)?e:[...e,r.previewId]),w(e=>({...e,[r.previewId]:r})),t.select!==!1&&v({item:r,kind:`proposal`}),r}function st(){_t(null),He(`manager:${ze}`,f(`composer.createGoalTemplate`)),window.requestAnimationFrame(()=>je.current?.focus())}async function ct(e,t){Se(!1);let r={delete:`Deleted from the owner workspace`,resume:`Resumed from the owner workspace`,stop:`Stopped from the owner workspace`},i={delete:f(`proposal.summary.lifecycleDelete`,{title:e.title}),resume:f(`proposal.summary.lifecycleResume`,{title:e.title}),stop:f(`proposal.summary.lifecycleStop`,{title:e.title})},a=null,o=!1;try{if(t===`stop`){if(Fe.current.has(e.goalId))return;Fe.current.add(e.goalId),fe(new Set(Fe.current)),v(null),a={goalId:e.goalId,next:`stopped`,optimisticApplied:!0,previous:e.activationState},ue(f(`feedback.applying`,{title:i.stop})),n.onGoalActivationStateChange?.(e.goalId,`stopped`)}if(n.onExecuteGoalLifecycle){if(t===`delete`)throw Error(`The selected status source does not authorize Goal deletion.`);let a=await n.onExecuteGoalLifecycle({goalId:e.goalId,operation:t,reason:r[t]});if(!a.projectionVerified)throw Error(`Goal lifecycle projection did not verify.`);o=!0,n.onGoalActivationStateChange?.(e.goalId,a.activationState),ue(f(`feedback.completed`,{title:i[t]})),t===`stop`&&_t(null),await ft([e.goalId]);return}let s=await ot({actionKind:`goal.lifecycle`,context:{kind:`goal_directory`,goal_id:e.goalId},idempotencyKey:`workspace-goal-${t}-${e.goalId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:t,reason:r[t]},summary:i[t]},{select:t!==`stop`});if(s.goalId!==e.goalId||s.lifecycleOperation!==t)throw v(null),Error(f(`actionReview.targetChanged`));t===`stop`&&(s.reviewPlan?.interaction===`direct`?(o=!0,await pt(s,{lifecycleProjection:a??void 0,presentation:`feedback`})):(a&&n.onGoalActivationStateChange?.(a.goalId,a.previous),ue(s.gate?f(`feedback.gateRequired`,{summary:s.gate.summary}):f(`feedback.notCompleted`,{status:s.status})),v({item:s,kind:`proposal`})))}catch(e){a&&!o&&n.onGoalActivationStateChange?.(a.goalId,a.previous),ue(f(`feedback.executionFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{t===`stop`&&(Fe.current.delete(e.goalId),fe(new Set(Fe.current)))}}function lt(e,t){Ue(f(t?e===`heartbeat`?`composer.heartbeatTemplate`:`composer.monitorTemplate`:e===`heartbeat`?`composer.heartbeatTemplateWithoutGoal`:`composer.monitorTemplateWithoutGoal`)),v(null),window.requestAnimationFrame(()=>je.current?.focus())}async function ut(e,t,r=``){let i=await n.onRequestScheduleConfig?.(e,t);if(i){ve(e=>e.includes(i.previewId)?e:[...e,i.previewId]),w(e=>({...e,[i.previewId]:i})),v({item:i,kind:`proposal`});return}if(!t){Ue(f(e===`heartbeat`?`composer.heartbeatGoalQuestion`:`composer.monitorGoalQuestion`));return}let a=Date.now().toString(36);await ot({actionKind:e===`heartbeat`?`heartbeat.bind`:`monitor.create`,context:{kind:`schedule`,goal_id:t},idempotencyKey:`workspace-${e}-${t}-${a}`,normalizedParameters:e===`heartbeat`?{agent_id:ze,cadence:sC(r),goal_id:t,stop_condition:uC(r),timezone:`Asia/Shanghai`}:{agent_id:ze,cadence:sC(r),goal_id:t,stop_condition:uC(r),target:lC(r,f),target_key:`goal-${t}`,timezone:`Asia/Shanghai`},summary:e===`heartbeat`?f(`proposal.summary.heartbeat`):f(`proposal.summary.monitor`,{target:lC(r,f)})})}async function dt(e){if(!Ie.current.has(e.todoId)){Ie.current.add(e.todoId),me(new Set(Ie.current)),ue(f(`feedback.preparingPreview`,{title:e.text}));try{await ot({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:f(`tasks.markComplete`,{name:e.text})}),ue(null)}catch(e){ue(f(`feedback.previewFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{Ie.current.delete(e.todoId),me(new Set(Ie.current))}}}function ft(e){let t=n.onReconcileStatus,r=t?t({invalidateGoalIds:e}):n.onRefresh?.();return Promise.resolve(r).catch(()=>{ue(f(`feedback.goalRefreshFailed`))})}async function pt(e,t={}){let r=e.actionKind===`team.plan`&&e.status===`error`&&[`apply_failed`,`readback_unverified`].includes(e.reviewPlan?.reason??``);if(e.reviewPlan&&!e.reviewPlan.canApply&&!r)return;let i=t.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:o.goals.find(t=>t.goalId===e.goalId)?.activationState??(e.lifecycleOperation===`stop`?`active`:`stopped`)}:null,s=t.lifecycleProjection??a;ue(f(`feedback.applying`,{title:e.title}));let c={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`pending`,reason:`apply_pending`,canApply:!1}:void 0,status:`applying`};w(t=>({...t,[e.previewId]:c})),i&&v({item:c,kind:`proposal`}),s&&!s.optimisticApplied&&n.onGoalActivationStateChange?.(s.goalId,s.next);try{if(n.onApplyProposal){await n.onApplyProposal(e);let t={...e,status:`applied`};w(n=>({...n,[e.previewId]:t})),i&&v({item:t,kind:`proposal`}),ue(f(`feedback.completed`,{title:e.title})),e.actionKind===`goal.lifecycle`&&((e.lifecycleOperation===`stop`||e.lifecycleOperation===`delete`)&&_t(null),e.lifecycleOperation===`delete`&&e.goalId&&n.onGoalDeleted?.(e.goalId),ft(e.goalId?[e.goalId]:void 0));return}let t=await tg(e.previewId);if(t.proposal.proposal_id!==e.previewId||t.proposal.action_kind!==e.actionKind||e.actionKind===`goal.lifecycle`&&(t.proposal.normalized_parameters.goal_id!==e.goalId||tC(t.proposal)!==e.lifecycleOperation))throw new qh(f(`actionReview.targetChanged`),{error_code:`action_response_mismatch`});let r=nC(t.proposal,f);if(w(t=>({...t,[e.previewId]:r})),i&&v({item:r,kind:`proposal`}),r.reviewPlan?.interaction!==`completed`){s&&n.onGoalActivationStateChange?.(s.goalId,s.previous),v({item:r,kind:`proposal`}),ue(t.proposal.status===`stale`?f(`feedback.stale`):f(`actionReview.${r.reviewPlan.reason}`));return}ue(f(`feedback.completed`,{title:r.title})),r.actionKind===`todo.create`&&await n.onRefresh?.(),r.actionKind===`goal.lifecycle`&&(r.lifecycleOperation===`stop`||r.lifecycleOperation===`delete`)&&_t(null),r.actionKind===`goal.lifecycle`&&r.lifecycleOperation===`delete`&&r.goalId&&n.onGoalDeleted?.(r.goalId),r.actionKind===`goal.lifecycle`&&ft(r.goalId?[r.goalId]:void 0)}catch(t){if(s&&n.onGoalActivationStateChange?.(s.goalId,s.previous),t instanceof qh&&t.payload.error_code===`protected_action`){let r=t.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??t.message)},status:`gated`};w(t=>({...t,[e.previewId]:a})),v({item:a,kind:`proposal`}),ue(f(`feedback.gateRequired`,{summary:a.gate.summary})),e.actionKind===`goal.create`&&e.goalId&&(n.onRefresh?.(),_t(e.goalId));return}let r=t instanceof qh&&tb(t.payload),i=t instanceof qh&&t.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:t instanceof Error?t.message:String(t),status:r?`stale`:`error`};w(t=>({...t,[e.previewId]:a})),v({item:a,kind:`proposal`}),ue(f(`feedback.executionFailed`,{error:a.errorMessage}))}}function mt(){E(`chat`),S(null),j(!1),window.requestAnimationFrame(()=>{let e=Me.current?.querySelectorAll(`.personal-message.is-assistant`);e?.item(e.length-1)?.scrollIntoView({block:`start`})})}let ht={...n,onOpenRunSession:async e=>{e.goalId!==B&&_t(e.goalId),E(`chat`),await n.onOpenRunSession?.(e),S(e),v(null)},onOpenGoal:e=>{_t(e),ft([e])},onOpenGoalView:e=>{e===`chat`?mt():E(e),v(null)},onOpenOutput:e=>{e.goalId!==B&&_t(e.goalId),E(`files`),n.onOpenOutput?.(e)},onApplyProposal:pt,onCancelProposal:async e=>{v(null),w(t=>{let n={...t};return delete n[e.previewId],n});try{n.onCancelProposal?.(e),n.onCancelProposal||await ng(e.previewId)}catch(t){w(t=>({...t,[e.previewId]:e})),ue(f(`feedback.cancelFailed`,{error:t instanceof Error?t.message:String(t)}))}},onTransitionProposal:async(e,t)=>{let n=nC(await rg(e.previewId,t),f);ve(e=>e.includes(n.previewId)?e:[...e,n.previewId]),w(r=>{let i={...r};return t===`regenerate`&&delete i[e.previewId],i[n.previewId]=n,i}),v({item:n,kind:`proposal`})},onSelectWorkspaceCandidate:async(e,t)=>{e.sourceRequest&&(w(t=>{let n={...t};return delete n[e.previewId],n}),await ot({...e.sourceRequest,idempotencyKey:`${e.sourceRequest.idempotencyKey}-${t}`,normalizedParameters:{...e.sourceRequest.normalizedParameters,workspace_ref:t}}))},onPreviewAction:ot,onRequestScheduleConfig:(e,t)=>lt(e,t),onOpenNotificationSettings:e=>Je({goalId:e,kind:`settings`,tab:`lark`}),onFetchNotificationTargets:()=>Ng(),onSetupGoalChannel:e=>Fg(e),onToggleGoalAutoNotify:e=>Ig(e),onUpdateSchedule:async(e,t)=>{let n=Date.now().toString(36),r=e.scheduleKind===`heartbeat`;await ot({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??ze,...!r&&t===`run_now`?{endpoint_id:ze}:{},...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}`})}},gt=s?{onOpenGoal:ht.onOpenGoal,onOpenGoalView:ht.onOpenGoalView,onOpenOutput:ht.onOpenOutput}:ht;function _t(e){m(e),O(!1),A(!1),j(!1),S(null),v(null),E(`tasks`),Se(!1),n.onSelectGoal?.(e)}function vt(e){g(e),n.onSelectAgent?.(e)}function yt(e){we(e),HS(e)}async function bt(r){let i=r?[]:I,a=(r??Ve).trim()||(i.length?f(`composer.imageAnalysisPrompt`):``);if(!(!a||ne)){if(P?.session_id===e&&P?.enabled&&P.active_turn_id&&e){if(i.length){ce(d===`zh-CN`?`运行中的消息投递暂不支持图片,请暂停后发送。`:`Pause execution before sending images.`);return}N(!0);try{let t=await Sg(e,a,ie);r||Ue(``),oe(d===`zh-CN`?`${ie===`queue`?`已排队,等待后续回合`:ie===`inbox`?`已进入收件箱`:`已提交纠偏`} · ${t.status}`:`${ie}: ${t.status}`)}catch(e){ce(e instanceof Error?e.message:String(e))}finally{N(!1)}return}r||(Ue(``),se([])),ce(null),N(!0);try{if(i.length){B?T!==`chat`&&j(!0):A(!0);let e=await n.onSendMessage?.(a,ze,B,i);e&&await ot(e);return}let e=Zb(a,{agents:t.map(e=>({agentId:e.agentId,label:e.label})),goalId:B,todos:(V?.agentTodos??[]).map(e=>({text:e.text,todoId:e.todoId}))});if(e.route===`clarify`){Ue(a);let t=f(`composer.clarifySingleAction`);e.missingFields.includes(`resume_when`)&&(t=f(`composer.clarifyDefer`)),ue(t);return}if(e.actionKind===`goal.create`){let t=oC(a,f),n=rC(t.title);await ot({actionKind:`goal.create`,context:{kind:`manager`,goal_id:null,natural_language:a},idempotencyKey:`workspace-goal-intent-${n}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:ze,completion_criteria:t.completionCriteria,execution_boundary:t.executionBoundary,goal_id:n,heartbeat:{cadence:sC(a),enabled:e.normalizedParameters.heartbeat_enabled===!0,timezone:`Asia/Shanghai`},initial_todos:t.initialTodos,objective:t.objective,permission:t.permission,stop_condition:uC(a),title:t.title,workspace_ref:`current`},summary:f(`proposal.summary.goalCreate`,{title:t.title})});return}if(B&&e.actionKind===`heartbeat.bind`){await ut(`heartbeat`,B,a);return}if(B&&e.actionKind===`monitor.create`){let e=cC(a,f);if(e){Ue(a),ue(e);return}await ut(`monitor`,B,a);return}let r=dC(a,t);if(B&&r&&e.actionKind===`agent.bind`){await ot({actionKind:`agent.bind`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-agent-bind-${B}-${r.agentId}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:r.agentId,goal_id:B},summary:`将 ${r.label} 绑定到 ${V?.title??B}`});return}if(B&&e.actionKind===`todo.create`){if(e.normalizedParameters.start_execution===!0){await ot({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-task-start-${B}-${Date.now().toString(36)}`,normalizedParameters:{endpoint_id:r?.agentId??ze,goal_id:B,start_execution:!0,text:a},summary:`交给 Agent 执行:${a.slice(0,120)}`});return}let t=r?.agentId??(/(交给|分配给|让).{0,24}(agent|codex|claude|kiro|kimi)/iu.test(a)?ze:null);await ot({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-todo-create-${B}-${Date.now().toString(36)}`,normalizedParameters:{...t?{endpoint_id:t}:{},goal_id:B,text:fC(a)},summary:`创建 Todo:${fC(a)}`});return}let o=V?.agentTodos.find(e=>a.includes(e.todoId)||a.includes(e.text)),s=typeof e.normalizedParameters.operation==`string`?e.normalizedParameters.operation:null;if(B&&o&&e.actionKind===`todo.update`&&s){await ot({actionKind:`todo.update`,context:{kind:`todo`,goal_id:B,todo_id:o.todoId,natural_language:a},idempotencyKey:`workspace-todo-update-${o.todoId}-${s}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:ze,...s===`reassign`&&r?{endpoint_id:r.agentId}:{},...s===`block`?{note:a}:{},...s===`defer`&&typeof e.normalizedParameters.resume_when==`string`?{resume_when:e.normalizedParameters.resume_when}:{},goal_id:B,operation:s,todo_id:o.todoId},summary:`更新 Todo:${o.text}`});return}B?T!==`chat`&&j(!0):A(!0);let c=await n.onSendMessage?.(a,ze,B);c&&await ot(c)}catch(e){r||(Ue(a),se(i));let t=e instanceof Error?e.message:f(`feedback.sendGenericError`);ue(f(`feedback.sendFailed`,{error:t}))}finally{N(!1)}}}let xt=t.find(e=>e.agentId===ze)?.label??ze,St=!V&&Ve.startsWith(f(`composer.createGoalDraftLead`));async function Ct(e){if(!e?.length)return;let t=hC-I.length,n=Array.from(e).slice(0,Math.max(0,t)),r=n.find(e=>!pC.has(e.type)),i=n.find(e=>e.size>mC);if(t<=0){ce(f(`composer.imageCountError`,{count:hC}));return}if(r){ce(f(`composer.imageTypeError`));return}if(i){ce(f(`composer.imageSizeError`,{size:mC/1024/1024}));return}try{let t=await Promise.all(n.map(e=>gC(e,f)));se(e=>[...e,...t].slice(0,hC)),ce(e.length>n.length?f(`composer.imageCountError`,{count:hC}):null)}catch(e){ce(e instanceof Error?e.message:f(`composer.imageReadGenericError`))}finally{Pe.current&&(Pe.current.value=``)}}function wt(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 Tt(){let e=await E_();Oe(e)}async function Et(){await Promise.all([Tt(),n.onRefresh?.()])}async function Dt(){if(!(!n.onRefresh||he===`loading`)){ge(`loading`);try{await n.onRefresh(),ge(`done`)}catch{ge(`error`)}window.setTimeout(()=>ge(`idle`),1800)}}let Ot=Xe?(0,z.jsx)(RS,{callbacks:gt,focusGoalConnection:!!(_?.kind===`settings`&&_.goalId),goalNotifications:o.goalNotifications??[],goals:Ge,initialGoalId:_?.kind===`settings`?_.goalId??B:B,initialTab:_?.kind===`settings`?_.tab??`lark`:`lark`,onChanged:()=>void Et(),onClose:Ye,onThemeChange:yt,theme:Ce}):null;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{hidden:Xe,children:(0,z.jsx)(US,{drawer:at?(0,z.jsx)(ox,{agents:t,attentionHistory:o.attentionHistory??o.userTodos,onSelectAttention:e=>v({kind:`attention`,item:e}),callbacks:gt,goalNotifications:o.goalNotifications??[],goals:Ge,inspectorExpanded:y,larkConnections:s?[]:De,onClose:()=>{at.kind===`proposal`&&[`applied`,`rejected`].includes(at.item.status)&&(at.item.actionKind!==`heartbeat.bind`||at.item.status!==`applied`)&&w(e=>{let t={...e};return delete t[at.item.previewId],t}),b(!1),v(null)},onToggleInspectorSize:()=>b(e=>!e),readOnly:s,runs:Qe.flatMap(e=>e.kind===`run`?[e.run]:[]),selection:at}):null,drawerMode:at?.kind===`todo`?y?`inspector-full`:`inspector`:`panel`,drawerOpen:at!==null,mobileSidebarOpen:xe,onCloseMobileSidebar:()=>Se(!1),theme:Ce,main:(0,z.jsxs)(`div`,{className:`personal-channel`,children:[(0,z.jsx)(pb,{agents:t,managerChatOpen:D,managerChannelBinding:i,managerRuntime:a,mobileNavigationOpen:xe,onOpenGoalCapabilities:V&&!s?()=>Je({goalId:V.goalId,kind:`settings`,tab:`capabilities`}):void 0,onRefresh:n.onRefresh?()=>void Dt():void 0,onOpenNavigation:()=>Se(!0),onOpenManagerChat:()=>{A(!1),O(!0)},onSelectGoalTab:e=>{e===`chat`?mt():E(e)},onSelectAgent:vt,onReturnManagerHome:()=>{O(!1),A(!1),window.requestAnimationFrame(()=>Me.current?.scrollTo({behavior:`smooth`,top:0}))},selectedAgentId:ze,refreshState:he,readOnlySourceLabel:s?u?.activeSource.label:void 0,selectedGoal:V,selectedGoalTab:T}),B&&T===`chat`&&!s&&ze===`codex`&&n.onStartLoopX?(0,z.jsx)(Nb,{onPrepare:()=>n.onPrepareLoopX(ze,B),sessionId:e,onChange:re,onExecute:(e,t)=>n.onStartLoopX?.(e,ze,B,t)},`${B}:${ze}`):null,(0,z.jsxs)(`div`,{className:`personal-channel-scroll`,"data-active-goal-view":V?T:void 0,ref:Me,children:[B&&T===`chat`&&!s&&ze===`codex`&&e&&P?.settings.execution_config&&P.settings.agent_id?(0,z.jsx)(Fb,{sessionId:e,zh:d===`zh-CN`,refreshKey:JSON.stringify(P.deliveries)},`${e}:${P.settings.agent_id}:${P.settings.execution_config}`):null,!V&&!D&&Le&&Le.done+Le.failed>0?(0,z.jsxs)(`section`,{className:`personal-digest-card`,"aria-label":f(`digest.away`),children:[(0,z.jsx)(`strong`,{children:f(`digest.away`)}),(0,z.jsxs)(`div`,{className:`personal-digest-stats`,children:[Le.done>0?(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:Le.done}),f(`digest.completed`)]}):null,Le.failed>0?(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:Le.failed}),f(`digest.failed`)]}):null]})]}):null,!V&&!D?(0,z.jsxs)(`section`,{className:`personal-manager-greeting`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(fm,{size:20})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:f(`home.greeting`)}),(0,z.jsx)(`p`,{children:o.goals.some(e=>e.activationState===`active`&&e.loadState)?f(`startup.partial`):(0,z.jsxs)(z.Fragment,{children:[f(`home.waitingCount`,{count:Ke}),` `,qe>0?f(`home.blockingSummary`,{count:qe}):null]})})]})]}):null,V?.loadState?(0,z.jsx)(`section`,{className:`personal-manager-greeting`,role:`status`,"data-testid":`goal-status-loading`,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:f(V.loadState===`error`?`startup.goalError`:`startup.goalLoading`)}),(0,z.jsx)(`p`,{children:f(V.loadError?`startup.error.${V.loadError}`:`startup.independent`)}),V.loadState===`error`?(0,z.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,type:`button`,onClick:()=>void n.onRefresh?.(),children:f(`startup.retry`)}):null]})}):V?(0,z.jsx)(Xx,{activeTab:T,scrollRef:Me,panels:{overview:(0,z.jsx)(Yx,{active:!Xe&&T===`overview`,goal:V,items:Qe,userTodos:o.userTodos,readOnly:s,onOpenDetails:()=>v({kind:`goal`,item:V}),onSelect:v,onView:E}),tasks:(0,z.jsx)(Mx,{historyEnabled:!s,goal:V,items:Qe,onDraftTaskFromMessage:s?void 0:e=>{Ue(`创建一个 Task:${WS(e)}`),ue(f(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>je.current?.focus())},onOpenChat:mt,onQuickComplete:s?void 0:dt,onSelect:v,quickCompletingTodoIds:pe,selectedTodoId:at?.kind===`todo`?at.item.todoId:null,userTodos:o.userTodos}),files:(0,z.jsx)(JS,{items:Qe.filter(e=>e.kind===`output`),onSelect:v,reportState:o.periodicReports}),chat:(0,z.jsxs)(z.Fragment,{children:[V&&x?.goalId===V.goalId?(0,z.jsx)(XS,{onClose:()=>S(null),onOpenDetails:()=>v({item:x,kind:`run`}),run:x}):null,(0,z.jsx)(Hb,{items:$e,onSelect:v,selectedGoal:V})]})}},`${u?.activeSource.statusUrl??`/status.json`}:${V.goalId}`):D?(0,z.jsx)(Hb,{items:nt,onSelect:v,selectedGoal:null}):(0,z.jsx)(qS,{goals:Ge,onRetry:()=>void n.onRefresh?.(),onSelectGoal:_t,systemHealth:o.systemHealth})]}),(0,z.jsxs)(`div`,{className:`personal-composer-wrap`,children:[P?.session_id===e&&P?.enabled&&P.active_turn_id?(0,z.jsxs)(`label`,{className:`goal-loopx-message-mode`,children:[d===`zh-CN`?`消息处理`:`Message delivery`,(0,z.jsxs)(`select`,{"aria-label":d===`zh-CN`?`消息处理方式`:`Message delivery mode`,value:ie,onChange:e=>ae(e.target.value),children:[(0,z.jsx)(`option`,{value:`queue`,children:d===`zh-CN`?`下一轮处理`:`Next turn`}),(0,z.jsx)(`option`,{value:`inbox`,children:d===`zh-CN`?`放入收件箱`:`Inbox`}),(0,z.jsx)(`option`,{value:`steer`,children:d===`zh-CN`?`立即纠偏`:`Steer now`})]}),(0,z.jsx)(`span`,{role:`status`,children:F})]}):null,s?(0,z.jsxs)(`div`,{className:`personal-read-only-notice`,children:[(0,z.jsx)(`strong`,{children:f(`source.readOnlyNoticeTitle`)}),(0,z.jsx)(`span`,{children:f(`source.readOnlyNoticeDescription`)})]}):(0,z.jsxs)(z.Fragment,{children:[!V&&!D&&k&&et.length?(0,z.jsx)(YS,{messages:et,onClose:()=>A(!1),onOpenConversation:()=>{A(!1),O(!0)}}):null,V&&T!==`chat`&&ee&&tt.length?(0,z.jsx)(YS,{agentLabel:xt,messages:tt,onClose:()=>j(!1),onDraftTask:T===`tasks`?e=>{Ue(`创建一个 Task:${WS(e)}`),ue(f(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>je.current?.focus())}:void 0,onOpenConversation:mt,title:`${V.title} · ${xt}`}):null,le?(0,z.jsxs)(`div`,{className:`personal-action-feedback`,role:`status`,children:[(0,z.jsx)(`span`,{children:le}),(0,z.jsx)(`button`,{"aria-label":f(`common.closeActionReceipt`),onClick:()=>ue(null),type:`button`,children:(0,z.jsx)(gh,{size:14})})]}):null,(0,z.jsxs)(`details`,{className:`personal-composer-tools`,children:[(0,z.jsx)(`summary`,{children:d===`zh-CN`?`快捷提问`:`Suggestions`}),V?(0,z.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,z.jsxs)(`button`,{"aria-label":f(`composer.nextAction`),disabled:ne,onClick:()=>void bt(f(`composer.nextActionPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(Hm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.nextAction`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.agentProgress`),disabled:ne,onClick:()=>void bt(f(`composer.agentProgressPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(nh,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.agentProgress`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.monitor`),disabled:ne,onClick:()=>void bt(f(`composer.monitorShortcutTemplate`,{target:f(`schedule.defaultTarget`)})),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(mm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.monitor`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.blockers`),disabled:ne||!We(`gate`),onClick:()=>void bt(We(`gate`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(ym,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.blockers`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.evidence`),disabled:ne||!We(`evidence`),onClick:()=>void bt(We(`evidence`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(jm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.evidence`)})]})]}):(0,z.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,z.jsxs)(`button`,{"aria-label":f(`composer.globalTasks`),disabled:ne,onClick:()=>void bt(f(`composer.globalTasksPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(Hm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.globalTasks`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.globalProgress`),disabled:ne,onClick:()=>void bt(f(`composer.globalProgressPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(nh,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.globalProgress`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.createGoal`),onClick:st,title:f(`composer.createGoalHint`),type:`button`,children:[(0,z.jsx)(Xm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.createGoal`)})]})]})]},B??`manager`),St?(0,z.jsxs)(`div`,{className:`personal-goal-draft-status`,role:`status`,children:[(0,z.jsx)(`strong`,{children:f(`composer.createGoalDraft`)}),(0,z.jsx)(`span`,{children:f(`composer.createGoalDraftDescription`)})]}):null,I.length?(0,z.jsx)(`div`,{className:`personal-composer-images`,"aria-label":f(`composer.imagesPending`),children:I.map(e=>(0,z.jsxs)(`figure`,{children:[(0,z.jsx)(`img`,{alt:e.name,src:e.dataUrl}),(0,z.jsx)(`button`,{"aria-label":f(`composer.sentImageAlt`,{name:e.name}),onClick:()=>se(t=>t.filter(t=>t.id!==e.id)),type:`button`,children:(0,z.jsx)(gh,{size:13})})]},e.id))}):null,L?(0,z.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:L}):null,(0,z.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,z.jsx)(`button`,{"aria-label":f(`composer.addImage`),className:`personal-composer-attach`,disabled:ne||I.length>=hC,onClick:()=>Pe.current?.click(),title:f(`composer.attachImageHint`),type:`button`,children:(0,z.jsx)(qm,{size:17})}),(0,z.jsx)(`input`,{accept:`image/png,image/jpeg,image/webp,image/gif`,"aria-label":f(`composer.imagePicker`),className:`personal-composer-file-input`,disabled:ne||I.length>=hC,multiple:!0,onChange:e=>void Ct(e.target.files),ref:Pe,type:`file`}),(0,z.jsx)(`textarea`,{"aria-label":f(`composer.sendMessage`),onChange:e=>Ue(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),bt())},onPaste:wt,placeholder:V?f(`composer.goalPlaceholder`,{goal:V.title}):f(`composer.managerPlaceholder`),ref:je,rows:1,value:Ve}),(0,z.jsx)(`button`,{"aria-label":f(St?`composer.createGoal`:`composer.send`),disabled:!Ve.trim()&&I.length===0||ne,onClick:()=>void bt(),title:f(St?`composer.createGoalHint`:`composer.sendMessageHint`),type:`button`,children:(0,z.jsx)(nh,{size:18})})]})]})]})]}),sidebar:(0,z.jsx)(Ox,{attentionCount:Ke,goals:Ge,goalArchiveLoadState:r,goalLifecycleOperations:n.onExecuteGoalLifecycle?[`stop`,`resume`]:void 0,lifecycleBusyGoalIds:de,onRequestGoalCreate:s?void 0:st,onRequestGoalLifecycle:s&&!n.onExecuteGoalLifecycle?void 0:(e,t)=>void ct(e,t),onRetryGoalArchive:n.onRetryGoalArchive||n.onRefresh?()=>void(n.onRetryGoalArchive??n.onRefresh)?.():void 0,onOpenSettings:s?void 0:()=>Je({kind:`settings`}),onSelectGoal:_t,selectedGoalId:B,statusSourceControl:u},u?.activeSource.statusUrl??`/status.json`)})}),Ot]})}function vC(e){return(e??``).replace(/\s+/gu,` `).trim()}function yC(e,t=120){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t-1).join(``)}…`}function bC(e,t,n){let r=vC(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`):yC(r)}function xC(e,t){return t({advancing:`projection.agentAdvancingGoal`,idle:`projection.agentIdle`,needs_you:`projection.agentNeedsDecision`,stopped:`projection.agentStopped`,waiting_external:`projection.agentWaitingExternal`}[e])}function SC({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 CC=`/status.json`,wC=`loopx-status-source-catalog-v1`,TC={id:`local`,kind:`local`,label:`本机`,readOnly:!1,statusUrl:CC};function EC(e,t){let n=xh(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 DC(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 OC(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=EC(n.statusUrl,t);if(!r||r.length>48||!(`url`in i))return null;let a=vx(n.hostAlias)?n.hostAlias.trim():void 0;return{...a?{hostAlias:a}:{},id:DC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url}}function kC(){return{schemaVersion:1,sources:[TC]}}function AC(e,t){try{let n=e.getItem(wC);if(!n)return kC();let r=JSON.parse(n);if(r.schemaVersion!==1||!Array.isArray(r.sources))return kC();let i=new Set([TC.statusUrl]);return{schemaVersion:1,sources:[TC,...r.sources.flatMap(e=>{let n=OC(e,t);return!n||i.has(n.statusUrl)?[]:(i.add(n.statusUrl),[n])})]}}catch{return kC()}}function jC(e,t){e.setItem(wC,JSON.stringify({schemaVersion:1,sources:t.sources.filter(e=>e.kind===`ssh_tunnel`)}))}function MC(e,t){let n=new Set(t.filter(vx).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 NC(e,t,n){let r=t.label.trim();if(!r)return{error:`请填写来源名称。`};if(r.length>48)return{error:`来源名称不能超过 48 个字符。`};let i=EC(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&&!vx(t.hostAlias))return{error:`请选择有效的 SSH Host。`};let a=t.hostAlias?.trim(),o={...a?{hostAlias:a}:{},id:DC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url};return{catalog:{...e,sources:[...e.sources,o]},source:o}}function PC(e,t){return{...e,sources:e.sources.filter(e=>e.kind===`local`||e.id!==t)}}function FC(e,t,n){if(!t.trim()||xh(t,n).source?.isRelative)return TC;let r=t.trim();try{r=new URL(r,n).toString()}catch{return null}return e.sources.find(e=>e.statusUrl===r)??null}function IC(e,t,n){return FC(e,t,n)||(xh(t,n).source?.isRelative?TC:{id:`temporary`,kind:`ssh_tunnel`,label:`临时来源`,readOnly:!0,statusUrl:t.trim()})}function LC(e,t,n,r){return IC(e,t??n,r)}var RC={delete:`删除`,deploy:`部署`,merge:`合并`,payment:`付款`,release:`发布`};function zC(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:`请求受保护操作:${RC[n.operation]} · ${n.target}`}}var BC=CC;async function VC(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 zp(await t.json())}function HC(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 UC(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??HC(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 WC(e){return(e??``).replace(/\s+/g,` `).trim()}function GC(e){let t=new Map;for(let n of e?.goals??[])t.set(n.goal_id,n);return t}function KC(e,t){return e===void 0||t===void 0?void 0:e+t}function qC(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 JC(e){return e?.items.find(e=>!e.done)}function YC(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 XC(e){return e?.queueItem?.project_asset?.quota?.state??e?.queueItem?.quota?.state??e?.goal.quota?.state??`waiting`}function ZC(e,t,n){let r=[];for(let t of e){let e=qC(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 QC(e){return e?.map(e=>({dataUrl:e.data_url,id:e.id,mimeType:e.mime_type,name:e.name,size:e.size}))}var $C=`loopx.personal-agent-selection.v1`;function ew(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem($C)??`{}`);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 tw={需修复:`danger`,等你:`warning`,等待条件:`info`,推进中:`success`,安静运行:`neutral`,已停止:`neutral`,已完成:`neutral`};function nw(e,t){return WC(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 rw(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 iw(e,t){return[`agent`,`assistant`].includes(e.trim().toLowerCase())&&t.trim().length>0}var aw=`已发现的项目 Agent`;function ow(e){switch(Vy(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 nw(e)}}function sw(e,t){switch(Hy(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 aw}}function cw(e,t){let n=e.project_asset;return t===`user`?YC(n?.user_todos,e.user_todos,`project_asset.user_todos`):YC(n?.agent_todos,e.agent_todos,`project_asset.agent_todos`)}function lw(e){return $d(e.title??e.text,112)}function uw(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 dw(e,t){let n=e.completion_validation_revision_history.at(-1);return{resumeWhen:e.resume_when??null,resumeReady:e.resume_ready??null,resumeReceiptId:uw(e),claimedBy:e.claimed_by??null,done:e.status!==`deferred`&&e.done,evidence:e.evidence?$d(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:lw(e),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.index}`,validationDigest:e.completion_validation_sha256??null,validationRevision:e.completion_validation_revision??null,validationRevisionActor:n?.actor_agent_id??null}}function fw(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 pw(e){return fw(e).map(t=>dw(t,e))}function mw(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=dw(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 hw(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:$d(e.title,112),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.claimed_by??`unknown`}:current`}}function gw(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=hw(t,n);r.has(i.todoId)||r.set(i.todoId,i)}return[...r.values()]}function _w(e){let t=e.queueItem?.project_asset?.agent_todos,n=e.queueItem?.agent_todos,r=fw(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=>dw(t,e)),l=r.find(e=>!e.done);return{doneTodoCount:o,nextTodoText:WC(t?.next??``)||(l?WC(l.title??``)||WC(l.text??``):``)||null,recentCompleted:c}}function vw(e,t){let n=WC(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`):bC(n,t,`projection.validationRecorded`):``}function yw(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 bw(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=[vw(r?.summary,n),bC(i?.health_check,n),bC(i?.recommended_action,n)].find(e=>e!==``&&e!==`暂无`)??n(`projection.runRecorded`),s=SC({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 xw(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 Sw(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 Cw(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 ww(e,t){let n=t.queueItem?.stale_latest_run_warning;return t.severity===`high`||!!Sw(e,t)||!!(n?.requires_refresh_state||n?.severity===`high`)||Cw(t)}function Tw(e,t){let n=Sw(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 Ew(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 Dw(e,t){let n=e.latestRun?.operator_gate;return bC(n?.operator_question??n?.reason_summary??n?.follow_up??e.queueItem?.recommended_action??e.latestRun?.recommended_action,t,`projection.confirmAgentDecision`)}function Ow(e,t){if(t.goal.activation_state===`stopped`)return`已停止`;let n=qC(t,`user`),r=qC(t,`agent`),i=!!JC(n),a=!!JC(r);return[`user_or_controller`,`controller`].includes(t.waitingOn)||i||Ew(t)?`等你`:ww(e,t)?`需修复`:t.waitingOn===`external_evidence`?`等待条件`:XC(t)===`eligible`||a?`推进中`:xw(t)?`已完成`:`安静运行`}function kw(e,t,n,r){if(n===`已停止`)return xC(`stopped`,r);if(n===`需修复`)return bC(Tw(e,t),r,`projection.statusRefreshNeeded`);if(n===`等你`)return xC(`needs_you`,r);if(n===`推进中`){let e=[(qC(t,`agent`)?.items??[]).filter(e=>!e.done).flatMap(e=>[e.title,e.text]).map(e=>WC(e)).find(e=>e!==``&&e!==`暂无`),t.queueItem?.recommended_action,t.latestRun?.recommended_action].map(e=>WC(e)).find(e=>e!==``&&e!==`暂无`);return e?bC(e,r,`projection.agentAdvancingGoal`):xC(`advancing`,r)}return xC(n===`等待条件`?`waiting_external`:`idle`,r)}function Aw(e,t){return t.some(t=>e.includes(t))}function jw(e,t,n){if(t.goals.some(e=>e.activationState===`active`&&e.loadState))return{text:`Goal 状态尚未全部加载,暂不能给出完整统计。可先打开已加载的 Goal,失败项可重试。`,lines:[]};if(Aw(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(Aw(n,[`现在`,`下一步`,`我该`,`该做什么`,`优先处理`])){let e=t.userTodos[0];if(e)return{text:e.blocking?`先处理「${nw(e.goalId)}」:${e.text}`:`当前最先处理「${nw(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(Aw(n,[`等我`,`阻塞`,`需要我`,`全局待办`]))return t.userTodos.length===0?{text:`目前没有 Goal 在等你,开放用户待办为 0。`,lines:[]}:{text:`有 ${t.userTodos.length} 项开放用户待办,阻塞项优先:`,lines:t.userTodos.slice(0,3).map(e=>`${nw(e.goalId)} · ${e.blocking?`阻塞`:`待处理`} · ${e.text}`)};if(Aw(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 Mw(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=GC(e.usage_summary),s=ZC(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(cw(e,`user`)?.items??[]).map((r,i)=>({projectedDone:r.done,details:tf(r),actionKind:r.action_kind??null,blocking:n,goalId:e.goal_id,sourceOrder:t,taskClass:r.task_class??null,text:lw(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)||!Ew(t)?[]:[{details:tf({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:Dw(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=Ow(e,a),l=f.find(e=>e.goalId===t.id),u=l?.text??null,d=_w(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=gw(pw(a),h,a),b=[d.nextTodoText,a.queueItem?.recommended_action,a.latestRun?.recommended_action,kw(e,a,c,n)].map(e=>bC(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:kw(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:bw(e,a,n),state:c,...r?{subagentExecution:{allowedDomains:t.spawn_policy?.allowed_domains??[],domainCandidates:mw(e,a,y),enabled:t.spawn_policy?.mode===`multi_subagent`&&t.spawn_policy.spawn_allowed===!0&&t.spawn_policy.max_children>0,executionConfig:t.spawn_policy?.execution_config,maxChildren:t.spawn_policy?.max_children??0,modelConfig:t.spawn_policy?.model_config}}:{},title:nw(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:KC(e.input_tokens_24h,e.output_tokens_24h),tokens7d:KC(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?$d(e.current_todo.title,96):null,lastActivityAt:e.last_activity_at??null,state:e.state??null}))}}function Nw({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:_}=Ji(),[v,y]=(0,R.useState)([]),[b,x]=(0,R.useState)(!1),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),E=(0,R.useMemo)(()=>{let e=Mw(c,u,_,b);if(!l)return e;let t=Object.values(l.snapshots).map(e=>Mw(e,UC(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,_]),D=E.goals.find(e=>e.goalId===d)??null,O=l?.snapshots[d]??c,[k,A]=(0,R.useState)(null),[ee,j]=(0,R.useState)(null),[M,te]=(0,R.useState)(!1),ne=E.goals.some(e=>e.activationState===`active`&&e.loadState===`loading`)?`loading`:E.goals.map(e=>`${e.goalId}:${e.agentId}`).join(`|`),N=D?.goalId??`manager`;E.goals.some(e=>e.activationState===`active`&&e.loadState)||(E.systemHealth?!E.systemHealth.ok:!c.ok)||E.openUserTodoCount>0&&`${E.openUserTodoCount}${E.blockingTodoCount}`;let P=v.length>0?v.map(e=>({agentId:e.agent_id,adapterKind:e.adapter_kind,available:e.available,capability:sw(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:sw(`codex`),label:`Codex`,statusLabel:`正在检测`}],re=[...P,{agentId:`status-only`,available:!0,capability:`不调用模型`,adapterKind:`status_projection`,interrupt:!1,label:`仅查状态`,resume:!0,statusLabel:`只读`,streaming:!1,toolCalls:!1,trustScope:`read_only`}],ie=P.find(e=>e.label===`Codex`&&e.available)?.agentId??P.find(e=>e.available)?.agentId??`status-only`,ae=w?.executor_endpoint?.trim()??``,F=ae?P.find(e=>e.agentId===ae)?.agentId:void 0,oe=e=>e===`manager`?F??ie:ie,[I,se]=(0,R.useState)(ew),L=Dh(re,I[N]??oe(N),ie),[ce,le]=(0,R.useState)(!1),[ue,de]=(0,R.useState)(!1),[fe,pe]=(0,R.useState)(`chat`),[me,he]=(0,R.useState)(``),[ge,_e]=(0,R.useState)({}),[ve,ye]=(0,R.useState)({}),[be,xe]=(0,R.useState)(null),[Se,Ce]=(0,R.useState)({}),[we,Te]=(0,R.useState)([]),[Ee,De]=(0,R.useState)(null),[Oe,ke]=(0,R.useState)({}),Ae=(0,R.useRef)(1),je=(0,R.useRef)(1),Me=(0,R.useRef)(new Map),Ne=(0,R.useRef)(new Set),Pe=(0,R.useRef)(new Map),Fe=(0,R.useRef)(new Map),Ie=(0,R.useRef)(new Set),Le=(0,R.useRef)(new Set),Re=(0,R.useRef)(null),B=(0,R.useRef)(null),ze=(0,R.useRef)(null),Be=(0,R.useRef)(null);(0,R.useRef)(null);let Ve=ge[N]??[];ve[N];let He=(e,t)=>e===`manager`?_(`header.manager`):t,Ue=D?E.userTodos.filter(e=>e.goalId===D.goalId):E.userTodos,We=D?.agentTodos??[];yw(We,D?.needsYou?3:4);let Ge=We.filter(e=>e.done).length,Ke=We.length>0?`${Ge}/${We.length}`:`暂无计划`;D&&({...E},Ue.filter(e=>e.blocking).length,Ue.length),(0,R.useEffect)(()=>{let e=bh(f.activeSource.statusUrl,window.location.href),t=e.source?wh(O,e.source):null;if(!D||!t?.indexUrl||!t.detailUrl){A(null),j(null),te(!1);return}let{detailUrl:n,indexUrl:r}=t,i=!1;return A(null),j(null),te(!0),Th(r,D.goalId).then(async e=>{let t=e.items[0]?.detail_ref;return t?Eh(n,t):null}).then(e=>{i||A(e)}).catch(e=>{i||j(Bp(e))}).finally(()=>{i||te(!1)}),()=>{i=!0}},[O,D?.goalId,f.activeSource.statusUrl]);let qe=Se[N]?.sessionId;(0,R.useEffect)(()=>{if(h||!qe)return;let e=!1,t,n=async()=>{try{let t=await cg(qe);if(e)return;let n=t.messages.filter(e=>e.origin===`manager_followup`);_e(e=>{let r=e[N]??[],i=new Set(r.map(e=>e.sourceMessageId)),a=n.filter(e=>!i.has(e.message_id)),o=new Map(n.map(e=>[e.message_id,e.return_delivery])),s=new Map(t.messages.filter(e=>e.role!==`user`&&e.origin!==`manager_followup`).map(e=>[e.turn_id,e])),c=new Map(t.messages.map(e=>[e.message_id,e.collaboration])),l=!1,u=r.map(e=>{let t=e.sourceMessageId?o.get(e.sourceMessageId):void 0,n=e.sourceTurnId?s.get(e.sourceTurnId):void 0,r=e.sourceMessageId?c.get(e.sourceMessageId):n?.collaboration;return JSON.stringify(t)===JSON.stringify(e.returnDelivery)&&JSON.stringify(r)===JSON.stringify(e.collaboration)?e:(l=!0,{...e,sourceMessageId:e.sourceMessageId??n?.message_id,returnDelivery:t,collaboration:r})});return!a.length&&!l?e:{...e,[N]:[...u,...a.map(e=>({id:Ae.current++,sourceMessageId:e.message_id,role:`assistant`,agentLabel:`协作回执`,sourceLabel:`协作回执`,text:rw(e.text),lines:[],returnDelivery:e.return_delivery}))]}})}catch{}finally{e||(t=setTimeout(n,3e3))}};return n(),()=>{e=!0,t&&clearTimeout(t)}},[h,qe,N,L.label]);function V(e,t){Ce(n=>{if(t===null){let t={...n};return delete t[e],t}return{...n,[e]:t}})}(0,R.useEffect)(()=>{if(h){y([]),x(!1),C(null),T(null);return}let e=!1;return ag().then(t=>{if(!e){y(t.adapters??[]);let e=t.manager?.runtime;T(t.manager?.channel_binding??null),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,R.useEffect)(()=>{try{window.localStorage.setItem($C,JSON.stringify(I))}catch{}},[I]),(0,R.useEffect)(()=>{if(h||!L.available)return;let e=N,t=`${e}:${L.agentId}`,n=D?`goal`:`manager`,r=D?`goal.${D.goalId}`:`manager`,i=!1,a=null,o=null;return(async()=>{try{let s=await dg({agentId:n===`manager`?void 0:L.agentId,channelId:r,goalId:D?.goalId});if(i||(_e(t=>(t[e]?.length??0)>0?t:{...t,[e]:s.messages.map(t=>({sourceMessageId:t.message_id,agentLabel:t.role===`user`?void 0:t.origin===`manager_followup`?`协作回执`:He(e,L.label),attachments:QC(t.attachments),id:Ae.current++,lines:[],role:t.role===`user`?`user`:`assistant`,returnDelivery:t.return_delivery,collaboration:t.collaboration,sourceLabel:t.role===`user`?void 0:t.role===`error`?`本地会话记录`:e===`manager`?`恢复的${_(`header.manager`)}会话`:`恢复的 ${L.label} 会话`,text:t.role===`user`?t.text:rw(t.text)}))}),L.agentId===`status-only`))return;let c=s.sessions[0];if(o=c?.session_id??null,c&&!c.resumable){Ne.current.add(t),V(e,{agentId:L.agentId,resumable:!1,sessionId:c.session_id,status:`resume_failed`});return}let l=n===`manager`?``:D?.goalId??``;if(n===`goal`&&!l)return;let u=await sg(l,n===`manager`?I[e]:L.agentId,`resume_latest`,n);if(i)return;n===`manager`&&u.session.manager_runtime&&C(u.session.manager_runtime),Me.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(V(e,{agentId:u.agent_id||L.agentId,resumable:!0,sessionId:u.session_id,status:f?`running`:`ready`,turnId:f||void 0}),Ne.current.delete(t),!f)return;let p=`${u.session_id}:${f}`;if(Le.current.has(p))return;Le.current.add(p),Pe.current.set(e,f),V(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`running`,turnId:f}),xe(e),a=new AbortController,Fe.current.set(e,a);let m=``,h=Je(e,{activity:[`正在恢复进行中的 Agent 回合`],agentLabel:He(e,L.label),lines:[],pending:!0,sourceLabel:e===`manager`?`恢复的${_(`header.manager`)}会话`:`恢复的 ${L.label} 会话`,text:``});try{let t=await Tg(u.session_id,f,{signal:a.signal,onDelta:t=>{m+=t,Ye(e,h,{text:m})},onActivity:t=>{_e(n=>({...n,[e]:(n[e]??[]).map(e=>e.id===h?{...e,activity:[...new Set([...e.activity??[],t])].slice(-6)}:e)}))}});if(i)return;Ye(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()||`${He(e,L.label)} 已完成分析。`});let n=E.goals.find(e=>e.goalId===d?.session.goal_id)??D??E.goals[0]??null;if(n&&t.response.proposals.length>0){let r=t.response.proposals.filter(Oh).map(e=>({goalId:n.goalId,id:je.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));r.length>0&&ye(t=>({...t,[e]:[...t[e]??[],...r]}))}}catch(t){if(i)return;Ye(e,h,{activity:[],lines:[],pending:!1,reconnect:t instanceof qh&&t.payload.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t instanceof Error?t.message:`无法恢复进行中的 Agent 回合。`})}finally{Le.current.delete(p),Pe.current.get(e)===f&&Pe.current.delete(e),V(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`ready`}),Fe.current.get(e)===a&&Fe.current.delete(e),i||xe(t=>t===e?null:t)}}catch(n){if(i)return;n instanceof qh&&n.payload.error_code===`resume_failed`&&(Ne.current.add(t),o&&V(e,{agentId:L.agentId,resumable:!1,sessionId:o,status:`resume_failed`}))}})(),()=>{i=!0,a?.abort()}},[N,E.goals[0]?.goalId,h,D?.goalId,L.agentId,L.available,L.label,I]),(0,R.useEffect)(()=>{if(h||D||E.goals.length===0||ne===`loading`)return;let e=!1;return Promise.all(E.goals.filter(e=>!e.loadState).map(async e=>{let t=await lg({agentId:e.agentId,channelId:`goal.${e.goalId}`,goalId:e.goalId});return{goalId:e.goalId,session:t.sessions[0]??null}})).then(t=>{e||Ce(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,ne,D?.goalId]),(0,R.useEffect)(()=>{if(De(null),h){Te([]),ke({});return}if(!D){Te([]),ke({});return}let e=!1,t=0,n=0;Te([]),ke({});let r=async()=>{if(!e){if(document.hidden){t=window.setTimeout(()=>void r(),1e4);return}try{let t=await lg({goalId:D.goalId});if(!e){let r=t.sessions.filter(e=>e.channel_id?.startsWith(`task.`));Te(r);let i=await Promise.allSettled(r.map(e=>cg(e.session_id)));if(!e){let e=i.some(e=>e.status===`rejected`);n=e?n+1:0,De(e?`partial`:null),ke(Object.fromEntries(i.flatMap((e,t)=>e.status===`fulfilled`?[[r[t].session_id,e.value]]:[])))}}}catch{n+=1,e||De(`offline`)}e||(t=window.setTimeout(()=>void r(),Math.min(3e4,2e3*2**Math.min(n,4))))}};return r(),()=>{e=!0,window.clearTimeout(t)}},[h,D?.goalId]),(0,R.useEffect)(()=>{if(!ce)return;let e=window.requestAnimationFrame(()=>{Re.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()});return()=>{window.cancelAnimationFrame(e),B.current?.focus()}},[ce]),(0,R.useEffect)(()=>{if(!ue)return;let e=window.requestAnimationFrame(()=>ze.current?.focus());return()=>{window.cancelAnimationFrame(e),Be.current?.focus()}},[ue]),(0,R.useEffect)(()=>{if(!ce&&!ue)return;let e=e=>{e.key===`Escape`&&(le(!1),de(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ce,ue]);function Je(e,t){let n=Ae.current++;return _e(r=>({...r,[e]:[...r[e]??[],{...t,id:n,role:`assistant`}]})),n}function Ye(e,t,n){_e(r=>({...r,[e]:(r[e]??[]).map(e=>e.id===t?{...e,...n}:e)}))}async function Xe(e,t){let n=`${e}:${t}`,r=Me.current.get(n);if(r)return r;let i=await sg(e,t,Ne.current.has(n)?`new`:`resume_latest`,`goal`);return Me.current.set(n,i.session_id),Ne.current.delete(n),V(e,{agentId:t,resumable:!0,sessionId:i.session_id,status:i.session.status}),i.session_id}async function Ze(e,t){let n=e.trim();if(!n)return;let r=t&&`goalId`in t?t.goalId??`manager`:N,i=r===`manager`?null:E.goals.find(e=>e.goalId===r)??null,a=t?.agentId?Dh(re,t.agentId,ie):L,o=r===`manager`?E:i?{...E,blockingTodoCount:E.userTodos.filter(e=>e.goalId===i.goalId&&e.blocking).length,goals:[i],openUserTodoCount:E.userTodos.filter(e=>e.goalId===i.goalId).length,userTodos:E.userTodos.filter(e=>e.goalId===i.goalId),visibleUserTodos:E.userTodos.filter(e=>e.goalId===i.goalId)}:E,s=Ae.current++;if(_e(e=>({...e,[r]:[...e[r]??[],{attachments:t?.attachments,id:s,lines:[],role:`user`,text:n}]})),he(``),xe(r),a.agentId===`status-only`||!i&&r!==`manager`){let e=jw(O,o,n),t=a.agentId===`status-only`;Je(r,{agentLabel:t?`仅查状态`:`LoopX 管家`,lines:e.lines.slice(0,3),sourceLabel:t?`LoopX 状态投影 · 仅查状态`:`LoopX 状态投影`,text:e.text}),og({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(()=>{}),xe(null);return}let c=`${r}:${a.agentId}`,l=null;try{let e=r===`manager`?Me.current.get(c):await Xe(r,a.agentId);if(!e){let t=Ne.current.has(c)?`new`:`resume_latest`,n=r===`manager`?I[r]:a.agentId,o=await sg(r===`manager`?``:i.goalId,n,t,r===`manager`?`manager`:`goal`);r===`manager`&&o.session.manager_runtime&&C(o.session.manager_runtime),e=o.session_id,Me.current.set(c,e),V(r,{agentId:o.agent_id||a.agentId,resumable:!0,sessionId:e,status:`ready`}),Ne.current.delete(c)}let o=``;l=Je(r,{activity:[r===`manager`?`正在连接管家`:`正在连接 Agent`],agentLabel:He(r,a.label),lines:[],pending:!0,sourceLabel:r===`manager`?`${_(`header.manager`)} · 跨 Goal`:`${a.label} Agent · ${nw(i.goalId)}`,text:``});let s={attachments:t?.attachments,signal:(()=>{let e=new AbortController;return Fe.current.set(r,e),e.signal})(),onDelta:e=>{o+=e,l!==null&&Ye(r,l,{text:o})},onActivity:e=>{l!==null&&_e(t=>({...t,[r]:(t[r]??[]).map(t=>t.id===l?{...t,activity:[...new Set([...t.activity??[],e])].slice(-6)}:t)}))},onPhase:(t,n)=>{l!==null&&Ye(r,l,{sourceTurnId:n}),Pe.current.set(r,n),V(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`running`,turnId:n})}},u;if(t?.loopxMode){let n=await xg(e,t.loopxMode.operation,t.loopxMode.settings);if(!n.turn_id)throw Error(`LoopX execution returned no turn identity`);s.onPhase(`turn.accepted`,n.turn_id),u=await Tg(e,n.turn_id,s)}else u=await Cg(e,n,s);let d=u.response;Ye(r,l,{lines:d.gate?[d.gate.summary,d.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:rw(d.message||o.trim())||`${He(r,a.label)} 已完成分析。`});let f=d.proposals.filter(Oh);if(f.length>0&&!i&&Ye(r,l,{lines:[`请进入要修改的 Goal,预览并确认具体变更。`]}),f.length>0&&i){let e=f.map(e=>({goalId:i.goalId,id:je.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));ye(t=>({...t,[r]:[...t[r]??[],...e]}))}if(r!==`manager`&&d.protected_action){let e=zC(r,n,d.protected_action);if(e)return e}}catch(e){if(Ie.current.delete(r)||t?.loopxMode&&e instanceof qh&&e.payload.error_code===`turn_interrupted`){let e={agentLabel:He(r,a.label),lines:[],pending:!1,sourceLabel:r===`manager`?`${_(`header.manager`)}会话`:`${a.label} 会话`,text:`已中断。你可以在当前会话继续发送消息。`};l===null?Je(r,e):Ye(r,l,e);return}let n=e instanceof qh?e.payload:null;n&&Ah(n)&&Me.current.delete(c),n?.error_code===`resume_failed`&&(Me.current.delete(c),Ne.current.add(c),V(r,{agentId:a.agentId,resumable:!1,sessionId:Se[r]?.sessionId??`resume-failed`,status:`resume_failed`}));let i=n?.gate,o=i&&typeof i==`object`?String(i.summary??``):``,s={agentLabel:He(r,a.label),lines:o?[o]:[],pending:!1,reconnect:n?.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:n?.error_code===`resume_failed`?`原 ${He(r,a.label)} 会话无法恢复。本地历史已经保留,请在运行详情里选择“重试恢复”或“开始新 Session”。`:e instanceof Error?e.message:`${He(r,a.label)} 会话暂时不可用。`};l===null?Je(r,s):Ye(r,l,s)}finally{Pe.current.delete(r),Fe.current.delete(r);let e=Me.current.get(c);e&&V(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),xe(e=>e===r?null:e)}}async function Qe(e){let t=e?.goalId??N,n=Se[t],r=e?.agentId??n?.agentId??L.agentId,i=`${t}:${r}`,a=e?.sessionId??n?.sessionId??Me.current.get(i),o=e?.turnId??n?.turnId??Pe.current.get(t);if(!(!a||!o))try{Ie.current.add(t),await hg(a,o),Fe.current.get(t)?.abort()}catch(e){throw Ie.current.delete(t),e}finally{Pe.current.delete(t),V(t,{agentId:r,resumable:!0,sessionId:a,status:`ready`}),Fe.current.delete(t),xe(e=>e===t?null:e)}}async function $e(e){let t=e.goalId,n=`${t}:${e.agentId}`,r=e.sessionId??Se[t]?.sessionId??Me.current.get(n);if(r)try{let i=await Dg(r);Me.current.set(n,r),Ne.current.delete(n),V(t,{agentId:e.agentId,resumable:i.session.resumable,sessionId:r,status:i.session.status})}catch{V(t,{agentId:e.agentId,resumable:!1,sessionId:r,status:`resume_failed`})}}function et(e){let t=`${e.goalId}:${e.agentId}`;Me.current.delete(t),Ne.current.add(t),V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:`new-session-pending`,status:`ready`})}async function tt(e){let t=`${e.goalId}:${e.agentId}`,n=e.sessionId??Se[e.goalId]?.sessionId??Me.current.get(t);n&&n!==`new-session-pending`&&await Eg(n),Me.current.delete(t),Ne.current.add(t),V(e.goalId,null)}function nt(e){re.some(t=>t.agentId===e&&t.available)&&(se(t=>({...t,[N]:e})),le(!1))}function rt(){i(``),pe(`chat`)}function it(e){i(e),pe(`chat`)}D&&tw[D.state],D&&(`${L.label}${D.state}`,We.length>0&&`${Ke}`,Ue.length>0&&`${Ue.length}`),D?.state===`需修复`||!D&&!c.ok?(D&&ow(D.agentId),D?.nextSentence,D?.agentSentence):D?.state===`等你`?(D.needsYouBlocking,D.needsYouBlocking,D.needsYou??D.nextSentence,D.needsYou):(D&&ow(D.agentId),D?.nextSentence);let at=[...!D&&Se.manager?.status===`resume_failed`?[{id:`run:manager:resume-failed`,kind:`run`,run:{agentId:Se.manager.agentId,agentLabel:ow(Se.manager.agentId),canInterrupt:!1,completedSteps:0,goalId:`manager`,goalTitle:`LoopX 管家`,latestActivity:`本地聊天记录已保留,点我查看恢复方式。`,resumable:!1,runId:`manager:resume-failed`,sessionId:Se.manager.sessionId,sessionStatus:`resume_failed`,status:`failed`,title:`上次会话需要恢复`,totalSteps:1,outputs:[]}}]:[],...D?we.map(e=>{let t=e.channel_id?.startsWith(`task.`)?e.channel_id.slice(5):void 0,n=D.agentTodos.find(e=>e.todoId===t),r=!!e.active_turn_id,i=Oe[e.session_id],a=i?.messages.some(e=>iw(e.role,e.text))===!0;return{id:`run:task:${e.session_id}`,kind:`run`,run:{agentId:e.agent_id,agentLabel:ow(e.agent_id),canInterrupt:r,completedSteps:n?.done||a?1:0,goalId:D.goalId,goalTitle:D.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`:iw(e.role,e.text)?`assistant`:`error`,text:e.role===`user`?e.text:rw(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}}}):[],...D&&(Se[D.goalId]?.turnId||D.runEvidence||qd(D))?[{id:`run:${D.goalId}`,kind:`run`,run:{agentId:Se[D.goalId]?.agentId??D.agentId,agentLabel:ow(Se[D.goalId]?.agentId??D.agentId),canInterrupt:!!Se[D.goalId]?.turnId,completedSteps:D.agentTodos.filter(e=>e.done).length,goalId:D.goalId,goalTitle:D.title,latestActivity:D.agentSentence,resumable:Se[D.goalId]?.resumable??!0,runId:`goal:${D.goalId}`,sessionId:Se[D.goalId]?.sessionId,sessionStatus:Se[D.goalId]?.status,status:Se[D.goalId]?.turnId?`running`:D.state===`需修复`?`failed`:`waiting`,title:D.nextSentence,totalSteps:D.agentTodos.length||1,turnId:Se[D.goalId]?.turnId,outputs:D.runEvidence?[{createdAt:D.runEvidence.generatedAt,kind:`evidence`,outputId:`${D.goalId}:latest-evidence`,title:D.runEvidence.label}]:[]}}]:[],...Ve.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,collaboration:e.collaboration,role:e.role,text:e.text||(e.pending?`Agent 正在处理…`:e.lines.join(` -`))}})),...(D?[D]:E.goals).flatMap(e=>e.runEvidence?[{id:`output:${e.goalId}:${e.runEvidence.generatedAt||`latest`}`,kind:`output`,output:{agentLabel:ow(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}}]:[]),...D&&k?[{id:`output:${D.goalId}:report:${k.publication.publication_id}`,kind:`output`,output:{agentId:k.agent_id,agentLabel:ow(k.agent_id),createdAt:k.publication.delivered_at,goalId:D.goalId,goalTitle:D.title,kind:`report`,outputId:k.publication.publication_id,report:{addedCount:k.delta.added_count,changedCount:k.delta.changed_count,deliveredAt:k.publication.delivered_at,generationId:k.generation_id,items:k.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:k.period_window.end_at,periodStartAt:k.period_window.start_at,predecessorPublicationId:k.publication.predecessor_publication_id,publicationId:k.publication.publication_id},safePreview:k.delta.items.map(e=>`${e.change_kind===`added`?`+`:`~`} ${e.title}\n${e.summary}`).join(` +`):``})]});let c=t.input_kind===`number`;return(0,z.jsxs)(`label`,{htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.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 cS({copy:e={},disabled:t=!1,editor:n,enabledAction:r,omitKeys:i=[],onChange:a,value:o}){let s=(0,R.useId)(),c=new Set(i);return(0,z.jsx)(`fieldset`,{className:`personal-capability-fields`,disabled:t,children:n.fields.filter(e=>!c.has(e.key)).map(t=>{let n=(0,z.jsx)(sS,{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,z.jsxs)(`div`,{className:`personal-capability-enabled-row`,children:[n,r]},t.key):n})})}var lS={en:{manager_runtime:{displayName:`Manager runtime`,description:`Selects the persistent host-tool profile used by owner manager conversations.`},steward_executor:{displayName:`Steward executor`,description:`Guides the steward executor, model, and selection boundary for this machine. A pinned route blocks substitution; a flexible pool permits only authorized fallback.`},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.`},progress_review:{displayName:`Progress-review sentinel`,description:`Records typed drift receipts from an external bounded review of scoped file deltas; assist may raise the existing autonomous replan obligation.`},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.`},coordination_runtime_shadow:{displayName:`Coordination runtime shadow`,description:`Captures transaction-bound Todo and task-lease mutations for reviewed whole-Goal coordination-authority promotion.`},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:`选择管家会话持续生效的宿主工具模式。`},steward_executor:{displayName:`管家执行器`,description:`配置本机管家的执行器、模型与选择边界;锁定路径禁止替代,灵活池只允许在已授权范围内回退。`},todo_replan_cadence:{displayName:`Goal 复核周期`,description:`配置 Goal 的复核周期。`},change_quality_qualification:{displayName:`变更质量验证`,description:`生成与 Provider 无关的审阅包,最多允许一次策略授权的安全修复,并可要求精确 diff 回执。`},progress_review:{displayName:`进展评估哨兵`,description:`记录外部有界评估对限定文件变化给出的类型化漂移回执;assist 模式可触发已有的自主重规划义务。`},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 状态,但不取得写入权。`},coordination_runtime_shadow:{displayName:`协调 Runtime 影子`,description:`捕获事务绑定的 Todo 与 task lease 变更,为经评审的整 Goal 协调 Authority 晋级提供证据。`},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 绑定。`}}},uS={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.`},selection_policy:{label:`Selection policy`,description:`Preferred allows an explicit user choice; pinned rejects another executor; flexible permits fallback only inside the eligible pool.`},executor_endpoint:{label:`Primary steward executor`,description:`The preferred or pinned executor for this machine. In a flexible pool it is tried first when available.`},eligible_endpoints:{label:`Flexible eligible executors`,description:`One authorized executor per line. Use only with flexible selection and include the primary executor.`},executor_model:{label:`Model`,description:`Optional model for the selected executor. Leave blank to keep the executor's own default.`},executor_reasoning_effort:{label:`Reasoning effort`,description:`Optional reasoning effort for the selected executor. Leave blank to keep the executor's own default.`},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.`},wait_for_ci:{label:`Wait for CI`,description:`Disable to use local validation without querying or waiting for CI. Merge authority is unchanged.`},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 开放常规宿主工具,但受保护操作仍单独校验。`},selection_policy:{label:`选择策略`,description:`preferred 允许用户显式改选;pinned 拒绝其他执行器;flexible 只在已授权资源池内回退。`},executor_endpoint:{label:`首选管家执行器`,description:`本机首选或锁定的执行器;灵活池模式下优先尝试它。`},eligible_endpoints:{label:`灵活池可用执行器`,description:`每行一个已授权执行器,仅用于 flexible;必须包含首选执行器。`},executor_model:{label:`模型`,description:`所选执行器使用的模型,可留空;留空表示沿用执行器自身的默认模型。`},executor_reasoning_effort:{label:`推理档位`,description:`所选执行器使用的推理档位,可留空;留空表示沿用执行器自身的默认档位。`},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。`},wait_for_ci:{label:`等待 CI`,description:`关闭后使用本地验证,不查询或等待 CI;不改变合并权限。`},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 dS(e,t){let n=lS[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 fS(e){return uS[e]}Object.freeze(Object.keys(lS.en).sort());function pS(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 mS({values:e,t}){return(0,z.jsxs)(`details`,{className:`personal-capability-raw-values`,children:[(0,z.jsx)(`summary`,{children:t(`capabilities.rawJson`)}),(0,z.jsx)(`div`,{className:`personal-capability-value-grid`,children:e.map(({label:e,value:t})=>(0,z.jsxs)(`section`,{children:[(0,z.jsx)(`strong`,{children:e}),(0,z.jsx)(`pre`,{children:t?JSON.stringify(t,null,2):`—`})]},e))})]})}function hS({source:e,t}){return e?(0,z.jsxs)(`p`,{className:`personal-capability-effective-source`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:15}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:t(`capabilities.effectiveSource`)}),t(`capabilities.source.${e}`)]})]}):null}function gS({available:e,description:t,t:n}){return e?null:(0,z.jsxs)(`section`,{className:`personal-capability-editor-status is-read-only`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:n(`capabilities.readOnly`)}),(0,z.jsx)(`p`,{children:t})]})]})}function _S(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 vS(e,t){return[...e].sort((e,n)=>{let r=_S(e)-_S(n);if(r!==0)return r;let i=dS(e,t),a=dS(n,t);return i.display_name.localeCompare(a.display_name,t)||e.capability_id.localeCompare(n.capability_id)})}function yS({capabilities:e,locale:t,onSelect:n,scope:r,selectedCapabilityId:i,t:a}){return(0,z.jsx)(`nav`,{"aria-label":a(r===`goal`?`capabilities.catalog`:`machine.capabilityCatalog`),className:`personal-capability-list`,tabIndex:0,children:vS(e,t).map(e=>{let o=dS(e,t);return(0,z.jsxs)(`button`,{"aria-current":i===o.capability_id?`page`:void 0,onClick:()=>n(o.capability_id),type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:o.display_name})}),(0,z.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 bS({capability:e,locale:t,source:n}){let{t:r}=Ji(),i=dS(e,t);return(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`span`,{className:`personal-settings-icon`,children:(0,z.jsx)(sh,{"aria-hidden":!0,size:18})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`personal-capability-heading-row`,children:[(0,z.jsx)(`h2`,{children:i.display_name}),(0,z.jsx)(hS,{source:n,t:r})]}),e.context_contribution&&(0,z.jsxs)(`details`,{className:`personal-capability-help`,"data-testid":`capability-context-phases`,children:[(0,z.jsx)(`summary`,{children:t===`zh-CN`?`主 Agent 协作指导`:`Coordinator workflow guidance`}),(0,z.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,z.jsx)(`dl`,{children:e.context_contribution.supported_phases.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:(0,z.jsx)(`code`,{children:e})}),(0,z.jsx)(`dd`,{children:xS[e][t===`zh-CN`?`zh`:`en`]})]},e))}),(0,z.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,z.jsxs)(`details`,{className:`personal-capability-help`,children:[(0,z.jsx)(`summary`,{children:t===`zh-CN`?`配置说明`:`Configuration help`}),(0,z.jsx)(`p`,{children:i.description}),(0,z.jsx)(`dl`,{children:e.configuration_editor.fields.map(e=>{let n=fS(t)[e.key],r=n?.description??e.description;return r?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n?.label??e.label}),(0,z.jsx)(`dd`,{children:r})]},e.key):null})})]},e.capability_id)]})]})}var xS={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 SS({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null);async function l(n){if(e.onToggleGoalAutoNotify){o(!0),c(null);try{let a=await e.onToggleGoalAutoNotify({autoNotify:n,goalId:t});if(!a.ok){c(a.public_summary??a.blocker??i(`notifications.setupFailed`));return}r()}catch(e){c(e instanceof Error?e.message:i(`notifications.setupFailed`))}finally{o(!1)}}}return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{className:`personal-notification-toggle`,children:[(0,z.jsx)(`input`,{checked:n?.humanGateAutoNotifyEnabled??!1,disabled:a||n?.configured!==!0||!e.onToggleGoalAutoNotify,onChange:e=>void l(e.target.checked),type:`checkbox`}),(0,z.jsx)(`span`,{children:i(`notifications.autoNotify`)}),a?(0,z.jsx)(zm,{"aria-hidden":!0,className:`is-spinning`,size:14}):null]}),s?(0,z.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:s}):null]})}function CS({goalId:e,onApplied:t,selected:n,t:r}){let[i,a]=(0,R.useState)({busy:null,draft:{},partialWrite:null,preview:null}),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(`guided`),[u,d]=(0,R.useState)(``),f=(0,R.useMemo)(()=>n?iS(n.configuration_editor,u):null,[n,u]),p=c===`guided`||f!==null;(0,R.useEffect)(()=>{l(`guided`),d(``),a({busy:null,draft:rS(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 o_(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=rS(n.configuration_editor,i.draft,n.default),o=await s_(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`?aS(r.draft,e,t):{...r.draft,[e]:t},preview:null})),s(null)}function _(e){if(!n||i.busy)return;d(e);let t=iS(n.configuration_editor,e);a(e=>({...e,preview:null,draft:t?rS(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 wS({mutationError:e,onApplied:t,partialWrite:n,preview:r}){let{t:i}=Ji();return(0,z.jsxs)(z.Fragment,{children:[e?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:e}):null,n?(0,z.jsxs)(`section`,{"aria-live":`polite`,className:`personal-capability-recovery`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:i(n.host_capacity_pending?`capabilities.hostCapacityPartialWrite`:`capabilities.partialWrite`)}),(0,z.jsx)(`p`,{children:i(n.host_capacity_pending?`capabilities.hostCapacityPartialWriteDescription`:`capabilities.partialWriteDescription`)}),(0,z.jsx)(`small`,{children:n.recommended_action})]}),(0,z.jsxs)(`button`,{onClick:t,type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":!0,size:15}),i(`capabilities.refreshSource`)]})]}):null,r?(0,z.jsxs)(`section`,{className:`personal-capability-preview`,"aria-label":i(`capabilities.preview`),children:[(0,z.jsx)(`strong`,{children:i(`capabilities.preview`)}),(0,z.jsx)(`span`,{children:i(`machine.action.${r.action}`)}),r.codex_host_capacity?(0,z.jsx)(`span`,{children:i(r.codex_host_capacity.write_required?`drawer.subagentHostCapacityRaise`:`drawer.subagentHostCapacityReady`,{configured:r.codex_host_capacity.configured_children??i(`drawer.subagentHostCapacityImplicit`),required:r.codex_host_capacity.required_children})}):null,(0,z.jsx)(`small`,{children:i(`capabilities.previewLocked`)})]}):null]})}function TS({callbacks:e,catalog:t,goalId:n,notification:r,onApplied:i,onNotificationChanged:a}){let{locale:o,t:s}=Ji(),c=(0,R.useMemo)(()=>vS(t.capabilities,o),[t.capabilities,o]),[l,u]=(0,R.useState)(()=>c[0]?.capability_id??``),d=(0,R.useMemo)(()=>c.find(e=>e.capability_id===l)??c[0],[c,l]),f=(0,R.useMemo)(()=>d?dS(d,o):void 0,[o,d]),{apply:p,changeDraft:m,changeJson:h,changeMode:g,editorMode:_,jsonDraft:v,jsonValid:y,error:b,mutation:x,preview:S}=CS({goalId:n,onApplied:i,selected:f,t:s}),{busy:C,draft:w,partialWrite:T,preview:E}=x;if(!d||!f)return(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:s(`capabilities.empty`)});let D=f.available_scopes.includes(`goal`),O=pS(f,`goal`),k=f.configuration_editor.read_only_reason??s(D?`capabilities.previewOnly`:`capabilities.machineOnly`);async function A(){if(!f||!O||C||!y)return;let e=rS(f.configuration_editor,w,f.default);await S(e)}async function ee(){!O||C||await S(null)}return(0,z.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,z.jsx)(yS,{capabilities:t.capabilities,locale:o,onSelect:u,scope:`goal`,selectedCapabilityId:f.capability_id,t:s}),(0,z.jsxs)(`article`,{"aria-label":f.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,z.jsx)(bS,{capability:d,locale:o,source:f.effective_configuration?.source}),(0,z.jsx)(gS,{available:O,t:s,description:k}),f.capability_id===`lark_event_inbox`?(0,z.jsxs)(`section`,{className:`personal-capability-linked-setting`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:s(`capabilities.larkInboxNotificationSetting`)}),(0,z.jsx)(`p`,{children:s(`capabilities.larkInboxNotificationDescription`)})]}),(0,z.jsx)(SS,{callbacks:e,goalId:n,notification:r,onChanged:a})]}):null,O?(0,z.jsxs)(z.Fragment,{children:[_===`json`||!f.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,z.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,z.jsxs)(`button`,{disabled:!!C||!y,onClick:g,type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),s(_===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,_===`guided`?(0,z.jsx)(`section`,{className:`personal-capability-field-summary`,children:(0,z.jsx)(cS,{disabled:!!C,copy:fS(o),editor:f.configuration_editor,onChange:m,value:w,enabledAction:(0,z.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:g,type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),s(`machine.editJson`)]})})}):(0,z.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`goal-configuration-json`,children:[(0,z.jsx)(`span`,{children:s(`capabilities.jsonConfiguration`)}),(0,z.jsx)(`textarea`,{id:`goal-configuration-json`,"aria-describedby":`goal-configuration-json-help`,disabled:!!C,onChange:e=>h(e.target.value),rows:12,spellCheck:!1,value:v}),(0,z.jsx)(`small`,{id:`goal-configuration-json-help`,children:s(`capabilities.jsonHelp`)}),y?null:(0,z.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:s(`capabilities.jsonInvalid`)})]})]}):null,(0,z.jsx)(wS,{mutationError:b,onApplied:i,partialWrite:T,preview:E}),O?(0,z.jsxs)(`footer`,{className:`personal-capability-actions`,children:[f.current&&f.available_scopes.includes(`machine`)?(0,z.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void ee(),type:`button`,children:s(`capabilities.restoreInheritance`)}):null,(0,z.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void A(),type:`button`,children:s(C===`preview`?`common.loading`:`capabilities.previewChanges`)}),(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!C||!E||!y,onClick:()=>void p(),type:`button`,children:s(C===`apply`?`common.loading`:`capabilities.applyPreview`)})]}):null,(0,z.jsx)(mS,{values:[{label:s(`capabilities.goalValue`),value:f.current},{label:s(f.machine_current?`capabilities.machineValue`:`capabilities.defaultValue`),value:f.machine_current??f.default}],t:s},d.capability_id)]})]})}function ES({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1);function d(){t&&(u(!0),c(null),a_(t).then(o).catch(e=>c(e instanceof Error?e.message:i(`capabilities.loadFailed`))).finally(()=>u(!1)))}return(0,R.useEffect)(d,[t]),t?l&&!a?(0,z.jsxs)(`p`,{"aria-live":`polite`,className:`personal-capability-empty`,children:[(0,z.jsx)(zm,{className:`personal-spin`,size:18}),i(`capabilities.loading`)]}):s?(0,z.jsxs)(`section`,{className:`personal-capability-error`,role:`alert`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:i(`capabilities.loadFailed`)}),(0,z.jsx)(`small`,{children:s})]}),(0,z.jsxs)(`button`,{onClick:d,type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":!0,size:15}),i(`capabilities.retry`)]})]}):a?(0,z.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":a.revision,children:[(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),i(`capabilities.atomicOverride`)]}),(0,z.jsx)(`p`,{children:i(`capabilities.atomicOverrideDescription`)})]}),(0,z.jsx)(TS,{callbacks:e,catalog:a.capability_catalog,goalId:t,notification:n,onApplied:d,onNotificationChanged:r})]}):null:(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:i(`capabilities.chooseGoal`)})}function DS(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function OS(e,t){let n=t?.machine_namespace;return n?e?.machine_configuration?.namespaces[n]:void 0}function kS(e,t,n){let r={...DS(e.default),...DS(t),...n};return e.capability_id===`steward_executor`&&(Object.hasOwn(n,`selection_policy`)||Object.hasOwn(n,`eligible_endpoints`))&&(r.schema_version=DS(e.default).schema_version),r}function AS(e,t){for(let n of e.configuration_editor.fields){let e=t[n.key];if(n.required&&(e==null||e===``))return!1}if(e.capability_id===`periodic_report`&&t.enabled===!0)return!!(String(t.profile_preset??``).trim()&&String(t.route_ref??``).trim()&&String(t.timezone??``).trim());if(e.capability_id===`steward_executor`){let e=String(t.selection_policy??`preferred`),n=String(t.executor_endpoint??``),r=Array.isArray(t.eligible_endpoints)?t.eligible_endpoints.map(e=>String(e)):[];return e===`flexible`?r.length>0&&r.includes(n)&&new Set(r).size===r.length:r.length===0}return!0}function jS(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}catch{return null}}function MS(e){return e?e===`absent`?e:e.replace(/^sha256:/,``).slice(0,12):`—`}function NS(){let{locale:e,t}=Ji(),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)({}),[c,l]=(0,R.useState)(`{}`),[u,d]=(0,R.useState)(`guided`),[f,p]=(0,R.useState)(null),[m,h]=(0,R.useState)(`upsert`),[g,_]=(0,R.useState)(null),[v,y]=(0,R.useState)(null),[b,x]=(0,R.useState)(`load`),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),E=(0,R.useMemo)(()=>vS(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=>pS(e,`machine`))??E[0],k=O?dS(O,e):void 0,A=OS(n,k),ee=!!(k?.machine_namespace&&A),j=!!(k&&pS(k,`machine`)),M=(0,R.useMemo)(()=>jS(c),[c]),te=k?u===`json`?M:kS(k,A,o):null,ne=!!(k&&(u===`json`?M:AS(k,te??{})));async function N(){r(await i_())}(0,R.useEffect)(()=>{let e=!0;return i_().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,R.useEffect)(()=>{if(!k)return;let e=OS(n,k),t=rS(k.configuration_editor,e??k.default,k.default),r=kS(k,e,t);s(t),l(JSON.stringify(r,null,2)),d(j?`guided`:`json`),p(null),h(`upsert`),y(null)},[n,i,e]);function P(e,t){s(n=>k?.capability_id===`periodic_report`?aS(n,e,t):{...n,[e]:t}),p(null),h(`upsert`),C(null),T(null)}function re(e){if(k){if(e===`json`)l(JSON.stringify(kS(k,A,o),null,2));else if(M)s(rS(k.configuration_editor,M,k.default));else{C(t(`machine.jsonInvalid`));return}d(e),p(null),h(`upsert`),C(null)}}async function ie(){if(!(!j||!k?.machine_namespace||!te||!ne||b)){x(`preview`),C(null),T(null);try{h(`upsert`),p(await c_(k.machine_namespace,te))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function ae(){if(!(!j||!k?.machine_namespace||!ee||b)){x(`preview`),C(null),T(null);try{h(`remove`),p(await u_(k.machine_namespace))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function F(){if(!j||!k?.machine_namespace||!f||b||m===`upsert`&&!te)return;x(`apply`),C(null);let e=m;try{let n=e===`remove`?await d_(k.machine_namespace,f.plan_revision):await l_(k.machine_namespace,te,f.plan_revision);_(n),p(null),h(`upsert`),y(null),await N(),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 oe(){if(!(!g?.transaction_id||b)){x(`rollback-preview`),C(null);try{y(await f_(g.transaction_id))}catch(e){C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}async function I(){if(!(!g?.transaction_id||!v||b)){x(`rollback`),C(null);try{await p_(g.transaction_id,v.plan_revision),_(null),y(null),p(null),await N(),T(t(`machine.rolledBack`))}catch(e){y(null),C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}return b===`load`?(0,z.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:t(`common.loading`)}):k?(0,z.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n?.revision,children:[(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),t(`machine.liveDefault`)]}),(0,z.jsx)(`p`,{children:t(`machine.liveDefaultDescription`)})]}),(0,z.jsxs)(`div`,{className:`personal-capability-body`,children:[n?.status===`invalid`?(0,z.jsxs)(`section`,{className:`personal-machine-error`,"data-testid":`machine-invalid-repair`,role:`alert`,children:[(0,z.jsx)(`strong`,{children:t(`machine.invalidStoredConfiguration`)}),(0,z.jsx)(`p`,{children:t(`machine.invalidStoredConfigurationDescription`)})]}):null,(0,z.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,z.jsx)(yS,{capabilities:E,locale:e,onSelect:a,scope:`machine`,selectedCapabilityId:k.capability_id,t}),(0,z.jsxs)(`article`,{"aria-label":k.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,z.jsx)(bS,{capability:O,locale:e,source:k.available_scopes.includes(`machine`)?ee?`machine_default`:`capability_default`:void 0}),(0,z.jsx)(gS,{available:j,t,description:k.available_scopes.includes(`machine`)?t(`machine.editorUnavailableDescription`):t(`machine.goalOnly`)}),k.capability_id===`periodic_report`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:A?.schedule?e===`zh-CN`?`日历与阶段汇报`:`Calendar and stage reports`:t(`machine.periodicReportActivation`)}),(0,z.jsx)(`p`,{children:A?.schedule?A.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,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.changeQualityActivation`)}),(0,z.jsx)(`p`,{children:t(`machine.changeQualityActivationDescription`)})]})]}):null,k.capability_id===`todo_replan_cadence`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.replanCadenceActivation`)}),(0,z.jsx)(`p`,{children:t(`machine.replanCadenceActivationDescription`)})]})]}):null,k.capability_id===`pull_request_review`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e===`zh-CN`?`只改变队列排序`:`Queue ordering only`}),(0,z.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,j?(0,z.jsxs)(z.Fragment,{children:[u===`json`||!k.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,z.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,z.jsxs)(`button`,{onClick:()=>re(u===`guided`?`json`:`guided`),type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),t(u===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,u===`guided`?(0,z.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,z.jsx)(cS,{copy:fS(e),disabled:!!b,editor:k.configuration_editor,onChange:P,value:o,enabledAction:(0,z.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:()=>re(`json`),type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),t(`machine.editJson`)]})}),ne?null:(0,z.jsx)(`p`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.requiredFields`)})]}):(0,z.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`machine-configuration-json`,children:[(0,z.jsx)(`span`,{children:t(`machine.jsonConfiguration`)}),(0,z.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,z.jsx)(`small`,{id:`machine-configuration-json-help`,children:t(`machine.jsonConfigurationHelp`)}),M?null:(0,z.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.jsonInvalid`)})]})]}):null,S?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:S}):null,w?(0,z.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,z.jsx)(hm,{"aria-hidden":!0,size:16}),w]}):null,f?(0,z.jsxs)(`section`,{"aria-label":t(`machine.preview`),className:`personal-machine-preview`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.preview`)}),(0,z.jsx)(`span`,{children:t(`machine.action.${f.action}`)})]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.currentRevision`)}),(0,z.jsx)(`dd`,{title:f.current_revision,children:MS(f.current_revision)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.desiredRevision`)}),(0,z.jsx)(`dd`,{title:f.desired_revision,children:MS(f.desired_revision)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.changedNamespaces`)}),(0,z.jsx)(`dd`,{children:f.changed_namespaces.join(`, `)||t(`common.none`)})]})]}),(0,z.jsx)(`p`,{children:t(`machine.previewLocked`)})]}):null,g?.rollback_available&&g.transaction_id?(0,z.jsxs)(`section`,{className:`personal-machine-rollback`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.rollbackAvailable`)}),(0,z.jsx)(`p`,{children:t(v?`machine.rollbackPreviewDescription`:`machine.rollbackDescription`)})]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!!b||!!(v&&!v.rollback_allowed),onClick:()=>void(v?I():oe()),type:`button`,children:[(0,z.jsx)($m,{"aria-hidden":!0,size:15}),t(b===`rollback`||b===`rollback-preview`?`common.loading`:v?`machine.confirmRollback`:`machine.previewRollback`)]})]}):null,j?(0,z.jsxs)(`footer`,{className:`personal-capability-actions`,children:[ee?(0,z.jsxs)(`button`,{className:`is-danger`,disabled:!!b,onClick:()=>void ae(),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),t(`machine.previewRemoval`)]}):null,(0,z.jsx)(`button`,{disabled:!!b||!ne,onClick:()=>void ie(),type:`button`,children:t(b===`preview`?`common.loading`:`machine.previewChanges`)}),(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!b||!f,onClick:()=>void F(),type:`button`,children:t(b===`apply`?`common.loading`:`machine.applyPreview`)})]}):null,k.available_scopes.includes(`machine`)?(0,z.jsx)(mS,{values:[{label:t(`machine.currentValue`),value:A},{label:t(`capabilities.defaultValue`),value:k.default}],t},k.capability_id):null]})]})]})]}):(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:t(`machine.capabilityEmpty`)})}function PS(e,t){return t(e===`invalid`?`machine.credentialInvalid`:e===`configured`?`machine.credentialConfigured`:`machine.credentialAbsent`)}function FS(e,t){return t(e===`machine_store`?`machine.credentialSourceMachine`:e===`service_environment`?`machine.credentialSourceEnvironment`:`machine.credentialSourceUnset`)}function IS(){let{t:e}=Ji(),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(null),p=(0,R.useCallback)(async()=>{c(`load`);try{let e=await n_();n(e),o(String(e.base_url.value??``))}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}},[e]);(0,R.useEffect)(()=>{p()},[p]);async function m(t,r){c(`store`),u(null),f(null);try{let e=await r_(t);n(e),o(String(e.base_url.value??``)),i(``),f(r)}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}}if(!t&&s===`load`)return(0,z.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:e(`common.loading`)});let h=t?`${PS(t.provider_key.configured?`configured`:`absent`,e)} · ${FS(t.provider_key.source,e)}`:``,g=t?`${t.base_url.value??e(`machine.credentialAbsent`)} · ${FS(t.base_url.source,e)}`:``;return(0,z.jsxs)(`section`,{className:`personal-operator-credential`,"data-testid":`operator-credential-settings`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(Fm,{"aria-hidden":!0,size:17}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e(`machine.credentialTitle`)}),(0,z.jsx)(`p`,{children:e(`machine.credentialDescription`)})]}),(0,z.jsx)(`span`,{className:`personal-operator-credential-status`,children:t?PS(t.status,e):e(`common.loading`)})]}),t?(0,z.jsxs)(`dl`,{className:`personal-operator-credential-readback`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialApiKey`)}),(0,z.jsx)(`dd`,{children:h})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialFingerprint`)}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.provider_key.fingerprint??e(`common.none`)})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialBaseUrl`)}),(0,z.jsx)(`dd`,{children:g})]})]}):null,t?.status===`invalid`&&t.repair?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:t.repair}):null,(0,z.jsxs)(`label`,{htmlFor:`operator-credential-api-key`,children:[(0,z.jsx)(`span`,{children:e(`machine.credentialApiKey`)}),(0,z.jsx)(`input`,{autoComplete:`off`,disabled:!!s,id:`operator-credential-api-key`,onChange:e=>i(e.target.value),placeholder:e(`machine.credentialApiKeyPlaceholder`),type:`password`,value:r})]}),(0,z.jsxs)(`label`,{htmlFor:`operator-credential-base-url`,children:[(0,z.jsx)(`span`,{children:e(`machine.credentialBaseUrl`)}),(0,z.jsx)(`input`,{autoComplete:`off`,disabled:!!s,id:`operator-credential-base-url`,onChange:e=>o(e.target.value),placeholder:e(`machine.credentialBaseUrlPlaceholder`),type:`text`,value:a})]}),l?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:l}):null,d?(0,z.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,z.jsx)(hm,{"aria-hidden":!0,size:16}),d]}):null,(0,z.jsxs)(`footer`,{className:`personal-operator-credential-actions`,children:[(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!s||!r.trim()&&!a.trim(),onClick:()=>void m({...r.trim()?{provider_key:r}:{},...a.trim()?{base_url:a}:{}},e(`machine.credentialStored`)),type:`button`,children:e(s===`store`?`common.loading`:`machine.credentialStore`)}),(0,z.jsxs)(`button`,{disabled:!!s||t?.provider_key.configured!==!0,onClick:()=>void m({clear_provider_key:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearKey`)]}),(0,z.jsxs)(`button`,{disabled:!!s||t?.base_url.configured!==!0,onClick:()=>void m({clear_base_url:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearUrl`)]})]}),(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),e(`machine.credentialTitle`)]}),(0,z.jsx)(`p`,{children:e(`machine.credentialBoundary`)})]})]})}var LS={appearance:Km,capabilities:sh,language:Im,lark:ah,machine:rh,provider:Fm};function RS({callbacks:e,focusGoalConnection:t=!1,goals:n,initialGoalId:r,initialTab:i=`lark`,goalNotifications:a,onChanged:o,onClose:s,onThemeChange:c,theme:l}){let{locale:u,setLocale:d,t:f}=Ji(),[p,m]=(0,R.useState)(i),h=(0,R.useRef)(null);(0,R.useEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{if(e.scrollWidth<=e.clientWidth)return;let t=e.querySelector(`[aria-current="page"]`);if(!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=r.leftn.right?r.right-n.right:0;i&&(e.scrollLeft+=i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[p]);let g=[...r?[{key:`capabilities`,label:f(`capabilities.title`)}]:[],{key:`provider`,label:f(`settings.modelProvider`)},{key:`machine`,label:f(`settings.globalCapabilities`)},{key:`lark`,label:`Lark`},{key:`appearance`,label:f(`settings.appearance`)},{key:`language`,label:f(`settings.language`)}],_=[{label:f(`settings.languageEnglish`),value:`en`},{label:f(`settings.languageSimplifiedChinese`),value:`zh-CN`}],v={appearance:{title:f(`settings.appearance`)},capabilities:{title:f(`capabilities.title`)},language:{title:f(`settings.language`)},lark:{title:`Lark`},machine:{title:f(`settings.globalCapabilities`)},provider:{title:f(`settings.modelProvider`)}}[p];return(0,z.jsxs)(`section`,{"aria-label":f(`settings.title`),className:`personal-settings-page`,"data-pw-theme":l,children:[(0,z.jsxs)(`aside`,{className:`personal-settings-sidebar`,children:[(0,z.jsxs)(`button`,{autoFocus:!0,className:`personal-settings-back`,onClick:s,type:`button`,children:[(0,z.jsx)(om,{size:17}),(0,z.jsx)(`span`,{children:f(`settings.back`)})]}),(0,z.jsx)(`div`,{className:`personal-settings-title`,children:(0,z.jsx)(`strong`,{children:f(`settings.title`)})}),(0,z.jsx)(`nav`,{"aria-label":f(`settings.categories`),className:`personal-settings-tabs`,ref:h,children:g.map(e=>{let t=LS[e.key];return(0,z.jsxs)(`button`,{"aria-current":p===e.key?`page`:void 0,onClick:()=>m(e.key),type:`button`,children:[(0,z.jsx)(t,{size:17}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:e.label})})]},e.key)})})]}),(0,z.jsxs)(`main`,{className:`personal-settings-body`,children:[(0,z.jsx)(`header`,{className:`personal-settings-header`,children:(0,z.jsx)(`div`,{children:(0,z.jsx)(`h1`,{children:v.title})})}),p===`lark`?(0,z.jsx)(tS,{embedded:!0,focusGoalConnection:t,goals:n,initialGoalId:r,onChanged:o,onClose:s}):null,p===`provider`?(0,z.jsx)(`div`,{className:`personal-provider-settings`,children:(0,z.jsx)(IS,{})}):null,p===`machine`?(0,z.jsx)(NS,{}):null,p===`capabilities`?(0,z.jsx)(ES,{callbacks:e,goalId:r,notification:a.find(e=>e.goalId===r),onChanged:o}):null,p===`appearance`?(0,z.jsx)(`section`,{className:`personal-detail-card personal-appearance-settings`,children:(0,z.jsxs)(`div`,{className:`personal-settings-choice-group`,role:`radiogroup`,"aria-label":f(`settings.workspaceTheme`),children:[(0,z.jsxs)(`button`,{"aria-checked":l===`loopx`,onClick:()=>c(`loopx`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-loopx`}),(0,z.jsx)(`strong`,{children:f(`settings.themeLoopx`)})]}),(0,z.jsxs)(`button`,{"aria-checked":l===`paper`,onClick:()=>c(`paper`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-paper`}),(0,z.jsx)(`strong`,{children:f(`settings.themeDefault`)})]}),(0,z.jsxs)(`button`,{"aria-checked":l===`brutal`,onClick:()=>c(`brutal`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-brutal`}),(0,z.jsx)(`strong`,{children:f(`settings.themeHighContrast`)})]})]})}):null,p===`language`?(0,z.jsx)(`section`,{className:`personal-settings-card`,children:(0,z.jsx)(`div`,{"aria-label":f(`settings.language`),className:`personal-language-options`,role:`radiogroup`,children:_.map(e=>(0,z.jsxs)(`button`,{"aria-checked":u===e.value,className:u===e.value?`is-selected`:``,onClick:()=>d(e.value),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:e.label})}),u===e.value?(0,z.jsx)(hm,{"aria-hidden":!0,size:17}):null]},e.value))})}):null]})]})}var zS=`loopx-pw-theme`,BS=`loopx`;function VS(){try{let e=window.localStorage.getItem(zS);return e===`loopx`||e===`paper`||e===`brutal`?e:BS}catch{return BS}}function HS(e){try{window.localStorage.setItem(zS,e)}catch{}}function US({drawer:e,drawerMode:t=`panel`,drawerOpen:n,main:r,mobileSidebarOpen:i=!1,onCloseMobileSidebar:a,sidebar:o,theme:s=`loopx`}){let{t:c}=Ji(),l=(0,R.useRef)(null),u=(0,R.useRef)(null);return(0,R.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,z.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,z.jsx)(`button`,{"aria-hidden":!0,className:`personal-sidebar-backdrop`,onClick:a,tabIndex:-1,type:`button`}):null,(0,z.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,z.jsxs)(`div`,{className:`personal-workspace-sidebar-inner`,children:[i?(0,z.jsxs)(`button`,{className:`personal-sr-only`,onClick:a,type:`button`,children:[c(`common.close`),` `,c(`header.goalNavigation`)]}):null,o]})}),(0,z.jsx)(`main`,{"aria-hidden":i||void 0,className:`personal-workspace-main`,inert:i||void 0,children:r}),n?(0,z.jsx)(`aside`,{className:`personal-workspace-drawer`,"data-context-drawer":!0,"data-drawer-mode":t,children:e}):null]})}function WS(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 GS(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 KS(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 qS({goals:e,onSelectGoal:t,onRetry:n,systemHealth:r}){let{locale:i,t:a}=Ji(),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=[];e.filter(e=>!e.loadState).forEach(e=>{let t=Jd(e);t===`history`?u.push(e):t!==`stopped`&&l[t].push(e)});let d=e=>(0,z.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,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`span`,{className:`personal-home-goal-meta`,children:e.agentLaneCount&&e.agentLaneCount>1?a(`header.workAgentCount`,{count:e.agentLaneCount}):e.agentLabel??e.agentId}),(0,z.jsx)(`p`,{children:e.loadError?a(`startup.error.${e.loadError}`):e.needsYou??e.nextSentence}),(0,z.jsxs)(`footer`,{children:[(0,z.jsx)(`span`,{children:e.loadState?a(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Yi(e.state,i)}),(0,z.jsx)(`small`,{title:e.latestActivity,children:e.loadState?``:e.latestActivity?KS(e.latestActivity,i,a):e.agentTodos.length?a(`home.taskCount`,{count:e.agentTodos.length}):a(`home.noActivity`)})]})]},e.goalId);return(0,z.jsxs)(`section`,{"aria-label":a(`home.workspace`),className:`personal-home-board`,children:[r&&(!r.ok||r.issues.length>0||r.freshnessWarning)?(0,z.jsxs)(`div`,{className:`personal-system-health-banner`,role:`alert`,children:[(0,z.jsxs)(`div`,{className:`personal-system-health-header`,children:[(0,z.jsx)(ym,{size:15}),(0,z.jsx)(`strong`,{children:a(`home.systemHealth`,{summary:r.summary})}),r.freshnessWarning?(0,z.jsxs)(`small`,{children:[`(`,r.freshnessWarning,`)`]}):null]}),r.issues.length>0?(0,z.jsx)(`ul`,{className:`personal-system-health-issues`,children:r.issues.map((e,t)=>(0,z.jsx)(`li`,{children:e},t))}):null]}):null,o.some(e=>e.loadState)?(0,z.jsxs)(`section`,{className:`personal-home-lane`,"aria-live":`polite`,children:[(0,z.jsx)(`header`,{children:a(`startup.progress`,{loaded:o.filter(e=>!e.loadState).length,total:o.length})}),s?(0,z.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`status`,children:[(0,z.jsx)(`span`,{children:a(`startup.failedCount`,{count:s})}),(0,z.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(d)]}):null,(0,z.jsx)(`div`,{className:`personal-home-lanes`,children:c.filter(e=>l[e.key].length>0).map(e=>(0,z.jsxs)(`section`,{className:`personal-home-lane is-${e.key}`,"data-testid":`personal-home-lane-${e.key}`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`i`,{}),e.label]}),(0,z.jsx)(`b`,{children:l[e.key].length})]}),(0,z.jsx)(`div`,{className:`personal-home-lane-list`,children:l[e.key].map(d)})]},e.key))}),u.length?(0,z.jsxs)(`details`,{className:`personal-home-history`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:a(`home.history`)}),(0,z.jsx)(`b`,{children:u.length}),(0,z.jsx)(`small`,{children:a(`home.completedGoals`)})]}),(0,z.jsx)(`div`,{children:u.map(d)})]}):null]})}function JS({items:e,onSelect:t,reportState:n}){let{locale:r,t:i}=Ji();return(0,z.jsxs)(`section`,{className:`personal-object-list personal-files-list`,"data-testid":`personal-goal-outputs`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:i(`files.title`)}),(0,z.jsx)(`span`,{children:e.length})]}),n?.loading?(0,z.jsxs)(`p`,{className:`personal-object-list-state`,role:`status`,children:[(0,z.jsx)(Qm,{className:`is-spinning`,size:14}),i(`files.loadingReports`)]}):null,n?.error?(0,z.jsxs)(`p`,{className:`personal-object-list-state is-error`,role:`alert`,children:[(0,z.jsx)(ym,{size:14}),i(`files.reportLoadFailed`),`: `,n.error]}):null,!n?.loading&&!n?.error&&e.length===0?(0,z.jsxs)(`p`,{className:`personal-object-list-state`,children:[(0,z.jsx)(jm,{size:14}),i(`files.empty`)]}):null,e.map(e=>(0,z.jsxs)(`button`,{"data-output-kind":e.output.kind,onClick:()=>t({item:e.output,kind:`output`}),type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-file-icon`,children:(0,z.jsx)(jm,{size:16})}),(0,z.jsx)(`strong`,{children:e.output.title}),e.output.report?(0,z.jsx)(`em`,{children:i(`files.reportDelta`,{added:e.output.report.addedCount,changed:e.output.report.changedCount})}):null,(0,z.jsx)(`p`,{children:e.output.summary??e.output.safePreview??e.output.kind??i(`files.emptySummary`)}),(0,z.jsx)(`small`,{title:e.output.createdAt,children:[e.output.kind===`report`?i(`files.verifiedReport`):null,KS(e.output.createdAt,r,i)].filter(Boolean).join(` · `)})]},e.id))]})}function YS({agentLabel:e,messages:t,onClose:n,onDraftTask:r,onOpenConversation:i,title:a}){let{t:o}=Ji(),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,R.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,z.jsxs)(`aside`,{"aria-label":o(`conversation.receipt`),className:`personal-manager-conversation-tray`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(fm,{size:16}),(0,z.jsx)(`strong`,{children:a??o(`conversation.title`)}),(0,z.jsx)(`small`,{children:t.at(-1)?.pending?o(`conversation.replying`):o(`common.recently`)})]}),(0,z.jsxs)(`div`,{className:`personal-manager-conversation-actions`,children:[r&&l?(0,z.jsxs)(`button`,{className:`personal-manager-conversation-btn`,onClick:()=>r(l.text),title:o(`conversation.convertHint`),type:`button`,children:[(0,z.jsx)(Rm,{size:13}),(0,z.jsx)(`span`,{children:o(`conversation.toTask`)})]}):null,(0,z.jsx)(`button`,{className:`personal-manager-conversation-link`,onClick:i,type:`button`,children:o(`conversation.full`)}),n?(0,z.jsx)(`button`,{"aria-label":o(`conversation.close`),className:`personal-manager-conversation-close`,onClick:n,title:o(`conversation.close`),type:`button`,children:(0,z.jsx)(gh,{size:14})}):null]})]}),(0,z.jsx)(`div`,{"aria-live":`polite`,className:`personal-manager-conversation-messages`,children:c.map(t=>(0,z.jsxs)(`article`,{className:`is-${t.role}`,children:[(0,z.jsx)(`strong`,{children:t.role===`user`?o(`common.you`):t.agentLabel??e??o(`header.manager`)}),(0,z.jsxs)(`div`,{className:`personal-manager-conversation-bubble`,children:[t.role===`user`?(0,z.jsx)(`p`,{children:t.text}):(0,z.jsx)(wb,{text:t.text}),t.pending?(0,z.jsx)(`small`,{children:o(`conversation.agentPending`)}):null,(0,z.jsx)(Wy,{request:t.collaboration}),(0,z.jsx)(Vb,{delivery:t.returnDelivery})]})]},t.id))})]})}function XS({onClose:e,onOpenDetails:t,run:n}){let{t:r}=Ji();return(0,z.jsxs)(`section`,{"aria-label":r(`session.record`),className:`personal-session-record`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(fm,{size:17}),r(`session.record`)]}),(0,z.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,z.jsx)(gh,{size:15})})]}),(0,z.jsx)(`div`,{children:(0,z.jsx)(`strong`,{children:n.title})}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Agent`}),(0,z.jsx)(`dd`,{children:n.agentLabel})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`common.status`)}),(0,z.jsx)(`dd`,{children:Xi(n.sessionStatus??n.status,r)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Session`}),(0,z.jsx)(`dd`,{title:n.sessionId,children:n.sessionId})]})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:t,type:`button`,children:r(`session.details`)})]})}function ZS(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??Kd(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>Jd(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`})}qd(i)&&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 QS(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function $S(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 eC(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 tC(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 nC(e,t){let n=tC(e),r=eb(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===`team.plan`?e.status===`applied`?db(ub(e.receipt),t):t(`proposal.summary.teamPlan`,{goal:ob(e.normalized_parameters),count:ab(e.normalized_parameters)}):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`?eC(e,r,t):e.action_kind===`team.plan`?ib(e.normalized_parameters,t):$S(e.normalized_parameters,t),goalId:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:void 0,impact:r.retryOriginal?t(`actionReview.${r.reason}`):e.action_kind===`operation.execute`?t(`proposal.impact.operation`):e.action_kind===`team.plan`?e.status===`applied`?t(`proposal.teamPlan.assignedHint`):t(`proposal.impact.teamPlan`):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`):``,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:r.retryOriginal?t(`drawer.retryOriginal`):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===`team.plan`?t(e.status===`applied`?`proposal.teamPlan.viewResult`:`proposal.primary.teamPlan`):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:r.retryOriginal||e.status===`applied`&&e.action_kind!==`operation.execute`&&r.interaction!==`completed`?`error`:QS(e.status),teamPlanOutcome:e.action_kind===`team.plan`?ub(e.receipt)??void 0:void 0,teamPlanAssignments:e.action_kind===`team.plan`?sb(e.receipt,e.normalized_parameters):void 0,teamPlanGapLanes:e.action_kind===`team.plan`?cb(e.receipt,e.normalized_parameters):void 0,title:c}}function rC(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 iC(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 aC(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 oC(e,t){let n=aC(e,[`目标`,`Objective`]),r=aC(e,[`完成标准`,`Completion criteria`]),i=aC(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||iC(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 sC(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 cC(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 lC(e,t){return aC(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 uC(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 dC(e,t){let n=e.toLowerCase();return t.find(e=>n.includes(e.agentId.toLowerCase())||n.includes(e.label.toLowerCase()))}function fC(e){let t=aC(e,[`标题`,`任务标题`,`Todo 标题`]),n=aC(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 pC=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),mC=5242880,hC=4;function gC(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 _C({conversationSessionId:e,agents:t=[{agentId:`codex`,available:!0,capability:`代码与项目执行`,label:`Codex`}],callbacks:n={},goalArchiveLoadState:r={error:null,phase:`ready`},managerChannelBinding:i,managerRuntime:a,model:o,readOnly:s=!1,selectedAgentId:c,selectedGoalId:l,statusSourceControl:u}){let{locale:d,t:f}=Ji(),[p,m]=(0,R.useState)(l??null),[h,g]=(0,R.useState)(c??t.find(e=>e.available)?.agentId??`codex`),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(null),[C,w]=(0,R.useState)({}),[T,E]=(0,R.useState)(`chat`),[D,O]=(0,R.useState)(!1),[k,A]=(0,R.useState)(!1),[ee,j]=(0,R.useState)(!1),[M,te]=(0,R.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{}}}),[ne,N]=(0,R.useState)(!1),[P,re]=(0,R.useState)(null),[ie,ae]=(0,R.useState)(`queue`),[F,oe]=(0,R.useState)(``),[I,se]=(0,R.useState)([]),[L,ce]=(0,R.useState)(null),[le,ue]=(0,R.useState)(null),[de,fe]=(0,R.useState)(()=>new Set),[pe,me]=(0,R.useState)(()=>new Set),[he,ge]=(0,R.useState)(`idle`),[_e,ve]=(0,R.useState)([]),[ye,be]=(0,R.useState)([]),[xe,Se]=(0,R.useState)(!1),[Ce,we]=(0,R.useState)(VS),[Te,Ee]=(0,R.useState)({}),[De,Oe]=(0,R.useState)([]),ke=(0,R.useRef)(!1),Ae=(0,R.useRef)(NaN),je=(0,R.useRef)(null),Me=(0,R.useRef)(null),Ne=(0,R.useRef)(null),Pe=(0,R.useRef)(null),Fe=(0,R.useRef)(new Set),Ie=(0,R.useRef)(new Set),[Le,Re]=(0,R.useState)(null),B=l===void 0?p:l,ze=c??h,Be=`${B??`manager`}:${ze}`,Ve=M[Be]??``;(0,R.useEffect)(()=>{se([]),ce(null)},[Be]);function He(e,t){te(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 Ue(e){He(Be,e)}function We(e){return kh.find(t=>t.id===e)?.prompt??``}(0,R.useEffect)(()=>{let e=je.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[Ve]);let Ge=(0,R.useMemo)(()=>o.goals.map(e=>{let t=Te[e.goalId];return t?{...e,repository:{branch:t.branch,identity:t.identity,label:t.label,readOnly:!0}}:e}),[Te,o.goals]),Ke=(0,R.useMemo)(()=>Ge.filter(e=>Jd(e)===`needs_you`).length,[Ge]),qe=(0,R.useMemo)(()=>Ge.filter(e=>Jd(e)===`needs_you`&&(e.needsYouBlocking||e.state===`等你`)).length,[Ge]),V=Ge.find(e=>e.goalId===B)??null;function Je(e){Ne.current=document.activeElement instanceof HTMLElement?document.activeElement:null,Se(!1),v(e)}function Ye(){v(null),window.requestAnimationFrame(()=>{let e=Ne.current;e?.isConnected&&e.getClientRects().length?e.focus({preventScroll:!0}):document.querySelector(`.personal-mobile-menu`)?.focus({preventScroll:!0})})}let Xe=_?.kind===`settings`,Ze=B,Qe=(0,R.useMemo)(()=>{let e=Object.values(C).filter(e=>e.actionKind===`heartbeat.bind`&&e.goalId&&e.status===`applied`).map(e=>({id:`schedule:${e.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:ze,executionHistory:[],goalId:e.goalId,label:e.title,nextRunAt:f(`drawer.schedulePending`),notificationRule:f(`drawer.scheduleDefaultNotification`),schedule:e.fields.find(e=>e.key===`cadence`)?.value??f(`schedule.summary`),scheduleId:`${e.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:e.status===`applied`?`active`:`draft`,stopCondition:e.fields.find(e=>e.key===`stop_condition`)?.value??f(`drawer.scheduleDefaultStop`),timezone:e.fields.find(e=>e.key===`timezone`)?.value??`Asia/Shanghai`}})),t=[...ZS(o,Ze,f),...o.timeline??[],...e,...GS(Object.values(C)).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)||e.proposal.reviewPlan?.retryOriginal===!0||_e.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)},[Ze,o,C,ze,B,_e,f]),$e=(0,R.useMemo)(()=>x?Qe.filter(e=>e.kind===`message`?!0:e.kind===`run`?e.run.runId===x.runId:e.kind===`output`&&e.output.runId===x.runId):Qe,[x,Qe]);(0,R.useEffect)(()=>{if(!x)return;let e=Qe.find(e=>e.kind===`run`&&e.run.runId===x.runId);!e||e.kind!==`run`||JSON.stringify({completedSteps:x.completedSteps,latestActivity:x.latestActivity,messages:x.sessionMessages,sessionStatus:x.sessionStatus,status:x.status,totalSteps:x.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})&&S(e.run)},[x,Qe]);let et=(0,R.useMemo)(()=>Qe.flatMap(e=>e.kind===`message`?[e.message]:[]),[Qe]),tt=(0,R.useMemo)(()=>V?Qe.flatMap(e=>e.kind===`message`?[e.message]:[]):[],[Qe,V]);(0,R.useEffect)(()=>{V||D||et.some(e=>e.pending)&&A(!0)},[D,et,V]),(0,R.useEffect)(()=>{!V||T===`chat`||tt.some(e=>e.pending)&&j(!0)},[tt,V,T]);let nt=(0,R.useMemo)(()=>Qe.filter(e=>e.kind===`message`||e.kind===`proposal`&&(_e.includes(e.proposal.previewId)||ye.includes(e.proposal.previewId))),[Qe,_e,ye]),rt=nt[nt.length-1],it=rt?.kind===`message`?rt.message.text.length:0;(0,R.useEffect)(()=>{if(!D||!Me.current)return;let e=window.requestAnimationFrame(()=>{Me.current&&(Me.current.scrollTop=Me.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[nt.length,D,it]);let at=(0,R.useMemo)(()=>{if(_?.kind===`settings`)return null;if(_?.kind===`attention`)return{kind:`attention`,item:rf(_.item,o.attentionHistory??o.userTodos)};if(_?.kind===`goal`){let e=Ge.find(e=>e.goalId===_.item.goalId);return e?{item:e,kind:`goal`}:_}if(_?.kind!==`run`)return _;let e=Qe.find(e=>e.kind===`run`&&e.run.runId===_.item.runId);return e?{item:e.run,kind:`run`}:_},[Qe,_,Ge,o.attentionHistory,o.userTodos]);(0,R.useEffect)(()=>{if(s){Ee({}),Oe([]);return}let e=!1;return Promise.all([h_(),E_()]).then(([t,n])=>{e||(Ee(Object.fromEntries(t.map(e=>[e.goal_id,e.repository]))),Oe(n))}).catch(()=>{}),()=>{e=!0}},[s]),(0,R.useEffect)(()=>{if(!xe)return;function e(e){e.key===`Escape`&&Se(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[xe]),(0,R.useEffect)(()=>{if(B||!Qe.length)return;if(!ke.current){ke.current=!0;try{Ae.current=Date.parse(window.localStorage.getItem(`loopx-pw-last-visit`)??``),window.localStorage.setItem(`loopx-pw-last-visit`,new Date().toISOString())}catch{Ae.current=NaN}}let e=Ae.current,t=Qe.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={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};Re(e=>e?.done===r.done&&e.failed===r.failed?e:r)},[Qe,B]),(0,R.useEffect)(()=>{if(s){w({});return}let e=!1;return eg(B?{goalId:B}:{contextKind:`manager`}).then(t=>{if(e)return;let n=t.filter(e=>[`preview_ready`,`gated`,`deferred`,`applying`].includes(e.status)||eb(e).retryOriginal===!0||e.action_kind===`operation.execute`&&e.status===`applied`).map(e=>nC(e,f)),r=Object.fromEntries(n.map(e=>[e.previewId,e]));w(e=>({...e,...r})),B||be(n.map(e=>e.previewId))}).catch(()=>{}),()=>{e=!0}},[s,B,f]);async function ot(e,t={}){if(s)throw Error(f(`source.readOnlyWriteError`));let r;try{r=n.onPreviewAction?await n.onPreviewAction(e):nC(await Qh(e),f)}catch(t){if(!(t instanceof qh)||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??f(`proposal.workspaceGate.defaultSummary`))},impact:f(o?`proposal.workspaceGate.agentImpact`:`proposal.workspaceGate.selectionImpact`),previewId:`workspace-choice-${Date.now().toString(36)}`,sourceRequest:e,status:`gated`,title:f(o?`proposal.workspaceGate.agentTitle`:`proposal.workspaceGate.selectionTitle`),workspaceCandidates:i}}return ve(e=>e.includes(r.previewId)?e:[...e,r.previewId]),w(e=>({...e,[r.previewId]:r})),t.select!==!1&&v({item:r,kind:`proposal`}),r}function st(){_t(null),He(`manager:${ze}`,f(`composer.createGoalTemplate`)),window.requestAnimationFrame(()=>je.current?.focus())}async function ct(e,t){Se(!1);let r={delete:`Deleted from the owner workspace`,resume:`Resumed from the owner workspace`,stop:`Stopped from the owner workspace`},i={delete:f(`proposal.summary.lifecycleDelete`,{title:e.title}),resume:f(`proposal.summary.lifecycleResume`,{title:e.title}),stop:f(`proposal.summary.lifecycleStop`,{title:e.title})},a=null,o=!1;try{if(t===`stop`){if(Fe.current.has(e.goalId))return;Fe.current.add(e.goalId),fe(new Set(Fe.current)),v(null),a={goalId:e.goalId,next:`stopped`,optimisticApplied:!0,previous:e.activationState},ue(f(`feedback.applying`,{title:i.stop})),n.onGoalActivationStateChange?.(e.goalId,`stopped`)}if(n.onExecuteGoalLifecycle){if(t===`delete`)throw Error(`The selected status source does not authorize Goal deletion.`);let a=await n.onExecuteGoalLifecycle({goalId:e.goalId,operation:t,reason:r[t]});if(!a.projectionVerified)throw Error(`Goal lifecycle projection did not verify.`);o=!0,n.onGoalActivationStateChange?.(e.goalId,a.activationState),ue(f(`feedback.completed`,{title:i[t]})),t===`stop`&&_t(null),await ft([e.goalId]);return}let s=await ot({actionKind:`goal.lifecycle`,context:{kind:`goal_directory`,goal_id:e.goalId},idempotencyKey:`workspace-goal-${t}-${e.goalId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:t,reason:r[t]},summary:i[t]},{select:t!==`stop`});if(s.goalId!==e.goalId||s.lifecycleOperation!==t)throw v(null),Error(f(`actionReview.targetChanged`));t===`stop`&&(s.reviewPlan?.interaction===`direct`?(o=!0,await pt(s,{lifecycleProjection:a??void 0,presentation:`feedback`})):(a&&n.onGoalActivationStateChange?.(a.goalId,a.previous),ue(s.gate?f(`feedback.gateRequired`,{summary:s.gate.summary}):f(`feedback.notCompleted`,{status:s.status})),v({item:s,kind:`proposal`})))}catch(e){a&&!o&&n.onGoalActivationStateChange?.(a.goalId,a.previous),ue(f(`feedback.executionFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{t===`stop`&&(Fe.current.delete(e.goalId),fe(new Set(Fe.current)))}}function lt(e,t){Ue(f(t?e===`heartbeat`?`composer.heartbeatTemplate`:`composer.monitorTemplate`:e===`heartbeat`?`composer.heartbeatTemplateWithoutGoal`:`composer.monitorTemplateWithoutGoal`)),v(null),window.requestAnimationFrame(()=>je.current?.focus())}async function ut(e,t,r=``){let i=await n.onRequestScheduleConfig?.(e,t);if(i){ve(e=>e.includes(i.previewId)?e:[...e,i.previewId]),w(e=>({...e,[i.previewId]:i})),v({item:i,kind:`proposal`});return}if(!t){Ue(f(e===`heartbeat`?`composer.heartbeatGoalQuestion`:`composer.monitorGoalQuestion`));return}let a=Date.now().toString(36);await ot({actionKind:e===`heartbeat`?`heartbeat.bind`:`monitor.create`,context:{kind:`schedule`,goal_id:t},idempotencyKey:`workspace-${e}-${t}-${a}`,normalizedParameters:e===`heartbeat`?{agent_id:ze,cadence:sC(r),goal_id:t,stop_condition:uC(r),timezone:`Asia/Shanghai`}:{agent_id:ze,cadence:sC(r),goal_id:t,stop_condition:uC(r),target:lC(r,f),target_key:`goal-${t}`,timezone:`Asia/Shanghai`},summary:e===`heartbeat`?f(`proposal.summary.heartbeat`):f(`proposal.summary.monitor`,{target:lC(r,f)})})}async function dt(e){if(!Ie.current.has(e.todoId)){Ie.current.add(e.todoId),me(new Set(Ie.current)),ue(f(`feedback.preparingPreview`,{title:e.text}));try{await ot({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:f(`tasks.markComplete`,{name:e.text})}),ue(null)}catch(e){ue(f(`feedback.previewFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{Ie.current.delete(e.todoId),me(new Set(Ie.current))}}}function ft(e){let t=n.onReconcileStatus,r=t?t({invalidateGoalIds:e}):n.onRefresh?.();return Promise.resolve(r).catch(()=>{ue(f(`feedback.goalRefreshFailed`))})}async function pt(e,t={}){let r=e.actionKind===`team.plan`&&e.status===`error`&&[`apply_failed`,`readback_unverified`].includes(e.reviewPlan?.reason??``);if(e.reviewPlan&&!e.reviewPlan.canApply&&!r)return;let i=t.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:o.goals.find(t=>t.goalId===e.goalId)?.activationState??(e.lifecycleOperation===`stop`?`active`:`stopped`)}:null,s=t.lifecycleProjection??a;ue(f(`feedback.applying`,{title:e.title}));let c={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`pending`,reason:`apply_pending`,canApply:!1}:void 0,status:`applying`};w(t=>({...t,[e.previewId]:c})),i&&v({item:c,kind:`proposal`}),s&&!s.optimisticApplied&&n.onGoalActivationStateChange?.(s.goalId,s.next);try{if(n.onApplyProposal){await n.onApplyProposal(e);let t={...e,status:`applied`};w(n=>({...n,[e.previewId]:t})),i&&v({item:t,kind:`proposal`}),ue(f(`feedback.completed`,{title:e.title})),e.actionKind===`goal.lifecycle`&&((e.lifecycleOperation===`stop`||e.lifecycleOperation===`delete`)&&_t(null),e.lifecycleOperation===`delete`&&e.goalId&&n.onGoalDeleted?.(e.goalId),ft(e.goalId?[e.goalId]:void 0));return}let t=await tg(e.previewId);if(t.proposal.proposal_id!==e.previewId||t.proposal.action_kind!==e.actionKind||e.actionKind===`goal.lifecycle`&&(t.proposal.normalized_parameters.goal_id!==e.goalId||tC(t.proposal)!==e.lifecycleOperation))throw new qh(f(`actionReview.targetChanged`),{error_code:`action_response_mismatch`});let r=nC(t.proposal,f);if(w(t=>({...t,[e.previewId]:r})),i&&v({item:r,kind:`proposal`}),r.reviewPlan?.interaction!==`completed`){s&&n.onGoalActivationStateChange?.(s.goalId,s.previous),v({item:r,kind:`proposal`}),ue(t.proposal.status===`stale`?f(`feedback.stale`):f(`actionReview.${r.reviewPlan.reason}`));return}ue(f(`feedback.completed`,{title:r.title})),r.actionKind===`todo.create`&&await n.onRefresh?.(),r.actionKind===`goal.lifecycle`&&(r.lifecycleOperation===`stop`||r.lifecycleOperation===`delete`)&&_t(null),r.actionKind===`goal.lifecycle`&&r.lifecycleOperation===`delete`&&r.goalId&&n.onGoalDeleted?.(r.goalId),r.actionKind===`goal.lifecycle`&&ft(r.goalId?[r.goalId]:void 0)}catch(t){if(s&&n.onGoalActivationStateChange?.(s.goalId,s.previous),t instanceof qh&&t.payload.error_code===`protected_action`){let r=t.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??t.message)},status:`gated`};w(t=>({...t,[e.previewId]:a})),v({item:a,kind:`proposal`}),ue(f(`feedback.gateRequired`,{summary:a.gate.summary})),e.actionKind===`goal.create`&&e.goalId&&(n.onRefresh?.(),_t(e.goalId));return}let r=t instanceof qh&&tb(t.payload),i=t instanceof qh&&t.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:t instanceof Error?t.message:String(t),status:r?`stale`:`error`};w(t=>({...t,[e.previewId]:a})),v({item:a,kind:`proposal`}),ue(f(`feedback.executionFailed`,{error:a.errorMessage}))}}function mt(){E(`chat`),S(null),j(!1),window.requestAnimationFrame(()=>{let e=Me.current?.querySelectorAll(`.personal-message.is-assistant`);e?.item(e.length-1)?.scrollIntoView({block:`start`})})}let ht={...n,onOpenRunSession:async e=>{e.goalId!==B&&_t(e.goalId),E(`chat`),await n.onOpenRunSession?.(e),S(e),v(null)},onOpenGoal:e=>{_t(e),ft([e])},onOpenGoalView:e=>{e===`chat`?mt():E(e),v(null)},onOpenOutput:e=>{e.goalId!==B&&_t(e.goalId),E(`files`),n.onOpenOutput?.(e)},onApplyProposal:pt,onCancelProposal:async e=>{v(null),w(t=>{let n={...t};return delete n[e.previewId],n});try{n.onCancelProposal?.(e),n.onCancelProposal||await ng(e.previewId)}catch(t){w(t=>({...t,[e.previewId]:e})),ue(f(`feedback.cancelFailed`,{error:t instanceof Error?t.message:String(t)}))}},onTransitionProposal:async(e,t)=>{let n=nC(await rg(e.previewId,t),f);ve(e=>e.includes(n.previewId)?e:[...e,n.previewId]),w(r=>{let i={...r};return t===`regenerate`&&delete i[e.previewId],i[n.previewId]=n,i}),v({item:n,kind:`proposal`})},onSelectWorkspaceCandidate:async(e,t)=>{e.sourceRequest&&(w(t=>{let n={...t};return delete n[e.previewId],n}),await ot({...e.sourceRequest,idempotencyKey:`${e.sourceRequest.idempotencyKey}-${t}`,normalizedParameters:{...e.sourceRequest.normalizedParameters,workspace_ref:t}}))},onPreviewAction:ot,onRequestScheduleConfig:(e,t)=>lt(e,t),onOpenNotificationSettings:e=>Je({goalId:e,kind:`settings`,tab:`lark`}),onFetchNotificationTargets:()=>Ng(),onSetupGoalChannel:e=>Fg(e),onToggleGoalAutoNotify:e=>Ig(e),onUpdateSchedule:async(e,t)=>{let n=Date.now().toString(36),r=e.scheduleKind===`heartbeat`;await ot({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??ze,...!r&&t===`run_now`?{endpoint_id:ze}:{},...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}`})}},gt=s?{onOpenGoal:ht.onOpenGoal,onOpenGoalView:ht.onOpenGoalView,onOpenOutput:ht.onOpenOutput}:ht;function _t(e){m(e),O(!1),A(!1),j(!1),S(null),v(null),E(`tasks`),Se(!1),n.onSelectGoal?.(e)}function vt(e){g(e),n.onSelectAgent?.(e)}function yt(e){we(e),HS(e)}async function bt(r){let i=r?[]:I,a=(r??Ve).trim()||(i.length?f(`composer.imageAnalysisPrompt`):``);if(!(!a||ne)){if(P?.session_id===e&&P?.enabled&&P.active_turn_id&&e){if(i.length){ce(d===`zh-CN`?`运行中的消息投递暂不支持图片,请暂停后发送。`:`Pause execution before sending images.`);return}N(!0);try{let t=await Sg(e,a,ie);r||Ue(``),oe(d===`zh-CN`?`${ie===`queue`?`已排队,等待后续回合`:ie===`inbox`?`已进入收件箱`:`已提交纠偏`} · ${t.status}`:`${ie}: ${t.status}`)}catch(e){ce(e instanceof Error?e.message:String(e))}finally{N(!1)}return}r||(Ue(``),se([])),ce(null),N(!0);try{if(i.length){B?T!==`chat`&&j(!0):A(!0);let e=await n.onSendMessage?.(a,ze,B,i);e&&await ot(e);return}let e=Zb(a,{agents:t.map(e=>({agentId:e.agentId,label:e.label})),goalId:B,todos:(V?.agentTodos??[]).map(e=>({text:e.text,todoId:e.todoId}))});if(e.route===`clarify`){Ue(a);let t=f(`composer.clarifySingleAction`);e.missingFields.includes(`resume_when`)&&(t=f(`composer.clarifyDefer`)),ue(t);return}if(e.actionKind===`goal.create`){let t=oC(a,f),n=rC(t.title);await ot({actionKind:`goal.create`,context:{kind:`manager`,goal_id:null,natural_language:a},idempotencyKey:`workspace-goal-intent-${n}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:ze,completion_criteria:t.completionCriteria,execution_boundary:t.executionBoundary,goal_id:n,heartbeat:{cadence:sC(a),enabled:e.normalizedParameters.heartbeat_enabled===!0,timezone:`Asia/Shanghai`},initial_todos:t.initialTodos,objective:t.objective,permission:t.permission,stop_condition:uC(a),title:t.title,workspace_ref:`current`},summary:f(`proposal.summary.goalCreate`,{title:t.title})});return}if(B&&e.actionKind===`heartbeat.bind`){await ut(`heartbeat`,B,a);return}if(B&&e.actionKind===`monitor.create`){let e=cC(a,f);if(e){Ue(a),ue(e);return}await ut(`monitor`,B,a);return}let r=dC(a,t);if(B&&r&&e.actionKind===`agent.bind`){await ot({actionKind:`agent.bind`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-agent-bind-${B}-${r.agentId}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:r.agentId,goal_id:B},summary:`将 ${r.label} 绑定到 ${V?.title??B}`});return}if(B&&e.actionKind===`todo.create`){if(e.normalizedParameters.start_execution===!0){await ot({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-task-start-${B}-${Date.now().toString(36)}`,normalizedParameters:{endpoint_id:r?.agentId??ze,goal_id:B,start_execution:!0,text:a},summary:`交给 Agent 执行:${a.slice(0,120)}`});return}let t=r?.agentId??(/(交给|分配给|让).{0,24}(agent|codex|claude|kiro|kimi)/iu.test(a)?ze:null);await ot({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-todo-create-${B}-${Date.now().toString(36)}`,normalizedParameters:{...t?{endpoint_id:t}:{},goal_id:B,text:fC(a)},summary:`创建 Todo:${fC(a)}`});return}let o=V?.agentTodos.find(e=>a.includes(e.todoId)||a.includes(e.text)),s=typeof e.normalizedParameters.operation==`string`?e.normalizedParameters.operation:null;if(B&&o&&e.actionKind===`todo.update`&&s){await ot({actionKind:`todo.update`,context:{kind:`todo`,goal_id:B,todo_id:o.todoId,natural_language:a},idempotencyKey:`workspace-todo-update-${o.todoId}-${s}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:ze,...s===`reassign`&&r?{endpoint_id:r.agentId}:{},...s===`block`?{note:a}:{},...s===`defer`&&typeof e.normalizedParameters.resume_when==`string`?{resume_when:e.normalizedParameters.resume_when}:{},goal_id:B,operation:s,todo_id:o.todoId},summary:`更新 Todo:${o.text}`});return}B?T!==`chat`&&j(!0):A(!0);let c=await n.onSendMessage?.(a,ze,B);c&&await ot(c)}catch(e){r||(Ue(a),se(i));let t=e instanceof Error?e.message:f(`feedback.sendGenericError`);ue(f(`feedback.sendFailed`,{error:t}))}finally{N(!1)}}}let xt=t.find(e=>e.agentId===ze)?.label??ze,St=!V&&Ve.startsWith(f(`composer.createGoalDraftLead`));async function Ct(e){if(!e?.length)return;let t=hC-I.length,n=Array.from(e).slice(0,Math.max(0,t)),r=n.find(e=>!pC.has(e.type)),i=n.find(e=>e.size>mC);if(t<=0){ce(f(`composer.imageCountError`,{count:hC}));return}if(r){ce(f(`composer.imageTypeError`));return}if(i){ce(f(`composer.imageSizeError`,{size:mC/1024/1024}));return}try{let t=await Promise.all(n.map(e=>gC(e,f)));se(e=>[...e,...t].slice(0,hC)),ce(e.length>n.length?f(`composer.imageCountError`,{count:hC}):null)}catch(e){ce(e instanceof Error?e.message:f(`composer.imageReadGenericError`))}finally{Pe.current&&(Pe.current.value=``)}}function wt(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 Tt(){let e=await E_();Oe(e)}async function Et(){await Promise.all([Tt(),n.onRefresh?.()])}async function Dt(){if(!(!n.onRefresh||he===`loading`)){ge(`loading`);try{await n.onRefresh(),ge(`done`)}catch{ge(`error`)}window.setTimeout(()=>ge(`idle`),1800)}}let Ot=Xe?(0,z.jsx)(RS,{callbacks:gt,focusGoalConnection:!!(_?.kind===`settings`&&_.goalId),goalNotifications:o.goalNotifications??[],goals:Ge,initialGoalId:_?.kind===`settings`?_.goalId??B:B,initialTab:_?.kind===`settings`?_.tab??`lark`:`lark`,onChanged:()=>void Et(),onClose:Ye,onThemeChange:yt,theme:Ce}):null;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{hidden:Xe,children:(0,z.jsx)(US,{drawer:at?(0,z.jsx)(ox,{agents:t,attentionHistory:o.attentionHistory??o.userTodos,onSelectAttention:e=>v({kind:`attention`,item:e}),callbacks:gt,goalNotifications:o.goalNotifications??[],goals:Ge,inspectorExpanded:y,larkConnections:s?[]:De,onClose:()=>{at.kind===`proposal`&&[`applied`,`rejected`].includes(at.item.status)&&(at.item.actionKind!==`heartbeat.bind`||at.item.status!==`applied`)&&w(e=>{let t={...e};return delete t[at.item.previewId],t}),b(!1),v(null)},onToggleInspectorSize:()=>b(e=>!e),readOnly:s,runs:Qe.flatMap(e=>e.kind===`run`?[e.run]:[]),selection:at}):null,drawerMode:at?.kind===`todo`?y?`inspector-full`:`inspector`:`panel`,drawerOpen:at!==null,mobileSidebarOpen:xe,onCloseMobileSidebar:()=>Se(!1),theme:Ce,main:(0,z.jsxs)(`div`,{className:`personal-channel`,children:[(0,z.jsx)(pb,{agents:t,managerChatOpen:D,managerChannelBinding:i,managerRuntime:a,mobileNavigationOpen:xe,onOpenGoalCapabilities:V&&!s?()=>Je({goalId:V.goalId,kind:`settings`,tab:`capabilities`}):void 0,onRefresh:n.onRefresh?()=>void Dt():void 0,onOpenNavigation:()=>Se(!0),onOpenManagerChat:()=>{A(!1),O(!0)},onSelectGoalTab:e=>{e===`chat`?mt():E(e)},onSelectAgent:vt,onReturnManagerHome:()=>{O(!1),A(!1),window.requestAnimationFrame(()=>Me.current?.scrollTo({behavior:`smooth`,top:0}))},selectedAgentId:ze,refreshState:he,readOnlySourceLabel:s?u?.activeSource.label:void 0,selectedGoal:V,selectedGoalTab:T}),B&&T===`chat`&&!s&&ze===`codex`&&n.onStartLoopX?(0,z.jsx)(Nb,{onPrepare:()=>n.onPrepareLoopX(ze,B),sessionId:e,onChange:re,onExecute:(e,t)=>n.onStartLoopX?.(e,ze,B,t)},`${B}:${ze}`):null,(0,z.jsxs)(`div`,{className:`personal-channel-scroll`,"data-active-goal-view":V?T:void 0,ref:Me,children:[B&&T===`chat`&&!s&&ze===`codex`&&e&&P?.settings.execution_config&&P.settings.agent_id?(0,z.jsx)(Fb,{sessionId:e,zh:d===`zh-CN`,refreshKey:JSON.stringify(P.deliveries)},`${e}:${P.settings.agent_id}:${P.settings.execution_config}`):null,!V&&!D&&Le&&Le.done+Le.failed>0?(0,z.jsxs)(`section`,{className:`personal-digest-card`,"aria-label":f(`digest.away`),children:[(0,z.jsx)(`strong`,{children:f(`digest.away`)}),(0,z.jsxs)(`div`,{className:`personal-digest-stats`,children:[Le.done>0?(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:Le.done}),f(`digest.completed`)]}):null,Le.failed>0?(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:Le.failed}),f(`digest.failed`)]}):null]})]}):null,!V&&!D?(0,z.jsxs)(`section`,{className:`personal-manager-greeting`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(fm,{size:20})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:f(`home.greeting`)}),(0,z.jsx)(`p`,{children:o.goals.some(e=>e.activationState===`active`&&e.loadState)?f(`startup.partial`):(0,z.jsxs)(z.Fragment,{children:[f(`home.waitingCount`,{count:Ke}),` `,qe>0?f(`home.blockingSummary`,{count:qe}):null]})})]})]}):null,V?.loadState?(0,z.jsx)(`section`,{className:`personal-manager-greeting`,role:`status`,"data-testid":`goal-status-loading`,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:f(V.loadState===`error`?`startup.goalError`:`startup.goalLoading`)}),(0,z.jsx)(`p`,{children:f(V.loadError?`startup.error.${V.loadError}`:`startup.independent`)}),V.loadState===`error`?(0,z.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,type:`button`,onClick:()=>void n.onRefresh?.(),children:f(`startup.retry`)}):null]})}):V?(0,z.jsx)(Xx,{activeTab:T,scrollRef:Me,panels:{overview:(0,z.jsx)(Yx,{active:!Xe&&T===`overview`,goal:V,items:Qe,userTodos:o.userTodos,readOnly:s,onOpenDetails:()=>v({kind:`goal`,item:V}),onSelect:v,onView:E}),tasks:(0,z.jsx)(Mx,{historyEnabled:!s,goal:V,items:Qe,onDraftTaskFromMessage:s?void 0:e=>{Ue(`创建一个 Task:${WS(e)}`),ue(f(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>je.current?.focus())},onOpenChat:mt,onQuickComplete:s?void 0:dt,onSelect:v,quickCompletingTodoIds:pe,selectedTodoId:at?.kind===`todo`?at.item.todoId:null,userTodos:o.userTodos}),files:(0,z.jsx)(JS,{items:Qe.filter(e=>e.kind===`output`),onSelect:v,reportState:o.periodicReports}),chat:(0,z.jsxs)(z.Fragment,{children:[V&&x?.goalId===V.goalId?(0,z.jsx)(XS,{onClose:()=>S(null),onOpenDetails:()=>v({item:x,kind:`run`}),run:x}):null,(0,z.jsx)(Hb,{items:$e,onSelect:v,selectedGoal:V})]})}},`${u?.activeSource.statusUrl??`/status.json`}:${V.goalId}`):D?(0,z.jsx)(Hb,{items:nt,onSelect:v,selectedGoal:null}):(0,z.jsx)(qS,{goals:Ge,onRetry:()=>void n.onRefresh?.(),onSelectGoal:_t,systemHealth:o.systemHealth})]}),(0,z.jsxs)(`div`,{className:`personal-composer-wrap`,children:[P?.session_id===e&&P?.enabled&&P.active_turn_id?(0,z.jsxs)(`label`,{className:`goal-loopx-message-mode`,children:[d===`zh-CN`?`消息处理`:`Message delivery`,(0,z.jsxs)(`select`,{"aria-label":d===`zh-CN`?`消息处理方式`:`Message delivery mode`,value:ie,onChange:e=>ae(e.target.value),children:[(0,z.jsx)(`option`,{value:`queue`,children:d===`zh-CN`?`下一轮处理`:`Next turn`}),(0,z.jsx)(`option`,{value:`inbox`,children:d===`zh-CN`?`放入收件箱`:`Inbox`}),(0,z.jsx)(`option`,{value:`steer`,children:d===`zh-CN`?`立即纠偏`:`Steer now`})]}),(0,z.jsx)(`span`,{role:`status`,children:F})]}):null,s?(0,z.jsxs)(`div`,{className:`personal-read-only-notice`,children:[(0,z.jsx)(`strong`,{children:f(`source.readOnlyNoticeTitle`)}),(0,z.jsx)(`span`,{children:f(`source.readOnlyNoticeDescription`)})]}):(0,z.jsxs)(z.Fragment,{children:[!V&&!D&&k&&et.length?(0,z.jsx)(YS,{messages:et,onClose:()=>A(!1),onOpenConversation:()=>{A(!1),O(!0)}}):null,V&&T!==`chat`&&ee&&tt.length?(0,z.jsx)(YS,{agentLabel:xt,messages:tt,onClose:()=>j(!1),onDraftTask:T===`tasks`?e=>{Ue(`创建一个 Task:${WS(e)}`),ue(f(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>je.current?.focus())}:void 0,onOpenConversation:mt,title:`${V.title} · ${xt}`}):null,le?(0,z.jsxs)(`div`,{className:`personal-action-feedback`,role:`status`,children:[(0,z.jsx)(`span`,{children:le}),(0,z.jsx)(`button`,{"aria-label":f(`common.closeActionReceipt`),onClick:()=>ue(null),type:`button`,children:(0,z.jsx)(gh,{size:14})})]}):null,(0,z.jsxs)(`details`,{className:`personal-composer-tools`,children:[(0,z.jsx)(`summary`,{children:d===`zh-CN`?`快捷提问`:`Suggestions`}),V?(0,z.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,z.jsxs)(`button`,{"aria-label":f(`composer.nextAction`),disabled:ne,onClick:()=>void bt(f(`composer.nextActionPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(Hm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.nextAction`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.agentProgress`),disabled:ne,onClick:()=>void bt(f(`composer.agentProgressPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(nh,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.agentProgress`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.monitor`),disabled:ne,onClick:()=>void bt(f(`composer.monitorShortcutTemplate`,{target:f(`schedule.defaultTarget`)})),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(mm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.monitor`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.blockers`),disabled:ne||!We(`gate`),onClick:()=>void bt(We(`gate`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(ym,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.blockers`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.evidence`),disabled:ne||!We(`evidence`),onClick:()=>void bt(We(`evidence`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(jm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.evidence`)})]})]}):(0,z.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,z.jsxs)(`button`,{"aria-label":f(`composer.globalTasks`),disabled:ne,onClick:()=>void bt(f(`composer.globalTasksPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(Hm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.globalTasks`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.globalProgress`),disabled:ne,onClick:()=>void bt(f(`composer.globalProgressPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(nh,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.globalProgress`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.createGoal`),onClick:st,title:f(`composer.createGoalHint`),type:`button`,children:[(0,z.jsx)(Xm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.createGoal`)})]})]})]},B??`manager`),St?(0,z.jsxs)(`div`,{className:`personal-goal-draft-status`,role:`status`,children:[(0,z.jsx)(`strong`,{children:f(`composer.createGoalDraft`)}),(0,z.jsx)(`span`,{children:f(`composer.createGoalDraftDescription`)})]}):null,I.length?(0,z.jsx)(`div`,{className:`personal-composer-images`,"aria-label":f(`composer.imagesPending`),children:I.map(e=>(0,z.jsxs)(`figure`,{children:[(0,z.jsx)(`img`,{alt:e.name,src:e.dataUrl}),(0,z.jsx)(`button`,{"aria-label":f(`composer.sentImageAlt`,{name:e.name}),onClick:()=>se(t=>t.filter(t=>t.id!==e.id)),type:`button`,children:(0,z.jsx)(gh,{size:13})})]},e.id))}):null,L?(0,z.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:L}):null,(0,z.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,z.jsx)(`button`,{"aria-label":f(`composer.addImage`),className:`personal-composer-attach`,disabled:ne||I.length>=hC,onClick:()=>Pe.current?.click(),title:f(`composer.attachImageHint`),type:`button`,children:(0,z.jsx)(qm,{size:17})}),(0,z.jsx)(`input`,{accept:`image/png,image/jpeg,image/webp,image/gif`,"aria-label":f(`composer.imagePicker`),className:`personal-composer-file-input`,disabled:ne||I.length>=hC,multiple:!0,onChange:e=>void Ct(e.target.files),ref:Pe,type:`file`}),(0,z.jsx)(`textarea`,{"aria-label":f(`composer.sendMessage`),onChange:e=>Ue(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),bt())},onPaste:wt,placeholder:V?f(`composer.goalPlaceholder`,{goal:V.title}):f(`composer.managerPlaceholder`),ref:je,rows:1,value:Ve}),(0,z.jsx)(`button`,{"aria-label":f(St?`composer.createGoal`:`composer.send`),disabled:!Ve.trim()&&I.length===0||ne,onClick:()=>void bt(),title:f(St?`composer.createGoalHint`:`composer.sendMessageHint`),type:`button`,children:(0,z.jsx)(nh,{size:18})})]})]})]})]}),sidebar:(0,z.jsx)(Ox,{attentionCount:Ke,goals:Ge,goalArchiveLoadState:r,goalLifecycleOperations:n.onExecuteGoalLifecycle?[`stop`,`resume`]:void 0,lifecycleBusyGoalIds:de,onRequestGoalCreate:s?void 0:st,onRequestGoalLifecycle:s&&!n.onExecuteGoalLifecycle?void 0:(e,t)=>void ct(e,t),onRetryGoalArchive:n.onRetryGoalArchive||n.onRefresh?()=>void(n.onRetryGoalArchive??n.onRefresh)?.():void 0,onOpenSettings:s?void 0:()=>Je({kind:`settings`}),onSelectGoal:_t,selectedGoalId:B,statusSourceControl:u},u?.activeSource.statusUrl??`/status.json`)})}),Ot]})}function vC(e){return(e??``).replace(/\s+/gu,` `).trim()}function yC(e,t=120){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t-1).join(``)}…`}function bC(e,t,n){let r=vC(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`):yC(r)}function xC(e,t){return t({advancing:`projection.agentAdvancingGoal`,idle:`projection.agentIdle`,needs_you:`projection.agentNeedsDecision`,stopped:`projection.agentStopped`,waiting_external:`projection.agentWaitingExternal`}[e])}var SC=`/status.json`,CC=`loopx-status-source-catalog-v1`,wC={id:`local`,kind:`local`,label:`本机`,readOnly:!1,statusUrl:SC};function TC(e,t){let n=xh(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 EC(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 DC(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=TC(n.statusUrl,t);if(!r||r.length>48||!(`url`in i))return null;let a=vx(n.hostAlias)?n.hostAlias.trim():void 0;return{...a?{hostAlias:a}:{},id:EC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url}}function OC(){return{schemaVersion:1,sources:[wC]}}function kC(e,t){try{let n=e.getItem(CC);if(!n)return OC();let r=JSON.parse(n);if(r.schemaVersion!==1||!Array.isArray(r.sources))return OC();let i=new Set([wC.statusUrl]);return{schemaVersion:1,sources:[wC,...r.sources.flatMap(e=>{let n=DC(e,t);return!n||i.has(n.statusUrl)?[]:(i.add(n.statusUrl),[n])})]}}catch{return OC()}}function AC(e,t){e.setItem(CC,JSON.stringify({schemaVersion:1,sources:t.sources.filter(e=>e.kind===`ssh_tunnel`)}))}function jC(e,t){let n=new Set(t.filter(vx).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 MC(e,t,n){let r=t.label.trim();if(!r)return{error:`请填写来源名称。`};if(r.length>48)return{error:`来源名称不能超过 48 个字符。`};let i=TC(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&&!vx(t.hostAlias))return{error:`请选择有效的 SSH Host。`};let a=t.hostAlias?.trim(),o={...a?{hostAlias:a}:{},id:EC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url};return{catalog:{...e,sources:[...e.sources,o]},source:o}}function NC(e,t){return{...e,sources:e.sources.filter(e=>e.kind===`local`||e.id!==t)}}function PC(e,t,n){if(!t.trim()||xh(t,n).source?.isRelative)return wC;let r=t.trim();try{r=new URL(r,n).toString()}catch{return null}return e.sources.find(e=>e.statusUrl===r)??null}function FC(e,t,n){return PC(e,t,n)||(xh(t,n).source?.isRelative?wC:{id:`temporary`,kind:`ssh_tunnel`,label:`临时来源`,readOnly:!0,statusUrl:t.trim()})}function IC(e,t,n,r){return FC(e,t??n,r)}var LC={delete:`删除`,deploy:`部署`,merge:`合并`,payment:`付款`,release:`发布`};function RC(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:`请求受保护操作:${LC[n.operation]} · ${n.target}`}}var zC=SC;async function BC(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 zp(await t.json())}function VC(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 HC(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??VC(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 UC(e){return(e??``).replace(/\s+/g,` `).trim()}function WC(e){let t=new Map;for(let n of e?.goals??[])t.set(n.goal_id,n);return t}function GC(e,t){return e===void 0||t===void 0?void 0:e+t}function KC(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 qC(e){return e?.items.find(e=>!e.done)}function JC(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 YC(e){return e?.queueItem?.project_asset?.quota?.state??e?.queueItem?.quota?.state??e?.goal.quota?.state??`waiting`}function XC(e,t,n){let r=[];for(let t of e){let e=KC(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 ZC(e){return e?.map(e=>({dataUrl:e.data_url,id:e.id,mimeType:e.mime_type,name:e.name,size:e.size}))}var QC=`loopx.personal-agent-selection.v1`;function $C(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(QC)??`{}`);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 ew={需修复:`danger`,等你:`warning`,等待条件:`info`,推进中:`success`,安静运行:`neutral`,已停止:`neutral`,已完成:`neutral`};function tw(e,t){return UC(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 nw(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 rw(e,t){return[`agent`,`assistant`].includes(e.trim().toLowerCase())&&t.trim().length>0}var iw=`已发现的项目 Agent`;function aw(e){switch(Vy(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 tw(e)}}function ow(e,t){switch(Hy(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 iw}}function sw(e,t){let n=e.project_asset;return t===`user`?JC(n?.user_todos,e.user_todos,`project_asset.user_todos`):JC(n?.agent_todos,e.agent_todos,`project_asset.agent_todos`)}function cw(e){return $d(e.title??e.text,112)}function lw(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 uw(e,t){let n=e.completion_validation_revision_history.at(-1);return{resumeWhen:e.resume_when??null,resumeReady:e.resume_ready??null,resumeReceiptId:lw(e),claimedBy:e.claimed_by??null,done:e.status!==`deferred`&&e.done,evidence:e.evidence?$d(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:cw(e),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.index}`,validationDigest:e.completion_validation_sha256??null,validationRevision:e.completion_validation_revision??null,validationRevisionActor:n?.actor_agent_id??null}}function dw(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 fw(e){return dw(e).map(t=>uw(t,e))}function pw(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=uw(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 mw(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:$d(e.title,112),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.claimed_by??`unknown`}:current`}}function hw(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=mw(t,n);r.has(i.todoId)||r.set(i.todoId,i)}return[...r.values()]}function gw(e){let t=e.queueItem?.project_asset?.agent_todos,n=e.queueItem?.agent_todos,r=dw(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=>uw(t,e)),l=r.find(e=>!e.done);return{doneTodoCount:o,nextTodoText:UC(t?.next??``)||(l?UC(l.title??``)||UC(l.text??``):``)||null,recentCompleted:c}}function _w(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 vw(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 yw(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 bw(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 xw(e,t){let n=t.queueItem?.stale_latest_run_warning;return t.severity===`high`||!!yw(e,t)||!!(n?.requires_refresh_state||n?.severity===`high`)||bw(t)}function Sw(e,t){let n=yw(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 Cw(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 ww(e,t){let n=e.latestRun?.operator_gate;return bC(n?.operator_question??n?.reason_summary??n?.follow_up??e.queueItem?.recommended_action??e.latestRun?.recommended_action,t,`projection.confirmAgentDecision`)}function Tw(e,t){if(t.goal.activation_state===`stopped`)return`已停止`;let n=KC(t,`user`),r=KC(t,`agent`),i=!!qC(n),a=!!qC(r);return[`user_or_controller`,`controller`].includes(t.waitingOn)||i||Cw(t)?`等你`:xw(e,t)?`需修复`:t.waitingOn===`external_evidence`?`等待条件`:YC(t)===`eligible`||a?`推进中`:vw(t)?`已完成`:`安静运行`}function Ew(e,t,n,r){if(n===`已停止`)return xC(`stopped`,r);if(n===`需修复`)return bC(Sw(e,t),r,`projection.statusRefreshNeeded`);if(n===`等你`)return xC(`needs_you`,r);if(n===`推进中`){let e=[(KC(t,`agent`)?.items??[]).filter(e=>!e.done).flatMap(e=>[e.title,e.text]).map(e=>UC(e)).find(e=>e!==``&&e!==`暂无`),t.queueItem?.recommended_action,t.latestRun?.recommended_action].map(e=>UC(e)).find(e=>e!==``&&e!==`暂无`);return e?bC(e,r,`projection.agentAdvancingGoal`):xC(`advancing`,r)}return xC(n===`等待条件`?`waiting_external`:`idle`,r)}function Dw(e,t){return t.some(t=>e.includes(t))}function Ow(e,t,n){if(t.goals.some(e=>e.activationState===`active`&&e.loadState))return{text:`Goal 状态尚未全部加载,暂不能给出完整统计。可先打开已加载的 Goal,失败项可重试。`,lines:[]};if(Dw(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(Dw(n,[`现在`,`下一步`,`我该`,`该做什么`,`优先处理`])){let e=t.userTodos[0];if(e)return{text:e.blocking?`先处理「${tw(e.goalId)}」:${e.text}`:`当前最先处理「${tw(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(Dw(n,[`等我`,`阻塞`,`需要我`,`全局待办`]))return t.userTodos.length===0?{text:`目前没有 Goal 在等你,开放用户待办为 0。`,lines:[]}:{text:`有 ${t.userTodos.length} 项开放用户待办,阻塞项优先:`,lines:t.userTodos.slice(0,3).map(e=>`${tw(e.goalId)} · ${e.blocking?`阻塞`:`待处理`} · ${e.text}`)};if(Dw(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 kw(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=WC(e.usage_summary),s=XC(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(sw(e,`user`)?.items??[]).map((r,i)=>({projectedDone:r.done,details:tf(r),actionKind:r.action_kind??null,blocking:n,goalId:e.goal_id,sourceOrder:t,taskClass:r.task_class??null,text:cw(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)||!Cw(t)?[]:[{details:tf({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:ww(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=Tw(e,a),l=f.find(e=>e.goalId===t.id),u=l?.text??null,d=gw(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=hw(fw(a),h,a),b=[d.nextTodoText,a.queueItem?.recommended_action,a.latestRun?.recommended_action,Ew(e,a,c,n)].map(e=>bC(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:Ew(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,hasRunObservation:!!(a.queueItem?.project_asset?.latest_validation||a.latestRun||e.event_ledger_summary?.goals.some(e=>e.goal_id===t.id)),state:c,...r?{subagentExecution:{allowedDomains:t.spawn_policy?.allowed_domains??[],domainCandidates:pw(e,a,y),enabled:t.spawn_policy?.mode===`multi_subagent`&&t.spawn_policy.spawn_allowed===!0&&t.spawn_policy.max_children>0,executionConfig:t.spawn_policy?.execution_config,maxChildren:t.spawn_policy?.max_children??0,modelConfig:t.spawn_policy?.model_config}}:{},title:tw(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:GC(e.input_tokens_24h,e.output_tokens_24h),tokens7d:GC(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?$d(e.current_todo.title,96):null,lastActivityAt:e.last_activity_at??null,state:e.state??null}))}}function Aw({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:_}=Ji(),[v,y]=(0,R.useState)([]),[b,x]=(0,R.useState)(!1),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),E=(0,R.useMemo)(()=>{let e=kw(c,u,_,b);if(!l)return e;let t=Object.values(l.snapshots).map(e=>kw(e,HC(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,_]),D=E.goals.find(e=>e.goalId===d)??null,O=l?.snapshots[d]??c,[k,A]=(0,R.useState)(null),[ee,j]=(0,R.useState)(null),[M,te]=(0,R.useState)(!1),ne=E.goals.some(e=>e.activationState===`active`&&e.loadState===`loading`)?`loading`:E.goals.map(e=>`${e.goalId}:${e.agentId}`).join(`|`),N=D?.goalId??`manager`;E.goals.some(e=>e.activationState===`active`&&e.loadState)||(E.systemHealth?!E.systemHealth.ok:!c.ok)||E.openUserTodoCount>0&&`${E.openUserTodoCount}${E.blockingTodoCount}`;let P=v.length>0?v.map(e=>({agentId:e.agent_id,adapterKind:e.adapter_kind,available:e.available,capability:ow(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:ow(`codex`),label:`Codex`,statusLabel:`正在检测`}],re=[...P,{agentId:`status-only`,available:!0,capability:`不调用模型`,adapterKind:`status_projection`,interrupt:!1,label:`仅查状态`,resume:!0,statusLabel:`只读`,streaming:!1,toolCalls:!1,trustScope:`read_only`}],ie=P.find(e=>e.label===`Codex`&&e.available)?.agentId??P.find(e=>e.available)?.agentId??`status-only`,ae=w?.executor_endpoint?.trim()??``,F=ae?P.find(e=>e.agentId===ae)?.agentId:void 0,oe=e=>e===`manager`?F??ie:ie,[I,se]=(0,R.useState)($C),L=Dh(re,I[N]??oe(N),ie),[ce,le]=(0,R.useState)(!1),[ue,de]=(0,R.useState)(!1),[fe,pe]=(0,R.useState)(`chat`),[me,he]=(0,R.useState)(``),[ge,_e]=(0,R.useState)({}),[ve,ye]=(0,R.useState)({}),[be,xe]=(0,R.useState)(null),[Se,Ce]=(0,R.useState)({}),[we,Te]=(0,R.useState)([]),[Ee,De]=(0,R.useState)(null),[Oe,ke]=(0,R.useState)({}),Ae=(0,R.useRef)(1),je=(0,R.useRef)(1),Me=(0,R.useRef)(new Map),Ne=(0,R.useRef)(new Set),Pe=(0,R.useRef)(new Map),Fe=(0,R.useRef)(new Map),Ie=(0,R.useRef)(new Set),Le=(0,R.useRef)(new Set),Re=(0,R.useRef)(null),B=(0,R.useRef)(null),ze=(0,R.useRef)(null),Be=(0,R.useRef)(null);(0,R.useRef)(null);let Ve=ge[N]??[];ve[N];let He=(e,t)=>e===`manager`?_(`header.manager`):t,Ue=D?E.userTodos.filter(e=>e.goalId===D.goalId):E.userTodos,We=D?.agentTodos??[];_w(We,D?.needsYou?3:4);let Ge=We.filter(e=>e.done).length,Ke=We.length>0?`${Ge}/${We.length}`:`暂无计划`;D&&({...E},Ue.filter(e=>e.blocking).length,Ue.length),(0,R.useEffect)(()=>{let e=bh(f.activeSource.statusUrl,window.location.href),t=e.source?wh(O,e.source):null;if(!D||!t?.indexUrl||!t.detailUrl){A(null),j(null),te(!1);return}let{detailUrl:n,indexUrl:r}=t,i=!1;return A(null),j(null),te(!0),Th(r,D.goalId).then(async e=>{let t=e.items[0]?.detail_ref;return t?Eh(n,t):null}).then(e=>{i||A(e)}).catch(e=>{i||j(Bp(e))}).finally(()=>{i||te(!1)}),()=>{i=!0}},[O,D?.goalId,f.activeSource.statusUrl]);let qe=Se[N]?.sessionId;(0,R.useEffect)(()=>{if(h||!qe)return;let e=!1,t,n=async()=>{try{let t=await cg(qe);if(e)return;let n=t.messages.filter(e=>e.origin===`manager_followup`);_e(e=>{let r=e[N]??[],i=new Set(r.map(e=>e.sourceMessageId)),a=n.filter(e=>!i.has(e.message_id)),o=new Map(n.map(e=>[e.message_id,e.return_delivery])),s=new Map(t.messages.filter(e=>e.role!==`user`&&e.origin!==`manager_followup`).map(e=>[e.turn_id,e])),c=new Map(t.messages.map(e=>[e.message_id,e.collaboration])),l=!1,u=r.map(e=>{let t=e.sourceMessageId?o.get(e.sourceMessageId):void 0,n=e.sourceTurnId?s.get(e.sourceTurnId):void 0,r=e.sourceMessageId?c.get(e.sourceMessageId):n?.collaboration;return JSON.stringify(t)===JSON.stringify(e.returnDelivery)&&JSON.stringify(r)===JSON.stringify(e.collaboration)?e:(l=!0,{...e,sourceMessageId:e.sourceMessageId??n?.message_id,returnDelivery:t,collaboration:r})});return!a.length&&!l?e:{...e,[N]:[...u,...a.map(e=>({id:Ae.current++,sourceMessageId:e.message_id,role:`assistant`,agentLabel:`协作回执`,sourceLabel:`协作回执`,text:nw(e.text),lines:[],returnDelivery:e.return_delivery}))]}})}catch{}finally{e||(t=setTimeout(n,3e3))}};return n(),()=>{e=!0,t&&clearTimeout(t)}},[h,qe,N,L.label]);function V(e,t){Ce(n=>{if(t===null){let t={...n};return delete t[e],t}return{...n,[e]:t}})}(0,R.useEffect)(()=>{if(h){y([]),x(!1),C(null),T(null);return}let e=!1;return ag().then(t=>{if(!e){y(t.adapters??[]);let e=t.manager?.runtime;T(t.manager?.channel_binding??null),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,R.useEffect)(()=>{try{window.localStorage.setItem(QC,JSON.stringify(I))}catch{}},[I]),(0,R.useEffect)(()=>{if(h||!L.available)return;let e=N,t=`${e}:${L.agentId}`,n=D?`goal`:`manager`,r=D?`goal.${D.goalId}`:`manager`,i=!1,a=null,o=null;return(async()=>{try{let s=await dg({agentId:n===`manager`?void 0:L.agentId,channelId:r,goalId:D?.goalId});if(i||(_e(t=>(t[e]?.length??0)>0?t:{...t,[e]:s.messages.map(t=>({sourceMessageId:t.message_id,agentLabel:t.role===`user`?void 0:t.origin===`manager_followup`?`协作回执`:He(e,L.label),attachments:ZC(t.attachments),id:Ae.current++,lines:[],role:t.role===`user`?`user`:`assistant`,returnDelivery:t.return_delivery,collaboration:t.collaboration,sourceLabel:t.role===`user`?void 0:t.role===`error`?`本地会话记录`:e===`manager`?`恢复的${_(`header.manager`)}会话`:`恢复的 ${L.label} 会话`,text:t.role===`user`?t.text:nw(t.text)}))}),L.agentId===`status-only`))return;let c=s.sessions[0];if(o=c?.session_id??null,c&&!c.resumable){Ne.current.add(t),V(e,{agentId:L.agentId,resumable:!1,sessionId:c.session_id,status:`resume_failed`});return}let l=n===`manager`?``:D?.goalId??``;if(n===`goal`&&!l)return;let u=await sg(l,n===`manager`?I[e]:L.agentId,`resume_latest`,n);if(i)return;n===`manager`&&u.session.manager_runtime&&C(u.session.manager_runtime),Me.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(V(e,{agentId:u.agent_id||L.agentId,resumable:!0,sessionId:u.session_id,status:f?`running`:`ready`,turnId:f||void 0}),Ne.current.delete(t),!f)return;let p=`${u.session_id}:${f}`;if(Le.current.has(p))return;Le.current.add(p),Pe.current.set(e,f),V(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`running`,turnId:f}),xe(e),a=new AbortController,Fe.current.set(e,a);let m=``,h=Je(e,{activity:[`正在恢复进行中的 Agent 回合`],agentLabel:He(e,L.label),lines:[],pending:!0,sourceLabel:e===`manager`?`恢复的${_(`header.manager`)}会话`:`恢复的 ${L.label} 会话`,text:``});try{let t=await Tg(u.session_id,f,{signal:a.signal,onDelta:t=>{m+=t,Ye(e,h,{text:m})},onActivity:t=>{_e(n=>({...n,[e]:(n[e]??[]).map(e=>e.id===h?{...e,activity:[...new Set([...e.activity??[],t])].slice(-6)}:e)}))}});if(i)return;Ye(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()||`${He(e,L.label)} 已完成分析。`});let n=E.goals.find(e=>e.goalId===d?.session.goal_id)??D??E.goals[0]??null;if(n&&t.response.proposals.length>0){let r=t.response.proposals.filter(Oh).map(e=>({goalId:n.goalId,id:je.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));r.length>0&&ye(t=>({...t,[e]:[...t[e]??[],...r]}))}}catch(t){if(i)return;Ye(e,h,{activity:[],lines:[],pending:!1,reconnect:t instanceof qh&&t.payload.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t instanceof Error?t.message:`无法恢复进行中的 Agent 回合。`})}finally{Le.current.delete(p),Pe.current.get(e)===f&&Pe.current.delete(e),V(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`ready`}),Fe.current.get(e)===a&&Fe.current.delete(e),i||xe(t=>t===e?null:t)}}catch(n){if(i)return;n instanceof qh&&n.payload.error_code===`resume_failed`&&(Ne.current.add(t),o&&V(e,{agentId:L.agentId,resumable:!1,sessionId:o,status:`resume_failed`}))}})(),()=>{i=!0,a?.abort()}},[N,E.goals[0]?.goalId,h,D?.goalId,L.agentId,L.available,L.label,I]),(0,R.useEffect)(()=>{if(h||D||E.goals.length===0||ne===`loading`)return;let e=!1;return Promise.all(E.goals.filter(e=>!e.loadState).map(async e=>{let t=await lg({agentId:e.agentId,channelId:`goal.${e.goalId}`,goalId:e.goalId});return{goalId:e.goalId,session:t.sessions[0]??null}})).then(t=>{e||Ce(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,ne,D?.goalId]),(0,R.useEffect)(()=>{if(De(null),h){Te([]),ke({});return}if(!D){Te([]),ke({});return}let e=!1,t=0,n=0;Te([]),ke({});let r=async()=>{if(!e){if(document.hidden){t=window.setTimeout(()=>void r(),1e4);return}try{let t=await lg({goalId:D.goalId});if(!e){let r=t.sessions.filter(e=>e.channel_id?.startsWith(`task.`));Te(r);let i=await Promise.allSettled(r.map(e=>cg(e.session_id)));if(!e){let e=i.some(e=>e.status===`rejected`);n=e?n+1:0,De(e?`partial`:null),ke(Object.fromEntries(i.flatMap((e,t)=>e.status===`fulfilled`?[[r[t].session_id,e.value]]:[])))}}}catch{n+=1,e||De(`offline`)}e||(t=window.setTimeout(()=>void r(),Math.min(3e4,2e3*2**Math.min(n,4))))}};return r(),()=>{e=!0,window.clearTimeout(t)}},[h,D?.goalId]),(0,R.useEffect)(()=>{if(!ce)return;let e=window.requestAnimationFrame(()=>{Re.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()});return()=>{window.cancelAnimationFrame(e),B.current?.focus()}},[ce]),(0,R.useEffect)(()=>{if(!ue)return;let e=window.requestAnimationFrame(()=>ze.current?.focus());return()=>{window.cancelAnimationFrame(e),Be.current?.focus()}},[ue]),(0,R.useEffect)(()=>{if(!ce&&!ue)return;let e=e=>{e.key===`Escape`&&(le(!1),de(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ce,ue]);function Je(e,t){let n=Ae.current++;return _e(r=>({...r,[e]:[...r[e]??[],{...t,id:n,role:`assistant`}]})),n}function Ye(e,t,n){_e(r=>({...r,[e]:(r[e]??[]).map(e=>e.id===t?{...e,...n}:e)}))}async function Xe(e,t){let n=`${e}:${t}`,r=Me.current.get(n);if(r)return r;let i=await sg(e,t,Ne.current.has(n)?`new`:`resume_latest`,`goal`);return Me.current.set(n,i.session_id),Ne.current.delete(n),V(e,{agentId:t,resumable:!0,sessionId:i.session_id,status:i.session.status}),i.session_id}async function Ze(e,t){let n=e.trim();if(!n)return;let r=t&&`goalId`in t?t.goalId??`manager`:N,i=r===`manager`?null:E.goals.find(e=>e.goalId===r)??null,a=t?.agentId?Dh(re,t.agentId,ie):L,o=r===`manager`?E:i?{...E,blockingTodoCount:E.userTodos.filter(e=>e.goalId===i.goalId&&e.blocking).length,goals:[i],openUserTodoCount:E.userTodos.filter(e=>e.goalId===i.goalId).length,userTodos:E.userTodos.filter(e=>e.goalId===i.goalId),visibleUserTodos:E.userTodos.filter(e=>e.goalId===i.goalId)}:E,s=Ae.current++;if(_e(e=>({...e,[r]:[...e[r]??[],{attachments:t?.attachments,id:s,lines:[],role:`user`,text:n}]})),he(``),xe(r),a.agentId===`status-only`||!i&&r!==`manager`){let e=Ow(O,o,n),t=a.agentId===`status-only`;Je(r,{agentLabel:t?`仅查状态`:`LoopX 管家`,lines:e.lines.slice(0,3),sourceLabel:t?`LoopX 状态投影 · 仅查状态`:`LoopX 状态投影`,text:e.text}),og({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(()=>{}),xe(null);return}let c=`${r}:${a.agentId}`,l=null;try{let e=r===`manager`?Me.current.get(c):await Xe(r,a.agentId);if(!e){let t=Ne.current.has(c)?`new`:`resume_latest`,n=r===`manager`?I[r]:a.agentId,o=await sg(r===`manager`?``:i.goalId,n,t,r===`manager`?`manager`:`goal`);r===`manager`&&o.session.manager_runtime&&C(o.session.manager_runtime),e=o.session_id,Me.current.set(c,e),V(r,{agentId:o.agent_id||a.agentId,resumable:!0,sessionId:e,status:`ready`}),Ne.current.delete(c)}let o=``;l=Je(r,{activity:[r===`manager`?`正在连接管家`:`正在连接 Agent`],agentLabel:He(r,a.label),lines:[],pending:!0,sourceLabel:r===`manager`?`${_(`header.manager`)} · 跨 Goal`:`${a.label} Agent · ${tw(i.goalId)}`,text:``});let s={attachments:t?.attachments,signal:(()=>{let e=new AbortController;return Fe.current.set(r,e),e.signal})(),onDelta:e=>{o+=e,l!==null&&Ye(r,l,{text:o})},onActivity:e=>{l!==null&&_e(t=>({...t,[r]:(t[r]??[]).map(t=>t.id===l?{...t,activity:[...new Set([...t.activity??[],e])].slice(-6)}:t)}))},onPhase:(t,n)=>{l!==null&&Ye(r,l,{sourceTurnId:n}),Pe.current.set(r,n),V(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`running`,turnId:n})}},u;if(t?.loopxMode){let n=await xg(e,t.loopxMode.operation,t.loopxMode.settings);if(!n.turn_id)throw Error(`LoopX execution returned no turn identity`);s.onPhase(`turn.accepted`,n.turn_id),u=await Tg(e,n.turn_id,s)}else u=await Cg(e,n,s);let d=u.response;Ye(r,l,{lines:d.gate?[d.gate.summary,d.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:nw(d.message||o.trim())||`${He(r,a.label)} 已完成分析。`});let f=d.proposals.filter(Oh);if(f.length>0&&!i&&Ye(r,l,{lines:[`请进入要修改的 Goal,预览并确认具体变更。`]}),f.length>0&&i){let e=f.map(e=>({goalId:i.goalId,id:je.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));ye(t=>({...t,[r]:[...t[r]??[],...e]}))}if(r!==`manager`&&d.protected_action){let e=RC(r,n,d.protected_action);if(e)return e}}catch(e){if(Ie.current.delete(r)||t?.loopxMode&&e instanceof qh&&e.payload.error_code===`turn_interrupted`){let e={agentLabel:He(r,a.label),lines:[],pending:!1,sourceLabel:r===`manager`?`${_(`header.manager`)}会话`:`${a.label} 会话`,text:`已中断。你可以在当前会话继续发送消息。`};l===null?Je(r,e):Ye(r,l,e);return}let n=e instanceof qh?e.payload:null;n&&Ah(n)&&Me.current.delete(c),n?.error_code===`resume_failed`&&(Me.current.delete(c),Ne.current.add(c),V(r,{agentId:a.agentId,resumable:!1,sessionId:Se[r]?.sessionId??`resume-failed`,status:`resume_failed`}));let i=n?.gate,o=i&&typeof i==`object`?String(i.summary??``):``,s={agentLabel:He(r,a.label),lines:o?[o]:[],pending:!1,reconnect:n?.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:n?.error_code===`resume_failed`?`原 ${He(r,a.label)} 会话无法恢复。本地历史已经保留,请在运行详情里选择“重试恢复”或“开始新 Session”。`:e instanceof Error?e.message:`${He(r,a.label)} 会话暂时不可用。`};l===null?Je(r,s):Ye(r,l,s)}finally{Pe.current.delete(r),Fe.current.delete(r);let e=Me.current.get(c);e&&V(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),xe(e=>e===r?null:e)}}async function Qe(e){let t=e?.goalId??N,n=Se[t],r=e?.agentId??n?.agentId??L.agentId,i=`${t}:${r}`,a=e?.sessionId??n?.sessionId??Me.current.get(i),o=e?.turnId??n?.turnId??Pe.current.get(t);if(!(!a||!o))try{Ie.current.add(t),await hg(a,o),Fe.current.get(t)?.abort()}catch(e){throw Ie.current.delete(t),e}finally{Pe.current.delete(t),V(t,{agentId:r,resumable:!0,sessionId:a,status:`ready`}),Fe.current.delete(t),xe(e=>e===t?null:e)}}async function $e(e){let t=e.goalId,n=`${t}:${e.agentId}`,r=e.sessionId??Se[t]?.sessionId??Me.current.get(n);if(r)try{let i=await Dg(r);Me.current.set(n,r),Ne.current.delete(n),V(t,{agentId:e.agentId,resumable:i.session.resumable,sessionId:r,status:i.session.status})}catch{V(t,{agentId:e.agentId,resumable:!1,sessionId:r,status:`resume_failed`})}}function et(e){let t=`${e.goalId}:${e.agentId}`;Me.current.delete(t),Ne.current.add(t),V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:`new-session-pending`,status:`ready`})}async function tt(e){let t=`${e.goalId}:${e.agentId}`,n=e.sessionId??Se[e.goalId]?.sessionId??Me.current.get(t);n&&n!==`new-session-pending`&&await Eg(n),Me.current.delete(t),Ne.current.add(t),V(e.goalId,null)}function nt(e){re.some(t=>t.agentId===e&&t.available)&&(se(t=>({...t,[N]:e})),le(!1))}function rt(){i(``),pe(`chat`)}function it(e){i(e),pe(`chat`)}D&&ew[D.state],D&&(`${L.label}${D.state}`,We.length>0&&`${Ke}`,Ue.length>0&&`${Ue.length}`),D?.state===`需修复`||!D&&!c.ok?(D&&aw(D.agentId),D?.nextSentence,D?.agentSentence):D?.state===`等你`?(D.needsYouBlocking,D.needsYouBlocking,D.needsYou??D.nextSentence,D.needsYou):(D&&aw(D.agentId),D?.nextSentence);let at=[...!D&&Se.manager?.status===`resume_failed`?[{id:`run:manager:resume-failed`,kind:`run`,run:{agentId:Se.manager.agentId,agentLabel:aw(Se.manager.agentId),canInterrupt:!1,completedSteps:0,goalId:`manager`,goalTitle:`LoopX 管家`,latestActivity:`本地聊天记录已保留,点我查看恢复方式。`,resumable:!1,runId:`manager:resume-failed`,sessionId:Se.manager.sessionId,sessionStatus:`resume_failed`,status:`failed`,title:`上次会话需要恢复`,totalSteps:1,outputs:[]}}]:[],...D?we.map(e=>{let t=e.channel_id?.startsWith(`task.`)?e.channel_id.slice(5):void 0,n=D.agentTodos.find(e=>e.todoId===t),r=!!e.active_turn_id,i=Oe[e.session_id],a=i?.messages.some(e=>rw(e.role,e.text))===!0;return{id:`run:task:${e.session_id}`,kind:`run`,run:{agentId:e.agent_id,agentLabel:aw(e.agent_id),canInterrupt:r,completedSteps:n?.done||a?1:0,goalId:D.goalId,goalTitle:D.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`:rw(e.role,e.text)?`assistant`:`error`,text:e.role===`user`?e.text:nw(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}}}):[],...D&&(Se[D.goalId]?.turnId||D.hasRunObservation||qd(D))?[{id:`run:${D.goalId}`,kind:`run`,run:{agentId:Se[D.goalId]?.agentId??D.agentId,agentLabel:aw(Se[D.goalId]?.agentId??D.agentId),canInterrupt:!!Se[D.goalId]?.turnId,completedSteps:D.agentTodos.filter(e=>e.done).length,goalId:D.goalId,goalTitle:D.title,latestActivity:D.agentSentence,resumable:Se[D.goalId]?.resumable??!0,runId:`goal:${D.goalId}`,sessionId:Se[D.goalId]?.sessionId,sessionStatus:Se[D.goalId]?.status,status:Se[D.goalId]?.turnId?`running`:D.state===`需修复`?`failed`:`waiting`,title:D.nextSentence,totalSteps:D.agentTodos.length||1,turnId:Se[D.goalId]?.turnId}}]:[],...Ve.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,collaboration:e.collaboration,role:e.role,text:e.text||(e.pending?`Agent 正在处理…`:e.lines.join(` +`))}})),...D&&k?[{id:`output:${D.goalId}:report:${k.publication.publication_id}`,kind:`output`,output:{agentId:k.agent_id,agentLabel:aw(k.agent_id),createdAt:k.publication.delivered_at,goalId:D.goalId,goalTitle:D.title,kind:`report`,outputId:k.publication.publication_id,report:{addedCount:k.delta.added_count,changedCount:k.delta.changed_count,deliveredAt:k.publication.delivered_at,generationId:k.generation_id,items:k.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:k.period_window.end_at,periodStartAt:k.period_window.start_at,predecessorPublicationId:k.publication.predecessor_publication_id,publicationId:k.publication.publication_id},safePreview:k.delta.items.map(e=>`${e.change_kind===`added`?`+`:`~`} ${e.title}\n${e.summary}`).join(` -`),summary:k.summary,title:k.title}}]:[]],ot=f.connectionState===`connected`,st=new Map(E.goals.map(e=>[e.goalId,e.title])),ct=e=>nf(e,f.activeSource.statusUrl,ot&&!l?.errors[e.goalId],st.get(e.goalId)),lt={...Gd(E),userTodos:E.userTodos.map(ct),attentionHistory:(E.attentionHistory??E.userTodos).map(ct),periodicReports:{error:ee,loading:M},timeline:at};return(0,z.jsxs)(`div`,{className:p===`dark`?`dark`:``,"data-testid":`personal-goal-home`,children:[Ee?(0,z.jsx)(`p`,{role:`status`,className:`m-0 bg-amber-50 px-4 py-2 text-sm text-amber-900`,children:_(Ee===`partial`?`runs.discoveryPartial`:`runs.discoveryOffline`)}):null,(0,z.jsx)(_C,{agents:re.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=>it(e.goalId),onCorrectRun:async(e,t)=>{if(!e.sessionId)throw Error(`这个 Run 还没有可纠偏的执行 Session。`);let n=await tg((await Qh({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(V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:r?`running`:`ready`,turnId:r}),r){Pe.current.set(e.goalId,r);let t=new AbortController;Fe.current.set(e.goalId,t);let n=``,i=Je(e.goalId,{activity:[`正在把纠偏送入原执行 Session`],agentLabel:e.agentLabel,lines:[],pending:!0,sourceLabel:`${e.agentLabel} · 执行 Session`,text:``});try{let a=await Tg(e.sessionId,r,{signal:t.signal,onDelta:t=>{n+=t,Ye(e.goalId,i,{text:n})}});Ye(e.goalId,i,{activity:[],pending:!1,text:rw(a.response.message||n.trim())||`${e.agentLabel} 已完成纠偏。`})}catch(t){let n=Ie.current.delete(e.goalId);Ye(e.goalId,i,{activity:[],pending:!1,text:n?`已中断。你可以在当前会话继续发送消息。`:t instanceof Error?t.message:`纠偏回合失败。`})}finally{Pe.current.delete(e.goalId),Fe.current.delete(e.goalId),V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:`ready`})}}},onCloseRunSession:tt,onInterruptRun:async e=>Qe(e),onOpenGoal:it,onOpenRunSession:async e=>{if(!e.sessionId)return;let t=e.sessionId,n=await cg(t);ke(e=>({...e,[t]:n})),it(e.goalId),_e(t=>({...t,[e.goalId]:n.messages.map(t=>({agentLabel:t.role===`user`?void 0:e.agentLabel,attachments:QC(t.attachments),id:Ae.current++,lines:[],role:t.role===`user`?`user`:`assistant`,sourceLabel:t.role===`user`?void 0:`${e.agentLabel} · 执行 Session`,text:t.role===`user`?t.text:rw(t.text)}))})),V(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=>it(e.goalId),...b?{onPreviewGoalSubagentConfiguration:async e=>{let t=await Ag(e);return{changed:t.changed,configuration:{allowedDomains:t.after.orchestration.allowed_domains,codexHostCapacity:{configuredChildren:t.codex_host_capacity.configured_children,newSessionRequired:t.codex_host_capacity.new_session_required,requiredChildren:t.codex_host_capacity.required_children,status:t.codex_host_capacity.status,writeRequired:t.codex_host_capacity.write_required,written:t.codex_host_capacity.written},enabled:t.feature_summary.multi_subagent===`enabled`,executionConfig:t.after.orchestration.execution_config,maxChildren:t.after.orchestration.max_children,modelConfig:t.after.orchestration.model_config},previewId:t.preview_id}},onApplyGoalSubagentConfiguration:async({previewId:e,...t})=>{let n=await jg(t,e);return{allowedDomains:n.after.orchestration.allowed_domains,codexHostCapacity:{configuredChildren:n.codex_host_capacity.configured_children,newSessionRequired:n.codex_host_capacity.new_session_required,requiredChildren:n.codex_host_capacity.required_children,status:n.codex_host_capacity.status,writeRequired:n.codex_host_capacity.write_required,written:n.codex_host_capacity.written},enabled:n.feature_summary.multi_subagent===`enabled`,executionConfig:n.after.orchestration.execution_config,maxChildren:n.after.orchestration.max_children,modelConfig:n.after.orchestration.model_config}}}:{},...g?{onExecuteGoalLifecycle:async({goalId:e,operation:t,reason:n})=>{let r=await Tx(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:$e,onSelectAgent:nt,onSelectGoal:e=>e?it(e):rt(),onSendMessage:async(e,t,n,r)=>Ze(e,{agentId:t,goalId:n,attachments:r}),onPrepareLoopX:(e,t)=>Xe(t,e),onStartLoopX:(e,t,n,r)=>{Ze(e===`start`?`开启 LoopX 模式,持续推进当前 Goal。`:`恢复 LoopX 模式。`,{agentId:t,goalId:n,loopxMode:{operation:e,settings:r}})},onStartNewRunSession:et},goalArchiveLoadState:e,managerChannelBinding:w,managerRuntime:S,conversationSessionId:Se[N]?.sessionId,model:lt,readOnly:h,selectedAgentId:L.agentId,selectedGoalId:D?.goalId??null,statusSourceControl:f})]})}function Pw({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,z.jsx)(`div`,{className:i===`dark`?`dark`:``,children:(0,z.jsxs)(`main`,{className:`min-h-screen bg-[#f6f7f9] text-slate-950 dark:bg-[#09090b] dark:text-zinc-50`,children:[(0,z.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,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:`LoopX Workspace`}),(0,z.jsx)(`p`,{className:`mt-1 break-all text-sm text-slate-500 dark:text-zinc-400`,children:`Personal Workspace`})]}),(0,z.jsx)(Iy,{"aria-label":`切换主题`,onClick:a,size:`icon`,variant:`secondary`,children:i===`dark`?(0,z.jsx)(uh,{className:`h-4 w-4`}):(0,z.jsx)(Gm,{className:`h-4 w-4`})})]}),(0,z.jsxs)(`div`,{className:`grid min-h-[calc(100vh-80px)] sm:grid-cols-[240px_1fr]`,children:[(0,z.jsxs)(`aside`,{className:`hidden border-r border-slate-200 p-6 dark:border-zinc-800 sm:block`,"aria-label":`Workspace`,children:[(0,z.jsx)(`strong`,{children:`LoopX`}),(0,z.jsx)(`p`,{className:`mt-6 text-sm`,children:`Workspace`}),(0,z.jsx)(`p`,{className:`mt-8 text-xs text-slate-500`,children:`Goals`}),[1,2,3].map(e=>(0,z.jsx)(`div`,{className:`mt-4 h-8 rounded bg-slate-100 dark:bg-zinc-900`},e))]}),(0,z.jsx)(`div`,{className:`p-4 sm:p-8`,children:(0,z.jsx)(Ly,{"data-testid":`initial-status-state`,children:(0,z.jsx)(Ry,{className:`flex min-h-64 items-center justify-center p-6`,children:(0,z.jsxs)(`div`,{className:`max-w-xl text-center`,children:[e?(0,z.jsx)(ym,{className:`mx-auto h-6 w-6 text-rose-600 dark:text-rose-300`}):(0,z.jsx)(Qm,{className:`mx-auto h-6 w-6 animate-spin text-slate-500 dark:text-zinc-400`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e?`无法加载实时状态`:`正在加载实时状态`}),e?(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-slate-400 dark:text-zinc-500`,children:`重新加载不会执行任务,也不会改变 Goal 配置。`}):null,(0,z.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:(0,z.jsxs)(Iy,{disabled:t,onClick:n,children:[(0,z.jsx)(Qm,{className:`h-4 w-4`}),`重试`]})})]}):(0,z.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 Fw(){let e=MT.useSearch(),t=MT.useNavigate(),[n,r]=(0,R.useState)(`light`),[i,a]=(0,R.useState)(null),o=(0,R.useRef)(null),s=(0,R.useRef)(e.goalId);s.current=e.goalId;let[c,l]=(0,R.useState)(Vp),[u,d]=(0,R.useState)({kind:`example`,label:`bundled example`}),[f,p]=(0,R.useState)(()=>AC(window.localStorage,window.location.href)),m=(0,R.useRef)(f);m.current=f;let[h,g]=(0,R.useState)(e.statusUrl),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)({error:null,phase:`idle`}),[C,w]=(0,R.useState)(e.statusUrl.trim()||null),[T,E]=(0,R.useState)(!1),D=(0,R.useRef)(null),O=(0,R.useRef)(k_(e.statusUrl.trim()||null)),k=!T&&u.kind===`example`?e.statusUrl.trim():``,A=C??k,ee=u.kind===`url`?u.label:BC,j=!!(_&&C),M=LC(f,C,ee,window.location.href),te=u.kind===`example`&&!T,ne=c.attention_queue,N=c.run_history,P=(0,R.useMemo)(()=>UC(N.goals,ne.items),[N.goals,ne.items]);function re(e,t,n=0){S({error:null,phase:`loading`}),VC(Sh(e,`stopped`,window.location.href)).then(r=>{if(!N_(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=>nv(e,r)),a&&n<1){F(e,{background:!0,resyncAttempt:n+1});return}S(a?{error:`Goal 状态在加载历史时发生变化,请重试。`,phase:`error`}:{error:null,phase:`ready`})}).catch(e=>{N_(O.current,t)&&S({error:Bp(e),phase:`error`})})}function ie(){let e=u.kind===`url`?u.label:h||BC,t=j_(O.current,e,{background:!0});if(i){F(e);return}t&&re(e,t)}async function ae(e,n,r){if(r.background)return l(e=>nv(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})}),M_(O.current,r)?(O.current.requestedUrl=null,w(null),!0):!1}async function F(e,t={}){let n=e.trim(),r=t.background===!0;if(!n){r||v(`状态地址不能为空`);return}let c=j_(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 Gp(n,window.location.href).catch(()=>null);if(!N_(O.current,c))return;if(e){let o=(t.retryOnly||t.reuseSnapshots)&&u.kind===`url`&&u.label===n?Up(i,e,{invalidateGoalIds:t.invalidateGoalIds}):{};a({directory:e,snapshots:o,errors:{}});let f={...e,goals:e.goals.filter(e=>!o[e.id])},p=!1,m=Kp(e);if(r)l(m);else if(!await ae(n,m,c))return;if(S({error:null,phase:`loading`}),await Jp(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})},()=>N_(O.current,c),()=>s.current,d.signal),p&&(t.resyncAttempt??0)<1&&N_(O.current,c)){await F(n,{resyncAttempt:1});return}N_(O.current,c)&&S({error:null,phase:`ready`});return}let o=await VC(Sh(n,`active`,window.location.href));if(!N_(O.current,c)||(a(null),c.registryRevision=o.goal_projection?.registry_revision??null,!await ae(n,o,c)))return;if(o.goal_projection?.scope!==`active`||o.goal_projection.complete){S({error:null,phase:`ready`});return}re(n,c,t.resyncAttempt??0)}catch(e){if(!M_(O.current,c))return;r||v(Bp(e))}finally{!r&&M_(O.current,c)&&b(!1)}}function oe(e,t={}){o.current?.abort();let n=A_(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 wx(e.label,t)}catch{}}O.current.selectionRevision===n&&await F(e.statusUrl,{selectionRevision:n})})()}function I(e){m.current=e,p(e);try{jC(window.localStorage,e)}catch{}}let se={activeSource:M,connectionState:y?`loading`:j?`error`:`connected`,errorMessage:j?`未切换到 ${C??`所选来源`}:${_}`:null,onAdd:e=>{let t=NC(f,e,window.location.href);return`error`in t?{error:t.error}:(I(t.catalog),oe(t.source,{ensureTunnel:e.ensureTunnel}),{})},onConfiguredHostsLoaded:e=>{let t=m.current,n=MC(t,e);n!==t&&I(n)},onRemove:e=>{I(PC(f,e)),M.id===e&&oe(TC)},onSelect:e=>{let t=f.sources.find(t=>t.id===e);t&&oe(t,{ensureTunnel:t.kind===`ssh_tunnel`})},sources:M.id===`temporary`?[...f.sources,M]:f.sources};(0,R.useEffect)(()=>{let t=e.statusUrl.trim();if(t){if(D.current===t||C&&C!==t)return;(u.kind!==`url`||u.label!==t)&&F(t);return}D.current=null,!T&&(C||u.kind===`example`&&F(BC))},[T,C,e.statusUrl,u.kind,u.label]),(0,R.useEffect)(()=>{if(e.statusUrl&&u.kind===`example`)return;let n=new Set(P.map(e=>e.goal.id));if(P.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,P,t,e.goalId,e.statusUrl,u.kind]),(0,R.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]&&F(u.label,{retryOnly:!0})},[e.goalId,y,i,u]);function L(e){t({search:t=>({...t,goalId:e})})}return te?(0,z.jsx)(Pw,{error:_,isLoading:y,onRetry:()=>void F(A||BC),requestedUrl:A||BC,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)}):(0,z.jsx)(Nw,{goalArchiveLoadState:x,isLoading:y,onGoalActivationStateChange:(e,t)=>{O.current.projectionRevision+=1,l(n=>Lp(n,e,t)),a(n=>n&&{...n,snapshots:Object.fromEntries(Object.entries(n.snapshots).map(([n,r])=>[n,Lp(r,e,t)]))})},onGoalDeleted:e=>{O.current.projectionRevision+=1,l(t=>Rp(t,e)),a(t=>t&&{...t,snapshots:Object.fromEntries(Object.entries(t.snapshots).filter(([t])=>t!==e))})},onSelectGoal:L,onReconcileStatus:e=>F(u.kind===`url`?u.label:h||BC,{background:!0,invalidateGoalIds:e?.invalidateGoalIds,reuseSnapshots:!0}),onRetryGoalArchive:ie,onRefresh:()=>F(u.kind===`url`?u.label:h||BC,{retryOnly:!!(i&&Object.keys(i.errors).length)}),payload:c,progress:i,rows:P,selectedGoalId:e.goalId,statusSourceControl:se,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)})}var Iw=sv(`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 Lw({className:e,variant:t,...n}){return(0,z.jsx)(`span`,{className:Py(Iw({variant:t}),e),...n})}var Rw=[{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`}],zw=[{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`}],Bw=[{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.`}],Vw=[`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`],Hw=[{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 Uw({children:e,icon:t,title:n}){return(0,z.jsxs)(`section`,{className:`rounded-lg border border-slate-200 bg-white shadow-sm`,children:[(0,z.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,z.jsx)(t,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function Ww(){return(0,z.jsx)(Uw,{icon:pm,title:`Status Contract Explorer`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,"data-testid":`developer-contract-explorer`,children:Rw.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(Lw,{variant:`info`,children:e.label}),(0,z.jsx)(Lw,{variant:`neutral`,children:`public contract`})]}),(0,z.jsx)(`div`,{className:`mt-2 break-words font-mono text-xs text-slate-700`,children:e.source}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.detail})]},e.label))})})}function Gw(){return(0,z.jsx)(Uw,{icon:Nm,title:`Projection Diffing`,children:(0,z.jsx)(`div`,{className:`overflow-x-auto`,"data-testid":`developer-projection-diffing`,children:(0,z.jsxs)(`table`,{className:`min-w-full border-separate border-spacing-0 text-left text-sm`,children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{className:`bg-slate-50 text-xs uppercase tracking-normal text-slate-500`,children:[(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Axis`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Current`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Proposed`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Gate`})]})}),(0,z.jsx)(`tbody`,{children:zw.map(e=>(0,z.jsxs)(`tr`,{className:`align-top`,children:[(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 font-semibold text-slate-950`,children:e.axis}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.current}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.proposed}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.gate})]},e.axis))})]})})})}function Kw(){return(0,z.jsx)(Uw,{icon:km,title:`Fixture Generation`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-fixture-generation`,children:Bw.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:e.title}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.title))})})}function qw(){return(0,z.jsx)(Uw,{icon:xm,title:`Smoke Checklist`,children:(0,z.jsx)(`div`,{className:`space-y-2 p-4`,"data-testid":`developer-smoke-checklist`,children:Vw.map(e=>(0,z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(um,{className:`mt-0.5 h-4 w-4 shrink-0 text-emerald-600`}),(0,z.jsx)(`code`,{className:`break-all text-xs font-semibold leading-5 text-slate-700`,children:e})]},e))})})}function Jw(){return(0,z.jsx)(Uw,{icon:Sm,title:`Component Examples`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-3`,"data-testid":`developer-component-examples`,children:Hw.map(e=>(0,z.jsxs)(`article`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.badges.map(e=>(0,z.jsx)(Lw,{variant:e===`read-only`||e===`public-safe`?`success`:`neutral`,children:e},e))}),(0,z.jsx)(`h3`,{className:`mt-3 text-sm font-semibold leading-6 text-slate-950`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.name))})})}function Yw(){return(0,z.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,z.jsxs)(`div`,{className:`mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,z.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,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.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,z.jsx)(dh,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold`,children:`Developer Cockpit`}),(0,z.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Projection extension`})]})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://loopx-project.github.io/loopx/`,children:[(0,z.jsx)(Lm,{className:`h-4 w-4`}),`LoopX home`]}),(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://loopx-project.github.io/loopx/docs/showcases/index.en.html`,children:[(0,z.jsx)(Dm,{className:`h-4 w-4`}),`Public cases`]}),(0,z.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,z.jsx)(Sm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,z.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,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(Lw,{variant:`success`,children:`read-only`}),(0,z.jsx)(Lw,{variant:`neutral`,children:`public fixtures`})]}),(0,z.jsx)(`p`,{children:`This route uses static public contracts only; live status feeds, registry files, and browser write APIs stay outside the cockpit.`})]})]}),(0,z.jsxs)(`section`,{className:`space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(Lw,{variant:`info`,children:`developers/projections`}),(0,z.jsx)(Lw,{variant:`success`,children:`public-safe`}),(0,z.jsx)(Lw,{variant:`neutral`,children:`no browser writes`})]}),(0,z.jsx)(`h1`,{className:`mt-3 text-3xl font-semibold tracking-normal text-slate-950`,children:`LoopX Projection Developer Cockpit`}),(0,z.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,z.jsxs)(`div`,{className:`grid min-w-[260px] gap-2 text-sm`,children:[(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Source of truth`}),(0,z.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`status contract + compact fixtures`})]}),(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Boundary`}),(0,z.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`read-only extension surface`})]})]})]})}),(0,z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,z.jsx)(Ww,{}),(0,z.jsx)(Gw,{})]}),(0,z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,z.jsx)(Kw,{}),(0,z.jsx)(qw,{})]}),(0,z.jsx)(Jw,{}),(0,z.jsx)(Uw,{icon:oh,title:`Extension Boundary`,children:(0,z.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-extension-boundary`,children:[(0,z.jsxs)(`div`,{className:`rounded-md border border-emerald-200 bg-emerald-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Allowed`}),(0,z.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,z.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Review`}),(0,z.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,z.jsxs)(`div`,{className:`rounded-md border border-rose-200 bg-rose-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Stop`}),(0,z.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 Xw=J({value:G().finite(),total:G().finite().positive().optional(),unit:W().optional(),higher_is_better:K()}).passthrough(),Zw=yd(W(),G().finite()).default({}),Qw=J({outcome_status:W().optional(),failure_class:W(),causal_summary:W(),expectedness:W(),implication:W(),next_probe:W(),confidence:W(),evidence_refs:q(W()).optional()}).passthrough(),$w=J({arm_id:W(),selected_run_id:W().nullable(),score_countable:K(),metrics:yd(W(),Xw),effort:Zw,insight:Qw.nullable().optional()}),eT=J({run_id:W(),case_id:W(),arm_id:W(),arm_role:W(),status:W(),protocol_id:W(),runner_revision:W().optional(),observed_at:W(),metrics:yd(W(),Xw),countability:J({integrity_qualified:K(),official_result_present:K(),score_countable:K()}).passthrough(),treatment_fidelity:W(),effort:Zw,redacted_insight:Qw.nullable().optional(),upload_provenance:J({producer_id:W(),producer_version:W(),observed_at:W(),source_revision:W()}).passthrough()}).passthrough(),tT=J({case_denominator:G().int().nonnegative(),value_sum:G().finite(),value_mean:G().finite().nullable(),value_median:G().finite().nullable(),value_min:G().finite().nullable(),value_max:G().finite().nullable(),case_macro_rate:G().finite().optional(),suite_micro_rate:G().finite().optional(),suite_micro_numerator:G().finite().optional(),suite_micro_denominator:G().finite().positive().optional()}).passthrough(),nT=J({arm_id:W(),arm_role:W(),factor_assignments:yd(W(),W()),protocol_counts:yd(W(),G().int().nonnegative()).default({}),runner_revision_counts:yd(W(),G().int().nonnegative()).default({}),orchestrator_runtime_counts:yd(W(),G().int().nonnegative()).default({}),intended_case_count:G().int().positive(),run_count:G().int().nonnegative(),terminal_run_count:G().int().nonnegative(),selected_score_countable_case_count:G().int().nonnegative(),coverage_rate:G().finite().min(0).max(1),metrics:yd(W(),tT),binary_outcomes:yd(W(),J({success_count:G().int().nonnegative(),case_denominator:G().int().nonnegative(),success_rate:G().finite().min(0).max(1).nullable()})),effort:yd(W(),J({denominator:G().int().nonnegative(),mean:G().finite().nullable(),median:G().finite().nullable()})),failure_class_counts:yd(W(),G().int().nonnegative())}).passthrough(),rT=J({baseline_value:G().finite(),candidate_value:G().finite(),delta:G().finite(),direction:Y([`improved`,`flat`,`regressed`]).optional()}).passthrough(),iT=J({comparison_id:W(),comparison_anchor_run_id:W(),candidate_run_id:W(),candidate_arm_id:W(),primary_metric:W(),matched_pair_countable:X(!0),metric_deltas:yd(W(),rT)}).passthrough(),aT=J({ok:X(!0),schema_version:X(`benchmark_study_dashboard_v0`),benchmark_id:W(),study_id:W(),status:Y([`complete`,`provisional`]),design:J({protocol_id:W(),comparison_protocol_id:W(),baseline_arm_id:W(),case_set:J({case_set_id:W(),case_ids:q(W())}),metric_catalog:q(J({metric_name:W(),role:Y([`primary`,`guardrail`,`supporting`]),unit:W().optional(),higher_is_better:K(),binary:K()})),labels:yd(W(),W())}).passthrough(),campaign:J({intended_case_count:G().int().positive(),intended_arm_count:G().int().positive(),intended_cell_denominator:G().int().positive(),selected_score_countable_cell_count:G().int().nonnegative(),selected_score_countable_coverage_rate:G().finite().min(0).max(1),complete_declared_design_case_count:G().int().nonnegative(),ambiguous_score_countable_cell_count:G().int().nonnegative(),in_flight_run_count:G().int().nonnegative(),matched_pair_countable_count:G().int().nonnegative(),factorial_contrast_count:G().int().nonnegative(),factorial_contrast_countable_count:G().int().nonnegative(),runtime_observation_count:G().int().nonnegative(),runtime_classification_counts:yd(W(),G().int().nonnegative())}),arms:q(nT),contrasts:yd(W(),J({matched_pair_denominator:G().int().nonnegative(),primary_metric_directions:J({improved:G().int().nonnegative(),flat:G().int().nonnegative(),regressed:G().int().nonnegative()}),binary_metric_transitions:yd(W(),J({"0_to_1":G().int().nonnegative(),"1_to_0":G().int().nonnegative(),same:G().int().nonnegative()}))})),cases:q(J({case_id:W(),complete_declared_design:K(),arms:q($w),eligible_comparisons:q(iT),largest_eligible_primary_contrast:iT.nullable()})),runs:q(eT),authority:J({score_source:W(),matched_comparison_source:W(),factorial_comparison_source:W().nullable(),manifest_changes_scores:X(!1),dashboard_is_execution_authority:X(!1)}),public_boundary:J({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 oT(e){return aT.parse(e)}function sT(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 cT=[{id:`campaign`,label:`Campaign`},{id:`arms`,label:`Arms`},{id:`cases`,label:`Cases`},{id:`runs`,label:`Runs`}];function lT(e){return e==null?`—`:`${(e*100).toFixed(e>=.995?0:1)}%`}function uT(e){return e==null?`—`:new Intl.NumberFormat(`en`,{maximumFractionDigits:2,notation:`compact`}).format(e)}function dT(e){if(e==null)return`—`;let t=e/6e4;return t>=120?`${(t/60).toFixed(1)} h`:`${uT(t)} min`}function fT(e){let t=Object.entries(e);return t.length?t.map(([e,t])=>`${e} (${t})`).join(`, `):`—`}function pT(e){if(!e)return`—`;let t=e.total==null?uT(e.value):`${uT(e.value)}/${uT(e.total)}`;return e.unit?`${t} ${e.unit}`:t}function mT(e,t){let n=e.metrics[t];return!n||n.case_denominator===0?`—`:n.suite_micro_rate==null?`${uT(n.value_mean)} mean`:`${lT(n.suite_micro_rate)} · ${uT(n.suite_micro_numerator)}/${uT(n.suite_micro_denominator)}`}function hT(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}${uT(r.delta)}`}}function gT({children:e,tone:t=`neutral`}){return(0,z.jsx)(`span`,{className:`benchmark-state benchmark-state-${t}`,children:e})}function _T({packet:e,primaryMetric:t}){return(0,z.jsxs)(`div`,{className:`benchmark-view-stack`,children:[(0,z.jsxs)(`section`,{"aria-labelledby":`arm-summary-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`ARM SUMMARY`}),(0,z.jsx)(`h2`,{id:`arm-summary-title`,children:`Comparable outcomes, denominator first`})]}),(0,z.jsx)(`p`,{children:`Only one score-countable run per declared case × arm cell is selected.`})]}),(0,z.jsx)(`div`,{className:`benchmark-arm-grid`,children:e.arms.map(e=>{let n=Object.values(e.binary_outcomes)[0];return(0,z.jsxs)(`article`,{className:`benchmark-arm-card`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:e.arm_role}),(0,z.jsx)(`h3`,{children:e.arm_id})]}),(0,z.jsx)(gT,{tone:e.coverage_rate===1?`success`:`warning`,children:e.coverage_rate===1?`Complete`:`Provisional`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`dt`,{children:[`Primary · `,t]}),(0,z.jsx)(`dd`,{children:mT(e,t)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Score-countable coverage`}),(0,z.jsxs)(`dd`,{children:[e.selected_score_countable_case_count,`/`,e.intended_case_count]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Binary success`}),(0,z.jsx)(`dd`,{children:n?`${n.success_count}/${n.case_denominator}`:`Not declared`})]})]})]},e.arm_id)})})]}),(0,z.jsxs)(`section`,{"aria-labelledby":`contrast-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`MATCHED CONTRASTS`}),(0,z.jsx)(`h2`,{id:`contrast-title`,children:`Direction counts on eligible pairs`})]}),(0,z.jsx)(`p`,{children:`Raw run volume is never used as a comparison denominator.`})]}),(0,z.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Candidate arm`}),(0,z.jsx)(`th`,{children:`Matched denominator`}),(0,z.jsx)(`th`,{children:`Improved`}),(0,z.jsx)(`th`,{children:`Flat`}),(0,z.jsx)(`th`,{children:`Regressed`}),(0,z.jsx)(`th`,{children:`Binary transitions`})]})}),(0,z.jsxs)(`tbody`,{children:[Object.entries(e.contrasts).map(([e,t])=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`strong`,{children:e})}),(0,z.jsx)(`td`,{children:t.matched_pair_denominator}),(0,z.jsx)(`td`,{className:`benchmark-positive`,children:t.primary_metric_directions.improved}),(0,z.jsx)(`td`,{children:t.primary_metric_directions.flat}),(0,z.jsx)(`td`,{className:`benchmark-negative`,children:t.primary_metric_directions.regressed}),(0,z.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,z.jsx)(`tr`,{children:(0,z.jsx)(`td`,{colSpan:6,children:`No matched comparisons are countable yet.`})})]})]})})]}),(0,z.jsxs)(`section`,{"aria-labelledby":`runtime-health-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`RUNTIME HEALTH`}),(0,z.jsx)(`h2`,{id:`runtime-health-title`,children:`Qualified observations, without execution authority`})]}),(0,z.jsxs)(`p`,{children:[e.campaign.runtime_observation_count,` public-safe runtime observations.`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-runtime-list`,children:[Object.entries(e.campaign.runtime_classification_counts).map(([e,t])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:e}),(0,z.jsx)(`strong`,{children:t})]},e)),e.campaign.runtime_observation_count===0&&(0,z.jsx)(`p`,{className:`benchmark-muted`,children:`No runtime observations uploaded.`})]})]})]})}function vT({packet:e}){return(0,z.jsx)(`div`,{className:`benchmark-detail-grid`,children:e.arms.map(t=>(0,z.jsxs)(`article`,{className:`benchmark-detail-card`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:t.arm_role}),(0,z.jsx)(`h2`,{children:t.arm_id})]}),(0,z.jsxs)(gT,{tone:t.coverage_rate===1?`success`:`warning`,children:[t.selected_score_countable_case_count,`/`,t.intended_case_count,` countable`]})]}),(0,z.jsx)(`div`,{className:`benchmark-factor-row`,children:Object.entries(t.factor_assignments).map(([e,t])=>(0,z.jsxs)(`span`,{children:[e,`: `,(0,z.jsx)(`strong`,{children:t})]},e))}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[e.design.metric_catalog.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`dt`,{children:[e.role,` · `,e.metric_name]}),(0,z.jsx)(`dd`,{children:mT(t,e.metric_name)})]},e.metric_name)),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runs terminal / observed`}),(0,z.jsxs)(`dd`,{children:[t.terminal_run_count,`/`,t.run_count]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Median duration`}),(0,z.jsx)(`dd`,{children:dT(t.effort.duration_ms?.median)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocols`}),(0,z.jsx)(`dd`,{children:fT(t.protocol_counts)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runner revisions`}),(0,z.jsx)(`dd`,{children:fT(t.runner_revision_counts)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Orchestrator runtimes`}),(0,z.jsxs)(`dd`,{children:[Object.keys(t.orchestrator_runtime_counts).length||0,` distinct`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Failure classes`}),(0,z.jsx)(`dd`,{children:fT(t.failure_class_counts)})]})]})]},t.arm_id))})}function yT({packet:e,primaryMetric:t,onOpenRun:n}){return(0,z.jsx)(`div`,{className:`benchmark-table-shell benchmark-wide-table`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Case`}),(0,z.jsx)(`th`,{children:`Design status`}),(0,z.jsx)(`th`,{children:`Largest eligible delta`}),e.arms.map(e=>(0,z.jsx)(`th`,{children:e.arm_id},e.arm_id))]})}),(0,z.jsx)(`tbody`,{children:e.cases.map(r=>{let i=hT(r,t);return(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`strong`,{children:r.case_id})}),(0,z.jsx)(`td`,{children:(0,z.jsx)(gT,{tone:r.complete_declared_design?`success`:`warning`,children:r.complete_declared_design?`Complete`:`Provisional`})}),(0,z.jsx)(`td`,{className:i?.direction===`improved`?`benchmark-positive`:i?.direction===`regressed`?`benchmark-negative`:void 0,children:i?.text??`—`}),r.arms.map(r=>(0,z.jsx)(`td`,{children:r.selected_run_id&&r.score_countable?(0,z.jsxs)(`button`,{className:`benchmark-cell-link`,onClick:()=>n(r.selected_run_id),type:`button`,children:[(0,z.jsxs)(`span`,{children:[t,`: `,pT(r.metrics[t])]}),e.design.metric_catalog.filter(e=>e.metric_name!==t).map(e=>(0,z.jsxs)(`small`,{className:`benchmark-cell-metric`,children:[e.metric_name,`: `,pT(r.metrics[e.metric_name])]},e.metric_name)),(0,z.jsxs)(`small`,{children:[`Countable · `,dT(r.effort.duration_ms),` `,(0,z.jsx)(sm,{"aria-hidden":`true`,size:12})]}),r.insight&&(0,z.jsxs)(`small`,{children:[r.insight.failure_class,` · `,r.insight.confidence]})]}):(0,z.jsx)(`span`,{className:`benchmark-muted`,children:`Not countable`})},r.arm_id))]},r.case_id)})})]})})}function bT({run:e,packet:t}){return(0,z.jsxs)(`aside`,{"aria-label":`Run detail for ${e.run_id}`,className:`benchmark-run-detail`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:`RUN DETAIL`}),(0,z.jsx)(`h2`,{children:e.run_id})]}),(0,z.jsx)(gT,{tone:e.countability.score_countable?`success`:`warning`,children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list benchmark-run-facts`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Case / arm`}),(0,z.jsxs)(`dd`,{children:[e.case_id,` · `,e.arm_id]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Lifecycle`}),(0,z.jsxs)(`dd`,{children:[e.status,` · `,e.observed_at]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocol`}),(0,z.jsx)(`dd`,{children:e.protocol_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Qualification`}),(0,z.jsxs)(`dd`,{children:[`Integrity `,e.countability.integrity_qualified?`qualified`:`not qualified`,` · result `,e.countability.official_result_present?`present`:`missing`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Treatment fidelity`}),(0,z.jsx)(`dd`,{children:e.treatment_fidelity})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Effort`}),(0,z.jsxs)(`dd`,{children:[dT(e.effort.duration_ms),` · `,uT(e.effort.agent_steps),` steps · `,uT(e.effort.token_count),` tokens`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runner revision`}),(0,z.jsx)(`dd`,{children:e.runner_revision??`—`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Upload provenance`}),(0,z.jsxs)(`dd`,{children:[e.upload_provenance.producer_id,` · `,e.upload_provenance.source_revision]})]})]}),(0,z.jsx)(`div`,{className:`benchmark-run-metrics`,children:t.design.metric_catalog.map(t=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:t.metric_name}),(0,z.jsx)(`strong`,{children:pT(e.metrics[t.metric_name])})]},t.metric_name))}),e.redacted_insight&&(0,z.jsxs)(`div`,{className:`benchmark-insight`,children:[(0,z.jsxs)(`span`,{className:`benchmark-mono`,children:[`REDACTED CASE INSIGHT · `,e.redacted_insight.confidence]}),(0,z.jsx)(`p`,{children:e.redacted_insight.causal_summary}),(0,z.jsxs)(`small`,{children:[`Implication: `,e.redacted_insight.implication]}),(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[`Next probe: `,e.redacted_insight.next_probe]}),!!e.redacted_insight.evidence_refs?.length&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[`Evidence: `,e.redacted_insight.evidence_refs.join(`, `)]})]})]})]})}function xT({packet:e,selectedRunId:t,onSelectRun:n}){let r=e.runs.find(e=>e.run_id===t)??e.runs[0];return(0,z.jsxs)(`div`,{className:`benchmark-runs-layout`,children:[(0,z.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Run`}),(0,z.jsx)(`th`,{children:`Case`}),(0,z.jsx)(`th`,{children:`Arm`}),(0,z.jsx)(`th`,{children:`Status`}),(0,z.jsx)(`th`,{children:`Countability`})]})}),(0,z.jsx)(`tbody`,{children:e.runs.map(e=>(0,z.jsxs)(`tr`,{"aria-selected":e.run_id===r?.run_id,children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`button`,{className:`benchmark-run-link`,onClick:()=>n(e.run_id),type:`button`,children:e.run_id})}),(0,z.jsx)(`td`,{children:e.case_id}),(0,z.jsx)(`td`,{children:e.arm_id}),(0,z.jsx)(`td`,{children:e.status}),(0,z.jsx)(`td`,{children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]},e.run_id))})]})}),r&&(0,z.jsx)(bT,{packet:e,run:r})]})}function ST(){let e=LT.useSearch(),t=LT.useNavigate(),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(null),[o,s]=(0,R.useState)(0),c=(0,R.useMemo)(()=>{let t=e.dashboardUrl||`/chat/benchmark-study.example.json`;try{return{url:sT(t,window.location.href),error:null}}catch(e){return{url:``,error:e instanceof Error?e.message:`Invalid dashboard source`}}},[e.dashboardUrl]);if((0,R.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 oT(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,R.useEffect)(()=>{n&&(document.title=`${n.design.labels.title??n.study_id} · LoopX Benchmark`)},[n]),i)return(0,z.jsxs)(`main`,{className:`benchmark-page benchmark-loading`,children:[(0,z.jsx)(ym,{"aria-hidden":`true`}),(0,z.jsx)(`h1`,{children:`Dashboard packet unavailable`}),(0,z.jsx)(`p`,{children:i}),(0,z.jsxs)(`button`,{onClick:()=>s(e=>e+1),type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":`true`,size:16}),` Retry readback`]})]});if(!n)return(0,z.jsxs)(`main`,{"aria-busy":`true`,className:`benchmark-page benchmark-loading`,children:[(0,z.jsx)(im,{"aria-hidden":`true`}),(0,z.jsx)(`h1`,{children:`Reading benchmark study`}),(0,z.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,z.jsxs)(`main`,{className:`benchmark-page`,children:[(0,z.jsxs)(`header`,{className:`benchmark-hero`,children:[(0,z.jsxs)(`div`,{className:`benchmark-hero-topline`,children:[(0,z.jsx)(`a`,{className:`benchmark-wordmark`,href:`/chat/`,children:`LoopX`}),(0,z.jsxs)(`div`,{className:`benchmark-readonly`,children:[(0,z.jsx)(oh,{"aria-hidden":`true`,size:15}),` Derived read-only projection`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-hero-grid`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`p`,{className:`benchmark-kicker`,children:[`BENCHMARK STUDY / `,n.benchmark_id]}),(0,z.jsxs)(`div`,{className:`benchmark-title-row`,children:[(0,z.jsx)(`h1`,{children:n.design.labels.title??n.study_id}),(0,z.jsx)(gT,{tone:n.status===`complete`?`success`:`warning`,children:n.status})]}),(0,z.jsx)(`p`,{className:`benchmark-lead`,children:`One declared study, explicit denominators, and the same countability rules from campaign summary to exact run.`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-identity`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Study`}),(0,z.jsx)(`dd`,{children:n.study_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocol`}),(0,z.jsx)(`dd`,{children:n.design.protocol_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Case set`}),(0,z.jsx)(`dd`,{children:n.design.case_set.case_set_id})]})]})]}),(0,z.jsxs)(`div`,{className:`benchmark-kpi-grid`,children:[(0,z.jsxs)(`article`,{children:[(0,z.jsx)(wm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Score-countable cells`}),(0,z.jsxs)(`strong`,{children:[n.campaign.selected_score_countable_cell_count,(0,z.jsxs)(`small`,{children:[` / `,n.campaign.intended_cell_denominator]})]}),(0,z.jsxs)(`p`,{children:[lT(n.campaign.selected_score_countable_coverage_rate),` declared coverage`]})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(bm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Complete designs`}),(0,z.jsxs)(`strong`,{children:[n.campaign.complete_declared_design_case_count,(0,z.jsxs)(`small`,{children:[` / `,n.campaign.intended_case_count]})]}),(0,z.jsx)(`p`,{children:`Cases with every declared arm`})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(sm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Matched comparisons`}),(0,z.jsx)(`strong`,{children:n.campaign.matched_pair_countable_count}),(0,z.jsx)(`p`,{children:`Eligible pairs only`})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(im,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`In flight`}),(0,z.jsx)(`strong`,{children:n.campaign.in_flight_run_count}),(0,z.jsx)(`p`,{children:n.status===`provisional`?`Coverage remains provisional`:`Declared coverage complete`})]})]})]}),(0,z.jsxs)(`nav`,{"aria-label":`Benchmark dashboard views`,className:`benchmark-tabs`,children:[cT.map(t=>(0,z.jsx)(`button`,{"aria-current":e.view===t.id?`page`:void 0,onClick:()=>u(t.id),type:`button`,children:t.label},t.id)),(0,z.jsxs)(`button`,{className:`benchmark-refresh`,onClick:()=>s(e=>e+1),type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":`true`,size:14}),` Refresh local readback`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-content`,children:[e.view===`campaign`&&(0,z.jsx)(_T,{packet:n,primaryMetric:l}),e.view===`arms`&&(0,z.jsx)(vT,{packet:n}),e.view===`cases`&&(0,z.jsx)(yT,{onOpenRun:e=>u(`runs`,e),packet:n,primaryMetric:l}),e.view===`runs`&&(0,z.jsx)(xT,{onSelectRun:e=>u(`runs`,e),packet:n,selectedRunId:e.runId})]}),(0,z.jsxs)(`footer`,{className:`benchmark-footer`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(oh,{"aria-hidden":`true`,size:16}),(0,z.jsxs)(`span`,{children:[`Scores: `,n.authority.score_source]}),(0,z.jsx)(`span`,{children:`Dashboard cannot launch, grade, or mutate runs.`})]}),(0,z.jsxs)(`code`,{title:d,children:[`local`,d]})]})]})}var CT=J({goalId:W().optional().default(``),statusUrl:W().optional().default(``)}),wT=J({goalId:W().optional().default(``),mode:Y([`showcase`,`developer`,`ops`]).optional().default(`showcase`),statusUrl:W().optional().default(``),todoLane:Y([`all`,`user`,`agent`]).optional().default(`all`),todoQuery:W().optional().default(``)}),TT=wT.omit({mode:!0}),ET=J({dashboardUrl:W().optional().default(``),view:Y([`campaign`,`arms`,`cases`,`runs`]).optional().default(`campaign`),runId:W().optional().default(``)});function DT(){let e=`https://loopx-project.github.io/loopx/docs/showcases/index.en.html`;return(0,R.useEffect)(()=>{window.location.replace(e)},[]),(0,z.jsx)(`a`,{href:e,children:`Open LoopX cases / 浏览案例`})}function OT({goalId:e,statusUrl:t}){let n=t?bh(t,window.location.href):null;return n?.error?(0,z.jsx)(`main`,{role:`alert`,children:n.error}):(0,z.jsx)(ii,{replace:!0,to:`/`,search:{goalId:e,statusUrl:t}})}function kT(){let e=NT.useSearch();return e.mode===`ops`?(0,z.jsx)(OT,{...e}):e.mode===`developer`?(0,z.jsx)(ii,{replace:!0,to:`/developers/projections`}):(0,z.jsx)(DT,{})}function AT(){return(0,z.jsx)(OT,{...PT.useSearch()})}var jT=Ci({component:()=>(0,z.jsx)(Mi,{}),errorComponent:()=>(0,z.jsxs)(`main`,{role:`alert`,className:`p-8`,children:[(0,z.jsx)(`h1`,{children:`页面暂时无法显示 / Page unavailable`}),(0,z.jsx)(`p`,{children:`请重新加载页面;这不会执行任务。 / Reloading does not execute tasks.`}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`重新加载 / Reload`})]})}),MT=xi({getParentRoute:()=>jT,path:`/`,validateSearch:e=>CT.parse(e),component:Fw}),NT=xi({getParentRoute:()=>jT,path:`/frontstage`,validateSearch:e=>wT.parse(e),component:kT}),PT=xi({getParentRoute:()=>jT,path:`/deprecated/frontstage/ops`,validateSearch:e=>TT.parse(e),component:AT}),FT=xi({getParentRoute:()=>jT,path:`/frontstage/developer`,component:()=>(0,z.jsx)(ii,{replace:!0,to:`/developers/projections`})}),IT=xi({getParentRoute:()=>jT,path:`/developers/projections`,component:Yw}),LT=xi({getParentRoute:()=>jT,path:`/benchmarks/study`,validateSearch:e=>ET.parse(e),component:ST}),RT=jT.addChildren([MT,NT,PT,FT,IT,LT]);function zT(e){return!e||e===`/`||e===`./`?`/`:(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``)||`/`}var BT=Li({routeTree:RT,basepath:zT(`/chat/`),trailingSlash:`preserve`}),VT=document.getElementById(`root`);if(!VT)throw Error(`Root element not found`);var HT=new je({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}});(0,Vi.createRoot)(VT).render((0,z.jsx)(Fe,{client:HT,children:(0,z.jsx)(qi,{children:(0,z.jsx)(Bi,{router:BT})})})); \ No newline at end of file +`),summary:k.summary,title:k.title}}]:[]],ot=f.connectionState===`connected`,st=new Map(E.goals.map(e=>[e.goalId,e.title])),ct=e=>nf(e,f.activeSource.statusUrl,ot&&!l?.errors[e.goalId],st.get(e.goalId)),lt={...Gd(E),userTodos:E.userTodos.map(ct),attentionHistory:(E.attentionHistory??E.userTodos).map(ct),periodicReports:{error:ee,loading:M},timeline:at};return(0,z.jsxs)(`div`,{className:p===`dark`?`dark`:``,"data-testid":`personal-goal-home`,children:[Ee?(0,z.jsx)(`p`,{role:`status`,className:`m-0 bg-amber-50 px-4 py-2 text-sm text-amber-900`,children:_(Ee===`partial`?`runs.discoveryPartial`:`runs.discoveryOffline`)}):null,(0,z.jsx)(_C,{agents:re.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=>it(e.goalId),onCorrectRun:async(e,t)=>{if(!e.sessionId)throw Error(`这个 Run 还没有可纠偏的执行 Session。`);let n=await tg((await Qh({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(V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:r?`running`:`ready`,turnId:r}),r){Pe.current.set(e.goalId,r);let t=new AbortController;Fe.current.set(e.goalId,t);let n=``,i=Je(e.goalId,{activity:[`正在把纠偏送入原执行 Session`],agentLabel:e.agentLabel,lines:[],pending:!0,sourceLabel:`${e.agentLabel} · 执行 Session`,text:``});try{let a=await Tg(e.sessionId,r,{signal:t.signal,onDelta:t=>{n+=t,Ye(e.goalId,i,{text:n})}});Ye(e.goalId,i,{activity:[],pending:!1,text:nw(a.response.message||n.trim())||`${e.agentLabel} 已完成纠偏。`})}catch(t){let n=Ie.current.delete(e.goalId);Ye(e.goalId,i,{activity:[],pending:!1,text:n?`已中断。你可以在当前会话继续发送消息。`:t instanceof Error?t.message:`纠偏回合失败。`})}finally{Pe.current.delete(e.goalId),Fe.current.delete(e.goalId),V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:`ready`})}}},onCloseRunSession:tt,onInterruptRun:async e=>Qe(e),onOpenGoal:it,onOpenRunSession:async e=>{if(!e.sessionId)return;let t=e.sessionId,n=await cg(t);ke(e=>({...e,[t]:n})),it(e.goalId),_e(t=>({...t,[e.goalId]:n.messages.map(t=>({agentLabel:t.role===`user`?void 0:e.agentLabel,attachments:ZC(t.attachments),id:Ae.current++,lines:[],role:t.role===`user`?`user`:`assistant`,sourceLabel:t.role===`user`?void 0:`${e.agentLabel} · 执行 Session`,text:t.role===`user`?t.text:nw(t.text)}))})),V(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=>it(e.goalId),...b?{onPreviewGoalSubagentConfiguration:async e=>{let t=await Ag(e);return{changed:t.changed,configuration:{allowedDomains:t.after.orchestration.allowed_domains,codexHostCapacity:{configuredChildren:t.codex_host_capacity.configured_children,newSessionRequired:t.codex_host_capacity.new_session_required,requiredChildren:t.codex_host_capacity.required_children,status:t.codex_host_capacity.status,writeRequired:t.codex_host_capacity.write_required,written:t.codex_host_capacity.written},enabled:t.feature_summary.multi_subagent===`enabled`,executionConfig:t.after.orchestration.execution_config,maxChildren:t.after.orchestration.max_children,modelConfig:t.after.orchestration.model_config},previewId:t.preview_id}},onApplyGoalSubagentConfiguration:async({previewId:e,...t})=>{let n=await jg(t,e);return{allowedDomains:n.after.orchestration.allowed_domains,codexHostCapacity:{configuredChildren:n.codex_host_capacity.configured_children,newSessionRequired:n.codex_host_capacity.new_session_required,requiredChildren:n.codex_host_capacity.required_children,status:n.codex_host_capacity.status,writeRequired:n.codex_host_capacity.write_required,written:n.codex_host_capacity.written},enabled:n.feature_summary.multi_subagent===`enabled`,executionConfig:n.after.orchestration.execution_config,maxChildren:n.after.orchestration.max_children,modelConfig:n.after.orchestration.model_config}}}:{},...g?{onExecuteGoalLifecycle:async({goalId:e,operation:t,reason:n})=>{let r=await Tx(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:$e,onSelectAgent:nt,onSelectGoal:e=>e?it(e):rt(),onSendMessage:async(e,t,n,r)=>Ze(e,{agentId:t,goalId:n,attachments:r}),onPrepareLoopX:(e,t)=>Xe(t,e),onStartLoopX:(e,t,n,r)=>{Ze(e===`start`?`开启 LoopX 模式,持续推进当前 Goal。`:`恢复 LoopX 模式。`,{agentId:t,goalId:n,loopxMode:{operation:e,settings:r}})},onStartNewRunSession:et},goalArchiveLoadState:e,managerChannelBinding:w,managerRuntime:S,conversationSessionId:Se[N]?.sessionId,model:lt,readOnly:h,selectedAgentId:L.agentId,selectedGoalId:D?.goalId??null,statusSourceControl:f})]})}function jw({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,z.jsx)(`div`,{className:i===`dark`?`dark`:``,children:(0,z.jsxs)(`main`,{className:`min-h-screen bg-[#f6f7f9] text-slate-950 dark:bg-[#09090b] dark:text-zinc-50`,children:[(0,z.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,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:`LoopX Workspace`}),(0,z.jsx)(`p`,{className:`mt-1 break-all text-sm text-slate-500 dark:text-zinc-400`,children:`Personal Workspace`})]}),(0,z.jsx)(Iy,{"aria-label":`切换主题`,onClick:a,size:`icon`,variant:`secondary`,children:i===`dark`?(0,z.jsx)(uh,{className:`h-4 w-4`}):(0,z.jsx)(Gm,{className:`h-4 w-4`})})]}),(0,z.jsxs)(`div`,{className:`grid min-h-[calc(100vh-80px)] sm:grid-cols-[240px_1fr]`,children:[(0,z.jsxs)(`aside`,{className:`hidden border-r border-slate-200 p-6 dark:border-zinc-800 sm:block`,"aria-label":`Workspace`,children:[(0,z.jsx)(`strong`,{children:`LoopX`}),(0,z.jsx)(`p`,{className:`mt-6 text-sm`,children:`Workspace`}),(0,z.jsx)(`p`,{className:`mt-8 text-xs text-slate-500`,children:`Goals`}),[1,2,3].map(e=>(0,z.jsx)(`div`,{className:`mt-4 h-8 rounded bg-slate-100 dark:bg-zinc-900`},e))]}),(0,z.jsx)(`div`,{className:`p-4 sm:p-8`,children:(0,z.jsx)(Ly,{"data-testid":`initial-status-state`,children:(0,z.jsx)(Ry,{className:`flex min-h-64 items-center justify-center p-6`,children:(0,z.jsxs)(`div`,{className:`max-w-xl text-center`,children:[e?(0,z.jsx)(ym,{className:`mx-auto h-6 w-6 text-rose-600 dark:text-rose-300`}):(0,z.jsx)(Qm,{className:`mx-auto h-6 w-6 animate-spin text-slate-500 dark:text-zinc-400`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e?`无法加载实时状态`:`正在加载实时状态`}),e?(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-slate-400 dark:text-zinc-500`,children:`重新加载不会执行任务,也不会改变 Goal 配置。`}):null,(0,z.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:(0,z.jsxs)(Iy,{disabled:t,onClick:n,children:[(0,z.jsx)(Qm,{className:`h-4 w-4`}),`重试`]})})]}):(0,z.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 Mw(){let e=kT.useSearch(),t=kT.useNavigate(),[n,r]=(0,R.useState)(`light`),[i,a]=(0,R.useState)(null),o=(0,R.useRef)(null),s=(0,R.useRef)(e.goalId);s.current=e.goalId;let[c,l]=(0,R.useState)(Vp),[u,d]=(0,R.useState)({kind:`example`,label:`bundled example`}),[f,p]=(0,R.useState)(()=>kC(window.localStorage,window.location.href)),m=(0,R.useRef)(f);m.current=f;let[h,g]=(0,R.useState)(e.statusUrl),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)({error:null,phase:`idle`}),[C,w]=(0,R.useState)(e.statusUrl.trim()||null),[T,E]=(0,R.useState)(!1),D=(0,R.useRef)(null),O=(0,R.useRef)(k_(e.statusUrl.trim()||null)),k=!T&&u.kind===`example`?e.statusUrl.trim():``,A=C??k,ee=u.kind===`url`?u.label:zC,j=!!(_&&C),M=IC(f,C,ee,window.location.href),te=u.kind===`example`&&!T,ne=c.attention_queue,N=c.run_history,P=(0,R.useMemo)(()=>HC(N.goals,ne.items),[N.goals,ne.items]);function re(e,t,n=0){S({error:null,phase:`loading`}),BC(Sh(e,`stopped`,window.location.href)).then(r=>{if(!N_(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=>nv(e,r)),a&&n<1){F(e,{background:!0,resyncAttempt:n+1});return}S(a?{error:`Goal 状态在加载历史时发生变化,请重试。`,phase:`error`}:{error:null,phase:`ready`})}).catch(e=>{N_(O.current,t)&&S({error:Bp(e),phase:`error`})})}function ie(){let e=u.kind===`url`?u.label:h||zC,t=j_(O.current,e,{background:!0});if(i){F(e);return}t&&re(e,t)}async function ae(e,n,r){if(r.background)return l(e=>nv(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})}),M_(O.current,r)?(O.current.requestedUrl=null,w(null),!0):!1}async function F(e,t={}){let n=e.trim(),r=t.background===!0;if(!n){r||v(`状态地址不能为空`);return}let c=j_(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 Gp(n,window.location.href).catch(()=>null);if(!N_(O.current,c))return;if(e){let o=(t.retryOnly||t.reuseSnapshots)&&u.kind===`url`&&u.label===n?Up(i,e,{invalidateGoalIds:t.invalidateGoalIds}):{};a({directory:e,snapshots:o,errors:{}});let f={...e,goals:e.goals.filter(e=>!o[e.id])},p=!1,m=Kp(e);if(r)l(m);else if(!await ae(n,m,c))return;if(S({error:null,phase:`loading`}),await Jp(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})},()=>N_(O.current,c),()=>s.current,d.signal),p&&(t.resyncAttempt??0)<1&&N_(O.current,c)){await F(n,{resyncAttempt:1});return}N_(O.current,c)&&S({error:null,phase:`ready`});return}let o=await BC(Sh(n,`active`,window.location.href));if(!N_(O.current,c)||(a(null),c.registryRevision=o.goal_projection?.registry_revision??null,!await ae(n,o,c)))return;if(o.goal_projection?.scope!==`active`||o.goal_projection.complete){S({error:null,phase:`ready`});return}re(n,c,t.resyncAttempt??0)}catch(e){if(!M_(O.current,c))return;r||v(Bp(e))}finally{!r&&M_(O.current,c)&&b(!1)}}function oe(e,t={}){o.current?.abort();let n=A_(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 wx(e.label,t)}catch{}}O.current.selectionRevision===n&&await F(e.statusUrl,{selectionRevision:n})})()}function I(e){m.current=e,p(e);try{AC(window.localStorage,e)}catch{}}let se={activeSource:M,connectionState:y?`loading`:j?`error`:`connected`,errorMessage:j?`未切换到 ${C??`所选来源`}:${_}`:null,onAdd:e=>{let t=MC(f,e,window.location.href);return`error`in t?{error:t.error}:(I(t.catalog),oe(t.source,{ensureTunnel:e.ensureTunnel}),{})},onConfiguredHostsLoaded:e=>{let t=m.current,n=jC(t,e);n!==t&&I(n)},onRemove:e=>{I(NC(f,e)),M.id===e&&oe(wC)},onSelect:e=>{let t=f.sources.find(t=>t.id===e);t&&oe(t,{ensureTunnel:t.kind===`ssh_tunnel`})},sources:M.id===`temporary`?[...f.sources,M]:f.sources};(0,R.useEffect)(()=>{let t=e.statusUrl.trim();if(t){if(D.current===t||C&&C!==t)return;(u.kind!==`url`||u.label!==t)&&F(t);return}D.current=null,!T&&(C||u.kind===`example`&&F(zC))},[T,C,e.statusUrl,u.kind,u.label]),(0,R.useEffect)(()=>{if(e.statusUrl&&u.kind===`example`)return;let n=new Set(P.map(e=>e.goal.id));if(P.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,P,t,e.goalId,e.statusUrl,u.kind]),(0,R.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]&&F(u.label,{retryOnly:!0})},[e.goalId,y,i,u]);function L(e){t({search:t=>({...t,goalId:e})})}return te?(0,z.jsx)(jw,{error:_,isLoading:y,onRetry:()=>void F(A||zC),requestedUrl:A||zC,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)}):(0,z.jsx)(Aw,{goalArchiveLoadState:x,isLoading:y,onGoalActivationStateChange:(e,t)=>{O.current.projectionRevision+=1,l(n=>Lp(n,e,t)),a(n=>n&&{...n,snapshots:Object.fromEntries(Object.entries(n.snapshots).map(([n,r])=>[n,Lp(r,e,t)]))})},onGoalDeleted:e=>{O.current.projectionRevision+=1,l(t=>Rp(t,e)),a(t=>t&&{...t,snapshots:Object.fromEntries(Object.entries(t.snapshots).filter(([t])=>t!==e))})},onSelectGoal:L,onReconcileStatus:e=>F(u.kind===`url`?u.label:h||zC,{background:!0,invalidateGoalIds:e?.invalidateGoalIds,reuseSnapshots:!0}),onRetryGoalArchive:ie,onRefresh:()=>F(u.kind===`url`?u.label:h||zC,{retryOnly:!!(i&&Object.keys(i.errors).length)}),payload:c,progress:i,rows:P,selectedGoalId:e.goalId,statusSourceControl:se,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)})}var Nw=sv(`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 Pw({className:e,variant:t,...n}){return(0,z.jsx)(`span`,{className:Py(Nw({variant:t}),e),...n})}var Fw=[{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`}],Iw=[{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`}],Lw=[{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.`}],Rw=[`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`],zw=[{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 Bw({children:e,icon:t,title:n}){return(0,z.jsxs)(`section`,{className:`rounded-lg border border-slate-200 bg-white shadow-sm`,children:[(0,z.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,z.jsx)(t,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function Vw(){return(0,z.jsx)(Bw,{icon:pm,title:`Status Contract Explorer`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,"data-testid":`developer-contract-explorer`,children:Fw.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(Pw,{variant:`info`,children:e.label}),(0,z.jsx)(Pw,{variant:`neutral`,children:`public contract`})]}),(0,z.jsx)(`div`,{className:`mt-2 break-words font-mono text-xs text-slate-700`,children:e.source}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.detail})]},e.label))})})}function Hw(){return(0,z.jsx)(Bw,{icon:Nm,title:`Projection Diffing`,children:(0,z.jsx)(`div`,{className:`overflow-x-auto`,"data-testid":`developer-projection-diffing`,children:(0,z.jsxs)(`table`,{className:`min-w-full border-separate border-spacing-0 text-left text-sm`,children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{className:`bg-slate-50 text-xs uppercase tracking-normal text-slate-500`,children:[(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Axis`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Current`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Proposed`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Gate`})]})}),(0,z.jsx)(`tbody`,{children:Iw.map(e=>(0,z.jsxs)(`tr`,{className:`align-top`,children:[(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 font-semibold text-slate-950`,children:e.axis}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.current}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.proposed}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.gate})]},e.axis))})]})})})}function Uw(){return(0,z.jsx)(Bw,{icon:km,title:`Fixture Generation`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-fixture-generation`,children:Lw.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:e.title}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.title))})})}function Ww(){return(0,z.jsx)(Bw,{icon:xm,title:`Smoke Checklist`,children:(0,z.jsx)(`div`,{className:`space-y-2 p-4`,"data-testid":`developer-smoke-checklist`,children:Rw.map(e=>(0,z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(um,{className:`mt-0.5 h-4 w-4 shrink-0 text-emerald-600`}),(0,z.jsx)(`code`,{className:`break-all text-xs font-semibold leading-5 text-slate-700`,children:e})]},e))})})}function Gw(){return(0,z.jsx)(Bw,{icon:Sm,title:`Component Examples`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-3`,"data-testid":`developer-component-examples`,children:zw.map(e=>(0,z.jsxs)(`article`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.badges.map(e=>(0,z.jsx)(Pw,{variant:e===`read-only`||e===`public-safe`?`success`:`neutral`,children:e},e))}),(0,z.jsx)(`h3`,{className:`mt-3 text-sm font-semibold leading-6 text-slate-950`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.name))})})}function Kw(){return(0,z.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,z.jsxs)(`div`,{className:`mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,z.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,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.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,z.jsx)(dh,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold`,children:`Developer Cockpit`}),(0,z.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Projection extension`})]})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://loopx-project.github.io/loopx/`,children:[(0,z.jsx)(Lm,{className:`h-4 w-4`}),`LoopX home`]}),(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://loopx-project.github.io/loopx/docs/showcases/index.en.html`,children:[(0,z.jsx)(Dm,{className:`h-4 w-4`}),`Public cases`]}),(0,z.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,z.jsx)(Sm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,z.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,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(Pw,{variant:`success`,children:`read-only`}),(0,z.jsx)(Pw,{variant:`neutral`,children:`public fixtures`})]}),(0,z.jsx)(`p`,{children:`This route uses static public contracts only; live status feeds, registry files, and browser write APIs stay outside the cockpit.`})]})]}),(0,z.jsxs)(`section`,{className:`space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(Pw,{variant:`info`,children:`developers/projections`}),(0,z.jsx)(Pw,{variant:`success`,children:`public-safe`}),(0,z.jsx)(Pw,{variant:`neutral`,children:`no browser writes`})]}),(0,z.jsx)(`h1`,{className:`mt-3 text-3xl font-semibold tracking-normal text-slate-950`,children:`LoopX Projection Developer Cockpit`}),(0,z.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,z.jsxs)(`div`,{className:`grid min-w-[260px] gap-2 text-sm`,children:[(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Source of truth`}),(0,z.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`status contract + compact fixtures`})]}),(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Boundary`}),(0,z.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`read-only extension surface`})]})]})]})}),(0,z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,z.jsx)(Vw,{}),(0,z.jsx)(Hw,{})]}),(0,z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,z.jsx)(Uw,{}),(0,z.jsx)(Ww,{})]}),(0,z.jsx)(Gw,{}),(0,z.jsx)(Bw,{icon:oh,title:`Extension Boundary`,children:(0,z.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-extension-boundary`,children:[(0,z.jsxs)(`div`,{className:`rounded-md border border-emerald-200 bg-emerald-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Allowed`}),(0,z.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,z.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Review`}),(0,z.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,z.jsxs)(`div`,{className:`rounded-md border border-rose-200 bg-rose-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Stop`}),(0,z.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 qw=J({value:G().finite(),total:G().finite().positive().optional(),unit:W().optional(),higher_is_better:K()}).passthrough(),Jw=yd(W(),G().finite()).default({}),Yw=J({outcome_status:W().optional(),failure_class:W(),causal_summary:W(),expectedness:W(),implication:W(),next_probe:W(),confidence:W(),evidence_refs:q(W()).optional()}).passthrough(),Xw=J({arm_id:W(),selected_run_id:W().nullable(),score_countable:K(),metrics:yd(W(),qw),effort:Jw,insight:Yw.nullable().optional()}),Zw=J({run_id:W(),case_id:W(),arm_id:W(),arm_role:W(),status:W(),protocol_id:W(),runner_revision:W().optional(),observed_at:W(),metrics:yd(W(),qw),countability:J({integrity_qualified:K(),official_result_present:K(),score_countable:K()}).passthrough(),treatment_fidelity:W(),effort:Jw,redacted_insight:Yw.nullable().optional(),upload_provenance:J({producer_id:W(),producer_version:W(),observed_at:W(),source_revision:W()}).passthrough()}).passthrough(),Qw=J({case_denominator:G().int().nonnegative(),value_sum:G().finite(),value_mean:G().finite().nullable(),value_median:G().finite().nullable(),value_min:G().finite().nullable(),value_max:G().finite().nullable(),case_macro_rate:G().finite().optional(),suite_micro_rate:G().finite().optional(),suite_micro_numerator:G().finite().optional(),suite_micro_denominator:G().finite().positive().optional()}).passthrough(),$w=J({arm_id:W(),arm_role:W(),factor_assignments:yd(W(),W()),protocol_counts:yd(W(),G().int().nonnegative()).default({}),runner_revision_counts:yd(W(),G().int().nonnegative()).default({}),orchestrator_runtime_counts:yd(W(),G().int().nonnegative()).default({}),intended_case_count:G().int().positive(),run_count:G().int().nonnegative(),terminal_run_count:G().int().nonnegative(),selected_score_countable_case_count:G().int().nonnegative(),coverage_rate:G().finite().min(0).max(1),metrics:yd(W(),Qw),binary_outcomes:yd(W(),J({success_count:G().int().nonnegative(),case_denominator:G().int().nonnegative(),success_rate:G().finite().min(0).max(1).nullable()})),effort:yd(W(),J({denominator:G().int().nonnegative(),mean:G().finite().nullable(),median:G().finite().nullable()})),failure_class_counts:yd(W(),G().int().nonnegative())}).passthrough(),eT=J({baseline_value:G().finite(),candidate_value:G().finite(),delta:G().finite(),direction:Y([`improved`,`flat`,`regressed`]).optional()}).passthrough(),tT=J({comparison_id:W(),comparison_anchor_run_id:W(),candidate_run_id:W(),candidate_arm_id:W(),primary_metric:W(),matched_pair_countable:X(!0),metric_deltas:yd(W(),eT)}).passthrough(),nT=J({ok:X(!0),schema_version:X(`benchmark_study_dashboard_v0`),benchmark_id:W(),study_id:W(),status:Y([`complete`,`provisional`]),design:J({protocol_id:W(),comparison_protocol_id:W(),baseline_arm_id:W(),case_set:J({case_set_id:W(),case_ids:q(W())}),metric_catalog:q(J({metric_name:W(),role:Y([`primary`,`guardrail`,`supporting`]),unit:W().optional(),higher_is_better:K(),binary:K()})),labels:yd(W(),W())}).passthrough(),campaign:J({intended_case_count:G().int().positive(),intended_arm_count:G().int().positive(),intended_cell_denominator:G().int().positive(),selected_score_countable_cell_count:G().int().nonnegative(),selected_score_countable_coverage_rate:G().finite().min(0).max(1),complete_declared_design_case_count:G().int().nonnegative(),ambiguous_score_countable_cell_count:G().int().nonnegative(),in_flight_run_count:G().int().nonnegative(),matched_pair_countable_count:G().int().nonnegative(),factorial_contrast_count:G().int().nonnegative(),factorial_contrast_countable_count:G().int().nonnegative(),runtime_observation_count:G().int().nonnegative(),runtime_classification_counts:yd(W(),G().int().nonnegative())}),arms:q($w),contrasts:yd(W(),J({matched_pair_denominator:G().int().nonnegative(),primary_metric_directions:J({improved:G().int().nonnegative(),flat:G().int().nonnegative(),regressed:G().int().nonnegative()}),binary_metric_transitions:yd(W(),J({"0_to_1":G().int().nonnegative(),"1_to_0":G().int().nonnegative(),same:G().int().nonnegative()}))})),cases:q(J({case_id:W(),complete_declared_design:K(),arms:q(Xw),eligible_comparisons:q(tT),largest_eligible_primary_contrast:tT.nullable()})),runs:q(Zw),authority:J({score_source:W(),matched_comparison_source:W(),factorial_comparison_source:W().nullable(),manifest_changes_scores:X(!1),dashboard_is_execution_authority:X(!1)}),public_boundary:J({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 rT(e){return nT.parse(e)}function iT(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 aT=[{id:`campaign`,label:`Campaign`},{id:`arms`,label:`Arms`},{id:`cases`,label:`Cases`},{id:`runs`,label:`Runs`}];function oT(e){return e==null?`—`:`${(e*100).toFixed(e>=.995?0:1)}%`}function sT(e){return e==null?`—`:new Intl.NumberFormat(`en`,{maximumFractionDigits:2,notation:`compact`}).format(e)}function cT(e){if(e==null)return`—`;let t=e/6e4;return t>=120?`${(t/60).toFixed(1)} h`:`${sT(t)} min`}function lT(e){let t=Object.entries(e);return t.length?t.map(([e,t])=>`${e} (${t})`).join(`, `):`—`}function uT(e){if(!e)return`—`;let t=e.total==null?sT(e.value):`${sT(e.value)}/${sT(e.total)}`;return e.unit?`${t} ${e.unit}`:t}function dT(e,t){let n=e.metrics[t];return!n||n.case_denominator===0?`—`:n.suite_micro_rate==null?`${sT(n.value_mean)} mean`:`${oT(n.suite_micro_rate)} · ${sT(n.suite_micro_numerator)}/${sT(n.suite_micro_denominator)}`}function fT(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}${sT(r.delta)}`}}function pT({children:e,tone:t=`neutral`}){return(0,z.jsx)(`span`,{className:`benchmark-state benchmark-state-${t}`,children:e})}function mT({packet:e,primaryMetric:t}){return(0,z.jsxs)(`div`,{className:`benchmark-view-stack`,children:[(0,z.jsxs)(`section`,{"aria-labelledby":`arm-summary-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`ARM SUMMARY`}),(0,z.jsx)(`h2`,{id:`arm-summary-title`,children:`Comparable outcomes, denominator first`})]}),(0,z.jsx)(`p`,{children:`Only one score-countable run per declared case × arm cell is selected.`})]}),(0,z.jsx)(`div`,{className:`benchmark-arm-grid`,children:e.arms.map(e=>{let n=Object.values(e.binary_outcomes)[0];return(0,z.jsxs)(`article`,{className:`benchmark-arm-card`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:e.arm_role}),(0,z.jsx)(`h3`,{children:e.arm_id})]}),(0,z.jsx)(pT,{tone:e.coverage_rate===1?`success`:`warning`,children:e.coverage_rate===1?`Complete`:`Provisional`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`dt`,{children:[`Primary · `,t]}),(0,z.jsx)(`dd`,{children:dT(e,t)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Score-countable coverage`}),(0,z.jsxs)(`dd`,{children:[e.selected_score_countable_case_count,`/`,e.intended_case_count]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Binary success`}),(0,z.jsx)(`dd`,{children:n?`${n.success_count}/${n.case_denominator}`:`Not declared`})]})]})]},e.arm_id)})})]}),(0,z.jsxs)(`section`,{"aria-labelledby":`contrast-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`MATCHED CONTRASTS`}),(0,z.jsx)(`h2`,{id:`contrast-title`,children:`Direction counts on eligible pairs`})]}),(0,z.jsx)(`p`,{children:`Raw run volume is never used as a comparison denominator.`})]}),(0,z.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Candidate arm`}),(0,z.jsx)(`th`,{children:`Matched denominator`}),(0,z.jsx)(`th`,{children:`Improved`}),(0,z.jsx)(`th`,{children:`Flat`}),(0,z.jsx)(`th`,{children:`Regressed`}),(0,z.jsx)(`th`,{children:`Binary transitions`})]})}),(0,z.jsxs)(`tbody`,{children:[Object.entries(e.contrasts).map(([e,t])=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`strong`,{children:e})}),(0,z.jsx)(`td`,{children:t.matched_pair_denominator}),(0,z.jsx)(`td`,{className:`benchmark-positive`,children:t.primary_metric_directions.improved}),(0,z.jsx)(`td`,{children:t.primary_metric_directions.flat}),(0,z.jsx)(`td`,{className:`benchmark-negative`,children:t.primary_metric_directions.regressed}),(0,z.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,z.jsx)(`tr`,{children:(0,z.jsx)(`td`,{colSpan:6,children:`No matched comparisons are countable yet.`})})]})]})})]}),(0,z.jsxs)(`section`,{"aria-labelledby":`runtime-health-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`RUNTIME HEALTH`}),(0,z.jsx)(`h2`,{id:`runtime-health-title`,children:`Qualified observations, without execution authority`})]}),(0,z.jsxs)(`p`,{children:[e.campaign.runtime_observation_count,` public-safe runtime observations.`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-runtime-list`,children:[Object.entries(e.campaign.runtime_classification_counts).map(([e,t])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:e}),(0,z.jsx)(`strong`,{children:t})]},e)),e.campaign.runtime_observation_count===0&&(0,z.jsx)(`p`,{className:`benchmark-muted`,children:`No runtime observations uploaded.`})]})]})]})}function hT({packet:e}){return(0,z.jsx)(`div`,{className:`benchmark-detail-grid`,children:e.arms.map(t=>(0,z.jsxs)(`article`,{className:`benchmark-detail-card`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:t.arm_role}),(0,z.jsx)(`h2`,{children:t.arm_id})]}),(0,z.jsxs)(pT,{tone:t.coverage_rate===1?`success`:`warning`,children:[t.selected_score_countable_case_count,`/`,t.intended_case_count,` countable`]})]}),(0,z.jsx)(`div`,{className:`benchmark-factor-row`,children:Object.entries(t.factor_assignments).map(([e,t])=>(0,z.jsxs)(`span`,{children:[e,`: `,(0,z.jsx)(`strong`,{children:t})]},e))}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[e.design.metric_catalog.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`dt`,{children:[e.role,` · `,e.metric_name]}),(0,z.jsx)(`dd`,{children:dT(t,e.metric_name)})]},e.metric_name)),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runs terminal / observed`}),(0,z.jsxs)(`dd`,{children:[t.terminal_run_count,`/`,t.run_count]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Median duration`}),(0,z.jsx)(`dd`,{children:cT(t.effort.duration_ms?.median)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocols`}),(0,z.jsx)(`dd`,{children:lT(t.protocol_counts)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runner revisions`}),(0,z.jsx)(`dd`,{children:lT(t.runner_revision_counts)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Orchestrator runtimes`}),(0,z.jsxs)(`dd`,{children:[Object.keys(t.orchestrator_runtime_counts).length||0,` distinct`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Failure classes`}),(0,z.jsx)(`dd`,{children:lT(t.failure_class_counts)})]})]})]},t.arm_id))})}function gT({packet:e,primaryMetric:t,onOpenRun:n}){return(0,z.jsx)(`div`,{className:`benchmark-table-shell benchmark-wide-table`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Case`}),(0,z.jsx)(`th`,{children:`Design status`}),(0,z.jsx)(`th`,{children:`Largest eligible delta`}),e.arms.map(e=>(0,z.jsx)(`th`,{children:e.arm_id},e.arm_id))]})}),(0,z.jsx)(`tbody`,{children:e.cases.map(r=>{let i=fT(r,t);return(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`strong`,{children:r.case_id})}),(0,z.jsx)(`td`,{children:(0,z.jsx)(pT,{tone:r.complete_declared_design?`success`:`warning`,children:r.complete_declared_design?`Complete`:`Provisional`})}),(0,z.jsx)(`td`,{className:i?.direction===`improved`?`benchmark-positive`:i?.direction===`regressed`?`benchmark-negative`:void 0,children:i?.text??`—`}),r.arms.map(r=>(0,z.jsx)(`td`,{children:r.selected_run_id&&r.score_countable?(0,z.jsxs)(`button`,{className:`benchmark-cell-link`,onClick:()=>n(r.selected_run_id),type:`button`,children:[(0,z.jsxs)(`span`,{children:[t,`: `,uT(r.metrics[t])]}),e.design.metric_catalog.filter(e=>e.metric_name!==t).map(e=>(0,z.jsxs)(`small`,{className:`benchmark-cell-metric`,children:[e.metric_name,`: `,uT(r.metrics[e.metric_name])]},e.metric_name)),(0,z.jsxs)(`small`,{children:[`Countable · `,cT(r.effort.duration_ms),` `,(0,z.jsx)(sm,{"aria-hidden":`true`,size:12})]}),r.insight&&(0,z.jsxs)(`small`,{children:[r.insight.failure_class,` · `,r.insight.confidence]})]}):(0,z.jsx)(`span`,{className:`benchmark-muted`,children:`Not countable`})},r.arm_id))]},r.case_id)})})]})})}function _T({run:e,packet:t}){return(0,z.jsxs)(`aside`,{"aria-label":`Run detail for ${e.run_id}`,className:`benchmark-run-detail`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:`RUN DETAIL`}),(0,z.jsx)(`h2`,{children:e.run_id})]}),(0,z.jsx)(pT,{tone:e.countability.score_countable?`success`:`warning`,children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list benchmark-run-facts`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Case / arm`}),(0,z.jsxs)(`dd`,{children:[e.case_id,` · `,e.arm_id]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Lifecycle`}),(0,z.jsxs)(`dd`,{children:[e.status,` · `,e.observed_at]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocol`}),(0,z.jsx)(`dd`,{children:e.protocol_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Qualification`}),(0,z.jsxs)(`dd`,{children:[`Integrity `,e.countability.integrity_qualified?`qualified`:`not qualified`,` · result `,e.countability.official_result_present?`present`:`missing`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Treatment fidelity`}),(0,z.jsx)(`dd`,{children:e.treatment_fidelity})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Effort`}),(0,z.jsxs)(`dd`,{children:[cT(e.effort.duration_ms),` · `,sT(e.effort.agent_steps),` steps · `,sT(e.effort.token_count),` tokens`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runner revision`}),(0,z.jsx)(`dd`,{children:e.runner_revision??`—`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Upload provenance`}),(0,z.jsxs)(`dd`,{children:[e.upload_provenance.producer_id,` · `,e.upload_provenance.source_revision]})]})]}),(0,z.jsx)(`div`,{className:`benchmark-run-metrics`,children:t.design.metric_catalog.map(t=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:t.metric_name}),(0,z.jsx)(`strong`,{children:uT(e.metrics[t.metric_name])})]},t.metric_name))}),e.redacted_insight&&(0,z.jsxs)(`div`,{className:`benchmark-insight`,children:[(0,z.jsxs)(`span`,{className:`benchmark-mono`,children:[`REDACTED CASE INSIGHT · `,e.redacted_insight.confidence]}),(0,z.jsx)(`p`,{children:e.redacted_insight.causal_summary}),(0,z.jsxs)(`small`,{children:[`Implication: `,e.redacted_insight.implication]}),(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[`Next probe: `,e.redacted_insight.next_probe]}),!!e.redacted_insight.evidence_refs?.length&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[`Evidence: `,e.redacted_insight.evidence_refs.join(`, `)]})]})]})]})}function vT({packet:e,selectedRunId:t,onSelectRun:n}){let r=e.runs.find(e=>e.run_id===t)??e.runs[0];return(0,z.jsxs)(`div`,{className:`benchmark-runs-layout`,children:[(0,z.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Run`}),(0,z.jsx)(`th`,{children:`Case`}),(0,z.jsx)(`th`,{children:`Arm`}),(0,z.jsx)(`th`,{children:`Status`}),(0,z.jsx)(`th`,{children:`Countability`})]})}),(0,z.jsx)(`tbody`,{children:e.runs.map(e=>(0,z.jsxs)(`tr`,{"aria-selected":e.run_id===r?.run_id,children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`button`,{className:`benchmark-run-link`,onClick:()=>n(e.run_id),type:`button`,children:e.run_id})}),(0,z.jsx)(`td`,{children:e.case_id}),(0,z.jsx)(`td`,{children:e.arm_id}),(0,z.jsx)(`td`,{children:e.status}),(0,z.jsx)(`td`,{children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]},e.run_id))})]})}),r&&(0,z.jsx)(_T,{packet:e,run:r})]})}function yT(){let e=PT.useSearch(),t=PT.useNavigate(),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(null),[o,s]=(0,R.useState)(0),c=(0,R.useMemo)(()=>{let t=e.dashboardUrl||`/chat/benchmark-study.example.json`;try{return{url:iT(t,window.location.href),error:null}}catch(e){return{url:``,error:e instanceof Error?e.message:`Invalid dashboard source`}}},[e.dashboardUrl]);if((0,R.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 rT(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,R.useEffect)(()=>{n&&(document.title=`${n.design.labels.title??n.study_id} · LoopX Benchmark`)},[n]),i)return(0,z.jsxs)(`main`,{className:`benchmark-page benchmark-loading`,children:[(0,z.jsx)(ym,{"aria-hidden":`true`}),(0,z.jsx)(`h1`,{children:`Dashboard packet unavailable`}),(0,z.jsx)(`p`,{children:i}),(0,z.jsxs)(`button`,{onClick:()=>s(e=>e+1),type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":`true`,size:16}),` Retry readback`]})]});if(!n)return(0,z.jsxs)(`main`,{"aria-busy":`true`,className:`benchmark-page benchmark-loading`,children:[(0,z.jsx)(im,{"aria-hidden":`true`}),(0,z.jsx)(`h1`,{children:`Reading benchmark study`}),(0,z.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,z.jsxs)(`main`,{className:`benchmark-page`,children:[(0,z.jsxs)(`header`,{className:`benchmark-hero`,children:[(0,z.jsxs)(`div`,{className:`benchmark-hero-topline`,children:[(0,z.jsx)(`a`,{className:`benchmark-wordmark`,href:`/chat/`,children:`LoopX`}),(0,z.jsxs)(`div`,{className:`benchmark-readonly`,children:[(0,z.jsx)(oh,{"aria-hidden":`true`,size:15}),` Derived read-only projection`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-hero-grid`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`p`,{className:`benchmark-kicker`,children:[`BENCHMARK STUDY / `,n.benchmark_id]}),(0,z.jsxs)(`div`,{className:`benchmark-title-row`,children:[(0,z.jsx)(`h1`,{children:n.design.labels.title??n.study_id}),(0,z.jsx)(pT,{tone:n.status===`complete`?`success`:`warning`,children:n.status})]}),(0,z.jsx)(`p`,{className:`benchmark-lead`,children:`One declared study, explicit denominators, and the same countability rules from campaign summary to exact run.`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-identity`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Study`}),(0,z.jsx)(`dd`,{children:n.study_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocol`}),(0,z.jsx)(`dd`,{children:n.design.protocol_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Case set`}),(0,z.jsx)(`dd`,{children:n.design.case_set.case_set_id})]})]})]}),(0,z.jsxs)(`div`,{className:`benchmark-kpi-grid`,children:[(0,z.jsxs)(`article`,{children:[(0,z.jsx)(wm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Score-countable cells`}),(0,z.jsxs)(`strong`,{children:[n.campaign.selected_score_countable_cell_count,(0,z.jsxs)(`small`,{children:[` / `,n.campaign.intended_cell_denominator]})]}),(0,z.jsxs)(`p`,{children:[oT(n.campaign.selected_score_countable_coverage_rate),` declared coverage`]})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(bm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Complete designs`}),(0,z.jsxs)(`strong`,{children:[n.campaign.complete_declared_design_case_count,(0,z.jsxs)(`small`,{children:[` / `,n.campaign.intended_case_count]})]}),(0,z.jsx)(`p`,{children:`Cases with every declared arm`})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(sm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Matched comparisons`}),(0,z.jsx)(`strong`,{children:n.campaign.matched_pair_countable_count}),(0,z.jsx)(`p`,{children:`Eligible pairs only`})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(im,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`In flight`}),(0,z.jsx)(`strong`,{children:n.campaign.in_flight_run_count}),(0,z.jsx)(`p`,{children:n.status===`provisional`?`Coverage remains provisional`:`Declared coverage complete`})]})]})]}),(0,z.jsxs)(`nav`,{"aria-label":`Benchmark dashboard views`,className:`benchmark-tabs`,children:[aT.map(t=>(0,z.jsx)(`button`,{"aria-current":e.view===t.id?`page`:void 0,onClick:()=>u(t.id),type:`button`,children:t.label},t.id)),(0,z.jsxs)(`button`,{className:`benchmark-refresh`,onClick:()=>s(e=>e+1),type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":`true`,size:14}),` Refresh local readback`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-content`,children:[e.view===`campaign`&&(0,z.jsx)(mT,{packet:n,primaryMetric:l}),e.view===`arms`&&(0,z.jsx)(hT,{packet:n}),e.view===`cases`&&(0,z.jsx)(gT,{onOpenRun:e=>u(`runs`,e),packet:n,primaryMetric:l}),e.view===`runs`&&(0,z.jsx)(vT,{onSelectRun:e=>u(`runs`,e),packet:n,selectedRunId:e.runId})]}),(0,z.jsxs)(`footer`,{className:`benchmark-footer`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(oh,{"aria-hidden":`true`,size:16}),(0,z.jsxs)(`span`,{children:[`Scores: `,n.authority.score_source]}),(0,z.jsx)(`span`,{children:`Dashboard cannot launch, grade, or mutate runs.`})]}),(0,z.jsxs)(`code`,{title:d,children:[`local`,d]})]})]})}var bT=J({goalId:W().optional().default(``),statusUrl:W().optional().default(``)}),xT=J({goalId:W().optional().default(``),mode:Y([`showcase`,`developer`,`ops`]).optional().default(`showcase`),statusUrl:W().optional().default(``),todoLane:Y([`all`,`user`,`agent`]).optional().default(`all`),todoQuery:W().optional().default(``)}),ST=xT.omit({mode:!0}),CT=J({dashboardUrl:W().optional().default(``),view:Y([`campaign`,`arms`,`cases`,`runs`]).optional().default(`campaign`),runId:W().optional().default(``)});function wT(){let e=`https://loopx-project.github.io/loopx/docs/showcases/index.en.html`;return(0,R.useEffect)(()=>{window.location.replace(e)},[]),(0,z.jsx)(`a`,{href:e,children:`Open LoopX cases / 浏览案例`})}function TT({goalId:e,statusUrl:t}){let n=t?bh(t,window.location.href):null;return n?.error?(0,z.jsx)(`main`,{role:`alert`,children:n.error}):(0,z.jsx)(ii,{replace:!0,to:`/`,search:{goalId:e,statusUrl:t}})}function ET(){let e=AT.useSearch();return e.mode===`ops`?(0,z.jsx)(TT,{...e}):e.mode===`developer`?(0,z.jsx)(ii,{replace:!0,to:`/developers/projections`}):(0,z.jsx)(wT,{})}function DT(){return(0,z.jsx)(TT,{...jT.useSearch()})}var OT=Ci({component:()=>(0,z.jsx)(Mi,{}),errorComponent:()=>(0,z.jsxs)(`main`,{role:`alert`,className:`p-8`,children:[(0,z.jsx)(`h1`,{children:`页面暂时无法显示 / Page unavailable`}),(0,z.jsx)(`p`,{children:`请重新加载页面;这不会执行任务。 / Reloading does not execute tasks.`}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`重新加载 / Reload`})]})}),kT=xi({getParentRoute:()=>OT,path:`/`,validateSearch:e=>bT.parse(e),component:Mw}),AT=xi({getParentRoute:()=>OT,path:`/frontstage`,validateSearch:e=>xT.parse(e),component:ET}),jT=xi({getParentRoute:()=>OT,path:`/deprecated/frontstage/ops`,validateSearch:e=>ST.parse(e),component:DT}),MT=xi({getParentRoute:()=>OT,path:`/frontstage/developer`,component:()=>(0,z.jsx)(ii,{replace:!0,to:`/developers/projections`})}),NT=xi({getParentRoute:()=>OT,path:`/developers/projections`,component:Kw}),PT=xi({getParentRoute:()=>OT,path:`/benchmarks/study`,validateSearch:e=>CT.parse(e),component:yT}),FT=OT.addChildren([kT,AT,jT,MT,NT,PT]);function IT(e){return!e||e===`/`||e===`./`?`/`:(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``)||`/`}var LT=Li({routeTree:FT,basepath:IT(`/chat/`),trailingSlash:`preserve`}),RT=document.getElementById(`root`);if(!RT)throw Error(`Root element not found`);var zT=new je({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}});(0,Vi.createRoot)(RT).render((0,z.jsx)(Fe,{client:zT,children:(0,z.jsx)(qi,{children:(0,z.jsx)(Bi,{router:LT})})})); \ No newline at end of file diff --git a/loopx/web/chat/index.html b/loopx/web/chat/index.html index 84dad0d361..9b70ee1003 100644 --- a/loopx/web/chat/index.html +++ b/loopx/web/chat/index.html @@ -18,7 +18,7 @@ content="LoopX 个人 Agent 工作区:在同一个频道里查看、纠偏并推进 Goal。" /> LoopX 个人 Agent 工作区 - + From ad48975da78ec1164bfdcd964b8e3fe8526256f4 Mon Sep 17 00:00:00 2001 From: huangruiteng <14976749+huangruiteng@users.noreply.github.com> Date: Thu, 24 Sep 2026 06:20:30 +0800 Subject: [PATCH 2/5] docs(team): distinguish managed status from delivered results Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com> --- docs/architecture/rfcs/live-team-workspace-v0.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/architecture/rfcs/live-team-workspace-v0.md b/docs/architecture/rfcs/live-team-workspace-v0.md index 9cae93496d..0b310d7d4e 100644 --- a/docs/architecture/rfcs/live-team-workspace-v0.md +++ b/docs/architecture/rfcs/live-team-workspace-v0.md @@ -327,6 +327,11 @@ stack the reader below it. Explicit artifact choices survive delivery refresh an are revalidated by operation, reference and hash; automatic reads do not take keyboard focus. Acceptance and requester adoption remain separate in details. This qualifies report readback, not mixed-team launch or stop/recovery. +The ordinary managed Goal Files view admits only a projected deliverable, such +as a published report. Latest-run metadata, validation summaries and event +counts remain execution observations; they cannot become a file or inherit an +unrelated open Todo ID. A readable managed result still needs a versioned, +public-safe artifact projection with its own source and acceptance readback. Merged [#4814](https://github.com/loopx-project/loopx/pull/4814) adds confirmation of one canonical team plan from manager and Goal Lark cards. Authenticated card bindings and the shared decision owner prevent a second click from creating a From ad99ddd058f1512b83ea3fa5e4e51d760a30ecdb Mon Sep 17 00:00:00 2001 From: huangruiteng <14976749+huangruiteng@users.noreply.github.com> Date: Thu, 24 Sep 2026 06:29:41 +0800 Subject: [PATCH 3/5] fix(bundle): normalize retained asset order Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com> --- loopx/web/chat/asset-retention.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loopx/web/chat/asset-retention.json b/loopx/web/chat/asset-retention.json index fc69aa96de..9d9d7f5fe7 100644 --- a/loopx/web/chat/asset-retention.json +++ b/loopx/web/chat/asset-retention.json @@ -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-C_Imc7ZG.css", - "assets/index-BGlmetKk.js" + "assets/index-BGlmetKk.js", + "assets/index-C_Imc7ZG.css" ] ] } From eb33dc5bc6f2f14e3b77e714361b25b1ec705f0e Mon Sep 17 00:00:00 2001 From: huangruiteng <14976749+huangruiteng@users.noreply.github.com> Date: Thu, 24 Sep 2026 07:16:05 +0800 Subject: [PATCH 4/5] Show accepted team reports in Goal Files Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com> --- .../src/features/personal-workspace/i18n.tsx | 4 + .../personal-workspace-page.tsx | 82 +++++++++++++------ loopx/web/chat/asset-retention.json | 6 +- .../{index-BGlmetKk.js => index-NEepBZD-.js} | 19 ++--- loopx/web/chat/index.html | 2 +- 5 files changed, 75 insertions(+), 38 deletions(-) rename loopx/web/chat/assets/{index-BGlmetKk.js => index-NEepBZD-.js} (83%) diff --git a/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx b/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx index 8793c3c1cb..7ec7758364 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx @@ -390,6 +390,8 @@ const en = { "drawer.workspaceCandidates": "Available workspaces", "files.emptySummary": "Public-safe output", "files.empty": "No delivered files or verified reports yet. Run and validation status remain in Tasks.", + "files.checkingTeam": "Checking this Goal conversation for verified team results…", + "files.teamLoadFailed": "Could not check team results from this Goal conversation.", "files.loadingReports": "Loading verified milestone reports…", "files.reportDelta": "+{added} added · {changed} changed", "files.reportAdded": "added", @@ -1470,6 +1472,8 @@ const zhCN: Record = { "drawer.workspaceCandidates": "可选择的工作区", "files.emptySummary": "公开安全产出", "files.empty": "还没有已交付文件或已验证报告。运行和验证状态请在任务中查看。", + "files.checkingTeam": "正在检查当前 Goal 会话的已验证团队成果…", + "files.teamLoadFailed": "无法核验当前 Goal 会话的团队成果。", "files.loadingReports": "正在加载已验证的阶段周报…", "files.reportDelta": "+{added} 新增 · {changed} 变化", "files.reportAdded": "新增", 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 d13a58fe66..fe87d2f191 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 @@ -16,6 +16,7 @@ import { fetchGoalContexts, fetchGoalChannelTargets, fetchLarkConnections, + fetchLoopXMode, listTypedActions, previewTypedAction, setupGoalChannel, @@ -181,40 +182,71 @@ function ManagerHomeBoard({ } function GoalOutputsView({ + active, items, onSelect, reportState, + teamSessionId, }: { + active: boolean; items: Array>; onSelect: (selection: WorkspaceDrawerSelection) => void; reportState?: WorkspaceModel["periodicReports"]; + teamSessionId?: string; }) { const { locale, t } = useWorkspaceI18n(); + const [teamSnapshot, setTeamSnapshot] = useState(null); + const [teamError, setTeamError] = useState(false); + const [teamRefresh, setTeamRefresh] = useState(0); + useEffect(() => { + if (!active || !teamSessionId) { + setTeamSnapshot(null); + setTeamError(false); + return; + } + let current = true; + setTeamSnapshot(null); + setTeamError(false); + void fetchLoopXMode(teamSessionId).then((snapshot) => { + if (current) setTeamSnapshot(snapshot); + }).catch(() => { + if (current) setTeamError(true); + }); + return () => { current = false; }; + }, [active, teamSessionId, teamRefresh]); + const teamConfigured = Boolean(teamSnapshot?.session_id === teamSessionId + && teamSnapshot?.settings.agent_id && teamSnapshot?.settings.execution_config); return ( -
-
{t("files.title")}{items.length}
- {reportState?.loading ? ( -

{t("files.loadingReports")}

- ) : null} - {reportState?.error ? ( -

{t("files.reportLoadFailed")}: {reportState.error}

- ) : null} - {!reportState?.loading && !reportState?.error && items.length === 0 ? ( -

{t("files.empty")}

- ) : null} - {items.map((item) => ( - - ))} -
+ <> +
+
{t("files.title")}{!teamConfigured ? {items.length} : null}
+ {reportState?.loading ? ( +

{t("files.loadingReports")}

+ ) : null} + {reportState?.error ? ( +

{t("files.reportLoadFailed")}: {reportState.error}

+ ) : null} + {!reportState?.loading && !reportState?.error && items.length === 0 && !teamConfigured + && (!teamSessionId || Boolean(teamSnapshot)) ? ( +

{t("files.empty")}

+ ) : null} + {items.map((item) => ( + + ))} +
+ {active && teamSessionId && !teamSnapshot && !teamError ?

{t("files.checkingTeam")}

: null} + {active && teamSessionId && teamError ?

{t("files.teamLoadFailed")}

: null} + {active && teamConfigured && teamSessionId ? : null} + ); } @@ -1991,9 +2023,11 @@ export function PersonalWorkspacePage({ userTodos={model.userTodos} />), files: ( => item.kind === "output")} onSelect={setSelection} reportState={model.periodicReports} + teamSessionId={!readOnly && selectedAgentId === "codex" ? conversationSessionId : undefined} />), chat: (<> {selectedGoal && activeSessionRun?.goalId === selectedGoal.goalId ? ( diff --git a/loopx/web/chat/asset-retention.json b/loopx/web/chat/asset-retention.json index 9d9d7f5fe7..505938fed7 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-BxY1Qe0B.js", - "assets/index-C_Imc7ZG.css" + "assets/index-C_Imc7ZG.css", + "assets/index-NEepBZD-.js" ], [ "assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2", @@ -28,7 +28,7 @@ "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-BGlmetKk.js", + "assets/index-BxY1Qe0B.js", "assets/index-C_Imc7ZG.css" ] ] diff --git a/loopx/web/chat/assets/index-BGlmetKk.js b/loopx/web/chat/assets/index-NEepBZD-.js similarity index 83% rename from loopx/web/chat/assets/index-BGlmetKk.js rename to loopx/web/chat/assets/index-NEepBZD-.js index 8e6d241b50..e69c6dbb06 100644 --- a/loopx/web/chat/assets/index-BGlmetKk.js +++ b/loopx/web/chat/assets/index-NEepBZD-.js @@ -28,7 +28,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.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.validationRevision":`Validation revision`,"drawer.validationDigest":`Validation declaration digest`,"drawer.validationRevisionActor":`Revised by`,"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.subagentAppliedRestart":`Applied and verified. The raised Codex child-agent limit takes effect in new Sessions.`,"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.subagentExecutionConfig":`Delegation bindings`,"drawer.subagentExecutionConfigHint":`Optional repo-relative ignored JSON under .loopx/config/. Planning sees only authorized route status; the file remains the execution-grant owner.`,"drawer.subagentExecutionConfigNone":`Not configured`,"drawer.subagentMaxChildren":`Maximum child agents`,"drawer.subagentHostCapacityImplicit":`implicit default`,"drawer.subagentHostCapacityRaise":`Confirming also raises the Codex child-agent limit to at least {required} (currently {configured}). Existing higher values are preserved; new Sessions are required.`,"drawer.subagentHostCapacityReady":`Codex child-agent capacity ({configured}) already satisfies this Goal ({required}).`,"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.taskPriority":`Priority`,"drawer.taskPriorityChoose":`Choose priority`,"drawer.taskPriorityClear":`No priority`,"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.overview":`Overview`,"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":`Configure this Goal’s capabilities`,"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.managerExecutorKindIndividual":`individual CLI login`,"header.managerExecutorKindManaged":`operator credential`,"header.managerExecutorKindRegistered":`registered endpoint`,"header.managerExecutionUnavailable":`Selected {executor} cannot start here; this channel does not fall back to an individual CLI login.`,"header.managerExecutionUnavailableCredential":`Selected {executor} needs the operator credential {credential} before this channel can start it.`,"header.managerExecutionUnavailableRuntime":`Selected {executor} cannot start here because its runtime is not installed on this machine.`,"header.managerExecutionUnavailableEffort":`Selected {executor} rejected the configured reasoning effort; set a supported effort and reload.`,"header.managerExecutionUnavailableOutputBudget":`Selected {executor} has an invalid per-request output-token limit; set a positive integer and reload.`,"header.managerEndpointStewardDefault":`Runs {executor}, the steward channel's shipped default. Select an executor explicitly to move it.`,"header.managerOutputTokenBudget":`{tokens} tok/request`,"header.managerAllocation":`Selection: {policy} · {reason}`,"header.managerSelectionPreferred":`preferred`,"header.managerSelectionPinned":`pinned`,"header.managerSelectionFlexible":`flexible pool`,"header.managerAllocationUser":`explicit user choice`,"header.managerAllocationPinned":`pinned by machine configuration`,"header.managerAllocationFallback":`primary unavailable; used an eligible fallback`,"header.managerAllocationUnavailable":`no eligible route is currently available`,"header.managerAllocationPrimary":`primary route is available`,"header.managerAllocationProductDefault":`product default`,"header.managerAllocationService":`service environment override`,"header.managerAllocationConfigured":`configured route`,"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.`,"drawer.recoverEditResult":`Recover operation result`,"drawer.retryOriginal":`Retry original operation`,"actionReview.canonical_update_retry":`The edit is not yet verified. Retry this operation to recover its result.`,"actionReview.canonical_update_projection_pending":`The operation was committed; display delivery is pending. Retry this operation to restore the current view.`,"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.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.teamPlan.gapReason.capabilityNotGranted":`Required capability not granted`,"proposal.teamPlan.gapReason.audienceNotAuthorized":`Required access not authorized`,"proposal.teamPlan.pending":`Pending`,"proposal.teamPlan.assignedHint":`Assignment recorded. See the Goal for execution progress.`,"proposal.teamPlan.recoveredHint":`No new tasks created. See the Goal for current progress.`,"proposal.teamPlan.originalPlan":`View original plan`,"proposal.teamPlan.viewResult":`View result`,"proposal.teamPlan.openGoal":`Open Goal`,"proposal.teamPlan.resultTitle":`Assignment result`,"proposal.teamPlan.retry":`Retry assignment`,"proposal.teamPlan.retryHint":`Retry this assignment to recover its result without duplicating tasks.`,"proposal.summary.teamPlan":`Assign {count} tasks for {goal}`,"proposal.impact.teamPlan":`Confirm to assign the ready tasks. Unavailable assignments stay pending.`,"proposal.primary.teamPlan":`Confirm assignment`,"proposal.field.laneGaps":`Unstaffed lanes`,"proposal.field.quotaEnvelope":`Quota envelope`,"proposal.teamPlan.acceptanceShort":`acceptance reference`,"proposal.teamPlan.advisory":`planning context; not enforced by this confirmation`,"proposal.teamPlan.appliedPartially":`{created} assigned · {gaps} pending`,"proposal.teamPlan.appliedAlreadyPresent":`Original assignment recovered`,"proposal.teamPlan.applied":`{count} tasks assigned`,"proposal.teamPlan.gapLane":`unstaffed`,"proposal.teamPlan.laneUnstaffed":`staffing gap, no first Todo`,"proposal.teamPlan.gapReason.agentNotRegistered":`the Agent is not registered for this Goal`,"proposal.teamPlan.gapReason.actionKindNotSupported":`this host does not ship that action kind`,"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.credentialTitle":`Operator model credential`,"machine.credentialDescription":`The key and endpoint the steward channel and the managed host authenticate with on this machine. The key is stored in its own owner-only file, never in the machine configuration that is projected here, and it is never read back — only its fingerprint is.`,"machine.credentialApiKey":`API key`,"machine.credentialApiKeyPlaceholder":`Paste a key to store it; leave blank to keep the stored one`,"machine.credentialBaseUrl":`Endpoint base URL`,"machine.credentialBaseUrlPlaceholder":`https://endpoint.example/v1 (blank keeps the endpoint default)`,"machine.credentialStore":`Store credential`,"machine.credentialClearKey":`Clear stored key`,"machine.credentialClearUrl":`Clear stored endpoint`,"machine.credentialConfigured":`configured`,"machine.credentialAbsent":`not configured`,"machine.credentialInvalid":`unreadable — repair required`,"machine.credentialSourceMachine":`this machine's stored credential`,"machine.credentialSourceEnvironment":`the service environment`,"machine.credentialSourceUnset":`no source`,"machine.credentialFingerprint":`fingerprint`,"machine.credentialStored":`Credential stored. The next turn uses it; no restart is needed.`,"machine.credentialCleared":`Stored credential cleared.`,"machine.credentialError":`The credential could not be stored.`,"machine.credentialBoundary":`Storing a credential grants no authority: it does not select an executor, model, or reasoning effort.`,"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.larkInboxNotificationDescription":`This switch controls automatic group messages for human gates. Incoming Lark events remain available when it is off.`,"capabilities.larkInboxNotificationSetting":`Human-gate group notifications`,"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.hostCapacityPartialWrite":`Goal value saved; Codex host capacity still needs alignment`,"capabilities.hostCapacityPartialWriteDescription":`The Goal configuration and shared projection were verified, but the Codex host limit was not updated. Refresh the preview after repairing the host configuration; do not resubmit the Goal change.`,"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.modelProvider":`Model provider`,"settings.globalCapabilities":`Global capabilities`,"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":`New conversation reply`,"tasks.chatPending":`Conversation in progress`,"tasks.chatReturn":`Collaboration receipt`,"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":`Draft a 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.blockers":`看阻塞`,"composer.attachImageHint":`选择、粘贴或拖入图片`,"composer.clarifyDefer":`暂缓 Todo 需要可自动判断的恢复条件。请补充 todo_done:、pr_merged:[owner/repo]#、capacity_available: 或 resume_at:<带时区 RFC3339 时间>。`,"composer.clarifySingleAction":`这句话包含多个可能修改状态的操作。请一次描述一项操作,我会逐项展示确认预览。`,"composer.evidence":`查证据`,"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.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.validationRevision":`Validation revision`,"drawer.validationDigest":`Validation declaration digest`,"drawer.validationRevisionActor":`Revised by`,"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.subagentAppliedRestart":`Applied and verified. The raised Codex child-agent limit takes effect in new Sessions.`,"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.subagentExecutionConfig":`Delegation bindings`,"drawer.subagentExecutionConfigHint":`Optional repo-relative ignored JSON under .loopx/config/. Planning sees only authorized route status; the file remains the execution-grant owner.`,"drawer.subagentExecutionConfigNone":`Not configured`,"drawer.subagentMaxChildren":`Maximum child agents`,"drawer.subagentHostCapacityImplicit":`implicit default`,"drawer.subagentHostCapacityRaise":`Confirming also raises the Codex child-agent limit to at least {required} (currently {configured}). Existing higher values are preserved; new Sessions are required.`,"drawer.subagentHostCapacityReady":`Codex child-agent capacity ({configured}) already satisfies this Goal ({required}).`,"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.taskPriority":`Priority`,"drawer.taskPriorityChoose":`Choose priority`,"drawer.taskPriorityClear":`No priority`,"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 delivered files or verified reports yet. Run and validation status remain in Tasks.`,"files.checkingTeam":`Checking this Goal conversation for verified team results…`,"files.teamLoadFailed":`Could not check team results from this Goal conversation.`,"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.overview":`Overview`,"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":`Configure this Goal’s capabilities`,"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.managerExecutorKindIndividual":`individual CLI login`,"header.managerExecutorKindManaged":`operator credential`,"header.managerExecutorKindRegistered":`registered endpoint`,"header.managerExecutionUnavailable":`Selected {executor} cannot start here; this channel does not fall back to an individual CLI login.`,"header.managerExecutionUnavailableCredential":`Selected {executor} needs the operator credential {credential} before this channel can start it.`,"header.managerExecutionUnavailableRuntime":`Selected {executor} cannot start here because its runtime is not installed on this machine.`,"header.managerExecutionUnavailableEffort":`Selected {executor} rejected the configured reasoning effort; set a supported effort and reload.`,"header.managerExecutionUnavailableOutputBudget":`Selected {executor} has an invalid per-request output-token limit; set a positive integer and reload.`,"header.managerEndpointStewardDefault":`Runs {executor}, the steward channel's shipped default. Select an executor explicitly to move it.`,"header.managerOutputTokenBudget":`{tokens} tok/request`,"header.managerAllocation":`Selection: {policy} · {reason}`,"header.managerSelectionPreferred":`preferred`,"header.managerSelectionPinned":`pinned`,"header.managerSelectionFlexible":`flexible pool`,"header.managerAllocationUser":`explicit user choice`,"header.managerAllocationPinned":`pinned by machine configuration`,"header.managerAllocationFallback":`primary unavailable; used an eligible fallback`,"header.managerAllocationUnavailable":`no eligible route is currently available`,"header.managerAllocationPrimary":`primary route is available`,"header.managerAllocationProductDefault":`product default`,"header.managerAllocationService":`service environment override`,"header.managerAllocationConfigured":`configured route`,"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.`,"drawer.recoverEditResult":`Recover operation result`,"drawer.retryOriginal":`Retry original operation`,"actionReview.canonical_update_retry":`The edit is not yet verified. Retry this operation to recover its result.`,"actionReview.canonical_update_projection_pending":`The operation was committed; display delivery is pending. Retry this operation to restore the current view.`,"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.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.teamPlan.gapReason.capabilityNotGranted":`Required capability not granted`,"proposal.teamPlan.gapReason.audienceNotAuthorized":`Required access not authorized`,"proposal.teamPlan.pending":`Pending`,"proposal.teamPlan.assignedHint":`Assignment recorded. See the Goal for execution progress.`,"proposal.teamPlan.recoveredHint":`No new tasks created. See the Goal for current progress.`,"proposal.teamPlan.originalPlan":`View original plan`,"proposal.teamPlan.viewResult":`View result`,"proposal.teamPlan.openGoal":`Open Goal`,"proposal.teamPlan.resultTitle":`Assignment result`,"proposal.teamPlan.retry":`Retry assignment`,"proposal.teamPlan.retryHint":`Retry this assignment to recover its result without duplicating tasks.`,"proposal.summary.teamPlan":`Assign {count} tasks for {goal}`,"proposal.impact.teamPlan":`Confirm to assign the ready tasks. Unavailable assignments stay pending.`,"proposal.primary.teamPlan":`Confirm assignment`,"proposal.field.laneGaps":`Unstaffed lanes`,"proposal.field.quotaEnvelope":`Quota envelope`,"proposal.teamPlan.acceptanceShort":`acceptance reference`,"proposal.teamPlan.advisory":`planning context; not enforced by this confirmation`,"proposal.teamPlan.appliedPartially":`{created} assigned · {gaps} pending`,"proposal.teamPlan.appliedAlreadyPresent":`Original assignment recovered`,"proposal.teamPlan.applied":`{count} tasks assigned`,"proposal.teamPlan.gapLane":`unstaffed`,"proposal.teamPlan.laneUnstaffed":`staffing gap, no first Todo`,"proposal.teamPlan.gapReason.agentNotRegistered":`the Agent is not registered for this Goal`,"proposal.teamPlan.gapReason.actionKindNotSupported":`this host does not ship that action kind`,"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.firstReadOnlyAdapterCheck":`Run the first read-only adapter check and save progress`,"projection.nextUpdatePending":`Waiting for LoopX to update the next step`,"projection.refreshState":`Refresh LoopX status and confirm the current progress is still valid`,"projection.statusRefreshNeeded":`LoopX status needs to be refreshed`,"projection.todoStatusUpdated":`Todo status updated; confirming the next step`,"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.credentialTitle":`Operator model credential`,"machine.credentialDescription":`The key and endpoint the steward channel and the managed host authenticate with on this machine. The key is stored in its own owner-only file, never in the machine configuration that is projected here, and it is never read back — only its fingerprint is.`,"machine.credentialApiKey":`API key`,"machine.credentialApiKeyPlaceholder":`Paste a key to store it; leave blank to keep the stored one`,"machine.credentialBaseUrl":`Endpoint base URL`,"machine.credentialBaseUrlPlaceholder":`https://endpoint.example/v1 (blank keeps the endpoint default)`,"machine.credentialStore":`Store credential`,"machine.credentialClearKey":`Clear stored key`,"machine.credentialClearUrl":`Clear stored endpoint`,"machine.credentialConfigured":`configured`,"machine.credentialAbsent":`not configured`,"machine.credentialInvalid":`unreadable — repair required`,"machine.credentialSourceMachine":`this machine's stored credential`,"machine.credentialSourceEnvironment":`the service environment`,"machine.credentialSourceUnset":`no source`,"machine.credentialFingerprint":`fingerprint`,"machine.credentialStored":`Credential stored. The next turn uses it; no restart is needed.`,"machine.credentialCleared":`Stored credential cleared.`,"machine.credentialError":`The credential could not be stored.`,"machine.credentialBoundary":`Storing a credential grants no authority: it does not select an executor, model, or reasoning effort.`,"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.larkInboxNotificationDescription":`This switch controls automatic group messages for human gates. Incoming Lark events remain available when it is off.`,"capabilities.larkInboxNotificationSetting":`Human-gate group notifications`,"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.hostCapacityPartialWrite":`Goal value saved; Codex host capacity still needs alignment`,"capabilities.hostCapacityPartialWriteDescription":`The Goal configuration and shared projection were verified, but the Codex host limit was not updated. Refresh the preview after repairing the host configuration; do not resubmit the Goal change.`,"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.modelProvider":`Model provider`,"settings.globalCapabilities":`Global capabilities`,"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":`New conversation reply`,"tasks.chatPending":`Conversation in progress`,"tasks.chatReturn":`Collaboration receipt`,"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":`Draft a 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.blockers":`看阻塞`,"composer.attachImageHint":`选择、粘贴或拖入图片`,"composer.clarifyDefer":`暂缓 Todo 需要可自动判断的恢复条件。请补充 todo_done:、pr_merged:[owner/repo]#、capacity_available: 或 resume_at:<带时区 RFC3339 时间>。`,"composer.clarifySingleAction":`这句话包含多个可能修改状态的操作。请一次描述一项操作,我会逐项展示确认预览。`,"composer.evidence":`查证据`,"composer.createGoal":`创建新 Goal`,"composer.createGoalDraft":`Goal 草稿`,"composer.createGoalDraftDescription":`补充内容后发送,LoopX 会先展示待确认操作。`,"composer.createGoalDraftLead":`我想创建一个长期 Goal:`,"composer.createGoalTemplate":`我想创建一个长期 Goal: 目标: 完成标准: 执行边界(可选): @@ -50,7 +50,7 @@ Goal: Goal: 频率:每天 停止条件:Goal 完成 -通知:仅在需要我时`,"composer.nextAction":`询问下一步`,"composer.nextActionPrompt":`我现在该做什么?`,"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.validationRevision":`验证声明修订`,"drawer.validationDigest":`验证声明摘要`,"drawer.validationRevisionActor":`修订者`,"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.subagentAppliedRestart":`已写入并完成读回校验;提升后的 Codex 子 Agent 上限将在新 Session 中生效。`,"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.subagentExecutionConfig":`委托执行绑定`,"drawer.subagentExecutionConfigHint":`可选;填写 .loopx/config/ 下仓库相对、已忽略的 JSON。规划只读取已授权路由状态,执行授权仍由该文件持有。`,"drawer.subagentExecutionConfigNone":`未配置`,"drawer.subagentMaxChildren":`最多子代理数`,"drawer.subagentHostCapacityImplicit":`隐式默认值`,"drawer.subagentHostCapacityRaise":`确认后还会把 Codex 子 Agent 上限从当前 {configured} 提升到至少 {required};已有更高值不会降低,并需新建 Session 生效。`,"drawer.subagentHostCapacityReady":`Codex 子 Agent 容量({configured})已满足该 Goal({required})。`,"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.taskPriority":`优先级`,"drawer.taskPriorityChoose":`选择优先级`,"drawer.taskPriorityClear":`不设优先级`,"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.overview":`概览`,"header.chat":`对话`,"header.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.managerExecutorKindIndividual":`个人 CLI 登录`,"header.managerExecutorKindManaged":`operator 凭据`,"header.managerExecutorKindRegistered":`注册端点`,"header.managerExecutionUnavailable":`所选执行器 {executor} 无法在本机启动;该通道不会回落到个人 CLI 登录。`,"header.managerExecutionUnavailableCredential":`所选执行器 {executor} 需要 operator 凭据 {credential},配置后该通道才能启动它。`,"header.managerExecutionUnavailableRuntime":`所选执行器 {executor} 无法在本机启动:本机未安装其 runtime。`,"header.managerExecutionUnavailableEffort":`所选执行器 {executor} 拒绝了当前配置的推理档位;请改为受支持的档位后刷新。`,"header.managerExecutionUnavailableOutputBudget":`所选执行器 {executor} 的每请求输出 token 上限无效;请设置为正整数后刷新。`,"header.managerEndpointStewardDefault":`当前运行 {executor},管家通道的出货默认值;如需改指请显式选择执行器。`,"header.managerOutputTokenBudget":`每次请求 {tokens} token`,"header.managerAllocation":`选择:{policy} · {reason}`,"header.managerSelectionPreferred":`偏好`,"header.managerSelectionPinned":`锁定`,"header.managerSelectionFlexible":`灵活资源池`,"header.managerAllocationUser":`用户明确选择`,"header.managerAllocationPinned":`由本机配置锁定`,"header.managerAllocationFallback":`首选不可用,使用池内合格替代`,"header.managerAllocationUnavailable":`当前没有可用的合格路径`,"header.managerAllocationPrimary":`首选路径可用`,"header.managerAllocationProductDefault":`产品默认路径`,"header.managerAllocationService":`服务环境覆盖`,"header.managerAllocationConfigured":`按已配置路径`,"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":`任务`,"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":`操作结果已经记录,但原群结果卡尚未通过回读核验。`,"drawer.recoverEditResult":`恢复操作结果`,"drawer.retryOriginal":`重试原操作`,"actionReview.canonical_update_retry":`编辑结果尚未确认。重试此操作以恢复原结果。`,"actionReview.canonical_update_projection_pending":`操作已提交,展示尚未同步。重试此操作以恢复当前视图。`,"actionReview.apply_failed":`执行未完成。请检查失败原因并重新生成预览后再试。`,"actionReview.inactive_proposal":`此提案当前不可执行。请重新检查后再继续。`,"proposal.gate.default":`需要宿主确认`,"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.teamPlan.gapReason.capabilityNotGranted":`尚未授予所需能力`,"proposal.teamPlan.gapReason.audienceNotAuthorized":`尚未获得所需访问权限`,"proposal.teamPlan.pending":`待安排`,"proposal.teamPlan.assignedHint":`分配已记录,执行进度请查看目标。`,"proposal.teamPlan.recoveredHint":`未新增任务,当前进度请查看目标。`,"proposal.teamPlan.originalPlan":`查看原计划`,"proposal.teamPlan.viewResult":`查看结果`,"proposal.teamPlan.openGoal":`打开目标`,"proposal.teamPlan.resultTitle":`分配结果`,"proposal.teamPlan.retry":`重试分配`,"proposal.teamPlan.retryHint":`重试会恢复本次分配结果,不会重复创建任务。`,"proposal.summary.teamPlan":`为 {goal} 分配 {count} 项任务`,"proposal.impact.teamPlan":`确认后分配可安排的任务,其余保留为待安排。`,"proposal.primary.teamPlan":`确认分配`,"proposal.field.laneGaps":`未配齐的 lane`,"proposal.field.quotaEnvelope":`配额包络`,"proposal.teamPlan.acceptanceShort":`验收参考`,"proposal.teamPlan.advisory":`计划参考;本次确认不执行该约束`,"proposal.teamPlan.appliedPartially":`已分配 {created} 项,{gaps} 项待安排`,"proposal.teamPlan.appliedAlreadyPresent":`已恢复原分配结果`,"proposal.teamPlan.applied":`已分配 {count} 项任务`,"proposal.teamPlan.gapLane":`待安排`,"proposal.teamPlan.laneUnstaffed":`待安排,尚无任务`,"proposal.teamPlan.gapReason.agentNotRegistered":`尚未加入此目标`,"proposal.teamPlan.gapReason.actionKindNotSupported":`当前环境不支持此任务类型`,"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.credentialTitle":`操作者模型凭据`,"machine.credentialDescription":`管家通道与托管宿主在本机认证用的 key 与 endpoint。key 单独存放于仅属主可读的文件,不会进入这里展示的机器配置,也不会被回读——回读的是它的指纹。`,"machine.credentialApiKey":`API key`,"machine.credentialApiKeyPlaceholder":`粘贴 key 以保存;留空则保留已存的 key`,"machine.credentialBaseUrl":`Endpoint base URL`,"machine.credentialBaseUrlPlaceholder":`https://endpoint.example/v1(留空则使用 endpoint 默认值)`,"machine.credentialStore":`保存凭据`,"machine.credentialClearKey":`清除已存 key`,"machine.credentialClearUrl":`清除已存 endpoint`,"machine.credentialConfigured":`已配置`,"machine.credentialAbsent":`未配置`,"machine.credentialInvalid":`无法读取——需要修复`,"machine.credentialSourceMachine":`本机已存凭据`,"machine.credentialSourceEnvironment":`服务环境变量`,"machine.credentialSourceUnset":`无来源`,"machine.credentialFingerprint":`指纹`,"machine.credentialStored":`凭据已保存。下一轮即生效,无需重启。`,"machine.credentialCleared":`已清除本机存储的凭据。`,"machine.credentialError":`凭据保存失败。`,"machine.credentialBoundary":`保存凭据不授予任何权限:它不会选择执行器、模型或推理强度。`,"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.larkInboxNotificationDescription":`此开关只控制遇到人工 Gate 时是否自动发群消息;关闭后仍会保留飞书事件收件箱能力。`,"capabilities.larkInboxNotificationSetting":`Gate 群通知`,"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.hostCapacityPartialWrite":`Goal 值已保存;Codex 宿主容量仍待对齐`,"capabilities.hostCapacityPartialWriteDescription":`Goal 配置与共享投影均已校验,但 Codex 宿主上限尚未更新。修复宿主配置后请重新预览容量对齐,不要重复提交 Goal 变更。`,"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.modelProvider":`模型 Provider 配置`,"settings.globalCapabilities":`全局能力配置`,"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":`对话有新回复`,"tasks.chatPending":`对话处理中`,"tasks.chatReturn":`协作回执`,"tasks.chatPendingDescription":`正在处理;只有经过确认的任务操作才会更新 Tasks。`,"tasks.chatRecent":`最近对话`,"tasks.chatUnchangedDescription":`本次对话没有直接修改 Tasks。需要执行时,可先转成 Task 草稿并确认。`,"tasks.chatViewReply":`查看回复`,"tasks.convertToTask":`转为任务草稿`,"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 Gi(e,t){return t?Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e):e}function Ki(){try{return window.localStorage.getItem(`loopx-pw-locale`)===`en`?`en`:`zh-CN`}catch{return`zh-CN`}}function qi({children:e}){let[t,n]=(0,R.useState)(Ki);function r(e){n(e);try{window.localStorage.setItem(Ui,e)}catch{}}(0,R.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,R.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Gi(Wi[t][e],n)}),[t]);return(0,z.jsx)(Hi.Provider,{value:i,children:e})}function Ji(){let e=(0,R.useContext)(Hi);if(!e)throw Error(`useWorkspaceI18n must be used within WorkspaceI18nProvider`);return e}function Yi(e,t){let n={安静运行:`state.quiet`,等你:`state.needsYou`,等待条件:`state.waiting`,推进中:`state.running`,需修复:`state.needsRepair`,已完成:`state.completed`,已停止:`state.stopped`}[e];return n?Wi[t][n]:e}function Xi(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 Zi(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 Qi;function H(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 $i=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ea=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Qi=globalThis).__zod_globalConfig??(Qi.__zod_globalConfig={});var ta=globalThis.__zod_globalConfig;function na(e){return e&&Object.assign(ta,e),ta}function ra(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 ia(e,t){return typeof t==`bigint`?t.toString():t}function aa(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function oa(e){return e==null}function sa(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ca(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 ga(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var _a=aa(()=>{if(ta.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function va(e){if(ga(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ga(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ya(e){return va(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ba=new Set([`string`,`number`,`symbol`]);function xa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Sa(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function U(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 Ca(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var wa={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ta(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 Sa(e,fa(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 da(this,`shape`,e),e},checks:[]}))}function Ea(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 Sa(e,fa(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 da(this,`shape`,r),r},checks:[]}))}function Da(e,t){if(!va(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 Sa(e,fa(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return da(this,`shape`,n),n}}))}function Oa(e,t){if(!va(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Sa(e,fa(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return da(this,`shape`,n),n}}))}function ka(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Sa(e,fa(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return da(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Aa(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 Sa(t,fa(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 da(this,`shape`,i),i},checks:[]}))}function ja(e,t,n){return Sa(t,fa(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 da(this,`shape`,i),i}}))}function Ma(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 Fa(e){return typeof e==`string`?e:e?.message}function Ia(e,t,n){let r=e.message?e.message:Fa(e.inst?._zod.def?.error?.(e))??Fa(t?.error?.(e))??Fa(n.customError?.(e))??Fa(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 La(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ra(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var za=(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,ia,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ba=H(`$ZodError`,za),Va=H(`$ZodError`,za,{Parent:Error});function Ha(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 Ua(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 $i;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ia(e,a,na())));throw ha(t,i?.callee),t}return o.value},Ga=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=>Ia(e,a,na())));throw ha(t,i?.callee),t}return o.value},Ka=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 $i;return a.issues.length?{success:!1,error:new(e??Ba)(a.issues.map(e=>Ia(e,i,na())))}:{success:!0,data:a.value}},qa=Ka(Va),Ja=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=>Ia(e,i,na())))}:{success:!0,data:a.value}},Ya=Ja(Va),Xa=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Wa(e)(t,n,i)},Za=e=>(t,n,r)=>Wa(e)(t,n,r),Qa=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ga(e)(t,n,i)},$a=e=>async(t,n,r)=>Ga(e)(t,n,r),eo=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ka(e)(t,n,i)},to=e=>(t,n,r)=>Ka(e)(t,n,r),no=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ja(e)(t,n,i)},ro=e=>async(t,n,r)=>Ja(e)(t,n,r),io=/^[cC][0-9a-z]{6,}$/,ao=/^[0-9a-z]+$/,oo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,so=/^[0-9a-vA-V]{20}$/,co=/^[A-Za-z0-9]{27}$/,lo=/^[a-zA-Z0-9_-]{21}$/,uo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fo=/^([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})$/,po=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)$/,mo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ho=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function go(){return new RegExp(ho,`u`)}var _o=/^(?:(?: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])$/,vo=/^(([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}|:))$/,yo=/^((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])$/,bo=/^(([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])$/,xo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,So=/^[A-Za-z0-9_-]*$/,Co=/^https?$/,wo=/^\+[1-9]\d{6,14}$/,To=`(?:(?:\\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])))`,Eo=RegExp(`^${To}$`);function Do(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 Oo(e){return RegExp(`^${Do(e)}$`)}function ko(e){let t=Do({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(`^${To}T(?:${r})$`)}var Ao=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},jo=/^-?\d+$/,Mo=/^-?\d+(?:\.\d+)?$/,No=/^(?:true|false)$/i,Po=/^null$/i,Fo=/^[^A-Z]*$/,Io=/^[^a-z]*$/,Lo=H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ro={number:`number`,bigint:`bigint`,object:`date`},zo=H(`$ZodCheckLessThan`,(e,t)=>{Lo.init(e,t);let n=Ro[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{Lo.init(e,t);let n=Ro[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})}}),Vo=H(`$ZodCheckMultipleOf`,(e,t)=>{Lo.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):ca(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})}}),Ho=H(`$ZodCheckNumberFormat`,(e,t)=>{Lo.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=wa[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=jo)}),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})}}),Uo=H(`$ZodCheckMaxLength`,(e,t)=>{var n;Lo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!oa(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=La(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wo=H(`$ZodCheckMinLength`,(e,t)=>{var n;Lo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!oa(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=La(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Go=H(`$ZodCheckLengthEquals`,(e,t)=>{var n;Lo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!oa(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=La(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})}}),Ko=H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Lo.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=()=>{})}),qo=H(`$ZodCheckRegex`,(e,t)=>{Ko.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})}}),Jo=H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Fo,Ko.init(e,t)}),Yo=H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Io,Ko.init(e,t)}),Xo=H(`$ZodCheckIncludes`,(e,t)=>{Lo.init(e,t);let n=xa(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})}}),Zo=H(`$ZodCheckStartsWith`,(e,t)=>{Lo.init(e,t);let n=RegExp(`^${xa(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})}}),Qo=H(`$ZodCheckEndsWith`,(e,t)=>{Lo.init(e,t);let n=RegExp(`.*${xa(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})}}),$o=H(`$ZodCheckOverwrite`,(e,t)=>{Lo.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),es=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.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.validationRevision":`验证声明修订`,"drawer.validationDigest":`验证声明摘要`,"drawer.validationRevisionActor":`修订者`,"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.subagentAppliedRestart":`已写入并完成读回校验;提升后的 Codex 子 Agent 上限将在新 Session 中生效。`,"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.subagentExecutionConfig":`委托执行绑定`,"drawer.subagentExecutionConfigHint":`可选;填写 .loopx/config/ 下仓库相对、已忽略的 JSON。规划只读取已授权路由状态,执行授权仍由该文件持有。`,"drawer.subagentExecutionConfigNone":`未配置`,"drawer.subagentMaxChildren":`最多子代理数`,"drawer.subagentHostCapacityImplicit":`隐式默认值`,"drawer.subagentHostCapacityRaise":`确认后还会把 Codex 子 Agent 上限从当前 {configured} 提升到至少 {required};已有更高值不会降低,并需新建 Session 生效。`,"drawer.subagentHostCapacityReady":`Codex 子 Agent 容量({configured})已满足该 Goal({required})。`,"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.taskPriority":`优先级`,"drawer.taskPriorityChoose":`选择优先级`,"drawer.taskPriorityClear":`不设优先级`,"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.checkingTeam":`正在检查当前 Goal 会话的已验证团队成果…`,"files.teamLoadFailed":`无法核验当前 Goal 会话的团队成果。`,"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.overview":`概览`,"header.chat":`对话`,"header.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.managerExecutorKindIndividual":`个人 CLI 登录`,"header.managerExecutorKindManaged":`operator 凭据`,"header.managerExecutorKindRegistered":`注册端点`,"header.managerExecutionUnavailable":`所选执行器 {executor} 无法在本机启动;该通道不会回落到个人 CLI 登录。`,"header.managerExecutionUnavailableCredential":`所选执行器 {executor} 需要 operator 凭据 {credential},配置后该通道才能启动它。`,"header.managerExecutionUnavailableRuntime":`所选执行器 {executor} 无法在本机启动:本机未安装其 runtime。`,"header.managerExecutionUnavailableEffort":`所选执行器 {executor} 拒绝了当前配置的推理档位;请改为受支持的档位后刷新。`,"header.managerExecutionUnavailableOutputBudget":`所选执行器 {executor} 的每请求输出 token 上限无效;请设置为正整数后刷新。`,"header.managerEndpointStewardDefault":`当前运行 {executor},管家通道的出货默认值;如需改指请显式选择执行器。`,"header.managerOutputTokenBudget":`每次请求 {tokens} token`,"header.managerAllocation":`选择:{policy} · {reason}`,"header.managerSelectionPreferred":`偏好`,"header.managerSelectionPinned":`锁定`,"header.managerSelectionFlexible":`灵活资源池`,"header.managerAllocationUser":`用户明确选择`,"header.managerAllocationPinned":`由本机配置锁定`,"header.managerAllocationFallback":`首选不可用,使用池内合格替代`,"header.managerAllocationUnavailable":`当前没有可用的合格路径`,"header.managerAllocationPrimary":`首选路径可用`,"header.managerAllocationProductDefault":`产品默认路径`,"header.managerAllocationService":`服务环境覆盖`,"header.managerAllocationConfigured":`按已配置路径`,"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":`任务`,"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":`操作结果已经记录,但原群结果卡尚未通过回读核验。`,"drawer.recoverEditResult":`恢复操作结果`,"drawer.retryOriginal":`重试原操作`,"actionReview.canonical_update_retry":`编辑结果尚未确认。重试此操作以恢复原结果。`,"actionReview.canonical_update_projection_pending":`操作已提交,展示尚未同步。重试此操作以恢复当前视图。`,"actionReview.apply_failed":`执行未完成。请检查失败原因并重新生成预览后再试。`,"actionReview.inactive_proposal":`此提案当前不可执行。请重新检查后再继续。`,"proposal.gate.default":`需要宿主确认`,"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.teamPlan.gapReason.capabilityNotGranted":`尚未授予所需能力`,"proposal.teamPlan.gapReason.audienceNotAuthorized":`尚未获得所需访问权限`,"proposal.teamPlan.pending":`待安排`,"proposal.teamPlan.assignedHint":`分配已记录,执行进度请查看目标。`,"proposal.teamPlan.recoveredHint":`未新增任务,当前进度请查看目标。`,"proposal.teamPlan.originalPlan":`查看原计划`,"proposal.teamPlan.viewResult":`查看结果`,"proposal.teamPlan.openGoal":`打开目标`,"proposal.teamPlan.resultTitle":`分配结果`,"proposal.teamPlan.retry":`重试分配`,"proposal.teamPlan.retryHint":`重试会恢复本次分配结果,不会重复创建任务。`,"proposal.summary.teamPlan":`为 {goal} 分配 {count} 项任务`,"proposal.impact.teamPlan":`确认后分配可安排的任务,其余保留为待安排。`,"proposal.primary.teamPlan":`确认分配`,"proposal.field.laneGaps":`未配齐的 lane`,"proposal.field.quotaEnvelope":`配额包络`,"proposal.teamPlan.acceptanceShort":`验收参考`,"proposal.teamPlan.advisory":`计划参考;本次确认不执行该约束`,"proposal.teamPlan.appliedPartially":`已分配 {created} 项,{gaps} 项待安排`,"proposal.teamPlan.appliedAlreadyPresent":`已恢复原分配结果`,"proposal.teamPlan.applied":`已分配 {count} 项任务`,"proposal.teamPlan.gapLane":`待安排`,"proposal.teamPlan.laneUnstaffed":`待安排,尚无任务`,"proposal.teamPlan.gapReason.agentNotRegistered":`尚未加入此目标`,"proposal.teamPlan.gapReason.actionKindNotSupported":`当前环境不支持此任务类型`,"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.firstReadOnlyAdapterCheck":`执行首次只读适配检查并保存进度`,"projection.nextUpdatePending":`等待 LoopX 更新下一步`,"projection.refreshState":`刷新 LoopX 状态,确认当前进度仍然有效`,"projection.statusRefreshNeeded":`LoopX 状态需要刷新`,"projection.todoStatusUpdated":`Todo 状态已经更新,正在确认下一步`,"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.credentialTitle":`操作者模型凭据`,"machine.credentialDescription":`管家通道与托管宿主在本机认证用的 key 与 endpoint。key 单独存放于仅属主可读的文件,不会进入这里展示的机器配置,也不会被回读——回读的是它的指纹。`,"machine.credentialApiKey":`API key`,"machine.credentialApiKeyPlaceholder":`粘贴 key 以保存;留空则保留已存的 key`,"machine.credentialBaseUrl":`Endpoint base URL`,"machine.credentialBaseUrlPlaceholder":`https://endpoint.example/v1(留空则使用 endpoint 默认值)`,"machine.credentialStore":`保存凭据`,"machine.credentialClearKey":`清除已存 key`,"machine.credentialClearUrl":`清除已存 endpoint`,"machine.credentialConfigured":`已配置`,"machine.credentialAbsent":`未配置`,"machine.credentialInvalid":`无法读取——需要修复`,"machine.credentialSourceMachine":`本机已存凭据`,"machine.credentialSourceEnvironment":`服务环境变量`,"machine.credentialSourceUnset":`无来源`,"machine.credentialFingerprint":`指纹`,"machine.credentialStored":`凭据已保存。下一轮即生效,无需重启。`,"machine.credentialCleared":`已清除本机存储的凭据。`,"machine.credentialError":`凭据保存失败。`,"machine.credentialBoundary":`保存凭据不授予任何权限:它不会选择执行器、模型或推理强度。`,"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.larkInboxNotificationDescription":`此开关只控制遇到人工 Gate 时是否自动发群消息;关闭后仍会保留飞书事件收件箱能力。`,"capabilities.larkInboxNotificationSetting":`Gate 群通知`,"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.hostCapacityPartialWrite":`Goal 值已保存;Codex 宿主容量仍待对齐`,"capabilities.hostCapacityPartialWriteDescription":`Goal 配置与共享投影均已校验,但 Codex 宿主上限尚未更新。修复宿主配置后请重新预览容量对齐,不要重复提交 Goal 变更。`,"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.modelProvider":`模型 Provider 配置`,"settings.globalCapabilities":`全局能力配置`,"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":`对话有新回复`,"tasks.chatPending":`对话处理中`,"tasks.chatReturn":`协作回执`,"tasks.chatPendingDescription":`正在处理;只有经过确认的任务操作才会更新 Tasks。`,"tasks.chatRecent":`最近对话`,"tasks.chatUnchangedDescription":`本次对话没有直接修改 Tasks。需要执行时,可先转成 Task 草稿并确认。`,"tasks.chatViewReply":`查看回复`,"tasks.convertToTask":`转为任务草稿`,"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 Gi(e,t){return t?Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e):e}function Ki(){try{return window.localStorage.getItem(`loopx-pw-locale`)===`en`?`en`:`zh-CN`}catch{return`zh-CN`}}function qi({children:e}){let[t,n]=(0,R.useState)(Ki);function r(e){n(e);try{window.localStorage.setItem(Ui,e)}catch{}}(0,R.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,R.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Gi(Wi[t][e],n)}),[t]);return(0,z.jsx)(Hi.Provider,{value:i,children:e})}function Ji(){let e=(0,R.useContext)(Hi);if(!e)throw Error(`useWorkspaceI18n must be used within WorkspaceI18nProvider`);return e}function Yi(e,t){let n={安静运行:`state.quiet`,等你:`state.needsYou`,等待条件:`state.waiting`,推进中:`state.running`,需修复:`state.needsRepair`,已完成:`state.completed`,已停止:`state.stopped`}[e];return n?Wi[t][n]:e}function Xi(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 Zi(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 Qi;function H(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 $i=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ea=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Qi=globalThis).__zod_globalConfig??(Qi.__zod_globalConfig={});var ta=globalThis.__zod_globalConfig;function na(e){return e&&Object.assign(ta,e),ta}function ra(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 ia(e,t){return typeof t==`bigint`?t.toString():t}function aa(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function oa(e){return e==null}function sa(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ca(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 ga(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var _a=aa(()=>{if(ta.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function va(e){if(ga(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ga(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ya(e){return va(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ba=new Set([`string`,`number`,`symbol`]);function xa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Sa(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function U(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 Ca(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var wa={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ta(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 Sa(e,fa(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 da(this,`shape`,e),e},checks:[]}))}function Ea(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 Sa(e,fa(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 da(this,`shape`,r),r},checks:[]}))}function Da(e,t){if(!va(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 Sa(e,fa(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return da(this,`shape`,n),n}}))}function Oa(e,t){if(!va(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Sa(e,fa(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return da(this,`shape`,n),n}}))}function ka(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Sa(e,fa(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return da(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Aa(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 Sa(t,fa(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 da(this,`shape`,i),i},checks:[]}))}function ja(e,t,n){return Sa(t,fa(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 da(this,`shape`,i),i}}))}function Ma(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 Fa(e){return typeof e==`string`?e:e?.message}function Ia(e,t,n){let r=e.message?e.message:Fa(e.inst?._zod.def?.error?.(e))??Fa(t?.error?.(e))??Fa(n.customError?.(e))??Fa(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 La(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ra(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var za=(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,ia,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ba=H(`$ZodError`,za),Va=H(`$ZodError`,za,{Parent:Error});function Ha(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 Ua(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 $i;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ia(e,a,na())));throw ha(t,i?.callee),t}return o.value},Ga=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=>Ia(e,a,na())));throw ha(t,i?.callee),t}return o.value},Ka=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 $i;return a.issues.length?{success:!1,error:new(e??Ba)(a.issues.map(e=>Ia(e,i,na())))}:{success:!0,data:a.value}},qa=Ka(Va),Ja=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=>Ia(e,i,na())))}:{success:!0,data:a.value}},Ya=Ja(Va),Xa=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Wa(e)(t,n,i)},Za=e=>(t,n,r)=>Wa(e)(t,n,r),Qa=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ga(e)(t,n,i)},$a=e=>async(t,n,r)=>Ga(e)(t,n,r),eo=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ka(e)(t,n,i)},to=e=>(t,n,r)=>Ka(e)(t,n,r),no=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ja(e)(t,n,i)},ro=e=>async(t,n,r)=>Ja(e)(t,n,r),io=/^[cC][0-9a-z]{6,}$/,ao=/^[0-9a-z]+$/,oo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,so=/^[0-9a-vA-V]{20}$/,co=/^[A-Za-z0-9]{27}$/,lo=/^[a-zA-Z0-9_-]{21}$/,uo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fo=/^([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})$/,po=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)$/,mo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ho=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function go(){return new RegExp(ho,`u`)}var _o=/^(?:(?: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])$/,vo=/^(([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}|:))$/,yo=/^((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])$/,bo=/^(([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])$/,xo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,So=/^[A-Za-z0-9_-]*$/,Co=/^https?$/,wo=/^\+[1-9]\d{6,14}$/,To=`(?:(?:\\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])))`,Eo=RegExp(`^${To}$`);function Do(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 Oo(e){return RegExp(`^${Do(e)}$`)}function ko(e){let t=Do({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(`^${To}T(?:${r})$`)}var Ao=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},jo=/^-?\d+$/,Mo=/^-?\d+(?:\.\d+)?$/,No=/^(?:true|false)$/i,Po=/^null$/i,Fo=/^[^A-Z]*$/,Io=/^[^a-z]*$/,Lo=H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ro={number:`number`,bigint:`bigint`,object:`date`},zo=H(`$ZodCheckLessThan`,(e,t)=>{Lo.init(e,t);let n=Ro[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{Lo.init(e,t);let n=Ro[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})}}),Vo=H(`$ZodCheckMultipleOf`,(e,t)=>{Lo.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):ca(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})}}),Ho=H(`$ZodCheckNumberFormat`,(e,t)=>{Lo.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=wa[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=jo)}),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})}}),Uo=H(`$ZodCheckMaxLength`,(e,t)=>{var n;Lo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!oa(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=La(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wo=H(`$ZodCheckMinLength`,(e,t)=>{var n;Lo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!oa(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=La(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Go=H(`$ZodCheckLengthEquals`,(e,t)=>{var n;Lo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!oa(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=La(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})}}),Ko=H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Lo.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=()=>{})}),qo=H(`$ZodCheckRegex`,(e,t)=>{Ko.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})}}),Jo=H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Fo,Ko.init(e,t)}),Yo=H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Io,Ko.init(e,t)}),Xo=H(`$ZodCheckIncludes`,(e,t)=>{Lo.init(e,t);let n=xa(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})}}),Zo=H(`$ZodCheckStartsWith`,(e,t)=>{Lo.init(e,t);let n=RegExp(`^${xa(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})}}),Qo=H(`$ZodCheckEndsWith`,(e,t)=>{Lo.init(e,t);let n=RegExp(`.*${xa(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})}}),$o=H(`$ZodCheckOverwrite`,(e,t)=>{Lo.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),es=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(` `))}},ts={major:4,minor:4,patch:3},ns=H(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ts;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=Ma(e),i;for(let a of t){if(a._zod.def.when){if(Na(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 $i;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Ma(e,t))});else{if(e.issues.length===t)continue;r||=Ma(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Ma(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new $i;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 $i;return o.then(e=>t(e,r,a))}return t(o,r,a)}}ua(e,`~standard`,()=>({validate:t=>{try{let n=qa(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ya(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),rs=H(`$ZodString`,(e,t)=>{ns.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ao(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}}),is=H(`$ZodStringFormat`,(e,t)=>{Ko.init(e,t),rs.init(e,t)}),as=H(`$ZodGUID`,(e,t)=>{t.pattern??=fo,is.init(e,t)}),os=H(`$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??=po(e)}else t.pattern??=po();is.init(e,t)}),ss=H(`$ZodEmail`,(e,t)=>{t.pattern??=mo,is.init(e,t)}),cs=H(`$ZodURL`,(e,t)=>{is.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Co.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})}}}),ls=H(`$ZodEmoji`,(e,t)=>{t.pattern??=go(),is.init(e,t)}),us=H(`$ZodNanoID`,(e,t)=>{t.pattern??=lo,is.init(e,t)}),ds=H(`$ZodCUID`,(e,t)=>{t.pattern??=io,is.init(e,t)}),fs=H(`$ZodCUID2`,(e,t)=>{t.pattern??=ao,is.init(e,t)}),ps=H(`$ZodULID`,(e,t)=>{t.pattern??=oo,is.init(e,t)}),ms=H(`$ZodXID`,(e,t)=>{t.pattern??=so,is.init(e,t)}),hs=H(`$ZodKSUID`,(e,t)=>{t.pattern??=co,is.init(e,t)}),gs=H(`$ZodISODateTime`,(e,t)=>{t.pattern??=ko(t),is.init(e,t)}),_s=H(`$ZodISODate`,(e,t)=>{t.pattern??=Eo,is.init(e,t)}),vs=H(`$ZodISOTime`,(e,t)=>{t.pattern??=Oo(t),is.init(e,t)}),ys=H(`$ZodISODuration`,(e,t)=>{t.pattern??=uo,is.init(e,t)}),bs=H(`$ZodIPv4`,(e,t)=>{t.pattern??=_o,is.init(e,t),e._zod.bag.format=`ipv4`}),xs=H(`$ZodIPv6`,(e,t)=>{t.pattern??=vo,is.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})}}}),Ss=H(`$ZodCIDRv4`,(e,t)=>{t.pattern??=yo,is.init(e,t)}),Cs=H(`$ZodCIDRv6`,(e,t)=>{t.pattern??=bo,is.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 ws(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Ts=H(`$ZodBase64`,(e,t)=>{t.pattern??=xo,is.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{ws(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Es(e){if(!So.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ws(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Ds=H(`$ZodBase64URL`,(e,t)=>{t.pattern??=So,is.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Es(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Os=H(`$ZodE164`,(e,t)=>{t.pattern??=wo,is.init(e,t)});function ks(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 As=H(`$ZodJWT`,(e,t)=>{is.init(e,t),e._zod.check=n=>{ks(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),js=H(`$ZodNumber`,(e,t)=>{ns.init(e,t),e._zod.pattern=e._zod.bag.pattern??Mo,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}}),Ms=H(`$ZodNumberFormat`,(e,t)=>{Ho.init(e,t),js.init(e,t)}),Ns=H(`$ZodBoolean`,(e,t)=>{ns.init(e,t),e._zod.pattern=No,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}}),Ps=H(`$ZodNull`,(e,t)=>{ns.init(e,t),e._zod.pattern=Po,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}}),Fs=H(`$ZodUnknown`,(e,t)=>{ns.init(e,t),e._zod.parse=e=>e}),Is=H(`$ZodNever`,(e,t)=>{ns.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Ls(e,t,n){e.issues.length&&t.issues.push(...Pa(n,e.issues)),t.value[n]=e.value}var Rs=H(`$ZodArray`,(e,t)=>{ns.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;eLs(t,n,e))):Ls(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function zs(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Pa(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 Bs(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=Ca(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Vs(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=>zs(e,n,i,t,u,d))):zs(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 Hs=H(`$ZodObject`,(e,t)=>{if(ns.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=aa(()=>Bs(t));ua(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=ga,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=>zs(n,t,e,s,r,i))):zs(a,t,e,s,r,i)}return i?Vs(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Us=H(`$ZodObjectJIT`,(e,t)=>{Hs.init(e,t);let n=e._zod.parse,r=aa(()=>Bs(t)),i=e=>{let t=new es([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=pa(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=pa(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) { @@ -130,12 +130,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs. `)};S.current=r,_(!0),y(``);try{let t=await Sg(e,r.text,`inbox`,r.id);x({id:r.id,status:t.status})}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}let E=b?i.find(e=>e.client_ingress_id===b.id)?.status??b.status:``,D=E===`pending`?n?`已进入协调员收件箱,等待读取`:`In the coordinator inbox; awaiting read`:E===`delivered`?n?`已交给协调员;尚无应用回执`:`Delivered to coordinator; application not confirmed`:n?`投递状态待核实`:`Delivery requires reconciliation`;return(0,z.jsxs)(`section`,{className:`goal-team-evidence`,"aria-label":n?`执行证据`:`Execution evidence`,"aria-busy":u,children:[(0,z.jsxs)(`div`,{className:`goal-team-work-actions`,children:[(0,z.jsx)(`h3`,{children:n?`执行证据`:`Execution evidence`}),(0,z.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>void w(),children:n?`重新读取证据`:`Recheck evidence`})]}),u?(0,z.jsx)(`p`,{role:`status`,children:n?`正在核验绑定、验收与文件…`:`Checking bindings, acceptance and files…`}):null,f?(0,z.jsxs)(`p`,{role:`alert`,children:[n?`无法核验,已清除上次证据。`:`Cannot verify; previous evidence cleared.`,` `,f]}):null,o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{role:`status`,children:[(0,z.jsxs)(`strong`,{children:[o.agent_id,` · `,vg(o,n)]}),` · `,c]}),(0,z.jsx)(`p`,{children:n?`按需读取的当前观察,不是持续在线状态;验收不代表协调员已采用。`:`An on-demand observation, not continuous liveness; acceptance does not establish coordinator adoption.`}),(0,z.jsx)(Ob,{sessionId:e,result:o,zh:n}),(0,z.jsx)(mb,{result:o,zh:n,onInspect:a}),o.error?(0,z.jsx)(`p`,{role:`alert`,children:o.error}):null,o.status===`accepted`&&!o.error&&!o.recovery_required&&o.artifacts?.length?o.artifacts.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(Db,{artifact:e,zh:n}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n?`版本与来源标识`:`Version and source identifiers`}),(0,z.jsx)(`code`,{children:t}),(0,z.jsx)(`code`,{children:o.request_id}),(0,z.jsx)(`code`,{children:o.todo_id})]})]},`${e.ref}:${e.sha256}`)):(0,z.jsx)(`p`,{children:n?`本次读取没有可展示的已验收产物。`:`No accepted artifact is available in this readback.`}),(0,z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),T()},children:[(0,z.jsxs)(`label`,{children:[n?`向协调员反馈此执行`:`Send feedback about this execution`,(0,z.jsx)(`textarea`,{value:m,maxLength:6e3,rows:3,disabled:!!S.current,onChange:e=>h(e.target.value)})]}),(0,z.jsx)(`p`,{children:n?`附上执行标识及当前产物版本,交给原协调员收件箱;不会直接改写任务或中断成员。`:`Includes the operation and observed artifact versions in the original coordinator inbox; does not change tasks or interrupt members.`}),r?null:(0,z.jsx)(`p`,{children:n?`协调员未在执行或当前观察不可用;恢复执行后可发送。`:`Coordinator inactive or observation unavailable; resume execution to send.`}),(0,z.jsx)(`button`,{type:`submit`,disabled:!r||g||!!b||!m.trim(),children:g?n?`正在投递…`:`Sending…`:v?n?`重试同一条反馈`:`Retry this feedback`:n?`发送反馈`:`Send feedback`})]})]}):null,v?(0,z.jsxs)(`p`,{role:`alert`,children:[n?`未确认投递,请重试同一条反馈,避免重复发送。`:`Delivery not confirmed; retry the same feedback to avoid duplicates.`,` `,v]}):null,b?(0,z.jsx)(`p`,{role:`status`,children:D}):null]})}var Ab={authority_unavailable:{en:`Canonical authority unavailable`,zh:`缺少规范权限状态`},turn_blocked:{en:`Task admission blocked`,zh:`当前任务未获准执行`},acceptance_unavailable:{en:`Acceptance binding unavailable`,zh:`缺少有效验收绑定`},runtime_unavailable:{en:`Runtime unavailable`,zh:`运行时不可用`},runtime_unverified:{en:`Runtime availability unverified`,zh:`运行时可用性尚未验证`},launchable:{en:`Local launch prerequisites met`,zh:`本机启动条件已满足`}};function jb({check:e,zh:t}){let n=e.executor?[e.executor.host,e.executor.reason].filter(Boolean).join(` · `):e.authority_reason,r=e.state===`authority_unavailable`?t?`未检查或启动执行器`:`No executor was inspected or launched`:t?`不代表正在执行`:`Does not mean executing`,i=e.authority_next_action===`preview_reviewed_goal_authority_promotion`?t?`下一步:预览整 Goal 协调 Authority 晋级`:`Next: preview whole-Goal coordination-authority promotion`:e.authority_next_action===`repair_canonical_authority`?t?`下一步:修复规范 Authority 读回`:`Next: repair canonical authority readback`:null;return(0,z.jsxs)(`p`,{role:`status`,children:[t?Ab[e.state].zh:Ab[e.state].en,n?` · ${n}`:``,i?` · ${i}`:``,` · ${r}`]})}function Mb({sessionId:e,members:t,zh:n,canMessage:r,ingress:i}){let[a,o]=(0,R.useState)(null),s=(0,R.useRef)(null),c=(0,R.useRef)(null),l=(0,R.useRef)(null),[u,d]=(0,R.useState)(null),[f,p]=(0,R.useState)({}),[m,h]=(0,R.useState)(!1),[g,_]=(0,R.useState)(``),v=(0,R.useRef)(0);(0,R.useEffect)(()=>{(a?s.current:l.current)?.focus()},[a]),(0,R.useEffect)(()=>(v.current++,d(null),p({}),_(``),h(!1),y(),()=>{v.current++}),[e]);async function y(t){let n=++v.current;h(!0),_(``),d(null),o(null);try{let r=await yg(e,t);n===v.current&&d(r)}catch(e){n===v.current&&_(e instanceof Error?e.message:String(e))}finally{n===v.current&&h(!1)}}async function b(t){let n=++v.current;h(!0),_(``),p(e=>{let n={...e};return delete n[t],n});try{let r=await bg(e,t);n===v.current&&p(e=>({...e,[t]:r}))}catch(e){n===v.current&&_(e instanceof Error?e.message:String(e))}finally{n===v.current&&h(!1)}}return a?(0,z.jsxs)(`div`,{className:`goal-team-work`,children:[(0,z.jsx)(`button`,{ref:s,type:`button`,onClick:()=>o(null),children:n?`返回执行列表`:`Back to executions`}),(0,z.jsx)(kb,{sessionId:e,operationId:a,zh:n,canMessage:r,ingress:i,onInspect:o},`${e}:${a}`)]}):(0,z.jsx)(`div`,{className:`goal-team-work`,children:(0,z.jsxs)(`section`,{"aria-label":n?`团队执行详情`:`Team execution details`,children:[(0,z.jsx)(`p`,{children:n?`检查不会启动成员。暂停协调员后,已派发的工作仍会继续。`:`Inspection starts no members. Dispatched work continues when the coordinator is paused.`}),(0,z.jsx)(`h3`,{children:n?`已绑定成员`:`Bound members`}),(0,z.jsx)(`ul`,{className:`goal-team-bindings`,children:t.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e.agent_id}),(0,z.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void b(e.id),children:n?`检查启动条件`:`Check prerequisites`})]}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n?`任务与执行配置`:`Task and execution details`}),(0,z.jsx)(`code`,{children:e.todo_id}),f[e.id]?.executor?.profile?(0,z.jsx)(`code`,{children:f[e.id]?.executor?.profile}):null]}),f[e.id]?(0,z.jsx)(jb,{check:f[e.id],zh:n}):null]},e.id))}),(0,z.jsxs)(`div`,{className:`goal-team-work-actions`,children:[(0,z.jsx)(`strong`,{children:n?`此协调身份的持久工作`:`Durable work for this coordinator`}),(0,z.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>{p({}),y()},children:n?`重新核验`:`Refresh`}),u?.has_more&&u.next_cursor?(0,z.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void y(u.next_cursor),children:n?`下一页`:`Next page`}):null]}),m?(0,z.jsx)(`p`,{role:`status`,children:n?`正在读取当前事实…`:`Reading current facts…`}):null,g?(0,z.jsx)(`p`,{role:`alert`,children:g}):null,u?(0,z.jsxs)(z.Fragment,{children:[u.page_readback_complete?null:(0,z.jsx)(`p`,{role:`status`,children:n?`本页有无法核验的工作,请检查原请求;不要直接重新派工。`:`Some work cannot be verified. Reconcile the original request before redispatching.`}),u.items.length?null:(0,z.jsx)(`p`,{children:n?`此页没有委派记录;不代表整个团队没有工作或 Goal 已完成。`:`No records on this page; this does not establish an idle team or a completed Goal.`}),(0,z.jsx)(`ul`,{className:`goal-team-operations`,children:u.items.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`strong`,{children:[e.agent_id??(n?`记录不可读`:`Unreadable record`),` · `,vg(e,n)]}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n?`执行标识`:`Execution identifier`}),(0,z.jsx)(`code`,{children:e.operation_id??e.record_id})]}),e.operation_id?(0,z.jsx)(`button`,{ref:e.operation_id===c.current?l:void 0,type:`button`,onClick:()=>{c.current=e.operation_id,o(e.operation_id)},children:n?`查看证据与反馈`:`Evidence and feedback`}):null]},e.record_id))}),(0,z.jsxs)(`p`,{children:[n?`仅限当前协调身份;分页不是团队快照。`:`Scoped to this coordinator; paging is not a team snapshot.`,u.has_more?n?` 还有下一页。`:` More pages remain.`:``]})]}):null]})})}function Nb({sessionId:e,onPrepare:t,onExecute:n,onChange:r}){let{locale:i}=Ji(),a=i===`zh-CN`,[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(null),u=c===`settings`,d=e=>l(e?`settings`:null),f=(0,R.useRef)(null);(0,R.useEffect)(()=>{c&&!f.current?.open?f.current?.showModal():!c&&f.current?.open&&f.current.close()},[c]);let[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(``),[y,b]=(0,R.useState)({agent_id:``,token_budget:0});(0,R.useEffect)(()=>{let t=!0,n=!1;if(s(null),r(null),g(``),v(``),d(!1),!e||e===`new-session-pending`)return;async function i(){if(!n){n=!0;try{let n=await gg(e);t&&(s(n),r(n),v(``))}catch(e){t&&v(e instanceof Error?e.message:String(e))}finally{n=!1}}}i();let a=window.setInterval(()=>{document.hidden||i()},2500);return()=>{t=!1,window.clearInterval(a)}},[e]);let x=!!(o?.enabled&&o.active_turn_id),S=o?.native.status??`absent`,C=![`absent`,`complete`].includes(S),w=!!(o?.settings.agent_id&&o.settings.token_budget&&o.settings.execution_config),T=e=>{b({agent_id:e.settings.agent_id??``,token_budget:e.settings.token_budget??0}),d(!0)},E=o?.enabled?o.recovery_required?a?`LoopX · 需要恢复连接`:`LoopX · Reconnect required`:S===`blocked`?a?`LoopX · 需要处理阻塞`:`LoopX · Blocked`:x?a?`LoopX · 正在推进`:`LoopX · Working`:S===`complete`?a?`LoopX · 本轮已结束`:`LoopX · Run finished`:[`budgetLimited`,`usageLimited`].includes(S)?a?`LoopX · 已到额度限制`:`LoopX · Usage limit`:a?`LoopX · 已暂停`:`LoopX · Paused`:a?`普通对话`:`Conversation`,D=()=>{o&&!u?T(o):d(!1)};async function O(){m(!0),g(``);try{let e=await gg(await t());s(e),r(e),T(e)}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function k(t){if(e){m(!0),g(``);try{let n=await xg(e,t,t===`configure`?y:void 0);s(n),r(n),(t===`configure`||t===`exit`)&&d(!1)}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}}}let A=o?.deliveries.some(e=>[`rejected`,`unavailable`].includes(e.status)),ee=o?.ingress.filter(e=>e.status!==`delivered`)??[];return(0,z.jsxs)(`section`,{className:`goal-loopx-mode`,"aria-label":a?`LoopX 运行模式`:`LoopX execution mode`,children:[(0,z.jsxs)(`div`,{className:`goal-loopx-mode-bar`,children:[(0,z.jsxs)(`span`,{className:`goal-loopx-mode-status`,"data-active":x,role:`status`,children:[(0,z.jsx)(`i`,{"aria-hidden":`true`}),E]}),(0,z.jsxs)(`div`,{className:`goal-loopx-mode-actions`,children:[w&&e?(0,z.jsxs)(`button`,{type:`button`,className:`goal-loopx-team-trigger`,onClick:()=>l(`team`),"aria-haspopup":`dialog`,children:[(0,z.jsx)(hh,{size:16}),a?`团队执行情况`:`Team execution`,A?(0,z.jsx)(`span`,{className:`goal-loopx-alert-dot`,"aria-label":a?`最近回读需要核验`:`Last observations need review`}):null]}):null,(0,z.jsx)(`button`,{type:`button`,disabled:p||o?.conversation_busy||!o,onClick:D,"aria-label":a?`运行设置`:`Settings`,title:a?`运行设置与用量`:`Settings and usage`,"aria-haspopup":`dialog`,children:(0,z.jsx)(ah,{size:16})}),(0,z.jsxs)(`button`,{type:`button`,className:`goal-loopx-primary`,disabled:p||!!(o?.conversation_busy&&!x),title:x?a?`暂停协调员;已派发的成员继续执行`:`Pause coordinator; dispatched members keep working`:void 0,onClick:async()=>{if(!o){await O();return}x?k(`pause`):!w||Number(o.settings.token_budget??0)<=Number(o.native.tokensUsed??0)?D():n(C?`resume`:`start`)},children:[x?(0,z.jsx)(Jm,{size:14}):(0,z.jsx)(Ym,{size:14}),x?a?`暂停协调员`:`Pause coordinator`:o?.enabled?S===`complete`?a?`开启新一轮`:`Start new run`:a?`恢复推进`:`Continue`:a?`开启 LoopX 模式`:`Enable LoopX`]})]})]}),ee.length?(0,z.jsxs)(`p`,{role:`status`,children:[a?`待处理消息:`:`Pending messages: `,ee.map(e=>`${e.mode===`loopx_queue`?`queue`:`inbox`} · ${e.status}`).join(` / `)]}):null,A?(0,z.jsx)(`button`,{className:`goal-loopx-review-notice`,type:`button`,onClick:()=>l(`team`),children:a?`最近成员回读有未通过或无法核验的结果 · 查看团队`:`Last member observations include rejected or unverified results · View team`}):null,(h||_)&&!c?(0,z.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:h||_}):null,(0,z.jsx)(`dialog`,{className:`goal-loopx-dialog`,ref:f,"aria-labelledby":`goal-loopx-dialog-title`,onClose:()=>l(null),onClick:e=>{e.target===e.currentTarget&&l(null)},children:c?(0,z.jsxs)(`div`,{className:`goal-loopx-dialog-content`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h2`,{id:`goal-loopx-dialog-title`,children:c===`team`?a?`团队执行情况`:`Team execution`:a?`运行设置`:`Execution settings`}),(0,z.jsx)(`button`,{type:`button`,autoFocus:!0,"aria-label":a?`关闭`:`Close`,onClick:()=>l(null),children:(0,z.jsx)(gh,{size:18})})]}),h||_?(0,z.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:h||_}):null,c===`team`&&e&&!_?(0,z.jsx)(Mb,{sessionId:e,members:o?.members??[],zh:a,canMessage:x&&!o?.paused&&!_,ingress:o?.ingress??[]},`${e}:${o?.settings.agent_id}:${o?.settings.execution_config}`):null,c===`team`?(0,z.jsxs)(`div`,{className:`goal-team-control`,children:[(0,z.jsx)(`button`,{type:`button`,disabled:p||!x||!!_,onClick:()=>void k(`pause`),children:a?`暂停协调员`:`Pause coordinator`}),(0,z.jsxs)(`p`,{role:`status`,children:[o?.paused?x?a?`已暂停后续调度,等待当前协调轮次停止回读。`:`Further dispatch paused; awaiting coordinator turn stop readback.`:a?`协调员已暂停。`:`Coordinator paused.`:null,a?`此操作不会停止已派发成员;成员状态以上次执行回读为准。当前入口不支持停止整个团队。`:`This does not stop dispatched members; their states are last-read observations. Whole-team stop is unavailable here.`]})]}):null,u?(0,z.jsxs)(`div`,{className:`goal-loopx-mode-settings`,children:[(0,z.jsxs)(`label`,{children:[a?`已注册的协调身份`:`Registered coordinator`,(0,z.jsxs)(`select`,{value:y.agent_id,onChange:e=>b({...y,agent_id:e.target.value}),children:[(0,z.jsx)(`option`,{value:``,children:a?`选择已授权身份`:`Select authorized identity`}),o?.registered_agents.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})]}),(0,z.jsxs)(`label`,{children:[a?`协调员总 token 额度`:`Coordinator total token allowance`,(0,z.jsx)(`input`,{type:`number`,min:1,max:2147483647,value:y.token_budget||``,onChange:e=>b({...y,token_budget:Number(e.target.value)})})]}),(0,z.jsxs)(`label`,{children:[a?`成员执行绑定文件(Goal 配置)`:`Member execution bindings (Goal configuration)`,(0,z.jsx)(`input`,{readOnly:!0,value:o?.settings.execution_config??(a?`未配置`:`Not configured`)})]}),(0,z.jsx)(`p`,{children:a?`绑定文件由 Goal 子代理设置统一管理;额度包含协调员历史用量,成员授权不会因开启模式而扩大。`:`Manage the binding file in Goal sub-agent settings. The allowance includes coordinator history; enabling this mode does not expand member grants.`}),(0,z.jsx)(`button`,{type:`button`,disabled:p||!y.agent_id||y.token_budget<1||!o?.settings.execution_config,onClick:()=>void k(`configure`),children:a?`保存设置`:`Save settings`})]}):null,c===`settings`&&o?.enabled&&o.native.tokensUsed!==void 0?(0,z.jsxs)(`p`,{className:`goal-loopx-mode-usage`,children:[a?`协调员累计用量`:`Coordinator usage`,` `,o.native.tokensUsed.toLocaleString(),` / `,o.native.tokenBudget?.toLocaleString()??`—`,` tokens`]}):null,c===`settings`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{children:a?`开启后,当前协调员持续推进本 Goal。暂停仅影响协调员,已派发成员继续执行;本轮结束不等于 Goal 完成。`:`The coordinator continues this Goal. Pausing affects only the coordinator; dispatched members keep working. A finished run does not complete the Goal.`}),o?.enabled&&!x?(0,z.jsx)(`button`,{type:`button`,disabled:p,onClick:()=>void k(`exit`),children:a?`退出模式`:`Exit mode`}):null]}):null]}):null})]})}var Pb=e=>e.items.filter(e=>e.operation_id&&e.status===`accepted`&&!e.recovery_required&&e.artifacts?.length);function Fb({sessionId:e,zh:t,refreshKey:n}){let[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(``),d=(0,R.useRef)(0),f=(0,R.useRef)(null),p=(0,R.useRef)(void 0),m=(0,R.useRef)(!1),h=(0,R.useRef)(null);(0,R.useEffect)(()=>{f.current=null,p.current=void 0},[e]),(0,R.useEffect)(()=>(v(p.current),()=>{d.current++}),[e,n]),(0,R.useEffect)(()=>{a&&m.current&&(h.current?.focus(),m.current=!1)},[a]);let g=t?`产物或验收已变化,未展示旧报告。请重新选择可核验的产物。`:`Artifact or acceptance changed. Previous report cleared; select a verified artifact again.`;async function _(t,n,r){let i=await _g(e,t);if(r!==d.current)return;let a=i.artifacts??[],s=n?.ref?a.filter(e=>e.ref===n.ref):[],c=n?.ref?s.length===1&&s[0].sha256===n.sha256?s[0]:void 0:a.find(e=>Tb(e.ref))??a[0];i.operation_id!==t||i.status!==`accepted`||i.error||i.recovery_required||!c?u(g):(f.current={operationId:t,ref:c.ref,sha256:c.sha256},o({result:i,artifact:c}))}async function v(n,r=!1){let a=++d.current;r&&(f.current=null),p.current=n,m.current=!1,c(!0),u(``),i(null),o(null);try{let t=await yg(e,n);if(a!==d.current)return;i(t);let r=f.current;if(!r){let e=Pb(t)[0],n=e?.artifacts?.find(e=>Tb(e.ref))??e?.artifacts?.[0];e?.operation_id&&n&&(r={operationId:e.operation_id,...n})}r&&(f.current=r,await _(r.operationId,r,a))}catch(e){a===d.current&&u(`${t?`无法核验,已清除上次报告。`:`Cannot verify; previous report cleared.`} ${String(e)}`)}finally{a===d.current&&c(!1)}}async function y(e,n){let r=++d.current;m.current=!0,c(!0),u(``),o(null);let i={operationId:e,...n};f.current=i;try{await _(e,i,r)}catch(e){r===d.current&&u(`${t?`无法核验,已清除上次报告。`:`Cannot verify; previous report cleared.`} ${String(e)}`)}finally{r===d.current&&c(!1)}}let b=r?Pb(r):[];return(0,z.jsxs)(`section`,{className:`goal-team-results`,"aria-label":t?`团队成果`:`Team results`,"aria-busy":s,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h3`,{children:t?`团队成果`:`Team results`}),(0,z.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>void v(p.current),children:[(0,z.jsx)(Qm,{size:14,"aria-hidden":`true`}),t?`刷新成果`:`Refresh results`]})]}),s?(0,z.jsx)(`p`,{role:`status`,children:t?`正在核验产物…`:`Verifying artifacts…`}):null,l?(0,z.jsx)(`p`,{role:`alert`,children:l}):null,r&&!r.page_readback_complete?(0,z.jsx)(`p`,{role:`status`,children:t?`部分工作无法核验,请在团队执行中检查。`:`Some work cannot be verified; inspect Team execution.`}):null,(0,z.jsxs)(`div`,{className:`goal-team-results-layout`,children:[r?(0,z.jsxs)(`nav`,{className:`goal-team-result-list`,"aria-label":t?`选择团队产物`:`Choose a team artifact`,children:[b.map(e=>{let t=e.artifacts.find(e=>Tb(e.ref))??e.artifacts[0];return(0,z.jsxs)(`button`,{type:`button`,disabled:s,"aria-label":`${e.agent_id} · ${t.ref}`,"aria-pressed":a?.result.operation_id===e.operation_id,onClick:()=>void y(e.operation_id,t),children:[(0,z.jsx)(jm,{size:16,"aria-hidden":`true`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.agent_id}),(0,z.jsx)(`small`,{children:t.ref})]}),(0,z.jsx)(hm,{className:`goal-team-result-check`,size:14,"aria-hidden":`true`})]},e.record_id)}),b.length?null:(0,z.jsx)(`p`,{children:t?`本页没有可读取的已验收产物。`:`No accepted artifact is available on this page.`}),r.has_more&&r.next_cursor?(0,z.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>void v(r.next_cursor,!0),children:t?`下一页成果`:`Next results page`}):null]}):null,a?(0,z.jsxs)(`div`,{ref:h,tabIndex:-1,className:`goal-team-result-reader`,"aria-label":t?`当前报告`:`Current report`,children:[(0,z.jsx)(Db,{artifact:a.artifact,zh:t,heading:t?`已通过当前验收`:`Currently accepted`},`${a.result.operation_id}:${a.artifact.sha256}`),a.result.artifacts&&a.result.artifacts.length>1?(0,z.jsxs)(`label`,{children:[t?`其他产物`:`Other artifacts`,(0,z.jsx)(`select`,{value:a.artifact.ref,onChange:e=>{let t=a.result.artifacts.find(t=>t.ref===e.target.value);t&&(f.current={operationId:a.result.operation_id,ref:t.ref,sha256:t.sha256},o({...a,artifact:t}))},children:a.result.artifacts.map(e=>(0,z.jsx)(`option`,{value:e.ref,children:e.ref},e.ref))})]}):null,(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t?`验收与采用关系`:`Acceptance and adoption`}),(0,z.jsx)(mb,{result:a.result,zh:t,onInspect:e=>void y(e)})]})]}):null]})]})}function Ib({attention:e,onSelect:t}){let{t:n}=Ji(),r=Zi(e.updatedAt,n);return(0,z.jsxs)(`button`,{className:`personal-timeline-row personal-attention-row`,"data-testid":`personal-browse-row`,onClick:t,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-row-icon is-attention`,children:(0,z.jsx)(ym,{size:18})}),(0,z.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,z.jsxs)(`small`,{children:[e.goalTitle??e.goalId,` · `,n(`home.lane.needsYou`),r?` · ${n(`tasks.waitingAge`,{age:r})}`:``]}),(0,z.jsx)(`strong`,{children:e.text})]}),(0,z.jsx)(`span`,{className:`personal-priority-dot is-${e.priority??(e.blocking?`high`:`medium`)}`}),(0,z.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?n(`tasks.blocked`):n(`tasks.pending`)}),(0,z.jsx)(_m,{size:17})]})}function Lb({onSelect:e,output:t}){let{t:n}=Ji(),r=t.kind===`report`?jm:Am;return(0,z.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,z.jsx)(`span`,{className:`personal-row-icon is-output`,children:(0,z.jsx)(r,{size:18})}),(0,z.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,z.jsxs)(`small`,{children:[t.goalTitle??t.goalId,` · `,t.agentLabel??`LoopX`]}),(0,z.jsx)(`strong`,{children:t.title}),t.summary?(0,z.jsx)(`span`,{children:t.summary}):null,t.report?(0,z.jsxs)(`small`,{children:[n(`files.reportDelta`,{added:t.report.addedCount,changed:t.report.changedCount}),` · `,n(`files.verifiedReport`)]}):null]}),t.createdAt?(0,z.jsx)(`time`,{children:t.createdAt}):null,(0,z.jsx)(_m,{size:17})]})}var Rb={completed:`runs.completed`,failed:`runs.failed`,interrupted:`runs.interrupted`,queued:`runs.queued`,running:`runs.running`,waiting:`runs.waiting`};function zb({onSelect:e,run:t,showGoal:n=!0}){let{t:r}=Ji();return(0,z.jsxs)(`button`,{"aria-label":`${r(`tasks.viewExecution`)}:${t.title}`,className:`personal-timeline-row personal-run-row`,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-row-icon is-run`,children:(0,z.jsx)(fm,{size:18})}),(0,z.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,z.jsxs)(`small`,{children:[n?`${t.goalTitle} · `:``,t.agentLabel]}),(0,z.jsx)(`strong`,{children:t.title}),t.latestActivity===t.title?null:(0,z.jsx)(`small`,{children:t.latestActivity})]}),(0,z.jsxs)(`span`,{className:`personal-row-status is-${t.status}`,children:[t.status===`running`?(0,z.jsx)(zm,{className:`personal-spin`,size:14}):null,r(Rb[t.status])]}),(0,z.jsx)(_m,{size:17})]})}function Bb({onSelect:e,schedule:t}){let{t:n}=Ji(),r=t.scheduleKind===`heartbeat`;return(0,z.jsxs)(`button`,{"aria-label":`${r?`Heartbeat`:n(`tasks.scheduled`)}:${t.label};${t.status??`active`}`,className:`personal-schedule-row`,onClick:e,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-schedule-icon`,children:r?(0,z.jsx)(Zm,{size:17}):(0,z.jsx)(mm,{size:17})}),(0,z.jsxs)(`span`,{className:`personal-schedule-copy`,children:[(0,z.jsx)(`small`,{children:n(r?`schedule.heartbeat`:`schedule.monitor`)}),(0,z.jsx)(`strong`,{children:t.label}),(0,z.jsx)(`p`,{children:t.schedule??n(`schedule.summary`)})]}),(0,z.jsx)(`span`,{className:`personal-schedule-status is-${t.status??`active`}`,children:t.status===`paused`?n(`schedule.paused`):n(`schedule.active`)}),(0,z.jsx)(_m,{size:16})]})}function Vb({delivery:e}){let{t}=Ji();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,z.jsx)(`small`,{className:`personal-return-delivery is-${r}`,role:`status`,children:n})}function Hb({items:e,onSelect:t,selectedGoal:n}){let{locale:r,t:i}=Ji();if(e.length===0)return(0,z.jsxs)(`div`,{className:`personal-timeline-empty`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(ch,{size:20})}),(0,z.jsx)(`strong`,{children:i(n?`timeline.emptyGoal`:`timeline.emptyWorkspace`)}),(0,z.jsx)(`p`,{children:i(n?`timeline.emptyGoalDescription`:`timeline.emptyWorkspaceDescription`)})]});let a=[...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`),o=a?.kind===`message`?`${a.message.agentLabel??i(`header.manager`)}:${a.message.pending?i(`timeline.pending`):a.message.text}`:a?.kind===`proposal`?`${a.proposal.title}:${a.proposal.status}`:a?.kind===`run`?i(`timeline.runCompleted`,{run:a.run.title}):``,s=e.filter(e=>e.kind===`proposal`&&e.proposal.status===`gated`),c=e.filter(e=>e.kind===`run`&&[`queued`,`running`,`completed`].includes(e.run.status)),l=new Set(c.map(e=>e.id)),u=e.filter(e=>e.kind!==`proposal`&&!l.has(e.id)),d=c.filter(e=>e.run.status===`running`&&!!e.run.sessionId&&!!e.run.canInterrupt).length,f=c.filter(e=>e.run.status===`queued`).length,p=c.filter(e=>e.run.status===`completed`).length,m=c.length-d-f-p,h=r===`zh-CN`?[d&&`${d} 个执行中`,f&&`${f} 个排队中`,p&&`${p} 次执行已结束`,m&&`${m} 项进展更新`].filter(Boolean).join(` · `):[d&&`${d} running`,f&&`${f} queued`,p&&`${p} runs finished`,m&&`${m} progress updates`].filter(Boolean).join(` · `),g=e.filter(e=>e.kind===`proposal`&&e.proposal.status!==`gated`);function _(e){return e.kind===`attention`?(0,z.jsx)(Ib,{attention:e.attention,onSelect:()=>t({item:e.attention,kind:`attention`})},e.id):e.kind===`run`?(0,z.jsx)(zb,{showGoal:!n,onSelect:()=>t({item:e.run,kind:`run`}),run:e.run},e.id):e.kind===`output`?(0,z.jsx)(Lb,{onSelect:()=>t({item:e.output,kind:`output`}),output:e.output},e.id):e.kind===`schedule`?(0,z.jsx)(Bb,{onSelect:()=>t({item:e.schedule,kind:`schedule`}),schedule:e.schedule},e.id):e.kind===`proposal`?(0,z.jsxs)(`button`,{className:`personal-proposal-row is-${e.proposal.status}`,onClick:()=>t({item:e.proposal,kind:`proposal`}),type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(ch,{size:17})}),(0,z.jsxs)(`span`,{children:[(0,z.jsxs)(`small`,{children:[e.proposal.actionKind,` · `,e.proposal.status]}),(0,z.jsx)(`strong`,{children:e.proposal.title}),e.proposal.impact?(0,z.jsx)(`p`,{children:e.proposal.impact}):null]}),(0,z.jsx)(`b`,{children:e.proposal.status===`gated`&&e.proposal.actionKind!==`operation.execute`?i(`timeline.review`):e.proposal.primaryLabel??i(`timeline.reviewAndConfirm`)})]},e.id):(0,z.jsxs)(`article`,{className:`personal-message is-${e.message.role}`,children:[e.message.role===`user`?null:(0,z.jsx)(`span`,{className:`personal-message-avatar`,children:(0,z.jsx)(fm,{size:17})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:e.message.role===`user`?i(`common.you`):e.message.agentLabel??i(`header.manager`)}),e.message.time?(0,z.jsx)(`time`,{children:e.message.time}):null]}),e.message.attachments?.length?(0,z.jsx)(`div`,{className:`personal-message-images`,children:e.message.attachments.map(e=>(0,z.jsx)(`img`,{alt:e.name,src:e.dataUrl},e.id))}):null,e.message.role===`user`?(0,z.jsx)(`p`,{children:e.message.text}):(0,z.jsx)(wb,{text:e.message.text}),e.message.pending?(0,z.jsx)(`span`,{className:`personal-message-pending`,children:i(`timeline.pending`)}):null,(0,z.jsx)(Wy,{request:e.message.collaboration}),(0,z.jsx)(Vb,{delivery:e.message.returnDelivery})]})]},e.id)}return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{"aria-atomic":`true`,"aria-live":`polite`,className:`personal-live-region`,role:`status`,children:o}),(0,z.jsxs)(`div`,{className:`personal-channel-timeline`,children:[c.length?(0,z.jsxs)(`details`,{className:`personal-activity-summary`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(im,{size:16,"aria-hidden":`true`}),(0,z.jsx)(`strong`,{children:r===`zh-CN`?`执行动态`:`Execution activity`}),(0,z.jsx)(`span`,{children:h})]}),(0,z.jsx)(`div`,{children:c.map(_)})]}):null,u.map(_),s.length?(0,z.jsxs)(`details`,{className:`personal-gated-summary`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(ch,{size:16})}),(0,z.jsx)(`strong`,{children:i(`timeline.waitingConfirmation`)}),(0,z.jsx)(`small`,{children:i(`timeline.gateHistory`,{count:s.length})})]}),(0,z.jsx)(`div`,{children:s.map(_)})]}):null,g.map(_)]})]})}function Ub({goal:e}){let{t,locale:n}=Ji(),r=n===`zh-CN`?{checkpoint_satisfied:`检查点满足`,checkpoint_fresh:`检查点有效`,path_outcome_valid:`路径决策有效`,evidence_refs_present:`证据引用齐全`,final_outcome_claim_present:`最终成果声明齐全`,no_reported_outcome_gap:`无已报告成果缺口`}:{checkpoint_satisfied:`Checkpoint satisfied`,checkpoint_fresh:`Checkpoint current`,path_outcome_valid:`Valid path decision`,evidence_refs_present:`Evidence refs present`,final_outcome_claim_present:`Final outcome claim present`,no_reported_outcome_gap:`No reported outcome gap`},i={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`)},a=e=>i[e]??t(`acceptance.unknown`),o=e.acceptanceObservation,s=e.loadState||!o||o.goal_id!==e.goalId||o.coverage===`unavailable`;return(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-acceptance`,"aria-label":t(`acceptance.title`),children:[(0,z.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,z.jsx)(`h3`,{children:t(`acceptance.title`)}),(0,z.jsx)(`em`,{children:t(`common.readOnly`)})]}),(0,z.jsx)(`p`,{role:`status`,children:t(s?`acceptance.unavailable`:`acceptance.partial`)}),!s&&o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h4`,{children:t(`acceptance.gaps`)}),o.acceptance_gaps.length?o.acceptance_gaps.map((e,i)=>(0,z.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,z.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),e.resolution_hint?(0,z.jsx)(`p`,{children:e.resolution_hint}):null,e.component_checks?(0,z.jsx)(`div`,{children:Object.entries(e.component_checks).map(([e,t])=>(0,z.jsxs)(`p`,{children:[r[e],`: `,n===`zh-CN`?t?`通过`:`未通过`:t?`Passed`:`Failed`]},e))}):null,(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.owner`)}),(0,z.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,z.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.observed`)}),(0,z.jsx)(`dd`,{children:e.observed_at??t(`acceptance.unknown`)})]})]})]},`${e.kind}:${e.owner}:${i}`)):(0,z.jsx)(`p`,{children:t(`acceptance.noGaps`)}),(0,z.jsx)(`h4`,{children:t(`acceptance.guards`)}),o.guards.length?o.guards.map((e,n)=>(0,z.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,z.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.owner`)}),(0,z.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),e.blocks_agent?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.agent`)}),(0,z.jsx)(`dd`,{children:e.blocks_agent})]}):null,e.todo_id?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.task`)}),(0,z.jsx)(`dd`,{children:e.todo_id})]}):null,(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,z.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.scope`)}),(0,z.jsx)(`dd`,{children:e.decision_scope??t(`acceptance.unknown`)})]})]})]},`${e.todo_id}:${n}`)):(0,z.jsx)(`p`,{children:t(`acceptance.noGuards`)}),(0,z.jsx)(`h4`,{children:t(`acceptance.next`)}),(0,z.jsx)(`p`,{children:o.next_action??t(`acceptance.unknown`)}),(0,z.jsxs)(`details`,{children:[(0,z.jsxs)(`summary`,{children:[t(`acceptance.historical_progress`),` · `,o.historical_progress.length]}),(0,z.jsx)(`p`,{children:t(`acceptance.historical`)}),o.historical_progress.map(e=>(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`strong`,{children:a(e.kind)}),` · `,e.observed_at??t(`acceptance.unknown`),` `,e.evidence_refs.join(`, `)]},e.kind))]}),o.missing_sources.length?(0,z.jsxs)(`p`,{children:[t(`acceptance.missing`),` `,o.missing_sources.map(a).join(`, `)]}):null,o.truncated?(0,z.jsx)(`p`,{children:t(`acceptance.truncated`)}):null]}):null]})}function Wb({item:e,successor:t,onSelect:n}){let{t:r}=Ji(),i=e.details;return(0,z.jsxs)(`section`,{className:`personal-detail-card`,"aria-label":r(`attentionDetail.title`),children:[(0,z.jsx)(`h3`,{children:r(`attentionDetail.title`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.request`)}),(0,z.jsx)(`dd`,{children:r(i?.interaction===`decision`?`attentionDetail.decision`:`attentionDetail.unknownRequest`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`common.status`)}),(0,z.jsx)(`dd`,{children:r(`attentionDetail.${i?.lifecycle??`unknown`}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`drawer.reason`)}),(0,z.jsx)(`dd`,{children:i?.reason??e.explanation??r(`attentionDetail.unknownReason`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Todo`}),(0,z.jsx)(`dd`,{children:e.todoId})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.targetTodo`)}),(0,z.jsx)(`dd`,{children:i?.unblocksTodoId??r(`attentionDetail.notProvided`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.targetAgent`)}),(0,z.jsx)(`dd`,{children:i?.blocksAgent??r(`attentionDetail.notProvided`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.scope`)}),(0,z.jsx)(`dd`,{children:i?.decisionScope?`${i.decisionScope.kind} · ${i.decisionScope.granularity} · ${i.decisionScope.scopeKey}`:r(`attentionDetail.notProvided`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`drawer.evidence`)}),(0,z.jsx)(`dd`,{children:i?.evidence??e.evidence??r(`drawer.decisionDefaultEvidence`)})]})]}),i?.supersededBy?(0,z.jsxs)(`p`,{children:[r(`attentionDetail.replacement`),`: `,i.supersededBy]}):null,t&&n?(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>n(t),type:`button`,children:r(`attentionDetail.openReplacement`)}):null,(0,z.jsx)(`p`,{children:r(`attentionDetail.boundary`)})]})}function Gb({proposal:e,t}){let n=e.teamPlanOutcome?.kind===`already_present`;return(0,z.jsxs)(`section`,{className:`personal-proposal-card personal-team-plan-result`,children:[(0,z.jsx)(`h3`,{children:db(e.teamPlanOutcome??null,t)}),(0,z.jsxs)(`dl`,{className:`personal-team-plan-assignments`,children:[e.teamPlanAssignments?.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.agentId||e.laneId}),(0,z.jsx)(`dd`,{children:e.task})]},e.laneId)),e.teamPlanGapLanes?.map(e=>(0,z.jsxs)(`div`,{className:`is-pending`,children:[(0,z.jsx)(`dt`,{children:e.agentId||e.laneId}),(0,z.jsxs)(`dd`,{children:[e.task||e.laneId,(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[t(`proposal.teamPlan.pending`),` · `,lb(e.reasonCode,t)]})]})]},e.laneId))]}),(0,z.jsx)(`p`,{children:t(n?`proposal.teamPlan.recoveredHint`:`proposal.teamPlan.assignedHint`)}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t(`proposal.teamPlan.originalPlan`)}),(0,z.jsx)(`dl`,{children:e.fields.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.label}),(0,z.jsx)(`dd`,{children:e.value})]},e.key))})]})]})}function Kb(e){return e.replace(/\s+/gu,` `).trim()}function qb(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 Jb(e){return/(我现在该做什么|下一步|哪些\s*Goal\s*在等我|需要我|谁在等我|Agent\s*在做什么|当前进度|总结(?:今天)?进展)/iu.test(e)}function Yb(e){let t=/(怎么|如何|为什么|给.*建议|分析一下|解释|只读)/u.test(e),n=/(解决一下|修复一下|处理一下|执行一下|改一下|跑(?:一下)?测试|rebase|push|提交|推送)/iu.test(e);return!t&&n&&/(帮我|请|给我|直接|现在|开始|bytedcli|codebase|git|rebase|push|提交|推送)/iu.test(e)}function Xb(e){return Kb(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 Zb(e,t){let n=Kb(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&&!qb(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n);if(!t.goalId&&!qb(n,/goal|目标/iu)&&/(创建|新建|设置|create|start|set up).{0,24}(goal|目标)/iu.test(n)&&r.push({actionKind:`goal.create`,confidence:.97,normalizedParameters:{heartbeat_enabled:!qb(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&&!qb(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&&!qb(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&&!qb(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&&Yb(n)&&r.push({actionKind:`todo.create`,confidence:.9,normalizedParameters:{goal_id:t.goalId,start_execution:!0}}),t.goalId&&a){let e=!qb(n,/完成|做完|关闭/u)&&/完成|做完|关闭/u.test(n)?`complete`:!qb(n,/阻塞|卡住/u)&&/阻塞|卡住/u.test(n)?`block`:!qb(n,/暂缓|稍后|推迟/u)&&/暂缓|稍后|推迟/u.test(n)?`defer`:i&&!qb(n,/交给|分配给|改派/u)&&/交给|分配给|改派/u.test(n)?`reassign`:null;if(e){let i=e===`defer`?Xb(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&&Jb(n)?{actionKind:null,confidence:.98,missingFields:[],normalizedParameters:{},route:`projection`}:{actionKind:null,confidence:.75,missingFields:[],normalizedParameters:{},route:`agent_chat`}}function Qb(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 $b=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`select:not([disabled])`,`input:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`),ex=[{key:`drawer.taskBlock`,operation:`block`},{key:`drawer.taskSuccessor`,operation:`successor_create`}],tx=[{key:`drawer.decisionReject`,resolution:`reject`},{key:`drawer.decisionDefer`,resolution:`defer`}],nx=Array.from({length:32},(e,t)=>t+1),rx=/^[a-z][a-z0-9_.-]{0,63}$/u;function ix(e){let t=String(e??``).trim().toLowerCase();return rx.test(t)?t:null}function ax(e,t){return e.enabled===t.enabled&&e.maxChildren===t.maxChildren&&JSON.stringify(e.modelConfig??null)===JSON.stringify(t.modelConfig??null)&&(e.executionConfig??``)===(t.executionConfig??``)&&[...e.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)===[...t.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)}function ox({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}=Ji(),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(!1),[y,b]=(0,R.useState)(`idle`),[x,S]=(0,R.useState)(`record`),[C,w]=(0,R.useState)([]),[T,E]=(0,R.useState)(null),[D,O]=(0,R.useState)(2),[k,A]=(0,R.useState)(``),[ee,j]=(0,R.useState)(``),[M,te]=(0,R.useState)(``),[ne,N]=(0,R.useState)(`idle`),[P,re]=(0,R.useState)(null),[ie,ae]=(0,R.useState)(null),F=(0,R.useRef)(null),oe=(0,R.useRef)(null),[I,se]=(0,R.useState)(e.find(e=>e.available)?.agentId??`codex`),[L,ce]=(0,R.useState)(``),[le,ue]=(0,R.useState)(``),de=(0,R.useRef)(null),fe=(0,R.useRef)(null),pe=(0,R.useRef)(null),me=(0,R.useRef)(null),he=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,R.useEffect)(()=>{b(`idle`),v(!1),S(`record`),ue(``);let e=f.kind===`goal`?f.item.subagentExecution:void 0;w(e?.allowedDomains??[]),A(e?.modelConfig?.model??``),j(e?.modelConfig?.reasoning_effort??``),te(e?.executionConfig??``),O(e?.maxChildren?Math.min(e.maxChildren,32):2),E(null),N(`idle`),re(null),ae(null),F.current=e??null,oe.current=null},[he]);let ge=f.kind===`goal`?f.item.subagentExecution:void 0;(0,R.useEffect)(()=>{let e=F.current,t=ge?!e||!ax(e,ge):e!==null;if(F.current=ge??null,!ie){t&&ge&&(w(ge.allowedDomains),A(ge.modelConfig?.model??``),j(ge.modelConfig?.reasoning_effort??``),te(ge.executionConfig??``),O(ge.maxChildren||2),E(null),N(`idle`),re(null));return}let n=oe.current;(!ge||ax(ie,ge)||n&&!ax(n,ge))&&(ge&&(w(ge.allowedDomains),A(ge.modelConfig?.model??``),j(ge.modelConfig?.reasoning_effort??``),te(ge.executionConfig??``),O(ge.maxChildren||2)),oe.current=null,ae(null))},[ge,ie]),(0,R.useEffect)(()=>{let e=document.activeElement;e instanceof HTMLElement&&!fe.current?.contains(e)&&(pe.current=e);let t=window.requestAnimationFrame(()=>me.current?.focus());return()=>window.cancelAnimationFrame(t)},[he]);let _e=(0,R.useCallback)(()=>{let e=pe.current;c(),window.requestAnimationFrame(()=>e?.focus())},[c]);(0,R.useEffect)(()=>{function e(e){if(e.key===`Escape`){e.preventDefault(),_e();return}if(e.key===`Tab`&&f.kind!==`todo`){let t=Array.from(fe.current?.querySelectorAll($b)??[]).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)}},[_e,f.kind]);let ve=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`&&f.item.actionKind===`team.plan`&&f.item.status===`applied`?m(`proposal.teamPlan.resultTitle`):f.kind===`proposal`?m(f.item.reviewPlan?.retryOriginal?`drawer.recoverEditResult`:f.item.status===`applied`?`drawer.titleProposalApplied`:`drawer.titleProposalConfirm`):f.kind===`schedule`?f.item.scheduleKind===`heartbeat`?`Heartbeat`:m(`drawer.titleSchedule`):m(`drawer.goalDetails`),ye=f.kind===`proposal`?f.item.goalId??`manager`:f.item.goalId,be=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.kind===`proposal`&&f.item.status===`applied`&&f.item.actionKind===`team.plan`?f.item.goalId??m(`drawer.currentGoal`):f.item.goalId?m(`drawer.goalChanges`):m(`drawer.managerChanges`),xe=f.kind===`goal`?d.find(e=>e.goalId===f.item.goalId&&!!e.sessionId)??d.find(e=>e.goalId===f.item.goalId):null,Se=f.kind===`run`&&(f.item.completedSteps>0||!!f.item.latestActivity||!!f.item.outputs?.length),Ce=f.kind===`attention`?Zi(f.item.updatedAt,m):null,we=Xb(le);async function Te(){f.kind!==`run`||!h.trim()||(await r.onCorrectRun?.(f.item,h.trim()),g(``))}async function Ee(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??I,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 De(e,t,n){u||!of(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 Oe=f.kind===`goal`?ie??f.item.subagentExecution??{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0}:{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0},ke=ne===`previewing`||ne===`applying`,Ae=(()=>{if(f.kind!==`goal`)return[];let e=new Map;for(let t of Oe.allowedDomains){let n=ix(t);n&&e.set(n,{matchingTodoCount:0,value:n})}if(Oe.domainCandidates)for(let t of Oe.domainCandidates){let n=ix(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=ix(t.taskDomain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+1,value:n})}return[...e.values()]})();function je(){w(Oe.allowedDomains),A(Oe.modelConfig?.model??``),j(Oe.modelConfig?.reasoning_effort??``),te(Oe.executionConfig??``),O(Oe.maxChildren||2),E(null),N(`idle`),re(null)}function Me(){let e=[...new Set(C.map(e=>ix(e)))];return e.every(e=>!!e)?e:null}function Ne(e,t){w(n=>t?[...n,e].filter((e,t,n)=>n.indexOf(e)===t):n.filter(t=>t!==e)),re(null),N(`idle`),E(null)}async function Pe(e,t=e){if(f.kind!==`goal`||!r.onPreviewGoalSubagentConfiguration)return;let n=e?Me():[];if(t&&!k.trim()&&ee){N(`error`),E(m(`drawer.subagentModelRequired`));return}if(e&&!n){N(`error`),E(m(`drawer.subagentDomainInvalid`)),re(null);return}let i={alignCodexHostCapacity:e,allowedDomains:n??[],enabled:e,goalId:f.item.goalId,maxChildren:e?D:0,executionConfig:M.trim(),...Qb(t,k,ee)};N(`previewing`),E(m(`drawer.subagentPreviewing`)),re(null);try{let e=await r.onPreviewGoalSubagentConfiguration(i);if(!e.changed){oe.current=ge??null,ae({...e.configuration,domainCandidates:Oe.domainCandidates}),w(e.configuration.allowedDomains),A(e.configuration.modelConfig?.model??``),j(e.configuration.modelConfig?.reasoning_effort??``),te(e.configuration.executionConfig??``),O(e.configuration.maxChildren||2),N(`success`),E(m(`drawer.subagentNoChange`));return}re({...i,codexHostCapacity:e.configuration.codexHostCapacity,changed:e.changed,previewId:e.previewId}),N(`ready`),E(m(`drawer.subagentPreviewReady`))}catch(e){N(`error`),E(e instanceof Error?e.message:m(`drawer.subagentPreviewFailed`))}}async function Fe(){if(!(!P||!r.onApplyGoalSubagentConfiguration)){N(`applying`),E(m(`drawer.subagentApplying`));try{let e=await r.onApplyGoalSubagentConfiguration({allowedDomains:P.allowedDomains,alignCodexHostCapacity:P.enabled,enabled:P.enabled,goalId:P.goalId,maxChildren:P.maxChildren,modelConfig:P.modelConfig,executionConfig:P.executionConfig,previewId:P.previewId});oe.current=ge??null,ae({...e,domainCandidates:Oe.domainCandidates}),w(e.allowedDomains),A(e.modelConfig?.model??``),j(e.modelConfig?.reasoning_effort??``),te(e.executionConfig??``),O(e.maxChildren||2),N(`success`),E(m(e.codexHostCapacity?.newSessionRequired?`drawer.subagentAppliedRestart`:`drawer.subagentApplied`)),re(null);try{await r.onRefresh?.()}catch{N(`warning`),E(m(`drawer.subagentAppliedRefreshFailed`))}}catch(e){N(`error`),E(e instanceof Error?e.message:m(`drawer.subagentApplyFailed`))}}}return(0,z.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:fe,role:`dialog`,children:[(0,z.jsxs)(`header`,{className:`personal-drawer-header${f.kind===`todo`?` is-task-inspector`:``}`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{id:`personal-drawer-title`,ref:me,tabIndex:-1,children:ve}),(0,z.jsx)(`p`,{children:be})]}),(0,z.jsxs)(`div`,{className:`personal-drawer-header-actions`,children:[f.kind===`todo`&&l?(0,z.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,z.jsx)(Wm,{size:17}):(0,z.jsx)(Bm,{size:17})}):null,(0,z.jsxs)(`button`,{"aria-label":m(`drawer.closeDetail`,{context:be}),className:`personal-icon-button personal-drawer-close`,onClick:_e,ref:de,type:`button`,children:[(0,z.jsx)(om,{className:`personal-mobile-back`,size:18}),(0,z.jsx)(gh,{className:`personal-desktop-close`,size:18})]})]})]}),(0,z.jsxs)(`div`,{className:`personal-drawer-body`,children:[f.kind===`attention`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card is-attention`,children:[(0,z.jsx)(`small`,{children:f.item.blocking?m(`drawer.attentionBlocking`):m(`drawer.attentionWaiting`)}),(0,z.jsx)(`h3`,{children:f.item.text}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,z.jsx)(`dd`,{children:f.item.priority??`medium`})]}),Ce?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`common.waiting`)}),(0,z.jsx)(`dd`,{children:m(`tasks.waitingAge`,{age:Ce})})]}):null]})]}),(0,z.jsx)(Wb,{item:f.item,onSelect:n,successor:af(f.item,t)}),!u&&of(f.item)?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void De(f.item,`approve`,m(`common.confirm`)),type:`button`,children:[(0,z.jsx)(hm,{size:17}),m(`drawer.decisionReview`)]}),(0,z.jsxs)(`details`,{className:`personal-compact-menu`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(Em,{size:17}),m(`drawer.decisionMore`)]}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`button`,{onClick:()=>void r.onExplainDecision?.(f.item),type:`button`,children:[(0,z.jsx)(Hm,{size:16}),m(`drawer.explainDecision`)]}),tx.map(e=>(0,z.jsx)(`button`,{onClick:()=>void De(f.item,e.resolution,m(e.key)),type:`button`,children:m(e.key)},e.resolution))]})]})]}):null]}):null,f.kind===`todo`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-task-inspector-summary`,children:[(0,z.jsxs)(`div`,{className:`personal-task-inspector-status`,children:[(0,z.jsxs)(`span`,{className:f.item.done?`is-done`:f.item.status===`blocked`?`is-blocked`:`is-open`,children:[(0,z.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,z.jsx)(`span`,{children:f.item.priority}):null,(0,z.jsx)(`span`,{children:f.item.taskClass===`advancement_task`?m(`drawer.taskAdvancement`):f.item.taskClass??m(`drawer.taskOrdinary`)})]}),(0,z.jsx)(`h3`,{children:f.item.text})]}),(0,z.jsxs)(`section`,{"aria-label":m(`drawer.taskInfo`),className:`personal-task-inspector-fields`,children:[(0,z.jsx)(`h4`,{children:m(`drawer.taskInfo`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`common.owner`)}),(0,z.jsx)(`dd`,{children:f.item.ownerLabel??f.item.claimedBy??m(`drawer.notAssigned`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`common.status`)}),(0,z.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,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,z.jsx)(`dd`,{children:f.item.priority??m(`drawer.notSet`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.dependencies`)}),(0,z.jsx)(`dd`,{children:f.item.dependencies?.join(` · `)||m(`common.none`)})]}),f.item.status===`deferred`||f.item.resumeWhen?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.resumeWhen`)}),(0,z.jsx)(`dd`,{children:f.item.resumeWhen||m(`drawer.notSet`)})]}):null,f.item.resumeWhen?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.resumeState`)}),(0,z.jsx)(`dd`,{children:f.item.resumeReady?m(`drawer.resumeReady`):m(`drawer.resumePending`)})]}):null,f.item.resumeReceiptId?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.resumeReceipt`)}),(0,z.jsx)(`dd`,{children:f.item.resumeReceiptId})]}):null,f.item.validationDigest?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.validationRevision`)}),(0,z.jsx)(`dd`,{children:f.item.validationRevision??0})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.validationDigest`)}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:f.item.validationDigest})})]}),f.item.validationRevisionActor?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.validationRevisionActor`)}),(0,z.jsx)(`dd`,{children:f.item.validationRevisionActor})]}):null]}):null,(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.nextTransition`)}),(0,z.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,z.jsxs)(`div`,{className:`personal-task-inspector-actions`,"aria-label":m(`drawer.taskActions`),children:[(0,z.jsxs)(`details`,{className:`personal-task-management`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(Em,{size:16}),m(`drawer.taskManage`)]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:m(`drawer.reassign`)}),(0,z.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.reassign`),(0,z.jsx)(`select`,{"aria-label":m(`drawer.reassign`),onChange:e=>se(e.target.value),value:I,children:e.filter(e=>e.available).map(e=>(0,z.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))}),(0,z.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-${I}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:I,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,z.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.taskPriority`),(0,z.jsxs)(`select`,{"aria-label":m(`drawer.taskPriority`),value:L,onChange:e=>ce(e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:m(`drawer.taskPriorityChoose`)}),[`P0`,`P1`,`P2`,`P3`,`P4`].map(e=>(0,z.jsx)(`option`,{value:e,children:e},e)),(0,z.jsx)(`option`,{value:`clear`,children:m(`drawer.taskPriorityClear`)})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:!L,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}-priority-${L}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:f.item.goalId,todo_id:f.item.todoId,operation:`edit`,...L===`clear`?{clear_priority:!0}:{priority:L}},summary:`${m(`drawer.taskPriority`)}: ${L===`clear`?m(`drawer.taskPriorityClear`):L}`}),type:`button`,children:m(`timeline.review`)})]}),(0,z.jsx)(`strong`,{children:m(`drawer.taskDeferUntil`)}),(0,z.jsxs)(`label`,{className:`personal-inline-agent-select personal-inline-resume-when`,children:[m(`drawer.taskDeferUntil`),(0,z.jsx)(`input`,{"aria-label":m(`drawer.taskDeferCondition`),"aria-invalid":!!le.trim()&&!we,onChange:e=>ue(e.target.value),placeholder:m(`drawer.taskDeferPlaceholder`),value:le}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:!we,onClick:()=>void Ee(f.item,`defer`,m(`drawer.taskDefer`),we??void 0),type:`button`,children:m(`drawer.taskDeferReview`)}),(0,z.jsx)(`small`,{children:le.trim()&&!we?m(`drawer.taskDeferInvalid`):m(`drawer.taskDeferSupported`)})]}),(0,z.jsx)(`div`,{className:`personal-task-management-secondary`,children:ex.map(e=>(0,z.jsx)(`button`,{onClick:()=>void Ee(f.item,e.operation,m(e.key)),type:`button`,children:m(e.key)},e.operation))})]})]}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void Ee(f.item,`complete`,m(`drawer.taskComplete`)),type:`button`,children:[(0,z.jsx)(hm,{size:17}),m(`drawer.taskComplete`)]})]}):null,f.item.done?(0,z.jsxs)(`div`,{className:`personal-task-completed-note`,children:[(0,z.jsx)(hm,{size:16}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:m(`drawer.taskCompletedTitle`)}),(0,z.jsx)(`small`,{children:m(`drawer.taskCompletedNote`)})]})]}):null]}):null,f.kind===`goal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsx)(`small`,{children:Yi(f.item.state,p)}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.agentSentence}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.tokens`)}),(0,z.jsxs)(`dd`,{children:[Qd(f.item.usage?.tokens24h,m(`drawer.usageNotMeasured`),Yd),` / `,Qd(f.item.usage?.tokens7d,m(`drawer.usageNotMeasured`),Yd)]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.cost`)}),(0,z.jsxs)(`dd`,{children:[Qd(f.item.usage?.costUsd24h,m(`drawer.usageNotMeasured`),Xd),` / `,Qd(f.item.usage?.costUsd7d,m(`drawer.usageNotMeasured`),Xd)]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.duration`)}),(0,z.jsxs)(`dd`,{children:[Qd(f.item.usage?.durationMs24h,m(`drawer.usageNotMeasured`),Zd),` / `,Qd(f.item.usage?.durationMs7d,m(`drawer.usageNotMeasured`),Zd)]})]})]})]}),(0,z.jsx)(Ub,{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,z.jsxs)(z.Fragment,{children:[f.item.repository?(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-repository`,children:[(0,z.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,z.jsx)(`small`,{children:m(`drawer.repository`)}),(0,z.jsx)(`em`,{children:m(`common.readOnly`)})]}),(0,z.jsxs)(`h3`,{children:[(0,z.jsx)(Mm,{size:16}),f.item.repository.label]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.branch`)}),(0,z.jsx)(`dd`,{children:f.item.repository.branch||`detached`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Role`}),(0,z.jsx)(`dd`,{children:m(`drawer.repositoryRole`)})]})]}),(0,z.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,z.jsx)(Cm,{size:15}),m(y===`copied`?`drawer.copyRepositoryDone`:`drawer.copyRepository`)]}),y===`error`?(0,z.jsx)(`p`,{className:`personal-copy-feedback is-error`,role:`status`,children:m(`drawer.copyRepositoryError`)}):y===`copied`?(0,z.jsx)(`p`,{className:`personal-copy-feedback`,role:`status`,children:m(`drawer.copyRepositorySuccess`)}):null]}):null,u?(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,z.jsx)(`small`,{children:m(`drawer.larkConnection`)}),(0,z.jsx)(`h3`,{children:m(`drawer.remoteDetailsUnavailable`)}),(0,z.jsx)(`p`,{children:m(`drawer.remoteDetailsDescription`)})]}):(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,z.jsx)(`small`,{children:m(`drawer.larkConnection`)}),t?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`h3`,{children:[t.app_label,(0,z.jsx)(`span`,{className:`personal-connection-status`,children:m(`drawer.connected`)})]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.group`)}),(0,z.jsx)(`dd`,{children:t.chat_name})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.topic`)}),(0,z.jsxs)(`dd`,{children:[`# `,t.topic_name]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.trigger`)}),(0,z.jsx)(`dd`,{children:t.incoming_mode===`mentions`?m(`lark.someoneMentions`):m(`lark.allMessages`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.replyMode`)}),(0,z.jsx)(`dd`,{children:m(`lark.topicReply`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.autoNotify`)}),(0,z.jsx)(`dd`,{children:e?.humanGateAutoNotifyEnabled?m(`common.on`):m(`common.off`)})]}),e?.lastNotifiedAt?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.lastNotification`)}),(0,z.jsx)(`dd`,{children:e.lastNotifiedAt})]}):null]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:m(`drawer.larkNotConfigured`)}),(0,z.jsx)(`p`,{children:m(`drawer.larkNotConfiguredDescription`)})]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onOpenNotificationSettings?.(f.item.goalId),type:`button`,children:[(0,z.jsx)(dm,{size:16}),m(t?`drawer.larkConfigure`:`drawer.larkConnect`)]})]})]})})(),(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-session`,children:[(0,z.jsx)(`small`,{children:m(`drawer.runDetails`)}),xe?.sessionId?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:Xi(xe.sessionStatus??xe.status,m)}),(0,z.jsx)(`p`,{children:xe.title}),r.onOpenRunSession?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onOpenRunSession?.(xe),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.runLatest`)]}):null]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:m(`drawer.noRun`)}),(0,z.jsx)(`p`,{children:m(`drawer.noRunDescription`)})]})]}),u?null:(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`heartbeat`,f.item.goalId),type:`button`,children:[(0,z.jsx)(Zm,{size:16}),m(`drawer.setupHeartbeat`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`monitor`,f.item.goalId),type:`button`,children:[(0,z.jsx)(mm,{size:16}),m(`drawer.scheduleAdd`)]})]}),f.item.subagentExecution?(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-subagents`,children:[(0,z.jsxs)(`div`,{className:`personal-subagent-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:m(`drawer.subagentLabel`)}),(0,z.jsxs)(`h3`,{children:[(0,z.jsx)(fm,{size:16}),m(`drawer.subagentTitle`)]})]}),(0,z.jsxs)(`button`,{"aria-checked":Oe.enabled,"aria-label":m(P&&ne===`ready`?`drawer.subagentPending`:Oe.enabled?`drawer.subagentDisable`:`drawer.subagentEnable`),className:`personal-subagent-switch`,"data-pending":P&&ne===`ready`?`true`:void 0,disabled:u||ke||!!P||!r.onPreviewGoalSubagentConfiguration,onClick:()=>void Pe(!Oe.enabled),role:`switch`,type:`button`,children:[(0,z.jsx)(`span`,{}),m(P&&ne===`ready`?`drawer.subagentPending`:Oe.enabled?`common.on`:`common.off`)]})]}),(0,z.jsx)(`p`,{children:m(`drawer.subagentDescription`)}),P&&ne===`ready`?(0,z.jsxs)(`div`,{className:`personal-subagent-preview`,children:[(0,z.jsx)(`strong`,{children:m(P.enabled?`drawer.subagentConfirmEnable`:`drawer.subagentConfirmDisable`)}),(0,z.jsx)(`p`,{children:P.enabled?m(`drawer.subagentPreviewSummary`,{count:P.maxChildren,domains:P.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)}):m(`drawer.subagentDisableSummary`)}),P.modelConfig===void 0?null:(0,z.jsxs)(`p`,{children:[m(`drawer.subagentModel`),`: `,P.modelConfig?.model||m(`drawer.subagentModelDefault`),` · `,P.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)]}),(0,z.jsxs)(`p`,{children:[m(`drawer.subagentExecutionConfig`),`: `,P.executionConfig||m(`drawer.subagentExecutionConfigNone`)]}),P.enabled&&P.codexHostCapacity?(0,z.jsx)(`p`,{children:m(P.codexHostCapacity.writeRequired?`drawer.subagentHostCapacityRaise`:`drawer.subagentHostCapacityReady`,{configured:P.codexHostCapacity.configuredChildren??m(`drawer.subagentHostCapacityImplicit`),required:P.codexHostCapacity.requiredChildren})}):null,(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`button`,{className:`personal-primary-action`,onClick:()=>void Fe(),type:`button`,children:m(`common.confirm`)}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:je,type:`button`,children:m(`common.cancel`)})]})]}):null,T?(0,z.jsxs)(`p`,{className:`personal-subagent-feedback is-${ne}`,role:`status`,children:[ne===`previewing`||ne===`applying`?(0,z.jsx)($m,{className:`personal-spin`,size:13}):null,T]}):null,(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentModel`)}),(0,z.jsx)(`dd`,{children:Oe.modelConfig?.model||m(`drawer.subagentModelDefault`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentEffort`)}),(0,z.jsx)(`dd`,{children:Oe.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentCurrentBoundary`)}),(0,z.jsx)(`dd`,{children:Oe.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentChildLimit`)}),(0,z.jsx)(`dd`,{children:Oe.maxChildren||0})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentExecutionConfig`)}),(0,z.jsx)(`dd`,{children:Oe.executionConfig||m(`drawer.subagentExecutionConfigNone`)})]})]}),u?(0,z.jsx)(`p`,{className:`personal-subagent-read-only`,children:m(`drawer.subagentRemoteReadOnly`)}):(0,z.jsxs)(`div`,{className:`personal-subagent-fields`,children:[(0,z.jsxs)(`fieldset`,{className:`personal-subagent-domain-picker`,disabled:ke,children:[(0,z.jsx)(`legend`,{children:m(`drawer.subagentDomains`)}),Ae.length>0?(0,z.jsx)(`div`,{className:`personal-subagent-domain-options`,children:Ae.map(e=>{let t=C.includes(e.value);return(0,z.jsxs)(`label`,{className:`personal-subagent-domain-option${t?` is-selected`:``}`,children:[(0,z.jsx)(`input`,{"aria-label":e.value,checked:t,onChange:t=>Ne(e.value,t.target.checked),type:`checkbox`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.value}),(0,z.jsx)(`small`,{children:m(`drawer.subagentDomainTodoCount`,{count:e.matchingTodoCount})})]})]},e.value)})}):(0,z.jsx)(`p`,{className:`personal-subagent-domain-empty`,children:m(`drawer.subagentDomainsEmpty`)}),(0,z.jsx)(`small`,{children:m(`drawer.subagentDomainsHint`)})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentModel`)}),(0,z.jsx)(`input`,{"aria-label":m(`drawer.subagentModel`),disabled:ke,value:k,placeholder:`gpt-5.6-luna`,onChange:e=>{A(e.target.value),re(null),N(`idle`),E(null)}})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentEffort`)}),(0,z.jsxs)(`select`,{"aria-label":m(`drawer.subagentEffort`),disabled:ke,value:ee,onChange:e=>{j(e.target.value),re(null),N(`idle`),E(null)},children:[(0,z.jsx)(`option`,{value:``,children:m(`drawer.subagentModelDefault`)}),[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`].map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:ke,type:`button`,onClick:()=>{A(`gpt-5.6-luna`),j(`max`),re(null),N(`idle`),E(null)},children:m(`drawer.subagentLunaPreset`)}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:ke,type:`button`,onClick:()=>{A(``),j(``),re(null),N(`idle`),E(null)},children:m(`drawer.subagentClearModel`)}),(0,z.jsx)(`p`,{children:m(`drawer.subagentModelHint`)}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentExecutionConfig`)}),(0,z.jsx)(`input`,{"aria-label":m(`drawer.subagentExecutionConfig`),disabled:ke,onChange:e=>{te(e.target.value),re(null),N(`idle`),E(null)},placeholder:`.loopx/config/delegations.json`,value:M})]}),(0,z.jsx)(`p`,{children:m(`drawer.subagentExecutionConfigHint`)}),(0,z.jsxs)(`label`,{className:`personal-subagent-limit-field`,children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentMaxChildren`)}),(0,z.jsx)(`select`,{"aria-label":m(`drawer.subagentMaxChildren`),disabled:ke,onChange:e=>{O(Number(e.target.value)),re(null),N(`idle`),E(null)},value:D,children:nx.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:ke,onClick:()=>void Pe(Oe.enabled,!0),type:`button`,children:m(`drawer.subagentPreviewBoundary`)})]})]}):null]}):null,f.kind===`run`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{"aria-label":m(`drawer.runView`),className:`personal-run-drawer-tabs`,role:`tablist`,children:[(0,z.jsx)(`button`,{"aria-selected":x===`record`,onClick:()=>S(`record`),role:`tab`,type:`button`,children:m(`drawer.executionRecordAndResult`)}),(0,z.jsx)(`button`,{"aria-selected":x===`details`,onClick:()=>S(`details`),role:`tab`,type:`button`,children:m(`drawer.detailsAndActions`)})]}),x===`record`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card personal-session-summary`,children:[(0,z.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Xi(f.item.sessionStatus??f.item.status,m)]}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.latestActivity}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,z.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]})]})]}),(0,z.jsxs)(`section`,{"aria-label":m(`drawer.executionRecord`),className:`personal-session-message-record`,children:[(0,z.jsx)(`h3`,{children:m(`drawer.executionRecord`)}),f.item.sessionMessages?.length?(0,z.jsx)(`ol`,{children:f.item.sessionMessages.map(e=>(0,z.jsxs)(`li`,{className:`is-${e.role}`,children:[(0,z.jsx)(`i`,{}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:e.role===`user`?m(`drawer.runRoleUser`):e.role===`assistant`?m(`drawer.runRoleAssistant`):m(`drawer.runRoleSystem`)}),e.createdAt?(0,z.jsx)(`time`,{children:new Date(e.createdAt).toLocaleTimeString(p,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}):null]}),(0,z.jsx)(`p`,{children:e.text})]})]},e.messageId))}):(0,z.jsx)(`p`,{className:`personal-session-empty`,children:Se?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,z.jsxs)(`div`,{className:`personal-session-active-step`,children:[(0,z.jsx)(`i`,{}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:m(`drawer.analysis`)}),(0,z.jsx)(`small`,{children:m(`drawer.agentWorking`)})]})]}):null]}),f.item.outputs?.length?(0,z.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-run-outputs-title`,children:[(0,z.jsx)(`h3`,{id:`personal-run-outputs-title`,children:m(`drawer.outputs`)}),(0,z.jsx)(`ol`,{children:f.item.outputs.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`small`,{children:e.createdAt??e.kind??m(`files.emptySummary`)})]})},e.outputId))})]}):null]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Xi(f.item.status,m)]}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.latestActivity}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,z.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.sessionStatus`)}),(0,z.jsx)(`dd`,{children:Xi(f.item.sessionStatus??f.item.status,m)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.sessionRecoverable`)}),(0,z.jsx)(`dd`,{children:f.item.resumable===!1?m(`drawer.resumeNo`):m(`drawer.resumeYes`)})]})]})]}),f.item.sessionStatus===`resume_failed`&&!u?(0,z.jsxs)(`section`,{className:`personal-recovery-panel`,"aria-label":m(`drawer.recoveryFailed`),children:[(0,z.jsx)(`strong`,{children:m(`drawer.recoveryFailed`)}),(0,z.jsx)(`p`,{children:m(`drawer.recoveryDescription`)}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,z.jsx)($m,{size:16}),m(`drawer.recoveryRetry`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.recoveryNewSession`)]})]}):null,u?null:(0,z.jsxs)(`section`,{className:`personal-correction-panel`,children:[(0,z.jsx)(`header`,{children:(0,z.jsxs)(`span`,{children:[(0,z.jsx)(fm,{size:16}),m(`drawer.correctionLabel`,{agent:f.item.agentLabel})]})}),(0,z.jsx)(`p`,{children:m(`drawer.correctionDescription`)}),(0,z.jsxs)(`div`,{className:`personal-correction-composer`,children:[(0,z.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,z.jsx)(`button`,{"aria-label":m(`drawer.correctionSend`),disabled:!h.trim(),onClick:()=>void Te(),type:`button`,children:(0,z.jsx)(nh,{size:16})})]})]}),u?null:(0,z.jsxs)(`details`,{className:`personal-compact-menu personal-run-more`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(Em,{size:17}),m(`drawer.moreRunActions`)]}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`button`,{disabled:!f.item.canInterrupt,onClick:()=>void r.onInterruptRun?.(f.item),type:`button`,children:[(0,z.jsx)(Jm,{size:16}),m(`drawer.runInterrupt`)]}),(0,z.jsxs)(`button`,{disabled:f.item.resumable===!1,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,z.jsx)($m,{size:16}),m(`drawer.recoveryRetry`)]}),(0,z.jsxs)(`button`,{onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.runNewSession`)]}),(0,z.jsxs)(`button`,{onClick:()=>void r.onCloseRunSession?.(f.item),type:`button`,children:[(0,z.jsx)(lh,{size:16}),m(`drawer.runCloseSession`)]})]})]})]})]}):null,f.kind===`output`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsx)(`small`,{children:f.item.kind??`output`}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.summary??m(`drawer.outputRecorded`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.outputTodo`)}),(0,z.jsx)(`dd`,{children:f.item.todoId??m(`drawer.notLinked`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.outputRun`)}),(0,z.jsx)(`dd`,{children:f.item.runId??m(`drawer.notLinked`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Agent`}),(0,z.jsx)(`dd`,{children:f.item.agentLabel??f.item.agentId??`LoopX`})]})]})]}),f.item.report?(0,z.jsxs)(`section`,{className:`personal-report-detail`,"data-testid":`personal-periodic-report-detail`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsxs)(`strong`,{children:[`+`,f.item.report.addedCount]}),m(`files.reportAdded`)]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:f.item.report.changedCount}),m(`files.reportChanged`)]})]}),(0,z.jsxs)(`p`,{children:[f.item.report.periodStartAt,` → `,f.item.report.periodEndAt]}),(0,z.jsx)(`ol`,{children:f.item.report.items.map(e=>(0,z.jsxs)(`li`,{"data-change-kind":e.changeKind,children:[(0,z.jsxs)(`small`,{children:[e.changeKind,` · `,e.status]}),(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`p`,{children:e.summary})]},e.sourceRef))}),(0,z.jsxs)(`footer`,{children:[(0,z.jsxs)(`span`,{children:[m(`files.reportPublication`),`: `,f.item.report.publicationId]}),(0,z.jsxs)(`span`,{children:[m(`files.reportGeneration`),`: `,f.item.report.generationId]})]})]}):null,f.item.safePreview?(0,z.jsx)(`pre`,{"aria-label":m(`drawer.outputSafePreview`),className:`personal-safe-preview`,children:f.item.safePreview}):(0,z.jsx)(`p`,{className:`personal-preview-unavailable`,children:m(`drawer.previewUnavailable`)}),(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:!r.onOpenOutput,onClick:()=>{r.onOpenOutput?.(f.item),c()},type:`button`,children:[(0,z.jsx)(Dm,{size:16}),m(`files.openConversation`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!r.onExportOutput,onClick:()=>void r.onExportOutput?.(f.item),type:`button`,children:[(0,z.jsx)(Tm,{size:16}),m(`files.exportSummary`)]})]})]}):null,f.kind===`proposal`?(0,z.jsxs)(z.Fragment,{children:[f.item.actionKind===`team.plan`&&f.item.status===`applied`?(0,z.jsx)(Gb,{proposal:f.item,t:m}):(0,z.jsxs)(`section`,{className:`personal-proposal-card`,children:[(0,z.jsxs)(`small`,{children:[f.item.actionKind,` · `,f.item.status]}),(0,z.jsx)(`h3`,{children:f.item.title}),f.item.impact?(0,z.jsx)(`p`,{children:f.item.impact}):null,f.item.reviewPlan&&!f.item.reviewPlan.retryOriginal&&f.item.actionKind!==`team.plan`?(0,z.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`&&f.item.actionKind!==`team.plan`?(0,z.jsx)(`p`,{className:`personal-proposal-explainer`,children:m(`drawer.proposalExplainer`)}):null,(0,z.jsx)(`dl`,{children:f.item.fields.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.label}),(0,z.jsx)(`dd`,{children:e.value})]},e.key))})]}),f.item.status===`applied`&&f.item.actionKind!==`team.plan`?(0,z.jsxs)(`p`,{className:`personal-proposal-state ${f.item.actionKind===`operation.execute`&&f.item.reviewPlan?.reason===`readback_unverified`?`is-gated`:`is-applied`}`,children:[(0,z.jsx)(hm,{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,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>{let e=f.item.goalId;c(),r.onOpenGoal?.(e)},type:`button`,children:[(0,z.jsx)(Dm,{size:16}),f.item.actionKind===`goal.create`?m(`drawer.proposalEnterGoal`):m(f.item.actionKind===`team.plan`?`proposal.teamPlan.openGoal`:`drawer.proposalViewGoal`)]}):null,f.item.status===`stale`?(0,z.jsx)(`p`,{className:`personal-proposal-state is-stale`,children:m(`drawer.proposalStale`)}):null,f.item.status===`error`&&!f.item.reviewPlan?.retryOriginal?(0,z.jsxs)(`div`,{className:`personal-proposal-state is-error`,children:[(0,z.jsx)(`span`,{children:f.item.reviewPlan?.reason===`readback_unverified`?m(`actionReview.readback_unverified`):m(`drawer.proposalApplyFailed`)}),f.item.errorMessage?(0,z.jsx)(`small`,{children:f.item.errorMessage}):null,(0,z.jsx)(`small`,{children:m(f.item.actionKind===`team.plan`?`proposal.teamPlan.retryHint`:`drawer.proposalApplyFailedHint`)})]}):null,f.item.status===`rejected`?(0,z.jsx)(`p`,{className:`personal-proposal-state is-error`,children:m(`drawer.proposalRejected`)}):null,f.item.status===`deferred`?(0,z.jsx)(`p`,{className:`personal-proposal-state is-gated`,children:m(`drawer.proposalDeferred`)}):null,f.item.status===`gated`?(0,z.jsxs)(`div`,{className:`personal-proposal-state is-gated`,children:[(0,z.jsxs)(`span`,{children:[(0,z.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,z.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,z.jsxs)(`section`,{className:`personal-detail-card personal-gate-cli-hint`,children:[(0,z.jsx)(`small`,{children:m(`drawer.gateApproveHint`)}),(0,z.jsxs)(`code`,{children:[`loopx todo complete --goal-id `,t,` --todo-id `,n,` --decision-outcome approve`]}),(0,z.jsx)(`small`,{children:m(`drawer.gateRejectHint`)})]})})():null,!u&&f.item.workspaceCandidates?.length?(0,z.jsx)(`div`,{className:`personal-workspace-candidates`,"aria-label":m(`drawer.workspaceCandidates`),children:f.item.workspaceCandidates.map(e=>(0,z.jsxs)(`button`,{onClick:()=>void r.onSelectWorkspaceCandidate?.(f.item,e.workspaceRef),type:`button`,children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsx)(`small`,{children:e.workspaceRef})]},e.workspaceRef))}):null,!u&&f.item.actionKind!==`operation.execute`&&f.item.status===`error`?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void(f.item.actionKind===`team.plan`||f.item.reviewPlan?.retryOriginal?r.onApplyProposal?.(f.item):r.onTransitionProposal?.(f.item,`regenerate`)),type:`button`,children:[(0,z.jsx)($m,{size:17}),m(f.item.reviewPlan?.retryOriginal?`drawer.retryOriginal`:f.item.actionKind===`team.plan`?`proposal.teamPlan.retry`:`drawer.proposalRegenerate`)]}):!u&&f.item.actionKind!==`operation.execute`&&f.item.status!==`gated`&&(f.item.actionKind!==`team.plan`||f.item.status!==`applied`)?(0,z.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,z.jsx)(hm,{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,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,z.jsx)($m,{size:16}),m(`drawer.proposalRecheck`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&[`ready`,`gated`].includes(f.item.status)?(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`defer`),type:`button`,children:m(`drawer.proposalDefer`)}),(0,z.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,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:c,type:`button`,children:m(`drawer.proposalClose`)})]}):null,f.kind===`schedule`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsxs)(`small`,{children:[f.item.scheduleKind===`heartbeat`?`Goal Heartbeat`:`continuous_monitor`,` · `,f.item.status??`active`]}),(0,z.jsx)(`h3`,{children:f.item.label}),(0,z.jsx)(`p`,{children:f.item.target??f.item.schedule??m(`drawer.scheduleDefaultTarget`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleTimezone`)}),(0,z.jsx)(`dd`,{children:f.item.timezone??m(`drawer.scheduleLocalTimezone`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleNext`)}),(0,z.jsx)(`dd`,{children:f.item.nextRunAt??m(`drawer.schedulePending`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleLast`)}),(0,z.jsx)(`dd`,{children:f.item.previousRunAt??m(`drawer.scheduleNeverRun`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleNotification`)}),(0,z.jsx)(`dd`,{children:f.item.notificationRule??m(`drawer.scheduleDefaultNotification`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleStopCondition`)}),(0,z.jsx)(`dd`,{children:f.item.stopCondition??m(`drawer.scheduleDefaultStop`)})]})]})]}),!u&&f.item.scheduleKind===`monitor`?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`run_now`),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.scheduleRunNow`)]}):null,u?null:(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.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,z.jsx)(Ym,{size:16}):(0,z.jsx)(Jm,{size:16}),f.item.status===`paused`?m(`drawer.scheduleResume`):m(`drawer.schedulePause`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`edit`),type:`button`,children:[(0,z.jsx)(mm,{size:16}),m(`drawer.scheduleEdit`)]})]}),u?null:(0,z.jsxs)(`button`,{className:`personal-danger-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`stop`),type:`button`,children:[(0,z.jsx)(lh,{size:16}),m(`drawer.scheduleStop`,{kind:f.item.scheduleKind===`heartbeat`?` Heartbeat`:m(`drawer.titleSchedule`)})]}),(0,z.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-execution-history-title`,children:[(0,z.jsx)(`h3`,{id:`personal-execution-history-title`,children:m(`drawer.executionHistory`)}),f.item.executionHistory?.length?(0,z.jsx)(`ol`,{children:f.item.executionHistory.map((e,t)=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsx)(`small`,{children:e.timestamp})]}),(0,z.jsx)(`em`,{className:`is-${e.status}`,children:e.status})]},`${e.timestamp}:${e.runId??t}`))}):(0,z.jsx)(`p`,{children:m(`drawer.noExecutionHistory`)})]})]}):null,f.kind===`run`||f.kind===`proposal`||f.kind===`schedule`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`button`,{"aria-expanded":_,className:`personal-diagnostics-trigger`,onClick:()=>v(e=>!e),type:`button`,children:[(0,z.jsx)(`span`,{children:m(`drawer.advancedDiagnostics`)}),(0,z.jsx)(gm,{className:_?`is-open`:``,size:16})]}),_?(0,z.jsxs)(`div`,{className:`personal-diagnostics`,children:[(0,z.jsxs)(`code`,{children:[`goal_id: `,ye]}),(0,z.jsxs)(`code`,{children:[`kind: `,f.kind]}),f.kind===`run`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`code`,{children:[`session_id: `,f.item.sessionId??m(`drawer.notLinked`)]}),(0,z.jsxs)(`code`,{children:[`turn_id: `,f.item.turnId??m(`common.none`)]}),(0,z.jsxs)(`code`,{children:[`adapter: `,f.item.agentId]}),(0,z.jsxs)(`code`,{children:[`status: `,f.item.sessionStatus??f.item.status]})]}):f.kind===`proposal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`code`,{children:[`action: `,f.item.actionKind]}),(0,z.jsxs)(`code`,{children:[`status: `,f.item.status]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`code`,{children:[`schedule_id: `,f.item.scheduleId]}),(0,z.jsxs)(`code`,{children:[`status: `,f.item.status??`active`]})]})]}):null]}):null]})]})}var sx=[`checking`,`connecting`,`downloading`,`installing_app`,`installing_runtime`],cx={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 lx(e,t=`update_failed`){return{phase:`error`,details:{code:typeof e==`string`&&Object.hasOwn(cx,e)?e:t}}}function ux(){let{locale:e}=Ji(),t=e===`zh-CN`,[n,r]=(0,R.useState)(!1),i=(0,R.useRef)(null),[a,o]=(0,R.useState)(`stable`),[s,c]=(0,R.useState)({phase:`idle`}),[l,u]=(0,R.useState)(``),[d,f]=(0,R.useState)(!1),p=(0,R.useRef)(!1),m=window.__TAURI__?.core.invoke,h=sx.includes(s.phase);(0,R.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,R.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(lx(t))})}).catch(()=>{e&&c(lx(null,`desktop_status_unavailable`))}),()=>{e=!1}},[m]),(0,R.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(lx(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.`,runtime_pairing_required:t?`本机 CLI 运行时与 App 自带运行时不一致。回到 App 启动界面可「更新 App 与运行时」或「回退 CLI」。`:`This host's CLI runtime and the App's bundled runtime differ. On the App boot screen, update both or use the App's runtime.`,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:cx[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,z.jsxs)(`div`,{className:`personal-desktop-update`,children:[(0,z.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,z.jsx)(Tm,{size:16,"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:v}),(0,z.jsx)(vm,{size:14,"aria-hidden":`true`})]}),(0,z.jsxs)(`section`,{ref:i,popover:`auto`,id:`desktop-update-panel`,className:`personal-update-panel`,"aria-label":t?`LoopX 更新`:`LoopX updates`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:t?`LoopX 更新`:`LoopX updates`}),(0,z.jsx)(`button`,{type:`button`,"aria-label":t?`关闭更新面板`:`Close updates`,onClick:()=>i.current?.hidePopover(),children:(0,z.jsx)(gh,{size:16,"aria-hidden":`true`})})]}),(0,z.jsxs)(`small`,{children:[l,` · `,a===`main`?t?`main 预览版`:`main preview`:t?`稳定版`:`Stable`]}),s.details?.version?(0,z.jsxs)(`p`,{children:[t?`目标版本:`:`Target: `,s.details.version]}):null,(0,z.jsxs)(`p`,{role:`status`,"aria-live":`polite`,children:[h?(0,z.jsx)(Qm,{className:`is-spinning`,size:14,"aria-hidden":`true`}):null,_[s.phase]]}),s.phase===`downloading`&&s.details?.total?(0,z.jsx)(`progress`,{"aria-label":t?`下载进度`:`Download progress`,max:s.details.total,value:s.details.received??0}):null,m?(0,z.jsx)(`div`,{className:`personal-update-actions`,children:s.phase===`restart_required`?(0,z.jsx)(`button`,{type:`button`,onClick:()=>void g(`restart`),children:t?`重启完成更新`:`Restart to finish`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void g(`check`),children:t?`检查更新`:`Check for updates`}),s.phase===`available`?(0,z.jsx)(`button`,{type:`button`,onClick:()=>void g(`apply`),children:t?`更新并准备重启`:`Install update`}):null]})}):(0,z.jsx)(`p`,{children:t?`请在 LoopX App 中更新;浏览器自身无需安装包。`:`Update from the LoopX App; the browser needs no installer.`}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t?`高级选项`:`Advanced options`}),(0,z.jsxs)(`label`,{children:[t?`更新通道`:`Update channel`,(0,z.jsxs)(`select`,{disabled:h||s.phase===`restart_required`,value:a,onChange:e=>{o(e.target.value),c({phase:`idle`})},children:[(0,z.jsx)(`option`,{value:`stable`,children:t?`稳定版(推荐)`:`Stable (recommended)`}),(0,z.jsx)(`option`,{value:`main`,children:t?`main 预览版`:`main preview`})]})]}),(0,z.jsx)(`p`,{children:t?`App 与匹配的 CLI 一起更新,服务可能短暂断开。不删除 Goal 数据。`:`Updates the App and matching CLI. Services may briefly disconnect. Goal data is not deleted.`}),m?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{children:t?`启动失败时,可重装当前 App 随附的运行时。`:`If startup fails, reinstall this App's bundled runtime.`}),(0,z.jsx)(`button`,{disabled:h||s.phase===`restart_required`,type:`button`,onClick:()=>void g(`repair`),children:t?`修复当前版本`:`Repair this version`})]}):null,m&&d?(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t?`恢复上个版本`:`Restore previous version`}),(0,z.jsx)(`p`,{children:t?`将恢复已保留的 App 和它的运行时,需要重启。`:`Restore the retained App and its runtime, then restart.`}),(0,z.jsx)(`button`,{disabled:h,type:`button`,onClick:()=>void g(`rollback`),children:t?`确认恢复上版`:`Restore previous version`})]}):null]})]})]})}var dx=e=>`loopx-sidebar-goal-order-v1:${encodeURIComponent(e)}`;function fx(e){try{let t=JSON.parse(e??`null`);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?[...new Set(t)]:[]}catch{return[]}}function px(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 mx(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 hx(e,t){let n=dx(t),[r,i]=(0,R.useState)(()=>{try{return fx(localStorage.getItem(n))}catch{return[]}}),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(null),d=(0,R.useRef)(null),f=(0,R.useRef)(!1),p=px(e,r),m=p.map(e=>e.goalId);function h(t,a,s){let l=mx(r,m,t,a,s);if(l===r)return;i(l);let u=px(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 gx=`/ssh-hosts`,_x=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/;function vx(e){return typeof e==`string`&&_x.test(e.trim())}function yx(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!vx(t)||n.has(t)?[]:(n.add(t),[{alias:t}])}),schemaVersion:`ssh_host_catalog_v0`}}async function bx(e=fetch,t=gx){let n=await e(t,{cache:`no-store`});if(!n.ok)throw Error(`无法读取本机 SSH Host(HTTP ${n.status})。`);return yx(await n.json())}function xx(e,t){let n=e.trim();if(!vx(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 Sx=`/api/ssh-source/ensure`,Cx=`/api/ssh-source/goal-lifecycle`;async function wx(e,t){let n=await fetch(Sx,{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 Tx(e,t,n,r,i=fetch){let a=await i(Cx,{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 Ex({activeSource:e,connectionState:t,errorMessage:n,onAdd:r,onConfiguredHostsLoaded:i,onRemove:a,onSelect:o,sources:s}){let{t:c}=Ji(),[l,u]=(0,R.useState)(!1),[d,f]=(0,R.useState)(null),[p,m]=(0,R.useState)(`configured`),[h,g]=(0,R.useState)([]),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(!1),[C,w]=(0,R.useState)(``),[T,E]=(0,R.useState)(``),[D,O]=(0,R.useState)(`8876`),[k,A]=(0,R.useState)(``),ee=`configured:`,j=[...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:`${ee}${e.alias}`}))],M=(0,R.useMemo)(()=>h.some(e=>e.alias===C)?xx(C,D):{error:c(`source.selectHost`)},[h,C,D,c]);(0,R.useEffect)(()=>{te()},[]);async function te(){b(!0),v(null);try{let e=await bx();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 ne(){u(!0),m(`configured`),f(null),te()}function N(){u(!1),m(`configured`),v(null),S(!1),w(``),f(null),E(``),O(`8876`),A(``)}function P(){let e=r({label:T,statusUrl:k});if(e.error){f(e.error);return}N()}function re(){if(`error`in M){f(M.error??c(`source.invalid`));return}let e=r({ensureTunnel:!0,hostAlias:M.hostAlias,label:M.label,statusUrl:M.statusUrl});if(e.error){f(e.error);return}N()}function ie(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=xx(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 ae(){if(`error`in M){f(M.error??c(`source.invalid`));return}try{await navigator.clipboard.writeText(M.command),S(!0),f(null)}catch{f(c(`source.copyError`))}}return(0,z.jsxs)(`section`,{"aria-label":c(`source.controlPlane`),className:`personal-status-source`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`span`,{children:`Control plane`}),(0,z.jsx)(`button`,{"aria-label":c(`source.addSsh`),onClick:ne,title:c(`source.add`),type:`button`,children:(0,z.jsx)(Xm,{size:14})})]}),(0,z.jsx)(fb,{ariaLabel:c(`source.select`),className:`personal-status-source-select`,icon:(0,z.jsx)(ih,{size:15}),onChange:e=>{if(e.startsWith(ee)){ie(e.slice(11));return}o(e)},options:j,value:e.id}),(0,z.jsxs)(`div`,{className:`personal-status-source-meta`,children:[(0,z.jsxs)(`span`,{className:`is-${t}`,children:[(0,z.jsx)(`i`,{}),c(t===`loading`?`source.connecting`:t===`error`?`source.notAvailable`:`source.connected`)]}),(0,z.jsx)(`small`,{children:e.readOnly?c(`source.readOnly`):c(`source.localInteractive`)}),e.kind===`ssh_tunnel`?(0,z.jsx)(`button`,{"aria-label":c(`source.remove`,{source:e.label}),onClick:()=>a(e.id),title:c(`source.removeCurrent`),type:`button`,children:(0,z.jsx)(fh,{size:12})}):null]}),n?(0,z.jsx)(`p`,{className:`personal-status-source-error`,role:`alert`,children:n}):null,l?(0,z.jsxs)(`div`,{className:`personal-status-source-form`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:c(`source.addSsh`)}),(0,z.jsx)(`button`,{"aria-label":c(`source.closeForm`),onClick:N,type:`button`,children:(0,z.jsx)(gh,{size:13})})]}),(0,z.jsxs)(`div`,{"aria-label":c(`source.addMethod`),className:`personal-status-source-modes`,role:`tablist`,children:[(0,z.jsx)(`button`,{"aria-selected":p===`configured`,onClick:()=>{m(`configured`),f(null)},role:`tab`,type:`button`,children:c(`source.configured`)}),(0,z.jsx)(`button`,{"aria-selected":p===`manual`,onClick:()=>{m(`manual`),f(null)},role:`tab`,type:`button`,children:c(`source.manual`)})]}),p===`configured`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.configuredCount`,{count:h.length})}),(0,z.jsxs)(`span`,{className:`personal-status-source-field-row`,children:[(0,z.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,z.jsx)(`datalist`,{id:`loopx-configured-ssh-hosts`,children:h.map(e=>(0,z.jsx)(`option`,{value:e.alias},e.alias))}),(0,z.jsx)(`button`,{"aria-label":c(`source.refreshHosts`),disabled:y,onClick:()=>void te(),title:c(`source.refreshHosts`),type:`button`,children:(0,z.jsx)(eh,{size:13})})]})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.localPort`)}),(0,z.jsx)(`input`,{"aria-label":c(`source.localPort`),inputMode:`numeric`,onChange:e=>{O(e.target.value),S(!1)},value:D})]}),(0,z.jsxs)(`div`,{className:`personal-status-source-command`,children:[(0,z.jsx)(`code`,{children:`error`in M?c(`source.tunnelCommandPending`):M.command}),(0,z.jsxs)(`button`,{"aria-label":c(`source.copyCommand`),disabled:`error`in M,onClick:()=>void ae(),type:`button`,children:[(0,z.jsx)(Cm,{size:12}),c(x?`source.copied`:`source.copy`)]})]}),_?(0,z.jsx)(`p`,{className:`is-error`,children:_}):null,(0,z.jsx)(`p`,{children:c(`source.description`)}),(0,z.jsx)(`button`,{className:`personal-status-source-add`,disabled:`error`in M,onClick:re,type:`button`,children:c(`source.addConfigured`)})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.name`)}),(0,z.jsx)(`input`,{autoFocus:!0,maxLength:48,onChange:e=>E(e.target.value),placeholder:c(`source.namePlaceholder`),value:T})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.statusUrl`)}),(0,z.jsx)(`input`,{onChange:e=>A(e.target.value),placeholder:`http://127.0.0.1:8876/status.json`,value:k})]}),(0,z.jsx)(`p`,{children:(0,z.jsx)(`code`,{children:`ssh -N -L 8876:127.0.0.1:8766 `})}),(0,z.jsx)(`p`,{children:c(`source.manualDescription`)}),(0,z.jsx)(`button`,{className:`personal-status-source-add`,onClick:P,type:`button`,children:c(`source.addConfigured`)})]}),d?(0,z.jsx)(`p`,{className:`is-error`,role:`alert`,children:d}):null]}):null]})}var Dx={需修复:`is-danger`,等你:`is-warning`,等待条件:`is-info`,推进中:`is-success`,安静运行:`is-quiet`,已完成:`is-quiet`,已停止:`is-stopped`};function Ox({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}=Ji(),[m,h]=(0,R.useState)(!1),g=hx(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,z.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,z.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,z.jsx)(`span`,{className:`personal-goal-state-dot ${e.loadState?``:Dx[e.state]}`}),(0,z.jsxs)(`span`,{className:`personal-goal-link-copy`,children:[(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsxs)(`small`,{children:[e.loadState&&(!t||u===e.goalId)?p(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Yi(e.state,f),e.needsYou&&!t?` · ${p(`home.lane.needsYou`)}`:``]})]}),(0,z.jsx)(_m,{size:15})]}),!t&&m?(0,z.jsxs)(`div`,{className:`personal-goal-move-actions`,children:[(0,z.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,z.jsx)(lm,{"aria-hidden":`true`,size:13})}),(0,z.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,z.jsx)(am,{"aria-hidden":`true`,size:13})})]}):null,c&&y(t?`resume`:`stop`)?(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.jsx)(zm,{size:13}):t?(0,z.jsx)($m,{size:13}):(0,z.jsx)(Jm,{size:13})}),t&&y(`delete`)?(0,z.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,z.jsx)(fh,{size:13})}):null]}):null]},e.goalId);return(0,z.jsxs)(`div`,{className:`personal-goal-directory`,children:[(0,z.jsxs)(`div`,{className:`personal-sidebar-brand`,children:[(0,z.jsx)(`span`,{className:`personal-brand-mark`,children:(0,z.jsx)(fm,{size:18})}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:`LoopX`})})]}),d?(0,z.jsx)(Ex,{...d}):null,(0,z.jsxs)(`nav`,{"aria-label":p(`home.workspace`),className:`personal-sidebar-nav`,children:[(0,z.jsxs)(`button`,{"aria-current":u===null?`page`:void 0,className:`personal-manager-link`,onClick:()=>l(null),type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-manager-icon`,children:(0,z.jsx)(fm,{size:17})}),(0,z.jsx)(`span`,{children:p(`sidebar.manager`)}),e>0?(0,z.jsx)(`span`,{className:`personal-sidebar-count`,children:e}):null,(0,z.jsx)(_m,{size:15})]}),(0,z.jsxs)(`div`,{className:`personal-sidebar-section-title`,children:[(0,z.jsx)(`span`,{children:`Goals`}),(0,z.jsxs)(`span`,{className:`personal-sidebar-title-actions`,children:[(0,z.jsx)(`small`,{children:_.length}),(0,z.jsx)(`button`,{"aria-label":p(`sidebar.sortGoals`),title:p(`sidebar.sortGoals`),"aria-pressed":m,onClick:()=>h(!m),type:`button`,children:(0,z.jsx)(cm,{"aria-hidden":`true`,size:15})}),a?(0,z.jsx)(`button`,{"aria-label":p(`sidebar.createGoal`),onClick:a,type:`button`,children:(0,z.jsx)(Xm,{size:15})}):null]})]}),g.saveFailed?(0,z.jsx)(`p`,{role:`status`,children:p(`sidebar.orderNotSaved`)}):null,(0,z.jsx)(`span`,{className:`personal-sr-only`,role:`status`,children:g.lastMoved?p(`sidebar.goalMoved`,{goal:g.lastMoved.title,position:g.lastMoved.position}):``}),(0,z.jsx)(`div`,{className:`personal-goal-list`,children:_.map(e=>b(e,!1))}),v.length||n.phase===`loading`||n.phase===`error`?(0,z.jsxs)(`details`,{className:`personal-stopped-goals`,open:n.phase===`error`||void 0,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(gm,{size:13}),(0,z.jsx)(`span`,{children:p(`sidebar.stopped`)}),n.phase===`loading`?(0,z.jsx)(zm,{"aria-label":p(`sidebar.stoppedLoading`),className:`is-spinning`,size:13}):(0,z.jsx)(`small`,{children:v.length})]}),(0,z.jsxs)(`div`,{className:`personal-goal-list is-stopped`,children:[n.phase===`error`?(0,z.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`alert`,children:[(0,z.jsx)(`span`,{children:p(`sidebar.stoppedLoadFailed`)}),s?(0,z.jsx)(`button`,{onClick:s,type:`button`,children:p(`sidebar.retryStopped`)}):null]}):null,v.map(e=>b(e,!0))]})]}):null]}),(0,z.jsxs)(`div`,{className:`personal-sidebar-footer`,children:[(0,z.jsx)(ux,{}),o?(0,z.jsxs)(`button`,{"aria-label":p(`settings.open`),className:`personal-sidebar-utility`,onClick:o,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-sidebar-utility-icon`,children:(0,z.jsx)(ah,{size:17})}),(0,z.jsx)(`span`,{className:`personal-sidebar-utility-copy`,children:(0,z.jsx)(`strong`,{children:p(`settings.open`)})}),(0,z.jsx)(_m,{"aria-hidden":`true`,size:15})]}):null]})]})}var kx=J({ok:X(!0),total:G().int().nonnegative(),next_cursor:W().nullable(),items:q(J({todo_id:W(),text:W(),claimed_by:W().nullable(),evidence:W().nullable(),priority:W().nullable(),task_class:W().nullable()})).max(40)});function Ax({goal:e,agentId:t,seed:n,enabled:r,listView:i=!1,onSelect:a}){let{t:o}=Ji(),s=(0,R.useId)(),[c,l]=(0,R.useState)(!1),u=!i||c,d=i?96:148,[f,p]=(0,R.useState)(n),[m,h]=(0,R.useState)(t===`all`?e.doneTodoCount??n.length:n.length),[g,_]=(0,R.useState)(void 0),[v,y]=(0,R.useState)(!1),[b,x]=(0,R.useState)(!1),[S,C]=(0,R.useState)(!1),[w,T]=(0,R.useState)({top:0,height:600}),[E,D]=(0,R.useState)(null),O=(0,R.useRef)(null),k=(0,R.useRef)(null),[A,ee]=(0,R.useState)(0);(0,R.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 j=g===void 0||w.top+w.height>=f.length*d-d*2;(0,R.useEffect)(()=>{if(!r||!u||!j||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=kx.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,j,g,b,A,e.goalId,t,v]),(0,R.useEffect)(()=>{O.current&&(O.current.scrollTop=0),T({top:0,height:O.current?.clientHeight??600}),D(null)},[i]);let M=Math.max(0,Math.floor(w.top/d)-3),te=Math.min(f.length,Math.ceil((w.top+w.height)/d)+3),ne=Array.from({length:Math.max(0,te-M)},(e,t)=>M+t);return E!==null&&El(e=>!e),children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,children:c?`▾`:`▸`}),` `,o(`tasks.completed`)]}):(0,z.jsxs)(`strong`,{children:[(0,z.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-done`}),o(`tasks.completed`)]}),(0,z.jsx)(`span`,{children:m})]}),(0,z.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,z.jsx)(`div`,{className:`personal-completed-window`,style:{height:f.length*d},children:ne.map(t=>{let n=f[t];return(0,z.jsx)(`div`,{className:`personal-task-card personal-completed-row`,style:{top:t*d,height:d},children:(0,z.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,z.jsx)(`span`,{className:`is-done`,children:`✓`}),(0,z.jsx)(`strong`,{children:$d(n.text,112)}),(0,z.jsx)(`small`,{children:n.claimedBy??e.agentLabel??e.agentId})]})},n.todoId)})}),(0,z.jsx)(`div`,{className:`personal-completed-footer`,role:`status`,children:v?o(`tasks.historyLoading`):b?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{children:o(S?`tasks.historyExpired`:`tasks.historyError`)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>{S&&(_(void 0),O.current&&(O.current.scrollTop=0)),C(!1),x(!1),ee(e=>e+1)},children:o(`tasks.historyRetry`)})]}):r?g===null?o(`tasks.historyEnd`):(0,z.jsx)(`button`,{type:`button`,onClick:()=>{O.current&&(O.current.scrollTop=f.length*d)},children:o(`tasks.historyMore`)}):o(`tasks.historyLocalOnly`)})]})]})}function jx({children:e,count:t,label:n,tone:r,listView:i=!1}){let a=(0,R.useId)(),o=(0,R.useRef)(null),s=(0,R.useRef)([]),c=(0,R.useRef)(null),[l,u]=(0,R.useState)({after:!1,before:!1}),d=(0,R.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,R.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,R.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,z.jsxs)(`details`,{className:`personal-task-group tone-${r}`,open:!0,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(gm,{size:16}),(0,z.jsx)(`strong`,{children:n}),(0,z.jsx)(`span`,{children:t})]}),(0,z.jsx)(`div`,{className:`personal-task-list-rows`,children:e})]}):(0,z.jsxs)(`section`,{className:`personal-object-list personal-task-lane`,children:[(0,z.jsxs)(`header`,{id:a,children:[(0,z.jsxs)(`strong`,{children:[(0,z.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-${r}`}),n]}),(0,z.jsx)(`span`,{children:t})]}),(0,z.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 Mx({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}=Ji(),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)({goalId:``,laneId:`all`}),h=(0,R.useRef)(null);(0,R.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:e.priority===`P3`?3:e.priority===`P4`?4:50,v=(0,R.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,A=D>=0&&E.slice(D+1).some(e=>e.message.role===`assistant`&&e.message.pending);return(0,z.jsxs)(`section`,{"aria-label":u(`header.tasks`),className:`personal-task-board${d?` is-list-view`:``}`,children:[(0,z.jsxs)(`header`,{className:`personal-task-view-toolbar`,children:[(0,z.jsx)(`div`,{children:(0,z.jsx)(`strong`,{children:u(`header.tasks`)})}),(0,z.jsxs)(`div`,{className:`personal-task-view-switch`,role:`group`,"aria-label":u(`tasks.viewLabel`),children:[(0,z.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(!0),children:u(`tasks.listView`)}),(0,z.jsx)(`button`,{type:`button`,"aria-pressed":!d,onClick:()=>f(!1),children:u(`tasks.boardView`)})]})]}),v.length>1?(0,z.jsxs)(`section`,{"aria-label":u(`tasks.agentLaneFilter`),className:`personal-task-lane-filter`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(fm,{size:15}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:u(`tasks.agentLane`)})})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{className:`sr-only`,children:u(`tasks.agentLaneFilter`)}),(0,z.jsxs)(`select`,{"aria-label":u(`tasks.agentLaneFilter`),onChange:e=>m({goalId:t.goalId,laneId:e.target.value}),value:y,children:[(0,z.jsx)(`option`,{value:`all`,children:u(`tasks.allAgentLanes`,{count:v.length})}),v.map(e=>(0,z.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))]}),(0,z.jsx)(gm,{"aria-hidden":!0,size:14})]})]}):null,O?(0,z.jsxs)(`section`,{"aria-label":u(`tasks.chatRecent`),className:`personal-task-chat-receipt`,children:[(0,z.jsx)(`span`,{className:`personal-task-chat-icon`,children:(0,z.jsx)(Um,{size:18})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:u(A?`tasks.chatPending`:k?`tasks.chatAgentReplied`:`tasks.chatRecent`)}),(0,z.jsx)(`small`,{children:k?.returnDelivery?u(`tasks.chatReturn`):k?.agentLabel})]}),(0,z.jsx)(`div`,{className:`personal-task-reply-preview`,children:(0,z.jsx)(wb,{text:A?u(`tasks.chatPendingDescription`):(k?.text??O.text).trim().split(/\r?\n/,1)[0]})})]}),(0,z.jsxs)(`footer`,{children:[(0,z.jsxs)(`button`,{onClick:i,type:`button`,children:[(0,z.jsx)(Um,{size:14}),u(`tasks.chatViewReply`)]}),k&&!A&&r?(0,z.jsxs)(`button`,{onClick:()=>r(k.text),type:`button`,children:[(0,z.jsx)(Rm,{size:14}),u(`tasks.convertToTask`)]}):null]})]}):null,(0,z.jsxs)(`div`,{className:d?`personal-task-grouped-list`:`personal-task-kanban`,children:[(0,z.jsxs)(jx,{listView:d,count:g.length,label:u(`timeline.waitingConfirmation`),tone:`attention`,children:[g.map(e=>{let t=Zi(e.updatedAt,u);return(0,z.jsxs)(`button`,{onClick:()=>s({item:e,kind:`attention`}),type:`button`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`is-attention`,children:`!`}),(0,z.jsx)(`strong`,{children:e.text}),(0,z.jsxs)(`small`,{children:[(0,z.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?u(`tasks.blocked`):u(`tasks.pending`)}),t?(0,z.jsx)(`span`,{className:`personal-task-age`,children:u(`tasks.waitingAge`,{age:t})}):null]})]},e.todoId)}),g.length?null:(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyConfirm`)})]}),(0,z.jsxs)(jx,{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,z.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,z.jsxs)(`button`,{"aria-pressed":c===e.todoId,onClick:()=>s({item:n,kind:`todo`}),type:`button`,children:[(0,z.jsx)(`span`,{children:`○`}),(0,z.jsx)(`strong`,{children:e.text}),(0,z.jsxs)(`small`,{children:[e.priority?(0,z.jsx)(`span`,{className:`personal-priority-badge is-${e.priority.toLowerCase()}`,children:e.priority}):null,e.status===`blocked`?(0,z.jsx)(`span`,{className:`personal-priority-badge is-blocked`,children:u(`tasks.blocked`)}):null,r?(0,z.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,z.jsx)(`span`,{className:`personal-task-session-status`,children:u(`drawer.taskStatusDeferred`)}):r?null:(0,z.jsx)(`span`,{className:`personal-task-session-status`,children:u(`tasks.waiting`)}),e.claimedBy??t.agentLabel??t.agentId]})]}),(0,z.jsxs)(`div`,{className:`personal-task-card-actions`,children:[r?(0,z.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,z.jsx)(Dm,{size:14}),(0,z.jsx)(`span`,{children:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`)})]}):null,a?(0,z.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,z.jsx)(zm,{className:`personal-spin`,size:14}):(0,z.jsx)(hm,{size:14})}):null,(0,z.jsx)(`button`,{"aria-label":u(`tasks.moreActions`,{name:e.text}),onClick:()=>s({item:n,kind:`todo`}),title:u(`common.actions`),type:`button`,children:(0,z.jsx)(Em,{size:14})})]})]},e.todoId)}),x.length?null:(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyRunning`)})]}),(0,z.jsxs)(jx,{listView:d,count:C.length,label:u(`tasks.scheduled`),tone:`schedule`,children:[C.map(e=>(0,z.jsxs)(`button`,{onClick:()=>s({item:e.schedule,kind:`schedule`}),type:`button`,children:[(0,z.jsx)(`span`,{children:`◷`}),(0,z.jsx)(`strong`,{children:e.schedule.label}),(0,z.jsx)(`small`,{children:e.schedule.status===`paused`?u(`schedule.paused`):u(`schedule.active`)})]},e.id)),C.length?null:(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptySchedules`)})]}),(0,z.jsx)(Ax,{goal:t,agentId:y,seed:S,enabled:e,listView:d,onSelect:s},`${t.goalId}:${y}:${e}`)]}),T?(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyGoal`)}):null]})}var Nx=yd(W(),q(W())),Px=J({node_id:W().min(1),kind:Y([`deliverable`,`gate`,`gate_summary`,`lease`,`validation`,`repair`,`handoff`,`evidence`]),title:W(),state:Y([`open`,`ready`,`blocked`,`done`,`waiting`,`unknown`]),refs:Nx,owner_agent:W().optional(),actor_agent:W().optional(),from_agent:W().optional(),to_agent:W().optional()}),Fx=J({edge_id:W().min(1),from_node_id:W(),to_node_id:W(),relation:Y([`depends_on`,`blocks`,`validates`,`repairs`,`audits`,`continues`,`hands_off_to`,`supersedes`]),reason:W(),refs:Nx.optional()}),Ix=J({schema_version:X(`task_graph_projection_v0`),mode:X(`read_only`),goal_id:W(),generated_at:W().nullable(),truth_contract:J({projection_is_writable:X(!1),write_api:X(!1)}),limits:J({user_gate_node_limit:G().int().nonnegative(),user_gate_open_count:G().int().nonnegative(),user_gate_truncated_count:G().int().nonnegative(),source_truncated:K().optional(),predecessor_truncated:K().optional(),missing_predecessor_count:G().int().nonnegative().optional(),topology_complete:K().optional()}),nodes:q(Px),edges:q(Fx)}).superRefine((e,t)=>{let n=new Set(e.nodes.map(e=>e.node_id)),r=new Set(e.edges.map(e=>e.edge_id));(n.size!==e.nodes.length||r.size!==e.edges.length||e.edges.some(e=>!n.has(e.from_node_id)||!n.has(e.to_node_id)))&&t.addIssue({code:`custom`,message:`Graph identities or endpoints are invalid`})}),Lx=J({ok:X(!0),goal_id:W(),observed_at:W().datetime({offset:!0}),graph:Ix.nullable(),acceptance:uf.nullable()});function Rx(e,t){let n=Lx.parse(e);if(n.goal_id!==t||n.graph&&n.graph.goal_id!==t||n.acceptance&&n.acceptance.goal_id!==t)throw Error(`Review source does not match the selected Goal`);return n}async function zx(e,t){let n=new URLSearchParams({goal_id:e}),r=await fetch(`/api/chat/delivery-review?${n}`,{signal:t,cache:`no-store`});if(!r.ok)throw Error(`Review unavailable (${r.status})`);return Rx(await r.json(),e)}function Bx(e,t,n,r){let i=new Set([r]);for(let t of e.edges)t.from_node_id===r&&i.add(t.to_node_id),t.to_node_id===r&&i.add(t.from_node_id);let a=t.trim().toLocaleLowerCase();return e.nodes.filter(e=>{let t=[e.title,e.owner_agent,e.actor_agent,e.from_agent,e.to_agent,...Object.values(e.refs).flat()].some(e=>e?.toLocaleLowerCase().includes(a)),r=n===`all`||n===`related`&&i.has(e.node_id)||n===`conditions`&&[`gate`,`gate_summary`,`lease`].includes(e.kind)||n===`evidence`&&[`evidence`,`validation`,`repair`,`handoff`].includes(e.kind);return t&&r})}function Vx(e){let t=e.limits;return t.topology_complete!==!0||t.source_truncated===!0||t.predecessor_truncated===!0||(t.missing_predecessor_count??0)>0||t.user_gate_truncated_count>0}function Hx(e){return[`gate`,`gate_summary`,`lease`].includes(e.kind)?0:e.kind===`deliverable`?1:2}function Ux(e,t){let n=e=>String(e??t.unavailable).replace(/[\\`*_{}[\]<>|#]/g,`\\$&`).replace(/[\r\n]+/g,` `),r=[`# ${t.title}`,``,`Goal: ${n(e.goal_id)}`,`${t.observed}: ${n(e.observed_at)}`,``,t.scope,``,t.acceptanceBoundary,``,`## ${t.chain}`,``],i=e.graph;if(!i)r.push(t.noGraph);else{Vx(i)&&r.push(t.incomplete,``),r.push("```json",JSON.stringify(i.limits,null,2),"```",``);for(let e of i.nodes)r.push(`- ${n(e.title)} · ${t.kind[e.kind]} · ${t.state[e.state]}${e.owner_agent?` · ${n(e.owner_agent)}`:``}`,` ${t.refs}: ${n(e.node_id)}; ${n(JSON.stringify(e.refs))}`),(e.from_agent||e.to_agent)&&r.push(` ${n(e.from_agent)} → ${n(e.to_agent)}`),e.actor_agent&&r.push(` actor: ${n(e.actor_agent)}`);let e=new Map(i.nodes.map(e=>[e.node_id,e.title]));r.push(``,`## ${t.relations}`,``);for(let a of i.edges)r.push(`- ${n(e.get(a.from_node_id))} → ${t.relation[a.relation]} → ${n(e.get(a.to_node_id))}: ${n(a.reason)} (${n(a.edge_id)})`,` ${t.refs}: ${n(JSON.stringify(a.refs??{}))}`)}r.push(``,`## ${t.acceptance}`,``);let a=e.acceptance;if(!a)r.push(t.unavailable);else{let e=a.coverage===`partial`;r.push(`${t.required}: ${e?a.acceptance_gaps.length:t.unavailable}`,`${t.guards}: ${e?a.guards.length:t.unavailable}`,``);for(let e of a.acceptance_gaps)r.push(`### ${n(e.evidence_required)}`,``,`${t.owner}: ${n(e.owner)}`,`${t.reason}: ${n(e.reason)}`,`${t.observed}: ${n(e.observed_at)}`,`${t.refs}: ${n(e.source)}`),e.resolution_hint&&r.push(n(e.resolution_hint)),e.component_checks&&r.push(`${t.checks}:`,"```json",JSON.stringify(e.component_checks,null,2),"```"),r.push(``);r.push(`### ${t.guards}`,``);for(let e of a.guards)r.push(`- ${n(e.reason)}`,` ${t.owner}: ${n(e.owner)}; ${t.required}: ${n(e.evidence_required)}`,` ${t.refs}: ${n(e.todo_id)}; ${n(e.blocks_agent)}; ${n(e.decision_scope)}`);r.push(``,`### ${t.historical}`,``);for(let e of a.historical_progress)r.push(`- ${n(e.kind)} · ${n(e.observed_at)} · ${n(e.source)} · ${n(e.evidence_refs.join(`, `))}`);r.push(``,`${t.observedScope}: ${n(a.coverage)}; truncated=${a.truncated}`,`${t.missingSources}: ${n(a.missing_sources.join(`, `))}`,`${t.next}: ${n(a.next_action)} (${n(a.next_action_source)})`)}let o=a?.goal_acceptance_contract;if(o?.enabled===!0){let i=t.contract;r.push(``,`## ${i.title}`,``,i.boundary,`${i.source}: ${n(e.goal_id)}`,`${i.revision}: ${o.revision}`,`${i.digest}: ${n(o.digest)}`,``,`### ${i.objective}`,n(o.objective||i.unknown),``,`### ${i.criteria}`),o.non_goals.length&&r.push(`${i.nonGoals}: ${n(o.non_goals.join(`; `))}`),o.criteria.length||r.push(i.noCriteria);for(let e of o.criteria)r.push(`- ${n(e.id)}: ${n(e.description)}`);r.push(``,`### ${i.tasks}`),o.tasks.length||r.push(i.noTasks);for(let e of o.tasks)r.push(`- ${n(e.todo_id)}: ${i.taskState[e.state]}`,` ${i.criteria}: ${n(e.criterion_ids.join(`, `)||i.unknown)}`),e.reason&&r.push(` ${n(e.reason)}`),e.applicable===!1&&r.push(` ${i.notApplicable}`);r.push(``,`### ${i.verification}`,i.verificationState[o.status]),o.held_todo_ids.length&&r.push(`${i.heldTasks}: ${n(o.held_todo_ids.join(`, `))}`),r.push(``,`### ${i.receipt}`);let a=o.verification;if(!a)r.push(i.unknown);else{r.push(i.receiptNote,`${i.operation}: ${n(a.operation_id)}`,`${i.revision}: ${a.contract_revision}`,`${i.digest}: ${n(a.contract_digest)}`,`${i.verificationScope}: ${n(a.todo_id??i.allCriteria)}`);for(let e of a.results)r.push(`- ${n(e.criterion_id)}: ${e.passed?i.passed:i.failed}; ${i.exitCode}: ${e.exit_code??i.unknown}`)}}return r.join(` `)+` `}function Wx({goalId:e,contract:t,copy:n,current:r}){if(t?.enabled!==!0)return null;let i=`loopx --format json goal-acceptance inspect --goal-id '${e.replace(/'/g,`'\\''`)}'`;return(0,z.jsxs)(`details`,{className:`delivery-acceptance-contract`,children:[(0,z.jsx)(`summary`,{children:n.title}),(0,z.jsxs)(`div`,{className:`delivery-acceptance-content`,children:[(0,z.jsx)(`p`,{children:n.boundary}),r?null:(0,z.jsx)(`p`,{role:`status`,className:`delivery-notice`,children:n.retained}),(0,z.jsxs)(`dl`,{className:`delivery-acceptance-source`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.source}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:e})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.revision}),(0,z.jsx)(`dd`,{children:t.revision})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.digest}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.digest})})]})]}),(0,z.jsx)(`h3`,{children:n.objective}),(0,z.jsx)(`p`,{children:t.objective||n.unknown}),t.non_goals.length?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:n.nonGoals}),(0,z.jsx)(`ul`,{children:t.non_goals.map((e,t)=>(0,z.jsx)(`li`,{children:e},t))})]}):null,(0,z.jsx)(`h3`,{children:n.criteria}),t.criteria.length?(0,z.jsx)(`ul`,{children:t.criteria.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(`code`,{children:e.id}),` · `,e.description]},e.id))}):(0,z.jsx)(`p`,{children:n.noCriteria}),(0,z.jsx)(`h3`,{children:n.tasks}),t.tasks.length?(0,z.jsx)(`ul`,{className:`delivery-acceptance-tasks`,children:t.tasks.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`code`,{children:e.todo_id}),` · `,(0,z.jsx)(`strong`,{children:n.taskState[e.state]})]}),(0,z.jsxs)(`p`,{children:[n.criteria,`: `,e.criterion_ids.length?e.criterion_ids.join(`, `):n.unknown]}),e.applicable===!1?(0,z.jsx)(`p`,{children:n.notApplicable}):null,e.reason?(0,z.jsx)(`p`,{children:e.reason}):null]},e.todo_id))}):(0,z.jsx)(`p`,{children:n.noTasks}),(0,z.jsx)(`h3`,{children:n.verification}),(0,z.jsx)(`p`,{children:n.verificationState[t.status]}),t.held_todo_ids.length?(0,z.jsxs)(`p`,{children:[n.heldTasks,`: `,t.held_todo_ids.join(`, `)]}):null,(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n.receipt}),t.verification?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{children:n.receiptNote}),(0,z.jsxs)(`dl`,{className:`delivery-acceptance-source`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.operation}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.verification.operation_id})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.revision}),(0,z.jsx)(`dd`,{children:t.verification.contract_revision})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.digest}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.verification.contract_digest})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.verificationScope}),(0,z.jsx)(`dd`,{children:t.verification.todo_id??n.allCriteria})]})]}),(0,z.jsx)(`ul`,{children:t.verification.results.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(`code`,{children:e.criterion_id}),` · `,e.passed?n.passed:n.failed,` · `,n.exitCode,`: `,e.exit_code??n.unknown]},e.criterion_id))})]}):(0,z.jsx)(`p`,{children:n.unknown})]}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n.help}),(0,z.jsx)(`p`,{children:n.guidance}),(0,z.jsx)(`p`,{children:(0,z.jsx)(`code`,{children:i})}),(0,z.jsx)(`p`,{children:(0,z.jsx)(`code`,{children:`loopx goal-acceptance --help`})}),(0,z.jsx)(`a`,{href:`https://github.com/huangruiteng/loopx/blob/main/docs/reference/goal-acceptance-observations.md#owner-authorized-contract-v0`,target:`_blank`,rel:`noreferrer`,children:n.guide})]})]})]})}var Gx={en:{title:`Goal acceptance contract`,boundary:`Read-only owner contract. Task association and artifact checks are separate; neither automatically approves or completes the Goal.`,source:`Goal source`,revision:`Contract revision`,digest:`Contract digest`,objective:`Objective`,criteria:`Acceptance criteria`,nonGoals:`Outside scope`,tasks:`Task associations`,verification:`Artifact verification`,unknown:`Unknown`,noTasks:`No task associations reported. Coverage is unknown.`,noCriteria:`No acceptance criteria reported.`,retained:`Retained snapshot; refresh to read current acceptance facts.`,taskState:{ready:`Task association confirmed`,unbound:`Task association missing`,stale:`Task association stale`},verificationState:{unverified:`Artifact checks not verified`,accepted:`Artifact checks passed`,failed:`Artifact checks failed`,stale:`Artifact checks stale`,partial:`Task checks passed; Goal-wide verification unknown`,held:`Task associations require confirmation`},notApplicable:`Outside the current task gate`,heldTasks:`Tasks held`,receipt:`Recorded artifact checks`,receiptNote:`Recorded results use the revision below. The current contract status above accounts for stale checks and task holds.`,operation:`Verification reference`,verificationScope:`Verification scope`,allCriteria:`All contract criteria`,passed:`Passed`,failed:`Failed`,exitCode:`Exit code`,help:`Setup and readback`,guide:`Owner setup guide (v0)`,guidance:`The local Goal owner configures this contract through the CLI using configure --document and the inspected --expected-provider-revision. Changes and verification require --execute. Inspect before changing the contract; refresh this snapshot afterward. Disable with the current provider revision to hide this section.`},"zh-CN":{title:`Goal 验收合同`,boundary:`只读的所有者合同。任务关联与产物检查是独立事实,均不会自动批准或完成 Goal。`,source:`Goal 来源`,revision:`合同版本`,digest:`合同摘要`,objective:`目标`,criteria:`验收条件`,nonGoals:`范围之外`,tasks:`任务关联`,verification:`产物验证`,unknown:`未知`,noTasks:`未提供任务关联,覆盖范围未知。`,noCriteria:`未提供验收条件。`,retained:`当前保留旧快照,请刷新读取最新验收事实。`,taskState:{ready:`任务关联已确认`,unbound:`任务关联缺失`,stale:`任务关联已过期`},verificationState:{unverified:`产物检查未验证`,accepted:`产物检查通过`,failed:`产物检查失败`,stale:`产物检查已过期`,partial:`任务检查通过;Goal 整体验证未知`,held:`任务关联需要确认`},notApplicable:`不属于当前任务门禁范围`,heldTasks:`受阻任务`,receipt:`已记录的产物检查`,receiptNote:`记录对应下方版本。上方当前合同状态已考虑检查过期和任务阻塞。`,operation:`验证引用`,verificationScope:`验证范围`,allCriteria:`全部合同条件`,passed:`通过`,failed:`失败`,exitCode:`退出码`,help:`配置与读回`,guide:`所有者配置指南(v0)`,guidance:`本地 Goal 所有者通过 CLI 的 configure --document 配置合同,并提供 inspect 读到的 --expected-provider-revision。变更和验证都需要 --execute。变更前先检查合同,操作后刷新此快照;使用当前 provider revision 执行 disable 可隐藏本区块。`}},Kx={en:{contract:Gx.en,title:`Delivery & evidence`,scope:`Current work and a limited set of predecessors. Use Tasks for the full task inventory.`,observed:`Snapshot read`,chain:`Delivery chain`,relations:`Relationships`,acceptance:`Acceptance observations`,acceptanceBoundary:`Completed tasks and recorded evidence do not certify Goal acceptance.`,noGraph:`No delivery chain is available in this snapshot. This does not mean all work is complete.`,incomplete:`Some related information is missing or not expanded.`,unavailable:`Unknown`,refs:`Source references`,required:`Evidence still required`,guards:`Pending decisions`,next:`Next action`,owner:`Owner`,reason:`Reason`,historical:`Historical observations`,checks:`Component checks`,missingSources:`Missing sources`,observedScope:`Observation coverage`,kind:{deliverable:`Work`,gate:`Decision`,gate_summary:`Other decisions`,lease:`Ownership`,validation:`Validation`,repair:`Recovery`,handoff:`Handoff`,evidence:`Evidence`},state:{open:`Open`,ready:`Ready`,blocked:`Blocked`,done:`Done`,waiting:`Waiting`,unknown:`Unknown`},relation:{depends_on:`depends on`,blocks:`blocks`,validates:`validates / contextualizes`,repairs:`repairs`,audits:`audits`,continues:`continues`,hands_off_to:`hands off to`,supersedes:`supersedes`},refresh:`Refresh snapshot`,export:`Export delivery snapshot`,exported:`Snapshot downloaded`,loading:`Reading the current delivery chain…`,error:`The delivery snapshot could not be read. Refresh to retry.`,refreshError:`Refresh failed. The previous snapshot remains visible; refresh before opening linked work or exporting.`,changed:`Workspace facts changed after this snapshot. Refresh before opening linked work or exporting.`,search:`Search title, owner or reference`,all:`All nodes`,conditions:`Conditions & owners`,evidence:`Evidence & handoffs`,related:`Directly related`,map:`Map`,list:`List`,view:`Delivery chain layout`,filter:`Delivery chain focus`,visible:`Visible`,empty:`No nodes match these filters.`,reset:`Reset filters`,select:`Select a node to trace its relationships and open its source.`,work:`Work`,context:`Evidence & recovery`,details:`Selected item`,noRelations:`No relationships are recorded for this item.`,openTask:`Open task`,openGate:`Review decision`,openRun:`Open execution`,sourceUnavailable:`The linked item is not in the current workspace. Use its reference in the task board or CLI.`,omittedGates:`Decisions not expanded`,missing:`Missing predecessors`,clipped:`Expansion limited`,sourceClipped:`Source truncated`,yes:`Yes`,no:`No`,chainOnly:`Bounded chain`,exportFailed:`Download failed. Please retry.`},"zh-CN":{contract:Gx[`zh-CN`],title:`交付与依据`,scope:`仅含当前工作及有限前序,完整任务清单见任务页。`,observed:`快照读取时间`,chain:`交付链`,relations:`关联关系`,acceptance:`验收观察`,acceptanceBoundary:`任务完成、已有证据均不等于 Goal 已通过验收。`,noGraph:`当前快照没有可展示的交付链,这不代表工作已经全部完成。`,incomplete:`部分关联信息缺失或未展开。`,unavailable:`未知`,refs:`来源引用`,required:`仍需补齐的证据`,guards:`待你处理`,next:`下一步`,owner:`负责人`,reason:`原因`,historical:`历史观察`,checks:`组成检查`,missingSources:`缺失来源`,observedScope:`观察范围`,kind:{deliverable:`工作`,gate:`决策`,gate_summary:`其他决策`,lease:`责任归属`,validation:`验证`,repair:`恢复`,handoff:`交接`,evidence:`证据`},state:{open:`待处理`,ready:`就绪`,blocked:`受阻`,done:`已完成`,waiting:`等待`,unknown:`未知`},relation:{depends_on:`依赖`,blocks:`阻塞`,validates:`验证 / 提供背景`,repairs:`修复`,audits:`复核`,continues:`延续`,hands_off_to:`交接给`,supersedes:`替代`},refresh:`刷新快照`,export:`导出交付快照`,exported:`快照已下载`,loading:`正在读取当前交付链…`,error:`交付快照读取失败,请刷新重试。`,refreshError:`刷新失败,当前保留上次快照;请刷新后再打开关联工作或导出。`,changed:`工作区状态已在此快照之后变化,请刷新后再打开关联工作或导出。`,search:`搜索标题、负责人或引用`,all:`全部节点`,conditions:`条件与责任`,evidence:`证据与交接`,related:`直接关联`,map:`关系图`,list:`列表`,view:`交付链布局`,filter:`交付链范围`,visible:`当前显示`,empty:`没有匹配当前筛选的节点。`,reset:`重置筛选`,select:`选择一个节点,追溯关联关系并打开来源。`,work:`工作`,context:`证据与恢复`,details:`选中事项`,noRelations:`当前快照未记录此事项的关联关系。`,openTask:`打开任务`,openGate:`查看决策`,openRun:`打开执行`,sourceUnavailable:`关联事项未出现在当前工作区,可使用其引用到任务看板或 CLI 查找。`,omittedGates:`未展开决策`,missing:`缺失前序`,clipped:`展开受限`,sourceClipped:`来源被裁剪`,yes:`是`,no:`否`,chainOnly:`当前局部链`,exportFailed:`下载失败,请重试。`}};function qx({graph:e,nodes:t,selected:n,onSelect:r,copy:i}){let a=(0,R.useId)().replace(/:/g,``),o=[0,1,2].map(e=>t.filter(t=>Hx(t)===e)),s=new Map(o.flatMap((e,t)=>e.map((e,n)=>[e.node_id,{x:t*320+12,y:n*124+48}]))),c=Math.max(1,...o.map(e=>e.length))*124+48;return(0,z.jsx)(`div`,{className:`delivery-map-scroll`,role:`region`,"aria-label":i.map,tabIndex:0,children:(0,z.jsxs)(`div`,{className:`delivery-map`,style:{height:c},children:[[i.conditions,i.work,i.context].map((e,t)=>(0,z.jsx)(`strong`,{className:`delivery-map-heading`,style:{left:t*320+12},children:e},e)),(0,z.jsxs)(`svg`,{"aria-hidden":`true`,width:`960`,height:c,children:[(0,z.jsx)(`defs`,{children:(0,z.jsx)(`marker`,{id:a,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto-start-reverse`,children:(0,z.jsx)(`path`,{d:`M 0 0 L 10 5 L 0 10 z`,fill:`currentColor`})})}),e.edges.map(e=>{let t=s.get(e.from_node_id),r=s.get(e.to_node_id);if(!t||!r)return null;let i=t.x{let t=s.get(e.node_id);return(0,z.jsxs)(`button`,{className:`delivery-map-node`,style:{left:t.x,top:t.y},"aria-pressed":n===e.node_id,onClick:()=>r(e.node_id),type:`button`,children:[(0,z.jsxs)(`span`,{children:[i.kind[e.kind],(0,z.jsx)(`em`,{"data-state":e.state,children:i.state[e.state]})]}),(0,z.jsx)(`strong`,{title:e.title,children:e.title}),(0,z.jsx)(`small`,{children:e.owner_agent??i.unavailable})]},e.node_id)})]})})}function Jx({goal:e,items:t,userTodos:n,onSelect:r,active:i}){let{locale:a}=Ji(),o=Kx[a],[s,c]=(0,R.useState)({kind:`loading`}),[l,u]=(0,R.useState)(0),[d,f]=(0,R.useState)(``),[p,m]=(0,R.useState)(`all`),[h,g]=(0,R.useState)(null),[_,v]=(0,R.useState)(()=>window.matchMedia(`(min-width: 1024px)`).matches),[y,b]=(0,R.useState)(``),x=(0,R.useRef)(null),S=n.filter(t=>t.goalId===e.goalId),C=JSON.stringify([e.agentTodos,e.acceptanceObservation,S]),w=(0,R.useRef)(C);w.current=C,(0,R.useEffect)(()=>{if(!i)return;let t=new AbortController,n=w.current;return c(e=>({...e,kind:`loading`})),b(``),zx(e.goalId,t.signal).then(e=>{t.signal.aborted||c({kind:`ready`,snapshot:e,sourceKey:n})}).catch(()=>{t.signal.aborted||c(e=>({...e,kind:`error`}))}),()=>t.abort()},[e.goalId,l,i]);let T=s.snapshot?.goal_id===e.goalId?s.snapshot:null,E=!!T&&s.sourceKey!==C,D=!!T&&s.kind===`ready`&&!E,O=T?.graph,k=O?.nodes.find(e=>e.node_id===h),A=p===`related`&&!k?`all`:p,ee=(0,R.useMemo)(()=>O?Bx(O,d,A,h):[],[O,d,A,h]),j=O?.edges.filter(e=>e.from_node_id===h||e.to_node_id===h)??[],M=new Map(O?.nodes.map(e=>[e.node_id,e])),te=()=>{f(``),m(`all`)},ne=e=>{g(e),b(``),window.requestAnimationFrame(()=>x.current?.scrollIntoView({block:`nearest`}))};function N(n){let r=new Set(n.refs.todo_ids??[]),i=new Set(n.refs.gate_ids??[]),a=new Set(n.refs.run_ids??[]);return[...e.agentTodos.filter(e=>r.has(e.todoId)).map(t=>({kind:`todo`,item:{...t,goalId:e.goalId,goalTitle:e.title,ownerLabel:t.claimedBy}})),...S.filter(e=>i.has(e.todoId)||r.has(e.todoId)).map(e=>({kind:`attention`,item:e})),...t.filter(t=>t.kind===`run`&&t.run.goalId===e.goalId&&a.has(t.run.runId)).map(e=>({kind:`run`,item:e.run}))]}let P=k?N(k):[];function re(){if(!T||!D)return;let e;try{e=URL.createObjectURL(new Blob([Ux(T,o)],{type:`text/markdown;charset=utf-8`}));let t=document.createElement(`a`);t.href=e,t.download=`loopx-delivery-review.md`,t.click(),b(o.exported)}catch{b(o.exportFailed)}finally{e&&window.setTimeout(()=>URL.revokeObjectURL(e),1e3)}}return(0,z.jsxs)(`section`,{className:`delivery-review`,"aria-label":o.title,children:[(0,z.jsxs)(`header`,{className:`delivery-review-toolbar`,children:[(0,z.jsx)(`h2`,{children:o.title}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`button`,{type:`button`,disabled:s.kind===`loading`,onClick:()=>u(e=>e+1),children:[(0,z.jsx)(Qm,{size:15}),o.refresh]}),(0,z.jsxs)(`button`,{type:`button`,disabled:!D,onClick:re,children:[(0,z.jsx)(Tm,{size:15}),o.export]})]})]}),y?(0,z.jsx)(`p`,{role:`status`,children:y}):null,T?(0,z.jsxs)(z.Fragment,{children:[s.kind===`ready`?null:(0,z.jsx)(`p`,{role:s.kind===`error`?`alert`:`status`,className:`delivery-notice`,children:s.kind===`error`?o.refreshError:o.loading}),(0,z.jsxs)(`p`,{className:`delivery-snapshot-time`,children:[o.observed,` · `,(0,z.jsx)(`time`,{dateTime:T.observed_at,children:new Date(T.observed_at).toLocaleString(a)})]}),E?(0,z.jsx)(`p`,{role:`alert`,className:`delivery-notice`,children:o.changed}):null,(0,z.jsxs)(`p`,{className:`delivery-boundary`,children:[o.scope,` `,o.acceptanceBoundary]}),O?(0,z.jsxs)(z.Fragment,{children:[Vx(O)?(0,z.jsxs)(`details`,{className:`delivery-notice`,children:[(0,z.jsx)(`summary`,{children:o.incomplete}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:o.omittedGates}),(0,z.jsx)(`dd`,{children:O.limits.user_gate_truncated_count})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:o.missing}),(0,z.jsx)(`dd`,{children:O.limits.missing_predecessor_count??o.unavailable})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:o.clipped}),(0,z.jsx)(`dd`,{children:O.limits.predecessor_truncated===void 0?o.unavailable:O.limits.predecessor_truncated?o.yes:o.no})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:o.sourceClipped}),(0,z.jsx)(`dd`,{children:O.limits.source_truncated===void 0?o.unavailable:O.limits.source_truncated?o.yes:o.no})]})]})]}):null,(0,z.jsxs)(`section`,{className:`delivery-chain`,"aria-label":o.chain,children:[(0,z.jsxs)(`header`,{className:`delivery-chain-toolbar`,children:[(0,z.jsx)(`h3`,{children:o.chain}),(0,z.jsxs)(`span`,{children:[o.visible,` `,ee.length,`/`,O.nodes.length]}),(0,z.jsxs)(`div`,{role:`group`,"aria-label":o.view,children:[(0,z.jsx)(`button`,{type:`button`,"aria-pressed":_,onClick:()=>v(!0),children:o.map}),(0,z.jsx)(`button`,{type:`button`,"aria-pressed":!_,onClick:()=>v(!1),children:o.list})]})]}),(0,z.jsxs)(`div`,{className:`delivery-filters`,children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(th,{size:16}),(0,z.jsx)(`input`,{"aria-label":o.search,placeholder:o.search,value:d,onChange:e=>f(e.target.value)})]}),(0,z.jsxs)(`select`,{"aria-label":o.filter,value:A,onChange:e=>m(e.target.value),children:[(0,z.jsx)(`option`,{value:`all`,children:o.all}),(0,z.jsx)(`option`,{value:`conditions`,children:o.conditions}),(0,z.jsx)(`option`,{value:`evidence`,children:o.evidence}),(0,z.jsx)(`option`,{value:`related`,disabled:!k,children:o.related})]}),(0,z.jsx)(`button`,{type:`button`,onClick:te,children:o.reset})]}),ee.length?_?(0,z.jsx)(qx,{graph:O,nodes:ee,selected:h,onSelect:ne,copy:o}):(0,z.jsx)(`ul`,{className:`delivery-node-list`,children:ee.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`button`,{type:`button`,"aria-pressed":h===e.node_id,onClick:()=>ne(e.node_id),children:[(0,z.jsx)(`span`,{children:o.kind[e.kind]}),(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`small`,{children:e.owner_agent??o.unavailable}),(0,z.jsx)(`em`,{"data-state":e.state,children:o.state[e.state]})]})},e.node_id))}):(0,z.jsx)(`p`,{className:`delivery-empty`,role:`status`,children:o.empty})]}),(0,z.jsx)(`section`,{className:`delivery-node-detail`,"aria-label":o.details,ref:x,children:k?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[o.kind[k.kind],` · `,o.state[k.state]]}),(0,z.jsx)(`h3`,{children:k.title}),k.owner_agent?(0,z.jsx)(`p`,{children:k.owner_agent}):null]}),k.from_agent||k.to_agent?(0,z.jsxs)(`p`,{children:[k.from_agent??o.unavailable,` → `,k.to_agent??o.unavailable]}):null,(0,z.jsx)(`div`,{className:`delivery-source-actions`,children:P.length?P.map((e,t)=>(0,z.jsxs)(`button`,{type:`button`,disabled:!D,onClick:()=>r(e),children:[(0,z.jsx)(Dm,{size:15}),e.kind===`todo`?o.openTask:e.kind===`attention`?o.openGate:o.openRun]},`${e.kind}:${t}`)):(0,z.jsx)(`p`,{children:o.sourceUnavailable})}),(0,z.jsx)(`h4`,{children:o.relations}),j.length?(0,z.jsx)(`ul`,{className:`delivery-relations`,children:j.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>ne(e.from_node_id),children:M.get(e.from_node_id).title}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(sm,{size:13}),o.relation[e.relation],(0,z.jsx)(sm,{size:13})]}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>ne(e.to_node_id),children:M.get(e.to_node_id).title})]}),(0,z.jsx)(`p`,{children:e.reason})]},e.edge_id))}):(0,z.jsx)(`p`,{children:o.noRelations}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:o.refs}),(0,z.jsx)(`code`,{children:k.node_id}),Object.entries(k.refs).map(([e,t])=>(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`strong`,{children:e}),` `,t.join(`, `)]},e))]})]}):(0,z.jsx)(`p`,{children:o.select})})]}):(0,z.jsx)(`p`,{className:`delivery-notice`,children:o.noGraph})]}):(0,z.jsx)(`p`,{role:s.kind===`error`?`alert`:`status`,className:`delivery-notice`,children:s.kind===`error`?o.error:o.loading}),(0,z.jsx)(Wx,{goalId:e.goalId,contract:T?.acceptance?.goal_acceptance_contract,copy:o.contract,current:D}),(0,z.jsx)(Ub,{goal:T?{...e,acceptanceObservation:T.acceptance}:e})]})}function Yx({active:e,goal:t,items:n,userTodos:r,readOnly:i,onOpenDetails:a,onSelect:o,onView:s}){let{t:c,locale:l}=Ji(),u=l===`zh-CN`?{progress:`当前进展`,attention:`需要你`,none:`当前没有已加载的待处理决定。`,details:`Goal 信息`,tasks:`查看任务`,usage:`最近 24 小时`,execution:`执行记录`,remote:`此来源仅提供同步的状态与验收观察,交付链需要实时本机来源。`}:{progress:`Current progress`,attention:`Needs you`,none:`No pending decisions are loaded.`,details:`Goal information`,tasks:`View tasks`,usage:`Last 24 hours`,execution:`Execution`,remote:`This source provides synchronized status and acceptance observations. The delivery chain requires the live local source.`},d=r.filter(e=>e.goalId===t.goalId),f=n.find(e=>e.kind===`run`&&e.run.goalId===t.goalId);return(0,z.jsxs)(`section`,{className:`goal-overview`,"aria-label":c(`header.overview`),children:[(0,z.jsxs)(`header`,{className:`goal-overview-heading`,children:[(0,z.jsx)(`h2`,{children:c(`header.overview`)}),(0,z.jsxs)(`button`,{onClick:a,type:`button`,children:[(0,z.jsx)(Pm,{size:15}),u.details]})]}),(0,z.jsxs)(`div`,{className:`goal-overview-summary${d.length?` has-attention`:``}`,children:[(0,z.jsxs)(`section`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h3`,{children:u.progress}),(0,z.jsx)(`span`,{children:Yi(t.state,l)})]}),(0,z.jsx)(`strong`,{children:t.nextSentence}),t.agentSentence&&t.agentSentence!==t.nextSentence?(0,z.jsx)(`p`,{children:t.agentSentence}):null,d.length?null:(0,z.jsx)(`p`,{className:`goal-overview-quiet`,children:u.none}),f?(0,z.jsxs)(`button`,{className:`goal-overview-run`,type:`button`,onClick:()=>o({kind:`run`,item:f.run}),children:[(0,z.jsxs)(`small`,{children:[u.execution,` · `,f.run.agentLabel]}),(0,z.jsx)(`strong`,{children:f.run.title}),(0,z.jsx)(sm,{size:15})]}):null]}),d.length?(0,z.jsxs)(`section`,{className:`goal-overview-attention`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h3`,{children:u.attention}),(0,z.jsx)(`span`,{children:d.length})]}),(0,z.jsx)(`ul`,{children:d.slice(0,3).map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`button`,{type:`button`,onClick:()=>o({kind:`attention`,item:e}),children:[(0,z.jsx)(`span`,{children:e.text}),(0,z.jsx)(sm,{size:15})]})},e.todoId))}),d.length>3?(0,z.jsxs)(`button`,{type:`button`,onClick:()=>s(`tasks`),children:[u.tasks,` (`,d.length,`)`,(0,z.jsx)(sm,{size:14})]}):null]}):null]}),(0,z.jsxs)(`section`,{className:`goal-overview-usage`,"aria-label":u.usage,children:[(0,z.jsx)(`h3`,{children:u.usage}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:c(`drawer.tokensShort`)}),(0,z.jsx)(`dd`,{children:Qd(t.usage?.tokens24h,c(`drawer.usageNotMeasured`),Yd)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:c(`drawer.costShort`)}),(0,z.jsx)(`dd`,{children:Qd(t.usage?.costUsd24h,c(`drawer.usageNotMeasured`),Xd)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:c(`drawer.durationShort`)}),(0,z.jsx)(`dd`,{children:Qd(t.usage?.durationMs24h,c(`drawer.usageNotMeasured`),Zd)})]})]})]}),i?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`goal-overview-source-note`,children:u.remote}),(0,z.jsx)(Ub,{goal:t})]}):(0,z.jsx)(Jx,{active:e,goal:t,items:n,userTodos:r,onSelect:o})]})}function Xx({activeTab:e,panels:t,scrollRef:n}){let[r,i]=(0,R.useState)(()=>new Set([e])),a=(0,R.useRef)({});return(0,R.useEffect)(()=>i(t=>t.has(e)?t:new Set([...t,e])),[e]),(0,R.useLayoutEffect)(()=>{let t=n.current;if(!t)return;t.scrollTop=a.current[e]??0;let r=()=>{a.current[e]=t.scrollTop};return t.addEventListener(`scroll`,r,{passive:!0}),()=>t.removeEventListener(`scroll`,r)},[e,n]),Object.keys(t).map(n=>r.has(n)||n===e?(0,z.jsx)(`div`,{className:`personal-goal-view-panel`,"data-goal-panel":n,hidden:n!==e,children:t[n]},n):null)}function Zx(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 Qx(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 $x(e){return e.history_permission_guidance?.api_document_url??null}function eS(e,t,n){if(e instanceof qh){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 tS({embedded:e=!1,focusGoalConnection:t=!1,goals:n,initialGoalId:r,onChanged:i,onClose:a}){let{t:o}=Ji(),[s,c]=(0,R.useState)(`connections`),[l,u]=(0,R.useState)([]),[d,f]=(0,R.useState)([]),[p,m]=(0,R.useState)(!0),[h,g]=(0,R.useState)(null),[_,v]=(0,R.useState)(``),[y,b]=(0,R.useState)(t),[x,S]=(0,R.useState)(``),[C,w]=(0,R.useState)(r??n[0]?.goalId??``),[T,E]=(0,R.useState)(``),[D,O]=(0,R.useState)([]),[k,A]=(0,R.useState)(``),[ee,j]=(0,R.useState)(!1),[M,te]=(0,R.useState)(null),[ne,N]=(0,R.useState)(`addressed_only`),[P,re]=(0,R.useState)(t&&r?`goal`:`manager`),[ie,ae]=(0,R.useState)(`async_inbox`),[F,oe]=(0,R.useState)(`topic_reply`),[I,se]=(0,R.useState)(``),[L,ce]=(0,R.useState)(!1),[le,ue]=(0,R.useState)({}),[de,fe]=(0,R.useState)(!1),[pe,me]=(0,R.useState)(null),[he,ge]=(0,R.useState)(null),[_e,ve]=(0,R.useState)(null),[ye,be]=(0,R.useState)(null),[xe,Se]=(0,R.useState)(!1),[Ce,we]=(0,R.useState)(`loopx-workspace-bot`),[Te,Ee]=(0,R.useState)(`feishu`),[De,Oe]=(0,R.useState)(null),[ke,Ae]=(0,R.useState)(!1),[je,Me]=(0,R.useState)(null),Ne=(0,R.useRef)(null),Pe=(0,R.useRef)(null),Fe=(0,R.useRef)(!1);async function Ie(){m(!0),g(null);try{let[e,t]=await Promise.all([__(),E_()]);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(eS(e,o(`lark.error.configuration`),o))}finally{m(!1)}}(0,R.useEffect)(()=>{Ie()},[]),(0,R.useEffect)(()=>{if(!t||p||Fe.current||!r)return;Fe.current=!0;let e=d.find(e=>e.goal_id===r);e?Je(e):V(n.find(e=>e.goalId===r))},[d,t,n,r,p]),(0,R.useEffect)(()=>{if(!y||!x||_e){O([]),A(``),j(!1),te(null);return}let e=!1;j(!0),te(null);let t=window.setTimeout(()=>{w_(x,T).then(t=>{e||(O(t),A(e=>t.some(t=>t.chat_id===e)?e:t[0]?.chat_id??``))}).catch(t=>{e||(O([]),A(``),te(eS(t,o(`lark.error.groupLoad`),o)))}).finally(()=>{e||j(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[x,T,y,_e]),(0,R.useEffect)(()=>{if(!xe||!De||[`ready`,`failed`,`cancelled`].includes(De.status))return;let e=!1,t=window.setTimeout(()=>{b_(De.setup_id).then(async t=>{e||(Oe(t),t.verification_url&&Pe.current!==t.verification_url&&(Pe.current=t.verification_url,Ne.current&&!Ne.current.closed&&(Ne.current.location.href=t.verification_url)),t.status===`ready`&&(await Ie(),S(t.app_ref),ue({}),Se(!1)),t.status===`failed`&&Me(t.error??o(`lark.error.appCreate`)))}).catch(t=>{e||Me(eS(t,o(`lark.error.setupPoll`),o))})},650);return()=>{e=!0,window.clearTimeout(t)}},[xe,De]);let Le=n.find(e=>e.goalId===C),Re=Le?.agentId?[{agentId:Le.agentId,label:Le.agentLabel??Le.agentId}]:[],B=Le?.agentLanes?.length?Le.agentLanes:Re,ze=B.some(e=>e.agentId===I),Be=[];L?Be=B.map(e=>({agentId:e.agentId,appRef:le[e.agentId]??x})):ze&&(Be=[{agentId:I,appRef:x}]);let Ve=Be.map(e=>e.agentId),He=!!_e||Be.length>0&&Be.every(e=>l.some(t=>t.app_ref===e.appRef&&t.reply_ready)),Ue=o(`lark.connect`);he?Ue=o(`lark.saveConnection`):L&&(Ue=o(`lark.connectAllAgentsAction`,{count:Ve.length}));let We=l.find(e=>e.app_ref===x),Ge=D.find(e=>e.chat_id===k),Ke=(0,R.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,_]),qe=(0,R.useMemo)(()=>d.filter(e=>Qx(e,o).state===`unverified`).length,[d,o]);function V(e){let i=e??n.find(e=>e.goalId===r)??n[0];ge(null),ve(null),re(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??``),A(``),w(i?.goalId??``),se(i?.agentId??``),ce(!1),ue({}),N(`addressed_only`),ae(`async_inbox`),oe(`topic_reply`),E(``),me(null),b(!0)}function Je(e){ge(e.goal_id),ve(e),re(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}]:[];se(e.agent_id??(r.length===1?r[0].agentId:``)),ce(!1),ue({}),N(e.capture_scope),ae(e.ingress_mode===`direct_session`?`async_inbox`:e.ingress_mode),oe(e.reply_mode),E(e.chat_name),me(null),b(!0)}function Ye(){Oe(null),Me(null),Pe.current=null,Se(!0)}async function Xe(){if(!(ke||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(Ce))){Ae(!0),Me(null),Pe.current=null,Ne.current=window.open(window.location.href,`_blank`);try{let e=await y_({appRef:Ce,brand:Te});Oe(e)}catch(e){Ne.current?.close(),Me(eS(e,o(`lark.error.setupStart`),o))}finally{Ae(!1)}}}async function Ze(){let e=De;if(Se(!1),Ne.current?.close(),e&&![`ready`,`failed`,`cancelled`].includes(e.status))try{await x_(e.setup_id)}catch{}}async function Qe(){if(!(!x||!C||!_e&&!Ge||P===`goal`&&Ve.length===0||de)){fe(!0),me(null);try{let e={...P===`manager`?{..._e?{connectionId:_e.connection_id}:{appRef:x,chatId:Ge.chat_id,chatName:Ge.chat_name}}:_e?{connectionId:_e.connection_id,agentId:I}:{agentBindings:Be,chatId:Ge.chat_id,chatName:Ge.chat_name},conversationKind:P,captureScope:P===`manager`?`addressed_only`:ne,goalId:C,incomingMode:ne===`configured_chat_all`?`all`:`mentions`,ingressMode:P===`manager`?`session_queue`:ie,replyMode:F},t=await D_({...e,execute:!1});if(!t.ok)throw new qh(t.public_summary??t.blocker??o(`lark.error.bindPreview`),{error_code:t.blocker??`provider_api_failed`});let n=await D_({...e,execute:!0});if(!n.ok)throw new qh(n.public_summary??n.blocker??o(`lark.error.bind`),{error_code:n.blocker??`provider_api_failed`});b(!1),await Ie(),i?.()}catch(e){me(eS(e,o(`lark.error.bind`),o))}finally{fe(!1)}}}async function $e(e,t){if(ye!==t){be(t);return}try{await O_(e,t),be(null),await Ie(),i?.()}catch(e){g(eS(e,o(`lark.error.disconnect`),o))}}return(0,z.jsxs)(`section`,{className:`personal-lark-settings${e?` is-embedded`:``}`,"aria-label":o(`lark.configuration`),children:[e?null:(0,z.jsxs)(`header`,{className:`personal-lark-header`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:o(`settings.goalConnections`)}),(0,z.jsx)(`h1`,{children:`Lark`})]}),(0,z.jsx)(`button`,{"aria-label":o(`lark.closeSettings`),className:`personal-icon-button`,onClick:a,type:`button`,children:(0,z.jsx)(gh,{size:18})})]}),(0,z.jsxs)(`nav`,{className:`personal-lark-tabs`,"aria-label":o(`lark.management`),children:[(0,z.jsxs)(`button`,{"aria-current":s===`apps`?`page`:void 0,onClick:()=>c(`apps`),type:`button`,children:[o(`lark.apps`),` `,(0,z.jsx)(`span`,{children:p?`…`:l.length})]}),(0,z.jsxs)(`button`,{"aria-current":s===`connections`?`page`:void 0,onClick:()=>c(`connections`),type:`button`,children:[o(`lark.connections`),` `,(0,z.jsx)(`span`,{children:p?`…`:d.length})]})]}),h?(0,z.jsx)(`p`,{className:`personal-notification-error`,children:h}):null,p?(0,z.jsxs)(`div`,{className:`personal-lark-loading`,children:[(0,z.jsx)(zm,{className:`is-spinning`,size:18}),o(`lark.loading`)]}):null,!p&&s===`apps`?(0,z.jsxs)(`div`,{className:`personal-lark-apps`,children:[(0,z.jsxs)(`div`,{className:`personal-lark-app-toolbar`,children:[(0,z.jsx)(`span`,{children:o(`lark.reusableApps`,{count:l.length})}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:Ye,type:`button`,children:[(0,z.jsx)(Xm,{size:16}),o(`lark.newApp`)]})]}),(0,z.jsxs)(`div`,{className:`personal-lark-app-grid`,children:[l.map(e=>(0,z.jsxs)(`article`,{className:`personal-lark-app-card`,children:[(0,z.jsx)(`span`,{className:`personal-lark-app-avatar`,children:(0,z.jsx)(fm,{size:19})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsxs)(`small`,{children:[e.brand,` · lark-cli profile`]})]}),(0,z.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,z.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,z.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noProfiles`)}):null]})]}):null,!p&&s===`connections`?(0,z.jsxs)(`div`,{className:`personal-lark-connections`,children:[qe>0?(0,z.jsxs)(`p`,{className:`personal-lark-route-readiness`,role:`status`,children:[(0,z.jsx)(Um,{size:15}),o(`lark.routesUnverified`,{count:qe})]}):null,(0,z.jsxs)(`div`,{className:`personal-lark-toolbar`,children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(th,{size:16}),(0,z.jsx)(`input`,{"aria-label":o(`lark.searchConnections`),onChange:e=>v(e.target.value),placeholder:o(`lark.searchPlaceholder`),type:`search`,value:_})]}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:l.length===0||n.length===0,onClick:()=>V(),type:`button`,children:[(0,z.jsx)(Xm,{size:16}),o(`lark.connectApp`)]})]}),(0,z.jsxs)(`div`,{className:`personal-lark-table`,role:`table`,"aria-label":o(`lark.goalTopicConnections`),children:[(0,z.jsxs)(`div`,{className:`personal-lark-table-head`,role:`row`,children:[(0,z.jsx)(`span`,{children:o(`lark.connection`)}),(0,z.jsx)(`span`,{children:o(`common.goal`)}),(0,z.jsx)(`span`,{children:o(`lark.capture`)}),(0,z.jsx)(`span`,{children:o(`lark.processing`)}),(0,z.jsx)(`span`,{children:o(`common.actions`)})]}),Ke.map(e=>{let t=Qx(e,o);return(0,z.jsxs)(`div`,{className:`personal-lark-table-row`,role:`row`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.chat_name}),(0,z.jsxs)(`small`,{children:[e.app_label,` · `,t.label]}),(0,z.jsx)(`small`,{children:t.detail}),t.state===`unverified`?(0,z.jsxs)(`a`,{href:`https://open.feishu.cn/document/server-docs/im-v1/message/events/receive?lang=zh-CN`,rel:`noreferrer`,target:`_blank`,children:[(0,z.jsx)(Dm,{size:12}),o(`lark.openEventSettings`)]}):null,$x(e)?(0,z.jsxs)(`a`,{href:$x(e)??void 0,rel:`noreferrer`,target:`_blank`,children:[(0,z.jsx)(Dm,{size:12}),o(`lark.historyPermission`)]}):null]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.goal_title}),(0,z.jsxs)(`small`,{children:[`# `,e.topic_name]})]}),(0,z.jsx)(`span`,{children:e.capture_scope===`addressed_only`?o(`lark.mentionsOnly`):o(`lark.allTopicMessages`)}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.conversation_kind===`manager`?o(`lark.managerConversation`):Zx(e.ingress_mode,o).label}),(0,z.jsx)(`small`,{children:e.conversation_kind===`manager`?o(`lark.managerConversationDescription`):e.agent_id??Zx(e.ingress_mode,o).detail})]}),(0,z.jsxs)(`span`,{className:`personal-lark-row-actions`,children:[(0,z.jsx)(`button`,{"aria-label":o(`lark.settingsConfigure`,{goal:e.goal_title}),onClick:()=>Je(e),type:`button`,children:(0,z.jsx)(ah,{size:15})}),(0,z.jsxs)(`button`,{"aria-label":o(`lark.settingsDisconnect`,{goal:e.goal_title}),className:ye===e.connection_id?`is-confirm`:``,onClick:()=>void $e(e.goal_id,e.connection_id),type:`button`,children:[(0,z.jsx)(mh,{size:15}),ye===e.connection_id?o(`common.confirm`):null]})]})]},e.connection_id)}),Ke.length===0?(0,z.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noConnections`)}):null]})]}):null,y?(0,z.jsx)(`div`,{className:`personal-lark-modal-backdrop`,role:`presentation`,children:(0,z.jsxs)(`section`,{"aria-labelledby":`connect-lark-title`,"aria-modal":`true`,className:`personal-lark-modal`,role:`dialog`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:`Goal Topic connection`}),(0,z.jsx)(`h2`,{id:`connect-lark-title`,children:o(he?`lark.editConnection`:`lark.connectApp`)})]}),(0,z.jsx)(`button`,{"aria-label":o(`lark.closeConnection`),onClick:()=>b(!1),type:`button`,children:(0,z.jsx)(gh,{size:18})})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.conversationKind`)}),(0,z.jsxs)(`select`,{"aria-label":o(`lark.conversationKind`),disabled:!!_e,value:P,onChange:e=>re(e.target.value),children:[(0,z.jsx)(`option`,{value:`manager`,children:o(`lark.managerConversation`)}),(0,z.jsx)(`option`,{value:`goal`,children:o(`lark.workerConversation`)})]})]}),P===`manager`?(0,z.jsx)(`p`,{children:o(`lark.managerConversationDescription`)}):null,_e?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,z.jsx)(`div`,{children:_e.app_label})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,z.jsx)(`div`,{children:_e.chat_name})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,z.jsx)(`div`,{children:_e.goal_title})]}),(0,z.jsx)(`small`,{children:o(`lark.editPreservesIdentity`)})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,z.jsx)(`select`,{"aria-label":o(`lark.appProfile`),disabled:p,onChange:e=>{e.target.value===`__register__`?Ye():(S(e.target.value),ue({}))},value:x,children:p?(0,z.jsx)(`option`,{value:``,children:o(`lark.appLoading`)}):(0,z.jsxs)(z.Fragment,{children:[l.map(e=>(0,z.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,z.jsx)(`option`,{value:`__register__`,children:o(`lark.registerAnother`)})]})}),(0,z.jsx)(`small`,{children:o(`lark.defaultAgentAppDescription`)})]}),We?.ready&&!We.reply_ready?(0,z.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.appPermissions`)}):null,(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,z.jsx)(`input`,{"aria-label":o(`lark.groupSearch`),onChange:e=>E(e.target.value),placeholder:o(`lark.groupSearch`),type:`search`,value:T}),ee?(0,z.jsxs)(`div`,{className:`personal-lark-group-state`,role:`status`,children:[(0,z.jsx)(zm,{className:`is-spinning`,size:15}),o(`lark.groupLoading`)]}):null,!ee&&M?(0,z.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:M}):null,!ee&&!M&&D.length===0?(0,z.jsx)(`div`,{className:`personal-lark-group-state`,role:`status`,children:o(`lark.groupEmpty`)}):null,!ee&&!M&&D.length>0?(0,z.jsx)(`select`,{"aria-label":o(`lark.groupChat`),onChange:e=>A(e.target.value),value:k,children:D.map(e=>(0,z.jsx)(`option`,{value:e.chat_id,children:e.chat_name},e.chat_id))}):null]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,z.jsx)(`select`,{"aria-label":o(`lark.bindGoal`),onChange:e=>{let t=e.target.value;w(t),se(n.find(e=>e.goalId===t)?.agentId??``),ue({})},value:C,children:n.map(e=>(0,z.jsx)(`option`,{value:e.goalId,children:e.title},e.goalId))})]})]}),(0,z.jsxs)(`label`,{className:`personal-lark-check`,children:[(0,z.jsx)(`input`,{checked:!0,readOnly:!0,type:`checkbox`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:o(`lark.createAutomatically`)}),(0,z.jsx)(`small`,{children:o(`lark.createAutomaticallyDescription`)})]})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.topicPreview`)}),(0,z.jsxs)(`div`,{className:`personal-lark-topic-preview`,children:[(0,z.jsx)(Um,{size:15}),`# `,Le?.title??Le?.goalId??`Goal`]})]}),P===`goal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.captureScope`)}),(0,z.jsxs)(`select`,{"aria-label":o(`lark.captureScope`),disabled:_e?.ingress_mode===`direct_session`,onChange:e=>N(e.target.value),value:ne,children:[(0,z.jsx)(`option`,{value:`addressed_only`,children:o(`lark.captureAddressed`)}),(0,z.jsx)(`option`,{value:`configured_chat_all`,children:o(`lark.captureAll`)})]}),(0,z.jsx)(`small`,{children:o(`lark.captureScopeDescription`)})]}),(0,z.jsxs)(`fieldset`,{"aria-label":o(`lark.agentIngress`),className:`personal-lark-ingress`,children:[(0,z.jsx)(`legend`,{children:o(`lark.agentIngress`)}),(0,z.jsx)(`div`,{children:[`live_steering`,`session_queue`,`async_inbox`].map(e=>{let t=Zx(e,o);return(0,z.jsxs)(`label`,{className:ie===e?`is-active`:``,children:[(0,z.jsx)(`input`,{"aria-label":t.label,checked:ie===e,name:`lark-agent-ingress`,onChange:()=>ae(e),type:`radio`,value:e}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:t.label}),(0,z.jsx)(`small`,{children:t.detail})]})]},e)})})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.targetAgent`)}),(0,z.jsxs)(`select`,{"aria-label":o(`lark.targetAgent`),disabled:!!_e?.agent_id,onChange:e=>se(e.target.value),value:I,children:[ze?null:(0,z.jsx)(`option`,{disabled:!0,value:I,children:I?o(`lark.agentUnavailable`,{agent:I}):o(`lark.noAgentConfigured`)}),B.map(e=>(0,z.jsx)(`option`,{value:e.agentId,children:e.label===e.agentId?e.agentId:`${e.label} · ${e.agentId}`},e.agentId))]}),(0,z.jsx)(`small`,{children:o(`lark.targetAgentDescription`)})]}),!he&&B.length>1?(0,z.jsxs)(`label`,{"aria-label":o(`lark.connectAllAgents`),className:`personal-lark-check`,children:[(0,z.jsx)(`input`,{checked:L,onChange:e=>ce(e.target.checked),type:`checkbox`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:o(`lark.connectAllAgents`)}),(0,z.jsx)(`small`,{children:o(`lark.connectAllAgentsDescription`,{count:B.length})})]})]}):null,!he&&L&&B.length>1?(0,z.jsxs)(`fieldset`,{"aria-label":o(`lark.agentApps`),className:`personal-lark-agent-apps`,children:[(0,z.jsx)(`legend`,{children:o(`lark.agentApps`)}),(0,z.jsx)(`small`,{children:o(`lark.agentAppsDescription`)}),(0,z.jsx)(`div`,{children:B.map(e=>(0,z.jsxs)(`label`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsx)(`small`,{children:e.agentId})]}),(0,z.jsx)(`select`,{"aria-label":o(`lark.agentAppSelection`,{agent:e.label}),onChange:t=>ue(n=>({...n,[e.agentId]:t.target.value})),value:le[e.agentId]??x,children:l.map(e=>(0,z.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,L&&Be.length>0&&!He?(0,z.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.agentAppPermissions`)}):null,Ve.length===0?(0,z.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:o(`lark.selectRegisteredAgent`)}):null]}):null,(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.replyMode`)}),(0,z.jsx)(`select`,{"aria-label":o(`lark.replyMode`),onChange:e=>oe(e.target.value),value:F,children:(0,z.jsx)(`option`,{value:`topic_reply`,children:o(`lark.topicReply`)})}),(0,z.jsx)(`small`,{children:o(`lark.replyModeDescription`)})]}),(0,z.jsxs)(`p`,{className:`personal-lark-cardinality`,children:[(0,z.jsx)(hm,{size:15}),o(`lark.cardinality`)]}),pe?(0,z.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:pe}):null,(0,z.jsxs)(`footer`,{children:[(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>b(!1),type:`button`,children:o(`lark.cancel`)}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:p||!x||!_e&&(!We?.reply_ready||!k)||P===`goal`&&(!He||Ve.length===0)||!C||de,onClick:()=>void Qe(),type:`button`,children:[de?(0,z.jsx)(zm,{className:`is-spinning`,size:15}):null,Ue]})]})]})}):null,xe?(0,z.jsx)(`div`,{className:`personal-lark-modal-backdrop is-setup`,role:`presentation`,children:(0,z.jsxs)(`section`,{"aria-labelledby":`new-lark-app-title`,"aria-modal":`true`,className:`personal-lark-modal personal-lark-setup-modal`,role:`dialog`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:o(`lark.reusableWorkspaceApp`)}),(0,z.jsx)(`h2`,{id:`new-lark-app-title`,children:o(`lark.newApp`)})]}),(0,z.jsx)(`button`,{"aria-label":o(`lark.closeCreate`),onClick:()=>void Ze(),type:`button`,children:(0,z.jsx)(gh,{size:18})})]}),De?(0,z.jsxs)(`div`,{className:`personal-lark-setup-progress`,children:[(0,z.jsx)(`span`,{className:`personal-lark-setup-icon is-${De.status}`,children:De.status===`ready`?(0,z.jsx)(hm,{size:22}):(0,z.jsx)(zm,{className:De.status===`failed`?``:`is-spinning`,size:22})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:De.status===`ready`?o(`lark.appCreated`):De.status===`failed`?o(`lark.appCreateFailed`):o(`lark.waitingFeishu`)}),(0,z.jsx)(`p`,{children:De.status===`waiting_for_feishu`?o(`lark.waitingFeishuDescription`):De.status===`starting`?o(`lark.waitingLink`):De.error})]}),De.verification_url?(0,z.jsxs)(`a`,{href:De.verification_url,rel:`noreferrer`,target:`_blank`,children:[(0,z.jsx)(Dm,{size:15}),o(`lark.reopenFeishu`)]}):null]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`personal-lark-setup-copy`,children:o(`lark.setupCopy`)}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.profileName`)}),(0,z.jsx)(`input`,{"aria-label":o(`lark.profileName`),autoComplete:`off`,onChange:e=>we(e.target.value),placeholder:`loopx-workspace-bot`,value:Ce})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.region`)}),(0,z.jsxs)(`select`,{"aria-label":o(`lark.region`),onChange:e=>Ee(e.target.value),value:Te,children:[(0,z.jsx)(`option`,{value:`feishu`,children:`Feishu`}),(0,z.jsx)(`option`,{value:`lark`,children:`Lark`})]})]}),Ce&&!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(Ce)?(0,z.jsx)(`p`,{className:`personal-notification-error`,children:o(`lark.profileValidation`)}):null]}),je?(0,z.jsx)(`p`,{className:`personal-notification-error`,children:je}):null,(0,z.jsxs)(`footer`,{children:[(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void Ze(),type:`button`,children:o(`lark.cancel`)}),De?null:(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:ke||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(Ce),onClick:()=>void Xe(),type:`button`,children:[ke?(0,z.jsx)(zm,{className:`is-spinning`,size:15}):(0,z.jsx)(Dm,{size:15}),o(`lark.continueFeishu`)]})]})]})}):null]})}function nS(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function rS(e,t,n){let r=nS(t),i=nS(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 iS(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 aS(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 oS({id:e,value:t,timezone:n,onChange:r}){let{locale:i}=Ji(),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,z.jsxs)(`div`,{className:`personal-report-schedule`,children:[(0,z.jsxs)(`label`,{className:`is-boolean`,htmlFor:e,children:[(0,z.jsx)(`span`,{children:a?`按日历汇报`:`Calendar reports`}),(0,z.jsx)(`input`,{id:e,type:`checkbox`,role:`switch`,checked:!!o,disabled:!r,onChange:e=>e.target.checked?p({}):r?.(null)})]}),o?(0,z.jsxs)(z.Fragment,{children:[d?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{htmlFor:`${e}-frequency`,children:[(0,z.jsx)(`span`,{children:a?`频率`:`Frequency`}),(0,z.jsxs)(`select`,{id:`${e}-frequency`,value:c.FREQ,disabled:!r,onChange:e=>p({FREQ:e.target.value}),children:[(0,z.jsx)(`option`,{value:`DAILY`,children:a?`每天`:`Daily`}),(0,z.jsx)(`option`,{value:`WEEKLY`,children:a?`每周`:`Weekly`})]})]}),c.FREQ===`WEEKLY`&&(0,z.jsxs)(`label`,{htmlFor:`${e}-day`,children:[(0,z.jsx)(`span`,{children:a?`星期`:`Weekday`}),(0,z.jsx)(`select`,{id:`${e}-day`,value:c.BYDAY,disabled:!r,onChange:e=>p({BYDAY:e.target.value}),children:l.map((e,t)=>(0,z.jsx)(`option`,{value:e,children:f[t]},e))})]}),(0,z.jsxs)(`label`,{htmlFor:`${e}-time`,children:[(0,z.jsxs)(`span`,{children:[a?`当地时间`:`Local time`,` (`,n,`)`]}),(0,z.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,z.jsx)(`p`,{role:`alert`,children:a?`此计划需在 JSON 模式中编辑;当前内容已保留。`:`Edit this schedule in JSON mode; its current value is preserved.`}),(0,z.jsx)(`p`,{children:a?`由现有唤醒检查到期计划;实际送达以回执为准。`:`Existing wakes check the schedule; delivery is confirmed by its receipt.`})]}):(0,z.jsx)(`p`,{children:a?`未设置日历计划;保持阶段结束时汇报。`:`No calendar schedule; report at validated stage boundaries.`})]})}function sS({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,z.jsx)(oS,{id:n,value:i,timezone:a,onChange:r?e=>r(t.key,e):void 0});if(t.input_kind===`boolean`)return(0,z.jsxs)(`label`,{className:`is-boolean`,htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.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,z.jsxs)(`label`,{htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.jsxs)(`select`,{id:n,onChange:r?e=>r(t.key,e.target.value):void 0,value:typeof i==`string`?i:``,children:[(0,z.jsx)(`option`,{value:``}),(t.options??[]).map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})]});if(t.input_kind===`string_list`)return(0,z.jsxs)(`label`,{htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.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,z.jsxs)(`label`,{htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.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 cS({copy:e={},disabled:t=!1,editor:n,enabledAction:r,omitKeys:i=[],onChange:a,value:o}){let s=(0,R.useId)(),c=new Set(i);return(0,z.jsx)(`fieldset`,{className:`personal-capability-fields`,disabled:t,children:n.fields.filter(e=>!c.has(e.key)).map(t=>{let n=(0,z.jsx)(sS,{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,z.jsxs)(`div`,{className:`personal-capability-enabled-row`,children:[n,r]},t.key):n})})}var lS={en:{manager_runtime:{displayName:`Manager runtime`,description:`Selects the persistent host-tool profile used by owner manager conversations.`},steward_executor:{displayName:`Steward executor`,description:`Guides the steward executor, model, and selection boundary for this machine. A pinned route blocks substitution; a flexible pool permits only authorized fallback.`},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.`},progress_review:{displayName:`Progress-review sentinel`,description:`Records typed drift receipts from an external bounded review of scoped file deltas; assist may raise the existing autonomous replan obligation.`},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.`},coordination_runtime_shadow:{displayName:`Coordination runtime shadow`,description:`Captures transaction-bound Todo and task-lease mutations for reviewed whole-Goal coordination-authority promotion.`},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:`选择管家会话持续生效的宿主工具模式。`},steward_executor:{displayName:`管家执行器`,description:`配置本机管家的执行器、模型与选择边界;锁定路径禁止替代,灵活池只允许在已授权范围内回退。`},todo_replan_cadence:{displayName:`Goal 复核周期`,description:`配置 Goal 的复核周期。`},change_quality_qualification:{displayName:`变更质量验证`,description:`生成与 Provider 无关的审阅包,最多允许一次策略授权的安全修复,并可要求精确 diff 回执。`},progress_review:{displayName:`进展评估哨兵`,description:`记录外部有界评估对限定文件变化给出的类型化漂移回执;assist 模式可触发已有的自主重规划义务。`},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 状态,但不取得写入权。`},coordination_runtime_shadow:{displayName:`协调 Runtime 影子`,description:`捕获事务绑定的 Todo 与 task lease 变更,为经评审的整 Goal 协调 Authority 晋级提供证据。`},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 绑定。`}}},uS={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.`},selection_policy:{label:`Selection policy`,description:`Preferred allows an explicit user choice; pinned rejects another executor; flexible permits fallback only inside the eligible pool.`},executor_endpoint:{label:`Primary steward executor`,description:`The preferred or pinned executor for this machine. In a flexible pool it is tried first when available.`},eligible_endpoints:{label:`Flexible eligible executors`,description:`One authorized executor per line. Use only with flexible selection and include the primary executor.`},executor_model:{label:`Model`,description:`Optional model for the selected executor. Leave blank to keep the executor's own default.`},executor_reasoning_effort:{label:`Reasoning effort`,description:`Optional reasoning effort for the selected executor. Leave blank to keep the executor's own default.`},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.`},wait_for_ci:{label:`Wait for CI`,description:`Disable to use local validation without querying or waiting for CI. Merge authority is unchanged.`},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 开放常规宿主工具,但受保护操作仍单独校验。`},selection_policy:{label:`选择策略`,description:`preferred 允许用户显式改选;pinned 拒绝其他执行器;flexible 只在已授权资源池内回退。`},executor_endpoint:{label:`首选管家执行器`,description:`本机首选或锁定的执行器;灵活池模式下优先尝试它。`},eligible_endpoints:{label:`灵活池可用执行器`,description:`每行一个已授权执行器,仅用于 flexible;必须包含首选执行器。`},executor_model:{label:`模型`,description:`所选执行器使用的模型,可留空;留空表示沿用执行器自身的默认模型。`},executor_reasoning_effort:{label:`推理档位`,description:`所选执行器使用的推理档位,可留空;留空表示沿用执行器自身的默认档位。`},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。`},wait_for_ci:{label:`等待 CI`,description:`关闭后使用本地验证,不查询或等待 CI;不改变合并权限。`},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 dS(e,t){let n=lS[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 fS(e){return uS[e]}Object.freeze(Object.keys(lS.en).sort());function pS(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 mS({values:e,t}){return(0,z.jsxs)(`details`,{className:`personal-capability-raw-values`,children:[(0,z.jsx)(`summary`,{children:t(`capabilities.rawJson`)}),(0,z.jsx)(`div`,{className:`personal-capability-value-grid`,children:e.map(({label:e,value:t})=>(0,z.jsxs)(`section`,{children:[(0,z.jsx)(`strong`,{children:e}),(0,z.jsx)(`pre`,{children:t?JSON.stringify(t,null,2):`—`})]},e))})]})}function hS({source:e,t}){return e?(0,z.jsxs)(`p`,{className:`personal-capability-effective-source`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:15}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:t(`capabilities.effectiveSource`)}),t(`capabilities.source.${e}`)]})]}):null}function gS({available:e,description:t,t:n}){return e?null:(0,z.jsxs)(`section`,{className:`personal-capability-editor-status is-read-only`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:n(`capabilities.readOnly`)}),(0,z.jsx)(`p`,{children:t})]})]})}function _S(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 vS(e,t){return[...e].sort((e,n)=>{let r=_S(e)-_S(n);if(r!==0)return r;let i=dS(e,t),a=dS(n,t);return i.display_name.localeCompare(a.display_name,t)||e.capability_id.localeCompare(n.capability_id)})}function yS({capabilities:e,locale:t,onSelect:n,scope:r,selectedCapabilityId:i,t:a}){return(0,z.jsx)(`nav`,{"aria-label":a(r===`goal`?`capabilities.catalog`:`machine.capabilityCatalog`),className:`personal-capability-list`,tabIndex:0,children:vS(e,t).map(e=>{let o=dS(e,t);return(0,z.jsxs)(`button`,{"aria-current":i===o.capability_id?`page`:void 0,onClick:()=>n(o.capability_id),type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:o.display_name})}),(0,z.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 bS({capability:e,locale:t,source:n}){let{t:r}=Ji(),i=dS(e,t);return(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`span`,{className:`personal-settings-icon`,children:(0,z.jsx)(sh,{"aria-hidden":!0,size:18})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`personal-capability-heading-row`,children:[(0,z.jsx)(`h2`,{children:i.display_name}),(0,z.jsx)(hS,{source:n,t:r})]}),e.context_contribution&&(0,z.jsxs)(`details`,{className:`personal-capability-help`,"data-testid":`capability-context-phases`,children:[(0,z.jsx)(`summary`,{children:t===`zh-CN`?`主 Agent 协作指导`:`Coordinator workflow guidance`}),(0,z.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,z.jsx)(`dl`,{children:e.context_contribution.supported_phases.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:(0,z.jsx)(`code`,{children:e})}),(0,z.jsx)(`dd`,{children:xS[e][t===`zh-CN`?`zh`:`en`]})]},e))}),(0,z.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,z.jsxs)(`details`,{className:`personal-capability-help`,children:[(0,z.jsx)(`summary`,{children:t===`zh-CN`?`配置说明`:`Configuration help`}),(0,z.jsx)(`p`,{children:i.description}),(0,z.jsx)(`dl`,{children:e.configuration_editor.fields.map(e=>{let n=fS(t)[e.key],r=n?.description??e.description;return r?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n?.label??e.label}),(0,z.jsx)(`dd`,{children:r})]},e.key):null})})]},e.capability_id)]})]})}var xS={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 SS({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null);async function l(n){if(e.onToggleGoalAutoNotify){o(!0),c(null);try{let a=await e.onToggleGoalAutoNotify({autoNotify:n,goalId:t});if(!a.ok){c(a.public_summary??a.blocker??i(`notifications.setupFailed`));return}r()}catch(e){c(e instanceof Error?e.message:i(`notifications.setupFailed`))}finally{o(!1)}}}return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{className:`personal-notification-toggle`,children:[(0,z.jsx)(`input`,{checked:n?.humanGateAutoNotifyEnabled??!1,disabled:a||n?.configured!==!0||!e.onToggleGoalAutoNotify,onChange:e=>void l(e.target.checked),type:`checkbox`}),(0,z.jsx)(`span`,{children:i(`notifications.autoNotify`)}),a?(0,z.jsx)(zm,{"aria-hidden":!0,className:`is-spinning`,size:14}):null]}),s?(0,z.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:s}):null]})}function CS({goalId:e,onApplied:t,selected:n,t:r}){let[i,a]=(0,R.useState)({busy:null,draft:{},partialWrite:null,preview:null}),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(`guided`),[u,d]=(0,R.useState)(``),f=(0,R.useMemo)(()=>n?iS(n.configuration_editor,u):null,[n,u]),p=c===`guided`||f!==null;(0,R.useEffect)(()=>{l(`guided`),d(``),a({busy:null,draft:rS(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 o_(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=rS(n.configuration_editor,i.draft,n.default),o=await s_(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`?aS(r.draft,e,t):{...r.draft,[e]:t},preview:null})),s(null)}function _(e){if(!n||i.busy)return;d(e);let t=iS(n.configuration_editor,e);a(e=>({...e,preview:null,draft:t?rS(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 wS({mutationError:e,onApplied:t,partialWrite:n,preview:r}){let{t:i}=Ji();return(0,z.jsxs)(z.Fragment,{children:[e?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:e}):null,n?(0,z.jsxs)(`section`,{"aria-live":`polite`,className:`personal-capability-recovery`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:i(n.host_capacity_pending?`capabilities.hostCapacityPartialWrite`:`capabilities.partialWrite`)}),(0,z.jsx)(`p`,{children:i(n.host_capacity_pending?`capabilities.hostCapacityPartialWriteDescription`:`capabilities.partialWriteDescription`)}),(0,z.jsx)(`small`,{children:n.recommended_action})]}),(0,z.jsxs)(`button`,{onClick:t,type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":!0,size:15}),i(`capabilities.refreshSource`)]})]}):null,r?(0,z.jsxs)(`section`,{className:`personal-capability-preview`,"aria-label":i(`capabilities.preview`),children:[(0,z.jsx)(`strong`,{children:i(`capabilities.preview`)}),(0,z.jsx)(`span`,{children:i(`machine.action.${r.action}`)}),r.codex_host_capacity?(0,z.jsx)(`span`,{children:i(r.codex_host_capacity.write_required?`drawer.subagentHostCapacityRaise`:`drawer.subagentHostCapacityReady`,{configured:r.codex_host_capacity.configured_children??i(`drawer.subagentHostCapacityImplicit`),required:r.codex_host_capacity.required_children})}):null,(0,z.jsx)(`small`,{children:i(`capabilities.previewLocked`)})]}):null]})}function TS({callbacks:e,catalog:t,goalId:n,notification:r,onApplied:i,onNotificationChanged:a}){let{locale:o,t:s}=Ji(),c=(0,R.useMemo)(()=>vS(t.capabilities,o),[t.capabilities,o]),[l,u]=(0,R.useState)(()=>c[0]?.capability_id??``),d=(0,R.useMemo)(()=>c.find(e=>e.capability_id===l)??c[0],[c,l]),f=(0,R.useMemo)(()=>d?dS(d,o):void 0,[o,d]),{apply:p,changeDraft:m,changeJson:h,changeMode:g,editorMode:_,jsonDraft:v,jsonValid:y,error:b,mutation:x,preview:S}=CS({goalId:n,onApplied:i,selected:f,t:s}),{busy:C,draft:w,partialWrite:T,preview:E}=x;if(!d||!f)return(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:s(`capabilities.empty`)});let D=f.available_scopes.includes(`goal`),O=pS(f,`goal`),k=f.configuration_editor.read_only_reason??s(D?`capabilities.previewOnly`:`capabilities.machineOnly`);async function A(){if(!f||!O||C||!y)return;let e=rS(f.configuration_editor,w,f.default);await S(e)}async function ee(){!O||C||await S(null)}return(0,z.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,z.jsx)(yS,{capabilities:t.capabilities,locale:o,onSelect:u,scope:`goal`,selectedCapabilityId:f.capability_id,t:s}),(0,z.jsxs)(`article`,{"aria-label":f.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,z.jsx)(bS,{capability:d,locale:o,source:f.effective_configuration?.source}),(0,z.jsx)(gS,{available:O,t:s,description:k}),f.capability_id===`lark_event_inbox`?(0,z.jsxs)(`section`,{className:`personal-capability-linked-setting`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:s(`capabilities.larkInboxNotificationSetting`)}),(0,z.jsx)(`p`,{children:s(`capabilities.larkInboxNotificationDescription`)})]}),(0,z.jsx)(SS,{callbacks:e,goalId:n,notification:r,onChanged:a})]}):null,O?(0,z.jsxs)(z.Fragment,{children:[_===`json`||!f.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,z.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,z.jsxs)(`button`,{disabled:!!C||!y,onClick:g,type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),s(_===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,_===`guided`?(0,z.jsx)(`section`,{className:`personal-capability-field-summary`,children:(0,z.jsx)(cS,{disabled:!!C,copy:fS(o),editor:f.configuration_editor,onChange:m,value:w,enabledAction:(0,z.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:g,type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),s(`machine.editJson`)]})})}):(0,z.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`goal-configuration-json`,children:[(0,z.jsx)(`span`,{children:s(`capabilities.jsonConfiguration`)}),(0,z.jsx)(`textarea`,{id:`goal-configuration-json`,"aria-describedby":`goal-configuration-json-help`,disabled:!!C,onChange:e=>h(e.target.value),rows:12,spellCheck:!1,value:v}),(0,z.jsx)(`small`,{id:`goal-configuration-json-help`,children:s(`capabilities.jsonHelp`)}),y?null:(0,z.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:s(`capabilities.jsonInvalid`)})]})]}):null,(0,z.jsx)(wS,{mutationError:b,onApplied:i,partialWrite:T,preview:E}),O?(0,z.jsxs)(`footer`,{className:`personal-capability-actions`,children:[f.current&&f.available_scopes.includes(`machine`)?(0,z.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void ee(),type:`button`,children:s(`capabilities.restoreInheritance`)}):null,(0,z.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void A(),type:`button`,children:s(C===`preview`?`common.loading`:`capabilities.previewChanges`)}),(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!C||!E||!y,onClick:()=>void p(),type:`button`,children:s(C===`apply`?`common.loading`:`capabilities.applyPreview`)})]}):null,(0,z.jsx)(mS,{values:[{label:s(`capabilities.goalValue`),value:f.current},{label:s(f.machine_current?`capabilities.machineValue`:`capabilities.defaultValue`),value:f.machine_current??f.default}],t:s},d.capability_id)]})]})}function ES({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1);function d(){t&&(u(!0),c(null),a_(t).then(o).catch(e=>c(e instanceof Error?e.message:i(`capabilities.loadFailed`))).finally(()=>u(!1)))}return(0,R.useEffect)(d,[t]),t?l&&!a?(0,z.jsxs)(`p`,{"aria-live":`polite`,className:`personal-capability-empty`,children:[(0,z.jsx)(zm,{className:`personal-spin`,size:18}),i(`capabilities.loading`)]}):s?(0,z.jsxs)(`section`,{className:`personal-capability-error`,role:`alert`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:i(`capabilities.loadFailed`)}),(0,z.jsx)(`small`,{children:s})]}),(0,z.jsxs)(`button`,{onClick:d,type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":!0,size:15}),i(`capabilities.retry`)]})]}):a?(0,z.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":a.revision,children:[(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),i(`capabilities.atomicOverride`)]}),(0,z.jsx)(`p`,{children:i(`capabilities.atomicOverrideDescription`)})]}),(0,z.jsx)(TS,{callbacks:e,catalog:a.capability_catalog,goalId:t,notification:n,onApplied:d,onNotificationChanged:r})]}):null:(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:i(`capabilities.chooseGoal`)})}function DS(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function OS(e,t){let n=t?.machine_namespace;return n?e?.machine_configuration?.namespaces[n]:void 0}function kS(e,t,n){let r={...DS(e.default),...DS(t),...n};return e.capability_id===`steward_executor`&&(Object.hasOwn(n,`selection_policy`)||Object.hasOwn(n,`eligible_endpoints`))&&(r.schema_version=DS(e.default).schema_version),r}function AS(e,t){for(let n of e.configuration_editor.fields){let e=t[n.key];if(n.required&&(e==null||e===``))return!1}if(e.capability_id===`periodic_report`&&t.enabled===!0)return!!(String(t.profile_preset??``).trim()&&String(t.route_ref??``).trim()&&String(t.timezone??``).trim());if(e.capability_id===`steward_executor`){let e=String(t.selection_policy??`preferred`),n=String(t.executor_endpoint??``),r=Array.isArray(t.eligible_endpoints)?t.eligible_endpoints.map(e=>String(e)):[];return e===`flexible`?r.length>0&&r.includes(n)&&new Set(r).size===r.length:r.length===0}return!0}function jS(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}catch{return null}}function MS(e){return e?e===`absent`?e:e.replace(/^sha256:/,``).slice(0,12):`—`}function NS(){let{locale:e,t}=Ji(),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)({}),[c,l]=(0,R.useState)(`{}`),[u,d]=(0,R.useState)(`guided`),[f,p]=(0,R.useState)(null),[m,h]=(0,R.useState)(`upsert`),[g,_]=(0,R.useState)(null),[v,y]=(0,R.useState)(null),[b,x]=(0,R.useState)(`load`),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),E=(0,R.useMemo)(()=>vS(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=>pS(e,`machine`))??E[0],k=O?dS(O,e):void 0,A=OS(n,k),ee=!!(k?.machine_namespace&&A),j=!!(k&&pS(k,`machine`)),M=(0,R.useMemo)(()=>jS(c),[c]),te=k?u===`json`?M:kS(k,A,o):null,ne=!!(k&&(u===`json`?M:AS(k,te??{})));async function N(){r(await i_())}(0,R.useEffect)(()=>{let e=!0;return i_().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,R.useEffect)(()=>{if(!k)return;let e=OS(n,k),t=rS(k.configuration_editor,e??k.default,k.default),r=kS(k,e,t);s(t),l(JSON.stringify(r,null,2)),d(j?`guided`:`json`),p(null),h(`upsert`),y(null)},[n,i,e]);function P(e,t){s(n=>k?.capability_id===`periodic_report`?aS(n,e,t):{...n,[e]:t}),p(null),h(`upsert`),C(null),T(null)}function re(e){if(k){if(e===`json`)l(JSON.stringify(kS(k,A,o),null,2));else if(M)s(rS(k.configuration_editor,M,k.default));else{C(t(`machine.jsonInvalid`));return}d(e),p(null),h(`upsert`),C(null)}}async function ie(){if(!(!j||!k?.machine_namespace||!te||!ne||b)){x(`preview`),C(null),T(null);try{h(`upsert`),p(await c_(k.machine_namespace,te))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function ae(){if(!(!j||!k?.machine_namespace||!ee||b)){x(`preview`),C(null),T(null);try{h(`remove`),p(await u_(k.machine_namespace))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function F(){if(!j||!k?.machine_namespace||!f||b||m===`upsert`&&!te)return;x(`apply`),C(null);let e=m;try{let n=e===`remove`?await d_(k.machine_namespace,f.plan_revision):await l_(k.machine_namespace,te,f.plan_revision);_(n),p(null),h(`upsert`),y(null),await N(),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 oe(){if(!(!g?.transaction_id||b)){x(`rollback-preview`),C(null);try{y(await f_(g.transaction_id))}catch(e){C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}async function I(){if(!(!g?.transaction_id||!v||b)){x(`rollback`),C(null);try{await p_(g.transaction_id,v.plan_revision),_(null),y(null),p(null),await N(),T(t(`machine.rolledBack`))}catch(e){y(null),C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}return b===`load`?(0,z.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:t(`common.loading`)}):k?(0,z.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n?.revision,children:[(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),t(`machine.liveDefault`)]}),(0,z.jsx)(`p`,{children:t(`machine.liveDefaultDescription`)})]}),(0,z.jsxs)(`div`,{className:`personal-capability-body`,children:[n?.status===`invalid`?(0,z.jsxs)(`section`,{className:`personal-machine-error`,"data-testid":`machine-invalid-repair`,role:`alert`,children:[(0,z.jsx)(`strong`,{children:t(`machine.invalidStoredConfiguration`)}),(0,z.jsx)(`p`,{children:t(`machine.invalidStoredConfigurationDescription`)})]}):null,(0,z.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,z.jsx)(yS,{capabilities:E,locale:e,onSelect:a,scope:`machine`,selectedCapabilityId:k.capability_id,t}),(0,z.jsxs)(`article`,{"aria-label":k.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,z.jsx)(bS,{capability:O,locale:e,source:k.available_scopes.includes(`machine`)?ee?`machine_default`:`capability_default`:void 0}),(0,z.jsx)(gS,{available:j,t,description:k.available_scopes.includes(`machine`)?t(`machine.editorUnavailableDescription`):t(`machine.goalOnly`)}),k.capability_id===`periodic_report`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:A?.schedule?e===`zh-CN`?`日历与阶段汇报`:`Calendar and stage reports`:t(`machine.periodicReportActivation`)}),(0,z.jsx)(`p`,{children:A?.schedule?A.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,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.changeQualityActivation`)}),(0,z.jsx)(`p`,{children:t(`machine.changeQualityActivationDescription`)})]})]}):null,k.capability_id===`todo_replan_cadence`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.replanCadenceActivation`)}),(0,z.jsx)(`p`,{children:t(`machine.replanCadenceActivationDescription`)})]})]}):null,k.capability_id===`pull_request_review`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e===`zh-CN`?`只改变队列排序`:`Queue ordering only`}),(0,z.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,j?(0,z.jsxs)(z.Fragment,{children:[u===`json`||!k.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,z.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,z.jsxs)(`button`,{onClick:()=>re(u===`guided`?`json`:`guided`),type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),t(u===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,u===`guided`?(0,z.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,z.jsx)(cS,{copy:fS(e),disabled:!!b,editor:k.configuration_editor,onChange:P,value:o,enabledAction:(0,z.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:()=>re(`json`),type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),t(`machine.editJson`)]})}),ne?null:(0,z.jsx)(`p`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.requiredFields`)})]}):(0,z.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`machine-configuration-json`,children:[(0,z.jsx)(`span`,{children:t(`machine.jsonConfiguration`)}),(0,z.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,z.jsx)(`small`,{id:`machine-configuration-json-help`,children:t(`machine.jsonConfigurationHelp`)}),M?null:(0,z.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.jsonInvalid`)})]})]}):null,S?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:S}):null,w?(0,z.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,z.jsx)(hm,{"aria-hidden":!0,size:16}),w]}):null,f?(0,z.jsxs)(`section`,{"aria-label":t(`machine.preview`),className:`personal-machine-preview`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.preview`)}),(0,z.jsx)(`span`,{children:t(`machine.action.${f.action}`)})]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.currentRevision`)}),(0,z.jsx)(`dd`,{title:f.current_revision,children:MS(f.current_revision)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.desiredRevision`)}),(0,z.jsx)(`dd`,{title:f.desired_revision,children:MS(f.desired_revision)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.changedNamespaces`)}),(0,z.jsx)(`dd`,{children:f.changed_namespaces.join(`, `)||t(`common.none`)})]})]}),(0,z.jsx)(`p`,{children:t(`machine.previewLocked`)})]}):null,g?.rollback_available&&g.transaction_id?(0,z.jsxs)(`section`,{className:`personal-machine-rollback`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.rollbackAvailable`)}),(0,z.jsx)(`p`,{children:t(v?`machine.rollbackPreviewDescription`:`machine.rollbackDescription`)})]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!!b||!!(v&&!v.rollback_allowed),onClick:()=>void(v?I():oe()),type:`button`,children:[(0,z.jsx)($m,{"aria-hidden":!0,size:15}),t(b===`rollback`||b===`rollback-preview`?`common.loading`:v?`machine.confirmRollback`:`machine.previewRollback`)]})]}):null,j?(0,z.jsxs)(`footer`,{className:`personal-capability-actions`,children:[ee?(0,z.jsxs)(`button`,{className:`is-danger`,disabled:!!b,onClick:()=>void ae(),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),t(`machine.previewRemoval`)]}):null,(0,z.jsx)(`button`,{disabled:!!b||!ne,onClick:()=>void ie(),type:`button`,children:t(b===`preview`?`common.loading`:`machine.previewChanges`)}),(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!b||!f,onClick:()=>void F(),type:`button`,children:t(b===`apply`?`common.loading`:`machine.applyPreview`)})]}):null,k.available_scopes.includes(`machine`)?(0,z.jsx)(mS,{values:[{label:t(`machine.currentValue`),value:A},{label:t(`capabilities.defaultValue`),value:k.default}],t},k.capability_id):null]})]})]})]}):(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:t(`machine.capabilityEmpty`)})}function PS(e,t){return t(e===`invalid`?`machine.credentialInvalid`:e===`configured`?`machine.credentialConfigured`:`machine.credentialAbsent`)}function FS(e,t){return t(e===`machine_store`?`machine.credentialSourceMachine`:e===`service_environment`?`machine.credentialSourceEnvironment`:`machine.credentialSourceUnset`)}function IS(){let{t:e}=Ji(),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(null),p=(0,R.useCallback)(async()=>{c(`load`);try{let e=await n_();n(e),o(String(e.base_url.value??``))}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}},[e]);(0,R.useEffect)(()=>{p()},[p]);async function m(t,r){c(`store`),u(null),f(null);try{let e=await r_(t);n(e),o(String(e.base_url.value??``)),i(``),f(r)}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}}if(!t&&s===`load`)return(0,z.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:e(`common.loading`)});let h=t?`${PS(t.provider_key.configured?`configured`:`absent`,e)} · ${FS(t.provider_key.source,e)}`:``,g=t?`${t.base_url.value??e(`machine.credentialAbsent`)} · ${FS(t.base_url.source,e)}`:``;return(0,z.jsxs)(`section`,{className:`personal-operator-credential`,"data-testid":`operator-credential-settings`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(Fm,{"aria-hidden":!0,size:17}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e(`machine.credentialTitle`)}),(0,z.jsx)(`p`,{children:e(`machine.credentialDescription`)})]}),(0,z.jsx)(`span`,{className:`personal-operator-credential-status`,children:t?PS(t.status,e):e(`common.loading`)})]}),t?(0,z.jsxs)(`dl`,{className:`personal-operator-credential-readback`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialApiKey`)}),(0,z.jsx)(`dd`,{children:h})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialFingerprint`)}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.provider_key.fingerprint??e(`common.none`)})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialBaseUrl`)}),(0,z.jsx)(`dd`,{children:g})]})]}):null,t?.status===`invalid`&&t.repair?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:t.repair}):null,(0,z.jsxs)(`label`,{htmlFor:`operator-credential-api-key`,children:[(0,z.jsx)(`span`,{children:e(`machine.credentialApiKey`)}),(0,z.jsx)(`input`,{autoComplete:`off`,disabled:!!s,id:`operator-credential-api-key`,onChange:e=>i(e.target.value),placeholder:e(`machine.credentialApiKeyPlaceholder`),type:`password`,value:r})]}),(0,z.jsxs)(`label`,{htmlFor:`operator-credential-base-url`,children:[(0,z.jsx)(`span`,{children:e(`machine.credentialBaseUrl`)}),(0,z.jsx)(`input`,{autoComplete:`off`,disabled:!!s,id:`operator-credential-base-url`,onChange:e=>o(e.target.value),placeholder:e(`machine.credentialBaseUrlPlaceholder`),type:`text`,value:a})]}),l?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:l}):null,d?(0,z.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,z.jsx)(hm,{"aria-hidden":!0,size:16}),d]}):null,(0,z.jsxs)(`footer`,{className:`personal-operator-credential-actions`,children:[(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!s||!r.trim()&&!a.trim(),onClick:()=>void m({...r.trim()?{provider_key:r}:{},...a.trim()?{base_url:a}:{}},e(`machine.credentialStored`)),type:`button`,children:e(s===`store`?`common.loading`:`machine.credentialStore`)}),(0,z.jsxs)(`button`,{disabled:!!s||t?.provider_key.configured!==!0,onClick:()=>void m({clear_provider_key:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearKey`)]}),(0,z.jsxs)(`button`,{disabled:!!s||t?.base_url.configured!==!0,onClick:()=>void m({clear_base_url:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearUrl`)]})]}),(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),e(`machine.credentialTitle`)]}),(0,z.jsx)(`p`,{children:e(`machine.credentialBoundary`)})]})]})}var LS={appearance:Km,capabilities:sh,language:Im,lark:ah,machine:rh,provider:Fm};function RS({callbacks:e,focusGoalConnection:t=!1,goals:n,initialGoalId:r,initialTab:i=`lark`,goalNotifications:a,onChanged:o,onClose:s,onThemeChange:c,theme:l}){let{locale:u,setLocale:d,t:f}=Ji(),[p,m]=(0,R.useState)(i),h=(0,R.useRef)(null);(0,R.useEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{if(e.scrollWidth<=e.clientWidth)return;let t=e.querySelector(`[aria-current="page"]`);if(!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=r.leftn.right?r.right-n.right:0;i&&(e.scrollLeft+=i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[p]);let g=[...r?[{key:`capabilities`,label:f(`capabilities.title`)}]:[],{key:`provider`,label:f(`settings.modelProvider`)},{key:`machine`,label:f(`settings.globalCapabilities`)},{key:`lark`,label:`Lark`},{key:`appearance`,label:f(`settings.appearance`)},{key:`language`,label:f(`settings.language`)}],_=[{label:f(`settings.languageEnglish`),value:`en`},{label:f(`settings.languageSimplifiedChinese`),value:`zh-CN`}],v={appearance:{title:f(`settings.appearance`)},capabilities:{title:f(`capabilities.title`)},language:{title:f(`settings.language`)},lark:{title:`Lark`},machine:{title:f(`settings.globalCapabilities`)},provider:{title:f(`settings.modelProvider`)}}[p];return(0,z.jsxs)(`section`,{"aria-label":f(`settings.title`),className:`personal-settings-page`,"data-pw-theme":l,children:[(0,z.jsxs)(`aside`,{className:`personal-settings-sidebar`,children:[(0,z.jsxs)(`button`,{autoFocus:!0,className:`personal-settings-back`,onClick:s,type:`button`,children:[(0,z.jsx)(om,{size:17}),(0,z.jsx)(`span`,{children:f(`settings.back`)})]}),(0,z.jsx)(`div`,{className:`personal-settings-title`,children:(0,z.jsx)(`strong`,{children:f(`settings.title`)})}),(0,z.jsx)(`nav`,{"aria-label":f(`settings.categories`),className:`personal-settings-tabs`,ref:h,children:g.map(e=>{let t=LS[e.key];return(0,z.jsxs)(`button`,{"aria-current":p===e.key?`page`:void 0,onClick:()=>m(e.key),type:`button`,children:[(0,z.jsx)(t,{size:17}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:e.label})})]},e.key)})})]}),(0,z.jsxs)(`main`,{className:`personal-settings-body`,children:[(0,z.jsx)(`header`,{className:`personal-settings-header`,children:(0,z.jsx)(`div`,{children:(0,z.jsx)(`h1`,{children:v.title})})}),p===`lark`?(0,z.jsx)(tS,{embedded:!0,focusGoalConnection:t,goals:n,initialGoalId:r,onChanged:o,onClose:s}):null,p===`provider`?(0,z.jsx)(`div`,{className:`personal-provider-settings`,children:(0,z.jsx)(IS,{})}):null,p===`machine`?(0,z.jsx)(NS,{}):null,p===`capabilities`?(0,z.jsx)(ES,{callbacks:e,goalId:r,notification:a.find(e=>e.goalId===r),onChanged:o}):null,p===`appearance`?(0,z.jsx)(`section`,{className:`personal-detail-card personal-appearance-settings`,children:(0,z.jsxs)(`div`,{className:`personal-settings-choice-group`,role:`radiogroup`,"aria-label":f(`settings.workspaceTheme`),children:[(0,z.jsxs)(`button`,{"aria-checked":l===`loopx`,onClick:()=>c(`loopx`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-loopx`}),(0,z.jsx)(`strong`,{children:f(`settings.themeLoopx`)})]}),(0,z.jsxs)(`button`,{"aria-checked":l===`paper`,onClick:()=>c(`paper`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-paper`}),(0,z.jsx)(`strong`,{children:f(`settings.themeDefault`)})]}),(0,z.jsxs)(`button`,{"aria-checked":l===`brutal`,onClick:()=>c(`brutal`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-brutal`}),(0,z.jsx)(`strong`,{children:f(`settings.themeHighContrast`)})]})]})}):null,p===`language`?(0,z.jsx)(`section`,{className:`personal-settings-card`,children:(0,z.jsx)(`div`,{"aria-label":f(`settings.language`),className:`personal-language-options`,role:`radiogroup`,children:_.map(e=>(0,z.jsxs)(`button`,{"aria-checked":u===e.value,className:u===e.value?`is-selected`:``,onClick:()=>d(e.value),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:e.label})}),u===e.value?(0,z.jsx)(hm,{"aria-hidden":!0,size:17}):null]},e.value))})}):null]})]})}var zS=`loopx-pw-theme`,BS=`loopx`;function VS(){try{let e=window.localStorage.getItem(zS);return e===`loopx`||e===`paper`||e===`brutal`?e:BS}catch{return BS}}function HS(e){try{window.localStorage.setItem(zS,e)}catch{}}function US({drawer:e,drawerMode:t=`panel`,drawerOpen:n,main:r,mobileSidebarOpen:i=!1,onCloseMobileSidebar:a,sidebar:o,theme:s=`loopx`}){let{t:c}=Ji(),l=(0,R.useRef)(null),u=(0,R.useRef)(null);return(0,R.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,z.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,z.jsx)(`button`,{"aria-hidden":!0,className:`personal-sidebar-backdrop`,onClick:a,tabIndex:-1,type:`button`}):null,(0,z.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,z.jsxs)(`div`,{className:`personal-workspace-sidebar-inner`,children:[i?(0,z.jsxs)(`button`,{className:`personal-sr-only`,onClick:a,type:`button`,children:[c(`common.close`),` `,c(`header.goalNavigation`)]}):null,o]})}),(0,z.jsx)(`main`,{"aria-hidden":i||void 0,className:`personal-workspace-main`,inert:i||void 0,children:r}),n?(0,z.jsx)(`aside`,{className:`personal-workspace-drawer`,"data-context-drawer":!0,"data-drawer-mode":t,children:e}):null]})}function WS(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 GS(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 KS(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 qS({goals:e,onSelectGoal:t,onRetry:n,systemHealth:r}){let{locale:i,t:a}=Ji(),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=[];e.filter(e=>!e.loadState).forEach(e=>{let t=Jd(e);t===`history`?u.push(e):t!==`stopped`&&l[t].push(e)});let d=e=>(0,z.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,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`span`,{className:`personal-home-goal-meta`,children:e.agentLaneCount&&e.agentLaneCount>1?a(`header.workAgentCount`,{count:e.agentLaneCount}):e.agentLabel??e.agentId}),(0,z.jsx)(`p`,{children:e.loadError?a(`startup.error.${e.loadError}`):e.needsYou??e.nextSentence}),(0,z.jsxs)(`footer`,{children:[(0,z.jsx)(`span`,{children:e.loadState?a(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Yi(e.state,i)}),(0,z.jsx)(`small`,{title:e.latestActivity,children:e.loadState?``:e.latestActivity?KS(e.latestActivity,i,a):e.agentTodos.length?a(`home.taskCount`,{count:e.agentTodos.length}):a(`home.noActivity`)})]})]},e.goalId);return(0,z.jsxs)(`section`,{"aria-label":a(`home.workspace`),className:`personal-home-board`,children:[r&&(!r.ok||r.issues.length>0||r.freshnessWarning)?(0,z.jsxs)(`div`,{className:`personal-system-health-banner`,role:`alert`,children:[(0,z.jsxs)(`div`,{className:`personal-system-health-header`,children:[(0,z.jsx)(ym,{size:15}),(0,z.jsx)(`strong`,{children:a(`home.systemHealth`,{summary:r.summary})}),r.freshnessWarning?(0,z.jsxs)(`small`,{children:[`(`,r.freshnessWarning,`)`]}):null]}),r.issues.length>0?(0,z.jsx)(`ul`,{className:`personal-system-health-issues`,children:r.issues.map((e,t)=>(0,z.jsx)(`li`,{children:e},t))}):null]}):null,o.some(e=>e.loadState)?(0,z.jsxs)(`section`,{className:`personal-home-lane`,"aria-live":`polite`,children:[(0,z.jsx)(`header`,{children:a(`startup.progress`,{loaded:o.filter(e=>!e.loadState).length,total:o.length})}),s?(0,z.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`status`,children:[(0,z.jsx)(`span`,{children:a(`startup.failedCount`,{count:s})}),(0,z.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(d)]}):null,(0,z.jsx)(`div`,{className:`personal-home-lanes`,children:c.filter(e=>l[e.key].length>0).map(e=>(0,z.jsxs)(`section`,{className:`personal-home-lane is-${e.key}`,"data-testid":`personal-home-lane-${e.key}`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`i`,{}),e.label]}),(0,z.jsx)(`b`,{children:l[e.key].length})]}),(0,z.jsx)(`div`,{className:`personal-home-lane-list`,children:l[e.key].map(d)})]},e.key))}),u.length?(0,z.jsxs)(`details`,{className:`personal-home-history`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:a(`home.history`)}),(0,z.jsx)(`b`,{children:u.length}),(0,z.jsx)(`small`,{children:a(`home.completedGoals`)})]}),(0,z.jsx)(`div`,{children:u.map(d)})]}):null]})}function JS({items:e,onSelect:t,reportState:n}){let{locale:r,t:i}=Ji();return(0,z.jsxs)(`section`,{className:`personal-object-list personal-files-list`,"data-testid":`personal-goal-outputs`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:i(`files.title`)}),(0,z.jsx)(`span`,{children:e.length})]}),n?.loading?(0,z.jsxs)(`p`,{className:`personal-object-list-state`,role:`status`,children:[(0,z.jsx)(Qm,{className:`is-spinning`,size:14}),i(`files.loadingReports`)]}):null,n?.error?(0,z.jsxs)(`p`,{className:`personal-object-list-state is-error`,role:`alert`,children:[(0,z.jsx)(ym,{size:14}),i(`files.reportLoadFailed`),`: `,n.error]}):null,!n?.loading&&!n?.error&&e.length===0?(0,z.jsxs)(`p`,{className:`personal-object-list-state`,children:[(0,z.jsx)(jm,{size:14}),i(`files.empty`)]}):null,e.map(e=>(0,z.jsxs)(`button`,{"data-output-kind":e.output.kind,onClick:()=>t({item:e.output,kind:`output`}),type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-file-icon`,children:(0,z.jsx)(jm,{size:16})}),(0,z.jsx)(`strong`,{children:e.output.title}),e.output.report?(0,z.jsx)(`em`,{children:i(`files.reportDelta`,{added:e.output.report.addedCount,changed:e.output.report.changedCount})}):null,(0,z.jsx)(`p`,{children:e.output.summary??e.output.safePreview??e.output.kind??i(`files.emptySummary`)}),(0,z.jsx)(`small`,{title:e.output.createdAt,children:[e.output.kind===`report`?i(`files.verifiedReport`):null,KS(e.output.createdAt,r,i)].filter(Boolean).join(` · `)})]},e.id))]})}function YS({agentLabel:e,messages:t,onClose:n,onDraftTask:r,onOpenConversation:i,title:a}){let{t:o}=Ji(),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,R.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,z.jsxs)(`aside`,{"aria-label":o(`conversation.receipt`),className:`personal-manager-conversation-tray`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(fm,{size:16}),(0,z.jsx)(`strong`,{children:a??o(`conversation.title`)}),(0,z.jsx)(`small`,{children:t.at(-1)?.pending?o(`conversation.replying`):o(`common.recently`)})]}),(0,z.jsxs)(`div`,{className:`personal-manager-conversation-actions`,children:[r&&l?(0,z.jsxs)(`button`,{className:`personal-manager-conversation-btn`,onClick:()=>r(l.text),title:o(`conversation.convertHint`),type:`button`,children:[(0,z.jsx)(Rm,{size:13}),(0,z.jsx)(`span`,{children:o(`conversation.toTask`)})]}):null,(0,z.jsx)(`button`,{className:`personal-manager-conversation-link`,onClick:i,type:`button`,children:o(`conversation.full`)}),n?(0,z.jsx)(`button`,{"aria-label":o(`conversation.close`),className:`personal-manager-conversation-close`,onClick:n,title:o(`conversation.close`),type:`button`,children:(0,z.jsx)(gh,{size:14})}):null]})]}),(0,z.jsx)(`div`,{"aria-live":`polite`,className:`personal-manager-conversation-messages`,children:c.map(t=>(0,z.jsxs)(`article`,{className:`is-${t.role}`,children:[(0,z.jsx)(`strong`,{children:t.role===`user`?o(`common.you`):t.agentLabel??e??o(`header.manager`)}),(0,z.jsxs)(`div`,{className:`personal-manager-conversation-bubble`,children:[t.role===`user`?(0,z.jsx)(`p`,{children:t.text}):(0,z.jsx)(wb,{text:t.text}),t.pending?(0,z.jsx)(`small`,{children:o(`conversation.agentPending`)}):null,(0,z.jsx)(Wy,{request:t.collaboration}),(0,z.jsx)(Vb,{delivery:t.returnDelivery})]})]},t.id))})]})}function XS({onClose:e,onOpenDetails:t,run:n}){let{t:r}=Ji();return(0,z.jsxs)(`section`,{"aria-label":r(`session.record`),className:`personal-session-record`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(fm,{size:17}),r(`session.record`)]}),(0,z.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,z.jsx)(gh,{size:15})})]}),(0,z.jsx)(`div`,{children:(0,z.jsx)(`strong`,{children:n.title})}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Agent`}),(0,z.jsx)(`dd`,{children:n.agentLabel})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`common.status`)}),(0,z.jsx)(`dd`,{children:Xi(n.sessionStatus??n.status,r)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Session`}),(0,z.jsx)(`dd`,{title:n.sessionId,children:n.sessionId})]})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:t,type:`button`,children:r(`session.details`)})]})}function ZS(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??Kd(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>Jd(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`})}qd(i)&&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 QS(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function $S(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 eC(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 tC(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 nC(e,t){let n=tC(e),r=eb(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===`team.plan`?e.status===`applied`?db(ub(e.receipt),t):t(`proposal.summary.teamPlan`,{goal:ob(e.normalized_parameters),count:ab(e.normalized_parameters)}):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`?eC(e,r,t):e.action_kind===`team.plan`?ib(e.normalized_parameters,t):$S(e.normalized_parameters,t),goalId:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:void 0,impact:r.retryOriginal?t(`actionReview.${r.reason}`):e.action_kind===`operation.execute`?t(`proposal.impact.operation`):e.action_kind===`team.plan`?e.status===`applied`?t(`proposal.teamPlan.assignedHint`):t(`proposal.impact.teamPlan`):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`):``,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:r.retryOriginal?t(`drawer.retryOriginal`):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===`team.plan`?t(e.status===`applied`?`proposal.teamPlan.viewResult`:`proposal.primary.teamPlan`):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:r.retryOriginal||e.status===`applied`&&e.action_kind!==`operation.execute`&&r.interaction!==`completed`?`error`:QS(e.status),teamPlanOutcome:e.action_kind===`team.plan`?ub(e.receipt)??void 0:void 0,teamPlanAssignments:e.action_kind===`team.plan`?sb(e.receipt,e.normalized_parameters):void 0,teamPlanGapLanes:e.action_kind===`team.plan`?cb(e.receipt,e.normalized_parameters):void 0,title:c}}function rC(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 iC(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 aC(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 oC(e,t){let n=aC(e,[`目标`,`Objective`]),r=aC(e,[`完成标准`,`Completion criteria`]),i=aC(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||iC(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 sC(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 cC(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 lC(e,t){return aC(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 uC(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 dC(e,t){let n=e.toLowerCase();return t.find(e=>n.includes(e.agentId.toLowerCase())||n.includes(e.label.toLowerCase()))}function fC(e){let t=aC(e,[`标题`,`任务标题`,`Todo 标题`]),n=aC(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 pC=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),mC=5242880,hC=4;function gC(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 _C({conversationSessionId:e,agents:t=[{agentId:`codex`,available:!0,capability:`代码与项目执行`,label:`Codex`}],callbacks:n={},goalArchiveLoadState:r={error:null,phase:`ready`},managerChannelBinding:i,managerRuntime:a,model:o,readOnly:s=!1,selectedAgentId:c,selectedGoalId:l,statusSourceControl:u}){let{locale:d,t:f}=Ji(),[p,m]=(0,R.useState)(l??null),[h,g]=(0,R.useState)(c??t.find(e=>e.available)?.agentId??`codex`),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(null),[C,w]=(0,R.useState)({}),[T,E]=(0,R.useState)(`chat`),[D,O]=(0,R.useState)(!1),[k,A]=(0,R.useState)(!1),[ee,j]=(0,R.useState)(!1),[M,te]=(0,R.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{}}}),[ne,N]=(0,R.useState)(!1),[P,re]=(0,R.useState)(null),[ie,ae]=(0,R.useState)(`queue`),[F,oe]=(0,R.useState)(``),[I,se]=(0,R.useState)([]),[L,ce]=(0,R.useState)(null),[le,ue]=(0,R.useState)(null),[de,fe]=(0,R.useState)(()=>new Set),[pe,me]=(0,R.useState)(()=>new Set),[he,ge]=(0,R.useState)(`idle`),[_e,ve]=(0,R.useState)([]),[ye,be]=(0,R.useState)([]),[xe,Se]=(0,R.useState)(!1),[Ce,we]=(0,R.useState)(VS),[Te,Ee]=(0,R.useState)({}),[De,Oe]=(0,R.useState)([]),ke=(0,R.useRef)(!1),Ae=(0,R.useRef)(NaN),je=(0,R.useRef)(null),Me=(0,R.useRef)(null),Ne=(0,R.useRef)(null),Pe=(0,R.useRef)(null),Fe=(0,R.useRef)(new Set),Ie=(0,R.useRef)(new Set),[Le,Re]=(0,R.useState)(null),B=l===void 0?p:l,ze=c??h,Be=`${B??`manager`}:${ze}`,Ve=M[Be]??``;(0,R.useEffect)(()=>{se([]),ce(null)},[Be]);function He(e,t){te(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 Ue(e){He(Be,e)}function We(e){return kh.find(t=>t.id===e)?.prompt??``}(0,R.useEffect)(()=>{let e=je.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[Ve]);let Ge=(0,R.useMemo)(()=>o.goals.map(e=>{let t=Te[e.goalId];return t?{...e,repository:{branch:t.branch,identity:t.identity,label:t.label,readOnly:!0}}:e}),[Te,o.goals]),Ke=(0,R.useMemo)(()=>Ge.filter(e=>Jd(e)===`needs_you`).length,[Ge]),qe=(0,R.useMemo)(()=>Ge.filter(e=>Jd(e)===`needs_you`&&(e.needsYouBlocking||e.state===`等你`)).length,[Ge]),V=Ge.find(e=>e.goalId===B)??null;function Je(e){Ne.current=document.activeElement instanceof HTMLElement?document.activeElement:null,Se(!1),v(e)}function Ye(){v(null),window.requestAnimationFrame(()=>{let e=Ne.current;e?.isConnected&&e.getClientRects().length?e.focus({preventScroll:!0}):document.querySelector(`.personal-mobile-menu`)?.focus({preventScroll:!0})})}let Xe=_?.kind===`settings`,Ze=B,Qe=(0,R.useMemo)(()=>{let e=Object.values(C).filter(e=>e.actionKind===`heartbeat.bind`&&e.goalId&&e.status===`applied`).map(e=>({id:`schedule:${e.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:ze,executionHistory:[],goalId:e.goalId,label:e.title,nextRunAt:f(`drawer.schedulePending`),notificationRule:f(`drawer.scheduleDefaultNotification`),schedule:e.fields.find(e=>e.key===`cadence`)?.value??f(`schedule.summary`),scheduleId:`${e.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:e.status===`applied`?`active`:`draft`,stopCondition:e.fields.find(e=>e.key===`stop_condition`)?.value??f(`drawer.scheduleDefaultStop`),timezone:e.fields.find(e=>e.key===`timezone`)?.value??`Asia/Shanghai`}})),t=[...ZS(o,Ze,f),...o.timeline??[],...e,...GS(Object.values(C)).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)||e.proposal.reviewPlan?.retryOriginal===!0||_e.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)},[Ze,o,C,ze,B,_e,f]),$e=(0,R.useMemo)(()=>x?Qe.filter(e=>e.kind===`message`?!0:e.kind===`run`?e.run.runId===x.runId:e.kind===`output`&&e.output.runId===x.runId):Qe,[x,Qe]);(0,R.useEffect)(()=>{if(!x)return;let e=Qe.find(e=>e.kind===`run`&&e.run.runId===x.runId);!e||e.kind!==`run`||JSON.stringify({completedSteps:x.completedSteps,latestActivity:x.latestActivity,messages:x.sessionMessages,sessionStatus:x.sessionStatus,status:x.status,totalSteps:x.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})&&S(e.run)},[x,Qe]);let et=(0,R.useMemo)(()=>Qe.flatMap(e=>e.kind===`message`?[e.message]:[]),[Qe]),tt=(0,R.useMemo)(()=>V?Qe.flatMap(e=>e.kind===`message`?[e.message]:[]):[],[Qe,V]);(0,R.useEffect)(()=>{V||D||et.some(e=>e.pending)&&A(!0)},[D,et,V]),(0,R.useEffect)(()=>{!V||T===`chat`||tt.some(e=>e.pending)&&j(!0)},[tt,V,T]);let nt=(0,R.useMemo)(()=>Qe.filter(e=>e.kind===`message`||e.kind===`proposal`&&(_e.includes(e.proposal.previewId)||ye.includes(e.proposal.previewId))),[Qe,_e,ye]),rt=nt[nt.length-1],it=rt?.kind===`message`?rt.message.text.length:0;(0,R.useEffect)(()=>{if(!D||!Me.current)return;let e=window.requestAnimationFrame(()=>{Me.current&&(Me.current.scrollTop=Me.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[nt.length,D,it]);let at=(0,R.useMemo)(()=>{if(_?.kind===`settings`)return null;if(_?.kind===`attention`)return{kind:`attention`,item:rf(_.item,o.attentionHistory??o.userTodos)};if(_?.kind===`goal`){let e=Ge.find(e=>e.goalId===_.item.goalId);return e?{item:e,kind:`goal`}:_}if(_?.kind!==`run`)return _;let e=Qe.find(e=>e.kind===`run`&&e.run.runId===_.item.runId);return e?{item:e.run,kind:`run`}:_},[Qe,_,Ge,o.attentionHistory,o.userTodos]);(0,R.useEffect)(()=>{if(s){Ee({}),Oe([]);return}let e=!1;return Promise.all([h_(),E_()]).then(([t,n])=>{e||(Ee(Object.fromEntries(t.map(e=>[e.goal_id,e.repository]))),Oe(n))}).catch(()=>{}),()=>{e=!0}},[s]),(0,R.useEffect)(()=>{if(!xe)return;function e(e){e.key===`Escape`&&Se(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[xe]),(0,R.useEffect)(()=>{if(B||!Qe.length)return;if(!ke.current){ke.current=!0;try{Ae.current=Date.parse(window.localStorage.getItem(`loopx-pw-last-visit`)??``),window.localStorage.setItem(`loopx-pw-last-visit`,new Date().toISOString())}catch{Ae.current=NaN}}let e=Ae.current,t=Qe.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={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};Re(e=>e?.done===r.done&&e.failed===r.failed?e:r)},[Qe,B]),(0,R.useEffect)(()=>{if(s){w({});return}let e=!1;return eg(B?{goalId:B}:{contextKind:`manager`}).then(t=>{if(e)return;let n=t.filter(e=>[`preview_ready`,`gated`,`deferred`,`applying`].includes(e.status)||eb(e).retryOriginal===!0||e.action_kind===`operation.execute`&&e.status===`applied`).map(e=>nC(e,f)),r=Object.fromEntries(n.map(e=>[e.previewId,e]));w(e=>({...e,...r})),B||be(n.map(e=>e.previewId))}).catch(()=>{}),()=>{e=!0}},[s,B,f]);async function ot(e,t={}){if(s)throw Error(f(`source.readOnlyWriteError`));let r;try{r=n.onPreviewAction?await n.onPreviewAction(e):nC(await Qh(e),f)}catch(t){if(!(t instanceof qh)||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??f(`proposal.workspaceGate.defaultSummary`))},impact:f(o?`proposal.workspaceGate.agentImpact`:`proposal.workspaceGate.selectionImpact`),previewId:`workspace-choice-${Date.now().toString(36)}`,sourceRequest:e,status:`gated`,title:f(o?`proposal.workspaceGate.agentTitle`:`proposal.workspaceGate.selectionTitle`),workspaceCandidates:i}}return ve(e=>e.includes(r.previewId)?e:[...e,r.previewId]),w(e=>({...e,[r.previewId]:r})),t.select!==!1&&v({item:r,kind:`proposal`}),r}function st(){_t(null),He(`manager:${ze}`,f(`composer.createGoalTemplate`)),window.requestAnimationFrame(()=>je.current?.focus())}async function ct(e,t){Se(!1);let r={delete:`Deleted from the owner workspace`,resume:`Resumed from the owner workspace`,stop:`Stopped from the owner workspace`},i={delete:f(`proposal.summary.lifecycleDelete`,{title:e.title}),resume:f(`proposal.summary.lifecycleResume`,{title:e.title}),stop:f(`proposal.summary.lifecycleStop`,{title:e.title})},a=null,o=!1;try{if(t===`stop`){if(Fe.current.has(e.goalId))return;Fe.current.add(e.goalId),fe(new Set(Fe.current)),v(null),a={goalId:e.goalId,next:`stopped`,optimisticApplied:!0,previous:e.activationState},ue(f(`feedback.applying`,{title:i.stop})),n.onGoalActivationStateChange?.(e.goalId,`stopped`)}if(n.onExecuteGoalLifecycle){if(t===`delete`)throw Error(`The selected status source does not authorize Goal deletion.`);let a=await n.onExecuteGoalLifecycle({goalId:e.goalId,operation:t,reason:r[t]});if(!a.projectionVerified)throw Error(`Goal lifecycle projection did not verify.`);o=!0,n.onGoalActivationStateChange?.(e.goalId,a.activationState),ue(f(`feedback.completed`,{title:i[t]})),t===`stop`&&_t(null),await ft([e.goalId]);return}let s=await ot({actionKind:`goal.lifecycle`,context:{kind:`goal_directory`,goal_id:e.goalId},idempotencyKey:`workspace-goal-${t}-${e.goalId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:t,reason:r[t]},summary:i[t]},{select:t!==`stop`});if(s.goalId!==e.goalId||s.lifecycleOperation!==t)throw v(null),Error(f(`actionReview.targetChanged`));t===`stop`&&(s.reviewPlan?.interaction===`direct`?(o=!0,await pt(s,{lifecycleProjection:a??void 0,presentation:`feedback`})):(a&&n.onGoalActivationStateChange?.(a.goalId,a.previous),ue(s.gate?f(`feedback.gateRequired`,{summary:s.gate.summary}):f(`feedback.notCompleted`,{status:s.status})),v({item:s,kind:`proposal`})))}catch(e){a&&!o&&n.onGoalActivationStateChange?.(a.goalId,a.previous),ue(f(`feedback.executionFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{t===`stop`&&(Fe.current.delete(e.goalId),fe(new Set(Fe.current)))}}function lt(e,t){Ue(f(t?e===`heartbeat`?`composer.heartbeatTemplate`:`composer.monitorTemplate`:e===`heartbeat`?`composer.heartbeatTemplateWithoutGoal`:`composer.monitorTemplateWithoutGoal`)),v(null),window.requestAnimationFrame(()=>je.current?.focus())}async function ut(e,t,r=``){let i=await n.onRequestScheduleConfig?.(e,t);if(i){ve(e=>e.includes(i.previewId)?e:[...e,i.previewId]),w(e=>({...e,[i.previewId]:i})),v({item:i,kind:`proposal`});return}if(!t){Ue(f(e===`heartbeat`?`composer.heartbeatGoalQuestion`:`composer.monitorGoalQuestion`));return}let a=Date.now().toString(36);await ot({actionKind:e===`heartbeat`?`heartbeat.bind`:`monitor.create`,context:{kind:`schedule`,goal_id:t},idempotencyKey:`workspace-${e}-${t}-${a}`,normalizedParameters:e===`heartbeat`?{agent_id:ze,cadence:sC(r),goal_id:t,stop_condition:uC(r),timezone:`Asia/Shanghai`}:{agent_id:ze,cadence:sC(r),goal_id:t,stop_condition:uC(r),target:lC(r,f),target_key:`goal-${t}`,timezone:`Asia/Shanghai`},summary:e===`heartbeat`?f(`proposal.summary.heartbeat`):f(`proposal.summary.monitor`,{target:lC(r,f)})})}async function dt(e){if(!Ie.current.has(e.todoId)){Ie.current.add(e.todoId),me(new Set(Ie.current)),ue(f(`feedback.preparingPreview`,{title:e.text}));try{await ot({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:f(`tasks.markComplete`,{name:e.text})}),ue(null)}catch(e){ue(f(`feedback.previewFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{Ie.current.delete(e.todoId),me(new Set(Ie.current))}}}function ft(e){let t=n.onReconcileStatus,r=t?t({invalidateGoalIds:e}):n.onRefresh?.();return Promise.resolve(r).catch(()=>{ue(f(`feedback.goalRefreshFailed`))})}async function pt(e,t={}){let r=e.actionKind===`team.plan`&&e.status===`error`&&[`apply_failed`,`readback_unverified`].includes(e.reviewPlan?.reason??``);if(e.reviewPlan&&!e.reviewPlan.canApply&&!r)return;let i=t.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:o.goals.find(t=>t.goalId===e.goalId)?.activationState??(e.lifecycleOperation===`stop`?`active`:`stopped`)}:null,s=t.lifecycleProjection??a;ue(f(`feedback.applying`,{title:e.title}));let c={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`pending`,reason:`apply_pending`,canApply:!1}:void 0,status:`applying`};w(t=>({...t,[e.previewId]:c})),i&&v({item:c,kind:`proposal`}),s&&!s.optimisticApplied&&n.onGoalActivationStateChange?.(s.goalId,s.next);try{if(n.onApplyProposal){await n.onApplyProposal(e);let t={...e,status:`applied`};w(n=>({...n,[e.previewId]:t})),i&&v({item:t,kind:`proposal`}),ue(f(`feedback.completed`,{title:e.title})),e.actionKind===`goal.lifecycle`&&((e.lifecycleOperation===`stop`||e.lifecycleOperation===`delete`)&&_t(null),e.lifecycleOperation===`delete`&&e.goalId&&n.onGoalDeleted?.(e.goalId),ft(e.goalId?[e.goalId]:void 0));return}let t=await tg(e.previewId);if(t.proposal.proposal_id!==e.previewId||t.proposal.action_kind!==e.actionKind||e.actionKind===`goal.lifecycle`&&(t.proposal.normalized_parameters.goal_id!==e.goalId||tC(t.proposal)!==e.lifecycleOperation))throw new qh(f(`actionReview.targetChanged`),{error_code:`action_response_mismatch`});let r=nC(t.proposal,f);if(w(t=>({...t,[e.previewId]:r})),i&&v({item:r,kind:`proposal`}),r.reviewPlan?.interaction!==`completed`){s&&n.onGoalActivationStateChange?.(s.goalId,s.previous),v({item:r,kind:`proposal`}),ue(t.proposal.status===`stale`?f(`feedback.stale`):f(`actionReview.${r.reviewPlan.reason}`));return}ue(f(`feedback.completed`,{title:r.title})),r.actionKind===`todo.create`&&await n.onRefresh?.(),r.actionKind===`goal.lifecycle`&&(r.lifecycleOperation===`stop`||r.lifecycleOperation===`delete`)&&_t(null),r.actionKind===`goal.lifecycle`&&r.lifecycleOperation===`delete`&&r.goalId&&n.onGoalDeleted?.(r.goalId),r.actionKind===`goal.lifecycle`&&ft(r.goalId?[r.goalId]:void 0)}catch(t){if(s&&n.onGoalActivationStateChange?.(s.goalId,s.previous),t instanceof qh&&t.payload.error_code===`protected_action`){let r=t.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??t.message)},status:`gated`};w(t=>({...t,[e.previewId]:a})),v({item:a,kind:`proposal`}),ue(f(`feedback.gateRequired`,{summary:a.gate.summary})),e.actionKind===`goal.create`&&e.goalId&&(n.onRefresh?.(),_t(e.goalId));return}let r=t instanceof qh&&tb(t.payload),i=t instanceof qh&&t.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:t instanceof Error?t.message:String(t),status:r?`stale`:`error`};w(t=>({...t,[e.previewId]:a})),v({item:a,kind:`proposal`}),ue(f(`feedback.executionFailed`,{error:a.errorMessage}))}}function mt(){E(`chat`),S(null),j(!1),window.requestAnimationFrame(()=>{let e=Me.current?.querySelectorAll(`.personal-message.is-assistant`);e?.item(e.length-1)?.scrollIntoView({block:`start`})})}let ht={...n,onOpenRunSession:async e=>{e.goalId!==B&&_t(e.goalId),E(`chat`),await n.onOpenRunSession?.(e),S(e),v(null)},onOpenGoal:e=>{_t(e),ft([e])},onOpenGoalView:e=>{e===`chat`?mt():E(e),v(null)},onOpenOutput:e=>{e.goalId!==B&&_t(e.goalId),E(`files`),n.onOpenOutput?.(e)},onApplyProposal:pt,onCancelProposal:async e=>{v(null),w(t=>{let n={...t};return delete n[e.previewId],n});try{n.onCancelProposal?.(e),n.onCancelProposal||await ng(e.previewId)}catch(t){w(t=>({...t,[e.previewId]:e})),ue(f(`feedback.cancelFailed`,{error:t instanceof Error?t.message:String(t)}))}},onTransitionProposal:async(e,t)=>{let n=nC(await rg(e.previewId,t),f);ve(e=>e.includes(n.previewId)?e:[...e,n.previewId]),w(r=>{let i={...r};return t===`regenerate`&&delete i[e.previewId],i[n.previewId]=n,i}),v({item:n,kind:`proposal`})},onSelectWorkspaceCandidate:async(e,t)=>{e.sourceRequest&&(w(t=>{let n={...t};return delete n[e.previewId],n}),await ot({...e.sourceRequest,idempotencyKey:`${e.sourceRequest.idempotencyKey}-${t}`,normalizedParameters:{...e.sourceRequest.normalizedParameters,workspace_ref:t}}))},onPreviewAction:ot,onRequestScheduleConfig:(e,t)=>lt(e,t),onOpenNotificationSettings:e=>Je({goalId:e,kind:`settings`,tab:`lark`}),onFetchNotificationTargets:()=>Ng(),onSetupGoalChannel:e=>Fg(e),onToggleGoalAutoNotify:e=>Ig(e),onUpdateSchedule:async(e,t)=>{let n=Date.now().toString(36),r=e.scheduleKind===`heartbeat`;await ot({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??ze,...!r&&t===`run_now`?{endpoint_id:ze}:{},...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}`})}},gt=s?{onOpenGoal:ht.onOpenGoal,onOpenGoalView:ht.onOpenGoalView,onOpenOutput:ht.onOpenOutput}:ht;function _t(e){m(e),O(!1),A(!1),j(!1),S(null),v(null),E(`tasks`),Se(!1),n.onSelectGoal?.(e)}function vt(e){g(e),n.onSelectAgent?.(e)}function yt(e){we(e),HS(e)}async function bt(r){let i=r?[]:I,a=(r??Ve).trim()||(i.length?f(`composer.imageAnalysisPrompt`):``);if(!(!a||ne)){if(P?.session_id===e&&P?.enabled&&P.active_turn_id&&e){if(i.length){ce(d===`zh-CN`?`运行中的消息投递暂不支持图片,请暂停后发送。`:`Pause execution before sending images.`);return}N(!0);try{let t=await Sg(e,a,ie);r||Ue(``),oe(d===`zh-CN`?`${ie===`queue`?`已排队,等待后续回合`:ie===`inbox`?`已进入收件箱`:`已提交纠偏`} · ${t.status}`:`${ie}: ${t.status}`)}catch(e){ce(e instanceof Error?e.message:String(e))}finally{N(!1)}return}r||(Ue(``),se([])),ce(null),N(!0);try{if(i.length){B?T!==`chat`&&j(!0):A(!0);let e=await n.onSendMessage?.(a,ze,B,i);e&&await ot(e);return}let e=Zb(a,{agents:t.map(e=>({agentId:e.agentId,label:e.label})),goalId:B,todos:(V?.agentTodos??[]).map(e=>({text:e.text,todoId:e.todoId}))});if(e.route===`clarify`){Ue(a);let t=f(`composer.clarifySingleAction`);e.missingFields.includes(`resume_when`)&&(t=f(`composer.clarifyDefer`)),ue(t);return}if(e.actionKind===`goal.create`){let t=oC(a,f),n=rC(t.title);await ot({actionKind:`goal.create`,context:{kind:`manager`,goal_id:null,natural_language:a},idempotencyKey:`workspace-goal-intent-${n}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:ze,completion_criteria:t.completionCriteria,execution_boundary:t.executionBoundary,goal_id:n,heartbeat:{cadence:sC(a),enabled:e.normalizedParameters.heartbeat_enabled===!0,timezone:`Asia/Shanghai`},initial_todos:t.initialTodos,objective:t.objective,permission:t.permission,stop_condition:uC(a),title:t.title,workspace_ref:`current`},summary:f(`proposal.summary.goalCreate`,{title:t.title})});return}if(B&&e.actionKind===`heartbeat.bind`){await ut(`heartbeat`,B,a);return}if(B&&e.actionKind===`monitor.create`){let e=cC(a,f);if(e){Ue(a),ue(e);return}await ut(`monitor`,B,a);return}let r=dC(a,t);if(B&&r&&e.actionKind===`agent.bind`){await ot({actionKind:`agent.bind`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-agent-bind-${B}-${r.agentId}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:r.agentId,goal_id:B},summary:`将 ${r.label} 绑定到 ${V?.title??B}`});return}if(B&&e.actionKind===`todo.create`){if(e.normalizedParameters.start_execution===!0){await ot({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-task-start-${B}-${Date.now().toString(36)}`,normalizedParameters:{endpoint_id:r?.agentId??ze,goal_id:B,start_execution:!0,text:a},summary:`交给 Agent 执行:${a.slice(0,120)}`});return}let t=r?.agentId??(/(交给|分配给|让).{0,24}(agent|codex|claude|kiro|kimi)/iu.test(a)?ze:null);await ot({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-todo-create-${B}-${Date.now().toString(36)}`,normalizedParameters:{...t?{endpoint_id:t}:{},goal_id:B,text:fC(a)},summary:`创建 Todo:${fC(a)}`});return}let o=V?.agentTodos.find(e=>a.includes(e.todoId)||a.includes(e.text)),s=typeof e.normalizedParameters.operation==`string`?e.normalizedParameters.operation:null;if(B&&o&&e.actionKind===`todo.update`&&s){await ot({actionKind:`todo.update`,context:{kind:`todo`,goal_id:B,todo_id:o.todoId,natural_language:a},idempotencyKey:`workspace-todo-update-${o.todoId}-${s}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:ze,...s===`reassign`&&r?{endpoint_id:r.agentId}:{},...s===`block`?{note:a}:{},...s===`defer`&&typeof e.normalizedParameters.resume_when==`string`?{resume_when:e.normalizedParameters.resume_when}:{},goal_id:B,operation:s,todo_id:o.todoId},summary:`更新 Todo:${o.text}`});return}B?T!==`chat`&&j(!0):A(!0);let c=await n.onSendMessage?.(a,ze,B);c&&await ot(c)}catch(e){r||(Ue(a),se(i));let t=e instanceof Error?e.message:f(`feedback.sendGenericError`);ue(f(`feedback.sendFailed`,{error:t}))}finally{N(!1)}}}let xt=t.find(e=>e.agentId===ze)?.label??ze,St=!V&&Ve.startsWith(f(`composer.createGoalDraftLead`));async function Ct(e){if(!e?.length)return;let t=hC-I.length,n=Array.from(e).slice(0,Math.max(0,t)),r=n.find(e=>!pC.has(e.type)),i=n.find(e=>e.size>mC);if(t<=0){ce(f(`composer.imageCountError`,{count:hC}));return}if(r){ce(f(`composer.imageTypeError`));return}if(i){ce(f(`composer.imageSizeError`,{size:mC/1024/1024}));return}try{let t=await Promise.all(n.map(e=>gC(e,f)));se(e=>[...e,...t].slice(0,hC)),ce(e.length>n.length?f(`composer.imageCountError`,{count:hC}):null)}catch(e){ce(e instanceof Error?e.message:f(`composer.imageReadGenericError`))}finally{Pe.current&&(Pe.current.value=``)}}function wt(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 Tt(){let e=await E_();Oe(e)}async function Et(){await Promise.all([Tt(),n.onRefresh?.()])}async function Dt(){if(!(!n.onRefresh||he===`loading`)){ge(`loading`);try{await n.onRefresh(),ge(`done`)}catch{ge(`error`)}window.setTimeout(()=>ge(`idle`),1800)}}let Ot=Xe?(0,z.jsx)(RS,{callbacks:gt,focusGoalConnection:!!(_?.kind===`settings`&&_.goalId),goalNotifications:o.goalNotifications??[],goals:Ge,initialGoalId:_?.kind===`settings`?_.goalId??B:B,initialTab:_?.kind===`settings`?_.tab??`lark`:`lark`,onChanged:()=>void Et(),onClose:Ye,onThemeChange:yt,theme:Ce}):null;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{hidden:Xe,children:(0,z.jsx)(US,{drawer:at?(0,z.jsx)(ox,{agents:t,attentionHistory:o.attentionHistory??o.userTodos,onSelectAttention:e=>v({kind:`attention`,item:e}),callbacks:gt,goalNotifications:o.goalNotifications??[],goals:Ge,inspectorExpanded:y,larkConnections:s?[]:De,onClose:()=>{at.kind===`proposal`&&[`applied`,`rejected`].includes(at.item.status)&&(at.item.actionKind!==`heartbeat.bind`||at.item.status!==`applied`)&&w(e=>{let t={...e};return delete t[at.item.previewId],t}),b(!1),v(null)},onToggleInspectorSize:()=>b(e=>!e),readOnly:s,runs:Qe.flatMap(e=>e.kind===`run`?[e.run]:[]),selection:at}):null,drawerMode:at?.kind===`todo`?y?`inspector-full`:`inspector`:`panel`,drawerOpen:at!==null,mobileSidebarOpen:xe,onCloseMobileSidebar:()=>Se(!1),theme:Ce,main:(0,z.jsxs)(`div`,{className:`personal-channel`,children:[(0,z.jsx)(pb,{agents:t,managerChatOpen:D,managerChannelBinding:i,managerRuntime:a,mobileNavigationOpen:xe,onOpenGoalCapabilities:V&&!s?()=>Je({goalId:V.goalId,kind:`settings`,tab:`capabilities`}):void 0,onRefresh:n.onRefresh?()=>void Dt():void 0,onOpenNavigation:()=>Se(!0),onOpenManagerChat:()=>{A(!1),O(!0)},onSelectGoalTab:e=>{e===`chat`?mt():E(e)},onSelectAgent:vt,onReturnManagerHome:()=>{O(!1),A(!1),window.requestAnimationFrame(()=>Me.current?.scrollTo({behavior:`smooth`,top:0}))},selectedAgentId:ze,refreshState:he,readOnlySourceLabel:s?u?.activeSource.label:void 0,selectedGoal:V,selectedGoalTab:T}),B&&T===`chat`&&!s&&ze===`codex`&&n.onStartLoopX?(0,z.jsx)(Nb,{onPrepare:()=>n.onPrepareLoopX(ze,B),sessionId:e,onChange:re,onExecute:(e,t)=>n.onStartLoopX?.(e,ze,B,t)},`${B}:${ze}`):null,(0,z.jsxs)(`div`,{className:`personal-channel-scroll`,"data-active-goal-view":V?T:void 0,ref:Me,children:[B&&T===`chat`&&!s&&ze===`codex`&&e&&P?.settings.execution_config&&P.settings.agent_id?(0,z.jsx)(Fb,{sessionId:e,zh:d===`zh-CN`,refreshKey:JSON.stringify(P.deliveries)},`${e}:${P.settings.agent_id}:${P.settings.execution_config}`):null,!V&&!D&&Le&&Le.done+Le.failed>0?(0,z.jsxs)(`section`,{className:`personal-digest-card`,"aria-label":f(`digest.away`),children:[(0,z.jsx)(`strong`,{children:f(`digest.away`)}),(0,z.jsxs)(`div`,{className:`personal-digest-stats`,children:[Le.done>0?(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:Le.done}),f(`digest.completed`)]}):null,Le.failed>0?(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:Le.failed}),f(`digest.failed`)]}):null]})]}):null,!V&&!D?(0,z.jsxs)(`section`,{className:`personal-manager-greeting`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(fm,{size:20})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:f(`home.greeting`)}),(0,z.jsx)(`p`,{children:o.goals.some(e=>e.activationState===`active`&&e.loadState)?f(`startup.partial`):(0,z.jsxs)(z.Fragment,{children:[f(`home.waitingCount`,{count:Ke}),` `,qe>0?f(`home.blockingSummary`,{count:qe}):null]})})]})]}):null,V?.loadState?(0,z.jsx)(`section`,{className:`personal-manager-greeting`,role:`status`,"data-testid":`goal-status-loading`,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:f(V.loadState===`error`?`startup.goalError`:`startup.goalLoading`)}),(0,z.jsx)(`p`,{children:f(V.loadError?`startup.error.${V.loadError}`:`startup.independent`)}),V.loadState===`error`?(0,z.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,type:`button`,onClick:()=>void n.onRefresh?.(),children:f(`startup.retry`)}):null]})}):V?(0,z.jsx)(Xx,{activeTab:T,scrollRef:Me,panels:{overview:(0,z.jsx)(Yx,{active:!Xe&&T===`overview`,goal:V,items:Qe,userTodos:o.userTodos,readOnly:s,onOpenDetails:()=>v({kind:`goal`,item:V}),onSelect:v,onView:E}),tasks:(0,z.jsx)(Mx,{historyEnabled:!s,goal:V,items:Qe,onDraftTaskFromMessage:s?void 0:e=>{Ue(`创建一个 Task:${WS(e)}`),ue(f(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>je.current?.focus())},onOpenChat:mt,onQuickComplete:s?void 0:dt,onSelect:v,quickCompletingTodoIds:pe,selectedTodoId:at?.kind===`todo`?at.item.todoId:null,userTodos:o.userTodos}),files:(0,z.jsx)(JS,{items:Qe.filter(e=>e.kind===`output`),onSelect:v,reportState:o.periodicReports}),chat:(0,z.jsxs)(z.Fragment,{children:[V&&x?.goalId===V.goalId?(0,z.jsx)(XS,{onClose:()=>S(null),onOpenDetails:()=>v({item:x,kind:`run`}),run:x}):null,(0,z.jsx)(Hb,{items:$e,onSelect:v,selectedGoal:V})]})}},`${u?.activeSource.statusUrl??`/status.json`}:${V.goalId}`):D?(0,z.jsx)(Hb,{items:nt,onSelect:v,selectedGoal:null}):(0,z.jsx)(qS,{goals:Ge,onRetry:()=>void n.onRefresh?.(),onSelectGoal:_t,systemHealth:o.systemHealth})]}),(0,z.jsxs)(`div`,{className:`personal-composer-wrap`,children:[P?.session_id===e&&P?.enabled&&P.active_turn_id?(0,z.jsxs)(`label`,{className:`goal-loopx-message-mode`,children:[d===`zh-CN`?`消息处理`:`Message delivery`,(0,z.jsxs)(`select`,{"aria-label":d===`zh-CN`?`消息处理方式`:`Message delivery mode`,value:ie,onChange:e=>ae(e.target.value),children:[(0,z.jsx)(`option`,{value:`queue`,children:d===`zh-CN`?`下一轮处理`:`Next turn`}),(0,z.jsx)(`option`,{value:`inbox`,children:d===`zh-CN`?`放入收件箱`:`Inbox`}),(0,z.jsx)(`option`,{value:`steer`,children:d===`zh-CN`?`立即纠偏`:`Steer now`})]}),(0,z.jsx)(`span`,{role:`status`,children:F})]}):null,s?(0,z.jsxs)(`div`,{className:`personal-read-only-notice`,children:[(0,z.jsx)(`strong`,{children:f(`source.readOnlyNoticeTitle`)}),(0,z.jsx)(`span`,{children:f(`source.readOnlyNoticeDescription`)})]}):(0,z.jsxs)(z.Fragment,{children:[!V&&!D&&k&&et.length?(0,z.jsx)(YS,{messages:et,onClose:()=>A(!1),onOpenConversation:()=>{A(!1),O(!0)}}):null,V&&T!==`chat`&&ee&&tt.length?(0,z.jsx)(YS,{agentLabel:xt,messages:tt,onClose:()=>j(!1),onDraftTask:T===`tasks`?e=>{Ue(`创建一个 Task:${WS(e)}`),ue(f(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>je.current?.focus())}:void 0,onOpenConversation:mt,title:`${V.title} · ${xt}`}):null,le?(0,z.jsxs)(`div`,{className:`personal-action-feedback`,role:`status`,children:[(0,z.jsx)(`span`,{children:le}),(0,z.jsx)(`button`,{"aria-label":f(`common.closeActionReceipt`),onClick:()=>ue(null),type:`button`,children:(0,z.jsx)(gh,{size:14})})]}):null,(0,z.jsxs)(`details`,{className:`personal-composer-tools`,children:[(0,z.jsx)(`summary`,{children:d===`zh-CN`?`快捷提问`:`Suggestions`}),V?(0,z.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,z.jsxs)(`button`,{"aria-label":f(`composer.nextAction`),disabled:ne,onClick:()=>void bt(f(`composer.nextActionPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(Hm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.nextAction`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.agentProgress`),disabled:ne,onClick:()=>void bt(f(`composer.agentProgressPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(nh,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.agentProgress`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.monitor`),disabled:ne,onClick:()=>void bt(f(`composer.monitorShortcutTemplate`,{target:f(`schedule.defaultTarget`)})),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(mm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.monitor`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.blockers`),disabled:ne||!We(`gate`),onClick:()=>void bt(We(`gate`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(ym,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.blockers`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.evidence`),disabled:ne||!We(`evidence`),onClick:()=>void bt(We(`evidence`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(jm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.evidence`)})]})]}):(0,z.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,z.jsxs)(`button`,{"aria-label":f(`composer.globalTasks`),disabled:ne,onClick:()=>void bt(f(`composer.globalTasksPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(Hm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.globalTasks`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.globalProgress`),disabled:ne,onClick:()=>void bt(f(`composer.globalProgressPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(nh,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.globalProgress`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.createGoal`),onClick:st,title:f(`composer.createGoalHint`),type:`button`,children:[(0,z.jsx)(Xm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.createGoal`)})]})]})]},B??`manager`),St?(0,z.jsxs)(`div`,{className:`personal-goal-draft-status`,role:`status`,children:[(0,z.jsx)(`strong`,{children:f(`composer.createGoalDraft`)}),(0,z.jsx)(`span`,{children:f(`composer.createGoalDraftDescription`)})]}):null,I.length?(0,z.jsx)(`div`,{className:`personal-composer-images`,"aria-label":f(`composer.imagesPending`),children:I.map(e=>(0,z.jsxs)(`figure`,{children:[(0,z.jsx)(`img`,{alt:e.name,src:e.dataUrl}),(0,z.jsx)(`button`,{"aria-label":f(`composer.sentImageAlt`,{name:e.name}),onClick:()=>se(t=>t.filter(t=>t.id!==e.id)),type:`button`,children:(0,z.jsx)(gh,{size:13})})]},e.id))}):null,L?(0,z.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:L}):null,(0,z.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,z.jsx)(`button`,{"aria-label":f(`composer.addImage`),className:`personal-composer-attach`,disabled:ne||I.length>=hC,onClick:()=>Pe.current?.click(),title:f(`composer.attachImageHint`),type:`button`,children:(0,z.jsx)(qm,{size:17})}),(0,z.jsx)(`input`,{accept:`image/png,image/jpeg,image/webp,image/gif`,"aria-label":f(`composer.imagePicker`),className:`personal-composer-file-input`,disabled:ne||I.length>=hC,multiple:!0,onChange:e=>void Ct(e.target.files),ref:Pe,type:`file`}),(0,z.jsx)(`textarea`,{"aria-label":f(`composer.sendMessage`),onChange:e=>Ue(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),bt())},onPaste:wt,placeholder:V?f(`composer.goalPlaceholder`,{goal:V.title}):f(`composer.managerPlaceholder`),ref:je,rows:1,value:Ve}),(0,z.jsx)(`button`,{"aria-label":f(St?`composer.createGoal`:`composer.send`),disabled:!Ve.trim()&&I.length===0||ne,onClick:()=>void bt(),title:f(St?`composer.createGoalHint`:`composer.sendMessageHint`),type:`button`,children:(0,z.jsx)(nh,{size:18})})]})]})]})]}),sidebar:(0,z.jsx)(Ox,{attentionCount:Ke,goals:Ge,goalArchiveLoadState:r,goalLifecycleOperations:n.onExecuteGoalLifecycle?[`stop`,`resume`]:void 0,lifecycleBusyGoalIds:de,onRequestGoalCreate:s?void 0:st,onRequestGoalLifecycle:s&&!n.onExecuteGoalLifecycle?void 0:(e,t)=>void ct(e,t),onRetryGoalArchive:n.onRetryGoalArchive||n.onRefresh?()=>void(n.onRetryGoalArchive??n.onRefresh)?.():void 0,onOpenSettings:s?void 0:()=>Je({kind:`settings`}),onSelectGoal:_t,selectedGoalId:B,statusSourceControl:u},u?.activeSource.statusUrl??`/status.json`)})}),Ot]})}function vC(e){return(e??``).replace(/\s+/gu,` `).trim()}function yC(e,t=120){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t-1).join(``)}…`}function bC(e,t,n){let r=vC(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`):yC(r)}function xC(e,t){return t({advancing:`projection.agentAdvancingGoal`,idle:`projection.agentIdle`,needs_you:`projection.agentNeedsDecision`,stopped:`projection.agentStopped`,waiting_external:`projection.agentWaitingExternal`}[e])}function SC({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 CC=`/status.json`,wC=`loopx-status-source-catalog-v1`,TC={id:`local`,kind:`local`,label:`本机`,readOnly:!1,statusUrl:CC};function EC(e,t){let n=xh(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 DC(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 OC(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=EC(n.statusUrl,t);if(!r||r.length>48||!(`url`in i))return null;let a=vx(n.hostAlias)?n.hostAlias.trim():void 0;return{...a?{hostAlias:a}:{},id:DC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url}}function kC(){return{schemaVersion:1,sources:[TC]}}function AC(e,t){try{let n=e.getItem(wC);if(!n)return kC();let r=JSON.parse(n);if(r.schemaVersion!==1||!Array.isArray(r.sources))return kC();let i=new Set([TC.statusUrl]);return{schemaVersion:1,sources:[TC,...r.sources.flatMap(e=>{let n=OC(e,t);return!n||i.has(n.statusUrl)?[]:(i.add(n.statusUrl),[n])})]}}catch{return kC()}}function jC(e,t){e.setItem(wC,JSON.stringify({schemaVersion:1,sources:t.sources.filter(e=>e.kind===`ssh_tunnel`)}))}function MC(e,t){let n=new Set(t.filter(vx).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 NC(e,t,n){let r=t.label.trim();if(!r)return{error:`请填写来源名称。`};if(r.length>48)return{error:`来源名称不能超过 48 个字符。`};let i=EC(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&&!vx(t.hostAlias))return{error:`请选择有效的 SSH Host。`};let a=t.hostAlias?.trim(),o={...a?{hostAlias:a}:{},id:DC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url};return{catalog:{...e,sources:[...e.sources,o]},source:o}}function PC(e,t){return{...e,sources:e.sources.filter(e=>e.kind===`local`||e.id!==t)}}function FC(e,t,n){if(!t.trim()||xh(t,n).source?.isRelative)return TC;let r=t.trim();try{r=new URL(r,n).toString()}catch{return null}return e.sources.find(e=>e.statusUrl===r)??null}function IC(e,t,n){return FC(e,t,n)||(xh(t,n).source?.isRelative?TC:{id:`temporary`,kind:`ssh_tunnel`,label:`临时来源`,readOnly:!0,statusUrl:t.trim()})}function LC(e,t,n,r){return IC(e,t??n,r)}var RC={delete:`删除`,deploy:`部署`,merge:`合并`,payment:`付款`,release:`发布`};function zC(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:`请求受保护操作:${RC[n.operation]} · ${n.target}`}}var BC=CC;async function VC(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 zp(await t.json())}function HC(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 UC(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??HC(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 WC(e){return(e??``).replace(/\s+/g,` `).trim()}function GC(e){let t=new Map;for(let n of e?.goals??[])t.set(n.goal_id,n);return t}function KC(e,t){return e===void 0||t===void 0?void 0:e+t}function qC(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 JC(e){return e?.items.find(e=>!e.done)}function YC(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 XC(e){return e?.queueItem?.project_asset?.quota?.state??e?.queueItem?.quota?.state??e?.goal.quota?.state??`waiting`}function ZC(e,t,n){let r=[];for(let t of e){let e=qC(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 QC(e){return e?.map(e=>({dataUrl:e.data_url,id:e.id,mimeType:e.mime_type,name:e.name,size:e.size}))}var $C=`loopx.personal-agent-selection.v1`;function ew(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem($C)??`{}`);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 tw={需修复:`danger`,等你:`warning`,等待条件:`info`,推进中:`success`,安静运行:`neutral`,已停止:`neutral`,已完成:`neutral`};function nw(e,t){return WC(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 rw(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 iw(e,t){return[`agent`,`assistant`].includes(e.trim().toLowerCase())&&t.trim().length>0}var aw=`已发现的项目 Agent`;function ow(e){switch(Vy(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 nw(e)}}function sw(e,t){switch(Hy(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 aw}}function cw(e,t){let n=e.project_asset;return t===`user`?YC(n?.user_todos,e.user_todos,`project_asset.user_todos`):YC(n?.agent_todos,e.agent_todos,`project_asset.agent_todos`)}function lw(e){return $d(e.title??e.text,112)}function uw(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 dw(e,t){let n=e.completion_validation_revision_history.at(-1);return{resumeWhen:e.resume_when??null,resumeReady:e.resume_ready??null,resumeReceiptId:uw(e),claimedBy:e.claimed_by??null,done:e.status!==`deferred`&&e.done,evidence:e.evidence?$d(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:lw(e),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.index}`,validationDigest:e.completion_validation_sha256??null,validationRevision:e.completion_validation_revision??null,validationRevisionActor:n?.actor_agent_id??null}}function fw(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 pw(e){return fw(e).map(t=>dw(t,e))}function mw(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=dw(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 hw(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:$d(e.title,112),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.claimed_by??`unknown`}:current`}}function gw(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=hw(t,n);r.has(i.todoId)||r.set(i.todoId,i)}return[...r.values()]}function _w(e){let t=e.queueItem?.project_asset?.agent_todos,n=e.queueItem?.agent_todos,r=fw(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=>dw(t,e)),l=r.find(e=>!e.done);return{doneTodoCount:o,nextTodoText:WC(t?.next??``)||(l?WC(l.title??``)||WC(l.text??``):``)||null,recentCompleted:c}}function vw(e,t){let n=WC(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`):bC(n,t,`projection.validationRecorded`):``}function yw(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 bw(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=[vw(r?.summary,n),bC(i?.health_check,n),bC(i?.recommended_action,n)].find(e=>e!==``&&e!==`暂无`)??n(`projection.runRecorded`),s=SC({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 xw(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 Sw(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 Cw(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 ww(e,t){let n=t.queueItem?.stale_latest_run_warning;return t.severity===`high`||!!Sw(e,t)||!!(n?.requires_refresh_state||n?.severity===`high`)||Cw(t)}function Tw(e,t){let n=Sw(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 Ew(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 Dw(e,t){let n=e.latestRun?.operator_gate;return bC(n?.operator_question??n?.reason_summary??n?.follow_up??e.queueItem?.recommended_action??e.latestRun?.recommended_action,t,`projection.confirmAgentDecision`)}function Ow(e,t){if(t.goal.activation_state===`stopped`)return`已停止`;let n=qC(t,`user`),r=qC(t,`agent`),i=!!JC(n),a=!!JC(r);return[`user_or_controller`,`controller`].includes(t.waitingOn)||i||Ew(t)?`等你`:ww(e,t)?`需修复`:t.waitingOn===`external_evidence`?`等待条件`:XC(t)===`eligible`||a?`推进中`:xw(t)?`已完成`:`安静运行`}function kw(e,t,n,r){if(n===`已停止`)return xC(`stopped`,r);if(n===`需修复`)return bC(Tw(e,t),r,`projection.statusRefreshNeeded`);if(n===`等你`)return xC(`needs_you`,r);if(n===`推进中`){let e=[(qC(t,`agent`)?.items??[]).filter(e=>!e.done).flatMap(e=>[e.title,e.text]).map(e=>WC(e)).find(e=>e!==``&&e!==`暂无`),t.queueItem?.recommended_action,t.latestRun?.recommended_action].map(e=>WC(e)).find(e=>e!==``&&e!==`暂无`);return e?bC(e,r,`projection.agentAdvancingGoal`):xC(`advancing`,r)}return xC(n===`等待条件`?`waiting_external`:`idle`,r)}function Aw(e,t){return t.some(t=>e.includes(t))}function jw(e,t,n){if(t.goals.some(e=>e.activationState===`active`&&e.loadState))return{text:`Goal 状态尚未全部加载,暂不能给出完整统计。可先打开已加载的 Goal,失败项可重试。`,lines:[]};if(Aw(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(Aw(n,[`现在`,`下一步`,`我该`,`该做什么`,`优先处理`])){let e=t.userTodos[0];if(e)return{text:e.blocking?`先处理「${nw(e.goalId)}」:${e.text}`:`当前最先处理「${nw(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(Aw(n,[`等我`,`阻塞`,`需要我`,`全局待办`]))return t.userTodos.length===0?{text:`目前没有 Goal 在等你,开放用户待办为 0。`,lines:[]}:{text:`有 ${t.userTodos.length} 项开放用户待办,阻塞项优先:`,lines:t.userTodos.slice(0,3).map(e=>`${nw(e.goalId)} · ${e.blocking?`阻塞`:`待处理`} · ${e.text}`)};if(Aw(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 Mw(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=GC(e.usage_summary),s=ZC(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(cw(e,`user`)?.items??[]).map((r,i)=>({projectedDone:r.done,details:tf(r),actionKind:r.action_kind??null,blocking:n,goalId:e.goal_id,sourceOrder:t,taskClass:r.task_class??null,text:lw(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)||!Ew(t)?[]:[{details:tf({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:Dw(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=Ow(e,a),l=f.find(e=>e.goalId===t.id),u=l?.text??null,d=_w(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=gw(pw(a),h,a),b=[d.nextTodoText,a.queueItem?.recommended_action,a.latestRun?.recommended_action,kw(e,a,c,n)].map(e=>bC(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:kw(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:bw(e,a,n),state:c,...r?{subagentExecution:{allowedDomains:t.spawn_policy?.allowed_domains??[],domainCandidates:mw(e,a,y),enabled:t.spawn_policy?.mode===`multi_subagent`&&t.spawn_policy.spawn_allowed===!0&&t.spawn_policy.max_children>0,executionConfig:t.spawn_policy?.execution_config,maxChildren:t.spawn_policy?.max_children??0,modelConfig:t.spawn_policy?.model_config}}:{},title:nw(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:KC(e.input_tokens_24h,e.output_tokens_24h),tokens7d:KC(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?$d(e.current_todo.title,96):null,lastActivityAt:e.last_activity_at??null,state:e.state??null}))}}function Nw({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:_}=Ji(),[v,y]=(0,R.useState)([]),[b,x]=(0,R.useState)(!1),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),E=(0,R.useMemo)(()=>{let e=Mw(c,u,_,b);if(!l)return e;let t=Object.values(l.snapshots).map(e=>Mw(e,UC(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,_]),D=E.goals.find(e=>e.goalId===d)??null,O=l?.snapshots[d]??c,[k,A]=(0,R.useState)(null),[ee,j]=(0,R.useState)(null),[M,te]=(0,R.useState)(!1),ne=E.goals.some(e=>e.activationState===`active`&&e.loadState===`loading`)?`loading`:E.goals.map(e=>`${e.goalId}:${e.agentId}`).join(`|`),N=D?.goalId??`manager`;E.goals.some(e=>e.activationState===`active`&&e.loadState)||(E.systemHealth?!E.systemHealth.ok:!c.ok)||E.openUserTodoCount>0&&`${E.openUserTodoCount}${E.blockingTodoCount}`;let P=v.length>0?v.map(e=>({agentId:e.agent_id,adapterKind:e.adapter_kind,available:e.available,capability:sw(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:sw(`codex`),label:`Codex`,statusLabel:`正在检测`}],re=[...P,{agentId:`status-only`,available:!0,capability:`不调用模型`,adapterKind:`status_projection`,interrupt:!1,label:`仅查状态`,resume:!0,statusLabel:`只读`,streaming:!1,toolCalls:!1,trustScope:`read_only`}],ie=P.find(e=>e.label===`Codex`&&e.available)?.agentId??P.find(e=>e.available)?.agentId??`status-only`,ae=w?.executor_endpoint?.trim()??``,F=ae?P.find(e=>e.agentId===ae)?.agentId:void 0,oe=e=>e===`manager`?F??ie:ie,[I,se]=(0,R.useState)(ew),L=Dh(re,I[N]??oe(N),ie),[ce,le]=(0,R.useState)(!1),[ue,de]=(0,R.useState)(!1),[fe,pe]=(0,R.useState)(`chat`),[me,he]=(0,R.useState)(``),[ge,_e]=(0,R.useState)({}),[ve,ye]=(0,R.useState)({}),[be,xe]=(0,R.useState)(null),[Se,Ce]=(0,R.useState)({}),[we,Te]=(0,R.useState)([]),[Ee,De]=(0,R.useState)(null),[Oe,ke]=(0,R.useState)({}),Ae=(0,R.useRef)(1),je=(0,R.useRef)(1),Me=(0,R.useRef)(new Map),Ne=(0,R.useRef)(new Set),Pe=(0,R.useRef)(new Map),Fe=(0,R.useRef)(new Map),Ie=(0,R.useRef)(new Set),Le=(0,R.useRef)(new Set),Re=(0,R.useRef)(null),B=(0,R.useRef)(null),ze=(0,R.useRef)(null),Be=(0,R.useRef)(null);(0,R.useRef)(null);let Ve=ge[N]??[];ve[N];let He=(e,t)=>e===`manager`?_(`header.manager`):t,Ue=D?E.userTodos.filter(e=>e.goalId===D.goalId):E.userTodos,We=D?.agentTodos??[];yw(We,D?.needsYou?3:4);let Ge=We.filter(e=>e.done).length,Ke=We.length>0?`${Ge}/${We.length}`:`暂无计划`;D&&({...E},Ue.filter(e=>e.blocking).length,Ue.length),(0,R.useEffect)(()=>{let e=bh(f.activeSource.statusUrl,window.location.href),t=e.source?wh(O,e.source):null;if(!D||!t?.indexUrl||!t.detailUrl){A(null),j(null),te(!1);return}let{detailUrl:n,indexUrl:r}=t,i=!1;return A(null),j(null),te(!0),Th(r,D.goalId).then(async e=>{let t=e.items[0]?.detail_ref;return t?Eh(n,t):null}).then(e=>{i||A(e)}).catch(e=>{i||j(Bp(e))}).finally(()=>{i||te(!1)}),()=>{i=!0}},[O,D?.goalId,f.activeSource.statusUrl]);let qe=Se[N]?.sessionId;(0,R.useEffect)(()=>{if(h||!qe)return;let e=!1,t,n=async()=>{try{let t=await cg(qe);if(e)return;let n=t.messages.filter(e=>e.origin===`manager_followup`);_e(e=>{let r=e[N]??[],i=new Set(r.map(e=>e.sourceMessageId)),a=n.filter(e=>!i.has(e.message_id)),o=new Map(n.map(e=>[e.message_id,e.return_delivery])),s=new Map(t.messages.filter(e=>e.role!==`user`&&e.origin!==`manager_followup`).map(e=>[e.turn_id,e])),c=new Map(t.messages.map(e=>[e.message_id,e.collaboration])),l=!1,u=r.map(e=>{let t=e.sourceMessageId?o.get(e.sourceMessageId):void 0,n=e.sourceTurnId?s.get(e.sourceTurnId):void 0,r=e.sourceMessageId?c.get(e.sourceMessageId):n?.collaboration;return JSON.stringify(t)===JSON.stringify(e.returnDelivery)&&JSON.stringify(r)===JSON.stringify(e.collaboration)?e:(l=!0,{...e,sourceMessageId:e.sourceMessageId??n?.message_id,returnDelivery:t,collaboration:r})});return!a.length&&!l?e:{...e,[N]:[...u,...a.map(e=>({id:Ae.current++,sourceMessageId:e.message_id,role:`assistant`,agentLabel:`协作回执`,sourceLabel:`协作回执`,text:rw(e.text),lines:[],returnDelivery:e.return_delivery}))]}})}catch{}finally{e||(t=setTimeout(n,3e3))}};return n(),()=>{e=!0,t&&clearTimeout(t)}},[h,qe,N,L.label]);function V(e,t){Ce(n=>{if(t===null){let t={...n};return delete t[e],t}return{...n,[e]:t}})}(0,R.useEffect)(()=>{if(h){y([]),x(!1),C(null),T(null);return}let e=!1;return ag().then(t=>{if(!e){y(t.adapters??[]);let e=t.manager?.runtime;T(t.manager?.channel_binding??null),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,R.useEffect)(()=>{try{window.localStorage.setItem($C,JSON.stringify(I))}catch{}},[I]),(0,R.useEffect)(()=>{if(h||!L.available)return;let e=N,t=`${e}:${L.agentId}`,n=D?`goal`:`manager`,r=D?`goal.${D.goalId}`:`manager`,i=!1,a=null,o=null;return(async()=>{try{let s=await dg({agentId:n===`manager`?void 0:L.agentId,channelId:r,goalId:D?.goalId});if(i||(_e(t=>(t[e]?.length??0)>0?t:{...t,[e]:s.messages.map(t=>({sourceMessageId:t.message_id,agentLabel:t.role===`user`?void 0:t.origin===`manager_followup`?`协作回执`:He(e,L.label),attachments:QC(t.attachments),id:Ae.current++,lines:[],role:t.role===`user`?`user`:`assistant`,returnDelivery:t.return_delivery,collaboration:t.collaboration,sourceLabel:t.role===`user`?void 0:t.role===`error`?`本地会话记录`:e===`manager`?`恢复的${_(`header.manager`)}会话`:`恢复的 ${L.label} 会话`,text:t.role===`user`?t.text:rw(t.text)}))}),L.agentId===`status-only`))return;let c=s.sessions[0];if(o=c?.session_id??null,c&&!c.resumable){Ne.current.add(t),V(e,{agentId:L.agentId,resumable:!1,sessionId:c.session_id,status:`resume_failed`});return}let l=n===`manager`?``:D?.goalId??``;if(n===`goal`&&!l)return;let u=await sg(l,n===`manager`?I[e]:L.agentId,`resume_latest`,n);if(i)return;n===`manager`&&u.session.manager_runtime&&C(u.session.manager_runtime),Me.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(V(e,{agentId:u.agent_id||L.agentId,resumable:!0,sessionId:u.session_id,status:f?`running`:`ready`,turnId:f||void 0}),Ne.current.delete(t),!f)return;let p=`${u.session_id}:${f}`;if(Le.current.has(p))return;Le.current.add(p),Pe.current.set(e,f),V(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`running`,turnId:f}),xe(e),a=new AbortController,Fe.current.set(e,a);let m=``,h=Je(e,{activity:[`正在恢复进行中的 Agent 回合`],agentLabel:He(e,L.label),lines:[],pending:!0,sourceLabel:e===`manager`?`恢复的${_(`header.manager`)}会话`:`恢复的 ${L.label} 会话`,text:``});try{let t=await Tg(u.session_id,f,{signal:a.signal,onDelta:t=>{m+=t,Ye(e,h,{text:m})},onActivity:t=>{_e(n=>({...n,[e]:(n[e]??[]).map(e=>e.id===h?{...e,activity:[...new Set([...e.activity??[],t])].slice(-6)}:e)}))}});if(i)return;Ye(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()||`${He(e,L.label)} 已完成分析。`});let n=E.goals.find(e=>e.goalId===d?.session.goal_id)??D??E.goals[0]??null;if(n&&t.response.proposals.length>0){let r=t.response.proposals.filter(Oh).map(e=>({goalId:n.goalId,id:je.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));r.length>0&&ye(t=>({...t,[e]:[...t[e]??[],...r]}))}}catch(t){if(i)return;Ye(e,h,{activity:[],lines:[],pending:!1,reconnect:t instanceof qh&&t.payload.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t instanceof Error?t.message:`无法恢复进行中的 Agent 回合。`})}finally{Le.current.delete(p),Pe.current.get(e)===f&&Pe.current.delete(e),V(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`ready`}),Fe.current.get(e)===a&&Fe.current.delete(e),i||xe(t=>t===e?null:t)}}catch(n){if(i)return;n instanceof qh&&n.payload.error_code===`resume_failed`&&(Ne.current.add(t),o&&V(e,{agentId:L.agentId,resumable:!1,sessionId:o,status:`resume_failed`}))}})(),()=>{i=!0,a?.abort()}},[N,E.goals[0]?.goalId,h,D?.goalId,L.agentId,L.available,L.label,I]),(0,R.useEffect)(()=>{if(h||D||E.goals.length===0||ne===`loading`)return;let e=!1;return Promise.all(E.goals.filter(e=>!e.loadState).map(async e=>{let t=await lg({agentId:e.agentId,channelId:`goal.${e.goalId}`,goalId:e.goalId});return{goalId:e.goalId,session:t.sessions[0]??null}})).then(t=>{e||Ce(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,ne,D?.goalId]),(0,R.useEffect)(()=>{if(De(null),h){Te([]),ke({});return}if(!D){Te([]),ke({});return}let e=!1,t=0,n=0;Te([]),ke({});let r=async()=>{if(!e){if(document.hidden){t=window.setTimeout(()=>void r(),1e4);return}try{let t=await lg({goalId:D.goalId});if(!e){let r=t.sessions.filter(e=>e.channel_id?.startsWith(`task.`));Te(r);let i=await Promise.allSettled(r.map(e=>cg(e.session_id)));if(!e){let e=i.some(e=>e.status===`rejected`);n=e?n+1:0,De(e?`partial`:null),ke(Object.fromEntries(i.flatMap((e,t)=>e.status===`fulfilled`?[[r[t].session_id,e.value]]:[])))}}}catch{n+=1,e||De(`offline`)}e||(t=window.setTimeout(()=>void r(),Math.min(3e4,2e3*2**Math.min(n,4))))}};return r(),()=>{e=!0,window.clearTimeout(t)}},[h,D?.goalId]),(0,R.useEffect)(()=>{if(!ce)return;let e=window.requestAnimationFrame(()=>{Re.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()});return()=>{window.cancelAnimationFrame(e),B.current?.focus()}},[ce]),(0,R.useEffect)(()=>{if(!ue)return;let e=window.requestAnimationFrame(()=>ze.current?.focus());return()=>{window.cancelAnimationFrame(e),Be.current?.focus()}},[ue]),(0,R.useEffect)(()=>{if(!ce&&!ue)return;let e=e=>{e.key===`Escape`&&(le(!1),de(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ce,ue]);function Je(e,t){let n=Ae.current++;return _e(r=>({...r,[e]:[...r[e]??[],{...t,id:n,role:`assistant`}]})),n}function Ye(e,t,n){_e(r=>({...r,[e]:(r[e]??[]).map(e=>e.id===t?{...e,...n}:e)}))}async function Xe(e,t){let n=`${e}:${t}`,r=Me.current.get(n);if(r)return r;let i=await sg(e,t,Ne.current.has(n)?`new`:`resume_latest`,`goal`);return Me.current.set(n,i.session_id),Ne.current.delete(n),V(e,{agentId:t,resumable:!0,sessionId:i.session_id,status:i.session.status}),i.session_id}async function Ze(e,t){let n=e.trim();if(!n)return;let r=t&&`goalId`in t?t.goalId??`manager`:N,i=r===`manager`?null:E.goals.find(e=>e.goalId===r)??null,a=t?.agentId?Dh(re,t.agentId,ie):L,o=r===`manager`?E:i?{...E,blockingTodoCount:E.userTodos.filter(e=>e.goalId===i.goalId&&e.blocking).length,goals:[i],openUserTodoCount:E.userTodos.filter(e=>e.goalId===i.goalId).length,userTodos:E.userTodos.filter(e=>e.goalId===i.goalId),visibleUserTodos:E.userTodos.filter(e=>e.goalId===i.goalId)}:E,s=Ae.current++;if(_e(e=>({...e,[r]:[...e[r]??[],{attachments:t?.attachments,id:s,lines:[],role:`user`,text:n}]})),he(``),xe(r),a.agentId===`status-only`||!i&&r!==`manager`){let e=jw(O,o,n),t=a.agentId===`status-only`;Je(r,{agentLabel:t?`仅查状态`:`LoopX 管家`,lines:e.lines.slice(0,3),sourceLabel:t?`LoopX 状态投影 · 仅查状态`:`LoopX 状态投影`,text:e.text}),og({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(()=>{}),xe(null);return}let c=`${r}:${a.agentId}`,l=null;try{let e=r===`manager`?Me.current.get(c):await Xe(r,a.agentId);if(!e){let t=Ne.current.has(c)?`new`:`resume_latest`,n=r===`manager`?I[r]:a.agentId,o=await sg(r===`manager`?``:i.goalId,n,t,r===`manager`?`manager`:`goal`);r===`manager`&&o.session.manager_runtime&&C(o.session.manager_runtime),e=o.session_id,Me.current.set(c,e),V(r,{agentId:o.agent_id||a.agentId,resumable:!0,sessionId:e,status:`ready`}),Ne.current.delete(c)}let o=``;l=Je(r,{activity:[r===`manager`?`正在连接管家`:`正在连接 Agent`],agentLabel:He(r,a.label),lines:[],pending:!0,sourceLabel:r===`manager`?`${_(`header.manager`)} · 跨 Goal`:`${a.label} Agent · ${nw(i.goalId)}`,text:``});let s={attachments:t?.attachments,signal:(()=>{let e=new AbortController;return Fe.current.set(r,e),e.signal})(),onDelta:e=>{o+=e,l!==null&&Ye(r,l,{text:o})},onActivity:e=>{l!==null&&_e(t=>({...t,[r]:(t[r]??[]).map(t=>t.id===l?{...t,activity:[...new Set([...t.activity??[],e])].slice(-6)}:t)}))},onPhase:(t,n)=>{l!==null&&Ye(r,l,{sourceTurnId:n}),Pe.current.set(r,n),V(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`running`,turnId:n})}},u;if(t?.loopxMode){let n=await xg(e,t.loopxMode.operation,t.loopxMode.settings);if(!n.turn_id)throw Error(`LoopX execution returned no turn identity`);s.onPhase(`turn.accepted`,n.turn_id),u=await Tg(e,n.turn_id,s)}else u=await Cg(e,n,s);let d=u.response;Ye(r,l,{lines:d.gate?[d.gate.summary,d.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:rw(d.message||o.trim())||`${He(r,a.label)} 已完成分析。`});let f=d.proposals.filter(Oh);if(f.length>0&&!i&&Ye(r,l,{lines:[`请进入要修改的 Goal,预览并确认具体变更。`]}),f.length>0&&i){let e=f.map(e=>({goalId:i.goalId,id:je.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));ye(t=>({...t,[r]:[...t[r]??[],...e]}))}if(r!==`manager`&&d.protected_action){let e=zC(r,n,d.protected_action);if(e)return e}}catch(e){if(Ie.current.delete(r)||t?.loopxMode&&e instanceof qh&&e.payload.error_code===`turn_interrupted`){let e={agentLabel:He(r,a.label),lines:[],pending:!1,sourceLabel:r===`manager`?`${_(`header.manager`)}会话`:`${a.label} 会话`,text:`已中断。你可以在当前会话继续发送消息。`};l===null?Je(r,e):Ye(r,l,e);return}let n=e instanceof qh?e.payload:null;n&&Ah(n)&&Me.current.delete(c),n?.error_code===`resume_failed`&&(Me.current.delete(c),Ne.current.add(c),V(r,{agentId:a.agentId,resumable:!1,sessionId:Se[r]?.sessionId??`resume-failed`,status:`resume_failed`}));let i=n?.gate,o=i&&typeof i==`object`?String(i.summary??``):``,s={agentLabel:He(r,a.label),lines:o?[o]:[],pending:!1,reconnect:n?.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:n?.error_code===`resume_failed`?`原 ${He(r,a.label)} 会话无法恢复。本地历史已经保留,请在运行详情里选择“重试恢复”或“开始新 Session”。`:e instanceof Error?e.message:`${He(r,a.label)} 会话暂时不可用。`};l===null?Je(r,s):Ye(r,l,s)}finally{Pe.current.delete(r),Fe.current.delete(r);let e=Me.current.get(c);e&&V(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),xe(e=>e===r?null:e)}}async function Qe(e){let t=e?.goalId??N,n=Se[t],r=e?.agentId??n?.agentId??L.agentId,i=`${t}:${r}`,a=e?.sessionId??n?.sessionId??Me.current.get(i),o=e?.turnId??n?.turnId??Pe.current.get(t);if(!(!a||!o))try{Ie.current.add(t),await hg(a,o),Fe.current.get(t)?.abort()}catch(e){throw Ie.current.delete(t),e}finally{Pe.current.delete(t),V(t,{agentId:r,resumable:!0,sessionId:a,status:`ready`}),Fe.current.delete(t),xe(e=>e===t?null:e)}}async function $e(e){let t=e.goalId,n=`${t}:${e.agentId}`,r=e.sessionId??Se[t]?.sessionId??Me.current.get(n);if(r)try{let i=await Dg(r);Me.current.set(n,r),Ne.current.delete(n),V(t,{agentId:e.agentId,resumable:i.session.resumable,sessionId:r,status:i.session.status})}catch{V(t,{agentId:e.agentId,resumable:!1,sessionId:r,status:`resume_failed`})}}function et(e){let t=`${e.goalId}:${e.agentId}`;Me.current.delete(t),Ne.current.add(t),V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:`new-session-pending`,status:`ready`})}async function tt(e){let t=`${e.goalId}:${e.agentId}`,n=e.sessionId??Se[e.goalId]?.sessionId??Me.current.get(t);n&&n!==`new-session-pending`&&await Eg(n),Me.current.delete(t),Ne.current.add(t),V(e.goalId,null)}function nt(e){re.some(t=>t.agentId===e&&t.available)&&(se(t=>({...t,[N]:e})),le(!1))}function rt(){i(``),pe(`chat`)}function it(e){i(e),pe(`chat`)}D&&tw[D.state],D&&(`${L.label}${D.state}`,We.length>0&&`${Ke}`,Ue.length>0&&`${Ue.length}`),D?.state===`需修复`||!D&&!c.ok?(D&&ow(D.agentId),D?.nextSentence,D?.agentSentence):D?.state===`等你`?(D.needsYouBlocking,D.needsYouBlocking,D.needsYou??D.nextSentence,D.needsYou):(D&&ow(D.agentId),D?.nextSentence);let at=[...!D&&Se.manager?.status===`resume_failed`?[{id:`run:manager:resume-failed`,kind:`run`,run:{agentId:Se.manager.agentId,agentLabel:ow(Se.manager.agentId),canInterrupt:!1,completedSteps:0,goalId:`manager`,goalTitle:`LoopX 管家`,latestActivity:`本地聊天记录已保留,点我查看恢复方式。`,resumable:!1,runId:`manager:resume-failed`,sessionId:Se.manager.sessionId,sessionStatus:`resume_failed`,status:`failed`,title:`上次会话需要恢复`,totalSteps:1,outputs:[]}}]:[],...D?we.map(e=>{let t=e.channel_id?.startsWith(`task.`)?e.channel_id.slice(5):void 0,n=D.agentTodos.find(e=>e.todoId===t),r=!!e.active_turn_id,i=Oe[e.session_id],a=i?.messages.some(e=>iw(e.role,e.text))===!0;return{id:`run:task:${e.session_id}`,kind:`run`,run:{agentId:e.agent_id,agentLabel:ow(e.agent_id),canInterrupt:r,completedSteps:n?.done||a?1:0,goalId:D.goalId,goalTitle:D.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`:iw(e.role,e.text)?`assistant`:`error`,text:e.role===`user`?e.text:rw(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}}}):[],...D&&(Se[D.goalId]?.turnId||D.runEvidence||qd(D))?[{id:`run:${D.goalId}`,kind:`run`,run:{agentId:Se[D.goalId]?.agentId??D.agentId,agentLabel:ow(Se[D.goalId]?.agentId??D.agentId),canInterrupt:!!Se[D.goalId]?.turnId,completedSteps:D.agentTodos.filter(e=>e.done).length,goalId:D.goalId,goalTitle:D.title,latestActivity:D.agentSentence,resumable:Se[D.goalId]?.resumable??!0,runId:`goal:${D.goalId}`,sessionId:Se[D.goalId]?.sessionId,sessionStatus:Se[D.goalId]?.status,status:Se[D.goalId]?.turnId?`running`:D.state===`需修复`?`failed`:`waiting`,title:D.nextSentence,totalSteps:D.agentTodos.length||1,turnId:Se[D.goalId]?.turnId,outputs:D.runEvidence?[{createdAt:D.runEvidence.generatedAt,kind:`evidence`,outputId:`${D.goalId}:latest-evidence`,title:D.runEvidence.label}]:[]}}]:[],...Ve.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,collaboration:e.collaboration,role:e.role,text:e.text||(e.pending?`Agent 正在处理…`:e.lines.join(` -`))}})),...(D?[D]:E.goals).flatMap(e=>e.runEvidence?[{id:`output:${e.goalId}:${e.runEvidence.generatedAt||`latest`}`,kind:`output`,output:{agentLabel:ow(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}}]:[]),...D&&k?[{id:`output:${D.goalId}:report:${k.publication.publication_id}`,kind:`output`,output:{agentId:k.agent_id,agentLabel:ow(k.agent_id),createdAt:k.publication.delivered_at,goalId:D.goalId,goalTitle:D.title,kind:`report`,outputId:k.publication.publication_id,report:{addedCount:k.delta.added_count,changedCount:k.delta.changed_count,deliveredAt:k.publication.delivered_at,generationId:k.generation_id,items:k.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:k.period_window.end_at,periodStartAt:k.period_window.start_at,predecessorPublicationId:k.publication.predecessor_publication_id,publicationId:k.publication.publication_id},safePreview:k.delta.items.map(e=>`${e.change_kind===`added`?`+`:`~`} ${e.title}\n${e.summary}`).join(` +`):``})]});let c=t.input_kind===`number`;return(0,z.jsxs)(`label`,{htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.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 cS({copy:e={},disabled:t=!1,editor:n,enabledAction:r,omitKeys:i=[],onChange:a,value:o}){let s=(0,R.useId)(),c=new Set(i);return(0,z.jsx)(`fieldset`,{className:`personal-capability-fields`,disabled:t,children:n.fields.filter(e=>!c.has(e.key)).map(t=>{let n=(0,z.jsx)(sS,{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,z.jsxs)(`div`,{className:`personal-capability-enabled-row`,children:[n,r]},t.key):n})})}var lS={en:{manager_runtime:{displayName:`Manager runtime`,description:`Selects the persistent host-tool profile used by owner manager conversations.`},steward_executor:{displayName:`Steward executor`,description:`Guides the steward executor, model, and selection boundary for this machine. A pinned route blocks substitution; a flexible pool permits only authorized fallback.`},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.`},progress_review:{displayName:`Progress-review sentinel`,description:`Records typed drift receipts from an external bounded review of scoped file deltas; assist may raise the existing autonomous replan obligation.`},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.`},coordination_runtime_shadow:{displayName:`Coordination runtime shadow`,description:`Captures transaction-bound Todo and task-lease mutations for reviewed whole-Goal coordination-authority promotion.`},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:`选择管家会话持续生效的宿主工具模式。`},steward_executor:{displayName:`管家执行器`,description:`配置本机管家的执行器、模型与选择边界;锁定路径禁止替代,灵活池只允许在已授权范围内回退。`},todo_replan_cadence:{displayName:`Goal 复核周期`,description:`配置 Goal 的复核周期。`},change_quality_qualification:{displayName:`变更质量验证`,description:`生成与 Provider 无关的审阅包,最多允许一次策略授权的安全修复,并可要求精确 diff 回执。`},progress_review:{displayName:`进展评估哨兵`,description:`记录外部有界评估对限定文件变化给出的类型化漂移回执;assist 模式可触发已有的自主重规划义务。`},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 状态,但不取得写入权。`},coordination_runtime_shadow:{displayName:`协调 Runtime 影子`,description:`捕获事务绑定的 Todo 与 task lease 变更,为经评审的整 Goal 协调 Authority 晋级提供证据。`},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 绑定。`}}},uS={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.`},selection_policy:{label:`Selection policy`,description:`Preferred allows an explicit user choice; pinned rejects another executor; flexible permits fallback only inside the eligible pool.`},executor_endpoint:{label:`Primary steward executor`,description:`The preferred or pinned executor for this machine. In a flexible pool it is tried first when available.`},eligible_endpoints:{label:`Flexible eligible executors`,description:`One authorized executor per line. Use only with flexible selection and include the primary executor.`},executor_model:{label:`Model`,description:`Optional model for the selected executor. Leave blank to keep the executor's own default.`},executor_reasoning_effort:{label:`Reasoning effort`,description:`Optional reasoning effort for the selected executor. Leave blank to keep the executor's own default.`},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.`},wait_for_ci:{label:`Wait for CI`,description:`Disable to use local validation without querying or waiting for CI. Merge authority is unchanged.`},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 开放常规宿主工具,但受保护操作仍单独校验。`},selection_policy:{label:`选择策略`,description:`preferred 允许用户显式改选;pinned 拒绝其他执行器;flexible 只在已授权资源池内回退。`},executor_endpoint:{label:`首选管家执行器`,description:`本机首选或锁定的执行器;灵活池模式下优先尝试它。`},eligible_endpoints:{label:`灵活池可用执行器`,description:`每行一个已授权执行器,仅用于 flexible;必须包含首选执行器。`},executor_model:{label:`模型`,description:`所选执行器使用的模型,可留空;留空表示沿用执行器自身的默认模型。`},executor_reasoning_effort:{label:`推理档位`,description:`所选执行器使用的推理档位,可留空;留空表示沿用执行器自身的默认档位。`},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。`},wait_for_ci:{label:`等待 CI`,description:`关闭后使用本地验证,不查询或等待 CI;不改变合并权限。`},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 dS(e,t){let n=lS[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 fS(e){return uS[e]}Object.freeze(Object.keys(lS.en).sort());function pS(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 mS({values:e,t}){return(0,z.jsxs)(`details`,{className:`personal-capability-raw-values`,children:[(0,z.jsx)(`summary`,{children:t(`capabilities.rawJson`)}),(0,z.jsx)(`div`,{className:`personal-capability-value-grid`,children:e.map(({label:e,value:t})=>(0,z.jsxs)(`section`,{children:[(0,z.jsx)(`strong`,{children:e}),(0,z.jsx)(`pre`,{children:t?JSON.stringify(t,null,2):`—`})]},e))})]})}function hS({source:e,t}){return e?(0,z.jsxs)(`p`,{className:`personal-capability-effective-source`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:15}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:t(`capabilities.effectiveSource`)}),t(`capabilities.source.${e}`)]})]}):null}function gS({available:e,description:t,t:n}){return e?null:(0,z.jsxs)(`section`,{className:`personal-capability-editor-status is-read-only`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:n(`capabilities.readOnly`)}),(0,z.jsx)(`p`,{children:t})]})]})}function _S(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 vS(e,t){return[...e].sort((e,n)=>{let r=_S(e)-_S(n);if(r!==0)return r;let i=dS(e,t),a=dS(n,t);return i.display_name.localeCompare(a.display_name,t)||e.capability_id.localeCompare(n.capability_id)})}function yS({capabilities:e,locale:t,onSelect:n,scope:r,selectedCapabilityId:i,t:a}){return(0,z.jsx)(`nav`,{"aria-label":a(r===`goal`?`capabilities.catalog`:`machine.capabilityCatalog`),className:`personal-capability-list`,tabIndex:0,children:vS(e,t).map(e=>{let o=dS(e,t);return(0,z.jsxs)(`button`,{"aria-current":i===o.capability_id?`page`:void 0,onClick:()=>n(o.capability_id),type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:o.display_name})}),(0,z.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 bS({capability:e,locale:t,source:n}){let{t:r}=Ji(),i=dS(e,t);return(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`span`,{className:`personal-settings-icon`,children:(0,z.jsx)(sh,{"aria-hidden":!0,size:18})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`personal-capability-heading-row`,children:[(0,z.jsx)(`h2`,{children:i.display_name}),(0,z.jsx)(hS,{source:n,t:r})]}),e.context_contribution&&(0,z.jsxs)(`details`,{className:`personal-capability-help`,"data-testid":`capability-context-phases`,children:[(0,z.jsx)(`summary`,{children:t===`zh-CN`?`主 Agent 协作指导`:`Coordinator workflow guidance`}),(0,z.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,z.jsx)(`dl`,{children:e.context_contribution.supported_phases.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:(0,z.jsx)(`code`,{children:e})}),(0,z.jsx)(`dd`,{children:xS[e][t===`zh-CN`?`zh`:`en`]})]},e))}),(0,z.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,z.jsxs)(`details`,{className:`personal-capability-help`,children:[(0,z.jsx)(`summary`,{children:t===`zh-CN`?`配置说明`:`Configuration help`}),(0,z.jsx)(`p`,{children:i.description}),(0,z.jsx)(`dl`,{children:e.configuration_editor.fields.map(e=>{let n=fS(t)[e.key],r=n?.description??e.description;return r?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n?.label??e.label}),(0,z.jsx)(`dd`,{children:r})]},e.key):null})})]},e.capability_id)]})]})}var xS={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 SS({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null);async function l(n){if(e.onToggleGoalAutoNotify){o(!0),c(null);try{let a=await e.onToggleGoalAutoNotify({autoNotify:n,goalId:t});if(!a.ok){c(a.public_summary??a.blocker??i(`notifications.setupFailed`));return}r()}catch(e){c(e instanceof Error?e.message:i(`notifications.setupFailed`))}finally{o(!1)}}}return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{className:`personal-notification-toggle`,children:[(0,z.jsx)(`input`,{checked:n?.humanGateAutoNotifyEnabled??!1,disabled:a||n?.configured!==!0||!e.onToggleGoalAutoNotify,onChange:e=>void l(e.target.checked),type:`checkbox`}),(0,z.jsx)(`span`,{children:i(`notifications.autoNotify`)}),a?(0,z.jsx)(zm,{"aria-hidden":!0,className:`is-spinning`,size:14}):null]}),s?(0,z.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:s}):null]})}function CS({goalId:e,onApplied:t,selected:n,t:r}){let[i,a]=(0,R.useState)({busy:null,draft:{},partialWrite:null,preview:null}),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(`guided`),[u,d]=(0,R.useState)(``),f=(0,R.useMemo)(()=>n?iS(n.configuration_editor,u):null,[n,u]),p=c===`guided`||f!==null;(0,R.useEffect)(()=>{l(`guided`),d(``),a({busy:null,draft:rS(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 o_(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=rS(n.configuration_editor,i.draft,n.default),o=await s_(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`?aS(r.draft,e,t):{...r.draft,[e]:t},preview:null})),s(null)}function _(e){if(!n||i.busy)return;d(e);let t=iS(n.configuration_editor,e);a(e=>({...e,preview:null,draft:t?rS(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 wS({mutationError:e,onApplied:t,partialWrite:n,preview:r}){let{t:i}=Ji();return(0,z.jsxs)(z.Fragment,{children:[e?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:e}):null,n?(0,z.jsxs)(`section`,{"aria-live":`polite`,className:`personal-capability-recovery`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:i(n.host_capacity_pending?`capabilities.hostCapacityPartialWrite`:`capabilities.partialWrite`)}),(0,z.jsx)(`p`,{children:i(n.host_capacity_pending?`capabilities.hostCapacityPartialWriteDescription`:`capabilities.partialWriteDescription`)}),(0,z.jsx)(`small`,{children:n.recommended_action})]}),(0,z.jsxs)(`button`,{onClick:t,type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":!0,size:15}),i(`capabilities.refreshSource`)]})]}):null,r?(0,z.jsxs)(`section`,{className:`personal-capability-preview`,"aria-label":i(`capabilities.preview`),children:[(0,z.jsx)(`strong`,{children:i(`capabilities.preview`)}),(0,z.jsx)(`span`,{children:i(`machine.action.${r.action}`)}),r.codex_host_capacity?(0,z.jsx)(`span`,{children:i(r.codex_host_capacity.write_required?`drawer.subagentHostCapacityRaise`:`drawer.subagentHostCapacityReady`,{configured:r.codex_host_capacity.configured_children??i(`drawer.subagentHostCapacityImplicit`),required:r.codex_host_capacity.required_children})}):null,(0,z.jsx)(`small`,{children:i(`capabilities.previewLocked`)})]}):null]})}function TS({callbacks:e,catalog:t,goalId:n,notification:r,onApplied:i,onNotificationChanged:a}){let{locale:o,t:s}=Ji(),c=(0,R.useMemo)(()=>vS(t.capabilities,o),[t.capabilities,o]),[l,u]=(0,R.useState)(()=>c[0]?.capability_id??``),d=(0,R.useMemo)(()=>c.find(e=>e.capability_id===l)??c[0],[c,l]),f=(0,R.useMemo)(()=>d?dS(d,o):void 0,[o,d]),{apply:p,changeDraft:m,changeJson:h,changeMode:g,editorMode:_,jsonDraft:v,jsonValid:y,error:b,mutation:x,preview:S}=CS({goalId:n,onApplied:i,selected:f,t:s}),{busy:C,draft:w,partialWrite:T,preview:E}=x;if(!d||!f)return(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:s(`capabilities.empty`)});let D=f.available_scopes.includes(`goal`),O=pS(f,`goal`),k=f.configuration_editor.read_only_reason??s(D?`capabilities.previewOnly`:`capabilities.machineOnly`);async function A(){if(!f||!O||C||!y)return;let e=rS(f.configuration_editor,w,f.default);await S(e)}async function ee(){!O||C||await S(null)}return(0,z.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,z.jsx)(yS,{capabilities:t.capabilities,locale:o,onSelect:u,scope:`goal`,selectedCapabilityId:f.capability_id,t:s}),(0,z.jsxs)(`article`,{"aria-label":f.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,z.jsx)(bS,{capability:d,locale:o,source:f.effective_configuration?.source}),(0,z.jsx)(gS,{available:O,t:s,description:k}),f.capability_id===`lark_event_inbox`?(0,z.jsxs)(`section`,{className:`personal-capability-linked-setting`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:s(`capabilities.larkInboxNotificationSetting`)}),(0,z.jsx)(`p`,{children:s(`capabilities.larkInboxNotificationDescription`)})]}),(0,z.jsx)(SS,{callbacks:e,goalId:n,notification:r,onChanged:a})]}):null,O?(0,z.jsxs)(z.Fragment,{children:[_===`json`||!f.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,z.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,z.jsxs)(`button`,{disabled:!!C||!y,onClick:g,type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),s(_===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,_===`guided`?(0,z.jsx)(`section`,{className:`personal-capability-field-summary`,children:(0,z.jsx)(cS,{disabled:!!C,copy:fS(o),editor:f.configuration_editor,onChange:m,value:w,enabledAction:(0,z.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:g,type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),s(`machine.editJson`)]})})}):(0,z.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`goal-configuration-json`,children:[(0,z.jsx)(`span`,{children:s(`capabilities.jsonConfiguration`)}),(0,z.jsx)(`textarea`,{id:`goal-configuration-json`,"aria-describedby":`goal-configuration-json-help`,disabled:!!C,onChange:e=>h(e.target.value),rows:12,spellCheck:!1,value:v}),(0,z.jsx)(`small`,{id:`goal-configuration-json-help`,children:s(`capabilities.jsonHelp`)}),y?null:(0,z.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:s(`capabilities.jsonInvalid`)})]})]}):null,(0,z.jsx)(wS,{mutationError:b,onApplied:i,partialWrite:T,preview:E}),O?(0,z.jsxs)(`footer`,{className:`personal-capability-actions`,children:[f.current&&f.available_scopes.includes(`machine`)?(0,z.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void ee(),type:`button`,children:s(`capabilities.restoreInheritance`)}):null,(0,z.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void A(),type:`button`,children:s(C===`preview`?`common.loading`:`capabilities.previewChanges`)}),(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!C||!E||!y,onClick:()=>void p(),type:`button`,children:s(C===`apply`?`common.loading`:`capabilities.applyPreview`)})]}):null,(0,z.jsx)(mS,{values:[{label:s(`capabilities.goalValue`),value:f.current},{label:s(f.machine_current?`capabilities.machineValue`:`capabilities.defaultValue`),value:f.machine_current??f.default}],t:s},d.capability_id)]})]})}function ES({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1);function d(){t&&(u(!0),c(null),a_(t).then(o).catch(e=>c(e instanceof Error?e.message:i(`capabilities.loadFailed`))).finally(()=>u(!1)))}return(0,R.useEffect)(d,[t]),t?l&&!a?(0,z.jsxs)(`p`,{"aria-live":`polite`,className:`personal-capability-empty`,children:[(0,z.jsx)(zm,{className:`personal-spin`,size:18}),i(`capabilities.loading`)]}):s?(0,z.jsxs)(`section`,{className:`personal-capability-error`,role:`alert`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:i(`capabilities.loadFailed`)}),(0,z.jsx)(`small`,{children:s})]}),(0,z.jsxs)(`button`,{onClick:d,type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":!0,size:15}),i(`capabilities.retry`)]})]}):a?(0,z.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":a.revision,children:[(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),i(`capabilities.atomicOverride`)]}),(0,z.jsx)(`p`,{children:i(`capabilities.atomicOverrideDescription`)})]}),(0,z.jsx)(TS,{callbacks:e,catalog:a.capability_catalog,goalId:t,notification:n,onApplied:d,onNotificationChanged:r})]}):null:(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:i(`capabilities.chooseGoal`)})}function DS(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function OS(e,t){let n=t?.machine_namespace;return n?e?.machine_configuration?.namespaces[n]:void 0}function kS(e,t,n){let r={...DS(e.default),...DS(t),...n};return e.capability_id===`steward_executor`&&(Object.hasOwn(n,`selection_policy`)||Object.hasOwn(n,`eligible_endpoints`))&&(r.schema_version=DS(e.default).schema_version),r}function AS(e,t){for(let n of e.configuration_editor.fields){let e=t[n.key];if(n.required&&(e==null||e===``))return!1}if(e.capability_id===`periodic_report`&&t.enabled===!0)return!!(String(t.profile_preset??``).trim()&&String(t.route_ref??``).trim()&&String(t.timezone??``).trim());if(e.capability_id===`steward_executor`){let e=String(t.selection_policy??`preferred`),n=String(t.executor_endpoint??``),r=Array.isArray(t.eligible_endpoints)?t.eligible_endpoints.map(e=>String(e)):[];return e===`flexible`?r.length>0&&r.includes(n)&&new Set(r).size===r.length:r.length===0}return!0}function jS(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}catch{return null}}function MS(e){return e?e===`absent`?e:e.replace(/^sha256:/,``).slice(0,12):`—`}function NS(){let{locale:e,t}=Ji(),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)({}),[c,l]=(0,R.useState)(`{}`),[u,d]=(0,R.useState)(`guided`),[f,p]=(0,R.useState)(null),[m,h]=(0,R.useState)(`upsert`),[g,_]=(0,R.useState)(null),[v,y]=(0,R.useState)(null),[b,x]=(0,R.useState)(`load`),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),E=(0,R.useMemo)(()=>vS(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=>pS(e,`machine`))??E[0],k=O?dS(O,e):void 0,A=OS(n,k),ee=!!(k?.machine_namespace&&A),j=!!(k&&pS(k,`machine`)),M=(0,R.useMemo)(()=>jS(c),[c]),te=k?u===`json`?M:kS(k,A,o):null,ne=!!(k&&(u===`json`?M:AS(k,te??{})));async function N(){r(await i_())}(0,R.useEffect)(()=>{let e=!0;return i_().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,R.useEffect)(()=>{if(!k)return;let e=OS(n,k),t=rS(k.configuration_editor,e??k.default,k.default),r=kS(k,e,t);s(t),l(JSON.stringify(r,null,2)),d(j?`guided`:`json`),p(null),h(`upsert`),y(null)},[n,i,e]);function P(e,t){s(n=>k?.capability_id===`periodic_report`?aS(n,e,t):{...n,[e]:t}),p(null),h(`upsert`),C(null),T(null)}function re(e){if(k){if(e===`json`)l(JSON.stringify(kS(k,A,o),null,2));else if(M)s(rS(k.configuration_editor,M,k.default));else{C(t(`machine.jsonInvalid`));return}d(e),p(null),h(`upsert`),C(null)}}async function ie(){if(!(!j||!k?.machine_namespace||!te||!ne||b)){x(`preview`),C(null),T(null);try{h(`upsert`),p(await c_(k.machine_namespace,te))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function ae(){if(!(!j||!k?.machine_namespace||!ee||b)){x(`preview`),C(null),T(null);try{h(`remove`),p(await u_(k.machine_namespace))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function F(){if(!j||!k?.machine_namespace||!f||b||m===`upsert`&&!te)return;x(`apply`),C(null);let e=m;try{let n=e===`remove`?await d_(k.machine_namespace,f.plan_revision):await l_(k.machine_namespace,te,f.plan_revision);_(n),p(null),h(`upsert`),y(null),await N(),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 oe(){if(!(!g?.transaction_id||b)){x(`rollback-preview`),C(null);try{y(await f_(g.transaction_id))}catch(e){C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}async function I(){if(!(!g?.transaction_id||!v||b)){x(`rollback`),C(null);try{await p_(g.transaction_id,v.plan_revision),_(null),y(null),p(null),await N(),T(t(`machine.rolledBack`))}catch(e){y(null),C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}return b===`load`?(0,z.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:t(`common.loading`)}):k?(0,z.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n?.revision,children:[(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),t(`machine.liveDefault`)]}),(0,z.jsx)(`p`,{children:t(`machine.liveDefaultDescription`)})]}),(0,z.jsxs)(`div`,{className:`personal-capability-body`,children:[n?.status===`invalid`?(0,z.jsxs)(`section`,{className:`personal-machine-error`,"data-testid":`machine-invalid-repair`,role:`alert`,children:[(0,z.jsx)(`strong`,{children:t(`machine.invalidStoredConfiguration`)}),(0,z.jsx)(`p`,{children:t(`machine.invalidStoredConfigurationDescription`)})]}):null,(0,z.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,z.jsx)(yS,{capabilities:E,locale:e,onSelect:a,scope:`machine`,selectedCapabilityId:k.capability_id,t}),(0,z.jsxs)(`article`,{"aria-label":k.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,z.jsx)(bS,{capability:O,locale:e,source:k.available_scopes.includes(`machine`)?ee?`machine_default`:`capability_default`:void 0}),(0,z.jsx)(gS,{available:j,t,description:k.available_scopes.includes(`machine`)?t(`machine.editorUnavailableDescription`):t(`machine.goalOnly`)}),k.capability_id===`periodic_report`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:A?.schedule?e===`zh-CN`?`日历与阶段汇报`:`Calendar and stage reports`:t(`machine.periodicReportActivation`)}),(0,z.jsx)(`p`,{children:A?.schedule?A.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,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.changeQualityActivation`)}),(0,z.jsx)(`p`,{children:t(`machine.changeQualityActivationDescription`)})]})]}):null,k.capability_id===`todo_replan_cadence`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.replanCadenceActivation`)}),(0,z.jsx)(`p`,{children:t(`machine.replanCadenceActivationDescription`)})]})]}):null,k.capability_id===`pull_request_review`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e===`zh-CN`?`只改变队列排序`:`Queue ordering only`}),(0,z.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,j?(0,z.jsxs)(z.Fragment,{children:[u===`json`||!k.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,z.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,z.jsxs)(`button`,{onClick:()=>re(u===`guided`?`json`:`guided`),type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),t(u===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,u===`guided`?(0,z.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,z.jsx)(cS,{copy:fS(e),disabled:!!b,editor:k.configuration_editor,onChange:P,value:o,enabledAction:(0,z.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:()=>re(`json`),type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),t(`machine.editJson`)]})}),ne?null:(0,z.jsx)(`p`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.requiredFields`)})]}):(0,z.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`machine-configuration-json`,children:[(0,z.jsx)(`span`,{children:t(`machine.jsonConfiguration`)}),(0,z.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,z.jsx)(`small`,{id:`machine-configuration-json-help`,children:t(`machine.jsonConfigurationHelp`)}),M?null:(0,z.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.jsonInvalid`)})]})]}):null,S?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:S}):null,w?(0,z.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,z.jsx)(hm,{"aria-hidden":!0,size:16}),w]}):null,f?(0,z.jsxs)(`section`,{"aria-label":t(`machine.preview`),className:`personal-machine-preview`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.preview`)}),(0,z.jsx)(`span`,{children:t(`machine.action.${f.action}`)})]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.currentRevision`)}),(0,z.jsx)(`dd`,{title:f.current_revision,children:MS(f.current_revision)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.desiredRevision`)}),(0,z.jsx)(`dd`,{title:f.desired_revision,children:MS(f.desired_revision)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.changedNamespaces`)}),(0,z.jsx)(`dd`,{children:f.changed_namespaces.join(`, `)||t(`common.none`)})]})]}),(0,z.jsx)(`p`,{children:t(`machine.previewLocked`)})]}):null,g?.rollback_available&&g.transaction_id?(0,z.jsxs)(`section`,{className:`personal-machine-rollback`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.rollbackAvailable`)}),(0,z.jsx)(`p`,{children:t(v?`machine.rollbackPreviewDescription`:`machine.rollbackDescription`)})]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!!b||!!(v&&!v.rollback_allowed),onClick:()=>void(v?I():oe()),type:`button`,children:[(0,z.jsx)($m,{"aria-hidden":!0,size:15}),t(b===`rollback`||b===`rollback-preview`?`common.loading`:v?`machine.confirmRollback`:`machine.previewRollback`)]})]}):null,j?(0,z.jsxs)(`footer`,{className:`personal-capability-actions`,children:[ee?(0,z.jsxs)(`button`,{className:`is-danger`,disabled:!!b,onClick:()=>void ae(),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),t(`machine.previewRemoval`)]}):null,(0,z.jsx)(`button`,{disabled:!!b||!ne,onClick:()=>void ie(),type:`button`,children:t(b===`preview`?`common.loading`:`machine.previewChanges`)}),(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!b||!f,onClick:()=>void F(),type:`button`,children:t(b===`apply`?`common.loading`:`machine.applyPreview`)})]}):null,k.available_scopes.includes(`machine`)?(0,z.jsx)(mS,{values:[{label:t(`machine.currentValue`),value:A},{label:t(`capabilities.defaultValue`),value:k.default}],t},k.capability_id):null]})]})]})]}):(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:t(`machine.capabilityEmpty`)})}function PS(e,t){return t(e===`invalid`?`machine.credentialInvalid`:e===`configured`?`machine.credentialConfigured`:`machine.credentialAbsent`)}function FS(e,t){return t(e===`machine_store`?`machine.credentialSourceMachine`:e===`service_environment`?`machine.credentialSourceEnvironment`:`machine.credentialSourceUnset`)}function IS(){let{t:e}=Ji(),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(null),p=(0,R.useCallback)(async()=>{c(`load`);try{let e=await n_();n(e),o(String(e.base_url.value??``))}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}},[e]);(0,R.useEffect)(()=>{p()},[p]);async function m(t,r){c(`store`),u(null),f(null);try{let e=await r_(t);n(e),o(String(e.base_url.value??``)),i(``),f(r)}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}}if(!t&&s===`load`)return(0,z.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:e(`common.loading`)});let h=t?`${PS(t.provider_key.configured?`configured`:`absent`,e)} · ${FS(t.provider_key.source,e)}`:``,g=t?`${t.base_url.value??e(`machine.credentialAbsent`)} · ${FS(t.base_url.source,e)}`:``;return(0,z.jsxs)(`section`,{className:`personal-operator-credential`,"data-testid":`operator-credential-settings`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(Fm,{"aria-hidden":!0,size:17}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e(`machine.credentialTitle`)}),(0,z.jsx)(`p`,{children:e(`machine.credentialDescription`)})]}),(0,z.jsx)(`span`,{className:`personal-operator-credential-status`,children:t?PS(t.status,e):e(`common.loading`)})]}),t?(0,z.jsxs)(`dl`,{className:`personal-operator-credential-readback`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialApiKey`)}),(0,z.jsx)(`dd`,{children:h})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialFingerprint`)}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.provider_key.fingerprint??e(`common.none`)})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialBaseUrl`)}),(0,z.jsx)(`dd`,{children:g})]})]}):null,t?.status===`invalid`&&t.repair?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:t.repair}):null,(0,z.jsxs)(`label`,{htmlFor:`operator-credential-api-key`,children:[(0,z.jsx)(`span`,{children:e(`machine.credentialApiKey`)}),(0,z.jsx)(`input`,{autoComplete:`off`,disabled:!!s,id:`operator-credential-api-key`,onChange:e=>i(e.target.value),placeholder:e(`machine.credentialApiKeyPlaceholder`),type:`password`,value:r})]}),(0,z.jsxs)(`label`,{htmlFor:`operator-credential-base-url`,children:[(0,z.jsx)(`span`,{children:e(`machine.credentialBaseUrl`)}),(0,z.jsx)(`input`,{autoComplete:`off`,disabled:!!s,id:`operator-credential-base-url`,onChange:e=>o(e.target.value),placeholder:e(`machine.credentialBaseUrlPlaceholder`),type:`text`,value:a})]}),l?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:l}):null,d?(0,z.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,z.jsx)(hm,{"aria-hidden":!0,size:16}),d]}):null,(0,z.jsxs)(`footer`,{className:`personal-operator-credential-actions`,children:[(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!s||!r.trim()&&!a.trim(),onClick:()=>void m({...r.trim()?{provider_key:r}:{},...a.trim()?{base_url:a}:{}},e(`machine.credentialStored`)),type:`button`,children:e(s===`store`?`common.loading`:`machine.credentialStore`)}),(0,z.jsxs)(`button`,{disabled:!!s||t?.provider_key.configured!==!0,onClick:()=>void m({clear_provider_key:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearKey`)]}),(0,z.jsxs)(`button`,{disabled:!!s||t?.base_url.configured!==!0,onClick:()=>void m({clear_base_url:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearUrl`)]})]}),(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),e(`machine.credentialTitle`)]}),(0,z.jsx)(`p`,{children:e(`machine.credentialBoundary`)})]})]})}var LS={appearance:Km,capabilities:sh,language:Im,lark:ah,machine:rh,provider:Fm};function RS({callbacks:e,focusGoalConnection:t=!1,goals:n,initialGoalId:r,initialTab:i=`lark`,goalNotifications:a,onChanged:o,onClose:s,onThemeChange:c,theme:l}){let{locale:u,setLocale:d,t:f}=Ji(),[p,m]=(0,R.useState)(i),h=(0,R.useRef)(null);(0,R.useEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{if(e.scrollWidth<=e.clientWidth)return;let t=e.querySelector(`[aria-current="page"]`);if(!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=r.leftn.right?r.right-n.right:0;i&&(e.scrollLeft+=i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[p]);let g=[...r?[{key:`capabilities`,label:f(`capabilities.title`)}]:[],{key:`provider`,label:f(`settings.modelProvider`)},{key:`machine`,label:f(`settings.globalCapabilities`)},{key:`lark`,label:`Lark`},{key:`appearance`,label:f(`settings.appearance`)},{key:`language`,label:f(`settings.language`)}],_=[{label:f(`settings.languageEnglish`),value:`en`},{label:f(`settings.languageSimplifiedChinese`),value:`zh-CN`}],v={appearance:{title:f(`settings.appearance`)},capabilities:{title:f(`capabilities.title`)},language:{title:f(`settings.language`)},lark:{title:`Lark`},machine:{title:f(`settings.globalCapabilities`)},provider:{title:f(`settings.modelProvider`)}}[p];return(0,z.jsxs)(`section`,{"aria-label":f(`settings.title`),className:`personal-settings-page`,"data-pw-theme":l,children:[(0,z.jsxs)(`aside`,{className:`personal-settings-sidebar`,children:[(0,z.jsxs)(`button`,{autoFocus:!0,className:`personal-settings-back`,onClick:s,type:`button`,children:[(0,z.jsx)(om,{size:17}),(0,z.jsx)(`span`,{children:f(`settings.back`)})]}),(0,z.jsx)(`div`,{className:`personal-settings-title`,children:(0,z.jsx)(`strong`,{children:f(`settings.title`)})}),(0,z.jsx)(`nav`,{"aria-label":f(`settings.categories`),className:`personal-settings-tabs`,ref:h,children:g.map(e=>{let t=LS[e.key];return(0,z.jsxs)(`button`,{"aria-current":p===e.key?`page`:void 0,onClick:()=>m(e.key),type:`button`,children:[(0,z.jsx)(t,{size:17}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:e.label})})]},e.key)})})]}),(0,z.jsxs)(`main`,{className:`personal-settings-body`,children:[(0,z.jsx)(`header`,{className:`personal-settings-header`,children:(0,z.jsx)(`div`,{children:(0,z.jsx)(`h1`,{children:v.title})})}),p===`lark`?(0,z.jsx)(tS,{embedded:!0,focusGoalConnection:t,goals:n,initialGoalId:r,onChanged:o,onClose:s}):null,p===`provider`?(0,z.jsx)(`div`,{className:`personal-provider-settings`,children:(0,z.jsx)(IS,{})}):null,p===`machine`?(0,z.jsx)(NS,{}):null,p===`capabilities`?(0,z.jsx)(ES,{callbacks:e,goalId:r,notification:a.find(e=>e.goalId===r),onChanged:o}):null,p===`appearance`?(0,z.jsx)(`section`,{className:`personal-detail-card personal-appearance-settings`,children:(0,z.jsxs)(`div`,{className:`personal-settings-choice-group`,role:`radiogroup`,"aria-label":f(`settings.workspaceTheme`),children:[(0,z.jsxs)(`button`,{"aria-checked":l===`loopx`,onClick:()=>c(`loopx`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-loopx`}),(0,z.jsx)(`strong`,{children:f(`settings.themeLoopx`)})]}),(0,z.jsxs)(`button`,{"aria-checked":l===`paper`,onClick:()=>c(`paper`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-paper`}),(0,z.jsx)(`strong`,{children:f(`settings.themeDefault`)})]}),(0,z.jsxs)(`button`,{"aria-checked":l===`brutal`,onClick:()=>c(`brutal`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-brutal`}),(0,z.jsx)(`strong`,{children:f(`settings.themeHighContrast`)})]})]})}):null,p===`language`?(0,z.jsx)(`section`,{className:`personal-settings-card`,children:(0,z.jsx)(`div`,{"aria-label":f(`settings.language`),className:`personal-language-options`,role:`radiogroup`,children:_.map(e=>(0,z.jsxs)(`button`,{"aria-checked":u===e.value,className:u===e.value?`is-selected`:``,onClick:()=>d(e.value),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:e.label})}),u===e.value?(0,z.jsx)(hm,{"aria-hidden":!0,size:17}):null]},e.value))})}):null]})]})}var zS=`loopx-pw-theme`,BS=`loopx`;function VS(){try{let e=window.localStorage.getItem(zS);return e===`loopx`||e===`paper`||e===`brutal`?e:BS}catch{return BS}}function HS(e){try{window.localStorage.setItem(zS,e)}catch{}}function US({drawer:e,drawerMode:t=`panel`,drawerOpen:n,main:r,mobileSidebarOpen:i=!1,onCloseMobileSidebar:a,sidebar:o,theme:s=`loopx`}){let{t:c}=Ji(),l=(0,R.useRef)(null),u=(0,R.useRef)(null);return(0,R.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,z.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,z.jsx)(`button`,{"aria-hidden":!0,className:`personal-sidebar-backdrop`,onClick:a,tabIndex:-1,type:`button`}):null,(0,z.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,z.jsxs)(`div`,{className:`personal-workspace-sidebar-inner`,children:[i?(0,z.jsxs)(`button`,{className:`personal-sr-only`,onClick:a,type:`button`,children:[c(`common.close`),` `,c(`header.goalNavigation`)]}):null,o]})}),(0,z.jsx)(`main`,{"aria-hidden":i||void 0,className:`personal-workspace-main`,inert:i||void 0,children:r}),n?(0,z.jsx)(`aside`,{className:`personal-workspace-drawer`,"data-context-drawer":!0,"data-drawer-mode":t,children:e}):null]})}function WS(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 GS(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 KS(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 qS({goals:e,onSelectGoal:t,onRetry:n,systemHealth:r}){let{locale:i,t:a}=Ji(),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=[];e.filter(e=>!e.loadState).forEach(e=>{let t=Jd(e);t===`history`?u.push(e):t!==`stopped`&&l[t].push(e)});let d=e=>(0,z.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,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`span`,{className:`personal-home-goal-meta`,children:e.agentLaneCount&&e.agentLaneCount>1?a(`header.workAgentCount`,{count:e.agentLaneCount}):e.agentLabel??e.agentId}),(0,z.jsx)(`p`,{children:e.loadError?a(`startup.error.${e.loadError}`):e.needsYou??e.nextSentence}),(0,z.jsxs)(`footer`,{children:[(0,z.jsx)(`span`,{children:e.loadState?a(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Yi(e.state,i)}),(0,z.jsx)(`small`,{title:e.latestActivity,children:e.loadState?``:e.latestActivity?KS(e.latestActivity,i,a):e.agentTodos.length?a(`home.taskCount`,{count:e.agentTodos.length}):a(`home.noActivity`)})]})]},e.goalId);return(0,z.jsxs)(`section`,{"aria-label":a(`home.workspace`),className:`personal-home-board`,children:[r&&(!r.ok||r.issues.length>0||r.freshnessWarning)?(0,z.jsxs)(`div`,{className:`personal-system-health-banner`,role:`alert`,children:[(0,z.jsxs)(`div`,{className:`personal-system-health-header`,children:[(0,z.jsx)(ym,{size:15}),(0,z.jsx)(`strong`,{children:a(`home.systemHealth`,{summary:r.summary})}),r.freshnessWarning?(0,z.jsxs)(`small`,{children:[`(`,r.freshnessWarning,`)`]}):null]}),r.issues.length>0?(0,z.jsx)(`ul`,{className:`personal-system-health-issues`,children:r.issues.map((e,t)=>(0,z.jsx)(`li`,{children:e},t))}):null]}):null,o.some(e=>e.loadState)?(0,z.jsxs)(`section`,{className:`personal-home-lane`,"aria-live":`polite`,children:[(0,z.jsx)(`header`,{children:a(`startup.progress`,{loaded:o.filter(e=>!e.loadState).length,total:o.length})}),s?(0,z.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`status`,children:[(0,z.jsx)(`span`,{children:a(`startup.failedCount`,{count:s})}),(0,z.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(d)]}):null,(0,z.jsx)(`div`,{className:`personal-home-lanes`,children:c.filter(e=>l[e.key].length>0).map(e=>(0,z.jsxs)(`section`,{className:`personal-home-lane is-${e.key}`,"data-testid":`personal-home-lane-${e.key}`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`i`,{}),e.label]}),(0,z.jsx)(`b`,{children:l[e.key].length})]}),(0,z.jsx)(`div`,{className:`personal-home-lane-list`,children:l[e.key].map(d)})]},e.key))}),u.length?(0,z.jsxs)(`details`,{className:`personal-home-history`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:a(`home.history`)}),(0,z.jsx)(`b`,{children:u.length}),(0,z.jsx)(`small`,{children:a(`home.completedGoals`)})]}),(0,z.jsx)(`div`,{children:u.map(d)})]}):null]})}function JS({active:e,items:t,onSelect:n,reportState:r,teamSessionId:i}){let{locale:a,t:o}=Ji(),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1),[d,f]=(0,R.useState)(0);(0,R.useEffect)(()=>{if(!e||!i){c(null),u(!1);return}let t=!0;return c(null),u(!1),gg(i).then(e=>{t&&c(e)}).catch(()=>{t&&u(!0)}),()=>{t=!1}},[e,i,d]);let p=!!(s?.session_id===i&&s?.settings.agent_id&&s?.settings.execution_config);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-object-list personal-files-list`,"data-testid":`personal-goal-outputs`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:o(`files.title`)}),p?null:(0,z.jsx)(`span`,{children:t.length})]}),r?.loading?(0,z.jsxs)(`p`,{className:`personal-object-list-state`,role:`status`,children:[(0,z.jsx)(Qm,{className:`is-spinning`,size:14}),o(`files.loadingReports`)]}):null,r?.error?(0,z.jsxs)(`p`,{className:`personal-object-list-state is-error`,role:`alert`,children:[(0,z.jsx)(ym,{size:14}),o(`files.reportLoadFailed`),`: `,r.error]}):null,!r?.loading&&!r?.error&&t.length===0&&!p&&(!i||s)?(0,z.jsxs)(`p`,{className:`personal-object-list-state`,children:[(0,z.jsx)(jm,{size:14}),o(`files.empty`)]}):null,t.map(e=>(0,z.jsxs)(`button`,{"data-output-kind":e.output.kind,onClick:()=>n({item:e.output,kind:`output`}),type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-file-icon`,children:(0,z.jsx)(jm,{size:16})}),(0,z.jsx)(`strong`,{children:e.output.title}),e.output.report?(0,z.jsx)(`em`,{children:o(`files.reportDelta`,{added:e.output.report.addedCount,changed:e.output.report.changedCount})}):null,(0,z.jsx)(`p`,{children:e.output.summary??e.output.safePreview??e.output.kind??o(`files.emptySummary`)}),(0,z.jsx)(`small`,{title:e.output.createdAt,children:[e.output.kind===`report`?o(`files.verifiedReport`):null,KS(e.output.createdAt,a,o)].filter(Boolean).join(` · `)})]},e.id))]}),e&&i&&!s&&!l?(0,z.jsx)(`p`,{className:`personal-object-list-state`,role:`status`,children:o(`files.checkingTeam`)}):null,e&&i&&l?(0,z.jsxs)(`p`,{className:`personal-object-list-state is-error`,role:`alert`,children:[o(`files.teamLoadFailed`),` `,(0,z.jsx)(`button`,{type:`button`,onClick:()=>f(e=>e+1),children:o(`startup.retry`)})]}):null,e&&p&&i?(0,z.jsx)(Fb,{sessionId:i,zh:a===`zh-CN`,refreshKey:JSON.stringify(s?.deliveries??[])}):null]})}function YS({agentLabel:e,messages:t,onClose:n,onDraftTask:r,onOpenConversation:i,title:a}){let{t:o}=Ji(),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,R.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,z.jsxs)(`aside`,{"aria-label":o(`conversation.receipt`),className:`personal-manager-conversation-tray`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(fm,{size:16}),(0,z.jsx)(`strong`,{children:a??o(`conversation.title`)}),(0,z.jsx)(`small`,{children:t.at(-1)?.pending?o(`conversation.replying`):o(`common.recently`)})]}),(0,z.jsxs)(`div`,{className:`personal-manager-conversation-actions`,children:[r&&l?(0,z.jsxs)(`button`,{className:`personal-manager-conversation-btn`,onClick:()=>r(l.text),title:o(`conversation.convertHint`),type:`button`,children:[(0,z.jsx)(Rm,{size:13}),(0,z.jsx)(`span`,{children:o(`conversation.toTask`)})]}):null,(0,z.jsx)(`button`,{className:`personal-manager-conversation-link`,onClick:i,type:`button`,children:o(`conversation.full`)}),n?(0,z.jsx)(`button`,{"aria-label":o(`conversation.close`),className:`personal-manager-conversation-close`,onClick:n,title:o(`conversation.close`),type:`button`,children:(0,z.jsx)(gh,{size:14})}):null]})]}),(0,z.jsx)(`div`,{"aria-live":`polite`,className:`personal-manager-conversation-messages`,children:c.map(t=>(0,z.jsxs)(`article`,{className:`is-${t.role}`,children:[(0,z.jsx)(`strong`,{children:t.role===`user`?o(`common.you`):t.agentLabel??e??o(`header.manager`)}),(0,z.jsxs)(`div`,{className:`personal-manager-conversation-bubble`,children:[t.role===`user`?(0,z.jsx)(`p`,{children:t.text}):(0,z.jsx)(wb,{text:t.text}),t.pending?(0,z.jsx)(`small`,{children:o(`conversation.agentPending`)}):null,(0,z.jsx)(Wy,{request:t.collaboration}),(0,z.jsx)(Vb,{delivery:t.returnDelivery})]})]},t.id))})]})}function XS({onClose:e,onOpenDetails:t,run:n}){let{t:r}=Ji();return(0,z.jsxs)(`section`,{"aria-label":r(`session.record`),className:`personal-session-record`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(fm,{size:17}),r(`session.record`)]}),(0,z.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,z.jsx)(gh,{size:15})})]}),(0,z.jsx)(`div`,{children:(0,z.jsx)(`strong`,{children:n.title})}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Agent`}),(0,z.jsx)(`dd`,{children:n.agentLabel})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`common.status`)}),(0,z.jsx)(`dd`,{children:Xi(n.sessionStatus??n.status,r)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Session`}),(0,z.jsx)(`dd`,{title:n.sessionId,children:n.sessionId})]})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:t,type:`button`,children:r(`session.details`)})]})}function ZS(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??Kd(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>Jd(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`})}qd(i)&&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 QS(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function $S(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 eC(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 tC(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 nC(e,t){let n=tC(e),r=eb(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===`team.plan`?e.status===`applied`?db(ub(e.receipt),t):t(`proposal.summary.teamPlan`,{goal:ob(e.normalized_parameters),count:ab(e.normalized_parameters)}):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`?eC(e,r,t):e.action_kind===`team.plan`?ib(e.normalized_parameters,t):$S(e.normalized_parameters,t),goalId:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:void 0,impact:r.retryOriginal?t(`actionReview.${r.reason}`):e.action_kind===`operation.execute`?t(`proposal.impact.operation`):e.action_kind===`team.plan`?e.status===`applied`?t(`proposal.teamPlan.assignedHint`):t(`proposal.impact.teamPlan`):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`):``,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:r.retryOriginal?t(`drawer.retryOriginal`):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===`team.plan`?t(e.status===`applied`?`proposal.teamPlan.viewResult`:`proposal.primary.teamPlan`):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:r.retryOriginal||e.status===`applied`&&e.action_kind!==`operation.execute`&&r.interaction!==`completed`?`error`:QS(e.status),teamPlanOutcome:e.action_kind===`team.plan`?ub(e.receipt)??void 0:void 0,teamPlanAssignments:e.action_kind===`team.plan`?sb(e.receipt,e.normalized_parameters):void 0,teamPlanGapLanes:e.action_kind===`team.plan`?cb(e.receipt,e.normalized_parameters):void 0,title:c}}function rC(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 iC(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 aC(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 oC(e,t){let n=aC(e,[`目标`,`Objective`]),r=aC(e,[`完成标准`,`Completion criteria`]),i=aC(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||iC(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 sC(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 cC(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 lC(e,t){return aC(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 uC(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 dC(e,t){let n=e.toLowerCase();return t.find(e=>n.includes(e.agentId.toLowerCase())||n.includes(e.label.toLowerCase()))}function fC(e){let t=aC(e,[`标题`,`任务标题`,`Todo 标题`]),n=aC(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 pC=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),mC=5242880,hC=4;function gC(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 _C({conversationSessionId:e,agents:t=[{agentId:`codex`,available:!0,capability:`代码与项目执行`,label:`Codex`}],callbacks:n={},goalArchiveLoadState:r={error:null,phase:`ready`},managerChannelBinding:i,managerRuntime:a,model:o,readOnly:s=!1,selectedAgentId:c,selectedGoalId:l,statusSourceControl:u}){let{locale:d,t:f}=Ji(),[p,m]=(0,R.useState)(l??null),[h,g]=(0,R.useState)(c??t.find(e=>e.available)?.agentId??`codex`),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(null),[C,w]=(0,R.useState)({}),[T,E]=(0,R.useState)(`chat`),[D,O]=(0,R.useState)(!1),[k,A]=(0,R.useState)(!1),[ee,j]=(0,R.useState)(!1),[M,te]=(0,R.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{}}}),[ne,N]=(0,R.useState)(!1),[P,re]=(0,R.useState)(null),[ie,ae]=(0,R.useState)(`queue`),[F,oe]=(0,R.useState)(``),[I,se]=(0,R.useState)([]),[L,ce]=(0,R.useState)(null),[le,ue]=(0,R.useState)(null),[de,fe]=(0,R.useState)(()=>new Set),[pe,me]=(0,R.useState)(()=>new Set),[he,ge]=(0,R.useState)(`idle`),[_e,ve]=(0,R.useState)([]),[ye,be]=(0,R.useState)([]),[xe,Se]=(0,R.useState)(!1),[Ce,we]=(0,R.useState)(VS),[Te,Ee]=(0,R.useState)({}),[De,Oe]=(0,R.useState)([]),ke=(0,R.useRef)(!1),Ae=(0,R.useRef)(NaN),je=(0,R.useRef)(null),Me=(0,R.useRef)(null),Ne=(0,R.useRef)(null),Pe=(0,R.useRef)(null),Fe=(0,R.useRef)(new Set),Ie=(0,R.useRef)(new Set),[Le,Re]=(0,R.useState)(null),B=l===void 0?p:l,ze=c??h,Be=`${B??`manager`}:${ze}`,Ve=M[Be]??``;(0,R.useEffect)(()=>{se([]),ce(null)},[Be]);function He(e,t){te(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 Ue(e){He(Be,e)}function We(e){return kh.find(t=>t.id===e)?.prompt??``}(0,R.useEffect)(()=>{let e=je.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[Ve]);let Ge=(0,R.useMemo)(()=>o.goals.map(e=>{let t=Te[e.goalId];return t?{...e,repository:{branch:t.branch,identity:t.identity,label:t.label,readOnly:!0}}:e}),[Te,o.goals]),Ke=(0,R.useMemo)(()=>Ge.filter(e=>Jd(e)===`needs_you`).length,[Ge]),qe=(0,R.useMemo)(()=>Ge.filter(e=>Jd(e)===`needs_you`&&(e.needsYouBlocking||e.state===`等你`)).length,[Ge]),V=Ge.find(e=>e.goalId===B)??null;function Je(e){Ne.current=document.activeElement instanceof HTMLElement?document.activeElement:null,Se(!1),v(e)}function Ye(){v(null),window.requestAnimationFrame(()=>{let e=Ne.current;e?.isConnected&&e.getClientRects().length?e.focus({preventScroll:!0}):document.querySelector(`.personal-mobile-menu`)?.focus({preventScroll:!0})})}let Xe=_?.kind===`settings`,Ze=B,Qe=(0,R.useMemo)(()=>{let e=Object.values(C).filter(e=>e.actionKind===`heartbeat.bind`&&e.goalId&&e.status===`applied`).map(e=>({id:`schedule:${e.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:ze,executionHistory:[],goalId:e.goalId,label:e.title,nextRunAt:f(`drawer.schedulePending`),notificationRule:f(`drawer.scheduleDefaultNotification`),schedule:e.fields.find(e=>e.key===`cadence`)?.value??f(`schedule.summary`),scheduleId:`${e.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:e.status===`applied`?`active`:`draft`,stopCondition:e.fields.find(e=>e.key===`stop_condition`)?.value??f(`drawer.scheduleDefaultStop`),timezone:e.fields.find(e=>e.key===`timezone`)?.value??`Asia/Shanghai`}})),t=[...ZS(o,Ze,f),...o.timeline??[],...e,...GS(Object.values(C)).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)||e.proposal.reviewPlan?.retryOriginal===!0||_e.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)},[Ze,o,C,ze,B,_e,f]),$e=(0,R.useMemo)(()=>x?Qe.filter(e=>e.kind===`message`?!0:e.kind===`run`?e.run.runId===x.runId:e.kind===`output`&&e.output.runId===x.runId):Qe,[x,Qe]);(0,R.useEffect)(()=>{if(!x)return;let e=Qe.find(e=>e.kind===`run`&&e.run.runId===x.runId);!e||e.kind!==`run`||JSON.stringify({completedSteps:x.completedSteps,latestActivity:x.latestActivity,messages:x.sessionMessages,sessionStatus:x.sessionStatus,status:x.status,totalSteps:x.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})&&S(e.run)},[x,Qe]);let et=(0,R.useMemo)(()=>Qe.flatMap(e=>e.kind===`message`?[e.message]:[]),[Qe]),tt=(0,R.useMemo)(()=>V?Qe.flatMap(e=>e.kind===`message`?[e.message]:[]):[],[Qe,V]);(0,R.useEffect)(()=>{V||D||et.some(e=>e.pending)&&A(!0)},[D,et,V]),(0,R.useEffect)(()=>{!V||T===`chat`||tt.some(e=>e.pending)&&j(!0)},[tt,V,T]);let nt=(0,R.useMemo)(()=>Qe.filter(e=>e.kind===`message`||e.kind===`proposal`&&(_e.includes(e.proposal.previewId)||ye.includes(e.proposal.previewId))),[Qe,_e,ye]),rt=nt[nt.length-1],it=rt?.kind===`message`?rt.message.text.length:0;(0,R.useEffect)(()=>{if(!D||!Me.current)return;let e=window.requestAnimationFrame(()=>{Me.current&&(Me.current.scrollTop=Me.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[nt.length,D,it]);let at=(0,R.useMemo)(()=>{if(_?.kind===`settings`)return null;if(_?.kind===`attention`)return{kind:`attention`,item:rf(_.item,o.attentionHistory??o.userTodos)};if(_?.kind===`goal`){let e=Ge.find(e=>e.goalId===_.item.goalId);return e?{item:e,kind:`goal`}:_}if(_?.kind!==`run`)return _;let e=Qe.find(e=>e.kind===`run`&&e.run.runId===_.item.runId);return e?{item:e.run,kind:`run`}:_},[Qe,_,Ge,o.attentionHistory,o.userTodos]);(0,R.useEffect)(()=>{if(s){Ee({}),Oe([]);return}let e=!1;return Promise.all([h_(),E_()]).then(([t,n])=>{e||(Ee(Object.fromEntries(t.map(e=>[e.goal_id,e.repository]))),Oe(n))}).catch(()=>{}),()=>{e=!0}},[s]),(0,R.useEffect)(()=>{if(!xe)return;function e(e){e.key===`Escape`&&Se(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[xe]),(0,R.useEffect)(()=>{if(B||!Qe.length)return;if(!ke.current){ke.current=!0;try{Ae.current=Date.parse(window.localStorage.getItem(`loopx-pw-last-visit`)??``),window.localStorage.setItem(`loopx-pw-last-visit`,new Date().toISOString())}catch{Ae.current=NaN}}let e=Ae.current,t=Qe.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={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};Re(e=>e?.done===r.done&&e.failed===r.failed?e:r)},[Qe,B]),(0,R.useEffect)(()=>{if(s){w({});return}let e=!1;return eg(B?{goalId:B}:{contextKind:`manager`}).then(t=>{if(e)return;let n=t.filter(e=>[`preview_ready`,`gated`,`deferred`,`applying`].includes(e.status)||eb(e).retryOriginal===!0||e.action_kind===`operation.execute`&&e.status===`applied`).map(e=>nC(e,f)),r=Object.fromEntries(n.map(e=>[e.previewId,e]));w(e=>({...e,...r})),B||be(n.map(e=>e.previewId))}).catch(()=>{}),()=>{e=!0}},[s,B,f]);async function ot(e,t={}){if(s)throw Error(f(`source.readOnlyWriteError`));let r;try{r=n.onPreviewAction?await n.onPreviewAction(e):nC(await Qh(e),f)}catch(t){if(!(t instanceof qh)||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??f(`proposal.workspaceGate.defaultSummary`))},impact:f(o?`proposal.workspaceGate.agentImpact`:`proposal.workspaceGate.selectionImpact`),previewId:`workspace-choice-${Date.now().toString(36)}`,sourceRequest:e,status:`gated`,title:f(o?`proposal.workspaceGate.agentTitle`:`proposal.workspaceGate.selectionTitle`),workspaceCandidates:i}}return ve(e=>e.includes(r.previewId)?e:[...e,r.previewId]),w(e=>({...e,[r.previewId]:r})),t.select!==!1&&v({item:r,kind:`proposal`}),r}function st(){_t(null),He(`manager:${ze}`,f(`composer.createGoalTemplate`)),window.requestAnimationFrame(()=>je.current?.focus())}async function ct(e,t){Se(!1);let r={delete:`Deleted from the owner workspace`,resume:`Resumed from the owner workspace`,stop:`Stopped from the owner workspace`},i={delete:f(`proposal.summary.lifecycleDelete`,{title:e.title}),resume:f(`proposal.summary.lifecycleResume`,{title:e.title}),stop:f(`proposal.summary.lifecycleStop`,{title:e.title})},a=null,o=!1;try{if(t===`stop`){if(Fe.current.has(e.goalId))return;Fe.current.add(e.goalId),fe(new Set(Fe.current)),v(null),a={goalId:e.goalId,next:`stopped`,optimisticApplied:!0,previous:e.activationState},ue(f(`feedback.applying`,{title:i.stop})),n.onGoalActivationStateChange?.(e.goalId,`stopped`)}if(n.onExecuteGoalLifecycle){if(t===`delete`)throw Error(`The selected status source does not authorize Goal deletion.`);let a=await n.onExecuteGoalLifecycle({goalId:e.goalId,operation:t,reason:r[t]});if(!a.projectionVerified)throw Error(`Goal lifecycle projection did not verify.`);o=!0,n.onGoalActivationStateChange?.(e.goalId,a.activationState),ue(f(`feedback.completed`,{title:i[t]})),t===`stop`&&_t(null),await ft([e.goalId]);return}let s=await ot({actionKind:`goal.lifecycle`,context:{kind:`goal_directory`,goal_id:e.goalId},idempotencyKey:`workspace-goal-${t}-${e.goalId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:t,reason:r[t]},summary:i[t]},{select:t!==`stop`});if(s.goalId!==e.goalId||s.lifecycleOperation!==t)throw v(null),Error(f(`actionReview.targetChanged`));t===`stop`&&(s.reviewPlan?.interaction===`direct`?(o=!0,await pt(s,{lifecycleProjection:a??void 0,presentation:`feedback`})):(a&&n.onGoalActivationStateChange?.(a.goalId,a.previous),ue(s.gate?f(`feedback.gateRequired`,{summary:s.gate.summary}):f(`feedback.notCompleted`,{status:s.status})),v({item:s,kind:`proposal`})))}catch(e){a&&!o&&n.onGoalActivationStateChange?.(a.goalId,a.previous),ue(f(`feedback.executionFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{t===`stop`&&(Fe.current.delete(e.goalId),fe(new Set(Fe.current)))}}function lt(e,t){Ue(f(t?e===`heartbeat`?`composer.heartbeatTemplate`:`composer.monitorTemplate`:e===`heartbeat`?`composer.heartbeatTemplateWithoutGoal`:`composer.monitorTemplateWithoutGoal`)),v(null),window.requestAnimationFrame(()=>je.current?.focus())}async function ut(e,t,r=``){let i=await n.onRequestScheduleConfig?.(e,t);if(i){ve(e=>e.includes(i.previewId)?e:[...e,i.previewId]),w(e=>({...e,[i.previewId]:i})),v({item:i,kind:`proposal`});return}if(!t){Ue(f(e===`heartbeat`?`composer.heartbeatGoalQuestion`:`composer.monitorGoalQuestion`));return}let a=Date.now().toString(36);await ot({actionKind:e===`heartbeat`?`heartbeat.bind`:`monitor.create`,context:{kind:`schedule`,goal_id:t},idempotencyKey:`workspace-${e}-${t}-${a}`,normalizedParameters:e===`heartbeat`?{agent_id:ze,cadence:sC(r),goal_id:t,stop_condition:uC(r),timezone:`Asia/Shanghai`}:{agent_id:ze,cadence:sC(r),goal_id:t,stop_condition:uC(r),target:lC(r,f),target_key:`goal-${t}`,timezone:`Asia/Shanghai`},summary:e===`heartbeat`?f(`proposal.summary.heartbeat`):f(`proposal.summary.monitor`,{target:lC(r,f)})})}async function dt(e){if(!Ie.current.has(e.todoId)){Ie.current.add(e.todoId),me(new Set(Ie.current)),ue(f(`feedback.preparingPreview`,{title:e.text}));try{await ot({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:f(`tasks.markComplete`,{name:e.text})}),ue(null)}catch(e){ue(f(`feedback.previewFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{Ie.current.delete(e.todoId),me(new Set(Ie.current))}}}function ft(e){let t=n.onReconcileStatus,r=t?t({invalidateGoalIds:e}):n.onRefresh?.();return Promise.resolve(r).catch(()=>{ue(f(`feedback.goalRefreshFailed`))})}async function pt(e,t={}){let r=e.actionKind===`team.plan`&&e.status===`error`&&[`apply_failed`,`readback_unverified`].includes(e.reviewPlan?.reason??``);if(e.reviewPlan&&!e.reviewPlan.canApply&&!r)return;let i=t.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:o.goals.find(t=>t.goalId===e.goalId)?.activationState??(e.lifecycleOperation===`stop`?`active`:`stopped`)}:null,s=t.lifecycleProjection??a;ue(f(`feedback.applying`,{title:e.title}));let c={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`pending`,reason:`apply_pending`,canApply:!1}:void 0,status:`applying`};w(t=>({...t,[e.previewId]:c})),i&&v({item:c,kind:`proposal`}),s&&!s.optimisticApplied&&n.onGoalActivationStateChange?.(s.goalId,s.next);try{if(n.onApplyProposal){await n.onApplyProposal(e);let t={...e,status:`applied`};w(n=>({...n,[e.previewId]:t})),i&&v({item:t,kind:`proposal`}),ue(f(`feedback.completed`,{title:e.title})),e.actionKind===`goal.lifecycle`&&((e.lifecycleOperation===`stop`||e.lifecycleOperation===`delete`)&&_t(null),e.lifecycleOperation===`delete`&&e.goalId&&n.onGoalDeleted?.(e.goalId),ft(e.goalId?[e.goalId]:void 0));return}let t=await tg(e.previewId);if(t.proposal.proposal_id!==e.previewId||t.proposal.action_kind!==e.actionKind||e.actionKind===`goal.lifecycle`&&(t.proposal.normalized_parameters.goal_id!==e.goalId||tC(t.proposal)!==e.lifecycleOperation))throw new qh(f(`actionReview.targetChanged`),{error_code:`action_response_mismatch`});let r=nC(t.proposal,f);if(w(t=>({...t,[e.previewId]:r})),i&&v({item:r,kind:`proposal`}),r.reviewPlan?.interaction!==`completed`){s&&n.onGoalActivationStateChange?.(s.goalId,s.previous),v({item:r,kind:`proposal`}),ue(t.proposal.status===`stale`?f(`feedback.stale`):f(`actionReview.${r.reviewPlan.reason}`));return}ue(f(`feedback.completed`,{title:r.title})),r.actionKind===`todo.create`&&await n.onRefresh?.(),r.actionKind===`goal.lifecycle`&&(r.lifecycleOperation===`stop`||r.lifecycleOperation===`delete`)&&_t(null),r.actionKind===`goal.lifecycle`&&r.lifecycleOperation===`delete`&&r.goalId&&n.onGoalDeleted?.(r.goalId),r.actionKind===`goal.lifecycle`&&ft(r.goalId?[r.goalId]:void 0)}catch(t){if(s&&n.onGoalActivationStateChange?.(s.goalId,s.previous),t instanceof qh&&t.payload.error_code===`protected_action`){let r=t.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??t.message)},status:`gated`};w(t=>({...t,[e.previewId]:a})),v({item:a,kind:`proposal`}),ue(f(`feedback.gateRequired`,{summary:a.gate.summary})),e.actionKind===`goal.create`&&e.goalId&&(n.onRefresh?.(),_t(e.goalId));return}let r=t instanceof qh&&tb(t.payload),i=t instanceof qh&&t.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:t instanceof Error?t.message:String(t),status:r?`stale`:`error`};w(t=>({...t,[e.previewId]:a})),v({item:a,kind:`proposal`}),ue(f(`feedback.executionFailed`,{error:a.errorMessage}))}}function mt(){E(`chat`),S(null),j(!1),window.requestAnimationFrame(()=>{let e=Me.current?.querySelectorAll(`.personal-message.is-assistant`);e?.item(e.length-1)?.scrollIntoView({block:`start`})})}let ht={...n,onOpenRunSession:async e=>{e.goalId!==B&&_t(e.goalId),E(`chat`),await n.onOpenRunSession?.(e),S(e),v(null)},onOpenGoal:e=>{_t(e),ft([e])},onOpenGoalView:e=>{e===`chat`?mt():E(e),v(null)},onOpenOutput:e=>{e.goalId!==B&&_t(e.goalId),E(`files`),n.onOpenOutput?.(e)},onApplyProposal:pt,onCancelProposal:async e=>{v(null),w(t=>{let n={...t};return delete n[e.previewId],n});try{n.onCancelProposal?.(e),n.onCancelProposal||await ng(e.previewId)}catch(t){w(t=>({...t,[e.previewId]:e})),ue(f(`feedback.cancelFailed`,{error:t instanceof Error?t.message:String(t)}))}},onTransitionProposal:async(e,t)=>{let n=nC(await rg(e.previewId,t),f);ve(e=>e.includes(n.previewId)?e:[...e,n.previewId]),w(r=>{let i={...r};return t===`regenerate`&&delete i[e.previewId],i[n.previewId]=n,i}),v({item:n,kind:`proposal`})},onSelectWorkspaceCandidate:async(e,t)=>{e.sourceRequest&&(w(t=>{let n={...t};return delete n[e.previewId],n}),await ot({...e.sourceRequest,idempotencyKey:`${e.sourceRequest.idempotencyKey}-${t}`,normalizedParameters:{...e.sourceRequest.normalizedParameters,workspace_ref:t}}))},onPreviewAction:ot,onRequestScheduleConfig:(e,t)=>lt(e,t),onOpenNotificationSettings:e=>Je({goalId:e,kind:`settings`,tab:`lark`}),onFetchNotificationTargets:()=>Ng(),onSetupGoalChannel:e=>Fg(e),onToggleGoalAutoNotify:e=>Ig(e),onUpdateSchedule:async(e,t)=>{let n=Date.now().toString(36),r=e.scheduleKind===`heartbeat`;await ot({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??ze,...!r&&t===`run_now`?{endpoint_id:ze}:{},...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}`})}},gt=s?{onOpenGoal:ht.onOpenGoal,onOpenGoalView:ht.onOpenGoalView,onOpenOutput:ht.onOpenOutput}:ht;function _t(e){m(e),O(!1),A(!1),j(!1),S(null),v(null),E(`tasks`),Se(!1),n.onSelectGoal?.(e)}function vt(e){g(e),n.onSelectAgent?.(e)}function yt(e){we(e),HS(e)}async function bt(r){let i=r?[]:I,a=(r??Ve).trim()||(i.length?f(`composer.imageAnalysisPrompt`):``);if(!(!a||ne)){if(P?.session_id===e&&P?.enabled&&P.active_turn_id&&e){if(i.length){ce(d===`zh-CN`?`运行中的消息投递暂不支持图片,请暂停后发送。`:`Pause execution before sending images.`);return}N(!0);try{let t=await Sg(e,a,ie);r||Ue(``),oe(d===`zh-CN`?`${ie===`queue`?`已排队,等待后续回合`:ie===`inbox`?`已进入收件箱`:`已提交纠偏`} · ${t.status}`:`${ie}: ${t.status}`)}catch(e){ce(e instanceof Error?e.message:String(e))}finally{N(!1)}return}r||(Ue(``),se([])),ce(null),N(!0);try{if(i.length){B?T!==`chat`&&j(!0):A(!0);let e=await n.onSendMessage?.(a,ze,B,i);e&&await ot(e);return}let e=Zb(a,{agents:t.map(e=>({agentId:e.agentId,label:e.label})),goalId:B,todos:(V?.agentTodos??[]).map(e=>({text:e.text,todoId:e.todoId}))});if(e.route===`clarify`){Ue(a);let t=f(`composer.clarifySingleAction`);e.missingFields.includes(`resume_when`)&&(t=f(`composer.clarifyDefer`)),ue(t);return}if(e.actionKind===`goal.create`){let t=oC(a,f),n=rC(t.title);await ot({actionKind:`goal.create`,context:{kind:`manager`,goal_id:null,natural_language:a},idempotencyKey:`workspace-goal-intent-${n}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:ze,completion_criteria:t.completionCriteria,execution_boundary:t.executionBoundary,goal_id:n,heartbeat:{cadence:sC(a),enabled:e.normalizedParameters.heartbeat_enabled===!0,timezone:`Asia/Shanghai`},initial_todos:t.initialTodos,objective:t.objective,permission:t.permission,stop_condition:uC(a),title:t.title,workspace_ref:`current`},summary:f(`proposal.summary.goalCreate`,{title:t.title})});return}if(B&&e.actionKind===`heartbeat.bind`){await ut(`heartbeat`,B,a);return}if(B&&e.actionKind===`monitor.create`){let e=cC(a,f);if(e){Ue(a),ue(e);return}await ut(`monitor`,B,a);return}let r=dC(a,t);if(B&&r&&e.actionKind===`agent.bind`){await ot({actionKind:`agent.bind`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-agent-bind-${B}-${r.agentId}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:r.agentId,goal_id:B},summary:`将 ${r.label} 绑定到 ${V?.title??B}`});return}if(B&&e.actionKind===`todo.create`){if(e.normalizedParameters.start_execution===!0){await ot({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-task-start-${B}-${Date.now().toString(36)}`,normalizedParameters:{endpoint_id:r?.agentId??ze,goal_id:B,start_execution:!0,text:a},summary:`交给 Agent 执行:${a.slice(0,120)}`});return}let t=r?.agentId??(/(交给|分配给|让).{0,24}(agent|codex|claude|kiro|kimi)/iu.test(a)?ze:null);await ot({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-todo-create-${B}-${Date.now().toString(36)}`,normalizedParameters:{...t?{endpoint_id:t}:{},goal_id:B,text:fC(a)},summary:`创建 Todo:${fC(a)}`});return}let o=V?.agentTodos.find(e=>a.includes(e.todoId)||a.includes(e.text)),s=typeof e.normalizedParameters.operation==`string`?e.normalizedParameters.operation:null;if(B&&o&&e.actionKind===`todo.update`&&s){await ot({actionKind:`todo.update`,context:{kind:`todo`,goal_id:B,todo_id:o.todoId,natural_language:a},idempotencyKey:`workspace-todo-update-${o.todoId}-${s}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:ze,...s===`reassign`&&r?{endpoint_id:r.agentId}:{},...s===`block`?{note:a}:{},...s===`defer`&&typeof e.normalizedParameters.resume_when==`string`?{resume_when:e.normalizedParameters.resume_when}:{},goal_id:B,operation:s,todo_id:o.todoId},summary:`更新 Todo:${o.text}`});return}B?T!==`chat`&&j(!0):A(!0);let c=await n.onSendMessage?.(a,ze,B);c&&await ot(c)}catch(e){r||(Ue(a),se(i));let t=e instanceof Error?e.message:f(`feedback.sendGenericError`);ue(f(`feedback.sendFailed`,{error:t}))}finally{N(!1)}}}let xt=t.find(e=>e.agentId===ze)?.label??ze,St=!V&&Ve.startsWith(f(`composer.createGoalDraftLead`));async function Ct(e){if(!e?.length)return;let t=hC-I.length,n=Array.from(e).slice(0,Math.max(0,t)),r=n.find(e=>!pC.has(e.type)),i=n.find(e=>e.size>mC);if(t<=0){ce(f(`composer.imageCountError`,{count:hC}));return}if(r){ce(f(`composer.imageTypeError`));return}if(i){ce(f(`composer.imageSizeError`,{size:mC/1024/1024}));return}try{let t=await Promise.all(n.map(e=>gC(e,f)));se(e=>[...e,...t].slice(0,hC)),ce(e.length>n.length?f(`composer.imageCountError`,{count:hC}):null)}catch(e){ce(e instanceof Error?e.message:f(`composer.imageReadGenericError`))}finally{Pe.current&&(Pe.current.value=``)}}function wt(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 Tt(){let e=await E_();Oe(e)}async function Et(){await Promise.all([Tt(),n.onRefresh?.()])}async function Dt(){if(!(!n.onRefresh||he===`loading`)){ge(`loading`);try{await n.onRefresh(),ge(`done`)}catch{ge(`error`)}window.setTimeout(()=>ge(`idle`),1800)}}let Ot=Xe?(0,z.jsx)(RS,{callbacks:gt,focusGoalConnection:!!(_?.kind===`settings`&&_.goalId),goalNotifications:o.goalNotifications??[],goals:Ge,initialGoalId:_?.kind===`settings`?_.goalId??B:B,initialTab:_?.kind===`settings`?_.tab??`lark`:`lark`,onChanged:()=>void Et(),onClose:Ye,onThemeChange:yt,theme:Ce}):null;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{hidden:Xe,children:(0,z.jsx)(US,{drawer:at?(0,z.jsx)(ox,{agents:t,attentionHistory:o.attentionHistory??o.userTodos,onSelectAttention:e=>v({kind:`attention`,item:e}),callbacks:gt,goalNotifications:o.goalNotifications??[],goals:Ge,inspectorExpanded:y,larkConnections:s?[]:De,onClose:()=>{at.kind===`proposal`&&[`applied`,`rejected`].includes(at.item.status)&&(at.item.actionKind!==`heartbeat.bind`||at.item.status!==`applied`)&&w(e=>{let t={...e};return delete t[at.item.previewId],t}),b(!1),v(null)},onToggleInspectorSize:()=>b(e=>!e),readOnly:s,runs:Qe.flatMap(e=>e.kind===`run`?[e.run]:[]),selection:at}):null,drawerMode:at?.kind===`todo`?y?`inspector-full`:`inspector`:`panel`,drawerOpen:at!==null,mobileSidebarOpen:xe,onCloseMobileSidebar:()=>Se(!1),theme:Ce,main:(0,z.jsxs)(`div`,{className:`personal-channel`,children:[(0,z.jsx)(pb,{agents:t,managerChatOpen:D,managerChannelBinding:i,managerRuntime:a,mobileNavigationOpen:xe,onOpenGoalCapabilities:V&&!s?()=>Je({goalId:V.goalId,kind:`settings`,tab:`capabilities`}):void 0,onRefresh:n.onRefresh?()=>void Dt():void 0,onOpenNavigation:()=>Se(!0),onOpenManagerChat:()=>{A(!1),O(!0)},onSelectGoalTab:e=>{e===`chat`?mt():E(e)},onSelectAgent:vt,onReturnManagerHome:()=>{O(!1),A(!1),window.requestAnimationFrame(()=>Me.current?.scrollTo({behavior:`smooth`,top:0}))},selectedAgentId:ze,refreshState:he,readOnlySourceLabel:s?u?.activeSource.label:void 0,selectedGoal:V,selectedGoalTab:T}),B&&T===`chat`&&!s&&ze===`codex`&&n.onStartLoopX?(0,z.jsx)(Nb,{onPrepare:()=>n.onPrepareLoopX(ze,B),sessionId:e,onChange:re,onExecute:(e,t)=>n.onStartLoopX?.(e,ze,B,t)},`${B}:${ze}`):null,(0,z.jsxs)(`div`,{className:`personal-channel-scroll`,"data-active-goal-view":V?T:void 0,ref:Me,children:[B&&T===`chat`&&!s&&ze===`codex`&&e&&P?.settings.execution_config&&P.settings.agent_id?(0,z.jsx)(Fb,{sessionId:e,zh:d===`zh-CN`,refreshKey:JSON.stringify(P.deliveries)},`${e}:${P.settings.agent_id}:${P.settings.execution_config}`):null,!V&&!D&&Le&&Le.done+Le.failed>0?(0,z.jsxs)(`section`,{className:`personal-digest-card`,"aria-label":f(`digest.away`),children:[(0,z.jsx)(`strong`,{children:f(`digest.away`)}),(0,z.jsxs)(`div`,{className:`personal-digest-stats`,children:[Le.done>0?(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:Le.done}),f(`digest.completed`)]}):null,Le.failed>0?(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:Le.failed}),f(`digest.failed`)]}):null]})]}):null,!V&&!D?(0,z.jsxs)(`section`,{className:`personal-manager-greeting`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(fm,{size:20})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:f(`home.greeting`)}),(0,z.jsx)(`p`,{children:o.goals.some(e=>e.activationState===`active`&&e.loadState)?f(`startup.partial`):(0,z.jsxs)(z.Fragment,{children:[f(`home.waitingCount`,{count:Ke}),` `,qe>0?f(`home.blockingSummary`,{count:qe}):null]})})]})]}):null,V?.loadState?(0,z.jsx)(`section`,{className:`personal-manager-greeting`,role:`status`,"data-testid":`goal-status-loading`,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:f(V.loadState===`error`?`startup.goalError`:`startup.goalLoading`)}),(0,z.jsx)(`p`,{children:f(V.loadError?`startup.error.${V.loadError}`:`startup.independent`)}),V.loadState===`error`?(0,z.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,type:`button`,onClick:()=>void n.onRefresh?.(),children:f(`startup.retry`)}):null]})}):V?(0,z.jsx)(Xx,{activeTab:T,scrollRef:Me,panels:{overview:(0,z.jsx)(Yx,{active:!Xe&&T===`overview`,goal:V,items:Qe,userTodos:o.userTodos,readOnly:s,onOpenDetails:()=>v({kind:`goal`,item:V}),onSelect:v,onView:E}),tasks:(0,z.jsx)(Mx,{historyEnabled:!s,goal:V,items:Qe,onDraftTaskFromMessage:s?void 0:e=>{Ue(`创建一个 Task:${WS(e)}`),ue(f(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>je.current?.focus())},onOpenChat:mt,onQuickComplete:s?void 0:dt,onSelect:v,quickCompletingTodoIds:pe,selectedTodoId:at?.kind===`todo`?at.item.todoId:null,userTodos:o.userTodos}),files:(0,z.jsx)(JS,{active:T===`files`,items:Qe.filter(e=>e.kind===`output`),onSelect:v,reportState:o.periodicReports,teamSessionId:!s&&ze===`codex`?e:void 0}),chat:(0,z.jsxs)(z.Fragment,{children:[V&&x?.goalId===V.goalId?(0,z.jsx)(XS,{onClose:()=>S(null),onOpenDetails:()=>v({item:x,kind:`run`}),run:x}):null,(0,z.jsx)(Hb,{items:$e,onSelect:v,selectedGoal:V})]})}},`${u?.activeSource.statusUrl??`/status.json`}:${V.goalId}`):D?(0,z.jsx)(Hb,{items:nt,onSelect:v,selectedGoal:null}):(0,z.jsx)(qS,{goals:Ge,onRetry:()=>void n.onRefresh?.(),onSelectGoal:_t,systemHealth:o.systemHealth})]}),(0,z.jsxs)(`div`,{className:`personal-composer-wrap`,children:[P?.session_id===e&&P?.enabled&&P.active_turn_id?(0,z.jsxs)(`label`,{className:`goal-loopx-message-mode`,children:[d===`zh-CN`?`消息处理`:`Message delivery`,(0,z.jsxs)(`select`,{"aria-label":d===`zh-CN`?`消息处理方式`:`Message delivery mode`,value:ie,onChange:e=>ae(e.target.value),children:[(0,z.jsx)(`option`,{value:`queue`,children:d===`zh-CN`?`下一轮处理`:`Next turn`}),(0,z.jsx)(`option`,{value:`inbox`,children:d===`zh-CN`?`放入收件箱`:`Inbox`}),(0,z.jsx)(`option`,{value:`steer`,children:d===`zh-CN`?`立即纠偏`:`Steer now`})]}),(0,z.jsx)(`span`,{role:`status`,children:F})]}):null,s?(0,z.jsxs)(`div`,{className:`personal-read-only-notice`,children:[(0,z.jsx)(`strong`,{children:f(`source.readOnlyNoticeTitle`)}),(0,z.jsx)(`span`,{children:f(`source.readOnlyNoticeDescription`)})]}):(0,z.jsxs)(z.Fragment,{children:[!V&&!D&&k&&et.length?(0,z.jsx)(YS,{messages:et,onClose:()=>A(!1),onOpenConversation:()=>{A(!1),O(!0)}}):null,V&&T!==`chat`&&ee&&tt.length?(0,z.jsx)(YS,{agentLabel:xt,messages:tt,onClose:()=>j(!1),onDraftTask:T===`tasks`?e=>{Ue(`创建一个 Task:${WS(e)}`),ue(f(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>je.current?.focus())}:void 0,onOpenConversation:mt,title:`${V.title} · ${xt}`}):null,le?(0,z.jsxs)(`div`,{className:`personal-action-feedback`,role:`status`,children:[(0,z.jsx)(`span`,{children:le}),(0,z.jsx)(`button`,{"aria-label":f(`common.closeActionReceipt`),onClick:()=>ue(null),type:`button`,children:(0,z.jsx)(gh,{size:14})})]}):null,(0,z.jsxs)(`details`,{className:`personal-composer-tools`,children:[(0,z.jsx)(`summary`,{children:d===`zh-CN`?`快捷提问`:`Suggestions`}),V?(0,z.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,z.jsxs)(`button`,{"aria-label":f(`composer.nextAction`),disabled:ne,onClick:()=>void bt(f(`composer.nextActionPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(Hm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.nextAction`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.agentProgress`),disabled:ne,onClick:()=>void bt(f(`composer.agentProgressPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(nh,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.agentProgress`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.monitor`),disabled:ne,onClick:()=>void bt(f(`composer.monitorShortcutTemplate`,{target:f(`schedule.defaultTarget`)})),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(mm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.monitor`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.blockers`),disabled:ne||!We(`gate`),onClick:()=>void bt(We(`gate`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(ym,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.blockers`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.evidence`),disabled:ne||!We(`evidence`),onClick:()=>void bt(We(`evidence`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(jm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.evidence`)})]})]}):(0,z.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,z.jsxs)(`button`,{"aria-label":f(`composer.globalTasks`),disabled:ne,onClick:()=>void bt(f(`composer.globalTasksPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(Hm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.globalTasks`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.globalProgress`),disabled:ne,onClick:()=>void bt(f(`composer.globalProgressPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(nh,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.globalProgress`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.createGoal`),onClick:st,title:f(`composer.createGoalHint`),type:`button`,children:[(0,z.jsx)(Xm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.createGoal`)})]})]})]},B??`manager`),St?(0,z.jsxs)(`div`,{className:`personal-goal-draft-status`,role:`status`,children:[(0,z.jsx)(`strong`,{children:f(`composer.createGoalDraft`)}),(0,z.jsx)(`span`,{children:f(`composer.createGoalDraftDescription`)})]}):null,I.length?(0,z.jsx)(`div`,{className:`personal-composer-images`,"aria-label":f(`composer.imagesPending`),children:I.map(e=>(0,z.jsxs)(`figure`,{children:[(0,z.jsx)(`img`,{alt:e.name,src:e.dataUrl}),(0,z.jsx)(`button`,{"aria-label":f(`composer.sentImageAlt`,{name:e.name}),onClick:()=>se(t=>t.filter(t=>t.id!==e.id)),type:`button`,children:(0,z.jsx)(gh,{size:13})})]},e.id))}):null,L?(0,z.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:L}):null,(0,z.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,z.jsx)(`button`,{"aria-label":f(`composer.addImage`),className:`personal-composer-attach`,disabled:ne||I.length>=hC,onClick:()=>Pe.current?.click(),title:f(`composer.attachImageHint`),type:`button`,children:(0,z.jsx)(qm,{size:17})}),(0,z.jsx)(`input`,{accept:`image/png,image/jpeg,image/webp,image/gif`,"aria-label":f(`composer.imagePicker`),className:`personal-composer-file-input`,disabled:ne||I.length>=hC,multiple:!0,onChange:e=>void Ct(e.target.files),ref:Pe,type:`file`}),(0,z.jsx)(`textarea`,{"aria-label":f(`composer.sendMessage`),onChange:e=>Ue(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),bt())},onPaste:wt,placeholder:V?f(`composer.goalPlaceholder`,{goal:V.title}):f(`composer.managerPlaceholder`),ref:je,rows:1,value:Ve}),(0,z.jsx)(`button`,{"aria-label":f(St?`composer.createGoal`:`composer.send`),disabled:!Ve.trim()&&I.length===0||ne,onClick:()=>void bt(),title:f(St?`composer.createGoalHint`:`composer.sendMessageHint`),type:`button`,children:(0,z.jsx)(nh,{size:18})})]})]})]})]}),sidebar:(0,z.jsx)(Ox,{attentionCount:Ke,goals:Ge,goalArchiveLoadState:r,goalLifecycleOperations:n.onExecuteGoalLifecycle?[`stop`,`resume`]:void 0,lifecycleBusyGoalIds:de,onRequestGoalCreate:s?void 0:st,onRequestGoalLifecycle:s&&!n.onExecuteGoalLifecycle?void 0:(e,t)=>void ct(e,t),onRetryGoalArchive:n.onRetryGoalArchive||n.onRefresh?()=>void(n.onRetryGoalArchive??n.onRefresh)?.():void 0,onOpenSettings:s?void 0:()=>Je({kind:`settings`}),onSelectGoal:_t,selectedGoalId:B,statusSourceControl:u},u?.activeSource.statusUrl??`/status.json`)})}),Ot]})}function vC(e){return(e??``).replace(/\s+/gu,` `).trim()}function yC(e,t=120){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t-1).join(``)}…`}function bC(e,t,n){let r=vC(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`):yC(r)}function xC(e,t){return t({advancing:`projection.agentAdvancingGoal`,idle:`projection.agentIdle`,needs_you:`projection.agentNeedsDecision`,stopped:`projection.agentStopped`,waiting_external:`projection.agentWaitingExternal`}[e])}var SC=`/status.json`,CC=`loopx-status-source-catalog-v1`,wC={id:`local`,kind:`local`,label:`本机`,readOnly:!1,statusUrl:SC};function TC(e,t){let n=xh(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 EC(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 DC(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=TC(n.statusUrl,t);if(!r||r.length>48||!(`url`in i))return null;let a=vx(n.hostAlias)?n.hostAlias.trim():void 0;return{...a?{hostAlias:a}:{},id:EC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url}}function OC(){return{schemaVersion:1,sources:[wC]}}function kC(e,t){try{let n=e.getItem(CC);if(!n)return OC();let r=JSON.parse(n);if(r.schemaVersion!==1||!Array.isArray(r.sources))return OC();let i=new Set([wC.statusUrl]);return{schemaVersion:1,sources:[wC,...r.sources.flatMap(e=>{let n=DC(e,t);return!n||i.has(n.statusUrl)?[]:(i.add(n.statusUrl),[n])})]}}catch{return OC()}}function AC(e,t){e.setItem(CC,JSON.stringify({schemaVersion:1,sources:t.sources.filter(e=>e.kind===`ssh_tunnel`)}))}function jC(e,t){let n=new Set(t.filter(vx).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 MC(e,t,n){let r=t.label.trim();if(!r)return{error:`请填写来源名称。`};if(r.length>48)return{error:`来源名称不能超过 48 个字符。`};let i=TC(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&&!vx(t.hostAlias))return{error:`请选择有效的 SSH Host。`};let a=t.hostAlias?.trim(),o={...a?{hostAlias:a}:{},id:EC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url};return{catalog:{...e,sources:[...e.sources,o]},source:o}}function NC(e,t){return{...e,sources:e.sources.filter(e=>e.kind===`local`||e.id!==t)}}function PC(e,t,n){if(!t.trim()||xh(t,n).source?.isRelative)return wC;let r=t.trim();try{r=new URL(r,n).toString()}catch{return null}return e.sources.find(e=>e.statusUrl===r)??null}function FC(e,t,n){return PC(e,t,n)||(xh(t,n).source?.isRelative?wC:{id:`temporary`,kind:`ssh_tunnel`,label:`临时来源`,readOnly:!0,statusUrl:t.trim()})}function IC(e,t,n,r){return FC(e,t??n,r)}var LC={delete:`删除`,deploy:`部署`,merge:`合并`,payment:`付款`,release:`发布`};function RC(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:`请求受保护操作:${LC[n.operation]} · ${n.target}`}}var zC=SC;async function BC(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 zp(await t.json())}function VC(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 HC(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??VC(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 UC(e){return(e??``).replace(/\s+/g,` `).trim()}function WC(e){let t=new Map;for(let n of e?.goals??[])t.set(n.goal_id,n);return t}function GC(e,t){return e===void 0||t===void 0?void 0:e+t}function KC(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 qC(e){return e?.items.find(e=>!e.done)}function JC(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 YC(e){return e?.queueItem?.project_asset?.quota?.state??e?.queueItem?.quota?.state??e?.goal.quota?.state??`waiting`}function XC(e,t,n){let r=[];for(let t of e){let e=KC(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 ZC(e){return e?.map(e=>({dataUrl:e.data_url,id:e.id,mimeType:e.mime_type,name:e.name,size:e.size}))}var QC=`loopx.personal-agent-selection.v1`;function $C(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(QC)??`{}`);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 ew={需修复:`danger`,等你:`warning`,等待条件:`info`,推进中:`success`,安静运行:`neutral`,已停止:`neutral`,已完成:`neutral`};function tw(e,t){return UC(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 nw(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 rw(e,t){return[`agent`,`assistant`].includes(e.trim().toLowerCase())&&t.trim().length>0}var iw=`已发现的项目 Agent`;function aw(e){switch(Vy(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 tw(e)}}function ow(e,t){switch(Hy(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 iw}}function sw(e,t){let n=e.project_asset;return t===`user`?JC(n?.user_todos,e.user_todos,`project_asset.user_todos`):JC(n?.agent_todos,e.agent_todos,`project_asset.agent_todos`)}function cw(e){return $d(e.title??e.text,112)}function lw(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 uw(e,t){let n=e.completion_validation_revision_history.at(-1);return{resumeWhen:e.resume_when??null,resumeReady:e.resume_ready??null,resumeReceiptId:lw(e),claimedBy:e.claimed_by??null,done:e.status!==`deferred`&&e.done,evidence:e.evidence?$d(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:cw(e),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.index}`,validationDigest:e.completion_validation_sha256??null,validationRevision:e.completion_validation_revision??null,validationRevisionActor:n?.actor_agent_id??null}}function dw(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 fw(e){return dw(e).map(t=>uw(t,e))}function pw(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=uw(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 mw(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:$d(e.title,112),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.claimed_by??`unknown`}:current`}}function hw(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=mw(t,n);r.has(i.todoId)||r.set(i.todoId,i)}return[...r.values()]}function gw(e){let t=e.queueItem?.project_asset?.agent_todos,n=e.queueItem?.agent_todos,r=dw(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=>uw(t,e)),l=r.find(e=>!e.done);return{doneTodoCount:o,nextTodoText:UC(t?.next??``)||(l?UC(l.title??``)||UC(l.text??``):``)||null,recentCompleted:c}}function _w(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 vw(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 yw(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 bw(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 xw(e,t){let n=t.queueItem?.stale_latest_run_warning;return t.severity===`high`||!!yw(e,t)||!!(n?.requires_refresh_state||n?.severity===`high`)||bw(t)}function Sw(e,t){let n=yw(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 Cw(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 ww(e,t){let n=e.latestRun?.operator_gate;return bC(n?.operator_question??n?.reason_summary??n?.follow_up??e.queueItem?.recommended_action??e.latestRun?.recommended_action,t,`projection.confirmAgentDecision`)}function Tw(e,t){if(t.goal.activation_state===`stopped`)return`已停止`;let n=KC(t,`user`),r=KC(t,`agent`),i=!!qC(n),a=!!qC(r);return[`user_or_controller`,`controller`].includes(t.waitingOn)||i||Cw(t)?`等你`:xw(e,t)?`需修复`:t.waitingOn===`external_evidence`?`等待条件`:YC(t)===`eligible`||a?`推进中`:vw(t)?`已完成`:`安静运行`}function Ew(e,t,n,r){if(n===`已停止`)return xC(`stopped`,r);if(n===`需修复`)return bC(Sw(e,t),r,`projection.statusRefreshNeeded`);if(n===`等你`)return xC(`needs_you`,r);if(n===`推进中`){let e=[(KC(t,`agent`)?.items??[]).filter(e=>!e.done).flatMap(e=>[e.title,e.text]).map(e=>UC(e)).find(e=>e!==``&&e!==`暂无`),t.queueItem?.recommended_action,t.latestRun?.recommended_action].map(e=>UC(e)).find(e=>e!==``&&e!==`暂无`);return e?bC(e,r,`projection.agentAdvancingGoal`):xC(`advancing`,r)}return xC(n===`等待条件`?`waiting_external`:`idle`,r)}function Dw(e,t){return t.some(t=>e.includes(t))}function Ow(e,t,n){if(t.goals.some(e=>e.activationState===`active`&&e.loadState))return{text:`Goal 状态尚未全部加载,暂不能给出完整统计。可先打开已加载的 Goal,失败项可重试。`,lines:[]};if(Dw(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(Dw(n,[`现在`,`下一步`,`我该`,`该做什么`,`优先处理`])){let e=t.userTodos[0];if(e)return{text:e.blocking?`先处理「${tw(e.goalId)}」:${e.text}`:`当前最先处理「${tw(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(Dw(n,[`等我`,`阻塞`,`需要我`,`全局待办`]))return t.userTodos.length===0?{text:`目前没有 Goal 在等你,开放用户待办为 0。`,lines:[]}:{text:`有 ${t.userTodos.length} 项开放用户待办,阻塞项优先:`,lines:t.userTodos.slice(0,3).map(e=>`${tw(e.goalId)} · ${e.blocking?`阻塞`:`待处理`} · ${e.text}`)};if(Dw(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 kw(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=WC(e.usage_summary),s=XC(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(sw(e,`user`)?.items??[]).map((r,i)=>({projectedDone:r.done,details:tf(r),actionKind:r.action_kind??null,blocking:n,goalId:e.goal_id,sourceOrder:t,taskClass:r.task_class??null,text:cw(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)||!Cw(t)?[]:[{details:tf({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:ww(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=Tw(e,a),l=f.find(e=>e.goalId===t.id),u=l?.text??null,d=gw(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=hw(fw(a),h,a),b=[d.nextTodoText,a.queueItem?.recommended_action,a.latestRun?.recommended_action,Ew(e,a,c,n)].map(e=>bC(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:Ew(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,hasRunObservation:!!(a.queueItem?.project_asset?.latest_validation||a.latestRun||e.event_ledger_summary?.goals.some(e=>e.goal_id===t.id)),state:c,...r?{subagentExecution:{allowedDomains:t.spawn_policy?.allowed_domains??[],domainCandidates:pw(e,a,y),enabled:t.spawn_policy?.mode===`multi_subagent`&&t.spawn_policy.spawn_allowed===!0&&t.spawn_policy.max_children>0,executionConfig:t.spawn_policy?.execution_config,maxChildren:t.spawn_policy?.max_children??0,modelConfig:t.spawn_policy?.model_config}}:{},title:tw(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:GC(e.input_tokens_24h,e.output_tokens_24h),tokens7d:GC(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?$d(e.current_todo.title,96):null,lastActivityAt:e.last_activity_at??null,state:e.state??null}))}}function Aw({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:_}=Ji(),[v,y]=(0,R.useState)([]),[b,x]=(0,R.useState)(!1),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),E=(0,R.useMemo)(()=>{let e=kw(c,u,_,b);if(!l)return e;let t=Object.values(l.snapshots).map(e=>kw(e,HC(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,_]),D=E.goals.find(e=>e.goalId===d)??null,O=l?.snapshots[d]??c,[k,A]=(0,R.useState)(null),[ee,j]=(0,R.useState)(null),[M,te]=(0,R.useState)(!1),ne=E.goals.some(e=>e.activationState===`active`&&e.loadState===`loading`)?`loading`:E.goals.map(e=>`${e.goalId}:${e.agentId}`).join(`|`),N=D?.goalId??`manager`;E.goals.some(e=>e.activationState===`active`&&e.loadState)||(E.systemHealth?!E.systemHealth.ok:!c.ok)||E.openUserTodoCount>0&&`${E.openUserTodoCount}${E.blockingTodoCount}`;let P=v.length>0?v.map(e=>({agentId:e.agent_id,adapterKind:e.adapter_kind,available:e.available,capability:ow(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:ow(`codex`),label:`Codex`,statusLabel:`正在检测`}],re=[...P,{agentId:`status-only`,available:!0,capability:`不调用模型`,adapterKind:`status_projection`,interrupt:!1,label:`仅查状态`,resume:!0,statusLabel:`只读`,streaming:!1,toolCalls:!1,trustScope:`read_only`}],ie=P.find(e=>e.label===`Codex`&&e.available)?.agentId??P.find(e=>e.available)?.agentId??`status-only`,ae=w?.executor_endpoint?.trim()??``,F=ae?P.find(e=>e.agentId===ae)?.agentId:void 0,oe=e=>e===`manager`?F??ie:ie,[I,se]=(0,R.useState)($C),L=Dh(re,I[N]??oe(N),ie),[ce,le]=(0,R.useState)(!1),[ue,de]=(0,R.useState)(!1),[fe,pe]=(0,R.useState)(`chat`),[me,he]=(0,R.useState)(``),[ge,_e]=(0,R.useState)({}),[ve,ye]=(0,R.useState)({}),[be,xe]=(0,R.useState)(null),[Se,Ce]=(0,R.useState)({}),[we,Te]=(0,R.useState)([]),[Ee,De]=(0,R.useState)(null),[Oe,ke]=(0,R.useState)({}),Ae=(0,R.useRef)(1),je=(0,R.useRef)(1),Me=(0,R.useRef)(new Map),Ne=(0,R.useRef)(new Set),Pe=(0,R.useRef)(new Map),Fe=(0,R.useRef)(new Map),Ie=(0,R.useRef)(new Set),Le=(0,R.useRef)(new Set),Re=(0,R.useRef)(null),B=(0,R.useRef)(null),ze=(0,R.useRef)(null),Be=(0,R.useRef)(null);(0,R.useRef)(null);let Ve=ge[N]??[];ve[N];let He=(e,t)=>e===`manager`?_(`header.manager`):t,Ue=D?E.userTodos.filter(e=>e.goalId===D.goalId):E.userTodos,We=D?.agentTodos??[];_w(We,D?.needsYou?3:4);let Ge=We.filter(e=>e.done).length,Ke=We.length>0?`${Ge}/${We.length}`:`暂无计划`;D&&({...E},Ue.filter(e=>e.blocking).length,Ue.length),(0,R.useEffect)(()=>{let e=bh(f.activeSource.statusUrl,window.location.href),t=e.source?wh(O,e.source):null;if(!D||!t?.indexUrl||!t.detailUrl){A(null),j(null),te(!1);return}let{detailUrl:n,indexUrl:r}=t,i=!1;return A(null),j(null),te(!0),Th(r,D.goalId).then(async e=>{let t=e.items[0]?.detail_ref;return t?Eh(n,t):null}).then(e=>{i||A(e)}).catch(e=>{i||j(Bp(e))}).finally(()=>{i||te(!1)}),()=>{i=!0}},[O,D?.goalId,f.activeSource.statusUrl]);let qe=Se[N]?.sessionId;(0,R.useEffect)(()=>{if(h||!qe)return;let e=!1,t,n=async()=>{try{let t=await cg(qe);if(e)return;let n=t.messages.filter(e=>e.origin===`manager_followup`);_e(e=>{let r=e[N]??[],i=new Set(r.map(e=>e.sourceMessageId)),a=n.filter(e=>!i.has(e.message_id)),o=new Map(n.map(e=>[e.message_id,e.return_delivery])),s=new Map(t.messages.filter(e=>e.role!==`user`&&e.origin!==`manager_followup`).map(e=>[e.turn_id,e])),c=new Map(t.messages.map(e=>[e.message_id,e.collaboration])),l=!1,u=r.map(e=>{let t=e.sourceMessageId?o.get(e.sourceMessageId):void 0,n=e.sourceTurnId?s.get(e.sourceTurnId):void 0,r=e.sourceMessageId?c.get(e.sourceMessageId):n?.collaboration;return JSON.stringify(t)===JSON.stringify(e.returnDelivery)&&JSON.stringify(r)===JSON.stringify(e.collaboration)?e:(l=!0,{...e,sourceMessageId:e.sourceMessageId??n?.message_id,returnDelivery:t,collaboration:r})});return!a.length&&!l?e:{...e,[N]:[...u,...a.map(e=>({id:Ae.current++,sourceMessageId:e.message_id,role:`assistant`,agentLabel:`协作回执`,sourceLabel:`协作回执`,text:nw(e.text),lines:[],returnDelivery:e.return_delivery}))]}})}catch{}finally{e||(t=setTimeout(n,3e3))}};return n(),()=>{e=!0,t&&clearTimeout(t)}},[h,qe,N,L.label]);function V(e,t){Ce(n=>{if(t===null){let t={...n};return delete t[e],t}return{...n,[e]:t}})}(0,R.useEffect)(()=>{if(h){y([]),x(!1),C(null),T(null);return}let e=!1;return ag().then(t=>{if(!e){y(t.adapters??[]);let e=t.manager?.runtime;T(t.manager?.channel_binding??null),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,R.useEffect)(()=>{try{window.localStorage.setItem(QC,JSON.stringify(I))}catch{}},[I]),(0,R.useEffect)(()=>{if(h||!L.available)return;let e=N,t=`${e}:${L.agentId}`,n=D?`goal`:`manager`,r=D?`goal.${D.goalId}`:`manager`,i=!1,a=null,o=null;return(async()=>{try{let s=await dg({agentId:n===`manager`?void 0:L.agentId,channelId:r,goalId:D?.goalId});if(i||(_e(t=>(t[e]?.length??0)>0?t:{...t,[e]:s.messages.map(t=>({sourceMessageId:t.message_id,agentLabel:t.role===`user`?void 0:t.origin===`manager_followup`?`协作回执`:He(e,L.label),attachments:ZC(t.attachments),id:Ae.current++,lines:[],role:t.role===`user`?`user`:`assistant`,returnDelivery:t.return_delivery,collaboration:t.collaboration,sourceLabel:t.role===`user`?void 0:t.role===`error`?`本地会话记录`:e===`manager`?`恢复的${_(`header.manager`)}会话`:`恢复的 ${L.label} 会话`,text:t.role===`user`?t.text:nw(t.text)}))}),L.agentId===`status-only`))return;let c=s.sessions[0];if(o=c?.session_id??null,c&&!c.resumable){Ne.current.add(t),V(e,{agentId:L.agentId,resumable:!1,sessionId:c.session_id,status:`resume_failed`});return}let l=n===`manager`?``:D?.goalId??``;if(n===`goal`&&!l)return;let u=await sg(l,n===`manager`?I[e]:L.agentId,`resume_latest`,n);if(i)return;n===`manager`&&u.session.manager_runtime&&C(u.session.manager_runtime),Me.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(V(e,{agentId:u.agent_id||L.agentId,resumable:!0,sessionId:u.session_id,status:f?`running`:`ready`,turnId:f||void 0}),Ne.current.delete(t),!f)return;let p=`${u.session_id}:${f}`;if(Le.current.has(p))return;Le.current.add(p),Pe.current.set(e,f),V(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`running`,turnId:f}),xe(e),a=new AbortController,Fe.current.set(e,a);let m=``,h=Je(e,{activity:[`正在恢复进行中的 Agent 回合`],agentLabel:He(e,L.label),lines:[],pending:!0,sourceLabel:e===`manager`?`恢复的${_(`header.manager`)}会话`:`恢复的 ${L.label} 会话`,text:``});try{let t=await Tg(u.session_id,f,{signal:a.signal,onDelta:t=>{m+=t,Ye(e,h,{text:m})},onActivity:t=>{_e(n=>({...n,[e]:(n[e]??[]).map(e=>e.id===h?{...e,activity:[...new Set([...e.activity??[],t])].slice(-6)}:e)}))}});if(i)return;Ye(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()||`${He(e,L.label)} 已完成分析。`});let n=E.goals.find(e=>e.goalId===d?.session.goal_id)??D??E.goals[0]??null;if(n&&t.response.proposals.length>0){let r=t.response.proposals.filter(Oh).map(e=>({goalId:n.goalId,id:je.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));r.length>0&&ye(t=>({...t,[e]:[...t[e]??[],...r]}))}}catch(t){if(i)return;Ye(e,h,{activity:[],lines:[],pending:!1,reconnect:t instanceof qh&&t.payload.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t instanceof Error?t.message:`无法恢复进行中的 Agent 回合。`})}finally{Le.current.delete(p),Pe.current.get(e)===f&&Pe.current.delete(e),V(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`ready`}),Fe.current.get(e)===a&&Fe.current.delete(e),i||xe(t=>t===e?null:t)}}catch(n){if(i)return;n instanceof qh&&n.payload.error_code===`resume_failed`&&(Ne.current.add(t),o&&V(e,{agentId:L.agentId,resumable:!1,sessionId:o,status:`resume_failed`}))}})(),()=>{i=!0,a?.abort()}},[N,E.goals[0]?.goalId,h,D?.goalId,L.agentId,L.available,L.label,I]),(0,R.useEffect)(()=>{if(h||D||E.goals.length===0||ne===`loading`)return;let e=!1;return Promise.all(E.goals.filter(e=>!e.loadState).map(async e=>{let t=await lg({agentId:e.agentId,channelId:`goal.${e.goalId}`,goalId:e.goalId});return{goalId:e.goalId,session:t.sessions[0]??null}})).then(t=>{e||Ce(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,ne,D?.goalId]),(0,R.useEffect)(()=>{if(De(null),h){Te([]),ke({});return}if(!D){Te([]),ke({});return}let e=!1,t=0,n=0;Te([]),ke({});let r=async()=>{if(!e){if(document.hidden){t=window.setTimeout(()=>void r(),1e4);return}try{let t=await lg({goalId:D.goalId});if(!e){let r=t.sessions.filter(e=>e.channel_id?.startsWith(`task.`));Te(r);let i=await Promise.allSettled(r.map(e=>cg(e.session_id)));if(!e){let e=i.some(e=>e.status===`rejected`);n=e?n+1:0,De(e?`partial`:null),ke(Object.fromEntries(i.flatMap((e,t)=>e.status===`fulfilled`?[[r[t].session_id,e.value]]:[])))}}}catch{n+=1,e||De(`offline`)}e||(t=window.setTimeout(()=>void r(),Math.min(3e4,2e3*2**Math.min(n,4))))}};return r(),()=>{e=!0,window.clearTimeout(t)}},[h,D?.goalId]),(0,R.useEffect)(()=>{if(!ce)return;let e=window.requestAnimationFrame(()=>{Re.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()});return()=>{window.cancelAnimationFrame(e),B.current?.focus()}},[ce]),(0,R.useEffect)(()=>{if(!ue)return;let e=window.requestAnimationFrame(()=>ze.current?.focus());return()=>{window.cancelAnimationFrame(e),Be.current?.focus()}},[ue]),(0,R.useEffect)(()=>{if(!ce&&!ue)return;let e=e=>{e.key===`Escape`&&(le(!1),de(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ce,ue]);function Je(e,t){let n=Ae.current++;return _e(r=>({...r,[e]:[...r[e]??[],{...t,id:n,role:`assistant`}]})),n}function Ye(e,t,n){_e(r=>({...r,[e]:(r[e]??[]).map(e=>e.id===t?{...e,...n}:e)}))}async function Xe(e,t){let n=`${e}:${t}`,r=Me.current.get(n);if(r)return r;let i=await sg(e,t,Ne.current.has(n)?`new`:`resume_latest`,`goal`);return Me.current.set(n,i.session_id),Ne.current.delete(n),V(e,{agentId:t,resumable:!0,sessionId:i.session_id,status:i.session.status}),i.session_id}async function Ze(e,t){let n=e.trim();if(!n)return;let r=t&&`goalId`in t?t.goalId??`manager`:N,i=r===`manager`?null:E.goals.find(e=>e.goalId===r)??null,a=t?.agentId?Dh(re,t.agentId,ie):L,o=r===`manager`?E:i?{...E,blockingTodoCount:E.userTodos.filter(e=>e.goalId===i.goalId&&e.blocking).length,goals:[i],openUserTodoCount:E.userTodos.filter(e=>e.goalId===i.goalId).length,userTodos:E.userTodos.filter(e=>e.goalId===i.goalId),visibleUserTodos:E.userTodos.filter(e=>e.goalId===i.goalId)}:E,s=Ae.current++;if(_e(e=>({...e,[r]:[...e[r]??[],{attachments:t?.attachments,id:s,lines:[],role:`user`,text:n}]})),he(``),xe(r),a.agentId===`status-only`||!i&&r!==`manager`){let e=Ow(O,o,n),t=a.agentId===`status-only`;Je(r,{agentLabel:t?`仅查状态`:`LoopX 管家`,lines:e.lines.slice(0,3),sourceLabel:t?`LoopX 状态投影 · 仅查状态`:`LoopX 状态投影`,text:e.text}),og({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(()=>{}),xe(null);return}let c=`${r}:${a.agentId}`,l=null;try{let e=r===`manager`?Me.current.get(c):await Xe(r,a.agentId);if(!e){let t=Ne.current.has(c)?`new`:`resume_latest`,n=r===`manager`?I[r]:a.agentId,o=await sg(r===`manager`?``:i.goalId,n,t,r===`manager`?`manager`:`goal`);r===`manager`&&o.session.manager_runtime&&C(o.session.manager_runtime),e=o.session_id,Me.current.set(c,e),V(r,{agentId:o.agent_id||a.agentId,resumable:!0,sessionId:e,status:`ready`}),Ne.current.delete(c)}let o=``;l=Je(r,{activity:[r===`manager`?`正在连接管家`:`正在连接 Agent`],agentLabel:He(r,a.label),lines:[],pending:!0,sourceLabel:r===`manager`?`${_(`header.manager`)} · 跨 Goal`:`${a.label} Agent · ${tw(i.goalId)}`,text:``});let s={attachments:t?.attachments,signal:(()=>{let e=new AbortController;return Fe.current.set(r,e),e.signal})(),onDelta:e=>{o+=e,l!==null&&Ye(r,l,{text:o})},onActivity:e=>{l!==null&&_e(t=>({...t,[r]:(t[r]??[]).map(t=>t.id===l?{...t,activity:[...new Set([...t.activity??[],e])].slice(-6)}:t)}))},onPhase:(t,n)=>{l!==null&&Ye(r,l,{sourceTurnId:n}),Pe.current.set(r,n),V(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`running`,turnId:n})}},u;if(t?.loopxMode){let n=await xg(e,t.loopxMode.operation,t.loopxMode.settings);if(!n.turn_id)throw Error(`LoopX execution returned no turn identity`);s.onPhase(`turn.accepted`,n.turn_id),u=await Tg(e,n.turn_id,s)}else u=await Cg(e,n,s);let d=u.response;Ye(r,l,{lines:d.gate?[d.gate.summary,d.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:nw(d.message||o.trim())||`${He(r,a.label)} 已完成分析。`});let f=d.proposals.filter(Oh);if(f.length>0&&!i&&Ye(r,l,{lines:[`请进入要修改的 Goal,预览并确认具体变更。`]}),f.length>0&&i){let e=f.map(e=>({goalId:i.goalId,id:je.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));ye(t=>({...t,[r]:[...t[r]??[],...e]}))}if(r!==`manager`&&d.protected_action){let e=RC(r,n,d.protected_action);if(e)return e}}catch(e){if(Ie.current.delete(r)||t?.loopxMode&&e instanceof qh&&e.payload.error_code===`turn_interrupted`){let e={agentLabel:He(r,a.label),lines:[],pending:!1,sourceLabel:r===`manager`?`${_(`header.manager`)}会话`:`${a.label} 会话`,text:`已中断。你可以在当前会话继续发送消息。`};l===null?Je(r,e):Ye(r,l,e);return}let n=e instanceof qh?e.payload:null;n&&Ah(n)&&Me.current.delete(c),n?.error_code===`resume_failed`&&(Me.current.delete(c),Ne.current.add(c),V(r,{agentId:a.agentId,resumable:!1,sessionId:Se[r]?.sessionId??`resume-failed`,status:`resume_failed`}));let i=n?.gate,o=i&&typeof i==`object`?String(i.summary??``):``,s={agentLabel:He(r,a.label),lines:o?[o]:[],pending:!1,reconnect:n?.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:n?.error_code===`resume_failed`?`原 ${He(r,a.label)} 会话无法恢复。本地历史已经保留,请在运行详情里选择“重试恢复”或“开始新 Session”。`:e instanceof Error?e.message:`${He(r,a.label)} 会话暂时不可用。`};l===null?Je(r,s):Ye(r,l,s)}finally{Pe.current.delete(r),Fe.current.delete(r);let e=Me.current.get(c);e&&V(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),xe(e=>e===r?null:e)}}async function Qe(e){let t=e?.goalId??N,n=Se[t],r=e?.agentId??n?.agentId??L.agentId,i=`${t}:${r}`,a=e?.sessionId??n?.sessionId??Me.current.get(i),o=e?.turnId??n?.turnId??Pe.current.get(t);if(!(!a||!o))try{Ie.current.add(t),await hg(a,o),Fe.current.get(t)?.abort()}catch(e){throw Ie.current.delete(t),e}finally{Pe.current.delete(t),V(t,{agentId:r,resumable:!0,sessionId:a,status:`ready`}),Fe.current.delete(t),xe(e=>e===t?null:e)}}async function $e(e){let t=e.goalId,n=`${t}:${e.agentId}`,r=e.sessionId??Se[t]?.sessionId??Me.current.get(n);if(r)try{let i=await Dg(r);Me.current.set(n,r),Ne.current.delete(n),V(t,{agentId:e.agentId,resumable:i.session.resumable,sessionId:r,status:i.session.status})}catch{V(t,{agentId:e.agentId,resumable:!1,sessionId:r,status:`resume_failed`})}}function et(e){let t=`${e.goalId}:${e.agentId}`;Me.current.delete(t),Ne.current.add(t),V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:`new-session-pending`,status:`ready`})}async function tt(e){let t=`${e.goalId}:${e.agentId}`,n=e.sessionId??Se[e.goalId]?.sessionId??Me.current.get(t);n&&n!==`new-session-pending`&&await Eg(n),Me.current.delete(t),Ne.current.add(t),V(e.goalId,null)}function nt(e){re.some(t=>t.agentId===e&&t.available)&&(se(t=>({...t,[N]:e})),le(!1))}function rt(){i(``),pe(`chat`)}function it(e){i(e),pe(`chat`)}D&&ew[D.state],D&&(`${L.label}${D.state}`,We.length>0&&`${Ke}`,Ue.length>0&&`${Ue.length}`),D?.state===`需修复`||!D&&!c.ok?(D&&aw(D.agentId),D?.nextSentence,D?.agentSentence):D?.state===`等你`?(D.needsYouBlocking,D.needsYouBlocking,D.needsYou??D.nextSentence,D.needsYou):(D&&aw(D.agentId),D?.nextSentence);let at=[...!D&&Se.manager?.status===`resume_failed`?[{id:`run:manager:resume-failed`,kind:`run`,run:{agentId:Se.manager.agentId,agentLabel:aw(Se.manager.agentId),canInterrupt:!1,completedSteps:0,goalId:`manager`,goalTitle:`LoopX 管家`,latestActivity:`本地聊天记录已保留,点我查看恢复方式。`,resumable:!1,runId:`manager:resume-failed`,sessionId:Se.manager.sessionId,sessionStatus:`resume_failed`,status:`failed`,title:`上次会话需要恢复`,totalSteps:1,outputs:[]}}]:[],...D?we.map(e=>{let t=e.channel_id?.startsWith(`task.`)?e.channel_id.slice(5):void 0,n=D.agentTodos.find(e=>e.todoId===t),r=!!e.active_turn_id,i=Oe[e.session_id],a=i?.messages.some(e=>rw(e.role,e.text))===!0;return{id:`run:task:${e.session_id}`,kind:`run`,run:{agentId:e.agent_id,agentLabel:aw(e.agent_id),canInterrupt:r,completedSteps:n?.done||a?1:0,goalId:D.goalId,goalTitle:D.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`:rw(e.role,e.text)?`assistant`:`error`,text:e.role===`user`?e.text:nw(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}}}):[],...D&&(Se[D.goalId]?.turnId||D.hasRunObservation||qd(D))?[{id:`run:${D.goalId}`,kind:`run`,run:{agentId:Se[D.goalId]?.agentId??D.agentId,agentLabel:aw(Se[D.goalId]?.agentId??D.agentId),canInterrupt:!!Se[D.goalId]?.turnId,completedSteps:D.agentTodos.filter(e=>e.done).length,goalId:D.goalId,goalTitle:D.title,latestActivity:D.agentSentence,resumable:Se[D.goalId]?.resumable??!0,runId:`goal:${D.goalId}`,sessionId:Se[D.goalId]?.sessionId,sessionStatus:Se[D.goalId]?.status,status:Se[D.goalId]?.turnId?`running`:D.state===`需修复`?`failed`:`waiting`,title:D.nextSentence,totalSteps:D.agentTodos.length||1,turnId:Se[D.goalId]?.turnId}}]:[],...Ve.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,collaboration:e.collaboration,role:e.role,text:e.text||(e.pending?`Agent 正在处理…`:e.lines.join(` +`))}})),...D&&k?[{id:`output:${D.goalId}:report:${k.publication.publication_id}`,kind:`output`,output:{agentId:k.agent_id,agentLabel:aw(k.agent_id),createdAt:k.publication.delivered_at,goalId:D.goalId,goalTitle:D.title,kind:`report`,outputId:k.publication.publication_id,report:{addedCount:k.delta.added_count,changedCount:k.delta.changed_count,deliveredAt:k.publication.delivered_at,generationId:k.generation_id,items:k.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:k.period_window.end_at,periodStartAt:k.period_window.start_at,predecessorPublicationId:k.publication.predecessor_publication_id,publicationId:k.publication.publication_id},safePreview:k.delta.items.map(e=>`${e.change_kind===`added`?`+`:`~`} ${e.title}\n${e.summary}`).join(` -`),summary:k.summary,title:k.title}}]:[]],ot=f.connectionState===`connected`,st=new Map(E.goals.map(e=>[e.goalId,e.title])),ct=e=>nf(e,f.activeSource.statusUrl,ot&&!l?.errors[e.goalId],st.get(e.goalId)),lt={...Gd(E),userTodos:E.userTodos.map(ct),attentionHistory:(E.attentionHistory??E.userTodos).map(ct),periodicReports:{error:ee,loading:M},timeline:at};return(0,z.jsxs)(`div`,{className:p===`dark`?`dark`:``,"data-testid":`personal-goal-home`,children:[Ee?(0,z.jsx)(`p`,{role:`status`,className:`m-0 bg-amber-50 px-4 py-2 text-sm text-amber-900`,children:_(Ee===`partial`?`runs.discoveryPartial`:`runs.discoveryOffline`)}):null,(0,z.jsx)(_C,{agents:re.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=>it(e.goalId),onCorrectRun:async(e,t)=>{if(!e.sessionId)throw Error(`这个 Run 还没有可纠偏的执行 Session。`);let n=await tg((await Qh({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(V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:r?`running`:`ready`,turnId:r}),r){Pe.current.set(e.goalId,r);let t=new AbortController;Fe.current.set(e.goalId,t);let n=``,i=Je(e.goalId,{activity:[`正在把纠偏送入原执行 Session`],agentLabel:e.agentLabel,lines:[],pending:!0,sourceLabel:`${e.agentLabel} · 执行 Session`,text:``});try{let a=await Tg(e.sessionId,r,{signal:t.signal,onDelta:t=>{n+=t,Ye(e.goalId,i,{text:n})}});Ye(e.goalId,i,{activity:[],pending:!1,text:rw(a.response.message||n.trim())||`${e.agentLabel} 已完成纠偏。`})}catch(t){let n=Ie.current.delete(e.goalId);Ye(e.goalId,i,{activity:[],pending:!1,text:n?`已中断。你可以在当前会话继续发送消息。`:t instanceof Error?t.message:`纠偏回合失败。`})}finally{Pe.current.delete(e.goalId),Fe.current.delete(e.goalId),V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:`ready`})}}},onCloseRunSession:tt,onInterruptRun:async e=>Qe(e),onOpenGoal:it,onOpenRunSession:async e=>{if(!e.sessionId)return;let t=e.sessionId,n=await cg(t);ke(e=>({...e,[t]:n})),it(e.goalId),_e(t=>({...t,[e.goalId]:n.messages.map(t=>({agentLabel:t.role===`user`?void 0:e.agentLabel,attachments:QC(t.attachments),id:Ae.current++,lines:[],role:t.role===`user`?`user`:`assistant`,sourceLabel:t.role===`user`?void 0:`${e.agentLabel} · 执行 Session`,text:t.role===`user`?t.text:rw(t.text)}))})),V(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=>it(e.goalId),...b?{onPreviewGoalSubagentConfiguration:async e=>{let t=await Ag(e);return{changed:t.changed,configuration:{allowedDomains:t.after.orchestration.allowed_domains,codexHostCapacity:{configuredChildren:t.codex_host_capacity.configured_children,newSessionRequired:t.codex_host_capacity.new_session_required,requiredChildren:t.codex_host_capacity.required_children,status:t.codex_host_capacity.status,writeRequired:t.codex_host_capacity.write_required,written:t.codex_host_capacity.written},enabled:t.feature_summary.multi_subagent===`enabled`,executionConfig:t.after.orchestration.execution_config,maxChildren:t.after.orchestration.max_children,modelConfig:t.after.orchestration.model_config},previewId:t.preview_id}},onApplyGoalSubagentConfiguration:async({previewId:e,...t})=>{let n=await jg(t,e);return{allowedDomains:n.after.orchestration.allowed_domains,codexHostCapacity:{configuredChildren:n.codex_host_capacity.configured_children,newSessionRequired:n.codex_host_capacity.new_session_required,requiredChildren:n.codex_host_capacity.required_children,status:n.codex_host_capacity.status,writeRequired:n.codex_host_capacity.write_required,written:n.codex_host_capacity.written},enabled:n.feature_summary.multi_subagent===`enabled`,executionConfig:n.after.orchestration.execution_config,maxChildren:n.after.orchestration.max_children,modelConfig:n.after.orchestration.model_config}}}:{},...g?{onExecuteGoalLifecycle:async({goalId:e,operation:t,reason:n})=>{let r=await Tx(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:$e,onSelectAgent:nt,onSelectGoal:e=>e?it(e):rt(),onSendMessage:async(e,t,n,r)=>Ze(e,{agentId:t,goalId:n,attachments:r}),onPrepareLoopX:(e,t)=>Xe(t,e),onStartLoopX:(e,t,n,r)=>{Ze(e===`start`?`开启 LoopX 模式,持续推进当前 Goal。`:`恢复 LoopX 模式。`,{agentId:t,goalId:n,loopxMode:{operation:e,settings:r}})},onStartNewRunSession:et},goalArchiveLoadState:e,managerChannelBinding:w,managerRuntime:S,conversationSessionId:Se[N]?.sessionId,model:lt,readOnly:h,selectedAgentId:L.agentId,selectedGoalId:D?.goalId??null,statusSourceControl:f})]})}function Pw({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,z.jsx)(`div`,{className:i===`dark`?`dark`:``,children:(0,z.jsxs)(`main`,{className:`min-h-screen bg-[#f6f7f9] text-slate-950 dark:bg-[#09090b] dark:text-zinc-50`,children:[(0,z.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,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:`LoopX Workspace`}),(0,z.jsx)(`p`,{className:`mt-1 break-all text-sm text-slate-500 dark:text-zinc-400`,children:`Personal Workspace`})]}),(0,z.jsx)(Iy,{"aria-label":`切换主题`,onClick:a,size:`icon`,variant:`secondary`,children:i===`dark`?(0,z.jsx)(uh,{className:`h-4 w-4`}):(0,z.jsx)(Gm,{className:`h-4 w-4`})})]}),(0,z.jsxs)(`div`,{className:`grid min-h-[calc(100vh-80px)] sm:grid-cols-[240px_1fr]`,children:[(0,z.jsxs)(`aside`,{className:`hidden border-r border-slate-200 p-6 dark:border-zinc-800 sm:block`,"aria-label":`Workspace`,children:[(0,z.jsx)(`strong`,{children:`LoopX`}),(0,z.jsx)(`p`,{className:`mt-6 text-sm`,children:`Workspace`}),(0,z.jsx)(`p`,{className:`mt-8 text-xs text-slate-500`,children:`Goals`}),[1,2,3].map(e=>(0,z.jsx)(`div`,{className:`mt-4 h-8 rounded bg-slate-100 dark:bg-zinc-900`},e))]}),(0,z.jsx)(`div`,{className:`p-4 sm:p-8`,children:(0,z.jsx)(Ly,{"data-testid":`initial-status-state`,children:(0,z.jsx)(Ry,{className:`flex min-h-64 items-center justify-center p-6`,children:(0,z.jsxs)(`div`,{className:`max-w-xl text-center`,children:[e?(0,z.jsx)(ym,{className:`mx-auto h-6 w-6 text-rose-600 dark:text-rose-300`}):(0,z.jsx)(Qm,{className:`mx-auto h-6 w-6 animate-spin text-slate-500 dark:text-zinc-400`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e?`无法加载实时状态`:`正在加载实时状态`}),e?(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-slate-400 dark:text-zinc-500`,children:`重新加载不会执行任务,也不会改变 Goal 配置。`}):null,(0,z.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:(0,z.jsxs)(Iy,{disabled:t,onClick:n,children:[(0,z.jsx)(Qm,{className:`h-4 w-4`}),`重试`]})})]}):(0,z.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 Fw(){let e=MT.useSearch(),t=MT.useNavigate(),[n,r]=(0,R.useState)(`light`),[i,a]=(0,R.useState)(null),o=(0,R.useRef)(null),s=(0,R.useRef)(e.goalId);s.current=e.goalId;let[c,l]=(0,R.useState)(Vp),[u,d]=(0,R.useState)({kind:`example`,label:`bundled example`}),[f,p]=(0,R.useState)(()=>AC(window.localStorage,window.location.href)),m=(0,R.useRef)(f);m.current=f;let[h,g]=(0,R.useState)(e.statusUrl),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)({error:null,phase:`idle`}),[C,w]=(0,R.useState)(e.statusUrl.trim()||null),[T,E]=(0,R.useState)(!1),D=(0,R.useRef)(null),O=(0,R.useRef)(k_(e.statusUrl.trim()||null)),k=!T&&u.kind===`example`?e.statusUrl.trim():``,A=C??k,ee=u.kind===`url`?u.label:BC,j=!!(_&&C),M=LC(f,C,ee,window.location.href),te=u.kind===`example`&&!T,ne=c.attention_queue,N=c.run_history,P=(0,R.useMemo)(()=>UC(N.goals,ne.items),[N.goals,ne.items]);function re(e,t,n=0){S({error:null,phase:`loading`}),VC(Sh(e,`stopped`,window.location.href)).then(r=>{if(!N_(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=>nv(e,r)),a&&n<1){F(e,{background:!0,resyncAttempt:n+1});return}S(a?{error:`Goal 状态在加载历史时发生变化,请重试。`,phase:`error`}:{error:null,phase:`ready`})}).catch(e=>{N_(O.current,t)&&S({error:Bp(e),phase:`error`})})}function ie(){let e=u.kind===`url`?u.label:h||BC,t=j_(O.current,e,{background:!0});if(i){F(e);return}t&&re(e,t)}async function ae(e,n,r){if(r.background)return l(e=>nv(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})}),M_(O.current,r)?(O.current.requestedUrl=null,w(null),!0):!1}async function F(e,t={}){let n=e.trim(),r=t.background===!0;if(!n){r||v(`状态地址不能为空`);return}let c=j_(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 Gp(n,window.location.href).catch(()=>null);if(!N_(O.current,c))return;if(e){let o=(t.retryOnly||t.reuseSnapshots)&&u.kind===`url`&&u.label===n?Up(i,e,{invalidateGoalIds:t.invalidateGoalIds}):{};a({directory:e,snapshots:o,errors:{}});let f={...e,goals:e.goals.filter(e=>!o[e.id])},p=!1,m=Kp(e);if(r)l(m);else if(!await ae(n,m,c))return;if(S({error:null,phase:`loading`}),await Jp(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})},()=>N_(O.current,c),()=>s.current,d.signal),p&&(t.resyncAttempt??0)<1&&N_(O.current,c)){await F(n,{resyncAttempt:1});return}N_(O.current,c)&&S({error:null,phase:`ready`});return}let o=await VC(Sh(n,`active`,window.location.href));if(!N_(O.current,c)||(a(null),c.registryRevision=o.goal_projection?.registry_revision??null,!await ae(n,o,c)))return;if(o.goal_projection?.scope!==`active`||o.goal_projection.complete){S({error:null,phase:`ready`});return}re(n,c,t.resyncAttempt??0)}catch(e){if(!M_(O.current,c))return;r||v(Bp(e))}finally{!r&&M_(O.current,c)&&b(!1)}}function oe(e,t={}){o.current?.abort();let n=A_(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 wx(e.label,t)}catch{}}O.current.selectionRevision===n&&await F(e.statusUrl,{selectionRevision:n})})()}function I(e){m.current=e,p(e);try{jC(window.localStorage,e)}catch{}}let se={activeSource:M,connectionState:y?`loading`:j?`error`:`connected`,errorMessage:j?`未切换到 ${C??`所选来源`}:${_}`:null,onAdd:e=>{let t=NC(f,e,window.location.href);return`error`in t?{error:t.error}:(I(t.catalog),oe(t.source,{ensureTunnel:e.ensureTunnel}),{})},onConfiguredHostsLoaded:e=>{let t=m.current,n=MC(t,e);n!==t&&I(n)},onRemove:e=>{I(PC(f,e)),M.id===e&&oe(TC)},onSelect:e=>{let t=f.sources.find(t=>t.id===e);t&&oe(t,{ensureTunnel:t.kind===`ssh_tunnel`})},sources:M.id===`temporary`?[...f.sources,M]:f.sources};(0,R.useEffect)(()=>{let t=e.statusUrl.trim();if(t){if(D.current===t||C&&C!==t)return;(u.kind!==`url`||u.label!==t)&&F(t);return}D.current=null,!T&&(C||u.kind===`example`&&F(BC))},[T,C,e.statusUrl,u.kind,u.label]),(0,R.useEffect)(()=>{if(e.statusUrl&&u.kind===`example`)return;let n=new Set(P.map(e=>e.goal.id));if(P.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,P,t,e.goalId,e.statusUrl,u.kind]),(0,R.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]&&F(u.label,{retryOnly:!0})},[e.goalId,y,i,u]);function L(e){t({search:t=>({...t,goalId:e})})}return te?(0,z.jsx)(Pw,{error:_,isLoading:y,onRetry:()=>void F(A||BC),requestedUrl:A||BC,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)}):(0,z.jsx)(Nw,{goalArchiveLoadState:x,isLoading:y,onGoalActivationStateChange:(e,t)=>{O.current.projectionRevision+=1,l(n=>Lp(n,e,t)),a(n=>n&&{...n,snapshots:Object.fromEntries(Object.entries(n.snapshots).map(([n,r])=>[n,Lp(r,e,t)]))})},onGoalDeleted:e=>{O.current.projectionRevision+=1,l(t=>Rp(t,e)),a(t=>t&&{...t,snapshots:Object.fromEntries(Object.entries(t.snapshots).filter(([t])=>t!==e))})},onSelectGoal:L,onReconcileStatus:e=>F(u.kind===`url`?u.label:h||BC,{background:!0,invalidateGoalIds:e?.invalidateGoalIds,reuseSnapshots:!0}),onRetryGoalArchive:ie,onRefresh:()=>F(u.kind===`url`?u.label:h||BC,{retryOnly:!!(i&&Object.keys(i.errors).length)}),payload:c,progress:i,rows:P,selectedGoalId:e.goalId,statusSourceControl:se,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)})}var Iw=sv(`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 Lw({className:e,variant:t,...n}){return(0,z.jsx)(`span`,{className:Py(Iw({variant:t}),e),...n})}var Rw=[{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`}],zw=[{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`}],Bw=[{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.`}],Vw=[`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`],Hw=[{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 Uw({children:e,icon:t,title:n}){return(0,z.jsxs)(`section`,{className:`rounded-lg border border-slate-200 bg-white shadow-sm`,children:[(0,z.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,z.jsx)(t,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function Ww(){return(0,z.jsx)(Uw,{icon:pm,title:`Status Contract Explorer`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,"data-testid":`developer-contract-explorer`,children:Rw.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(Lw,{variant:`info`,children:e.label}),(0,z.jsx)(Lw,{variant:`neutral`,children:`public contract`})]}),(0,z.jsx)(`div`,{className:`mt-2 break-words font-mono text-xs text-slate-700`,children:e.source}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.detail})]},e.label))})})}function Gw(){return(0,z.jsx)(Uw,{icon:Nm,title:`Projection Diffing`,children:(0,z.jsx)(`div`,{className:`overflow-x-auto`,"data-testid":`developer-projection-diffing`,children:(0,z.jsxs)(`table`,{className:`min-w-full border-separate border-spacing-0 text-left text-sm`,children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{className:`bg-slate-50 text-xs uppercase tracking-normal text-slate-500`,children:[(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Axis`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Current`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Proposed`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Gate`})]})}),(0,z.jsx)(`tbody`,{children:zw.map(e=>(0,z.jsxs)(`tr`,{className:`align-top`,children:[(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 font-semibold text-slate-950`,children:e.axis}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.current}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.proposed}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.gate})]},e.axis))})]})})})}function Kw(){return(0,z.jsx)(Uw,{icon:km,title:`Fixture Generation`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-fixture-generation`,children:Bw.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:e.title}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.title))})})}function qw(){return(0,z.jsx)(Uw,{icon:xm,title:`Smoke Checklist`,children:(0,z.jsx)(`div`,{className:`space-y-2 p-4`,"data-testid":`developer-smoke-checklist`,children:Vw.map(e=>(0,z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(um,{className:`mt-0.5 h-4 w-4 shrink-0 text-emerald-600`}),(0,z.jsx)(`code`,{className:`break-all text-xs font-semibold leading-5 text-slate-700`,children:e})]},e))})})}function Jw(){return(0,z.jsx)(Uw,{icon:Sm,title:`Component Examples`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-3`,"data-testid":`developer-component-examples`,children:Hw.map(e=>(0,z.jsxs)(`article`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.badges.map(e=>(0,z.jsx)(Lw,{variant:e===`read-only`||e===`public-safe`?`success`:`neutral`,children:e},e))}),(0,z.jsx)(`h3`,{className:`mt-3 text-sm font-semibold leading-6 text-slate-950`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.name))})})}function Yw(){return(0,z.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,z.jsxs)(`div`,{className:`mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,z.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,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.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,z.jsx)(dh,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold`,children:`Developer Cockpit`}),(0,z.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Projection extension`})]})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://loopx-project.github.io/loopx/`,children:[(0,z.jsx)(Lm,{className:`h-4 w-4`}),`LoopX home`]}),(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://loopx-project.github.io/loopx/docs/showcases/index.en.html`,children:[(0,z.jsx)(Dm,{className:`h-4 w-4`}),`Public cases`]}),(0,z.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,z.jsx)(Sm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,z.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,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(Lw,{variant:`success`,children:`read-only`}),(0,z.jsx)(Lw,{variant:`neutral`,children:`public fixtures`})]}),(0,z.jsx)(`p`,{children:`This route uses static public contracts only; live status feeds, registry files, and browser write APIs stay outside the cockpit.`})]})]}),(0,z.jsxs)(`section`,{className:`space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(Lw,{variant:`info`,children:`developers/projections`}),(0,z.jsx)(Lw,{variant:`success`,children:`public-safe`}),(0,z.jsx)(Lw,{variant:`neutral`,children:`no browser writes`})]}),(0,z.jsx)(`h1`,{className:`mt-3 text-3xl font-semibold tracking-normal text-slate-950`,children:`LoopX Projection Developer Cockpit`}),(0,z.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,z.jsxs)(`div`,{className:`grid min-w-[260px] gap-2 text-sm`,children:[(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Source of truth`}),(0,z.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`status contract + compact fixtures`})]}),(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Boundary`}),(0,z.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`read-only extension surface`})]})]})]})}),(0,z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,z.jsx)(Ww,{}),(0,z.jsx)(Gw,{})]}),(0,z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,z.jsx)(Kw,{}),(0,z.jsx)(qw,{})]}),(0,z.jsx)(Jw,{}),(0,z.jsx)(Uw,{icon:oh,title:`Extension Boundary`,children:(0,z.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-extension-boundary`,children:[(0,z.jsxs)(`div`,{className:`rounded-md border border-emerald-200 bg-emerald-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Allowed`}),(0,z.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,z.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Review`}),(0,z.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,z.jsxs)(`div`,{className:`rounded-md border border-rose-200 bg-rose-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Stop`}),(0,z.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 Xw=J({value:G().finite(),total:G().finite().positive().optional(),unit:W().optional(),higher_is_better:K()}).passthrough(),Zw=yd(W(),G().finite()).default({}),Qw=J({outcome_status:W().optional(),failure_class:W(),causal_summary:W(),expectedness:W(),implication:W(),next_probe:W(),confidence:W(),evidence_refs:q(W()).optional()}).passthrough(),$w=J({arm_id:W(),selected_run_id:W().nullable(),score_countable:K(),metrics:yd(W(),Xw),effort:Zw,insight:Qw.nullable().optional()}),eT=J({run_id:W(),case_id:W(),arm_id:W(),arm_role:W(),status:W(),protocol_id:W(),runner_revision:W().optional(),observed_at:W(),metrics:yd(W(),Xw),countability:J({integrity_qualified:K(),official_result_present:K(),score_countable:K()}).passthrough(),treatment_fidelity:W(),effort:Zw,redacted_insight:Qw.nullable().optional(),upload_provenance:J({producer_id:W(),producer_version:W(),observed_at:W(),source_revision:W()}).passthrough()}).passthrough(),tT=J({case_denominator:G().int().nonnegative(),value_sum:G().finite(),value_mean:G().finite().nullable(),value_median:G().finite().nullable(),value_min:G().finite().nullable(),value_max:G().finite().nullable(),case_macro_rate:G().finite().optional(),suite_micro_rate:G().finite().optional(),suite_micro_numerator:G().finite().optional(),suite_micro_denominator:G().finite().positive().optional()}).passthrough(),nT=J({arm_id:W(),arm_role:W(),factor_assignments:yd(W(),W()),protocol_counts:yd(W(),G().int().nonnegative()).default({}),runner_revision_counts:yd(W(),G().int().nonnegative()).default({}),orchestrator_runtime_counts:yd(W(),G().int().nonnegative()).default({}),intended_case_count:G().int().positive(),run_count:G().int().nonnegative(),terminal_run_count:G().int().nonnegative(),selected_score_countable_case_count:G().int().nonnegative(),coverage_rate:G().finite().min(0).max(1),metrics:yd(W(),tT),binary_outcomes:yd(W(),J({success_count:G().int().nonnegative(),case_denominator:G().int().nonnegative(),success_rate:G().finite().min(0).max(1).nullable()})),effort:yd(W(),J({denominator:G().int().nonnegative(),mean:G().finite().nullable(),median:G().finite().nullable()})),failure_class_counts:yd(W(),G().int().nonnegative())}).passthrough(),rT=J({baseline_value:G().finite(),candidate_value:G().finite(),delta:G().finite(),direction:Y([`improved`,`flat`,`regressed`]).optional()}).passthrough(),iT=J({comparison_id:W(),comparison_anchor_run_id:W(),candidate_run_id:W(),candidate_arm_id:W(),primary_metric:W(),matched_pair_countable:X(!0),metric_deltas:yd(W(),rT)}).passthrough(),aT=J({ok:X(!0),schema_version:X(`benchmark_study_dashboard_v0`),benchmark_id:W(),study_id:W(),status:Y([`complete`,`provisional`]),design:J({protocol_id:W(),comparison_protocol_id:W(),baseline_arm_id:W(),case_set:J({case_set_id:W(),case_ids:q(W())}),metric_catalog:q(J({metric_name:W(),role:Y([`primary`,`guardrail`,`supporting`]),unit:W().optional(),higher_is_better:K(),binary:K()})),labels:yd(W(),W())}).passthrough(),campaign:J({intended_case_count:G().int().positive(),intended_arm_count:G().int().positive(),intended_cell_denominator:G().int().positive(),selected_score_countable_cell_count:G().int().nonnegative(),selected_score_countable_coverage_rate:G().finite().min(0).max(1),complete_declared_design_case_count:G().int().nonnegative(),ambiguous_score_countable_cell_count:G().int().nonnegative(),in_flight_run_count:G().int().nonnegative(),matched_pair_countable_count:G().int().nonnegative(),factorial_contrast_count:G().int().nonnegative(),factorial_contrast_countable_count:G().int().nonnegative(),runtime_observation_count:G().int().nonnegative(),runtime_classification_counts:yd(W(),G().int().nonnegative())}),arms:q(nT),contrasts:yd(W(),J({matched_pair_denominator:G().int().nonnegative(),primary_metric_directions:J({improved:G().int().nonnegative(),flat:G().int().nonnegative(),regressed:G().int().nonnegative()}),binary_metric_transitions:yd(W(),J({"0_to_1":G().int().nonnegative(),"1_to_0":G().int().nonnegative(),same:G().int().nonnegative()}))})),cases:q(J({case_id:W(),complete_declared_design:K(),arms:q($w),eligible_comparisons:q(iT),largest_eligible_primary_contrast:iT.nullable()})),runs:q(eT),authority:J({score_source:W(),matched_comparison_source:W(),factorial_comparison_source:W().nullable(),manifest_changes_scores:X(!1),dashboard_is_execution_authority:X(!1)}),public_boundary:J({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 oT(e){return aT.parse(e)}function sT(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 cT=[{id:`campaign`,label:`Campaign`},{id:`arms`,label:`Arms`},{id:`cases`,label:`Cases`},{id:`runs`,label:`Runs`}];function lT(e){return e==null?`—`:`${(e*100).toFixed(e>=.995?0:1)}%`}function uT(e){return e==null?`—`:new Intl.NumberFormat(`en`,{maximumFractionDigits:2,notation:`compact`}).format(e)}function dT(e){if(e==null)return`—`;let t=e/6e4;return t>=120?`${(t/60).toFixed(1)} h`:`${uT(t)} min`}function fT(e){let t=Object.entries(e);return t.length?t.map(([e,t])=>`${e} (${t})`).join(`, `):`—`}function pT(e){if(!e)return`—`;let t=e.total==null?uT(e.value):`${uT(e.value)}/${uT(e.total)}`;return e.unit?`${t} ${e.unit}`:t}function mT(e,t){let n=e.metrics[t];return!n||n.case_denominator===0?`—`:n.suite_micro_rate==null?`${uT(n.value_mean)} mean`:`${lT(n.suite_micro_rate)} · ${uT(n.suite_micro_numerator)}/${uT(n.suite_micro_denominator)}`}function hT(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}${uT(r.delta)}`}}function gT({children:e,tone:t=`neutral`}){return(0,z.jsx)(`span`,{className:`benchmark-state benchmark-state-${t}`,children:e})}function _T({packet:e,primaryMetric:t}){return(0,z.jsxs)(`div`,{className:`benchmark-view-stack`,children:[(0,z.jsxs)(`section`,{"aria-labelledby":`arm-summary-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`ARM SUMMARY`}),(0,z.jsx)(`h2`,{id:`arm-summary-title`,children:`Comparable outcomes, denominator first`})]}),(0,z.jsx)(`p`,{children:`Only one score-countable run per declared case × arm cell is selected.`})]}),(0,z.jsx)(`div`,{className:`benchmark-arm-grid`,children:e.arms.map(e=>{let n=Object.values(e.binary_outcomes)[0];return(0,z.jsxs)(`article`,{className:`benchmark-arm-card`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:e.arm_role}),(0,z.jsx)(`h3`,{children:e.arm_id})]}),(0,z.jsx)(gT,{tone:e.coverage_rate===1?`success`:`warning`,children:e.coverage_rate===1?`Complete`:`Provisional`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`dt`,{children:[`Primary · `,t]}),(0,z.jsx)(`dd`,{children:mT(e,t)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Score-countable coverage`}),(0,z.jsxs)(`dd`,{children:[e.selected_score_countable_case_count,`/`,e.intended_case_count]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Binary success`}),(0,z.jsx)(`dd`,{children:n?`${n.success_count}/${n.case_denominator}`:`Not declared`})]})]})]},e.arm_id)})})]}),(0,z.jsxs)(`section`,{"aria-labelledby":`contrast-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`MATCHED CONTRASTS`}),(0,z.jsx)(`h2`,{id:`contrast-title`,children:`Direction counts on eligible pairs`})]}),(0,z.jsx)(`p`,{children:`Raw run volume is never used as a comparison denominator.`})]}),(0,z.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Candidate arm`}),(0,z.jsx)(`th`,{children:`Matched denominator`}),(0,z.jsx)(`th`,{children:`Improved`}),(0,z.jsx)(`th`,{children:`Flat`}),(0,z.jsx)(`th`,{children:`Regressed`}),(0,z.jsx)(`th`,{children:`Binary transitions`})]})}),(0,z.jsxs)(`tbody`,{children:[Object.entries(e.contrasts).map(([e,t])=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`strong`,{children:e})}),(0,z.jsx)(`td`,{children:t.matched_pair_denominator}),(0,z.jsx)(`td`,{className:`benchmark-positive`,children:t.primary_metric_directions.improved}),(0,z.jsx)(`td`,{children:t.primary_metric_directions.flat}),(0,z.jsx)(`td`,{className:`benchmark-negative`,children:t.primary_metric_directions.regressed}),(0,z.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,z.jsx)(`tr`,{children:(0,z.jsx)(`td`,{colSpan:6,children:`No matched comparisons are countable yet.`})})]})]})})]}),(0,z.jsxs)(`section`,{"aria-labelledby":`runtime-health-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`RUNTIME HEALTH`}),(0,z.jsx)(`h2`,{id:`runtime-health-title`,children:`Qualified observations, without execution authority`})]}),(0,z.jsxs)(`p`,{children:[e.campaign.runtime_observation_count,` public-safe runtime observations.`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-runtime-list`,children:[Object.entries(e.campaign.runtime_classification_counts).map(([e,t])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:e}),(0,z.jsx)(`strong`,{children:t})]},e)),e.campaign.runtime_observation_count===0&&(0,z.jsx)(`p`,{className:`benchmark-muted`,children:`No runtime observations uploaded.`})]})]})]})}function vT({packet:e}){return(0,z.jsx)(`div`,{className:`benchmark-detail-grid`,children:e.arms.map(t=>(0,z.jsxs)(`article`,{className:`benchmark-detail-card`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:t.arm_role}),(0,z.jsx)(`h2`,{children:t.arm_id})]}),(0,z.jsxs)(gT,{tone:t.coverage_rate===1?`success`:`warning`,children:[t.selected_score_countable_case_count,`/`,t.intended_case_count,` countable`]})]}),(0,z.jsx)(`div`,{className:`benchmark-factor-row`,children:Object.entries(t.factor_assignments).map(([e,t])=>(0,z.jsxs)(`span`,{children:[e,`: `,(0,z.jsx)(`strong`,{children:t})]},e))}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[e.design.metric_catalog.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`dt`,{children:[e.role,` · `,e.metric_name]}),(0,z.jsx)(`dd`,{children:mT(t,e.metric_name)})]},e.metric_name)),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runs terminal / observed`}),(0,z.jsxs)(`dd`,{children:[t.terminal_run_count,`/`,t.run_count]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Median duration`}),(0,z.jsx)(`dd`,{children:dT(t.effort.duration_ms?.median)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocols`}),(0,z.jsx)(`dd`,{children:fT(t.protocol_counts)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runner revisions`}),(0,z.jsx)(`dd`,{children:fT(t.runner_revision_counts)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Orchestrator runtimes`}),(0,z.jsxs)(`dd`,{children:[Object.keys(t.orchestrator_runtime_counts).length||0,` distinct`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Failure classes`}),(0,z.jsx)(`dd`,{children:fT(t.failure_class_counts)})]})]})]},t.arm_id))})}function yT({packet:e,primaryMetric:t,onOpenRun:n}){return(0,z.jsx)(`div`,{className:`benchmark-table-shell benchmark-wide-table`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Case`}),(0,z.jsx)(`th`,{children:`Design status`}),(0,z.jsx)(`th`,{children:`Largest eligible delta`}),e.arms.map(e=>(0,z.jsx)(`th`,{children:e.arm_id},e.arm_id))]})}),(0,z.jsx)(`tbody`,{children:e.cases.map(r=>{let i=hT(r,t);return(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`strong`,{children:r.case_id})}),(0,z.jsx)(`td`,{children:(0,z.jsx)(gT,{tone:r.complete_declared_design?`success`:`warning`,children:r.complete_declared_design?`Complete`:`Provisional`})}),(0,z.jsx)(`td`,{className:i?.direction===`improved`?`benchmark-positive`:i?.direction===`regressed`?`benchmark-negative`:void 0,children:i?.text??`—`}),r.arms.map(r=>(0,z.jsx)(`td`,{children:r.selected_run_id&&r.score_countable?(0,z.jsxs)(`button`,{className:`benchmark-cell-link`,onClick:()=>n(r.selected_run_id),type:`button`,children:[(0,z.jsxs)(`span`,{children:[t,`: `,pT(r.metrics[t])]}),e.design.metric_catalog.filter(e=>e.metric_name!==t).map(e=>(0,z.jsxs)(`small`,{className:`benchmark-cell-metric`,children:[e.metric_name,`: `,pT(r.metrics[e.metric_name])]},e.metric_name)),(0,z.jsxs)(`small`,{children:[`Countable · `,dT(r.effort.duration_ms),` `,(0,z.jsx)(sm,{"aria-hidden":`true`,size:12})]}),r.insight&&(0,z.jsxs)(`small`,{children:[r.insight.failure_class,` · `,r.insight.confidence]})]}):(0,z.jsx)(`span`,{className:`benchmark-muted`,children:`Not countable`})},r.arm_id))]},r.case_id)})})]})})}function bT({run:e,packet:t}){return(0,z.jsxs)(`aside`,{"aria-label":`Run detail for ${e.run_id}`,className:`benchmark-run-detail`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:`RUN DETAIL`}),(0,z.jsx)(`h2`,{children:e.run_id})]}),(0,z.jsx)(gT,{tone:e.countability.score_countable?`success`:`warning`,children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list benchmark-run-facts`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Case / arm`}),(0,z.jsxs)(`dd`,{children:[e.case_id,` · `,e.arm_id]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Lifecycle`}),(0,z.jsxs)(`dd`,{children:[e.status,` · `,e.observed_at]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocol`}),(0,z.jsx)(`dd`,{children:e.protocol_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Qualification`}),(0,z.jsxs)(`dd`,{children:[`Integrity `,e.countability.integrity_qualified?`qualified`:`not qualified`,` · result `,e.countability.official_result_present?`present`:`missing`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Treatment fidelity`}),(0,z.jsx)(`dd`,{children:e.treatment_fidelity})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Effort`}),(0,z.jsxs)(`dd`,{children:[dT(e.effort.duration_ms),` · `,uT(e.effort.agent_steps),` steps · `,uT(e.effort.token_count),` tokens`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runner revision`}),(0,z.jsx)(`dd`,{children:e.runner_revision??`—`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Upload provenance`}),(0,z.jsxs)(`dd`,{children:[e.upload_provenance.producer_id,` · `,e.upload_provenance.source_revision]})]})]}),(0,z.jsx)(`div`,{className:`benchmark-run-metrics`,children:t.design.metric_catalog.map(t=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:t.metric_name}),(0,z.jsx)(`strong`,{children:pT(e.metrics[t.metric_name])})]},t.metric_name))}),e.redacted_insight&&(0,z.jsxs)(`div`,{className:`benchmark-insight`,children:[(0,z.jsxs)(`span`,{className:`benchmark-mono`,children:[`REDACTED CASE INSIGHT · `,e.redacted_insight.confidence]}),(0,z.jsx)(`p`,{children:e.redacted_insight.causal_summary}),(0,z.jsxs)(`small`,{children:[`Implication: `,e.redacted_insight.implication]}),(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[`Next probe: `,e.redacted_insight.next_probe]}),!!e.redacted_insight.evidence_refs?.length&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[`Evidence: `,e.redacted_insight.evidence_refs.join(`, `)]})]})]})]})}function xT({packet:e,selectedRunId:t,onSelectRun:n}){let r=e.runs.find(e=>e.run_id===t)??e.runs[0];return(0,z.jsxs)(`div`,{className:`benchmark-runs-layout`,children:[(0,z.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Run`}),(0,z.jsx)(`th`,{children:`Case`}),(0,z.jsx)(`th`,{children:`Arm`}),(0,z.jsx)(`th`,{children:`Status`}),(0,z.jsx)(`th`,{children:`Countability`})]})}),(0,z.jsx)(`tbody`,{children:e.runs.map(e=>(0,z.jsxs)(`tr`,{"aria-selected":e.run_id===r?.run_id,children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`button`,{className:`benchmark-run-link`,onClick:()=>n(e.run_id),type:`button`,children:e.run_id})}),(0,z.jsx)(`td`,{children:e.case_id}),(0,z.jsx)(`td`,{children:e.arm_id}),(0,z.jsx)(`td`,{children:e.status}),(0,z.jsx)(`td`,{children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]},e.run_id))})]})}),r&&(0,z.jsx)(bT,{packet:e,run:r})]})}function ST(){let e=LT.useSearch(),t=LT.useNavigate(),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(null),[o,s]=(0,R.useState)(0),c=(0,R.useMemo)(()=>{let t=e.dashboardUrl||`/chat/benchmark-study.example.json`;try{return{url:sT(t,window.location.href),error:null}}catch(e){return{url:``,error:e instanceof Error?e.message:`Invalid dashboard source`}}},[e.dashboardUrl]);if((0,R.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 oT(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,R.useEffect)(()=>{n&&(document.title=`${n.design.labels.title??n.study_id} · LoopX Benchmark`)},[n]),i)return(0,z.jsxs)(`main`,{className:`benchmark-page benchmark-loading`,children:[(0,z.jsx)(ym,{"aria-hidden":`true`}),(0,z.jsx)(`h1`,{children:`Dashboard packet unavailable`}),(0,z.jsx)(`p`,{children:i}),(0,z.jsxs)(`button`,{onClick:()=>s(e=>e+1),type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":`true`,size:16}),` Retry readback`]})]});if(!n)return(0,z.jsxs)(`main`,{"aria-busy":`true`,className:`benchmark-page benchmark-loading`,children:[(0,z.jsx)(im,{"aria-hidden":`true`}),(0,z.jsx)(`h1`,{children:`Reading benchmark study`}),(0,z.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,z.jsxs)(`main`,{className:`benchmark-page`,children:[(0,z.jsxs)(`header`,{className:`benchmark-hero`,children:[(0,z.jsxs)(`div`,{className:`benchmark-hero-topline`,children:[(0,z.jsx)(`a`,{className:`benchmark-wordmark`,href:`/chat/`,children:`LoopX`}),(0,z.jsxs)(`div`,{className:`benchmark-readonly`,children:[(0,z.jsx)(oh,{"aria-hidden":`true`,size:15}),` Derived read-only projection`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-hero-grid`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`p`,{className:`benchmark-kicker`,children:[`BENCHMARK STUDY / `,n.benchmark_id]}),(0,z.jsxs)(`div`,{className:`benchmark-title-row`,children:[(0,z.jsx)(`h1`,{children:n.design.labels.title??n.study_id}),(0,z.jsx)(gT,{tone:n.status===`complete`?`success`:`warning`,children:n.status})]}),(0,z.jsx)(`p`,{className:`benchmark-lead`,children:`One declared study, explicit denominators, and the same countability rules from campaign summary to exact run.`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-identity`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Study`}),(0,z.jsx)(`dd`,{children:n.study_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocol`}),(0,z.jsx)(`dd`,{children:n.design.protocol_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Case set`}),(0,z.jsx)(`dd`,{children:n.design.case_set.case_set_id})]})]})]}),(0,z.jsxs)(`div`,{className:`benchmark-kpi-grid`,children:[(0,z.jsxs)(`article`,{children:[(0,z.jsx)(wm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Score-countable cells`}),(0,z.jsxs)(`strong`,{children:[n.campaign.selected_score_countable_cell_count,(0,z.jsxs)(`small`,{children:[` / `,n.campaign.intended_cell_denominator]})]}),(0,z.jsxs)(`p`,{children:[lT(n.campaign.selected_score_countable_coverage_rate),` declared coverage`]})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(bm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Complete designs`}),(0,z.jsxs)(`strong`,{children:[n.campaign.complete_declared_design_case_count,(0,z.jsxs)(`small`,{children:[` / `,n.campaign.intended_case_count]})]}),(0,z.jsx)(`p`,{children:`Cases with every declared arm`})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(sm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Matched comparisons`}),(0,z.jsx)(`strong`,{children:n.campaign.matched_pair_countable_count}),(0,z.jsx)(`p`,{children:`Eligible pairs only`})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(im,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`In flight`}),(0,z.jsx)(`strong`,{children:n.campaign.in_flight_run_count}),(0,z.jsx)(`p`,{children:n.status===`provisional`?`Coverage remains provisional`:`Declared coverage complete`})]})]})]}),(0,z.jsxs)(`nav`,{"aria-label":`Benchmark dashboard views`,className:`benchmark-tabs`,children:[cT.map(t=>(0,z.jsx)(`button`,{"aria-current":e.view===t.id?`page`:void 0,onClick:()=>u(t.id),type:`button`,children:t.label},t.id)),(0,z.jsxs)(`button`,{className:`benchmark-refresh`,onClick:()=>s(e=>e+1),type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":`true`,size:14}),` Refresh local readback`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-content`,children:[e.view===`campaign`&&(0,z.jsx)(_T,{packet:n,primaryMetric:l}),e.view===`arms`&&(0,z.jsx)(vT,{packet:n}),e.view===`cases`&&(0,z.jsx)(yT,{onOpenRun:e=>u(`runs`,e),packet:n,primaryMetric:l}),e.view===`runs`&&(0,z.jsx)(xT,{onSelectRun:e=>u(`runs`,e),packet:n,selectedRunId:e.runId})]}),(0,z.jsxs)(`footer`,{className:`benchmark-footer`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(oh,{"aria-hidden":`true`,size:16}),(0,z.jsxs)(`span`,{children:[`Scores: `,n.authority.score_source]}),(0,z.jsx)(`span`,{children:`Dashboard cannot launch, grade, or mutate runs.`})]}),(0,z.jsxs)(`code`,{title:d,children:[`local`,d]})]})]})}var CT=J({goalId:W().optional().default(``),statusUrl:W().optional().default(``)}),wT=J({goalId:W().optional().default(``),mode:Y([`showcase`,`developer`,`ops`]).optional().default(`showcase`),statusUrl:W().optional().default(``),todoLane:Y([`all`,`user`,`agent`]).optional().default(`all`),todoQuery:W().optional().default(``)}),TT=wT.omit({mode:!0}),ET=J({dashboardUrl:W().optional().default(``),view:Y([`campaign`,`arms`,`cases`,`runs`]).optional().default(`campaign`),runId:W().optional().default(``)});function DT(){let e=`https://loopx-project.github.io/loopx/docs/showcases/index.en.html`;return(0,R.useEffect)(()=>{window.location.replace(e)},[]),(0,z.jsx)(`a`,{href:e,children:`Open LoopX cases / 浏览案例`})}function OT({goalId:e,statusUrl:t}){let n=t?bh(t,window.location.href):null;return n?.error?(0,z.jsx)(`main`,{role:`alert`,children:n.error}):(0,z.jsx)(ii,{replace:!0,to:`/`,search:{goalId:e,statusUrl:t}})}function kT(){let e=NT.useSearch();return e.mode===`ops`?(0,z.jsx)(OT,{...e}):e.mode===`developer`?(0,z.jsx)(ii,{replace:!0,to:`/developers/projections`}):(0,z.jsx)(DT,{})}function AT(){return(0,z.jsx)(OT,{...PT.useSearch()})}var jT=Ci({component:()=>(0,z.jsx)(Mi,{}),errorComponent:()=>(0,z.jsxs)(`main`,{role:`alert`,className:`p-8`,children:[(0,z.jsx)(`h1`,{children:`页面暂时无法显示 / Page unavailable`}),(0,z.jsx)(`p`,{children:`请重新加载页面;这不会执行任务。 / Reloading does not execute tasks.`}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`重新加载 / Reload`})]})}),MT=xi({getParentRoute:()=>jT,path:`/`,validateSearch:e=>CT.parse(e),component:Fw}),NT=xi({getParentRoute:()=>jT,path:`/frontstage`,validateSearch:e=>wT.parse(e),component:kT}),PT=xi({getParentRoute:()=>jT,path:`/deprecated/frontstage/ops`,validateSearch:e=>TT.parse(e),component:AT}),FT=xi({getParentRoute:()=>jT,path:`/frontstage/developer`,component:()=>(0,z.jsx)(ii,{replace:!0,to:`/developers/projections`})}),IT=xi({getParentRoute:()=>jT,path:`/developers/projections`,component:Yw}),LT=xi({getParentRoute:()=>jT,path:`/benchmarks/study`,validateSearch:e=>ET.parse(e),component:ST}),RT=jT.addChildren([MT,NT,PT,FT,IT,LT]);function zT(e){return!e||e===`/`||e===`./`?`/`:(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``)||`/`}var BT=Li({routeTree:RT,basepath:zT(`/chat/`),trailingSlash:`preserve`}),VT=document.getElementById(`root`);if(!VT)throw Error(`Root element not found`);var HT=new je({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}});(0,Vi.createRoot)(VT).render((0,z.jsx)(Fe,{client:HT,children:(0,z.jsx)(qi,{children:(0,z.jsx)(Bi,{router:BT})})})); \ No newline at end of file +`),summary:k.summary,title:k.title}}]:[]],ot=f.connectionState===`connected`,st=new Map(E.goals.map(e=>[e.goalId,e.title])),ct=e=>nf(e,f.activeSource.statusUrl,ot&&!l?.errors[e.goalId],st.get(e.goalId)),lt={...Gd(E),userTodos:E.userTodos.map(ct),attentionHistory:(E.attentionHistory??E.userTodos).map(ct),periodicReports:{error:ee,loading:M},timeline:at};return(0,z.jsxs)(`div`,{className:p===`dark`?`dark`:``,"data-testid":`personal-goal-home`,children:[Ee?(0,z.jsx)(`p`,{role:`status`,className:`m-0 bg-amber-50 px-4 py-2 text-sm text-amber-900`,children:_(Ee===`partial`?`runs.discoveryPartial`:`runs.discoveryOffline`)}):null,(0,z.jsx)(_C,{agents:re.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=>it(e.goalId),onCorrectRun:async(e,t)=>{if(!e.sessionId)throw Error(`这个 Run 还没有可纠偏的执行 Session。`);let n=await tg((await Qh({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(V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:r?`running`:`ready`,turnId:r}),r){Pe.current.set(e.goalId,r);let t=new AbortController;Fe.current.set(e.goalId,t);let n=``,i=Je(e.goalId,{activity:[`正在把纠偏送入原执行 Session`],agentLabel:e.agentLabel,lines:[],pending:!0,sourceLabel:`${e.agentLabel} · 执行 Session`,text:``});try{let a=await Tg(e.sessionId,r,{signal:t.signal,onDelta:t=>{n+=t,Ye(e.goalId,i,{text:n})}});Ye(e.goalId,i,{activity:[],pending:!1,text:nw(a.response.message||n.trim())||`${e.agentLabel} 已完成纠偏。`})}catch(t){let n=Ie.current.delete(e.goalId);Ye(e.goalId,i,{activity:[],pending:!1,text:n?`已中断。你可以在当前会话继续发送消息。`:t instanceof Error?t.message:`纠偏回合失败。`})}finally{Pe.current.delete(e.goalId),Fe.current.delete(e.goalId),V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:`ready`})}}},onCloseRunSession:tt,onInterruptRun:async e=>Qe(e),onOpenGoal:it,onOpenRunSession:async e=>{if(!e.sessionId)return;let t=e.sessionId,n=await cg(t);ke(e=>({...e,[t]:n})),it(e.goalId),_e(t=>({...t,[e.goalId]:n.messages.map(t=>({agentLabel:t.role===`user`?void 0:e.agentLabel,attachments:ZC(t.attachments),id:Ae.current++,lines:[],role:t.role===`user`?`user`:`assistant`,sourceLabel:t.role===`user`?void 0:`${e.agentLabel} · 执行 Session`,text:t.role===`user`?t.text:nw(t.text)}))})),V(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=>it(e.goalId),...b?{onPreviewGoalSubagentConfiguration:async e=>{let t=await Ag(e);return{changed:t.changed,configuration:{allowedDomains:t.after.orchestration.allowed_domains,codexHostCapacity:{configuredChildren:t.codex_host_capacity.configured_children,newSessionRequired:t.codex_host_capacity.new_session_required,requiredChildren:t.codex_host_capacity.required_children,status:t.codex_host_capacity.status,writeRequired:t.codex_host_capacity.write_required,written:t.codex_host_capacity.written},enabled:t.feature_summary.multi_subagent===`enabled`,executionConfig:t.after.orchestration.execution_config,maxChildren:t.after.orchestration.max_children,modelConfig:t.after.orchestration.model_config},previewId:t.preview_id}},onApplyGoalSubagentConfiguration:async({previewId:e,...t})=>{let n=await jg(t,e);return{allowedDomains:n.after.orchestration.allowed_domains,codexHostCapacity:{configuredChildren:n.codex_host_capacity.configured_children,newSessionRequired:n.codex_host_capacity.new_session_required,requiredChildren:n.codex_host_capacity.required_children,status:n.codex_host_capacity.status,writeRequired:n.codex_host_capacity.write_required,written:n.codex_host_capacity.written},enabled:n.feature_summary.multi_subagent===`enabled`,executionConfig:n.after.orchestration.execution_config,maxChildren:n.after.orchestration.max_children,modelConfig:n.after.orchestration.model_config}}}:{},...g?{onExecuteGoalLifecycle:async({goalId:e,operation:t,reason:n})=>{let r=await Tx(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:$e,onSelectAgent:nt,onSelectGoal:e=>e?it(e):rt(),onSendMessage:async(e,t,n,r)=>Ze(e,{agentId:t,goalId:n,attachments:r}),onPrepareLoopX:(e,t)=>Xe(t,e),onStartLoopX:(e,t,n,r)=>{Ze(e===`start`?`开启 LoopX 模式,持续推进当前 Goal。`:`恢复 LoopX 模式。`,{agentId:t,goalId:n,loopxMode:{operation:e,settings:r}})},onStartNewRunSession:et},goalArchiveLoadState:e,managerChannelBinding:w,managerRuntime:S,conversationSessionId:Se[N]?.sessionId,model:lt,readOnly:h,selectedAgentId:L.agentId,selectedGoalId:D?.goalId??null,statusSourceControl:f})]})}function jw({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,z.jsx)(`div`,{className:i===`dark`?`dark`:``,children:(0,z.jsxs)(`main`,{className:`min-h-screen bg-[#f6f7f9] text-slate-950 dark:bg-[#09090b] dark:text-zinc-50`,children:[(0,z.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,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:`LoopX Workspace`}),(0,z.jsx)(`p`,{className:`mt-1 break-all text-sm text-slate-500 dark:text-zinc-400`,children:`Personal Workspace`})]}),(0,z.jsx)(Iy,{"aria-label":`切换主题`,onClick:a,size:`icon`,variant:`secondary`,children:i===`dark`?(0,z.jsx)(uh,{className:`h-4 w-4`}):(0,z.jsx)(Gm,{className:`h-4 w-4`})})]}),(0,z.jsxs)(`div`,{className:`grid min-h-[calc(100vh-80px)] sm:grid-cols-[240px_1fr]`,children:[(0,z.jsxs)(`aside`,{className:`hidden border-r border-slate-200 p-6 dark:border-zinc-800 sm:block`,"aria-label":`Workspace`,children:[(0,z.jsx)(`strong`,{children:`LoopX`}),(0,z.jsx)(`p`,{className:`mt-6 text-sm`,children:`Workspace`}),(0,z.jsx)(`p`,{className:`mt-8 text-xs text-slate-500`,children:`Goals`}),[1,2,3].map(e=>(0,z.jsx)(`div`,{className:`mt-4 h-8 rounded bg-slate-100 dark:bg-zinc-900`},e))]}),(0,z.jsx)(`div`,{className:`p-4 sm:p-8`,children:(0,z.jsx)(Ly,{"data-testid":`initial-status-state`,children:(0,z.jsx)(Ry,{className:`flex min-h-64 items-center justify-center p-6`,children:(0,z.jsxs)(`div`,{className:`max-w-xl text-center`,children:[e?(0,z.jsx)(ym,{className:`mx-auto h-6 w-6 text-rose-600 dark:text-rose-300`}):(0,z.jsx)(Qm,{className:`mx-auto h-6 w-6 animate-spin text-slate-500 dark:text-zinc-400`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e?`无法加载实时状态`:`正在加载实时状态`}),e?(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-slate-400 dark:text-zinc-500`,children:`重新加载不会执行任务,也不会改变 Goal 配置。`}):null,(0,z.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:(0,z.jsxs)(Iy,{disabled:t,onClick:n,children:[(0,z.jsx)(Qm,{className:`h-4 w-4`}),`重试`]})})]}):(0,z.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 Mw(){let e=kT.useSearch(),t=kT.useNavigate(),[n,r]=(0,R.useState)(`light`),[i,a]=(0,R.useState)(null),o=(0,R.useRef)(null),s=(0,R.useRef)(e.goalId);s.current=e.goalId;let[c,l]=(0,R.useState)(Vp),[u,d]=(0,R.useState)({kind:`example`,label:`bundled example`}),[f,p]=(0,R.useState)(()=>kC(window.localStorage,window.location.href)),m=(0,R.useRef)(f);m.current=f;let[h,g]=(0,R.useState)(e.statusUrl),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)({error:null,phase:`idle`}),[C,w]=(0,R.useState)(e.statusUrl.trim()||null),[T,E]=(0,R.useState)(!1),D=(0,R.useRef)(null),O=(0,R.useRef)(k_(e.statusUrl.trim()||null)),k=!T&&u.kind===`example`?e.statusUrl.trim():``,A=C??k,ee=u.kind===`url`?u.label:zC,j=!!(_&&C),M=IC(f,C,ee,window.location.href),te=u.kind===`example`&&!T,ne=c.attention_queue,N=c.run_history,P=(0,R.useMemo)(()=>HC(N.goals,ne.items),[N.goals,ne.items]);function re(e,t,n=0){S({error:null,phase:`loading`}),BC(Sh(e,`stopped`,window.location.href)).then(r=>{if(!N_(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=>nv(e,r)),a&&n<1){F(e,{background:!0,resyncAttempt:n+1});return}S(a?{error:`Goal 状态在加载历史时发生变化,请重试。`,phase:`error`}:{error:null,phase:`ready`})}).catch(e=>{N_(O.current,t)&&S({error:Bp(e),phase:`error`})})}function ie(){let e=u.kind===`url`?u.label:h||zC,t=j_(O.current,e,{background:!0});if(i){F(e);return}t&&re(e,t)}async function ae(e,n,r){if(r.background)return l(e=>nv(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})}),M_(O.current,r)?(O.current.requestedUrl=null,w(null),!0):!1}async function F(e,t={}){let n=e.trim(),r=t.background===!0;if(!n){r||v(`状态地址不能为空`);return}let c=j_(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 Gp(n,window.location.href).catch(()=>null);if(!N_(O.current,c))return;if(e){let o=(t.retryOnly||t.reuseSnapshots)&&u.kind===`url`&&u.label===n?Up(i,e,{invalidateGoalIds:t.invalidateGoalIds}):{};a({directory:e,snapshots:o,errors:{}});let f={...e,goals:e.goals.filter(e=>!o[e.id])},p=!1,m=Kp(e);if(r)l(m);else if(!await ae(n,m,c))return;if(S({error:null,phase:`loading`}),await Jp(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})},()=>N_(O.current,c),()=>s.current,d.signal),p&&(t.resyncAttempt??0)<1&&N_(O.current,c)){await F(n,{resyncAttempt:1});return}N_(O.current,c)&&S({error:null,phase:`ready`});return}let o=await BC(Sh(n,`active`,window.location.href));if(!N_(O.current,c)||(a(null),c.registryRevision=o.goal_projection?.registry_revision??null,!await ae(n,o,c)))return;if(o.goal_projection?.scope!==`active`||o.goal_projection.complete){S({error:null,phase:`ready`});return}re(n,c,t.resyncAttempt??0)}catch(e){if(!M_(O.current,c))return;r||v(Bp(e))}finally{!r&&M_(O.current,c)&&b(!1)}}function oe(e,t={}){o.current?.abort();let n=A_(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 wx(e.label,t)}catch{}}O.current.selectionRevision===n&&await F(e.statusUrl,{selectionRevision:n})})()}function I(e){m.current=e,p(e);try{AC(window.localStorage,e)}catch{}}let se={activeSource:M,connectionState:y?`loading`:j?`error`:`connected`,errorMessage:j?`未切换到 ${C??`所选来源`}:${_}`:null,onAdd:e=>{let t=MC(f,e,window.location.href);return`error`in t?{error:t.error}:(I(t.catalog),oe(t.source,{ensureTunnel:e.ensureTunnel}),{})},onConfiguredHostsLoaded:e=>{let t=m.current,n=jC(t,e);n!==t&&I(n)},onRemove:e=>{I(NC(f,e)),M.id===e&&oe(wC)},onSelect:e=>{let t=f.sources.find(t=>t.id===e);t&&oe(t,{ensureTunnel:t.kind===`ssh_tunnel`})},sources:M.id===`temporary`?[...f.sources,M]:f.sources};(0,R.useEffect)(()=>{let t=e.statusUrl.trim();if(t){if(D.current===t||C&&C!==t)return;(u.kind!==`url`||u.label!==t)&&F(t);return}D.current=null,!T&&(C||u.kind===`example`&&F(zC))},[T,C,e.statusUrl,u.kind,u.label]),(0,R.useEffect)(()=>{if(e.statusUrl&&u.kind===`example`)return;let n=new Set(P.map(e=>e.goal.id));if(P.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,P,t,e.goalId,e.statusUrl,u.kind]),(0,R.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]&&F(u.label,{retryOnly:!0})},[e.goalId,y,i,u]);function L(e){t({search:t=>({...t,goalId:e})})}return te?(0,z.jsx)(jw,{error:_,isLoading:y,onRetry:()=>void F(A||zC),requestedUrl:A||zC,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)}):(0,z.jsx)(Aw,{goalArchiveLoadState:x,isLoading:y,onGoalActivationStateChange:(e,t)=>{O.current.projectionRevision+=1,l(n=>Lp(n,e,t)),a(n=>n&&{...n,snapshots:Object.fromEntries(Object.entries(n.snapshots).map(([n,r])=>[n,Lp(r,e,t)]))})},onGoalDeleted:e=>{O.current.projectionRevision+=1,l(t=>Rp(t,e)),a(t=>t&&{...t,snapshots:Object.fromEntries(Object.entries(t.snapshots).filter(([t])=>t!==e))})},onSelectGoal:L,onReconcileStatus:e=>F(u.kind===`url`?u.label:h||zC,{background:!0,invalidateGoalIds:e?.invalidateGoalIds,reuseSnapshots:!0}),onRetryGoalArchive:ie,onRefresh:()=>F(u.kind===`url`?u.label:h||zC,{retryOnly:!!(i&&Object.keys(i.errors).length)}),payload:c,progress:i,rows:P,selectedGoalId:e.goalId,statusSourceControl:se,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)})}var Nw=sv(`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 Pw({className:e,variant:t,...n}){return(0,z.jsx)(`span`,{className:Py(Nw({variant:t}),e),...n})}var Fw=[{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`}],Iw=[{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`}],Lw=[{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.`}],Rw=[`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`],zw=[{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 Bw({children:e,icon:t,title:n}){return(0,z.jsxs)(`section`,{className:`rounded-lg border border-slate-200 bg-white shadow-sm`,children:[(0,z.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,z.jsx)(t,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function Vw(){return(0,z.jsx)(Bw,{icon:pm,title:`Status Contract Explorer`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,"data-testid":`developer-contract-explorer`,children:Fw.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(Pw,{variant:`info`,children:e.label}),(0,z.jsx)(Pw,{variant:`neutral`,children:`public contract`})]}),(0,z.jsx)(`div`,{className:`mt-2 break-words font-mono text-xs text-slate-700`,children:e.source}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.detail})]},e.label))})})}function Hw(){return(0,z.jsx)(Bw,{icon:Nm,title:`Projection Diffing`,children:(0,z.jsx)(`div`,{className:`overflow-x-auto`,"data-testid":`developer-projection-diffing`,children:(0,z.jsxs)(`table`,{className:`min-w-full border-separate border-spacing-0 text-left text-sm`,children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{className:`bg-slate-50 text-xs uppercase tracking-normal text-slate-500`,children:[(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Axis`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Current`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Proposed`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Gate`})]})}),(0,z.jsx)(`tbody`,{children:Iw.map(e=>(0,z.jsxs)(`tr`,{className:`align-top`,children:[(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 font-semibold text-slate-950`,children:e.axis}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.current}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.proposed}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.gate})]},e.axis))})]})})})}function Uw(){return(0,z.jsx)(Bw,{icon:km,title:`Fixture Generation`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-fixture-generation`,children:Lw.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:e.title}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.title))})})}function Ww(){return(0,z.jsx)(Bw,{icon:xm,title:`Smoke Checklist`,children:(0,z.jsx)(`div`,{className:`space-y-2 p-4`,"data-testid":`developer-smoke-checklist`,children:Rw.map(e=>(0,z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(um,{className:`mt-0.5 h-4 w-4 shrink-0 text-emerald-600`}),(0,z.jsx)(`code`,{className:`break-all text-xs font-semibold leading-5 text-slate-700`,children:e})]},e))})})}function Gw(){return(0,z.jsx)(Bw,{icon:Sm,title:`Component Examples`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-3`,"data-testid":`developer-component-examples`,children:zw.map(e=>(0,z.jsxs)(`article`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.badges.map(e=>(0,z.jsx)(Pw,{variant:e===`read-only`||e===`public-safe`?`success`:`neutral`,children:e},e))}),(0,z.jsx)(`h3`,{className:`mt-3 text-sm font-semibold leading-6 text-slate-950`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.name))})})}function Kw(){return(0,z.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,z.jsxs)(`div`,{className:`mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,z.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,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.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,z.jsx)(dh,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold`,children:`Developer Cockpit`}),(0,z.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Projection extension`})]})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://loopx-project.github.io/loopx/`,children:[(0,z.jsx)(Lm,{className:`h-4 w-4`}),`LoopX home`]}),(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://loopx-project.github.io/loopx/docs/showcases/index.en.html`,children:[(0,z.jsx)(Dm,{className:`h-4 w-4`}),`Public cases`]}),(0,z.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,z.jsx)(Sm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,z.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,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(Pw,{variant:`success`,children:`read-only`}),(0,z.jsx)(Pw,{variant:`neutral`,children:`public fixtures`})]}),(0,z.jsx)(`p`,{children:`This route uses static public contracts only; live status feeds, registry files, and browser write APIs stay outside the cockpit.`})]})]}),(0,z.jsxs)(`section`,{className:`space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(Pw,{variant:`info`,children:`developers/projections`}),(0,z.jsx)(Pw,{variant:`success`,children:`public-safe`}),(0,z.jsx)(Pw,{variant:`neutral`,children:`no browser writes`})]}),(0,z.jsx)(`h1`,{className:`mt-3 text-3xl font-semibold tracking-normal text-slate-950`,children:`LoopX Projection Developer Cockpit`}),(0,z.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,z.jsxs)(`div`,{className:`grid min-w-[260px] gap-2 text-sm`,children:[(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Source of truth`}),(0,z.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`status contract + compact fixtures`})]}),(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Boundary`}),(0,z.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`read-only extension surface`})]})]})]})}),(0,z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,z.jsx)(Vw,{}),(0,z.jsx)(Hw,{})]}),(0,z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,z.jsx)(Uw,{}),(0,z.jsx)(Ww,{})]}),(0,z.jsx)(Gw,{}),(0,z.jsx)(Bw,{icon:oh,title:`Extension Boundary`,children:(0,z.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-extension-boundary`,children:[(0,z.jsxs)(`div`,{className:`rounded-md border border-emerald-200 bg-emerald-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Allowed`}),(0,z.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,z.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Review`}),(0,z.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,z.jsxs)(`div`,{className:`rounded-md border border-rose-200 bg-rose-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Stop`}),(0,z.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 qw=J({value:G().finite(),total:G().finite().positive().optional(),unit:W().optional(),higher_is_better:K()}).passthrough(),Jw=yd(W(),G().finite()).default({}),Yw=J({outcome_status:W().optional(),failure_class:W(),causal_summary:W(),expectedness:W(),implication:W(),next_probe:W(),confidence:W(),evidence_refs:q(W()).optional()}).passthrough(),Xw=J({arm_id:W(),selected_run_id:W().nullable(),score_countable:K(),metrics:yd(W(),qw),effort:Jw,insight:Yw.nullable().optional()}),Zw=J({run_id:W(),case_id:W(),arm_id:W(),arm_role:W(),status:W(),protocol_id:W(),runner_revision:W().optional(),observed_at:W(),metrics:yd(W(),qw),countability:J({integrity_qualified:K(),official_result_present:K(),score_countable:K()}).passthrough(),treatment_fidelity:W(),effort:Jw,redacted_insight:Yw.nullable().optional(),upload_provenance:J({producer_id:W(),producer_version:W(),observed_at:W(),source_revision:W()}).passthrough()}).passthrough(),Qw=J({case_denominator:G().int().nonnegative(),value_sum:G().finite(),value_mean:G().finite().nullable(),value_median:G().finite().nullable(),value_min:G().finite().nullable(),value_max:G().finite().nullable(),case_macro_rate:G().finite().optional(),suite_micro_rate:G().finite().optional(),suite_micro_numerator:G().finite().optional(),suite_micro_denominator:G().finite().positive().optional()}).passthrough(),$w=J({arm_id:W(),arm_role:W(),factor_assignments:yd(W(),W()),protocol_counts:yd(W(),G().int().nonnegative()).default({}),runner_revision_counts:yd(W(),G().int().nonnegative()).default({}),orchestrator_runtime_counts:yd(W(),G().int().nonnegative()).default({}),intended_case_count:G().int().positive(),run_count:G().int().nonnegative(),terminal_run_count:G().int().nonnegative(),selected_score_countable_case_count:G().int().nonnegative(),coverage_rate:G().finite().min(0).max(1),metrics:yd(W(),Qw),binary_outcomes:yd(W(),J({success_count:G().int().nonnegative(),case_denominator:G().int().nonnegative(),success_rate:G().finite().min(0).max(1).nullable()})),effort:yd(W(),J({denominator:G().int().nonnegative(),mean:G().finite().nullable(),median:G().finite().nullable()})),failure_class_counts:yd(W(),G().int().nonnegative())}).passthrough(),eT=J({baseline_value:G().finite(),candidate_value:G().finite(),delta:G().finite(),direction:Y([`improved`,`flat`,`regressed`]).optional()}).passthrough(),tT=J({comparison_id:W(),comparison_anchor_run_id:W(),candidate_run_id:W(),candidate_arm_id:W(),primary_metric:W(),matched_pair_countable:X(!0),metric_deltas:yd(W(),eT)}).passthrough(),nT=J({ok:X(!0),schema_version:X(`benchmark_study_dashboard_v0`),benchmark_id:W(),study_id:W(),status:Y([`complete`,`provisional`]),design:J({protocol_id:W(),comparison_protocol_id:W(),baseline_arm_id:W(),case_set:J({case_set_id:W(),case_ids:q(W())}),metric_catalog:q(J({metric_name:W(),role:Y([`primary`,`guardrail`,`supporting`]),unit:W().optional(),higher_is_better:K(),binary:K()})),labels:yd(W(),W())}).passthrough(),campaign:J({intended_case_count:G().int().positive(),intended_arm_count:G().int().positive(),intended_cell_denominator:G().int().positive(),selected_score_countable_cell_count:G().int().nonnegative(),selected_score_countable_coverage_rate:G().finite().min(0).max(1),complete_declared_design_case_count:G().int().nonnegative(),ambiguous_score_countable_cell_count:G().int().nonnegative(),in_flight_run_count:G().int().nonnegative(),matched_pair_countable_count:G().int().nonnegative(),factorial_contrast_count:G().int().nonnegative(),factorial_contrast_countable_count:G().int().nonnegative(),runtime_observation_count:G().int().nonnegative(),runtime_classification_counts:yd(W(),G().int().nonnegative())}),arms:q($w),contrasts:yd(W(),J({matched_pair_denominator:G().int().nonnegative(),primary_metric_directions:J({improved:G().int().nonnegative(),flat:G().int().nonnegative(),regressed:G().int().nonnegative()}),binary_metric_transitions:yd(W(),J({"0_to_1":G().int().nonnegative(),"1_to_0":G().int().nonnegative(),same:G().int().nonnegative()}))})),cases:q(J({case_id:W(),complete_declared_design:K(),arms:q(Xw),eligible_comparisons:q(tT),largest_eligible_primary_contrast:tT.nullable()})),runs:q(Zw),authority:J({score_source:W(),matched_comparison_source:W(),factorial_comparison_source:W().nullable(),manifest_changes_scores:X(!1),dashboard_is_execution_authority:X(!1)}),public_boundary:J({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 rT(e){return nT.parse(e)}function iT(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 aT=[{id:`campaign`,label:`Campaign`},{id:`arms`,label:`Arms`},{id:`cases`,label:`Cases`},{id:`runs`,label:`Runs`}];function oT(e){return e==null?`—`:`${(e*100).toFixed(e>=.995?0:1)}%`}function sT(e){return e==null?`—`:new Intl.NumberFormat(`en`,{maximumFractionDigits:2,notation:`compact`}).format(e)}function cT(e){if(e==null)return`—`;let t=e/6e4;return t>=120?`${(t/60).toFixed(1)} h`:`${sT(t)} min`}function lT(e){let t=Object.entries(e);return t.length?t.map(([e,t])=>`${e} (${t})`).join(`, `):`—`}function uT(e){if(!e)return`—`;let t=e.total==null?sT(e.value):`${sT(e.value)}/${sT(e.total)}`;return e.unit?`${t} ${e.unit}`:t}function dT(e,t){let n=e.metrics[t];return!n||n.case_denominator===0?`—`:n.suite_micro_rate==null?`${sT(n.value_mean)} mean`:`${oT(n.suite_micro_rate)} · ${sT(n.suite_micro_numerator)}/${sT(n.suite_micro_denominator)}`}function fT(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}${sT(r.delta)}`}}function pT({children:e,tone:t=`neutral`}){return(0,z.jsx)(`span`,{className:`benchmark-state benchmark-state-${t}`,children:e})}function mT({packet:e,primaryMetric:t}){return(0,z.jsxs)(`div`,{className:`benchmark-view-stack`,children:[(0,z.jsxs)(`section`,{"aria-labelledby":`arm-summary-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`ARM SUMMARY`}),(0,z.jsx)(`h2`,{id:`arm-summary-title`,children:`Comparable outcomes, denominator first`})]}),(0,z.jsx)(`p`,{children:`Only one score-countable run per declared case × arm cell is selected.`})]}),(0,z.jsx)(`div`,{className:`benchmark-arm-grid`,children:e.arms.map(e=>{let n=Object.values(e.binary_outcomes)[0];return(0,z.jsxs)(`article`,{className:`benchmark-arm-card`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:e.arm_role}),(0,z.jsx)(`h3`,{children:e.arm_id})]}),(0,z.jsx)(pT,{tone:e.coverage_rate===1?`success`:`warning`,children:e.coverage_rate===1?`Complete`:`Provisional`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`dt`,{children:[`Primary · `,t]}),(0,z.jsx)(`dd`,{children:dT(e,t)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Score-countable coverage`}),(0,z.jsxs)(`dd`,{children:[e.selected_score_countable_case_count,`/`,e.intended_case_count]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Binary success`}),(0,z.jsx)(`dd`,{children:n?`${n.success_count}/${n.case_denominator}`:`Not declared`})]})]})]},e.arm_id)})})]}),(0,z.jsxs)(`section`,{"aria-labelledby":`contrast-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`MATCHED CONTRASTS`}),(0,z.jsx)(`h2`,{id:`contrast-title`,children:`Direction counts on eligible pairs`})]}),(0,z.jsx)(`p`,{children:`Raw run volume is never used as a comparison denominator.`})]}),(0,z.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Candidate arm`}),(0,z.jsx)(`th`,{children:`Matched denominator`}),(0,z.jsx)(`th`,{children:`Improved`}),(0,z.jsx)(`th`,{children:`Flat`}),(0,z.jsx)(`th`,{children:`Regressed`}),(0,z.jsx)(`th`,{children:`Binary transitions`})]})}),(0,z.jsxs)(`tbody`,{children:[Object.entries(e.contrasts).map(([e,t])=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`strong`,{children:e})}),(0,z.jsx)(`td`,{children:t.matched_pair_denominator}),(0,z.jsx)(`td`,{className:`benchmark-positive`,children:t.primary_metric_directions.improved}),(0,z.jsx)(`td`,{children:t.primary_metric_directions.flat}),(0,z.jsx)(`td`,{className:`benchmark-negative`,children:t.primary_metric_directions.regressed}),(0,z.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,z.jsx)(`tr`,{children:(0,z.jsx)(`td`,{colSpan:6,children:`No matched comparisons are countable yet.`})})]})]})})]}),(0,z.jsxs)(`section`,{"aria-labelledby":`runtime-health-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`RUNTIME HEALTH`}),(0,z.jsx)(`h2`,{id:`runtime-health-title`,children:`Qualified observations, without execution authority`})]}),(0,z.jsxs)(`p`,{children:[e.campaign.runtime_observation_count,` public-safe runtime observations.`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-runtime-list`,children:[Object.entries(e.campaign.runtime_classification_counts).map(([e,t])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:e}),(0,z.jsx)(`strong`,{children:t})]},e)),e.campaign.runtime_observation_count===0&&(0,z.jsx)(`p`,{className:`benchmark-muted`,children:`No runtime observations uploaded.`})]})]})]})}function hT({packet:e}){return(0,z.jsx)(`div`,{className:`benchmark-detail-grid`,children:e.arms.map(t=>(0,z.jsxs)(`article`,{className:`benchmark-detail-card`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:t.arm_role}),(0,z.jsx)(`h2`,{children:t.arm_id})]}),(0,z.jsxs)(pT,{tone:t.coverage_rate===1?`success`:`warning`,children:[t.selected_score_countable_case_count,`/`,t.intended_case_count,` countable`]})]}),(0,z.jsx)(`div`,{className:`benchmark-factor-row`,children:Object.entries(t.factor_assignments).map(([e,t])=>(0,z.jsxs)(`span`,{children:[e,`: `,(0,z.jsx)(`strong`,{children:t})]},e))}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[e.design.metric_catalog.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`dt`,{children:[e.role,` · `,e.metric_name]}),(0,z.jsx)(`dd`,{children:dT(t,e.metric_name)})]},e.metric_name)),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runs terminal / observed`}),(0,z.jsxs)(`dd`,{children:[t.terminal_run_count,`/`,t.run_count]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Median duration`}),(0,z.jsx)(`dd`,{children:cT(t.effort.duration_ms?.median)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocols`}),(0,z.jsx)(`dd`,{children:lT(t.protocol_counts)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runner revisions`}),(0,z.jsx)(`dd`,{children:lT(t.runner_revision_counts)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Orchestrator runtimes`}),(0,z.jsxs)(`dd`,{children:[Object.keys(t.orchestrator_runtime_counts).length||0,` distinct`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Failure classes`}),(0,z.jsx)(`dd`,{children:lT(t.failure_class_counts)})]})]})]},t.arm_id))})}function gT({packet:e,primaryMetric:t,onOpenRun:n}){return(0,z.jsx)(`div`,{className:`benchmark-table-shell benchmark-wide-table`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Case`}),(0,z.jsx)(`th`,{children:`Design status`}),(0,z.jsx)(`th`,{children:`Largest eligible delta`}),e.arms.map(e=>(0,z.jsx)(`th`,{children:e.arm_id},e.arm_id))]})}),(0,z.jsx)(`tbody`,{children:e.cases.map(r=>{let i=fT(r,t);return(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`strong`,{children:r.case_id})}),(0,z.jsx)(`td`,{children:(0,z.jsx)(pT,{tone:r.complete_declared_design?`success`:`warning`,children:r.complete_declared_design?`Complete`:`Provisional`})}),(0,z.jsx)(`td`,{className:i?.direction===`improved`?`benchmark-positive`:i?.direction===`regressed`?`benchmark-negative`:void 0,children:i?.text??`—`}),r.arms.map(r=>(0,z.jsx)(`td`,{children:r.selected_run_id&&r.score_countable?(0,z.jsxs)(`button`,{className:`benchmark-cell-link`,onClick:()=>n(r.selected_run_id),type:`button`,children:[(0,z.jsxs)(`span`,{children:[t,`: `,uT(r.metrics[t])]}),e.design.metric_catalog.filter(e=>e.metric_name!==t).map(e=>(0,z.jsxs)(`small`,{className:`benchmark-cell-metric`,children:[e.metric_name,`: `,uT(r.metrics[e.metric_name])]},e.metric_name)),(0,z.jsxs)(`small`,{children:[`Countable · `,cT(r.effort.duration_ms),` `,(0,z.jsx)(sm,{"aria-hidden":`true`,size:12})]}),r.insight&&(0,z.jsxs)(`small`,{children:[r.insight.failure_class,` · `,r.insight.confidence]})]}):(0,z.jsx)(`span`,{className:`benchmark-muted`,children:`Not countable`})},r.arm_id))]},r.case_id)})})]})})}function _T({run:e,packet:t}){return(0,z.jsxs)(`aside`,{"aria-label":`Run detail for ${e.run_id}`,className:`benchmark-run-detail`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:`RUN DETAIL`}),(0,z.jsx)(`h2`,{children:e.run_id})]}),(0,z.jsx)(pT,{tone:e.countability.score_countable?`success`:`warning`,children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list benchmark-run-facts`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Case / arm`}),(0,z.jsxs)(`dd`,{children:[e.case_id,` · `,e.arm_id]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Lifecycle`}),(0,z.jsxs)(`dd`,{children:[e.status,` · `,e.observed_at]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocol`}),(0,z.jsx)(`dd`,{children:e.protocol_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Qualification`}),(0,z.jsxs)(`dd`,{children:[`Integrity `,e.countability.integrity_qualified?`qualified`:`not qualified`,` · result `,e.countability.official_result_present?`present`:`missing`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Treatment fidelity`}),(0,z.jsx)(`dd`,{children:e.treatment_fidelity})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Effort`}),(0,z.jsxs)(`dd`,{children:[cT(e.effort.duration_ms),` · `,sT(e.effort.agent_steps),` steps · `,sT(e.effort.token_count),` tokens`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runner revision`}),(0,z.jsx)(`dd`,{children:e.runner_revision??`—`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Upload provenance`}),(0,z.jsxs)(`dd`,{children:[e.upload_provenance.producer_id,` · `,e.upload_provenance.source_revision]})]})]}),(0,z.jsx)(`div`,{className:`benchmark-run-metrics`,children:t.design.metric_catalog.map(t=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:t.metric_name}),(0,z.jsx)(`strong`,{children:uT(e.metrics[t.metric_name])})]},t.metric_name))}),e.redacted_insight&&(0,z.jsxs)(`div`,{className:`benchmark-insight`,children:[(0,z.jsxs)(`span`,{className:`benchmark-mono`,children:[`REDACTED CASE INSIGHT · `,e.redacted_insight.confidence]}),(0,z.jsx)(`p`,{children:e.redacted_insight.causal_summary}),(0,z.jsxs)(`small`,{children:[`Implication: `,e.redacted_insight.implication]}),(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[`Next probe: `,e.redacted_insight.next_probe]}),!!e.redacted_insight.evidence_refs?.length&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[`Evidence: `,e.redacted_insight.evidence_refs.join(`, `)]})]})]})]})}function vT({packet:e,selectedRunId:t,onSelectRun:n}){let r=e.runs.find(e=>e.run_id===t)??e.runs[0];return(0,z.jsxs)(`div`,{className:`benchmark-runs-layout`,children:[(0,z.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Run`}),(0,z.jsx)(`th`,{children:`Case`}),(0,z.jsx)(`th`,{children:`Arm`}),(0,z.jsx)(`th`,{children:`Status`}),(0,z.jsx)(`th`,{children:`Countability`})]})}),(0,z.jsx)(`tbody`,{children:e.runs.map(e=>(0,z.jsxs)(`tr`,{"aria-selected":e.run_id===r?.run_id,children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`button`,{className:`benchmark-run-link`,onClick:()=>n(e.run_id),type:`button`,children:e.run_id})}),(0,z.jsx)(`td`,{children:e.case_id}),(0,z.jsx)(`td`,{children:e.arm_id}),(0,z.jsx)(`td`,{children:e.status}),(0,z.jsx)(`td`,{children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]},e.run_id))})]})}),r&&(0,z.jsx)(_T,{packet:e,run:r})]})}function yT(){let e=PT.useSearch(),t=PT.useNavigate(),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(null),[o,s]=(0,R.useState)(0),c=(0,R.useMemo)(()=>{let t=e.dashboardUrl||`/chat/benchmark-study.example.json`;try{return{url:iT(t,window.location.href),error:null}}catch(e){return{url:``,error:e instanceof Error?e.message:`Invalid dashboard source`}}},[e.dashboardUrl]);if((0,R.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 rT(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,R.useEffect)(()=>{n&&(document.title=`${n.design.labels.title??n.study_id} · LoopX Benchmark`)},[n]),i)return(0,z.jsxs)(`main`,{className:`benchmark-page benchmark-loading`,children:[(0,z.jsx)(ym,{"aria-hidden":`true`}),(0,z.jsx)(`h1`,{children:`Dashboard packet unavailable`}),(0,z.jsx)(`p`,{children:i}),(0,z.jsxs)(`button`,{onClick:()=>s(e=>e+1),type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":`true`,size:16}),` Retry readback`]})]});if(!n)return(0,z.jsxs)(`main`,{"aria-busy":`true`,className:`benchmark-page benchmark-loading`,children:[(0,z.jsx)(im,{"aria-hidden":`true`}),(0,z.jsx)(`h1`,{children:`Reading benchmark study`}),(0,z.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,z.jsxs)(`main`,{className:`benchmark-page`,children:[(0,z.jsxs)(`header`,{className:`benchmark-hero`,children:[(0,z.jsxs)(`div`,{className:`benchmark-hero-topline`,children:[(0,z.jsx)(`a`,{className:`benchmark-wordmark`,href:`/chat/`,children:`LoopX`}),(0,z.jsxs)(`div`,{className:`benchmark-readonly`,children:[(0,z.jsx)(oh,{"aria-hidden":`true`,size:15}),` Derived read-only projection`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-hero-grid`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`p`,{className:`benchmark-kicker`,children:[`BENCHMARK STUDY / `,n.benchmark_id]}),(0,z.jsxs)(`div`,{className:`benchmark-title-row`,children:[(0,z.jsx)(`h1`,{children:n.design.labels.title??n.study_id}),(0,z.jsx)(pT,{tone:n.status===`complete`?`success`:`warning`,children:n.status})]}),(0,z.jsx)(`p`,{className:`benchmark-lead`,children:`One declared study, explicit denominators, and the same countability rules from campaign summary to exact run.`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-identity`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Study`}),(0,z.jsx)(`dd`,{children:n.study_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocol`}),(0,z.jsx)(`dd`,{children:n.design.protocol_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Case set`}),(0,z.jsx)(`dd`,{children:n.design.case_set.case_set_id})]})]})]}),(0,z.jsxs)(`div`,{className:`benchmark-kpi-grid`,children:[(0,z.jsxs)(`article`,{children:[(0,z.jsx)(wm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Score-countable cells`}),(0,z.jsxs)(`strong`,{children:[n.campaign.selected_score_countable_cell_count,(0,z.jsxs)(`small`,{children:[` / `,n.campaign.intended_cell_denominator]})]}),(0,z.jsxs)(`p`,{children:[oT(n.campaign.selected_score_countable_coverage_rate),` declared coverage`]})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(bm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Complete designs`}),(0,z.jsxs)(`strong`,{children:[n.campaign.complete_declared_design_case_count,(0,z.jsxs)(`small`,{children:[` / `,n.campaign.intended_case_count]})]}),(0,z.jsx)(`p`,{children:`Cases with every declared arm`})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(sm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Matched comparisons`}),(0,z.jsx)(`strong`,{children:n.campaign.matched_pair_countable_count}),(0,z.jsx)(`p`,{children:`Eligible pairs only`})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(im,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`In flight`}),(0,z.jsx)(`strong`,{children:n.campaign.in_flight_run_count}),(0,z.jsx)(`p`,{children:n.status===`provisional`?`Coverage remains provisional`:`Declared coverage complete`})]})]})]}),(0,z.jsxs)(`nav`,{"aria-label":`Benchmark dashboard views`,className:`benchmark-tabs`,children:[aT.map(t=>(0,z.jsx)(`button`,{"aria-current":e.view===t.id?`page`:void 0,onClick:()=>u(t.id),type:`button`,children:t.label},t.id)),(0,z.jsxs)(`button`,{className:`benchmark-refresh`,onClick:()=>s(e=>e+1),type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":`true`,size:14}),` Refresh local readback`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-content`,children:[e.view===`campaign`&&(0,z.jsx)(mT,{packet:n,primaryMetric:l}),e.view===`arms`&&(0,z.jsx)(hT,{packet:n}),e.view===`cases`&&(0,z.jsx)(gT,{onOpenRun:e=>u(`runs`,e),packet:n,primaryMetric:l}),e.view===`runs`&&(0,z.jsx)(vT,{onSelectRun:e=>u(`runs`,e),packet:n,selectedRunId:e.runId})]}),(0,z.jsxs)(`footer`,{className:`benchmark-footer`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(oh,{"aria-hidden":`true`,size:16}),(0,z.jsxs)(`span`,{children:[`Scores: `,n.authority.score_source]}),(0,z.jsx)(`span`,{children:`Dashboard cannot launch, grade, or mutate runs.`})]}),(0,z.jsxs)(`code`,{title:d,children:[`local`,d]})]})]})}var bT=J({goalId:W().optional().default(``),statusUrl:W().optional().default(``)}),xT=J({goalId:W().optional().default(``),mode:Y([`showcase`,`developer`,`ops`]).optional().default(`showcase`),statusUrl:W().optional().default(``),todoLane:Y([`all`,`user`,`agent`]).optional().default(`all`),todoQuery:W().optional().default(``)}),ST=xT.omit({mode:!0}),CT=J({dashboardUrl:W().optional().default(``),view:Y([`campaign`,`arms`,`cases`,`runs`]).optional().default(`campaign`),runId:W().optional().default(``)});function wT(){let e=`https://loopx-project.github.io/loopx/docs/showcases/index.en.html`;return(0,R.useEffect)(()=>{window.location.replace(e)},[]),(0,z.jsx)(`a`,{href:e,children:`Open LoopX cases / 浏览案例`})}function TT({goalId:e,statusUrl:t}){let n=t?bh(t,window.location.href):null;return n?.error?(0,z.jsx)(`main`,{role:`alert`,children:n.error}):(0,z.jsx)(ii,{replace:!0,to:`/`,search:{goalId:e,statusUrl:t}})}function ET(){let e=AT.useSearch();return e.mode===`ops`?(0,z.jsx)(TT,{...e}):e.mode===`developer`?(0,z.jsx)(ii,{replace:!0,to:`/developers/projections`}):(0,z.jsx)(wT,{})}function DT(){return(0,z.jsx)(TT,{...jT.useSearch()})}var OT=Ci({component:()=>(0,z.jsx)(Mi,{}),errorComponent:()=>(0,z.jsxs)(`main`,{role:`alert`,className:`p-8`,children:[(0,z.jsx)(`h1`,{children:`页面暂时无法显示 / Page unavailable`}),(0,z.jsx)(`p`,{children:`请重新加载页面;这不会执行任务。 / Reloading does not execute tasks.`}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`重新加载 / Reload`})]})}),kT=xi({getParentRoute:()=>OT,path:`/`,validateSearch:e=>bT.parse(e),component:Mw}),AT=xi({getParentRoute:()=>OT,path:`/frontstage`,validateSearch:e=>xT.parse(e),component:ET}),jT=xi({getParentRoute:()=>OT,path:`/deprecated/frontstage/ops`,validateSearch:e=>ST.parse(e),component:DT}),MT=xi({getParentRoute:()=>OT,path:`/frontstage/developer`,component:()=>(0,z.jsx)(ii,{replace:!0,to:`/developers/projections`})}),NT=xi({getParentRoute:()=>OT,path:`/developers/projections`,component:Kw}),PT=xi({getParentRoute:()=>OT,path:`/benchmarks/study`,validateSearch:e=>CT.parse(e),component:yT}),FT=OT.addChildren([kT,AT,jT,MT,NT,PT]);function IT(e){return!e||e===`/`||e===`./`?`/`:(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``)||`/`}var LT=Li({routeTree:FT,basepath:IT(`/chat/`),trailingSlash:`preserve`}),RT=document.getElementById(`root`);if(!RT)throw Error(`Root element not found`);var zT=new je({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}});(0,Vi.createRoot)(RT).render((0,z.jsx)(Fe,{client:zT,children:(0,z.jsx)(qi,{children:(0,z.jsx)(Bi,{router:LT})})})); \ No newline at end of file diff --git a/loopx/web/chat/index.html b/loopx/web/chat/index.html index 9b70ee1003..13f4bdcc27 100644 --- a/loopx/web/chat/index.html +++ b/loopx/web/chat/index.html @@ -18,7 +18,7 @@ content="LoopX 个人 Agent 工作区:在同一个频道里查看、纠偏并推进 Goal。" /> LoopX 个人 Agent 工作区 - + From 3d63d0c594f831c3c6da6b333698cc9da2f49157 Mon Sep 17 00:00:00 2001 From: huangruiteng <14976749+huangruiteng@users.noreply.github.com> Date: Thu, 24 Sep 2026 07:16:22 +0800 Subject: [PATCH 5/5] Verify accepted report readback in Files Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com> --- .../rfcs/live-team-workspace-v0.md | 4 +++ .../team-evidence.mjs | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/docs/architecture/rfcs/live-team-workspace-v0.md b/docs/architecture/rfcs/live-team-workspace-v0.md index 0b310d7d4e..723dd40ad0 100644 --- a/docs/architecture/rfcs/live-team-workspace-v0.md +++ b/docs/architecture/rfcs/live-team-workspace-v0.md @@ -332,6 +332,10 @@ as a published report. Latest-run metadata, validation summaries and event counts remain execution observations; they cannot become a file or inherit an unrelated open Todo ID. A readable managed result still needs a versioned, public-safe artifact projection with its own source and acceptance readback. +For Goal Chat, Files now opens the same session-scoped accepted team report +reader as the original conversation; source hash and current acceptance are +rechecked, and failed mode/readback clears the prior report. This does not +turn managed non-Chat run observations into deliverables. Merged [#4814](https://github.com/loopx-project/loopx/pull/4814) adds confirmation of one canonical team plan from manager and Goal Lark cards. Authenticated card bindings and the shared decision owner prevent a second click from creating a diff --git a/examples/personal-workspace-browser/team-evidence.mjs b/examples/personal-workspace-browser/team-evidence.mjs index 8010ea3bbc..00afd7478b 100644 --- a/examples/personal-workspace-browser/team-evidence.mjs +++ b/examples/personal-workspace-browser/team-evidence.mjs @@ -22,6 +22,31 @@ export const teamEvidenceScenario = { const results = page.getByRole("region", {name: "团队成果", exact: true}); // Accepted report opens in the original conversation without an extra click. await results.getByRole("table").waitFor(); + const goalNav = page.getByRole("navigation", {name: "Goal 视图"}); + await goalNav.getByRole("button", {name: "成果", exact: true}).click(); + const fileResults = page.getByRole("region", {name: "团队成果", exact: true}); + await fileResults.getByRole("table").waitFor(); + assert.match(await fileResults.getByRole("table").textContent(), /Free cash75/, "Files reads the accepted artifact from the original Goal session"); + assert(!(await page.locator(".personal-files-list > button").allTextContents()).some(text => /最近运行|Latest run/.test(text)), + "Run observations remain absent from delivered Files"); + await page.screenshot({path: resolve(outputDir, "team-files-desktop.png"), animations: "disabled"}); + await page.setViewportSize({width: 390, height: 844}); + assert(await fileResults.evaluate(el => el.scrollWidth <= el.clientWidth), "Files report remains readable on mobile"); + await page.screenshot({path: resolve(outputDir, "team-files-mobile.png"), animations: "disabled"}); + await page.setViewportSize({width: 1512, height: 982}); + await goalNav.getByRole("button", {name: "对话", exact: true}).click(); + const failedTeamMode = async route => route.request().method() === "GET" + ? route.fulfill({status: 503, json: {error: "team readback unavailable"}}) : route.fallback(); + await page.route("**/api/chat/sessions/*/loopx", failedTeamMode); + await goalNav.getByRole("button", {name: "成果", exact: true}).click(); + await page.getByRole("alert").filter({hasText: "无法核验当前 Goal 会话的团队成果"}).waitFor(); + assert.equal(await page.getByRole("region", {name: "团队成果", exact: true}).count(), 0, + "A failed team read must not retain the previously accepted report"); + await page.unroute("**/api/chat/sessions/*/loopx", failedTeamMode); + await page.getByRole("button", {name: "重试", exact: true}).click(); + await page.getByRole("region", {name: "团队成果", exact: true}).getByRole("table").waitFor(); + await goalNav.getByRole("button", {name: "对话", exact: true}).click(); + await results.getByRole("table").waitFor(); assert.equal(await results.getByLabel("当前报告").evaluate(el => el === document.activeElement), false, "Automatic readback must not steal focus"); const reads = api.loopxModeRequests.filter(row => row.operation === "read").length; await results.getByRole("button", {name: "刷新成果", exact: true}).click();