diff --git a/apps/presentation/dashboard/package.json b/apps/presentation/dashboard/package.json index 674476ed33..25a750723d 100644 --- a/apps/presentation/dashboard/package.json +++ b/apps/presentation/dashboard/package.json @@ -37,6 +37,8 @@ "smoke:pwa-bundle": "python3 ../../../examples/dashboard-pwa-bundle-smoke.py", "smoke:goal-acceptance-browser": "node ../../../examples/dashboard-goal-acceptance-browser-smoke.mjs", "smoke:goal-acceptance-packaged": "LOOPX_GOAL_ACCEPTANCE_PACKAGED=1 LOOPX_GOAL_ACCEPTANCE_PORT=5292 LOOPX_PLAYWRIGHT_PACKAGE=\"$PWD/node_modules/playwright\" node ../../../examples/dashboard-goal-acceptance-browser-smoke.mjs", + "smoke:goal-acceptance-contract-browser": "node smoke/goal-acceptance-contract-browser-smoke.mjs", + "smoke:goal-acceptance-contract-packaged": "LOOPX_ACCEPTANCE_CONTRACT_PACKAGED=1 LOOPX_ACCEPTANCE_CONTRACT_PORT=5297 LOOPX_PLAYWRIGHT_PACKAGE=\"$PWD/node_modules/playwright\" node smoke/goal-acceptance-contract-browser-smoke.mjs", "smoke:status-projection-contract": "rm -rf /tmp/loopx-status-projection-contract-smoke && tsc --ignoreConfig --target ES2022 --module CommonJS --moduleResolution Node --ignoreDeprecations 6.0 --skipLibCheck --strict --resolveJsonModule --esModuleInterop --outDir /tmp/loopx-status-projection-contract-smoke smoke/status-projection-contract-smoke.ts src/data/status.ts src/data/status-merge.ts src/data/status-request-fence.ts && NODE_PATH=\"$PWD/node_modules\" node /tmp/loopx-status-projection-contract-smoke/apps/presentation/dashboard/smoke/status-projection-contract-smoke.js", "smoke:team-plan-proposal": "tsc --ignoreConfig --target ES2022 --module ES2022 --moduleResolution Bundler --ignoreDeprecations 6.0 --jsx react-jsx --types node --skipLibCheck --strict --rootDir . --outDir node_modules/.cache/loopx-team-plan-smoke smoke/team-plan-proposal-smoke.ts src/data/chat.ts src/features/personal-workspace/team-plan-preview.ts src/vite-env.d.ts && node node_modules/.cache/loopx-team-plan-smoke/smoke/team-plan-proposal-smoke.js", "smoke:status-source-switch-browser": "node ../../../examples/status-source-switch-browser-smoke.mjs", diff --git a/apps/presentation/dashboard/smoke/delivery-review-smoke.mjs b/apps/presentation/dashboard/smoke/delivery-review-smoke.mjs index d64de95b77..5a6c00786d 100644 --- a/apps/presentation/dashboard/smoke/delivery-review-smoke.mjs +++ b/apps/presentation/dashboard/smoke/delivery-review-smoke.mjs @@ -64,3 +64,4 @@ for (const copy of Object.values(deliveryReviewCopy)) { assert.ok(markdown.includes(`${copy.guards}: ${copy.unavailable}`), "Unavailable decisions must not export as zero pending"); } console.log("delivery review: identity, scope, relationships, partial coverage, filtering, export and negative contracts passed"); +await import("./goal-acceptance-contract-smoke.mjs"); diff --git a/apps/presentation/dashboard/smoke/goal-acceptance-contract-browser-smoke.mjs b/apps/presentation/dashboard/smoke/goal-acceptance-contract-browser-smoke.mjs new file mode 100644 index 0000000000..0c07120c5e --- /dev/null +++ b/apps/presentation/dashboard/smoke/goal-acceptance-contract-browser-smoke.mjs @@ -0,0 +1,129 @@ +#!/usr/bin/env node +// Exercise the shipped delivery view with synthetic status and read-only API fixtures. +import assert from "node:assert/strict"; +import { execFileSync, spawn } from "node:child_process"; +import { createRequire } from "node:module"; +import { dirname, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; +import { cleanupBrowserSmoke, launchBrowser, startViteDashboardServer, waitForHttp } from "../../../../examples/dashboard-browser-smoke-support.mjs"; +import { acceptance, contract, snapshot, verifiedContract } from "./goal-acceptance-contract-fixture.mjs"; + +const dashboardDir = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const root = resolve(dashboardDir, "../../.."); +const python = process.env.LOOPX_PYTHON ?? "python3"; +const port = Number(process.env.LOOPX_ACCEPTANCE_CONTRACT_PORT ?? 5297); +const packaged = process.env.LOOPX_ACCEPTANCE_CONTRACT_PACKAGED === "1"; +const payload = JSON.parse(execFileSync(python, ["-c", ` +import runpy, tempfile, json +from pathlib import Path +from loopx.status import collect_status +fixture = runpy.run_path('tests/test_delivery_review.py') +with tempfile.TemporaryDirectory() as directory: + registry, runtime = fixture['make_project'](Path(directory)) + print(json.dumps(collect_status(registry_path=registry, runtime_root_override=str(runtime), scan_roots=[], limit=20, goal_id='release-demo', include_public_boundary_scan=False))) +`], { cwd: root, encoding: "utf8" })); +payload.run_history.goals[0].acceptance_observation = acceptance; +const server = packaged + ? spawn(python, ["-m", "http.server", String(port), "--bind", "127.0.0.1", "--directory", resolve(root, "loopx/web")], { stdio: "ignore" }) + : startViteDashboardServer({ dashboardDir, port }); +let browser; +try { + await waitForHttp(`http://127.0.0.1:${port}/`); + browser = await launchBrowser(createRequire(import.meta.url)("playwright").chromium); + for (const [locale, viewport] of [["en", { width: 1440, height: 1000 }], ["zh-CN", { width: 390, height: 844 }]]) { + const page = await browser.newPage({ viewport }); + const errors = []; + page.on("pageerror", error => errors.push(error.message)); + const writes = []; + let response = structuredClone(snapshot); + let responseStatus = 200; + await page.addInitScript(language => localStorage.setItem("loopx-pw-locale", language), locale); + await page.route("**/api/**", route => { + if (route.request().method() !== "GET") writes.push(route.request().url()); + return route.fulfill({ status: 404, json: { error: "Unavailable in read-only fixture" } }); + }); + await page.route(url => url.pathname === "/status.json", route => route.fulfill({ json: payload })); + await page.route("**/api/chat/delivery-review?*", route => { + assert.equal(route.request().method(), "GET"); + assert.equal(new URL(route.request().url()).searchParams.get("goal_id"), "release-demo"); + return route.fulfill({ status: responseStatus, json: response }); + }); + await page.goto(`http://127.0.0.1:${port}/${packaged ? "chat/" : ""}?statusUrl=/status.json`, { waitUntil: "networkidle" }); + const navigation = page.getByRole("button", { name: locale === "en" ? "Open Goal navigation" : "打开 Goal 导航" }); + if (await navigation.isVisible()) await navigation.click(); + await page.locator(".personal-goal-link").first().click(); + await page.getByRole("button", { name: locale === "en" ? "Overview" : "概览", exact: true }).click(); + const review = page.locator(".delivery-review"); + const section = review.locator(".delivery-acceptance-contract"); + const refresh = review.getByRole("button", { name: locale === "en" ? "Refresh snapshot" : "刷新快照", exact: true }); + const exportButton = review.getByRole("button", { name: locale === "en" ? "Export delivery snapshot" : "导出交付快照", exact: true }); + const refreshSnapshot = async value => { + response = { ...snapshot, acceptance: { ...acceptance, goal_acceptance_contract: value } }; + const read = page.waitForResponse(url => url.url().includes("/api/chat/delivery-review?")); + await refresh.click(); + await read; + await page.waitForFunction(() => !document.querySelector(".delivery-review-toolbar button")?.disabled); + }; + await review.locator(".delivery-chain").waitFor(); + const baseline = await review.innerText(); + assert.equal(await section.count(), 0); + for (const value of [{ enabled: false }, { ...verifiedContract("accepted"), enabled: false }, undefined]) { + await refreshSnapshot(value); + assert.equal(await section.count(), 0); + assert.equal(await review.innerText(), baseline, "Absent/off contract must preserve the existing view"); + } + await refreshSnapshot(contract); + assert.equal(await section.getAttribute("open"), null, "Contract starts collapsed"); + const summary = section.locator(":scope > summary"); + await summary.focus(); + await page.keyboard.press("Enter"); + assert.notEqual(await section.getAttribute("open"), null, "Disclosure is keyboard accessible"); + const text = await section.innerText(); + for (const value of [contract.objective, contract.digest, "release-demo", "todo_confirmed", "todo_unbound", "todo_stale", "recovery"]) assert.ok(text.includes(value)); + for (const value of locale === "en" ? ["Task association confirmed", "Task association missing", "Task association stale", "Task associations require confirmation", "Outside the current task gate"] : ["任务关联已确认", "任务关联缺失", "任务关联已过期", "任务关联需要确认", "不属于当前任务门禁范围"]) assert.ok(text.includes(value), value); + assert.equal(await section.locator("button,input,select,textarea").count(), 0, "Readback must offer no mutation controls"); + await section.locator("details > summary").last().click(); + await section.getByText(locale === "en" ? /The local Goal owner/ : /本地 Goal 所有者/).waitFor(); + for (const [status, en, zh] of [["unverified", "Artifact checks not verified", "产物检查未验证"], ["failed", "Artifact checks failed", "产物检查失败"], ["stale", "Artifact checks stale", "产物检查已过期"], ["partial", "Task checks passed; Goal-wide verification unknown", "任务检查通过;Goal 整体验证未知"], ["accepted", "Artifact checks passed", "产物检查通过"]]) { + await refreshSnapshot(verifiedContract(status)); + await section.getByText(locale === "en" ? en : zh, { exact: true }).waitFor(); + assert.ok((await section.innerText()).includes(locale === "en" ? "neither automatically approves or completes the Goal" : "均不会自动批准或完成 Goal")); + } + const next = { ...verifiedContract("stale"), revision: 8, digest: "b".repeat(64) }; + await refreshSnapshot(next); + await section.getByText(next.digest, { exact: true }).waitFor(); + assert.equal(await section.getByText(contract.digest, { exact: true }).count(), 0); + assert.match(await section.locator("dl").first().innerText(), /8/); + await section.locator("details > summary").first().click(); + await section.getByText("c".repeat(64), { exact: true }).waitFor(); + assert.match(await section.locator("dl").last().innerText(), /6/); + assert.equal(await section.evaluate(element => element.scrollWidth > element.clientWidth + 2), false, "Long digests must wrap at narrow widths"); + const downloadPromise = page.waitForEvent("download"); + await exportButton.click(); + const download = await downloadPromise; + const stream = await download.createReadStream(); + let markdown = ""; + for await (const chunk of stream) markdown += chunk.toString(); + assert.ok(markdown.includes(next.digest) && markdown.includes("8") && markdown.includes(contract.objective)); + responseStatus = 503; + await refreshSnapshot(next); + await section.getByText(locale === "en" ? /Retained snapshot/ : /当前保留旧快照/).waitFor(); + assert.equal(await exportButton.isDisabled(), true, "Failed refresh must not export retained contract as current"); + responseStatus = 200; + response = { ...snapshot, acceptance: { ...acceptance, goal_id: "other-goal", goal_acceptance_contract: next } }; + const mismatch = page.waitForResponse(url => url.url().includes("/api/chat/delivery-review?")); + await refresh.click(); + await mismatch; + await page.waitForFunction(() => !document.querySelector(".delivery-review-toolbar button")?.disabled); + await section.getByText(locale === "en" ? /Retained snapshot/ : /当前保留旧快照/).waitFor(); + assert.equal(await section.getByText("other-goal", { exact: true }).count(), 0); + await refreshSnapshot({ enabled: false }); + assert.equal(await section.count(), 0, "Disabling removes the previous enabled readback"); + assert.deepEqual(writes, [], "Reading and exporting must not write state"); + assert.deepEqual(errors, []); + await page.close(); + } + console.log(`Goal acceptance contract browser (${packaged ? "packaged" : "development"}): off parity, states, keyboard, locales, mobile, revision refresh and read-only export passed`); +} finally { + await cleanupBrowserSmoke({ browser, server, fixturePaths: [] }); +} diff --git a/apps/presentation/dashboard/smoke/goal-acceptance-contract-fixture.mjs b/apps/presentation/dashboard/smoke/goal-acceptance-contract-fixture.mjs new file mode 100644 index 0000000000..55a33cbc66 --- /dev/null +++ b/apps/presentation/dashboard/smoke/goal-acceptance-contract-fixture.mjs @@ -0,0 +1,40 @@ +// Synthetic server projection. No acceptance state is inferred by the client. +export const acceptance = { + schema_version: "goal_acceptance_observation_projection_v0", goal_id: "release-demo", + read_only: true, acceptance_assessed: false, coverage: "partial", missing_sources: [], + truncated: false, historical_progress: [], acceptance_gaps: [], guards: [], next_action: null, next_action_source: null, +}; +export const contract = { + enabled: true, revision: 7, digest: "a".repeat(64), objective: "Deliver a recoverable release", + non_goals: ["Publishing the release"], status: "held", held_todo_ids: ["todo_unbound", "todo_stale"], verification: null, + criteria: [{ id: "recovery", description: "An independent recovery check passes." }], + tasks: [ + { todo_id: "todo_confirmed", state: "ready", criterion_ids: ["recovery"], applicable: true }, + { todo_id: "todo_unbound", state: "unbound", criterion_ids: [], reason: "No criterion is associated.", applicable: true }, + { todo_id: "todo_stale", state: "stale", criterion_ids: ["recovery"], reason: "Association refers to a prior contract revision.", applicable: true }, + { todo_id: "todo_retired", state: "stale", criterion_ids: ["recovery"], applicable: false }, + ], +}; +export function verifiedContract(status) { + return { + ...contract, status, + tasks: status === "held" ? contract.tasks : [contract.tasks[0], contract.tasks[3]], + held_todo_ids: status === "held" ? contract.held_todo_ids : [], + verification: status === "unverified" ? null : { + operation_id: "verify-release-7", contract_revision: status === "stale" ? 6 : 7, + contract_digest: status === "stale" ? "c".repeat(64) : contract.digest, + todo_id: status === "partial" ? "todo_confirmed" : null, + results: [{ criterion_id: "recovery", passed: status !== "failed", exit_code: status === "failed" ? 1 : 0 }], + }, + }; +} +export const snapshot = { + ok: true, goal_id: "release-demo", observed_at: "2026-09-01T00:00:00Z", acceptance, + graph: { + schema_version: "task_graph_projection_v0", mode: "read_only", goal_id: "release-demo", generated_at: null, + truth_contract: { projection_is_writable: false, write_api: false }, + limits: { user_gate_node_limit: 2, user_gate_open_count: 0, user_gate_truncated_count: 0, topology_complete: true }, + nodes: [{ node_id: "current", kind: "deliverable", title: "Integrate the verified release package", state: "open", refs: { todo_ids: ["todo_integrate"] } }], + edges: [], + }, +}; diff --git a/apps/presentation/dashboard/smoke/goal-acceptance-contract-smoke.mjs b/apps/presentation/dashboard/smoke/goal-acceptance-contract-smoke.mjs new file mode 100644 index 0000000000..33a17d96f7 --- /dev/null +++ b/apps/presentation/dashboard/smoke/goal-acceptance-contract-smoke.mjs @@ -0,0 +1,44 @@ +import assert from "node:assert/strict"; +import { deliveryReviewMarkdown, parseDeliveryReview } from "../node_modules/.cache/delivery-review/data/delivery-review.js"; +import { deliveryReviewCopy } from "../node_modules/.cache/delivery-review/features/personal-workspace/delivery-review-copy.js"; +import { acceptance, contract, snapshot, verifiedContract } from "./goal-acceptance-contract-fixture.mjs"; + +const withContract = value => ({ ...snapshot, acceptance: { ...acceptance, goal_acceptance_contract: value } }); +const before = structuredClone(contract); +for (const copy of Object.values(deliveryReviewCopy)) { + const baseline = deliveryReviewMarkdown(parseDeliveryReview(snapshot, snapshot.goal_id), copy); + for (const value of [undefined, { enabled: false }, { ...verifiedContract("accepted"), enabled: false }]) { + assert.equal(deliveryReviewMarkdown(parseDeliveryReview(withContract(value), snapshot.goal_id), copy), baseline, + "Missing/disabled contract must preserve baseline export even with retained success data"); + } + for (const status of ["unverified", "failed", "stale", "accepted", "partial", "held"]) { + const source = withContract(verifiedContract(status)); + const parsed = parseDeliveryReview(source, snapshot.goal_id); + assert.deepEqual(parsed.acceptance.goal_acceptance_contract, source.acceptance.goal_acceptance_contract); + const markdown = deliveryReviewMarkdown(parsed, copy); + for (const text of [copy.contract.boundary, contract.objective, contract.digest, `${copy.contract.revision}: 7`, + `${copy.contract.source}: release-demo`, copy.contract.taskState.ready, copy.contract.taskState.stale, + copy.contract.notApplicable, copy.contract.verificationState[status]]) { + assert.ok(markdown.includes(text), `Missing readback: ${text}`); + } + if (status !== "accepted") assert.ok(!markdown.includes(copy.contract.verificationState.accepted), "Association readiness must not imply passing checks"); + if (status === "held") assert.ok(markdown.includes(copy.contract.taskState.unbound)); + if (status === "stale") assert.ok(markdown.includes("c".repeat(64)) && markdown.includes(`${copy.contract.revision}: 6`), "Historical verification must retain its distinct basis"); + if (status === "partial") assert.ok(markdown.includes(`${copy.contract.verificationScope}: todo\\_confirmed`)); + } + const empty = parseDeliveryReview(withContract({ ...contract, criteria: [], tasks: [] }), snapshot.goal_id); + assert.ok(deliveryReviewMarkdown(empty, copy).includes(copy.contract.noTasks)); + assert.ok(deliveryReviewMarkdown(empty, copy).includes(copy.contract.noCriteria)); +} +for (const mutation of [ + { ...contract, enabled: "true" }, { ...contract, revision: "7" }, { ...contract, revision: 1.5 }, + { ...contract, digest: "" }, { ...contract, tasks: [{ ...contract.tasks[0], state: "approved" }] }, + { ...contract, status: "approved" }, { ...contract, verification: { status: "passed" } }, +]) assert.throws(() => parseDeliveryReview(withContract(mutation), snapshot.goal_id)); +assert.throws(() => parseDeliveryReview(withContract(contract), "other-goal")); +assert.throws(() => parseDeliveryReview({ ...withContract(contract), acceptance: { ...acceptance, goal_id: "other-goal", goal_acceptance_contract: contract } }, snapshot.goal_id)); +const next = parseDeliveryReview(withContract({ ...contract, revision: 8, digest: "b".repeat(64) }), snapshot.goal_id); +assert.equal(next.acceptance.goal_acceptance_contract.revision, 8); +assert.notEqual(next.acceptance.goal_acceptance_contract.digest, contract.digest); +assert.deepEqual(contract, before, "Rendering must not mutate the supplied contract"); +console.log("Goal acceptance contract API/export: off parity, association/verification distinction, source/revision and negative cases passed"); diff --git a/apps/presentation/dashboard/src/data/delivery-review.ts b/apps/presentation/dashboard/src/data/delivery-review.ts index 4b13e607d4..84e7f1b3d9 100644 --- a/apps/presentation/dashboard/src/data/delivery-review.ts +++ b/apps/presentation/dashboard/src/data/delivery-review.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { goalAcceptanceObservationSchema } from "./goal-acceptance-observation.js"; +import { goalAcceptanceObservationSchema, type GoalAcceptanceContract } from "./goal-acceptance-observation.js"; const refsSchema = z.record(z.string(), z.array(z.string())); const nodeSchema = z.object({ @@ -93,7 +93,15 @@ export function reviewNodeColumn(node: ReviewNode) { return ["gate", "gate_summary", "lease"].includes(node.kind) ? 0 : node.kind === "deliverable" ? 1 : 2; } +type EnabledContract = Extract; +type ContractExportLabels = Record<"title" | "boundary" | "source" | "revision" | "digest" | "objective" | "criteria" + | "nonGoals" | "tasks" | "verification" | "unknown" | "noTasks" | "noCriteria" | "notApplicable" + | "heldTasks" | "receipt" | "receiptNote" | "operation" | "verificationScope" | "allCriteria" | "passed" | "failed" | "exitCode", string> & { + taskState: Record; + verificationState: Record; +}; export type ReviewExportLabels = { + contract: ContractExportLabels; title: string; scope: string; observed: string; chain: string; relations: string; acceptance: string; acceptanceBoundary: string; noGraph: string; incomplete: string; unavailable: string; refs: string; required: string; guards: string; next: string; @@ -146,5 +154,34 @@ export function deliveryReviewMarkdown(snapshot: DeliveryReviewSnapshot, labels: `${labels.missingSources}: ${line(acceptance.missing_sources.join(", "))}`, `${labels.next}: ${line(acceptance.next_action)} (${line(acceptance.next_action_source)})`); } + const contract = acceptance?.goal_acceptance_contract; + if (contract?.enabled === true) { + const copy = labels.contract; + rows.push("", `## ${copy.title}`, "", copy.boundary, + `${copy.source}: ${line(snapshot.goal_id)}`, `${copy.revision}: ${contract.revision}`, `${copy.digest}: ${line(contract.digest)}`, + "", `### ${copy.objective}`, line(contract.objective || copy.unknown), "", `### ${copy.criteria}`); + if (contract.non_goals.length) rows.push(`${copy.nonGoals}: ${line(contract.non_goals.join("; "))}`); + if (!contract.criteria.length) rows.push(copy.noCriteria); + for (const criterion of contract.criteria) rows.push(`- ${line(criterion.id)}: ${line(criterion.description)}`); + rows.push("", `### ${copy.tasks}`); + if (!contract.tasks.length) rows.push(copy.noTasks); + for (const task of contract.tasks) { + rows.push(`- ${line(task.todo_id)}: ${copy.taskState[task.state]}`, + ` ${copy.criteria}: ${line(task.criterion_ids.join(", ") || copy.unknown)}`); + if (task.reason) rows.push(` ${line(task.reason)}`); + if (task.applicable === false) rows.push(` ${copy.notApplicable}`); + } + rows.push("", `### ${copy.verification}`, copy.verificationState[contract.status]); + if (contract.held_todo_ids.length) rows.push(`${copy.heldTasks}: ${line(contract.held_todo_ids.join(", "))}`); + rows.push("", `### ${copy.receipt}`); + const receipt = contract.verification; + if (!receipt) rows.push(copy.unknown); + else { + rows.push(copy.receiptNote, `${copy.operation}: ${line(receipt.operation_id)}`, + `${copy.revision}: ${receipt.contract_revision}`, `${copy.digest}: ${line(receipt.contract_digest)}`, + `${copy.verificationScope}: ${line(receipt.todo_id ?? copy.allCriteria)}`); + for (const result of receipt.results) rows.push(`- ${line(result.criterion_id)}: ${result.passed ? copy.passed : copy.failed}; ${copy.exitCode}: ${result.exit_code ?? copy.unknown}`); + } + } return rows.join("\n") + "\n"; } diff --git a/apps/presentation/dashboard/src/data/goal-acceptance-observation.ts b/apps/presentation/dashboard/src/data/goal-acceptance-observation.ts index 98c63d585f..7c4f05af86 100644 --- a/apps/presentation/dashboard/src/data/goal-acceptance-observation.ts +++ b/apps/presentation/dashboard/src/data/goal-acceptance-observation.ts @@ -1,6 +1,28 @@ import { z } from "zod"; const nullableText = z.string().nullable(); +// Readback only: the Goal owner supplies association and verification states. +const goalAcceptanceContractSchema = z.discriminatedUnion("enabled", [ + z.object({ enabled: z.literal(false) }), + z.object({ + enabled: z.literal(true), revision: z.number().int().positive(), digest: z.string().min(1), objective: z.string(), + non_goals: z.array(z.string()), held_todo_ids: z.array(z.string()), + status: z.enum(["unverified", "stale", "failed", "partial", "accepted", "held"]), + criteria: z.array(z.object({ id: z.string(), description: z.string() })), + tasks: z.array(z.object({ + todo_id: z.string(), state: z.enum(["ready", "unbound", "stale"]), + criterion_ids: z.array(z.string()), reason: z.string().optional(), + reason_code: z.string().optional(), applicable: z.boolean().optional(), + })), + verification: z.object({ + operation_id: z.string(), contract_revision: z.number().int().positive(), contract_digest: z.string(), + todo_id: z.string().nullable(), + results: z.array(z.object({ criterion_id: z.string(), passed: z.boolean(), exit_code: z.number().int().nullable() })), + }).nullable(), + }), +]); +export type GoalAcceptanceContract = z.infer; + export const goalAcceptanceObservationSchema = z.object({ schema_version: z.literal("goal_acceptance_observation_projection_v0"), goal_id: z.string(), @@ -22,5 +44,6 @@ export const goalAcceptanceObservationSchema = z.object({ guards: z.array(z.object({ kind: z.string(), todo_id: nullableText, blocks_agent: nullableText, owner: nullableText, reason: nullableText, evidence_required: nullableText, decision_scope: nullableText })), next_action: nullableText, next_action_source: nullableText, + goal_acceptance_contract: goalAcceptanceContractSchema.optional(), }); export type GoalAcceptanceObservation = z.infer; diff --git a/apps/presentation/dashboard/src/features/personal-workspace/delivery-review-copy.ts b/apps/presentation/dashboard/src/features/personal-workspace/delivery-review-copy.ts index 2d2c68db77..4dc8e6201d 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/delivery-review-copy.ts +++ b/apps/presentation/dashboard/src/features/personal-workspace/delivery-review-copy.ts @@ -1,6 +1,33 @@ import type { ReviewExportLabels } from "../../data/delivery-review.js"; +export const goalAcceptanceContractCopy = { + 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 可隐藏本区块。", + }, +}; +export type GoalAcceptanceContractCopy = typeof goalAcceptanceContractCopy.en; + const en = { + contract: goalAcceptanceContractCopy.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.", @@ -25,6 +52,7 @@ const en = { } satisfies ReviewExportLabels & Record; const zh: typeof en = { + contract: goalAcceptanceContractCopy["zh-CN"], title: "交付与依据", scope: "仅含当前工作及有限前序,完整任务清单见任务页。", observed: "快照读取时间", chain: "交付链", relations: "关联关系", acceptance: "验收观察", acceptanceBoundary: "任务完成、已有证据均不等于 Goal 已通过验收。", diff --git a/apps/presentation/dashboard/src/features/personal-workspace/delivery-review.css b/apps/presentation/dashboard/src/features/personal-workspace/delivery-review.css index 22a3d89859..fb6bf73d7c 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/delivery-review.css +++ b/apps/presentation/dashboard/src/features/personal-workspace/delivery-review.css @@ -52,6 +52,21 @@ .delivery-relations span { display: flex; align-items: center; gap: 4px; font-size: 11px; } .delivery-relations p { padding-top: 8px; color: var(--pw-muted); font-size: 12px; } .delivery-empty { padding: 24px; } +.delivery-acceptance-contract { min-width: 0; border: 1px solid var(--pw-line); border-radius: 12px; background: var(--pw-card); } +.delivery-acceptance-contract summary { min-height: 44px; padding: 12px 16px; cursor: pointer; font-weight: 500; } +.delivery-acceptance-content { display: grid; gap: 16px; padding: 0 16px 16px; font-size: 14px; } +.delivery-acceptance-content ul { margin: 0; padding-left: 20px; } +.delivery-acceptance-content :is(li, dd, code) { overflow-wrap: anywhere; } +.delivery-acceptance-source { display: grid; gap: 8px; margin: 0; } +.delivery-acceptance-source > div { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(0, 3fr); gap: 12px; } +.delivery-acceptance-source dt { color: var(--pw-muted); } +.delivery-acceptance-source dd { margin: 0; } +.delivery-acceptance-content code { font-family: var(--font-mono); font-size: 12px; } +.delivery-acceptance-tasks { display: grid; gap: 12px; } +.delivery-acceptance-content details { border-top: 1px solid var(--pw-line); } +.delivery-acceptance-content details summary { padding-left: 0; } +.delivery-acceptance-content a { color: var(--color-link, #0070f3); text-decoration: underline; } +.delivery-acceptance-content a:focus-visible { outline: 2px solid var(--color-link, #0070f3); outline-offset: 3px; } @media (max-width: 640px) { .delivery-review { gap: 16px; } .delivery-review-toolbar > div { width: 100%; } diff --git a/apps/presentation/dashboard/src/features/personal-workspace/delivery-review.tsx b/apps/presentation/dashboard/src/features/personal-workspace/delivery-review.tsx index c8e24d77dc..7d7a70dff5 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/delivery-review.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/delivery-review.tsx @@ -3,6 +3,7 @@ import { ArrowRight, Download, ExternalLink, RefreshCw, Search } from "lucide-re import { deliveryReviewMarkdown, fetchDeliveryReview, filterReviewNodes, reviewCoverageIncomplete, reviewNodeColumn, type DeliveryReviewSnapshot, type ReviewFocus, type ReviewGraph, type ReviewNode } from "../../data/delivery-review"; import type { WorkspaceDrawerSelection, WorkspaceGoal, WorkspaceModel, WorkspaceTimelineItem } from "./personal-workspace-model"; import { GoalAcceptanceObservationCard } from "./goal-acceptance-observation-card"; +import { GoalAcceptanceContractSection } from "./goal-acceptance-contract"; import { deliveryReviewCopy } from "./delivery-review-copy"; import { useWorkspaceI18n } from "./i18n"; import "./delivery-review.css"; @@ -160,6 +161,7 @@ export function DeliveryReview({ goal, items, userTodos, onSelect, active }: Del :

{copy.noGraph}

} } + ; } diff --git a/apps/presentation/dashboard/src/features/personal-workspace/goal-acceptance-contract.tsx b/apps/presentation/dashboard/src/features/personal-workspace/goal-acceptance-contract.tsx new file mode 100644 index 0000000000..c5a79ae566 --- /dev/null +++ b/apps/presentation/dashboard/src/features/personal-workspace/goal-acceptance-contract.tsx @@ -0,0 +1,54 @@ +import type { GoalAcceptanceContract } from "../../data/goal-acceptance-observation"; +import type { GoalAcceptanceContractCopy } from "./delivery-review-copy"; + +/** Present owner-projected states without deriving acceptance or task readiness. */ +export function GoalAcceptanceContractSection({ goalId, contract, copy, current }: { + goalId: string; contract?: GoalAcceptanceContract; copy: GoalAcceptanceContractCopy; current: boolean; +}) { + if (contract?.enabled !== true) return null; + const inspectCommand = `loopx --format json goal-acceptance inspect --goal-id '${goalId.replace(/'/g, "'\\''")}'`; + return
+ {copy.title} +
+

{copy.boundary}

+ {!current ?

{copy.retained}

: null} +
+
{copy.source}
{goalId}
+
{copy.revision}
{contract.revision}
+
{copy.digest}
{contract.digest}
+
+

{copy.objective}

{contract.objective || copy.unknown}

+ {contract.non_goals.length ? <>

{copy.nonGoals}

    {contract.non_goals.map((item, index) =>
  • {item}
  • )}
: null} +

{copy.criteria}

+ {contract.criteria.length ?
    {contract.criteria.map(criterion =>
  • {criterion.id} · {criterion.description}
  • )}
:

{copy.noCriteria}

} +

{copy.tasks}

+ {contract.tasks.length ?
    {contract.tasks.map(task =>
  • +

    {task.todo_id} · {copy.taskState[task.state]}

    +

    {copy.criteria}: {task.criterion_ids.length ? task.criterion_ids.join(", ") : copy.unknown}

    + {task.applicable === false ?

    {copy.notApplicable}

    : null} + {task.reason ?

    {task.reason}

    : null} +
  • )}
:

{copy.noTasks}

} +

{copy.verification}

+

{copy.verificationState[contract.status]}

+ {contract.held_todo_ids.length ?

{copy.heldTasks}: {contract.held_todo_ids.join(", ")}

: null} +
{copy.receipt} + {!contract.verification ?

{copy.unknown}

: <> +

{copy.receiptNote}

+
+
{copy.operation}
{contract.verification.operation_id}
+
{copy.revision}
{contract.verification.contract_revision}
+
{copy.digest}
{contract.verification.contract_digest}
+
{copy.verificationScope}
{contract.verification.todo_id ?? copy.allCriteria}
+
+
    {contract.verification.results.map(result =>
  • + {result.criterion_id} · {result.passed ? copy.passed : copy.failed} · {copy.exitCode}: {result.exit_code ?? copy.unknown} +
  • )}
+ } +
+
{copy.help}

{copy.guidance}

+

{inspectCommand}

loopx goal-acceptance --help

+ {copy.guide} +
+
+
; +} diff --git a/docs/architecture/rfcs/goal-direction-baseline-v0.md b/docs/architecture/rfcs/goal-direction-baseline-v0.md index ece430d29c..aad1446858 100644 --- a/docs/architecture/rfcs/goal-direction-baseline-v0.md +++ b/docs/architecture/rfcs/goal-direction-baseline-v0.md @@ -28,6 +28,11 @@ RFC maturity and delivery maturity are independent. This proposal does not claim that `goal_direction_baseline_v0`, its declaration, or a runtime consumer exists on `main`. +The separate [acceptance contract v0](../../reference/goal-acceptance-observations.md#owner-authorized-contract-v0) +does not implement this RFC's material declarations or usage receipts. +#2831's next slice is **direction-material revision to acceptance basis linkage**, +qualified by the same-Agent/current-revision fixtures below. + --- ## 1. Decision summary diff --git a/docs/architecture/rfcs/goal-direction-baseline-v0.zh-CN.md b/docs/architecture/rfcs/goal-direction-baseline-v0.zh-CN.md index 3a6562ff48..7397955d51 100644 --- a/docs/architecture/rfcs/goal-direction-baseline-v0.zh-CN.md +++ b/docs/architecture/rfcs/goal-direction-baseline-v0.zh-CN.md @@ -24,6 +24,10 @@ RFC 成熟度与交付成熟度互相独立。本提案不声称 `goal_direction_baseline_v0`、 它的声明字段或运行时消费者已经存在于 `main`。 +独立的[验收合同 v0](../../reference/goal-acceptance-observations.md#owner-authorized-contract-v0) +不实现本 RFC 的材料声明或使用回执。#2831 的下一切片是**方向材料版本与验收基线关联**, +通过下面的同 Agent/当前版本 fixture 验证。 + --- ## 1. 决策摘要 diff --git a/docs/architecture/rfcs/loopx-overall-roadmap-v0.md b/docs/architecture/rfcs/loopx-overall-roadmap-v0.md index 6ec0579418..d7507a6794 100644 --- a/docs/architecture/rfcs/loopx-overall-roadmap-v0.md +++ b/docs/architecture/rfcs/loopx-overall-roadmap-v0.md @@ -109,8 +109,8 @@ This maps **all 30 primary RFCs** at the scope baseline, counting language mirro | [TypeScript Control-Plane Migration Direction v0](typescript-control-plane-migration-v0.md) | S2 | Accepted; whole-transaction migration active | P0/P1: R1–R4 hot transactions first; T0–T4 caller/deletion/cost evidence; no full rewrite prerequisite | | [Semantic Vocabulary Convergence and Commit-Time Drift Checks (v0)](semantic-vocabulary-convergence-v0.md) | S2 | Draft; registry/inventory/drift and subsequent typed slices exist | P1: converge by semantic role and active producer/consumer; no name-based enum merging; review schema changes separately | | [LoopX Shared Control-Plane Authority and Pluggable State Providers (v0)](shared-goal-authority-state-provider-v0.md) | S2/S3/S7 | Draft; stores, local transactions and service-admission foundations exist | P1→P2: R5 local D1–D3, R6 authenticated hosts; real backend/soak/recovery before promotion | -| [Shared Goal Alignment and Governed Amendment Protocol (v0)](shared-goal-alignment-and-governed-amendment-v0.md) | S3 | Draft; Stage 1/2, full intent/commit incomplete | P1: R4 one work-graph amendment class; CAS/lease impact, conflicts and lost-response receipts | -| [Goal Direction Baseline (v0)](goal-direction-baseline-v0.md) | S3/S6 | Draft; read-model proposal | P1: synthetic fixtures for same-Agent/current-revision material use; no Vision writer or automatic Todo | +| [Shared Goal Alignment and Governed Amendment Protocol (v0)](shared-goal-alignment-and-governed-amendment-v0.md) | S3 | Draft; Stage 1/2 and owner acceptance readback; full intent/commit incomplete | P1: #3836 governed acceptance amendments and peer adoption; R4 CAS/lease impact, conflicts and lost-response receipts | +| [Goal Direction Baseline (v0)](goal-direction-baseline-v0.md) | S3/S6 | Draft; material read-model proposal | P1: #2831 direction-material revision to acceptance basis linkage; same-Agent/current-revision fixtures | | [Goal Artifact Lifecycle Projection (milestone / guard / next-transition) v0](goal-artifact-lifecycle-projection-v0.md) | S3/S5 | Draft; read-model proposal | P1: derive milestone/guard/next transition from typed facts; no process engine | | [Capable Agent Manager and Semantic Work Handoff (v0)](capable-manager-semantic-handoff-v0.md) | S1/S3 | Draft; partial profile/intake, M1–M4 not fully qualified | P0→P1: R1/R2 real teams, R3 semantic peer work and durable return; continuation matrix and A1–A20 | | [Manager runtime profile v0](manager-runtime-profile-v0.md) | S1/S4 | Draft; private Codex profile exists, general qualification incomplete | P0: real tools/session/recovery and scoped authority; runtime labels do not qualify behavior | diff --git a/docs/architecture/rfcs/shared-goal-alignment-and-governed-amendment-v0.md b/docs/architecture/rfcs/shared-goal-alignment-and-governed-amendment-v0.md index c7d2b74c13..954285fd1e 100644 --- a/docs/architecture/rfcs/shared-goal-alignment-and-governed-amendment-v0.md +++ b/docs/architecture/rfcs/shared-goal-alignment-and-governed-amendment-v0.md @@ -107,6 +107,14 @@ freedom does not confer shared-amendment authority, and handoff receipt does not acknowledge a new Goal on behalf of every peer. Section 9.1 and that RFC's M2/A16 define integration; they do not introduce a second amendment policy. +### 1.2 Owner-authorized acceptance checkpoint + +The [acceptance contract v0](../../reference/goal-acceptance-observations.md#owner-authorized-contract-v0) +adds local-owner configuration and readback on existing canonical Goal authority. +#3836's next slice is **governed acceptance amendments and peer adoption**: +bind the contract to amendment policy, exact-base commit and receiver readback; +qualify Lark separately. Full intent versioning and Stage 3–5 remain incomplete. + ## 2. Problem and current boundary LoopX already coordinates execution usefully: diff --git a/docs/architecture/rfcs/shared-goal-alignment-and-governed-amendment-v0.zh-CN.md b/docs/architecture/rfcs/shared-goal-alignment-and-governed-amendment-v0.zh-CN.md index 01d76c12de..5c9a2634b6 100644 --- a/docs/architecture/rfcs/shared-goal-alignment-and-governed-amendment-v0.zh-CN.md +++ b/docs/architecture/rfcs/shared-goal-alignment-and-governed-amendment-v0.zh-CN.md @@ -96,6 +96,13 @@ admission。它的请求、brief、投递版本不是 Goal-intent revision。 peer 确认新 Goal。第 9.1 节及该 RFC 的 M2/A16 定义衔接,不新增第二 amendment policy。 +### 1.2 所有者授权验收检查点 + +[验收合同 v0](../../reference/goal-acceptance-observations.md#owner-authorized-contract-v0) +在既有 canonical Goal authority 上增加本地所有者配置与读回。 +#3836 的下一切片是**受治理的验收修订与 peer 采用**:将合同接入 amendment policy、 +精确基线提交和接收方读回,Lark 单独验证。完整意图版本化与 Stage 3–5 仍未完成。 + ## 2. 问题与当前边界 LoopX 已经能较好地协调执行: diff --git a/docs/guides/personal-workspace-user-guide.md b/docs/guides/personal-workspace-user-guide.md index b72b1d8fef..d306814abd 100644 --- a/docs/guides/personal-workspace-user-guide.md +++ b/docs/guides/personal-workspace-user-guide.md @@ -175,7 +175,16 @@ Goal 顶部直接提供 **概览、任务、对话、成果**,分别用于判 Markdown。搜索筛选不会裁剪导出;不包含原始日志、文件正文或对话正文。 成果与报告继续由成果页统一展示,不在概览建立第二份成果清单。 -**边界:**本功能无需模型调用或新配置。远端只读来源可查看同步的概览和验收观察, +**显式验收合同:**若本地所有者已为使用 canonical authority 的 Goal 启用合同, +交付链下方可展开「Goal 验收合同」,查看条件、任务关联与独立的产物检查结果。 +「任务关联已确认」不等于「产物检查通过」,后者也不自动批准或完成 Goal。 +缺失、停用保持原界面;旧检查显示其原版本,刷新失败不会作为最新结果导出。 +配置入口是本地所有者 CLI:先 `loopx goal-acceptance inspect --goal-id example-goal`, +再按[配置与回滚指南(v0)](../reference/goal-acceptance-observations.md#owner-authorized-contract-v0) +使用 `configure --document --expected-provider-revision`、`verify` 或 `disable`; +变更与执行检查需要 `--execute`。不新增网页配置入口,不自动提升 provider。 + +**边界:**原有交付链观察无需模型调用或新配置。远端只读来源可查看同步的概览和验收观察, 不回退查询本机同名 Goal 的交付链。所有阅读、筛选与导出均不改变任务、租约、预算或 审批;来源操作仍使用既有预览和权限检查。本次没有状态迁移,回滚沿用原安装流程。 @@ -191,8 +200,19 @@ and Markdown export. Leaving Overview aborts pending reads. Export retains the entire validated delivery snapshot regardless of filtering, excluding raw logs and conversation/file bodies. Outputs remain in Files. Missing observations never certify acceptance. Remote sources show their synchronized observations -without querying the local delivery API. No model call, new configuration, -write authority or migration is introduced. +without querying the local delivery API. The baseline delivery-chain read +requires no model call or configuration and adds no write authority or migration. + +When a local owner explicitly enables an acceptance contract on an already +canonical Goal, expand **Goal acceptance contract** below the delivery chain. +It separates confirmed task associations from artifact checks and shows both +the current contract basis and recorded verification basis. Neither approves +or completes the Goal. Missing or disabled contracts preserve the baseline view. +Start with `loopx goal-acceptance inspect --goal-id example-goal`; the +[owner guide (v0)](../reference/goal-acceptance-observations.md#owner-authorized-contract-v0) +covers exact configure, verify and disable commands. Authoring stays in the +explicit local-owner CLI; it does not automatically promote a provider or add a +web configuration surface. Refresh the snapshot after a CLI operation. CLI readback uses the same existing owners: diff --git a/docs/reference/goal-acceptance-observations.md b/docs/reference/goal-acceptance-observations.md index 16fddbf6ab..944f62d496 100644 --- a/docs/reference/goal-acceptance-observations.md +++ b/docs/reference/goal-acceptance-observations.md @@ -1,6 +1,6 @@ # Goal acceptance observations -Open a Goal, then **Goal settings → Goal details → Acceptance observations**. +Open a local Goal, then **Overview → Delivery & evidence → Acceptance observations**. The read-only card shows each observed acceptance requirement with its Agent and observation time, pending gates with their target Agent and decision scope, and the next action already projected by status. A missing human decision owner @@ -8,7 +8,7 @@ is shown as unknown; the blocked Agent is not assumed to be the approver. The same projection is available as `run_history.goals[].acceptance_observation` in `loopx status --format json`; status Markdown includes a compact summary. -No activation or new permission is required. This changes presentation only; +The observation card requires no activation or new permission. It changes presentation only; Todo, gate, quota, settlement, and Goal completion authority are unchanged. Acceptance requirements reuse the frontier's existing per-Agent vision rules @@ -63,15 +63,141 @@ plus `node examples/dashboard-goal-acceptance-browser-smoke.mjs`. The browser check consumes real status collection over a disposable synthetic Goal; set `LOOPX_GOAL_ACCEPTANCE_PACKAGED=1` after the Dashboard build to check shipped assets. +## Owner-authorized contract (v0) + +An owner can opt an existing registered Goal into a versioned acceptance contract. +The Goal must already use promoted canonical authority. These commands never +promote a provider or fall back to legacy Markdown when canonical reads fail. +The owner makes three explicit decisions: the objective and its acceptance +criteria, which existing advancement tasks serve those criteria, and whether to +enable this governance. The existing Goal authority owns the contract; the +Dashboard only reads it. No new capability editor or provider is introduced. + +From the Goal's delivery workspace, inspect the current provider revision: + +```bash +loopx --format json goal-acceptance inspect --goal-id example-goal +loopx --format json todo list --goal-id example-goal +``` + +Prepare an owner-reviewed `acceptance.json`, replacing the illustrative file +check and task ID with the actual artifact checks and existing advancement task: + +```json +{ + "objective": "Deliver a checked artifact", + "non_goals": ["Publish the artifact"], + "criteria": [{ + "id": "artifact-present", + "description": "The delivered text artifact exists and is nonempty.", + "validation_argv": ["python3", "-c", "from pathlib import Path; assert Path('deliverable.txt').read_text().strip()"], + "validation_timeout_seconds": 5 + }], + "bindings": [{"todo_id": "todo_deliver", "criterion_ids": ["artifact-present"]}] +} +``` + +Keep executable declarations in the owner's local file; public readback omits +command arguments and output. The configured checks run as bounded argv commands +without a shell, using the existing delivery-workspace validation rules. +Each criterion allows 1–25 seconds and defaults to 5 seconds. The sum of all +criterion timeouts must not exceed 25 seconds. Run longer evaluations outside +the completion wrapper and configure a bounded check of their resulting artifact. + +The inline Python example binds its code text in the versioned document. For a +script validator, optionally run `sha256sum verify.py` and add +`"validation_files": [{"path": "verify.py", "sha256": "<64-hex-digest>"}]` +to that criterion, using a delivery-workspace-relative path. The host checks the +declared file bytes before and after the real run to detect changes. This bounded +check does not prove all transitive imports or interpreter/external-tool identity. + +Configure without `--agent-id`: registered Agent-role invocations can inspect +and verify, but cannot configure or disable the contract. **This is a trusted +local invocation role, not an authentication boundary.** The CLI relies on +existing local-process and private-runtime filesystem permissions; omitting +`--agent-id` is not authentication. Processes with the same private-runtime +permissions are not isolated from owner operations. + +Substitute the exact +`provider_revision` from the preceding inspect, not the acceptance revision: + +```bash +loopx goal-acceptance configure --goal-id example-goal --document acceptance.json --expected-provider-revision '' +loopx goal-acceptance configure --goal-id example-goal --document acceptance.json --expected-provider-revision '' --execute +loopx --format json goal-acceptance inspect --goal-id example-goal +``` + +Omitting `--execute` previews configuration. A revision conflict requires a new +inspect and review of the changed basis before retrying. After enablement, the +existing task claim and completion paths enforce the contract: applicable work +with an unbound or stale association is held; the owner must confirm its current +association by reconfiguring. Completion executes fresh bound artifact checks +and retains the existing claim, lease/fence, permission and continuation gates. +A prior verification receipt or a confirmed association cannot complete a task. +Use `loopx todo claim --help` and `loopx todo complete --help` for the existing +task arguments; this contract adds no bypass flags. + +Run all configured Goal checks and read back their recorded basis: + +```bash +loopx goal-acceptance verify --goal-id example-goal +loopx goal-acceptance verify --goal-id example-goal --execute +loopx --format json goal-acceptance inspect --goal-id example-goal +``` + +Verification without `--execute` is a preview. In **Overview → Delivery & +evidence**, refresh the snapshot and expand **Goal acceptance contract** below +the delivery chain. It shows the Goal ID, contract revision/digest, criteria, +task associations, and verification results with their own revision/digest. +The section exists only when the server's +`acceptance.goal_acceptance_contract.enabled` is `true`. Missing or disabled +contracts retain the baseline UI and export. The existing snapshot export and +status Markdown include the enabled readback without command bodies or raw logs. + +| Server state | Readback meaning | +| --- | --- | +| Task `ready` | Owner confirmed the current task association; artifact checks are separate | +| Task `unbound` / `stale` | Association is missing / no longer current; `applicable: false` identifies tasks outside the current gate | +| Contract `unverified` | Artifact checks have not been verified | +| Contract `failed` / `stale` | Checks failed / their recorded basis is no longer current | +| Contract `partial` | Task-scoped checks passed; Goal-wide verification remains unknown | +| Contract `held` | Applicable task associations require confirmation; historical results remain inspectable | +| Contract `accepted` | All configured artifact checks passed on the current basis; this does not approve or complete the Goal | + +Disabling is an explicit owner operation against a freshly inspected provider +revision. It hides the contextual readback and removes this opt-in gate; existing +task authority, permissions, and lifecycle rules still apply: + +```bash +loopx --format json goal-acceptance inspect --goal-id example-goal +loopx goal-acceptance disable --goal-id example-goal --expected-provider-revision '' --execute +loopx --format json goal-acceptance inspect --goal-id example-goal +``` + +Activation grants no publication, external effect, provider-promotion or Goal +completion authority. Keep objective, criterion descriptions and reasons safe +for their status audience. Lark rendering, remote contract editing, semantic +intent-preservation proofs and general shared amendments remain outside this +local-owner slice. Follow-up belongs to [#3836](../architecture/rfcs/shared-goal-alignment-and-governed-amendment-v0.md) +and [#2831](../architecture/rfcs/goal-direction-baseline-v0.md); it does not close +either RFC. + +Readback validation: Dashboard `npm run smoke:delivery-review`, +`node smoke/goal-acceptance-contract-smoke.mjs`, +`npm run smoke:goal-acceptance-contract-browser`, and +`uv run --extra test python -m pytest tests/test_goal_acceptance_contract_rendering.py`. +After the integrated Dashboard build, `npm run smoke:goal-acceptance-contract-packaged` +runs the same contract browser check against the shipped assets. + ## 中文 -打开 Goal,选择 **Goal 设置 → Goal 详情 → 验收观察**。 +打开本机 Goal,选择 **概览 → 交付与依据 → 验收观察**。 只读卡片展示已有验收要求、对应 Agent、观测时间、待处理门禁的目标 Agent 和决策范围, 以及 status 已给出的下一步。人类决策责任人未提供时显示未知,不把被阻塞的 Agent 当作审批人。`loopx status --format json` 中的 `run_history.goals[].acceptance_observation` 提供相同投影,Markdown 提供简要摘要。 -无需启用或增加权限。仅改变展示,不改变 Todo、gate、quota、settlement 或 Goal 完成权威。 +原有观察卡片无需启用或增加权限。仅改变展示,不改变 Todo、gate、quota、settlement 或 Goal 完成权威。 验收要求复用执行前沿已有的 Agent vision 规则,并消费展示截断前已读取的历史,不额外读取文件。 不收集完整执行前沿,也不审计所有 Agent 通道。历史是有界输入,因此始终显示部分观测: 没有缺口不等于通过验收。 @@ -103,3 +229,58 @@ status 同时在独立的 `run_history.goals[].artifact_lifecycle` 和 Markdown `closing` 或缺少 `work_lane_selected` 均不证明所有工作完成,工作通道与完成权威仍保留各自的判断。 上面的测试命令覆盖合成 Goal 的生产 refresh-state 写入、 真实 status 收集和浏览器入口;打包验证使用 `LOOPX_GOAL_ACCEPTANCE_PACKAGED=1`。 + +### 所有者授权的验收合同(v0) + +所有者可为已注册且**已提升到 canonical authority** 的 Goal 显式启用版本化验收合同。 +命令不会自动提升 provider,canonical 读取失败也不回退到旧 Markdown。 +三个明确决定是:目标与验收条件、现有推进任务与条件的关联、是否启用这项治理。 +合同归既有 Goal authority 所有,Dashboard 只读,不新增配置编辑器或 provider。 + +在 Goal 的交付工作区先运行 +`loopx --format json goal-acceptance inspect --goal-id example-goal`, +并用 `loopx --format json todo list --goal-id example-goal` 查看任务。 +按上方 JSON 示例准备所有者审阅过的 `acceptance.json`,将文件检查与任务 ID 替换为实际产物 +检查和已有推进任务。argv 检查不经过 shell,沿用既有交付工作区验证规则;命令声明保留在本地, +公开读回不含参数、输出或原始日志。每个条件允许 1–25 秒,默认 5 秒;所有条件的 +超时总和不得超过 25 秒。较长评估在完成包装器之外运行,再配置有界的产物检查。 + +上方内联 Python 示例的代码文本绑定在版本化文档中。脚本型验证器可选地运行 +`sha256sum verify.py`,并在该条件中加入 +`"validation_files": [{"path": "verify.py", "sha256": "<64-hex-digest>"}]`, +路径相对于交付工作区。host 在真实运行前后检查声明文件的字节以发现变更; +这项有界检查不证明全部传递导入或解释器/外部工具身份。 + +所有者使用 `goal-acceptance configure --goal-id example-goal --document acceptance.json +--expected-provider-revision ''` 预览,再加 `--execute` 启用; +这里填写最近 inspect 返回的 provider revision,不是合同版本。配置时不传 `--agent-id`: +已注册 Agent 角色调用可 inspect/verify,但不能配置或停用合同。 +**所有者角色依赖受信任的本地调用,不是身份认证边界。** CLI 沿用本地进程与私有 runtime +文件系统权限;省略 `--agent-id` 不构成身份认证,具有相同私有 runtime 权限的进程 +不会与所有者操作隔离。发生版本冲突时重新 inspect, +审阅变化后再重试,配置后再次 inspect 确认。 + +启用后,现有任务 claim/complete 路径执行真实门禁:适用任务缺少关联或关联过期时受阻, +所有者通过重新配置确认当前关联;完成任务必须执行当前绑定的产物检查,并继续满足原有 +claim、lease/fence、权限和后续工作要求。既有验证回执或已确认的关联不能代替本次任务完成验证。 +任务参数沿用 `loopx todo claim --help`、`loopx todo complete --help`,没有绕过门禁的新参数。 + +`loopx goal-acceptance verify --goal-id example-goal` 仅预览;加 `--execute` 执行全部配置条件, +再运行 inspect 读回。进入 **概览 → 交付与依据**,刷新并展开交付链下方的 **Goal 验收合同**。 +区块仅在服务端 `acceptance.goal_acceptance_contract.enabled=true` 时显示,缺失或停用保持原界面与导出。 +区块及导出展示 Goal ID、合同版本/摘要、条件、任务关联,以及带独立版本/摘要的历史验证结果。 + +任务 `ready` 只表示所有者确认关联;`unbound` / `stale` 表示缺失 / 过期; +`applicable=false` 表示不属于当前任务门禁范围。合同 `unverified` 表示未验证, +`failed` / `stale` 表示检查失败 / 检查基线过期,`partial` 表示任务检查通过但 Goal 整体验证未知, +`held` 表示适用任务关联需要确认。`accepted` 仅表示当前基线上的全部配置产物检查通过, +不代表自动批准或完成 Goal。 + +停用前重新 inspect,随后执行 +`loopx goal-acceptance disable --goal-id example-goal --expected-provider-revision '' --execute`, +并再次 inspect。停用隐藏此区块并移除此项显式启用的门禁,原有任务权威、权限和生命周期规则仍生效。 +启用不会授予发布、外部副作用、provider 提升或 Goal 完成权威;目标、条件描述与原因必须适合其 status 受众。 +Lark 呈现、远端合同编辑、语义意图保持证明与通用共享 amendment 留给 #3836 / #2831 后续切片, +不宣称任一 RFC 已完成。合同浏览器检查用 `npm run smoke:goal-acceptance-contract-browser`; +前端集成打包后,`npm run smoke:goal-acceptance-contract-packaged` 对已发布资源跑同一项检查。 +Python renderer 测试和 API/export smoke 覆盖缺失、停用、过期、失败及通过的区别。 diff --git a/loopx/cli.py b/loopx/cli.py index e50388ab13..ef53205bb6 100644 --- a/loopx/cli.py +++ b/loopx/cli.py @@ -161,6 +161,10 @@ handle_shared_goal_alignment_command, register_shared_goal_alignment_command, ) +from .cli_commands.goal_acceptance import ( + handle_goal_acceptance_command, + register_goal_acceptance_command, +) from .cli_commands.goal_amendment_proposal import ( handle_goal_amendment_proposal_command, register_goal_amendment_proposal_command, @@ -350,6 +354,7 @@ def build_parser() -> LoopXArgumentParser: register_todo_continuation(sub, add_subcommand_format) register_handoff_mode_command(sub, add_subcommand_format) register_shared_goal_alignment_command(sub, add_subcommand_format) + register_goal_acceptance_command(sub, add_subcommand_format) register_goal_amendment_proposal_command(sub, add_subcommand_format) register_quota_command(sub) @@ -906,6 +911,13 @@ def main(argv: list[str] | None = None) -> int: if handoff_mode_result is not None: return handoff_mode_result + goal_acceptance_result = handle_goal_acceptance_command( + args, registry_path=registry_path, runtime_root_arg=args.runtime_root, + output_format=output_format, print_payload=print_payload, + ) + if goal_acceptance_result is not None: + return goal_acceptance_result + shared_goal_alignment_result = handle_shared_goal_alignment_command( args, registry_path=registry_path, diff --git a/loopx/cli_commands/goal_acceptance.py b/loopx/cli_commands/goal_acceptance.py new file mode 100644 index 0000000000..5cb221773e --- /dev/null +++ b/loopx/cli_commands/goal_acceptance.py @@ -0,0 +1,134 @@ +"""Local owner configuration and real validation for a Goal acceptance basis.""" + +from __future__ import annotations + +import argparse +import json +from pathlib import Path + +from ..control_plane.goals.acceptance import ( + configure_goal_acceptance, + inspect_goal_acceptance, + public_goal_acceptance, + verify_goal_acceptance, +) + + +def register_goal_acceptance_command(subparsers, add_format): + parser = subparsers.add_parser( + "goal-acceptance", + help="Configure, inspect or verify a versioned Goal acceptance basis.", + ) + add_format(parser) + parser.add_argument("action", choices=("inspect", "configure", "verify", "disable")) + parser.add_argument("--goal-id", required=True) + parser.add_argument( + "--agent-id", + help="Registered caller; Agent callers may inspect/verify but cannot change the owner's contract.", + ) + parser.add_argument( + "--document", + type=Path, + help="Owner-approved contract JSON; used only by configure.", + ) + parser.add_argument( + "--expected-provider-revision", + help="Exact revision from inspect; required by configure/disable.", + ) + parser.add_argument( + "--operation-id", help="Stable identity for an unchanged configuration retry." + ) + parser.add_argument( + "--execute", + action="store_true", + help="Apply configuration or execute validation; otherwise preview only.", + ) + + +def render_goal_acceptance(payload): + lines = ["# Goal acceptance", "", f"- ok: {payload.get('ok')}"] + if payload.get("error"): + return "\n".join([*lines, f"- error: {payload['error']}"]) + if payload.get("provider_revision"): + lines.append(f"- provider revision: {payload['provider_revision']}") + contract = payload.get("goal_acceptance_contract") or {} + lines.append(f"- enabled: {contract.get('enabled', False)}") + if contract.get("enabled"): + lines.extend( + [ + f"- acceptance revision: {contract.get('revision')}", + f"- objective: {contract.get('objective')}", + ] + ) + for task in contract.get("tasks", []): + lines.append( + f"- {task.get('todo_id')}: {task.get('state')} ({', '.join(task.get('criterion_ids', []))})" + ) + lines.append( + f"- configured artifact checks: {contract.get('status', 'unverified')}" + ) + return "\n".join(lines) + + +def handle_goal_acceptance_command( + args: argparse.Namespace, + *, + registry_path: Path, + runtime_root_arg: str | None, + output_format, + print_payload, +): + if args.command != "goal-acceptance": + return None + try: + common = { + "registry_path": registry_path, + "goal_id": args.goal_id, + "runtime_root": runtime_root_arg, + "agent_id": args.agent_id, + } + if args.action in {"configure", "disable"}: + if not args.expected_provider_revision: + raise ValueError( + "configure/disable requires --expected-provider-revision from inspect" + ) + if args.action == "configure" and args.document is None: + raise ValueError("configure requires --document") + if args.action == "disable" and args.document is not None: + raise ValueError("disable does not accept --document") + document = ( + json.loads(args.document.read_text(encoding="utf-8")) + if args.document + else None + ) + if document is not None and not isinstance(document, dict): + raise ValueError("acceptance document must be a JSON object") + payload = public_goal_acceptance( + configure_goal_acceptance( + **common, + document=document, + expected_provider_revision=args.expected_provider_revision, + operation_id=args.operation_id, + execute=args.execute, + disable=args.action == "disable", + ) + ) + else: + if args.document or args.expected_provider_revision or args.operation_id: + raise ValueError("configuration arguments require configure or disable") + if args.action == "inspect": + if args.execute: + raise ValueError("inspect is read-only") + payload = public_goal_acceptance(inspect_goal_acceptance(**common)) + else: + payload = verify_goal_acceptance(**common, execute=args.execute) + code = ( + 1 + if payload.get("checks_passed") is False + or payload.get("acceptance_ready") is False + else 0 + ) + except (OSError, TypeError, ValueError, RuntimeError) as exc: + payload, code = {"ok": False, "error": str(exc)}, 1 + print_payload(payload, output_format(args), render_goal_acceptance) + return code diff --git a/loopx/control_plane/coordination/local_authority.py b/loopx/control_plane/coordination/local_authority.py index 4803edd682..c65b724a6f 100644 --- a/loopx/control_plane/coordination/local_authority.py +++ b/loopx/control_plane/coordination/local_authority.py @@ -258,7 +258,9 @@ def read_canonical_todo_fields_if_promoted( """ canonical = read_canonical_todos_if_promoted(runtime_root=runtime_root, goal_id=goal_id) return ( - canonical_todo_summary_fields(canonical["todos"], rollout_events=rollout_events) + canonical_todo_summary_fields(canonical["todos"], rollout_events=rollout_events, + goal_acceptance_contract=canonical.get("goal_acceptance_contract"), + goal_acceptance_work_guards=canonical.get("goal_acceptance_work_guards")) if canonical is not None else None ) @@ -267,6 +269,8 @@ def canonical_todo_summary_fields( todos: list[dict[str, Any]], *, rollout_events: list[dict[str, Any]] | None = None, + goal_acceptance_contract: dict[str, Any] | None = None, + goal_acceptance_work_guards: dict[str, Any] | None = None, ) -> dict[str, Any]: """Adapt canonical records into the existing Todo summary read model.""" @@ -301,6 +305,12 @@ def canonical_todo_summary_fields( else item for index, item in enumerate(todos, 1) ] + # These are native authority decisions, not persisted Todo fields. Keep the + # records visible while every summary/selection uses the same work guard. + if goal_acceptance_contract and goal_acceptance_contract.get("enabled") is True: + guards = goal_acceptance_work_guards or {} + todos = [{**item, "goal_acceptance_guard": guards[item["todo_id"]]} + if item.get("todo_id") in guards else item for item in todos] fields: dict[str, Any] = {} for role in ("user", "agent"): items = [ @@ -320,6 +330,8 @@ def canonical_todo_summary_fields( ) if summary: if role == "agent": + if goal_acceptance_contract and goal_acceptance_contract.get("enabled") is True: + summary["goal_acceptance_contract"] = goal_acceptance_contract archived_done = count_advancement_todos( [ item diff --git a/loopx/control_plane/coordination/local_authority_runtime.ts b/loopx/control_plane/coordination/local_authority_runtime.ts index 6914145692..2f1067608b 100644 --- a/loopx/control_plane/coordination/local_authority_runtime.ts +++ b/loopx/control_plane/coordination/local_authority_runtime.ts @@ -7,6 +7,7 @@ import { ShadowManagementError } from "./shadow_management.ts"; import { isAbsolute, join } from "node:path"; import type { JsonObject } from "../effect_program.ts"; +import {acceptanceWorkGuard, projectGoalAcceptance} from "../goals/acceptance_contract.ts"; import {executeCoordinationMonitorPoll, COORDINATION_MONITOR_POLL_REQUEST_SCHEMA, COORDINATION_LEASED_MONITOR_POLL_REQUEST_SCHEMA, COORDINATION_MONITOR_POLL_RESULT_SCHEMA} from "./todo_monitor_poll.ts"; import { requireJsonObject } from "../runtime_decode.ts"; @@ -945,6 +946,9 @@ export async function terminalLifecycleLocalCoordinationTodo( ? null : requireJsonObject(input.validation_declaration, "validation_declaration"), validation_receipt: input.validation_receipt === null || input.validation_receipt === undefined ? null : requireJsonObject(input.validation_receipt, "validation_receipt"), + goal_acceptance_source_binding: input.goal_acceptance_source_binding == null + ? null : requireJsonObject(input.goal_acceptance_source_binding, "goal_acceptance_source_binding"), + goal_acceptance_validation_receipts: input.goal_acceptance_validation_receipts, completion_policy_request: input.completion_policy_request === null || input.completion_policy_request === undefined ? null : requireJsonObject(input.completion_policy_request, "completion_policy_request"), @@ -1100,11 +1104,13 @@ export async function readLocalCoordinationTodo( const projection = indexCoordinationProjectionTodos(head.head, goalId); validateCoordinationTodoReadModel(head.head, goalId); const todo = projection.todos.get(todoId); + const acceptance = todo === undefined ? null : acceptanceWorkGuard(head.head, goalId, todoId); return { schema_version: LOCAL_COORDINATION_TODO_READ_RESULT_SCHEMA, status: todo === undefined ? "missing" : "found", todo_id: todoId, ...(todo === undefined ? {} : { todo }), + ...(acceptance === null ? {} : {goal_acceptance_guard: acceptance}), todo_ids: projection.todo_ids, provider_revision: head.provider_revision, cursor: head.cursor, @@ -1158,12 +1164,18 @@ export async function listLocalCoordinationTodos( const todoReadModel = validateCoordinationTodoReadModel(head.head, goalId); const leaseIndex = input.include_leases === true ? indexCoordinationProjection(head.head, goalId) : null; + const acceptance = projectGoalAcceptance(head.head, goalId); return { schema_version: LOCAL_COORDINATION_TODO_LIST_RESULT_SCHEMA, status: "loaded", todos: projection.todo_ids.map((todoId) => projection.todos.get(todoId)!), todo_ids: projection.todo_ids, todo_read_model: todoReadModel, + ...(acceptance.enabled !== true ? {} : {goal_acceptance_contract: acceptance, + goal_acceptance_work_guards: Object.fromEntries(projection.todo_ids.flatMap(id => { + const guard = acceptanceWorkGuard(head.head, goalId, id); + return guard === null ? [] : [[id, guard]]; + }))}), ...(leaseIndex === null ? {} : { leases: leaseIndex.lease_todo_ids.map((id) => leaseIndex.leases.get(id)!), handoff_mode: head.head.handoff_mode ?? "legacy", diff --git a/loopx/control_plane/coordination/task_lease_acquire.ts b/loopx/control_plane/coordination/task_lease_acquire.ts index 5c14a89e54..272b0be016 100644 --- a/loopx/control_plane/coordination/task_lease_acquire.ts +++ b/loopx/control_plane/coordination/task_lease_acquire.ts @@ -10,6 +10,7 @@ import {HANDOFF_MODES} from "./handoff_mode_policy.ts"; import {requireStringLiteral} from "../runtime_decode.ts"; import {decideTaskLeaseAcquire, materializeTaskLeaseAcquire} from "../work_items/task_lease_acquire_decision.ts"; import {leaseOwnerRejection} from "../work_items/task_lease_eligibility.ts"; +import {acceptanceWorkGuard} from "../goals/acceptance_contract.ts"; import {normalizeGoalId, normalizeTodoId, normalizeOwner, normalizeIdempotencyKey, normalizeWriteScopes, normalizeTtl, leaseEpoch, leaseVersion, leaseIsActive, TaskLeaseAcquireError} from "../work_items/task_lease_acquire.ts"; @@ -87,6 +88,11 @@ export async function executeCanonicalTaskLeaseAcquire(store: AuthorityStore, ra leaseVersion(current) < leaseVersion(original)) { return failed("idempotency_key_reuse", "acquire receipt belongs to a retired execution; use a new execution key", details); } + const acceptance = acceptanceWorkGuard(head.head, input.goal_id, input.todo_id); + if (acceptance !== null && !acceptance.allowed) { + return failed(String(acceptance.reason_code), `${String(acceptance.reason)} Inspect Goal acceptance and ask the owner to configure or rebind this Todo.`, + {...details, goal_acceptance_guard: acceptance}); + } // Renewal may advance version/expiry within this execution. Return current // usable proof while the immutable receipt preserves the original decision. return {...result, ...details, lease: current}; @@ -107,6 +113,11 @@ export async function executeCanonicalTaskLeaseAcquire(store: AuthorityStore, ra ...(facts.todo ? {todo_status: facts.todo.status, claimed_by: facts.todo.claimed_by, excluded_agents: [...facts.todo.excluded_agents]} : {}), ...(decision.conflict_indexes.length ? {conflicts: decision.conflict_indexes.map(i => facts.other_leases[i])} : {})}); } + const acceptance = acceptanceWorkGuard(head.head, input.goal_id, input.todo_id); + if (acceptance !== null && !acceptance.allowed) { + return failed(String(acceptance.reason_code), `${String(acceptance.reason)} Inspect Goal acceptance and ask the owner to configure or rebind this Todo.`, + {goal_acceptance_guard: acceptance}); + } const changed = decision.outcome === "apply"; const lease = changed ? materializeTaskLeaseAcquire(input, input, decision, input.now) : facts.current; if (!lease) throw new AuthorityStoreProtocolError("accepted acquire lacks a lease"); diff --git a/loopx/control_plane/coordination/todo_claim.ts b/loopx/control_plane/coordination/todo_claim.ts index 482adedb17..08c62bd570 100644 --- a/loopx/control_plane/coordination/todo_claim.ts +++ b/loopx/control_plane/coordination/todo_claim.ts @@ -10,6 +10,7 @@ import { } from "./authority_store_codec.ts"; import {validateContinuationNote, computeContinuationTodoFacts} from "./continuation_note.ts"; import {CoordinationCommandReceipt} from "./command_receipt.ts"; +import {acceptanceWorkGuard} from "../goals/acceptance_contract.ts"; import {normalizeRegisteredTodoAgents, normalizeTodoAgent} from "./todo_agents.ts"; import { prepareCoordinationProjectionCommit, @@ -410,7 +411,19 @@ export async function executeCoordinationTodoClaim( return {fields: {...result, original_receipt: original}, changed: result.changed !== false}; }}); const existing = await receipt.read(store); - if (existing !== null) return existing; + if (existing !== null) { + // A historical claim receipt cannot grant work after its acceptance binding + // changed. Preserve the original response when the contract is absent. + const current = await store.loadAuthority(); + if (current.status === "loaded") { + const guard = acceptanceWorkGuard(current.head, input.goal_id, input.todo_id); + if (guard !== null && !guard.allowed) { + return failure(String(guard.reason_code), `${String(guard.reason)} Inspect Goal acceptance and ask the owner to configure or rebind this Todo.`, + {goal_acceptance_guard: guard}, "decision_rejection"); + } + } + return existing; + } const head = await store.loadAuthority(); if (head.status !== "loaded") { @@ -560,6 +573,12 @@ export async function executeCoordinationTodoClaim( ); } + const acceptance = acceptanceWorkGuard(head.head, input.goal_id, input.todo_id); + if (acceptance !== null && !acceptance.allowed) { + return failure(String(acceptance.reason_code), `${String(acceptance.reason)} Inspect Goal acceptance and ask the owner to configure or rebind this Todo.`, + {goal_acceptance_guard: acceptance}, "decision_rejection"); + } + const mutationAuthority = canonicalAuthorityObject( authority.mutation_authority, "Todo claim mutation authority", diff --git a/loopx/control_plane/coordination/todo_terminal_lifecycle.ts b/loopx/control_plane/coordination/todo_terminal_lifecycle.ts index b0abdfb327..7a32a46eb7 100644 --- a/loopx/control_plane/coordination/todo_terminal_lifecycle.ts +++ b/loopx/control_plane/coordination/todo_terminal_lifecycle.ts @@ -1,4 +1,6 @@ import { createHash } from "node:crypto"; +import {acceptanceWorkGuard, acceptanceCompletionRequirements, validateAcceptanceCompletion, + acceptanceRequire, type AcceptanceCompletionRequirements} from "../goals/acceptance_contract.ts"; import {CoordinationCommandReceipt, commandReceiptResult} from "./command_receipt.ts"; import type { JsonObject } from "../effect_program.ts"; @@ -93,6 +95,8 @@ export interface CoordinationTodoTerminalLifecycleInput { readonly clear_claim: boolean; readonly validation_declaration: JsonObject | null; readonly validation_receipt: JsonObject | null; + readonly goal_acceptance_source_binding?: JsonObject | null; + readonly goal_acceptance_validation_receipts?: unknown; readonly completion_policy_request: JsonObject | null; readonly dry_run: boolean; readonly now: Date; @@ -395,6 +399,56 @@ function terminalReceipt(input: CoordinationTodoTerminalLifecycleInput, requestS decode: commandReceiptResult}); } +function acceptanceSourceBinding(input: CoordinationTodoTerminalLifecycleInput, + requirements: AcceptanceCompletionRequirements, providerRevision: string): JsonObject { + return {goal_id: input.goal_id, todo_id: input.todo_id, operation_id: input.operation_id, + provider_revision: providerRevision, contract_revision: requirements.contract_revision, + contract_digest: requirements.contract_digest, todo_semantic_digest: requirements.todo_semantic_digest}; +} + +function acceptanceValidationEffects(requirements: AcceptanceCompletionRequirements, todo: JsonObject): JsonObject[] { + return requirements.criteria.map(criterion => ({criterion_id: criterion.id, effect: { + kind: "caller_validation", validation_command: null, validation_argv: criterion.validation_argv, + validation_label: criterion.id, validation_timeout_seconds: criterion.validation_timeout_seconds, + ...(criterion.validation_files == null ? {} : {validation_files: criterion.validation_files}), + task_repository: todo.task_repository ?? null, + }})); +} + +/** Only the trusted execution adapter supplies these fresh, structured runner + * receipts. Save the public-safe criterion results, never command output. */ +function acceptanceCompletionEvidence(head: JsonObject, input: CoordinationTodoTerminalLifecycleInput, + requirements: AcceptanceCompletionRequirements, binding: JsonObject): JsonObject { + acceptanceRequire(input.goal_acceptance_source_binding != null && + canonicalAuthoritySha256(input.goal_acceptance_source_binding) === canonicalAuthoritySha256(binding), + "Acceptance completion source changed; run the configured criteria again against the current work."); + const receipts = input.goal_acceptance_validation_receipts; + acceptanceRequire(Array.isArray(receipts), "Acceptance completion requires fresh validation receipts."); + const results = receipts.map(value => { + const row = canonicalAuthorityObject(value, "acceptance validation receipt"); + const receipt = canonicalAuthorityObject(row.receipt, "acceptance criterion runner receipt"); + acceptanceRequire(receipt.schema_version === "issue_fix_validation_command_v0" && + typeof row.criterion_id === "string" && receipt.command_label === row.criterion_id && + receipt.stdout_captured === false && receipt.stderr_captured === false && receipt.local_path_captured === false, + "Acceptance completion requires the configured criterion's public-safe runner receipt."); + return {criterion_id: row.criterion_id, passed: receipt.passed, exit_code: receipt.exit_code}; + }); + const validationReceipts = receipts.map(value => { + const row = canonicalAuthorityObject(value, "acceptance validation receipt"); + const receipt = canonicalAuthorityObject(row.receipt, "acceptance criterion runner receipt"); + return {criterion_id: row.criterion_id, receipt: Object.fromEntries([ + "schema_version", "command_label", "passed", "exit_code", "status", "summary", + "stdout_captured", "stderr_captured", "local_path_captured", + ].flatMap(key => receipt[key] === undefined ? [] : [[key, receipt[key]]]))}; + }); + const evidence = validateAcceptanceCompletion(head, input.goal_id, input.todo_id, { + contract_revision: requirements.contract_revision, contract_digest: requirements.contract_digest, + todo_id: input.todo_id, todo_semantic_digest: requirements.todo_semantic_digest, results, + }); + acceptanceRequire(evidence !== null, "Acceptance completion requirements disappeared."); + return {source_binding: binding, ...evidence, validation_receipts: validationReceipts}; +} + async function commitTerminalResult( store: AuthorityStore, input: CoordinationTodoTerminalLifecycleInput, @@ -663,6 +717,13 @@ export async function executeCoordinationTodoTerminalLifecycle( ); } const requestSha = terminalRequestSha(input); + // Unlike `todo_claim`, this replay needs no post-replay acceptance re-check. + // A claim receipt grants work going forward, so replaying one after its + // binding changed would resume work acceptance now holds. A terminal receipt + // only reports a transition that already committed: it cannot exist for work + // that never closed, a closed Todo cannot be reopened + // (`unsupported_todo_update_target`), and a replay returns `changed: false`. + // Re-checking here would add a load per replay and protect nothing. const replay = await terminalReceipt(input, requestSha).read(store); if (replay !== null) return replay; @@ -748,6 +809,32 @@ export async function executeCoordinationTodoTerminalLifecycle( ); } + // Acceptance constrains a state transition, not a verb. Every TERMINAL_COMMANDS + // entry reaches `terminalTarget`, which writes `status: "done", done: true`, + // so the guard follows that write instead of one command name. A future + // terminal command then inherits it rather than silently bypassing it. + const acceptance = acceptanceWorkGuard(head.head, input.goal_id, input.todo_id); + if (acceptance !== null && !acceptance.allowed) { + return terminalFailure(String(acceptance.reason_code), `${String(acceptance.reason)} Inspect Goal acceptance and ask the owner to configure or rebind this Todo.`, + {goal_acceptance_guard: acceptance}, "decision_rejection"); + } + const acceptanceRequirements = acceptanceCompletionRequirements(head.head, input.goal_id, input.todo_id); + const acceptanceBinding = acceptanceRequirements === null ? null + : acceptanceSourceBinding(input, acceptanceRequirements, head.provider_revision); + let acceptanceEvidence: JsonObject | null = null; + if (acceptanceRequirements !== null && acceptanceBinding !== null && + input.goal_acceptance_validation_receipts != null) { + try { + acceptanceEvidence = acceptanceCompletionEvidence(head.head, input, acceptanceRequirements, acceptanceBinding); + } catch (error) { + return terminalFailure("goal_acceptance_validation_rejected", + error instanceof Error ? error.message : "Acceptance completion validation failed.", {}, "decision_rejection"); + } + } else if (input.goal_acceptance_source_binding != null || input.goal_acceptance_validation_receipts != null) { + return terminalFailure("goal_acceptance_validation_unexpected", + "This terminal operation has no applicable acceptance validation requirements.", {}, "decision_rejection"); + } + let completion: ReturnType | null = null; if (input.command === "complete") { const validationRequired = todo.completion_validation_required === true; @@ -800,14 +887,31 @@ export async function executeCoordinationTodoTerminalLifecycle( error instanceof Error ? error.message : "invalid Todo completion transaction", ); } - if (completion.decision === "execute_validation") { + if (completion.decision === "execute_validation" || + (completion.decision === "commit" && acceptanceRequirements !== null && + acceptanceEvidence === null && !input.dry_run)) { + if (acceptanceRequirements !== null) { + const callerTimeout = completion.decision === "execute_validation" + ? completion.validation_effect.validation_timeout_seconds ?? 20 : 0; + const acceptanceTimeout = acceptanceRequirements.criteria.reduce( + (total, criterion) => total + criterion.validation_timeout_seconds, 0); + if (callerTimeout + acceptanceTimeout > 29) { + return terminalFailure("goal_acceptance_validation_budget_exceeded", + "Combined validation exceeds the completion budget of 29 seconds; ask the owner to configure criteria and caller validation within that budget.", + {validation_timeout_seconds: callerTimeout + acceptanceTimeout}, "decision_rejection"); + } + } return { schema_version: COORDINATION_TODO_TERMINAL_LIFECYCLE_RESULT_SCHEMA, status: "execute_validation", changed: false, todo_id: input.todo_id, command: input.command, - validation_effect: completion.validation_effect, + validation_effect: completion.decision === "execute_validation" ? completion.validation_effect : null, + ...(acceptanceRequirements === null ? {} : { + goal_acceptance_source_binding: acceptanceBinding, + goal_acceptance_validation_effects: acceptanceValidationEffects(acceptanceRequirements, todo), + }), completion_identity_key: completion.completion_identity_key, completion_identity_source: completion.completion_identity_source, provider_revision: head.provider_revision, @@ -859,6 +963,13 @@ export async function executeCoordinationTodoTerminalLifecycle( }, []); } + if (acceptanceRequirements !== null && !input.dry_run && acceptanceEvidence === null) { + return terminalFailure("goal_acceptance_validation_required", + input.command === "complete" + ? "Completion requires fresh execution of the owner-configured acceptance criteria." + : `${input.command} would close this work as done without running the owner-configured acceptance criteria. Complete it so the criteria run, or ask the owner to rebind or disable acceptance for this Todo.`, + {}, "decision_rejection"); + } const domainReadModel = readModel.schema_version === TODO_DOMAIN_READ_RECORD_SCHEMA; const completionPolicy = completion?.decision === "commit" && completion.completion_policy !== undefined @@ -991,6 +1102,15 @@ export async function executeCoordinationTodoTerminalLifecycle( completion_identity_source: completion === null ? null : completion.completion_identity_source, completed_at: target.todo.completed_at, + ...(acceptanceEvidence === null ? {} : {goal_acceptance_completion: acceptanceEvidence}), + // A preview that omits this would show an unconditional close for work the + // real call still gates. Name the criteria the real call must run; never + // their argv, which stays out of every projection. + ...(acceptanceRequirements !== null && acceptanceEvidence === null + ? {goal_acceptance_pending: {contract_revision: acceptanceRequirements.contract_revision, + contract_digest: acceptanceRequirements.contract_digest, + criterion_ids: acceptanceRequirements.criterion_ids}} + : {}), }; const mutations: CoordinationProjectionMutation[] = changed ? [ {kind: "todo_upsert", todo: target.todo, clear_fields: target.clear_fields}, diff --git a/loopx/control_plane/coordination/todo_update.ts b/loopx/control_plane/coordination/todo_update.ts index eb92b64ab5..022e7123a5 100644 --- a/loopx/control_plane/coordination/todo_update.ts +++ b/loopx/control_plane/coordination/todo_update.ts @@ -1,4 +1,5 @@ import type { JsonObject } from "../effect_program.ts"; +import {acceptanceWorkGuard} from "../goals/acceptance_contract.ts"; import { TODO_WORK_REQUIREMENT_FIELDS } from "../todos/work_requirements.ts"; import { TODO_OWNERSHIP_INTENT_FIELDS } from "../todos/authoring_scope.ts"; import type { AuthorityStore, AuthorityStoreCommit } from "./authority_store.ts"; @@ -341,9 +342,6 @@ export async function executeCoordinationTodoUpdate( const prepared = prepareUpdatedTodo(target.todo, input, head.head); if (isFailure(prepared)) return prepared; const {next, changed, clearFields} = prepared; - if (input.dry_run) return {schema_version: COORDINATION_TODO_UPDATE_RESULT_SCHEMA, - status: changed ? "planned" : "no_change", changed, todo_id: input.todo_id, - provider_revision: head.provider_revision, cursor: head.cursor, dry_run: true}; const commit: AuthorityStoreCommit = changed ? prepareCoordinationProjectionCommit({ goal_id: input.goal_id, operation_id: input.operation_id, expected_provider_revision: head.provider_revision, projection: head.head, @@ -351,6 +349,18 @@ export async function executeCoordinationTodoUpdate( }) : {operation_id: input.operation_id, expected_provider_revision: head.provider_revision, next_projection: head.head, events: [], receipts: []}; + // Planning can assign a claim too. Admit that assignment against the full + // candidate head so a simultaneous semantic edit cannot retain stale approval. + if (input.planning_intent?.claimed_by != null) { + const acceptance = acceptanceWorkGuard(commit.next_projection, input.goal_id, input.todo_id); + if (acceptance !== null && !acceptance.allowed) { + return {...failure(String(acceptance.reason_code), `${String(acceptance.reason)} Inspect Goal acceptance and ask the owner to configure or rebind this Todo.`), + goal_acceptance_guard: acceptance}; + } + } + if (input.dry_run) return {schema_version: COORDINATION_TODO_UPDATE_RESULT_SCHEMA, + status: changed ? "planned" : "no_change", changed, todo_id: input.todo_id, + provider_revision: head.provider_revision, cursor: head.cursor, dry_run: true}; commit.receipts = [{schema_version: COORDINATION_TODO_UPDATE_RECEIPT_SCHEMA, operation_id: input.operation_id, goal_id: input.goal_id, todo_id: input.todo_id, request_sha256: requestSha, changed}]; diff --git a/loopx/control_plane/effect_runtime_handlers.ts b/loopx/control_plane/effect_runtime_handlers.ts index 1d4b763ce9..7eb2009586 100644 --- a/loopx/control_plane/effect_runtime_handlers.ts +++ b/loopx/control_plane/effect_runtime_handlers.ts @@ -1,5 +1,7 @@ import {previewTeamPlan, planTeamTransaction, teamTransactionIdentity} from "./work_items/team_plan.ts"; import {commitLocalTeamPlan} from "./work_items/team_plan_authority.ts"; +import {inspectLocalGoalAcceptance, commitLocalGoalAcceptance, + commitLocalGoalAcceptanceVerification} from "./goals/acceptance_authority.ts"; import {planHandoffMode} from "./coordination/handoff_mode_policy.ts"; import {setLocalHandoffMode} from "./coordination/handoff_mode_runtime.ts"; import {projectOwnershipObservation} from "./coordination/ownership_observation.ts"; @@ -463,6 +465,9 @@ export function createEffectRuntimeHandlers( ["goal.shared_goal_alignment.project", projectSharedGoalAlignment], ["goal.operator_actions.project", projectGoalOperatorActions], ["goal.amendment_proposal.admit", admitGoalAmendmentProposal], + ["goal.acceptance.inspect", inspectLocalGoalAcceptance], + ["goal.acceptance.configure", commitLocalGoalAcceptance], + ["goal.acceptance.verify.commit", commitLocalGoalAcceptanceVerification], ["agent.delivery_workspace.evaluate", evaluateDeliveryWorkspace], [ "quota.delivery_workspace_causality.evaluate", diff --git a/loopx/control_plane/goals/acceptance.py b/loopx/control_plane/goals/acceptance.py new file mode 100644 index 0000000000..aee6d6db1d --- /dev/null +++ b/loopx/control_plane/goals/acceptance.py @@ -0,0 +1,297 @@ +"""Host adapter for canonical, owner-configured Goal acceptance. + +TypeScript owns revisions, work bindings, admission and CAS. Python resolves +the registered Goal and executes only validation commands read from that owner. +No caller-supplied pass/fail result is accepted by the public CLI. +""" + +from __future__ import annotations + +import hashlib +from collections.abc import Mapping +from pathlib import Path +from typing import Any +from uuid import uuid4 + +from ...agent_registry import load_goal_from_registry, registered_agent_ids_for_goal +from ..coordination.local_authority import local_authority_is_promoted +from ..coordination.local_authority_shadow_adapter import effective_runtime_root +from ..effect_runtime import effect_runtime_result +from ..todos.completion_validation import ( + _resolve_completion_validation_workspace, + run_declared_completion_validation_effect, +) + + +def _routing( + registry_path: Path, + goal_id: str, + runtime_root: str | None, + agent_id: str | None = None, +) -> dict[str, Any]: + goal = load_goal_from_registry(registry_path, goal_id) + if goal is None: + raise ValueError("Goal acceptance requires a registered Goal") + if agent_id is not None and agent_id not in registered_agent_ids_for_goal(goal): + raise ValueError("Goal acceptance caller must be a registered Agent") + root = effective_runtime_root(registry_path, runtime_root) + if not local_authority_is_promoted(runtime_root=root, goal_id=goal_id): + raise ValueError( + "Goal acceptance requires an existing canonical authority; activation never promotes a provider" + ) + return {"runtime_root": str(root.resolve()), "goal_id": goal_id} + + +def _result(method: str, request: Mapping[str, Any]) -> dict[str, Any]: + value = effect_runtime_result(method, dict(request)) + if not isinstance(value, dict): + raise TypeError("Goal acceptance authority returned an invalid result") + if value.get("status") not in { + "loaded", + "applied", + "recovered", + "replayed", + "planned", + "no_change", + }: + raise ValueError( + str( + value.get("reason_code") + or value.get("reason") + or "Goal acceptance authority is unavailable" + ) + ) + return value + + +def inspect_goal_acceptance( + *, + registry_path: Path, + goal_id: str, + runtime_root: str | None = None, + agent_id: str | None = None, +) -> dict[str, Any]: + """Read one canonical basis; command declarations stay inside the host.""" + return _result( + "goal.acceptance.inspect", + _routing(registry_path, goal_id, runtime_root, agent_id), + ) + + +def configure_goal_acceptance( + *, + registry_path: Path, + goal_id: str, + expected_provider_revision: str, + document: dict[str, Any] | None, + runtime_root: str | None = None, + agent_id: str | None = None, + operation_id: str | None = None, + execute: bool = False, + disable: bool = False, +) -> dict[str, Any]: + """Explicit local-owner configuration; Agent tool callers have no writer.""" + route = _routing(registry_path, goal_id, runtime_root, agent_id) + return _result( + "goal.acceptance.configure", + { + **route, + "actor_agent_id": agent_id, + "expected_provider_revision": expected_provider_revision, + "document": document, + "disable": disable, + "dry_run": not execute, + "operation_id": operation_id or f"goal-acceptance:{uuid4().hex}", + }, + ) + + +def run_goal_acceptance_effects( + *, + effects: list[dict[str, Any]], + registry_path: Path, + goal_id: str, + delivery_workspace: Mapping[str, Any] | None = None, + validation_workspace_path: Path | None = None, +) -> list[dict[str, Any]]: + """Execute a finite plan supplied by the typed authority, never by CLI JSON.""" + results = [] + for effect in effects: + criterion_id = effect.get("criterion_id") + if not isinstance(criterion_id, str) or not criterion_id: + raise ValueError("Goal acceptance effect requires a criterion identity") + receipt = run_goal_acceptance_validation_effect( + effect=effect, + registry_path=registry_path, + goal_id=goal_id, + delivery_workspace=delivery_workspace, + validation_workspace_path=validation_workspace_path, + ) + exit_code = receipt["exit_code"] + results.append( + { + "criterion_id": criterion_id, + "passed": receipt["passed"], + "exit_code": exit_code + if isinstance(exit_code, int) and 0 <= exit_code <= 255 + else None, + } + ) + return results + + +def run_goal_acceptance_validation_effect( + *, + effect: Mapping[str, Any], + registry_path: Path, + goal_id: str, + delivery_workspace: Mapping[str, Any] | None = None, + validation_workspace_path: Path | None = None, +) -> dict[str, Any]: + """Use the ordinary runner while preserving declared verifier-file identity. + + Pins cover explicitly declared verifier assets, not inferred dependencies. + The local execution environment remains the existing host trust boundary. + """ + pins = effect.get("validation_files", []) + if not isinstance(pins, list): + raise TypeError("acceptance validation_files must be an array") + label = str(effect.get("validation_label") or "Goal acceptance") + workspace = None + if pins: + workspace, failure = _resolve_completion_validation_workspace( + registry_path=registry_path, + goal_id=goal_id, + task_repository=effect.get("task_repository"), + delivery_workspace=delivery_workspace, + validation_workspace_path=validation_workspace_path, + label=label, + ) + if failure is not None: + return failure + + def pins_match() -> bool: + if not pins: + return True + if workspace is None: + return False + for pin in pins: + if not isinstance(pin, dict): + return False + relative = pin.get("path") + if not isinstance(relative, str) or not relative or "\\" in relative: + return False + path = Path(relative) + if path.is_absolute() or ".." in path.parts: + return False + candidate = workspace + try: + for part in path.parts: + candidate = candidate / part + if candidate.is_symlink(): + return False + if not candidate.is_file() or hashlib.sha256( + candidate.read_bytes() + ).hexdigest() != pin.get("sha256"): + return False + except OSError: + return False + return True + + def stale_receipt() -> dict[str, Any]: + return { + "schema_version": "issue_fix_validation_command_v0", + "command_label": label, + "exit_code": None, + "passed": False, + "status": "validation_basis_changed", + "summary": "Declared verifier files changed or are unavailable; review and reconfigure the acceptance basis.", + "stdout_captured": False, + "stderr_captured": False, + "local_path_captured": False, + } + + if not pins_match(): + return stale_receipt() + receipt = run_declared_completion_validation_effect( + effect={ + key: value for key, value in effect.items() if key != "validation_files" + }, + registry_path=registry_path, + goal_id=goal_id, + delivery_workspace=delivery_workspace, + validation_workspace_path=validation_workspace_path, + ) + return receipt if pins_match() else stale_receipt() + + +def public_goal_acceptance(value: dict[str, Any]) -> dict[str, Any]: + """Expose projections and revision tokens, never executable declarations.""" + keys = ( + "status", + "goal_id", + "provider_revision", + "source_authority", + "changed", + "dry_run", + "operation_id", + "goal_acceptance_contract", + "reason_code", + ) + return {"ok": True, **{key: value[key] for key in keys if key in value}} + + +def verify_goal_acceptance( + *, + registry_path: Path, + goal_id: str, + runtime_root: str | None = None, + agent_id: str | None = None, + execute: bool = False, +) -> dict[str, Any]: + """Run the configured acceptance checks against a frozen canonical basis.""" + route = _routing(registry_path, goal_id, runtime_root, agent_id) + basis = _result("goal.acceptance.inspect", route) + contract = basis.get("contract") + if contract is None: + raise ValueError("Goal acceptance is not enabled") + if not isinstance(contract, dict): + raise TypeError("Goal acceptance contract shape is invalid") + criteria = contract.get("criteria") + if not isinstance(criteria, list) or not criteria: + raise ValueError("Goal acceptance authority omitted its criteria") + if not execute: + return {**public_goal_acceptance(basis), "status": "planned", "executed": False} + effects = [ + { + "kind": "caller_validation", + "criterion_id": row["id"], + "validation_argv": row["validation_argv"], + "validation_label": f"Goal acceptance: {row['id']}", + "validation_timeout_seconds": row.get("validation_timeout_seconds", 29), + "validation_files": row.get("validation_files", []), + } + for row in criteria + ] + receipts = run_goal_acceptance_effects( + effects=effects, registry_path=registry_path, goal_id=goal_id + ) + result = _result( + "goal.acceptance.verify.commit", + { + **route, + "expected_provider_revision": basis["provider_revision"], + "actor_agent_id": None, + "operation_id": f"goal-acceptance-verify:{uuid4().hex}", + "contract_digest": basis["goal_acceptance_contract"]["digest"], + "revision": basis["goal_acceptance_contract"]["revision"], + "results": receipts, + }, + ) + return { + **public_goal_acceptance(result), + "executed": True, + "checks_passed": all(row.get("passed") is True for row in receipts), + "acceptance_ready": result.get("goal_acceptance_contract", {}).get("status") + == "accepted", + } diff --git a/loopx/control_plane/goals/acceptance_authority.ts b/loopx/control_plane/goals/acceptance_authority.ts new file mode 100644 index 0000000000..b3866574ee --- /dev/null +++ b/loopx/control_plane/goals/acceptance_authority.ts @@ -0,0 +1,192 @@ +/** Acceptance effects use the existing canonical head, CAS and operation journal. + * Only trusted local owner/host adapters may invoke these mutation exports. */ +import {isAbsolute} from "node:path"; +import type {JsonObject} from "../effect_program.ts"; +import type {AuthorityStore, AuthorityStoreHead} from "../coordination/authority_store.ts"; +import {authorityStoreSourceAuthority} from "../coordination/authority_store.ts"; +import {AuthorityStoreProtocolError, canonicalAuthorityObject, canonicalAuthoritySha256, + requireAuthorityStoreId} from "../coordination/authority_store_codec.ts"; +import {CoordinationCommandReceipt} from "../coordination/command_receipt.ts"; +import {withCanonicalWriter} from "../coordination/local_authority_write.ts"; +import {openLocalAuthorityStore, localAuthorityOpenFailure} from "../coordination/local_authority_provider.ts"; +import {GOAL_ACCEPTANCE_SCHEMA, acceptanceKeys, acceptanceRequire, acceptanceTask, acceptanceText, acceptanceTodos, + goalAcceptanceTodoDigest, goalAcceptanceWorkDigest, normalizeAcceptanceResults, + normalizeGoalAcceptanceDocument, projectGoalAcceptance, readGoalAcceptance, + type AcceptanceState, type AcceptanceVerification} from "./acceptance_contract.ts"; + +const RESULT_SCHEMA = "loopx_goal_acceptance_result_v0"; +const RECEIPT_SCHEMA = "loopx_goal_acceptance_operation_v0"; +const REQUEST_FIELDS = ["goal_id", "operation_id", "actor_agent_id", "expected_provider_revision"]; +const LOCAL_FIELDS = ["runtime_root", "dry_run"]; + +function mutationRequest(value: unknown, verification: boolean): JsonObject { + const request = canonicalAuthorityObject(value, "acceptance request"); + // The verify operation is registered only for the trusted execution adapter; + // its wire call need not impersonate an owner. Explicit Agent actors fail. + if (verification && !Object.hasOwn(request, "actor_agent_id")) request.actor_agent_id = null; + acceptanceKeys(request, [...REQUEST_FIELDS, ...(verification ? ["contract_digest", "revision", "results"] : ["document"])], + [...LOCAL_FIELDS, ...(verification ? ["todo_id"] : ["disable"])]); + acceptanceRequire(request.actor_agent_id === null, "goal acceptance mutation requires the trusted owner/host; agent actors cannot configure or attest acceptance"); + for (const field of ["goal_id", "operation_id", "expected_provider_revision"]) { + requireAuthorityStoreId(request[field], field); + } + acceptanceText(request.operation_id, "acceptance operation id", 256); + acceptanceRequire(request.dry_run === undefined || typeof request.dry_run === "boolean", "dry_run must be boolean"); + if (!verification) acceptanceRequire(request.disable === undefined || typeof request.disable === "boolean", "disable must be boolean"); + return request; +} +function source(store: AuthorityStore, result: JsonObject): JsonObject { + return {...result, source_authority: authorityStoreSourceAuthority(store), + decision_read_from_provider: true, legacy_fallback_used: false}; +} +function failure(reason_code: string, reason: string): JsonObject & {schema_version: typeof RESULT_SCHEMA} { + return {schema_version: RESULT_SCHEMA, status: "failed", changed: false, reason_code, reason}; +} +function receiptFor(request: JsonObject, kind: "configure" | "verify") { + // Transport location and dry-run are not operation content. Everything else, + // including the exact supplied document/results and expected CAS, is bound. + const content = Object.fromEntries(Object.entries(request).filter(([key]) => !LOCAL_FIELDS.includes(key))); + const identity = {schema_version: RECEIPT_SCHEMA, operation_id: String(request.operation_id), + goal_id: String(request.goal_id), request_sha256: canonicalAuthoritySha256({kind, ...content})}; + const receipt = new CoordinationCommandReceipt({result_schema: RESULT_SCHEMA, identity, failure, + decode: original => ({fields: canonicalAuthorityObject(original.result, "acceptance operation result"), changed: true})}); + return {identity, receipt}; +} +async function current(store: AuthorityStore, request: JsonObject): Promise { + const loaded = await store.loadAuthority(); + if (loaded.status !== "loaded") return {...loaded}; + if (loaded.provider_revision !== request.expected_provider_revision) return { + status: "conflict", changed: false, reason_code: "goal_acceptance_provider_revision_mismatch", + conflict_kind: "provider_revision_mismatch", current_provider_revision: loaded.provider_revision}; + acceptanceTodos(loaded.head, String(request.goal_id)); + return loaded; +} +function loaded(value: AuthorityStoreHead | JsonObject): value is AuthorityStoreHead { + return "status" in value && value.status === "loaded"; +} +async function commit(store: AuthorityStore, request: JsonObject, head: AuthorityStoreHead, + state: AcceptanceState | null, command: ReturnType, kind: "configure" | "verify"): Promise { + const next = {...head.head}; + if (state !== null) next.goal_acceptance = state; + const result = {goal_id: request.goal_id, operation_id: request.operation_id, + goal_acceptance_contract: projectGoalAcceptance(next, String(request.goal_id))}; + if (request.dry_run === true) return source(store, {status: "planned", dry_run: true, changed: false, + provider_revision: head.provider_revision, ...result}); + const committed = await command.receipt.commit(store, { + operation_id: String(request.operation_id), expected_provider_revision: String(request.expected_provider_revision), + next_projection: next, + events: [{schema_version: RECEIPT_SCHEMA, kind: `goal_acceptance_${kind}`, goal_id: request.goal_id, + operation_id: request.operation_id, revision: state?.revision ?? null, digest: state?.digest ?? null, + enabled: state?.enabled ?? false}], + receipts: [{...command.identity, result}], + }); + // No Todo/Markdown display document changes in this transaction. + return source(store, {...committed, projection_delivery: "not_required"}); +} + +export async function configureGoalAcceptance(store: AuthorityStore, value: JsonObject): Promise { + const request = mutationRequest(value, false); + const disable = request.disable === true || request.document === null; + acceptanceRequire(!disable || request.document === null, "disable requires document:null"); + const document = disable ? null : normalizeGoalAcceptanceDocument(request.document); + const command = receiptFor(request, "configure"); + const replay = await command.receipt.read(store); + if (replay) return source(store, {...replay, projection_delivery: "not_required"}); + const head = await current(store, request); + if (!loaded(head)) return source(store, head); + const previous = readGoalAcceptance(head.head, String(request.goal_id)); + let state: AcceptanceState | null = previous; + if (document) { + const todos = acceptanceTodos(head.head, String(request.goal_id)); + const revision = (previous?.revision ?? 0) + 1; + acceptanceRequire(Number.isSafeInteger(revision), "acceptance revision exhausted"); + const bindings = document.bindings.map(binding => { + const todo = todos.get(binding.todo_id); + acceptanceRequire(todo && todo.role === "agent" && (todo.task_class == null || todo.task_class === "advancement_task"), + "acceptance binding must reference existing Agent advancement work"); + return {...binding, todo_semantic_digest: goalAcceptanceTodoDigest(todo), revision, confirmed_by: "owner" as const}; + }); + state = {schema_version: GOAL_ACCEPTANCE_SCHEMA, enabled: true, revision, + digest: canonicalAuthoritySha256(document), document, bindings, verification: previous?.verification ?? null}; + } else if (previous) state = {...previous, enabled: false}; + return commit(store, request, head, state, command, "configure"); +} + +/** Host adapter only: results must come from actual execution at this provider + * revision, never an agent-supplied accepted flag. This provides Goal readback; + * Todo completion needs its own fresh execution and atomic completion CAS. */ +export async function commitGoalAcceptanceVerification(store: AuthorityStore, value: JsonObject): Promise { + const request = mutationRequest(value, true); + acceptanceRequire(Number.isSafeInteger(request.revision) && Number(request.revision) > 0 && + typeof request.contract_digest === "string" && /^[a-f0-9]{64}$/.test(request.contract_digest), "invalid verification contract basis"); + const todoId = request.todo_id == null ? null : requireAuthorityStoreId(request.todo_id, "verification todo_id"); + const results = normalizeAcceptanceResults(request.results); + const command = receiptFor(request, "verify"); + const replay = await command.receipt.read(store); + if (replay) return source(store, {...replay, projection_delivery: "not_required"}); + const head = await current(store, request); + if (!loaded(head)) return source(store, head); + const goalId = String(request.goal_id); + const state = readGoalAcceptance(head.head, goalId); + acceptanceRequire(state?.enabled, "goal acceptance is disabled"); + if (state.revision !== request.revision || state.digest !== request.contract_digest) return source(store, + failure("goal_acceptance_contract_stale", "acceptance contract changed while validation ran")); + let criterionIds = state.document.criteria.map(item => item.id); + if (todoId !== null) { + const task = acceptanceTask(todoId, acceptanceTodos(head.head, goalId).get(todoId), state); + acceptanceRequire(task.state === "ready", task.reason_code); + criterionIds = task.criterion_ids; + } + normalizeAcceptanceResults(results, criterionIds); + const verification: AcceptanceVerification = {operation_id: String(request.operation_id), + contract_revision: state.revision, contract_digest: state.digest, todo_id: todoId, + work_digest: goalAcceptanceWorkDigest(head.head, goalId), results}; + return commit(store, request, head, {...state, verification}, command, "verify"); +} + +/** Private readback. Only goal_acceptance_contract is safe to project publicly. */ +export async function inspectGoalAcceptance(store: AuthorityStore, goalId: string, todoId?: string): Promise { + const head = await store.loadAuthority(); + if (head.status !== "loaded") return source(store, {...head}); + const todos = acceptanceTodos(head.head, goalId); + const state = readGoalAcceptance(head.head, goalId); + const tasks = [...todos.entries()].filter(([key]) => todoId === undefined || key === todoId).map(([key, todo]) => ({ + todo_id: key, todo_semantic_digest: goalAcceptanceTodoDigest(todo), + ...(state?.enabled ? acceptanceTask(key, todo, state) : {state: "unbound", criterion_ids: [], applicable: false}), + })); + return source(store, {status: "loaded", provider_revision: head.provider_revision, + revision: state?.revision ?? null, contract_digest: state?.digest ?? null, + contract: state?.enabled ? state.document : null, tasks, + goal_acceptance_contract: projectGoalAcceptance(head.head, goalId)}); +} + +async function local(value: unknown, kind: "inspect" | "configure" | "verify"): Promise { + let store: AuthorityStore | undefined; + try { + const request = canonicalAuthorityObject(value, "local acceptance request"); + const root = requireAuthorityStoreId(request.runtime_root, "runtime_root"); + acceptanceRequire(isAbsolute(root), "runtime_root must be absolute"); + const goalId = requireAuthorityStoreId(request.goal_id, "goal_id"); + const run = async () => { + store = await openLocalAuthorityStore(root, goalId); + if (kind === "inspect") return inspectGoalAcceptance(store, goalId, + request.todo_id == null ? undefined : requireAuthorityStoreId(request.todo_id, "todo_id")); + return kind === "configure" ? configureGoalAcceptance(store, request) : commitGoalAcceptanceVerification(store, request); + }; + return kind === "inspect" ? await run() : await withCanonicalWriter(root, goalId, request.dry_run === true, run); + } catch (error) { + const result = {...failure(error instanceof AuthorityStoreProtocolError ? "goal_acceptance_invalid_request" : "goal_acceptance_effect_failed", + error instanceof Error ? error.message : "acceptance effect failed"), + decision_read_from_provider: false, legacy_fallback_used: false, ...localAuthorityOpenFailure(error)}; + return store ? {...result, source_authority: authorityStoreSourceAuthority(store)} : result; + } +} +export async function inspectLocalGoalAcceptance(value: unknown): Promise { + return local(value, "inspect"); +} +export async function commitLocalGoalAcceptance(value: unknown): Promise { + return local(value, "configure"); +} +export async function commitLocalGoalAcceptanceVerification(value: unknown): Promise { + return local(value, "verify"); +} diff --git a/loopx/control_plane/goals/acceptance_contract.ts b/loopx/control_plane/goals/acceptance_contract.ts new file mode 100644 index 0000000000..20b62ff27e --- /dev/null +++ b/loopx/control_plane/goals/acceptance_contract.ts @@ -0,0 +1,331 @@ +/** Owner-configured acceptance basis. This is neither a permission grant nor + * the full shared Goal intent/amendment authority. The Todo manifest is unchanged. */ +import type {JsonObject} from "../effect_program.ts"; +import {AuthorityStoreProtocolError, authorityUnicodeCompare, canonicalAuthorityBytes, + canonicalAuthorityObject, canonicalAuthoritySha256} from "../coordination/authority_store_codec.ts"; +import {indexCoordinationProjectionTodos, validateCoordinationTodoReadModel} from "../coordination/coordination_projection.ts"; + +export const GOAL_ACCEPTANCE_SCHEMA = "loopx_goal_acceptance_v0"; +export interface AcceptanceCriterion extends JsonObject { + id: string; + description: string; + validation_argv: string[]; + validation_timeout_seconds: number; + validation_files: {path: string; sha256: string}[]; +} +export interface AcceptanceDocument extends JsonObject { + objective: string; + non_goals: string[]; + criteria: AcceptanceCriterion[]; + bindings: {todo_id: string; criterion_ids: string[]}[]; +} +export interface AcceptanceBinding extends JsonObject { + todo_id: string; + todo_semantic_digest: string; + revision: number; + criterion_ids: string[]; + confirmed_by: "owner"; +} +export interface AcceptanceResult extends JsonObject { + criterion_id: string; + passed: boolean; + exit_code: number | null; +} +export interface AcceptanceVerification extends JsonObject { + operation_id: string; + contract_revision: number; + contract_digest: string; + work_digest: string; + todo_id: string | null; + results: AcceptanceResult[]; +} +export interface AcceptanceState extends JsonObject { + schema_version: typeof GOAL_ACCEPTANCE_SCHEMA; + enabled: boolean; + revision: number; + digest: string; + document: AcceptanceDocument; + bindings: AcceptanceBinding[]; + verification: AcceptanceVerification | null; +} +export type AcceptanceBindingState = "ready" | "unbound" | "stale"; +export interface AcceptanceTask extends JsonObject { + todo_id: string; + state: AcceptanceBindingState; + criterion_ids: string[]; + reason: string; + reason_code: string; + applicable: boolean; +} +export interface AcceptanceCompletionRequirements extends JsonObject { + contract_revision: number; + contract_digest: string; + todo_id: string; + todo_semantic_digest: string; + criterion_ids: string[]; + criteria: AcceptanceCriterion[]; +} + +export function acceptanceRequire(condition: unknown, message: string): asserts condition { + if (!condition) throw new AuthorityStoreProtocolError(message); +} +export function acceptanceKeys(value: JsonObject, required: readonly string[], optional: readonly string[] = []): void { + acceptanceRequire(required.every(key => Object.hasOwn(value, key)) && + Object.keys(value).every(key => required.includes(key) || optional.includes(key)), "acceptance fields are missing or unsupported"); +} +export function acceptanceText(value: unknown, label: string, limit = 4096): string { + acceptanceRequire(typeof value === "string" && value.trim().length > 0 && + value.length <= limit && !value.includes("\0"), `${label} must be nonempty bounded text`); + return value.trim(); +} +function id(value: unknown): string { + const result = acceptanceText(value, "acceptance identifier", 128); + acceptanceRequire(result === value && /^[A-Za-z0-9][A-Za-z0-9_.-]*$/.test(result), "acceptance identifier must be a safe token"); + return result; +} +function list(value: unknown, label: string, max: number, min = 0): unknown[] { + acceptanceRequire(Array.isArray(value) && value.length >= min && value.length <= max, `${label} has invalid size`); + return value; +} +function unique(values: string[], label: string): string[] { + acceptanceRequire(new Set(values).size === values.length, `${label} contains duplicate identifiers`); + return values.sort(authorityUnicodeCompare); +} + +/** Explicit file pins only. The host checks repository containment and bytes + * before/after execution; pins do not attest transitive imports or dependencies. */ +function validationFiles(value: unknown): {path: string; sha256: string}[] { + const files = list(value, "validation files", 16).map(value => { + const file = canonicalAuthorityObject(value, "validation file"); + acceptanceKeys(file, ["path", "sha256"]); + const path = acceptanceText(file.path, "validation file path", 1024); + acceptanceRequire(path === file.path && /^[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*$/.test(path) && + path.split("/").every(part => part !== "." && part !== ".."), + "validation file path must be repository-relative with safe path segments; absolute paths, backslashes and dot segments are forbidden"); + acceptanceRequire(typeof file.sha256 === "string" && /^[a-fA-F0-9]{64}$/.test(file.sha256), + "validation file sha256 must contain exactly 64 hexadecimal characters"); + return {path, sha256: file.sha256.toLowerCase()}; + }); + unique(files.map(file => file.path), "validation file paths"); + return files.sort((left, right) => authorityUnicodeCompare(left.path, right.path)); +} + +export function normalizeGoalAcceptanceDocument(value: unknown): AcceptanceDocument { + const raw = canonicalAuthorityObject(value, "acceptance document"); + acceptanceKeys(raw, ["objective", "non_goals", "criteria", "bindings"]); + acceptanceRequire(canonicalAuthorityBytes(raw).length <= 262144, "acceptance document exceeds byte limit"); + const criteria = list(raw.criteria, "acceptance criteria", 64, 1).map(value => { + const item = canonicalAuthorityObject(value, "acceptance criterion"); + acceptanceKeys(item, ["id", "description", "validation_argv"], ["validation_timeout_seconds", "validation_files"]); + const argv = list(item.validation_argv, "validation argv", 128, 1).map(arg => { + acceptanceRequire(typeof arg === "string" && arg.length > 0 && arg.length <= 8192 && !arg.includes("\0"), "validation argv contains an invalid argument"); + return arg; + }); + acceptanceRequire(argv[0].trim().length > 0, "validation argv requires an executable"); + const timeout = item.validation_timeout_seconds ?? 5; + acceptanceRequire(Number.isSafeInteger(timeout) && Number(timeout) >= 1 && Number(timeout) <= 25, "validation timeout must be 1..25 seconds"); + return {id: id(item.id), description: acceptanceText(item.description, "criterion description"), + validation_argv: argv, validation_timeout_seconds: Number(timeout), + validation_files: validationFiles(item.validation_files === undefined ? [] : item.validation_files)}; + }).sort((a, b) => authorityUnicodeCompare(a.id, b.id)); + acceptanceRequire(criteria.reduce((total, item) => total + item.validation_timeout_seconds, 0) <= 25, + "acceptance validation timeouts must total at most 25 seconds (default 5 seconds per criterion); lower the timeouts or run longer evaluations outside the completion wrapper"); + const criterionIds = unique(criteria.map(item => item.id), "criteria"); + const bindings = list(raw.bindings, "acceptance bindings", 4096).map(value => { + const item = canonicalAuthorityObject(value, "acceptance binding"); + acceptanceKeys(item, ["todo_id", "criterion_ids"]); + const criterion_ids = unique(list(item.criterion_ids, "binding criteria", 64, 1).map(id), "binding criteria"); + acceptanceRequire(criterion_ids.every(key => criterionIds.includes(key)), "binding references an unknown criterion"); + return {todo_id: id(item.todo_id), criterion_ids}; + }).sort((a, b) => authorityUnicodeCompare(a.todo_id, b.todo_id)); + unique(bindings.map(item => item.todo_id), "bindings"); + return {objective: acceptanceText(raw.objective, "acceptance objective"), + non_goals: list(raw.non_goals, "non-goals", 64).map(item => acceptanceText(item, "non-goal", 2048)), criteria, bindings}; +} + +// Exact field classification, never prose/substring relevance. Unknown future +// domain fields remain digest inputs by default. Execution observations and +// presentation must not revoke a confirmed work declaration. +const NON_WORK_FIELDS = new Set([ + "schema_version", "source_section", "index", "title", "priority", "status", "done", "archive_state", + "claimed_by", "created_by", "last_actor_agent_id", "updated_at", "completed_at", "completion_turn_key", + "completion_validation_sha256", "completion_recovery", "completion_continuation", "decision_outcome", + "decision_scope_outcomes", "note", "evidence", "reason", "handoff_note", "resume_ready", + "resume_monitor_generation", "last_checked_at", "result_hash", "consecutive_no_change", + "material_change", "material_change_generation", "monitor_effect_id", +]); +export function goalAcceptanceTodoDigest(todo: JsonObject): string { + return canonicalAuthoritySha256(Object.fromEntries(Object.entries(todo).filter(([key]) => !NON_WORK_FIELDS.has(key)))); +} +function advancement(todo: JsonObject): boolean { + return todo.role === "agent" && (todo.task_class == null || todo.task_class === "advancement_task"); +} +export function acceptanceApplies(todo: JsonObject): boolean { + return advancement(todo) && todo.archive_state === "active" && + (todo.status === "open" || todo.status === "blocked") && todo.done === false; +} +export function acceptanceTodos(head: JsonObject, goalId: string): ReadonlyMap { + validateCoordinationTodoReadModel(head, goalId); + return indexCoordinationProjectionTodos(head, goalId).todos; +} +export function goalAcceptanceWorkDigest(head: JsonObject, goalId: string): string { + // This semantic fingerprint is independent of provider row representation. + // Projection and mutation callers separately validate the canonical read model. + return canonicalAuthoritySha256([...indexCoordinationProjectionTodos(head, goalId).todos.values()].filter(advancement) + .sort((left, right) => authorityUnicodeCompare(String(left.todo_id), String(right.todo_id))) + .map(todo => ({todo_id: todo.todo_id, digest: goalAcceptanceTodoDigest(todo)}))); +} + +/** Absent is the sole legacy/off shortcut; malformed present state fails closed. */ +export function readGoalAcceptance(head: JsonObject, goalId: string): AcceptanceState | null { + if (!Object.hasOwn(head, "goal_acceptance")) return null; + acceptanceRequire(head.goal_id === goalId, "acceptance Goal identity mismatch"); + const state = canonicalAuthorityObject(head.goal_acceptance, "goal_acceptance"); + acceptanceKeys(state, ["schema_version", "enabled", "revision", "digest", "document", "bindings", "verification"]); + acceptanceRequire(state.schema_version === GOAL_ACCEPTANCE_SCHEMA && typeof state.enabled === "boolean" && + Number.isSafeInteger(state.revision) && Number(state.revision) > 0, "invalid acceptance state version"); + const document = normalizeGoalAcceptanceDocument(state.document); + acceptanceRequire(state.digest === canonicalAuthoritySha256(document), "acceptance contract digest mismatch"); + const bindings = list(state.bindings, "canonical bindings", 4096).map(value => { + const binding = canonicalAuthorityObject(value, "canonical binding"); + acceptanceKeys(binding, ["todo_id", "todo_semantic_digest", "revision", "criterion_ids", "confirmed_by"]); + const declared = document.bindings.find(item => item.todo_id === binding.todo_id); + acceptanceRequire(declared && binding.confirmed_by === "owner" && binding.revision === state.revision && + typeof binding.todo_semantic_digest === "string" && /^[a-f0-9]{64}$/.test(binding.todo_semantic_digest) && + canonicalAuthoritySha256(binding.criterion_ids) === canonicalAuthoritySha256(declared.criterion_ids), "invalid owner-confirmed acceptance binding"); + return binding as AcceptanceBinding; + }); + unique(bindings.map(binding => binding.todo_id), "canonical bindings"); + acceptanceRequire(bindings.length === document.bindings.length, "canonical bindings omit declared work"); + let verification: AcceptanceVerification | null = null; + if (state.verification !== null) { + const receipt = canonicalAuthorityObject(state.verification, "acceptance verification"); + acceptanceKeys(receipt, ["operation_id", "contract_revision", "contract_digest", "work_digest", "todo_id", "results"]); + const operationId = acceptanceText(receipt.operation_id, "verification operation id", 256); + acceptanceRequire(operationId === receipt.operation_id, "verification operation id must be trimmed"); + acceptanceRequire(Number.isSafeInteger(receipt.contract_revision) && Number(receipt.contract_revision) > 0 && + Number(receipt.contract_revision) <= Number(state.revision) && + [receipt.contract_digest, receipt.work_digest].every(value => typeof value === "string" && /^[a-f0-9]{64}$/.test(value)), + "invalid verification basis"); + const todoId = receipt.todo_id === null ? null : id(receipt.todo_id); + // Historical receipts can name retired criteria. Current acceptance checks + // require exact coverage even for failed or task-scoped verification. + let expectedIds: string[] | undefined; + if (receipt.contract_revision === state.revision) { + acceptanceRequire(receipt.contract_digest === state.digest, "current verification contract digest mismatch"); + expectedIds = todoId === null ? document.criteria.map(item => item.id) + : bindings.find(binding => binding.todo_id === todoId)?.criterion_ids; + acceptanceRequire(expectedIds, "current verification references an unbound Todo"); + } + verification = {...receipt, operation_id: operationId, todo_id: todoId, + results: normalizeAcceptanceResults(receipt.results, expectedIds)} as AcceptanceVerification; + } + return {...state, document, bindings, verification} as AcceptanceState; +} + +export function acceptanceTask(todoId: string, todo: JsonObject | undefined, state: AcceptanceState): AcceptanceTask { + const binding = state.bindings.find(item => item.todo_id === todoId); + const reason_code = !binding ? "goal_acceptance_unbound" : !todo || binding.todo_semantic_digest !== goalAcceptanceTodoDigest(todo) + ? "goal_acceptance_stale" : "goal_acceptance_ready"; + return {todo_id: todoId, state: !binding ? "unbound" : reason_code === "goal_acceptance_stale" ? "stale" : "ready", + criterion_ids: binding?.criterion_ids ?? [], reason_code, + reason: !binding ? "Owner confirmation is required for this work's acceptance association." + : reason_code === "goal_acceptance_stale" ? "Work changed after owner confirmation; confirm its current acceptance association." + : "The owner confirmed this work's current acceptance association.", + applicable: todo !== undefined && acceptanceApplies(todo)}; +} + +export function normalizeAcceptanceResults(value: unknown, expectedIds?: readonly string[]): AcceptanceResult[] { + const results = list(value, "verification results", 64, 1).map(value => { + const item = canonicalAuthorityObject(value, "verification result"); + // Existing caller-validation runner metadata is accepted at the host seam + // but deliberately not persisted or projected (labels can contain context). + acceptanceKeys(item, ["criterion_id", "passed", "exit_code"], ["schema_version", "command_label", "status", "summary", + "stdout_captured", "stderr_captured", "local_path_captured"]); + for (const key of ["stdout_captured", "stderr_captured", "local_path_captured"]) { + acceptanceRequire(item[key] === undefined || item[key] === false, "validation result must not capture private output or paths"); + } + acceptanceRequire(typeof item.passed === "boolean" && (item.exit_code === null || + (Number.isSafeInteger(item.exit_code) && Number(item.exit_code) >= 0 && Number(item.exit_code) <= 255)), "invalid verification result"); + acceptanceRequire(item.passed === (item.exit_code === 0), "criterion pass/fail must agree with exit code zero"); + return {criterion_id: id(item.criterion_id), passed: item.passed, exit_code: item.exit_code as number | null}; + }).sort((a, b) => authorityUnicodeCompare(a.criterion_id, b.criterion_id)); + const ids = unique(results.map(item => item.criterion_id), "verification results"); + if (expectedIds) acceptanceRequire(canonicalAuthoritySha256(ids) === canonicalAuthoritySha256([...expectedIds].sort(authorityUnicodeCompare)), + "verification results must cover exactly the required criteria"); + return results; +} + +export function projectGoalAcceptance(head: JsonObject, goalId: string): JsonObject { + const state = readGoalAcceptance(head, goalId); + if (!state?.enabled) return {enabled: false}; + const todos = acceptanceTodos(head, goalId); + const taskIds = new Set([...todos.values()].filter(advancement).map(todo => String(todo.todo_id))); + for (const binding of state.bindings) taskIds.add(binding.todo_id); + const tasks = [...taskIds].sort(authorityUnicodeCompare).map(key => acceptanceTask(key, todos.get(key), state)); + const held = tasks.filter(task => task.applicable && task.state !== "ready"); + const receipt = state.verification; + let status = "unverified"; + if (receipt) { + if (receipt.contract_revision !== state.revision || receipt.contract_digest !== state.digest || + receipt.work_digest !== goalAcceptanceWorkDigest(head, goalId)) status = "stale"; + else if (receipt.results.some(item => !item.passed)) status = "failed"; + else if (receipt.todo_id !== null) status = "partial"; + else status = "accepted"; + } + if (held.length) status = "held"; + return {enabled: true, revision: state.revision, digest: state.digest, objective: state.document.objective, + non_goals: state.document.non_goals, criteria: state.document.criteria.map(({id, description}) => ({id, description})), + tasks, held_todo_ids: held.map(task => task.todo_id), status, + verification: receipt ? {operation_id: receipt.operation_id, contract_revision: receipt.contract_revision, + contract_digest: receipt.contract_digest, todo_id: receipt.todo_id, results: receipt.results} : null}; +} + +/** An owner-confirmed binding governs its work until the owner changes it. + * Mutable Todo fields can make a binding stale; they must not make it + * inapplicable, or the guarded party could edit its way out of the guard. */ +function acceptanceBound(state: AcceptanceState, todoId: string): boolean { + return state.bindings.some(binding => binding.todo_id === todoId); +} + +export function acceptanceWorkGuard(head: JsonObject, goalId: string, todoId: string): JsonObject | null { + const state = readGoalAcceptance(head, goalId); + if (!state?.enabled) return null; + const todo = acceptanceTodos(head, goalId).get(todoId); + if (todo && !acceptanceApplies(todo) && !acceptanceBound(state, todoId)) return null; + const task = acceptanceTask(todoId, todo, state); + return {allowed: task.state === "ready", ...task, revision: state.revision, digest: state.digest}; +} + +/** Trusted execution adapter only. Run these commands at the inspected provider + * revision and commit fresh results with completion in that same provider CAS. */ +export function acceptanceCompletionRequirements(head: JsonObject, goalId: string, todoId: string): AcceptanceCompletionRequirements | null { + const state = readGoalAcceptance(head, goalId); + if (!state?.enabled) return null; + const todo = acceptanceTodos(head, goalId).get(todoId); + acceptanceRequire(todo, "acceptance completion Todo is missing"); + // Applicability follows the owner's binding, not the Todo's current shape: + // `acceptanceApplies` reads task_class and status, which the guarded party + // may rewrite. Its remaining job is to decide which *unbound* work must be + // held, so it stays as the fallback for Todos the owner never bound. + if (!acceptanceApplies(todo) && !acceptanceBound(state, todoId)) return null; + const task = acceptanceTask(todoId, todo, state); + acceptanceRequire(task.state === "ready", task.reason_code); + return {contract_revision: state.revision, contract_digest: state.digest, todo_id: todoId, + todo_semantic_digest: goalAcceptanceTodoDigest(todo), criterion_ids: task.criterion_ids, + criteria: state.document.criteria.filter(item => task.criterion_ids.includes(item.id))}; +} + +/** This validates fresh host execution evidence, not a saved success receipt. + * Host identity and the pre-execution provider CAS are enforced by the caller. */ +export function validateAcceptanceCompletion(head: JsonObject, goalId: string, todoId: string, value: unknown): JsonObject | null { + const requirements = acceptanceCompletionRequirements(head, goalId, todoId); + if (!requirements) return null; + const receipt = canonicalAuthorityObject(value, "acceptance completion evidence"); + acceptanceKeys(receipt, ["contract_revision", "contract_digest", "todo_id", "todo_semantic_digest", "results"]); + acceptanceRequire(["contract_revision", "contract_digest", "todo_id", "todo_semantic_digest"].every(key => receipt[key] === requirements[key]), + "acceptance completion basis changed"); + const results = normalizeAcceptanceResults(receipt.results, requirements.criterion_ids); + acceptanceRequire(results.every(item => item.passed), "acceptance completion criteria failed"); + return {...receipt, results}; +} diff --git a/loopx/control_plane/goals/acceptance_observation.py b/loopx/control_plane/goals/acceptance_observation.py index e60e23133b..d9e5291e0b 100644 --- a/loopx/control_plane/goals/acceptance_observation.py +++ b/loopx/control_plane/goals/acceptance_observation.py @@ -204,6 +204,11 @@ def build_goal_acceptance_observation( sources_missing.append("todo_projection") if item.get("stale_latest_run_warning"): sources_missing.append("current_run") + acceptance_contract = next((candidate for candidate in ( + item.get("goal_acceptance_contract"), asset.get("goal_acceptance_contract"), + _dict(item.get("agent_todos")).get("goal_acceptance_contract"), + _dict(asset.get("agent_todos")).get("goal_acceptance_contract"), + ) if isinstance(candidate, dict) and candidate.get("enabled") is True), None) return { "schema_version": GOAL_ACCEPTANCE_OBSERVATION_SCHEMA_VERSION, "goal_id": goal_id, @@ -219,6 +224,9 @@ def build_goal_acceptance_observation( asset.get("next_action") or item.get("recommended_action") ), "next_action_source": "attention_queue" if item else None, + # Executed configured checks are narrower than independent Goal + # acceptance. Keep acceptance_assessed false and preserve their basis. + **({"goal_acceptance_contract": acceptance_contract} if acceptance_contract is not None else {}), } diff --git a/loopx/control_plane/quota/should_run.py b/loopx/control_plane/quota/should_run.py index 66f052a7c7..b938f51d0e 100644 --- a/loopx/control_plane/quota/should_run.py +++ b/loopx/control_plane/quota/should_run.py @@ -89,6 +89,30 @@ def _apply_selected_todo_guards( work_lane_contract=route.payload_work_lane_contract, agent_scope_frontier=route.agent_scope_frontier, ) + summary = prepared.agent_todo_summary or {} + acceptance = summary.get("goal_acceptance_contract") + if isinstance(acceptance, dict) and acceptance.get("enabled") is True: + held_ids = acceptance.get("held_todo_ids") or [] + held_selection = bool(selected_todo and selected_todo.get("todo_id") in held_ids) + # Native guards already filtered these lanes. Do not let a generic + # Goal recommendation recreate advancement permission from held work. + no_runnable_work = bool(held_ids) and not selected_todo and not any( + summary.get(field) for field in ( + "first_executable_items", "executable_backlog_items", "monitor_due_items", + ) + ) + if ( + (route.normal_delivery_allowed or route.recovery_allowed) + and not prepared.inbox_priority_due + and (held_selection or no_runnable_work) + ): + prepared.normal_delivery_allowed = False + prepared.recovery_allowed = False + prepared.reason = ( + "Goal acceptance holds the current work; inspect its contract and " + "ask the owner to configure or rebind the current Todo." + ) + route = _resolve_quota_route_with_settled_replay_precedence(prepared) workspace_guard = None if not prepared.inbox_priority_due: workspace_guard = build_agent_workspace_guard( diff --git a/loopx/control_plane/todos/active_state_todos.py b/loopx/control_plane/todos/active_state_todos.py index 51f470bd4e..8b89737773 100644 --- a/loopx/control_plane/todos/active_state_todos.py +++ b/loopx/control_plane/todos/active_state_todos.py @@ -132,7 +132,9 @@ def active_state_todo_fields( rollout_events=rollout_events, ) if canonical is not None: - fields = canonical_todo_summary_fields(canonical["todos"], rollout_events=rollout_events) + fields = canonical_todo_summary_fields(canonical["todos"], rollout_events=rollout_events, + goal_acceptance_contract=canonical.get("goal_acceptance_contract"), + goal_acceptance_work_guards=canonical.get("goal_acceptance_work_guards")) # Canonical observation/successor transactions now support current # lease proof. Scheduling exposes due work; mutation admission still # validates the caller's proof and never falls back to the old writer. diff --git a/loopx/control_plane/todos/provider_terminal_lifecycle.py b/loopx/control_plane/todos/provider_terminal_lifecycle.py index 0c4337d53d..576a316ddc 100644 --- a/loopx/control_plane/todos/provider_terminal_lifecycle.py +++ b/loopx/control_plane/todos/provider_terminal_lifecycle.py @@ -430,15 +430,37 @@ def terminal_canonical_todo_if_promoted( ) if isinstance(result, Mapping) and result.get("status") == "execute_validation": effect = result.get("validation_effect") - if not isinstance(effect, Mapping): + acceptance_effects = result.get("goal_acceptance_validation_effects") + if not isinstance(effect, Mapping) and not isinstance(acceptance_effects, list): raise RuntimeError("Todo terminal validation effect shape mismatch") - request["validation_receipt"] = run_declared_completion_validation_effect( - effect=effect, - registry_path=registry_path, - goal_id=goal_id, - delivery_workspace=completion_delivery_workspace, - validation_workspace_path=completion_validation_workspace_path, - ) + if isinstance(effect, Mapping): + request["validation_receipt"] = run_declared_completion_validation_effect( + effect=effect, + registry_path=registry_path, + goal_id=goal_id, + delivery_workspace=completion_delivery_workspace, + validation_workspace_path=completion_validation_workspace_path, + ) + if acceptance_effects is not None: + from ..goals.acceptance import run_goal_acceptance_validation_effect + + if not isinstance(acceptance_effects, list) or not acceptance_effects: + raise RuntimeError("Goal acceptance validation effects are missing") + source_binding = result.get("goal_acceptance_source_binding") + if not isinstance(source_binding, Mapping): + raise RuntimeError("Goal acceptance validation omitted its source basis") + receipts = [] + for row in acceptance_effects: + if not isinstance(row, Mapping) or not isinstance(row.get("effect"), Mapping): + raise RuntimeError("Goal acceptance validation effect shape mismatch") + receipt = run_goal_acceptance_validation_effect( + effect=row["effect"], registry_path=registry_path, goal_id=goal_id, + delivery_workspace=completion_delivery_workspace, + validation_workspace_path=completion_validation_workspace_path, + ) + receipts.append({"criterion_id": row.get("criterion_id"), "receipt": receipt}) + request["goal_acceptance_source_binding"] = dict(source_binding) + request["goal_acceptance_validation_receipts"] = receipts result = effect_runtime_result( "coordination.local_authority.todo_terminal", request ) diff --git a/loopx/control_plane/todos/quota_summary.py b/loopx/control_plane/todos/quota_summary.py index 58ac727a9c..30a16d2e26 100644 --- a/loopx/control_plane/todos/quota_summary.py +++ b/loopx/control_plane/todos/quota_summary.py @@ -43,6 +43,7 @@ "agent_lane_status_todo_reference_v0" ) QUOTA_PAYLOAD_ITEM_FIELDS = ( + "goal_acceptance_guard", "schema_version", "index", "text", @@ -412,6 +413,8 @@ def summarize_user_todos_for_quota( "backlog_items": lanes.display_open_items[:TODO_BACKLOG_ITEM_LIMIT], "executable_backlog_items": lanes.executable_items[:TODO_BACKLOG_ITEM_LIMIT], } + if isinstance(value.get("goal_acceptance_contract"), dict): + summary["goal_acceptance_contract"] = value["goal_acceptance_contract"] if isinstance(value.get("advancement_frontier_revision_index"), dict): summary["advancement_frontier_revision_index"] = value[ "advancement_frontier_revision_index" diff --git a/loopx/control_plane/todos/summary_item.py b/loopx/control_plane/todos/summary_item.py index 9f4bbcee61..5e78bac715 100644 --- a/loopx/control_plane/todos/summary_item.py +++ b/loopx/control_plane/todos/summary_item.py @@ -22,6 +22,7 @@ from .frontier_revision import FRONTIER_REVISION_FIELDS TODO_SUMMARY_COMPACT_FIELDS = ( + "goal_acceptance_guard", "schema_version", "todo_id", "role", diff --git a/loopx/control_plane/todos/todo_semantics.py b/loopx/control_plane/todos/todo_semantics.py index f8d2c0e20c..41aa1748e3 100644 --- a/loopx/control_plane/todos/todo_semantics.py +++ b/loopx/control_plane/todos/todo_semantics.py @@ -269,6 +269,9 @@ def todo_item_task_class( def todo_item_is_actionable_open(item: dict[str, Any]) -> bool: + guard = item.get("goal_acceptance_guard") + if isinstance(guard, dict) and guard.get("allowed") is False: + return False return monitor_todo_is_actionable_open(item) diff --git a/loopx/control_plane/todos/todo_summary.py b/loopx/control_plane/todos/todo_summary.py index 38a7fa81d8..a6deeb2a14 100644 --- a/loopx/control_plane/todos/todo_summary.py +++ b/loopx/control_plane/todos/todo_summary.py @@ -458,6 +458,8 @@ def compact_todo_item(item: dict[str, Any]) -> dict[str, Any]: continue if item.get(key) is not None: compact[key] = item.get(key) + if isinstance(item.get("goal_acceptance_guard"), dict): + compact["goal_acceptance_guard"] = item["goal_acceptance_guard"] attach_todo_handoff_note(compact) return compact diff --git a/loopx/presentation/renderers/goal_acceptance_observation_markdown.py b/loopx/presentation/renderers/goal_acceptance_observation_markdown.py index c945209cb8..e256277c85 100644 --- a/loopx/presentation/renderers/goal_acceptance_observation_markdown.py +++ b/loopx/presentation/renderers/goal_acceptance_observation_markdown.py @@ -2,6 +2,7 @@ from __future__ import annotations +import re from typing import Any from ...control_plane.goals.acceptance_observation import ( @@ -10,6 +11,12 @@ from ..markdown import as_dict, as_list, markdown_scalar +def _contract_text(value: Any) -> str: + """Owner-authored text stays literal in the Markdown readback.""" + text = str(value if value is not None else "unknown") + return re.sub(r"([\\`*_{}\[\]<>|#])", r"\\\1", text).replace("\n", " ").replace("\r", " ") + + def append_goal_acceptance_observation_markdown( lines: list[str], goal: dict[str, Any] ) -> None: @@ -27,3 +34,77 @@ def append_goal_acceptance_observation_markdown( f" - owner={markdown_scalar(gap.get('owner') or 'unknown')}: " f"{markdown_scalar(gap.get('evidence_required') or gap.get('reason') or 'unknown')}" ) + contract = as_dict(observation.get("goal_acceptance_contract")) + if contract.get("enabled") is not True: + return + if observation.get("goal_id") != goal.get("id"): + lines.append(" - Goal acceptance contract: source unavailable; acceptance unknown") + return + task_states = { + "ready": "task association confirmed", + "unbound": "task association missing", + "stale": "task association stale", + } + verification_states = { + "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", + } + lines.extend([ + " - Goal acceptance contract (read-only; does not automatically approve or complete the Goal):", + f" - Goal source: {_contract_text(observation.get('goal_id'))}", + f" - contract revision: {_contract_text(contract.get('revision'))}", + f" - contract digest: {_contract_text(contract.get('digest'))}", + f" - objective: {_contract_text(contract.get('objective') or 'unknown')}", + ]) + for non_goal in as_list(contract.get("non_goals")): + lines.append(f" - outside scope: {_contract_text(non_goal)}") + for criterion in as_list(contract.get("criteria")): + if isinstance(criterion, dict): + lines.append( + f" - criterion {_contract_text(criterion.get('id'))}: " + f"{_contract_text(criterion.get('description'))}" + ) + tasks = as_list(contract.get("tasks")) + if not tasks: + lines.append(" - task associations: unknown; no associations reported") + for task in tasks: + if isinstance(task, dict): + criteria = ", ".join(str(value) for value in as_list(task.get("criterion_ids"))) + lines.append( + f" - {_contract_text(task.get('todo_id'))}: " + f"{task_states.get(task.get('state'), 'unknown')}; " + f"criteria={_contract_text(criteria or 'unknown')}" + ) + if task.get("reason"): + lines.append(f" {_contract_text(task['reason'])}") + if task.get("applicable") is False: + lines.append(" outside the current task gate") + verification = as_dict(contract.get("verification")) + lines.append( + f" - artifact verification: {verification_states.get(contract.get('status'), 'unknown')}" + ) + held = as_list(contract.get("held_todo_ids")) + if held: + lines.append(f" - tasks held: {_contract_text(', '.join(str(todo) for todo in held))}") + if not verification: + lines.append(" - recorded artifact checks: unknown") + else: + lines.extend([ + " - recorded artifact checks (historical basis; current status accounts for stale checks and task holds):", + f" - verification reference: {_contract_text(verification.get('operation_id'))}", + f" - contract revision: {_contract_text(verification.get('contract_revision'))}", + f" - contract digest: {_contract_text(verification.get('contract_digest'))}", + f" - verification scope: {_contract_text(verification.get('todo_id') or 'all contract criteria')}", + ]) + for result in as_list(verification.get("results")): + if isinstance(result, dict): + passed = result.get("passed") + state = "passed" if passed is True else "failed" if passed is False else "unknown" + lines.append( + f" - {_contract_text(result.get('criterion_id'))}: {state}; " + f"exit code={_contract_text(result.get('exit_code'))}" + ) diff --git a/loopx/web/chat/asset-retention.json b/loopx/web/chat/asset-retention.json index 818c27292b..17b2d0b455 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-DDnVlcoj.css", - "assets/index-zKDuYlHV.js" + "assets/index-Cbgh0ZGA.css", + "assets/index-DnsV3JwV.js" ], [ "assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2", @@ -28,8 +28,8 @@ "assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2", "assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2", "assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2", - "assets/index-B9n5owdR.js", - "assets/index-wAFS2mYU.css" + "assets/index-DDnVlcoj.css", + "assets/index-zKDuYlHV.js" ] ] } diff --git a/loopx/web/chat/assets/index-Cbgh0ZGA.css b/loopx/web/chat/assets/index-Cbgh0ZGA.css new file mode 100644 index 0000000000..a4697b3ea8 --- /dev/null +++ b/loopx/web/chat/assets/index-Cbgh0ZGA.css @@ -0,0 +1 @@ +.personal-collaboration{border:1px solid var(--color-border,#ebebeb);overflow-wrap:anywhere;border-radius:6px;margin-top:12px;padding:12px 16px}.personal-collaboration header{flex-wrap:wrap;justify-content:space-between;gap:8px;display:flex}.personal-collaboration header span,.personal-collaboration-status{opacity:.75;font-size:12px}.personal-collaboration-status{flex-wrap:wrap;gap:8px 16px;display:flex}.personal-collaboration summary{cursor:pointer;align-content:center;min-height:44px;display:list-item}.personal-collaboration h4{margin:12px 0 4px;font-size:13px}.personal-collaboration p{white-space:pre-wrap}.personal-collaboration ul{padding-left:20px}.personal-collaboration small{font-family:var(--font-mono);font-size:11px;display:block}.personal-collaboration summary:focus-visible{outline:2px solid var(--color-link,#0070f3);outline-offset:2px}.delivery-review{min-width:0;color:var(--pw-text);gap:20px;padding:0;display:grid}.delivery-review h2,.delivery-review h3,.delivery-review h4,.delivery-review p{margin:0}.delivery-review h2{font-size:20px;font-weight:600;line-height:28px}.delivery-review h3{font-size:16px;font-weight:600;line-height:24px}.delivery-review h4{font-size:14px;line-height:20px}.delivery-review p{overflow-wrap:anywhere;line-height:1.6}.delivery-review button,.delivery-review select,.delivery-review input{color:inherit;font:inherit}.delivery-review button,.delivery-review select{border:1px solid var(--pw-line);background:var(--pw-card);cursor:pointer;border-radius:6px;min-height:44px;padding:8px 12px}.delivery-review button:disabled{opacity:.5;cursor:not-allowed}.delivery-review button[aria-pressed=true]{border-color:var(--pw-text);background:var(--pw-hover,var(--pw-card))}.delivery-review :is(button,input,select,summary,[tabindex]):focus-visible{outline:2px solid var(--color-link,#0070f3);outline-offset:3px}.delivery-review-toolbar,.delivery-chain-toolbar{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;display:flex}.delivery-review-toolbar>div,.delivery-chain-toolbar>div,.delivery-source-actions{flex-wrap:wrap;gap:8px;display:flex}.delivery-review-toolbar button,.delivery-source-actions button{align-items:center;gap:8px;display:inline-flex}.delivery-snapshot-time,.delivery-boundary,.delivery-chain-toolbar>span{color:var(--pw-muted);font-size:12px}.delivery-notice{border:1px solid var(--pw-line);border-left:3px solid var(--pw-amber,#a96500);border-radius:6px;padding:12px 16px;font-size:13px}.delivery-notice dl{flex-wrap:wrap;gap:8px 24px;margin:12px 0 0;display:flex}.delivery-notice dl>div{gap:8px;display:flex}.delivery-notice dd{margin:0;font-weight:600}.delivery-chain{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;min-width:0;overflow:hidden}.delivery-chain-toolbar{border-bottom:1px solid var(--pw-line);padding:16px}.delivery-chain-toolbar h3{margin-right:auto}.delivery-filters{border-bottom:1px solid var(--pw-line);flex-wrap:wrap;gap:8px;padding:12px 16px;display:flex}.delivery-filters label{flex:1;align-items:center;gap:8px;min-width:160px;display:flex}.delivery-filters input{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:6px;width:100%;min-width:0;padding:10px 8px}.delivery-map-scroll{overscroll-behavior:contain;max-height:540px;overflow:auto}.delivery-map{width:960px;min-height:172px;position:relative}.delivery-map-heading{color:var(--pw-muted);font-size:12px;font-weight:500;position:absolute;top:16px}.delivery-map svg{color:var(--pw-muted);pointer-events:none;position:absolute;inset:0}.delivery-map svg>path{fill:none;stroke:currentColor;stroke-width:1px;opacity:.3}.delivery-map svg>path.is-related{stroke-width:2px;opacity:1}.delivery-map .delivery-map-node{text-align:left;background:var(--pw-card);border-radius:12px;gap:8px;width:280px;height:100px;padding:12px;display:grid;position:absolute}.delivery-map-node>span{color:var(--pw-muted);justify-content:space-between;align-items:center;font-size:11px;display:flex}.delivery-map-node>strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.delivery-map-node>small{color:var(--pw-muted);white-space:nowrap;text-overflow:ellipsis;font-size:11px;overflow:hidden}.delivery-review em{color:var(--pw-muted);font-size:11px;font-style:normal}.delivery-review em[data-state=blocked],.delivery-review em[data-state=waiting]{color:var(--pw-amber,#a96500)}.delivery-node-list,.delivery-relations{margin:0;padding:0;list-style:none}.delivery-node-list li+li{border-top:1px solid var(--pw-line)}.delivery-node-list button{text-align:left;border-radius:0;grid-template-columns:88px minmax(0,1fr) 120px 72px;align-items:center;gap:12px;width:100%;padding:16px;display:grid}.delivery-node-list strong,.delivery-node-list small{overflow-wrap:anywhere}.delivery-node-list span,.delivery-node-list small{color:var(--pw-muted);font-size:12px}.delivery-node-detail{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;gap:16px;padding:20px;display:grid}.delivery-node-detail header{gap:8px;display:grid}.delivery-node-detail header>span,.delivery-node-detail header>p,.delivery-source-actions p{color:var(--pw-muted);font-size:12px}.delivery-node-detail summary{cursor:pointer;min-height:44px;padding-top:12px}.delivery-node-detail code,.delivery-node-detail details p{overflow-wrap:anywhere;font-size:12px}.delivery-relations{gap:12px;display:grid}.delivery-relations li{border-bottom:1px solid var(--pw-line);padding-bottom:12px}.delivery-relations li>div{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:8px;display:grid}.delivery-relations button{text-align:left;overflow-wrap:anywhere;font-size:12px}.delivery-relations span{align-items:center;gap:4px;font-size:11px;display:flex}.delivery-relations p{color:var(--pw-muted);padding-top:8px;font-size:12px}.delivery-empty{padding:24px}.delivery-acceptance-contract{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;min-width:0}.delivery-acceptance-contract summary{cursor:pointer;min-height:44px;padding:12px 16px;font-weight:500}.delivery-acceptance-content{gap:16px;padding:0 16px 16px;font-size:14px;display:grid}.delivery-acceptance-content ul{margin:0;padding-left:20px}.delivery-acceptance-content :is(li,dd,code){overflow-wrap:anywhere}.delivery-acceptance-source{gap:8px;margin:0;display:grid}.delivery-acceptance-source>div{grid-template-columns:minmax(100px,1fr) minmax(0,3fr);gap:12px;display:grid}.delivery-acceptance-source dt{color:var(--pw-muted)}.delivery-acceptance-source dd{margin:0}.delivery-acceptance-content code{font-family:var(--font-mono);font-size:12px}.delivery-acceptance-tasks{gap:12px;display:grid}.delivery-acceptance-content details{border-top:1px solid var(--pw-line)}.delivery-acceptance-content details summary{padding-left:0}.delivery-acceptance-content a{color:var(--color-link,#0070f3);text-decoration:underline}.delivery-acceptance-content a:focus-visible{outline:2px solid var(--color-link,#0070f3);outline-offset:3px}@media (width<=640px){.delivery-review{gap:16px}.delivery-review-toolbar>div{width:100%}.delivery-review-toolbar button{flex:1;justify-content:center;font-size:12px}.delivery-filters label{flex-basis:100%}.delivery-filters select{flex:1;min-width:0}.delivery-node-list button{grid-template-columns:minmax(0,1fr) auto;gap:8px}.delivery-node-list strong{grid-column:1/-1}.delivery-relations li>div{grid-template-columns:minmax(0,1fr)}.delivery-node-detail{padding:16px}}.delivery-notice summary{cursor:pointer;min-height:24px}.personal-goal-view-panel{min-width:0}.personal-goal-view-panel[hidden]{display:none}.personal-goal-view-panel[data-goal-panel=tasks]{height:100%}.goal-overview{gap:24px;min-width:0;display:grid}.goal-overview h2,.goal-overview h3,.goal-overview p{margin:0}.goal-overview h2{font-size:20px;font-weight:600}.goal-overview h3{font-size:14px;font-weight:600}.goal-overview button{border:1px solid var(--pw-line);background:var(--pw-card);min-height:40px;color:var(--pw-text);font:inherit;cursor:pointer;text-align:left;border-radius:6px;align-items:center;gap:8px;padding:8px 12px;display:inline-flex}.goal-overview button:focus-visible{outline:2px solid var(--pw-blue);outline-offset:3px}.goal-overview-heading,.goal-overview-summary header{justify-content:space-between;align-items:center;gap:16px;display:flex}.goal-overview-heading button,.goal-overview-summary header span{color:var(--pw-muted);font-size:12px}.goal-overview-summary{grid-template-columns:1fr 1fr;gap:20px;display:grid}.goal-overview-summary>section{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;align-content:start;gap:16px;min-width:0;padding:20px;display:grid}.goal-overview-summary p,.goal-overview-source-note{color:var(--pw-muted);font-size:13px;line-height:1.6}.goal-overview-summary strong,.goal-overview-summary p,.goal-overview-summary button span{overflow-wrap:anywhere}.goal-overview-summary ul{margin:0;padding:0;list-style:none}.goal-overview-summary li+li{margin-top:8px}.goal-overview-summary li button{justify-content:space-between;width:100%;display:flex}.goal-overview-links{gap:8px;display:flex}.goal-overview-summary .goal-overview-run{grid-template-columns:1fr auto;gap:4px 12px;display:grid}.goal-overview-run small{color:var(--pw-muted);font-size:12px}.goal-overview-run strong{grid-row:2;font-size:13px}.goal-overview-run svg{grid-area:1/2/3}.goal-overview-usage{border-block:1px solid var(--pw-line);grid-template-columns:repeat(3,minmax(0,1fr));margin:0;padding-block:12px;display:grid}.goal-overview-usage>div{padding-inline:16px}.goal-overview-usage>div+div{border-left:1px solid var(--pw-line)}.goal-overview-usage dt{color:var(--pw-muted);font-size:11px}.goal-overview-usage dd{margin:8px 0 0;font-size:14px}@media (width<=640px){.goal-overview-summary{grid-template-columns:1fr}.goal-overview-usage>div{padding-inline:8px}}.personal-workspace-shell{--pw-bg:#fbfaf7;--pw-card:#fff;--pw-line:#eceae3;--pw-line-strong:#e0ddd4;--pw-muted:#82889a;--pw-faint:#aab0bf;--pw-text:#23262e;--pw-blue:#2f66e9;--pw-blue-ink:#2456c8;--pw-blue-soft:#ebf1fe;--pw-amber:#a86a12;--pw-amber-bg:#fbf2df;--pw-red:#c2402f;--pw-red-bg:#fcecea;--pw-green:#2e7d5b;--pw-green-bg:#e6f3ec;background:var(--pw-bg);min-height:100vh;color:var(--pw-text);grid-template-columns:272px minmax(520px,1fr);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;display:grid}.personal-workspace-shell.has-drawer{grid-template-columns:256px minmax(500px,1fr) minmax(340px,404px)}.personal-workspace-shell.has-task-inspector{grid-template-columns:minmax(520px,1fr) minmax(520px,50vw)}.personal-workspace-shell.has-task-inspector .personal-workspace-sidebar{display:none}.personal-workspace-shell.has-task-inspector.is-task-inspector-full{grid-template-columns:minmax(600px,1fr)}.personal-workspace-shell.is-task-inspector-full .personal-workspace-main{display:none}.personal-workspace-sidebar{border-right:1px solid var(--pw-line);background:#f5f3ee;min-width:0}.personal-workspace-sidebar-inner{width:100%;height:100%}.personal-sr-only{clip:rect(0, 0, 0, 0)!important;white-space:nowrap!important;border:0!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;position:absolute!important;overflow:hidden!important}.personal-workspace-main{min-width:0}.personal-workspace-drawer{border-left:1px solid var(--pw-line);background:#fff;min-width:0;position:relative;box-shadow:-14px 0 36px #1e1c140d}.personal-workspace-drawer[data-drawer-mode=inspector]{z-index:3;width:auto;position:relative;box-shadow:-8px 0 24px #1e284014}.personal-workspace-drawer[data-drawer-mode=inspector-full]{min-width:0;box-shadow:none;grid-column:1}.personal-sidebar-backdrop{display:none}.personal-workspace-shell :focus-visible:not(textarea):not(input){outline-offset:2px;outline:2px solid #5f87ed}.personal-goal-directory{flex-direction:column;width:100%;height:100vh;display:flex;position:sticky;top:0}.personal-sidebar-brand{border-bottom:1px solid var(--pw-line);align-items:center;gap:11px;height:74px;padding:0 18px;display:flex}.personal-sidebar-brand>span:last-child{gap:1px;display:grid}.personal-sidebar-brand strong{letter-spacing:.01em;font-size:16px}.personal-sidebar-brand small{color:var(--pw-muted);font-size:11px}.personal-brand-mark,.personal-manager-icon{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:10px;place-items:center;display:grid;box-shadow:0 2px 6px #2f66e947}.personal-brand-mark{width:34px;height:34px}.personal-manager-icon{width:30px;height:30px;color:var(--pw-blue-ink);background:var(--pw-blue-soft);box-shadow:none}.personal-status-source{border-bottom:1px solid var(--pw-line);gap:7px;padding:12px 14px;display:grid;position:relative}.personal-status-source>header{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;justify-content:space-between;align-items:center;padding:0 3px;font-size:10px;font-weight:700;display:flex}.personal-status-source>header button,.personal-status-source-meta button,.personal-status-source-form header button{width:25px;height:25px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-status-source>header button:hover,.personal-status-source-meta button:hover,.personal-status-source-form header button:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-status-source-select{width:100%}.personal-status-source-meta{min-width:0;color:var(--pw-muted);align-items:center;gap:7px;padding:0 3px;font-size:10.5px;display:flex}.personal-status-source-meta>span{white-space:nowrap;align-items:center;gap:5px;display:inline-flex}.personal-status-source-meta>span i{background:#3fbf82;border-radius:50%;width:6px;height:6px}.personal-status-source-meta>span.is-loading i{background:#e5a33d}.personal-status-source-meta>span.is-error i{background:#dd5b47}.personal-status-source-meta small{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}.personal-status-source-meta button{width:22px;height:22px;color:var(--pw-faint);margin-left:auto}.personal-status-source-error{color:var(--pw-red);overflow-wrap:anywhere;margin:0 3px;font-size:10px;line-height:1.4}.personal-status-source-form{z-index:12;border:1px solid var(--pw-line-strong);background:#fff;border-radius:12px;gap:10px;padding:13px;display:grid;position:absolute;top:calc(100% - 4px);left:12px;right:12px;box-shadow:0 12px 32px #1e1c1424}.personal-status-source-form>header{justify-content:space-between;align-items:center;font-size:12.5px;display:flex}.personal-status-source-form label{color:var(--pw-muted);gap:5px;font-size:10.5px;display:grid}.personal-status-source-form input,.personal-status-source-form select{border:1px solid var(--pw-line-strong);width:100%;min-width:0;height:34px;color:var(--pw-text);background:#fff;border-radius:8px;outline:0;padding:0 9px;font:12px/1.2 inherit}.personal-status-source-form input:focus,.personal-status-source-form select:focus{border-color:#8aa7ed;box-shadow:0 0 0 2px #2f66e91a}.personal-status-source-form input:disabled,.personal-status-source-form select:disabled{color:var(--pw-faint);background:#f6f5f2}.personal-status-source-form p{color:var(--pw-muted);overflow-wrap:anywhere;margin:0;font-size:10px;line-height:1.45}.personal-status-source-form p.is-error{color:var(--pw-red)}.personal-status-source-form code{font:9.5px/1.5 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-status-source-add{background:var(--pw-blue);color:#fff;cursor:pointer;border:0;border-radius:8px;min-height:34px;font-size:11.5px;font-weight:650}.personal-status-source-add:hover{background:var(--pw-blue-ink)}.personal-status-source-add:disabled{cursor:not-allowed;opacity:.48}.personal-status-source-modes{background:#f2f1ed;border-radius:9px;grid-template-columns:1fr 1fr;gap:3px;padding:3px;display:grid}.personal-status-source-modes button{min-height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;padding:0 8px;font-size:10.5px;font-weight:650}.personal-status-source-modes button[aria-selected=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-status-source-field-row{grid-template-columns:minmax(0,1fr) 34px;gap:6px;display:grid}.personal-status-source-field-row>button{border:1px solid var(--pw-line-strong);width:34px;height:34px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:8px;place-items:center;padding:0;display:grid}.personal-status-source-field-row>button:hover{color:var(--pw-text);background:#f8f7f4}.personal-status-source-field-row>button:disabled{cursor:wait;opacity:.45}.personal-status-source-command{background:#f6f5f2;border-radius:8px;gap:7px;padding:8px 9px;display:grid}.personal-status-source-command code{color:#4e5668;overflow-wrap:anywhere}.personal-status-source-command button{border:1px solid var(--pw-line-strong);min-height:25px;color:var(--pw-blue-ink);cursor:pointer;background:#fff;border-radius:7px;justify-content:center;justify-self:end;align-items:center;gap:5px;padding:0 8px;font-size:10px;font-weight:650;display:inline-flex}.personal-status-source-command button:disabled{color:var(--pw-faint);cursor:not-allowed}.personal-sidebar-nav{flex:1;padding:12px;overflow:auto}.personal-manager-link,.personal-goal-link,.personal-sidebar-utility{width:100%;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0}.personal-manager-link{border-radius:11px;grid-template-columns:30px 1fr auto auto;align-items:center;gap:10px;padding:8px 10px;font-weight:650;display:grid}.personal-manager-link:hover,.personal-goal-link:hover{background:#ffffffa6}.personal-manager-link[aria-current=page],.personal-goal-link[aria-current=page]{background:#fff;box-shadow:0 1px 4px #1e1c141a}.personal-sidebar-count{background:var(--pw-amber-bg);min-width:22px;color:var(--pw-amber);text-align:center;border-radius:99px;padding:2px 7px;font-size:11px;font-weight:650}.personal-sidebar-section-title{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;justify-content:space-between;padding:20px 10px 7px;font-size:11px;font-weight:650;display:flex}.personal-sidebar-title-actions{align-items:center;gap:6px;display:flex}.personal-sidebar-title-actions button{width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-sidebar-title-actions button:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141f}.personal-goal-list{gap:2px;display:grid}.personal-goal-row{border-radius:11px;grid-template-columns:minmax(0,1fr) 28px 28px;align-items:center;gap:2px;display:grid}.personal-goal-row:has(.personal-goal-move-actions){grid-template-columns:minmax(0,1fr) 52px 28px}.personal-goal-row[data-reorder-goal]>.personal-goal-link{cursor:grab;-webkit-user-select:none;user-select:none}.personal-goal-row[data-reorder-goal]>.personal-goal-link:active{cursor:grabbing}.personal-goal-row.is-drop-before{box-shadow:0 -2px var(--color-link,#0070f3)}.personal-goal-row.is-drop-after{box-shadow:0 2px var(--color-link,#0070f3)}.personal-goal-move-actions{display:flex}.personal-goal-move-actions button{min-width:26px;min-height:44px;color:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;place-items:center;display:grid}.personal-goal-move-actions button:disabled{opacity:.35;cursor:default}.personal-goal-move-actions button:not(:disabled):hover{background:var(--color-surface-soft,#f2f2f2)}.personal-goal-link{border-radius:11px;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:10px;min-height:44px;padding:7px 5px 7px 10px;display:grid}.personal-goal-lifecycle{width:26px;height:26px;color:var(--pw-faint);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-goal-lifecycle:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141f}.personal-goal-lifecycle:disabled{opacity:.45;cursor:wait}.personal-goal-lifecycle.is-pending svg{animation:.8s linear infinite personal-goal-lifecycle-spin}@keyframes personal-goal-lifecycle-spin{to{transform:rotate(360deg)}}.personal-goal-delete:hover{color:var(--pw-danger)}.personal-goal-link-copy{gap:2px;min-width:0;display:grid}.personal-goal-link-copy strong,.personal-goal-link-copy small{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.personal-goal-link-copy strong{font-size:13px;font-weight:600}.personal-goal-link-copy small{color:var(--pw-muted);align-items:center;gap:5px;font-size:11px;display:flex}.personal-goal-state-dot{background:#e8ecf1;border-radius:9px;width:30px;height:30px;position:relative}.personal-goal-state-dot:after{content:"";background:#9aa3b2;border-radius:50%;width:7px;height:7px;position:absolute;bottom:3px;right:3px;box-shadow:0 0 0 2px #ffffffd9}.personal-goal-row:nth-child(5n+1) .personal-goal-state-dot{background:#e3ebfd}.personal-goal-row:nth-child(5n+2) .personal-goal-state-dot{background:#eee7fb}.personal-goal-row:nth-child(5n+3) .personal-goal-state-dot{background:#e2f2e4}.personal-goal-row:nth-child(5n+4) .personal-goal-state-dot{background:#fbf0dc}.personal-goal-row:nth-child(5n) .personal-goal-state-dot{background:#e8ecf1}.personal-goal-state-dot.is-danger:after{background:#dd5b47}.personal-goal-state-dot.is-warning:after{background:#e5a33d}.personal-goal-state-dot.is-info:after{background:#54a5e8}.personal-goal-state-dot.is-success:after{background:#3fae7c}.personal-goal-state-dot.is-quiet:after{background:#b6bcc9}.personal-goal-state-dot.is-stopped:after{background:#8f96a4}.personal-stopped-goals{border-top:1px solid var(--pw-line);margin-top:14px;padding-top:8px}.personal-stopped-goals>summary{min-height:34px;color:var(--pw-muted);cursor:pointer;letter-spacing:.04em;border-radius:9px;grid-template-columns:16px minmax(0,1fr) auto;align-items:center;gap:6px;padding:5px 10px;font-size:11px;font-weight:650;list-style:none;display:grid}.personal-stopped-goals>summary::-webkit-details-marker{display:none}.personal-stopped-goals>summary:hover{color:var(--pw-text);background:#ffffff8c}.personal-stopped-goals>summary>svg:first-child{transition:transform .14s}.personal-stopped-goals[open]>summary>svg:first-child{transform:rotate(180deg)}.personal-stopped-goals>summary small{text-align:center;background:#ebe9e3;border-radius:99px;min-width:22px;padding:2px 6px}.personal-goal-list.is-stopped{opacity:.82;margin-top:2px}.personal-stopped-goal-error{background:var(--pw-red-bg);color:var(--pw-red);border:1px solid #edc1ba;border-radius:9px;gap:7px;margin:6px 8px;padding:9px 10px;font-size:11px;line-height:1.45;display:grid}.personal-stopped-goal-error button{min-height:28px;color:inherit;cursor:pointer;font:inherit;background:0 0;border:1px solid;border-radius:7px;justify-self:start;padding:0 9px;font-weight:650}.personal-priority-dot{background:#aab2bf;border-radius:50%;width:7px;height:7px}.personal-priority-dot.is-high{background:#dd5b47}.personal-priority-dot.is-medium{background:#e5a33d}.personal-priority-dot.is-low{background:#3fae7c}.personal-sidebar-footer{border-top:1px solid var(--pw-line);flex-shrink:0;padding:12px}.personal-update-trigger{width:100%;min-height:44px;color:var(--pw-text);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;align-items:center;gap:8px;padding:0 9px;font-size:13px;display:flex}.personal-update-trigger span{text-align:left;flex:1}.personal-update-trigger:hover{background:var(--pw-card)}.personal-update-trigger:focus-visible{outline-offset:2px;outline:2px solid #0070f3}.personal-update-panel{box-sizing:border-box;width:min(320px,100vw - 24px);max-height:calc(100dvh - 104px);color:var(--pw-text);background:var(--pw-card,#fff);font:inherit;border:1px solid var(--pw-line);border-radius:12px;margin:0;padding:16px;font-size:13px;line-height:1.6;position:fixed;inset:auto auto 80px 12px;overflow-y:auto;box-shadow:0 8px 28px #0000001f}.personal-update-panel header{justify-content:space-between;align-items:center;display:flex}.personal-update-panel button{min-height:44px;color:inherit;background:var(--pw-card,#fff);border:1px solid var(--pw-line);cursor:pointer;border-radius:6px;padding:6px 10px}.personal-update-panel header button{border:0;place-items:center;min-width:44px;display:grid}.personal-update-panel summary{cursor:pointer;align-content:center;min-height:44px}.personal-update-panel p{margin:10px 0}.personal-update-panel label,.personal-update-panel small,.personal-update-panel code{display:block}.personal-update-panel select{width:100%;min-height:44px;color:inherit;background:var(--pw-card);border:1px solid var(--pw-line);border-radius:6px;margin-top:6px}.personal-update-actions{flex-wrap:wrap;gap:8px;display:flex}.personal-update-actions button{border:1px solid var(--pw-line);border-radius:6px;min-height:44px;padding:6px 10px}.personal-update-panel a{text-decoration:underline}.personal-update-panel :focus-visible{outline-offset:2px;outline:2px solid #0070f3}.personal-sidebar-utility{border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;grid-template-columns:32px minmax(0,1fr) auto;align-items:center;gap:10px;min-height:54px;padding:7px 9px;font-size:13px;display:grid;box-shadow:0 1px 4px #1e1c1412}.personal-sidebar-utility:hover{background:#fff;border-color:#d6d2c8;box-shadow:0 2px 7px #1e1c141a}.personal-sidebar-utility-icon{background:var(--pw-blue-soft);width:32px;height:32px;color:var(--pw-blue-ink);border-radius:9px;place-items:center;display:grid}.personal-sidebar-utility-copy{gap:2px;min-width:0;display:grid}.personal-sidebar-utility-copy strong,.personal-sidebar-utility-copy small{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.personal-sidebar-utility-copy strong{font-size:13px;font-weight:700}.personal-sidebar-utility-copy small{color:var(--pw-muted);font-size:10.5px}.personal-sidebar-utility>svg{color:var(--pw-faint)}.personal-owner-row{min-height:40px;color:var(--pw-muted);border-radius:10px;align-items:center;gap:10px;margin-top:2px;padding:8px 10px;font-size:13px;display:flex}.personal-channel{grid-template-rows:auto minmax(0,1fr) auto;grid-template-columns:minmax(0,1fr);min-width:0;height:100vh;display:grid}.personal-channel-header{z-index:8;border-bottom:1px solid var(--pw-line);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fbfaf7eb;justify-content:space-between;align-items:center;gap:16px;min-height:72px;padding:12px 26px;display:flex;position:relative;overflow:visible}.personal-goal-tabs{background:#f2f1ed;border-radius:10px;align-self:center;align-items:center;gap:2px;margin-left:auto;padding:3px;display:flex}.personal-goal-tabs button{min-height:30px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;padding:0 13px;font-size:12.5px;font-weight:600}.personal-goal-tabs button:hover{color:var(--pw-text)}.personal-goal-tabs button[aria-current=page]{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-channel-title{min-width:0}.personal-channel-title h1{letter-spacing:-.015em;margin:0;font-size:17.5px;font-weight:700;line-height:1.25}.personal-channel-title p{color:var(--pw-muted);white-space:nowrap;text-overflow:ellipsis;margin:3px 0 0;font-size:12px;overflow:hidden}.personal-channel-title p.personal-manager-execution{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.personal-execution-chip{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:999px;flex:none;align-items:center;gap:6px;padding:0 8px;font-family:SFMono-Regular,Consolas,monospace;font-size:11px;line-height:18px;display:inline-flex}.personal-execution-chip-endpoint{color:var(--pw-text);font-weight:650}.personal-execution-chip-kind{color:var(--pw-faint)}.personal-execution-chip-model{color:var(--pw-muted)}.personal-execution-chip.is-unavailable{border-color:var(--pw-amber);background:var(--pw-amber-bg)}.personal-execution-chip.is-unavailable .personal-execution-chip-endpoint,.personal-execution-chip.is-unavailable .personal-execution-chip-kind,.personal-execution-chip.is-unavailable .personal-execution-chip-model{color:var(--pw-amber)}.personal-execution-note{color:var(--pw-muted);text-overflow:ellipsis;font-size:11px;overflow:hidden}.personal-execution-rule-note{color:var(--pw-faint);text-overflow:ellipsis;font-size:11px;overflow:hidden}.personal-workspace-shell[data-pw-theme=brutal] .personal-execution-chip{border-color:#141414;border-radius:4px}.personal-channel-actions{flex:none;align-items:center;gap:9px;display:flex}.personal-icon-button.personal-mobile-menu{display:none}.personal-select{min-width:0;position:relative}.personal-select-trigger{border:1px solid var(--pw-line-strong);width:100%;min-height:36px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border-radius:10px;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:7px;padding:0 9px;font-size:12px;font-weight:500;line-height:16px;display:grid}.personal-select-trigger:hover,.personal-select-trigger[aria-expanded=true]{border-color:var(--pw-faint)}.personal-select-trigger:focus-visible{border-color:var(--pw-blue);outline-offset:1px;outline:2px solid #0070f329}.personal-select-trigger>svg{color:var(--pw-muted);transition:transform .15s}.personal-select-trigger>svg.is-open{transform:rotate(180deg)}.personal-select-icon{color:var(--pw-muted);place-items:center;display:grid}.personal-select-value{white-space:nowrap;align-items:center;gap:6px;min-width:0;display:flex}.personal-select-value>small{color:var(--pw-faint);flex:none;font-size:10px;font-weight:500}.personal-select-value>span{text-overflow:ellipsis;min-width:0;overflow:hidden}.personal-select-listbox{z-index:50;border:1px solid var(--pw-line);background:#fff;border-radius:12px;min-width:max(100%,204px);max-width:min(300px,80vw);max-height:260px;padding:4px;display:grid;position:absolute;top:calc(100% + 5px);left:0;overflow:auto;box-shadow:0 10px 24px #00000017}.personal-agent-select .personal-select-listbox{min-width:216px;left:auto;right:0}.personal-select-option-wrap{display:grid}.personal-select-group-label{color:var(--pw-faint);letter-spacing:0;text-transform:uppercase;padding:8px 8px 4px;font:500 10px/14px Geist Mono Variable,Geist Mono,monospace}.personal-select-option{width:100%;min-height:32px;color:var(--pw-text);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;grid-template-columns:minmax(0,1fr) 16px;align-items:center;gap:10px;padding:6px 8px;font-size:12px;font-weight:400;line-height:16px;display:grid}.personal-select-option:hover,.personal-select-option:focus-visible{background:#f2f2f2;outline:0}.personal-select-option[aria-selected=true]{font-weight:600}.personal-select-option[disabled]{color:var(--pw-faint);cursor:not-allowed}.personal-select-option>svg{color:var(--pw-text);justify-self:end}.personal-agent-select{width:188px}.personal-read-only-source{border:1px solid var(--pw-line-strong);max-width:190px;height:38px;color:var(--pw-text);white-space:nowrap;background:#fff;border-radius:10px;align-items:center;gap:7px;padding:0 10px;font-size:12.5px;font-weight:600;display:inline-flex;overflow:hidden}.personal-read-only-source>svg{color:var(--pw-muted);flex:none}.personal-read-only-source>small{color:var(--pw-muted);background:#f2f1ed;border-radius:99px;padding:2px 6px;font-size:9.5px;font-weight:650}.personal-live-indicator{color:var(--pw-muted);white-space:nowrap;flex:none;align-items:center;gap:6px;padding:7px 4px;font-size:12px;display:inline-flex}.personal-live-indicator i{background:#3fbf82;border-radius:50%;width:7px;height:7px}.personal-composer-attach{cursor:pointer;border:0;flex:none;place-items:center;display:grid;position:relative;overflow:hidden}.personal-composer-attach:disabled{cursor:not-allowed;opacity:.45}.personal-composer-file-input{opacity:0;pointer-events:none;width:1px;height:1px;position:fixed;overflow:hidden}.personal-action-feedback{border:1px solid var(--pw-line);background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:10px;justify-content:space-between;align-items:center;gap:12px;margin:0 0 8px;padding:9px 12px;font-size:13px;font-weight:650;display:flex}.personal-action-feedback button{color:inherit;cursor:pointer;background:0 0;border:0;place-items:center;display:grid}.personal-refresh-control{flex:none;align-items:center;gap:6px;display:inline-flex}.personal-refresh-control small{color:var(--pw-muted);white-space:nowrap;font-size:11px}.personal-refresh-control.is-error small{color:var(--pw-danger)}.personal-icon-button{border:1px solid var(--pw-line);width:36px;min-width:36px;height:36px;min-height:36px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:10px;flex:0 0 36px;place-items:center;padding:0;display:inline-grid}.personal-icon-button:hover{border-color:var(--pw-line-strong);color:var(--pw-text)}.personal-channel-scroll{min-width:0;min-height:0;padding:22px max(26px,50% - 410px);overflow:auto}.personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-kanban){padding-inline:max(26px,50vw - 770px)}.personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-board){overflow:hidden}.personal-manager-greeting{align-items:center;gap:14px;margin-bottom:16px;padding:18px 20px;display:flex}.personal-home-lanes{grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;display:grid}.personal-system-health-banner{color:#991b1b;background:#fef2f2;border:1px solid #fecaca;border-radius:12px;margin-bottom:16px;padding:12px 16px}.personal-system-health-header{align-items:center;gap:8px;font-size:13px;font-weight:600;display:flex}.personal-system-health-header small{color:#b91c1c;font-size:11.5px;font-weight:400}.personal-system-health-issues{color:#b91c1c;margin:6px 0 0 24px;padding:0;font-size:12px;line-height:1.5}.personal-home-lane{border:1px solid var(--pw-line);background:#fff;border-radius:16px;flex-direction:column;min-width:0;min-height:100%;display:flex;box-shadow:0 1px 4px #1e1c140a}.personal-manager-greeting>span{background:var(--pw-blue-soft);width:38px;height:38px;color:var(--pw-blue);border-radius:12px;place-items:center;display:grid}.personal-manager-greeting div{gap:3px;display:grid}.personal-manager-greeting strong{letter-spacing:-.01em}.personal-manager-greeting p{color:var(--pw-muted);margin:0;font-size:13px}.personal-proposal-explainer{background:var(--pw-blue-soft);color:var(--pw-text);border-radius:10px;padding:10px 12px;font-size:12px;line-height:1.55}.personal-home-board{gap:12px;min-width:0;display:grid}.personal-home-lanes{grid-template-columns:repeat(4,minmax(170px,1fr));gap:10px;min-width:0;display:grid}.personal-home-lane{border:1px solid var(--pw-line);background:#ffffff85;border-radius:15px;align-content:start;min-width:0;min-height:260px;padding:12px;display:grid}.personal-home-lane>header{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-home-lane>header span{align-items:center;gap:7px;font-size:13px;font-weight:700;display:inline-flex}.personal-home-lane>header i,.personal-home-goal-meta i{background:var(--pw-faint);border-radius:50%;width:8px;height:8px}.personal-home-lane>header b{min-width:24px;color:var(--pw-muted);font-variant-numeric:tabular-nums;text-align:right;font-size:12px}.personal-home-lane>p{min-height:34px;color:var(--pw-muted);margin:7px 0 10px;font-size:10.5px;line-height:1.55}.personal-home-lane.is-needs_you>header i,.personal-home-lane.is-needs_you .personal-home-goal-meta i{background:var(--pw-amber)}.personal-home-lane.is-running>header i,.personal-home-lane.is-running .personal-home-goal-meta i{background:var(--pw-green)}.personal-home-lane.is-observing>header i,.personal-home-lane.is-observing .personal-home-goal-meta i{background:var(--pw-blue)}.personal-home-lane.is-scheduled>header i,.personal-home-lane.is-scheduled .personal-home-goal-meta i{background:#8b6bd8}.personal-home-lane-list{align-content:start;gap:9px;display:grid}.personal-home-goal-card{border:1px solid var(--pw-line);width:100%;min-width:0;color:inherit;cursor:pointer;text-align:left;background:#fff;border-radius:12px;gap:7px;padding:12px;transition:border-color .14s,transform .14s,box-shadow .14s;display:grid;box-shadow:0 1px 4px #1e1c140f}.personal-home-goal-card:hover{border-color:var(--pw-line-strong);transform:translateY(-1px);box-shadow:0 4px 12px #1e1c1414}.personal-home-goal-card:focus-visible{outline-offset:2px;outline:2px solid #7da2ff}.personal-home-goal-meta{min-width:0;color:var(--pw-muted);text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:6px;font-size:10.5px;display:flex;overflow:hidden}.personal-home-goal-card>strong{text-overflow:ellipsis;font-size:13px;line-height:1.45;overflow:hidden}.personal-home-goal-card>p{color:var(--pw-muted);-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:0;font-size:11px;line-height:1.55;display:-webkit-box;overflow:hidden}.personal-home-goal-card>footer{justify-content:space-between;align-items:center;gap:8px;padding-top:2px;display:flex}.personal-home-goal-card>footer span{color:var(--pw-muted);background:#f2f1ed;border-radius:99px;flex:none;padding:2px 7px;font-size:9.5px}.personal-home-goal-card>footer small{color:var(--pw-faint);text-overflow:ellipsis;white-space:nowrap;font-size:9.5px;overflow:hidden}.personal-home-empty{border:1px dashed var(--pw-line-strong);min-height:96px;color:var(--pw-faint);border-radius:11px;place-items:center;font-size:11px;display:grid}.personal-home-history{border:1px solid var(--pw-line);background:#fff9;border-radius:13px}.personal-home-history>summary{cursor:pointer;align-items:center;gap:9px;min-height:44px;padding:0 14px;list-style:none;display:flex}.personal-home-history>summary::-webkit-details-marker{display:none}.personal-home-history>summary span{font-size:12.5px;font-weight:700}.personal-home-history>summary b{color:var(--pw-muted);font-size:11px}.personal-home-history>summary small{color:var(--pw-faint);margin-left:auto;font-size:10.5px}.personal-home-history>div{grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:9px;padding:0 12px 12px;display:grid}.personal-session-record{background:var(--pw-blue-soft);border:1px solid #cfdcf9;border-radius:14px;grid-template-columns:minmax(0,1fr) auto;gap:10px 16px;margin-bottom:12px;padding:14px 16px;display:grid}.personal-session-record>header{grid-column:1/-1;justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-session-record>header span{color:var(--pw-blue-ink);align-items:center;gap:7px;font-size:12px;font-weight:700;display:inline-flex}.personal-session-record>header button{width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;place-items:center;padding:0;display:grid}.personal-session-record>header button:hover{color:var(--pw-text);background:#ffffffb3}.personal-session-record>div{min-width:0}.personal-session-record>div strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;display:block;overflow:hidden}.personal-session-record>div p{color:var(--pw-muted);margin:4px 0 0;font-size:11px}.personal-session-record dl{grid-column:1/-1;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0;display:grid}.personal-session-record dl div{background:#ffffff9e;border-radius:9px;gap:2px;min-width:0;padding:8px 10px;display:grid}.personal-session-record dt{color:var(--pw-faint);font-size:9.5px}.personal-session-record dd{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;margin:0;font:10.5px/1.4 SF Mono,ui-monospace,Menlo,Consolas,monospace;overflow:hidden}.personal-session-record>.personal-secondary-action{grid-area:2/2;align-self:center}.personal-channel-timeline{gap:10px;display:grid}.personal-live-region{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:fixed;overflow:hidden}.personal-timeline-row{border:1px solid var(--pw-line);background:var(--pw-card);width:100%;min-height:64px;color:inherit;cursor:pointer;text-align:left;border-radius:14px;grid-template-columns:38px minmax(0,1fr) auto auto 16px;align-items:center;gap:12px;padding:11px 15px;transition:border-color .14s,box-shadow .14s;display:grid}.personal-timeline-row:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-timeline-row:focus-visible{outline-offset:2px;outline:2px solid #7da2ff}.personal-row-icon{border-radius:11px;place-items:center;width:34px;height:34px;display:grid}.personal-row-icon.is-attention{color:var(--pw-amber);background:var(--pw-amber-bg)}.personal-row-icon.is-run{color:var(--pw-blue-ink);background:var(--pw-blue-soft)}.personal-row-icon.is-output{color:var(--pw-green);background:var(--pw-green-bg)}.personal-row-copy,.personal-run-identity{gap:3px;min-width:0;display:grid}.personal-row-copy strong,.personal-row-copy small,.personal-row-copy span,.personal-run-identity strong,.personal-run-identity small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.personal-row-copy strong{font-size:13.5px;font-weight:600}.personal-row-copy small,.personal-run-identity small,.personal-row-copy span{color:var(--pw-muted);font-size:11px}.personal-row-status{color:var(--pw-muted);white-space:nowrap;background:#f2f1ed;border-radius:99px;align-items:center;gap:5px;padding:2.5px 10px;font-size:11px;font-weight:600;display:inline-flex}.personal-row-status.is-running{background:var(--pw-green-bg);color:var(--pw-green)}.personal-run-row{grid-template-columns:38px minmax(90px,.65fr) minmax(160px,1.4fr) 90px auto auto 16px}.personal-run-open-label{color:var(--pw-blue-ink);white-space:nowrap;font-size:10.5px;font-weight:650}.personal-run-identity strong{font-size:12px}.personal-run-progress{gap:5px;display:grid}.personal-run-progress small{color:var(--pw-muted);font-variant-numeric:tabular-nums;font-size:10px}.personal-run-progress i{background:#f0efeb;border-radius:99px;height:4px;display:block;overflow:hidden}.personal-run-progress b{border-radius:inherit;background:var(--pw-blue);height:100%;display:block}.personal-output-row time{color:var(--pw-muted);font-size:11px}.personal-spin{animation:1.2s linear infinite pw-spin}@keyframes pw-spin{to{transform:rotate(360deg)}}.personal-message{gap:11px;max-width:84%;padding:6px 2px;display:flex}.personal-message.is-user{background:var(--pw-blue-soft);color:var(--pw-text);border:1px solid #dbe7fd;border-radius:16px 16px 4px;justify-self:end;padding:11px 15px}.personal-message-avatar{background:var(--pw-blue-soft);height:34px;color:var(--pw-blue-ink);border-radius:11px;flex:0 0 34px;place-items:center;display:grid}.personal-message header{align-items:baseline;gap:8px;display:flex}.personal-message header strong{font-size:12px}.personal-message time{color:var(--pw-faint);font-size:10px}.personal-message p{white-space:pre-wrap;margin:6px 0 0;font-size:13.5px;line-height:1.7}.personal-message-pending{color:var(--pw-muted);font-size:11px}.personal-return-delivery{color:var(--pw-muted);margin-top:7px;font-size:11px;font-weight:600;display:inline-block}.personal-return-delivery.is-delivered{color:var(--pw-green)}.personal-return-delivery.is-verification_required{color:var(--pw-blue-ink)}.personal-return-delivery.is-explicit_unverified{color:var(--pw-amber)}.personal-message-images{flex-wrap:wrap;gap:7px;margin-top:8px;display:flex}.personal-message-images img{object-fit:cover;border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;width:min(220px,100%);max-height:180px}.personal-md{overflow-wrap:anywhere;font-size:13.5px;line-height:1.7}.personal-md>*+*{margin-top:8px}.personal-md p{margin:0}.personal-md-heading.is-h1,.personal-md-heading.is-h2{font-size:14.5px}.personal-md-code{color:#4d5361;background:#f0efe9;border-radius:5px;padding:1px 5px;font-family:SF Mono,ui-monospace,Menlo,Consolas,monospace;font-size:.86em}.personal-md-pre{color:#e8ecf3;white-space:pre;background:#23262e;border-radius:10px;margin:0;padding:12px 14px;font:12px/1.65 SF Mono,ui-monospace,Menlo,Consolas,monospace;overflow-x:auto}.personal-md-pre code{font:inherit}.personal-md-link{color:var(--pw-blue-ink);text-underline-offset:2px;word-break:break-all;text-decoration:underline}.personal-agent-avatar{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:13px;flex:none;place-items:center;width:44px;height:44px;font-size:18px;font-weight:700;display:grid;box-shadow:0 2px 6px #2f66e947}.personal-agent-health.is-off{color:var(--pw-muted);background:#f2f1ed}.personal-agent-persona dl{border-top:1px solid var(--pw-line);margin-top:14px;padding-top:13px}.personal-detail-card-title{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-detail-card-title em{color:var(--pw-muted);background:#f1f1ee;border-radius:99px;padding:2px 8px;font-size:10px;font-style:normal;font-weight:650}.personal-goal-repository h3{align-items:center;gap:8px;display:flex}.personal-goal-notification h3{justify-content:space-between;align-items:center;gap:8px;display:flex}.personal-connection-status{background:var(--pw-green-bg);color:var(--pw-green);border-radius:99px;padding:2px 8px;font-size:10px;font-weight:650}.personal-subagent-heading{justify-content:space-between;align-items:flex-start;gap:14px;display:flex}.personal-subagent-heading h3{align-items:center;gap:7px;margin-bottom:0;display:flex}.personal-subagent-switch{border:1px solid var(--pw-line-strong);min-height:32px;color:var(--pw-muted);cursor:pointer;background:#f2f1ed;border-radius:99px;flex:none;align-items:center;gap:7px;padding:4px 9px 4px 5px;font-size:11px;font-weight:700;display:inline-flex}.personal-subagent-switch>span{background:#c8c8c2;border-radius:99px;width:30px;height:18px;transition:background .18s;position:relative}.personal-subagent-switch>span:after{content:"";background:#fff;border-radius:50%;width:12px;height:12px;transition:transform .18s;position:absolute;top:3px;left:3px}.personal-subagent-switch[aria-checked=true]{background:var(--pw-green-bg);color:var(--pw-green);border-color:#b9dccb}.personal-subagent-switch[aria-checked=true]>span{background:var(--pw-green)}.personal-subagent-switch[aria-checked=true]>span:after{transform:translate(12px)}.personal-subagent-switch[data-pending=true]{color:#8a6b00;opacity:1;background:#fffbed;border-color:#d8c67a}.personal-subagent-switch:disabled{cursor:default;opacity:.55}.personal-subagent-switch[data-pending=true]:disabled{opacity:1}.personal-subagent-fields{border-top:1px solid var(--pw-line);grid-template-columns:minmax(0,1fr) 112px;gap:10px;margin-top:14px;padding-top:13px;display:grid}.personal-subagent-fields label{color:var(--pw-text);align-content:start;gap:6px;font-size:11.5px;font-weight:650;display:grid}.personal-subagent-fields input:not([type=checkbox]),.personal-subagent-fields select{border:1px solid var(--pw-line-strong);min-width:0;min-height:38px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 10px;font-size:12px}.personal-subagent-fields label small{color:var(--pw-faint);font-size:10.5px;font-weight:450;line-height:1.45}.personal-subagent-domain-picker{border:0;grid-column:1/-1;min-width:0;margin:0;padding:0}.personal-subagent-domain-picker>legend{color:var(--pw-text);margin-bottom:7px;padding:0;font-size:11.5px;font-weight:650}.personal-subagent-domain-picker>small{color:var(--pw-faint);margin-top:7px;font-size:10.5px;line-height:1.45;display:block}.personal-subagent-domain-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;display:grid}.personal-subagent-domain-option{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:9px;grid-template-columns:auto minmax(0,1fr);min-height:44px;padding:8px 9px;align-items:center!important;display:grid!important}.personal-subagent-domain-option:hover{border-color:#b9c9dc}.personal-subagent-domain-option:has(input:focus-visible){outline:2px solid var(--pw-blue);outline-offset:2px}.personal-subagent-domain-option.is-selected{background:var(--pw-blue-soft);border-color:#9fc4ed}.personal-subagent-domain-option input{width:15px;height:15px;accent-color:var(--pw-blue);margin:0}.personal-subagent-domain-option>span{gap:1px;min-width:0;display:grid}.personal-subagent-domain-option strong{text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;overflow:hidden}.personal-subagent-domain-option small{font-size:9.5px!important;font-weight:450!important}.personal-subagent-domain-empty{border:1px dashed var(--pw-line-strong);background:var(--pw-bg);color:var(--pw-muted);border-radius:9px;grid-column:1/-1;margin:0;padding:10px;font-size:10.5px;line-height:1.5}.personal-subagent-limit-field{grid-column:1/-1;width:112px}.personal-subagent-fields .personal-secondary-action{grid-column:1/-1;margin-top:0}.personal-subagent-preview{background:#fffbed;border:1px solid #d8c67a;border-radius:10px;margin-top:10px;padding:12px}.personal-subagent-preview>strong{font-size:12.5px}.personal-subagent-preview>p{margin:5px 0 0}.personal-subagent-preview>div{grid-template-columns:1fr 1fr;gap:8px;display:grid}.personal-subagent-preview .personal-primary-action,.personal-subagent-preview .personal-secondary-action{min-height:38px;margin-top:10px}.personal-subagent-feedback{align-items:flex-start;gap:7px;display:flex;margin:10px 0 0!important}.personal-subagent-feedback.is-success{color:var(--pw-green)!important}.personal-subagent-feedback.is-warning{color:#8a6b00!important}.personal-subagent-feedback.is-error{color:var(--pw-red)!important}.personal-subagent-read-only{margin-bottom:0}.personal-settings-page{--pw-bg:#fbfaf7;--pw-card:#fff;--pw-line:#eceae3;--pw-line-strong:#e0ddd4;--pw-muted:#82889a;--pw-faint:#aab0bf;--pw-text:#23262e;--pw-blue:#2f66e9;--pw-blue-ink:#2456c8;--pw-blue-soft:#ebf1fe;--pw-red:#c2402f;--pw-red-bg:#fcecea;--pw-green:#2e7d5b;--pw-green-bg:#e6f3ec;background:var(--pw-bg);height:100dvh;min-height:0;color:var(--pw-text);grid-template-rows:minmax(0,1fr);grid-template-columns:268px minmax(0,1fr);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;display:grid;overflow:hidden}.personal-settings-sidebar{overscroll-behavior:contain;scrollbar-gutter:stable;border-right:1px solid var(--pw-line);background:#f5f3ee;flex-direction:column;gap:14px;min-width:0;height:100%;min-height:0;padding:18px 14px;display:flex;position:relative;overflow-y:auto}.personal-settings-page :focus-visible{outline-offset:2px;outline:2px solid #5f87ed}.personal-settings-back{width:100%;min-height:40px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:10px;align-items:center;gap:8px;padding:0 10px;font-size:13px;font-weight:650;display:inline-flex}.personal-settings-back:hover{color:var(--pw-text);background:#ffffffa6}.personal-settings-title{border-bottom:1px solid var(--pw-line);gap:3px;padding:8px 10px 10px;display:grid}.personal-settings-title small{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-settings-title strong{letter-spacing:-.02em;font-size:18px}.personal-settings-header{justify-content:space-between;align-items:flex-start;gap:24px;margin-bottom:24px;display:flex}.personal-settings-header small{color:var(--pw-blue);letter-spacing:.08em;text-transform:uppercase;font-size:11px;font-weight:700}.personal-settings-header h1{letter-spacing:-.035em;margin:4px 0 2px;font-size:28px}.personal-settings-tabs{gap:3px;display:grid}.personal-settings-tabs button{width:100%;min-height:54px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:11px;grid-template-columns:32px minmax(0,1fr);align-items:center;gap:9px;padding:8px 10px;display:grid}.personal-settings-tabs button:hover{color:var(--pw-text);background:#ffffffa6}.personal-settings-tabs button[aria-current=page]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c141a}.personal-settings-tabs button>span{gap:2px;min-width:0;display:grid}.personal-settings-tabs strong{font-size:13px}.personal-settings-body{overscroll-behavior:contain;scrollbar-gutter:stable;min-width:0;min-height:0;padding:30px clamp(24px,5vw,72px);overflow:auto}.personal-settings-body:has(>.personal-capability-settings){grid-template-rows:auto minmax(0,1fr);display:grid;overflow:hidden}.personal-settings-body>.personal-settings-header{min-width:0}.personal-settings-page *,.personal-settings-page :before,.personal-settings-page :after{box-sizing:border-box}.personal-appearance-settings{max-width:680px}.personal-settings-choice-group{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:14px;display:grid}.personal-settings-choice-group button{border:1px solid var(--pw-line);min-height:60px;color:inherit;cursor:pointer;text-align:left;background:#fff;border-radius:12px;grid-template-columns:34px minmax(0,1fr);align-items:center;gap:10px;padding:13px;display:grid}.personal-settings-choice-group button:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-settings-choice-group button[aria-checked=true]{background:#f7f9ff;border-color:#9fb9f4;box-shadow:0 0 0 3px #2f66e91a}.personal-settings-choice-group strong{align-self:center;font-size:13px}.personal-settings-theme-swatch{border:1px solid var(--pw-line-strong);border-radius:10px;width:34px;height:34px;display:block}.personal-settings-theme-swatch.is-loopx{background:linear-gradient(135deg,#171717 0 44%,#0070f3 44% 54%,#fafafa 54% 76%,#fff 76%);border-radius:6px}.personal-settings-theme-swatch.is-paper{background:linear-gradient(135deg,#fbfaf7 0 48%,#2f66e9 48% 58%,#fff 58%)}.personal-settings-theme-swatch.is-brutal{background:linear-gradient(135deg,#ffd91a 0 45%,#ff8fd0 45% 70%,#8fdcff 70%);border:2px solid #141414;border-radius:5px;box-shadow:2px 2px #141414}.personal-lark-settings{background:var(--pw-bg);min-height:100vh;color:var(--pw-text);padding:30px clamp(24px,5vw,72px);position:relative}.personal-lark-settings.is-embedded{background:0 0;min-height:0;padding:0}.personal-lark-header{justify-content:space-between;align-items:flex-start;gap:24px;max-width:1180px;margin:0 auto;display:flex}.personal-lark-header small{color:var(--pw-blue);letter-spacing:.08em;text-transform:uppercase;font-size:11px;font-weight:700}.personal-lark-header h1{letter-spacing:-.035em;margin:4px 0 2px;font-size:28px}.personal-lark-header p{color:var(--pw-muted);margin:0;font-size:13px}.personal-lark-tabs{border-bottom:1px solid var(--pw-line);gap:24px;max-width:1180px;margin:28px auto 20px;display:flex}.personal-lark-settings.is-embedded .personal-lark-tabs{margin-top:0}.personal-lark-tabs button{min-height:42px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-bottom:2px solid #0000;align-items:center;gap:8px;padding:0 2px;font-weight:650;display:flex}.personal-lark-tabs button[aria-current=page]{border-color:var(--pw-blue);color:var(--pw-text)}.personal-lark-tabs span{min-width:20px;height:20px;color:var(--pw-muted);background:#efeee9;border-radius:99px;place-items:center;padding:0 5px;font-size:10px;display:inline-grid}.personal-lark-section-heading{max-width:1180px;margin:0 auto 18px}.personal-lark-section-heading small{color:var(--pw-blue);letter-spacing:.07em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-lark-section-heading h2{letter-spacing:-.025em;margin:4px 0;font-size:21px}.personal-lark-section-heading p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-lark-subtabs{margin-top:0}.personal-settings-content{max-width:1180px;margin:0 auto}.personal-settings-card{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:16px;max-width:720px;overflow:hidden;box-shadow:0 8px 30px #1e1c140a}.personal-settings-card>header{border-bottom:1px solid var(--pw-line);align-items:center;gap:13px;padding:20px;display:flex}.personal-settings-card>header h2{letter-spacing:-.02em;margin:0;font-size:17px}.personal-settings-card>header p{color:var(--pw-muted);margin:4px 0 0;font-size:12px;line-height:1.5}.personal-settings-icon{background:var(--pw-blue-soft);width:40px;height:40px;color:var(--pw-blue);border-radius:12px;flex:none;place-items:center;display:grid}.personal-language-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:18px 20px;display:grid}.personal-language-options>button{border:1px solid var(--pw-line);min-height:66px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border-radius:12px;justify-content:space-between;align-items:center;gap:18px;padding:13px 15px;transition:border-color .15s,background-color .15s,box-shadow .15s;display:flex}.personal-language-options>button:hover{border-color:var(--pw-line-strong);background:#fcfbf8}.personal-language-options>button.is-selected{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-color:#9bb5f0;box-shadow:0 0 0 1px #2f66e814}.personal-language-options>button>span{gap:4px;display:grid}.personal-language-options strong{font-size:13px}.personal-settings-card>footer{border-top:1px solid var(--pw-line);color:var(--pw-faint);background:#faf9f6;padding:13px 20px;font-size:11px}.personal-machine-loading{min-height:220px;color:var(--pw-muted);place-items:center;font-size:13px;display:grid}.personal-machine-layout{grid-template-columns:210px minmax(0,1fr);gap:22px;max-width:1080px;display:grid}.personal-machine-namespaces{min-width:0}.personal-machine-namespaces>div{gap:3px;margin-bottom:10px;padding:0 4px;display:grid}.personal-machine-namespaces>div small,.personal-machine-editor>header small,.personal-machine-editor-bar small{color:var(--pw-blue);letter-spacing:.07em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-machine-namespaces>div strong{font-size:13px}.personal-machine-namespaces nav{gap:5px;display:grid}.personal-machine-namespaces button{width:100%;min-height:52px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:1px solid #0000;border-radius:10px;gap:3px;padding:9px 11px;display:grid}.personal-machine-namespaces button:hover{border-color:var(--pw-line);background:#fff9}.personal-machine-namespaces button[aria-current=page]{border-color:var(--pw-line-strong);color:var(--pw-text);background:#fff;box-shadow:0 2px 8px #1e1c140d}.personal-machine-namespaces button span{overflow-wrap:anywhere;font-size:12px;font-weight:650}.personal-machine-namespaces button small{color:var(--pw-muted);font-size:10px}.personal-machine-content{min-width:0}.personal-machine-summary{border:1px solid var(--pw-line);background:#fff;border-radius:14px;justify-content:space-between;align-items:center;gap:20px;margin-bottom:14px;padding:14px 16px;display:flex}.personal-machine-summary>div{align-items:center;gap:11px;min-width:0;display:flex}.personal-machine-summary>div>span:last-child{gap:3px;display:grid}.personal-machine-summary>div small{color:var(--pw-muted);text-transform:uppercase;font-size:10px;font-weight:650}.personal-machine-summary>div strong{font-size:13px}.personal-machine-summary dl{gap:22px;margin:0;display:flex}.personal-machine-summary dl div{gap:3px;display:grid}.personal-machine-summary dt{color:var(--pw-muted);font-size:10px}.personal-machine-summary dd{margin:0;font-family:SFMono-Regular,Consolas,monospace;font-size:11px;font-weight:650}.personal-machine-editor-bar{justify-content:space-between;align-items:center;gap:14px;margin-bottom:10px;padding:0 2px;display:flex}.personal-machine-editor-mode{border:1px solid var(--pw-line);background:#f5f4f0;border-radius:9px;flex:none;gap:3px;padding:3px;display:flex}.personal-machine-editor-mode button{min-height:44px;color:var(--pw-muted);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:6px;padding:0 12px;font-size:11px;font-weight:650}.personal-machine-editor-mode button[aria-pressed=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c1414}.personal-machine-editor{border:1px solid var(--pw-line);background:#fff;border-radius:16px;overflow:hidden;box-shadow:0 8px 30px #1e1c140a}.personal-machine-editor>header{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:flex-start;gap:20px;padding:20px;display:flex}.personal-machine-editor>header h2{letter-spacing:-.02em;margin:4px 0 3px;font-size:18px}.personal-machine-editor>header p{max-width:610px;color:var(--pw-muted);margin:0;font-size:12px;line-height:1.55}.personal-machine-switch{min-height:44px;color:var(--pw-muted);cursor:pointer;white-space:nowrap;flex:none;align-items:center;gap:9px;font-size:12px;font-weight:650;display:flex}.personal-machine-switch input{width:42px;height:24px;accent-color:var(--pw-blue);cursor:pointer;margin:0}.personal-machine-scope-note{color:var(--pw-blue-ink);background:#f6f8fd;border:1px solid #cfdaf3;border-radius:12px;align-items:flex-start;gap:10px;margin:18px 20px 0;padding:13px 14px;display:flex}.personal-machine-scope-note svg{flex:none;margin-top:1px}.personal-machine-scope-note strong{font-size:12px}.personal-machine-scope-note p{color:#52627f;margin:3px 0 0;font-size:11px;line-height:1.55}.personal-machine-editor fieldset{border:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:0;padding:20px;display:grid}.personal-machine-editor fieldset label{align-content:start;gap:6px;min-width:0;display:grid}.personal-machine-editor fieldset label:last-child{grid-column:1/-1}.personal-machine-editor fieldset label>span{font-size:12px;font-weight:650}.personal-machine-editor fieldset label>small{color:var(--pw-muted);font-size:10.5px;line-height:1.45}.personal-machine-editor input[type=text],.personal-machine-editor fieldset input{border:1px solid var(--pw-line-strong);width:100%;min-width:0;min-height:42px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 11px;font-size:13px}.personal-machine-editor fieldset:disabled{opacity:.58}.personal-machine-editor fieldset:disabled input{cursor:not-allowed}.personal-machine-json-editor>label{gap:7px;padding:20px;display:grid}.personal-machine-json-editor>label>span{font-size:12px;font-weight:650}.personal-machine-json-editor>label>small{color:var(--pw-muted);font-size:10.5px;line-height:1.5}.personal-machine-json-editor textarea{resize:vertical;border:1px solid var(--pw-line-strong);width:100%;min-width:0;color:var(--pw-text);tab-size:2;background:#fafafa;border-radius:9px;padding:12px 13px;font:12px/1.6 SFMono-Regular,Consolas,monospace}.personal-machine-json-editor textarea:focus-visible{outline:2px solid var(--pw-blue);outline-offset:2px}.personal-machine-validation,.personal-machine-error,.personal-machine-notice{border-radius:9px;margin:0 20px 16px;padding:10px 12px;font-size:11px;line-height:1.5}.personal-machine-validation,.personal-machine-error{background:var(--pw-red-bg);color:var(--pw-red);border:1px solid #edc1ba}.personal-machine-notice{background:var(--pw-green-bg);color:var(--pw-green);border:1px solid #bcdacb;align-items:center;gap:8px;display:flex}.personal-machine-preview{background:#f8faff;border:1px solid #aebfec;border-radius:12px;margin:0 20px 18px;padding:14px}.personal-machine-preview header{justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-machine-preview header strong{font-size:12px}.personal-machine-preview header span{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:99px;padding:3px 8px;font-size:10px;font-weight:650}.personal-machine-preview dl{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:12px 0;display:grid}.personal-machine-preview dl div{background:#fff;border:1px solid #dfe5f3;border-radius:8px;min-width:0;padding:8px}.personal-machine-preview dt{color:var(--pw-muted);font-size:9.5px}.personal-machine-preview dd{overflow-wrap:anywhere;margin:4px 0 0;font-family:SFMono-Regular,Consolas,monospace;font-size:10.5px;font-weight:650}.personal-machine-preview p{color:#52627f;margin:0;font-size:10.5px;line-height:1.5}.personal-machine-rollback{border:1px solid var(--pw-line);background:#faf9f6;border-radius:12px;justify-content:space-between;align-items:center;gap:18px;margin:0 20px 18px;padding:13px 14px;display:flex}.personal-machine-rollback strong{font-size:12px}.personal-machine-rollback p{color:var(--pw-muted);margin:3px 0 0;font-size:10.5px;line-height:1.45}.personal-machine-rollback .personal-secondary-action{flex:none;width:auto;min-height:40px;margin:0;padding:0 13px}.personal-machine-editor>footer{border-top:1px solid var(--pw-line);background:#faf9f6;justify-content:flex-end;gap:10px;padding:15px 20px;display:flex}.personal-machine-editor>footer .personal-primary-action,.personal-machine-editor>footer .personal-secondary-action,.personal-machine-editor>footer .personal-danger-action{width:auto;min-height:42px;margin:0;padding:0 15px}.personal-machine-unavailable{border:1px dashed var(--pw-line-strong);min-height:180px;color:var(--pw-muted);background:#fff;border-radius:14px;justify-items:start;gap:8px;padding:26px;display:grid}.personal-machine-unavailable strong{color:var(--pw-text);font-size:13px}.personal-machine-unavailable p{max-width:540px;margin:0;font-size:11px;line-height:1.6}.personal-lark-loading,.personal-lark-empty{min-height:130px;color:var(--pw-muted);justify-content:center;align-items:center;gap:8px;font-size:13px;display:flex}.personal-lark-apps{max-width:1180px;margin:0 auto}.personal-lark-app-toolbar{color:var(--pw-muted);justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;font-size:11px;display:flex}.personal-lark-app-toolbar .personal-primary-action{width:auto;min-height:40px;margin:0;padding:0 16px}.personal-lark-app-grid{grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px;display:grid}.personal-lark-app-card{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:15px;grid-template-columns:42px minmax(0,1fr) auto;align-items:center;gap:11px;padding:18px;display:grid}.personal-lark-app-avatar{background:var(--pw-blue-soft);width:42px;height:42px;color:var(--pw-blue);border-radius:12px;place-items:center;display:grid}.personal-lark-app-card div{gap:3px;display:grid}.personal-lark-app-card small,.personal-lark-app-card p{color:var(--pw-muted);font-size:11px}.personal-lark-app-card em{border-radius:99px;padding:3px 9px;font-size:10px;font-style:normal;font-weight:650}.personal-lark-app-card em.is-ready{background:var(--pw-green-bg);color:var(--pw-green)}.personal-lark-app-card em.is-off{color:var(--pw-muted);background:#f1f1ee}.personal-lark-app-card p{grid-column:2/-1;margin:0}.personal-lark-connections{max-width:1180px;margin:0 auto}.personal-lark-route-readiness{background:var(--pw-amber-bg);color:var(--pw-amber);border:1px solid #ead49a;border-radius:10px;align-items:center;gap:8px;margin:0 0 12px;padding:10px 12px;font-size:12px;font-weight:650;line-height:1.5;display:flex}.personal-lark-route-readiness svg{flex:none}.personal-lark-toolbar{justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;display:flex}.personal-lark-toolbar>label{border:1px solid var(--pw-line);max-width:680px;height:40px;color:var(--pw-faint);background:#fff;border-radius:10px;flex:1;align-items:center;gap:8px;padding:0 12px;display:flex}.personal-lark-toolbar input{width:100%;font:inherit;background:0 0;border:0;outline:0}.personal-lark-toolbar .personal-primary-action{flex:none;width:auto;min-height:40px;margin-top:0;padding:0 16px}.personal-lark-table{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:14px;overflow:hidden}.personal-lark-table-head,.personal-lark-table-row{grid-template-columns:1.35fr 1.35fr .72fr .72fr 100px;align-items:center;gap:16px;padding:12px 16px;display:grid}.personal-lark-table-head{border-bottom:1px solid var(--pw-line);min-height:42px;color:var(--pw-faint);letter-spacing:.04em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-lark-table-row{border-bottom:1px solid var(--pw-line);min-height:70px;font-size:12px}.personal-lark-table-row:last-of-type{border-bottom:0}.personal-lark-table-row>span{gap:3px;min-width:0;display:grid}.personal-lark-table-row strong,.personal-lark-table-row small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.personal-lark-table-row small{color:var(--pw-muted);font-size:10px}.personal-lark-row-actions{justify-content:flex-end;display:flex!important}.personal-lark-row-actions button,.personal-lark-modal header button{border:1px solid var(--pw-line);min-height:30px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:8px;align-items:center;gap:4px;padding:0 8px;font-size:10px;display:inline-flex}.personal-lark-row-actions button.is-confirm{background:var(--pw-red-bg);color:var(--pw-red);border-color:#e6b0aa}.personal-lark-modal-backdrop{z-index:80;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background:#1e1f2361;place-items:center;padding:24px;display:grid;position:fixed;inset:0}.personal-lark-modal{border:1px solid var(--pw-line);background:#fff;border-radius:18px;gap:14px;width:min(560px,100%);max-height:calc(100vh - 48px);padding:22px;display:grid;overflow:auto;box-shadow:0 24px 70px #14182340}.personal-lark-modal header{justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.personal-lark-modal header small{color:var(--pw-muted);font-size:10px}.personal-lark-modal h2{letter-spacing:-.02em;margin:3px 0 0;font-size:20px}.personal-lark-modal>label{color:var(--pw-muted);gap:7px;font-size:11px;font-weight:650;display:grid}.personal-lark-modal>label>small{color:var(--pw-faint);font-size:10px;font-weight:450;line-height:1.45}.personal-lark-modal input[type=search],.personal-lark-modal input[type=text],.personal-lark-modal input:not([type]),.personal-lark-modal select{border:1px solid var(--pw-line-strong);width:100%;min-height:40px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 11px}.personal-lark-modal label:has(input[type=search]){grid-template-columns:1fr}.personal-lark-modal label:has(input[type=search]) input{margin-bottom:2px}.personal-lark-group-state{border:1px dashed var(--pw-line-strong);min-height:40px;color:var(--pw-muted);background:#fafaf8;border-radius:9px;align-items:center;gap:7px;padding:9px 11px;font-size:11px;font-weight:500;line-height:1.45;display:flex}.personal-lark-group-state.is-error{background:var(--pw-red-bg);color:var(--pw-red);border-style:solid;border-color:#efc3bd}.personal-lark-check{border:1px solid var(--pw-line);background:#fafaf8;border-radius:10px;align-items:flex-start;padding:12px;gap:10px!important;display:flex!important}.personal-lark-check input{accent-color:var(--pw-blue);margin-top:2px}.personal-lark-check span{gap:2px;display:grid}.personal-lark-check strong{color:var(--pw-text)}.personal-lark-check small{font-weight:400}.personal-lark-agent-apps{color:var(--pw-muted);border:0;gap:7px;margin:0;padding:0;display:grid}.personal-lark-agent-apps legend{margin-bottom:1px;font-size:11px;font-weight:650}.personal-lark-agent-apps>small{color:var(--pw-faint);font-size:10px;line-height:1.45}.personal-lark-agent-apps>div{gap:8px;display:grid}.personal-lark-agent-apps label{border:1px solid var(--pw-line);background:#fafaf8;border-radius:10px;grid-template-columns:minmax(0,1fr) minmax(180px,1fr);align-items:center;gap:12px;padding:10px 11px;display:grid}.personal-lark-agent-apps label>span{gap:2px;min-width:0;display:grid}.personal-lark-agent-apps label strong{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;font-size:11px;overflow:hidden}.personal-lark-agent-apps label small{color:var(--pw-faint);text-overflow:ellipsis;white-space:nowrap;font-size:9px;overflow:hidden}.personal-lark-agent-apps select{min-width:0}.personal-lark-ingress{color:var(--pw-muted);border:0;gap:7px;margin:0;padding:0;display:grid}.personal-lark-ingress legend{margin-bottom:1px;font-size:11px;font-weight:650}.personal-lark-ingress>div{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;display:grid}.personal-lark-ingress label{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:10px;min-height:84px;padding:11px;display:block;position:relative}.personal-lark-ingress label.is-active{border-color:var(--pw-blue);background:#2f69eb0f;box-shadow:0 0 0 1px #2f69eb24}.personal-lark-ingress input{opacity:0;width:1px;height:1px;position:absolute}.personal-lark-ingress span{gap:5px;display:grid}.personal-lark-ingress strong{color:var(--pw-text);font-size:11px}.personal-lark-ingress small{color:var(--pw-faint);font-size:9px;font-weight:450;line-height:1.35}.personal-lark-topic-preview{border:1px solid var(--pw-line);min-height:40px;color:var(--pw-text);background:#f7f7f4;border-radius:9px;align-items:center;gap:8px;padding:0 11px;font-size:12px;font-weight:500;display:flex}.personal-lark-topic-preview.is-locked{color:var(--pw-muted)}.personal-lark-cardinality{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:9px;align-items:center;gap:8px;margin:0;padding:10px 12px;font-size:11px;display:flex}.personal-lark-modal footer{z-index:2;border-top:1px solid var(--pw-line);background:#fff;justify-content:flex-end;gap:9px;margin:0 -22px -22px;padding:12px 22px 22px;display:flex;position:sticky;bottom:-22px}.personal-lark-modal footer button{width:auto;min-width:96px;margin-top:0;padding:0 16px}@media (width<=640px){.personal-lark-agent-apps label{grid-template-columns:1fr}}.personal-lark-modal-backdrop.is-setup{z-index:90}.personal-lark-setup-modal{width:min(620px,100%)}.personal-lark-setup-copy{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-lark-setup-progress{border:1px solid var(--pw-line);background:#fafaf8;border-radius:13px;grid-template-columns:46px minmax(0,1fr);align-items:center;gap:13px;min-height:132px;padding:18px;display:grid}.personal-lark-setup-progress>div{gap:5px;display:grid}.personal-lark-setup-progress p{color:var(--pw-muted);margin:0;font-size:11px;line-height:1.5}.personal-lark-setup-progress a{width:fit-content;color:var(--pw-blue);grid-column:2;align-items:center;gap:6px;font-size:11px;font-weight:650;text-decoration:none;display:inline-flex}.personal-lark-setup-icon{background:var(--pw-blue-soft);width:46px;height:46px;color:var(--pw-blue);border-radius:13px;place-items:center;display:grid}.personal-lark-setup-icon.is-ready{background:var(--pw-green-bg);color:var(--pw-green)}.personal-lark-setup-icon.is-failed,.personal-row-status.is-blocking{background:var(--pw-red-bg);color:var(--pw-red)}.personal-proposal-row{width:100%;color:inherit;cursor:pointer;text-align:left;background:#f5f8ff;border:1px solid #c3d3f9;border-radius:14px;grid-template-columns:36px minmax(0,1fr) auto;align-items:center;gap:12px;padding:14px;display:grid}.personal-proposal-row:hover{border-color:#8fabe9;box-shadow:0 2px 10px #2f66e814}.personal-proposal-row>span:first-child{color:#315fc8;background:#e4ebff;border-radius:11px;place-items:center;width:36px;height:36px;display:grid}.personal-proposal-row>span:nth-child(2){gap:3px;min-width:0;display:grid}.personal-proposal-row small{color:#5f74ad;font-size:10px}.personal-proposal-row strong{font-size:13px}.personal-proposal-row p{color:#686f7c;margin:0;font-size:11px}.personal-proposal-row>b{color:#315fc8;font-size:11px}.personal-proposal-row.is-applied{background:#f3fbf7;border-color:#b5ddcc}.personal-proposal-row.is-error,.personal-proposal-row.is-stale{background:#fff7f7;border-color:#efc3c3}.personal-proposal-row.is-gated{background:#fffaf0;border-color:#ead39c}.personal-gated-summary{background:#fffaf0;border:1px solid #ead39c;border-radius:14px}.personal-gated-summary>summary{color:#6d5620;cursor:pointer;align-items:center;gap:9px;padding:12px 14px;list-style:none;display:flex}.personal-gated-summary>summary::-webkit-details-marker{display:none}.personal-gated-summary>summary>span{color:#9a741d;background:#fff1c9;border-radius:9px;place-items:center;width:30px;height:30px;display:grid}.personal-gated-summary>summary small{color:#927d4c;margin-left:auto}.personal-gated-summary>div{gap:8px;padding:0 8px 8px;display:grid}.personal-gated-summary .personal-proposal-row{background:#fffdf7}.personal-schedule-row{border:1px solid var(--pw-line);background:var(--pw-card);width:100%;color:inherit;cursor:pointer;text-align:left;border-radius:14px;grid-template-columns:36px minmax(0,1fr) auto 16px;align-items:center;gap:12px;padding:13px 15px;display:grid}.personal-schedule-row:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-schedule-icon{width:34px;height:34px;color:var(--pw-muted);background:#f2f1ed;border-radius:11px;place-items:center;display:grid}.personal-schedule-copy{gap:2px;min-width:0;display:grid}.personal-schedule-copy small,.personal-schedule-copy p{color:var(--pw-muted);margin:0;font-size:10px}.personal-schedule-copy strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;overflow:hidden}.personal-schedule-status{background:var(--pw-green-bg);color:var(--pw-green);border-radius:99px;align-items:center;padding:2.5px 10px;font-size:11px;font-weight:600;display:inline-flex}.personal-schedule-status.is-paused{color:var(--pw-muted);background:#f2f1ed}.personal-timeline-empty{text-align:center;place-items:center;padding:70px 20px;display:grid}.personal-timeline-empty>span{background:var(--pw-blue-soft);width:44px;height:44px;color:var(--pw-blue);border-radius:14px;place-items:center;margin-bottom:14px;display:grid}.personal-timeline-empty p{max-width:420px;color:var(--pw-muted);font-size:13px}.personal-object-list{border:1px solid var(--pw-line);background:#fff;border-radius:14px;overflow:hidden}.personal-object-list>header,.personal-object-list>button{border:0;border-bottom:1px solid var(--pw-line);width:100%;min-height:52px;color:inherit;text-align:left;background:0 0;grid-template-columns:28px minmax(0,1fr) auto;align-items:center;gap:10px;padding:10px 15px;display:grid}.personal-object-list>header{min-height:46px;color:var(--pw-faint);letter-spacing:.06em;grid-template-columns:minmax(0,1fr) auto;font-size:12px;font-weight:650}.personal-object-list>button{cursor:pointer}.personal-object-list>button:hover{background:#faf9f6}.personal-object-list>button:last-child{border-bottom:0}.personal-object-list>button>p{color:var(--pw-muted);text-overflow:ellipsis;white-space:nowrap;grid-column:2/-1;margin:-3px 0 0;font-size:12px;line-height:1.45;overflow:hidden}.personal-object-list>button>em{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:999px;justify-self:end;padding:2px 7px;font-size:10px;font-style:normal;font-weight:700}.personal-object-list small{color:var(--pw-muted)}.personal-object-list>button>small{white-space:nowrap;align-items:center;gap:8px;display:inline-flex}.personal-object-list-state{border-bottom:1px solid var(--pw-line);color:var(--pw-muted);align-items:center;gap:8px;margin:0;padding:14px 15px;font-size:12px;line-height:1.5;display:flex}.personal-object-list-state.is-error{color:var(--pw-red);background:var(--pw-red-bg)}.personal-object-list .is-done{color:var(--pw-green)}.personal-object-list .is-attention{color:var(--pw-amber);font-weight:700}.personal-task-age{color:var(--pw-faint);font-size:11px}.personal-task-empty{color:var(--pw-muted);margin:0;padding:4px 15px 16px;font-size:12.5px}.personal-task-lane-filter{border:1px solid var(--pw-line);background:#fff;border-radius:10px;justify-content:space-between;align-items:center;gap:16px;min-height:50px;padding:8px 12px;display:flex}.personal-capability-settings{grid-template-rows:auto minmax(0,1fr);gap:16px;width:100%;min-width:0;max-width:1050px;min-height:0;display:grid;overflow:hidden}.personal-capability-body{flex-direction:column;gap:16px;min-width:0;min-height:0;display:flex;overflow:hidden}.personal-capability-body>.personal-capability-layout{flex:auto}.personal-provider-settings{width:100%;min-width:0;max-width:1050px}.personal-provider-settings>.personal-operator-credential{margin-top:0}.personal-capability-scope-note{overscroll-behavior:contain;max-height:120px;color:var(--pw-muted);padding:12px 0;overflow:auto}.personal-capability-scope-note summary{cursor:pointer;align-items:center;gap:8px;font-size:12px;display:flex}.personal-capability-scope-note p{padding:10px 0 0 25px}.personal-capability-scope-note svg{flex:none;margin-top:2px}.personal-operator-credential{border:1px solid var(--pw-border);background:var(--pw-surface);border-radius:10px;gap:12px;margin:16px 0 24px;padding:16px;display:grid}.personal-operator-credential>header{grid-template-columns:auto 1fr auto;align-items:start;gap:10px;display:grid}.personal-operator-credential>header strong{font-size:13px;display:block}.personal-operator-credential>header p{color:var(--pw-muted);margin:4px 0 0;font-size:12px;line-height:1.5}.personal-operator-credential-status{color:var(--pw-muted);font-family:var(--pw-font-mono);font-size:11px}.personal-operator-credential-readback{gap:6px;margin:0;font-size:12px;display:grid}.personal-operator-credential-readback>div{grid-template-columns:140px 1fr;gap:10px;display:grid}.personal-operator-credential-readback dt{color:var(--pw-muted)}.personal-operator-credential-readback dd{overflow-wrap:anywhere;margin:0}.personal-operator-credential label{gap:4px;font-size:12px;display:grid}.personal-operator-credential input{border:1px solid var(--pw-border);background:var(--pw-canvas);color:inherit;border-radius:8px;padding:7px 9px;font-size:12px}.personal-operator-credential input:disabled{opacity:.6}.personal-capability-scope-note p{margin:0;font-size:12px;line-height:1.55}.personal-capability-scope-note strong{color:var(--pw-text);display:block}.personal-capability-layout{grid-template-columns:220px minmax(0,1fr);align-items:stretch;gap:24px;min-width:0;min-height:0;display:grid;overflow:hidden}.personal-capability-list{overscroll-behavior:contain;scrollbar-gutter:stable;align-content:start;gap:6px;min-height:0;padding:3px;display:grid;overflow-y:auto}.personal-capability-list button{min-height:44px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border:1px solid #0000;border-radius:6px;justify-content:space-between;align-items:center;gap:8px;padding:10px 12px;display:flex}.personal-capability-list button:hover{border-color:#b8c9f5}.personal-capability-list button[aria-current=page]{background:#f4f7ff;border-color:#8cacf0;box-shadow:0 0 0 3px #2f66e914}.personal-capability-list button>span{gap:2px;min-width:0;display:grid}.personal-capability-list em{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:999px;flex:none;padding:3px 6px;font-size:9px;font-style:normal;font-weight:750}.personal-capability-list strong{overflow-wrap:anywhere;font-size:13px;font-weight:500;line-height:1.5}.personal-capability-detail{overscroll-behavior:contain;scrollbar-gutter:stable;border:1px solid var(--pw-line);background:#fff;border-radius:14px;align-self:start;min-width:0;min-height:0;max-height:100%;overflow:auto}.personal-capability-detail>header{border-bottom:1px solid var(--pw-line);align-items:flex-start;gap:12px;padding:24px;display:flex}.personal-capability-detail>header>div{flex:1;min-width:0}.personal-capability-help{color:var(--pw-muted);margin-top:8px;font-size:12px}.personal-capability-help summary{cursor:pointer}.personal-capability-help p{padding-top:12px}.personal-capability-help dl{gap:12px;margin-bottom:0;display:grid}.personal-capability-help dt{color:var(--pw-text);font-weight:500}.personal-capability-help dd{margin:4px 0 0;line-height:1.6}.personal-capability-detail h2{margin:2px 0 4px;font-size:17px}.personal-capability-detail p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.55}.personal-capability-value-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:16px 18px;display:grid}.personal-capability-raw-values{border-top:1px solid var(--pw-line)}.personal-capability-raw-values>summary{cursor:pointer;color:var(--pw-text);padding:16px 18px;font-size:12px}.personal-capability-raw-values>summary:focus-visible{outline:2px solid var(--pw-blue);outline-offset:-2px}.personal-capability-value-grid section{min-width:0}.personal-capability-value-grid strong,.personal-capability-field-summary>strong{font-size:11px}.personal-capability-value-grid pre{border:1px solid var(--pw-line);min-height:72px;max-height:220px;color:var(--pw-text);background:#faf9f6;border-radius:9px;margin:7px 0 0;padding:11px;font-size:10.5px;line-height:1.5;overflow:auto}.personal-capability-editor-status{border-radius:10px;align-items:flex-start;gap:10px;margin:20px 24px;padding:12px;display:flex}.personal-capability-heading-row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;display:flex}.personal-capability-heading-row .personal-capability-effective-source{color:var(--pw-muted);align-items:center;gap:6px;margin:0;display:flex}.personal-capability-effective-source span{color:var(--pw-muted);flex-wrap:wrap;gap:6px;font-size:11px;display:flex}.personal-capability-effective-source strong{color:var(--pw-text)}.personal-capability-editor-status svg{flex:none;margin-top:1px}.personal-capability-editor-status strong{font-size:12px}.personal-capability-editor-status p{margin-top:3px}.personal-capability-editor-status.is-preview{background:var(--pw-blue-soft);color:var(--pw-blue-ink)}.personal-capability-editor-status.is-read-only{color:#9a5a10;background:#fff5e8}.personal-capability-linked-setting{border:1px solid var(--pw-line);background:var(--pw-bg);border-radius:10px;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:16px;margin:0 24px 20px;padding:14px;display:grid}.personal-capability-linked-setting>div{gap:4px;display:grid}.personal-capability-linked-setting strong{font-size:12px}.personal-capability-linked-setting .personal-notification-toggle{justify-self:end;min-height:44px}.personal-capability-linked-setting .personal-notification-error{grid-column:1/-1}.personal-capability-behavior-note{border:1px solid var(--pw-line);background:var(--pw-amber-bg);color:var(--pw-amber);border-radius:6px;align-items:flex-start;gap:10px;margin:16px 24px;padding:12px;display:flex}.personal-capability-behavior-note svg{flex:none;margin-top:1px}.personal-capability-behavior-note strong{font-size:12px}.personal-capability-behavior-note p{color:inherit;margin-top:3px}.personal-capability-editor-mode{color:var(--pw-muted);justify-content:flex-end;align-items:center;gap:12px;margin:8px 24px 0;font-size:11px;display:flex}.personal-capability-editor-mode button{min-height:44px;color:var(--pw-muted);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;gap:6px;padding:0 12px;font-size:11px;font-weight:650;display:inline-flex}.personal-capability-editor-mode button:hover{background:var(--pw-blue-soft);color:var(--pw-text)}.personal-capability-editor-mode button:disabled{cursor:not-allowed;opacity:.45}.personal-capability-field-summary{padding:20px 24px 24px}.personal-capability-field-summary .personal-capability-fields{margin-top:0}.personal-capability-fields{border:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:0;padding:0;display:grid}.personal-report-schedule{grid-column:1/-1;grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr));gap:12px;min-width:0;display:grid}.personal-report-schedule p{color:var(--pw-muted);overflow-wrap:anywhere;grid-column:1/-1;margin:0;font-size:12px}.personal-capability-fields label{align-content:start;gap:6px;min-width:0;display:grid}.personal-capability-fields label>span{font-size:12px;font-weight:650}.personal-capability-fields input:not([type=checkbox]),.personal-capability-fields select,.personal-capability-fields textarea{border:1px solid var(--pw-line-strong);width:100%;min-width:0;min-height:42px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:8px 11px;font-size:13px}.personal-capability-fields .is-boolean{border-bottom:1px solid var(--pw-line);grid-column:1/-1;grid-template-columns:minmax(0,1fr) auto;align-items:center;min-height:48px;padding-bottom:12px}.personal-capability-enabled-row{border-bottom:1px solid var(--pw-line);grid-column:1/-1;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:16px;min-width:0;min-height:60px;padding-bottom:12px;display:grid}.personal-capability-enabled-row>.is-boolean{display:contents}.personal-capability-enabled-row>.is-boolean>span{grid-area:1/1}.personal-capability-enabled-row>.is-boolean>input{grid-area:1/3}.personal-capability-enabled-row>.personal-capability-edit-json{grid-area:1/2}.personal-capability-edit-json{min-height:44px;color:var(--pw-muted);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;align-items:center;gap:6px;padding:0 8px;font-size:11px;display:inline-flex}.personal-capability-edit-json:hover{background:var(--pw-blue-soft);color:var(--pw-text)}.personal-capability-edit-json:disabled{cursor:not-allowed;opacity:.45}.personal-capability-fields .is-boolean input{appearance:none;border:1px solid var(--pw-line-strong);background:var(--pw-line);cursor:pointer;border-radius:999px;width:40px;height:24px;margin:0;padding:2px}.personal-capability-fields .is-boolean input:before{content:"";background:#fff;border-radius:50%;width:18px;height:18px;display:block}.personal-capability-fields .is-boolean input:checked{background:var(--pw-text)}.personal-capability-fields .is-boolean input:checked:before{transform:translate(16px)}.personal-capability-fields .is-boolean input:focus-visible{outline:2px solid var(--pw-blue);outline-offset:3px}.personal-capability-fields:disabled{opacity:.62}.personal-capability-json-editor{gap:7px;margin:0;padding:0 18px 18px;display:grid}.personal-capability-json-editor>span{font-size:11px;font-weight:650}.personal-capability-json-editor>small{color:var(--pw-muted);font-size:10.5px;line-height:1.5}.personal-capability-json-editor textarea{resize:vertical;border:1px solid var(--pw-line-strong);width:100%;min-width:0;color:var(--pw-text);tab-size:2;background:#fafafa;border-radius:9px;padding:12px 13px;font:12px/1.6 SFMono-Regular,Consolas,monospace}.personal-capability-json-editor textarea:focus-visible{outline:2px solid var(--pw-blue);outline-offset:2px}.personal-capability-preview{background:#f4f7ff;border:1px solid #9fb9f4;border-radius:10px;grid-template-columns:minmax(0,1fr) auto;gap:3px 12px;margin:0 18px 16px;padding:12px;display:grid}.personal-capability-preview strong{font-size:12px}.personal-capability-preview span{color:var(--pw-blue-ink);font-size:11px;font-weight:700}.personal-capability-preview small{color:var(--pw-muted);grid-column:1/-1;font-size:10.5px}.personal-capability-actions,.personal-operator-credential-actions{border-top:1px solid var(--pw-line);background:0 0;justify-content:flex-end;gap:9px;padding:14px 18px;display:flex}.personal-capability-actions button,.personal-operator-credential-actions button{border:1px solid var(--pw-line-strong);min-height:44px;color:var(--pw-text);cursor:pointer;font:inherit;background:#fff;border-radius:9px;padding:0 14px;font-size:12px;font-weight:700}.personal-capability-actions button.is-primary,.personal-operator-credential-actions button.is-primary{border-color:var(--pw-blue);background:var(--pw-blue);color:#fff}.personal-capability-actions button.is-danger,.personal-operator-credential-actions button.is-danger{color:var(--pw-red);align-items:center;gap:6px;margin-right:auto;display:inline-flex}.personal-capability-actions button:disabled,.personal-operator-credential-actions button:disabled{cursor:not-allowed;opacity:.5}.personal-capability-empty,.personal-capability-error{border:1px solid var(--pw-line);max-width:720px;min-height:56px;color:var(--pw-muted);background:#fff;border-radius:11px;align-items:center;gap:9px;margin:0;padding:14px;font-size:12px;display:flex}.personal-capability-error{color:var(--pw-red);border-color:#efc1ba}.personal-capability-error span{gap:2px;display:grid}.personal-capability-error small{color:var(--pw-muted)}.personal-capability-error button{min-height:44px;color:inherit;cursor:pointer;background:0 0;border:1px solid;border-radius:9px;align-items:center;gap:6px;margin-left:auto;padding:0 12px;display:inline-flex}.personal-capability-recovery{color:#74530d;background:#fffaf0;border:1px solid #dfc98d;border-radius:10px;grid-template-columns:auto minmax(0,1fr) auto;align-items:start;gap:9px;margin:0 20px 16px;padding:12px;font-size:11px;line-height:1.5;display:grid}.personal-capability-recovery div{gap:3px;display:grid}.personal-capability-recovery p{margin:0}.personal-capability-recovery small{color:var(--pw-muted);overflow-wrap:anywhere}.personal-capability-recovery button{min-height:40px;color:inherit;cursor:pointer;background:0 0;border:1px solid;border-radius:8px;align-items:center;gap:6px;padding:0 10px;display:inline-flex}.personal-task-lane-filter>div{min-width:0;color:var(--pw-muted);align-items:center;gap:9px;display:flex}.personal-task-lane-filter>div>span{gap:1px;display:grid}.personal-task-lane-filter strong{color:var(--pw-text);font-size:12px}.personal-task-lane-filter small{color:var(--pw-faint);font-size:10.5px}.personal-task-lane-filter label{border:1px solid var(--pw-line-strong);background:var(--pw-bg);border-radius:8px;align-items:center;gap:6px;min-height:34px;padding:0 9px;display:flex}.personal-task-lane-filter select{max-width:300px;color:var(--pw-text);font:inherit;appearance:none;background:0 0;border:0;outline:0;font-size:11.5px;font-weight:600}.personal-task-board{flex-direction:column;gap:12px;height:100%;min-height:0;display:flex}.personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-board.is-list-view){overflow-y:auto}.personal-task-board.is-list-view{gap:24px;height:auto;min-height:100%}.personal-task-view-toolbar{flex:none;justify-content:space-between;align-items:center;gap:16px;display:flex}.personal-task-view-toolbar>div:first-child{gap:4px;display:grid}.personal-task-view-toolbar strong{font-size:16px;font-weight:600}.personal-task-view-toolbar span{color:var(--pw-muted);font-size:12px}.personal-task-view-switch{border:1px solid var(--pw-line);background:var(--pw-bg);border-radius:8px;flex:none;padding:3px;display:flex}.personal-task-view-switch button{min-height:36px;color:var(--pw-muted);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:5px;padding:0 14px;font-size:13px}.personal-task-view-switch button[aria-pressed=true]{background:var(--pw-text);color:var(--pw-bg)}.personal-task-grouped-list{gap:24px;padding-bottom:24px;display:grid}.personal-completed-list{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px}.personal-completed-list>header{min-height:48px;color:var(--pw-text);padding:2px 16px}.personal-completed-list>header>button{color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;min-height:44px;padding:0}.personal-completed-list .personal-task-lane-scroll{height:480px;max-height:60vh;overflow-y:auto}.personal-completed-list .personal-task-lane-scroll[hidden]{display:none}.personal-completed-list .personal-completed-row>button{border:0;border-bottom:1px solid var(--pw-line);text-align:left;background:0 0;grid-template-columns:20px minmax(0,1fr);gap:8px 12px;width:100%;height:100%;padding:16px;display:grid}.personal-completed-list .personal-completed-row>button>strong{-webkit-line-clamp:2}.personal-completed-list .personal-completed-row>button>small{grid-column:2}.personal-task-group{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;min-width:0}.personal-task-group>summary{cursor:pointer;align-items:center;gap:8px;min-height:48px;padding:10px 16px;list-style:none;display:flex}.personal-task-group>summary::-webkit-details-marker{display:none}.personal-task-group>summary strong{font-size:12px;font-weight:600;line-height:18px}.personal-task-group>summary span{background:var(--pw-line);color:var(--pw-muted);border-radius:6px;padding:2px 7px;font-size:12px}.personal-task-group>summary svg{color:var(--pw-muted);transform:rotate(-90deg)}.personal-task-group[open]>summary svg{transform:none}.personal-task-group.tone-attention>summary{color:var(--pw-amber)}.personal-task-list-rows{padding:0 16px 8px}.personal-task-list-rows>button,.personal-task-list-rows>.personal-task-card>button{border:0;border-top:1px solid var(--pw-line);width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border-radius:0;grid-template-columns:20px minmax(0,1fr);gap:8px 12px;padding:16px 4px;display:grid}.personal-task-list-rows>button:hover,.personal-task-list-rows>.personal-task-card>button:hover{background:var(--pw-line)}.personal-task-list-rows>button>strong,.personal-task-list-rows>.personal-task-card>button>strong{-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;font-size:14px;font-weight:500;line-height:20px;display:-webkit-box;overflow:hidden}.personal-task-list-rows>button>small,.personal-task-list-rows>.personal-task-card>button>small{color:var(--pw-muted);overflow-wrap:anywhere;flex-wrap:wrap;grid-column:2;align-items:center;gap:8px;font-size:12px;line-height:16px;display:flex}.personal-task-list-rows .personal-task-card-actions{background:var(--pw-card);top:auto;bottom:12px}@media (width>=721px){.personal-channel-header:has(~.personal-channel-scroll[data-active-goal-view=tasks] .is-list-view){flex-wrap:wrap}.personal-channel-header:has(~.personal-channel-scroll[data-active-goal-view=tasks] .is-list-view) .personal-channel-title{flex-basis:100%}}.personal-task-kanban{flex:1;grid-template-columns:repeat(auto-fit,minmax(172px,1fr));align-items:stretch;gap:12px;min-height:0;display:grid}.personal-task-chat-receipt{background:#f8faff;border:1px solid #d8e2f8;border-radius:10px;grid-template-columns:28px minmax(0,1fr) auto;align-items:center;gap:10px;padding:8px 12px;display:grid;box-shadow:0 1px 3px #2f66e90a}.personal-task-chat-icon{background:var(--pw-blue-soft);width:28px;height:28px;color:var(--pw-blue-ink);border-radius:8px;place-items:center;display:grid}.personal-task-chat-receipt>div{min-width:0}.personal-task-chat-receipt header{align-items:center;gap:8px;display:flex}.personal-task-chat-receipt header strong{font-size:12px;font-weight:650}.personal-task-chat-receipt header small{color:var(--pw-faint);font-size:10px}.personal-task-chat-receipt p{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;grid-template-columns:36px minmax(0,1fr);gap:5px;margin:3px 0;font-size:12px;line-height:1.4;display:grid;overflow:hidden}.personal-task-chat-receipt p b{color:var(--pw-faint);font-size:10px;font-weight:650}.personal-task-chat-receipt p.is-assistant{max-height:2.8em;color:var(--pw-muted);white-space:normal}.personal-task-chat-receipt>div>small{color:var(--pw-muted);font-size:10.5px;line-height:1.4}.personal-task-chat-receipt footer{gap:6px;display:flex}.personal-task-chat-receipt footer button{min-height:26px;color:var(--pw-blue-ink);cursor:pointer;white-space:nowrap;background:#fff;border:1px solid #b9c9ee;border-radius:7px;align-items:center;gap:4px;padding:3px 8px;font-size:10.5px;font-weight:650;display:inline-flex}.personal-task-chat-receipt footer button:hover{border-color:var(--pw-blue);background:var(--pw-blue-soft)}.personal-task-kanban .personal-object-list{background:#f6f4ee;flex-direction:column;min-height:0;padding:0;display:flex}.personal-task-kanban .personal-object-list>header{background:#f6f4ee;border-bottom:1px solid #e0ddd4b8;flex:none;align-items:center;gap:8px;min-height:38px;padding:10px 16px 7px;display:flex}.personal-task-kanban .personal-object-list>header>strong{align-items:center;gap:7px;min-width:0;font-size:12px;display:inline-flex}.personal-task-kanban .personal-object-list>header>span{margin-left:auto}.personal-task-lane-scroll{overscroll-behavior-y:contain;scrollbar-color:#bebbb2 transparent;scrollbar-gutter:stable;scrollbar-width:thin;-webkit-overflow-scrolling:touch;flex-direction:column;flex:auto;gap:8px;min-height:0;padding:8px;scroll-padding-block:8px;display:flex;overflow-y:auto}.personal-task-lane-scroll:focus-visible{outline:2px solid var(--pw-blue);outline-offset:-3px}.personal-task-lane-scroll.has-overflow-before{box-shadow:inset 0 12px 10px -13px #34312b94}.personal-task-lane-scroll.has-overflow-after{box-shadow:inset 0 -16px 12px -15px #34312bb3}.personal-task-lane-scroll.has-overflow-before.has-overflow-after{box-shadow:inset 0 12px 10px -13px #34312b94,inset 0 -16px 12px -15px #34312bb3}.personal-task-lane-scroll::-webkit-scrollbar{width:10px}.personal-task-lane-scroll::-webkit-scrollbar-track{background:0 0}.personal-task-lane-scroll::-webkit-scrollbar-thumb{background:#bebbb2 padding-box padding-box;border:3px solid #0000;border-radius:999px;min-height:40px}.personal-task-lane-scroll::-webkit-scrollbar-thumb:hover{background:#97938a padding-box padding-box}.personal-kanban-dot{background:var(--pw-faint);border-radius:50%;width:8px;height:8px}.personal-kanban-dot.tone-attention{background:var(--pw-amber)}.personal-kanban-dot.tone-progress{background:var(--pw-blue)}.personal-kanban-dot.tone-schedule{background:#8a6fd6}.personal-kanban-dot.tone-done{background:var(--pw-green)}.personal-task-kanban .personal-task-lane-scroll>button,.personal-task-kanban .personal-task-card>button{border:1px solid var(--pw-line);width:100%;min-height:0;color:inherit;text-align:left;cursor:pointer;background:#fff;border-radius:10px;grid-template-columns:18px minmax(0,1fr);align-items:center;gap:6px 8px;padding:10px 12px;display:grid;box-shadow:0 1px 3px #1e1c140f}.personal-task-kanban .personal-task-lane-scroll>button:hover,.personal-task-kanban .personal-task-card>button:hover{border-color:var(--pw-line-strong);background:#fff;box-shadow:0 2px 8px #1e1c1417}.personal-task-kanban .personal-task-lane-scroll>button>small,.personal-task-kanban .personal-task-card>button>small{white-space:normal;text-align:left;flex-wrap:wrap;grid-column:1/-1;justify-content:flex-start;align-items:center;gap:8px;display:inline-flex}.personal-task-kanban .personal-task-lane-scroll>button:last-child{border-bottom:1px solid var(--pw-line)}.personal-task-kanban .personal-task-lane-scroll>button:last-child:hover{border-color:var(--pw-line-strong)}.personal-task-lane-scroll>button,.personal-task-card{flex:none;min-width:0}.personal-task-lane-scroll>button>small,.personal-task-card>button>small{font-size:12px;line-height:16px}.personal-task-lane-scroll>button>strong,.personal-task-card>button>strong{-webkit-line-clamp:3;overflow-wrap:anywhere;-webkit-box-orient:vertical;font-size:14px;font-weight:500;line-height:20px;display:-webkit-box;overflow:hidden}.personal-task-card{position:relative}.personal-completed-window{flex-shrink:0;position:relative}.personal-completed-row{padding-bottom:8px;position:absolute;inset-inline:0}.personal-completed-row>button{width:100%;height:100%}.personal-completed-row>button>strong{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.personal-completed-footer{color:var(--pw-muted);text-align:center;flex-shrink:0;padding:12px 4px;font-size:12px}.personal-completed-footer button{border:1px solid var(--pw-line);min-height:32px;color:inherit;cursor:pointer;background:0 0;border-radius:6px}.personal-task-card>button{width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:start;display:grid}.personal-task-card-actions{opacity:0;gap:4px;transition:opacity .12s;display:flex;position:absolute;top:6px;right:6px}.personal-task-card:hover .personal-task-card-actions,.personal-task-card:focus-within .personal-task-card-actions,.personal-task-card.has-session .personal-task-card-actions{opacity:1}.personal-task-card.is-selected>button,.personal-task-kanban .personal-task-lane-scroll>button.is-selected{background:#f5f8ff;border-color:#7c9df1;box-shadow:0 0 0 2px #2f66e91f,0 4px 14px #1e34681a}.personal-task-card.is-selected:before{z-index:2;background:var(--pw-blue);content:"";border-radius:0 3px 3px 0;width:3px;position:absolute;top:8px;bottom:8px;left:0}.personal-task-card-actions button{border:1px solid var(--pw-line-strong);width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:7px;place-items:center;padding:0;display:grid;box-shadow:0 1px 3px #1e1c141f}.personal-task-card-actions button:hover{color:var(--pw-text);border-color:var(--pw-text)}.personal-task-card-actions button:disabled{cursor:wait;opacity:.72}.personal-task-card-actions .personal-task-session-link{width:auto;color:var(--pw-blue-ink);opacity:1;gap:5px;padding:0 8px;display:flex}.personal-task-session-link span{white-space:nowrap;font-size:10.5px;font-weight:650}.personal-task-session-status{color:var(--pw-blue-ink);font-weight:650}.personal-task-kanban .personal-task-empty{border:1px dashed var(--pw-line-strong);text-align:center;border-radius:10px;margin:2px 0 4px;padding:16px 10px;font-size:12px}.personal-workspace-shell.has-drawer .personal-task-kanban{grid-template-columns:repeat(2,minmax(0,1fr))}.personal-workspace-shell.has-task-inspector .personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-kanban){padding-inline:20px}.personal-workspace-shell.has-task-inspector .personal-task-kanban{grid-template-columns:repeat(4,260px);width:max-content;min-width:100%}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-receipt{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-icon{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-receipt footer button{color:#141414;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-composer-wrap{background:linear-gradient(transparent, var(--pw-bg) 22%);padding:10px max(26px,50% - 410px) 20px}.personal-read-only-notice{border:1px solid var(--pw-line);min-height:46px;color:var(--pw-muted);background:#f5f4f1;border-radius:12px;justify-content:center;align-items:center;gap:8px;padding:10px 16px;font-size:11.5px;display:flex}.personal-read-only-notice strong{color:var(--pw-text);white-space:nowrap}.personal-manager-conversation-tray{width:100%;max-height:320px;color:inherit;font:inherit;text-align:left;background:#fffffff7;border:1px solid #bfcdf1;border-radius:14px;gap:9px;margin-bottom:10px;padding:12px 14px;animation:.16s cubic-bezier(.16,1,.3,1) pw-tray-in;display:grid;overflow:hidden;box-shadow:0 5px 20px #223e781a}@keyframes pw-tray-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}.personal-manager-conversation-tray:hover{border-color:#8fa9ee;box-shadow:0 7px 24px #223e7824}.personal-manager-conversation-tray:focus-within{border-color:var(--pw-blue);box-shadow:0 0 0 3px #2f66e921,0 5px 20px #223e781a}.personal-manager-conversation-tray>header{justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-manager-conversation-tray>header>span{color:var(--pw-blue-ink);align-items:center;gap:7px;display:flex}.personal-manager-conversation-tray>header strong{font-size:16px;font-weight:600;line-height:24px}.personal-manager-conversation-tray>header small{color:var(--pw-faint);font-size:12px;font-weight:500;line-height:16px}.personal-manager-conversation-actions{align-items:center;gap:8px;display:flex}.personal-manager-conversation-btn{min-height:32px;color:var(--pw-blue-ink);cursor:pointer;background:#f4f7fe;border:1px solid #b9c9ee;border-radius:8px;align-items:center;gap:5px;padding:5px 10px;font-size:12px;font-weight:600;line-height:16px;transition:all .12s;display:inline-flex}.personal-manager-conversation-btn:hover{background:var(--pw-blue-soft);border-color:var(--pw-blue)}.personal-manager-conversation-link{min-height:32px;color:var(--pw-blue);cursor:pointer;background:0 0;border:0;border-radius:7px;align-items:center;padding:5px 8px;font-size:14px;font-weight:500;line-height:20px;transition:background .12s;display:inline-flex}.personal-manager-conversation-link:hover{background:var(--pw-blue-soft)}.personal-manager-conversation-close{width:32px;height:32px;color:var(--pw-faint);cursor:pointer;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;padding:0;transition:all .12s;display:inline-flex}.personal-manager-conversation-close:hover{color:#ef4444;background:#fee2e2}.personal-manager-conversation-messages{gap:7px;max-height:220px;display:grid;overflow-y:auto}.personal-manager-conversation-messages article{background:#f5f7fc;border-radius:10px;grid-template-columns:86px minmax(0,1fr);gap:10px;padding:10px 12px;font-size:14px;line-height:20px;display:grid}.personal-manager-conversation-messages article.is-user{background:#edf3ff}.personal-manager-conversation-messages article strong{color:var(--pw-muted);font-size:12px;font-weight:500;line-height:16px}.personal-manager-conversation-bubble{min-width:0}.personal-manager-conversation-bubble p{white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.personal-manager-conversation-bubble .personal-md{font-size:14px;line-height:20px}.personal-manager-conversation-bubble small{color:var(--pw-blue);margin-top:4px;font-size:12px;line-height:16px;display:inline-block}.personal-quick-prompts{flex-wrap:wrap;gap:8px;margin-bottom:9px;display:flex}.personal-quick-prompts button{border:1px solid var(--pw-line-strong);min-height:32px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:99px;align-items:center;gap:6px;padding:5px 12px;font-size:12.5px;transition:all .14s;display:inline-flex}.personal-quick-prompts button:hover{border-color:var(--pw-blue);color:var(--pw-blue-ink)}.personal-quick-prompts button:disabled{opacity:.45;cursor:default}.personal-goal-draft-status{color:var(--pw-muted);background:#f5f7ff;border:1px solid #cfd9f5;border-radius:10px;align-items:center;gap:8px;margin-bottom:9px;padding:8px 11px;font-size:11px;display:flex}.personal-goal-draft-status strong{color:var(--pw-text)}.personal-channel-composer{border:1px solid var(--pw-line-strong);background:#fff;border-radius:16px;grid-template-columns:auto 36px minmax(0,1fr) 40px;align-items:center;min-height:56px;padding:7px 7px 7px 14px;transition:border-color .15s,box-shadow .15s;display:grid;box-shadow:0 2px 10px #1e1c1412}.personal-channel-composer:focus-within{border-color:var(--pw-blue);box-shadow:0 0 0 3px #2f66e921,0 2px 10px #1e1c1412}.personal-channel-composer>span{color:#535b68;align-items:center;gap:7px;padding-right:12px;font-size:12.5px;font-weight:650;display:flex}.personal-channel-composer textarea{resize:none;border:0;border-left:1px solid var(--pw-line);width:100%;max-height:120px;color:inherit;font:inherit;background:0 0;outline:0;padding:9px 12px;line-height:1.4}.personal-channel-composer>button,.personal-correction-composer button{background:var(--pw-blue);color:#fff;cursor:pointer;border:0;border-radius:12px;place-items:center;width:40px;height:40px;display:grid;box-shadow:0 2px 6px #2f66e952}.personal-channel-composer>button:hover{background:var(--pw-blue-ink)}.personal-channel-composer>button:disabled,.personal-correction-composer button:disabled{opacity:.4;cursor:default;box-shadow:none}.personal-channel-composer>.personal-composer-attach{width:34px;height:34px;color:var(--pw-muted);box-shadow:none;background:0 0;border-radius:9px}.personal-channel-composer>.personal-composer-attach:hover{background:var(--pw-blue-soft);color:var(--pw-blue-ink)}.personal-composer-images{gap:8px;margin:0 0 8px;display:flex;overflow-x:auto}.personal-composer-images figure{flex:0 0 74px;height:58px;margin:0;position:relative}.personal-composer-images img{object-fit:cover;border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;width:100%;height:100%}.personal-composer-images button{border:1px solid var(--pw-line-strong);width:20px;height:20px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:50%;place-items:center;padding:0;display:grid;position:absolute;top:-5px;right:-5px;box-shadow:0 1px 4px #1e1c142e}.personal-composer-error{color:var(--pw-red);margin:0 0 7px;font-size:11.5px}.personal-context-drawer{grid-template-rows:auto minmax(0,1fr);height:100vh;display:grid}.personal-drawer-header{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:flex-start;min-height:84px;padding:20px 18px 16px;display:flex}.personal-drawer-header h2{letter-spacing:-.01em;margin:0;font-size:15.5px;font-weight:700}.personal-drawer-header p{color:var(--pw-faint);letter-spacing:.07em;text-transform:uppercase;margin:4px 0 0;font-size:11px;font-weight:650}.personal-drawer-close{flex:0 0 44px;width:44px;height:44px;margin-top:2px}.personal-drawer-body{padding:18px;overflow:auto}.personal-context-drawer[data-context-kind=todo]{background:#fbfbfc}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header{background:#fff;min-height:68px;padding:11px 22px}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header h2{font-size:14px}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header p{text-overflow:ellipsis;white-space:nowrap;max-width:330px;overflow:hidden}.personal-drawer-header-actions{align-items:center;gap:6px;display:flex}.personal-drawer-header-actions .personal-icon-button{flex:none}.personal-context-drawer[data-context-kind=todo] .personal-drawer-body{padding:0}.personal-task-inspector-summary{border-bottom:1px solid var(--pw-line);background:#fff;padding:24px 24px 20px}.personal-task-inspector-summary h3{letter-spacing:-.015em;overflow-wrap:anywhere;margin:14px 0 0;font-size:18px;font-weight:680;line-height:1.55}.personal-task-inspector-status{flex-wrap:wrap;align-items:center;gap:7px;display:flex}.personal-task-inspector-status>span{color:#62697a;background:#f1f2f5;border-radius:6px;align-items:center;gap:6px;min-height:24px;padding:2px 8px;font-size:11px;font-weight:650;display:inline-flex}.personal-task-inspector-status>span:first-child{padding-left:7px}.personal-task-inspector-status i{background:var(--pw-blue);border-radius:50%;width:7px;height:7px}.personal-task-inspector-status .is-done{background:var(--pw-green-bg);color:var(--pw-green)}.personal-task-inspector-status .is-done i{background:var(--pw-green)}.personal-task-inspector-status .is-blocked{background:var(--pw-red-bg);color:var(--pw-red)}.personal-task-inspector-status .is-blocked i{background:var(--pw-red)}.personal-task-inspector-fields{background:#fff;padding:20px 24px 22px}.personal-task-inspector-fields h4{color:var(--pw-text);margin:0 0 9px;font-size:12px;font-weight:700}.personal-task-inspector-fields dl{border-top:1px solid var(--pw-line);margin:0}.personal-task-inspector-fields dl div{border-bottom:1px solid var(--pw-line);grid-template-columns:92px minmax(0,1fr);gap:14px;min-height:44px;padding:11px 0;font-size:12px;line-height:1.55;display:grid}.personal-task-inspector-fields dt{color:var(--pw-muted)}.personal-task-inspector-fields dd{color:var(--pw-text);overflow-wrap:anywhere;margin:0}.personal-task-inspector-actions{border-top:1px solid var(--pw-line-strong);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fffffff5;grid-template-columns:auto minmax(170px,1fr);gap:10px;padding:13px 18px;display:grid;position:sticky;bottom:0;box-shadow:0 -8px 26px #1e284012}.personal-task-inspector-actions>.personal-primary-action{min-height:40px;margin:0}.personal-task-management{position:relative}.personal-task-management>summary{border:1px solid var(--pw-line-strong);min-width:128px;min-height:40px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:9px;justify-content:center;align-items:center;gap:7px;padding:0 14px;font-size:12px;font-weight:650;list-style:none;display:flex}.personal-task-management>summary::-webkit-details-marker{display:none}.personal-task-management[open]>summary{color:var(--pw-blue-ink);border-color:#9db3e9}.personal-task-management>div{border:1px solid var(--pw-line-strong);background:#fff;border-radius:12px;gap:9px;width:390px;padding:14px;display:grid;position:absolute;bottom:calc(100% + 9px);left:0;box-shadow:0 16px 38px #1e284029}.personal-task-management>div>strong{color:var(--pw-muted);font-size:10.5px;font-weight:650}.personal-task-management-secondary{border-top:1px solid var(--pw-line);grid-template-columns:1fr 1fr;gap:7px;padding-top:4px;display:grid}.personal-task-management-secondary button{border:1px solid var(--pw-line-strong);min-height:34px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:8px;font-size:11.5px}.personal-task-management-secondary button:hover{background:#f6f7fa}.personal-task-completed-note{background:var(--pw-green-bg);color:var(--pw-green);border:1px solid #cde4d8;border-radius:10px;align-items:center;gap:10px;margin:12px 24px 24px;padding:12px 14px;display:flex}.personal-task-completed-note>span{gap:2px;display:grid}.personal-task-completed-note strong{font-size:12px}.personal-task-completed-note small{color:#5d786c;font-size:10.5px}.personal-detail-card,.personal-correction-panel{border:1px solid var(--pw-line);background:#fff;border-radius:14px;padding:15px}.personal-proposal-card{background:#f5f8ff;border:1px solid #c3d3f9;border-radius:14px;padding:16px}.personal-proposal-card>small{color:#5270bd;letter-spacing:.05em;font-size:11px;font-weight:650}.personal-proposal-card h3{margin:8px 0;font-size:15.5px}.personal-proposal-card p{color:#5f6570;font-size:12px;line-height:1.55}.personal-proposal-card dl{gap:8px;margin:14px 0 0;display:grid}.personal-proposal-card dl div{grid-template-columns:82px minmax(0,1fr);gap:10px;font-size:11.5px;display:grid}.personal-proposal-card dt{color:var(--pw-faint)}.personal-proposal-card dd{overflow-wrap:anywhere;margin:0}.personal-context-drawer .personal-team-plan-result{border-color:var(--pw-line);background:var(--pw-card)}.personal-context-drawer .personal-team-plan-result h3{margin:0;font-size:18px;font-weight:600}.personal-context-drawer .personal-team-plan-result>p{color:var(--pw-muted);margin:16px 0 0;font-weight:400}.personal-team-plan-result .personal-team-plan-assignments{gap:16px;margin:20px 0}.personal-team-plan-result .personal-team-plan-assignments>div{grid-template-columns:minmax(0,1fr);gap:4px;font-size:13px}.personal-team-plan-result .personal-team-plan-assignments dt{color:var(--pw-muted);font-size:12px}.personal-team-plan-result .is-pending dd{color:var(--pw-muted)}.personal-team-plan-result details{border-top:1px solid var(--pw-line);margin-top:16px;padding-top:12px}.personal-team-plan-result summary{cursor:pointer;color:var(--pw-muted);font-size:12px}.personal-proposal-state{border-radius:9px;align-items:center;gap:7px;margin:10px 0 0;padding:10px 12px;font-size:11px;display:flex}.personal-proposal-state.is-applied{background:var(--pw-green-bg);color:var(--pw-green)}.personal-proposal-state.is-stale,.personal-proposal-state.is-error{background:var(--pw-red-bg);color:var(--pw-red)}.personal-proposal-state.is-gated{color:#825a00;background:#fff6df;gap:6px;display:grid}.personal-proposal-state.is-gated>span{gap:3px;display:grid}.personal-proposal-state.is-gated small{line-height:1.5}.personal-workspace-candidates{gap:8px;margin-top:10px;display:grid}.personal-workspace-candidates button{color:#263e76;cursor:pointer;text-align:left;background:#fff;border:1px solid #c3d3f9;border-radius:10px;gap:3px;min-height:48px;padding:9px 12px;display:grid}.personal-workspace-candidates small{color:var(--pw-muted)}.personal-detail-card.is-attention{background:#fffdf7;border-color:#f1d8ac}.personal-detail-card small{color:var(--pw-muted);font-size:11px}.personal-detail-card h3{margin:7px 0;font-size:14.5px;line-height:1.5}.personal-detail-card p,.personal-correction-panel p{color:var(--pw-muted);font-size:12px;line-height:1.55}.personal-detail-card dl{gap:9px;margin:14px 0 0;display:grid}.personal-detail-card dl div{grid-template-columns:74px minmax(0,1fr);gap:10px;font-size:12px;display:grid}.personal-detail-card dt{color:var(--pw-faint)}.personal-detail-card dd{overflow-wrap:anywhere;margin:0}.personal-run-drawer-tabs{background:#efefec;border-radius:11px;grid-template-columns:1fr 1fr;gap:4px;padding:4px;display:grid}.personal-run-drawer-tabs button{min-height:36px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;padding:0 8px;font-size:12px;font-weight:650}.personal-run-drawer-tabs button[aria-selected=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c141f}.personal-session-summary{margin-top:12px}.personal-session-message-record{margin-top:14px}.personal-session-message-record>h3{color:var(--pw-faint);letter-spacing:.06em;text-transform:uppercase;margin:0 0 10px;font-size:11px}.personal-session-message-record ol{gap:0;margin:0;padding:0;list-style:none;display:grid}.personal-session-message-record li{grid-template-columns:13px minmax(0,1fr);gap:9px;padding-bottom:15px;display:grid}.personal-session-message-record li>i,.personal-session-active-step>i{background:var(--pw-green);width:9px;height:9px;box-shadow:0 0 0 3px var(--pw-green-bg);border-radius:50%;margin-top:5px}.personal-session-message-record li.is-user>i{background:var(--pw-blue);box-shadow:0 0 0 3px var(--pw-blue-soft)}.personal-session-message-record li.is-error>i{background:var(--pw-red);box-shadow:0 0 0 3px var(--pw-red-bg)}.personal-session-message-record li>div{border-bottom:1px solid var(--pw-line);gap:5px;min-width:0;padding:0 0 15px;display:grid}.personal-session-message-record li header{justify-content:space-between;align-items:center;gap:8px;display:flex}.personal-session-message-record li strong{font-size:12px}.personal-session-message-record time{color:var(--pw-faint);font-size:10px}.personal-session-message-record li p{max-height:180px;color:var(--pw-muted);white-space:pre-wrap;margin:0;font-size:11.5px;line-height:1.6;overflow:auto}.personal-session-empty{border:1px dashed var(--pw-line-strong);color:var(--pw-muted);text-align:center;border-radius:10px;margin:0;padding:18px 12px;font-size:11.5px}.personal-session-active-step{grid-template-columns:13px minmax(0,1fr);align-items:start;gap:9px;padding-top:4px;display:grid}.personal-session-active-step>i{background:var(--pw-blue);box-shadow:0 0 0 3px var(--pw-blue-soft);animation:1.4s ease-in-out infinite personal-session-pulse}.personal-session-active-step>span{gap:3px;display:grid}.personal-session-active-step strong{font-size:12px}.personal-session-active-step small{color:var(--pw-muted);font-size:10.5px}@keyframes personal-session-pulse{50%{opacity:.35}}.personal-todo-actions{grid-template-columns:1fr 1fr;gap:8px;margin-top:12px;display:grid}.personal-todo-actions>button{margin-top:0}.personal-todo-actions-title{color:var(--pw-faint);letter-spacing:.06em;grid-column:1/-1;font-size:11px;font-weight:650}.personal-todo-actions .personal-primary-action,.personal-todo-actions .personal-compact-menu{grid-column:1/-1;margin-top:0}.personal-inline-agent-select{border:1px solid var(--pw-line);color:var(--pw-muted);border-radius:10px;grid-column:1/-1;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px;padding:8px;font-size:11px;display:grid}.personal-inline-agent-select select{border:1px solid var(--pw-line-strong);color:#333;background:#fff;border-radius:8px;min-width:0;min-height:36px;padding:0 8px}.personal-inline-agent-select .personal-secondary-action{width:auto;min-height:36px;margin:0;padding:0 12px}.personal-inline-resume-when input{border:1px solid var(--pw-line-strong);color:#333;background:#fff;border-radius:8px;min-width:0;min-height:36px;padding:0 8px}.personal-inline-resume-when small{color:var(--pw-faint);grid-column:2/-1}.personal-primary-action,.personal-secondary-action,.personal-danger-action{cursor:pointer;border-radius:11px;justify-content:center;align-items:center;gap:8px;width:100%;min-height:42px;margin-top:12px;font-size:13.5px;font-weight:650;display:flex}.personal-primary-action{border:1px solid var(--pw-blue);background:var(--pw-blue);color:#fff;box-shadow:0 2px 6px #2f66e947}.personal-primary-action:hover{background:var(--pw-blue-ink)}.personal-secondary-action{border:1px solid var(--pw-line-strong);color:var(--pw-text);background:#fff}.personal-secondary-action:hover{border-color:var(--pw-faint)}.personal-danger-action{color:var(--pw-red);background:#fff;border:1px solid #efd2cd}.personal-danger-action:hover{background:var(--pw-red-bg)}.personal-primary-action:disabled,.personal-secondary-action:disabled,.personal-danger-action:disabled{opacity:.46;cursor:default;box-shadow:none}.personal-drawer-action-grid{grid-template-columns:1fr 1fr;gap:8px;display:grid}.personal-correction-panel{margin-top:12px}.personal-correction-panel header{justify-content:space-between;align-items:center;display:flex}.personal-correction-panel header span{align-items:center;gap:7px;font-size:12px;font-weight:700;display:flex}.personal-correction-panel header button{color:var(--pw-muted);cursor:pointer;background:0 0;border:0}.personal-correction-composer{border:1px solid var(--pw-line-strong);border-radius:12px;position:relative;overflow:hidden}.personal-correction-composer:focus-within{border-color:var(--pw-blue)}.personal-correction-composer textarea{resize:vertical;width:100%;min-height:84px;font:inherit;border:0;outline:0;padding:10px 56px 10px 12px;font-size:12.5px}.personal-correction-composer button{border-radius:10px;width:34px;height:34px;position:absolute;bottom:6px;right:6px}.personal-recovery-panel{background:#fffaf0;border:1px solid #eccf94;border-radius:12px;margin-top:12px;padding:14px}.personal-recovery-panel>strong{font-size:13px}.personal-recovery-panel>p,.personal-preview-unavailable{color:var(--pw-muted);font-size:12px;line-height:1.5}.personal-compact-menu{margin-top:12px;position:relative}.personal-compact-menu>summary{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:11px;justify-content:center;align-items:center;gap:8px;min-height:42px;padding:0 12px;font-size:12.5px;font-weight:650;list-style:none;display:flex}.personal-compact-menu>summary::-webkit-details-marker{display:none}.personal-compact-menu[open]>summary{border-color:var(--pw-faint)}.personal-compact-menu>div{border:1px solid var(--pw-line);background:#fff;border-radius:11px;margin-top:6px;padding:6px;display:grid;box-shadow:0 8px 24px #1e1c141a}.personal-compact-menu>div button{min-height:40px;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;align-items:center;gap:8px;padding:0 10px;display:flex}.personal-compact-menu>div button:hover{background:#f5f4f1}.personal-compact-menu>div button:disabled{color:var(--pw-faint);cursor:default;opacity:.55}.personal-safe-preview{border:1px solid var(--pw-line);color:#333943;white-space:pre-wrap;overflow-wrap:anywhere;background:#f7f6f3;border-radius:11px;max-height:280px;margin:12px 0 0;padding:14px;font:12px/1.6 Geist Mono,SFMono-Regular,Consolas,monospace;overflow:auto}.personal-report-detail{border:1px solid var(--pw-line);background:#fff;border-radius:14px;margin-top:12px;padding:14px}.personal-report-detail>header{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;display:grid}.personal-report-detail>header span{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:10px;flex-direction:column;gap:2px;padding:10px;font-size:10px;font-weight:650;display:flex}.personal-report-detail>header strong{font-size:18px}.personal-report-detail>p{color:var(--pw-muted);margin:10px 0;font-size:11px}.personal-report-detail ol{gap:8px;margin:0;padding:0;list-style:none;display:grid}.personal-report-detail li{border:1px solid var(--pw-line);border-radius:10px;gap:4px;padding:10px;display:grid}.personal-report-detail li[data-change-kind=changed]{background:#fffaf0;border-color:#e8d3a5}.personal-report-detail li small{color:var(--pw-muted);text-transform:uppercase;font-size:10px}.personal-report-detail li strong{font-size:12px;line-height:1.45}.personal-report-detail li p{color:var(--pw-muted);margin:0;font-size:11px;line-height:1.5}.personal-report-detail>footer{color:var(--pw-faint);overflow-wrap:anywhere;gap:4px;margin-top:10px;font:10px/1.5 Geist Mono,SFMono-Regular,Consolas,monospace;display:grid}.personal-execution-history{margin-top:18px}.personal-execution-history h3{letter-spacing:.07em;text-transform:uppercase;color:var(--pw-faint);margin:0 0 10px;font-size:11.5px;font-weight:650}.personal-execution-history>p{color:var(--pw-muted);font-size:12px}.personal-execution-history ol{border-top:1px solid var(--pw-line);margin:0;padding:0;list-style:none}.personal-execution-history li{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:center;gap:12px;min-height:50px;display:flex}.personal-execution-history li>span{gap:3px;display:grid}.personal-execution-history li strong{font-size:12px}.personal-execution-history li small{color:var(--pw-muted);font-size:10px}.personal-execution-history li em{color:var(--pw-muted);font-size:10px;font-style:normal}.personal-execution-history li em.is-completed{color:var(--pw-green)}.personal-execution-history li em.is-failed{color:var(--pw-red)}.personal-mobile-back{display:none}.personal-message:not(.is-user)>div{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:4px 16px 16px;flex:1;min-width:0;padding:10px 14px}.personal-md{gap:8px;margin-top:5px;font-size:13.5px;line-height:1.7;display:grid}.personal-md p{white-space:normal;overflow-wrap:anywhere;margin:0}.personal-md-heading{letter-spacing:-.01em;font-weight:700}.personal-md-heading.is-h1{font-size:15.5px}.personal-md-heading.is-h2{font-size:14.5px}.personal-md-heading.is-h3,.personal-md-heading.is-h4{font-size:13.5px}.personal-md-list{gap:4px;margin:0;padding-left:20px;display:grid}.personal-md ul.personal-md-list{list-style-type:disc}.personal-md ol.personal-md-list{list-style-type:decimal}.personal-md-list li{overflow-wrap:anywhere;padding-left:2px}.personal-md-list li::marker{color:var(--pw-faint)}.personal-md-code{border:1px solid var(--pw-line);overflow-wrap:anywhere;background:#f5f4f1;border-radius:6px;padding:1px 5px;font:12px/1.5 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-md-pre{border:1px solid var(--pw-line);background:#f7f6f3;border-radius:11px;margin:0;padding:12px 14px;overflow-x:auto}.personal-md-pre code{color:#333943;white-space:pre;font:12px/1.65 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-md-link{color:var(--pw-blue-ink);border-bottom:1px solid #c3d3f9;text-decoration:none}.personal-md-link:hover{border-bottom-color:var(--pw-blue-ink)}.personal-agent-persona-head{align-items:center;gap:12px;display:flex}.personal-agent-avatar{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:14px;flex:0 0 46px;place-items:center;height:46px;font-size:19px;font-weight:700;display:grid;box-shadow:0 2px 8px #2f66e942}.personal-agent-persona-id{flex:1;min-width:0}.personal-agent-persona-id h3{margin:0}.personal-agent-persona-id p{margin:2px 0 0}.personal-agent-health{border-radius:99px;flex:none;padding:2.5px 10px;font-size:11px;font-weight:650}.personal-agent-health.is-ok{background:var(--pw-green-bg);color:var(--pw-green)}.personal-agent-health.is-off,.personal-row-status.is-blocking{background:var(--pw-red-bg);color:var(--pw-red)}.personal-row-status.is-pending{background:var(--pw-amber-bg);color:var(--pw-amber)}.personal-row-status.is-failed{background:var(--pw-red-bg);color:var(--pw-red)}.personal-row-status.is-completed{background:var(--pw-green-bg);color:var(--pw-green)}.personal-row-status.is-queued,.personal-row-status.is-waiting,.personal-row-status.is-interrupted{color:var(--pw-muted);background:#f2f1ed}.personal-diagnostics-trigger{border:0;border-top:1px solid var(--pw-line);width:100%;color:var(--pw-muted);cursor:pointer;background:0 0;justify-content:space-between;align-items:center;margin-top:18px;padding:12px 0;font-size:12.5px;display:flex}.personal-diagnostics-trigger svg{transition:transform .16s}.personal-diagnostics-trigger svg.is-open{transform:rotate(180deg)}.personal-diagnostics{color:var(--pw-muted);overflow-wrap:anywhere;background:#f5f4f1;border-radius:10px;gap:7px;padding:12px;font-size:10.5px;display:grid}.personal-copy-feedback{color:var(--pw-green);margin:7px 0 0;font-size:11px}.personal-copy-feedback.is-error{color:var(--pw-red)}@media (width<=1300px){.personal-workspace-shell.has-drawer .personal-live-indicator{display:none}.personal-workspace-shell.has-drawer .personal-channel-title p{max-width:260px}.personal-home-lanes{grid-template-columns:repeat(2,minmax(190px,1fr))}}@media (width<=1100px){.personal-machine-layout{grid-template-columns:1fr;gap:14px}.personal-machine-namespaces nav{overscroll-behavior-x:contain;scroll-snap-type:x proximity;display:flex;overflow-x:auto}.personal-machine-namespaces button{scroll-snap-align:start;flex:0 0 180px}.personal-machine-summary{flex-wrap:wrap;align-items:flex-start}.personal-machine-editor-bar{flex-direction:column;align-items:stretch}.personal-machine-editor-mode{width:100%}.personal-machine-editor-mode button{flex:1 1 0}.personal-machine-editor fieldset{grid-template-columns:1fr}.personal-machine-editor fieldset label:last-child{grid-column:auto}.personal-machine-preview dl{grid-template-columns:1fr}}@media (width<=1050px){.personal-workspace-shell,.personal-workspace-shell.has-drawer{grid-template-columns:minmax(0,1fr)}.personal-workspace-sidebar{z-index:40;width:min(310px,86vw);display:none;position:fixed;inset:0 auto 0 0;box-shadow:18px 0 50px #1e1c1429}.personal-workspace-shell.mobile-sidebar-open .personal-workspace-sidebar{display:block}.personal-sidebar-backdrop{z-index:35;cursor:default;background:#14182047;border:0;display:block;position:fixed;inset:0}.personal-icon-button.personal-mobile-menu{flex:0 0 36px;display:inline-grid}.personal-workspace-drawer{z-index:30;width:min(410px,90vw);position:fixed;inset:0 0 0 auto}.personal-workspace-drawer[data-drawer-mode=inspector],.personal-workspace-drawer[data-drawer-mode=inspector-full]{width:min(520px,92vw);position:fixed;inset:0 0 0 auto;box-shadow:-18px 0 44px #1e284024}.personal-run-row{grid-template-columns:36px minmax(0,1fr) auto 16px}.personal-run-identity,.personal-run-progress{display:none}.personal-home-lanes{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (width<=720px){.personal-workspace-shell,.personal-workspace-shell.has-drawer{grid-template-columns:1fr}.personal-workspace-shell,.personal-workspace-main,.personal-channel{width:100%;max-width:100vw;overflow-x:hidden}.personal-workspace-sidebar{z-index:40;width:min(310px,86vw);display:none;position:fixed;inset:0 auto 0 0;box-shadow:18px 0 50px #1e1c1429}.personal-workspace-shell.mobile-sidebar-open .personal-workspace-sidebar{display:block}.personal-icon-button.personal-mobile-menu{flex:0 0 36px;display:inline-grid}.personal-channel-header{grid-template-columns:36px minmax(0,1fr) auto;gap:10px;min-height:60px;padding:10px 14px;display:grid}.personal-channel-title p{display:none}.personal-channel-title p.personal-manager-execution{display:flex}.personal-channel-actions{min-width:0}.personal-agent-select{min-width:0;max-width:132px}.personal-channel-actions>.personal-icon-button{display:none}.personal-goal-tabs{order:4;grid-column:1/-1;align-self:auto;margin-left:0;overflow-x:auto}.personal-channel-actions .personal-live-indicator{display:none}.personal-channel-scroll,.personal-composer-wrap{padding-left:14px;padding-right:14px}.personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-board){overflow-y:auto}.personal-task-board{height:auto;min-height:100%}.personal-task-kanban,.personal-workspace-shell.has-drawer .personal-task-kanban,.personal-workspace-shell.has-task-inspector .personal-task-kanban{grid-template-columns:minmax(0,1fr);width:100%;height:auto}.personal-task-kanban .personal-object-list{min-height:auto}.personal-task-lane-scroll,.personal-task-lane-scroll.has-overflow-before,.personal-task-lane-scroll.has-overflow-after{min-height:auto;box-shadow:none;scrollbar-gutter:auto;flex:none;padding-right:8px;overflow:visible}.personal-quick-prompts{flex-wrap:nowrap;overflow-x:auto}.personal-quick-prompts button{flex:none;min-height:36px}.personal-manager-conversation-tray>header{flex-wrap:wrap;align-items:flex-start}.personal-manager-conversation-actions{justify-content:flex-end;width:100%}.personal-manager-conversation-messages article{grid-template-columns:minmax(0,1fr);gap:4px}.personal-timeline-row,.personal-output-row{grid-template-columns:34px minmax(0,1fr) 14px;gap:9px;padding:10px 12px}.personal-timeline-row>time,.personal-timeline-row>.personal-row-status,.personal-timeline-row .personal-priority-dot{display:none}.personal-channel-composer{grid-template-columns:40px 36px minmax(0,1fr) 40px}.personal-task-chat-receipt{grid-template-columns:32px minmax(0,1fr);padding:11px}.personal-task-lane-filter{flex-direction:column;align-items:stretch;gap:8px}.personal-task-lane-filter label,.personal-task-lane-filter select{width:100%;max-width:none}.personal-capability-layout,.personal-capability-value-grid,.personal-capability-fields,.personal-capability-linked-setting{grid-template-columns:minmax(0,1fr)}.personal-capability-linked-setting .personal-notification-toggle{justify-self:start}.personal-capability-layout{grid-template-rows:auto minmax(0,1fr)}.personal-capability-list{min-width:0;max-height:90px;padding:3px;display:flex;overflow-x:auto}.personal-capability-list button{flex:0 0 180px}.personal-task-chat-icon{width:32px;height:32px}.personal-task-chat-receipt footer{grid-column:1/-1;justify-content:flex-end}.personal-channel-composer>span{justify-content:center;min-width:0;padding:0;font-size:0}.personal-composer-wrap{max-width:100vw}.personal-workspace-drawer,.personal-workspace-drawer[data-drawer-mode=inspector],.personal-workspace-drawer[data-drawer-mode=inspector-full]{width:100vw}.personal-inspector-size{display:none!important}.personal-context-drawer{height:100dvh}.personal-drawer-body{padding-bottom:max(18px, env(safe-area-inset-bottom))}.personal-composer-wrap{padding-bottom:max(16px, env(safe-area-inset-bottom))}.personal-mobile-back{display:block}.personal-desktop-close{display:none}.personal-goal-tabs button{min-height:34px}.personal-correction-composer{padding-bottom:2px}.personal-correction-composer textarea{min-height:84px;padding-right:56px;padding-bottom:max(14px, env(safe-area-inset-bottom))}.personal-correction-composer button{width:40px;height:40px}.personal-todo-actions{grid-template-columns:1fr}.personal-task-management>div{width:calc(100vw - 28px)}.personal-home-lanes{grid-template-columns:1fr}.personal-home-lane{min-height:0}.personal-session-record,.personal-session-record dl{grid-template-columns:1fr}.personal-session-record>.personal-secondary-action{grid-area:auto/1}.personal-settings-page{grid-template-rows:auto minmax(0,1fr);grid-template-columns:minmax(0,1fr)}.personal-settings-sidebar{border-right:0;border-bottom:1px solid var(--pw-line);gap:10px;height:auto;max-height:30dvh;padding:12px 14px;position:static;overflow:auto}.personal-settings-title{display:none}.personal-settings-tabs{display:flex;overflow-x:auto}.personal-settings-tabs button{flex:0 0 180px}.personal-settings-body{padding:20px 14px}.personal-settings-header{align-items:center;gap:14px}.personal-settings-header h1{font-size:24px}.personal-machine-layout{grid-template-columns:1fr;gap:14px}.personal-machine-namespaces nav{overscroll-behavior-x:contain;scroll-snap-type:x proximity;display:flex;overflow-x:auto}.personal-machine-namespaces button{scroll-snap-align:start;flex:0 0 180px}.personal-machine-summary{align-items:flex-start}.personal-machine-editor-bar{flex-direction:column;align-items:stretch}.personal-machine-editor-mode{width:100%}.personal-machine-editor-mode button{flex:1 1 0}.personal-machine-summary dl{flex-direction:column;gap:8px}.personal-machine-editor fieldset{grid-template-columns:1fr}.personal-machine-editor fieldset label:last-child{grid-column:auto}.personal-machine-preview dl{grid-template-columns:1fr}.personal-machine-rollback{flex-direction:column;align-items:stretch}.personal-machine-rollback .personal-secondary-action{width:100%}.personal-lark-settings.is-embedded .personal-lark-tabs{overflow-x:auto}.personal-lark-settings.is-embedded .personal-lark-tabs button{flex:none}}@media (prefers-reduced-motion:reduce){.personal-timeline-row,.personal-diagnostics-trigger svg,.personal-workspace-sidebar,.personal-stopped-goals>summary>svg:first-child,.personal-subagent-switch>span,.personal-subagent-switch>span:after{transition:none}.personal-goal-lifecycle.is-pending svg,.personal-spin{animation:none}}.personal-workspace-shell[data-pw-theme=loopx],.personal-settings-page[data-pw-theme=loopx]{--pw-bg:#fafafa;--pw-card:#fff;--pw-line:#ebebeb;--pw-line-strong:#dedede;--pw-muted:#6b6b6b;--pw-faint:#8f8f8f;--pw-text:#171717;--pw-blue:#0070f3;--pw-blue-ink:#0060d1;--pw-blue-soft:#edf6ff;--pw-amber:#9a6200;--pw-amber-bg:#fff7df;--pw-red:#d90000;--pw-red-bg:#fff0f0;--pw-green:#197342;--pw-green-bg:#edf9f1;font-family:Geist Variable,Geist,Inter,Helvetica Neue,Arial,PingFang SC,Microsoft YaHei,sans-serif}.personal-workspace-shell[data-pw-theme=loopx] .personal-workspace-sidebar,.personal-settings-page[data-pw-theme=loopx] .personal-settings-sidebar{background:#fff}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-header{box-shadow:none;background:#fafafaf0}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-title h1{letter-spacing:0;font-size:20px;font-weight:600;line-height:28px}.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-section-title{letter-spacing:0;font-size:12px;font-weight:500;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link-copy strong,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane>header span,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card>strong{font-size:14px;font-weight:600;line-height:20px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link-copy small,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane>p,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card>p{font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-select-trigger,.personal-workspace-shell[data-pw-theme=loopx] .personal-select-option{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-workspace-drawer{box-shadow:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-brand-mark{box-shadow:none;background:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-icon{color:#171717;background:#f2f2f2;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-greeting>span{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-utility,.personal-settings-page[data-pw-theme=loopx] .personal-settings-back,.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-utility:hover,.personal-settings-page[data-pw-theme=loopx] .personal-settings-back:hover,.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button:hover{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link[aria-current=page],.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link[aria-current=page],.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button[aria-current=page]{box-shadow:none;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes{background:#f2f2f2;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes button{border-radius:4px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page],.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes button[aria-selected=true]{box-shadow:0 1px 2px #0000000f}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs{background:0 0;border-radius:0;align-self:stretch;gap:20px;padding:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button{border-radius:0;min-height:46px;padding:0 1px;font-size:12px;font-weight:500;position:relative}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page]{box-shadow:none;color:#171717;background:0 0}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page]:after{content:"";background:#171717;height:2px;position:absolute;bottom:-1px;left:0;right:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-count{color:#4d4d4d;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-state-dot,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-row:nth-child(n) .personal-goal-state-dot{background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-agent-select .personal-select-trigger,.personal-workspace-shell[data-pw-theme=loopx] .personal-read-only-source,.personal-workspace-shell[data-pw-theme=loopx] .personal-icon-button,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-select .personal-select-trigger,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action,.personal-settings-page[data-pw-theme=loopx] .personal-secondary-action{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane,.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row,.personal-workspace-shell[data-pw-theme=loopx] .personal-detail-card,.personal-settings-page[data-pw-theme=loopx] .personal-detail-card,.personal-settings-page[data-pw-theme=loopx] .personal-settings-card,.personal-settings-page[data-pw-theme=loopx] .personal-lark-app-card,.personal-settings-page[data-pw-theme=loopx] .personal-lark-table,.personal-settings-page[data-pw-theme=loopx] .personal-lark-topic-panel{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lanes{border-block:1px solid #ebebeb;gap:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane{border:0;background:0 0;border-left:1px solid #ebebeb;border-radius:0;min-height:260px;padding:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane:first-child{border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card{box-shadow:none;border-radius:12px;transform:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card:hover{box-shadow:none;border-color:#a1a1a1;transform:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-timeline{gap:8px}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row,.personal-workspace-shell[data-pw-theme=loopx] .personal-schedule-row{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-schedule-row:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-row-icon{color:#4d4d4d;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-run-open-label{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-run-progress b{background:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-message.is-user{background:#f2f2f2;border-color:#dedede;border-radius:12px 12px 4px;padding:10px 12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message-avatar{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message:not(.is-user)>div{box-shadow:none;border-radius:4px 12px 12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message p,.personal-workspace-shell[data-pw-theme=loopx] .personal-md{font-size:13px;line-height:1.65}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-empty>span{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row{box-shadow:none;background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row>span:first-child{color:#171717;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row small,.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row>b{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record{background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record>header span{color:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record dl div{background:#fafafa;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt{box-shadow:none;background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-icon{color:#171717;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt footer button{color:#171717;border-color:#dedede;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt footer button:hover{background:#f2f2f2;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban{border-block:1px solid #ebebeb;gap:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list{border:0;background:0 0;border-left:1px solid #ebebeb;border-radius:0;gap:8px;padding:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list:first-child{border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>header{padding:4px 2px 8px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>header>strong{font-size:12px;font-weight:600}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-lane-scroll>button>strong,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button>strong{overflow-wrap:anywhere;font-size:14px;font-weight:500;line-height:20px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button>small,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button>small{color:#6b6b6b;font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card.is-selected>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button.is-selected{background:#fff;border-color:#171717;box-shadow:0 0 0 1px #171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card.is-selected:before{background:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card-actions button{box-shadow:none;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card-actions .personal-task-session-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-session-status{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-empty{border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>header{letter-spacing:0;min-height:44px;padding:8px 14px;font-weight:500}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button{min-height:58px;padding:10px 14px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button:hover{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-file-icon{color:#4d4d4d;background:#fafafa;border:1px solid #ebebeb;border-radius:6px;place-items:center;width:28px;height:28px;display:grid}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>strong{font-size:13px;font-weight:600}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>p,.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>small{font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-primary-action,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action{box-shadow:none;background:#171717;border-color:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-primary-action:hover,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action:hover{background:#333;border-color:#333}.personal-workspace-shell[data-pw-theme=loopx] .personal-md-code,.personal-workspace-shell[data-pw-theme=loopx] .personal-safe-preview,.personal-workspace-shell[data-pw-theme=loopx] .personal-diagnostics{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-md-pre{color:#fafafa;background:#171717;border:1px solid #242424}.personal-workspace-shell[data-pw-theme=loopx] .personal-digest-card{background:#fff;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-action-feedback{color:#171717;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button{color:#171717;box-shadow:none;background:#fff;border-color:#dedede;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button:hover{color:#171717;box-shadow:none;background:#f2f2f2;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-draft-status{color:#6b6b6b;background:#f2f2f2;border-color:#dedede;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-draft-status strong{color:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer{box-shadow:none;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer:focus-within{border-color:#0070f3;box-shadow:0 0 0 2px #0070f31f}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-correction-composer button{box-shadow:none;background:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-correction-composer button:hover{background:#333}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>.personal-composer-attach{color:#6b6b6b;background:0 0}.personal-settings-theme-swatch.is-loopx{background:linear-gradient(135deg,#171717 0 48%,#fafafa 48% 78%,#fff 78%)}.personal-settings-page[data-pw-theme=loopx] .personal-settings-header small,.personal-settings-page[data-pw-theme=loopx] .personal-lark-header small,.personal-settings-page[data-pw-theme=loopx] .personal-lark-section-heading small{color:#0070f3;font-family:Geist Mono Variable,Geist Mono,JetBrains Mono,SFMono-Regular,monospace;font-weight:500}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button{box-shadow:none;border-radius:12px}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button:hover{box-shadow:none;border-color:#c8c8c8}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button[aria-checked=true]{background:#fff;border-color:#171717;box-shadow:0 0 0 1px #171717}@media (width<=720px){.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list{border-top:1px solid #ebebeb;border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane:first-child,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list:first-child{border-top:0}}.personal-workspace-shell[data-pw-theme=brutal],.personal-settings-page[data-pw-theme=brutal]{--pw-bg:#fdf8e7;--pw-card:#fff;--pw-line:#141414;--pw-line-strong:#141414;--pw-muted:#3f3f3f;--pw-faint:#666;--pw-text:#141414;--pw-blue:#141414;--pw-blue-ink:#141414;--pw-blue-soft:#ffe23f;--pw-amber:#141414;--pw-amber-bg:#ffd23f;--pw-red:#141414;--pw-red-bg:#ff9d8a;--pw-green:#141414;--pw-green-bg:#8fe6a4}.personal-workspace-shell[data-pw-theme=brutal] :focus-visible:not(textarea):not(input),.personal-settings-page[data-pw-theme=brutal] :focus-visible:not(textarea):not(input){outline-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-workspace-sidebar{background:#ffd91a;border-right:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-brand{border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-brand-mark{color:#ffd91a;box-shadow:none;background:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-icon{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-link:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-link:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-utility:hover{background:#ffffff8c}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-link[aria-current=page],.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-link[aria-current=page]{background:#ff8fd0;border:2px solid #141414;border-radius:4px;font-weight:700;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-count{color:#141414;background:#fff;border:2px solid #141414;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-section-title{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-title-actions button:hover{box-shadow:none;background:#fff;border:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-footer{border-top:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-sidebar{background:#ffd91a;border-right:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-title{border-bottom:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-title small,.personal-settings-page[data-pw-theme=brutal] .personal-settings-header small,.personal-settings-page[data-pw-theme=brutal] .personal-settings-back,.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button{color:#141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-back:hover,.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button:hover{background:#ffffff8c}.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button[aria-current=page]{color:#141414;background:#ff8fd0;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-detail-card,.personal-settings-page[data-pw-theme=brutal] .personal-machine-editor,.personal-settings-page[data-pw-theme=brutal] .personal-machine-summary,.personal-settings-page[data-pw-theme=brutal] .personal-lark-app-card,.personal-settings-page[data-pw-theme=brutal] .personal-lark-table,.personal-settings-page[data-pw-theme=brutal] .personal-lark-topic-panel{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-machine-namespaces button[aria-current=page],.personal-settings-page[data-pw-theme=brutal] .personal-machine-preview,.personal-settings-page[data-pw-theme=brutal] .personal-machine-scope-note,.personal-settings-page[data-pw-theme=brutal] .personal-machine-rollback{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button:hover{background:#fff8d6;border-color:#141414;transform:translate(-1px,-1px);box-shadow:4px 4px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button[aria-checked=true]{background:#ffe23f;border-color:#141414;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-primary-action,.personal-settings-page[data-pw-theme=brutal] .personal-secondary-action,.personal-settings-page[data-pw-theme=brutal] .personal-lark-toolbar label{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-primary-action{background:#ffe23f}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs{border-bottom:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs button[aria-current=page]{color:#141414;border-color:#141414}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs span,.personal-settings-page[data-pw-theme=brutal] .personal-lark-app-card em,.personal-settings-page[data-pw-theme=brutal] .personal-connection-status{color:#141414;background:#ffe23f;border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-header{background:#fdf8e7;border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs{background:0 0;gap:6px;padding:0}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs button{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs button[aria-current=page]{background:#ffe23f;font-weight:700;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-agent-select .personal-select-trigger,.personal-workspace-shell[data-pw-theme=brutal] .personal-icon-button{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-live-indicator i{border:1.5px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-message.is-user{background:#8fdcff;border:2px solid #141414;border-radius:8px 8px 2px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-message-avatar{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-pre{color:#fdf8e7;background:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-code{color:#141414;background:#ffe23f;border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-link{color:#141414;text-decoration-thickness:2px}.personal-workspace-shell[data-pw-theme=brutal] .personal-object-list{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-object-list>button:hover{background:#fff8d6}.personal-workspace-shell[data-pw-theme=brutal] .personal-row-status{border:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list{background:#fff}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list>header{background:#fff;border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-lane-scroll>button,.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-card>button{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-lane-scroll>button:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-card:hover>button{background:#fff;border-color:#141414;transform:translate(-1px,-1px);box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list>header>span{color:#fff;background:#141414;border-radius:3px;padding:1px 7px}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot{border:2px solid #141414;border-radius:2px;width:10px;height:10px}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-attention{background:#ff9d5c}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-progress{background:#35c5f0}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-schedule{background:#b49bf0}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-done{background:#7ddb8a}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-empty{border:2px dashed #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-card-actions button{color:#141414;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-composer-wrap{background:linear-gradient(transparent, var(--pw-bg) 22%)}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-banner{color:#141414;background:#fee2e2;border:2px solid #141414;border-radius:6px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-header{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-header small{color:#555}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-issues{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray{background:#fff;border:2px solid #141414;border-radius:6px;box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray:focus-within{border-color:#141414;box-shadow:5px 5px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-btn{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-btn:hover{background:#ffd91a}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-link{color:#141414;text-decoration:underline}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-close{color:#141414;border:1.5px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-messages article{background:#fdf8e7;border:1.5px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-messages article.is-user{background:#8fdcff}.personal-workspace-shell[data-pw-theme=brutal] .personal-quick-prompts button{color:#141414;background:#fff;border:2px solid #141414;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-quick-prompts button:hover{color:#141414;background:#ffe23f;border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer{border:2px solid #141414;border-radius:6px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer:focus-within{border-color:#141414;box-shadow:5px 5px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer textarea{border-left:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>button,.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>.personal-composer-attach,.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer button{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>button:hover{background:#ffd91a;transform:translate(1px,1px);box-shadow:1px 1px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer{border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer:focus-within{border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-workspace-drawer{box-shadow:none;border-left:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-detail-card,.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-panel{border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-detail-card.is-attention{background:#fff3c9;border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-primary-action{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-primary-action:hover{background:#ffd91a;transform:translate(1px,1px);box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-secondary-action{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-secondary-action:hover{border-color:#141414;transform:translate(1px,1px);box-shadow:1px 1px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-danger-action{color:#141414;background:#ff9d8a;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>summary{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>div{border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>div button:hover{background:#fff8d6}.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-agent-select{border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-agent-select select,.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-resume-when input,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-fields input:not([type=checkbox]),.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-fields select,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-domain-option,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-preview{color:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch{background:#fff;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch[aria-checked=true]{background:#baf2c7}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch>span{background:#777}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch[aria-checked=true]>span{background:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-preview{background:#fff3c9;box-shadow:2px 2px #141414}.personal-digest-card{border:1px solid var(--pw-line);background:linear-gradient(135deg,#fff,#fbf7ee);border-radius:14px;justify-content:space-between;align-items:center;gap:14px;margin-bottom:12px;padding:13px 16px;display:flex}.personal-digest-card>strong{letter-spacing:.01em;font-size:13px}.personal-digest-stats{gap:8px;display:flex}.personal-digest-stats span{border:1px solid var(--pw-line-strong);color:var(--pw-muted);background:#fff;border-radius:99px;align-items:baseline;gap:6px;padding:6px 13px;font-size:12px;display:inline-flex}.personal-digest-stats b{color:var(--pw-text);font-size:14px}.personal-composer-hint{color:var(--pw-faint);margin:0 0 8px;font-size:11.5px}.personal-priority-badge{color:var(--pw-muted);background:#f2f1ed;border-radius:6px;padding:1px 7px;font-size:10.5px;font-weight:700}.personal-priority-badge.is-p0{background:var(--pw-red-bg);color:var(--pw-red)}.personal-priority-badge.is-p1{background:var(--pw-amber-bg);color:var(--pw-amber)}.personal-priority-badge.is-blocked{background:var(--pw-red-bg);color:var(--pw-red)}.personal-workspace-shell[data-pw-theme=brutal] .personal-digest-card{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-digest-stats span{color:#141414;border:2px solid #141414;border-radius:99px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-priority-badge{border:1.5px solid #141414;border-radius:3px}.personal-goal-notification code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);word-break:break-all;border-radius:5px;padding:1px 5px;font-size:11px}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-notification code{background:#fff;border:1.5px solid #141414;border-radius:3px}.personal-proposal-state.is-error:has(small){align-items:start;gap:4px;display:grid}.personal-proposal-state.is-error small{word-break:break-all;line-height:1.5}.personal-gate-cli-hint{gap:6px;margin-top:10px;display:grid}.personal-gate-cli-hint code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);-webkit-user-select:all;user-select:all;word-break:break-all;border-radius:7px;padding:8px 10px;font-size:11.5px;line-height:1.5;display:block}.personal-gate-cli-hint small{color:var(--pw-muted);line-height:1.5}.personal-notification-list{gap:0;margin:12px 0 0;padding:0;list-style:none;display:grid}.personal-notification-row{border-top:1px solid var(--pw-line);gap:8px;padding:12px 0;display:grid}.personal-notification-row:first-child{border-top:0;padding-top:4px}.personal-notification-row-head{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-notification-row-head strong{font-size:13px}.personal-notification-badge{border-radius:99px;flex:none;padding:2px 8px;font-size:11px;font-weight:650}.personal-notification-badge.is-on{background:var(--pw-green-bg);color:var(--pw-green)}.personal-notification-badge.is-off{background:var(--pw-bg,#f5f4ef);color:var(--pw-muted)}.personal-notification-meta{color:var(--pw-muted);flex-wrap:wrap;gap:4px 12px;font-size:11.5px;display:flex}.personal-notification-toggle{color:var(--pw-text);cursor:pointer;align-items:center;gap:8px;font-size:12.5px;display:flex}.personal-notification-toggle input{accent-color:var(--pw-blue);cursor:pointer;width:15px;height:15px}.personal-notification-bind{gap:8px;display:flex}.personal-notification-bind select{border:1px solid var(--pw-line-strong);min-width:0;height:34px;color:var(--pw-text);background:#fff;border-radius:8px;flex:1;padding:0 10px;font-size:12.5px}.personal-notification-bind .personal-secondary-action{flex:none}.personal-notification-confirm{border:1px solid var(--pw-line);background:var(--pw-bg,#faf9f5);border-radius:9px;gap:8px;padding:10px 12px;display:grid}.personal-notification-confirm p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-notification-actions{gap:8px;display:flex}.personal-notification-error{color:var(--pw-red);margin:0;font-size:12px;line-height:1.5}.personal-notification-hint{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-notification-hint code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);-webkit-user-select:all;user-select:all;border-radius:5px;margin-top:4px;padding:2px 7px;font-size:11px;display:inline-block}.is-spinning{animation:.9s linear infinite personal-notification-spin}@keyframes personal-notification-spin{to{transform:rotate(360deg)}}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-badge{border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-bind select{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-confirm{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-settings-card{border:2px solid #141414;border-radius:4px;box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-settings-icon{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-language-options>button{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-language-options>button.is-selected{color:#141414;background:#8fdcff}@media (width<=720px){.personal-lark-settings{padding:20px 16px calc(24px + env(safe-area-inset-bottom))}.personal-lark-header h1{font-size:24px}.personal-lark-tabs{gap:18px;margin-top:20px}.personal-settings-card>header,.personal-language-options{padding-left:15px;padding-right:15px}}.personal-goal-acceptance h4{margin:16px 0 8px;font-size:14px}.personal-goal-acceptance .personal-acceptance-observation{border-top:1px solid var(--color-border,#ebebeb);padding:8px 0}.personal-goal-acceptance dd,.personal-goal-acceptance p{overflow-wrap:anywhere}.personal-goal-acceptance details{margin-top:16px}.personal-channel-scroll[data-active-goal-view=overview]{padding-inline:max(24px,50% - 560px)}.personal-channel-header[data-goal-selected=true]{grid-template-columns:auto minmax(0,1fr) auto;gap:4px 16px;padding-block:12px 0;display:grid}.personal-channel-header[data-goal-selected=true] .personal-channel-title{grid-area:1/1/auto/3}.personal-channel-header[data-goal-selected=true] .personal-channel-title h1{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.personal-channel-header[data-goal-selected=true] .personal-channel-actions{grid-area:1/3}.personal-goal-navigation{grid-area:2/1/auto/-1;justify-content:space-between;align-items:center;gap:16px;min-width:0;display:flex}.personal-channel-header[data-goal-selected=true] .personal-goal-tabs{order:0;margin-left:0;overflow:visible}.personal-channel-actions>.personal-goal-settings-action{justify-content:center;align-items:center;min-width:44px;min-height:44px;display:inline-flex}@media (width<=1050px){.personal-channel-header[data-goal-selected=true] .personal-mobile-menu{grid-area:1/1}.personal-channel-header[data-goal-selected=true] .personal-channel-title{grid-column:2}}@media (width<=720px){.personal-channel-header[data-goal-selected=true]{gap:4px 8px}.personal-goal-navigation{gap:12px}.personal-goal-navigation .personal-agent-select{max-width:132px}.personal-goal-navigation .personal-select-value>small{display:none}.personal-channel-header[data-goal-selected=true] .personal-goal-tabs{gap:8px}.personal-goal-navigation .personal-goal-tabs button{min-width:44px;padding-inline:0}.personal-goal-navigation .personal-read-only-source{max-width:132px}.personal-channel-scroll[data-active-goal-view=overview]{padding-inline:14px}}.benchmark-page{--benchmark-ink:#171717;--benchmark-body:#4d4d4d;--benchmark-muted:#767676;--benchmark-canvas:#fafafa;--benchmark-surface:#fff;--benchmark-soft:#f2f2f2;--benchmark-border:#e5e5e5;--benchmark-link:#0068d7;width:100%;max-width:100vw;min-height:100vh;color:var(--benchmark-ink);background:var(--benchmark-canvas);font-family:Geist,Inter,Helvetica Neue,Arial,sans-serif;overflow-x:clip}.benchmark-page,.benchmark-page *{box-sizing:border-box}.benchmark-hero{border-bottom:1px solid var(--benchmark-border);background:var(--benchmark-surface);padding:24px max(24px,50vw - 600px)}.benchmark-hero-topline,.benchmark-title-row,.benchmark-card-heading,.benchmark-footer>div{align-items:center;display:flex}.benchmark-hero-topline{justify-content:space-between;margin-bottom:64px}.benchmark-wordmark{color:var(--benchmark-ink);letter-spacing:-.04em;font-weight:650;text-decoration:none}.benchmark-readonly{color:var(--benchmark-muted);align-items:center;gap:8px;font-size:12px;display:inline-flex}.benchmark-hero-grid{grid-template-columns:minmax(0,1.5fr) minmax(260px,.5fr);align-items:end;gap:64px;display:grid}.benchmark-kicker,.benchmark-mono{color:var(--benchmark-muted);letter-spacing:.08em;text-transform:uppercase;margin:0 0 8px;font:500 11px/16px Geist Mono,JetBrains Mono,monospace}.benchmark-title-row{align-items:baseline;gap:16px}.benchmark-title-row h1{letter-spacing:-.05em;max-width:780px;margin:0;font-size:clamp(32px,4.5vw,48px);font-weight:600;line-height:1}.benchmark-lead{max-width:680px;color:var(--benchmark-body);margin:20px 0 0;font-size:16px;line-height:24px}.benchmark-identity,.benchmark-stat-list{margin:0}.benchmark-identity>div{border-top:1px solid var(--benchmark-border);grid-template-columns:80px minmax(0,1fr);gap:16px;padding:10px 0;display:grid}.benchmark-identity dt,.benchmark-stat-list dt{color:var(--benchmark-muted);font-size:12px}.benchmark-identity dd{text-overflow:ellipsis;white-space:nowrap;margin:0;font:500 12px/18px Geist Mono,monospace;overflow:hidden}.benchmark-kpi-grid{border:1px solid var(--benchmark-border);border-radius:12px;grid-template-columns:repeat(4,minmax(0,1fr));margin-top:64px;display:grid;overflow:hidden}.benchmark-kpi-grid article{border-right:1px solid var(--benchmark-border);min-width:0;padding:20px 24px}.benchmark-kpi-grid article:last-child{border-right:0}.benchmark-kpi-grid svg{color:var(--benchmark-muted)}.benchmark-kpi-grid span{color:var(--benchmark-muted);margin-top:16px;font-size:12px;display:block}.benchmark-kpi-grid strong{letter-spacing:-.04em;font-variant-numeric:tabular-nums;margin-top:6px;font-size:30px;font-weight:600;display:block}.benchmark-kpi-grid strong small{color:var(--benchmark-muted);letter-spacing:0;font-size:14px;font-weight:400}.benchmark-kpi-grid p{color:var(--benchmark-body);margin:8px 0 0;font-size:12px}.benchmark-state{border:1px solid var(--benchmark-border);width:fit-content;color:var(--benchmark-body);background:var(--benchmark-soft);text-transform:capitalize;border-radius:999px;align-items:center;padding:3px 8px;font:500 11px/16px Geist Mono,monospace;display:inline-flex}.benchmark-state-success{color:#087a44;background:#ecf9f2;border-color:#b8e7ce}.benchmark-state-warning{color:#8a5100;background:#fff8e8;border-color:#f0d2a3}.benchmark-state-info{color:#0057b8;background:#eef6ff;border-color:#b9d7f5}.benchmark-tabs{z-index:3;border-bottom:1px solid var(--benchmark-border);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fafafaf0;align-items:center;gap:4px;padding:12px max(24px,50vw - 600px);display:flex;position:sticky;top:0}.benchmark-tabs button,.benchmark-loading button{min-height:40px;color:var(--benchmark-body);cursor:pointer;background:0 0;border:0;border-radius:6px;padding:0 14px;font-size:13px;font-weight:500}.benchmark-tabs button[aria-current=page]{color:#fff;background:var(--benchmark-ink)}.benchmark-tabs .benchmark-refresh{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);align-items:center;gap:7px;margin-left:auto;display:inline-flex}.benchmark-tabs button:focus-visible,.benchmark-cell-link:focus-visible,.benchmark-run-link:focus-visible,.benchmark-loading button:focus-visible{outline:2px solid var(--benchmark-link);outline-offset:2px}.benchmark-content{width:min(100vw - 48px,1200px);min-width:0;margin:0 auto;padding:40px 0 64px}.benchmark-view-stack{gap:48px;min-width:0;display:grid}.benchmark-view-stack>section{min-width:0}.benchmark-section-heading{justify-content:space-between;align-items:end;gap:24px;margin-bottom:16px;display:flex}.benchmark-section-heading h2,.benchmark-detail-card h2,.benchmark-run-detail h2{letter-spacing:-.02em;margin:0;font-size:20px;line-height:28px}.benchmark-section-heading>p{max-width:420px;color:var(--benchmark-muted);text-align:right;margin:0;font-size:12px;line-height:18px}.benchmark-arm-grid,.benchmark-detail-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;display:grid}.benchmark-arm-card,.benchmark-detail-card,.benchmark-run-detail{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:12px;padding:24px}.benchmark-card-heading{justify-content:space-between;align-items:start;gap:24px}.benchmark-card-heading h3{letter-spacing:-.02em;margin:0;font-size:16px;line-height:24px}.benchmark-stat-list{margin-top:24px}.benchmark-stat-list>div{border-top:1px solid var(--benchmark-border);grid-template-columns:minmax(0,1fr) auto;gap:16px;padding:11px 0;display:grid}.benchmark-stat-list dd{font-variant-numeric:tabular-nums;text-align:right;margin:0;font:500 12px/18px Geist Mono,monospace}.benchmark-factor-row{flex-wrap:wrap;gap:8px;margin-top:20px;display:flex}.benchmark-factor-row span{color:var(--benchmark-muted);background:var(--benchmark-soft);border-radius:6px;padding:5px 8px;font-size:11px}.benchmark-runtime-list{flex-wrap:wrap;gap:8px;display:flex}.benchmark-runtime-list>div{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:6px;align-items:center;gap:20px;padding:9px 11px;font:500 11px/16px Geist Mono,monospace;display:inline-flex}.benchmark-runtime-list>div span{color:var(--benchmark-muted)}.benchmark-runtime-list>div strong{font-weight:600}.benchmark-table-shell{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:12px;width:100%;max-width:100%;overflow:auto}.benchmark-table-shell table{border-collapse:collapse;width:100%;font-size:12px}.benchmark-table-shell th,.benchmark-table-shell td{border-bottom:1px solid var(--benchmark-border);text-align:left;white-space:nowrap;padding:14px 16px}.benchmark-table-shell tr:last-child td{border-bottom:0}.benchmark-table-shell th{color:var(--benchmark-muted);background:var(--benchmark-soft);letter-spacing:.03em;text-transform:uppercase;font-size:11px;font-weight:500}.benchmark-table-shell td{color:var(--benchmark-body)}.benchmark-positive{color:#087a44!important}.benchmark-negative{color:#b42318!important}.benchmark-muted{color:var(--benchmark-muted)}.benchmark-wide-table{min-height:300px}.benchmark-cell-link,.benchmark-run-link{color:var(--benchmark-ink);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:0}.benchmark-cell-link span{font-family:Geist Mono,monospace;display:block}.benchmark-cell-link small{color:var(--benchmark-link);align-items:center;gap:4px;margin-top:5px;display:flex}.benchmark-cell-link small+small{color:var(--benchmark-muted)}.benchmark-cell-link .benchmark-cell-metric{color:var(--benchmark-body);font-family:Geist Mono,monospace}.benchmark-run-link{max-width:280px;color:var(--benchmark-link);text-overflow:ellipsis;overflow:hidden}.benchmark-runs-layout{grid-template-columns:minmax(0,1.3fr) minmax(340px,.7fr);align-items:start;gap:16px;display:grid}.benchmark-table-shell tr[aria-selected=true] td{background:#f3f7fb}.benchmark-run-detail{position:sticky;top:82px}.benchmark-run-detail h2{overflow-wrap:anywhere;max-width:340px}.benchmark-run-facts dd{overflow-wrap:anywhere;white-space:normal;max-width:310px}.benchmark-run-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:20px;display:grid}.benchmark-run-metrics>div{background:var(--benchmark-soft);border-radius:6px;padding:10px}.benchmark-run-metrics span,.benchmark-run-metrics strong{display:block}.benchmark-run-metrics span{color:var(--benchmark-muted);font-size:10px}.benchmark-run-metrics strong{margin-top:5px;font:600 12px/18px Geist Mono,monospace}.benchmark-insight{border-left:2px solid var(--benchmark-link);margin-top:20px;padding:4px 0 4px 14px}.benchmark-insight p{color:var(--benchmark-body);margin:8px 0;font-size:13px;line-height:20px}.benchmark-insight small{color:var(--benchmark-muted);line-height:18px}.benchmark-footer{border-top:1px solid var(--benchmark-border);color:var(--benchmark-muted);background:var(--benchmark-surface);justify-content:space-between;gap:24px;padding:20px max(24px,50vw - 600px);font-size:11px;display:flex}.benchmark-footer>div{flex-wrap:wrap;gap:12px}.benchmark-footer code{text-overflow:ellipsis;white-space:nowrap;max-width:360px;overflow:hidden}.benchmark-loading{text-align:center;place-content:center;min-height:100vh;display:grid}.benchmark-loading svg{color:var(--benchmark-muted);margin:0 auto}.benchmark-loading h1{margin:18px 0 0;font-size:24px}.benchmark-loading p{max-width:520px;color:var(--benchmark-muted);margin:8px auto 0}.benchmark-loading button{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);align-items:center;gap:8px;margin:20px auto 0;display:inline-flex}@media (width<=900px){.benchmark-hero-grid,.benchmark-runs-layout{grid-template-columns:1fr}.benchmark-hero-grid{gap:32px}.benchmark-kpi-grid{grid-template-columns:repeat(2,1fr)}.benchmark-kpi-grid article:nth-child(2){border-right:0}.benchmark-kpi-grid article:nth-child(-n+2){border-bottom:1px solid var(--benchmark-border)}.benchmark-run-detail{position:static}}@media (width<=640px){.benchmark-hero{padding-inline:20px}.benchmark-hero-topline{margin-bottom:40px}.benchmark-title-row,.benchmark-section-heading,.benchmark-footer{flex-direction:column;align-items:flex-start}.benchmark-title-row h1{font-size:34px}.benchmark-kpi-grid,.benchmark-arm-grid,.benchmark-detail-grid{grid-template-columns:1fr}.benchmark-kpi-grid article{border-right:0;border-bottom:1px solid var(--benchmark-border)}.benchmark-kpi-grid article:last-child{border-bottom:0}.benchmark-tabs{padding-inline:20px;overflow-x:auto}.benchmark-tabs .benchmark-refresh{display:none}.benchmark-content{width:calc(100vw - 40px);padding-top:28px}.benchmark-section-heading>p{text-align:left}.benchmark-footer code{max-width:100%}}@media (prefers-reduced-motion:reduce){.benchmark-page *,.benchmark-page :before,.benchmark-page :after{scroll-behavior:auto!important;transition:none!important}}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-latin-wght-normal-BgDaEnEv.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2)format("woff2-variations");unicode-range:U+2000-2001,U+2004-2008,U+200A,U+23B8-23BD,U+2500-259F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-amber-950:oklch(27.9% .077 45.635);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-800:oklch(43.2% .095 166.913);--color-emerald-900:oklch(37.8% .077 168.94);--color-emerald-950:oklch(26.2% .051 172.552);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-800:oklch(44.3% .11 240.79);--color-sky-900:oklch(39.1% .09 240.876);--color-sky-950:oklch(29.3% .066 243.157);--color-rose-50:oklch(96.9% .015 12.422);--color-rose-100:oklch(94.1% .03 12.58);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-600:oklch(58.6% .253 17.585);--color-rose-700:oklch(51.4% .222 16.935);--color-rose-800:oklch(45.5% .188 13.697);--color-rose-900:oklch(41% .159 10.272);--color-rose-950:oklch(27.1% .105 12.094);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-zinc-50:oklch(98.5% 0 0);--color-zinc-100:oklch(96.7% .001 286.375);--color-zinc-200:oklch(92% .004 286.32);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-400:oklch(70.5% .015 286.067);--color-zinc-500:oklch(55.2% .016 285.938);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-zinc-950:oklch(14.1% .005 285.823);--color-white:#fff;--spacing:.25rem;--container-xl:36rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-normal:0em;--radius-md:.375rem;--radius-lg:.5rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.\!visible{visibility:visible!important}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.fixed{position:fixed}.relative{position:relative}.static{position:static}.m-0{margin:calc(var(--spacing) * 0)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-8{margin-top:calc(var(--spacing) * 8)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-64{min-height:calc(var(--spacing) * 64)}.min-h-\[calc\(100vh-80px\)\]{min-height:calc(100vh - 80px)}.min-h-screen{min-height:100vh}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-9{width:calc(var(--spacing) * 9)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[1500px\]{max-width:1500px}.max-w-xl{max-width:var(--container-xl)}.min-w-\[260px\]{min-width:260px}.min-w-full{min-width:100%}.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.border-separate{border-collapse:separate}.border-spacing-0{--tw-border-spacing-x:calc(var(--spacing) * 0);--tw-border-spacing-y:calc(var(--spacing) * 0);border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}.animate-spin{animation:var(--animate-spin)}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-slate-100>:not(:last-child)){border-color:var(--color-slate-100)}.overflow-x-auto{overflow-x:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-200{border-color:var(--color-amber-200)}.border-emerald-200{border-color:var(--color-emerald-200)}.border-rose-200{border-color:var(--color-rose-200)}.border-sky-200{border-color:var(--color-sky-200)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-200\/80{border-color:#e2e8f0cc}@supports (color:color-mix(in lab, red, red)){.border-slate-200\/80{border-color:color-mix(in oklab, var(--color-slate-200) 80%, transparent)}}.border-slate-300{border-color:var(--color-slate-300)}.border-slate-900{border-color:var(--color-slate-900)}.border-transparent{border-color:#0000}.bg-\[\#f6f7f9\]{background-color:#f6f7f9}.bg-\[\#f7f7f4\]{background-color:#f7f7f4}.bg-amber-50{background-color:var(--color-amber-50)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-rose-50{background-color:var(--color-rose-50)}.bg-sky-50{background-color:var(--color-sky-50)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-slate-950{background-color:var(--color-slate-950)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.bg-white\/70{background-color:color-mix(in oklab, var(--color-white) 70%, transparent)}}.bg-white\/95{background-color:#fffffff2}@supports (color:color-mix(in lab, red, red)){.bg-white\/95{background-color:color-mix(in oklab, var(--color-white) 95%, transparent)}}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.pt-0{padding-top:calc(var(--spacing) * 0)}.text-center{text-align:center}.text-left{text-align:left}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[11px\]{font-size:11px}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-7{--tw-leading:calc(var(--spacing) * 7);line-height:calc(var(--spacing) * 7)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\[0\.14em\]{--tw-tracking:.14em;letter-spacing:.14em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-amber-900{color:var(--color-amber-900)}.text-amber-950{color:var(--color-amber-950)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-emerald-800{color:var(--color-emerald-800)}.text-emerald-950{color:var(--color-emerald-950)}.text-rose-600{color:var(--color-rose-600)}.text-rose-700{color:var(--color-rose-700)}.text-rose-800{color:var(--color-rose-800)}.text-rose-900{color:var(--color-rose-900)}.text-sky-800{color:var(--color-sky-800)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-slate-900{color:var(--color-slate-900)}.text-slate-950{color:var(--color-slate-950)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_1px_2px_rgba\(15\,23\,42\,0\.04\)\]{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0f172a0a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.hover\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\:bg-slate-100:hover{background-color:var(--color-slate-100)}.hover\:bg-slate-800:hover{background-color:var(--color-slate-800)}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-slate-400:focus{--tw-ring-color:var(--color-slate-400)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-slate-400:focus-visible{--tw-ring-color:var(--color-slate-400)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:block{display:block}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-\[240px_1fr\]{grid-template-columns:240px 1fr}.sm\:p-8{padding:calc(var(--spacing) * 8)}.sm\:px-5{padding-inline:calc(var(--spacing) * 5)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}}@media (width>=48rem){.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=80rem){.xl\:sticky{position:sticky}.xl\:top-4{top:calc(var(--spacing) * 4)}.xl\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-\[260px_minmax\(0\,1fr\)\]{grid-template-columns:260px minmax(0,1fr)}.xl\:grid-cols-\[minmax\(0\,1\.35fr\)_minmax\(360px\,0\.65fr\)\]{grid-template-columns:minmax(0,1.35fr) minmax(360px,.65fr)}.xl\:grid-cols-\[minmax\(0\,1fr\)_420px\]{grid-template-columns:minmax(0,1fr) 420px}.xl\:self-start{align-self:flex-start}}:where(.dark\:divide-zinc-900:where(.dark,.dark *)>:not(:last-child)){border-color:var(--color-zinc-900)}.dark\:border-amber-900:where(.dark,.dark *){border-color:var(--color-amber-900)}.dark\:border-emerald-900:where(.dark,.dark *){border-color:var(--color-emerald-900)}.dark\:border-rose-900:where(.dark,.dark *){border-color:var(--color-rose-900)}.dark\:border-sky-900:where(.dark,.dark *){border-color:var(--color-sky-900)}.dark\:border-zinc-100:where(.dark,.dark *){border-color:var(--color-zinc-100)}.dark\:border-zinc-700:where(.dark,.dark *){border-color:var(--color-zinc-700)}.dark\:border-zinc-800:where(.dark,.dark *){border-color:var(--color-zinc-800)}.dark\:bg-\[\#09090b\]:where(.dark,.dark *){background-color:#09090b}.dark\:bg-amber-950:where(.dark,.dark *){background-color:var(--color-amber-950)}.dark\:bg-amber-950\/40:where(.dark,.dark *){background-color:#46190166}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-950\/40:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-amber-950) 40%, transparent)}}.dark\:bg-emerald-950:where(.dark,.dark *){background-color:var(--color-emerald-950)}.dark\:bg-rose-950:where(.dark,.dark *){background-color:var(--color-rose-950)}.dark\:bg-sky-950:where(.dark,.dark *){background-color:var(--color-sky-950)}.dark\:bg-zinc-50:where(.dark,.dark *){background-color:var(--color-zinc-50)}.dark\:bg-zinc-900:where(.dark,.dark *){background-color:var(--color-zinc-900)}.dark\:bg-zinc-950:where(.dark,.dark *){background-color:var(--color-zinc-950)}.dark\:bg-zinc-950\/40:where(.dark,.dark *){background-color:#09090b66}@supports (color:color-mix(in lab, red, red)){.dark\:bg-zinc-950\/40:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-zinc-950) 40%, transparent)}}.dark\:text-amber-100:where(.dark,.dark *){color:var(--color-amber-100)}.dark\:text-amber-200:where(.dark,.dark *){color:var(--color-amber-200)}.dark\:text-amber-300:where(.dark,.dark *){color:var(--color-amber-300)}.dark\:text-emerald-200:where(.dark,.dark *){color:var(--color-emerald-200)}.dark\:text-emerald-300:where(.dark,.dark *){color:var(--color-emerald-300)}.dark\:text-rose-100:where(.dark,.dark *){color:var(--color-rose-100)}.dark\:text-rose-200:where(.dark,.dark *){color:var(--color-rose-200)}.dark\:text-rose-300:where(.dark,.dark *){color:var(--color-rose-300)}.dark\:text-sky-200:where(.dark,.dark *){color:var(--color-sky-200)}.dark\:text-zinc-50:where(.dark,.dark *){color:var(--color-zinc-50)}.dark\:text-zinc-100:where(.dark,.dark *){color:var(--color-zinc-100)}.dark\:text-zinc-200:where(.dark,.dark *){color:var(--color-zinc-200)}.dark\:text-zinc-300:where(.dark,.dark *){color:var(--color-zinc-300)}.dark\:text-zinc-400:where(.dark,.dark *){color:var(--color-zinc-400)}.dark\:text-zinc-500:where(.dark,.dark *){color:var(--color-zinc-500)}.dark\:text-zinc-950:where(.dark,.dark *){color:var(--color-zinc-950)}@media (hover:hover){.dark\:hover\:bg-zinc-200:where(.dark,.dark *):hover{background-color:var(--color-zinc-200)}.dark\:hover\:bg-zinc-900:where(.dark,.dark *):hover{background-color:var(--color-zinc-900)}}.dark\:focus\:ring-zinc-500:where(.dark,.dark *):focus,.dark\:focus-visible\:ring-zinc-500:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--color-zinc-500)}}:root{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;font-family:Geist Variable,Geist,Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.dark{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}body{-webkit-font-smoothing:antialiased;text-rendering:geometricprecision;margin:0}button,input,select{font:inherit}.personal-home{--personal-accent:#2563eb;--personal-border:#e2ded6;color:#23272d;background:#f8f7f3;grid-template-columns:196px minmax(0,1fr);width:100%;min-height:100vh;display:grid;overflow-x:clip}.personal-sidebar{border-right:1px solid var(--personal-border);background:#fcfbf8;flex-direction:column;height:100vh;padding:1.5rem 1rem;display:flex;position:sticky;top:0}.personal-wordmark{color:#181d24;letter-spacing:-.01em;align-items:center;gap:.625rem;padding-inline:.5rem;font-size:.9375rem;font-weight:700;text-decoration:none;display:flex}.personal-wordmark-mark,.personal-manager-icon{color:#fff;background:#1e40af;border-radius:.625rem;flex:none;place-items:center;width:1.875rem;height:1.875rem;display:grid;box-shadow:0 1px 2px #0f172a24}.personal-nav{gap:.25rem;margin-top:2rem;display:grid}.personal-nav-item{color:#646971;text-align:left;background:0 0;border:0;border-radius:.625rem;align-items:center;gap:.625rem;width:100%;padding:.625rem .75rem;font-size:.875rem;font-weight:500;text-decoration:none;display:flex}.personal-nav-item-active{color:#1e40af;background:#e8eefc}.personal-nav-item:disabled{cursor:default;opacity:.72}.personal-health{color:#71717a;align-items:center;gap:.5rem;margin-top:auto;padding:.75rem .5rem 0;font-size:.75rem;display:flex}.personal-health-dot,.personal-state-dot{background:#94a3b8;border-radius:9999px;flex:none;width:.5rem;height:.5rem}.personal-health-dot.is-healthy{background:#22c55e;box-shadow:0 0 0 3px #22c55e1f}.personal-health-dot.is-unhealthy{background:#e11d48;box-shadow:0 0 0 3px #e11d481f}.personal-main{min-width:0;padding-bottom:6rem;position:relative}.personal-header{border-bottom:1px solid var(--personal-border);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fcfbf8eb;justify-content:space-between;align-items:center;gap:1.5rem;min-height:7rem;padding:1.5rem clamp(1.5rem,5vw,4.5rem);display:flex}.personal-header h1{color:#181d24;letter-spacing:-.035em;margin:0;font-size:clamp(1.625rem,2.5vw,2rem);font-weight:650}.personal-header p{color:#71717a;margin:.375rem 0 0;font-size:.875rem}.personal-primary-link,.personal-row-action{color:#fff;background:var(--personal-accent);border-radius:.625rem;flex:none;justify-content:center;align-items:center;gap:.375rem;font-size:.8125rem;font-weight:600;text-decoration:none;display:inline-flex;box-shadow:0 1px 2px #2563eb33}.personal-primary-link{min-height:2.375rem;padding-inline:.875rem}.personal-content{width:min(100%,70rem);margin-inline:auto;padding:2rem clamp(1.5rem,5vw,4.5rem)}.personal-manager-summary{background:#ffffffb8;border:1px solid #dbe0e8;border-radius:.75rem;align-items:center;gap:.875rem;padding:.875rem 1rem;display:flex;box-shadow:0 1px 2px #0f172a09}.personal-manager-summary p{color:#474f5b;margin:0;font-size:.875rem;line-height:1.5}.personal-manager-icon{color:#1e40af;width:1.75rem;height:1.75rem;box-shadow:none;background:#e2e9f9}.personal-section{margin-top:2.25rem}.personal-section-heading{justify-content:space-between;align-items:end;gap:1rem;margin-bottom:.75rem;display:flex}.personal-section-heading h2{color:#23272d;letter-spacing:-.01em;margin:0;font-size:1rem;font-weight:650}.personal-section-heading p{color:#7d7d85;margin:.25rem 0 0;font-size:.75rem}.personal-section-heading>span{color:#7d7d85;font-variant-numeric:tabular-nums;font-size:.75rem}.personal-list{border:1px solid var(--personal-border);background:#ffffffdb;border-radius:.75rem;overflow:hidden;box-shadow:0 2px 8px #1d232b09}.personal-list-row{border-bottom:1px solid #ebe8e2;align-items:center;gap:1rem;min-width:0;padding:1rem;display:grid}.personal-list-row:last-child{border-bottom:0}.personal-needs-row{grid-template-columns:auto minmax(0,1fr) auto auto}.personal-goal-row{color:inherit;grid-template-columns:minmax(0,1fr) auto auto;text-decoration:none;transition:background-color .12s}.personal-goal-row:hover{background:#f8fafc}.personal-goal-meta{align-items:center;gap:.75rem;display:inline-flex}.personal-state-dot.is-blocking{background:#d97706;box-shadow:0 0 0 3px #d977061f}.personal-row-copy{min-width:0}.personal-row-copy strong,.personal-row-copy span{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.personal-row-copy strong{color:#2a2f36;font-size:.875rem;font-weight:580}.personal-row-copy span{color:#7d7d85;margin-top:.3125rem;font-size:.75rem}.personal-row-action{color:#1e40af;min-height:2rem;box-shadow:none;background:#e8eefc;padding-inline:.75rem}.personal-empty{color:#7d7d85;text-align:center;padding:1.5rem 1rem;font-size:.8125rem}.personal-source-tools{color:#94949c;justify-content:flex-end;align-items:center;gap:.25rem;margin-top:1rem;font-size:.6875rem;display:flex}.personal-source-tools button{min-height:1.75rem;color:inherit;background:0 0;border:0;border-radius:.375rem;align-items:center;gap:.25rem;padding-inline:.375rem;display:inline-flex}.personal-source-tools button:not(:disabled):hover{color:#475569;background:#f1efea}.personal-manager-input{color:#7d7d85;text-align:left;cursor:pointer;background:#fffffff0;border:1px solid #d8d6d0;border-radius:9999px;align-items:center;gap:.625rem;min-width:12rem;padding:.75rem 1rem;font-size:.8125rem;transition:border-color .12s,box-shadow .12s,color .12s;display:inline-flex;position:fixed;bottom:1.5rem;right:1.5rem;box-shadow:0 8px 24px #0f172a14}.personal-manager-input:hover{color:#475569;border-color:#bfc9da;box-shadow:0 10px 28px #0f172a1f}.personal-manager-backdrop{z-index:50;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a33;justify-content:flex-end;display:flex;position:fixed;inset:0}.personal-manager-drawer{color:#23272d;background:#fcfbf8;grid-template-rows:auto auto minmax(0,1fr) auto;width:min(26.25rem,100vw);min-width:0;height:100%;display:grid;box-shadow:-12px 0 36px #0f172a29}.personal-manager-drawer-header{border-bottom:1px solid var(--personal-border);grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;padding:1rem;display:grid}.personal-manager-drawer-header h2,.personal-manager-drawer-header p{margin:0}.personal-manager-drawer-header h2{color:#181d24;font-size:.9375rem;font-weight:650}.personal-manager-drawer-header p{color:#7d7d85;margin-top:.125rem;font-size:.6875rem}.personal-manager-source{color:#475569;background:#f1efea;border-radius:9999px;padding:.25rem .5rem;font-size:.6875rem}.personal-manager-drawer-header button,.personal-manager-composer button{color:#646971;cursor:pointer;background:0 0;border:0;border-radius:.5rem;flex:none;place-items:center;width:2rem;height:2rem;display:inline-grid}.personal-manager-drawer-header button:hover{color:#23272d;background:#f1efea}.personal-manager-quick-actions{border-bottom:1px solid #ebe8e2;gap:.5rem;padding:.75rem 1rem;display:flex;overflow-x:auto}.personal-manager-thread{min-width:0;padding:1rem;overflow-y:auto}.personal-message-answer{white-space:pre-wrap;color:#323944;line-height:1.7}.personal-message-pending{color:#64748b}.personal-message-activity{color:#646a74;border-top:1px solid #d6d3cc;margin-top:.625rem;padding-top:.5rem}.personal-message-activity summary{cursor:pointer;width:fit-content;font-size:.6875rem;font-weight:600}.personal-message-activity ol{gap:.25rem;margin:.5rem 0 0;padding-left:1.125rem;font-size:.6875rem;display:grid}.personal-message-reconnect{color:#1e40af;background:#fff;border:1px solid #cbd5e1;border-radius:.5rem;margin-top:.625rem;padding:.35rem .65rem;font-size:.6875rem;font-weight:700}.personal-message-reconnect:hover{background:#eff6ff;border-color:#93c5fd}.personal-manager-composer{border-top:1px solid var(--personal-border);padding:.875rem 1rem max(.875rem, env(safe-area-inset-bottom));background:#fcfbf8;align-items:center;gap:.5rem;display:flex}.personal-manager-composer input{color:#23272d;background:#fff;border:1px solid #d8d6d0;border-radius:.625rem;outline:none;width:100%;min-width:0;height:2.5rem;padding-inline:.75rem}.personal-manager-composer input:focus{border-color:#60a5fa;box-shadow:0 0 0 3px #3b82f61f}.personal-manager-composer button{color:#fff;background:var(--personal-accent)}.personal-manager-composer button:disabled{cursor:default;opacity:.42}@media (width<=760px){.personal-home{display:block}.personal-sidebar{border-right:0;border-bottom:1px solid var(--personal-border);grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;height:auto;padding:.75rem 1rem;display:grid;position:static}.personal-nav{justify-content:flex-end;min-width:0;margin-top:0;display:flex}.personal-nav-item{width:auto;padding:.5rem}.personal-nav-item:not(.personal-nav-item-active){font-size:0}.personal-health{margin-top:0;padding:0;font-size:0}.personal-header{min-height:auto;padding:1.25rem 1rem}.personal-content{padding:1.5rem 1rem}.personal-list{box-shadow:none;background:0 0;border:0;overflow:visible}.personal-list-row{border:1px solid var(--personal-border);background:#ffffffe6;border-radius:.75rem;margin-bottom:.625rem}.personal-needs-row{grid-template-columns:auto minmax(0,1fr) auto}.personal-needs-row .personal-row-action{grid-column:2/-1;justify-self:start}.personal-manager-input{bottom:1rem;right:1rem}}@media (width<=640px){.personal-manager-backdrop{align-items:flex-end}.personal-manager-drawer{width:100%;max-width:none;height:100dvh}}@media (width<=420px){.personal-wordmark-mark{display:none}.personal-sidebar{grid-template-columns:auto minmax(0,1fr) auto;padding-inline:.75rem}.personal-nav{gap:0}.personal-nav-item{gap:.25rem;padding-inline:.375rem}.personal-header{align-items:flex-start}.personal-primary-link{padding-inline:.625rem}.personal-primary-link svg{display:none}.personal-needs-row,.personal-goal-row{grid-template-columns:minmax(0,1fr) auto}.personal-needs-row .personal-state-dot{display:none}.personal-manager-input{min-width:0;max-width:calc(100vw - 2rem)}.personal-goal-meta svg{display:none}.personal-manager-drawer-header{grid-template-columns:auto minmax(0,1fr) auto auto}}.personal-workspace{--workspace-accent:#2563eb;--workspace-border:#e5e2dc;--workspace-muted:#70747e;color:#1e2228;background:#faf9f6;grid-template-columns:4.5rem 20rem minmax(0,1fr);height:100vh;min-height:42rem;display:grid;overflow:hidden}.personal-global-rail{border-right:1px solid var(--workspace-border);background:#fcfbf8;flex-direction:column;align-items:center;min-height:0;padding:1.125rem .75rem;display:flex}.personal-rail-logo{color:#fff;background:#1e40af;border-radius:.75rem;place-items:center;width:2.5rem;height:2.5rem;display:grid;box-shadow:0 4px 12px #1e40af2e}.personal-global-rail nav{gap:.5rem;margin-top:2rem;display:grid}.personal-global-rail nav button,.personal-global-rail>button{color:#80848c;cursor:pointer;background:0 0;border:0;border-radius:.625rem;place-items:center;width:2.5rem;height:2.5rem;display:grid}.personal-global-rail nav button.is-active{color:#1e40af;background:#e8eefc}.personal-global-rail nav button:disabled{cursor:default;opacity:.42}.personal-global-rail .personal-health-dot{margin-top:auto}.personal-goal-sidebar{border-right:1px solid var(--workspace-border);background:#fcfbf8;grid-template-rows:auto auto minmax(0,1fr) auto;min-width:0;min-height:0;display:grid}.personal-goal-sidebar>header{justify-content:space-between;align-items:center;height:4.75rem;padding:0 1.25rem;display:flex}.personal-goal-sidebar>header h1{letter-spacing:-.02em;margin:0;font-size:1rem;font-weight:680}.personal-goal-sidebar>header button,.personal-goal-sidebar>footer button{color:#70747e;background:0 0;border:0;border-radius:.5rem;place-items:center;width:2rem;height:2rem;display:grid}.personal-goal-sidebar>header button:disabled{opacity:.4}.personal-manager-row,.personal-goal-list-row{width:calc(100% - 1.5rem);min-width:0;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:.75rem;align-items:center;gap:.75rem;margin:0 .75rem;padding:.75rem;display:grid}.personal-manager-row{grid-template-columns:auto minmax(0,1fr);margin-bottom:.5rem}.personal-manager-row.is-selected,.personal-goal-list-row.is-selected{background:#e9eefa}.personal-goal-icon{color:#2563eb;background:#ffffffe6;border-radius:.625rem;place-items:center;width:2.25rem;height:2.25rem;display:grid;box-shadow:0 1px 2px #0f172a0f}.personal-manager-row strong,.personal-manager-row small,.personal-goal-list-copy strong,.personal-goal-list-copy small{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.personal-manager-row strong,.personal-goal-list-copy strong{font-size:.8125rem;font-weight:620}.personal-manager-row small,.personal-goal-list-copy small{color:var(--workspace-muted);margin-top:.25rem;font-size:.6875rem}.personal-goal-scroll{min-height:0;padding-bottom:1rem;overflow-y:auto}.personal-goal-list-row{grid-template-columns:auto minmax(0,1fr) auto;margin-bottom:.25rem}.personal-goal-list-row:hover{background:#f5f3ef}.personal-goal-list-row.is-selected:hover{background:#e9eefa}.personal-goal-list-row .personal-state-dot{width:.4375rem;height:.4375rem}.personal-state-dot.is-progressing{background:#10b981}.personal-state-dot.is-repair{background:#f43f5e}.personal-goal-list-row .rounded-full{padding-inline:.45rem;font-size:.625rem}.personal-goal-sidebar>footer{border-top:1px solid var(--workspace-border);min-height:3.25rem;color:var(--workspace-muted);justify-content:space-between;align-items:center;padding:0 1.25rem;font-size:.6875rem;display:flex}.personal-chat-pane{background:#faf9f6;grid-template-rows:auto minmax(0,1fr) auto;min-width:0;min-height:0;display:grid}.personal-chat-header{z-index:20;border-bottom:1px solid var(--workspace-border);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);background:#fcfbf8f0;justify-content:space-between;align-items:center;gap:1rem;min-width:0;min-height:4.75rem;padding:.75rem clamp(1rem,2.5vw,2rem);display:flex;position:relative}.personal-chat-title,.personal-chat-actions{align-items:center;gap:.75rem;min-width:0;display:flex}.personal-chat-title{flex:auto;overflow:hidden}.personal-chat-title>div{min-width:0}.personal-chat-actions{flex:none}.personal-chat-title h2,.personal-chat-title p{margin:0}.personal-chat-title h2{color:#181d24;letter-spacing:-.02em;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;font-weight:680;overflow:hidden}.personal-chat-title p{max-width:28rem;color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.15rem;font-size:.6875rem;overflow:hidden}.personal-chat-back,.personal-mobile-goals-button,.personal-chat-actions>button{color:#5b606a;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:.625rem;flex:none;place-items:center;width:2.25rem;height:2.25rem;display:grid}.personal-mobile-goals-button,.personal-agent-menu-backdrop{display:none}.personal-chat-back:hover,.personal-chat-actions>button:hover{border-color:var(--workspace-border);background:#fff}.personal-chat-actions>button.personal-progress-trigger{border-color:var(--workspace-border);color:#3c434e;background:#fffc;gap:.4rem;width:auto;padding-inline:.75rem;font-size:.6875rem;font-weight:620;display:inline-flex}.personal-agent-picker{position:relative}.personal-agent-trigger{color:#292e36;cursor:pointer;background:#fff;border:1px solid #dadadc;border-radius:.625rem;align-items:center;gap:.45rem;min-height:2.25rem;padding:0 .75rem;font-size:.75rem;font-weight:600;display:inline-flex}.personal-agent-menu{z-index:40;border:1px solid var(--workspace-border);background:#fffffffa;border-radius:.875rem;width:min(21rem,100vw - 2rem);padding:.5rem;position:absolute;top:calc(100% + .5rem);right:0;box-shadow:0 18px 48px #0f172a29}.personal-agent-menu-title,.personal-agent-menu-footer{color:var(--workspace-muted);padding:.5rem .625rem;font-size:.6875rem}.personal-agent-menu-title{color:#23272d;font-weight:650}.personal-agent-menu-footer{border-top:1px solid var(--workspace-border);margin-top:.375rem}.personal-agent-menu>button{width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:.625rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.625rem;padding:.625rem;display:grid}.personal-agent-menu>button:hover,.personal-agent-menu>button.is-selected{background:#eff3fc}.personal-agent-menu>button:disabled{cursor:not-allowed;opacity:.52}.personal-agent-menu strong,.personal-agent-menu small{display:block}.personal-agent-menu strong{font-size:.75rem}.personal-agent-menu small{color:var(--workspace-muted);margin-top:.125rem;font-size:.65rem}.personal-agent-avatar{color:#1e40af;background:#e2e9f9;border-radius:.625rem;flex:none;place-items:center;width:2rem;height:2rem;font-size:.75rem;font-weight:700;display:grid}.personal-agent-online{background:#10b981;border-radius:9999px;width:.4375rem;height:.4375rem}.personal-agent-online.is-offline{background:#94a3b8}.personal-live-badge{color:#33634e;background:#f5fcf8;border:1px solid #d1eddf;border-radius:9999px;align-items:center;gap:.375rem;padding:.35rem .625rem;font-size:.65rem;display:inline-flex}.personal-live-badge>span{background:#10b981;border-radius:9999px;width:.375rem;height:.375rem}.personal-chat-scroll{width:100%;min-height:0;padding:2rem clamp(1rem,5vw,5rem) 1.5rem;overflow-y:auto}.personal-chat-scroll>*{width:min(100%,56rem);margin-inline:auto}.personal-chat-welcome{background:#f1efea;border-radius:1rem;align-items:flex-start;gap:.875rem;margin-top:clamp(4rem,14vh,9rem);padding:1rem 1.125rem;display:flex}.personal-chat-welcome h3,.personal-chat-welcome p{margin:0}.personal-chat-welcome h3{font-size:.875rem;font-weight:650}.personal-chat-welcome p{color:#474f5b;margin-top:.25rem;font-size:.8125rem;line-height:1.55}.personal-manager-quick-actions{border:0;justify-content:center;gap:.625rem;padding:1rem 0;display:flex;overflow-x:auto}.personal-manager-quick-actions button{color:#3c434e;cursor:pointer;background:#ffffffc7;border:1px solid #d7dae1;border-radius:.625rem;flex:none;padding:.625rem .875rem;font-size:.75rem}.personal-manager-quick-actions button:hover{color:#1e40af;border-color:#a3b5dc}.personal-goal-summary{border:1px solid var(--workspace-border);background:#ffffffd1;border-radius:.875rem;overflow:hidden;box-shadow:0 2px 8px #0f172a08}.personal-goal-summary>div{border-bottom:1px solid #ebe8e2;grid-template-columns:7rem minmax(0,1fr);gap:1rem;padding:.8rem 1rem;font-size:.75rem;display:grid}.personal-goal-summary>div:last-child{border-bottom:0}.personal-goal-summary span{color:var(--workspace-muted)}.personal-goal-summary strong{min-width:0;font-weight:560}.personal-goal-summary .is-attention{background:#fffbeb}.personal-goal-summary .is-attention span,.personal-goal-summary .is-attention strong{color:#92400e}.personal-goal-projection{gap:.75rem;display:grid}.personal-projection-author{align-items:center;gap:.75rem;padding:0 .125rem .25rem;display:flex}.personal-projection-author strong,.personal-projection-author small{display:block}.personal-projection-author strong{color:#23272d;font-size:.8125rem;font-weight:660}.personal-projection-author small{color:var(--workspace-muted);margin-top:.15rem;font-size:.65rem}.personal-plan-card{border:1px solid var(--workspace-border);background:#ffffffdb;border-radius:.875rem;overflow:hidden;box-shadow:0 2px 8px #0f172a06}.personal-plan-card>header{border-bottom:1px solid #ebe8e2;justify-content:space-between;align-items:center;gap:1rem;min-height:3.25rem;padding:.75rem 1rem;display:flex}.personal-plan-card>header strong,.personal-plan-card>header small{display:block}.personal-plan-card>header strong{font-size:.75rem;font-weight:660}.personal-plan-card>header small{color:var(--workspace-muted);margin-top:.2rem;font-size:.625rem}.personal-plan-card>header>span{color:#5a5e65;background:#faf9f6;border:1px solid #e0ddd7;border-radius:.5rem;flex:none;padding:.25rem .45rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.65rem}.personal-plan-row{color:#343a43;border-bottom:1px solid #f0eee9;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;min-height:2.625rem;padding:.625rem 1rem;font-size:.75rem;display:grid}.personal-plan-row svg{color:#2563eb}.personal-plan-row.is-done svg{color:#059669}.personal-plan-row.is-done>span{color:#5c626b}.personal-plan-row small{color:var(--workspace-muted);font-size:.625rem}.personal-plan-card>button{color:#545b66;cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;gap:.25rem;width:100%;min-height:2.625rem;font-size:.6875rem;display:flex}.personal-plan-card>button:hover{color:#1e40af;background:#f8f9fc}.personal-plan-card.is-empty>header{border-bottom:0}.personal-plan-card.is-empty>p{color:var(--workspace-muted);margin:-.25rem 0 0;padding:0 1rem 1rem;font-size:.75rem;line-height:1.55}.personal-run-evidence-card{border:1px solid var(--workspace-border);width:100%;min-height:3.75rem;color:inherit;text-align:left;cursor:pointer;background:#ffffffd1;border-radius:.875rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;padding:.75rem 1rem;display:grid}.personal-run-evidence-card:hover{background:#fff;border-color:#c7ccd6}.personal-evidence-icon{color:#059669;background:#ecfdf5;border-radius:.625rem;place-items:center;width:2rem;height:2rem;display:grid}.personal-run-evidence-card strong,.personal-run-evidence-card small{display:block}.personal-run-evidence-card strong{font-size:.75rem;font-weight:650}.personal-run-evidence-card small{max-width:38rem;color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.2rem;font-size:.65rem;overflow:hidden}.personal-run-evidence-card em{color:var(--workspace-muted);white-space:nowrap;font-size:.625rem;font-style:normal}.personal-decision-card{background:#fffaee;border:1px solid #f5c068;border-radius:.875rem;justify-content:space-between;align-items:center;gap:1.5rem;margin-top:1rem;padding:1rem;display:flex}.personal-decision-card span{color:#b45309;text-transform:uppercase;font-size:.6875rem;font-weight:700}.personal-decision-card h3,.personal-decision-card p{margin:0}.personal-decision-card h3{margin-top:.25rem;font-size:.9375rem;font-weight:650}.personal-decision-card p{color:var(--workspace-muted);margin-top:.25rem;font-size:.75rem}.personal-decision-actions{flex:none;gap:.5rem;display:flex}.personal-decision-actions button,.personal-execution-card button,.personal-ops-link{color:#1e40af;cursor:pointer;background:#fff;border:1px solid #bbc9ea;border-radius:.625rem;justify-content:center;align-items:center;min-height:2.25rem;padding:0 .75rem;font-size:.75rem;font-weight:600;text-decoration:none;display:inline-flex}.personal-decision-actions button:last-child{border-color:var(--workspace-accent);color:#fff;background:var(--workspace-accent)}.personal-manager-thread{min-width:0;padding:1.25rem 0 0;overflow:visible}.personal-manager-message{color:#474f5b;background:#f1efea;border-radius:.875rem;width:fit-content;max-width:min(88%,43rem);margin-bottom:1rem;padding:.75rem .875rem;font-size:.8125rem;line-height:1.55}.personal-manager-message.is-user{color:#fff;background:#2563eb;margin-left:auto}.personal-message-author{color:#1e40af;margin-bottom:.25rem;font-size:.6875rem;font-weight:700;display:block}.personal-manager-message p,.personal-manager-message ul{margin:0}.personal-manager-message ul{gap:.375rem;margin-top:.5rem;padding-left:1rem;display:grid}.personal-manager-message small{color:#7d7d85;margin-top:.5rem;font-size:.625rem;display:block}.personal-manager-message.is-user small{color:#dbeafe}.personal-manager-message.is-pending{color:#64748b;background:#f8fafc}.personal-proposal-list{gap:.75rem;width:min(100%,43rem);margin:0 0 1.25rem;display:grid}.personal-proposal-card{background:#f9fbff;border:1px solid #d3dcee;border-radius:.875rem;gap:.625rem;padding:.875rem;display:grid}.personal-proposal-card>header{align-items:center;gap:.5rem;display:flex}.personal-proposal-card>header span{color:#1e40af;background:#dbeafe;border-radius:999px;padding:.125rem .5rem;font-size:.625rem;font-weight:700}.personal-proposal-card>header strong{font-size:.75rem}.personal-proposal-card>header small{color:var(--workspace-muted);margin-left:auto;font-size:.625rem}.personal-proposal-card>p,.personal-proposal-card>small{margin:0}.personal-proposal-card>p{color:#1e293b;font-size:.8125rem;font-weight:600;line-height:1.5}.personal-proposal-card>small,.personal-proposal-status{color:#64748b;font-size:.6875rem;line-height:1.5}.personal-proposal-card>code{color:#475569;background:#f1f5f9;border-radius:.375rem;width:fit-content;padding:.25rem .375rem;font-size:.625rem}.personal-proposal-card.is-approved{background:#f7fefa;border-color:#a7f3d0}.personal-proposal-card.is-stale,.personal-proposal-card.is-error{background:#fffbeb;border-color:#fdba74}.personal-proposal-actions{flex-wrap:wrap;gap:.5rem;display:flex}.personal-proposal-actions button{color:#475569;cursor:pointer;background:#fff;border:1px solid #cbd5e1;border-radius:.625rem;min-height:2.25rem;padding:0 .75rem;font-size:.6875rem;font-weight:650}.personal-proposal-actions button:first-child{border-color:var(--workspace-accent);color:#fff;background:var(--workspace-accent)}.personal-proposal-actions button:disabled{cursor:wait;opacity:.55}.personal-execution-card{border:1px solid var(--workspace-border);background:#fffc;border-radius:.875rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;margin-top:1.25rem;padding:.875rem;display:grid}.personal-execution-card strong,.personal-execution-card p{margin:0}.personal-execution-card strong{font-size:.8125rem}.personal-execution-card p{color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.25rem;font-size:.6875rem;overflow:hidden}.personal-manager-composer{background:#fffffff5;border:1px solid #d5d5d6;border-radius:1rem;grid-template-rows:1fr;grid-template-columns:auto minmax(0,1fr) auto;gap:.5rem;width:min(100% - 2rem,58rem);min-height:4rem;margin:0 auto 1rem;padding:.5rem .625rem;display:grid;position:relative;box-shadow:0 10px 30px #0f172a14}.personal-manager-composer input{color:#23272d;background:0 0;border:0;outline:none;grid-area:1/2;height:2.75rem;padding:0 .25rem}.personal-manager-composer input:focus{box-shadow:none;border:0}.personal-composer-tools{grid-area:1/1;align-self:center;align-items:center;min-width:0;display:flex}.personal-composer-tools button{color:#334155;cursor:pointer;background:#f5f3ef;border:0;border-radius:.75rem;align-items:center;gap:.35rem;width:auto;min-width:0;height:2.5rem;min-height:2.5rem;padding:0 .625rem;font-size:.6875rem;font-weight:620;display:inline-flex}.personal-composer-tools button span{text-overflow:ellipsis;white-space:nowrap;max-width:8rem;display:block;overflow:hidden}.personal-manager-composer .personal-send-button{color:#fff;background:var(--workspace-accent);cursor:pointer;border:0;border-radius:.75rem;grid-area:1/3;align-self:center;place-items:center;width:2.5rem;height:2.5rem;display:grid}.personal-manager-composer .personal-send-button:disabled{cursor:default;opacity:.34}.personal-details-backdrop{z-index:70;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a2e;justify-content:flex-end;display:flex;position:fixed;inset:0}.personal-running-details{background:#fcfbf8;width:min(28rem,100vw);height:100%;padding:1rem;overflow-y:auto;box-shadow:-12px 0 36px #0f172a29}.personal-running-details>header{justify-content:space-between;align-items:center;gap:1rem;padding-bottom:1rem;display:flex}.personal-running-details h2,.personal-running-details header p{margin:0}.personal-running-details h2{font-size:1rem;font-weight:680}.personal-running-details header p{color:var(--workspace-muted);margin-top:.25rem;font-size:.6875rem}.personal-running-details header button{cursor:pointer;background:#f1efea;border:0;border-radius:.625rem;place-items:center;width:2.25rem;height:2.25rem;display:grid}.personal-diagnosis-card{border:1px solid var(--workspace-border);background:#fff;border-radius:.875rem;padding:1rem}.personal-diagnosis-card>span{color:#059669;font-size:.6875rem;font-weight:700}.personal-diagnosis-card h3{margin:.375rem 0 1rem;font-size:.875rem;line-height:1.5}.personal-diagnosis-card dl,.personal-diagnosis-card dd{margin:0}.personal-diagnosis-card dl{gap:.625rem;display:grid}.personal-diagnosis-card dl>div{grid-template-columns:3.5rem minmax(0,1fr);gap:.75rem;font-size:.75rem;display:grid}.personal-diagnosis-card dt{color:var(--workspace-muted)}.personal-running-details details{border-bottom:1px solid var(--workspace-border);padding:1rem .25rem}.personal-running-details summary{cursor:pointer;font-size:.8125rem;font-weight:620}.personal-running-details details p{color:var(--workspace-muted);margin:.75rem 0 0;font-size:.75rem;line-height:1.55}.personal-details-todo-list{gap:.375rem;margin:.75rem 0 0;padding:0;list-style:none;display:grid}.personal-details-todo-list li{color:#484f59;padding-left:1rem;font-size:.71875rem;line-height:1.45;position:relative}.personal-details-todo-list li:before{content:"";background:#2563eb;border-radius:9999px;width:.375rem;height:.375rem;position:absolute;top:.45em;left:0}.personal-details-todo-list li.is-done{color:#7e838b}.personal-details-todo-list li.is-done:before{background:#059669}.personal-ops-link{gap:.375rem;width:100%;margin-top:1rem}.dark .personal-workspace,.dark .personal-chat-pane{color:#f4f4f5;background:#131417}.dark .personal-global-rail,.dark .personal-goal-sidebar,.dark .personal-chat-header,.dark .personal-running-details{color:#f4f4f5;background:#191a1e}.dark .personal-plan-card,.dark .personal-run-evidence-card,.dark .personal-projection-author strong{color:#f4f4f5;background:#1e1f23}.dark .personal-plan-card>header,.dark .personal-plan-row{border-color:#3f3f46}.dark .personal-plan-row,.dark .personal-plan-row.is-done>span{color:#d4d4d8}.dark .personal-decision-card{background:#45290d;border-color:#92400e}@media (width<=1000px){.personal-workspace{grid-template-columns:3.75rem 16.5rem minmax(0,1fr)}.personal-live-badge{display:none}.personal-chat-scroll{padding-inline:1.25rem}}@media (width<=720px){.personal-workspace{grid-template-rows:minmax(0,1fr);grid-template-columns:1fr;height:100dvh;min-height:100dvh;overflow:hidden}.personal-global-rail{display:none}.personal-goal-sidebar{border-right:0;height:100dvh;display:none}.personal-workspace.mobile-goals-visible .personal-goal-sidebar{display:grid}.personal-workspace.mobile-goals-visible .personal-chat-pane{display:none}.personal-chat-pane{height:100dvh;min-height:0}.personal-chat-header{-webkit-backdrop-filter:none;backdrop-filter:none;gap:.5rem;min-height:4.25rem;padding-inline:.75rem}.personal-mobile-goals-button{display:grid}.personal-goal-sidebar>header button,.personal-goal-sidebar>footer button{width:2.75rem;height:2.75rem}.personal-chat-title p,.personal-chat-title>span,.personal-chat-actions>button:first-of-type,.personal-chat-actions>button.personal-progress-trigger span{display:none}.personal-chat-actions>button.personal-progress-trigger{width:2.75rem;padding:0}.personal-chat-back,.personal-mobile-goals-button,.personal-chat-actions>button{width:2.75rem;height:2.75rem}.personal-agent-trigger{min-height:2.75rem;padding-inline:.5rem}.personal-agent-menu-backdrop{z-index:35;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a33;border:0;display:block;position:fixed;inset:0}.personal-agent-menu{z-index:40;border-radius:1rem;width:auto;max-height:calc(100dvh - 1.5rem);position:fixed;inset:auto .75rem .75rem;overflow-y:auto}.personal-agent-menu>button{min-height:3.5rem}.personal-chat-scroll{padding:1rem .75rem}.personal-chat-welcome{margin-top:1rem}.personal-manager-quick-actions{grid-template-columns:repeat(2,minmax(0,1fr));display:grid;overflow:visible}.personal-manager-quick-actions button{white-space:normal;width:100%}.personal-manager-quick-actions button:last-child{grid-column:1/-1}.personal-goal-summary>div{grid-template-columns:5.5rem minmax(0,1fr)}.personal-decision-card{flex-direction:column;align-items:stretch}.personal-run-evidence-card{grid-template-columns:auto minmax(0,1fr) auto}.personal-run-evidence-card em,.personal-plan-row small{display:none}.personal-decision-actions{grid-template-columns:1fr 1fr;display:grid}.personal-decision-actions button,.personal-manager-quick-actions button,.personal-execution-card button,.personal-ops-link,.personal-running-details header button{min-height:2.75rem}.personal-running-details header button{width:2.75rem;height:2.75rem}.personal-execution-card{grid-template-columns:auto minmax(0,1fr) auto}.personal-execution-card .rounded-full{display:none}.personal-execution-card button{grid-column:2/-1;justify-self:start}.personal-manager-composer{margin-bottom:.5rem;position:sticky;bottom:.5rem}.personal-composer-tools button,.personal-send-button{min-width:2.75rem;min-height:2.75rem}}.chat-shell{background:radial-gradient(circle at 48% 0,#ffffffeb,#0000 30rem),#f7f8f6}.chat-goal-map{isolation:isolate;position:relative;overflow:hidden}.chat-goal-map:before{z-index:0;content:"";opacity:.44;background-image:radial-gradient(#94a3b83b .7px,#0000 .7px);background-size:18px 18px;position:absolute;inset:0;-webkit-mask-image:linear-gradient(#0000,#000 18% 84%,#0000);mask-image:linear-gradient(#0000,#000 18% 84%,#0000)}.chat-map-goal:after{content:"";background:#cbd5e1;width:1px;height:3rem;position:absolute;top:100%;left:50%}.chat-map-branches:before{content:"";background:#cbd5e1;height:1px;position:absolute;top:-1.5rem;left:16.666%;right:16.666%}.chat-map-branches>div{position:relative}.chat-map-branches>div:before{content:"";background:#cbd5e1;width:1px;height:1.5rem;position:absolute;bottom:100%;left:50%}.chat-map-branches:after{content:"";background:#cbd5e1;width:1px;height:2.5rem;position:absolute;top:100%;left:50%}@media (width<=767px){.chat-map-goal:after,.chat-map-branches:before,.chat-map-branches:after,.chat-map-branches>div:before{display:none}}@property --tw-border-spacing-x{syntax:"";inherits:false;initial-value:0}@property --tw-border-spacing-y{syntax:"";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/loopx/web/chat/assets/index-B9n5owdR.js b/loopx/web/chat/assets/index-DnsV3JwV.js similarity index 70% rename from loopx/web/chat/assets/index-B9n5owdR.js rename to loopx/web/chat/assets/index-DnsV3JwV.js index c07fd21c6d..2e05244c51 100644 --- a/loopx/web/chat/assets/index-B9n5owdR.js +++ b/loopx/web/chat/assets/index-DnsV3JwV.js @@ -113,25 +113,25 @@ Goal: `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=ga,s=!ta.jitless,c=s&&_a.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Vs([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Ws(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Ma(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Ia(e,r,na())))}),t)}var Gs=H(`$ZodUnion`,(e,t)=>{ns.init(e,t),ua(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),ua(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),ua(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),ua(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>sa(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Ws(t,r,e,i)):Ws(o,r,e,i)}}),Ks=H(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Gs.init(e,t);let n=e._zod.parse;ua(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=aa(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!ga(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),qs=H(`$ZodIntersection`,(e,t)=>{ns.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Ys(e,t,n)):Ys(e,i,a)}});function Js(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(va(e)&&va(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Js(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;re.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Ma(e))return e;let o=Js(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Xs=H(`$ZodTuple`,(e,t)=>{ns.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=Zs(n,`optin`),c=Zs(n,`optout`);if(!t.rest){if(a.lengthn.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:a,inst:e,origin:`array`})}let l=Array(n.length);for(let e=0;e{l[e]=t})):l[e]=t}if(t.rest){let e=n.length-1,s=a.slice(n.length);for(let n of s){e++;let a=t.rest._zod.run({value:n,issues:[]},i);a instanceof Promise?o.push(a.then(t=>Qs(t,r,e))):Qs(a,r,e)}}return o.length?Promise.all(o).then(()=>$s(l,r,n,a,c)):$s(l,r,n,a,c)}});function Zs(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function Qs(e,t,n){e.issues.length&&t.issues.push(...Pa(n,e.issues)),t.value[n]=e.value}function $s(e,t,n,r,i){for(let a=0;a=i){t.value.length=a;break}t.issues.push(...Pa(a,n.issues))}t.value[a]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var ec=H(`$ZodRecord`,(e,t)=>{ns.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!va(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>Ia(e,r,na())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...Pa(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...Pa(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Mo.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Ia(e,r,na())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Pa(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Pa(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),tc=H(`$ZodEnum`,(e,t)=>{ns.init(e,t);let n=ra(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ba.has(typeof e)).map(e=>typeof e==`string`?xa(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),nc=H(`$ZodLiteral`,(e,t)=>{if(ns.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?xa(e):e?xa(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),rc=H(`$ZodTransform`,(e,t)=>{ns.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ea(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new $i;return n.value=i,n.fallback=!0,n}});function ic(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var ac=H(`$ZodOptional`,(e,t)=>{ns.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,ua(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ua(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${sa(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>ic(e,r)):ic(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),oc=H(`$ZodExactOptional`,(e,t)=>{ac.init(e,t),ua(e._zod,`values`,()=>t.innerType._zod.values),ua(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),sc=H(`$ZodNullable`,(e,t)=>{ns.init(e,t),ua(e._zod,`optin`,()=>t.innerType._zod.optin),ua(e._zod,`optout`,()=>t.innerType._zod.optout),ua(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${sa(e.source)}|null)$`):void 0}),ua(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),cc=H(`$ZodDefault`,(e,t)=>{ns.init(e,t),e._zod.optin=`optional`,ua(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>lc(e,t)):lc(r,t)}});function lc(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var uc=H(`$ZodPrefault`,(e,t)=>{ns.init(e,t),e._zod.optin=`optional`,ua(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),dc=H(`$ZodNonOptional`,(e,t)=>{ns.init(e,t),ua(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>fc(t,e)):fc(i,e)}});function fc(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var pc=H(`$ZodCatch`,(e,t)=>{ns.init(e,t),e._zod.optin=`optional`,ua(e._zod,`optout`,()=>t.innerType._zod.optout),ua(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ia(e,n,na()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ia(e,n,na()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),mc=H(`$ZodPipe`,(e,t)=>{ns.init(e,t),ua(e._zod,`values`,()=>t.in._zod.values),ua(e._zod,`optin`,()=>t.in._zod.optin),ua(e._zod,`optout`,()=>t.out._zod.optout),ua(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>hc(e,t.in,n)):hc(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>hc(e,t.out,n)):hc(r,t.out,n)}});function hc(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var gc=H(`$ZodReadonly`,(e,t)=>{ns.init(e,t),ua(e._zod,`propValues`,()=>t.innerType._zod.propValues),ua(e._zod,`values`,()=>t.innerType._zod.values),ua(e._zod,`optin`,()=>t.innerType?._zod?.optin),ua(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(_c):_c(r)}});function _c(e){return e.value=Object.freeze(e.value),e}var vc=H(`$ZodCustom`,(e,t)=>{Lo.init(e,t),ns.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>yc(t,n,r,e));yc(i,n,r,e)}});function yc(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ra(e))}}var bc,xc=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Sc(){return new xc}(bc=globalThis).__zod_globalRegistry??(bc.__zod_globalRegistry=Sc());var Cc=globalThis.__zod_globalRegistry;function wc(e,t){return new e({type:`string`,...U(t)})}function Tc(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...U(t)})}function Ec(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...U(t)})}function Dc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...U(t)})}function Oc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...U(t)})}function kc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...U(t)})}function Ac(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...U(t)})}function jc(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...U(t)})}function Mc(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...U(t)})}function Nc(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...U(t)})}function Pc(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...U(t)})}function Fc(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...U(t)})}function Ic(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...U(t)})}function Lc(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...U(t)})}function Rc(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...U(t)})}function zc(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...U(t)})}function Bc(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...U(t)})}function Vc(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...U(t)})}function Hc(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...U(t)})}function Uc(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...U(t)})}function Wc(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...U(t)})}function Gc(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...U(t)})}function Kc(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...U(t)})}function qc(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...U(t)})}function Jc(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...U(t)})}function Yc(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...U(t)})}function Xc(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...U(t)})}function Zc(e,t){return new e({type:`number`,checks:[],...U(t)})}function Qc(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...U(t)})}function $c(e,t){return new e({type:`boolean`,...U(t)})}function el(e,t){return new e({type:`null`,...U(t)})}function tl(e){return new e({type:`unknown`})}function nl(e,t){return new e({type:`never`,...U(t)})}function rl(e,t){return new zo({check:`less_than`,...U(t),value:e,inclusive:!1})}function il(e,t){return new zo({check:`less_than`,...U(t),value:e,inclusive:!0})}function al(e,t){return new Bo({check:`greater_than`,...U(t),value:e,inclusive:!1})}function ol(e,t){return new Bo({check:`greater_than`,...U(t),value:e,inclusive:!0})}function sl(e,t){return new Vo({check:`multiple_of`,...U(t),value:e})}function cl(e,t){return new Uo({check:`max_length`,...U(t),maximum:e})}function ll(e,t){return new Wo({check:`min_length`,...U(t),minimum:e})}function ul(e,t){return new Go({check:`length_equals`,...U(t),length:e})}function dl(e,t){return new qo({check:`string_format`,format:`regex`,...U(t),pattern:e})}function fl(e){return new Jo({check:`string_format`,format:`lowercase`,...U(e)})}function pl(e){return new Yo({check:`string_format`,format:`uppercase`,...U(e)})}function ml(e,t){return new Xo({check:`string_format`,format:`includes`,...U(t),includes:e})}function hl(e,t){return new Zo({check:`string_format`,format:`starts_with`,...U(t),prefix:e})}function gl(e,t){return new Qo({check:`string_format`,format:`ends_with`,...U(t),suffix:e})}function _l(e){return new $o({check:`overwrite`,tx:e})}function vl(e){return _l(t=>t.normalize(e))}function yl(){return _l(e=>e.trim())}function bl(){return _l(e=>e.toLowerCase())}function xl(){return _l(e=>e.toUpperCase())}function Sl(){return _l(e=>ma(e))}function Cl(e,t,n){return new e({type:`array`,element:t,...U(n)})}function wl(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...U(n)})}function Tl(e,t){let n=El(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ra(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Ra(r))}},e(t.value,t)),t);return n}function El(e,t){let n=new Lo({check:`custom`,...U(t)});return n._zod.check=e,n}function Dl(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Cc,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Ol(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Ol(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&jl(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function kl(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/ -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Al(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Nl(t,`input`,e.processors),output:Nl(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function jl(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return jl(r.element,n);if(r.type===`set`)return jl(r.valueType,n);if(r.type===`lazy`)return jl(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return jl(r.innerType,n);if(r.type===`intersection`)return jl(r.left,n)||jl(r.right,n);if(r.type===`record`||r.type===`map`)return jl(r.keyType,n)||jl(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:jl(r.in,n)||jl(r.out,n);if(r.type===`object`){for(let e in r.shape)if(jl(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(jl(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(jl(e,n))return!0;return!!(r.rest&&jl(r.rest,n))}return!1}var Ml=(e,t={})=>n=>{let r=Dl({...n,processors:t});return Ol(e,r),kl(r,e),Al(r,e)},Nl=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Dl({...i??{},target:a,io:t,processors:n});return Ol(e,o),kl(o,e),Al(o,e)},Pl={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Fl=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Pl[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Il=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ll=(e,t,n,r)=>{n.type=`boolean`},Rl=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},zl=(e,t,n,r)=>{n.not={}},Bl=(e,t,n,r)=>{let i=e._zod.def,a=ra(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Vl=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Hl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Ul=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Wl=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ol(a.element,t,{...r,path:[...r.path,`items`]})},Gl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Ol(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ol(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Kl=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ol(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ql=(e,t,n,r)=>{let i=e._zod.def,a=Ol(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ol(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Jl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Ol(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Ol(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Yl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ol(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Ol(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ol(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Xl=(e,t,n,r)=>{let i=e._zod.def,a=Ol(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Zl=(e,t,n,r)=>{let i=e._zod.def;Ol(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ql=(e,t,n,r)=>{let i=e._zod.def;Ol(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},$l=(e,t,n,r)=>{let i=e._zod.def;Ol(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},eu=(e,t,n,r)=>{let i=e._zod.def;Ol(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},tu=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Ol(o,t,r);let s=t.seen.get(e);s.ref=o},nu=(e,t,n,r)=>{let i=e._zod.def;Ol(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ru=(e,t,n,r)=>{let i=e._zod.def;Ol(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},iu=H(`ZodISODateTime`,(e,t)=>{gs.init(e,t),Mu.init(e,t)});function au(e){return qc(iu,e)}var ou=H(`ZodISODate`,(e,t)=>{_s.init(e,t),Mu.init(e,t)});function su(e){return Jc(ou,e)}var cu=H(`ZodISOTime`,(e,t)=>{vs.init(e,t),Mu.init(e,t)});function lu(e){return Yc(cu,e)}var uu=H(`ZodISODuration`,(e,t)=>{ys.init(e,t),Mu.init(e,t)});function du(e){return Xc(uu,e)}var fu=(e,t)=>{Ba.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ua(e,t)},flatten:{value:t=>Ha(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ia,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ia,2)}},isEmpty:{get(){return e.issues.length===0}}})},pu=H(`ZodError`,fu),mu=H(`ZodError`,fu,{Parent:Error}),hu=Wa(mu),gu=Ga(mu),_u=Ka(mu),vu=Ja(mu),yu=Xa(mu),bu=Za(mu),xu=Qa(mu),Su=$a(mu),Cu=eo(mu),wu=to(mu),Tu=no(mu),Eu=ro(mu),Du=new WeakMap;function Ou(e,t,n){let r=Object.getPrototypeOf(e),i=Du.get(r);if(i||(i=new Set,Du.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var ku=H(`ZodType`,(e,t)=>(ns.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Nl(e,`input`),output:Nl(e,`output`)}}),e.toJSONSchema=Ml(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>hu(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>_u(e,t,n),e.parseAsync=async(t,n)=>gu(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>vu(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>yu(e,t,n),e.decode=(t,n)=>bu(e,t,n),e.encodeAsync=async(t,n)=>xu(e,t,n),e.decodeAsync=async(t,n)=>Su(e,t,n),e.safeEncode=(t,n)=>Cu(e,t,n),e.safeDecode=(t,n)=>wu(e,t,n),e.safeEncodeAsync=async(t,n)=>Tu(e,t,n),e.safeDecodeAsync=async(t,n)=>Eu(e,t,n),Ou(e,`ZodType`,{check(...e){let t=this.def;return this.clone(fa(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Sa(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ud(e,t))},superRefine(e,t){return this.check(Wd(e,t))},overwrite(e){return this.check(_l(e))},optional(){return Td(this)},exactOptional(){return Dd(this)},nullable(){return kd(this)},nullish(){return Td(kd(this))},nonoptional(e){return Fd(this,e)},array(){return q(this)},or(e){return dd([this,e])},and(e){return hd(this,e)},transform(e){return zd(this,Cd(e))},default(e){return jd(this,e)},prefault(e){return Nd(this,e)},catch(e){return Ld(this,e)},pipe(e){return zd(this,e)},readonly(){return Vd(this)},describe(e){let t=this.clone();return Cc.add(t,{description:e}),t},meta(...e){if(e.length===0)return Cc.get(this);let t=this.clone();return Cc.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Cc.get(e)?.description},configurable:!0}),e)),Au=H(`_ZodString`,(e,t)=>{rs.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fl(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Ou(e,`_ZodString`,{regex(...e){return this.check(dl(...e))},includes(...e){return this.check(ml(...e))},startsWith(...e){return this.check(hl(...e))},endsWith(...e){return this.check(gl(...e))},min(...e){return this.check(ll(...e))},max(...e){return this.check(cl(...e))},length(...e){return this.check(ul(...e))},nonempty(...e){return this.check(ll(1,...e))},lowercase(e){return this.check(fl(e))},uppercase(e){return this.check(pl(e))},trim(){return this.check(yl())},normalize(...e){return this.check(vl(...e))},toLowerCase(){return this.check(bl())},toUpperCase(){return this.check(xl())},slugify(){return this.check(Sl())}})}),ju=H(`ZodString`,(e,t)=>{rs.init(e,t),Au.init(e,t),e.email=t=>e.check(Tc(Nu,t)),e.url=t=>e.check(jc(Iu,t)),e.jwt=t=>e.check(Kc(Zu,t)),e.emoji=t=>e.check(Mc(Lu,t)),e.guid=t=>e.check(Ec(Pu,t)),e.uuid=t=>e.check(Dc(Fu,t)),e.uuidv4=t=>e.check(Oc(Fu,t)),e.uuidv6=t=>e.check(kc(Fu,t)),e.uuidv7=t=>e.check(Ac(Fu,t)),e.nanoid=t=>e.check(Nc(Ru,t)),e.guid=t=>e.check(Ec(Pu,t)),e.cuid=t=>e.check(Pc(zu,t)),e.cuid2=t=>e.check(Fc(Bu,t)),e.ulid=t=>e.check(Ic(Vu,t)),e.base64=t=>e.check(Uc(Ju,t)),e.base64url=t=>e.check(Wc(Yu,t)),e.xid=t=>e.check(Lc(Hu,t)),e.ksuid=t=>e.check(Rc(Uu,t)),e.ipv4=t=>e.check(zc(Wu,t)),e.ipv6=t=>e.check(Bc(Gu,t)),e.cidrv4=t=>e.check(Vc(Ku,t)),e.cidrv6=t=>e.check(Hc(qu,t)),e.e164=t=>e.check(Gc(Xu,t)),e.datetime=t=>e.check(au(t)),e.date=t=>e.check(su(t)),e.time=t=>e.check(lu(t)),e.duration=t=>e.check(du(t))});function W(e){return wc(ju,e)}var Mu=H(`ZodStringFormat`,(e,t)=>{is.init(e,t),Au.init(e,t)}),Nu=H(`ZodEmail`,(e,t)=>{ss.init(e,t),Mu.init(e,t)}),Pu=H(`ZodGUID`,(e,t)=>{as.init(e,t),Mu.init(e,t)}),Fu=H(`ZodUUID`,(e,t)=>{os.init(e,t),Mu.init(e,t)}),Iu=H(`ZodURL`,(e,t)=>{cs.init(e,t),Mu.init(e,t)}),Lu=H(`ZodEmoji`,(e,t)=>{ls.init(e,t),Mu.init(e,t)}),Ru=H(`ZodNanoID`,(e,t)=>{us.init(e,t),Mu.init(e,t)}),zu=H(`ZodCUID`,(e,t)=>{ds.init(e,t),Mu.init(e,t)}),Bu=H(`ZodCUID2`,(e,t)=>{fs.init(e,t),Mu.init(e,t)}),Vu=H(`ZodULID`,(e,t)=>{ps.init(e,t),Mu.init(e,t)}),Hu=H(`ZodXID`,(e,t)=>{ms.init(e,t),Mu.init(e,t)}),Uu=H(`ZodKSUID`,(e,t)=>{hs.init(e,t),Mu.init(e,t)}),Wu=H(`ZodIPv4`,(e,t)=>{bs.init(e,t),Mu.init(e,t)}),Gu=H(`ZodIPv6`,(e,t)=>{xs.init(e,t),Mu.init(e,t)}),Ku=H(`ZodCIDRv4`,(e,t)=>{Ss.init(e,t),Mu.init(e,t)}),qu=H(`ZodCIDRv6`,(e,t)=>{Cs.init(e,t),Mu.init(e,t)}),Ju=H(`ZodBase64`,(e,t)=>{Ts.init(e,t),Mu.init(e,t)}),Yu=H(`ZodBase64URL`,(e,t)=>{Ds.init(e,t),Mu.init(e,t)}),Xu=H(`ZodE164`,(e,t)=>{Os.init(e,t),Mu.init(e,t)}),Zu=H(`ZodJWT`,(e,t)=>{As.init(e,t),Mu.init(e,t)}),Qu=H(`ZodNumber`,(e,t)=>{js.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Il(e,t,n,r),Ou(e,`ZodNumber`,{gt(e,t){return this.check(al(e,t))},gte(e,t){return this.check(ol(e,t))},min(e,t){return this.check(ol(e,t))},lt(e,t){return this.check(rl(e,t))},lte(e,t){return this.check(il(e,t))},max(e,t){return this.check(il(e,t))},int(e){return this.check(ed(e))},safe(e){return this.check(ed(e))},positive(e){return this.check(al(0,e))},nonnegative(e){return this.check(ol(0,e))},negative(e){return this.check(rl(0,e))},nonpositive(e){return this.check(il(0,e))},multipleOf(e,t){return this.check(sl(e,t))},step(e,t){return this.check(sl(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function G(e){return Zc(Qu,e)}var $u=H(`ZodNumberFormat`,(e,t)=>{Ms.init(e,t),Qu.init(e,t)});function ed(e){return Qc($u,e)}var td=H(`ZodBoolean`,(e,t)=>{Ns.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ll(e,t,n,r)});function K(e){return $c(td,e)}var nd=H(`ZodNull`,(e,t)=>{Ps.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rl(e,t,n,r)});function rd(e){return el(nd,e)}var id=H(`ZodUnknown`,(e,t)=>{Fs.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ad(){return tl(id)}var od=H(`ZodNever`,(e,t)=>{Is.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zl(e,t,n,r)});function sd(e){return nl(od,e)}var cd=H(`ZodArray`,(e,t)=>{Rs.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wl(e,t,n,r),e.element=t.element,Ou(e,`ZodArray`,{min(e,t){return this.check(ll(e,t))},nonempty(e){return this.check(ll(1,e))},max(e,t){return this.check(cl(e,t))},length(e,t){return this.check(ul(e,t))},unwrap(){return this.element}})});function q(e,t){return Cl(cd,e,t)}var ld=H(`ZodObject`,(e,t)=>{Us.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gl(e,t,n,r),ua(e,`shape`,()=>t.shape),Ou(e,`ZodObject`,{keyof(){return Y(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:ad()})},loose(){return this.clone({...this._zod.def,catchall:ad()})},strict(){return this.clone({...this._zod.def,catchall:sd()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Da(this,e)},safeExtend(e){return Oa(this,e)},merge(e){return ka(this,e)},pick(e){return Ta(this,e)},omit(e){return Ea(this,e)},partial(...e){return Aa(wd,this,e[0])},required(...e){return ja(Pd,this,e[0])}})});function J(e,t){return new ld({type:`object`,shape:e??{},...U(t)})}var ud=H(`ZodUnion`,(e,t)=>{Gs.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kl(e,t,n,r),e.options=t.options});function dd(e,t){return new ud({type:`union`,options:e,...U(t)})}var fd=H(`ZodDiscriminatedUnion`,(e,t)=>{ud.init(e,t),Ks.init(e,t)});function pd(e,t,n){return new fd({type:`union`,options:t,discriminator:e,...U(n)})}var md=H(`ZodIntersection`,(e,t)=>{qs.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ql(e,t,n,r)});function hd(e,t){return new md({type:`intersection`,left:e,right:t})}var gd=H(`ZodTuple`,(e,t)=>{Xs.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jl(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function _d(e,t,n){let r=t instanceof ns;return new gd({type:`tuple`,items:e,rest:r?t:null,...U(r?n:t)})}var vd=H(`ZodRecord`,(e,t)=>{ec.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yl(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function yd(e,t,n){return!t||!t._zod?new vd({type:`record`,keyType:W(),valueType:e,...U(t)}):new vd({type:`record`,keyType:e,valueType:t,...U(n)})}var bd=H(`ZodEnum`,(e,t)=>{tc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bl(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new bd({...t,checks:[],...U(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new bd({...t,checks:[],...U(r),entries:i})}});function Y(e,t){return new bd({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...U(t)})}var xd=H(`ZodLiteral`,(e,t)=>{nc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vl(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function X(e,t){return new xd({type:`literal`,values:Array.isArray(e)?e:[e],...U(t)})}var Sd=H(`ZodTransform`,(e,t)=>{rc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ul(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ea(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ra(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Ra(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Cd(e){return new Sd({type:`transform`,transform:e})}var wd=H(`ZodOptional`,(e,t)=>{ac.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ru(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Td(e){return new wd({type:`optional`,innerType:e})}var Ed=H(`ZodExactOptional`,(e,t)=>{oc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ru(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dd(e){return new Ed({type:`optional`,innerType:e})}var Od=H(`ZodNullable`,(e,t)=>{sc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kd(e){return new Od({type:`nullable`,innerType:e})}var Ad=H(`ZodDefault`,(e,t)=>{cc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ql(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function jd(e,t){return new Ad({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ya(t)}})}var Md=H(`ZodPrefault`,(e,t)=>{uc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$l(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nd(e,t){return new Md({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ya(t)}})}var Pd=H(`ZodNonOptional`,(e,t)=>{dc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fd(e,t){return new Pd({type:`nonoptional`,innerType:e,...U(t)})}var Id=H(`ZodCatch`,(e,t)=>{pc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ld(e,t){return new Id({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Rd=H(`ZodPipe`,(e,t)=>{mc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tu(e,t,n,r),e.in=t.in,e.out=t.out});function zd(e,t){return new Rd({type:`pipe`,in:e,out:t})}var Bd=H(`ZodReadonly`,(e,t)=>{gc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vd(e){return new Bd({type:`readonly`,innerType:e})}var Hd=H(`ZodCustom`,(e,t)=>{vc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hl(e,t,n,r)});function Ud(e,t={}){return wl(Hd,e,t)}function Wd(e,t){return Tl(e,t)}var Gd=e=>typeof e==`string`&&e.trim()?e.trim():null;function Kd(e){let t=e.decision_scope&&typeof e.decision_scope==`object`&&!Array.isArray(e.decision_scope)?e.decision_scope:{},n=Gd(t.kind),r=Gd(t.granularity),i=Gd(t.scope_key),a=Gd(e.superseded_by);return{interaction:e.task_class===`user_gate`?`decision`:`unknown`,lifecycle:a?`superseded`:e.status===`deferred`?`deferred`:e.done===!0||[`done`,`completed`,`closed`,`archived`].includes(String(e.status))?`closed`:e.status===`open`||e.status===`blocked`?`open`:`unknown`,reason:Gd(e.note),evidence:Gd(e.evidence),blocksAgent:Gd(e.blocks_agent),unblocksTodoId:Gd(e.unblocks_todo_id),decisionScope:n&&r&&i?{kind:n,granularity:r,scopeKey:i}:null,supersededBy:a}}function qd(e,t,n,r){return{...e,sourceId:t,goalTitle:r??e.goalTitle,details:n?e.details:{...e.details??Kd({}),lifecycle:`unavailable`}}}function Jd(e,t){return t.find(t=>t.sourceId===e.sourceId&&t.goalId===e.goalId&&t.todoId===e.todoId)||{...e,details:{...e.details??Kd({}),lifecycle:`unavailable`}}}function Yd(e,t){let n=e.details?.supersededBy;if(!(!n||n===e.todoId||e.details?.lifecycle===`unavailable`))return t.find(t=>t.sourceId===e.sourceId&&t.goalId===e.goalId&&t.todoId===n)}function Xd(e){return![`closed`,`deferred`,`superseded`,`unavailable`].includes(e.details?.lifecycle??`unknown`)}var Zd={ok:!0,registry:`$HOME/.codex/loopx/registry.global.json`,runtime_root:`$HOME/.codex/loopx`,goal_count:1,run_count:8440,status_contract:{schema_version:2,minimum_dashboard_schema_version:2,producer:`loopx status`,reload_hint:`scripts/macos-dashboard-launchagent.sh restart`},usage_summary:{available:!0,source:`run_history`,generated_at:`2026-07-06T06:49:06.471166+00:00`,sample_run_count:20,proxy_note:`run-history proxy; excludes token counts and raw thread logs`,totals:{runs_24h:20,runs_7d:20,quota_spend_slots_24h:11,quota_spend_slots_7d:11,automation_run_count_24h:11,automation_run_count_7d:11,progress_signal_run_count_24h:9,progress_signal_run_count_7d:9},goals:[{goal_id:`loopx-meta`,runs_24h:20,runs_7d:20,quota_spend_slots_24h:11,quota_spend_slots_7d:11,automation_run_count_24h:11,automation_run_count_7d:11,progress_signal_run_count_24h:9,progress_signal_run_count_7d:9,project_share_24h:1}]},event_ledger_summary:{available:!0,source:`run_history`,generated_at:`2026-07-06T06:49:06.360662+00:00`,sample_run_count:20,proxy_note:`append-only run-history projection; compact event-class counts only`,event_classes:[`accounting`,`decision`,`evidence`,`state`,`work`],totals:{events_24h:20,events_7d:20,by_class_24h:{accounting:11,decision:0,evidence:0,state:0,work:9},by_class_7d:{accounting:11,decision:0,evidence:0,state:0,work:9}},goals:[{goal_id:`loopx-meta`,events_24h:20,events_7d:20,by_class_24h:{accounting:11,decision:0,evidence:0,state:0,work:9},by_class_7d:{accounting:11,decision:0,evidence:0,state:0,work:9},latest_event_class:`accounting`,latest_event_at:`2026-07-06T14:37:32+08:00`}]},promotion_readiness_summary:{available:!0,source:`run_history_full_scan`,goal_id:`loopx-meta`,generated_at:`2026-07-05T20:02:02+08:00`,classification:`canary_promotion_readiness_smoke_group`,delivery_batch_scale:`multi_surface`,delivery_outcome:`primary_goal_outcome`,recommended_action:`Canary promotion-readiness smoke passed; promotion may proceed after doctor/status reports fresh evidence.`,json_exists:!0,markdown_exists:!0,freshness_window_hours:24,freshness_status:`fresh`,is_fresh:!0,requires_readiness_run:!1,age_seconds:67624,age_hours:18.78,freshness_reference_time:`2026-07-06T06:49:06.408527+00:00`,sample_run_count:0,proxy_note:`canary promotion-readiness projection from append-only run history; exact evidence stays in run artifacts`},promotion_gate:{ok:!0,registry:`$HOME/.codex/loopx/registry.global.json`,runtime_root:`$HOME/.codex/loopx`,gate:`promotion_readiness`,gate_state:`ready`,can_promote:!0,should_warn:!1,non_blocking:!0,recommended_action:`promotion readiness is fresh`,readiness:{available:!0,goal_id:`loopx-meta`,generated_at:`2026-07-05T20:02:02+08:00`,classification:`canary_promotion_readiness_smoke_group`,delivery_batch_scale:`multi_surface`,delivery_outcome:`primary_goal_outcome`,recommended_action:`Canary promotion-readiness smoke passed; promotion may proceed after doctor/status reports fresh evidence.`,json_exists:!0,markdown_exists:!0,runtime_root:`$HOME/.codex/loopx`,freshness_window_hours:24,freshness_status:`fresh`,is_fresh:!0,requires_readiness_run:!1,age_seconds:67624,age_hours:18.78,freshness_reference_time:`2026-07-06T06:49:06.471087+00:00`}},decision_freshness_summary:{available:!0,source:`run_history`,generated_at:`2026-07-06T06:49:06.471133+00:00`,sample_run_count:20,window_days:7,proxy_note:`checkpointed decision freshness projection; rebase old decisions at the decision point before reuse`,summary:{decision_count:0,stale_count:0,rebase_required_count:0,fresh_count:0},items:[]},todo_index:JSON.parse(`{"schema_version":"todo_index_v0","source":"live_loopx_status_public_slice","total_count":12,"current_projected_count":12,"rollout_event_count":94,"item_limit":12,"items":[{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo update recorded for todo_1596c3a678bb","schema_version":"todo_index_item_v0","todo_id":"todo_1596c3a678bb","role":"agent","status":"open","title":"todo update recorded for todo_1596c3a678bb","source":"rollout_event_log","agent_id":"codex-main-control","latest_event_kind":"todo_update","latest_event_at":"2026-07-06T06:33:32Z","latest_event_status":"open","event_count":7,"event_kinds":["todo_update"]},{"goal_id":"loopx-meta","index":24,"done":false,"text":"Monitor ArcticDB #3179 LoopX comment https://github.com/man-group/ArcticDB/issues/3179#issuecomment-4797835630 for metadata-only maintainer reply signal; do not read private material or reply again without owner approva…","schema_version":"todo_index_item_v0","todo_id":"todo_15bc0926a494","role":"agent","status":"open","priority":"P0-REVENUE MONITOR","title":"Monitor ArcticDB #3179 LoopX comment https://github.com/man-group/ArcticDB/issues/3179#issuecomment-4797835630 for metadata-only maintainer reply signal; do not read private material or reply again without owner approva…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","action_kind":"github_public_reply_metadata_monitor","claimed_by":"codex-value-explorer","evidence":"autonomous replan: bounded current value-explorer monitor lane with explicit expires_at.","note":"Set bounded watch expiry for metadata-only public reply monitor; no catch-up after expiry.","updated_at":"2026-07-05T06:27:15+08:00"},{"goal_id":"loopx-meta","index":17,"done":false,"text":"Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harness paths/imports and goal-harness CLI strings to loopx, rerun launch-artifact-handle smoke, and verify it does not reintrod…","schema_version":"todo_index_item_v0","todo_id":"todo_2bf560b48a0c","role":"agent","status":"open","priority":"P0","title":"Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harness paths/imports and goal-harness CLI strings to loopx, rerun launch-artifact-handle smoke, and verify it does not reintrod…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"blocker","action_kind":"legacy_open_pr_rename_blocker","claimed_by":"codex-main-control"},{"goal_id":"loopx-meta","index":23,"done":false,"text":"Fix or bypass local SkillsBench Docker verifier reward collection before using local fallback for canonical base/test comparison; organize-messy-files base on merged #668 reached final verifier but produced empty verifi…","schema_version":"todo_index_item_v0","todo_id":"todo_3ed1c4a69164","role":"agent","status":"open","priority":"P0","title":"Fix or bypass local SkillsBench Docker verifier reward collection before using local fallback for canonical base/test comparison; organize-messy-files base on merged #668 reached final verifier but produced empty verifi…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"blocker","action_kind":"skillsbench_local_verifier_reward_collection","claimed_by":"codex-main-control","required_capabilities":["benchmark_runner"]},{"goal_id":"loopx-meta","index":32,"done":false,"text":"Rerun SkillsBench raw vs loopx-goal-start-product-mode on citation-check and powerlifting with PR #779 merged; inspect compact public counters for soft_verify_exception_continued, probe_operation_count, task-facing solv…","schema_version":"todo_index_item_v0","todo_id":"todo_44907a5f355d","role":"agent","status":"blocked","priority":"P0","title":"Rerun SkillsBench raw vs loopx-goal-start-product-mode on citation-check and powerlifting with PR #779 merged; inspect compact public counters for soft_verify_exception_continued, probe_operation_count, task-facing solv…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"skillsbench_goal_start_raw_new_rerun","claimed_by":"codex-main-control","evidence":"Public-safe redacted live LoopX text; inspect local status for the full row.","note":"Do not spend a full citation-check loopx rerun yet: #865 fixed scored output paths and #874 added bootstrap preflight attribution, but citation-check itself still preflights as apt+verifier bootstrap risk on ECS.","updated_at":"2026-06-29T00:49:36+08:00"},{"goal_id":"loopx-meta","index":39,"done":false,"text":"Run the next SkillsBench loopx-goal-start-product-mode reverse-channel case on latest main (no local Docker), prioritizing a currently bad or uncertain case, then update the public case ledger and true LoopX issue analy…","schema_version":"todo_index_item_v0","todo_id":"todo_4762c790e583","role":"agent","status":"blocked","priority":"P0","title":"Run the next SkillsBench loopx-goal-start-product-mode reverse-channel case on latest main (no local Docker), prioritizing a currently bad or uncertain case, then update the public case ledger and true LoopX issue analy…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"skillsbench_goal_start_remote_rerun","claimed_by":"codex-main-control","evidence":"A prior benchmark adapter change was validated before the legacy surface was archived. Current research uses the RFC-linked benchmark workspace and toolkit boundary smokes.","note":"2026-06-29: fixed host-local ACP idle/no-output root cause in PR #894. ACP protocol tool_call_count=0 is now distinguished from reverse-channel task-facing bridge activity; repeated codex_exec_bridge_idle_timeout withou…","updated_at":"2026-06-29T19:40:32+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_584f55f8f3b4","schema_version":"todo_index_item_v0","todo_id":"todo_584f55f8f3b4","role":"agent","status":"open","title":"todo add recorded for todo_584f55f8f3b4","source":"rollout_event_log","agent_id":"codex-value-explorer","latest_event_kind":"todo_update","latest_event_at":"2026-07-06T06:48:49Z","latest_event_status":"open","event_count":3,"event_kinds":["todo_add","todo_update"]},{"goal_id":"loopx-meta","index":40,"done":false,"text":"Monitor r10 SkillsBench 30-case codex-app-server-goal-baseline batch, summarize completed compact results into the common case ledger, and stop/repair if setup/bootstrap creates new non-solver blockers.","schema_version":"todo_index_item_v0","todo_id":"todo_62debf065fec","role":"agent","status":"blocked","priority":"P0 MONITOR","title":"Monitor r10 SkillsBench 30-case codex-app-server-goal-baseline batch, summarize completed compact results into the common case ledger, and stop/repair if setup/bootstrap creates new non-solver blockers.","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","action_kind":"monitor_skillsbench_batch","claimed_by":"codex-main-control","evidence":"Observed 2026-06-30T02:52+08: active-state target_key=skillsbench-goal-baseline-30case-20260629T1826Z-r10; local ps/tmux/recent artifact search found no r10 batch process or compact artifact; no raw task/log/trajectory …","updated_at":"2026-06-30T02:54:54+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_93bc6439c521","schema_version":"todo_index_item_v0","todo_id":"todo_93bc6439c521","role":"agent","status":"open","title":"todo add recorded for todo_93bc6439c521","source":"rollout_event_log","agent_id":"codex-main-control","latest_event_kind":"todo_claim","latest_event_at":"2026-07-06T06:32:52Z","latest_event_status":"open","event_count":2,"event_kinds":["todo_add","todo_claim"]},{"goal_id":"loopx-meta","index":27,"done":false,"text":"Run the SkillsBench two-arm comparison after the goal-start route is countable: raw Codex vs new loopx-goal-start-product-mode, reporting task_score/control_score/time and compact public-safe LoopX todo rollout evidence.","schema_version":"todo_index_item_v0","todo_id":"todo_aad7e9716927","role":"agent","status":"blocked","priority":"P0","title":"Run the SkillsBench two-arm comparison after the goal-start route is countable: raw Codex vs new loopx-goal-start-product-mode, reporting task_score/control_score/time and compact public-safe LoopX todo rollout evidence.","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"run_goal_start_product_mode_matrix","claimed_by":"codex-main-control","evidence":"driver.status shows DONE raw then RUN loopx-goal-start with no running driver; raw benchmark_run.compact first_blocker=skillsbench_codex_acp_provider_zero_activity; source guard requires --host-local-acp-launch for Loop…","note":"Remote run group skillsbench-raw-new-goal-start-20260627T0420Z produced a material closeout for citation-check raw only; raw compact attribution is skillsbench_codex_acp_provider_zero_activity with official score missin…","updated_at":"2026-06-27T13:05:47+08:00"},{"goal_id":"loopx-meta","index":21,"done":false,"text":"Observe remote official SkillsBench powerlifting-coef-calc base/test runtime-layer mountfix pair skillsbench-powerlifting-coef-calc-remote-canonical-runtime-mountfix-pair-20260623T022028Z: use compact/public artifacts o…","schema_version":"todo_index_item_v0","todo_id":"todo_aec1873c7f28","role":"agent","status":"open","priority":"P0 MONITOR","title":"Observe remote official SkillsBench powerlifting-coef-calc base/test runtime-layer mountfix pair skillsbench-powerlifting-coef-calc-remote-canonical-runtime-mountfix-pair-20260623T022028Z: use compact/public artifacts o…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","claimed_by":"codex-main-control","note":"2026-06-23 projection fix: this is monitor context for the powerlifting run, not an advancement next action; current executable path is SkillsBench build cache/prewarm repair.","updated_at":"2026-06-23T10:37:43+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_c02cb7d19607","schema_version":"todo_index_item_v0","todo_id":"todo_c02cb7d19607","role":"agent","status":"open","title":"todo add recorded for todo_c02cb7d19607","source":"rollout_event_log","agent_id":"codex-value-explorer","latest_event_kind":"todo_add","latest_event_at":"2026-07-06T03:47:54Z","latest_event_status":"open","event_count":1,"event_kinds":["todo_add"]}]}`),agent_management_projection:{schema_version:`agent_management_projection_v0`,mode:`read_only`,goal_id:`loopx-meta`,generated_at:`2026-07-06T06:49:06Z`,style_hint:null,truth_contract:{todo_is_runtime_work_item:!0,projection_is_writable:!1,introduces_task_runtime:!1,write_api:!1},source_summary:{registered_agent_count:4,projected_agent_count:4,todo_source:`live_loopx_status_public_slice`,public_safe_export:!0},agents:[{agent_id:`codex-main-control`,agent_model:`peer_v1`,profile_role:`release-validation`,state:`blocked`,next_action:`Continue projected todo todo_2bf560b48a0c.`,last_activity_at:`2026-06-29T00:49:36+08:00`,evidence_refs:[`todo:todo_e72afc24f04a:evidence`],goal_ids:[`loopx-meta`],stale_claim_hint:{state:`activity_missing`,claimed_by:`codex-main-control`,reason:`claimed open todo has no projected activity timestamp`,recommended_operator_action:`inspect evidence before considering reassignment`},current_todo:{schema_version:`todo_row_v0`,todo_id:`todo_2bf560b48a0c`,goal_id:`loopx-meta`,role:`agent`,status:`open`,priority:`P0`,title:`Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harn…`,task_class:`blocker`,action_kind:`legacy_open_pr_rename_blocker`,claimed_by:`codex-main-control`}},{agent_id:`codex-product-capability`,agent_model:`peer_v1`,profile_role:`product-validation`,state:`monitoring`,next_action:`Continue projected todo todo_ded745761822.`,last_activity_at:`2026-07-06T06:29:53Z`,evidence_refs:[`todo:todo_ded745761822:evidence`],goal_ids:[`loopx-meta`],current_todo:{schema_version:`todo_row_v0`,todo_id:`todo_ded745761822`,goal_id:`loopx-meta`,role:`agent`,status:`open`,priority:`P0-LOCAL`,title:`Public-safe redacted live LoopX text; inspect local status for the full row.`,task_class:`continuous_monitor`,action_kind:`Public-safe redacted live LoopX text; inspect local status for the full row.`,claimed_by:`codex-product-capability`,updated_at:`2026-07-04T20:22:45+08:00`}},{agent_id:`codex-side-bypass`,agent_model:`peer_v1`,profile_role:`implementation-validation`,state:`waiting`,next_action:`Inspect status projection before taking work.`,last_activity_at:`2026-07-06T06:32:16Z`,evidence_refs:[`rollout_event:todo_complete:todo_22c946938115`],goal_ids:[`loopx-meta`]},{agent_id:`codex-value-explorer`,agent_model:`peer_v1`,profile_role:`value-exploration`,state:`monitoring`,next_action:`Continue projected todo todo_584f55f8f3b4.`,last_activity_at:`2026-07-06T09:39:59+08:00`,evidence_refs:[`rollout_event:todo_update:todo_584f55f8f3b4`],goal_ids:[`loopx-meta`],current_todo:{schema_version:`todo_row_v0`,todo_id:`todo_584f55f8f3b4`,goal_id:`loopx-meta`,role:`agent`,status:`open`,title:`todo add recorded for todo_584f55f8f3b4`}}]},contract:{ok:!0,summary:{errors:0,warnings:1,checks:6},errors:[],warnings:["loopx-meta: duplicate index rows raw=8444 unique=8440 unexpected=3 artifact_identity_collisions=2 artifact_collision_rows=3 reward_overlays=1; inspect with `loopx history --goal-id loopx-meta inspect-index-duplicates`; artifact identity collisions need review…"],checks:[`registry goals checked: 12`,`registry boundary: shared_local_registry push_allowed=False tracked=False ignored=False`,`user-gate scopes checked: 6 open multi-agent gates`,`runtime root resolved: $HOME/.codex/loopx`,`run-history goals=28 runs=10210`,`public boundary scan clean: 1218 files`]},global_registry:{available:!0,ok:!0,registry:`$HOME/.codex/loopx/registry.global.json`,current_registry:`$HOME/.codex/loopx/registry.global.json`,current_registry_is_global:!0,global_goal_count:12,current_goal_count:12,source_registry_count:7,summary:{high:0,action:8,info:0,checks:2,findings:8},findings:[{kind:`source_registry_missing`,severity:`action`,message:"`cc-test` source registry is missing",recommended_action:"reconnect `cc-test` from its project or archive it if the project is obsolete",goal_id:`cc-test`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`state_file_missing`,severity:`action`,message:"`cc-test` active state file is missing",recommended_action:"repair `cc-test` state_file or reconnect the project",goal_id:`cc-test`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`source_registry_missing`,severity:`action`,message:"`cc-tmp` source registry is missing",recommended_action:"reconnect `cc-tmp` from its project or archive it if the project is obsolete",goal_id:`cc-tmp`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`state_file_missing`,severity:`action`,message:"`cc-tmp` active state file is missing",recommended_action:"repair `cc-tmp` state_file or reconnect the project",goal_id:`cc-tmp`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`source_registry_missing`,severity:`action`,message:"`cc-tmp-xdrchpuaul` source registry is missing",recommended_action:"reconnect `cc-tmp-xdrchpuaul` from its project or archive it if the project is obsolete",goal_id:`cc-tmp-xdrchpuaul`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`state_file_missing`,severity:`action`,message:"`cc-tmp-xdrchpuaul` active state file is missing",recommended_action:"repair `cc-tmp-xdrchpuaul` state_file or reconnect the project",goal_id:`cc-tmp-xdrchpuaul`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`source_registry_missing`,severity:`action`,message:"`loopx-auto-research-e2e-probe-20260628-2225-goal` source registry is missing",recommended_action:"reconnect `loopx-auto-research-e2e-probe-20260628-2225-goal` from its project or archive it if the project is obsolete",goal_id:`loopx-auto-research-e2e-probe-20260628-2225-goal`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`state_file_missing`,severity:`action`,message:"`loopx-auto-research-e2e-probe-20260628-2225-goal` active state file is missing",recommended_action:"repair `loopx-auto-research-e2e-probe-20260628-2225-goal` state_file or reconnect the project",goal_id:`loopx-auto-research-e2e-probe-20260628-2225-goal`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`}],checks:[`global registry goals checked: 12`,`global source registries checked: 7`]},attention_queue:JSON.parse(`{"available":true,"item_count":1,"needs_user_or_controller":0,"needs_controller":0,"needs_codex":1,"watching_external_evidence":0,"items":[{"goal_id":"loopx-meta","status":"skillsbench_codex_cli_goal_tail4_keepalive_relaunched","lifecycle_phase":"adapter_inspected","lifecycle_flags":["adapter_inspected"],"waiting_on":"codex","severity":"action","recommended_action":"Monitor run_group skillsbench-codex-cli-goal-xhigh-tail4-keepalive-20260706T143132CST using public compact/public artifacts only; once benchmark_run.compact.json lands for each case, classify launcher/case/solver/verifi…","source":"latest_run","quota":{"compute":1.0,"window_hours":24,"slot_minutes":1,"allowed_slots":1440,"spent_slots":97,"state":"eligible","reason":"1 compute quota; eligible for the next automatic agent turn"},"agent_todos":{"source_section":"Agent Todo","total_count":12,"open_count":12,"done_count":0,"items":[{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo update recorded for todo_1596c3a678bb","schema_version":"todo_index_item_v0","todo_id":"todo_1596c3a678bb","role":"agent","status":"open","title":"todo update recorded for todo_1596c3a678bb","source":"rollout_event_log","agent_id":"codex-main-control","latest_event_kind":"todo_update","latest_event_at":"2026-07-06T06:33:32Z","latest_event_status":"open","event_count":7,"event_kinds":["todo_update"]},{"goal_id":"loopx-meta","index":24,"done":false,"text":"Monitor ArcticDB #3179 LoopX comment https://github.com/man-group/ArcticDB/issues/3179#issuecomment-4797835630 for metadata-only maintainer reply signal; do not read private material or reply again without owner approva…","schema_version":"todo_index_item_v0","todo_id":"todo_15bc0926a494","role":"agent","status":"open","priority":"P0-REVENUE MONITOR","title":"Monitor ArcticDB #3179 LoopX comment https://github.com/man-group/ArcticDB/issues/3179#issuecomment-4797835630 for metadata-only maintainer reply signal; do not read private material or reply again without owner approva…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","action_kind":"github_public_reply_metadata_monitor","claimed_by":"codex-value-explorer","evidence":"autonomous replan: bounded current value-explorer monitor lane with explicit expires_at.","note":"Set bounded watch expiry for metadata-only public reply monitor; no catch-up after expiry.","updated_at":"2026-07-05T06:27:15+08:00"},{"goal_id":"loopx-meta","index":17,"done":false,"text":"Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harness paths/imports and goal-harness CLI strings to loopx, rerun launch-artifact-handle smoke, and verify it does not reintrod…","schema_version":"todo_index_item_v0","todo_id":"todo_2bf560b48a0c","role":"agent","status":"open","priority":"P0","title":"Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harness paths/imports and goal-harness CLI strings to loopx, rerun launch-artifact-handle smoke, and verify it does not reintrod…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"blocker","action_kind":"legacy_open_pr_rename_blocker","claimed_by":"codex-main-control"},{"goal_id":"loopx-meta","index":23,"done":false,"text":"Fix or bypass local SkillsBench Docker verifier reward collection before using local fallback for canonical base/test comparison; organize-messy-files base on merged #668 reached final verifier but produced empty verifi…","schema_version":"todo_index_item_v0","todo_id":"todo_3ed1c4a69164","role":"agent","status":"open","priority":"P0","title":"Fix or bypass local SkillsBench Docker verifier reward collection before using local fallback for canonical base/test comparison; organize-messy-files base on merged #668 reached final verifier but produced empty verifi…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"blocker","action_kind":"skillsbench_local_verifier_reward_collection","claimed_by":"codex-main-control","required_capabilities":["benchmark_runner"]},{"goal_id":"loopx-meta","index":32,"done":false,"text":"Rerun SkillsBench raw vs loopx-goal-start-product-mode on citation-check and powerlifting with PR #779 merged; inspect compact public counters for soft_verify_exception_continued, probe_operation_count, task-facing solv…","schema_version":"todo_index_item_v0","todo_id":"todo_44907a5f355d","role":"agent","status":"blocked","priority":"P0","title":"Rerun SkillsBench raw vs loopx-goal-start-product-mode on citation-check and powerlifting with PR #779 merged; inspect compact public counters for soft_verify_exception_continued, probe_operation_count, task-facing solv…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"skillsbench_goal_start_raw_new_rerun","claimed_by":"codex-main-control","evidence":"Public-safe redacted live LoopX text; inspect local status for the full row.","note":"Do not spend a full citation-check loopx rerun yet: #865 fixed scored output paths and #874 added bootstrap preflight attribution, but citation-check itself still preflights as apt+verifier bootstrap risk on ECS.","updated_at":"2026-06-29T00:49:36+08:00"},{"goal_id":"loopx-meta","index":39,"done":false,"text":"Run the next SkillsBench loopx-goal-start-product-mode reverse-channel case on latest main (no local Docker), prioritizing a currently bad or uncertain case, then update the public case ledger and true LoopX issue analy…","schema_version":"todo_index_item_v0","todo_id":"todo_4762c790e583","role":"agent","status":"blocked","priority":"P0","title":"Run the next SkillsBench loopx-goal-start-product-mode reverse-channel case on latest main (no local Docker), prioritizing a currently bad or uncertain case, then update the public case ledger and true LoopX issue analy…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"skillsbench_goal_start_remote_rerun","claimed_by":"codex-main-control","evidence":"A prior benchmark adapter change was validated before the legacy surface was archived. Current research uses the RFC-linked benchmark workspace and toolkit boundary smokes.","note":"2026-06-29: fixed host-local ACP idle/no-output root cause in PR #894. ACP protocol tool_call_count=0 is now distinguished from reverse-channel task-facing bridge activity; repeated codex_exec_bridge_idle_timeout withou…","updated_at":"2026-06-29T19:40:32+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_584f55f8f3b4","schema_version":"todo_index_item_v0","todo_id":"todo_584f55f8f3b4","role":"agent","status":"open","title":"todo add recorded for todo_584f55f8f3b4","source":"rollout_event_log","agent_id":"codex-value-explorer","latest_event_kind":"todo_update","latest_event_at":"2026-07-06T06:48:49Z","latest_event_status":"open","event_count":3,"event_kinds":["todo_add","todo_update"]},{"goal_id":"loopx-meta","index":40,"done":false,"text":"Monitor r10 SkillsBench 30-case codex-app-server-goal-baseline batch, summarize completed compact results into the common case ledger, and stop/repair if setup/bootstrap creates new non-solver blockers.","schema_version":"todo_index_item_v0","todo_id":"todo_62debf065fec","role":"agent","status":"blocked","priority":"P0 MONITOR","title":"Monitor r10 SkillsBench 30-case codex-app-server-goal-baseline batch, summarize completed compact results into the common case ledger, and stop/repair if setup/bootstrap creates new non-solver blockers.","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","action_kind":"monitor_skillsbench_batch","claimed_by":"codex-main-control","evidence":"Observed 2026-06-30T02:52+08: active-state target_key=skillsbench-goal-baseline-30case-20260629T1826Z-r10; local ps/tmux/recent artifact search found no r10 batch process or compact artifact; no raw task/log/trajectory …","updated_at":"2026-06-30T02:54:54+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_93bc6439c521","schema_version":"todo_index_item_v0","todo_id":"todo_93bc6439c521","role":"agent","status":"open","title":"todo add recorded for todo_93bc6439c521","source":"rollout_event_log","agent_id":"codex-main-control","latest_event_kind":"todo_claim","latest_event_at":"2026-07-06T06:32:52Z","latest_event_status":"open","event_count":2,"event_kinds":["todo_add","todo_claim"]},{"goal_id":"loopx-meta","index":27,"done":false,"text":"Run the SkillsBench two-arm comparison after the goal-start route is countable: raw Codex vs new loopx-goal-start-product-mode, reporting task_score/control_score/time and compact public-safe LoopX todo rollout evidence.","schema_version":"todo_index_item_v0","todo_id":"todo_aad7e9716927","role":"agent","status":"blocked","priority":"P0","title":"Run the SkillsBench two-arm comparison after the goal-start route is countable: raw Codex vs new loopx-goal-start-product-mode, reporting task_score/control_score/time and compact public-safe LoopX todo rollout evidence.","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"run_goal_start_product_mode_matrix","claimed_by":"codex-main-control","evidence":"driver.status shows DONE raw then RUN loopx-goal-start with no running driver; raw benchmark_run.compact first_blocker=skillsbench_codex_acp_provider_zero_activity; source guard requires --host-local-acp-launch for Loop…","note":"Remote run group skillsbench-raw-new-goal-start-20260627T0420Z produced a material closeout for citation-check raw only; raw compact attribution is skillsbench_codex_acp_provider_zero_activity with official score missin…","updated_at":"2026-06-27T13:05:47+08:00"},{"goal_id":"loopx-meta","index":21,"done":false,"text":"Observe remote official SkillsBench powerlifting-coef-calc base/test runtime-layer mountfix pair skillsbench-powerlifting-coef-calc-remote-canonical-runtime-mountfix-pair-20260623T022028Z: use compact/public artifacts o…","schema_version":"todo_index_item_v0","todo_id":"todo_aec1873c7f28","role":"agent","status":"open","priority":"P0 MONITOR","title":"Observe remote official SkillsBench powerlifting-coef-calc base/test runtime-layer mountfix pair skillsbench-powerlifting-coef-calc-remote-canonical-runtime-mountfix-pair-20260623T022028Z: use compact/public artifacts o…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","claimed_by":"codex-main-control","note":"2026-06-23 projection fix: this is monitor context for the powerlifting run, not an advancement next action; current executable path is SkillsBench build cache/prewarm repair.","updated_at":"2026-06-23T10:37:43+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_c02cb7d19607","schema_version":"todo_index_item_v0","todo_id":"todo_c02cb7d19607","role":"agent","status":"open","title":"todo add recorded for todo_c02cb7d19607","source":"rollout_event_log","agent_id":"codex-value-explorer","latest_event_kind":"todo_add","latest_event_at":"2026-07-06T03:47:54Z","latest_event_status":"open","event_count":1,"event_kinds":["todo_add"]}]}}]}`),run_history:{available:!0,goal_count:1,run_count:5,goals:[{id:`loopx-meta`,domain:`loopx-platform`,status:`active-read-only`,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`],registry_member:!0,legacy_runtime_goal:!1,adapter_kind:`harness_self_improvement`,adapter_status:`connected-read-only`,index_exists:!0,raw_index_records:8444,unique_runs:8440,quota:{compute:1,window_hours:24,slot_minutes:1,allowed_slots:1440,spent_slots:97,state:`waiting`,reason:`no active Codex-ready work is currently selected`},latest_runs:[{generated_at:`2026-07-06T14:37:32+08:00`,goal_id:`loopx-meta`,classification:`quota_slot_spent`,agent_id:`codex-value-explorer`,recommended_action:`审阅 PR #1524 的 Agent Management 面板视觉方向:workspace hint 与 stale claim hint 是否符合预期;确认后允许 codex-value-explorer 自合并。`,health_check:`quota safe-bypass operator gate; quota slot spend event public-safe`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]},{generated_at:`2026-07-06T14:33:55+08:00`,goal_id:`loopx-meta`,classification:`quota_slot_spent`,agent_id:`codex-main-control`,recommended_action:`[P1] Repair SkillsBench post-run debug gate consistency for countable codex-cli-goal official-zero runs: when attempt_accounting is countable and case_closeout_complete=true, do not project first_blocker=loopx_closeout_…`,health_check:`quota should-run eligible; quota slot spend event public-safe`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]},{generated_at:`2026-07-06T14:33:54+08:00`,goal_id:`loopx-meta`,classification:`skillsbench_codex_cli_goal_tail4_keepalive_relaunched`,agent_id:`codex-main-control`,progress_scope:`goal`,delivery_batch_scale:`single_surface`,delivery_outcome:`outcome_progress`,recommended_action:`Monitor run_group skillsbench-codex-cli-goal-xhigh-tail4-keepalive-20260706T143132CST using public compact/public artifacts only; once benchmark_run.compact.json lands for each case, classify launcher/case/solver/verifi…`,health_check:`state_file 1/1; registry_goal 1/1; authority_sources 10`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]},{generated_at:`2026-07-06T14:33:34+08:00`,goal_id:`loopx-meta`,classification:`quota_slot_spent`,agent_id:`codex-side-bypass`,recommended_action:`[P0] Rerun real KNN visible auto-research after the successor-link fix and verify evaluator completion projects a second-round hypothesis/frontier or explicit completion gate without manual intervention; keep evidence p…`,health_check:`quota should-run eligible; quota slot spend event public-safe`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]},{generated_at:`2026-07-06T14:32:57+08:00`,goal_id:`loopx-meta`,classification:`auto_research_successor_link_fix_merged`,agent_id:`codex-side-bypass`,progress_scope:`agent_lane`,delivery_batch_scale:`implementation`,delivery_outcome:`outcome_progress`,recommended_action:`[P0] Rerun real KNN visible auto-research after the successor-link fix and verify evaluator completion projects a second-round hypothesis/frontier or explicit completion gate without manual intervention; keep evidence p…`,health_check:`state_file 1/1; registry_goal 1/1; authority_sources 0`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]}]}]}},Qd=W().nullable(),$d=J({schema_version:X(`goal_acceptance_observation_projection_v0`),goal_id:W(),read_only:X(!0),acceptance_assessed:X(!1),coverage:Y([`partial`,`unavailable`]),missing_sources:q(W()),truncated:K(),historical_progress:q(J({kind:W(),observed_at:Qd,source:W(),evidence_refs:q(W())})),acceptance_gaps:q(J({kind:W(),owner:Qd,reason:Qd,evidence_required:Qd,observed_at:Qd,source:W(),reason_code:W().optional(),resolution_hint:W().optional(),component_checks:J({checkpoint_satisfied:K(),checkpoint_fresh:K(),path_outcome_valid:K(),evidence_refs_present:K(),final_outcome_claim_present:K(),no_reported_outcome_gap:K()}).optional()})),guards:q(J({kind:W(),todo_id:Qd,blocks_agent:Qd,owner:Qd,reason:Qd,evidence_required:Qd,decision_scope:Qd})),next_action:Qd,next_action_source:Qd}),ef=dd([W(),G(),K(),rd()]),tf=yd(W(),ef),nf=J({todo_id:W().optional(),priority:W().optional(),status:W(),title:W(),claimed_by:W().optional(),task_class:W().optional(),action_kind:W().optional()}),rf=J({gate_id:W(),kind:W(),status:W(),blocks:q(W()).optional()}),af=J({todo_id:W().optional(),owner_agent:W().optional(),status:W().optional(),lease_until:W().optional(),write_scope:q(W()).optional()}),of=J({generated_at:W().optional(),classification:W().optional(),summary:W().optional()}),sf=J({kind:W().optional().default(`warning`),message:dd([W(),q(W())]).optional().default(`compact source warning`)}).passthrough(),cf=J({schema_version:X(`goal_channel_projection_v0`),mode:X(`read_only`),goal_id:W(),display_name:W(),generated_at:W().optional().nullable(),latest_status:W(),waiting_on:W(),next_action:W(),source_refs:yd(W(),ef),decision_frame:J({user_action_required:K(),agent_action_required:K(),quiet_noop_allowed:K()}),quota:tf,user_todos:q(nf).default([]),agent_todos:q(nf).default([]),open_gates:q(rf).default([]),active_leases:q(af).default([]),artifacts:q(tf).default([]),recent_events:q(of).default([]),source_warnings:q(sf).default([]),truth_contract:J({event_ledger_is_source_of_truth:K(),projection_is_writable:K(),recompute_rule:W(),write_authority:W()})}),lf=J({compute:G().optional().default(1),window_hours:G().optional().default(24),slot_minutes:G().optional().default(1),allowed_slots:G().optional().nullable(),spent_slots:G().optional().default(0),state:W().optional().nullable(),next_eligible_at:W().optional().nullable(),reason:W().optional().nullable(),blocked_action_scope:W().optional().nullable(),focus_wait:K().optional().nullable(),handoff_outcome_floor_block:K().optional().nullable(),safe_bypass_allowed:K().optional().default(!1),safe_bypass_kind:W().optional().nullable(),safe_bypass_policy:W().optional().nullable(),post_handoff_outcome_gap_streak:G().optional().nullable(),outcome_gap_threshold:G().optional().nullable(),must_advance:q(W()).optional().default([]),avoid:q(W()).optional().default([])}).transform(e=>{let t=Math.max(1,e.slot_minutes),n=Math.round(e.window_hours*60*e.compute/t);return{...e,slot_minutes:t,allowed_slots:e.allowed_slots??n}}),uf=J({self_repair:J({enabled:K().optional().default(!1),allow_health_blocker_repair:K().optional().default(!1),allow_waiting_projection_repair:K().optional().default(!1)}).optional().nullable()}).passthrough(),df=J({model_config:J({model:W(),reasoning_effort:W().optional()}).optional(),mode:W().optional().default(`default`),orchestration_mode:W().optional().nullable(),spawn_allowed:K().optional().default(!1),allowed:K().optional().nullable(),max_children:G().optional().default(0),allowed_domains:q(W()).optional().default([])}).passthrough(),ff=J({label:W().optional().nullable(),path:W(),anchor:W().optional().nullable(),exists:K().optional().default(!1),resolved_path:W().optional().nullable()}),pf=J({index:G(),done:K(),text:W(),schema_version:W().optional().nullable(),todo_id:W().optional().nullable(),role:W().optional().nullable(),status:W().optional().nullable(),resume_when:W().optional().nullable(),resume_ready:K().optional().nullable(),resume_condition:yd(W(),ad()).optional().nullable(),priority:W().optional().nullable(),title:W().optional().nullable(),archive_state:W().optional().nullable(),source_section:W().optional().nullable(),task_class:W().optional().nullable(),task_domain:W().optional().nullable(),action_kind:W().optional().nullable(),claimed_by:W().optional().nullable(),required_capabilities:q(W()).optional(),note:W().optional().nullable(),evidence:W().optional().nullable(),updated_at:W().optional().nullable(),review_materials:q(ff).optional().default([])}).passthrough(),mf=J({source_section:W().optional().nullable(),total_count:G().optional().default(0),open_count:G().optional().default(0),done_count:G().optional().default(0),advancement_done_count:G().optional(),items:q(pf).optional().default([]),deferred_items:q(pf).optional()}),hf=pf.extend({goal_id:W(),source:W().optional().nullable(),event_count:G().optional().default(0),event_kinds:q(W()).optional().default([]),latest_event_kind:W().optional().nullable(),latest_event_at:W().optional().nullable(),latest_event_status:W().optional().nullable(),agent_id:W().optional().nullable()}).passthrough(),gf=J({schema_version:W().optional().nullable(),source:W().optional().nullable(),total_count:G().optional().default(0),current_projected_count:G().optional().default(0),rollout_event_count:G().optional().default(0),item_limit:G().optional().nullable(),items:q(hf).optional().default([])}),_f=J({kind:W().optional().nullable(),label:W().optional().nullable(),path_safe:K().optional().default(!1),branch:W().optional().nullable(),write_scope:q(W()).optional().default([])}).passthrough(),vf=J({state:W().optional().nullable(),claimed_by:W().optional().nullable(),last_activity_at:W().optional().nullable(),threshold_hours:G().optional().nullable(),reason:W().optional().nullable(),recommended_operator_action:W().optional().nullable()}).passthrough(),yf=J({schema_version:W().optional().nullable(),todo_id:W().optional().nullable(),goal_id:W().optional().nullable(),role:W().optional().nullable(),status:W().optional().nullable(),priority:W().optional().nullable(),title:W().optional().nullable(),task_class:W().optional().nullable(),action_kind:W().optional().nullable(),claimed_by:W().optional().nullable(),required_write_scopes:q(W()).optional().default([]),workspace_ref:_f.optional().nullable()}).passthrough(),bf=J({schema_version:W().optional().nullable(),from_agent:W().optional().nullable(),to_agent:W().optional().nullable(),intent:W().optional().nullable(),summary:W().optional().nullable(),blocker:W().optional().nullable(),suggested_next_action:W().optional().nullable(),evidence_refs:q(W()).optional().default([]),updated_at:W().optional().nullable()}).passthrough(),xf=J({agent_id:W(),role:W().optional().nullable(),state:W().optional().nullable(),current_todo:yf.optional().nullable(),next_action:W().optional().nullable(),last_activity_at:W().optional().nullable(),evidence_refs:q(W()).optional().default([]),handoff_refs:q(W()).optional().default([]),handoff_note:bf.optional().nullable(),workspace_ref:_f.optional().nullable(),stale_claim_hint:vf.optional().nullable(),blocked_on:yf.optional().nullable(),goal_ids:q(W()).optional().default([])}).passthrough(),Sf=J({schema_version:W().optional().nullable(),mode:W().optional().nullable(),goal_id:W().optional().nullable(),generated_at:W().optional().nullable(),style_hint:J({preferred:W().optional().nullable(),license_boundary:W().optional().nullable()}).optional().nullable(),truth_contract:J({todo_is_runtime_work_item:K().optional().default(!0),projection_is_writable:K().optional().default(!1),introduces_task_runtime:K().optional().default(!1),write_api:K().optional().default(!1)}).optional().nullable(),source_summary:J({registered_agent_count:G().optional().default(0),projected_agent_count:G().optional().default(0),todo_source:W().optional().nullable()}).optional().nullable(),agents:q(xf).optional().default([])}).passthrough(),Cf=J({goal_id:W(),configured:K().optional().default(!1),enabled:K().optional().default(!1),human_gate_auto_notify_enabled:K().optional().default(!1),target_ref:W().optional().nullable(),receipt_count:G().optional().default(0),last_notified_at:W().optional().nullable()}).passthrough(),wf=J({schema_version:W().optional().nullable(),generated_at:W().optional().nullable(),goals:q(Cf).optional().default([])}).passthrough(),Tf=J({source_section:W().optional().nullable(),open:G().optional().default(0),done:G().optional().default(0),total:G().optional().default(0),advancement_done_count:G().optional(),next:W().optional().nullable(),next_index:G().optional().nullable(),items:q(pf).optional().default([]),recent_completed_advancement_items:q(pf).optional().default([])}),Ef=J({goal_id:W(),status:W().optional().nullable(),waiting_on:W().optional().nullable(),severity:W().optional().nullable(),index:G().optional().nullable(),text:W(),source:W().optional().nullable()}),Df=J({source:W().optional().nullable(),open_count:G().optional().default(0),items:q(Ef).optional().default([])}),Of=J({goal_id:W(),status:W().optional().nullable(),waiting_on:W().optional().nullable(),quota_state:W().optional().nullable(),priority:W().optional().nullable(),todo_index:G().optional().nullable(),text:W(),source:W().optional().nullable()}),kf=J({source:W().optional().nullable(),open_count:G().optional().default(0),items:q(Of).optional().default([])}),Af=J({generated_at:W().optional().nullable(),classification:W().optional().nullable(),summary:W().optional().nullable()}),jf=J({kind:W().optional().nullable(),source:W().optional().nullable(),severity:W().optional().nullable(),requires_refresh_state:K().optional().default(!1),reason:W().optional().nullable(),active_state_updated_at:W().optional().nullable(),latest_run_generated_at:W().optional().nullable(),latest_run_state_updated_at:W().optional().nullable(),latest_run_classification:W().optional().nullable(),recommended_action:W().optional().nullable()}),Mf=J({generated_at:W().optional().nullable(),classification:W().optional().nullable(),delivery_batch_scale:W().optional().nullable(),delivery_outcome:W().optional().nullable(),health_check:W().optional().nullable(),json_exists:K().optional().nullable(),markdown_exists:K().optional().nullable()}),Nf=J({project_asset_backed:K().optional(),same_source_should_run:K().optional(),codex_ready:K().optional(),handoff_has_next_action:K().optional(),handoff_has_stop_condition:K().optional(),handoff_sanitized_surface:K().optional()}).catchall(K()),Pf=J({ready:K().optional().default(!1),codex_ready:K().optional().default(!1),source:W().optional().nullable(),quota_state:W().optional().nullable(),checks:Nf.optional().default({}),handoff_status:W().optional().nullable(),handoff_ready_at:W().optional().nullable(),handoff_ready_classification:W().optional().nullable(),post_handoff_run_seen:K().optional().default(!1),post_handoff_latest_run:Mf.optional().nullable(),post_handoff_recent_runs:q(Mf).optional().default([]),post_handoff_small_scale_streak:G().int().nonnegative().optional().default(0),post_handoff_outcome_gap_streak:G().int().nonnegative().optional().default(0),next_probe:W().optional().nullable()}),Ff=J({schema_version:W().optional().nullable(),kind:W().optional().nullable(),missing_roles:q(W()).optional().default([]),source:W().optional().nullable(),recommended_action:W().optional().nullable()}),If=J({owner:W(),gate:W(),next_action:W(),stop_condition:W(),user_todos:Tf.optional().nullable(),agent_todos:Tf.optional().nullable(),quota:lf.optional().nullable(),control_plane:uf.optional().nullable(),orchestration:df.optional().nullable(),latest_validation:Af.optional().nullable(),stale_latest_run_warning:jf.optional().nullable(),todo_projection_gap:Ff.optional().nullable()}),Lf=J({goal_id:W(),activation_state:Y([`active`,`stopped`]).optional().default(`active`),status:W(),waiting_on:W(),severity:W(),recommended_action:W(),project_asset:If.optional().nullable(),handoff_readiness:Pf.optional().nullable(),source:W().optional(),operator_question:W().optional().nullable(),agent_command:W().optional().nullable(),lifecycle_phase:W().optional().nullable(),lifecycle_flags:q(W()).optional().default([]),controller_stage:W().optional().nullable(),missing_gates:q(W()).optional().default([]),next_handoff_condition:W().optional().nullable(),quota:lf.optional().nullable(),control_plane:uf.optional().nullable(),user_todos:mf.optional().nullable(),agent_todos:mf.optional().nullable(),stale_latest_run_warning:jf.optional().nullable(),dependency_blockers:Df.optional().nullable(),todo_state_file:W().optional().nullable(),goal_channel_projection:cf.optional().nullable()}),Rf=J({recorded_at:W().optional().nullable(),decision:W().optional().nullable(),reward:W().optional().nullable(),reason_summary:W().optional().nullable(),follow_up:W().optional().nullable()}),zf=J({recorded_at:W().optional().nullable(),gate:W().optional().nullable(),decision:W().optional().nullable(),operator_question:W().optional().nullable(),reason_summary:W().optional().nullable(),follow_up:W().optional().nullable(),agent_command:W().optional().nullable()}),Bf=J({version:W().optional().nullable(),goal_id:W().optional().nullable(),run_id:W().optional().nullable(),gate_id:W().optional().nullable(),created_state_ref:W().optional().nullable(),created_policy_version:W().optional().nullable(),interrupt_payload:J({question:W().optional().nullable(),choices:q(W()).optional().default([])}).optional().nullable(),allowed_decisions:q(W()).optional().default([]),operator_decision:W().optional().nullable(),latest_state_ref:W().optional().nullable(),freshness_check:W().optional().nullable(),precondition_check:W().optional().nullable(),migration_or_rebase_result:W().optional().nullable(),resulting_action:W().optional().nullable(),validation_after_resume:W().optional().nullable()}),Vf=J({id:W().optional().nullable(),ok:K().optional().nullable(),review:W().optional().nullable()}),Hf=J({classification:W().optional().nullable(),read_only_observer_ready:K().optional().nullable(),decision_advisor_ready:K().optional().nullable(),write_controller_ready:K().optional().nullable(),missing_gates:q(W()).optional().default([]),review_judgment:W().optional().nullable(),next_handoff_condition:W().optional().nullable(),gates:q(Vf).optional().default([])}),Uf=J({declared:K().optional().default(!1),required:K().optional().default(!1),path:W().optional().nullable(),path_exists:K().optional().nullable(),read_status:W().optional().nullable(),default_entry_count:G().optional().default(0),default_entries_checked:G().optional().default(0),default_entries_present:G().optional().default(0),topic_authority_count:G().optional().default(0),project_material_count:G().optional().default(0),project_material_repository_count:G().optional().default(0),project_material_owner_review_required_count:G().optional().default(0),project_material_stale_count:G().optional().default(0),project_material_current_authority_count:G().optional().default(0),deprecated_source_count:G().optional().default(0),conflict_risk:W().optional().nullable()}),Wf=J({adapter_kind:W().optional().nullable(),adapter_status:W().optional().nullable(),authority_source_count:G().optional().nullable(),authority_registry_declared:K().optional().nullable(),authority_registry_path_exists:K().optional().nullable(),authority_registry_default_entry_count:G().optional().nullable(),authority_registry_default_entries_present:G().optional().nullable(),topic_authority_count:G().optional().nullable(),project_material_count:G().optional().nullable(),project_material_repository_count:G().optional().nullable(),project_material_owner_review_required_count:G().optional().nullable(),project_material_stale_count:G().optional().nullable(),project_material_current_authority_count:G().optional().nullable(),authority_registry_conflict_risk:W().optional().nullable(),guard_count:G().optional().nullable(),sections_found:G().optional().nullable(),sections_checked:G().optional().nullable(),files_present:G().optional().nullable(),files_checked:G().optional().nullable()}),Gf=J({generated_at:W(),goal_id:W(),classification:W().optional().nullable(),lifecycle_phase:W().optional().nullable(),lifecycle_flags:q(W()).optional().default([]),recommended_action:W().optional().nullable(),health_check:W().optional().nullable(),active_task_count:G().optional().nullable(),active_priorities:yd(W(),ad()).optional().nullable(),cache_check:W().optional().nullable(),json_exists:K().optional().default(!1),markdown_exists:K().optional().default(!1),human_reward:Rf.optional().nullable(),operator_gate:zf.optional().nullable(),operator_gate_resume_contract:Bf.optional().nullable(),controller_readiness:Hf.optional().nullable(),project_map:Wf.optional().nullable()}),Kf=J({acceptance_observation:$d.optional().nullable().catch(null),id:W(),activation_state:Y([`active`,`stopped`]).optional().default(`active`),display_name:W().optional().nullable(),domain:W().optional().nullable(),status:W().optional().nullable(),lifecycle_phase:W().optional().nullable(),lifecycle_flags:q(W()).optional().default([]),registry_member:K().optional().default(!1),legacy_runtime_goal:K().optional().default(!1),adapter_kind:W().optional().nullable(),adapter_status:W().optional().nullable(),authority_registry:Uf.optional().nullable(),quota:lf.optional().nullable(),control_plane:uf.optional().nullable(),spawn_policy:df.optional().nullable(),orchestration:df.optional().nullable(),coordination:J({agent_model:W().optional().nullable(),registered_agents:q(W()).optional().default([])}).optional().nullable(),index_exists:K().optional().default(!1),raw_index_records:G().optional().default(0),unique_runs:G().optional().default(0),latest_runs:q(Gf).optional().default([])}),qf=J({available:K(),goal_count:G().optional().default(0),run_count:G().optional().default(0),goals:q(Kf).optional().default([]),recent_runs:q(Gf).optional().default([])}),Jf=J({kind:W(),severity:W(),message:W(),recommended_action:W(),goal_id:W().optional().nullable(),path:W().optional().nullable(),goal_ids:q(W()).optional().default([])}),Yf=J({available:K(),ok:K(),registry:W(),current_registry:W().optional().nullable(),current_registry_is_global:K().optional().default(!1),global_goal_count:G().optional().default(0),current_goal_count:G().optional().default(0),source_registry_count:G().optional().default(0),summary:J({high:G().optional().default(0),action:G().optional().default(0),info:G().optional().default(0),checks:G().optional().default(0),findings:G().optional().default(0)}),findings:q(Jf).optional().default([]),checks:q(W()).optional().default([])}),Xf=J({runs_24h:G().optional().default(0),runs_7d:G().optional().default(0),quota_spend_slots_24h:G().optional().default(0),quota_spend_slots_7d:G().optional().default(0),automation_run_count_24h:G().optional().default(0),automation_run_count_7d:G().optional().default(0),progress_signal_run_count_24h:G().optional().default(0),progress_signal_run_count_7d:G().optional().default(0),input_tokens_24h:G().optional(),input_tokens_7d:G().optional(),output_tokens_24h:G().optional(),output_tokens_7d:G().optional(),cache_tokens_24h:G().optional(),cache_tokens_7d:G().optional(),cost_usd_24h:G().optional(),cost_usd_7d:G().optional(),duration_ms_24h:G().optional(),duration_ms_7d:G().optional()}),Zf=Xf.extend({goal_id:W(),project_share_24h:G().optional().default(0)}),Qf=J({available:K().optional().default(!0),source:W().optional().default(`run_history`),generated_at:W().optional().nullable(),sample_run_count:G().optional().default(0),proxy_note:W().optional().nullable(),totals:Xf.optional().default({runs_24h:0,runs_7d:0,quota_spend_slots_24h:0,quota_spend_slots_7d:0,automation_run_count_24h:0,automation_run_count_7d:0,progress_signal_run_count_24h:0,progress_signal_run_count_7d:0}),goals:q(Zf).optional().default([])}).optional().nullable(),$f=J({accounting:G().optional().default(0),decision:G().optional().default(0),evidence:G().optional().default(0),state:G().optional().default(0),work:G().optional().default(0)}),ep={accounting:0,decision:0,evidence:0,state:0,work:0},tp=J({events_24h:G().optional().default(0),events_7d:G().optional().default(0),by_class_24h:$f.optional().default(ep),by_class_7d:$f.optional().default(ep)}),np=tp.extend({goal_id:W(),latest_event_class:W().optional().nullable(),latest_event_at:W().optional().nullable()}),rp={events_24h:0,events_7d:0,by_class_24h:ep,by_class_7d:ep},ip=J({available:K().optional().default(!0),source:W().optional().default(`run_history`),generated_at:W().optional().nullable(),sample_run_count:G().optional().default(0),proxy_note:W().optional().nullable(),event_classes:q(W()).optional().default([`accounting`,`decision`,`evidence`,`state`,`work`]),totals:tp.optional().default(rp),goals:q(np).optional().default([])}).optional().nullable(),ap=J({available:K().optional().default(!1),source:W().optional().default(`run_history`),goal_id:W().optional().nullable(),generated_at:W().optional().nullable(),classification:W().optional().nullable(),delivery_batch_scale:W().optional().nullable(),delivery_outcome:W().optional().nullable(),recommended_action:W().optional().nullable(),json_exists:K().optional().default(!1),markdown_exists:K().optional().default(!1),freshness_window_hours:G().optional().default(24),freshness_status:W().optional().nullable(),is_fresh:K().optional().default(!1),requires_readiness_run:K().optional().default(!0),age_seconds:G().optional().nullable(),age_hours:G().optional().nullable(),freshness_reference_time:W().optional().nullable(),sample_run_count:G().optional().default(0),proxy_note:W().optional().nullable(),reason:W().optional().nullable()}).optional().nullable(),op=J({ok:K().optional().default(!0),registry:W().optional().nullable(),runtime_root:W().optional().nullable(),gate:W().optional().default(`promotion_readiness`),gate_state:W().optional().default(`warning`),can_promote:K().optional().default(!1),should_warn:K().optional().default(!0),non_blocking:K().optional().default(!0),recommended_action:W().optional().nullable(),warning_message:W().optional().nullable(),readiness:ap.default(null)}).optional().nullable(),sp=J({decision_count:G().optional().default(0),stale_count:G().optional().default(0),rebase_required_count:G().optional().default(0),fresh_count:G().optional().default(0)}),cp=J({goal_id:W(),decision_kind:W().optional().nullable(),decision_at:W().optional().nullable(),classification:W().optional().nullable(),age_days:G().optional().nullable(),stale_by_age:K().optional().default(!1),newer_event_count_7d:G().optional().default(0),newer_event_classes_7d:$f.optional().default(ep),freshness_state:W().optional().nullable(),requires_decision_point_rebase:K().optional().default(!1),reason:W().optional().nullable()}),lp=J({available:K().optional().default(!0),source:W().optional().default(`run_history`),generated_at:W().optional().nullable(),sample_run_count:G().optional().default(0),window_days:G().optional().default(7),proxy_note:W().optional().nullable(),summary:sp.optional().default({decision_count:0,stale_count:0,rebase_required_count:0,fresh_count:0}),items:q(cp).optional().default([])}).optional().nullable(),up=J({schema_version:G().optional().default(0),minimum_dashboard_schema_version:G().optional().default(2),producer:W().optional().nullable(),reload_hint:W().optional().nullable()}).optional().default({schema_version:0,minimum_dashboard_schema_version:2,producer:null,reload_hint:`scripts/macos-dashboard-launchagent.sh restart`}),dp=J({schema_version:X(`loopx_goal_projection_scope_v0`),scope:Y([`all`,`active`,`stopped`]),complete:K(),projected_goal_count:G().int().nonnegative(),registry_goal_count:G().int().nonnegative(),registry_revision:W().optional().nullable()}),fp=J({source:W().optional().default(`serve-status`),status_url:W().optional().nullable(),health_url:W().optional().nullable(),review_material_url:W().optional().nullable(),presentation_surfaces_url:W().optional().nullable(),presentation_detail_url:W().optional().nullable(),periodic_report_index_url:W().optional().nullable(),periodic_report_detail_url:W().optional().nullable(),ssh_hosts_url:W().optional().nullable(),reward_dry_run_url:W().optional().nullable(),reward_append_url:W().optional().nullable(),reward_write_enabled:K().optional().default(!1),configure_goal_dry_run_url:W().optional().nullable(),configure_goal_apply_url:W().optional().nullable(),control_plane_write_enabled:K().optional().default(!1)}).optional().nullable(),pp=J({extension_id:W().min(1),surface_id:W().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/),extension_revision:W().min(1),payload_sha256:W().regex(/^[0-9a-f]{64}$/)}).strict(),mp=J({extension_id:W().min(1),extension_revision:W().min(1),surface_id:W().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/),surface_kind:W().regex(/^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/),title:W().min(1),view_schema:W().regex(/^[a-z][a-z0-9_]*_v\d+$/),visibility:Y([`public-safe`,`owner-only`]),goal_id:W().min(1).nullable(),generated_at:W().min(1).nullable(),review_due_at:W().min(1).nullable(),diagnostic:W().min(1).nullable(),empty_state_title:W().min(1),empty_state_detail:W().min(1)}),hp=dd([mp.extend({state:Y([`ready`,`review_due`]),goal_id:W().min(1),generated_at:W().min(1),detail_ref:pp}).strict(),mp.extend({state:X(`empty`),detail_ref:sd().optional()}).strict(),mp.extend({state:X(`invalid`),diagnostic:W().min(1),detail_ref:sd().optional()}).strict()]),gp=J({schema_version:X(`extension_presentation_surfaces_v0`),count:G().int().nonnegative(),ready_count:G().int().nonnegative(),review_due_count:G().int().nonnegative(),empty_count:G().int().nonnegative(),invalid_count:G().int().nonnegative(),items:q(hp)}).strict(),_p={schema_version:`extension_presentation_surfaces_v0`,count:0,ready_count:0,review_due_count:0,empty_count:0,invalid_count:0,items:[]};J({ok:X(!0),presentation_surfaces:gp}).strict();var vp=J({goal_id:W().min(1),agent_id:W().min(1),generation_id:W().min(1),content_sha256:W().regex(/^sha256:[0-9a-f]{64}$/)}).strict(),yp=J({goal_id:W().min(1),agent_id:W().min(1),generation_id:W().min(1),publication_id:W().min(1),delivered_at:W().min(1),predecessor_publication_id:W().min(1).nullable().optional(),detail_ref:vp}).strict(),bp=J({schema_version:X(`periodic_report_workspace_index_v0`),count:G().int().nonnegative(),items:q(yp)}),xp=bp.extend({returned_count:G().int().nonnegative(),total_count:G().int().nonnegative(),limit:G().int().nonnegative(),offset:G().int().nonnegative(),truncated:K()}).strict(),Sp=bp.strict().transform(e=>({...e,returned_count:e.count,total_count:e.count,limit:e.count,offset:0,truncated:!1})),Cp=J({ok:X(!0),periodic_reports:dd([xp,Sp])}).strict(),wp=J({schema_version:X(`periodic_report_workspace_projection_v0`),goal_id:W().min(1),agent_id:W().min(1),generation_id:W().min(1),generated_at:W().min(1),title:W().min(1),summary:W().min(1),content_sha256:W().regex(/^sha256:[0-9a-f]{64}$/),period_window:J({start_at:W().min(1),end_at:W().min(1)}).strict(),interaction:J({attention_kind:X(`progress`),interaction:X(`inform`),delivery:X(`surface`),form:X(`milestone_report`),writable:X(!1)}).strict(),delta:J({added_count:G().int().nonnegative(),changed_count:G().int().nonnegative(),item_count:G().int().positive(),items:q(J({fact_id:W().min(1),source_ref:W().min(1),title:W().min(1),summary:W().min(1),status:W().min(1),content_kind:W().min(1),change_kind:Y([`added`,`changed`]),previous_status:W().min(1).optional()}).strict())}).strict(),publication:J({publication_id:W().min(1),delivered_at:W().min(1),predecessor_publication_id:W().min(1).nullable().optional(),cursor_id:W().min(1)}).strict(),truth_contract:J({published_cursor_is_source_of_truth:X(!0),generation_receipt_is_delivery_receipt:X(!1),projection_is_writable:X(!1),browser_write_api:X(!1)}).strict()}).strict(),Tp=J({ok:X(!0),projection:wp}).strict(),Ep=J({ok:K(),registry:W(),runtime_root:W(),goal_count:G(),run_count:G(),status_contract:up,goal_projection:dp.optional().nullable().default(null),local_dashboard_api:fp,contract:J({ok:K(),summary:J({errors:G(),warnings:G(),checks:G()}),errors:q(W()),warnings:q(W()),checks:q(W()).optional().default([])}),global_registry:Yf.optional().default({available:!1,ok:!0,registry:``,current_registry:null,current_registry_is_global:!1,global_goal_count:0,current_goal_count:0,source_registry_count:0,summary:{high:0,action:0,info:0,checks:0,findings:0},findings:[],checks:[]}),attention_queue:J({available:K(),item_count:G(),needs_user_or_controller:G(),needs_controller:G().optional().default(0),needs_codex:G(),watching_external_evidence:G(),autonomous_backlog_candidates:kf.optional().nullable(),items:q(Lf)}),run_history:qf.optional().default({available:!1,goal_count:0,run_count:0,goals:[],recent_runs:[]}),event_ledger_summary:ip.default(null),promotion_readiness_summary:ap.default(null),promotion_gate:op.default(null),decision_freshness_summary:lp.default(null),usage_summary:Qf.default(null),todo_index:gf.optional().nullable().default(null),agent_management_projection:Sf.optional().nullable().default(null),goal_channel_notification_projection:wf.optional().nullable().default(null),presentation_surfaces:gp.optional().default(_p)});J({ok:K(),dry_run:K().optional().default(!0),appended:K().optional().default(!1),goal_id:W().optional().nullable(),raw_index_records_before:G().optional().nullable(),preview_id:W().optional().nullable(),selected_run:J({generated_at:W().optional().nullable(),classification:W().optional().nullable(),recommended_action:W().optional().nullable(),json_exists:K().optional().nullable(),markdown_exists:K().optional().nullable()}).optional().nullable(),human_reward:Rf.optional().nullable(),active_state_summary:W().optional().nullable(),project_agent_visibility:J({source_of_truth:W().optional().nullable(),history_command:W().optional().nullable(),active_state_role:W().optional().nullable(),review_packet_role:W().optional().nullable()}).optional().nullable(),error:W().optional().nullable()});function Dp(e,t,n){let r=e.run_history.goals.map(e=>e.id===t&&e.activation_state!==n?{...e,activation_state:n}:e),i=e.attention_queue.items.map(e=>e.goal_id===t&&e.activation_state!==n?{...e,activation_state:n}:e),a=r.some((t,n)=>t!==e.run_history.goals[n]),o=i.some((t,n)=>t!==e.attention_queue.items[n]);return!a&&!o?e:{...e,attention_queue:o?{...e.attention_queue,items:i}:e.attention_queue,run_history:a?{...e.run_history,goals:r}:e.run_history}}function Op(e,t){let n=e.run_history.goals.filter(e=>e.id!==t),r=e.attention_queue.items.filter(e=>e.goal_id!==t);return n.length===e.run_history.goals.length&&r.length===e.attention_queue.items.length?e:{...e,attention_queue:{...e.attention_queue,items:r},run_history:{...e.run_history,goals:n}}}function kp(e){return Ep.parse(e)}function Ap(e){return e instanceof pu?e.issues.map(e=>`${e.path.join(`.`)||`root`}: ${e.message}`).join(`; `):e instanceof Error?e.message:String(e)}var jp=kp(Zd),Mp=J({ok:X(!0),schema_version:X(`loopx_workspace_directory_v1`),registry_revision:W(),goals:q(J({id:W(),display_name:W(),activation_state:Y([`active`,`stopped`]),registry_member:X(!0)}))});function Np(e,t,n={}){if(!e)return{};let r=new Set(n.invalidateGoalIds??[]),i=new Map(e.directory.goals.map(e=>[e.id,e]));return Object.fromEntries(t.goals.flatMap(t=>{let n=i.get(t.id),a=e.snapshots[t.id];return!n||!a||r.has(t.id)||n.display_name!==t.display_name||n.activation_state!==t.activation_state?[]:[[t.id,a]]}))}function Pp(e,t,n){let r=new URL(e,n);r.searchParams.delete(`goal_activation`),r.searchParams.delete(`goal_id`),r.searchParams.delete(`view`);for(let[e,n]of Object.entries(t))r.searchParams.set(e,n);return r.toString()}async function Fp(e,t){let n=await fetch(Pp(e,{view:`workspace-directory`},t),{cache:`no-store`,signal:AbortSignal.timeout(5e3)});if(!n.ok)return null;let r=Mp.safeParse(await n.json());return r.success?r.data:null}function Ip(e){return kp({ok:!0,registry:``,runtime_root:``,goal_count:e.goals.length,run_count:0,local_dashboard_api:{},contract:{ok:!0,summary:{errors:0,warnings:0,checks:0},errors:[],warnings:[]},attention_queue:{available:!1,item_count:0,needs_user_or_controller:0,needs_codex:0,watching_external_evidence:0,items:[]},run_history:{available:!1,goal_count:e.goals.length,run_count:0,goals:e.goals,recent_runs:[]}})}async function Lp(e,t){if(!e.body)return`service`;let n=e.body.getReader(),r=()=>{n.cancel().catch(()=>{})};t.addEventListener(`abort`,r,{once:!0});let i=new Uint8Array(16384),a=0;try{for(t.throwIfAborted();;){let{done:e,value:r}=await n.read();if(t.throwIfAborted(),e)break;if(a+r.byteLength>i.byteLength)return`service`;i.set(r,a),a+=r.byteLength}let e=JSON.parse(new TextDecoder().decode(i.subarray(0,a)));return typeof e==`object`&&e&&!Array.isArray(e)&&`error_code`in e&&e.error_code===`workspace_status_access_denied`?`access`:`service`}catch{return t.throwIfAborted(),`service`}finally{t.removeEventListener(`abort`,r),r(),n.releaseLock()}}async function Rp(e,t,n,r,i,a,o){let s=[...n.goals],c=new Map;async function l(){for(;s.length&&i()&&!o?.aborted;){let l=s.findIndex(e=>e.id===a()),u=l>=0?l:s.findIndex(e=>e.activation_state===`active`);if(u<0)return;let d=s.splice(u,1)[0],f=(c.get(d.id)??0)+1;c.set(d.id,f);let p=new AbortController,m=!1,h=()=>p.abort();o?.addEventListener(`abort`,h,{once:!0});let g=setTimeout(()=>{m=!0,p.abort()},3e4),_=null;try{let a=await fetch(Pp(e,{goal_id:d.id},t),{cache:`no-store`,signal:p.signal});if(!a.ok)_=a.status===409?`revision`:a.status>=500?await Lp(a,p.signal):`scope`,p.signal.throwIfAborted();else{let e=await a.json();if(e.workspace_registry_revision!==n.registry_revision)_=`revision`;else{let t=kp(e);!t.run_history.goals.some(e=>e.id===d.id)||t.run_history.goals.some(e=>e.id!==d.id)?_=`scope`:i()&&!o?.aborted&&r(d.id,t,null)}}}catch(e){_=m?`timeout`:e instanceof TypeError?`network`:`invalid`}finally{clearTimeout(g),o?.removeEventListener(`abort`,h)}if(!i()||o?.aborted)return;_&&[`timeout`,`network`,`service`].includes(_)&&f<3?(await new Promise(e=>setTimeout(e,f*1e3)),s.push(d)):_&&r(d.id,null,_)}}await Promise.all([l(),l()])}var zp=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Bp=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Vp=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Hp=e=>{let t=Vp(e);return t.charAt(0).toUpperCase()+t.slice(1)},Up={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Wp=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Gp=(0,z.createContext)({}),Kp=()=>(0,z.useContext)(Gp),qp=(0,z.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Kp()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,z.createElement)(`svg`,{ref:c,...Up,width:t??l??Up.width,height:t??l??Up.height,stroke:e??f,strokeWidth:m,className:zp(`lucide`,p,i),...!a&&!Wp(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,z.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Z=(e,t)=>{let n=(0,z.forwardRef)(({className:n,...r},i)=>(0,z.createElement)(qp,{ref:i,iconNode:t,className:zp(`lucide-${Bp(Hp(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Hp(e),n},Jp=Z(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Yp=Z(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Xp=Z(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Zp=Z(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Qp=Z(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),$p=Z(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),em=Z(`badge-check`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),tm=Z(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),nm=Z(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),rm=Z(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),im=Z(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),am=Z(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),om=Z(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),sm=Z(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),cm=Z(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),lm=Z(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),um=Z(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),dm=Z(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),fm=Z(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),pm=Z(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),mm=Z(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),hm=Z(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),gm=Z(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),_m=Z(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),vm=Z(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ym=Z(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),bm=Z(`file-check-corner`,[[`path`,{d:`M10.5 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v6`,key:`g5mvt7`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14 20 2 2 4-4`,key:`15kota`}]]),xm=Z(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Sm=Z(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Cm=Z(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),wm=Z(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Tm=Z(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Em=Z(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Dm=Z(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Om=Z(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),km=Z(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Am=Z(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),jm=Z(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Mm=Z(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Nm=Z(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Pm=Z(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Fm=Z(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Im=Z(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Lm=Z(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Rm=Z(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),zm=Z(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Bm=Z(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Vm=Z(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),Hm=Z(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Um=Z(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Wm=Z(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Gm=Z(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Km=Z(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),qm=Z(`server-cog`,[[`path`,{d:`m10.852 14.772-.383.923`,key:`11vil6`}],[`path`,{d:`M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923`,key:`1v3clb`}],[`path`,{d:`m13.148 9.228.383-.923`,key:`t2zzyc`}],[`path`,{d:`m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544`,key:`1bxfiv`}],[`path`,{d:`m14.772 10.852.923-.383`,key:`k9m8cz`}],[`path`,{d:`m14.772 13.148.923.383`,key:`1xvhww`}],[`path`,{d:`M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5`,key:`tn8das`}],[`path`,{d:`M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5`,key:`1g2pve`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M6 6h.01`,key:`1utrut`}],[`path`,{d:`m9.228 10.852-.923-.383`,key:`1wtb30`}],[`path`,{d:`m9.228 13.148-.923.383`,key:`1a830x`}]]),Jm=Z(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Ym=Z(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Xm=Z(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Zm=Z(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Qm=Z(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),$m=Z(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),eh=Z(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),th=Z(`test-tube-diagonal`,[[`path`,{d:`M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3`,key:`1ub6xw`}],[`path`,{d:`m16 2 6 6`,key:`1gw87d`}],[`path`,{d:`M12 16H4`,key:`1cjfip`}]]),nh=Z(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),rh=Z(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ih=Z(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),ah=Z(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function oh(e){return/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e)||e.startsWith(`//`)}function sh(e){return[`localhost`,`127.0.0.1`,`::1`,`[::1]`].includes(e)}function ch(e,t,n){let r=e.trim();if(!r)return{error:`status URL is empty`};let i;try{i=new URL(r,t)}catch{return{error:`status URL is invalid`}}let a=!oh(r),o=sh(i.hostname);return!a&&!o?{error:`${n} must be relative or loopback`}:{source:{isLoopback:o,isRelative:a,url:r}}}function lh(e,t){return ch(e,t,`statusUrl`)}function uh(e,t){let n=ch(e,t,`Ops statusUrl`);return n.error?{error:`${n.error}; use showcase mode for public links.`}:n}function dh(e,t,n){let r=new URL(e,n);return r.searchParams.set(`goal_activation`,t),r.toString()}function fh(e,t){if(!t||!e.isLoopback)return null;try{let n=new URL(e.url,window.location.href),r=new URL(t,n.origin);return sh(r.hostname)?r.toString():null}catch{return null}}function ph(e,t){return{detailUrl:fh(t,e.local_dashboard_api?.periodic_report_detail_url),indexUrl:fh(t,e.local_dashboard_api?.periodic_report_index_url)}}async function mh(e,t){let n=new URL(e);n.searchParams.set(`goal_id`,t),n.searchParams.set(`limit`,`100`),n.searchParams.set(`offset`,`0`);let r=await fetch(n,{cache:`no-store`});if(!r.ok)throw Error(`HTTP ${r.status} while loading published reports`);return Cp.parse(await r.json()).periodic_reports}async function hh(e,t){let n=new URL(e);Object.entries(t).forEach(([e,t])=>n.searchParams.set(e,t));let r=await fetch(n,{cache:`no-store`});if(!r.ok)throw Error(`HTTP ${r.status} while loading published report detail`);return Tp.parse(await r.json()).projection}function gh(e,t,n){let r=e.find(e=>e.agentId===t&&e.available)??e.find(e=>e.agentId===n&&e.available)??e.find(e=>e.available);if(!r)throw Error(`Chat requires at least one available route`);return r}function _h(e){return e.kind===`todo`}var vh=[{id:`next`,label:`找下一步`,prompt:`结合当前 Goal,告诉我现在最值得推进的一个动作,并说明理由。`},{id:`gate`,label:`看阻塞`,prompt:`当前 Goal 有哪些 Gate 或阻塞?哪些需要我决定?`},{id:`evidence`,label:`查证据`,prompt:`检查当前 Goal 的 Evidence,告诉我哪些结论已经有依据,哪些还需要验证。`}];function yh(e){return!!(e&&typeof e==`object`&&e.session_invalidated===!0)}var bh=``.replace(/\/+$/,``);function xh(e){return!bh||/^https?:\/\//.test(e)?e:new URL(e,`${bh}/`).toString()}var Sh=J({todo_id:W().nullable(),role:W().nullable(),status:W(),priority:W().nullable(),text:W(),action_kind:W().nullable(),task_class:W().nullable(),claimed_by:W().nullable(),evidence:W().nullable()}),Ch=J({goal_id:W(),title:W(),objective:W(),status:W(),waiting_on:W().nullable(),severity:W().nullable(),gate:W(),next_action:W(),top_todo:Sh.nullable(),todos:q(Sh),evidence:q(W()),quota:J({state:W().nullable(),spent_slots:G().nullable(),allowed_slots:G().nullable(),reason:W().nullable()})});J({ok:K(),schema_version:X(`loopx_chat_status_v0`),selected_goal_id:W().nullable(),goal_count:G(),goals:q(Ch)});var wh=J({schema_version:W(),executor_endpoint:W(),executor_endpoint_source:W(),executor_endpoint_default_reason:W().optional(),executor_kind:W(),model:W(),model_source:W(),credential_env_var:W(),operator_credential_configured:K(),available:K().nullable(),unavailable_reason:W().nullable()}),Th=J({ok:X(!0),schema_version:Y([`loopx_chat_capabilities_v0`,`loopx_chat_capabilities_v1`]),agent_backend:W(),sandbox:W(),approval_policy:W(),todo_write:W(),goal_subagent_configuration:W().optional(),goal_id:W().nullable(),manager:J({scope:X(`owner_global`),model:W(),reasoning_effort:W(),channel_binding:wh.optional(),runtime:J({schema_version:X(`manager_runtime_effective_profile_v0`),runtime_profile:Y([`restricted`,`trusted_owner`]),source:W(),configuration_revision:W(),standing_grant:W(),sandbox:W(),approval_policy:W(),tool_classes:q(W()),status:W(),repair:W().optional()})}).optional(),streaming:K().optional(),resume:K().optional(),interrupt:K().optional(),typed_actions:K().optional(),action_kinds:q(W()).optional(),adapters:q(J({agent_id:W(),display_name:W(),adapter_kind:W(),available:K(),streaming:K(),resume:K(),interrupt:K(),location:W().optional(),source:W().optional(),tool_calls:K().optional(),trust_scope:W().optional()})).optional(),lark_cli:J({available:K(),source:W(),version:W().nullable(),error_code:W().nullable()}).optional()}),Eh=J({kind:X(`todo`),text:W(),priority:Y([`P0`,`P1`,`P2`]),rationale:W()}),Dh=pd(`kind`,[Eh,J({kind:X(`steward_team_plan_preview`),preview:yd(W(),ad())})]),Oh=J({operation:Y([`merge`,`release`,`deploy`,`delete`,`payment`]),target:W().min(1).max(160),summary:W().max(300)}),kh=J({schema_version:X(`loopx_chat_agent_response_v0`),message:W(),proposals:q(Dh),protected_action:Oh.nullable().optional().default(null),gate:J({kind:W(),summary:W(),next_action:W()}).nullable()}),Ah=J({closed:X(!0),ok:X(!0),session_id:W().min(1)});J({dry_run:X(!0),ok:X(!0),preview_id:W().min(1),todo:J({goal_id:W().min(1),text:W(),todo_id:W().optional()})});var jh=J({schema_version:X(`loopx_chat_todo_receipt_v0`),receipt_id:W().min(1),preview_id:W().min(1),goal_id:W().min(1),todo_id:W().min(1),status:X(`applied`),outcome:Y([`todo_added`,`todo_already_exists`]),already_exists:K(),preview_revision:W().nullable()});J({applied:X(!0),ok:X(!0),receipt:jh,todo:J({text:W(),todo_id:W()})});var Mh=J({model_config:J({model:W(),reasoning_effort:W().optional()}).optional(),mode:W(),spawn_allowed:K(),max_children:G().int().nonnegative(),allowed_domains:q(W()).optional().default([])}).passthrough(),Nh=J({ok:X(!0),dry_run:K(),execute:K(),written:K(),changed:K(),goal_id:W().min(1),changed_fields:q(W()),before:J({orchestration:Mh}).passthrough(),after:J({orchestration:Mh}).passthrough(),preview_id:W().min(1),feature_summary:J({multi_subagent:Y([`off`,`enabled`])}).passthrough(),global_sync:J({required:K(),executed:K(),readback:J({status:W(),verified:K()}).passthrough()}).passthrough()}),Ph=J({id:W().min(1),outcome:Y([`approved`,`rejected`,`cancelled`]),projectionVerified:K().nullable(),proposal:Eh,receipt:jh.nullable()}).superRefine((e,t)=>{e.outcome===`approved`&&!e.receipt&&t.addIssue({code:`custom`,message:`approved decision history requires a Todo receipt`,path:[`receipt`]}),e.outcome!==`approved`&&e.receipt&&t.addIssue({code:`custom`,message:`zero-write decision history must not include a Todo receipt`,path:[`receipt`]})});J({schema_version:X(`loopx_chat_decision_history_v0`),goal_id:W().min(1),decisions:q(Ph).max(24)});var Fh=class extends Error{payload;constructor(e,t){super(e),this.payload=t}},Ih=Y([`goal.create`,`goal.update`,`goal.lifecycle`,`todo.create`,`todo.update`,`agent.bind`,`heartbeat.bind`,`monitor.create`,`monitor.update`,`gate.resolve`,`run.correct`,`operation.execute`,`team.plan`]),Lh=J({schema_version:X(`loopx_operation_envelope_v0`),lifecycle_state:Y([`prepared`,`awaiting_confirmation`,`claimed`,`outcome_observed`]),operation_id:W().min(1),confirmation_digest:W().min(1),payload_digest:W().min(1),projection_digest:W().min(1),expires_at:W().min(1),delivery:yd(W(),ad()).nullable(),confirmation:yd(W(),ad()).nullable(),claim:yd(W(),ad()).nullable(),outcome:yd(W(),ad()).nullable(),result_delivery:yd(W(),ad()).nullable().optional()}).passthrough(),Rh=J({schema_version:X(`loopx_chat_action_proposal_v1`),proposal_id:W().min(1),action_kind:Ih,summary:W().min(1),normalized_parameters:yd(W(),ad()),context:yd(W(),ad()),expected_state_fingerprint:W().min(1),permission_classification:W().min(1),validation_evidence:q(W().refine(e=>e.trim().length>0,`Validation evidence must be non-blank text`)),available_transitions:q(Y([`apply`,`cancel`,`regenerate`,`reject`,`defer`])),status:Y([`preview_ready`,`applying`,`gated`,`failed`,`rejected`,`deferred`,`cancelled`,`stale`,`applied`]),receipt:yd(W(),ad()).nullable(),stale:yd(W(),ad()).nullable(),gate:yd(W(),ad()).nullable().optional(),error:yd(W(),ad()).nullable().optional(),checkpoint:yd(W(),ad()).nullable().optional(),regenerated_from:W().nullable().optional(),operation:Lh.nullable().optional(),created_at:W(),updated_at:W()}),zh=J({ok:X(!0),proposal:Rh});async function Bh(e){let t=await Kh(`/api/actions/preview`,{method:`POST`,body:JSON.stringify({action_kind:e.actionKind,context:e.context,idempotency_key:e.idempotencyKey,normalized_parameters:e.normalizedParameters,summary:e.summary})});return zh.parse(t).proposal}var Vh=J({ok:X(!0),schema_version:X(`loopx_chat_action_list_v1`),proposals:q(Rh)});async function Hh(e={}){let t=new URLSearchParams;e.contextKind&&t.set(`context_kind`,e.contextKind),e.goalId&&t.set(`goal_id`,e.goalId);let n=t.size>0?`?${t.toString()}`:``;return Vh.parse(await Kh(`/api/actions${n}`)).proposals}async function Uh(e){let t=await Kh(`/api/actions/${encodeURIComponent(e)}/apply`,{method:`POST`,body:`{}`});return J({ok:X(!0),proposal:Rh,turn:yd(W(),ad()).nullable().optional()}).parse(t)}async function Wh(e){return zh.parse(await Kh(`/api/actions/${encodeURIComponent(e)}/cancel`,{method:`POST`,body:`{}`})).proposal}async function Gh(e,t){return zh.parse(await Kh(`/api/actions/${encodeURIComponent(e)}/${t}`,{method:`POST`,body:`{}`})).proposal}async function Kh(e,t){let n;try{n=await fetch(xh(e),{cache:`no-store`,...t,headers:{"Content-Type":`application/json`,...t?.headers}})}catch{throw new Fh(`无法连接 LoopX Chat 服务。请确认 Dashboard 与 Chat 服务已启动且来自同一版本。`,{error_code:`chat_api_unavailable`})}let r=await n.text(),i=null;if(r.trim())try{i=JSON.parse(r)}catch{i=null}let a=i&&typeof i==`object`&&!Array.isArray(i)?i:{};if(!n.ok){let e=(a.proposal&&typeof a.proposal==`object`?a.proposal:null)?.status===`stale`?`来源状态已变化,请重新生成预览。`:null,t=n.status>=500?`LoopX Chat 服务暂时不可用(HTTP ${n.status})。请确认 Dashboard 与 Chat 服务已启动且来自同一版本。`:`LoopX Chat 请求失败(HTTP ${n.status})。`;throw new Fh(e??String(a.error||t),Object.keys(a).length?a:{error_code:`chat_api_unavailable`,http_status:n.status})}if(i===null)throw new Fh(`LoopX Chat 服务返回了无法识别的响应(HTTP ${n.status})。请确认 Dashboard 与 Chat 服务来自同一版本。`,{error_code:`invalid_chat_api_response`,http_status:n.status});return i}async function qh(){return Th.parse(await Kh(`/api/chat/capabilities`))}async function Jh(e){return Kh(`/api/chat/projection-messages`,{method:`POST`,body:JSON.stringify({answer:e.answer,context_kind:e.contextKind,goal_id:e.goalId,question:e.question})})}async function Yh(e,t,n=`resume_latest`,r=`goal`){return Kh(`/api/chat/sessions`,{method:`POST`,body:JSON.stringify({goal_id:e,agent_id:t,mode:n,context_kind:r})})}async function Xh(e){return Kh(`/api/chat/sessions/${e}`)}async function Zh(e){let t=new URLSearchParams;return e.agentId&&t.set(`agent_id`,e.agentId),e.channelId&&t.set(`channel_id`,e.channelId),e.goalId&&t.set(`goal_id`,e.goalId),Kh(`/api/chat/sessions?${t.toString()}`)}function Qh(e){let t=new Map;for(let n of e)for(let e of n.messages)t.set(e.message_id,e);return[...t.values()].sort((e,t)=>e.created_at.localeCompare(t.created_at)||e.message_id.localeCompare(t.message_id))}async function $h(e){let t=await Zh(e),n=await Promise.all(t.sessions.map(e=>Xh(e.session_id)));return{messages:Qh(n),sessions:t.sessions,snapshots:n}}async function eg(e,t,n,r=[]){return Kh(`/api/chat/sessions/${e}/turns`,{method:`POST`,body:JSON.stringify({message:t,client_turn_id:n,...r.length?{attachments:r.map(e=>({data_url:e.dataUrl,id:e.id,mime_type:e.mimeType,name:e.name,size:e.size}))}:{}})})}function tg(e){let t=e.split(` +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Al(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Nl(t,`input`,e.processors),output:Nl(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function jl(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return jl(r.element,n);if(r.type===`set`)return jl(r.valueType,n);if(r.type===`lazy`)return jl(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return jl(r.innerType,n);if(r.type===`intersection`)return jl(r.left,n)||jl(r.right,n);if(r.type===`record`||r.type===`map`)return jl(r.keyType,n)||jl(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:jl(r.in,n)||jl(r.out,n);if(r.type===`object`){for(let e in r.shape)if(jl(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(jl(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(jl(e,n))return!0;return!!(r.rest&&jl(r.rest,n))}return!1}var Ml=(e,t={})=>n=>{let r=Dl({...n,processors:t});return Ol(e,r),kl(r,e),Al(r,e)},Nl=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Dl({...i??{},target:a,io:t,processors:n});return Ol(e,o),kl(o,e),Al(o,e)},Pl={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Fl=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Pl[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Il=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ll=(e,t,n,r)=>{n.type=`boolean`},Rl=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},zl=(e,t,n,r)=>{n.not={}},Bl=(e,t,n,r)=>{let i=e._zod.def,a=ra(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Vl=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Hl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Ul=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Wl=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ol(a.element,t,{...r,path:[...r.path,`items`]})},Gl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Ol(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ol(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Kl=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ol(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ql=(e,t,n,r)=>{let i=e._zod.def,a=Ol(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ol(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Jl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Ol(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Ol(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Yl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ol(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Ol(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ol(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Xl=(e,t,n,r)=>{let i=e._zod.def,a=Ol(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Zl=(e,t,n,r)=>{let i=e._zod.def;Ol(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ql=(e,t,n,r)=>{let i=e._zod.def;Ol(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},$l=(e,t,n,r)=>{let i=e._zod.def;Ol(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},eu=(e,t,n,r)=>{let i=e._zod.def;Ol(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},tu=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Ol(o,t,r);let s=t.seen.get(e);s.ref=o},nu=(e,t,n,r)=>{let i=e._zod.def;Ol(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ru=(e,t,n,r)=>{let i=e._zod.def;Ol(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},iu=H(`ZodISODateTime`,(e,t)=>{gs.init(e,t),Mu.init(e,t)});function au(e){return qc(iu,e)}var ou=H(`ZodISODate`,(e,t)=>{_s.init(e,t),Mu.init(e,t)});function su(e){return Jc(ou,e)}var cu=H(`ZodISOTime`,(e,t)=>{vs.init(e,t),Mu.init(e,t)});function lu(e){return Yc(cu,e)}var uu=H(`ZodISODuration`,(e,t)=>{ys.init(e,t),Mu.init(e,t)});function du(e){return Xc(uu,e)}var fu=(e,t)=>{Ba.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ua(e,t)},flatten:{value:t=>Ha(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ia,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ia,2)}},isEmpty:{get(){return e.issues.length===0}}})},pu=H(`ZodError`,fu),mu=H(`ZodError`,fu,{Parent:Error}),hu=Wa(mu),gu=Ga(mu),_u=Ka(mu),vu=Ja(mu),yu=Xa(mu),bu=Za(mu),xu=Qa(mu),Su=$a(mu),Cu=eo(mu),wu=to(mu),Tu=no(mu),Eu=ro(mu),Du=new WeakMap;function Ou(e,t,n){let r=Object.getPrototypeOf(e),i=Du.get(r);if(i||(i=new Set,Du.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var ku=H(`ZodType`,(e,t)=>(ns.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Nl(e,`input`),output:Nl(e,`output`)}}),e.toJSONSchema=Ml(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>hu(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>_u(e,t,n),e.parseAsync=async(t,n)=>gu(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>vu(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>yu(e,t,n),e.decode=(t,n)=>bu(e,t,n),e.encodeAsync=async(t,n)=>xu(e,t,n),e.decodeAsync=async(t,n)=>Su(e,t,n),e.safeEncode=(t,n)=>Cu(e,t,n),e.safeDecode=(t,n)=>wu(e,t,n),e.safeEncodeAsync=async(t,n)=>Tu(e,t,n),e.safeDecodeAsync=async(t,n)=>Eu(e,t,n),Ou(e,`ZodType`,{check(...e){let t=this.def;return this.clone(fa(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Sa(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ud(e,t))},superRefine(e,t){return this.check(Wd(e,t))},overwrite(e){return this.check(_l(e))},optional(){return Td(this)},exactOptional(){return Dd(this)},nullable(){return kd(this)},nullish(){return Td(kd(this))},nonoptional(e){return Fd(this,e)},array(){return q(this)},or(e){return dd([this,e])},and(e){return hd(this,e)},transform(e){return zd(this,Cd(e))},default(e){return jd(this,e)},prefault(e){return Nd(this,e)},catch(e){return Ld(this,e)},pipe(e){return zd(this,e)},readonly(){return Vd(this)},describe(e){let t=this.clone();return Cc.add(t,{description:e}),t},meta(...e){if(e.length===0)return Cc.get(this);let t=this.clone();return Cc.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Cc.get(e)?.description},configurable:!0}),e)),Au=H(`_ZodString`,(e,t)=>{rs.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fl(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Ou(e,`_ZodString`,{regex(...e){return this.check(dl(...e))},includes(...e){return this.check(ml(...e))},startsWith(...e){return this.check(hl(...e))},endsWith(...e){return this.check(gl(...e))},min(...e){return this.check(ll(...e))},max(...e){return this.check(cl(...e))},length(...e){return this.check(ul(...e))},nonempty(...e){return this.check(ll(1,...e))},lowercase(e){return this.check(fl(e))},uppercase(e){return this.check(pl(e))},trim(){return this.check(yl())},normalize(...e){return this.check(vl(...e))},toLowerCase(){return this.check(bl())},toUpperCase(){return this.check(xl())},slugify(){return this.check(Sl())}})}),ju=H(`ZodString`,(e,t)=>{rs.init(e,t),Au.init(e,t),e.email=t=>e.check(Tc(Nu,t)),e.url=t=>e.check(jc(Iu,t)),e.jwt=t=>e.check(Kc(Zu,t)),e.emoji=t=>e.check(Mc(Lu,t)),e.guid=t=>e.check(Ec(Pu,t)),e.uuid=t=>e.check(Dc(Fu,t)),e.uuidv4=t=>e.check(Oc(Fu,t)),e.uuidv6=t=>e.check(kc(Fu,t)),e.uuidv7=t=>e.check(Ac(Fu,t)),e.nanoid=t=>e.check(Nc(Ru,t)),e.guid=t=>e.check(Ec(Pu,t)),e.cuid=t=>e.check(Pc(zu,t)),e.cuid2=t=>e.check(Fc(Bu,t)),e.ulid=t=>e.check(Ic(Vu,t)),e.base64=t=>e.check(Uc(Ju,t)),e.base64url=t=>e.check(Wc(Yu,t)),e.xid=t=>e.check(Lc(Hu,t)),e.ksuid=t=>e.check(Rc(Uu,t)),e.ipv4=t=>e.check(zc(Wu,t)),e.ipv6=t=>e.check(Bc(Gu,t)),e.cidrv4=t=>e.check(Vc(Ku,t)),e.cidrv6=t=>e.check(Hc(qu,t)),e.e164=t=>e.check(Gc(Xu,t)),e.datetime=t=>e.check(au(t)),e.date=t=>e.check(su(t)),e.time=t=>e.check(lu(t)),e.duration=t=>e.check(du(t))});function W(e){return wc(ju,e)}var Mu=H(`ZodStringFormat`,(e,t)=>{is.init(e,t),Au.init(e,t)}),Nu=H(`ZodEmail`,(e,t)=>{ss.init(e,t),Mu.init(e,t)}),Pu=H(`ZodGUID`,(e,t)=>{as.init(e,t),Mu.init(e,t)}),Fu=H(`ZodUUID`,(e,t)=>{os.init(e,t),Mu.init(e,t)}),Iu=H(`ZodURL`,(e,t)=>{cs.init(e,t),Mu.init(e,t)}),Lu=H(`ZodEmoji`,(e,t)=>{ls.init(e,t),Mu.init(e,t)}),Ru=H(`ZodNanoID`,(e,t)=>{us.init(e,t),Mu.init(e,t)}),zu=H(`ZodCUID`,(e,t)=>{ds.init(e,t),Mu.init(e,t)}),Bu=H(`ZodCUID2`,(e,t)=>{fs.init(e,t),Mu.init(e,t)}),Vu=H(`ZodULID`,(e,t)=>{ps.init(e,t),Mu.init(e,t)}),Hu=H(`ZodXID`,(e,t)=>{ms.init(e,t),Mu.init(e,t)}),Uu=H(`ZodKSUID`,(e,t)=>{hs.init(e,t),Mu.init(e,t)}),Wu=H(`ZodIPv4`,(e,t)=>{bs.init(e,t),Mu.init(e,t)}),Gu=H(`ZodIPv6`,(e,t)=>{xs.init(e,t),Mu.init(e,t)}),Ku=H(`ZodCIDRv4`,(e,t)=>{Ss.init(e,t),Mu.init(e,t)}),qu=H(`ZodCIDRv6`,(e,t)=>{Cs.init(e,t),Mu.init(e,t)}),Ju=H(`ZodBase64`,(e,t)=>{Ts.init(e,t),Mu.init(e,t)}),Yu=H(`ZodBase64URL`,(e,t)=>{Ds.init(e,t),Mu.init(e,t)}),Xu=H(`ZodE164`,(e,t)=>{Os.init(e,t),Mu.init(e,t)}),Zu=H(`ZodJWT`,(e,t)=>{As.init(e,t),Mu.init(e,t)}),Qu=H(`ZodNumber`,(e,t)=>{js.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Il(e,t,n,r),Ou(e,`ZodNumber`,{gt(e,t){return this.check(al(e,t))},gte(e,t){return this.check(ol(e,t))},min(e,t){return this.check(ol(e,t))},lt(e,t){return this.check(rl(e,t))},lte(e,t){return this.check(il(e,t))},max(e,t){return this.check(il(e,t))},int(e){return this.check(ed(e))},safe(e){return this.check(ed(e))},positive(e){return this.check(al(0,e))},nonnegative(e){return this.check(ol(0,e))},negative(e){return this.check(rl(0,e))},nonpositive(e){return this.check(il(0,e))},multipleOf(e,t){return this.check(sl(e,t))},step(e,t){return this.check(sl(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function G(e){return Zc(Qu,e)}var $u=H(`ZodNumberFormat`,(e,t)=>{Ms.init(e,t),Qu.init(e,t)});function ed(e){return Qc($u,e)}var td=H(`ZodBoolean`,(e,t)=>{Ns.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ll(e,t,n,r)});function K(e){return $c(td,e)}var nd=H(`ZodNull`,(e,t)=>{Ps.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rl(e,t,n,r)});function rd(e){return el(nd,e)}var id=H(`ZodUnknown`,(e,t)=>{Fs.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ad(){return tl(id)}var od=H(`ZodNever`,(e,t)=>{Is.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zl(e,t,n,r)});function sd(e){return nl(od,e)}var cd=H(`ZodArray`,(e,t)=>{Rs.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wl(e,t,n,r),e.element=t.element,Ou(e,`ZodArray`,{min(e,t){return this.check(ll(e,t))},nonempty(e){return this.check(ll(1,e))},max(e,t){return this.check(cl(e,t))},length(e,t){return this.check(ul(e,t))},unwrap(){return this.element}})});function q(e,t){return Cl(cd,e,t)}var ld=H(`ZodObject`,(e,t)=>{Us.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gl(e,t,n,r),ua(e,`shape`,()=>t.shape),Ou(e,`ZodObject`,{keyof(){return Y(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:ad()})},loose(){return this.clone({...this._zod.def,catchall:ad()})},strict(){return this.clone({...this._zod.def,catchall:sd()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Da(this,e)},safeExtend(e){return Oa(this,e)},merge(e){return ka(this,e)},pick(e){return Ta(this,e)},omit(e){return Ea(this,e)},partial(...e){return Aa(wd,this,e[0])},required(...e){return ja(Pd,this,e[0])}})});function J(e,t){return new ld({type:`object`,shape:e??{},...U(t)})}var ud=H(`ZodUnion`,(e,t)=>{Gs.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kl(e,t,n,r),e.options=t.options});function dd(e,t){return new ud({type:`union`,options:e,...U(t)})}var fd=H(`ZodDiscriminatedUnion`,(e,t)=>{ud.init(e,t),Ks.init(e,t)});function pd(e,t,n){return new fd({type:`union`,options:t,discriminator:e,...U(n)})}var md=H(`ZodIntersection`,(e,t)=>{qs.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ql(e,t,n,r)});function hd(e,t){return new md({type:`intersection`,left:e,right:t})}var gd=H(`ZodTuple`,(e,t)=>{Xs.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jl(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function _d(e,t,n){let r=t instanceof ns;return new gd({type:`tuple`,items:e,rest:r?t:null,...U(r?n:t)})}var vd=H(`ZodRecord`,(e,t)=>{ec.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yl(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function yd(e,t,n){return!t||!t._zod?new vd({type:`record`,keyType:W(),valueType:e,...U(t)}):new vd({type:`record`,keyType:e,valueType:t,...U(n)})}var bd=H(`ZodEnum`,(e,t)=>{tc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bl(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new bd({...t,checks:[],...U(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new bd({...t,checks:[],...U(r),entries:i})}});function Y(e,t){return new bd({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...U(t)})}var xd=H(`ZodLiteral`,(e,t)=>{nc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vl(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function X(e,t){return new xd({type:`literal`,values:Array.isArray(e)?e:[e],...U(t)})}var Sd=H(`ZodTransform`,(e,t)=>{rc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ul(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ea(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ra(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Ra(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Cd(e){return new Sd({type:`transform`,transform:e})}var wd=H(`ZodOptional`,(e,t)=>{ac.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ru(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Td(e){return new wd({type:`optional`,innerType:e})}var Ed=H(`ZodExactOptional`,(e,t)=>{oc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ru(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dd(e){return new Ed({type:`optional`,innerType:e})}var Od=H(`ZodNullable`,(e,t)=>{sc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kd(e){return new Od({type:`nullable`,innerType:e})}var Ad=H(`ZodDefault`,(e,t)=>{cc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ql(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function jd(e,t){return new Ad({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ya(t)}})}var Md=H(`ZodPrefault`,(e,t)=>{uc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$l(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nd(e,t){return new Md({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ya(t)}})}var Pd=H(`ZodNonOptional`,(e,t)=>{dc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fd(e,t){return new Pd({type:`nonoptional`,innerType:e,...U(t)})}var Id=H(`ZodCatch`,(e,t)=>{pc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ld(e,t){return new Id({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Rd=H(`ZodPipe`,(e,t)=>{mc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tu(e,t,n,r),e.in=t.in,e.out=t.out});function zd(e,t){return new Rd({type:`pipe`,in:e,out:t})}var Bd=H(`ZodReadonly`,(e,t)=>{gc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vd(e){return new Bd({type:`readonly`,innerType:e})}var Hd=H(`ZodCustom`,(e,t)=>{vc.init(e,t),ku.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hl(e,t,n,r)});function Ud(e,t={}){return wl(Hd,e,t)}function Wd(e,t){return Tl(e,t)}var Gd=e=>typeof e==`string`&&e.trim()?e.trim():null;function Kd(e){let t=e.decision_scope&&typeof e.decision_scope==`object`&&!Array.isArray(e.decision_scope)?e.decision_scope:{},n=Gd(t.kind),r=Gd(t.granularity),i=Gd(t.scope_key),a=Gd(e.superseded_by);return{interaction:e.task_class===`user_gate`?`decision`:`unknown`,lifecycle:a?`superseded`:e.status===`deferred`?`deferred`:e.done===!0||[`done`,`completed`,`closed`,`archived`].includes(String(e.status))?`closed`:e.status===`open`||e.status===`blocked`?`open`:`unknown`,reason:Gd(e.note),evidence:Gd(e.evidence),blocksAgent:Gd(e.blocks_agent),unblocksTodoId:Gd(e.unblocks_todo_id),decisionScope:n&&r&&i?{kind:n,granularity:r,scopeKey:i}:null,supersededBy:a}}function qd(e,t,n,r){return{...e,sourceId:t,goalTitle:r??e.goalTitle,details:n?e.details:{...e.details??Kd({}),lifecycle:`unavailable`}}}function Jd(e,t){return t.find(t=>t.sourceId===e.sourceId&&t.goalId===e.goalId&&t.todoId===e.todoId)||{...e,details:{...e.details??Kd({}),lifecycle:`unavailable`}}}function Yd(e,t){let n=e.details?.supersededBy;if(!(!n||n===e.todoId||e.details?.lifecycle===`unavailable`))return t.find(t=>t.sourceId===e.sourceId&&t.goalId===e.goalId&&t.todoId===n)}function Xd(e){return![`closed`,`deferred`,`superseded`,`unavailable`].includes(e.details?.lifecycle??`unknown`)}var Zd={ok:!0,registry:`$HOME/.codex/loopx/registry.global.json`,runtime_root:`$HOME/.codex/loopx`,goal_count:1,run_count:8440,status_contract:{schema_version:2,minimum_dashboard_schema_version:2,producer:`loopx status`,reload_hint:`scripts/macos-dashboard-launchagent.sh restart`},usage_summary:{available:!0,source:`run_history`,generated_at:`2026-07-06T06:49:06.471166+00:00`,sample_run_count:20,proxy_note:`run-history proxy; excludes token counts and raw thread logs`,totals:{runs_24h:20,runs_7d:20,quota_spend_slots_24h:11,quota_spend_slots_7d:11,automation_run_count_24h:11,automation_run_count_7d:11,progress_signal_run_count_24h:9,progress_signal_run_count_7d:9},goals:[{goal_id:`loopx-meta`,runs_24h:20,runs_7d:20,quota_spend_slots_24h:11,quota_spend_slots_7d:11,automation_run_count_24h:11,automation_run_count_7d:11,progress_signal_run_count_24h:9,progress_signal_run_count_7d:9,project_share_24h:1}]},event_ledger_summary:{available:!0,source:`run_history`,generated_at:`2026-07-06T06:49:06.360662+00:00`,sample_run_count:20,proxy_note:`append-only run-history projection; compact event-class counts only`,event_classes:[`accounting`,`decision`,`evidence`,`state`,`work`],totals:{events_24h:20,events_7d:20,by_class_24h:{accounting:11,decision:0,evidence:0,state:0,work:9},by_class_7d:{accounting:11,decision:0,evidence:0,state:0,work:9}},goals:[{goal_id:`loopx-meta`,events_24h:20,events_7d:20,by_class_24h:{accounting:11,decision:0,evidence:0,state:0,work:9},by_class_7d:{accounting:11,decision:0,evidence:0,state:0,work:9},latest_event_class:`accounting`,latest_event_at:`2026-07-06T14:37:32+08:00`}]},promotion_readiness_summary:{available:!0,source:`run_history_full_scan`,goal_id:`loopx-meta`,generated_at:`2026-07-05T20:02:02+08:00`,classification:`canary_promotion_readiness_smoke_group`,delivery_batch_scale:`multi_surface`,delivery_outcome:`primary_goal_outcome`,recommended_action:`Canary promotion-readiness smoke passed; promotion may proceed after doctor/status reports fresh evidence.`,json_exists:!0,markdown_exists:!0,freshness_window_hours:24,freshness_status:`fresh`,is_fresh:!0,requires_readiness_run:!1,age_seconds:67624,age_hours:18.78,freshness_reference_time:`2026-07-06T06:49:06.408527+00:00`,sample_run_count:0,proxy_note:`canary promotion-readiness projection from append-only run history; exact evidence stays in run artifacts`},promotion_gate:{ok:!0,registry:`$HOME/.codex/loopx/registry.global.json`,runtime_root:`$HOME/.codex/loopx`,gate:`promotion_readiness`,gate_state:`ready`,can_promote:!0,should_warn:!1,non_blocking:!0,recommended_action:`promotion readiness is fresh`,readiness:{available:!0,goal_id:`loopx-meta`,generated_at:`2026-07-05T20:02:02+08:00`,classification:`canary_promotion_readiness_smoke_group`,delivery_batch_scale:`multi_surface`,delivery_outcome:`primary_goal_outcome`,recommended_action:`Canary promotion-readiness smoke passed; promotion may proceed after doctor/status reports fresh evidence.`,json_exists:!0,markdown_exists:!0,runtime_root:`$HOME/.codex/loopx`,freshness_window_hours:24,freshness_status:`fresh`,is_fresh:!0,requires_readiness_run:!1,age_seconds:67624,age_hours:18.78,freshness_reference_time:`2026-07-06T06:49:06.471087+00:00`}},decision_freshness_summary:{available:!0,source:`run_history`,generated_at:`2026-07-06T06:49:06.471133+00:00`,sample_run_count:20,window_days:7,proxy_note:`checkpointed decision freshness projection; rebase old decisions at the decision point before reuse`,summary:{decision_count:0,stale_count:0,rebase_required_count:0,fresh_count:0},items:[]},todo_index:JSON.parse(`{"schema_version":"todo_index_v0","source":"live_loopx_status_public_slice","total_count":12,"current_projected_count":12,"rollout_event_count":94,"item_limit":12,"items":[{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo update recorded for todo_1596c3a678bb","schema_version":"todo_index_item_v0","todo_id":"todo_1596c3a678bb","role":"agent","status":"open","title":"todo update recorded for todo_1596c3a678bb","source":"rollout_event_log","agent_id":"codex-main-control","latest_event_kind":"todo_update","latest_event_at":"2026-07-06T06:33:32Z","latest_event_status":"open","event_count":7,"event_kinds":["todo_update"]},{"goal_id":"loopx-meta","index":24,"done":false,"text":"Monitor ArcticDB #3179 LoopX comment https://github.com/man-group/ArcticDB/issues/3179#issuecomment-4797835630 for metadata-only maintainer reply signal; do not read private material or reply again without owner approva…","schema_version":"todo_index_item_v0","todo_id":"todo_15bc0926a494","role":"agent","status":"open","priority":"P0-REVENUE MONITOR","title":"Monitor ArcticDB #3179 LoopX comment https://github.com/man-group/ArcticDB/issues/3179#issuecomment-4797835630 for metadata-only maintainer reply signal; do not read private material or reply again without owner approva…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","action_kind":"github_public_reply_metadata_monitor","claimed_by":"codex-value-explorer","evidence":"autonomous replan: bounded current value-explorer monitor lane with explicit expires_at.","note":"Set bounded watch expiry for metadata-only public reply monitor; no catch-up after expiry.","updated_at":"2026-07-05T06:27:15+08:00"},{"goal_id":"loopx-meta","index":17,"done":false,"text":"Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harness paths/imports and goal-harness CLI strings to loopx, rerun launch-artifact-handle smoke, and verify it does not reintrod…","schema_version":"todo_index_item_v0","todo_id":"todo_2bf560b48a0c","role":"agent","status":"open","priority":"P0","title":"Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harness paths/imports and goal-harness CLI strings to loopx, rerun launch-artifact-handle smoke, and verify it does not reintrod…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"blocker","action_kind":"legacy_open_pr_rename_blocker","claimed_by":"codex-main-control"},{"goal_id":"loopx-meta","index":23,"done":false,"text":"Fix or bypass local SkillsBench Docker verifier reward collection before using local fallback for canonical base/test comparison; organize-messy-files base on merged #668 reached final verifier but produced empty verifi…","schema_version":"todo_index_item_v0","todo_id":"todo_3ed1c4a69164","role":"agent","status":"open","priority":"P0","title":"Fix or bypass local SkillsBench Docker verifier reward collection before using local fallback for canonical base/test comparison; organize-messy-files base on merged #668 reached final verifier but produced empty verifi…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"blocker","action_kind":"skillsbench_local_verifier_reward_collection","claimed_by":"codex-main-control","required_capabilities":["benchmark_runner"]},{"goal_id":"loopx-meta","index":32,"done":false,"text":"Rerun SkillsBench raw vs loopx-goal-start-product-mode on citation-check and powerlifting with PR #779 merged; inspect compact public counters for soft_verify_exception_continued, probe_operation_count, task-facing solv…","schema_version":"todo_index_item_v0","todo_id":"todo_44907a5f355d","role":"agent","status":"blocked","priority":"P0","title":"Rerun SkillsBench raw vs loopx-goal-start-product-mode on citation-check and powerlifting with PR #779 merged; inspect compact public counters for soft_verify_exception_continued, probe_operation_count, task-facing solv…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"skillsbench_goal_start_raw_new_rerun","claimed_by":"codex-main-control","evidence":"Public-safe redacted live LoopX text; inspect local status for the full row.","note":"Do not spend a full citation-check loopx rerun yet: #865 fixed scored output paths and #874 added bootstrap preflight attribution, but citation-check itself still preflights as apt+verifier bootstrap risk on ECS.","updated_at":"2026-06-29T00:49:36+08:00"},{"goal_id":"loopx-meta","index":39,"done":false,"text":"Run the next SkillsBench loopx-goal-start-product-mode reverse-channel case on latest main (no local Docker), prioritizing a currently bad or uncertain case, then update the public case ledger and true LoopX issue analy…","schema_version":"todo_index_item_v0","todo_id":"todo_4762c790e583","role":"agent","status":"blocked","priority":"P0","title":"Run the next SkillsBench loopx-goal-start-product-mode reverse-channel case on latest main (no local Docker), prioritizing a currently bad or uncertain case, then update the public case ledger and true LoopX issue analy…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"skillsbench_goal_start_remote_rerun","claimed_by":"codex-main-control","evidence":"A prior benchmark adapter change was validated before the legacy surface was archived. Current research uses the RFC-linked benchmark workspace and toolkit boundary smokes.","note":"2026-06-29: fixed host-local ACP idle/no-output root cause in PR #894. ACP protocol tool_call_count=0 is now distinguished from reverse-channel task-facing bridge activity; repeated codex_exec_bridge_idle_timeout withou…","updated_at":"2026-06-29T19:40:32+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_584f55f8f3b4","schema_version":"todo_index_item_v0","todo_id":"todo_584f55f8f3b4","role":"agent","status":"open","title":"todo add recorded for todo_584f55f8f3b4","source":"rollout_event_log","agent_id":"codex-value-explorer","latest_event_kind":"todo_update","latest_event_at":"2026-07-06T06:48:49Z","latest_event_status":"open","event_count":3,"event_kinds":["todo_add","todo_update"]},{"goal_id":"loopx-meta","index":40,"done":false,"text":"Monitor r10 SkillsBench 30-case codex-app-server-goal-baseline batch, summarize completed compact results into the common case ledger, and stop/repair if setup/bootstrap creates new non-solver blockers.","schema_version":"todo_index_item_v0","todo_id":"todo_62debf065fec","role":"agent","status":"blocked","priority":"P0 MONITOR","title":"Monitor r10 SkillsBench 30-case codex-app-server-goal-baseline batch, summarize completed compact results into the common case ledger, and stop/repair if setup/bootstrap creates new non-solver blockers.","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","action_kind":"monitor_skillsbench_batch","claimed_by":"codex-main-control","evidence":"Observed 2026-06-30T02:52+08: active-state target_key=skillsbench-goal-baseline-30case-20260629T1826Z-r10; local ps/tmux/recent artifact search found no r10 batch process or compact artifact; no raw task/log/trajectory …","updated_at":"2026-06-30T02:54:54+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_93bc6439c521","schema_version":"todo_index_item_v0","todo_id":"todo_93bc6439c521","role":"agent","status":"open","title":"todo add recorded for todo_93bc6439c521","source":"rollout_event_log","agent_id":"codex-main-control","latest_event_kind":"todo_claim","latest_event_at":"2026-07-06T06:32:52Z","latest_event_status":"open","event_count":2,"event_kinds":["todo_add","todo_claim"]},{"goal_id":"loopx-meta","index":27,"done":false,"text":"Run the SkillsBench two-arm comparison after the goal-start route is countable: raw Codex vs new loopx-goal-start-product-mode, reporting task_score/control_score/time and compact public-safe LoopX todo rollout evidence.","schema_version":"todo_index_item_v0","todo_id":"todo_aad7e9716927","role":"agent","status":"blocked","priority":"P0","title":"Run the SkillsBench two-arm comparison after the goal-start route is countable: raw Codex vs new loopx-goal-start-product-mode, reporting task_score/control_score/time and compact public-safe LoopX todo rollout evidence.","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"run_goal_start_product_mode_matrix","claimed_by":"codex-main-control","evidence":"driver.status shows DONE raw then RUN loopx-goal-start with no running driver; raw benchmark_run.compact first_blocker=skillsbench_codex_acp_provider_zero_activity; source guard requires --host-local-acp-launch for Loop…","note":"Remote run group skillsbench-raw-new-goal-start-20260627T0420Z produced a material closeout for citation-check raw only; raw compact attribution is skillsbench_codex_acp_provider_zero_activity with official score missin…","updated_at":"2026-06-27T13:05:47+08:00"},{"goal_id":"loopx-meta","index":21,"done":false,"text":"Observe remote official SkillsBench powerlifting-coef-calc base/test runtime-layer mountfix pair skillsbench-powerlifting-coef-calc-remote-canonical-runtime-mountfix-pair-20260623T022028Z: use compact/public artifacts o…","schema_version":"todo_index_item_v0","todo_id":"todo_aec1873c7f28","role":"agent","status":"open","priority":"P0 MONITOR","title":"Observe remote official SkillsBench powerlifting-coef-calc base/test runtime-layer mountfix pair skillsbench-powerlifting-coef-calc-remote-canonical-runtime-mountfix-pair-20260623T022028Z: use compact/public artifacts o…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","claimed_by":"codex-main-control","note":"2026-06-23 projection fix: this is monitor context for the powerlifting run, not an advancement next action; current executable path is SkillsBench build cache/prewarm repair.","updated_at":"2026-06-23T10:37:43+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_c02cb7d19607","schema_version":"todo_index_item_v0","todo_id":"todo_c02cb7d19607","role":"agent","status":"open","title":"todo add recorded for todo_c02cb7d19607","source":"rollout_event_log","agent_id":"codex-value-explorer","latest_event_kind":"todo_add","latest_event_at":"2026-07-06T03:47:54Z","latest_event_status":"open","event_count":1,"event_kinds":["todo_add"]}]}`),agent_management_projection:{schema_version:`agent_management_projection_v0`,mode:`read_only`,goal_id:`loopx-meta`,generated_at:`2026-07-06T06:49:06Z`,style_hint:null,truth_contract:{todo_is_runtime_work_item:!0,projection_is_writable:!1,introduces_task_runtime:!1,write_api:!1},source_summary:{registered_agent_count:4,projected_agent_count:4,todo_source:`live_loopx_status_public_slice`,public_safe_export:!0},agents:[{agent_id:`codex-main-control`,agent_model:`peer_v1`,profile_role:`release-validation`,state:`blocked`,next_action:`Continue projected todo todo_2bf560b48a0c.`,last_activity_at:`2026-06-29T00:49:36+08:00`,evidence_refs:[`todo:todo_e72afc24f04a:evidence`],goal_ids:[`loopx-meta`],stale_claim_hint:{state:`activity_missing`,claimed_by:`codex-main-control`,reason:`claimed open todo has no projected activity timestamp`,recommended_operator_action:`inspect evidence before considering reassignment`},current_todo:{schema_version:`todo_row_v0`,todo_id:`todo_2bf560b48a0c`,goal_id:`loopx-meta`,role:`agent`,status:`open`,priority:`P0`,title:`Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harn…`,task_class:`blocker`,action_kind:`legacy_open_pr_rename_blocker`,claimed_by:`codex-main-control`}},{agent_id:`codex-product-capability`,agent_model:`peer_v1`,profile_role:`product-validation`,state:`monitoring`,next_action:`Continue projected todo todo_ded745761822.`,last_activity_at:`2026-07-06T06:29:53Z`,evidence_refs:[`todo:todo_ded745761822:evidence`],goal_ids:[`loopx-meta`],current_todo:{schema_version:`todo_row_v0`,todo_id:`todo_ded745761822`,goal_id:`loopx-meta`,role:`agent`,status:`open`,priority:`P0-LOCAL`,title:`Public-safe redacted live LoopX text; inspect local status for the full row.`,task_class:`continuous_monitor`,action_kind:`Public-safe redacted live LoopX text; inspect local status for the full row.`,claimed_by:`codex-product-capability`,updated_at:`2026-07-04T20:22:45+08:00`}},{agent_id:`codex-side-bypass`,agent_model:`peer_v1`,profile_role:`implementation-validation`,state:`waiting`,next_action:`Inspect status projection before taking work.`,last_activity_at:`2026-07-06T06:32:16Z`,evidence_refs:[`rollout_event:todo_complete:todo_22c946938115`],goal_ids:[`loopx-meta`]},{agent_id:`codex-value-explorer`,agent_model:`peer_v1`,profile_role:`value-exploration`,state:`monitoring`,next_action:`Continue projected todo todo_584f55f8f3b4.`,last_activity_at:`2026-07-06T09:39:59+08:00`,evidence_refs:[`rollout_event:todo_update:todo_584f55f8f3b4`],goal_ids:[`loopx-meta`],current_todo:{schema_version:`todo_row_v0`,todo_id:`todo_584f55f8f3b4`,goal_id:`loopx-meta`,role:`agent`,status:`open`,title:`todo add recorded for todo_584f55f8f3b4`}}]},contract:{ok:!0,summary:{errors:0,warnings:1,checks:6},errors:[],warnings:["loopx-meta: duplicate index rows raw=8444 unique=8440 unexpected=3 artifact_identity_collisions=2 artifact_collision_rows=3 reward_overlays=1; inspect with `loopx history --goal-id loopx-meta inspect-index-duplicates`; artifact identity collisions need review…"],checks:[`registry goals checked: 12`,`registry boundary: shared_local_registry push_allowed=False tracked=False ignored=False`,`user-gate scopes checked: 6 open multi-agent gates`,`runtime root resolved: $HOME/.codex/loopx`,`run-history goals=28 runs=10210`,`public boundary scan clean: 1218 files`]},global_registry:{available:!0,ok:!0,registry:`$HOME/.codex/loopx/registry.global.json`,current_registry:`$HOME/.codex/loopx/registry.global.json`,current_registry_is_global:!0,global_goal_count:12,current_goal_count:12,source_registry_count:7,summary:{high:0,action:8,info:0,checks:2,findings:8},findings:[{kind:`source_registry_missing`,severity:`action`,message:"`cc-test` source registry is missing",recommended_action:"reconnect `cc-test` from its project or archive it if the project is obsolete",goal_id:`cc-test`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`state_file_missing`,severity:`action`,message:"`cc-test` active state file is missing",recommended_action:"repair `cc-test` state_file or reconnect the project",goal_id:`cc-test`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`source_registry_missing`,severity:`action`,message:"`cc-tmp` source registry is missing",recommended_action:"reconnect `cc-tmp` from its project or archive it if the project is obsolete",goal_id:`cc-tmp`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`state_file_missing`,severity:`action`,message:"`cc-tmp` active state file is missing",recommended_action:"repair `cc-tmp` state_file or reconnect the project",goal_id:`cc-tmp`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`source_registry_missing`,severity:`action`,message:"`cc-tmp-xdrchpuaul` source registry is missing",recommended_action:"reconnect `cc-tmp-xdrchpuaul` from its project or archive it if the project is obsolete",goal_id:`cc-tmp-xdrchpuaul`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`state_file_missing`,severity:`action`,message:"`cc-tmp-xdrchpuaul` active state file is missing",recommended_action:"repair `cc-tmp-xdrchpuaul` state_file or reconnect the project",goal_id:`cc-tmp-xdrchpuaul`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`source_registry_missing`,severity:`action`,message:"`loopx-auto-research-e2e-probe-20260628-2225-goal` source registry is missing",recommended_action:"reconnect `loopx-auto-research-e2e-probe-20260628-2225-goal` from its project or archive it if the project is obsolete",goal_id:`loopx-auto-research-e2e-probe-20260628-2225-goal`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`state_file_missing`,severity:`action`,message:"`loopx-auto-research-e2e-probe-20260628-2225-goal` active state file is missing",recommended_action:"repair `loopx-auto-research-e2e-probe-20260628-2225-goal` state_file or reconnect the project",goal_id:`loopx-auto-research-e2e-probe-20260628-2225-goal`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`}],checks:[`global registry goals checked: 12`,`global source registries checked: 7`]},attention_queue:JSON.parse(`{"available":true,"item_count":1,"needs_user_or_controller":0,"needs_controller":0,"needs_codex":1,"watching_external_evidence":0,"items":[{"goal_id":"loopx-meta","status":"skillsbench_codex_cli_goal_tail4_keepalive_relaunched","lifecycle_phase":"adapter_inspected","lifecycle_flags":["adapter_inspected"],"waiting_on":"codex","severity":"action","recommended_action":"Monitor run_group skillsbench-codex-cli-goal-xhigh-tail4-keepalive-20260706T143132CST using public compact/public artifacts only; once benchmark_run.compact.json lands for each case, classify launcher/case/solver/verifi…","source":"latest_run","quota":{"compute":1.0,"window_hours":24,"slot_minutes":1,"allowed_slots":1440,"spent_slots":97,"state":"eligible","reason":"1 compute quota; eligible for the next automatic agent turn"},"agent_todos":{"source_section":"Agent Todo","total_count":12,"open_count":12,"done_count":0,"items":[{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo update recorded for todo_1596c3a678bb","schema_version":"todo_index_item_v0","todo_id":"todo_1596c3a678bb","role":"agent","status":"open","title":"todo update recorded for todo_1596c3a678bb","source":"rollout_event_log","agent_id":"codex-main-control","latest_event_kind":"todo_update","latest_event_at":"2026-07-06T06:33:32Z","latest_event_status":"open","event_count":7,"event_kinds":["todo_update"]},{"goal_id":"loopx-meta","index":24,"done":false,"text":"Monitor ArcticDB #3179 LoopX comment https://github.com/man-group/ArcticDB/issues/3179#issuecomment-4797835630 for metadata-only maintainer reply signal; do not read private material or reply again without owner approva…","schema_version":"todo_index_item_v0","todo_id":"todo_15bc0926a494","role":"agent","status":"open","priority":"P0-REVENUE MONITOR","title":"Monitor ArcticDB #3179 LoopX comment https://github.com/man-group/ArcticDB/issues/3179#issuecomment-4797835630 for metadata-only maintainer reply signal; do not read private material or reply again without owner approva…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","action_kind":"github_public_reply_metadata_monitor","claimed_by":"codex-value-explorer","evidence":"autonomous replan: bounded current value-explorer monitor lane with explicit expires_at.","note":"Set bounded watch expiry for metadata-only public reply monitor; no catch-up after expiry.","updated_at":"2026-07-05T06:27:15+08:00"},{"goal_id":"loopx-meta","index":17,"done":false,"text":"Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harness paths/imports and goal-harness CLI strings to loopx, rerun launch-artifact-handle smoke, and verify it does not reintrod…","schema_version":"todo_index_item_v0","todo_id":"todo_2bf560b48a0c","role":"agent","status":"open","priority":"P0","title":"Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harness paths/imports and goal-harness CLI strings to loopx, rerun launch-artifact-handle smoke, and verify it does not reintrod…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"blocker","action_kind":"legacy_open_pr_rename_blocker","claimed_by":"codex-main-control"},{"goal_id":"loopx-meta","index":23,"done":false,"text":"Fix or bypass local SkillsBench Docker verifier reward collection before using local fallback for canonical base/test comparison; organize-messy-files base on merged #668 reached final verifier but produced empty verifi…","schema_version":"todo_index_item_v0","todo_id":"todo_3ed1c4a69164","role":"agent","status":"open","priority":"P0","title":"Fix or bypass local SkillsBench Docker verifier reward collection before using local fallback for canonical base/test comparison; organize-messy-files base on merged #668 reached final verifier but produced empty verifi…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"blocker","action_kind":"skillsbench_local_verifier_reward_collection","claimed_by":"codex-main-control","required_capabilities":["benchmark_runner"]},{"goal_id":"loopx-meta","index":32,"done":false,"text":"Rerun SkillsBench raw vs loopx-goal-start-product-mode on citation-check and powerlifting with PR #779 merged; inspect compact public counters for soft_verify_exception_continued, probe_operation_count, task-facing solv…","schema_version":"todo_index_item_v0","todo_id":"todo_44907a5f355d","role":"agent","status":"blocked","priority":"P0","title":"Rerun SkillsBench raw vs loopx-goal-start-product-mode on citation-check and powerlifting with PR #779 merged; inspect compact public counters for soft_verify_exception_continued, probe_operation_count, task-facing solv…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"skillsbench_goal_start_raw_new_rerun","claimed_by":"codex-main-control","evidence":"Public-safe redacted live LoopX text; inspect local status for the full row.","note":"Do not spend a full citation-check loopx rerun yet: #865 fixed scored output paths and #874 added bootstrap preflight attribution, but citation-check itself still preflights as apt+verifier bootstrap risk on ECS.","updated_at":"2026-06-29T00:49:36+08:00"},{"goal_id":"loopx-meta","index":39,"done":false,"text":"Run the next SkillsBench loopx-goal-start-product-mode reverse-channel case on latest main (no local Docker), prioritizing a currently bad or uncertain case, then update the public case ledger and true LoopX issue analy…","schema_version":"todo_index_item_v0","todo_id":"todo_4762c790e583","role":"agent","status":"blocked","priority":"P0","title":"Run the next SkillsBench loopx-goal-start-product-mode reverse-channel case on latest main (no local Docker), prioritizing a currently bad or uncertain case, then update the public case ledger and true LoopX issue analy…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"skillsbench_goal_start_remote_rerun","claimed_by":"codex-main-control","evidence":"A prior benchmark adapter change was validated before the legacy surface was archived. Current research uses the RFC-linked benchmark workspace and toolkit boundary smokes.","note":"2026-06-29: fixed host-local ACP idle/no-output root cause in PR #894. ACP protocol tool_call_count=0 is now distinguished from reverse-channel task-facing bridge activity; repeated codex_exec_bridge_idle_timeout withou…","updated_at":"2026-06-29T19:40:32+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_584f55f8f3b4","schema_version":"todo_index_item_v0","todo_id":"todo_584f55f8f3b4","role":"agent","status":"open","title":"todo add recorded for todo_584f55f8f3b4","source":"rollout_event_log","agent_id":"codex-value-explorer","latest_event_kind":"todo_update","latest_event_at":"2026-07-06T06:48:49Z","latest_event_status":"open","event_count":3,"event_kinds":["todo_add","todo_update"]},{"goal_id":"loopx-meta","index":40,"done":false,"text":"Monitor r10 SkillsBench 30-case codex-app-server-goal-baseline batch, summarize completed compact results into the common case ledger, and stop/repair if setup/bootstrap creates new non-solver blockers.","schema_version":"todo_index_item_v0","todo_id":"todo_62debf065fec","role":"agent","status":"blocked","priority":"P0 MONITOR","title":"Monitor r10 SkillsBench 30-case codex-app-server-goal-baseline batch, summarize completed compact results into the common case ledger, and stop/repair if setup/bootstrap creates new non-solver blockers.","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","action_kind":"monitor_skillsbench_batch","claimed_by":"codex-main-control","evidence":"Observed 2026-06-30T02:52+08: active-state target_key=skillsbench-goal-baseline-30case-20260629T1826Z-r10; local ps/tmux/recent artifact search found no r10 batch process or compact artifact; no raw task/log/trajectory …","updated_at":"2026-06-30T02:54:54+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_93bc6439c521","schema_version":"todo_index_item_v0","todo_id":"todo_93bc6439c521","role":"agent","status":"open","title":"todo add recorded for todo_93bc6439c521","source":"rollout_event_log","agent_id":"codex-main-control","latest_event_kind":"todo_claim","latest_event_at":"2026-07-06T06:32:52Z","latest_event_status":"open","event_count":2,"event_kinds":["todo_add","todo_claim"]},{"goal_id":"loopx-meta","index":27,"done":false,"text":"Run the SkillsBench two-arm comparison after the goal-start route is countable: raw Codex vs new loopx-goal-start-product-mode, reporting task_score/control_score/time and compact public-safe LoopX todo rollout evidence.","schema_version":"todo_index_item_v0","todo_id":"todo_aad7e9716927","role":"agent","status":"blocked","priority":"P0","title":"Run the SkillsBench two-arm comparison after the goal-start route is countable: raw Codex vs new loopx-goal-start-product-mode, reporting task_score/control_score/time and compact public-safe LoopX todo rollout evidence.","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"run_goal_start_product_mode_matrix","claimed_by":"codex-main-control","evidence":"driver.status shows DONE raw then RUN loopx-goal-start with no running driver; raw benchmark_run.compact first_blocker=skillsbench_codex_acp_provider_zero_activity; source guard requires --host-local-acp-launch for Loop…","note":"Remote run group skillsbench-raw-new-goal-start-20260627T0420Z produced a material closeout for citation-check raw only; raw compact attribution is skillsbench_codex_acp_provider_zero_activity with official score missin…","updated_at":"2026-06-27T13:05:47+08:00"},{"goal_id":"loopx-meta","index":21,"done":false,"text":"Observe remote official SkillsBench powerlifting-coef-calc base/test runtime-layer mountfix pair skillsbench-powerlifting-coef-calc-remote-canonical-runtime-mountfix-pair-20260623T022028Z: use compact/public artifacts o…","schema_version":"todo_index_item_v0","todo_id":"todo_aec1873c7f28","role":"agent","status":"open","priority":"P0 MONITOR","title":"Observe remote official SkillsBench powerlifting-coef-calc base/test runtime-layer mountfix pair skillsbench-powerlifting-coef-calc-remote-canonical-runtime-mountfix-pair-20260623T022028Z: use compact/public artifacts o…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","claimed_by":"codex-main-control","note":"2026-06-23 projection fix: this is monitor context for the powerlifting run, not an advancement next action; current executable path is SkillsBench build cache/prewarm repair.","updated_at":"2026-06-23T10:37:43+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_c02cb7d19607","schema_version":"todo_index_item_v0","todo_id":"todo_c02cb7d19607","role":"agent","status":"open","title":"todo add recorded for todo_c02cb7d19607","source":"rollout_event_log","agent_id":"codex-value-explorer","latest_event_kind":"todo_add","latest_event_at":"2026-07-06T03:47:54Z","latest_event_status":"open","event_count":1,"event_kinds":["todo_add"]}]}}]}`),run_history:{available:!0,goal_count:1,run_count:5,goals:[{id:`loopx-meta`,domain:`loopx-platform`,status:`active-read-only`,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`],registry_member:!0,legacy_runtime_goal:!1,adapter_kind:`harness_self_improvement`,adapter_status:`connected-read-only`,index_exists:!0,raw_index_records:8444,unique_runs:8440,quota:{compute:1,window_hours:24,slot_minutes:1,allowed_slots:1440,spent_slots:97,state:`waiting`,reason:`no active Codex-ready work is currently selected`},latest_runs:[{generated_at:`2026-07-06T14:37:32+08:00`,goal_id:`loopx-meta`,classification:`quota_slot_spent`,agent_id:`codex-value-explorer`,recommended_action:`审阅 PR #1524 的 Agent Management 面板视觉方向:workspace hint 与 stale claim hint 是否符合预期;确认后允许 codex-value-explorer 自合并。`,health_check:`quota safe-bypass operator gate; quota slot spend event public-safe`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]},{generated_at:`2026-07-06T14:33:55+08:00`,goal_id:`loopx-meta`,classification:`quota_slot_spent`,agent_id:`codex-main-control`,recommended_action:`[P1] Repair SkillsBench post-run debug gate consistency for countable codex-cli-goal official-zero runs: when attempt_accounting is countable and case_closeout_complete=true, do not project first_blocker=loopx_closeout_…`,health_check:`quota should-run eligible; quota slot spend event public-safe`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]},{generated_at:`2026-07-06T14:33:54+08:00`,goal_id:`loopx-meta`,classification:`skillsbench_codex_cli_goal_tail4_keepalive_relaunched`,agent_id:`codex-main-control`,progress_scope:`goal`,delivery_batch_scale:`single_surface`,delivery_outcome:`outcome_progress`,recommended_action:`Monitor run_group skillsbench-codex-cli-goal-xhigh-tail4-keepalive-20260706T143132CST using public compact/public artifacts only; once benchmark_run.compact.json lands for each case, classify launcher/case/solver/verifi…`,health_check:`state_file 1/1; registry_goal 1/1; authority_sources 10`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]},{generated_at:`2026-07-06T14:33:34+08:00`,goal_id:`loopx-meta`,classification:`quota_slot_spent`,agent_id:`codex-side-bypass`,recommended_action:`[P0] Rerun real KNN visible auto-research after the successor-link fix and verify evaluator completion projects a second-round hypothesis/frontier or explicit completion gate without manual intervention; keep evidence p…`,health_check:`quota should-run eligible; quota slot spend event public-safe`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]},{generated_at:`2026-07-06T14:32:57+08:00`,goal_id:`loopx-meta`,classification:`auto_research_successor_link_fix_merged`,agent_id:`codex-side-bypass`,progress_scope:`agent_lane`,delivery_batch_scale:`implementation`,delivery_outcome:`outcome_progress`,recommended_action:`[P0] Rerun real KNN visible auto-research after the successor-link fix and verify evaluator completion projects a second-round hypothesis/frontier or explicit completion gate without manual intervention; keep evidence p…`,health_check:`state_file 1/1; registry_goal 1/1; authority_sources 0`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]}]}]}},Qd=W().nullable(),$d=pd(`enabled`,[J({enabled:X(!1)}),J({enabled:X(!0),revision:G().int().positive(),digest:W().min(1),objective:W(),non_goals:q(W()),held_todo_ids:q(W()),status:Y([`unverified`,`stale`,`failed`,`partial`,`accepted`,`held`]),criteria:q(J({id:W(),description:W()})),tasks:q(J({todo_id:W(),state:Y([`ready`,`unbound`,`stale`]),criterion_ids:q(W()),reason:W().optional(),reason_code:W().optional(),applicable:K().optional()})),verification:J({operation_id:W(),contract_revision:G().int().positive(),contract_digest:W(),todo_id:W().nullable(),results:q(J({criterion_id:W(),passed:K(),exit_code:G().int().nullable()}))}).nullable()})]),ef=J({schema_version:X(`goal_acceptance_observation_projection_v0`),goal_id:W(),read_only:X(!0),acceptance_assessed:X(!1),coverage:Y([`partial`,`unavailable`]),missing_sources:q(W()),truncated:K(),historical_progress:q(J({kind:W(),observed_at:Qd,source:W(),evidence_refs:q(W())})),acceptance_gaps:q(J({kind:W(),owner:Qd,reason:Qd,evidence_required:Qd,observed_at:Qd,source:W(),reason_code:W().optional(),resolution_hint:W().optional(),component_checks:J({checkpoint_satisfied:K(),checkpoint_fresh:K(),path_outcome_valid:K(),evidence_refs_present:K(),final_outcome_claim_present:K(),no_reported_outcome_gap:K()}).optional()})),guards:q(J({kind:W(),todo_id:Qd,blocks_agent:Qd,owner:Qd,reason:Qd,evidence_required:Qd,decision_scope:Qd})),next_action:Qd,next_action_source:Qd,goal_acceptance_contract:$d.optional()}),tf=dd([W(),G(),K(),rd()]),nf=yd(W(),tf),rf=J({todo_id:W().optional(),priority:W().optional(),status:W(),title:W(),claimed_by:W().optional(),task_class:W().optional(),action_kind:W().optional()}),af=J({gate_id:W(),kind:W(),status:W(),blocks:q(W()).optional()}),of=J({todo_id:W().optional(),owner_agent:W().optional(),status:W().optional(),lease_until:W().optional(),write_scope:q(W()).optional()}),sf=J({generated_at:W().optional(),classification:W().optional(),summary:W().optional()}),cf=J({kind:W().optional().default(`warning`),message:dd([W(),q(W())]).optional().default(`compact source warning`)}).passthrough(),lf=J({schema_version:X(`goal_channel_projection_v0`),mode:X(`read_only`),goal_id:W(),display_name:W(),generated_at:W().optional().nullable(),latest_status:W(),waiting_on:W(),next_action:W(),source_refs:yd(W(),tf),decision_frame:J({user_action_required:K(),agent_action_required:K(),quiet_noop_allowed:K()}),quota:nf,user_todos:q(rf).default([]),agent_todos:q(rf).default([]),open_gates:q(af).default([]),active_leases:q(of).default([]),artifacts:q(nf).default([]),recent_events:q(sf).default([]),source_warnings:q(cf).default([]),truth_contract:J({event_ledger_is_source_of_truth:K(),projection_is_writable:K(),recompute_rule:W(),write_authority:W()})}),uf=J({compute:G().optional().default(1),window_hours:G().optional().default(24),slot_minutes:G().optional().default(1),allowed_slots:G().optional().nullable(),spent_slots:G().optional().default(0),state:W().optional().nullable(),next_eligible_at:W().optional().nullable(),reason:W().optional().nullable(),blocked_action_scope:W().optional().nullable(),focus_wait:K().optional().nullable(),handoff_outcome_floor_block:K().optional().nullable(),safe_bypass_allowed:K().optional().default(!1),safe_bypass_kind:W().optional().nullable(),safe_bypass_policy:W().optional().nullable(),post_handoff_outcome_gap_streak:G().optional().nullable(),outcome_gap_threshold:G().optional().nullable(),must_advance:q(W()).optional().default([]),avoid:q(W()).optional().default([])}).transform(e=>{let t=Math.max(1,e.slot_minutes),n=Math.round(e.window_hours*60*e.compute/t);return{...e,slot_minutes:t,allowed_slots:e.allowed_slots??n}}),df=J({self_repair:J({enabled:K().optional().default(!1),allow_health_blocker_repair:K().optional().default(!1),allow_waiting_projection_repair:K().optional().default(!1)}).optional().nullable()}).passthrough(),ff=J({model_config:J({model:W(),reasoning_effort:W().optional()}).optional(),mode:W().optional().default(`default`),orchestration_mode:W().optional().nullable(),spawn_allowed:K().optional().default(!1),allowed:K().optional().nullable(),max_children:G().optional().default(0),allowed_domains:q(W()).optional().default([])}).passthrough(),pf=J({label:W().optional().nullable(),path:W(),anchor:W().optional().nullable(),exists:K().optional().default(!1),resolved_path:W().optional().nullable()}),mf=J({index:G(),done:K(),text:W(),schema_version:W().optional().nullable(),todo_id:W().optional().nullable(),role:W().optional().nullable(),status:W().optional().nullable(),resume_when:W().optional().nullable(),resume_ready:K().optional().nullable(),resume_condition:yd(W(),ad()).optional().nullable(),priority:W().optional().nullable(),title:W().optional().nullable(),archive_state:W().optional().nullable(),source_section:W().optional().nullable(),task_class:W().optional().nullable(),task_domain:W().optional().nullable(),action_kind:W().optional().nullable(),claimed_by:W().optional().nullable(),required_capabilities:q(W()).optional(),note:W().optional().nullable(),evidence:W().optional().nullable(),updated_at:W().optional().nullable(),review_materials:q(pf).optional().default([])}).passthrough(),hf=J({source_section:W().optional().nullable(),total_count:G().optional().default(0),open_count:G().optional().default(0),done_count:G().optional().default(0),advancement_done_count:G().optional(),items:q(mf).optional().default([]),deferred_items:q(mf).optional()}),gf=mf.extend({goal_id:W(),source:W().optional().nullable(),event_count:G().optional().default(0),event_kinds:q(W()).optional().default([]),latest_event_kind:W().optional().nullable(),latest_event_at:W().optional().nullable(),latest_event_status:W().optional().nullable(),agent_id:W().optional().nullable()}).passthrough(),_f=J({schema_version:W().optional().nullable(),source:W().optional().nullable(),total_count:G().optional().default(0),current_projected_count:G().optional().default(0),rollout_event_count:G().optional().default(0),item_limit:G().optional().nullable(),items:q(gf).optional().default([])}),vf=J({kind:W().optional().nullable(),label:W().optional().nullable(),path_safe:K().optional().default(!1),branch:W().optional().nullable(),write_scope:q(W()).optional().default([])}).passthrough(),yf=J({state:W().optional().nullable(),claimed_by:W().optional().nullable(),last_activity_at:W().optional().nullable(),threshold_hours:G().optional().nullable(),reason:W().optional().nullable(),recommended_operator_action:W().optional().nullable()}).passthrough(),bf=J({schema_version:W().optional().nullable(),todo_id:W().optional().nullable(),goal_id:W().optional().nullable(),role:W().optional().nullable(),status:W().optional().nullable(),priority:W().optional().nullable(),title:W().optional().nullable(),task_class:W().optional().nullable(),action_kind:W().optional().nullable(),claimed_by:W().optional().nullable(),required_write_scopes:q(W()).optional().default([]),workspace_ref:vf.optional().nullable()}).passthrough(),xf=J({schema_version:W().optional().nullable(),from_agent:W().optional().nullable(),to_agent:W().optional().nullable(),intent:W().optional().nullable(),summary:W().optional().nullable(),blocker:W().optional().nullable(),suggested_next_action:W().optional().nullable(),evidence_refs:q(W()).optional().default([]),updated_at:W().optional().nullable()}).passthrough(),Sf=J({agent_id:W(),role:W().optional().nullable(),state:W().optional().nullable(),current_todo:bf.optional().nullable(),next_action:W().optional().nullable(),last_activity_at:W().optional().nullable(),evidence_refs:q(W()).optional().default([]),handoff_refs:q(W()).optional().default([]),handoff_note:xf.optional().nullable(),workspace_ref:vf.optional().nullable(),stale_claim_hint:yf.optional().nullable(),blocked_on:bf.optional().nullable(),goal_ids:q(W()).optional().default([])}).passthrough(),Cf=J({schema_version:W().optional().nullable(),mode:W().optional().nullable(),goal_id:W().optional().nullable(),generated_at:W().optional().nullable(),style_hint:J({preferred:W().optional().nullable(),license_boundary:W().optional().nullable()}).optional().nullable(),truth_contract:J({todo_is_runtime_work_item:K().optional().default(!0),projection_is_writable:K().optional().default(!1),introduces_task_runtime:K().optional().default(!1),write_api:K().optional().default(!1)}).optional().nullable(),source_summary:J({registered_agent_count:G().optional().default(0),projected_agent_count:G().optional().default(0),todo_source:W().optional().nullable()}).optional().nullable(),agents:q(Sf).optional().default([])}).passthrough(),wf=J({goal_id:W(),configured:K().optional().default(!1),enabled:K().optional().default(!1),human_gate_auto_notify_enabled:K().optional().default(!1),target_ref:W().optional().nullable(),receipt_count:G().optional().default(0),last_notified_at:W().optional().nullable()}).passthrough(),Tf=J({schema_version:W().optional().nullable(),generated_at:W().optional().nullable(),goals:q(wf).optional().default([])}).passthrough(),Ef=J({source_section:W().optional().nullable(),open:G().optional().default(0),done:G().optional().default(0),total:G().optional().default(0),advancement_done_count:G().optional(),next:W().optional().nullable(),next_index:G().optional().nullable(),items:q(mf).optional().default([]),recent_completed_advancement_items:q(mf).optional().default([])}),Df=J({goal_id:W(),status:W().optional().nullable(),waiting_on:W().optional().nullable(),severity:W().optional().nullable(),index:G().optional().nullable(),text:W(),source:W().optional().nullable()}),Of=J({source:W().optional().nullable(),open_count:G().optional().default(0),items:q(Df).optional().default([])}),kf=J({goal_id:W(),status:W().optional().nullable(),waiting_on:W().optional().nullable(),quota_state:W().optional().nullable(),priority:W().optional().nullable(),todo_index:G().optional().nullable(),text:W(),source:W().optional().nullable()}),Af=J({source:W().optional().nullable(),open_count:G().optional().default(0),items:q(kf).optional().default([])}),jf=J({generated_at:W().optional().nullable(),classification:W().optional().nullable(),summary:W().optional().nullable()}),Mf=J({kind:W().optional().nullable(),source:W().optional().nullable(),severity:W().optional().nullable(),requires_refresh_state:K().optional().default(!1),reason:W().optional().nullable(),active_state_updated_at:W().optional().nullable(),latest_run_generated_at:W().optional().nullable(),latest_run_state_updated_at:W().optional().nullable(),latest_run_classification:W().optional().nullable(),recommended_action:W().optional().nullable()}),Nf=J({generated_at:W().optional().nullable(),classification:W().optional().nullable(),delivery_batch_scale:W().optional().nullable(),delivery_outcome:W().optional().nullable(),health_check:W().optional().nullable(),json_exists:K().optional().nullable(),markdown_exists:K().optional().nullable()}),Pf=J({project_asset_backed:K().optional(),same_source_should_run:K().optional(),codex_ready:K().optional(),handoff_has_next_action:K().optional(),handoff_has_stop_condition:K().optional(),handoff_sanitized_surface:K().optional()}).catchall(K()),Ff=J({ready:K().optional().default(!1),codex_ready:K().optional().default(!1),source:W().optional().nullable(),quota_state:W().optional().nullable(),checks:Pf.optional().default({}),handoff_status:W().optional().nullable(),handoff_ready_at:W().optional().nullable(),handoff_ready_classification:W().optional().nullable(),post_handoff_run_seen:K().optional().default(!1),post_handoff_latest_run:Nf.optional().nullable(),post_handoff_recent_runs:q(Nf).optional().default([]),post_handoff_small_scale_streak:G().int().nonnegative().optional().default(0),post_handoff_outcome_gap_streak:G().int().nonnegative().optional().default(0),next_probe:W().optional().nullable()}),If=J({schema_version:W().optional().nullable(),kind:W().optional().nullable(),missing_roles:q(W()).optional().default([]),source:W().optional().nullable(),recommended_action:W().optional().nullable()}),Lf=J({owner:W(),gate:W(),next_action:W(),stop_condition:W(),user_todos:Ef.optional().nullable(),agent_todos:Ef.optional().nullable(),quota:uf.optional().nullable(),control_plane:df.optional().nullable(),orchestration:ff.optional().nullable(),latest_validation:jf.optional().nullable(),stale_latest_run_warning:Mf.optional().nullable(),todo_projection_gap:If.optional().nullable()}),Rf=J({goal_id:W(),activation_state:Y([`active`,`stopped`]).optional().default(`active`),status:W(),waiting_on:W(),severity:W(),recommended_action:W(),project_asset:Lf.optional().nullable(),handoff_readiness:Ff.optional().nullable(),source:W().optional(),operator_question:W().optional().nullable(),agent_command:W().optional().nullable(),lifecycle_phase:W().optional().nullable(),lifecycle_flags:q(W()).optional().default([]),controller_stage:W().optional().nullable(),missing_gates:q(W()).optional().default([]),next_handoff_condition:W().optional().nullable(),quota:uf.optional().nullable(),control_plane:df.optional().nullable(),user_todos:hf.optional().nullable(),agent_todos:hf.optional().nullable(),stale_latest_run_warning:Mf.optional().nullable(),dependency_blockers:Of.optional().nullable(),todo_state_file:W().optional().nullable(),goal_channel_projection:lf.optional().nullable()}),zf=J({recorded_at:W().optional().nullable(),decision:W().optional().nullable(),reward:W().optional().nullable(),reason_summary:W().optional().nullable(),follow_up:W().optional().nullable()}),Bf=J({recorded_at:W().optional().nullable(),gate:W().optional().nullable(),decision:W().optional().nullable(),operator_question:W().optional().nullable(),reason_summary:W().optional().nullable(),follow_up:W().optional().nullable(),agent_command:W().optional().nullable()}),Vf=J({version:W().optional().nullable(),goal_id:W().optional().nullable(),run_id:W().optional().nullable(),gate_id:W().optional().nullable(),created_state_ref:W().optional().nullable(),created_policy_version:W().optional().nullable(),interrupt_payload:J({question:W().optional().nullable(),choices:q(W()).optional().default([])}).optional().nullable(),allowed_decisions:q(W()).optional().default([]),operator_decision:W().optional().nullable(),latest_state_ref:W().optional().nullable(),freshness_check:W().optional().nullable(),precondition_check:W().optional().nullable(),migration_or_rebase_result:W().optional().nullable(),resulting_action:W().optional().nullable(),validation_after_resume:W().optional().nullable()}),Hf=J({id:W().optional().nullable(),ok:K().optional().nullable(),review:W().optional().nullable()}),Uf=J({classification:W().optional().nullable(),read_only_observer_ready:K().optional().nullable(),decision_advisor_ready:K().optional().nullable(),write_controller_ready:K().optional().nullable(),missing_gates:q(W()).optional().default([]),review_judgment:W().optional().nullable(),next_handoff_condition:W().optional().nullable(),gates:q(Hf).optional().default([])}),Wf=J({declared:K().optional().default(!1),required:K().optional().default(!1),path:W().optional().nullable(),path_exists:K().optional().nullable(),read_status:W().optional().nullable(),default_entry_count:G().optional().default(0),default_entries_checked:G().optional().default(0),default_entries_present:G().optional().default(0),topic_authority_count:G().optional().default(0),project_material_count:G().optional().default(0),project_material_repository_count:G().optional().default(0),project_material_owner_review_required_count:G().optional().default(0),project_material_stale_count:G().optional().default(0),project_material_current_authority_count:G().optional().default(0),deprecated_source_count:G().optional().default(0),conflict_risk:W().optional().nullable()}),Gf=J({adapter_kind:W().optional().nullable(),adapter_status:W().optional().nullable(),authority_source_count:G().optional().nullable(),authority_registry_declared:K().optional().nullable(),authority_registry_path_exists:K().optional().nullable(),authority_registry_default_entry_count:G().optional().nullable(),authority_registry_default_entries_present:G().optional().nullable(),topic_authority_count:G().optional().nullable(),project_material_count:G().optional().nullable(),project_material_repository_count:G().optional().nullable(),project_material_owner_review_required_count:G().optional().nullable(),project_material_stale_count:G().optional().nullable(),project_material_current_authority_count:G().optional().nullable(),authority_registry_conflict_risk:W().optional().nullable(),guard_count:G().optional().nullable(),sections_found:G().optional().nullable(),sections_checked:G().optional().nullable(),files_present:G().optional().nullable(),files_checked:G().optional().nullable()}),Kf=J({generated_at:W(),goal_id:W(),classification:W().optional().nullable(),lifecycle_phase:W().optional().nullable(),lifecycle_flags:q(W()).optional().default([]),recommended_action:W().optional().nullable(),health_check:W().optional().nullable(),active_task_count:G().optional().nullable(),active_priorities:yd(W(),ad()).optional().nullable(),cache_check:W().optional().nullable(),json_exists:K().optional().default(!1),markdown_exists:K().optional().default(!1),human_reward:zf.optional().nullable(),operator_gate:Bf.optional().nullable(),operator_gate_resume_contract:Vf.optional().nullable(),controller_readiness:Uf.optional().nullable(),project_map:Gf.optional().nullable()}),qf=J({acceptance_observation:ef.optional().nullable().catch(null),id:W(),activation_state:Y([`active`,`stopped`]).optional().default(`active`),display_name:W().optional().nullable(),domain:W().optional().nullable(),status:W().optional().nullable(),lifecycle_phase:W().optional().nullable(),lifecycle_flags:q(W()).optional().default([]),registry_member:K().optional().default(!1),legacy_runtime_goal:K().optional().default(!1),adapter_kind:W().optional().nullable(),adapter_status:W().optional().nullable(),authority_registry:Wf.optional().nullable(),quota:uf.optional().nullable(),control_plane:df.optional().nullable(),spawn_policy:ff.optional().nullable(),orchestration:ff.optional().nullable(),coordination:J({agent_model:W().optional().nullable(),registered_agents:q(W()).optional().default([])}).optional().nullable(),index_exists:K().optional().default(!1),raw_index_records:G().optional().default(0),unique_runs:G().optional().default(0),latest_runs:q(Kf).optional().default([])}),Jf=J({available:K(),goal_count:G().optional().default(0),run_count:G().optional().default(0),goals:q(qf).optional().default([]),recent_runs:q(Kf).optional().default([])}),Yf=J({kind:W(),severity:W(),message:W(),recommended_action:W(),goal_id:W().optional().nullable(),path:W().optional().nullable(),goal_ids:q(W()).optional().default([])}),Xf=J({available:K(),ok:K(),registry:W(),current_registry:W().optional().nullable(),current_registry_is_global:K().optional().default(!1),global_goal_count:G().optional().default(0),current_goal_count:G().optional().default(0),source_registry_count:G().optional().default(0),summary:J({high:G().optional().default(0),action:G().optional().default(0),info:G().optional().default(0),checks:G().optional().default(0),findings:G().optional().default(0)}),findings:q(Yf).optional().default([]),checks:q(W()).optional().default([])}),Zf=J({runs_24h:G().optional().default(0),runs_7d:G().optional().default(0),quota_spend_slots_24h:G().optional().default(0),quota_spend_slots_7d:G().optional().default(0),automation_run_count_24h:G().optional().default(0),automation_run_count_7d:G().optional().default(0),progress_signal_run_count_24h:G().optional().default(0),progress_signal_run_count_7d:G().optional().default(0),input_tokens_24h:G().optional(),input_tokens_7d:G().optional(),output_tokens_24h:G().optional(),output_tokens_7d:G().optional(),cache_tokens_24h:G().optional(),cache_tokens_7d:G().optional(),cost_usd_24h:G().optional(),cost_usd_7d:G().optional(),duration_ms_24h:G().optional(),duration_ms_7d:G().optional()}),Qf=Zf.extend({goal_id:W(),project_share_24h:G().optional().default(0)}),$f=J({available:K().optional().default(!0),source:W().optional().default(`run_history`),generated_at:W().optional().nullable(),sample_run_count:G().optional().default(0),proxy_note:W().optional().nullable(),totals:Zf.optional().default({runs_24h:0,runs_7d:0,quota_spend_slots_24h:0,quota_spend_slots_7d:0,automation_run_count_24h:0,automation_run_count_7d:0,progress_signal_run_count_24h:0,progress_signal_run_count_7d:0}),goals:q(Qf).optional().default([])}).optional().nullable(),ep=J({accounting:G().optional().default(0),decision:G().optional().default(0),evidence:G().optional().default(0),state:G().optional().default(0),work:G().optional().default(0)}),tp={accounting:0,decision:0,evidence:0,state:0,work:0},np=J({events_24h:G().optional().default(0),events_7d:G().optional().default(0),by_class_24h:ep.optional().default(tp),by_class_7d:ep.optional().default(tp)}),rp=np.extend({goal_id:W(),latest_event_class:W().optional().nullable(),latest_event_at:W().optional().nullable()}),ip={events_24h:0,events_7d:0,by_class_24h:tp,by_class_7d:tp},ap=J({available:K().optional().default(!0),source:W().optional().default(`run_history`),generated_at:W().optional().nullable(),sample_run_count:G().optional().default(0),proxy_note:W().optional().nullable(),event_classes:q(W()).optional().default([`accounting`,`decision`,`evidence`,`state`,`work`]),totals:np.optional().default(ip),goals:q(rp).optional().default([])}).optional().nullable(),op=J({available:K().optional().default(!1),source:W().optional().default(`run_history`),goal_id:W().optional().nullable(),generated_at:W().optional().nullable(),classification:W().optional().nullable(),delivery_batch_scale:W().optional().nullable(),delivery_outcome:W().optional().nullable(),recommended_action:W().optional().nullable(),json_exists:K().optional().default(!1),markdown_exists:K().optional().default(!1),freshness_window_hours:G().optional().default(24),freshness_status:W().optional().nullable(),is_fresh:K().optional().default(!1),requires_readiness_run:K().optional().default(!0),age_seconds:G().optional().nullable(),age_hours:G().optional().nullable(),freshness_reference_time:W().optional().nullable(),sample_run_count:G().optional().default(0),proxy_note:W().optional().nullable(),reason:W().optional().nullable()}).optional().nullable(),sp=J({ok:K().optional().default(!0),registry:W().optional().nullable(),runtime_root:W().optional().nullable(),gate:W().optional().default(`promotion_readiness`),gate_state:W().optional().default(`warning`),can_promote:K().optional().default(!1),should_warn:K().optional().default(!0),non_blocking:K().optional().default(!0),recommended_action:W().optional().nullable(),warning_message:W().optional().nullable(),readiness:op.default(null)}).optional().nullable(),cp=J({decision_count:G().optional().default(0),stale_count:G().optional().default(0),rebase_required_count:G().optional().default(0),fresh_count:G().optional().default(0)}),lp=J({goal_id:W(),decision_kind:W().optional().nullable(),decision_at:W().optional().nullable(),classification:W().optional().nullable(),age_days:G().optional().nullable(),stale_by_age:K().optional().default(!1),newer_event_count_7d:G().optional().default(0),newer_event_classes_7d:ep.optional().default(tp),freshness_state:W().optional().nullable(),requires_decision_point_rebase:K().optional().default(!1),reason:W().optional().nullable()}),up=J({available:K().optional().default(!0),source:W().optional().default(`run_history`),generated_at:W().optional().nullable(),sample_run_count:G().optional().default(0),window_days:G().optional().default(7),proxy_note:W().optional().nullable(),summary:cp.optional().default({decision_count:0,stale_count:0,rebase_required_count:0,fresh_count:0}),items:q(lp).optional().default([])}).optional().nullable(),dp=J({schema_version:G().optional().default(0),minimum_dashboard_schema_version:G().optional().default(2),producer:W().optional().nullable(),reload_hint:W().optional().nullable()}).optional().default({schema_version:0,minimum_dashboard_schema_version:2,producer:null,reload_hint:`scripts/macos-dashboard-launchagent.sh restart`}),fp=J({schema_version:X(`loopx_goal_projection_scope_v0`),scope:Y([`all`,`active`,`stopped`]),complete:K(),projected_goal_count:G().int().nonnegative(),registry_goal_count:G().int().nonnegative(),registry_revision:W().optional().nullable()}),pp=J({source:W().optional().default(`serve-status`),status_url:W().optional().nullable(),health_url:W().optional().nullable(),review_material_url:W().optional().nullable(),presentation_surfaces_url:W().optional().nullable(),presentation_detail_url:W().optional().nullable(),periodic_report_index_url:W().optional().nullable(),periodic_report_detail_url:W().optional().nullable(),ssh_hosts_url:W().optional().nullable(),reward_dry_run_url:W().optional().nullable(),reward_append_url:W().optional().nullable(),reward_write_enabled:K().optional().default(!1),configure_goal_dry_run_url:W().optional().nullable(),configure_goal_apply_url:W().optional().nullable(),control_plane_write_enabled:K().optional().default(!1)}).optional().nullable(),mp=J({extension_id:W().min(1),surface_id:W().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/),extension_revision:W().min(1),payload_sha256:W().regex(/^[0-9a-f]{64}$/)}).strict(),hp=J({extension_id:W().min(1),extension_revision:W().min(1),surface_id:W().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/),surface_kind:W().regex(/^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/),title:W().min(1),view_schema:W().regex(/^[a-z][a-z0-9_]*_v\d+$/),visibility:Y([`public-safe`,`owner-only`]),goal_id:W().min(1).nullable(),generated_at:W().min(1).nullable(),review_due_at:W().min(1).nullable(),diagnostic:W().min(1).nullable(),empty_state_title:W().min(1),empty_state_detail:W().min(1)}),gp=dd([hp.extend({state:Y([`ready`,`review_due`]),goal_id:W().min(1),generated_at:W().min(1),detail_ref:mp}).strict(),hp.extend({state:X(`empty`),detail_ref:sd().optional()}).strict(),hp.extend({state:X(`invalid`),diagnostic:W().min(1),detail_ref:sd().optional()}).strict()]),_p=J({schema_version:X(`extension_presentation_surfaces_v0`),count:G().int().nonnegative(),ready_count:G().int().nonnegative(),review_due_count:G().int().nonnegative(),empty_count:G().int().nonnegative(),invalid_count:G().int().nonnegative(),items:q(gp)}).strict(),vp={schema_version:`extension_presentation_surfaces_v0`,count:0,ready_count:0,review_due_count:0,empty_count:0,invalid_count:0,items:[]};J({ok:X(!0),presentation_surfaces:_p}).strict();var yp=J({goal_id:W().min(1),agent_id:W().min(1),generation_id:W().min(1),content_sha256:W().regex(/^sha256:[0-9a-f]{64}$/)}).strict(),bp=J({goal_id:W().min(1),agent_id:W().min(1),generation_id:W().min(1),publication_id:W().min(1),delivered_at:W().min(1),predecessor_publication_id:W().min(1).nullable().optional(),detail_ref:yp}).strict(),xp=J({schema_version:X(`periodic_report_workspace_index_v0`),count:G().int().nonnegative(),items:q(bp)}),Sp=xp.extend({returned_count:G().int().nonnegative(),total_count:G().int().nonnegative(),limit:G().int().nonnegative(),offset:G().int().nonnegative(),truncated:K()}).strict(),Cp=xp.strict().transform(e=>({...e,returned_count:e.count,total_count:e.count,limit:e.count,offset:0,truncated:!1})),wp=J({ok:X(!0),periodic_reports:dd([Sp,Cp])}).strict(),Tp=J({schema_version:X(`periodic_report_workspace_projection_v0`),goal_id:W().min(1),agent_id:W().min(1),generation_id:W().min(1),generated_at:W().min(1),title:W().min(1),summary:W().min(1),content_sha256:W().regex(/^sha256:[0-9a-f]{64}$/),period_window:J({start_at:W().min(1),end_at:W().min(1)}).strict(),interaction:J({attention_kind:X(`progress`),interaction:X(`inform`),delivery:X(`surface`),form:X(`milestone_report`),writable:X(!1)}).strict(),delta:J({added_count:G().int().nonnegative(),changed_count:G().int().nonnegative(),item_count:G().int().positive(),items:q(J({fact_id:W().min(1),source_ref:W().min(1),title:W().min(1),summary:W().min(1),status:W().min(1),content_kind:W().min(1),change_kind:Y([`added`,`changed`]),previous_status:W().min(1).optional()}).strict())}).strict(),publication:J({publication_id:W().min(1),delivered_at:W().min(1),predecessor_publication_id:W().min(1).nullable().optional(),cursor_id:W().min(1)}).strict(),truth_contract:J({published_cursor_is_source_of_truth:X(!0),generation_receipt_is_delivery_receipt:X(!1),projection_is_writable:X(!1),browser_write_api:X(!1)}).strict()}).strict(),Ep=J({ok:X(!0),projection:Tp}).strict(),Dp=J({ok:K(),registry:W(),runtime_root:W(),goal_count:G(),run_count:G(),status_contract:dp,goal_projection:fp.optional().nullable().default(null),local_dashboard_api:pp,contract:J({ok:K(),summary:J({errors:G(),warnings:G(),checks:G()}),errors:q(W()),warnings:q(W()),checks:q(W()).optional().default([])}),global_registry:Xf.optional().default({available:!1,ok:!0,registry:``,current_registry:null,current_registry_is_global:!1,global_goal_count:0,current_goal_count:0,source_registry_count:0,summary:{high:0,action:0,info:0,checks:0,findings:0},findings:[],checks:[]}),attention_queue:J({available:K(),item_count:G(),needs_user_or_controller:G(),needs_controller:G().optional().default(0),needs_codex:G(),watching_external_evidence:G(),autonomous_backlog_candidates:Af.optional().nullable(),items:q(Rf)}),run_history:Jf.optional().default({available:!1,goal_count:0,run_count:0,goals:[],recent_runs:[]}),event_ledger_summary:ap.default(null),promotion_readiness_summary:op.default(null),promotion_gate:sp.default(null),decision_freshness_summary:up.default(null),usage_summary:$f.default(null),todo_index:_f.optional().nullable().default(null),agent_management_projection:Cf.optional().nullable().default(null),goal_channel_notification_projection:Tf.optional().nullable().default(null),presentation_surfaces:_p.optional().default(vp)});J({ok:K(),dry_run:K().optional().default(!0),appended:K().optional().default(!1),goal_id:W().optional().nullable(),raw_index_records_before:G().optional().nullable(),preview_id:W().optional().nullable(),selected_run:J({generated_at:W().optional().nullable(),classification:W().optional().nullable(),recommended_action:W().optional().nullable(),json_exists:K().optional().nullable(),markdown_exists:K().optional().nullable()}).optional().nullable(),human_reward:zf.optional().nullable(),active_state_summary:W().optional().nullable(),project_agent_visibility:J({source_of_truth:W().optional().nullable(),history_command:W().optional().nullable(),active_state_role:W().optional().nullable(),review_packet_role:W().optional().nullable()}).optional().nullable(),error:W().optional().nullable()});function Op(e,t,n){let r=e.run_history.goals.map(e=>e.id===t&&e.activation_state!==n?{...e,activation_state:n}:e),i=e.attention_queue.items.map(e=>e.goal_id===t&&e.activation_state!==n?{...e,activation_state:n}:e),a=r.some((t,n)=>t!==e.run_history.goals[n]),o=i.some((t,n)=>t!==e.attention_queue.items[n]);return!a&&!o?e:{...e,attention_queue:o?{...e.attention_queue,items:i}:e.attention_queue,run_history:a?{...e.run_history,goals:r}:e.run_history}}function kp(e,t){let n=e.run_history.goals.filter(e=>e.id!==t),r=e.attention_queue.items.filter(e=>e.goal_id!==t);return n.length===e.run_history.goals.length&&r.length===e.attention_queue.items.length?e:{...e,attention_queue:{...e.attention_queue,items:r},run_history:{...e.run_history,goals:n}}}function Ap(e){return Dp.parse(e)}function jp(e){return e instanceof pu?e.issues.map(e=>`${e.path.join(`.`)||`root`}: ${e.message}`).join(`; `):e instanceof Error?e.message:String(e)}var Mp=Ap(Zd),Np=J({ok:X(!0),schema_version:X(`loopx_workspace_directory_v1`),registry_revision:W(),goals:q(J({id:W(),display_name:W(),activation_state:Y([`active`,`stopped`]),registry_member:X(!0)}))});function Pp(e,t,n={}){if(!e)return{};let r=new Set(n.invalidateGoalIds??[]),i=new Map(e.directory.goals.map(e=>[e.id,e]));return Object.fromEntries(t.goals.flatMap(t=>{let n=i.get(t.id),a=e.snapshots[t.id];return!n||!a||r.has(t.id)||n.display_name!==t.display_name||n.activation_state!==t.activation_state?[]:[[t.id,a]]}))}function Fp(e,t,n){let r=new URL(e,n);r.searchParams.delete(`goal_activation`),r.searchParams.delete(`goal_id`),r.searchParams.delete(`view`);for(let[e,n]of Object.entries(t))r.searchParams.set(e,n);return r.toString()}async function Ip(e,t){let n=await fetch(Fp(e,{view:`workspace-directory`},t),{cache:`no-store`,signal:AbortSignal.timeout(5e3)});if(!n.ok)return null;let r=Np.safeParse(await n.json());return r.success?r.data:null}function Lp(e){return Ap({ok:!0,registry:``,runtime_root:``,goal_count:e.goals.length,run_count:0,local_dashboard_api:{},contract:{ok:!0,summary:{errors:0,warnings:0,checks:0},errors:[],warnings:[]},attention_queue:{available:!1,item_count:0,needs_user_or_controller:0,needs_codex:0,watching_external_evidence:0,items:[]},run_history:{available:!1,goal_count:e.goals.length,run_count:0,goals:e.goals,recent_runs:[]}})}async function Rp(e,t){if(!e.body)return`service`;let n=e.body.getReader(),r=()=>{n.cancel().catch(()=>{})};t.addEventListener(`abort`,r,{once:!0});let i=new Uint8Array(16384),a=0;try{for(t.throwIfAborted();;){let{done:e,value:r}=await n.read();if(t.throwIfAborted(),e)break;if(a+r.byteLength>i.byteLength)return`service`;i.set(r,a),a+=r.byteLength}let e=JSON.parse(new TextDecoder().decode(i.subarray(0,a)));return typeof e==`object`&&e&&!Array.isArray(e)&&`error_code`in e&&e.error_code===`workspace_status_access_denied`?`access`:`service`}catch{return t.throwIfAborted(),`service`}finally{t.removeEventListener(`abort`,r),r(),n.releaseLock()}}async function zp(e,t,n,r,i,a,o){let s=[...n.goals],c=new Map;async function l(){for(;s.length&&i()&&!o?.aborted;){let l=s.findIndex(e=>e.id===a()),u=l>=0?l:s.findIndex(e=>e.activation_state===`active`);if(u<0)return;let d=s.splice(u,1)[0],f=(c.get(d.id)??0)+1;c.set(d.id,f);let p=new AbortController,m=!1,h=()=>p.abort();o?.addEventListener(`abort`,h,{once:!0});let g=setTimeout(()=>{m=!0,p.abort()},3e4),_=null;try{let a=await fetch(Fp(e,{goal_id:d.id},t),{cache:`no-store`,signal:p.signal});if(!a.ok)_=a.status===409?`revision`:a.status>=500?await Rp(a,p.signal):`scope`,p.signal.throwIfAborted();else{let e=await a.json();if(e.workspace_registry_revision!==n.registry_revision)_=`revision`;else{let t=Ap(e);!t.run_history.goals.some(e=>e.id===d.id)||t.run_history.goals.some(e=>e.id!==d.id)?_=`scope`:i()&&!o?.aborted&&r(d.id,t,null)}}}catch(e){_=m?`timeout`:e instanceof TypeError?`network`:`invalid`}finally{clearTimeout(g),o?.removeEventListener(`abort`,h)}if(!i()||o?.aborted)return;_&&[`timeout`,`network`,`service`].includes(_)&&f<3?(await new Promise(e=>setTimeout(e,f*1e3)),s.push(d)):_&&r(d.id,null,_)}}await Promise.all([l(),l()])}var Bp=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Vp=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Hp=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Up=e=>{let t=Hp(e);return t.charAt(0).toUpperCase()+t.slice(1)},Wp={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Gp=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Kp=(0,z.createContext)({}),qp=()=>(0,z.useContext)(Kp),Jp=(0,z.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=qp()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,z.createElement)(`svg`,{ref:c,...Wp,width:t??l??Wp.width,height:t??l??Wp.height,stroke:e??f,strokeWidth:m,className:Bp(`lucide`,p,i),...!a&&!Gp(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,z.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Z=(e,t)=>{let n=(0,z.forwardRef)(({className:n,...r},i)=>(0,z.createElement)(Jp,{ref:i,iconNode:t,className:Bp(`lucide-${Vp(Up(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Up(e),n},Yp=Z(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Xp=Z(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Zp=Z(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Qp=Z(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),$p=Z(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),em=Z(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),tm=Z(`badge-check`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),nm=Z(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),rm=Z(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),im=Z(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),am=Z(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),om=Z(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),sm=Z(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),cm=Z(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),lm=Z(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),um=Z(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),dm=Z(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),fm=Z(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),pm=Z(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),mm=Z(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),hm=Z(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),gm=Z(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),_m=Z(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),vm=Z(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),ym=Z(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),bm=Z(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),xm=Z(`file-check-corner`,[[`path`,{d:`M10.5 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v6`,key:`g5mvt7`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14 20 2 2 4-4`,key:`15kota`}]]),Sm=Z(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Cm=Z(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),wm=Z(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),Tm=Z(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Em=Z(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Dm=Z(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Om=Z(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),km=Z(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),Am=Z(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),jm=Z(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Mm=Z(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Nm=Z(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Pm=Z(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Fm=Z(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Im=Z(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Lm=Z(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Rm=Z(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),zm=Z(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Bm=Z(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Vm=Z(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Hm=Z(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),Um=Z(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Wm=Z(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Gm=Z(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Km=Z(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),qm=Z(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Jm=Z(`server-cog`,[[`path`,{d:`m10.852 14.772-.383.923`,key:`11vil6`}],[`path`,{d:`M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923`,key:`1v3clb`}],[`path`,{d:`m13.148 9.228.383-.923`,key:`t2zzyc`}],[`path`,{d:`m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544`,key:`1bxfiv`}],[`path`,{d:`m14.772 10.852.923-.383`,key:`k9m8cz`}],[`path`,{d:`m14.772 13.148.923.383`,key:`1xvhww`}],[`path`,{d:`M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5`,key:`tn8das`}],[`path`,{d:`M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5`,key:`1g2pve`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M6 6h.01`,key:`1utrut`}],[`path`,{d:`m9.228 10.852-.923-.383`,key:`1wtb30`}],[`path`,{d:`m9.228 13.148-.923.383`,key:`1a830x`}]]),Ym=Z(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Xm=Z(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Zm=Z(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qm=Z(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),$m=Z(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),eh=Z(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),th=Z(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),nh=Z(`test-tube-diagonal`,[[`path`,{d:`M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3`,key:`1ub6xw`}],[`path`,{d:`m16 2 6 6`,key:`1gw87d`}],[`path`,{d:`M12 16H4`,key:`1cjfip`}]]),rh=Z(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),ih=Z(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ah=Z(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),oh=Z(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function sh(e){return/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e)||e.startsWith(`//`)}function ch(e){return[`localhost`,`127.0.0.1`,`::1`,`[::1]`].includes(e)}function lh(e,t,n){let r=e.trim();if(!r)return{error:`status URL is empty`};let i;try{i=new URL(r,t)}catch{return{error:`status URL is invalid`}}let a=!sh(r),o=ch(i.hostname);return!a&&!o?{error:`${n} must be relative or loopback`}:{source:{isLoopback:o,isRelative:a,url:r}}}function uh(e,t){return lh(e,t,`statusUrl`)}function dh(e,t){let n=lh(e,t,`Ops statusUrl`);return n.error?{error:`${n.error}; use showcase mode for public links.`}:n}function fh(e,t,n){let r=new URL(e,n);return r.searchParams.set(`goal_activation`,t),r.toString()}function ph(e,t){if(!t||!e.isLoopback)return null;try{let n=new URL(e.url,window.location.href),r=new URL(t,n.origin);return ch(r.hostname)?r.toString():null}catch{return null}}function mh(e,t){return{detailUrl:ph(t,e.local_dashboard_api?.periodic_report_detail_url),indexUrl:ph(t,e.local_dashboard_api?.periodic_report_index_url)}}async function hh(e,t){let n=new URL(e);n.searchParams.set(`goal_id`,t),n.searchParams.set(`limit`,`100`),n.searchParams.set(`offset`,`0`);let r=await fetch(n,{cache:`no-store`});if(!r.ok)throw Error(`HTTP ${r.status} while loading published reports`);return wp.parse(await r.json()).periodic_reports}async function gh(e,t){let n=new URL(e);Object.entries(t).forEach(([e,t])=>n.searchParams.set(e,t));let r=await fetch(n,{cache:`no-store`});if(!r.ok)throw Error(`HTTP ${r.status} while loading published report detail`);return Ep.parse(await r.json()).projection}function _h(e,t,n){let r=e.find(e=>e.agentId===t&&e.available)??e.find(e=>e.agentId===n&&e.available)??e.find(e=>e.available);if(!r)throw Error(`Chat requires at least one available route`);return r}function vh(e){return e.kind===`todo`}var yh=[{id:`next`,label:`找下一步`,prompt:`结合当前 Goal,告诉我现在最值得推进的一个动作,并说明理由。`},{id:`gate`,label:`看阻塞`,prompt:`当前 Goal 有哪些 Gate 或阻塞?哪些需要我决定?`},{id:`evidence`,label:`查证据`,prompt:`检查当前 Goal 的 Evidence,告诉我哪些结论已经有依据,哪些还需要验证。`}];function bh(e){return!!(e&&typeof e==`object`&&e.session_invalidated===!0)}var xh=``.replace(/\/+$/,``);function Sh(e){return!xh||/^https?:\/\//.test(e)?e:new URL(e,`${xh}/`).toString()}var Ch=J({todo_id:W().nullable(),role:W().nullable(),status:W(),priority:W().nullable(),text:W(),action_kind:W().nullable(),task_class:W().nullable(),claimed_by:W().nullable(),evidence:W().nullable()}),wh=J({goal_id:W(),title:W(),objective:W(),status:W(),waiting_on:W().nullable(),severity:W().nullable(),gate:W(),next_action:W(),top_todo:Ch.nullable(),todos:q(Ch),evidence:q(W()),quota:J({state:W().nullable(),spent_slots:G().nullable(),allowed_slots:G().nullable(),reason:W().nullable()})});J({ok:K(),schema_version:X(`loopx_chat_status_v0`),selected_goal_id:W().nullable(),goal_count:G(),goals:q(wh)});var Th=J({schema_version:W(),executor_endpoint:W(),executor_endpoint_source:W(),executor_endpoint_default_reason:W().optional(),executor_kind:W(),model:W(),model_source:W(),credential_env_var:W(),operator_credential_configured:K(),available:K().nullable(),unavailable_reason:W().nullable()}),Eh=J({ok:X(!0),schema_version:Y([`loopx_chat_capabilities_v0`,`loopx_chat_capabilities_v1`]),agent_backend:W(),sandbox:W(),approval_policy:W(),todo_write:W(),goal_subagent_configuration:W().optional(),goal_id:W().nullable(),manager:J({scope:X(`owner_global`),model:W(),reasoning_effort:W(),channel_binding:Th.optional(),runtime:J({schema_version:X(`manager_runtime_effective_profile_v0`),runtime_profile:Y([`restricted`,`trusted_owner`]),source:W(),configuration_revision:W(),standing_grant:W(),sandbox:W(),approval_policy:W(),tool_classes:q(W()),status:W(),repair:W().optional()})}).optional(),streaming:K().optional(),resume:K().optional(),interrupt:K().optional(),typed_actions:K().optional(),action_kinds:q(W()).optional(),adapters:q(J({agent_id:W(),display_name:W(),adapter_kind:W(),available:K(),streaming:K(),resume:K(),interrupt:K(),location:W().optional(),source:W().optional(),tool_calls:K().optional(),trust_scope:W().optional()})).optional(),lark_cli:J({available:K(),source:W(),version:W().nullable(),error_code:W().nullable()}).optional()}),Dh=J({kind:X(`todo`),text:W(),priority:Y([`P0`,`P1`,`P2`]),rationale:W()}),Oh=pd(`kind`,[Dh,J({kind:X(`steward_team_plan_preview`),preview:yd(W(),ad())})]),kh=J({operation:Y([`merge`,`release`,`deploy`,`delete`,`payment`]),target:W().min(1).max(160),summary:W().max(300)}),Ah=J({schema_version:X(`loopx_chat_agent_response_v0`),message:W(),proposals:q(Oh),protected_action:kh.nullable().optional().default(null),gate:J({kind:W(),summary:W(),next_action:W()}).nullable()}),jh=J({closed:X(!0),ok:X(!0),session_id:W().min(1)});J({dry_run:X(!0),ok:X(!0),preview_id:W().min(1),todo:J({goal_id:W().min(1),text:W(),todo_id:W().optional()})});var Mh=J({schema_version:X(`loopx_chat_todo_receipt_v0`),receipt_id:W().min(1),preview_id:W().min(1),goal_id:W().min(1),todo_id:W().min(1),status:X(`applied`),outcome:Y([`todo_added`,`todo_already_exists`]),already_exists:K(),preview_revision:W().nullable()});J({applied:X(!0),ok:X(!0),receipt:Mh,todo:J({text:W(),todo_id:W()})});var Nh=J({model_config:J({model:W(),reasoning_effort:W().optional()}).optional(),mode:W(),spawn_allowed:K(),max_children:G().int().nonnegative(),allowed_domains:q(W()).optional().default([])}).passthrough(),Ph=J({ok:X(!0),dry_run:K(),execute:K(),written:K(),changed:K(),goal_id:W().min(1),changed_fields:q(W()),before:J({orchestration:Nh}).passthrough(),after:J({orchestration:Nh}).passthrough(),preview_id:W().min(1),feature_summary:J({multi_subagent:Y([`off`,`enabled`])}).passthrough(),global_sync:J({required:K(),executed:K(),readback:J({status:W(),verified:K()}).passthrough()}).passthrough()}),Fh=J({id:W().min(1),outcome:Y([`approved`,`rejected`,`cancelled`]),projectionVerified:K().nullable(),proposal:Dh,receipt:Mh.nullable()}).superRefine((e,t)=>{e.outcome===`approved`&&!e.receipt&&t.addIssue({code:`custom`,message:`approved decision history requires a Todo receipt`,path:[`receipt`]}),e.outcome!==`approved`&&e.receipt&&t.addIssue({code:`custom`,message:`zero-write decision history must not include a Todo receipt`,path:[`receipt`]})});J({schema_version:X(`loopx_chat_decision_history_v0`),goal_id:W().min(1),decisions:q(Fh).max(24)});var Ih=class extends Error{payload;constructor(e,t){super(e),this.payload=t}},Lh=Y([`goal.create`,`goal.update`,`goal.lifecycle`,`todo.create`,`todo.update`,`agent.bind`,`heartbeat.bind`,`monitor.create`,`monitor.update`,`gate.resolve`,`run.correct`,`operation.execute`,`team.plan`]),Rh=J({schema_version:X(`loopx_operation_envelope_v0`),lifecycle_state:Y([`prepared`,`awaiting_confirmation`,`claimed`,`outcome_observed`]),operation_id:W().min(1),confirmation_digest:W().min(1),payload_digest:W().min(1),projection_digest:W().min(1),expires_at:W().min(1),delivery:yd(W(),ad()).nullable(),confirmation:yd(W(),ad()).nullable(),claim:yd(W(),ad()).nullable(),outcome:yd(W(),ad()).nullable(),result_delivery:yd(W(),ad()).nullable().optional()}).passthrough(),zh=J({schema_version:X(`loopx_chat_action_proposal_v1`),proposal_id:W().min(1),action_kind:Lh,summary:W().min(1),normalized_parameters:yd(W(),ad()),context:yd(W(),ad()),expected_state_fingerprint:W().min(1),permission_classification:W().min(1),validation_evidence:q(W().refine(e=>e.trim().length>0,`Validation evidence must be non-blank text`)),available_transitions:q(Y([`apply`,`cancel`,`regenerate`,`reject`,`defer`])),status:Y([`preview_ready`,`applying`,`gated`,`failed`,`rejected`,`deferred`,`cancelled`,`stale`,`applied`]),receipt:yd(W(),ad()).nullable(),stale:yd(W(),ad()).nullable(),gate:yd(W(),ad()).nullable().optional(),error:yd(W(),ad()).nullable().optional(),checkpoint:yd(W(),ad()).nullable().optional(),regenerated_from:W().nullable().optional(),operation:Rh.nullable().optional(),created_at:W(),updated_at:W()}),Bh=J({ok:X(!0),proposal:zh});async function Vh(e){let t=await qh(`/api/actions/preview`,{method:`POST`,body:JSON.stringify({action_kind:e.actionKind,context:e.context,idempotency_key:e.idempotencyKey,normalized_parameters:e.normalizedParameters,summary:e.summary})});return Bh.parse(t).proposal}var Hh=J({ok:X(!0),schema_version:X(`loopx_chat_action_list_v1`),proposals:q(zh)});async function Uh(e={}){let t=new URLSearchParams;e.contextKind&&t.set(`context_kind`,e.contextKind),e.goalId&&t.set(`goal_id`,e.goalId);let n=t.size>0?`?${t.toString()}`:``;return Hh.parse(await qh(`/api/actions${n}`)).proposals}async function Wh(e){let t=await qh(`/api/actions/${encodeURIComponent(e)}/apply`,{method:`POST`,body:`{}`});return J({ok:X(!0),proposal:zh,turn:yd(W(),ad()).nullable().optional()}).parse(t)}async function Gh(e){return Bh.parse(await qh(`/api/actions/${encodeURIComponent(e)}/cancel`,{method:`POST`,body:`{}`})).proposal}async function Kh(e,t){return Bh.parse(await qh(`/api/actions/${encodeURIComponent(e)}/${t}`,{method:`POST`,body:`{}`})).proposal}async function qh(e,t){let n;try{n=await fetch(Sh(e),{cache:`no-store`,...t,headers:{"Content-Type":`application/json`,...t?.headers}})}catch{throw new Ih(`无法连接 LoopX Chat 服务。请确认 Dashboard 与 Chat 服务已启动且来自同一版本。`,{error_code:`chat_api_unavailable`})}let r=await n.text(),i=null;if(r.trim())try{i=JSON.parse(r)}catch{i=null}let a=i&&typeof i==`object`&&!Array.isArray(i)?i:{};if(!n.ok){let e=(a.proposal&&typeof a.proposal==`object`?a.proposal:null)?.status===`stale`?`来源状态已变化,请重新生成预览。`:null,t=n.status>=500?`LoopX Chat 服务暂时不可用(HTTP ${n.status})。请确认 Dashboard 与 Chat 服务已启动且来自同一版本。`:`LoopX Chat 请求失败(HTTP ${n.status})。`;throw new Ih(e??String(a.error||t),Object.keys(a).length?a:{error_code:`chat_api_unavailable`,http_status:n.status})}if(i===null)throw new Ih(`LoopX Chat 服务返回了无法识别的响应(HTTP ${n.status})。请确认 Dashboard 与 Chat 服务来自同一版本。`,{error_code:`invalid_chat_api_response`,http_status:n.status});return i}async function Jh(){return Eh.parse(await qh(`/api/chat/capabilities`))}async function Yh(e){return qh(`/api/chat/projection-messages`,{method:`POST`,body:JSON.stringify({answer:e.answer,context_kind:e.contextKind,goal_id:e.goalId,question:e.question})})}async function Xh(e,t,n=`resume_latest`,r=`goal`){return qh(`/api/chat/sessions`,{method:`POST`,body:JSON.stringify({goal_id:e,agent_id:t,mode:n,context_kind:r})})}async function Zh(e){return qh(`/api/chat/sessions/${e}`)}async function Qh(e){let t=new URLSearchParams;return e.agentId&&t.set(`agent_id`,e.agentId),e.channelId&&t.set(`channel_id`,e.channelId),e.goalId&&t.set(`goal_id`,e.goalId),qh(`/api/chat/sessions?${t.toString()}`)}function $h(e){let t=new Map;for(let n of e)for(let e of n.messages)t.set(e.message_id,e);return[...t.values()].sort((e,t)=>e.created_at.localeCompare(t.created_at)||e.message_id.localeCompare(t.message_id))}async function eg(e){let t=await Qh(e),n=await Promise.all(t.sessions.map(e=>Zh(e.session_id)));return{messages:$h(n),sessions:t.sessions,snapshots:n}}async function tg(e,t,n,r=[]){return qh(`/api/chat/sessions/${e}/turns`,{method:`POST`,body:JSON.stringify({message:t,client_turn_id:n,...r.length?{attachments:r.map(e=>({data_url:e.dataUrl,id:e.id,mime_type:e.mimeType,name:e.name,size:e.size}))}:{}})})}function ng(e){let t=e.split(` `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(` -`);if(!t)return null;try{let e=JSON.parse(t);return!e.kind||!e.payload||typeof e.payload!=`object`?null:{event_id:String(e.event_id??``),sequence:Number(e.sequence??0),kind:String(e.kind),created_at:String(e.created_at??``),payload:e.payload}}catch{return null}}async function ng(e,t,n){let r=``,i=0,a=!1;for(;!a&&i<4;){let o=typeof window>`u`?`http://127.0.0.1`:window.location.origin,s=new URL(xh(e),o);r&&s.searchParams.set(`after`,r);try{let e=await fetch(s,{cache:`no-store`,headers:{Accept:`text/event-stream`},signal:n});if(!e.ok||!e.body)throw new Fh(`SSE HTTP ${e.status}`,{status:e.status});let o=e.body.getReader(),c=new TextDecoder,l=``;for(;;){let{done:e,value:n}=await o.read();l+=c.decode(n,{stream:!e}).replaceAll(`\r +`);if(!t)return null;try{let e=JSON.parse(t);return!e.kind||!e.payload||typeof e.payload!=`object`?null:{event_id:String(e.event_id??``),sequence:Number(e.sequence??0),kind:String(e.kind),created_at:String(e.created_at??``),payload:e.payload}}catch{return null}}async function rg(e,t,n){let r=``,i=0,a=!1;for(;!a&&i<4;){let o=typeof window>`u`?`http://127.0.0.1`:window.location.origin,s=new URL(Sh(e),o);r&&s.searchParams.set(`after`,r);try{let e=await fetch(s,{cache:`no-store`,headers:{Accept:`text/event-stream`},signal:n});if(!e.ok||!e.body)throw new Ih(`SSE HTTP ${e.status}`,{status:e.status});let o=e.body.getReader(),c=new TextDecoder,l=``;for(;;){let{done:e,value:n}=await o.read();l+=c.decode(n,{stream:!e}).replaceAll(`\r `,` `);let i=l.indexOf(` -`);for(;i>=0;){let e=l.slice(0,i);l=l.slice(i+2);let n=tg(e);n&&(n.event_id&&(r=n.event_id),t(n),a=[`turn.completed`,`turn.interrupted`,`turn.failed`].includes(n.kind)),i=l.indexOf(` +`);for(;i>=0;){let e=l.slice(0,i);l=l.slice(i+2);let n=ng(e);n&&(n.event_id&&(r=n.event_id),t(n),a=[`turn.completed`,`turn.interrupted`,`turn.failed`].includes(n.kind)),i=l.indexOf(` -`)}if(e||a)break}i=a?i:i+1}catch(e){if(n?.aborted||(i+=1,i>=4))throw e;await new Promise(e=>globalThis.setTimeout(e,250*2**(i-1)))}}if(!a)throw new Fh(`Agent 事件流连接已断开。`,{reconnect_attempts:i})}async function rg(e,t){return Kh(`/api/chat/sessions/${e}/turns/${t}/interrupt`,{method:`POST`,body:`{}`})}async function ig(e,t,n={}){let r=await eg(e,t,n.clientTurnId??crypto.randomUUID(),n.attachments);return n.onPhase?.(`turn.accepted`,r.turn_id),ag(e,r.turn_id,r.events_url,n)}async function ag(e,t,n,r={}){let i=null,a={failure:null,interrupted:null};try{await ng(n,e=>{r.onPhase?.(e.kind,t),(e.kind===`answer.delta`||e.kind===`assistant.delta`)&&r.onDelta?.(String(e.payload.text??``)),e.kind===`agent.phase`&&r.onActivity?.(String(e.payload.label??`Agent 正在处理`)),e.kind===`turn.completed`&&(i=e.payload.response),e.kind===`turn.failed`&&(a.failure=e.payload),e.kind===`turn.interrupted`&&(a.interrupted=e.payload)},r.signal)}catch(i){throw i instanceof Fh&&!r.signal?.aborted?new Fh(i.message,{...i.payload,events_url:n,reconnectable:!0,session_id:e,turn_id:t}):i}if(a.failure)throw new Fh(String(a.failure.message||`Agent 回合失败。`),a.failure);if(a.interrupted)throw new Fh(`Agent 回合已中断。`,{...a.interrupted,error_code:`turn_interrupted`,session_id:e,turn_id:t});return{response:kh.parse(i),sessionId:e,turnId:t}}async function og(e,t,n={}){return ag(e,t,`/api/chat/sessions/${e}/turns/${t}/events`,n)}async function sg(e){let t=Ah.parse(await Kh(`/api/chat/sessions/${e}`,{keepalive:!0,method:`DELETE`}));if(t.session_id!==e)throw new Fh(`Agent 会话关闭回执与本次请求不一致。`,{session_id:t.session_id});return t}async function cg(e){return Kh(`/api/chat/sessions/${e}/resume`,{method:`POST`,body:`{}`})}function lg(e){return{goal_id:e.goalId,enabled:e.enabled,...e.modelConfig===void 0?{}:{model_config:e.modelConfig},...e.enabled?{max_children:e.maxChildren,allowed_domains:e.allowedDomains}:{}}}function ug(e,t){let n=e.after.orchestration,r=[...new Set(t.allowedDomains)],i=e.feature_summary.multi_subagent===`enabled`;if(!(e.goal_id===t.goalId&&i===t.enabled&&(t.modelConfig===void 0||JSON.stringify(n.model_config??null)===JSON.stringify(t.modelConfig))&&(t.enabled?n.max_children===t.maxChildren&&JSON.stringify(n.allowed_domains)===JSON.stringify(r):n.spawn_allowed===!1&&n.max_children===0)))throw new Fh(`Goal 子代理配置回执与本次请求不一致,界面已停止更新。`,{after:e.after,goal_id:e.goal_id});return e}async function dg(e){let t=Nh.parse(await Kh(`/api/chat/goal-subagents/dry-run`,{method:`POST`,body:JSON.stringify(lg(e))}));if(!t.dry_run||t.execute||t.written)throw new Fh(`Goal 子代理预览返回了非预览回执,已停止进入确认状态。`,{result:t});return ug(t,e)}async function fg(e,t){let n=Nh.parse(await Kh(`/api/chat/goal-subagents/apply`,{method:`POST`,body:JSON.stringify({...lg(e),preview_id:t})}));if(n.preview_id!==t||n.dry_run||!n.execute)throw new Fh(`Goal 子代理写入回执与本次确认不一致,界面已停止更新。`,{result:n});if(n.changed&&(!n.written||!n.global_sync.executed||!n.global_sync.readback.verified))throw new Fh(`Goal 子代理设置未通过共享状态读回验证。`,{result:n});return ug(n,e)}var pg=J({ok:X(!0),targets:q(J({enabled:K(),provider:W(),target_name:W()}))});async function mg(){return pg.parse(await Kh(`/api/chat/goal-channel/targets`)).targets}var hg=J({ok:K(),blocker:W().optional(),public_summary:W().optional(),status:W().optional()});async function gg(e){return hg.parse(await Kh(`/api/chat/goal-channel/setup`,{method:`POST`,body:JSON.stringify({execute:e.execute,goal_id:e.goalId,target:e.target})}))}async function _g(e){return hg.parse(await Kh(`/api/chat/goal-channel/configure`,{method:`POST`,body:JSON.stringify({auto_notify_human_gates:e.autoNotify,goal_id:e.goalId})}))}var vg=J({schema_version:X(`periodic_report_schedule_v0`),schedule_id:W(),rrule:W(),timezone:W()});J({schema_version:X(`periodic_report_machine_defaults_v0`),enabled:K(),inheritance:X(`live_machine_default`),profile_preset:W().optional(),route_ref:W().optional(),timezone:W(),schedule:vg.nullable().optional()});var yg=J({schema_version:X(`loopx_machine_configuration_v0`),namespaces:yd(W(),yd(W(),ad()))}),bg=J({namespace:W(),title:W(),description:W(),schema_versions:q(W()).min(1),configuration_template:yd(W(),ad()),template_status:Y([`ready`,`schema_only`])}),xg=J({schema_version:X(`machine_configuration_catalog_v0`),namespaces:q(bg)}),Sg=J({key:W(),label:W(),description:W(),input_kind:Y([`boolean`,`number`,`select`,`string_list`,`text`,`periodic_report_schedule`]),nullable:K().optional(),required:K(),minimum:G().int().optional(),maximum:G().int().optional(),options:q(W()).optional()}),Cg=J({schema_version:X(`capability_configuration_editor_v0`),editable:K(),supported_scopes:q(Y([`goal`,`machine`])),writable_scopes:q(Y([`goal`,`machine`])),fields:q(Sg),read_only_reason:W().optional()}),wg=J({schema_version:X(`capability_configuration_catalog_v0`),capabilities:q(J({capability_id:W(),display_name:W(),description:W(),available_scopes:q(Y([`goal`,`machine`])),machine_namespace:W().optional(),goal_feature_id:W().optional(),effective_value_policy:X(`goal_override_over_live_machine_default`).optional(),availability:W().optional(),default:yd(W(),ad()).optional(),current:yd(W(),ad()).optional(),machine_current:yd(W(),ad()).optional(),effective_configuration:J({schema_version:X(`capability_configuration_resolution_v0`),capability_id:W(),source:Y([`goal_override`,`machine_default`,`capability_default`,`not_configured`]),configuration:yd(W(),ad()).nullable(),inherited:K(),goal_override_present:K(),machine_default_present:K(),effective_revision:W()}).optional(),documentation:yd(W(),ad()).optional(),context_contribution:J({supported_phases:q(Y([`before_plan`,`before_delegate`,`after_delegate_result`])),target:X(`coordinator`),activation:X(`with_capability`),receipt_required:X(!0)}).optional(),configuration_editor:Cg}))}),Tg=J({ok:X(!0),schema_version:X(`goal_configuration_inspection_v0`),status:X(`configured`),goal_id:W(),revision:W(),available_capabilities:q(W()),capability_catalog:wg}),Eg=J({ok:X(!0),goal_id:W(),capability_id:W(),changed_fields:q(W()),goal_configuration:yd(W(),ad()).nullable(),capability_catalog:wg}),Dg=Eg.extend({schema_version:X(`goal_configuration_update_plan_v0`),status:X(`preview`),action:Y([`create`,`update`,`delete`,`unchanged`]),current_revision:W(),desired_revision:W(),base_revision:W(),plan_revision:W(),writes_required:G().int().nonnegative()}),Og=dd([Eg.extend({schema_version:X(`goal_configuration_transaction_v0`),status:Y([`applied`,`unchanged`]),plan_revision:W(),applied_revision:W(),readback_verified:X(!0)}),J({ok:X(!1),schema_version:X(`goal_configuration_transaction_v0`),status:X(`partial_write`),goal_id:W(),capability_id:W(),plan_revision:W(),applied_revision:W().nullable(),source_written:X(!0),shared_sync_pending:X(!0),readback_verified:K(),changed_fields:q(W()),goal_configuration:yd(W(),ad()).nullable(),capability_catalog:wg,error:W(),recommended_action:W()})]),kg=J({ok:X(!0),available_namespaces:q(W()),namespace_catalog:xg.optional().default({schema_version:`machine_configuration_catalog_v0`,namespaces:[]}),capability_catalog:wg,changed_namespaces:q(W()).optional().default([]),invalid_namespaces:q(W()).optional().default([]),machine_configuration:yg.nullable().optional()}),Ag=kg.extend({schema_version:X(`machine_configuration_inspection_v0`),status:Y([`configured`,`absent`,`invalid`]),revision:W()}),jg=kg.extend({schema_version:X(`machine_configuration_update_plan_v0`),status:X(`preview`),action:Y([`create`,`update`,`delete`,`unchanged`]),current_revision:W(),desired_revision:W(),plan_revision:W(),writes_required:G().int().nonnegative(),machine_configuration:yg.nullable()}),Mg=kg.extend({schema_version:X(`machine_configuration_transaction_v0`),status:Y([`applied`,`unchanged`]),plan_revision:W(),transaction_id:W().nullable(),readback_verified:X(!0),rollback_available:K(),applied_revision:W().optional(),prior_revision:W().optional()}),Ng=kg.extend({schema_version:X(`machine_configuration_rollback_plan_v0`),status:X(`preview`),action:Y([`delete`,`restore`,`unchanged`,`blocked`]),reason:W(),transaction_id:W(),plan_revision:W(),rollback_allowed:K(),writes_required:G().int().nonnegative()}),Pg=kg.extend({schema_version:X(`machine_configuration_rollback_receipt_v0`),status:Y([`rolled_back`,`unchanged`]),transaction_id:W(),plan_revision:W(),rollback_id:W().nullable(),readback_verified:X(!0)}),Fg=J({configured:K(),source:Y([`machine_store`,`service_environment`,`unset`]),env_var:W().optional(),fingerprint:W().nullable().optional(),value:W().nullable().optional(),blocked_by:W().optional()}),Ig=J({ok:X(!0),schema_version:X(`operator_provider_credential_projection_v0`),action:W().optional(),store_ref:W(),store_revision:W(),record_present:K(),status:Y([`configured`,`absent`,`invalid`]),repair:W(),provider_key:Fg,base_url:Fg});async function Lg(){return Ig.parse(await Kh(`/api/chat/operator-credential`))}async function Rg(e){return Ig.parse(await Kh(`/api/chat/operator-credential`,{method:`POST`,body:JSON.stringify(e)}))}async function zg(){return Ag.parse(await Kh(`/api/chat/machine-configuration`))}async function Bg(e){let t=new URLSearchParams({goal_id:e});return Tg.parse(await Kh(`/api/chat/goal-configuration?${t.toString()}`))}async function Vg(e,t,n){return Dg.parse(await Kh(`/api/chat/goal-configuration/preview`,{method:`POST`,body:JSON.stringify({goal_id:e,capability_id:t,configuration:n})}))}async function Hg(e,t,n,r){return Og.parse(await Kh(`/api/chat/goal-configuration/apply`,{method:`POST`,body:JSON.stringify({goal_id:e,capability_id:t,configuration:n,expected_plan_revision:r})}))}async function Ug(e,t){return jg.parse(await Kh(`/api/chat/machine-configuration/preview`,{method:`POST`,body:JSON.stringify({namespace:e,namespace_configuration:t})}))}async function Wg(e,t,n){return Mg.parse(await Kh(`/api/chat/machine-configuration/apply`,{method:`POST`,body:JSON.stringify({expected_plan_revision:n,namespace:e,namespace_configuration:t})}))}async function Gg(e){return jg.parse(await Kh(`/api/chat/machine-configuration/preview`,{method:`POST`,body:JSON.stringify({namespace:e,operation:`remove`})}))}async function Kg(e,t){return Mg.parse(await Kh(`/api/chat/machine-configuration/apply`,{method:`POST`,body:JSON.stringify({expected_plan_revision:t,namespace:e,operation:`remove`})}))}async function qg(e){return Ng.parse(await Kh(`/api/chat/machine-configuration/rollback`,{method:`POST`,body:JSON.stringify({execute:!1,transaction_id:e})}))}async function Jg(e,t){return Pg.parse(await Kh(`/api/chat/machine-configuration/rollback`,{method:`POST`,body:JSON.stringify({execute:!0,expected_plan_revision:t,transaction_id:e})}))}var Yg=J({ok:X(!0),goals:q(J({goal_id:W(),repository:J({branch:W(),identity:W(),label:W(),read_only:X(!0)})}))});async function Xg(){return Yg.parse(await Kh(`/api/chat/goals/contexts`)).goals}var Zg=J({ok:X(!0),apps:q(J({active:K(),app_ref:W(),brand:W(),health_error_code:W().nullable().default(null),label:W(),ready:K(),reply_ready:K().default(!1)}))});async function Qg(){return Zg.parse(await Kh(`/api/chat/lark/apps`)).apps}var $g=J({ok:X(!0),app_ref:W(),error:W().nullable(),setup_id:W(),status:Y([`starting`,`waiting_for_feishu`,`ready`,`failed`,`cancelled`]),verification_url:W().url().nullable()});async function e_(e){return $g.parse(await Kh(`/api/chat/lark/app-setups`,{method:`POST`,body:JSON.stringify({app_ref:e.appRef,brand:e.brand})}))}async function t_(e){return $g.parse(await Kh(`/api/chat/lark/app-setups/${encodeURIComponent(e)}`))}async function n_(e){return $g.parse(await Kh(`/api/chat/lark/app-setups/${encodeURIComponent(e)}`,{method:`DELETE`}))}var r_=[`invalid_event`,`binding_unavailable`,`chat_mismatch`,`topic_mismatch`,`route_ambiguous`,`self_message`,`invalid_routing_state`,`not_addressed`],i_=J({ok:X(!0),chats:q(J({chat_id:W(),chat_name:W()}))});async function a_(e,t){let n=new URLSearchParams({app_ref:e});return t&&n.set(`query`,t),i_.parse(await Kh(`/api/chat/lark/chats?${n.toString()}`)).chats}var o_=J({ok:X(!0),connections:q(J({conversation_kind:Y([`goal`,`manager`]).default(`goal`),agent_id:W().nullable().default(null),connection_id:W(),app_label:W(),app_ref:W(),capture_scope:Y([`addressed_only`,`configured_chat_all`]).default(`addressed_only`),chat_name:W(),enabled:K(),goal_id:W(),goal_title:W(),health_error_code:W().nullable().default(null),history_permission_guidance:J({action:X(`enable_application_scopes_and_publish`),api_document_url:W().url(),capability:X(`group_history_pagination`),identity:X(`bot`),required_scopes:_d([X(`im:message.group_msg`),X(`im:message.group_msg.include_bot:read`)]),schema_version:X(`lark_bot_group_history_permission_guidance_v0`)}).nullable().default(null),incoming_mode:Y([`mentions`,`all`]),ingress_mode:Y([`live_steering`,`session_queue`,`async_inbox`,`direct_session`]).default(`async_inbox`),event_count:G().int().nonnegative().default(0),last_event_reason:Y(r_).nullable().default(null).catch(null),last_event_status:W().nullable().default(null),listener_error_code:W().nullable().default(null),listener_status:Y([`starting`,`listening`,`retrying`,`stopped`]).nullable().default(null),replied_count:G().int().nonnegative().default(0),reply_ready:K().default(!1),reply_mode:X(`topic_reply`),session_bound:K().default(!1),target_ref:W(),topic_name:W(),topic_setup_required:K()}))});async function s_(){return o_.parse(await Kh(`/api/chat/lark/connections`)).connections}async function c_(e){return hg.parse(await Kh(`/api/chat/lark/connections`,{method:`POST`,body:JSON.stringify({...e.agentBindings?{agent_bindings:e.agentBindings.map(e=>({agent_id:e.agentId,app_ref:e.appRef}))}:{},...e.agentId?{agent_id:e.agentId}:{},...e.appRef?{app_ref:e.appRef}:{},...e.connectionId?{connection_id:e.connectionId}:{},conversation_kind:e.conversationKind??`goal`,capture_scope:e.captureScope,chat_id:e.chatId,chat_name:e.chatName,execute:e.execute,goal_id:e.goalId,incoming_mode:e.incomingMode,ingress_mode:e.ingressMode,reply_mode:e.replyMode})}))}async function l_(e,t){let n=new URLSearchParams({goal_id:e,connection_id:t});return hg.parse(await Kh(`/api/chat/lark/connections?${n.toString()}`,{method:`DELETE`}))}function u_(e){return{loadedUrl:null,projectionRevision:0,requestedUrl:e,selectionRevision:0,requestGeneration:0}}function d_(e,t){return e.selectionRevision+=1,e.requestedUrl=t,e.selectionRevision}function f_(e,t,n){if(n.background)return e.requestedUrl!==null||e.loadedUrl!==t?null:(e.requestGeneration+=1,{background:!0,projectionRevision:e.projectionRevision,selectionRevision:e.selectionRevision,url:t,generation:e.requestGeneration});let r=n.selectionRevision??e.selectionRevision+1;return n.selectionRevision!==void 0&&e.selectionRevision!==r?null:(e.selectionRevision=r,e.projectionRevision+=1,e.requestedUrl=t,e.requestGeneration+=1,{background:!1,projectionRevision:e.projectionRevision,selectionRevision:r,url:t,generation:e.requestGeneration})}function p_(e,t){return t.generation===e.requestGeneration&&e.projectionRevision===t.projectionRevision&&e.selectionRevision===t.selectionRevision}function m_(e,t){return p_(e,t)&&(!t.background||e.requestedUrl===null&&e.loadedUrl===t.url)}function h_(e,t,n){return t.get(e)===n}function g_(e,t,n,r){return e.filter(e=>h_(r(e),n,t))}function __(e,t,n){let r=new Set,i=[];for(let a of[...e,...t]){let e=n(a);e==null||r.has(e)||(r.add(e),i.push(a))}return i}var v_=[`runs_24h`,`runs_7d`,`quota_spend_slots_24h`,`quota_spend_slots_7d`,`automation_run_count_24h`,`automation_run_count_7d`,`progress_signal_run_count_24h`,`progress_signal_run_count_7d`],y_=[`input_tokens_24h`,`input_tokens_7d`,`output_tokens_24h`,`output_tokens_7d`,`cache_tokens_24h`,`cache_tokens_7d`,`cost_usd_24h`,`cost_usd_7d`,`duration_ms_24h`,`duration_ms_7d`],b_=[`accounting`,`decision`,`evidence`,`state`,`work`],x_={accounting:0,decision:0,evidence:0,state:0,work:0},S_={runs_24h:0,runs_7d:0,quota_spend_slots_24h:0,quota_spend_slots_7d:0,automation_run_count_24h:0,automation_run_count_7d:0,progress_signal_run_count_24h:0,progress_signal_run_count_7d:0};function C_(e,t){let n={...e};for(let r of v_)n[r]=(Number(e[r])||0)+(Number(t[r])||0);for(let r of y_)(e[r]!==void 0||t[r]!==void 0)&&(n[r]=(e[r]??0)+(t[r]??0));return n}function w_(e,t){return!e.length||t<=0?e:e.map(e=>({...e,project_share_24h:Math.round((Number(e.runs_24h)||0)/t*1e3)/1e3}))}function T_(e,t){let n={...e};for(let r of b_)n[r]=(e[r]??0)+(t[r]??0);return n}function E_(e){let t={events_24h:0,events_7d:0,by_class_24h:{...x_},by_class_7d:{...x_}};for(let n of e)t.events_24h+=n.events_24h,t.events_7d+=n.events_7d,t.by_class_24h=T_(t.by_class_24h,n.by_class_24h),t.by_class_7d=T_(t.by_class_7d,n.by_class_7d);return t}function D_(e,t,n){if(!e&&!t)return null;let r=g_(e?.goals??[],`active`,n,e=>e.goal_id),i=g_(t?.goals??[],`stopped`,n,e=>e.goal_id),a=__(r,i,e=>e.goal_id),o=E_(r),s=E_(i),c={events_24h:o.events_24h+s.events_24h,events_7d:o.events_7d+s.events_7d,by_class_24h:T_(o.by_class_24h,s.by_class_24h),by_class_7d:T_(o.by_class_7d,s.by_class_7d)};return{...e??t,goals:a,sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),totals:c}}function O_(e,t,n){if(!e&&!t)return null;let r=__([...g_(e?.items??[],`active`,n,e=>e.goal_id),...g_(t?.items??[],`stopped`,n,e=>e.goal_id)],[],e=>`${e.goal_id}:${e.decision_kind??``}:${e.decision_at??``}`),i={decision_count:(e?.summary.decision_count??0)+(t?.summary.decision_count??0),stale_count:r.filter(e=>e.stale_by_age).length,rebase_required_count:(e?.summary.rebase_required_count??0)+(t?.summary.rebase_required_count??0),fresh_count:(e?.summary.fresh_count??0)+(t?.summary.fresh_count??0)};return{...e??t,items:r,sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),summary:i}}function k_(e,t){return __([...e,...t].sort((e,t)=>t.generated_at.localeCompare(e.generated_at)),[],e=>`${e.goal_id}:${e.generated_at}:${e.classification??``}`)}function A_(e,t,n){let r=__(g_(e.items,`active`,n,e=>e.goal_id),g_(t.items,`stopped`,n,e=>e.goal_id),e=>e.goal_id);return{...e,item_count:r.length,items:r,needs_controller:r.filter(e=>e.waiting_on===`controller`).length,needs_codex:r.filter(e=>e.waiting_on===`codex`).length,needs_user_or_controller:r.filter(e=>[`user_or_controller`,`controller`].includes(e.waiting_on)).length,watching_external_evidence:r.filter(e=>e.waiting_on===`external_evidence`).length}}function j_(e){let t=e.todo_id?.trim()||``;return t?`${e.goal_id}:${t}`:`${e.goal_id}:synthetic:${e.role??``}:${e.index??``}:${e.text??``}`}function M_(e){let t={...S_};for(let n of e){for(let e of v_)t[e]+=Number(n[e])||0;for(let e of y_)n[e]!==void 0&&(t[e]=(t[e]??0)+n[e])}return t}function N_(e,t,n){if(!e&&!t)return null;let r=g_(e?.items??[],`active`,n,e=>e.goal_id),i=g_(t?.items??[],`stopped`,n,e=>e.goal_id),a=__(r,i,j_);return{...e??t,current_projected_count:r.length+i.length,items:a,rollout_event_count:a.reduce((e,t)=>e+(t.event_count??0),0),total_count:a.length}}function P_(e,t,n){if(!e&&!t)return null;let r=g_(e?.goals??[],`active`,n,e=>e.goal_id),i=g_(t?.goals??[],`stopped`,n,e=>e.goal_id),a=__(r,i,e=>e.goal_id),o=C_(M_(r),M_(i));return{...e??t,goals:w_(a,Number(o.runs_24h)||0),sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),totals:o}}function F_(e,t,n){if(!e&&!t)return null;let r=(e?.agents??[]).filter(e=>e.goal_ids.some(e=>h_(e,n,`active`))||(e.current_todo?.goal_id?h_(e.current_todo.goal_id,n,`active`):!1)),i=(t?.agents??[]).filter(e=>e.goal_ids.some(e=>h_(e,n,`stopped`))||(e.current_todo?.goal_id?h_(e.current_todo.goal_id,n,`stopped`):!1)),a=__(r,i,e=>e.agent_id).map(e=>{let t=i.find(t=>t.agent_id===e.agent_id);return t?{...e,goal_ids:Array.from(new Set([...e.goal_ids??[],...t.goal_ids]))}:e});return{...e??t,agents:a,source_summary:(e??t)?.source_summary?{...(e??t).source_summary,projected_agent_count:a.length,registered_agent_count:new Set(a.map(e=>e.agent_id)).size}:(e??t)?.source_summary}}function I_(e,t,n){if(!e&&!t)return null;let r=__(g_(e?.goals??[],`active`,n,e=>e.goal_id),g_(t?.goals??[],`stopped`,n,e=>e.goal_id),e=>e.goal_id);return{...e??t,goals:r}}function L_(e,t){let n=t.goal_projection?.scope;if(n!==`active`&&n!==`stopped`)return t;let r=n,i=t.run_history.goals,a=e.run_history.goals,o=__(r===`active`?i:a.filter(e=>e.activation_state!==`stopped`),r===`stopped`?i:a.filter(e=>e.activation_state===`stopped`),e=>e.id),s=new Map(o.map(e=>[e.id,e.activation_state])),c=r===`active`?t:e,l=r===`stopped`?t:e,u=e.goal_projection?.registry_revision??null,d=t.goal_projection?.registry_revision??null,f=u===null||d===null||u===d;return{...e,agent_management_projection:F_(c.agent_management_projection,l.agent_management_projection,s),attention_queue:A_(c.attention_queue,l.attention_queue,s),decision_freshness_summary:O_(c.decision_freshness_summary,l.decision_freshness_summary,s),event_ledger_summary:D_(c.event_ledger_summary,l.event_ledger_summary,s),goal_channel_notification_projection:I_(c.goal_channel_notification_projection,l.goal_channel_notification_projection,s),goal_projection:{schema_version:`loopx_goal_projection_scope_v0`,...t.goal_projection,complete:f,projected_goal_count:o.length,registry_goal_count:t.goal_projection?.registry_goal_count??0,scope:`all`},run_history:{...e.run_history,goal_count:o.length,goals:o,recent_runs:k_(c.run_history.recent_runs,l.run_history.recent_runs),run_count:c.run_history.run_count+l.run_history.run_count},todo_index:N_(c.todo_index,l.todo_index,s),usage_summary:P_(c.usage_summary,l.usage_summary,s)}}function R_(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,V_=z_,H_=(e,t)=>n=>{if(t?.variants==null)return V_(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=B_(t)||B_(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return V_(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},U_=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t({classGroupId:e,validator:t}),G_=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),K_=`-`,q_=[],J_=`arbitrary..`,Y_=e=>{let t=Q_(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Z_(e);let n=e.split(K_);return X_(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?U_(i,t):t:i||q_}return n[e]||q_}}},X_=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=X_(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(K_):e.slice(t).join(K_),s=a.length;for(let e=0;ee.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?J_+r:void 0})(),Q_=e=>{let{theme:t,classGroups:n}=e;return $_(n,t)},$_=(e,t)=>{let n=G_();for(let r in e){let i=e[r];ev(i,n,r,t)}return n},ev=(e,t,n,r)=>{let i=e.length;for(let a=0;a{if(typeof e==`string`){nv(e,t,n);return}if(typeof e==`function`){rv(e,t,n,r);return}iv(e,t,n,r)},nv=(e,t,n)=>{let r=e===``?t:av(t,e);r.classGroupId=n},rv=(e,t,n,r)=>{if(ov(e)){ev(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(W_(n,e))},iv=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e{let n=e,r=t.split(K_),i=r.length;for(let e=0;e`isThemeGetter`in e&&e.isThemeGetter===!0,sv=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},cv=`!`,lv=`:`,uv=[],dv=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),fv=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;si?a-i:void 0;return dv(t,l,c,u)};if(t){let e=t+lv,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):dv(uv,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},pv=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},mv=e=>({cache:sv(e.cacheSize),parseClassName:fv(e),sortModifiers:pv(e),postfixLookupClassGroupIds:hv(e),...Y_(e)}),hv=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(gv),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+cv:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e0?` `+l:l)}return l},vv=(...e)=>{let t=0,n,r,i=``;for(;t{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r{let n,r,i,a,o=o=>(n=mv(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=_v(e,n);return i(e,a),a};return a=o,(...e)=>a(vv(...e))},xv=[],Sv=e=>{let t=t=>t[e]||xv;return t.isThemeGetter=!0,t},Cv=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,wv=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Tv=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ev=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Dv=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ov=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,kv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Av=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,jv=e=>Tv.test(e),Mv=e=>!!e&&!Number.isNaN(Number(e)),Nv=e=>!!e&&Number.isInteger(Number(e)),Pv=e=>e.endsWith(`%`)&&Mv(e.slice(0,-1)),Fv=e=>Ev.test(e),Iv=()=>!0,Lv=e=>Dv.test(e)&&!Ov.test(e),Rv=()=>!1,zv=e=>kv.test(e),Bv=e=>Av.test(e),Vv=e=>!Q(e)&&!$(e),Hv=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Uv=e=>iy(e,cy,Rv),Q=e=>Cv.test(e),Wv=e=>iy(e,ly,Lv),Gv=e=>iy(e,uy,Mv),Kv=e=>iy(e,fy,Iv),qv=e=>iy(e,dy,Rv),Jv=e=>iy(e,oy,Rv),Yv=e=>iy(e,sy,Bv),Xv=e=>iy(e,py,zv),$=e=>wv.test(e),Zv=e=>ay(e,ly),Qv=e=>ay(e,dy),$v=e=>ay(e,oy),ey=e=>ay(e,cy),ty=e=>ay(e,sy),ny=e=>ay(e,py,!0),ry=e=>ay(e,fy,!0),iy=(e,t,n)=>{let r=Cv.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ay=(e,t,n=!1)=>{let r=wv.exec(e);return r?r[1]?t(r[1]):n:!1},oy=e=>e===`position`||e===`percentage`,sy=e=>e===`image`||e===`url`,cy=e=>e===`length`||e===`size`||e===`bg-size`,ly=e=>e===`length`,uy=e=>e===`number`,dy=e=>e===`family-name`,fy=e=>e===`number`||e===`weight`,py=e=>e===`shadow`,my=bv(()=>{let e=Sv(`color`),t=Sv(`font`),n=Sv(`text`),r=Sv(`font-weight`),i=Sv(`tracking`),a=Sv(`leading`),o=Sv(`breakpoint`),s=Sv(`container`),c=Sv(`spacing`),l=Sv(`radius`),u=Sv(`shadow`),d=Sv(`inset-shadow`),f=Sv(`text-shadow`),p=Sv(`drop-shadow`),m=Sv(`blur`),h=Sv(`perspective`),g=Sv(`aspect`),_=Sv(`ease`),v=Sv(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),$,Q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$,Q,c],T=()=>[jv,`full`,`auto`,...w()],E=()=>[Nv,`none`,`subgrid`,$,Q],D=()=>[`auto`,{span:[`full`,Nv,$,Q]},Nv,$,Q],O=()=>[Nv,`auto`,$,Q],k=()=>[`auto`,`min`,`max`,`fr`,$,Q],ee=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],te=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],A=()=>[`auto`,...w()],j=()=>[jv,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],M=()=>[jv,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ne=()=>[jv,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],N=()=>[e,$,Q],P=()=>[...b(),$v,Jv,{position:[$,Q]}],re=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ie=()=>[`auto`,`cover`,`contain`,ey,Uv,{size:[$,Q]}],ae=()=>[Pv,Zv,Wv],F=()=>[``,`none`,`full`,l,$,Q],oe=()=>[``,Mv,Zv,Wv],I=()=>[`solid`,`dashed`,`dotted`,`double`],se=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],L=()=>[Mv,Pv,$v,Jv],ce=()=>[``,`none`,m,$,Q],le=()=>[`none`,Mv,$,Q],ue=()=>[`none`,Mv,$,Q],de=()=>[Mv,$,Q],fe=()=>[jv,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Fv],breakpoint:[Fv],color:[Iv],container:[Fv],"drop-shadow":[Fv],ease:[`in`,`out`,`in-out`],font:[Vv],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Fv],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Fv],shadow:[Fv],spacing:[`px`,Mv],text:[Fv],"text-shadow":[Fv],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,jv,Q,$,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,$,Q]}],"container-named":[Hv],columns:[{columns:[Mv,Q,$,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Nv,`auto`,$,Q]}],basis:[{basis:[jv,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Mv,jv,`auto`,`initial`,`none`,Q]}],grow:[{grow:[``,Mv,$,Q]}],shrink:[{shrink:[``,Mv,$,Q]}],order:[{order:[Nv,`first`,`last`,`none`,$,Q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ee(),`normal`]}],"justify-items":[{"justify-items":[...te(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...te()]}],"align-content":[{content:[`normal`,...ee()]}],"align-items":[{items:[...te(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...te(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...te(),`baseline`]}],"place-self":[{"place-self":[`auto`,...te()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:j()}],"inline-size":[{inline:[`auto`,...M()]}],"min-inline-size":[{"min-inline":[`auto`,...M()]}],"max-inline-size":[{"max-inline":[`none`,...M()]}],"block-size":[{block:[`auto`,...ne()]}],"min-block-size":[{"min-block":[`auto`,...ne()]}],"max-block-size":[{"max-block":[`none`,...ne()]}],w:[{w:[s,`screen`,...j()]}],"min-w":[{"min-w":[s,`screen`,`none`,...j()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...j()]}],h:[{h:[`screen`,`lh`,...j()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...j()]}],"max-h":[{"max-h":[`screen`,`lh`,...j()]}],"font-size":[{text:[`base`,n,Zv,Wv]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,ry,Kv]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Pv,Q]}],"font-family":[{font:[Qv,qv,t]}],"font-features":[{"font-features":[Q]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,$,Q]}],"line-clamp":[{"line-clamp":[Mv,`none`,$,Gv]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$,Q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$,Q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...I(),`wavy`]}],"text-decoration-thickness":[{decoration:[Mv,`from-font`,`auto`,$,Wv]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[Mv,`auto`,$,Q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Nv,$,Q]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$,Q]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,$,Q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:re()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Nv,$,Q],radial:[``,$,Q],conic:[Nv,$,Q]},ty,Yv]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:ae()}],"gradient-via-pos":[{via:ae()}],"gradient-to-pos":[{to:ae()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...I(),`hidden`,`none`]}],"divide-style":[{divide:[...I(),`hidden`,`none`]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...I(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Mv,$,Q]}],"outline-w":[{outline:[``,Mv,Zv,Wv]}],"outline-color":[{outline:N()}],shadow:[{shadow:[``,`none`,u,ny,Xv]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":[`none`,d,ny,Xv]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:oe()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[Mv,Wv]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":[`none`,f,ny,Xv]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[Mv,$,Q]}],"mix-blend":[{"mix-blend":[...se(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Mv]}],"mask-image-linear-from-pos":[{"mask-linear-from":L()}],"mask-image-linear-to-pos":[{"mask-linear-to":L()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":L()}],"mask-image-t-to-pos":[{"mask-t-to":L()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":L()}],"mask-image-r-to-pos":[{"mask-r-to":L()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":L()}],"mask-image-b-to-pos":[{"mask-b-to":L()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":L()}],"mask-image-l-to-pos":[{"mask-l-to":L()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":L()}],"mask-image-x-to-pos":[{"mask-x-to":L()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":L()}],"mask-image-y-to-pos":[{"mask-y-to":L()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[$,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":L()}],"mask-image-radial-to-pos":[{"mask-radial-to":L()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Mv]}],"mask-image-conic-from-pos":[{"mask-conic-from":L()}],"mask-image-conic-to-pos":[{"mask-conic-to":L()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:re()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,$,Q]}],filter:[{filter:[``,`none`,$,Q]}],blur:[{blur:ce()}],brightness:[{brightness:[Mv,$,Q]}],contrast:[{contrast:[Mv,$,Q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,ny,Xv]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:[``,Mv,$,Q]}],"hue-rotate":[{"hue-rotate":[Mv,$,Q]}],invert:[{invert:[``,Mv,$,Q]}],saturate:[{saturate:[Mv,$,Q]}],sepia:[{sepia:[``,Mv,$,Q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$,Q]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[Mv,$,Q]}],"backdrop-contrast":[{"backdrop-contrast":[Mv,$,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Mv,$,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Mv,$,Q]}],"backdrop-invert":[{"backdrop-invert":[``,Mv,$,Q]}],"backdrop-opacity":[{"backdrop-opacity":[Mv,$,Q]}],"backdrop-saturate":[{"backdrop-saturate":[Mv,$,Q]}],"backdrop-sepia":[{"backdrop-sepia":[``,Mv,$,Q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,$,Q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Mv,`initial`,$,Q]}],ease:[{ease:[`linear`,`initial`,_,$,Q]}],delay:[{delay:[Mv,$,Q]}],animate:[{animate:[`none`,v,$,Q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$,Q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":[`scale-3d`],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[$,Q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:fe()}],"translate-x":[{"translate-x":fe()}],"translate-y":[{"translate-y":fe()}],"translate-z":[{"translate-z":fe()}],"translate-none":[`translate-none`],zoom:[{zoom:[Nv,$,Q]}],accent:[{accent:N()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,$,Q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":N()}],"scrollbar-track-color":[{"scrollbar-track":N()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,$,Q]}],fill:[{fill:[`none`,...N()]}],"stroke-w":[{stroke:[Mv,Zv,Wv,Gv]}],stroke:[{stroke:[`none`,...N()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function hy(...e){return my(z_(e))}var gy=H_(`inline-flex h-9 shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md border px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 disabled:pointer-events-none disabled:opacity-50 dark:focus-visible:ring-zinc-500`,{variants:{variant:{primary:`border-slate-900 bg-slate-950 text-white hover:bg-slate-800 dark:border-zinc-100 dark:bg-zinc-50 dark:text-zinc-950 dark:hover:bg-zinc-200`,secondary:`border-slate-200 bg-white text-slate-900 hover:bg-slate-50 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-100 dark:hover:bg-zinc-900`,ghost:`border-transparent bg-transparent text-slate-700 hover:bg-slate-100 dark:text-zinc-300 dark:hover:bg-zinc-900`},size:{sm:`h-8 px-2 text-xs`,md:`h-9 px-3 text-sm`,icon:`h-9 w-9 px-0`}},defaultVariants:{variant:`secondary`,size:`md`}});function _y({className:e,variant:t,size:n,...r}){return(0,B.jsx)(`button`,{className:hy(gy({variant:t,size:n}),e),type:`button`,...r})}function vy({className:e,...t}){return(0,B.jsx)(`section`,{className:hy(`rounded-lg border border-slate-200/80 bg-white/95 text-slate-950 shadow-[0_1px_2px_rgba(15,23,42,0.04)] dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50`,e),...t})}function yy({className:e,...t}){return(0,B.jsx)(`div`,{className:hy(`p-4 pt-0`,e),...t})}var by=[`codex`,`claude`,`kiro`,`trae`,`coco`,`openai`,`anthropic`],xy=new Set([`acp`,`status_projection`]);function Sy(e){let t=e.trim().toLowerCase().replace(/_/gu,`-`);for(let e of by)if(t===e||t.startsWith(`${e}-`))return e;return t}function Cy(e,t){let n=t?.trim().toLowerCase()??``;return n.length>0&&!xy.has(n)?Sy(n):Sy(e)}var wy={stop:`ready_stop`,resume:`resume_review`,delete:`delete_review`};function Ty(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function Ey(e){return typeof e==`string`&&e.trim().length>0?e:null}function Dy(e,t=240){let n=typeof e==`string`?e.replace(/\s+/g,` `).trim():``;return n.length>t?`${n.slice(0,t-1)}…`:n}function Oy(e){let t=Ty(e)??{},n=Dy(t.agent_id,80)||`unknown-agent`,r=Dy(t.acceptance,200);if(t.staffing===`gap`){let e=Ty(t.declined_first_todo)??{};return[`${n} · gap`,Dy(t.gap_reason_code,80),Dy(e.text,200)].filter(Boolean).join(` · `)}let i=Ty(t.first_todo)??{};return[`${n} · ready`,Dy(i.priority,8),Dy(i.action_kind,40),Dy(i.text,240),r?`acceptance: ${r}`:``].filter(Boolean).join(` · `)}function ky(e){let t=Ty(e)??{};return Object.entries(t).map(([e,t])=>`${e}: ${typeof t==`object`&&t?JSON.stringify(t):String(t)}`).join(` · `)}function Ay(e){let t=Ty(e);if(t?.action_kind!==`team.plan`||t.status!==`preview_ready`&&t.status!==`deferred`)return;let n=Ty(Ty(t.normalized_parameters)?.plan);if(!n||n.kind!==`steward_team_plan_preview`||n.applies!==!1)return;let r=Ey(t.proposal_id),i=Ey(t.expected_state_fingerprint),a=Ey(n.goal_id);if(!r||!i||!a)return;let o=Array.isArray(n.lanes)?n.lanes:[],s=Array.isArray(n.gaps)?n.gaps:[],c=[{key:`goal`,value:a},{key:`objective`,value:Dy(n.objective)},...o.map((e,t)=>({key:`lane_${t+1}`,value:Oy(e)})),...s.length>0?[{key:`lane_gaps`,value:s.map(e=>{let t=Ty(e)??{};return[Dy(t.lane_id,80),Dy(t.reason_code,80)].filter(Boolean).join(`: `)}).filter(Boolean).join(` · `)}]:[],{key:`quota_envelope`,value:ky(n.quota_envelope)},{key:`stop_condition`,value:Dy(n.stop_condition)}].filter(e=>e.value.length>0);return{schemaVersion:`review_card_frame_v0`,actionKind:`team.plan`,proposalId:r,stateFingerprint:i,kind:`confirmation`,attentionKind:`authority`,interactionMode:`confirm_reject`,decisions:[`confirm`,`reject`],titleKey:`team_plan_preview`,subtitleKey:`preview_only_no_lane_exists`,confirmLabelKey:`confirm_team_plan`,rejectLabelKey:`reject_team_plan`,warningKey:`confirming_creates_each_ready_lane_first_todo`,focus:`${a} · ${o.length} lane${o.length===1?``:`s`}`,fields:c}}function jy(e){let t=Ty(e.projection);if(t?.schema_version!==`loopx_operation_projection_v0`)return null;let n=Ey(t.title),r=Ey(t.subtitle),i=Ey(t.focus),a=Ey(t.warning);if(!n||!r||!i||!a||!Array.isArray(t.fields))return null;let o=[];for(let e of t.fields){let t=Ty(e),n=Ey(t?.label),r=Ey(t?.value);if(!n||!r)return null;o.push({label:n,value:r})}return{title:n,subtitle:r,focus:i,fields:o,warning:a}}function My(e){let t=Ty(e);if(t?.action_kind!==`operation.execute`)return;let n=Ty(t.normalized_parameters),r=Ty(t.operation);if(!n||r?.schema_version!==`loopx_operation_envelope_v0`)return;let i=Ey(r.operation_id),a=Ey(r.confirmation_digest),o=Ey(r.expires_at),s=jy(n);if(!i||!a||!o||!s||i!==t.proposal_id)return;let c=r.lifecycle_state;if(c!==`awaiting_confirmation`&&c!==`claimed`&&c!==`outcome_observed`)return;let l={schemaVersion:`operation_review_frame_v0`,operationId:i,confirmationDigest:a,lifecycleState:c,simulated:Ty(n.projection).simulated===!0,expiresAt:o,content:s};if(c===`awaiting_confirmation`)return{...l,kind:`confirmation`,attentionKind:`authority`,interactionMode:`confirm_reject`,decisions:[`confirm`,`reject`]};if(c===`claimed`)return{...l,kind:`pending`,attentionKind:`progress`,interactionMode:`inform`};let u=Ty(r.outcome);if(!u)return;let d=u.outcome===`rejected_by_operator`,f=u.simulation===!0||l.simulated;return{...l,kind:`result`,attentionKind:`progress`,interactionMode:`inform`,resultKind:d?`rejected`:f?`simulation_completed`:`completed`,resultDeliveryVerified:Ty(r.result_delivery)!==null,summary:Ey(u.summary)??``}}function Ny(e){let t=Ty(e)??{},n={schemaVersion:`action_review_plan_v0`,proposalId:typeof t.proposal_id==`string`?t.proposal_id:``,sourceFingerprint:typeof t.expected_state_fingerprint==`string`?t.expected_state_fingerprint:``},r=My(t),i=Ay(t),a=e=>({...n,...e,...r?{operationFrame:r}:{},...i?{reviewCardFrame:i}:{}}),o=(e,t)=>a({interaction:e,reason:t,canApply:!1}),s=t.action_kind===`goal.lifecycle`;if(s&&t.gate!=null||t.status===`gated`)return o(`gated`,`authority_gate`);if(s&&t.stale!=null||t.status===`stale`)return o(`refresh`,`stale_proposal`);if(t.status===`applied`)return Ty(t.receipt)?.projection_verified===!0&&(t.action_kind!==`operation.execute`||Ty(Ty(t.operation)?.result_delivery)!==null)?o(`completed`,`readback_verified`):o(`repair`,`readback_unverified`);if(t.status===`applying`)return o(`pending`,`apply_pending`);if(t.status===`failed`||t.error!=null)return o(`repair`,`apply_failed`);if(t.status!==`preview_ready`&&t.status!==`deferred`)return o(`inactive`,`inactive_proposal`);let c=(e,t=!0)=>a({interaction:`review`,reason:e,canApply:t});if(t.action_kind!==`goal.lifecycle`)return c(t.permission_classification===`protected`?`protected_action`:`action_review`);let l=t.validation_evidence,u=t.available_transitions;if(!(Ey(t.proposal_id)!==null&&Ey(t.expected_state_fingerprint)!==null&&Array.isArray(l)&&l.length>0&&l.every(e=>Ey(e)!==null)&&Array.isArray(u)&&u.includes(`apply`)))return o(`refresh`,`incomplete_proposal`);let d=Ty(t.normalized_parameters),f=Ty(t.context),p=d?.operation,m=Ey(d?.goal_id);if(!m||f?.goal_id!=null&&f.goal_id!==m)return o(`refresh`,`incomplete_proposal`);if(p!==`stop`&&p!==`resume`&&p!==`delete`)return c(`unknown_action`,!1);if(t.permission_classification===`protected`)return c(`protected_action`);if(t.permission_classification!==`durable_write`)return c(`unknown_permission`,!1);let h=wy[p];return h===`ready_stop`&&t.status===`preview_ready`?a({interaction:`direct`,reason:h,canApply:!0}):c(h===`ready_stop`?`action_review`:h)}function Py(e){return e.error_code===`action_stale`||e.error_code===`action_conflict`||Ty(e.proposal)?.status===`stale`}function Fy(e){return typeof e==`object`&&e?e:{}}function Iy(e){return typeof e==`string`?e:``}function Ly(e,t){let n=Fy(e.plan),r=[],i=Iy(e.goal_id)||Iy(n.goal_id);i&&r.push({key:`goal_id`,label:t(`proposal.field.goalId`),value:i});let a=Iy(n.objective);a&&r.push({key:`objective`,label:t(`proposal.field.objective`),value:a}),(Array.isArray(n.lanes)?n.lanes:[]).forEach((e,n)=>{let i=Fy(e),a=Iy(i.lane_id)||`lane-${n+1}`,o=Iy(i.agent_id),s=Iy(i.acceptance);if(Iy(i.staffing)===`gap`){let e=Fy(i.declined_first_todo);r.push({key:`lane_${a}`,label:o||a,value:[t(`proposal.teamPlan.gapLane`),Hy(Iy(i.gap_reason_code),t),Iy(e.text)].filter(Boolean).join(` · `)});return}let c=Fy(i.first_todo),l=[Iy(c.priority),Iy(c.action_kind),Iy(c.text)].filter(Boolean).join(` · `);r.push({key:`lane_${a}`,label:o||a,value:[l||t(`proposal.teamPlan.laneUnstaffed`),s?`${t(`proposal.teamPlan.acceptanceShort`)}: ${s}`:``].filter(Boolean).join(` · `)})});let o=Fy(n.quota_envelope),s=Object.entries(o);s.length>0&&r.push({key:`quota_envelope`,label:t(`proposal.field.quotaEnvelope`),value:s.map(([e,t])=>`${e}: ${String(t??``)}`).join(` · `)+` · ${t(`proposal.teamPlan.advisory`)}`});let c=Iy(n.stop_condition);return c&&r.push({key:`stop_condition`,label:t(`proposal.field.stopCondition`),value:`${c} · ${t(`proposal.teamPlan.advisory`)}`}),r}function Ry(e){let t=Fy(e.plan);return Array.isArray(t.lanes)?t.lanes.length:0}function zy(e){let t=Fy(e.plan);return Iy(e.goal_id)||Iy(t.goal_id)}function By(e,t){let n=Fy(e),r=Fy(t.plan),i=(Array.isArray(r.lanes)?r.lanes:[]).map(Fy);return(Array.isArray(n.lanes)?n.lanes:[]).map(e=>{let t=Fy(e),n=Iy(t.lane_id),r=i.find(e=>e.lane_id===n);return{laneId:n,agentId:Iy(t.agent_id),task:Iy(Fy(r?.first_todo).text)||n}}).filter(e=>e.laneId.length>0)}function Vy(e,t={}){let n=Fy(e),r=Fy(t.plan),i=(Array.isArray(r.lanes)?r.lanes:[]).map(Fy);return(Array.isArray(n.gap_lanes)?n.gap_lanes:[]).map(e=>{let t=Fy(e);return{laneId:Iy(t.lane_id),agentId:Iy(t.agent_id),reasonCode:Iy(t.reason_code),task:Iy(Fy(i.find(e=>e.lane_id===t.lane_id)?.declined_first_todo).text)}}).filter(e=>e.laneId.length>0)}function Hy(e,t){return e===`agent_not_registered`?t(`proposal.teamPlan.gapReason.agentNotRegistered`):e===`action_kind_not_supported`?t(`proposal.teamPlan.gapReason.actionKindNotSupported`):e===`capability_not_granted`?t(`proposal.teamPlan.gapReason.capabilityNotGranted`):e===`audience_not_authorized`?t(`proposal.teamPlan.gapReason.audienceNotAuthorized`):e}function Uy(e){let t=Fy(e),n=Iy(t.outcome),r=Array.isArray(t.lanes)?t.lanes.length:0,i=typeof t.gap_count==`number`?t.gap_count:0;return n===`team_plan_partially_applied`?{kind:`partially_applied`,created:r,gaps:i}:n===`team_plan_lanes_already_present`||n===`team_plan_commit_recovered`?{kind:`already_present`,created:r,gaps:i}:n===`team_plan_applied`?{kind:`applied`,created:r,gaps:i}:null}function Wy(e,t){return e?.kind===`partially_applied`?t(`proposal.teamPlan.appliedPartially`,{created:String(e.created),gaps:String(e.gaps)}):e?.kind===`already_present`?t(`proposal.teamPlan.appliedAlreadyPresent`):t(e?.kind===`applied`?`proposal.teamPlan.applied`:`drawer.proposalApplied`,{count:e?.created??0})}function Gy(e){return{blockingTodoCount:e.blockingTodoCount,goalNotifications:e.goalNotifications,goals:e.goals,openUserTodoCount:e.openUserTodoCount,systemHealth:e.systemHealth,attentionHistory:e.attentionHistory,userTodos:e.userTodos,workers:e.workers}}function Ky(e,t){return e.goals.find(e=>e.goalId===t)?.title??t}function qy(e){return e.activationState===`stopped`||e.state===`已停止`?`stopped`:e.state===`已完成`?`history`:e.needsYou||e.state===`等你`?`needs_you`:e.state===`推进中`||e.state===`需修复`?`running`:e.state===`安静运行`?`observing`:`scheduled`}function Jy(e){let t=e;return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Yy(e){return`$${e.toFixed(2)}`}function Xy(e){let t=e;return t>=36e5?`${(t/36e5).toFixed(1)}h`:t>=6e4?`${(t/6e4).toFixed(1)}m`:t>=1e3?`${Math.round(t/1e3)}s`:`${t}ms`}function Zy(e,t,n){return e==null?t:n(e)}function Qy(e){return!!(e&&[e.tokens24h,e.tokens7d,e.costUsd24h,e.costUsd7d,e.durationMs24h,e.durationMs7d].some(e=>e!=null))}function $y(e,t){if(!Qy(e))return null;let n=(e,n,r,i)=>{let a=[n==null?null:`${Jy(n)} ${t.tokens}`,r==null?null:`${t.cost}: ${Yy(r)}`,i==null?null:`${t.duration}: ${Xy(i)}`].filter(e=>e!==null);return a.length?`${e} ${a.join(` · `)}`:null};return n(t.period7d,e.tokens7d,e.costUsd7d,e.durationMs7d)??n(t.period24h,e.tokens24h,e.costUsd24h,e.durationMs24h)}function eb({ariaLabel:e,className:t,icon:n,onChange:r,options:i,prefixLabel:a,value:o}){let s=(0,z.useId)(),c=(0,z.useRef)(null),l=(0,z.useRef)(null),u=(0,z.useRef)(new Map),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(o),h=i.find(e=>e.value===o)??i[0],g=i.filter(e=>!e.disabled);(0,z.useEffect)(()=>{if(!d)return;let e=e=>{c.current?.contains(e.target)||f(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[d]),(0,z.useEffect)(()=>{d&&u.current.get(p)?.focus()},[p,d]);function _(e){m(e)}function v(e=`selected`){let t=e===`last`?g.at(-1):g[0],n=e===`selected`&&h&&!h.disabled?h:t;n&&(f(!0),_(n.value))}function y({restoreFocus:e=!1}={}){f(!1),e&&l.current?.focus()}function b(e){e.disabled||(r(e.value),y({restoreFocus:!0}))}function x(e){if(!g.length)return;let t=g.findIndex(e=>e.value===p),n=t<0?0:(t+e+g.length)%g.length;_(g[n].value)}function S(e){e.key===`ArrowDown`||e.key===`Enter`||e.key===` `?(e.preventDefault(),v(`selected`)):e.key===`ArrowUp`&&(e.preventDefault(),v(`last`))}function C(e,t){if(e.key===`ArrowDown`)e.preventDefault(),x(1);else if(e.key===`ArrowUp`)e.preventDefault(),x(-1);else if(e.key===`Home`)e.preventDefault(),g[0]&&_(g[0].value);else if(e.key===`End`){e.preventDefault();let t=g.at(-1);t&&_(t.value)}else e.key===`Enter`||e.key===` `?(e.preventDefault(),b(t)):e.key===`Escape`?(e.preventDefault(),y({restoreFocus:!0})):e.key===`Tab`&&y()}let w;return(0,B.jsxs)(`div`,{className:`personal-select${t?` ${t}`:``}`,ref:c,children:[(0,B.jsxs)(`button`,{"aria-controls":s,"aria-expanded":d,"aria-haspopup":`listbox`,"aria-label":e,className:`personal-select-trigger`,"data-value":o,onClick:()=>d?y():v(),onKeyDown:S,ref:l,role:`combobox`,type:`button`,children:[n?(0,B.jsx)(`span`,{className:`personal-select-icon`,children:n}):null,(0,B.jsxs)(`span`,{className:`personal-select-value`,children:[a?(0,B.jsx)(`small`,{children:a}):null,(0,B.jsx)(`span`,{children:h?.label??o})]}),(0,B.jsx)(om,{"aria-hidden":!0,className:d?`is-open`:void 0,size:14})]}),d?(0,B.jsx)(`div`,{"aria-label":e,className:`personal-select-listbox`,id:s,role:`listbox`,children:i.map(e=>{let t=e.group&&e.group!==w;return w=e.group,(0,B.jsxs)(`div`,{className:`personal-select-option-wrap`,children:[t?(0,B.jsx)(`div`,{className:`personal-select-group-label`,children:e.group}):null,(0,B.jsxs)(`button`,{"aria-disabled":e.disabled||void 0,"aria-selected":e.value===o,className:`personal-select-option`,disabled:e.disabled,id:`${s}-${e.value.replace(/[^a-z0-9_-]/gi,`-`)}`,onClick:()=>b(e),onFocus:()=>m(e.value),onKeyDown:t=>C(t,e),ref:t=>{t?u.current.set(e.value,t):u.current.delete(e.value)},role:`option`,tabIndex:e.value===p?0:-1,type:`button`,children:[(0,B.jsx)(`span`,{children:e.label}),e.value===o?(0,B.jsx)(am,{"aria-hidden":!0,size:15}):null]})]},e.value)})}):null]})}function tb({agents:e,managerChannelBinding:t,managerChatOpen:n,managerRuntime:r,mobileNavigationOpen:i,onOpenGoalCapabilities:a,onOpenManagerChat:o,onRefresh:s,onOpenNavigation:c,onSelectGoalTab:l,onSelectAgent:u,onReturnManagerHome:d,refreshState:f,readOnlySourceLabel:p,selectedAgentId:m,selectedGoal:h,selectedGoalTab:g}){let{locale:_,t:v}=Ji(),y=h?$y(h.usage,{cost:v(`drawer.costShort`),duration:v(`drawer.durationShort`),period24h:v(`drawer.period24h`),period7d:v(`drawer.period7d`),tokens:v(`drawer.tokensShort`)}):null,b=t?t.executor_kind===`individual`?v(`header.managerExecutorKindIndividual`):t.executor_kind===`managed`?v(`header.managerExecutorKindManaged`):v(`header.managerExecutorKindRegistered`):null,x=t?.available===!1,S=t?.available===!1?t.unavailable_reason:null,C=S===`operator_credential_unconfigured`?`header.managerExecutionUnavailableCredential`:S===`dsh_runtime_unavailable`?`header.managerExecutionUnavailableRuntime`:S===`invalid_reasoning_effort`?`header.managerExecutionUnavailableEffort`:`header.managerExecutionUnavailable`,w=t&&t.executor_endpoint_source===`product_default`&&t.executor_endpoint_default_reason===`steward_channel_default`?`header.managerEndpointStewardDefault`:null,T=p?(0,B.jsxs)(`span`,{className:`personal-read-only-source`,title:v(`header.readOnlySourceDescription`,{source:p}),children:[(0,B.jsx)(vm,{size:15}),p,(0,B.jsx)(`small`,{children:v(`common.readOnly`)})]}):(0,B.jsx)(eb,{ariaLabel:v(`header.selectChatRuntime`),className:`personal-agent-select`,icon:(0,B.jsx)(nm,{size:16}),onChange:u,options:e.map(e=>({disabled:!e.available,label:`${e.label}${e.available?``:` · ${v(`header.agentUnavailable`)}`}`,value:e.agentId})),prefixLabel:v(`header.chatRuntime`),value:m});return(0,B.jsxs)(`header`,{className:`personal-channel-header`,"data-goal-selected":!!h,children:[(0,B.jsx)(`button`,{"aria-expanded":i??!1,"aria-label":v(`header.openGoalNavigation`),className:`personal-icon-button personal-mobile-menu`,onClick:c,type:`button`,children:(0,B.jsx)(jm,{size:18})}),(0,B.jsxs)(`div`,{className:`personal-channel-title`,children:[(0,B.jsx)(`h1`,{children:h?.title??v(`header.manager`)}),!h&&r?(0,B.jsx)(`p`,{children:r.status===`ready`?v(`header.managerRuntime`,{profile:r.runtime_profile,sandbox:r.sandbox}):v(`header.managerRuntimeFallback`,{profile:r.runtime_profile,sandbox:r.sandbox})}):null,!h&&t?(0,B.jsxs)(`p`,{className:`personal-manager-execution`,children:[(0,B.jsxs)(`span`,{className:x?`personal-execution-chip is-unavailable`:`personal-execution-chip`,children:[(0,B.jsx)(`span`,{className:`personal-execution-chip-endpoint`,children:t.executor_endpoint}),b?(0,B.jsx)(`span`,{className:`personal-execution-chip-kind`,children:b}):null,(0,B.jsx)(`span`,{className:`personal-execution-chip-model`,children:t.model})]}),x?(0,B.jsx)(`span`,{className:`personal-execution-note`,children:v(C,{executor:t.executor_endpoint,credential:t.credential_env_var})}):null,w?(0,B.jsx)(`span`,{className:`personal-execution-rule-note`,children:v(w,{executor:t.executor_endpoint})}):null]}):null,h?(0,B.jsx)(`p`,{children:h.loadState?v(h.loadState===`error`?`startup.goalError`:`startup.goalLoading`):`${h.agentLaneCount&&h.agentLaneCount>1?v(`header.workAgentCount`,{count:h.agentLaneCount}):h.agentLabel??h.agentId} · ${h.loadState?v(h.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Yi(h.state,_)}${y?` · ${y}`:``} · ${h.nextSentence}`}):null]}),h?(0,B.jsxs)(`div`,{className:`personal-goal-navigation`,children:[(0,B.jsxs)(`nav`,{"aria-label":v(`header.goalView`),className:`personal-goal-tabs`,children:[(0,B.jsx)(`button`,{"aria-current":g===`overview`?`page`:void 0,onClick:()=>l(`overview`),type:`button`,children:v(`header.overview`)}),(0,B.jsx)(`button`,{"aria-current":g===`tasks`?`page`:void 0,onClick:()=>l(`tasks`),type:`button`,children:v(`header.tasks`)}),(0,B.jsx)(`button`,{"aria-current":g===`chat`?`page`:void 0,onClick:()=>l(`chat`),type:`button`,children:v(`header.chat`)}),(0,B.jsx)(`button`,{"aria-current":g===`files`?`page`:void 0,onClick:()=>l(`files`),type:`button`,children:v(`header.files`)})]}),T]}):(0,B.jsxs)(`nav`,{"aria-label":v(`header.managerView`),className:`personal-goal-tabs`,children:[(0,B.jsx)(`button`,{"aria-current":n?void 0:`page`,onClick:d,type:`button`,children:v(`header.managerOverview`)}),(0,B.jsx)(`button`,{"aria-current":n?`page`:void 0,onClick:o,type:`button`,children:v(`header.chat`)})]}),(0,B.jsxs)(`div`,{className:`personal-channel-actions`,children:[h&&a?(0,B.jsx)(`button`,{"aria-label":v(`header.goalSettings`),title:v(`header.goalSettingsDescription`),className:`personal-icon-button personal-goal-settings-action`,onClick:a,type:`button`,children:(0,B.jsx)(Zm,{"aria-hidden":!0,size:17})}):null,h?null:T,(0,B.jsxs)(`span`,{className:`personal-live-indicator`,children:[(0,B.jsx)(`i`,{}),v(`header.live`)]}),s?(0,B.jsxs)(`span`,{className:`personal-refresh-control is-${f??`idle`}`,children:[f===`loading`?(0,B.jsx)(`small`,{children:v(`header.refreshing`)}):f===`done`?(0,B.jsx)(`small`,{children:v(`header.refreshDone`)}):f===`error`?(0,B.jsx)(`small`,{children:v(`header.refreshFailed`)}):null,(0,B.jsx)(`button`,{"aria-label":v(f===`loading`?`header.refreshing`:`header.refresh`),className:`personal-icon-button`,disabled:f===`loading`,onClick:s,type:`button`,children:(0,B.jsx)(Hm,{className:f===`loading`?`is-spinning`:void 0,size:17})})]}):null]})]})}function nb({attention:e,onSelect:t}){let{t:n}=Ji(),r=Zi(e.updatedAt,n);return(0,B.jsxs)(`button`,{className:`personal-timeline-row personal-attention-row`,"data-testid":`personal-browse-row`,onClick:t,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-row-icon is-attention`,children:(0,B.jsx)(lm,{size:18})}),(0,B.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,B.jsxs)(`small`,{children:[e.goalTitle??e.goalId,` · `,n(`home.lane.needsYou`),r?` · ${n(`tasks.waitingAge`,{age:r})}`:``]}),(0,B.jsx)(`strong`,{children:e.text})]}),(0,B.jsx)(`span`,{className:`personal-priority-dot is-${e.priority??(e.blocking?`high`:`medium`)}`}),(0,B.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?n(`tasks.blocked`):n(`tasks.pending`)}),(0,B.jsx)(sm,{size:17})]})}var rb=/(`[^`\n]+`)|(\*\*[^*\n]+(\*[^*\n]*)?\*\*)|(\[[^\]\n]{1,120}\]\(https?:\/\/[^)\s]+\))/g;function ib(e,t){let n=[],r=0,i=0;for(let a of e.matchAll(rb)){let o=a.index??0;o>r&&n.push(e.slice(r,o));let s=a[0],c=`${t}-i${i++}`;if(s.startsWith("`"))n.push((0,B.jsx)(`code`,{className:`personal-md-code`,children:s.slice(1,-1)},c));else if(s.startsWith(`**`))n.push((0,B.jsx)(`strong`,{children:s.slice(2,-2)},c));else{let e=s.indexOf(`](`),t=s.slice(1,e),r=s.slice(e+2,-1);n.push((0,B.jsx)(`a`,{className:`personal-md-link`,href:r,rel:`noreferrer`,target:`_blank`,children:t},c))}r=o+s.length}return r=4))throw e;await new Promise(e=>globalThis.setTimeout(e,250*2**(i-1)))}}if(!a)throw new Ih(`Agent 事件流连接已断开。`,{reconnect_attempts:i})}async function ig(e,t){return qh(`/api/chat/sessions/${e}/turns/${t}/interrupt`,{method:`POST`,body:`{}`})}async function ag(e,t,n={}){let r=await tg(e,t,n.clientTurnId??crypto.randomUUID(),n.attachments);return n.onPhase?.(`turn.accepted`,r.turn_id),og(e,r.turn_id,r.events_url,n)}async function og(e,t,n,r={}){let i=null,a={failure:null,interrupted:null};try{await rg(n,e=>{r.onPhase?.(e.kind,t),(e.kind===`answer.delta`||e.kind===`assistant.delta`)&&r.onDelta?.(String(e.payload.text??``)),e.kind===`agent.phase`&&r.onActivity?.(String(e.payload.label??`Agent 正在处理`)),e.kind===`turn.completed`&&(i=e.payload.response),e.kind===`turn.failed`&&(a.failure=e.payload),e.kind===`turn.interrupted`&&(a.interrupted=e.payload)},r.signal)}catch(i){throw i instanceof Ih&&!r.signal?.aborted?new Ih(i.message,{...i.payload,events_url:n,reconnectable:!0,session_id:e,turn_id:t}):i}if(a.failure)throw new Ih(String(a.failure.message||`Agent 回合失败。`),a.failure);if(a.interrupted)throw new Ih(`Agent 回合已中断。`,{...a.interrupted,error_code:`turn_interrupted`,session_id:e,turn_id:t});return{response:Ah.parse(i),sessionId:e,turnId:t}}async function sg(e,t,n={}){return og(e,t,`/api/chat/sessions/${e}/turns/${t}/events`,n)}async function cg(e){let t=jh.parse(await qh(`/api/chat/sessions/${e}`,{keepalive:!0,method:`DELETE`}));if(t.session_id!==e)throw new Ih(`Agent 会话关闭回执与本次请求不一致。`,{session_id:t.session_id});return t}async function lg(e){return qh(`/api/chat/sessions/${e}/resume`,{method:`POST`,body:`{}`})}function ug(e){return{goal_id:e.goalId,enabled:e.enabled,...e.modelConfig===void 0?{}:{model_config:e.modelConfig},...e.enabled?{max_children:e.maxChildren,allowed_domains:e.allowedDomains}:{}}}function dg(e,t){let n=e.after.orchestration,r=[...new Set(t.allowedDomains)],i=e.feature_summary.multi_subagent===`enabled`;if(!(e.goal_id===t.goalId&&i===t.enabled&&(t.modelConfig===void 0||JSON.stringify(n.model_config??null)===JSON.stringify(t.modelConfig))&&(t.enabled?n.max_children===t.maxChildren&&JSON.stringify(n.allowed_domains)===JSON.stringify(r):n.spawn_allowed===!1&&n.max_children===0)))throw new Ih(`Goal 子代理配置回执与本次请求不一致,界面已停止更新。`,{after:e.after,goal_id:e.goal_id});return e}async function fg(e){let t=Ph.parse(await qh(`/api/chat/goal-subagents/dry-run`,{method:`POST`,body:JSON.stringify(ug(e))}));if(!t.dry_run||t.execute||t.written)throw new Ih(`Goal 子代理预览返回了非预览回执,已停止进入确认状态。`,{result:t});return dg(t,e)}async function pg(e,t){let n=Ph.parse(await qh(`/api/chat/goal-subagents/apply`,{method:`POST`,body:JSON.stringify({...ug(e),preview_id:t})}));if(n.preview_id!==t||n.dry_run||!n.execute)throw new Ih(`Goal 子代理写入回执与本次确认不一致,界面已停止更新。`,{result:n});if(n.changed&&(!n.written||!n.global_sync.executed||!n.global_sync.readback.verified))throw new Ih(`Goal 子代理设置未通过共享状态读回验证。`,{result:n});return dg(n,e)}var mg=J({ok:X(!0),targets:q(J({enabled:K(),provider:W(),target_name:W()}))});async function hg(){return mg.parse(await qh(`/api/chat/goal-channel/targets`)).targets}var gg=J({ok:K(),blocker:W().optional(),public_summary:W().optional(),status:W().optional()});async function _g(e){return gg.parse(await qh(`/api/chat/goal-channel/setup`,{method:`POST`,body:JSON.stringify({execute:e.execute,goal_id:e.goalId,target:e.target})}))}async function vg(e){return gg.parse(await qh(`/api/chat/goal-channel/configure`,{method:`POST`,body:JSON.stringify({auto_notify_human_gates:e.autoNotify,goal_id:e.goalId})}))}var yg=J({schema_version:X(`periodic_report_schedule_v0`),schedule_id:W(),rrule:W(),timezone:W()});J({schema_version:X(`periodic_report_machine_defaults_v0`),enabled:K(),inheritance:X(`live_machine_default`),profile_preset:W().optional(),route_ref:W().optional(),timezone:W(),schedule:yg.nullable().optional()});var bg=J({schema_version:X(`loopx_machine_configuration_v0`),namespaces:yd(W(),yd(W(),ad()))}),xg=J({namespace:W(),title:W(),description:W(),schema_versions:q(W()).min(1),configuration_template:yd(W(),ad()),template_status:Y([`ready`,`schema_only`])}),Sg=J({schema_version:X(`machine_configuration_catalog_v0`),namespaces:q(xg)}),Cg=J({key:W(),label:W(),description:W(),input_kind:Y([`boolean`,`number`,`select`,`string_list`,`text`,`periodic_report_schedule`]),nullable:K().optional(),required:K(),minimum:G().int().optional(),maximum:G().int().optional(),options:q(W()).optional()}),wg=J({schema_version:X(`capability_configuration_editor_v0`),editable:K(),supported_scopes:q(Y([`goal`,`machine`])),writable_scopes:q(Y([`goal`,`machine`])),fields:q(Cg),read_only_reason:W().optional()}),Tg=J({schema_version:X(`capability_configuration_catalog_v0`),capabilities:q(J({capability_id:W(),display_name:W(),description:W(),available_scopes:q(Y([`goal`,`machine`])),machine_namespace:W().optional(),goal_feature_id:W().optional(),effective_value_policy:X(`goal_override_over_live_machine_default`).optional(),availability:W().optional(),default:yd(W(),ad()).optional(),current:yd(W(),ad()).optional(),machine_current:yd(W(),ad()).optional(),effective_configuration:J({schema_version:X(`capability_configuration_resolution_v0`),capability_id:W(),source:Y([`goal_override`,`machine_default`,`capability_default`,`not_configured`]),configuration:yd(W(),ad()).nullable(),inherited:K(),goal_override_present:K(),machine_default_present:K(),effective_revision:W()}).optional(),documentation:yd(W(),ad()).optional(),context_contribution:J({supported_phases:q(Y([`before_plan`,`before_delegate`,`after_delegate_result`])),target:X(`coordinator`),activation:X(`with_capability`),receipt_required:X(!0)}).optional(),configuration_editor:wg}))}),Eg=J({ok:X(!0),schema_version:X(`goal_configuration_inspection_v0`),status:X(`configured`),goal_id:W(),revision:W(),available_capabilities:q(W()),capability_catalog:Tg}),Dg=J({ok:X(!0),goal_id:W(),capability_id:W(),changed_fields:q(W()),goal_configuration:yd(W(),ad()).nullable(),capability_catalog:Tg}),Og=Dg.extend({schema_version:X(`goal_configuration_update_plan_v0`),status:X(`preview`),action:Y([`create`,`update`,`delete`,`unchanged`]),current_revision:W(),desired_revision:W(),base_revision:W(),plan_revision:W(),writes_required:G().int().nonnegative()}),kg=dd([Dg.extend({schema_version:X(`goal_configuration_transaction_v0`),status:Y([`applied`,`unchanged`]),plan_revision:W(),applied_revision:W(),readback_verified:X(!0)}),J({ok:X(!1),schema_version:X(`goal_configuration_transaction_v0`),status:X(`partial_write`),goal_id:W(),capability_id:W(),plan_revision:W(),applied_revision:W().nullable(),source_written:X(!0),shared_sync_pending:X(!0),readback_verified:K(),changed_fields:q(W()),goal_configuration:yd(W(),ad()).nullable(),capability_catalog:Tg,error:W(),recommended_action:W()})]),Ag=J({ok:X(!0),available_namespaces:q(W()),namespace_catalog:Sg.optional().default({schema_version:`machine_configuration_catalog_v0`,namespaces:[]}),capability_catalog:Tg,changed_namespaces:q(W()).optional().default([]),invalid_namespaces:q(W()).optional().default([]),machine_configuration:bg.nullable().optional()}),jg=Ag.extend({schema_version:X(`machine_configuration_inspection_v0`),status:Y([`configured`,`absent`,`invalid`]),revision:W()}),Mg=Ag.extend({schema_version:X(`machine_configuration_update_plan_v0`),status:X(`preview`),action:Y([`create`,`update`,`delete`,`unchanged`]),current_revision:W(),desired_revision:W(),plan_revision:W(),writes_required:G().int().nonnegative(),machine_configuration:bg.nullable()}),Ng=Ag.extend({schema_version:X(`machine_configuration_transaction_v0`),status:Y([`applied`,`unchanged`]),plan_revision:W(),transaction_id:W().nullable(),readback_verified:X(!0),rollback_available:K(),applied_revision:W().optional(),prior_revision:W().optional()}),Pg=Ag.extend({schema_version:X(`machine_configuration_rollback_plan_v0`),status:X(`preview`),action:Y([`delete`,`restore`,`unchanged`,`blocked`]),reason:W(),transaction_id:W(),plan_revision:W(),rollback_allowed:K(),writes_required:G().int().nonnegative()}),Fg=Ag.extend({schema_version:X(`machine_configuration_rollback_receipt_v0`),status:Y([`rolled_back`,`unchanged`]),transaction_id:W(),plan_revision:W(),rollback_id:W().nullable(),readback_verified:X(!0)}),Ig=J({configured:K(),source:Y([`machine_store`,`service_environment`,`unset`]),env_var:W().optional(),fingerprint:W().nullable().optional(),value:W().nullable().optional(),blocked_by:W().optional()}),Lg=J({ok:X(!0),schema_version:X(`operator_provider_credential_projection_v0`),action:W().optional(),store_ref:W(),store_revision:W(),record_present:K(),status:Y([`configured`,`absent`,`invalid`]),repair:W(),provider_key:Ig,base_url:Ig});async function Rg(){return Lg.parse(await qh(`/api/chat/operator-credential`))}async function zg(e){return Lg.parse(await qh(`/api/chat/operator-credential`,{method:`POST`,body:JSON.stringify(e)}))}async function Bg(){return jg.parse(await qh(`/api/chat/machine-configuration`))}async function Vg(e){let t=new URLSearchParams({goal_id:e});return Eg.parse(await qh(`/api/chat/goal-configuration?${t.toString()}`))}async function Hg(e,t,n){return Og.parse(await qh(`/api/chat/goal-configuration/preview`,{method:`POST`,body:JSON.stringify({goal_id:e,capability_id:t,configuration:n})}))}async function Ug(e,t,n,r){return kg.parse(await qh(`/api/chat/goal-configuration/apply`,{method:`POST`,body:JSON.stringify({goal_id:e,capability_id:t,configuration:n,expected_plan_revision:r})}))}async function Wg(e,t){return Mg.parse(await qh(`/api/chat/machine-configuration/preview`,{method:`POST`,body:JSON.stringify({namespace:e,namespace_configuration:t})}))}async function Gg(e,t,n){return Ng.parse(await qh(`/api/chat/machine-configuration/apply`,{method:`POST`,body:JSON.stringify({expected_plan_revision:n,namespace:e,namespace_configuration:t})}))}async function Kg(e){return Mg.parse(await qh(`/api/chat/machine-configuration/preview`,{method:`POST`,body:JSON.stringify({namespace:e,operation:`remove`})}))}async function qg(e,t){return Ng.parse(await qh(`/api/chat/machine-configuration/apply`,{method:`POST`,body:JSON.stringify({expected_plan_revision:t,namespace:e,operation:`remove`})}))}async function Jg(e){return Pg.parse(await qh(`/api/chat/machine-configuration/rollback`,{method:`POST`,body:JSON.stringify({execute:!1,transaction_id:e})}))}async function Yg(e,t){return Fg.parse(await qh(`/api/chat/machine-configuration/rollback`,{method:`POST`,body:JSON.stringify({execute:!0,expected_plan_revision:t,transaction_id:e})}))}var Xg=J({ok:X(!0),goals:q(J({goal_id:W(),repository:J({branch:W(),identity:W(),label:W(),read_only:X(!0)})}))});async function Zg(){return Xg.parse(await qh(`/api/chat/goals/contexts`)).goals}var Qg=J({ok:X(!0),apps:q(J({active:K(),app_ref:W(),brand:W(),health_error_code:W().nullable().default(null),label:W(),ready:K(),reply_ready:K().default(!1)}))});async function $g(){return Qg.parse(await qh(`/api/chat/lark/apps`)).apps}var e_=J({ok:X(!0),app_ref:W(),error:W().nullable(),setup_id:W(),status:Y([`starting`,`waiting_for_feishu`,`ready`,`failed`,`cancelled`]),verification_url:W().url().nullable()});async function t_(e){return e_.parse(await qh(`/api/chat/lark/app-setups`,{method:`POST`,body:JSON.stringify({app_ref:e.appRef,brand:e.brand})}))}async function n_(e){return e_.parse(await qh(`/api/chat/lark/app-setups/${encodeURIComponent(e)}`))}async function r_(e){return e_.parse(await qh(`/api/chat/lark/app-setups/${encodeURIComponent(e)}`,{method:`DELETE`}))}var i_=[`invalid_event`,`binding_unavailable`,`chat_mismatch`,`topic_mismatch`,`route_ambiguous`,`self_message`,`invalid_routing_state`,`not_addressed`],a_=J({ok:X(!0),chats:q(J({chat_id:W(),chat_name:W()}))});async function o_(e,t){let n=new URLSearchParams({app_ref:e});return t&&n.set(`query`,t),a_.parse(await qh(`/api/chat/lark/chats?${n.toString()}`)).chats}var s_=J({ok:X(!0),connections:q(J({conversation_kind:Y([`goal`,`manager`]).default(`goal`),agent_id:W().nullable().default(null),connection_id:W(),app_label:W(),app_ref:W(),capture_scope:Y([`addressed_only`,`configured_chat_all`]).default(`addressed_only`),chat_name:W(),enabled:K(),goal_id:W(),goal_title:W(),health_error_code:W().nullable().default(null),history_permission_guidance:J({action:X(`enable_application_scopes_and_publish`),api_document_url:W().url(),capability:X(`group_history_pagination`),identity:X(`bot`),required_scopes:_d([X(`im:message.group_msg`),X(`im:message.group_msg.include_bot:read`)]),schema_version:X(`lark_bot_group_history_permission_guidance_v0`)}).nullable().default(null),incoming_mode:Y([`mentions`,`all`]),ingress_mode:Y([`live_steering`,`session_queue`,`async_inbox`,`direct_session`]).default(`async_inbox`),event_count:G().int().nonnegative().default(0),last_event_reason:Y(i_).nullable().default(null).catch(null),last_event_status:W().nullable().default(null),listener_error_code:W().nullable().default(null),listener_status:Y([`starting`,`listening`,`retrying`,`stopped`]).nullable().default(null),replied_count:G().int().nonnegative().default(0),reply_ready:K().default(!1),reply_mode:X(`topic_reply`),session_bound:K().default(!1),target_ref:W(),topic_name:W(),topic_setup_required:K()}))});async function c_(){return s_.parse(await qh(`/api/chat/lark/connections`)).connections}async function l_(e){return gg.parse(await qh(`/api/chat/lark/connections`,{method:`POST`,body:JSON.stringify({...e.agentBindings?{agent_bindings:e.agentBindings.map(e=>({agent_id:e.agentId,app_ref:e.appRef}))}:{},...e.agentId?{agent_id:e.agentId}:{},...e.appRef?{app_ref:e.appRef}:{},...e.connectionId?{connection_id:e.connectionId}:{},conversation_kind:e.conversationKind??`goal`,capture_scope:e.captureScope,chat_id:e.chatId,chat_name:e.chatName,execute:e.execute,goal_id:e.goalId,incoming_mode:e.incomingMode,ingress_mode:e.ingressMode,reply_mode:e.replyMode})}))}async function u_(e,t){let n=new URLSearchParams({goal_id:e,connection_id:t});return gg.parse(await qh(`/api/chat/lark/connections?${n.toString()}`,{method:`DELETE`}))}function d_(e){return{loadedUrl:null,projectionRevision:0,requestedUrl:e,selectionRevision:0,requestGeneration:0}}function f_(e,t){return e.selectionRevision+=1,e.requestedUrl=t,e.selectionRevision}function p_(e,t,n){if(n.background)return e.requestedUrl!==null||e.loadedUrl!==t?null:(e.requestGeneration+=1,{background:!0,projectionRevision:e.projectionRevision,selectionRevision:e.selectionRevision,url:t,generation:e.requestGeneration});let r=n.selectionRevision??e.selectionRevision+1;return n.selectionRevision!==void 0&&e.selectionRevision!==r?null:(e.selectionRevision=r,e.projectionRevision+=1,e.requestedUrl=t,e.requestGeneration+=1,{background:!1,projectionRevision:e.projectionRevision,selectionRevision:r,url:t,generation:e.requestGeneration})}function m_(e,t){return t.generation===e.requestGeneration&&e.projectionRevision===t.projectionRevision&&e.selectionRevision===t.selectionRevision}function h_(e,t){return m_(e,t)&&(!t.background||e.requestedUrl===null&&e.loadedUrl===t.url)}function g_(e,t,n){return t.get(e)===n}function __(e,t,n,r){return e.filter(e=>g_(r(e),n,t))}function v_(e,t,n){let r=new Set,i=[];for(let a of[...e,...t]){let e=n(a);e==null||r.has(e)||(r.add(e),i.push(a))}return i}var y_=[`runs_24h`,`runs_7d`,`quota_spend_slots_24h`,`quota_spend_slots_7d`,`automation_run_count_24h`,`automation_run_count_7d`,`progress_signal_run_count_24h`,`progress_signal_run_count_7d`],b_=[`input_tokens_24h`,`input_tokens_7d`,`output_tokens_24h`,`output_tokens_7d`,`cache_tokens_24h`,`cache_tokens_7d`,`cost_usd_24h`,`cost_usd_7d`,`duration_ms_24h`,`duration_ms_7d`],x_=[`accounting`,`decision`,`evidence`,`state`,`work`],S_={accounting:0,decision:0,evidence:0,state:0,work:0},C_={runs_24h:0,runs_7d:0,quota_spend_slots_24h:0,quota_spend_slots_7d:0,automation_run_count_24h:0,automation_run_count_7d:0,progress_signal_run_count_24h:0,progress_signal_run_count_7d:0};function w_(e,t){let n={...e};for(let r of y_)n[r]=(Number(e[r])||0)+(Number(t[r])||0);for(let r of b_)(e[r]!==void 0||t[r]!==void 0)&&(n[r]=(e[r]??0)+(t[r]??0));return n}function T_(e,t){return!e.length||t<=0?e:e.map(e=>({...e,project_share_24h:Math.round((Number(e.runs_24h)||0)/t*1e3)/1e3}))}function E_(e,t){let n={...e};for(let r of x_)n[r]=(e[r]??0)+(t[r]??0);return n}function D_(e){let t={events_24h:0,events_7d:0,by_class_24h:{...S_},by_class_7d:{...S_}};for(let n of e)t.events_24h+=n.events_24h,t.events_7d+=n.events_7d,t.by_class_24h=E_(t.by_class_24h,n.by_class_24h),t.by_class_7d=E_(t.by_class_7d,n.by_class_7d);return t}function O_(e,t,n){if(!e&&!t)return null;let r=__(e?.goals??[],`active`,n,e=>e.goal_id),i=__(t?.goals??[],`stopped`,n,e=>e.goal_id),a=v_(r,i,e=>e.goal_id),o=D_(r),s=D_(i),c={events_24h:o.events_24h+s.events_24h,events_7d:o.events_7d+s.events_7d,by_class_24h:E_(o.by_class_24h,s.by_class_24h),by_class_7d:E_(o.by_class_7d,s.by_class_7d)};return{...e??t,goals:a,sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),totals:c}}function k_(e,t,n){if(!e&&!t)return null;let r=v_([...__(e?.items??[],`active`,n,e=>e.goal_id),...__(t?.items??[],`stopped`,n,e=>e.goal_id)],[],e=>`${e.goal_id}:${e.decision_kind??``}:${e.decision_at??``}`),i={decision_count:(e?.summary.decision_count??0)+(t?.summary.decision_count??0),stale_count:r.filter(e=>e.stale_by_age).length,rebase_required_count:(e?.summary.rebase_required_count??0)+(t?.summary.rebase_required_count??0),fresh_count:(e?.summary.fresh_count??0)+(t?.summary.fresh_count??0)};return{...e??t,items:r,sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),summary:i}}function A_(e,t){return v_([...e,...t].sort((e,t)=>t.generated_at.localeCompare(e.generated_at)),[],e=>`${e.goal_id}:${e.generated_at}:${e.classification??``}`)}function j_(e,t,n){let r=v_(__(e.items,`active`,n,e=>e.goal_id),__(t.items,`stopped`,n,e=>e.goal_id),e=>e.goal_id);return{...e,item_count:r.length,items:r,needs_controller:r.filter(e=>e.waiting_on===`controller`).length,needs_codex:r.filter(e=>e.waiting_on===`codex`).length,needs_user_or_controller:r.filter(e=>[`user_or_controller`,`controller`].includes(e.waiting_on)).length,watching_external_evidence:r.filter(e=>e.waiting_on===`external_evidence`).length}}function M_(e){let t=e.todo_id?.trim()||``;return t?`${e.goal_id}:${t}`:`${e.goal_id}:synthetic:${e.role??``}:${e.index??``}:${e.text??``}`}function N_(e){let t={...C_};for(let n of e){for(let e of y_)t[e]+=Number(n[e])||0;for(let e of b_)n[e]!==void 0&&(t[e]=(t[e]??0)+n[e])}return t}function P_(e,t,n){if(!e&&!t)return null;let r=__(e?.items??[],`active`,n,e=>e.goal_id),i=__(t?.items??[],`stopped`,n,e=>e.goal_id),a=v_(r,i,M_);return{...e??t,current_projected_count:r.length+i.length,items:a,rollout_event_count:a.reduce((e,t)=>e+(t.event_count??0),0),total_count:a.length}}function F_(e,t,n){if(!e&&!t)return null;let r=__(e?.goals??[],`active`,n,e=>e.goal_id),i=__(t?.goals??[],`stopped`,n,e=>e.goal_id),a=v_(r,i,e=>e.goal_id),o=w_(N_(r),N_(i));return{...e??t,goals:T_(a,Number(o.runs_24h)||0),sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),totals:o}}function I_(e,t,n){if(!e&&!t)return null;let r=(e?.agents??[]).filter(e=>e.goal_ids.some(e=>g_(e,n,`active`))||(e.current_todo?.goal_id?g_(e.current_todo.goal_id,n,`active`):!1)),i=(t?.agents??[]).filter(e=>e.goal_ids.some(e=>g_(e,n,`stopped`))||(e.current_todo?.goal_id?g_(e.current_todo.goal_id,n,`stopped`):!1)),a=v_(r,i,e=>e.agent_id).map(e=>{let t=i.find(t=>t.agent_id===e.agent_id);return t?{...e,goal_ids:Array.from(new Set([...e.goal_ids??[],...t.goal_ids]))}:e});return{...e??t,agents:a,source_summary:(e??t)?.source_summary?{...(e??t).source_summary,projected_agent_count:a.length,registered_agent_count:new Set(a.map(e=>e.agent_id)).size}:(e??t)?.source_summary}}function L_(e,t,n){if(!e&&!t)return null;let r=v_(__(e?.goals??[],`active`,n,e=>e.goal_id),__(t?.goals??[],`stopped`,n,e=>e.goal_id),e=>e.goal_id);return{...e??t,goals:r}}function R_(e,t){let n=t.goal_projection?.scope;if(n!==`active`&&n!==`stopped`)return t;let r=n,i=t.run_history.goals,a=e.run_history.goals,o=v_(r===`active`?i:a.filter(e=>e.activation_state!==`stopped`),r===`stopped`?i:a.filter(e=>e.activation_state===`stopped`),e=>e.id),s=new Map(o.map(e=>[e.id,e.activation_state])),c=r===`active`?t:e,l=r===`stopped`?t:e,u=e.goal_projection?.registry_revision??null,d=t.goal_projection?.registry_revision??null,f=u===null||d===null||u===d;return{...e,agent_management_projection:I_(c.agent_management_projection,l.agent_management_projection,s),attention_queue:j_(c.attention_queue,l.attention_queue,s),decision_freshness_summary:k_(c.decision_freshness_summary,l.decision_freshness_summary,s),event_ledger_summary:O_(c.event_ledger_summary,l.event_ledger_summary,s),goal_channel_notification_projection:L_(c.goal_channel_notification_projection,l.goal_channel_notification_projection,s),goal_projection:{schema_version:`loopx_goal_projection_scope_v0`,...t.goal_projection,complete:f,projected_goal_count:o.length,registry_goal_count:t.goal_projection?.registry_goal_count??0,scope:`all`},run_history:{...e.run_history,goal_count:o.length,goals:o,recent_runs:A_(c.run_history.recent_runs,l.run_history.recent_runs),run_count:c.run_history.run_count+l.run_history.run_count},todo_index:P_(c.todo_index,l.todo_index,s),usage_summary:F_(c.usage_summary,l.usage_summary,s)}}function z_(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,H_=B_,U_=(e,t)=>n=>{if(t?.variants==null)return H_(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=V_(t)||V_(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return H_(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},W_=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t({classGroupId:e,validator:t}),K_=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),q_=`-`,J_=[],Y_=`arbitrary..`,X_=e=>{let t=$_(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Q_(e);let n=e.split(q_);return Z_(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?W_(i,t):t:i||J_}return n[e]||J_}}},Z_=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Z_(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(q_):e.slice(t).join(q_),s=a.length;for(let e=0;ee.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Y_+r:void 0})(),$_=e=>{let{theme:t,classGroups:n}=e;return ev(n,t)},ev=(e,t)=>{let n=K_();for(let r in e){let i=e[r];tv(i,n,r,t)}return n},tv=(e,t,n,r)=>{let i=e.length;for(let a=0;a{if(typeof e==`string`){rv(e,t,n);return}if(typeof e==`function`){iv(e,t,n,r);return}av(e,t,n,r)},rv=(e,t,n)=>{let r=e===``?t:ov(t,e);r.classGroupId=n},iv=(e,t,n,r)=>{if(sv(e)){tv(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(G_(n,e))},av=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e{let n=e,r=t.split(q_),i=r.length;for(let e=0;e`isThemeGetter`in e&&e.isThemeGetter===!0,cv=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},lv=`!`,uv=`:`,dv=[],fv=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),pv=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;si?a-i:void 0;return fv(t,l,c,u)};if(t){let e=t+uv,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):fv(dv,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},mv=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},hv=e=>({cache:cv(e.cacheSize),parseClassName:pv(e),sortModifiers:mv(e),postfixLookupClassGroupIds:gv(e),...X_(e)}),gv=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(_v),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+lv:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e0?` `+l:l)}return l},yv=(...e)=>{let t=0,n,r,i=``;for(;t{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r{let n,r,i,a,o=o=>(n=hv(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=vv(e,n);return i(e,a),a};return a=o,(...e)=>a(yv(...e))},Sv=[],Cv=e=>{let t=t=>t[e]||Sv;return t.isThemeGetter=!0,t},wv=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Tv=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ev=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Dv=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ov=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,kv=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Av=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jv=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mv=e=>Ev.test(e),Nv=e=>!!e&&!Number.isNaN(Number(e)),Pv=e=>!!e&&Number.isInteger(Number(e)),Fv=e=>e.endsWith(`%`)&&Nv(e.slice(0,-1)),Iv=e=>Dv.test(e),Lv=()=>!0,Rv=e=>Ov.test(e)&&!kv.test(e),zv=()=>!1,Bv=e=>Av.test(e),Vv=e=>jv.test(e),Hv=e=>!Q(e)&&!$(e),Uv=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Wv=e=>ay(e,ly,zv),Q=e=>wv.test(e),Gv=e=>ay(e,uy,Rv),Kv=e=>ay(e,dy,Nv),qv=e=>ay(e,py,Lv),Jv=e=>ay(e,fy,zv),Yv=e=>ay(e,sy,zv),Xv=e=>ay(e,cy,Vv),Zv=e=>ay(e,my,Bv),$=e=>Tv.test(e),Qv=e=>oy(e,uy),$v=e=>oy(e,fy),ey=e=>oy(e,sy),ty=e=>oy(e,ly),ny=e=>oy(e,cy),ry=e=>oy(e,my,!0),iy=e=>oy(e,py,!0),ay=(e,t,n)=>{let r=wv.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},oy=(e,t,n=!1)=>{let r=Tv.exec(e);return r?r[1]?t(r[1]):n:!1},sy=e=>e===`position`||e===`percentage`,cy=e=>e===`image`||e===`url`,ly=e=>e===`length`||e===`size`||e===`bg-size`,uy=e=>e===`length`,dy=e=>e===`number`,fy=e=>e===`family-name`,py=e=>e===`number`||e===`weight`,my=e=>e===`shadow`,hy=xv(()=>{let e=Cv(`color`),t=Cv(`font`),n=Cv(`text`),r=Cv(`font-weight`),i=Cv(`tracking`),a=Cv(`leading`),o=Cv(`breakpoint`),s=Cv(`container`),c=Cv(`spacing`),l=Cv(`radius`),u=Cv(`shadow`),d=Cv(`inset-shadow`),f=Cv(`text-shadow`),p=Cv(`drop-shadow`),m=Cv(`blur`),h=Cv(`perspective`),g=Cv(`aspect`),_=Cv(`ease`),v=Cv(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),$,Q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$,Q,c],T=()=>[Mv,`full`,`auto`,...w()],E=()=>[Pv,`none`,`subgrid`,$,Q],D=()=>[`auto`,{span:[`full`,Pv,$,Q]},Pv,$,Q],O=()=>[Pv,`auto`,$,Q],k=()=>[`auto`,`min`,`max`,`fr`,$,Q],ee=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],te=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],A=()=>[`auto`,...w()],j=()=>[Mv,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],M=()=>[Mv,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ne=()=>[Mv,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],N=()=>[e,$,Q],P=()=>[...b(),ey,Yv,{position:[$,Q]}],re=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ie=()=>[`auto`,`cover`,`contain`,ty,Wv,{size:[$,Q]}],ae=()=>[Fv,Qv,Gv],F=()=>[``,`none`,`full`,l,$,Q],oe=()=>[``,Nv,Qv,Gv],I=()=>[`solid`,`dashed`,`dotted`,`double`],se=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],L=()=>[Nv,Fv,ey,Yv],ce=()=>[``,`none`,m,$,Q],le=()=>[`none`,Nv,$,Q],ue=()=>[`none`,Nv,$,Q],de=()=>[Nv,$,Q],fe=()=>[Mv,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Iv],breakpoint:[Iv],color:[Lv],container:[Iv],"drop-shadow":[Iv],ease:[`in`,`out`,`in-out`],font:[Hv],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Iv],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Iv],shadow:[Iv],spacing:[`px`,Nv],text:[Iv],"text-shadow":[Iv],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Mv,Q,$,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,$,Q]}],"container-named":[Uv],columns:[{columns:[Nv,Q,$,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Pv,`auto`,$,Q]}],basis:[{basis:[Mv,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Nv,Mv,`auto`,`initial`,`none`,Q]}],grow:[{grow:[``,Nv,$,Q]}],shrink:[{shrink:[``,Nv,$,Q]}],order:[{order:[Pv,`first`,`last`,`none`,$,Q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ee(),`normal`]}],"justify-items":[{"justify-items":[...te(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...te()]}],"align-content":[{content:[`normal`,...ee()]}],"align-items":[{items:[...te(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...te(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...te(),`baseline`]}],"place-self":[{"place-self":[`auto`,...te()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:j()}],"inline-size":[{inline:[`auto`,...M()]}],"min-inline-size":[{"min-inline":[`auto`,...M()]}],"max-inline-size":[{"max-inline":[`none`,...M()]}],"block-size":[{block:[`auto`,...ne()]}],"min-block-size":[{"min-block":[`auto`,...ne()]}],"max-block-size":[{"max-block":[`none`,...ne()]}],w:[{w:[s,`screen`,...j()]}],"min-w":[{"min-w":[s,`screen`,`none`,...j()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...j()]}],h:[{h:[`screen`,`lh`,...j()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...j()]}],"max-h":[{"max-h":[`screen`,`lh`,...j()]}],"font-size":[{text:[`base`,n,Qv,Gv]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,iy,qv]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Fv,Q]}],"font-family":[{font:[$v,Jv,t]}],"font-features":[{"font-features":[Q]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,$,Q]}],"line-clamp":[{"line-clamp":[Nv,`none`,$,Kv]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$,Q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$,Q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...I(),`wavy`]}],"text-decoration-thickness":[{decoration:[Nv,`from-font`,`auto`,$,Gv]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[Nv,`auto`,$,Q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Pv,$,Q]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$,Q]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,$,Q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:re()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Pv,$,Q],radial:[``,$,Q],conic:[Pv,$,Q]},ny,Xv]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:ae()}],"gradient-via-pos":[{via:ae()}],"gradient-to-pos":[{to:ae()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...I(),`hidden`,`none`]}],"divide-style":[{divide:[...I(),`hidden`,`none`]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...I(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Nv,$,Q]}],"outline-w":[{outline:[``,Nv,Qv,Gv]}],"outline-color":[{outline:N()}],shadow:[{shadow:[``,`none`,u,ry,Zv]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":[`none`,d,ry,Zv]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:oe()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[Nv,Gv]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":[`none`,f,ry,Zv]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[Nv,$,Q]}],"mix-blend":[{"mix-blend":[...se(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Nv]}],"mask-image-linear-from-pos":[{"mask-linear-from":L()}],"mask-image-linear-to-pos":[{"mask-linear-to":L()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":L()}],"mask-image-t-to-pos":[{"mask-t-to":L()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":L()}],"mask-image-r-to-pos":[{"mask-r-to":L()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":L()}],"mask-image-b-to-pos":[{"mask-b-to":L()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":L()}],"mask-image-l-to-pos":[{"mask-l-to":L()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":L()}],"mask-image-x-to-pos":[{"mask-x-to":L()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":L()}],"mask-image-y-to-pos":[{"mask-y-to":L()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[$,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":L()}],"mask-image-radial-to-pos":[{"mask-radial-to":L()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Nv]}],"mask-image-conic-from-pos":[{"mask-conic-from":L()}],"mask-image-conic-to-pos":[{"mask-conic-to":L()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:re()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,$,Q]}],filter:[{filter:[``,`none`,$,Q]}],blur:[{blur:ce()}],brightness:[{brightness:[Nv,$,Q]}],contrast:[{contrast:[Nv,$,Q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,ry,Zv]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:[``,Nv,$,Q]}],"hue-rotate":[{"hue-rotate":[Nv,$,Q]}],invert:[{invert:[``,Nv,$,Q]}],saturate:[{saturate:[Nv,$,Q]}],sepia:[{sepia:[``,Nv,$,Q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$,Q]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[Nv,$,Q]}],"backdrop-contrast":[{"backdrop-contrast":[Nv,$,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Nv,$,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Nv,$,Q]}],"backdrop-invert":[{"backdrop-invert":[``,Nv,$,Q]}],"backdrop-opacity":[{"backdrop-opacity":[Nv,$,Q]}],"backdrop-saturate":[{"backdrop-saturate":[Nv,$,Q]}],"backdrop-sepia":[{"backdrop-sepia":[``,Nv,$,Q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,$,Q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Nv,`initial`,$,Q]}],ease:[{ease:[`linear`,`initial`,_,$,Q]}],delay:[{delay:[Nv,$,Q]}],animate:[{animate:[`none`,v,$,Q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$,Q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":[`scale-3d`],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[$,Q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:fe()}],"translate-x":[{"translate-x":fe()}],"translate-y":[{"translate-y":fe()}],"translate-z":[{"translate-z":fe()}],"translate-none":[`translate-none`],zoom:[{zoom:[Pv,$,Q]}],accent:[{accent:N()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,$,Q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":N()}],"scrollbar-track-color":[{"scrollbar-track":N()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,$,Q]}],fill:[{fill:[`none`,...N()]}],"stroke-w":[{stroke:[Nv,Qv,Gv,Kv]}],stroke:[{stroke:[`none`,...N()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function gy(...e){return hy(B_(e))}var _y=U_(`inline-flex h-9 shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md border px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 disabled:pointer-events-none disabled:opacity-50 dark:focus-visible:ring-zinc-500`,{variants:{variant:{primary:`border-slate-900 bg-slate-950 text-white hover:bg-slate-800 dark:border-zinc-100 dark:bg-zinc-50 dark:text-zinc-950 dark:hover:bg-zinc-200`,secondary:`border-slate-200 bg-white text-slate-900 hover:bg-slate-50 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-100 dark:hover:bg-zinc-900`,ghost:`border-transparent bg-transparent text-slate-700 hover:bg-slate-100 dark:text-zinc-300 dark:hover:bg-zinc-900`},size:{sm:`h-8 px-2 text-xs`,md:`h-9 px-3 text-sm`,icon:`h-9 w-9 px-0`}},defaultVariants:{variant:`secondary`,size:`md`}});function vy({className:e,variant:t,size:n,...r}){return(0,B.jsx)(`button`,{className:gy(_y({variant:t,size:n}),e),type:`button`,...r})}function yy({className:e,...t}){return(0,B.jsx)(`section`,{className:gy(`rounded-lg border border-slate-200/80 bg-white/95 text-slate-950 shadow-[0_1px_2px_rgba(15,23,42,0.04)] dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50`,e),...t})}function by({className:e,...t}){return(0,B.jsx)(`div`,{className:gy(`p-4 pt-0`,e),...t})}var xy=[`codex`,`claude`,`kiro`,`trae`,`coco`,`openai`,`anthropic`],Sy=new Set([`acp`,`status_projection`]);function Cy(e){let t=e.trim().toLowerCase().replace(/_/gu,`-`);for(let e of xy)if(t===e||t.startsWith(`${e}-`))return e;return t}function wy(e,t){let n=t?.trim().toLowerCase()??``;return n.length>0&&!Sy.has(n)?Cy(n):Cy(e)}var Ty={"zh-CN":{title:`交办说明`,context:`背景与补充`,constraints:`约束`,inputs:`输入材料`,acceptance:`验收要求`,return:`需要回传`,supplied:`已提供给接收方`,pending:`等待接收方读取`,decision:`接收方判断`,unknown:`尚未记录`,unavailable:`暂时无法读取`,adopt:`已采纳`,defer:`已暂缓`,reject:`未采纳`,no_change:`无需调整`,result:`结论已保存`,delivered:`结论已回传`,details:`查看交办内容`},en:{title:`Delegation brief`,context:`Context & corrections`,constraints:`Constraints`,inputs:`Inputs`,acceptance:`Acceptance`,return:`Expected return`,supplied:`Supplied to receiver`,pending:`Awaiting receiver read`,decision:`Receiver decision`,unknown:`Not recorded`,unavailable:`Readback unavailable`,adopt:`Adopted`,defer:`Deferred`,reject:`Rejected`,no_change:`No change needed`,result:`Conclusion saved`,delivered:`Conclusion returned`,details:`View delegation details`}};function Ey({request:e}){let{locale:t}=Ji();if(!e)return null;let n=Ty[t],r=e.brief,i=e.decision,a=e.returns.find(e=>e.phase===`conclusion`);return(0,B.jsxs)(`section`,{className:`personal-collaboration`,"aria-label":n.title,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:r.purpose}),(0,B.jsx)(`span`,{children:e.agent_id})]}),(0,B.jsxs)(`p`,{className:`personal-collaboration-status`,children:[(0,B.jsx)(`span`,{children:e.read_status===`supplied`?n.supplied:e.read_status===`unavailable`?n.unavailable:n.pending}),(0,B.jsxs)(`span`,{children:[n.decision,`: `,n[i]??(e.decision===`unavailable`?n.unavailable:n.unknown)]}),a?(0,B.jsx)(`span`,{children:a.status===`delivered`?n.delivered:n.result}):null]}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:n.details}),(0,B.jsx)(`h4`,{children:n.context}),(0,B.jsx)(`p`,{children:r.context}),r.constraints.length?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h4`,{children:n.constraints}),(0,B.jsx)(`ul`,{children:r.constraints.map((e,t)=>(0,B.jsx)(`li`,{children:e},t))})]}):null,r.inputs.length?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h4`,{children:n.inputs}),(0,B.jsx)(`ul`,{children:r.inputs.map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`code`,{children:e.ref}),` — `,e.description,e.sha256?(0,B.jsxs)(`small`,{children:[`sha256:`,e.sha256]}):null]},t))})]}):null,(0,B.jsx)(`h4`,{children:n.acceptance}),(0,B.jsx)(`ul`,{children:r.acceptance.map((e,t)=>(0,B.jsx)(`li`,{children:e},t))}),(0,B.jsx)(`h4`,{children:n.return}),(0,B.jsx)(`p`,{children:r.return_requirement})]})]})}var Dy={stop:`ready_stop`,resume:`resume_review`,delete:`delete_review`};function Oy(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function ky(e){return typeof e==`string`&&e.trim().length>0?e:null}function Ay(e,t=240){let n=typeof e==`string`?e.replace(/\s+/g,` `).trim():``;return n.length>t?`${n.slice(0,t-1)}…`:n}function jy(e){let t=Oy(e)??{},n=Ay(t.agent_id,80)||`unknown-agent`,r=Ay(t.acceptance,200);if(t.staffing===`gap`){let e=Oy(t.declined_first_todo)??{};return[`${n} · gap`,Ay(t.gap_reason_code,80),Ay(e.text,200)].filter(Boolean).join(` · `)}let i=Oy(t.first_todo)??{};return[`${n} · ready`,Ay(i.priority,8),Ay(i.action_kind,40),Ay(i.text,240),r?`acceptance: ${r}`:``].filter(Boolean).join(` · `)}function My(e){let t=Oy(e)??{};return Object.entries(t).map(([e,t])=>`${e}: ${typeof t==`object`&&t?JSON.stringify(t):String(t)}`).join(` · `)}function Ny(e){let t=Oy(e);if(t?.action_kind!==`team.plan`||t.status!==`preview_ready`&&t.status!==`deferred`)return;let n=Oy(Oy(t.normalized_parameters)?.plan);if(!n||n.kind!==`steward_team_plan_preview`||n.applies!==!1)return;let r=ky(t.proposal_id),i=ky(t.expected_state_fingerprint),a=ky(n.goal_id);if(!r||!i||!a)return;let o=Array.isArray(n.lanes)?n.lanes:[],s=Array.isArray(n.gaps)?n.gaps:[],c=[{key:`goal`,value:a},{key:`objective`,value:Ay(n.objective)},...o.map((e,t)=>({key:`lane_${t+1}`,value:jy(e)})),...s.length>0?[{key:`lane_gaps`,value:s.map(e=>{let t=Oy(e)??{};return[Ay(t.lane_id,80),Ay(t.reason_code,80)].filter(Boolean).join(`: `)}).filter(Boolean).join(` · `)}]:[],{key:`quota_envelope`,value:My(n.quota_envelope)},{key:`stop_condition`,value:Ay(n.stop_condition)}].filter(e=>e.value.length>0);return{schemaVersion:`review_card_frame_v0`,actionKind:`team.plan`,proposalId:r,stateFingerprint:i,kind:`confirmation`,attentionKind:`authority`,interactionMode:`confirm_reject`,decisions:[`confirm`,`reject`],titleKey:`team_plan_preview`,subtitleKey:`preview_only_no_lane_exists`,confirmLabelKey:`confirm_team_plan`,rejectLabelKey:`reject_team_plan`,warningKey:`confirming_creates_each_ready_lane_first_todo`,focus:`${a} · ${o.length} lane${o.length===1?``:`s`}`,fields:c}}function Py(e){let t=Oy(e.projection);if(t?.schema_version!==`loopx_operation_projection_v0`)return null;let n=ky(t.title),r=ky(t.subtitle),i=ky(t.focus),a=ky(t.warning);if(!n||!r||!i||!a||!Array.isArray(t.fields))return null;let o=[];for(let e of t.fields){let t=Oy(e),n=ky(t?.label),r=ky(t?.value);if(!n||!r)return null;o.push({label:n,value:r})}return{title:n,subtitle:r,focus:i,fields:o,warning:a}}function Fy(e){let t=Oy(e);if(t?.action_kind!==`operation.execute`)return;let n=Oy(t.normalized_parameters),r=Oy(t.operation);if(!n||r?.schema_version!==`loopx_operation_envelope_v0`)return;let i=ky(r.operation_id),a=ky(r.confirmation_digest),o=ky(r.expires_at),s=Py(n);if(!i||!a||!o||!s||i!==t.proposal_id)return;let c=r.lifecycle_state;if(c!==`awaiting_confirmation`&&c!==`claimed`&&c!==`outcome_observed`)return;let l={schemaVersion:`operation_review_frame_v0`,operationId:i,confirmationDigest:a,lifecycleState:c,simulated:Oy(n.projection).simulated===!0,expiresAt:o,content:s};if(c===`awaiting_confirmation`)return{...l,kind:`confirmation`,attentionKind:`authority`,interactionMode:`confirm_reject`,decisions:[`confirm`,`reject`]};if(c===`claimed`)return{...l,kind:`pending`,attentionKind:`progress`,interactionMode:`inform`};let u=Oy(r.outcome);if(!u)return;let d=u.outcome===`rejected_by_operator`,f=u.simulation===!0||l.simulated;return{...l,kind:`result`,attentionKind:`progress`,interactionMode:`inform`,resultKind:d?`rejected`:f?`simulation_completed`:`completed`,resultDeliveryVerified:Oy(r.result_delivery)!==null,summary:ky(u.summary)??``}}function Iy(e){let t=Oy(e)??{},n={schemaVersion:`action_review_plan_v0`,proposalId:typeof t.proposal_id==`string`?t.proposal_id:``,sourceFingerprint:typeof t.expected_state_fingerprint==`string`?t.expected_state_fingerprint:``},r=Fy(t),i=Ny(t),a=e=>({...n,...e,...r?{operationFrame:r}:{},...i?{reviewCardFrame:i}:{}}),o=(e,t)=>a({interaction:e,reason:t,canApply:!1}),s=t.action_kind===`goal.lifecycle`;if(s&&t.gate!=null||t.status===`gated`)return o(`gated`,`authority_gate`);if(s&&t.stale!=null||t.status===`stale`)return o(`refresh`,`stale_proposal`);if(t.status===`applied`)return Oy(t.receipt)?.projection_verified===!0&&(t.action_kind!==`operation.execute`||Oy(Oy(t.operation)?.result_delivery)!==null)?o(`completed`,`readback_verified`):o(`repair`,`readback_unverified`);if(t.status===`applying`)return o(`pending`,`apply_pending`);if(t.status===`failed`||t.error!=null)return o(`repair`,`apply_failed`);if(t.status!==`preview_ready`&&t.status!==`deferred`)return o(`inactive`,`inactive_proposal`);let c=(e,t=!0)=>a({interaction:`review`,reason:e,canApply:t});if(t.action_kind!==`goal.lifecycle`)return c(t.permission_classification===`protected`?`protected_action`:`action_review`);let l=t.validation_evidence,u=t.available_transitions;if(!(ky(t.proposal_id)!==null&&ky(t.expected_state_fingerprint)!==null&&Array.isArray(l)&&l.length>0&&l.every(e=>ky(e)!==null)&&Array.isArray(u)&&u.includes(`apply`)))return o(`refresh`,`incomplete_proposal`);let d=Oy(t.normalized_parameters),f=Oy(t.context),p=d?.operation,m=ky(d?.goal_id);if(!m||f?.goal_id!=null&&f.goal_id!==m)return o(`refresh`,`incomplete_proposal`);if(p!==`stop`&&p!==`resume`&&p!==`delete`)return c(`unknown_action`,!1);if(t.permission_classification===`protected`)return c(`protected_action`);if(t.permission_classification!==`durable_write`)return c(`unknown_permission`,!1);let h=Dy[p];return h===`ready_stop`&&t.status===`preview_ready`?a({interaction:`direct`,reason:h,canApply:!0}):c(h===`ready_stop`?`action_review`:h)}function Ly(e){return e.error_code===`action_stale`||e.error_code===`action_conflict`||Oy(e.proposal)?.status===`stale`}function Ry(e){return typeof e==`object`&&e?e:{}}function zy(e){return typeof e==`string`?e:``}function By(e,t){let n=Ry(e.plan),r=[],i=zy(e.goal_id)||zy(n.goal_id);i&&r.push({key:`goal_id`,label:t(`proposal.field.goalId`),value:i});let a=zy(n.objective);a&&r.push({key:`objective`,label:t(`proposal.field.objective`),value:a}),(Array.isArray(n.lanes)?n.lanes:[]).forEach((e,n)=>{let i=Ry(e),a=zy(i.lane_id)||`lane-${n+1}`,o=zy(i.agent_id),s=zy(i.acceptance);if(zy(i.staffing)===`gap`){let e=Ry(i.declined_first_todo);r.push({key:`lane_${a}`,label:o||a,value:[t(`proposal.teamPlan.gapLane`),Gy(zy(i.gap_reason_code),t),zy(e.text)].filter(Boolean).join(` · `)});return}let c=Ry(i.first_todo),l=[zy(c.priority),zy(c.action_kind),zy(c.text)].filter(Boolean).join(` · `);r.push({key:`lane_${a}`,label:o||a,value:[l||t(`proposal.teamPlan.laneUnstaffed`),s?`${t(`proposal.teamPlan.acceptanceShort`)}: ${s}`:``].filter(Boolean).join(` · `)})});let o=Ry(n.quota_envelope),s=Object.entries(o);s.length>0&&r.push({key:`quota_envelope`,label:t(`proposal.field.quotaEnvelope`),value:s.map(([e,t])=>`${e}: ${String(t??``)}`).join(` · `)+` · ${t(`proposal.teamPlan.advisory`)}`});let c=zy(n.stop_condition);return c&&r.push({key:`stop_condition`,label:t(`proposal.field.stopCondition`),value:`${c} · ${t(`proposal.teamPlan.advisory`)}`}),r}function Vy(e){let t=Ry(e.plan);return Array.isArray(t.lanes)?t.lanes.length:0}function Hy(e){let t=Ry(e.plan);return zy(e.goal_id)||zy(t.goal_id)}function Uy(e,t){let n=Ry(e),r=Ry(t.plan),i=(Array.isArray(r.lanes)?r.lanes:[]).map(Ry);return(Array.isArray(n.lanes)?n.lanes:[]).map(e=>{let t=Ry(e),n=zy(t.lane_id),r=i.find(e=>e.lane_id===n);return{laneId:n,agentId:zy(t.agent_id),task:zy(Ry(r?.first_todo).text)||n}}).filter(e=>e.laneId.length>0)}function Wy(e,t={}){let n=Ry(e),r=Ry(t.plan),i=(Array.isArray(r.lanes)?r.lanes:[]).map(Ry);return(Array.isArray(n.gap_lanes)?n.gap_lanes:[]).map(e=>{let t=Ry(e);return{laneId:zy(t.lane_id),agentId:zy(t.agent_id),reasonCode:zy(t.reason_code),task:zy(Ry(i.find(e=>e.lane_id===t.lane_id)?.declined_first_todo).text)}}).filter(e=>e.laneId.length>0)}function Gy(e,t){return e===`agent_not_registered`?t(`proposal.teamPlan.gapReason.agentNotRegistered`):e===`action_kind_not_supported`?t(`proposal.teamPlan.gapReason.actionKindNotSupported`):e===`capability_not_granted`?t(`proposal.teamPlan.gapReason.capabilityNotGranted`):e===`audience_not_authorized`?t(`proposal.teamPlan.gapReason.audienceNotAuthorized`):e}function Ky(e){let t=Ry(e),n=zy(t.outcome),r=Array.isArray(t.lanes)?t.lanes.length:0,i=typeof t.gap_count==`number`?t.gap_count:0;return n===`team_plan_partially_applied`?{kind:`partially_applied`,created:r,gaps:i}:n===`team_plan_lanes_already_present`||n===`team_plan_commit_recovered`?{kind:`already_present`,created:r,gaps:i}:n===`team_plan_applied`?{kind:`applied`,created:r,gaps:i}:null}function qy(e,t){return e?.kind===`partially_applied`?t(`proposal.teamPlan.appliedPartially`,{created:String(e.created),gaps:String(e.gaps)}):e?.kind===`already_present`?t(`proposal.teamPlan.appliedAlreadyPresent`):t(e?.kind===`applied`?`proposal.teamPlan.applied`:`drawer.proposalApplied`,{count:e?.created??0})}function Jy(e){return{blockingTodoCount:e.blockingTodoCount,goalNotifications:e.goalNotifications,goals:e.goals,openUserTodoCount:e.openUserTodoCount,systemHealth:e.systemHealth,attentionHistory:e.attentionHistory,userTodos:e.userTodos,workers:e.workers}}function Yy(e,t){return e.goals.find(e=>e.goalId===t)?.title??t}function Xy(e){return e.activationState===`stopped`||e.state===`已停止`?`stopped`:e.state===`已完成`?`history`:e.needsYou||e.state===`等你`?`needs_you`:e.state===`推进中`||e.state===`需修复`?`running`:e.state===`安静运行`?`observing`:`scheduled`}function Zy(e){let t=e;return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Qy(e){return`$${e.toFixed(2)}`}function $y(e){let t=e;return t>=36e5?`${(t/36e5).toFixed(1)}h`:t>=6e4?`${(t/6e4).toFixed(1)}m`:t>=1e3?`${Math.round(t/1e3)}s`:`${t}ms`}function eb(e,t,n){return e==null?t:n(e)}function tb(e){return!!(e&&[e.tokens24h,e.tokens7d,e.costUsd24h,e.costUsd7d,e.durationMs24h,e.durationMs7d].some(e=>e!=null))}function nb(e,t){if(!tb(e))return null;let n=(e,n,r,i)=>{let a=[n==null?null:`${Zy(n)} ${t.tokens}`,r==null?null:`${t.cost}: ${Qy(r)}`,i==null?null:`${t.duration}: ${$y(i)}`].filter(e=>e!==null);return a.length?`${e} ${a.join(` · `)}`:null};return n(t.period7d,e.tokens7d,e.costUsd7d,e.durationMs7d)??n(t.period24h,e.tokens24h,e.costUsd24h,e.durationMs24h)}function rb({ariaLabel:e,className:t,icon:n,onChange:r,options:i,prefixLabel:a,value:o}){let s=(0,z.useId)(),c=(0,z.useRef)(null),l=(0,z.useRef)(null),u=(0,z.useRef)(new Map),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(o),h=i.find(e=>e.value===o)??i[0],g=i.filter(e=>!e.disabled);(0,z.useEffect)(()=>{if(!d)return;let e=e=>{c.current?.contains(e.target)||f(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[d]),(0,z.useEffect)(()=>{d&&u.current.get(p)?.focus()},[p,d]);function _(e){m(e)}function v(e=`selected`){let t=e===`last`?g.at(-1):g[0],n=e===`selected`&&h&&!h.disabled?h:t;n&&(f(!0),_(n.value))}function y({restoreFocus:e=!1}={}){f(!1),e&&l.current?.focus()}function b(e){e.disabled||(r(e.value),y({restoreFocus:!0}))}function x(e){if(!g.length)return;let t=g.findIndex(e=>e.value===p),n=t<0?0:(t+e+g.length)%g.length;_(g[n].value)}function S(e){e.key===`ArrowDown`||e.key===`Enter`||e.key===` `?(e.preventDefault(),v(`selected`)):e.key===`ArrowUp`&&(e.preventDefault(),v(`last`))}function C(e,t){if(e.key===`ArrowDown`)e.preventDefault(),x(1);else if(e.key===`ArrowUp`)e.preventDefault(),x(-1);else if(e.key===`Home`)e.preventDefault(),g[0]&&_(g[0].value);else if(e.key===`End`){e.preventDefault();let t=g.at(-1);t&&_(t.value)}else e.key===`Enter`||e.key===` `?(e.preventDefault(),b(t)):e.key===`Escape`?(e.preventDefault(),y({restoreFocus:!0})):e.key===`Tab`&&y()}let w;return(0,B.jsxs)(`div`,{className:`personal-select${t?` ${t}`:``}`,ref:c,children:[(0,B.jsxs)(`button`,{"aria-controls":s,"aria-expanded":d,"aria-haspopup":`listbox`,"aria-label":e,className:`personal-select-trigger`,"data-value":o,onClick:()=>d?y():v(),onKeyDown:S,ref:l,role:`combobox`,type:`button`,children:[n?(0,B.jsx)(`span`,{className:`personal-select-icon`,children:n}):null,(0,B.jsxs)(`span`,{className:`personal-select-value`,children:[a?(0,B.jsx)(`small`,{children:a}):null,(0,B.jsx)(`span`,{children:h?.label??o})]}),(0,B.jsx)(sm,{"aria-hidden":!0,className:d?`is-open`:void 0,size:14})]}),d?(0,B.jsx)(`div`,{"aria-label":e,className:`personal-select-listbox`,id:s,role:`listbox`,children:i.map(e=>{let t=e.group&&e.group!==w;return w=e.group,(0,B.jsxs)(`div`,{className:`personal-select-option-wrap`,children:[t?(0,B.jsx)(`div`,{className:`personal-select-group-label`,children:e.group}):null,(0,B.jsxs)(`button`,{"aria-disabled":e.disabled||void 0,"aria-selected":e.value===o,className:`personal-select-option`,disabled:e.disabled,id:`${s}-${e.value.replace(/[^a-z0-9_-]/gi,`-`)}`,onClick:()=>b(e),onFocus:()=>m(e.value),onKeyDown:t=>C(t,e),ref:t=>{t?u.current.set(e.value,t):u.current.delete(e.value)},role:`option`,tabIndex:e.value===p?0:-1,type:`button`,children:[(0,B.jsx)(`span`,{children:e.label}),e.value===o?(0,B.jsx)(om,{"aria-hidden":!0,size:15}):null]})]},e.value)})}):null]})}function ib({agents:e,managerChannelBinding:t,managerChatOpen:n,managerRuntime:r,mobileNavigationOpen:i,onOpenGoalCapabilities:a,onOpenManagerChat:o,onRefresh:s,onOpenNavigation:c,onSelectGoalTab:l,onSelectAgent:u,onReturnManagerHome:d,refreshState:f,readOnlySourceLabel:p,selectedAgentId:m,selectedGoal:h,selectedGoalTab:g}){let{locale:_,t:v}=Ji(),y=h?nb(h.usage,{cost:v(`drawer.costShort`),duration:v(`drawer.durationShort`),period24h:v(`drawer.period24h`),period7d:v(`drawer.period7d`),tokens:v(`drawer.tokensShort`)}):null,b=t?t.executor_kind===`individual`?v(`header.managerExecutorKindIndividual`):t.executor_kind===`managed`?v(`header.managerExecutorKindManaged`):v(`header.managerExecutorKindRegistered`):null,x=t?.available===!1,S=t?.available===!1?t.unavailable_reason:null,C=S===`operator_credential_unconfigured`?`header.managerExecutionUnavailableCredential`:S===`dsh_runtime_unavailable`?`header.managerExecutionUnavailableRuntime`:S===`invalid_reasoning_effort`?`header.managerExecutionUnavailableEffort`:`header.managerExecutionUnavailable`,w=t&&t.executor_endpoint_source===`product_default`&&t.executor_endpoint_default_reason===`steward_channel_default`?`header.managerEndpointStewardDefault`:null,T=p?(0,B.jsxs)(`span`,{className:`personal-read-only-source`,title:v(`header.readOnlySourceDescription`,{source:p}),children:[(0,B.jsx)(ym,{size:15}),p,(0,B.jsx)(`small`,{children:v(`common.readOnly`)})]}):(0,B.jsx)(rb,{ariaLabel:v(`header.selectChatRuntime`),className:`personal-agent-select`,icon:(0,B.jsx)(rm,{size:16}),onChange:u,options:e.map(e=>({disabled:!e.available,label:`${e.label}${e.available?``:` · ${v(`header.agentUnavailable`)}`}`,value:e.agentId})),prefixLabel:v(`header.chatRuntime`),value:m});return(0,B.jsxs)(`header`,{className:`personal-channel-header`,"data-goal-selected":!!h,children:[(0,B.jsx)(`button`,{"aria-expanded":i??!1,"aria-label":v(`header.openGoalNavigation`),className:`personal-icon-button personal-mobile-menu`,onClick:c,type:`button`,children:(0,B.jsx)(Mm,{size:18})}),(0,B.jsxs)(`div`,{className:`personal-channel-title`,children:[(0,B.jsx)(`h1`,{children:h?.title??v(`header.manager`)}),!h&&r?(0,B.jsx)(`p`,{children:r.status===`ready`?v(`header.managerRuntime`,{profile:r.runtime_profile,sandbox:r.sandbox}):v(`header.managerRuntimeFallback`,{profile:r.runtime_profile,sandbox:r.sandbox})}):null,!h&&t?(0,B.jsxs)(`p`,{className:`personal-manager-execution`,children:[(0,B.jsxs)(`span`,{className:x?`personal-execution-chip is-unavailable`:`personal-execution-chip`,children:[(0,B.jsx)(`span`,{className:`personal-execution-chip-endpoint`,children:t.executor_endpoint}),b?(0,B.jsx)(`span`,{className:`personal-execution-chip-kind`,children:b}):null,(0,B.jsx)(`span`,{className:`personal-execution-chip-model`,children:t.model})]}),x?(0,B.jsx)(`span`,{className:`personal-execution-note`,children:v(C,{executor:t.executor_endpoint,credential:t.credential_env_var})}):null,w?(0,B.jsx)(`span`,{className:`personal-execution-rule-note`,children:v(w,{executor:t.executor_endpoint})}):null]}):null,h?(0,B.jsx)(`p`,{children:h.loadState?v(h.loadState===`error`?`startup.goalError`:`startup.goalLoading`):`${h.agentLaneCount&&h.agentLaneCount>1?v(`header.workAgentCount`,{count:h.agentLaneCount}):h.agentLabel??h.agentId} · ${h.loadState?v(h.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Yi(h.state,_)}${y?` · ${y}`:``} · ${h.nextSentence}`}):null]}),h?(0,B.jsxs)(`div`,{className:`personal-goal-navigation`,children:[(0,B.jsxs)(`nav`,{"aria-label":v(`header.goalView`),className:`personal-goal-tabs`,children:[(0,B.jsx)(`button`,{"aria-current":g===`overview`?`page`:void 0,onClick:()=>l(`overview`),type:`button`,children:v(`header.overview`)}),(0,B.jsx)(`button`,{"aria-current":g===`tasks`?`page`:void 0,onClick:()=>l(`tasks`),type:`button`,children:v(`header.tasks`)}),(0,B.jsx)(`button`,{"aria-current":g===`chat`?`page`:void 0,onClick:()=>l(`chat`),type:`button`,children:v(`header.chat`)}),(0,B.jsx)(`button`,{"aria-current":g===`files`?`page`:void 0,onClick:()=>l(`files`),type:`button`,children:v(`header.files`)})]}),T]}):(0,B.jsxs)(`nav`,{"aria-label":v(`header.managerView`),className:`personal-goal-tabs`,children:[(0,B.jsx)(`button`,{"aria-current":n?void 0:`page`,onClick:d,type:`button`,children:v(`header.managerOverview`)}),(0,B.jsx)(`button`,{"aria-current":n?`page`:void 0,onClick:o,type:`button`,children:v(`header.chat`)})]}),(0,B.jsxs)(`div`,{className:`personal-channel-actions`,children:[h&&a?(0,B.jsx)(`button`,{"aria-label":v(`header.goalSettings`),title:v(`header.goalSettingsDescription`),className:`personal-icon-button personal-goal-settings-action`,onClick:a,type:`button`,children:(0,B.jsx)(Qm,{"aria-hidden":!0,size:17})}):null,h?null:T,(0,B.jsxs)(`span`,{className:`personal-live-indicator`,children:[(0,B.jsx)(`i`,{}),v(`header.live`)]}),s?(0,B.jsxs)(`span`,{className:`personal-refresh-control is-${f??`idle`}`,children:[f===`loading`?(0,B.jsx)(`small`,{children:v(`header.refreshing`)}):f===`done`?(0,B.jsx)(`small`,{children:v(`header.refreshDone`)}):f===`error`?(0,B.jsx)(`small`,{children:v(`header.refreshFailed`)}):null,(0,B.jsx)(`button`,{"aria-label":v(f===`loading`?`header.refreshing`:`header.refresh`),className:`personal-icon-button`,disabled:f===`loading`,onClick:s,type:`button`,children:(0,B.jsx)(Um,{className:f===`loading`?`is-spinning`:void 0,size:17})})]}):null]})]})}function ab({attention:e,onSelect:t}){let{t:n}=Ji(),r=Zi(e.updatedAt,n);return(0,B.jsxs)(`button`,{className:`personal-timeline-row personal-attention-row`,"data-testid":`personal-browse-row`,onClick:t,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-row-icon is-attention`,children:(0,B.jsx)(um,{size:18})}),(0,B.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,B.jsxs)(`small`,{children:[e.goalTitle??e.goalId,` · `,n(`home.lane.needsYou`),r?` · ${n(`tasks.waitingAge`,{age:r})}`:``]}),(0,B.jsx)(`strong`,{children:e.text})]}),(0,B.jsx)(`span`,{className:`personal-priority-dot is-${e.priority??(e.blocking?`high`:`medium`)}`}),(0,B.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?n(`tasks.blocked`):n(`tasks.pending`)}),(0,B.jsx)(cm,{size:17})]})}var ob=/(`[^`\n]+`)|(\*\*[^*\n]+(\*[^*\n]*)?\*\*)|(\[[^\]\n]{1,120}\]\(https?:\/\/[^)\s]+\))/g;function sb(e,t){let n=[],r=0,i=0;for(let a of e.matchAll(ob)){let o=a.index??0;o>r&&n.push(e.slice(r,o));let s=a[0],c=`${t}-i${i++}`;if(s.startsWith("`"))n.push((0,B.jsx)(`code`,{className:`personal-md-code`,children:s.slice(1,-1)},c));else if(s.startsWith(`**`))n.push((0,B.jsx)(`strong`,{children:s.slice(2,-2)},c));else{let e=s.indexOf(`](`),t=s.slice(1,e),r=s.slice(e+2,-1);n.push((0,B.jsx)(`a`,{className:`personal-md-link`,href:r,rel:`noreferrer`,target:`_blank`,children:t},c))}r=o+s.length}return r{r.length>0&&(n.push({type:`paragraph`,lines:r}),r=[])},a=0;for(;a{let n=`b${t}`;if(e.type===`code`)return(0,B.jsx)(`pre`,{className:`personal-md-pre`,children:(0,B.jsx)(`code`,{children:e.text})},n);if(e.type===`heading`)return(0,B.jsx)(`p`,{className:`personal-md-heading is-h${e.level}`,children:ib(e.text,n)},n);if(e.type===`list`){let t=e.items.map((e,t)=>(0,B.jsx)(`li`,{children:ib(e,`${n}-${t}`)},`${n}-${t}`));return e.ordered?(0,B.jsx)(`ol`,{className:`personal-md-list`,children:t},n):(0,B.jsx)(`ul`,{className:`personal-md-list`,children:t},n)}return(0,B.jsx)(`p`,{children:e.lines.map((e,t)=>(0,B.jsxs)(z.Fragment,{children:[t>0?(0,B.jsx)(`br`,{}):null,ib(e,`${n}-${t}`)]},`${n}-${t}`))},n)})})}function lb({onSelect:e,output:t}){let{t:n}=Ji(),r=t.kind===`report`?xm:bm;return(0,B.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,B.jsx)(`span`,{className:`personal-row-icon is-output`,children:(0,B.jsx)(r,{size:18})}),(0,B.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,B.jsxs)(`small`,{children:[t.goalTitle??t.goalId,` · `,t.agentLabel??`LoopX`]}),(0,B.jsx)(`strong`,{children:t.title}),t.summary?(0,B.jsx)(`span`,{children:t.summary}):null,t.report?(0,B.jsxs)(`small`,{children:[n(`files.reportDelta`,{added:t.report.addedCount,changed:t.report.changedCount}),` · `,n(`files.verifiedReport`)]}):null]}),t.createdAt?(0,B.jsx)(`time`,{children:t.createdAt}):null,(0,B.jsx)(sm,{size:17})]})}var ub={completed:`runs.completed`,failed:`runs.failed`,interrupted:`runs.interrupted`,queued:`runs.queued`,running:`runs.running`,waiting:`runs.waiting`};function db({onSelect:e,run:t}){let{t:n}=Ji(),r=t.totalSteps>0?Math.min(100,t.completedSteps/t.totalSteps*100):0;return(0,B.jsxs)(`button`,{"aria-label":`${n(`tasks.viewExecution`)}:${t.title}`,className:`personal-timeline-row personal-run-row`,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-row-icon is-run`,children:(0,B.jsx)(nm,{size:18})}),(0,B.jsxs)(`span`,{className:`personal-run-identity`,children:[(0,B.jsx)(`small`,{children:t.goalTitle}),(0,B.jsx)(`strong`,{children:t.agentLabel})]}),(0,B.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,B.jsx)(`strong`,{children:t.title}),(0,B.jsx)(`small`,{children:t.latestActivity})]}),(0,B.jsxs)(`span`,{className:`personal-run-progress`,"aria-label":`${t.completedSteps}/${t.totalSteps}`,children:[(0,B.jsxs)(`small`,{children:[t.completedSteps,`/`,t.totalSteps]}),(0,B.jsx)(`i`,{children:(0,B.jsx)(`b`,{style:{width:`${r}%`}})})]}),(0,B.jsxs)(`span`,{className:`personal-row-status is-${t.status}`,children:[t.status===`running`?(0,B.jsx)(km,{className:`personal-spin`,size:14}):null,n(ub[t.status])]}),t.sessionId?(0,B.jsx)(`span`,{className:`personal-run-open-label`,children:n(`tasks.viewExecution`)}):null,(0,B.jsx)(sm,{size:17})]})}function fb({onSelect:e,schedule:t}){let{t:n}=Ji(),r=t.scheduleKind===`heartbeat`;return(0,B.jsxs)(`button`,{"aria-label":`${r?`Heartbeat`:n(`tasks.scheduled`)}:${t.label};${t.status??`active`}`,className:`personal-schedule-row`,onClick:e,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-schedule-icon`,children:r?(0,B.jsx)(Vm,{size:17}):(0,B.jsx)(im,{size:17})}),(0,B.jsxs)(`span`,{className:`personal-schedule-copy`,children:[(0,B.jsx)(`small`,{children:n(r?`schedule.heartbeat`:`schedule.monitor`)}),(0,B.jsx)(`strong`,{children:t.label}),(0,B.jsx)(`p`,{children:t.schedule??n(`schedule.summary`)})]}),(0,B.jsx)(`span`,{className:`personal-schedule-status is-${t.status??`active`}`,children:t.status===`paused`?n(`schedule.paused`):n(`schedule.active`)}),(0,B.jsx)(sm,{size:16})]})}function pb({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,B.jsx)(`small`,{className:`personal-return-delivery is-${r}`,role:`status`,children:n})}function mb({items:e,onSelect:t,selectedGoal:n}){let{t:r}=Ji();if(e.length===0)return(0,B.jsxs)(`div`,{className:`personal-timeline-empty`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(Qm,{size:20})}),(0,B.jsx)(`strong`,{children:r(n?`timeline.emptyGoal`:`timeline.emptyWorkspace`)}),(0,B.jsx)(`p`,{children:r(n?`timeline.emptyGoalDescription`:`timeline.emptyWorkspaceDescription`)})]});let i=[...e].reverse().find(e=>e.kind===`message`&&e.message.role!==`user`||e.kind===`proposal`&&[`applied`,`stale`,`error`,`gated`].includes(e.proposal.status)||e.kind===`run`&&e.run.status===`completed`),a=i?.kind===`message`?`${i.message.agentLabel??r(`header.manager`)}:${i.message.pending?r(`timeline.pending`):i.message.text}`:i?.kind===`proposal`?`${i.proposal.title}:${i.proposal.status}`:i?.kind===`run`?r(`timeline.runCompleted`,{run:i.run.title}):``,o=e.filter(e=>e.kind===`proposal`&&e.proposal.status===`gated`),s=e.filter(e=>e.kind!==`proposal`),c=e.filter(e=>e.kind===`proposal`&&e.proposal.status!==`gated`);function l(e){return e.kind===`attention`?(0,B.jsx)(nb,{attention:e.attention,onSelect:()=>t({item:e.attention,kind:`attention`})},e.id):e.kind===`run`?(0,B.jsx)(db,{onSelect:()=>t({item:e.run,kind:`run`}),run:e.run},e.id):e.kind===`output`?(0,B.jsx)(lb,{onSelect:()=>t({item:e.output,kind:`output`}),output:e.output},e.id):e.kind===`schedule`?(0,B.jsx)(fb,{onSelect:()=>t({item:e.schedule,kind:`schedule`}),schedule:e.schedule},e.id):e.kind===`proposal`?(0,B.jsxs)(`button`,{className:`personal-proposal-row is-${e.proposal.status}`,onClick:()=>t({item:e.proposal,kind:`proposal`}),type:`button`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(Qm,{size:17})}),(0,B.jsxs)(`span`,{children:[(0,B.jsxs)(`small`,{children:[e.proposal.actionKind,` · `,e.proposal.status]}),(0,B.jsx)(`strong`,{children:e.proposal.title}),(0,B.jsx)(`p`,{children:e.proposal.impact})]}),(0,B.jsx)(`b`,{children:e.proposal.status===`gated`&&e.proposal.actionKind!==`operation.execute`?r(`timeline.review`):e.proposal.primaryLabel??r(`timeline.reviewAndConfirm`)})]},e.id):(0,B.jsxs)(`article`,{className:`personal-message is-${e.message.role}`,children:[e.message.role===`user`?null:(0,B.jsx)(`span`,{className:`personal-message-avatar`,children:(0,B.jsx)(nm,{size:17})}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:e.message.role===`user`?r(`common.you`):e.message.agentLabel??r(`header.manager`)}),e.message.time?(0,B.jsx)(`time`,{children:e.message.time}):null]}),e.message.attachments?.length?(0,B.jsx)(`div`,{className:`personal-message-images`,children:e.message.attachments.map(e=>(0,B.jsx)(`img`,{alt:e.name,src:e.dataUrl},e.id))}):null,e.message.role===`user`?(0,B.jsx)(`p`,{children:e.message.text}):(0,B.jsx)(cb,{text:e.message.text}),e.message.pending?(0,B.jsx)(`span`,{className:`personal-message-pending`,children:r(`timeline.pending`)}):null,(0,B.jsx)(pb,{delivery:e.message.returnDelivery})]})]},e.id)}return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{"aria-atomic":`true`,"aria-live":`polite`,className:`personal-live-region`,role:`status`,children:a}),(0,B.jsxs)(`div`,{className:`personal-channel-timeline`,children:[s.map(l),o.length?(0,B.jsxs)(`details`,{className:`personal-gated-summary`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(Qm,{size:16})}),(0,B.jsx)(`strong`,{children:r(`timeline.waitingConfirmation`)}),(0,B.jsx)(`small`,{children:r(`timeline.gateHistory`,{count:o.length})})]}),(0,B.jsx)(`div`,{children:o.map(l)})]}):null,c.map(l)]})]})}function hb({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,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-acceptance`,"aria-label":t(`acceptance.title`),children:[(0,B.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,B.jsx)(`h3`,{children:t(`acceptance.title`)}),(0,B.jsx)(`em`,{children:t(`common.readOnly`)})]}),(0,B.jsx)(`p`,{role:`status`,children:t(s?`acceptance.unavailable`:`acceptance.partial`)}),!s&&o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h4`,{children:t(`acceptance.gaps`)}),o.acceptance_gaps.length?o.acceptance_gaps.map((e,i)=>(0,B.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,B.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),e.resolution_hint?(0,B.jsx)(`p`,{children:e.resolution_hint}):null,e.component_checks?(0,B.jsx)(`div`,{children:Object.entries(e.component_checks).map(([e,t])=>(0,B.jsxs)(`p`,{children:[r[e],`: `,n===`zh-CN`?t?`通过`:`未通过`:t?`Passed`:`Failed`]},e))}):null,(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`common.owner`)}),(0,B.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,B.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`acceptance.observed`)}),(0,B.jsx)(`dd`,{children:e.observed_at??t(`acceptance.unknown`)})]})]})]},`${e.kind}:${e.owner}:${i}`)):(0,B.jsx)(`p`,{children:t(`acceptance.noGaps`)}),(0,B.jsx)(`h4`,{children:t(`acceptance.guards`)}),o.guards.length?o.guards.map((e,n)=>(0,B.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,B.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`common.owner`)}),(0,B.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),e.blocks_agent?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`common.agent`)}),(0,B.jsx)(`dd`,{children:e.blocks_agent})]}):null,e.todo_id?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`common.task`)}),(0,B.jsx)(`dd`,{children:e.todo_id})]}):null,(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,B.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`acceptance.scope`)}),(0,B.jsx)(`dd`,{children:e.decision_scope??t(`acceptance.unknown`)})]})]})]},`${e.todo_id}:${n}`)):(0,B.jsx)(`p`,{children:t(`acceptance.noGuards`)}),(0,B.jsx)(`h4`,{children:t(`acceptance.next`)}),(0,B.jsx)(`p`,{children:o.next_action??t(`acceptance.unknown`)}),(0,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{children:[t(`acceptance.historical_progress`),` · `,o.historical_progress.length]}),(0,B.jsx)(`p`,{children:t(`acceptance.historical`)}),o.historical_progress.map(e=>(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`strong`,{children:a(e.kind)}),` · `,e.observed_at??t(`acceptance.unknown`),` `,e.evidence_refs.join(`, `)]},e.kind))]}),o.missing_sources.length?(0,B.jsxs)(`p`,{children:[t(`acceptance.missing`),` `,o.missing_sources.map(a).join(`, `)]}):null,o.truncated?(0,B.jsx)(`p`,{children:t(`acceptance.truncated`)}):null]}):null]})}function gb({item:e,successor:t,onSelect:n}){let{t:r}=Ji(),i=e.details;return(0,B.jsxs)(`section`,{className:`personal-detail-card`,"aria-label":r(`attentionDetail.title`),children:[(0,B.jsx)(`h3`,{children:r(`attentionDetail.title`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`attentionDetail.request`)}),(0,B.jsx)(`dd`,{children:r(i?.interaction===`decision`?`attentionDetail.decision`:`attentionDetail.unknownRequest`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`common.status`)}),(0,B.jsx)(`dd`,{children:r(`attentionDetail.${i?.lifecycle??`unknown`}`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`drawer.reason`)}),(0,B.jsx)(`dd`,{children:i?.reason??e.explanation??r(`attentionDetail.unknownReason`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Todo`}),(0,B.jsx)(`dd`,{children:e.todoId})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`attentionDetail.targetTodo`)}),(0,B.jsx)(`dd`,{children:i?.unblocksTodoId??r(`attentionDetail.notProvided`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`attentionDetail.targetAgent`)}),(0,B.jsx)(`dd`,{children:i?.blocksAgent??r(`attentionDetail.notProvided`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`attentionDetail.scope`)}),(0,B.jsx)(`dd`,{children:i?.decisionScope?`${i.decisionScope.kind} · ${i.decisionScope.granularity} · ${i.decisionScope.scopeKey}`:r(`attentionDetail.notProvided`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`drawer.evidence`)}),(0,B.jsx)(`dd`,{children:i?.evidence??e.evidence??r(`drawer.decisionDefaultEvidence`)})]})]}),i?.supersededBy?(0,B.jsxs)(`p`,{children:[r(`attentionDetail.replacement`),`: `,i.supersededBy]}):null,t&&n?(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>n(t),type:`button`,children:r(`attentionDetail.openReplacement`)}):null,(0,B.jsx)(`p`,{children:r(`attentionDetail.boundary`)})]})}function _b({proposal:e,t}){let n=e.teamPlanOutcome?.kind===`already_present`;return(0,B.jsxs)(`section`,{className:`personal-proposal-card personal-team-plan-result`,children:[(0,B.jsx)(`h3`,{children:Wy(e.teamPlanOutcome??null,t)}),(0,B.jsxs)(`dl`,{className:`personal-team-plan-assignments`,children:[e.teamPlanAssignments?.map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e.agentId||e.laneId}),(0,B.jsx)(`dd`,{children:e.task})]},e.laneId)),e.teamPlanGapLanes?.map(e=>(0,B.jsxs)(`div`,{className:`is-pending`,children:[(0,B.jsx)(`dt`,{children:e.agentId||e.laneId}),(0,B.jsxs)(`dd`,{children:[e.task||e.laneId,(0,B.jsx)(`br`,{}),(0,B.jsxs)(`small`,{children:[t(`proposal.teamPlan.pending`),` · `,Hy(e.reasonCode,t)]})]})]},e.laneId))]}),(0,B.jsx)(`p`,{children:t(n?`proposal.teamPlan.recoveredHint`:`proposal.teamPlan.assignedHint`)}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:t(`proposal.teamPlan.originalPlan`)}),(0,B.jsx)(`dl`,{children:e.fields.map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e.label}),(0,B.jsx)(`dd`,{children:e.value})]},e.key))})]})]})}function vb(e){return e.replace(/\s+/gu,` `).trim()}function yb(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 bb(e){return/(我现在该做什么|下一步|哪些\s*Goal\s*在等我|需要我|谁在等我|Agent\s*在做什么|当前进度|总结(?:今天)?进展)/iu.test(e)}function xb(e){let t=/(怎么|如何|为什么|给.*建议|分析一下|解释|只读)/u.test(e),n=/(解决一下|修复一下|处理一下|执行一下|改一下|跑(?:一下)?测试|rebase|push|提交|推送)/iu.test(e);return!t&&n&&/(帮我|请|给我|直接|现在|开始|bytedcli|codebase|git|rebase|push|提交|推送)/iu.test(e)}function Sb(e){return vb(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 Cb(e,t){let n=vb(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&&!yb(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n);if(!t.goalId&&!yb(n,/goal|目标/iu)&&/(创建|新建|设置|create|start|set up).{0,24}(goal|目标)/iu.test(n)&&r.push({actionKind:`goal.create`,confidence:.97,normalizedParameters:{heartbeat_enabled:!yb(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&&!yb(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&&!yb(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&&!yb(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&&xb(n)&&r.push({actionKind:`todo.create`,confidence:.9,normalizedParameters:{goal_id:t.goalId,start_execution:!0}}),t.goalId&&a){let e=!yb(n,/完成|做完|关闭/u)&&/完成|做完|关闭/u.test(n)?`complete`:!yb(n,/阻塞|卡住/u)&&/阻塞|卡住/u.test(n)?`block`:!yb(n,/暂缓|稍后|推迟/u)&&/暂缓|稍后|推迟/u.test(n)?`defer`:i&&!yb(n,/交给|分配给|改派/u)&&/交给|分配给|改派/u.test(n)?`reassign`:null;if(e){let i=e===`defer`?Sb(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&&bb(n)?{actionKind:null,confidence:.98,missingFields:[],normalizedParameters:{},route:`projection`}:{actionKind:null,confidence:.75,missingFields:[],normalizedParameters:{},route:`agent_chat`}}function wb(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 Tb=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`select:not([disabled])`,`input:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`),Eb=[{key:`drawer.taskBlock`,operation:`block`},{key:`drawer.taskSuccessor`,operation:`successor_create`}],Db=[{key:`drawer.decisionReject`,resolution:`reject`},{key:`drawer.decisionDefer`,resolution:`defer`}],Ob=Array.from({length:32},(e,t)=>t+1),kb=/^[a-z][a-z0-9_.-]{0,63}$/u;function Ab(e){let t=String(e??``).trim().toLowerCase();return kb.test(t)?t:null}function jb(e,t){return e.enabled===t.enabled&&e.maxChildren===t.maxChildren&&JSON.stringify(e.modelConfig??null)===JSON.stringify(t.modelConfig??null)&&[...e.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)===[...t.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)}function Mb({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,z.useState)(``),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(`idle`),[x,S]=(0,z.useState)(`record`),[C,w]=(0,z.useState)([]),[T,E]=(0,z.useState)(null),[D,O]=(0,z.useState)(2),[k,ee]=(0,z.useState)(``),[te,A]=(0,z.useState)(``),[j,M]=(0,z.useState)(`idle`),[ne,N]=(0,z.useState)(null),[P,re]=(0,z.useState)(null),ie=(0,z.useRef)(null),ae=(0,z.useRef)(null),[F,oe]=(0,z.useState)(e.find(e=>e.available)?.agentId??`codex`),[I,se]=(0,z.useState)(``),L=(0,z.useRef)(null),ce=(0,z.useRef)(null),le=(0,z.useRef)(null),ue=(0,z.useRef)(null),de=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,z.useEffect)(()=>{b(`idle`),v(!1),S(`record`),se(``);let e=f.kind===`goal`?f.item.subagentExecution:void 0;w(e?.allowedDomains??[]),ee(e?.modelConfig?.model??``),A(e?.modelConfig?.reasoning_effort??``),O(e?.maxChildren?Math.min(e.maxChildren,32):2),E(null),M(`idle`),N(null),re(null),ie.current=e??null,ae.current=null},[de]);let fe=f.kind===`goal`?f.item.subagentExecution:void 0;(0,z.useEffect)(()=>{let e=ie.current,t=fe?!e||!jb(e,fe):e!==null;if(ie.current=fe??null,!P){t&&fe&&(w(fe.allowedDomains),ee(fe.modelConfig?.model??``),A(fe.modelConfig?.reasoning_effort??``),O(fe.maxChildren||2),E(null),M(`idle`),N(null));return}let n=ae.current;(!fe||jb(P,fe)||n&&!jb(n,fe))&&(fe&&(w(fe.allowedDomains),ee(fe.modelConfig?.model??``),A(fe.modelConfig?.reasoning_effort??``),O(fe.maxChildren||2)),ae.current=null,re(null))},[fe,P]),(0,z.useEffect)(()=>{let e=document.activeElement;e instanceof HTMLElement&&!ce.current?.contains(e)&&(le.current=e);let t=window.requestAnimationFrame(()=>ue.current?.focus());return()=>window.cancelAnimationFrame(t)},[de]);let pe=(0,z.useCallback)(()=>{let e=le.current;c(),window.requestAnimationFrame(()=>e?.focus())},[c]);(0,z.useEffect)(()=>{function e(e){if(e.key===`Escape`){e.preventDefault(),pe();return}if(e.key===`Tab`&&f.kind!==`todo`){let t=Array.from(ce.current?.querySelectorAll(Tb)??[]).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)}},[pe,f.kind]);let me=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.status===`applied`?`drawer.titleProposalApplied`:`drawer.titleProposalConfirm`):f.kind===`schedule`?f.item.scheduleKind===`heartbeat`?`Heartbeat`:m(`drawer.titleSchedule`):m(`drawer.goalDetails`),he=f.kind===`proposal`?f.item.goalId??`manager`:f.item.goalId,ge=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`),_e=f.kind===`goal`?d.find(e=>e.goalId===f.item.goalId&&!!e.sessionId)??d.find(e=>e.goalId===f.item.goalId):null,ve=f.kind===`run`&&(f.item.completedSteps>0||!!f.item.latestActivity||!!f.item.outputs?.length),ye=f.kind===`attention`?Zi(f.item.updatedAt,m):null,be=Sb(I);async function xe(){f.kind!==`run`||!h.trim()||(await r.onCorrectRun?.(f.item,h.trim()),g(``))}async function Se(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??F,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 Ce(e,t,n){u||!Xd(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 we=f.kind===`goal`?P??f.item.subagentExecution??{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0}:{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0},Te=j===`previewing`||j===`applying`,Ee=(()=>{if(f.kind!==`goal`)return[];let e=new Map;for(let t of we.allowedDomains){let n=Ab(t);n&&e.set(n,{matchingTodoCount:0,value:n})}if(we.domainCandidates)for(let t of we.domainCandidates){let n=Ab(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=Ab(t.taskDomain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+1,value:n})}return[...e.values()]})();function De(){w(we.allowedDomains),ee(we.modelConfig?.model??``),A(we.modelConfig?.reasoning_effort??``),O(we.maxChildren||2),E(null),M(`idle`),N(null)}function Oe(){let e=[...new Set(C.map(e=>Ab(e)))];return e.every(e=>!!e)?e:null}function ke(e,t){w(n=>t?[...n,e].filter((e,t,n)=>n.indexOf(e)===t):n.filter(t=>t!==e)),N(null),M(`idle`),E(null)}async function Ae(e,t=e){if(f.kind!==`goal`||!r.onPreviewGoalSubagentConfiguration)return;let n=e?Oe():[];if(t&&!k.trim()&&te){M(`error`),E(m(`drawer.subagentModelRequired`));return}if(e&&!n){M(`error`),E(m(`drawer.subagentDomainInvalid`)),N(null);return}let i={allowedDomains:n??[],enabled:e,goalId:f.item.goalId,maxChildren:e?D:0,...wb(t,k,te)};M(`previewing`),E(m(`drawer.subagentPreviewing`)),N(null);try{let e=await r.onPreviewGoalSubagentConfiguration(i);if(!e.changed){ae.current=fe??null,re({...e.configuration,domainCandidates:we.domainCandidates}),w(e.configuration.allowedDomains),ee(e.configuration.modelConfig?.model??``),A(e.configuration.modelConfig?.reasoning_effort??``),O(e.configuration.maxChildren||2),M(`success`),E(m(`drawer.subagentNoChange`));return}N({...i,changed:e.changed,previewId:e.previewId}),M(`ready`),E(m(`drawer.subagentPreviewReady`))}catch(e){M(`error`),E(e instanceof Error?e.message:m(`drawer.subagentPreviewFailed`))}}async function je(){if(!(!ne||!r.onApplyGoalSubagentConfiguration)){M(`applying`),E(m(`drawer.subagentApplying`));try{let e=await r.onApplyGoalSubagentConfiguration({allowedDomains:ne.allowedDomains,enabled:ne.enabled,goalId:ne.goalId,maxChildren:ne.maxChildren,modelConfig:ne.modelConfig,previewId:ne.previewId});ae.current=fe??null,re({...e,domainCandidates:we.domainCandidates}),w(e.allowedDomains),ee(e.modelConfig?.model??``),A(e.modelConfig?.reasoning_effort??``),O(e.maxChildren||2),M(`success`),E(m(`drawer.subagentApplied`)),N(null);try{await r.onRefresh?.()}catch{M(`warning`),E(m(`drawer.subagentAppliedRefreshFailed`))}}catch(e){M(`error`),E(e instanceof Error?e.message:m(`drawer.subagentApplyFailed`))}}}return(0,B.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:ce,role:`dialog`,children:[(0,B.jsxs)(`header`,{className:`personal-drawer-header${f.kind===`todo`?` is-task-inspector`:``}`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{id:`personal-drawer-title`,ref:ue,tabIndex:-1,children:me}),(0,B.jsx)(`p`,{children:ge})]}),(0,B.jsxs)(`div`,{className:`personal-drawer-header-actions`,children:[f.kind===`todo`&&l?(0,B.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,B.jsx)(Pm,{size:17}):(0,B.jsx)(Am,{size:17})}):null,(0,B.jsxs)(`button`,{"aria-label":m(`drawer.closeDetail`,{context:ge}),className:`personal-icon-button personal-drawer-close`,onClick:pe,ref:L,type:`button`,children:[(0,B.jsx)(Xp,{className:`personal-mobile-back`,size:18}),(0,B.jsx)(ah,{className:`personal-desktop-close`,size:18})]})]})]}),(0,B.jsxs)(`div`,{className:`personal-drawer-body`,children:[f.kind===`attention`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card is-attention`,children:[(0,B.jsx)(`small`,{children:f.item.blocking?m(`drawer.attentionBlocking`):m(`drawer.attentionWaiting`)}),(0,B.jsx)(`h3`,{children:f.item.text}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,B.jsx)(`dd`,{children:f.item.priority??`medium`})]}),ye?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`common.waiting`)}),(0,B.jsx)(`dd`,{children:m(`tasks.waitingAge`,{age:ye})})]}):null]})]}),(0,B.jsx)(gb,{item:f.item,onSelect:n,successor:Yd(f.item,t)}),!u&&Xd(f.item)?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void Ce(f.item,`approve`,m(`common.confirm`)),type:`button`,children:[(0,B.jsx)(am,{size:17}),m(`drawer.decisionReview`)]}),(0,B.jsxs)(`details`,{className:`personal-compact-menu`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(gm,{size:17}),m(`drawer.decisionMore`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{onClick:()=>void r.onExplainDecision?.(f.item),type:`button`,children:[(0,B.jsx)(Mm,{size:16}),m(`drawer.explainDecision`)]}),Db.map(e=>(0,B.jsx)(`button`,{onClick:()=>void Ce(f.item,e.resolution,m(e.key)),type:`button`,children:m(e.key)},e.resolution))]})]})]}):null]}):null,f.kind===`todo`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-task-inspector-summary`,children:[(0,B.jsxs)(`div`,{className:`personal-task-inspector-status`,children:[(0,B.jsxs)(`span`,{className:f.item.done?`is-done`:f.item.status===`blocked`?`is-blocked`:`is-open`,children:[(0,B.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,B.jsx)(`span`,{children:f.item.priority}):null,(0,B.jsx)(`span`,{children:f.item.taskClass===`advancement_task`?m(`drawer.taskAdvancement`):f.item.taskClass??m(`drawer.taskOrdinary`)})]}),(0,B.jsx)(`h3`,{children:f.item.text})]}),(0,B.jsxs)(`section`,{"aria-label":m(`drawer.taskInfo`),className:`personal-task-inspector-fields`,children:[(0,B.jsx)(`h4`,{children:m(`drawer.taskInfo`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`common.owner`)}),(0,B.jsx)(`dd`,{children:f.item.ownerLabel??f.item.claimedBy??m(`drawer.notAssigned`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`common.status`)}),(0,B.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,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,B.jsx)(`dd`,{children:f.item.priority??m(`drawer.notSet`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.dependencies`)}),(0,B.jsx)(`dd`,{children:f.item.dependencies?.join(` · `)||m(`common.none`)})]}),f.item.status===`deferred`||f.item.resumeWhen?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.resumeWhen`)}),(0,B.jsx)(`dd`,{children:f.item.resumeWhen||m(`drawer.notSet`)})]}):null,f.item.resumeWhen?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.resumeState`)}),(0,B.jsx)(`dd`,{children:f.item.resumeReady?m(`drawer.resumeReady`):m(`drawer.resumePending`)})]}):null,f.item.resumeReceiptId?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.resumeReceipt`)}),(0,B.jsx)(`dd`,{children:f.item.resumeReceiptId})]}):null,(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.nextTransition`)}),(0,B.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,B.jsxs)(`div`,{className:`personal-task-inspector-actions`,"aria-label":m(`drawer.taskActions`),children:[(0,B.jsxs)(`details`,{className:`personal-task-management`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(gm,{size:16}),m(`drawer.taskManage`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:m(`drawer.reassign`)}),(0,B.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.reassign`),(0,B.jsx)(`select`,{"aria-label":m(`drawer.reassign`),onChange:e=>oe(e.target.value),value:F,children:e.filter(e=>e.available).map(e=>(0,B.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))}),(0,B.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-${F}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:F,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,B.jsx)(`strong`,{children:m(`drawer.taskDeferUntil`)}),(0,B.jsxs)(`label`,{className:`personal-inline-agent-select personal-inline-resume-when`,children:[m(`drawer.taskDeferUntil`),(0,B.jsx)(`input`,{"aria-label":m(`drawer.taskDeferCondition`),"aria-invalid":!!I.trim()&&!be,onChange:e=>se(e.target.value),placeholder:m(`drawer.taskDeferPlaceholder`),value:I}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,disabled:!be,onClick:()=>void Se(f.item,`defer`,m(`drawer.taskDefer`),be??void 0),type:`button`,children:m(`drawer.taskDeferReview`)}),(0,B.jsx)(`small`,{children:I.trim()&&!be?m(`drawer.taskDeferInvalid`):m(`drawer.taskDeferSupported`)})]}),(0,B.jsx)(`div`,{className:`personal-task-management-secondary`,children:Eb.map(e=>(0,B.jsx)(`button`,{onClick:()=>void Se(f.item,e.operation,m(e.key)),type:`button`,children:m(e.key)},e.operation))})]})]}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void Se(f.item,`complete`,m(`drawer.taskComplete`)),type:`button`,children:[(0,B.jsx)(am,{size:17}),m(`drawer.taskComplete`)]})]}):null,f.item.done?(0,B.jsxs)(`div`,{className:`personal-task-completed-note`,children:[(0,B.jsx)(am,{size:16}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:m(`drawer.taskCompletedTitle`)}),(0,B.jsx)(`small`,{children:m(`drawer.taskCompletedNote`)})]})]}):null]}):null,f.kind===`goal`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,B.jsx)(`small`,{children:Yi(f.item.state,p)}),(0,B.jsx)(`h3`,{children:f.item.title}),(0,B.jsx)(`p`,{children:f.item.agentSentence}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.tokens`)}),(0,B.jsxs)(`dd`,{children:[Zy(f.item.usage?.tokens24h,m(`drawer.usageNotMeasured`),Jy),` / `,Zy(f.item.usage?.tokens7d,m(`drawer.usageNotMeasured`),Jy)]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.cost`)}),(0,B.jsxs)(`dd`,{children:[Zy(f.item.usage?.costUsd24h,m(`drawer.usageNotMeasured`),Yy),` / `,Zy(f.item.usage?.costUsd7d,m(`drawer.usageNotMeasured`),Yy)]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.duration`)}),(0,B.jsxs)(`dd`,{children:[Zy(f.item.usage?.durationMs24h,m(`drawer.usageNotMeasured`),Xy),` / `,Zy(f.item.usage?.durationMs7d,m(`drawer.usageNotMeasured`),Xy)]})]})]})]}),(0,B.jsx)(hb,{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,B.jsxs)(B.Fragment,{children:[f.item.repository?(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-repository`,children:[(0,B.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,B.jsx)(`small`,{children:m(`drawer.repository`)}),(0,B.jsx)(`em`,{children:m(`common.readOnly`)})]}),(0,B.jsxs)(`h3`,{children:[(0,B.jsx)(Sm,{size:16}),f.item.repository.label]}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.branch`)}),(0,B.jsx)(`dd`,{children:f.item.repository.branch||`detached`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Role`}),(0,B.jsx)(`dd`,{children:m(`drawer.repositoryRole`)})]})]}),(0,B.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,B.jsx)(pm,{size:15}),m(y===`copied`?`drawer.copyRepositoryDone`:`drawer.copyRepository`)]}),y===`error`?(0,B.jsx)(`p`,{className:`personal-copy-feedback is-error`,role:`status`,children:m(`drawer.copyRepositoryError`)}):y===`copied`?(0,B.jsx)(`p`,{className:`personal-copy-feedback`,role:`status`,children:m(`drawer.copyRepositorySuccess`)}):null]}):null,u?(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,B.jsx)(`small`,{children:m(`drawer.larkConnection`)}),(0,B.jsx)(`h3`,{children:m(`drawer.remoteDetailsUnavailable`)}),(0,B.jsx)(`p`,{children:m(`drawer.remoteDetailsDescription`)})]}):(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,B.jsx)(`small`,{children:m(`drawer.larkConnection`)}),t?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`h3`,{children:[t.app_label,(0,B.jsx)(`span`,{className:`personal-connection-status`,children:m(`drawer.connected`)})]}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.group`)}),(0,B.jsx)(`dd`,{children:t.chat_name})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.topic`)}),(0,B.jsxs)(`dd`,{children:[`# `,t.topic_name]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.trigger`)}),(0,B.jsx)(`dd`,{children:t.incoming_mode===`mentions`?m(`lark.someoneMentions`):m(`lark.allMessages`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.replyMode`)}),(0,B.jsx)(`dd`,{children:m(`lark.topicReply`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.autoNotify`)}),(0,B.jsx)(`dd`,{children:e?.humanGateAutoNotifyEnabled?m(`common.on`):m(`common.off`)})]}),e?.lastNotifiedAt?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.lastNotification`)}),(0,B.jsx)(`dd`,{children:e.lastNotifiedAt})]}):null]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h3`,{children:m(`drawer.larkNotConfigured`)}),(0,B.jsx)(`p`,{children:m(`drawer.larkNotConfiguredDescription`)})]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onOpenNotificationSettings?.(f.item.goalId),type:`button`,children:[(0,B.jsx)(tm,{size:16}),m(t?`drawer.larkConfigure`:`drawer.larkConnect`)]})]})]})})(),(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-session`,children:[(0,B.jsx)(`small`,{children:m(`drawer.runDetails`)}),_e?.sessionId?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h3`,{children:Xi(_e.sessionStatus??_e.status,m)}),(0,B.jsx)(`p`,{children:_e.title}),r.onOpenRunSession?(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onOpenRunSession?.(_e),type:`button`,children:[(0,B.jsx)(zm,{size:16}),m(`drawer.runLatest`)]}):null]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h3`,{children:m(`drawer.noRun`)}),(0,B.jsx)(`p`,{children:m(`drawer.noRunDescription`)})]})]}),u?null:(0,B.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`heartbeat`,f.item.goalId),type:`button`,children:[(0,B.jsx)(Vm,{size:16}),m(`drawer.setupHeartbeat`)]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`monitor`,f.item.goalId),type:`button`,children:[(0,B.jsx)(im,{size:16}),m(`drawer.scheduleAdd`)]})]}),f.item.subagentExecution?(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-subagents`,children:[(0,B.jsxs)(`div`,{className:`personal-subagent-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:m(`drawer.subagentLabel`)}),(0,B.jsxs)(`h3`,{children:[(0,B.jsx)(nm,{size:16}),m(`drawer.subagentTitle`)]})]}),(0,B.jsxs)(`button`,{"aria-checked":we.enabled,"aria-label":m(ne&&j===`ready`?`drawer.subagentPending`:we.enabled?`drawer.subagentDisable`:`drawer.subagentEnable`),className:`personal-subagent-switch`,"data-pending":ne&&j===`ready`?`true`:void 0,disabled:u||Te||!!ne||!r.onPreviewGoalSubagentConfiguration,onClick:()=>void Ae(!we.enabled),role:`switch`,type:`button`,children:[(0,B.jsx)(`span`,{}),m(ne&&j===`ready`?`drawer.subagentPending`:we.enabled?`common.on`:`common.off`)]})]}),(0,B.jsx)(`p`,{children:m(`drawer.subagentDescription`)}),ne&&j===`ready`?(0,B.jsxs)(`div`,{className:`personal-subagent-preview`,children:[(0,B.jsx)(`strong`,{children:m(ne.enabled?`drawer.subagentConfirmEnable`:`drawer.subagentConfirmDisable`)}),(0,B.jsx)(`p`,{children:ne.enabled?m(`drawer.subagentPreviewSummary`,{count:ne.maxChildren,domains:ne.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)}):m(`drawer.subagentDisableSummary`)}),ne.modelConfig===void 0?null:(0,B.jsxs)(`p`,{children:[m(`drawer.subagentModel`),`: `,ne.modelConfig?.model||m(`drawer.subagentModelDefault`),` · `,ne.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`button`,{className:`personal-primary-action`,onClick:()=>void je(),type:`button`,children:m(`common.confirm`)}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:De,type:`button`,children:m(`common.cancel`)})]})]}):null,T?(0,B.jsxs)(`p`,{className:`personal-subagent-feedback is-${j}`,role:`status`,children:[j===`previewing`||j===`applying`?(0,B.jsx)(Um,{className:`personal-spin`,size:13}):null,T]}):null,(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.subagentModel`)}),(0,B.jsx)(`dd`,{children:we.modelConfig?.model||m(`drawer.subagentModelDefault`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.subagentEffort`)}),(0,B.jsx)(`dd`,{children:we.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.subagentCurrentBoundary`)}),(0,B.jsx)(`dd`,{children:we.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.subagentChildLimit`)}),(0,B.jsx)(`dd`,{children:we.maxChildren||0})]})]}),u?(0,B.jsx)(`p`,{className:`personal-subagent-read-only`,children:m(`drawer.subagentRemoteReadOnly`)}):(0,B.jsxs)(`div`,{className:`personal-subagent-fields`,children:[(0,B.jsxs)(`fieldset`,{className:`personal-subagent-domain-picker`,disabled:Te,children:[(0,B.jsx)(`legend`,{children:m(`drawer.subagentDomains`)}),Ee.length>0?(0,B.jsx)(`div`,{className:`personal-subagent-domain-options`,children:Ee.map(e=>{let t=C.includes(e.value);return(0,B.jsxs)(`label`,{className:`personal-subagent-domain-option${t?` is-selected`:``}`,children:[(0,B.jsx)(`input`,{"aria-label":e.value,checked:t,onChange:t=>ke(e.value,t.target.checked),type:`checkbox`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.value}),(0,B.jsx)(`small`,{children:m(`drawer.subagentDomainTodoCount`,{count:e.matchingTodoCount})})]})]},e.value)})}):(0,B.jsx)(`p`,{className:`personal-subagent-domain-empty`,children:m(`drawer.subagentDomainsEmpty`)}),(0,B.jsx)(`small`,{children:m(`drawer.subagentDomainsHint`)})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:m(`drawer.subagentModel`)}),(0,B.jsx)(`input`,{"aria-label":m(`drawer.subagentModel`),disabled:Te,value:k,placeholder:`gpt-5.6-luna`,onChange:e=>{ee(e.target.value),N(null),M(`idle`),E(null)}})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:m(`drawer.subagentEffort`)}),(0,B.jsxs)(`select`,{"aria-label":m(`drawer.subagentEffort`),disabled:Te,value:te,onChange:e=>{A(e.target.value),N(null),M(`idle`),E(null)},children:[(0,B.jsx)(`option`,{value:``,children:m(`drawer.subagentModelDefault`)}),[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`].map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,disabled:Te,type:`button`,onClick:()=>{ee(`gpt-5.6-luna`),A(`max`),N(null),M(`idle`),E(null)},children:m(`drawer.subagentLunaPreset`)}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,disabled:Te,type:`button`,onClick:()=>{ee(``),A(``),N(null),M(`idle`),E(null)},children:m(`drawer.subagentClearModel`)}),(0,B.jsx)(`p`,{children:m(`drawer.subagentModelHint`)}),(0,B.jsxs)(`label`,{className:`personal-subagent-limit-field`,children:[(0,B.jsx)(`span`,{children:m(`drawer.subagentMaxChildren`)}),(0,B.jsx)(`select`,{"aria-label":m(`drawer.subagentMaxChildren`),disabled:Te,onChange:e=>{O(Number(e.target.value)),N(null),M(`idle`),E(null)},value:D,children:Ob.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,disabled:Te,onClick:()=>void Ae(we.enabled,!0),type:`button`,children:m(`drawer.subagentPreviewBoundary`)})]})]}):null]}):null,f.kind===`run`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{"aria-label":m(`drawer.runView`),className:`personal-run-drawer-tabs`,role:`tablist`,children:[(0,B.jsx)(`button`,{"aria-selected":x===`record`,onClick:()=>S(`record`),role:`tab`,type:`button`,children:m(`drawer.executionRecordAndResult`)}),(0,B.jsx)(`button`,{"aria-selected":x===`details`,onClick:()=>S(`details`),role:`tab`,type:`button`,children:m(`drawer.detailsAndActions`)})]}),x===`record`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card personal-session-summary`,children:[(0,B.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Xi(f.item.sessionStatus??f.item.status,m)]}),(0,B.jsx)(`h3`,{children:f.item.title}),(0,B.jsx)(`p`,{children:f.item.latestActivity}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,B.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]})]})]}),(0,B.jsxs)(`section`,{"aria-label":m(`drawer.executionRecord`),className:`personal-session-message-record`,children:[(0,B.jsx)(`h3`,{children:m(`drawer.executionRecord`)}),f.item.sessionMessages?.length?(0,B.jsx)(`ol`,{children:f.item.sessionMessages.map(e=>(0,B.jsxs)(`li`,{className:`is-${e.role}`,children:[(0,B.jsx)(`i`,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:e.role===`user`?m(`drawer.runRoleUser`):e.role===`assistant`?m(`drawer.runRoleAssistant`):m(`drawer.runRoleSystem`)}),e.createdAt?(0,B.jsx)(`time`,{children:new Date(e.createdAt).toLocaleTimeString(p,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}):null]}),(0,B.jsx)(`p`,{children:e.text})]})]},e.messageId))}):(0,B.jsx)(`p`,{className:`personal-session-empty`,children:ve?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,B.jsxs)(`div`,{className:`personal-session-active-step`,children:[(0,B.jsx)(`i`,{}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:m(`drawer.analysis`)}),(0,B.jsx)(`small`,{children:m(`drawer.agentWorking`)})]})]}):null]}),f.item.outputs?.length?(0,B.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-run-outputs-title`,children:[(0,B.jsx)(`h3`,{id:`personal-run-outputs-title`,children:m(`drawer.outputs`)}),(0,B.jsx)(`ol`,{children:f.item.outputs.map(e=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.title}),(0,B.jsx)(`small`,{children:e.createdAt??e.kind??m(`files.emptySummary`)})]})},e.outputId))})]}):null]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,B.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Xi(f.item.status,m)]}),(0,B.jsx)(`h3`,{children:f.item.title}),(0,B.jsx)(`p`,{children:f.item.latestActivity}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,B.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.sessionStatus`)}),(0,B.jsx)(`dd`,{children:Xi(f.item.sessionStatus??f.item.status,m)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.sessionRecoverable`)}),(0,B.jsx)(`dd`,{children:f.item.resumable===!1?m(`drawer.resumeNo`):m(`drawer.resumeYes`)})]})]})]}),f.item.sessionStatus===`resume_failed`&&!u?(0,B.jsxs)(`section`,{className:`personal-recovery-panel`,"aria-label":m(`drawer.recoveryFailed`),children:[(0,B.jsx)(`strong`,{children:m(`drawer.recoveryFailed`)}),(0,B.jsx)(`p`,{children:m(`drawer.recoveryDescription`)}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,B.jsx)(Um,{size:16}),m(`drawer.recoveryRetry`)]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,B.jsx)(zm,{size:16}),m(`drawer.recoveryNewSession`)]})]}):null,u?null:(0,B.jsxs)(`section`,{className:`personal-correction-panel`,children:[(0,B.jsx)(`header`,{children:(0,B.jsxs)(`span`,{children:[(0,B.jsx)(nm,{size:16}),m(`drawer.correctionLabel`,{agent:f.item.agentLabel})]})}),(0,B.jsx)(`p`,{children:m(`drawer.correctionDescription`)}),(0,B.jsxs)(`div`,{className:`personal-correction-composer`,children:[(0,B.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,B.jsx)(`button`,{"aria-label":m(`drawer.correctionSend`),disabled:!h.trim(),onClick:()=>void xe(),type:`button`,children:(0,B.jsx)(Km,{size:16})})]})]}),u?null:(0,B.jsxs)(`details`,{className:`personal-compact-menu personal-run-more`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(gm,{size:17}),m(`drawer.moreRunActions`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{disabled:!f.item.canInterrupt,onClick:()=>void r.onInterruptRun?.(f.item),type:`button`,children:[(0,B.jsx)(Rm,{size:16}),m(`drawer.runInterrupt`)]}),(0,B.jsxs)(`button`,{disabled:f.item.resumable===!1,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,B.jsx)(Um,{size:16}),m(`drawer.recoveryRetry`)]}),(0,B.jsxs)(`button`,{onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,B.jsx)(zm,{size:16}),m(`drawer.runNewSession`)]}),(0,B.jsxs)(`button`,{onClick:()=>void r.onCloseRunSession?.(f.item),type:`button`,children:[(0,B.jsx)($m,{size:16}),m(`drawer.runCloseSession`)]})]})]})]})]}):null,f.kind===`output`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,B.jsx)(`small`,{children:f.item.kind??`output`}),(0,B.jsx)(`h3`,{children:f.item.title}),(0,B.jsx)(`p`,{children:f.item.summary??m(`drawer.outputRecorded`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.outputTodo`)}),(0,B.jsx)(`dd`,{children:f.item.todoId??m(`drawer.notLinked`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.outputRun`)}),(0,B.jsx)(`dd`,{children:f.item.runId??m(`drawer.notLinked`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Agent`}),(0,B.jsx)(`dd`,{children:f.item.agentLabel??f.item.agentId??`LoopX`})]})]})]}),f.item.report?(0,B.jsxs)(`section`,{className:`personal-report-detail`,"data-testid":`personal-periodic-report-detail`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsxs)(`strong`,{children:[`+`,f.item.report.addedCount]}),m(`files.reportAdded`)]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:f.item.report.changedCount}),m(`files.reportChanged`)]})]}),(0,B.jsxs)(`p`,{children:[f.item.report.periodStartAt,` → `,f.item.report.periodEndAt]}),(0,B.jsx)(`ol`,{children:f.item.report.items.map(e=>(0,B.jsxs)(`li`,{"data-change-kind":e.changeKind,children:[(0,B.jsxs)(`small`,{children:[e.changeKind,` · `,e.status]}),(0,B.jsx)(`strong`,{children:e.title}),(0,B.jsx)(`p`,{children:e.summary})]},e.sourceRef))}),(0,B.jsxs)(`footer`,{children:[(0,B.jsxs)(`span`,{children:[m(`files.reportPublication`),`: `,f.item.report.publicationId]}),(0,B.jsxs)(`span`,{children:[m(`files.reportGeneration`),`: `,f.item.report.generationId]})]})]}):null,f.item.safePreview?(0,B.jsx)(`pre`,{"aria-label":m(`drawer.outputSafePreview`),className:`personal-safe-preview`,children:f.item.safePreview}):(0,B.jsx)(`p`,{className:`personal-preview-unavailable`,children:m(`drawer.previewUnavailable`)}),(0,B.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,B.jsxs)(`button`,{className:`personal-primary-action`,disabled:!r.onOpenOutput,onClick:()=>{r.onOpenOutput?.(f.item),c()},type:`button`,children:[(0,B.jsx)(_m,{size:16}),m(`files.openConversation`)]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!r.onExportOutput,onClick:()=>void r.onExportOutput?.(f.item),type:`button`,children:[(0,B.jsx)(hm,{size:16}),m(`files.exportSummary`)]})]})]}):null,f.kind===`proposal`?(0,B.jsxs)(B.Fragment,{children:[f.item.actionKind===`team.plan`&&f.item.status===`applied`?(0,B.jsx)(_b,{proposal:f.item,t:m}):(0,B.jsxs)(`section`,{className:`personal-proposal-card`,children:[(0,B.jsxs)(`small`,{children:[f.item.actionKind,` · `,f.item.status]}),(0,B.jsx)(`h3`,{children:f.item.title}),(0,B.jsx)(`p`,{children:f.item.impact}),f.item.reviewPlan&&f.item.actionKind!==`team.plan`?(0,B.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,B.jsx)(`p`,{className:`personal-proposal-explainer`,children:m(`drawer.proposalExplainer`)}):null,(0,B.jsx)(`dl`,{children:f.item.fields.map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e.label}),(0,B.jsx)(`dd`,{children:e.value})]},e.key))})]}),f.item.status===`applied`&&f.item.actionKind!==`team.plan`?(0,B.jsxs)(`p`,{className:`personal-proposal-state ${f.item.actionKind===`operation.execute`&&f.item.reviewPlan?.reason===`readback_unverified`?`is-gated`:`is-applied`}`,children:[(0,B.jsx)(am,{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,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>{let e=f.item.goalId;c(),r.onOpenGoal?.(e)},type:`button`,children:[(0,B.jsx)(_m,{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,B.jsx)(`p`,{className:`personal-proposal-state is-stale`,children:m(`drawer.proposalStale`)}):null,f.item.status===`error`?(0,B.jsxs)(`div`,{className:`personal-proposal-state is-error`,children:[(0,B.jsx)(`span`,{children:f.item.reviewPlan?.reason===`readback_unverified`?m(`actionReview.readback_unverified`):m(`drawer.proposalApplyFailed`)}),f.item.errorMessage?(0,B.jsx)(`small`,{children:f.item.errorMessage}):null,(0,B.jsx)(`small`,{children:m(f.item.actionKind===`team.plan`?`proposal.teamPlan.retryHint`:`drawer.proposalApplyFailedHint`)})]}):null,f.item.status===`rejected`?(0,B.jsx)(`p`,{className:`personal-proposal-state is-error`,children:m(`drawer.proposalRejected`)}):null,f.item.status===`deferred`?(0,B.jsx)(`p`,{className:`personal-proposal-state is-gated`,children:m(`drawer.proposalDeferred`)}):null,f.item.status===`gated`?(0,B.jsxs)(`div`,{className:`personal-proposal-state is-gated`,children:[(0,B.jsxs)(`span`,{children:[(0,B.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,B.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,B.jsxs)(`section`,{className:`personal-detail-card personal-gate-cli-hint`,children:[(0,B.jsx)(`small`,{children:m(`drawer.gateApproveHint`)}),(0,B.jsxs)(`code`,{children:[`loopx todo complete --goal-id `,t,` --todo-id `,n,` --decision-outcome approve`]}),(0,B.jsx)(`small`,{children:m(`drawer.gateRejectHint`)})]})})():null,!u&&f.item.workspaceCandidates?.length?(0,B.jsx)(`div`,{className:`personal-workspace-candidates`,"aria-label":m(`drawer.workspaceCandidates`),children:f.item.workspaceCandidates.map(e=>(0,B.jsxs)(`button`,{onClick:()=>void r.onSelectWorkspaceCandidate?.(f.item,e.workspaceRef),type:`button`,children:[(0,B.jsx)(`strong`,{children:e.label}),(0,B.jsx)(`small`,{children:e.workspaceRef})]},e.workspaceRef))}):null,!u&&f.item.actionKind!==`operation.execute`&&f.item.status===`error`?(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void(f.item.actionKind===`team.plan`?r.onApplyProposal?.(f.item):r.onTransitionProposal?.(f.item,`regenerate`)),type:`button`,children:[(0,B.jsx)(Um,{size:17}),m(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,B.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,B.jsx)(am,{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,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,B.jsx)(Um,{size:16}),m(`drawer.proposalRecheck`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&[`ready`,`gated`].includes(f.item.status)?(0,B.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`defer`),type:`button`,children:m(`drawer.proposalDefer`)}),(0,B.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,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:c,type:`button`,children:m(`drawer.proposalClose`)})]}):null,f.kind===`schedule`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,B.jsxs)(`small`,{children:[f.item.scheduleKind===`heartbeat`?`Goal Heartbeat`:`continuous_monitor`,` · `,f.item.status??`active`]}),(0,B.jsx)(`h3`,{children:f.item.label}),(0,B.jsx)(`p`,{children:f.item.target??f.item.schedule??m(`drawer.scheduleDefaultTarget`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.scheduleTimezone`)}),(0,B.jsx)(`dd`,{children:f.item.timezone??m(`drawer.scheduleLocalTimezone`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.scheduleNext`)}),(0,B.jsx)(`dd`,{children:f.item.nextRunAt??m(`drawer.schedulePending`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.scheduleLast`)}),(0,B.jsx)(`dd`,{children:f.item.previousRunAt??m(`drawer.scheduleNeverRun`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.scheduleNotification`)}),(0,B.jsx)(`dd`,{children:f.item.notificationRule??m(`drawer.scheduleDefaultNotification`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.scheduleStopCondition`)}),(0,B.jsx)(`dd`,{children:f.item.stopCondition??m(`drawer.scheduleDefaultStop`)})]})]})]}),!u&&f.item.scheduleKind===`monitor`?(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`run_now`),type:`button`,children:[(0,B.jsx)(zm,{size:16}),m(`drawer.scheduleRunNow`)]}):null,u?null:(0,B.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,B.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,B.jsx)(zm,{size:16}):(0,B.jsx)(Rm,{size:16}),f.item.status===`paused`?m(`drawer.scheduleResume`):m(`drawer.schedulePause`)]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`edit`),type:`button`,children:[(0,B.jsx)(im,{size:16}),m(`drawer.scheduleEdit`)]})]}),u?null:(0,B.jsxs)(`button`,{className:`personal-danger-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`stop`),type:`button`,children:[(0,B.jsx)($m,{size:16}),m(`drawer.scheduleStop`,{kind:f.item.scheduleKind===`heartbeat`?` Heartbeat`:m(`drawer.titleSchedule`)})]}),(0,B.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-execution-history-title`,children:[(0,B.jsx)(`h3`,{id:`personal-execution-history-title`,children:m(`drawer.executionHistory`)}),f.item.executionHistory?.length?(0,B.jsx)(`ol`,{children:f.item.executionHistory.map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.label}),(0,B.jsx)(`small`,{children:e.timestamp})]}),(0,B.jsx)(`em`,{className:`is-${e.status}`,children:e.status})]},`${e.timestamp}:${e.runId??t}`))}):(0,B.jsx)(`p`,{children:m(`drawer.noExecutionHistory`)})]})]}):null,f.kind===`run`||f.kind===`proposal`||f.kind===`schedule`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{"aria-expanded":_,className:`personal-diagnostics-trigger`,onClick:()=>v(e=>!e),type:`button`,children:[(0,B.jsx)(`span`,{children:m(`drawer.advancedDiagnostics`)}),(0,B.jsx)(om,{className:_?`is-open`:``,size:16})]}),_?(0,B.jsxs)(`div`,{className:`personal-diagnostics`,children:[(0,B.jsxs)(`code`,{children:[`goal_id: `,he]}),(0,B.jsxs)(`code`,{children:[`kind: `,f.kind]}),f.kind===`run`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`code`,{children:[`session_id: `,f.item.sessionId??m(`drawer.notLinked`)]}),(0,B.jsxs)(`code`,{children:[`turn_id: `,f.item.turnId??m(`common.none`)]}),(0,B.jsxs)(`code`,{children:[`adapter: `,f.item.agentId]}),(0,B.jsxs)(`code`,{children:[`status: `,f.item.sessionStatus??f.item.status]})]}):f.kind===`proposal`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`code`,{children:[`action: `,f.item.actionKind]}),(0,B.jsxs)(`code`,{children:[`status: `,f.item.status]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`code`,{children:[`schedule_id: `,f.item.scheduleId]}),(0,B.jsxs)(`code`,{children:[`status: `,f.item.status??`active`]})]})]}):null]}):null]})]})}var Nb=[`checking`,`connecting`,`downloading`,`installing_app`,`installing_runtime`],Pb={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 Fb(e,t=`update_failed`){return{phase:`error`,details:{code:typeof e==`string`&&Object.hasOwn(Pb,e)?e:t}}}function Ib(){let{locale:e}=Ji(),t=e===`zh-CN`,[n,r]=(0,z.useState)(!1),i=(0,z.useRef)(null),[a,o]=(0,z.useState)(`stable`),[s,c]=(0,z.useState)({phase:`idle`}),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(!1),p=(0,z.useRef)(!1),m=window.__TAURI__?.core.invoke,h=Nb.includes(s.phase);(0,z.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,z.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(Fb(t))})}).catch(()=>{e&&c(Fb(null,`desktop_status_unavailable`))}),()=>{e=!1}},[m]),(0,z.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(Fb(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:Pb[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,B.jsxs)(`div`,{className:`personal-desktop-update`,children:[(0,B.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,B.jsx)(hm,{size:16,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:v}),(0,B.jsx)(cm,{size:14,"aria-hidden":`true`})]}),(0,B.jsxs)(`section`,{ref:i,popover:`auto`,id:`desktop-update-panel`,className:`personal-update-panel`,"aria-label":t?`LoopX 更新`:`LoopX updates`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:t?`LoopX 更新`:`LoopX updates`}),(0,B.jsx)(`button`,{type:`button`,"aria-label":t?`关闭更新面板`:`Close updates`,onClick:()=>i.current?.hidePopover(),children:(0,B.jsx)(ah,{size:16,"aria-hidden":`true`})})]}),(0,B.jsxs)(`small`,{children:[l,` · `,a===`main`?t?`main 预览版`:`main preview`:t?`稳定版`:`Stable`]}),s.details?.version?(0,B.jsxs)(`p`,{children:[t?`目标版本:`:`Target: `,s.details.version]}):null,(0,B.jsxs)(`p`,{role:`status`,"aria-live":`polite`,children:[h?(0,B.jsx)(Hm,{className:`is-spinning`,size:14,"aria-hidden":`true`}):null,_[s.phase]]}),s.phase===`downloading`&&s.details?.total?(0,B.jsx)(`progress`,{"aria-label":t?`下载进度`:`Download progress`,max:s.details.total,value:s.details.received??0}):null,m?(0,B.jsx)(`div`,{className:`personal-update-actions`,children:s.phase===`restart_required`?(0,B.jsx)(`button`,{type:`button`,onClick:()=>void g(`restart`),children:t?`重启完成更新`:`Restart to finish`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void g(`check`),children:t?`检查更新`:`Check for updates`}),s.phase===`available`?(0,B.jsx)(`button`,{type:`button`,onClick:()=>void g(`apply`),children:t?`更新并准备重启`:`Install update`}):null]})}):(0,B.jsx)(`p`,{children:t?`请在 LoopX App 中更新;浏览器自身无需安装包。`:`Update from the LoopX App; the browser needs no installer.`}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:t?`高级选项`:`Advanced options`}),(0,B.jsxs)(`label`,{children:[t?`更新通道`:`Update channel`,(0,B.jsxs)(`select`,{disabled:h||s.phase===`restart_required`,value:a,onChange:e=>{o(e.target.value),c({phase:`idle`})},children:[(0,B.jsx)(`option`,{value:`stable`,children:t?`稳定版(推荐)`:`Stable (recommended)`}),(0,B.jsx)(`option`,{value:`main`,children:t?`main 预览版`:`main preview`})]})]}),(0,B.jsx)(`p`,{children:t?`App 与匹配的 CLI 一起更新,服务可能短暂断开。不删除 Goal 数据。`:`Updates the App and matching CLI. Services may briefly disconnect. Goal data is not deleted.`}),m?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{children:t?`启动失败时,可重装当前 App 随附的运行时。`:`If startup fails, reinstall this App's bundled runtime.`}),(0,B.jsx)(`button`,{disabled:h||s.phase===`restart_required`,type:`button`,onClick:()=>void g(`repair`),children:t?`修复当前版本`:`Repair this version`})]}):null,m&&d?(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:t?`恢复上个版本`:`Restore previous version`}),(0,B.jsx)(`p`,{children:t?`将恢复已保留的 App 和它的运行时,需要重启。`:`Restore the retained App and its runtime, then restart.`}),(0,B.jsx)(`button`,{disabled:h,type:`button`,onClick:()=>void g(`rollback`),children:t?`确认恢复上版`:`Restore previous version`})]}):null]})]})]})}var Lb=e=>`loopx-sidebar-goal-order-v1:${encodeURIComponent(e)}`;function Rb(e){try{let t=JSON.parse(e??`null`);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?[...new Set(t)]:[]}catch{return[]}}function zb(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 Bb(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 Vb(e,t){let n=Lb(t),[r,i]=(0,z.useState)(()=>{try{return Rb(localStorage.getItem(n))}catch{return[]}}),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(null),d=(0,z.useRef)(null),f=(0,z.useRef)(!1),p=zb(e,r),m=p.map(e=>e.goalId);function h(t,a,s){let l=Bb(r,m,t,a,s);if(l===r)return;i(l);let u=zb(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 Hb=`/ssh-hosts`,Ub=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/;function Wb(e){return typeof e==`string`&&Ub.test(e.trim())}function Gb(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`SSH Host 列表响应无效。`);let t=e;if(t.ok!==!0||t.schema_version!==`ssh_host_catalog_v0`||!Array.isArray(t.hosts))throw Error(`SSH Host 列表协议不兼容,请更新本机 LoopX 服务。`);let n=new Set;return{hosts:t.hosts.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=String(e.alias??``).trim();return!Wb(t)||n.has(t)?[]:(n.add(t),[{alias:t}])}),schemaVersion:`ssh_host_catalog_v0`}}async function Kb(e=fetch,t=Hb){let n=await e(t,{cache:`no-store`});if(!n.ok)throw Error(`无法读取本机 SSH Host(HTTP ${n.status})。`);return Gb(await n.json())}function qb(e,t){let n=e.trim();if(!Wb(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 Jb=`/api/ssh-source/ensure`,Yb=`/api/ssh-source/goal-lifecycle`;async function Xb(e,t){let n=await fetch(Jb,{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 Zb(e,t,n,r,i=fetch){let a=await i(Yb,{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 Qb({activeSource:e,connectionState:t,errorMessage:n,onAdd:r,onConfiguredHostsLoaded:i,onRemove:a,onSelect:o,sources:s}){let{t:c}=Ji(),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(null),[p,m]=(0,z.useState)(`configured`),[h,g]=(0,z.useState)([]),[_,v]=(0,z.useState)(null),[y,b]=(0,z.useState)(!1),[x,S]=(0,z.useState)(!1),[C,w]=(0,z.useState)(``),[T,E]=(0,z.useState)(``),[D,O]=(0,z.useState)(`8876`),[k,ee]=(0,z.useState)(``),te=`configured:`,A=[...s.map(e=>({label:e.label,value:e.id})),...h.filter(e=>!s.some(t=>t.label===e.alias)).map(e=>({group:c(`source.configuredGroup`,{count:h.length}),label:e.alias,value:`${te}${e.alias}`}))],j=(0,z.useMemo)(()=>h.some(e=>e.alias===C)?qb(C,D):{error:c(`source.selectHost`)},[h,C,D,c]);(0,z.useEffect)(()=>{M()},[]);async function M(){b(!0),v(null);try{let e=await Kb();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),M()}function N(){u(!1),m(`configured`),v(null),S(!1),w(``),f(null),E(``),O(`8876`),ee(``)}function P(){let e=r({label:T,statusUrl:k});if(e.error){f(e.error);return}N()}function re(){if(`error`in j){f(j.error??c(`source.invalid`));return}let e=r({ensureTunnel:!0,hostAlias:j.hostAlias,label:j.label,statusUrl:j.statusUrl});if(e.error){f(e.error);return}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=qb(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 j){f(j.error??c(`source.invalid`));return}try{await navigator.clipboard.writeText(j.command),S(!0),f(null)}catch{f(c(`source.copyError`))}}return(0,B.jsxs)(`section`,{"aria-label":c(`source.controlPlane`),className:`personal-status-source`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`span`,{children:`Control plane`}),(0,B.jsx)(`button`,{"aria-label":c(`source.addSsh`),onClick:ne,title:c(`source.add`),type:`button`,children:(0,B.jsx)(Bm,{size:14})})]}),(0,B.jsx)(eb,{ariaLabel:c(`source.select`),className:`personal-status-source-select`,icon:(0,B.jsx)(Jm,{size:15}),onChange:e=>{if(e.startsWith(te)){ie(e.slice(11));return}o(e)},options:A,value:e.id}),(0,B.jsxs)(`div`,{className:`personal-status-source-meta`,children:[(0,B.jsxs)(`span`,{className:`is-${t}`,children:[(0,B.jsx)(`i`,{}),c(t===`loading`?`source.connecting`:t===`error`?`source.notAvailable`:`source.connected`)]}),(0,B.jsx)(`small`,{children:e.readOnly?c(`source.readOnly`):c(`source.localInteractive`)}),e.kind===`ssh_tunnel`?(0,B.jsx)(`button`,{"aria-label":c(`source.remove`,{source:e.label}),onClick:()=>a(e.id),title:c(`source.removeCurrent`),type:`button`,children:(0,B.jsx)(nh,{size:12})}):null]}),n?(0,B.jsx)(`p`,{className:`personal-status-source-error`,role:`alert`,children:n}):null,l?(0,B.jsxs)(`div`,{className:`personal-status-source-form`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:c(`source.addSsh`)}),(0,B.jsx)(`button`,{"aria-label":c(`source.closeForm`),onClick:N,type:`button`,children:(0,B.jsx)(ah,{size:13})})]}),(0,B.jsxs)(`div`,{"aria-label":c(`source.addMethod`),className:`personal-status-source-modes`,role:`tablist`,children:[(0,B.jsx)(`button`,{"aria-selected":p===`configured`,onClick:()=>{m(`configured`),f(null)},role:`tab`,type:`button`,children:c(`source.configured`)}),(0,B.jsx)(`button`,{"aria-selected":p===`manual`,onClick:()=>{m(`manual`),f(null)},role:`tab`,type:`button`,children:c(`source.manual`)})]}),p===`configured`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:c(`source.configuredCount`,{count:h.length})}),(0,B.jsxs)(`span`,{className:`personal-status-source-field-row`,children:[(0,B.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,B.jsx)(`datalist`,{id:`loopx-configured-ssh-hosts`,children:h.map(e=>(0,B.jsx)(`option`,{value:e.alias},e.alias))}),(0,B.jsx)(`button`,{"aria-label":c(`source.refreshHosts`),disabled:y,onClick:()=>void M(),title:c(`source.refreshHosts`),type:`button`,children:(0,B.jsx)(Wm,{size:13})})]})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:c(`source.localPort`)}),(0,B.jsx)(`input`,{"aria-label":c(`source.localPort`),inputMode:`numeric`,onChange:e=>{O(e.target.value),S(!1)},value:D})]}),(0,B.jsxs)(`div`,{className:`personal-status-source-command`,children:[(0,B.jsx)(`code`,{children:`error`in j?c(`source.tunnelCommandPending`):j.command}),(0,B.jsxs)(`button`,{"aria-label":c(`source.copyCommand`),disabled:`error`in j,onClick:()=>void ae(),type:`button`,children:[(0,B.jsx)(pm,{size:12}),c(x?`source.copied`:`source.copy`)]})]}),_?(0,B.jsx)(`p`,{className:`is-error`,children:_}):null,(0,B.jsx)(`p`,{children:c(`source.description`)}),(0,B.jsx)(`button`,{className:`personal-status-source-add`,disabled:`error`in j,onClick:re,type:`button`,children:c(`source.addConfigured`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:c(`source.name`)}),(0,B.jsx)(`input`,{autoFocus:!0,maxLength:48,onChange:e=>E(e.target.value),placeholder:c(`source.namePlaceholder`),value:T})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:c(`source.statusUrl`)}),(0,B.jsx)(`input`,{onChange:e=>ee(e.target.value),placeholder:`http://127.0.0.1:8876/status.json`,value:k})]}),(0,B.jsx)(`p`,{children:(0,B.jsx)(`code`,{children:`ssh -N -L 8876:127.0.0.1:8766 `})}),(0,B.jsx)(`p`,{children:c(`source.manualDescription`)}),(0,B.jsx)(`button`,{className:`personal-status-source-add`,onClick:P,type:`button`,children:c(`source.addConfigured`)})]}),d?(0,B.jsx)(`p`,{className:`is-error`,role:`alert`,children:d}):null]}):null]})}var $b={需修复:`is-danger`,等你:`is-warning`,等待条件:`is-info`,推进中:`is-success`,安静运行:`is-quiet`,已完成:`is-quiet`,已停止:`is-stopped`};function ex({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,z.useState)(!1),g=Vb(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,B.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,B.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,B.jsx)(`span`,{className:`personal-goal-state-dot ${e.loadState?``:$b[e.state]}`}),(0,B.jsxs)(`span`,{className:`personal-goal-link-copy`,children:[(0,B.jsx)(`strong`,{children:e.title}),(0,B.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,B.jsx)(sm,{size:15})]}),!t&&m?(0,B.jsxs)(`div`,{className:`personal-goal-move-actions`,children:[(0,B.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,B.jsx)($p,{"aria-hidden":`true`,size:13})}),(0,B.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,B.jsx)(Yp,{"aria-hidden":`true`,size:13})})]}):null,c&&y(t?`resume`:`stop`)?(0,B.jsxs)(B.Fragment,{children:[(0,B.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,B.jsx)(km,{size:13}):t?(0,B.jsx)(Um,{size:13}):(0,B.jsx)(Rm,{size:13})}),t&&y(`delete`)?(0,B.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,B.jsx)(nh,{size:13})}):null]}):null]},e.goalId);return(0,B.jsxs)(`div`,{className:`personal-goal-directory`,children:[(0,B.jsxs)(`div`,{className:`personal-sidebar-brand`,children:[(0,B.jsx)(`span`,{className:`personal-brand-mark`,children:(0,B.jsx)(nm,{size:18})}),(0,B.jsx)(`span`,{children:(0,B.jsx)(`strong`,{children:`LoopX`})})]}),d?(0,B.jsx)(Qb,{...d}):null,(0,B.jsxs)(`nav`,{"aria-label":p(`home.workspace`),className:`personal-sidebar-nav`,children:[(0,B.jsxs)(`button`,{"aria-current":u===null?`page`:void 0,className:`personal-manager-link`,onClick:()=>l(null),type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-manager-icon`,children:(0,B.jsx)(nm,{size:17})}),(0,B.jsx)(`span`,{children:p(`sidebar.manager`)}),e>0?(0,B.jsx)(`span`,{className:`personal-sidebar-count`,children:e}):null,(0,B.jsx)(sm,{size:15})]}),(0,B.jsxs)(`div`,{className:`personal-sidebar-section-title`,children:[(0,B.jsx)(`span`,{children:`Goals`}),(0,B.jsxs)(`span`,{className:`personal-sidebar-title-actions`,children:[(0,B.jsx)(`small`,{children:_.length}),(0,B.jsx)(`button`,{"aria-label":p(`sidebar.sortGoals`),title:p(`sidebar.sortGoals`),"aria-pressed":m,onClick:()=>h(!m),type:`button`,children:(0,B.jsx)(Qp,{"aria-hidden":`true`,size:15})}),a?(0,B.jsx)(`button`,{"aria-label":p(`sidebar.createGoal`),onClick:a,type:`button`,children:(0,B.jsx)(Bm,{size:15})}):null]})]}),g.saveFailed?(0,B.jsx)(`p`,{role:`status`,children:p(`sidebar.orderNotSaved`)}):null,(0,B.jsx)(`span`,{className:`personal-sr-only`,role:`status`,children:g.lastMoved?p(`sidebar.goalMoved`,{goal:g.lastMoved.title,position:g.lastMoved.position}):``}),(0,B.jsx)(`div`,{className:`personal-goal-list`,children:_.map(e=>b(e,!1))}),v.length||n.phase===`loading`||n.phase===`error`?(0,B.jsxs)(`details`,{className:`personal-stopped-goals`,open:n.phase===`error`||void 0,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(om,{size:13}),(0,B.jsx)(`span`,{children:p(`sidebar.stopped`)}),n.phase===`loading`?(0,B.jsx)(km,{"aria-label":p(`sidebar.stoppedLoading`),className:`is-spinning`,size:13}):(0,B.jsx)(`small`,{children:v.length})]}),(0,B.jsxs)(`div`,{className:`personal-goal-list is-stopped`,children:[n.phase===`error`?(0,B.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`alert`,children:[(0,B.jsx)(`span`,{children:p(`sidebar.stoppedLoadFailed`)}),s?(0,B.jsx)(`button`,{onClick:s,type:`button`,children:p(`sidebar.retryStopped`)}):null]}):null,v.map(e=>b(e,!0))]})]}):null]}),(0,B.jsxs)(`div`,{className:`personal-sidebar-footer`,children:[(0,B.jsx)(Ib,{}),o?(0,B.jsxs)(`button`,{"aria-label":p(`settings.open`),className:`personal-sidebar-utility`,onClick:o,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-sidebar-utility-icon`,children:(0,B.jsx)(Ym,{size:17})}),(0,B.jsx)(`span`,{className:`personal-sidebar-utility-copy`,children:(0,B.jsx)(`strong`,{children:p(`settings.open`)})}),(0,B.jsx)(sm,{"aria-hidden":`true`,size:15})]}):null]})]})}var tx=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 nx({goal:e,agentId:t,seed:n,enabled:r,listView:i=!1,onSelect:a}){let{t:o}=Ji(),s=(0,z.useId)(),[c,l]=(0,z.useState)(!1),u=!i||c,d=i?96:148,[f,p]=(0,z.useState)(n),[m,h]=(0,z.useState)(t===`all`?e.doneTodoCount??n.length:n.length),[g,_]=(0,z.useState)(void 0),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(!1),[S,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)({top:0,height:600}),[E,D]=(0,z.useState)(null),O=(0,z.useRef)(null),k=(0,z.useRef)(null),[ee,te]=(0,z.useState)(0);(0,z.useEffect)(()=>{let e=O.current;if(!e)return;let t=new ResizeObserver(()=>T({top:e.scrollTop,height:e.clientHeight}));return t.observe(e),()=>{t.disconnect(),k.current?.abort()}},[]);let A=g===void 0||w.top+w.height>=f.length*d-d*2;(0,z.useEffect)(()=>{if(!r||!u||!A||g===null||b||k.current)return;let n=new AbortController;k.current=n,y(!0);let i=new URLSearchParams({goal_id:e.goalId});t!==`all`&&i.set(`agent_id`,t),g&&i.set(`cursor`,g),fetch(`/api/chat/completed-todos?${i}`,{signal:n.signal}).then(async e=>{if(e.status===409&&C(!0),!e.ok)throw Error(`history unavailable`);let t=tx.parse(await e.json());if(n.signal.aborted)return;let r=t.items.map(e=>({todoId:e.todo_id,text:e.text,claimedBy:e.claimed_by,evidence:e.evidence,priority:e.priority,taskClass:e.task_class,done:!0,status:`done`}));p(e=>g===void 0?r:[...e,...r.filter(t=>!e.some(e=>e.todoId===t.todoId))]),h(t.total),_(t.next_cursor)}).catch(()=>{n.signal.aborted||x(!0)}).finally(()=>{n.signal.aborted||(k.current=null,y(!1))})},[r,u,A,g,b,ee,e.goalId,t,v]),(0,z.useEffect)(()=>{O.current&&(O.current.scrollTop=0),T({top:0,height:O.current?.clientHeight??600}),D(null)},[i]);let j=Math.max(0,Math.floor(w.top/d)-3),M=Math.min(f.length,Math.ceil((w.top+w.height)/d)+3),ne=Array.from({length:Math.max(0,M-j)},(e,t)=>j+t);return E!==null&&El(e=>!e),children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:c?`▾`:`▸`}),` `,o(`tasks.completed`)]}):(0,B.jsxs)(`strong`,{children:[(0,B.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-done`}),o(`tasks.completed`)]}),(0,B.jsx)(`span`,{children:m})]}),(0,B.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,B.jsx)(`div`,{className:`personal-completed-window`,style:{height:f.length*d},children:ne.map(t=>{let n=f[t];return(0,B.jsx)(`div`,{className:`personal-task-card personal-completed-row`,style:{top:t*d,height:d},children:(0,B.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,B.jsx)(`span`,{className:`is-done`,children:`✓`}),(0,B.jsx)(`strong`,{children:n.text}),(0,B.jsx)(`small`,{children:n.claimedBy??e.agentLabel??e.agentId})]})},n.todoId)})}),(0,B.jsx)(`div`,{className:`personal-completed-footer`,role:`status`,children:v?o(`tasks.historyLoading`):b?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:o(S?`tasks.historyExpired`:`tasks.historyError`)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{S&&(_(void 0),O.current&&(O.current.scrollTop=0)),C(!1),x(!1),te(e=>e+1)},children:o(`tasks.historyRetry`)})]}):r?g===null?o(`tasks.historyEnd`):(0,B.jsx)(`button`,{type:`button`,onClick:()=>{O.current&&(O.current.scrollTop=f.length*d)},children:o(`tasks.historyMore`)}):o(`tasks.historyLocalOnly`)})]})]})}function rx({children:e,count:t,label:n,tone:r,listView:i=!1}){let a=(0,z.useId)(),o=(0,z.useRef)(null),s=(0,z.useRef)([]),c=(0,z.useRef)(null),[l,u]=(0,z.useState)({after:!1,before:!1}),d=(0,z.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,z.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,z.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,B.jsxs)(`details`,{className:`personal-task-group tone-${r}`,open:!0,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(om,{size:16}),(0,B.jsx)(`strong`,{children:n}),(0,B.jsx)(`span`,{children:t})]}),(0,B.jsx)(`div`,{className:`personal-task-list-rows`,children:e})]}):(0,B.jsxs)(`section`,{className:`personal-object-list personal-task-lane`,children:[(0,B.jsxs)(`header`,{id:a,children:[(0,B.jsxs)(`strong`,{children:[(0,B.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-${r}`}),n]}),(0,B.jsx)(`span`,{children:t})]}),(0,B.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 ix({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,z.useState)(!1),[p,m]=(0,z.useState)({goalId:``,laneId:`all`}),h=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!c)return;let e=window.requestAnimationFrame(()=>h.current?.scrollIntoView({block:`nearest`,inline:`nearest`}));return()=>window.cancelAnimationFrame(e)},[c]);let g=l.filter(e=>e.goalId===t.goalId).map(e=>({...e,goalTitle:t.title})),_=e=>e.priority===`P0`?0:e.priority===`P1`?1:e.priority===`P2`?2:3,v=(0,z.useMemo)(()=>{let e=new Map((t.agentLanes??[]).map(e=>[e.agentId,e]));for(let n of t.agentTodos)n.claimedBy&&!e.has(n.claimedBy)&&e.set(n.claimedBy,{agentId:n.claimedBy,label:n.claimedBy});return[...e.values()]},[t.agentLanes,t.agentTodos]),y=p.goalId===t.goalId&&v.some(e=>e.agentId===p.laneId)?p.laneId:`all`,b=e=>y===`all`||e===y,x=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&!e.done).filter(e=>b(e.claimedBy)).sort((e,t)=>_(e)-_(t)),S=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&e.done).filter(e=>b(e.claimedBy)),C=n.filter(e=>e.kind===`schedule`&&b(e.schedule.agentId)),w=n.filter(e=>e.kind===`run`&&!!e.run.todoId&&b(e.run.agentId)),T=!g.length&&!x.length&&!S.length&&!C.length,E=n.filter(e=>e.kind===`message`&&(e.message.role===`user`||e.message.role===`assistant`)),D=E.reduce((e,t,n)=>t.message.role===`user`?n:e,-1),O=D>=0?E[D]?.message:null,k=D>=0?E.slice(D+1).reverse().find(e=>e.message.role===`assistant`)?.message:null,ee=D>=0&&E.slice(D+1).some(e=>e.message.role===`assistant`&&e.message.pending);return(0,B.jsxs)(`section`,{"aria-label":u(`header.tasks`),className:`personal-task-board${d?` is-list-view`:``}`,children:[(0,B.jsxs)(`header`,{className:`personal-task-view-toolbar`,children:[(0,B.jsx)(`div`,{children:(0,B.jsx)(`strong`,{children:u(`header.tasks`)})}),(0,B.jsxs)(`div`,{className:`personal-task-view-switch`,role:`group`,"aria-label":u(`tasks.viewLabel`),children:[(0,B.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(!0),children:u(`tasks.listView`)}),(0,B.jsx)(`button`,{type:`button`,"aria-pressed":!d,onClick:()=>f(!1),children:u(`tasks.boardView`)})]})]}),v.length>1?(0,B.jsxs)(`section`,{"aria-label":u(`tasks.agentLaneFilter`),className:`personal-task-lane-filter`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(nm,{size:15}),(0,B.jsx)(`span`,{children:(0,B.jsx)(`strong`,{children:u(`tasks.agentLane`)})})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{className:`sr-only`,children:u(`tasks.agentLaneFilter`)}),(0,B.jsxs)(`select`,{"aria-label":u(`tasks.agentLaneFilter`),onChange:e=>m({goalId:t.goalId,laneId:e.target.value}),value:y,children:[(0,B.jsx)(`option`,{value:`all`,children:u(`tasks.allAgentLanes`,{count:v.length})}),v.map(e=>(0,B.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))]}),(0,B.jsx)(om,{"aria-hidden":!0,size:14})]})]}):null,O?(0,B.jsxs)(`section`,{"aria-label":u(`tasks.chatRecent`),className:`personal-task-chat-receipt`,children:[(0,B.jsx)(`span`,{className:`personal-task-chat-icon`,children:(0,B.jsx)(Nm,{size:18})}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:u(ee?`tasks.chatPending`:k?`tasks.chatAgentReplied`:`tasks.chatRecent`)}),(0,B.jsx)(`small`,{children:t.agentLabel??t.agentId})]}),(0,B.jsxs)(`p`,{className:`is-user`,children:[(0,B.jsx)(`b`,{children:u(`common.you`)}),O.text]}),k&&!k.pending?(0,B.jsxs)(`p`,{className:`is-assistant`,children:[(0,B.jsx)(`b`,{children:u(`common.agent`)}),k.text]}):null,(0,B.jsx)(`small`,{children:u(ee?`tasks.chatPendingDescription`:`tasks.chatUnchangedDescription`)})]}),(0,B.jsxs)(`footer`,{children:[(0,B.jsxs)(`button`,{onClick:i,type:`button`,children:[(0,B.jsx)(Nm,{size:14}),u(`tasks.chatViewReply`)]}),k&&!ee&&r?(0,B.jsxs)(`button`,{onClick:()=>r(k.text),type:`button`,children:[(0,B.jsx)(Om,{size:14}),u(`tasks.convertToTask`)]}):null]})]}):null,(0,B.jsxs)(`div`,{className:d?`personal-task-grouped-list`:`personal-task-kanban`,children:[(0,B.jsxs)(rx,{listView:d,count:g.length,label:u(`timeline.waitingConfirmation`),tone:`attention`,children:[g.map(e=>{let t=Zi(e.updatedAt,u);return(0,B.jsxs)(`button`,{onClick:()=>s({item:e,kind:`attention`}),type:`button`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`is-attention`,children:`!`}),(0,B.jsx)(`strong`,{children:e.text}),(0,B.jsxs)(`small`,{children:[(0,B.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?u(`tasks.blocked`):u(`tasks.pending`)}),t?(0,B.jsx)(`span`,{className:`personal-task-age`,children:u(`tasks.waitingAge`,{age:t})}):null]})]},e.todoId)}),g.length?null:(0,B.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyConfirm`)})]}),(0,B.jsxs)(rx,{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,B.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,B.jsxs)(`button`,{"aria-pressed":c===e.todoId,onClick:()=>s({item:n,kind:`todo`}),type:`button`,children:[(0,B.jsx)(`span`,{children:`○`}),(0,B.jsx)(`strong`,{children:e.text}),(0,B.jsxs)(`small`,{children:[e.priority?(0,B.jsx)(`span`,{className:`personal-priority-badge is-${e.priority.toLowerCase()}`,children:e.priority}):null,e.status===`blocked`?(0,B.jsx)(`span`,{className:`personal-priority-badge is-blocked`,children:u(`tasks.blocked`)}):null,r?(0,B.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,B.jsx)(`span`,{className:`personal-task-session-status`,children:u(`drawer.taskStatusDeferred`)}):r?null:(0,B.jsx)(`span`,{className:`personal-task-session-status`,children:u(`tasks.waiting`)}),e.claimedBy??t.agentLabel??t.agentId]})]}),(0,B.jsxs)(`div`,{className:`personal-task-card-actions`,children:[r?(0,B.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,B.jsx)(_m,{size:14}),(0,B.jsx)(`span`,{children:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`)})]}):null,a?(0,B.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,B.jsx)(km,{className:`personal-spin`,size:14}):(0,B.jsx)(am,{size:14})}):null,(0,B.jsx)(`button`,{"aria-label":u(`tasks.moreActions`,{name:e.text}),onClick:()=>s({item:n,kind:`todo`}),title:u(`common.actions`),type:`button`,children:(0,B.jsx)(gm,{size:14})})]})]},e.todoId)}),x.length?null:(0,B.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyRunning`)})]}),(0,B.jsxs)(rx,{listView:d,count:C.length,label:u(`tasks.scheduled`),tone:`schedule`,children:[C.map(e=>(0,B.jsxs)(`button`,{onClick:()=>s({item:e.schedule,kind:`schedule`}),type:`button`,children:[(0,B.jsx)(`span`,{children:`◷`}),(0,B.jsx)(`strong`,{children:e.schedule.label}),(0,B.jsx)(`small`,{children:e.schedule.status===`paused`?u(`schedule.paused`):u(`schedule.active`)})]},e.id)),C.length?null:(0,B.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptySchedules`)})]}),(0,B.jsx)(nx,{goal:t,agentId:y,seed:S,enabled:e,listView:d,onSelect:s},`${t.goalId}:${y}:${e}`)]}),T?(0,B.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyGoal`)}):null]})}var ax=yd(W(),q(W())),ox=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:ax,owner_agent:W().optional(),actor_agent:W().optional(),from_agent:W().optional(),to_agent:W().optional()}),sx=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:ax.optional()}),cx=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(ox),edges:q(sx)}).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:cx.nullable(),acceptance:$d.nullable()});function ux(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 dx(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 ux(await r.json(),e)}function fx(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 px(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 mx(e){return[`gate`,`gate_summary`,`lease`].includes(e.kind)?0:e.kind===`deliverable`?1:2}function hx(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{px(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)})`)}return r.join(` +`)});continue}let o=e.match(/^\s{0,3}#{1,4}\s+(.*)$/);if(o){i();let t=e.trimStart().match(/^#+/)?.[0].length??1;n.push({type:`heading`,level:t,text:o[1].trim()}),a+=1;continue}if(cb.test(e)||lb.test(e)){i();let r=lb.test(e),o=r?lb:cb,s=[];for(;a{let n=`b${t}`;if(e.type===`code`)return(0,B.jsx)(`pre`,{className:`personal-md-pre`,children:(0,B.jsx)(`code`,{children:e.text})},n);if(e.type===`heading`)return(0,B.jsx)(`p`,{className:`personal-md-heading is-h${e.level}`,children:sb(e.text,n)},n);if(e.type===`list`){let t=e.items.map((e,t)=>(0,B.jsx)(`li`,{children:sb(e,`${n}-${t}`)},`${n}-${t}`));return e.ordered?(0,B.jsx)(`ol`,{className:`personal-md-list`,children:t},n):(0,B.jsx)(`ul`,{className:`personal-md-list`,children:t},n)}return(0,B.jsx)(`p`,{children:e.lines.map((e,t)=>(0,B.jsxs)(z.Fragment,{children:[t>0?(0,B.jsx)(`br`,{}):null,sb(e,`${n}-${t}`)]},`${n}-${t}`))},n)})})}function fb({onSelect:e,output:t}){let{t:n}=Ji(),r=t.kind===`report`?Sm:xm;return(0,B.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,B.jsx)(`span`,{className:`personal-row-icon is-output`,children:(0,B.jsx)(r,{size:18})}),(0,B.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,B.jsxs)(`small`,{children:[t.goalTitle??t.goalId,` · `,t.agentLabel??`LoopX`]}),(0,B.jsx)(`strong`,{children:t.title}),t.summary?(0,B.jsx)(`span`,{children:t.summary}):null,t.report?(0,B.jsxs)(`small`,{children:[n(`files.reportDelta`,{added:t.report.addedCount,changed:t.report.changedCount}),` · `,n(`files.verifiedReport`)]}):null]}),t.createdAt?(0,B.jsx)(`time`,{children:t.createdAt}):null,(0,B.jsx)(cm,{size:17})]})}var pb={completed:`runs.completed`,failed:`runs.failed`,interrupted:`runs.interrupted`,queued:`runs.queued`,running:`runs.running`,waiting:`runs.waiting`};function mb({onSelect:e,run:t}){let{t:n}=Ji(),r=t.totalSteps>0?Math.min(100,t.completedSteps/t.totalSteps*100):0;return(0,B.jsxs)(`button`,{"aria-label":`${n(`tasks.viewExecution`)}:${t.title}`,className:`personal-timeline-row personal-run-row`,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-row-icon is-run`,children:(0,B.jsx)(rm,{size:18})}),(0,B.jsxs)(`span`,{className:`personal-run-identity`,children:[(0,B.jsx)(`small`,{children:t.goalTitle}),(0,B.jsx)(`strong`,{children:t.agentLabel})]}),(0,B.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,B.jsx)(`strong`,{children:t.title}),(0,B.jsx)(`small`,{children:t.latestActivity})]}),(0,B.jsxs)(`span`,{className:`personal-run-progress`,"aria-label":`${t.completedSteps}/${t.totalSteps}`,children:[(0,B.jsxs)(`small`,{children:[t.completedSteps,`/`,t.totalSteps]}),(0,B.jsx)(`i`,{children:(0,B.jsx)(`b`,{style:{width:`${r}%`}})})]}),(0,B.jsxs)(`span`,{className:`personal-row-status is-${t.status}`,children:[t.status===`running`?(0,B.jsx)(Am,{className:`personal-spin`,size:14}):null,n(pb[t.status])]}),t.sessionId?(0,B.jsx)(`span`,{className:`personal-run-open-label`,children:n(`tasks.viewExecution`)}):null,(0,B.jsx)(cm,{size:17})]})}function hb({onSelect:e,schedule:t}){let{t:n}=Ji(),r=t.scheduleKind===`heartbeat`;return(0,B.jsxs)(`button`,{"aria-label":`${r?`Heartbeat`:n(`tasks.scheduled`)}:${t.label};${t.status??`active`}`,className:`personal-schedule-row`,onClick:e,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-schedule-icon`,children:r?(0,B.jsx)(Hm,{size:17}):(0,B.jsx)(am,{size:17})}),(0,B.jsxs)(`span`,{className:`personal-schedule-copy`,children:[(0,B.jsx)(`small`,{children:n(r?`schedule.heartbeat`:`schedule.monitor`)}),(0,B.jsx)(`strong`,{children:t.label}),(0,B.jsx)(`p`,{children:t.schedule??n(`schedule.summary`)})]}),(0,B.jsx)(`span`,{className:`personal-schedule-status is-${t.status??`active`}`,children:t.status===`paused`?n(`schedule.paused`):n(`schedule.active`)}),(0,B.jsx)(cm,{size:16})]})}function gb({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,B.jsx)(`small`,{className:`personal-return-delivery is-${r}`,role:`status`,children:n})}function _b({items:e,onSelect:t,selectedGoal:n}){let{t:r}=Ji();if(e.length===0)return(0,B.jsxs)(`div`,{className:`personal-timeline-empty`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)($m,{size:20})}),(0,B.jsx)(`strong`,{children:r(n?`timeline.emptyGoal`:`timeline.emptyWorkspace`)}),(0,B.jsx)(`p`,{children:r(n?`timeline.emptyGoalDescription`:`timeline.emptyWorkspaceDescription`)})]});let i=[...e].reverse().find(e=>e.kind===`message`&&e.message.role!==`user`||e.kind===`proposal`&&[`applied`,`stale`,`error`,`gated`].includes(e.proposal.status)||e.kind===`run`&&e.run.status===`completed`),a=i?.kind===`message`?`${i.message.agentLabel??r(`header.manager`)}:${i.message.pending?r(`timeline.pending`):i.message.text}`:i?.kind===`proposal`?`${i.proposal.title}:${i.proposal.status}`:i?.kind===`run`?r(`timeline.runCompleted`,{run:i.run.title}):``,o=e.filter(e=>e.kind===`proposal`&&e.proposal.status===`gated`),s=e.filter(e=>e.kind!==`proposal`),c=e.filter(e=>e.kind===`proposal`&&e.proposal.status!==`gated`);function l(e){return e.kind===`attention`?(0,B.jsx)(ab,{attention:e.attention,onSelect:()=>t({item:e.attention,kind:`attention`})},e.id):e.kind===`run`?(0,B.jsx)(mb,{onSelect:()=>t({item:e.run,kind:`run`}),run:e.run},e.id):e.kind===`output`?(0,B.jsx)(fb,{onSelect:()=>t({item:e.output,kind:`output`}),output:e.output},e.id):e.kind===`schedule`?(0,B.jsx)(hb,{onSelect:()=>t({item:e.schedule,kind:`schedule`}),schedule:e.schedule},e.id):e.kind===`proposal`?(0,B.jsxs)(`button`,{className:`personal-proposal-row is-${e.proposal.status}`,onClick:()=>t({item:e.proposal,kind:`proposal`}),type:`button`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)($m,{size:17})}),(0,B.jsxs)(`span`,{children:[(0,B.jsxs)(`small`,{children:[e.proposal.actionKind,` · `,e.proposal.status]}),(0,B.jsx)(`strong`,{children:e.proposal.title}),(0,B.jsx)(`p`,{children:e.proposal.impact})]}),(0,B.jsx)(`b`,{children:e.proposal.status===`gated`&&e.proposal.actionKind!==`operation.execute`?r(`timeline.review`):e.proposal.primaryLabel??r(`timeline.reviewAndConfirm`)})]},e.id):(0,B.jsxs)(`article`,{className:`personal-message is-${e.message.role}`,children:[e.message.role===`user`?null:(0,B.jsx)(`span`,{className:`personal-message-avatar`,children:(0,B.jsx)(rm,{size:17})}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:e.message.role===`user`?r(`common.you`):e.message.agentLabel??r(`header.manager`)}),e.message.time?(0,B.jsx)(`time`,{children:e.message.time}):null]}),e.message.attachments?.length?(0,B.jsx)(`div`,{className:`personal-message-images`,children:e.message.attachments.map(e=>(0,B.jsx)(`img`,{alt:e.name,src:e.dataUrl},e.id))}):null,e.message.role===`user`?(0,B.jsx)(`p`,{children:e.message.text}):(0,B.jsx)(db,{text:e.message.text}),e.message.pending?(0,B.jsx)(`span`,{className:`personal-message-pending`,children:r(`timeline.pending`)}):null,(0,B.jsx)(Ey,{request:e.message.collaboration}),(0,B.jsx)(gb,{delivery:e.message.returnDelivery})]})]},e.id)}return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{"aria-atomic":`true`,"aria-live":`polite`,className:`personal-live-region`,role:`status`,children:a}),(0,B.jsxs)(`div`,{className:`personal-channel-timeline`,children:[s.map(l),o.length?(0,B.jsxs)(`details`,{className:`personal-gated-summary`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(`span`,{children:(0,B.jsx)($m,{size:16})}),(0,B.jsx)(`strong`,{children:r(`timeline.waitingConfirmation`)}),(0,B.jsx)(`small`,{children:r(`timeline.gateHistory`,{count:o.length})})]}),(0,B.jsx)(`div`,{children:o.map(l)})]}):null,c.map(l)]})]})}function vb({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,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-acceptance`,"aria-label":t(`acceptance.title`),children:[(0,B.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,B.jsx)(`h3`,{children:t(`acceptance.title`)}),(0,B.jsx)(`em`,{children:t(`common.readOnly`)})]}),(0,B.jsx)(`p`,{role:`status`,children:t(s?`acceptance.unavailable`:`acceptance.partial`)}),!s&&o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h4`,{children:t(`acceptance.gaps`)}),o.acceptance_gaps.length?o.acceptance_gaps.map((e,i)=>(0,B.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,B.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),e.resolution_hint?(0,B.jsx)(`p`,{children:e.resolution_hint}):null,e.component_checks?(0,B.jsx)(`div`,{children:Object.entries(e.component_checks).map(([e,t])=>(0,B.jsxs)(`p`,{children:[r[e],`: `,n===`zh-CN`?t?`通过`:`未通过`:t?`Passed`:`Failed`]},e))}):null,(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`common.owner`)}),(0,B.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,B.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`acceptance.observed`)}),(0,B.jsx)(`dd`,{children:e.observed_at??t(`acceptance.unknown`)})]})]})]},`${e.kind}:${e.owner}:${i}`)):(0,B.jsx)(`p`,{children:t(`acceptance.noGaps`)}),(0,B.jsx)(`h4`,{children:t(`acceptance.guards`)}),o.guards.length?o.guards.map((e,n)=>(0,B.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,B.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`common.owner`)}),(0,B.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),e.blocks_agent?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`common.agent`)}),(0,B.jsx)(`dd`,{children:e.blocks_agent})]}):null,e.todo_id?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`common.task`)}),(0,B.jsx)(`dd`,{children:e.todo_id})]}):null,(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,B.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`acceptance.scope`)}),(0,B.jsx)(`dd`,{children:e.decision_scope??t(`acceptance.unknown`)})]})]})]},`${e.todo_id}:${n}`)):(0,B.jsx)(`p`,{children:t(`acceptance.noGuards`)}),(0,B.jsx)(`h4`,{children:t(`acceptance.next`)}),(0,B.jsx)(`p`,{children:o.next_action??t(`acceptance.unknown`)}),(0,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{children:[t(`acceptance.historical_progress`),` · `,o.historical_progress.length]}),(0,B.jsx)(`p`,{children:t(`acceptance.historical`)}),o.historical_progress.map(e=>(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`strong`,{children:a(e.kind)}),` · `,e.observed_at??t(`acceptance.unknown`),` `,e.evidence_refs.join(`, `)]},e.kind))]}),o.missing_sources.length?(0,B.jsxs)(`p`,{children:[t(`acceptance.missing`),` `,o.missing_sources.map(a).join(`, `)]}):null,o.truncated?(0,B.jsx)(`p`,{children:t(`acceptance.truncated`)}):null]}):null]})}function yb({item:e,successor:t,onSelect:n}){let{t:r}=Ji(),i=e.details;return(0,B.jsxs)(`section`,{className:`personal-detail-card`,"aria-label":r(`attentionDetail.title`),children:[(0,B.jsx)(`h3`,{children:r(`attentionDetail.title`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`attentionDetail.request`)}),(0,B.jsx)(`dd`,{children:r(i?.interaction===`decision`?`attentionDetail.decision`:`attentionDetail.unknownRequest`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`common.status`)}),(0,B.jsx)(`dd`,{children:r(`attentionDetail.${i?.lifecycle??`unknown`}`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`drawer.reason`)}),(0,B.jsx)(`dd`,{children:i?.reason??e.explanation??r(`attentionDetail.unknownReason`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Todo`}),(0,B.jsx)(`dd`,{children:e.todoId})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`attentionDetail.targetTodo`)}),(0,B.jsx)(`dd`,{children:i?.unblocksTodoId??r(`attentionDetail.notProvided`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`attentionDetail.targetAgent`)}),(0,B.jsx)(`dd`,{children:i?.blocksAgent??r(`attentionDetail.notProvided`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`attentionDetail.scope`)}),(0,B.jsx)(`dd`,{children:i?.decisionScope?`${i.decisionScope.kind} · ${i.decisionScope.granularity} · ${i.decisionScope.scopeKey}`:r(`attentionDetail.notProvided`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`drawer.evidence`)}),(0,B.jsx)(`dd`,{children:i?.evidence??e.evidence??r(`drawer.decisionDefaultEvidence`)})]})]}),i?.supersededBy?(0,B.jsxs)(`p`,{children:[r(`attentionDetail.replacement`),`: `,i.supersededBy]}):null,t&&n?(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>n(t),type:`button`,children:r(`attentionDetail.openReplacement`)}):null,(0,B.jsx)(`p`,{children:r(`attentionDetail.boundary`)})]})}function bb({proposal:e,t}){let n=e.teamPlanOutcome?.kind===`already_present`;return(0,B.jsxs)(`section`,{className:`personal-proposal-card personal-team-plan-result`,children:[(0,B.jsx)(`h3`,{children:qy(e.teamPlanOutcome??null,t)}),(0,B.jsxs)(`dl`,{className:`personal-team-plan-assignments`,children:[e.teamPlanAssignments?.map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e.agentId||e.laneId}),(0,B.jsx)(`dd`,{children:e.task})]},e.laneId)),e.teamPlanGapLanes?.map(e=>(0,B.jsxs)(`div`,{className:`is-pending`,children:[(0,B.jsx)(`dt`,{children:e.agentId||e.laneId}),(0,B.jsxs)(`dd`,{children:[e.task||e.laneId,(0,B.jsx)(`br`,{}),(0,B.jsxs)(`small`,{children:[t(`proposal.teamPlan.pending`),` · `,Gy(e.reasonCode,t)]})]})]},e.laneId))]}),(0,B.jsx)(`p`,{children:t(n?`proposal.teamPlan.recoveredHint`:`proposal.teamPlan.assignedHint`)}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:t(`proposal.teamPlan.originalPlan`)}),(0,B.jsx)(`dl`,{children:e.fields.map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e.label}),(0,B.jsx)(`dd`,{children:e.value})]},e.key))})]})]})}function xb(e){return e.replace(/\s+/gu,` `).trim()}function Sb(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 Cb(e){return/(我现在该做什么|下一步|哪些\s*Goal\s*在等我|需要我|谁在等我|Agent\s*在做什么|当前进度|总结(?:今天)?进展)/iu.test(e)}function wb(e){let t=/(怎么|如何|为什么|给.*建议|分析一下|解释|只读)/u.test(e),n=/(解决一下|修复一下|处理一下|执行一下|改一下|跑(?:一下)?测试|rebase|push|提交|推送)/iu.test(e);return!t&&n&&/(帮我|请|给我|直接|现在|开始|bytedcli|codebase|git|rebase|push|提交|推送)/iu.test(e)}function Tb(e){return xb(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 Eb(e,t){let n=xb(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&&!Sb(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n);if(!t.goalId&&!Sb(n,/goal|目标/iu)&&/(创建|新建|设置|create|start|set up).{0,24}(goal|目标)/iu.test(n)&&r.push({actionKind:`goal.create`,confidence:.97,normalizedParameters:{heartbeat_enabled:!Sb(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&&!Sb(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&&!Sb(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&&!Sb(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&&wb(n)&&r.push({actionKind:`todo.create`,confidence:.9,normalizedParameters:{goal_id:t.goalId,start_execution:!0}}),t.goalId&&a){let e=!Sb(n,/完成|做完|关闭/u)&&/完成|做完|关闭/u.test(n)?`complete`:!Sb(n,/阻塞|卡住/u)&&/阻塞|卡住/u.test(n)?`block`:!Sb(n,/暂缓|稍后|推迟/u)&&/暂缓|稍后|推迟/u.test(n)?`defer`:i&&!Sb(n,/交给|分配给|改派/u)&&/交给|分配给|改派/u.test(n)?`reassign`:null;if(e){let i=e===`defer`?Tb(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&&Cb(n)?{actionKind:null,confidence:.98,missingFields:[],normalizedParameters:{},route:`projection`}:{actionKind:null,confidence:.75,missingFields:[],normalizedParameters:{},route:`agent_chat`}}function Db(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 Ob=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`select:not([disabled])`,`input:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`),kb=[{key:`drawer.taskBlock`,operation:`block`},{key:`drawer.taskSuccessor`,operation:`successor_create`}],Ab=[{key:`drawer.decisionReject`,resolution:`reject`},{key:`drawer.decisionDefer`,resolution:`defer`}],jb=Array.from({length:32},(e,t)=>t+1),Mb=/^[a-z][a-z0-9_.-]{0,63}$/u;function Nb(e){let t=String(e??``).trim().toLowerCase();return Mb.test(t)?t:null}function Pb(e,t){return e.enabled===t.enabled&&e.maxChildren===t.maxChildren&&JSON.stringify(e.modelConfig??null)===JSON.stringify(t.modelConfig??null)&&[...e.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)===[...t.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)}function Fb({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,z.useState)(``),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(`idle`),[x,S]=(0,z.useState)(`record`),[C,w]=(0,z.useState)([]),[T,E]=(0,z.useState)(null),[D,O]=(0,z.useState)(2),[k,ee]=(0,z.useState)(``),[te,A]=(0,z.useState)(``),[j,M]=(0,z.useState)(`idle`),[ne,N]=(0,z.useState)(null),[P,re]=(0,z.useState)(null),ie=(0,z.useRef)(null),ae=(0,z.useRef)(null),[F,oe]=(0,z.useState)(e.find(e=>e.available)?.agentId??`codex`),[I,se]=(0,z.useState)(``),L=(0,z.useRef)(null),ce=(0,z.useRef)(null),le=(0,z.useRef)(null),ue=(0,z.useRef)(null),de=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,z.useEffect)(()=>{b(`idle`),v(!1),S(`record`),se(``);let e=f.kind===`goal`?f.item.subagentExecution:void 0;w(e?.allowedDomains??[]),ee(e?.modelConfig?.model??``),A(e?.modelConfig?.reasoning_effort??``),O(e?.maxChildren?Math.min(e.maxChildren,32):2),E(null),M(`idle`),N(null),re(null),ie.current=e??null,ae.current=null},[de]);let fe=f.kind===`goal`?f.item.subagentExecution:void 0;(0,z.useEffect)(()=>{let e=ie.current,t=fe?!e||!Pb(e,fe):e!==null;if(ie.current=fe??null,!P){t&&fe&&(w(fe.allowedDomains),ee(fe.modelConfig?.model??``),A(fe.modelConfig?.reasoning_effort??``),O(fe.maxChildren||2),E(null),M(`idle`),N(null));return}let n=ae.current;(!fe||Pb(P,fe)||n&&!Pb(n,fe))&&(fe&&(w(fe.allowedDomains),ee(fe.modelConfig?.model??``),A(fe.modelConfig?.reasoning_effort??``),O(fe.maxChildren||2)),ae.current=null,re(null))},[fe,P]),(0,z.useEffect)(()=>{let e=document.activeElement;e instanceof HTMLElement&&!ce.current?.contains(e)&&(le.current=e);let t=window.requestAnimationFrame(()=>ue.current?.focus());return()=>window.cancelAnimationFrame(t)},[de]);let pe=(0,z.useCallback)(()=>{let e=le.current;c(),window.requestAnimationFrame(()=>e?.focus())},[c]);(0,z.useEffect)(()=>{function e(e){if(e.key===`Escape`){e.preventDefault(),pe();return}if(e.key===`Tab`&&f.kind!==`todo`){let t=Array.from(ce.current?.querySelectorAll(Ob)??[]).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)}},[pe,f.kind]);let me=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.status===`applied`?`drawer.titleProposalApplied`:`drawer.titleProposalConfirm`):f.kind===`schedule`?f.item.scheduleKind===`heartbeat`?`Heartbeat`:m(`drawer.titleSchedule`):m(`drawer.goalDetails`),he=f.kind===`proposal`?f.item.goalId??`manager`:f.item.goalId,ge=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`),_e=f.kind===`goal`?d.find(e=>e.goalId===f.item.goalId&&!!e.sessionId)??d.find(e=>e.goalId===f.item.goalId):null,ve=f.kind===`run`&&(f.item.completedSteps>0||!!f.item.latestActivity||!!f.item.outputs?.length),ye=f.kind===`attention`?Zi(f.item.updatedAt,m):null,be=Tb(I);async function xe(){f.kind!==`run`||!h.trim()||(await r.onCorrectRun?.(f.item,h.trim()),g(``))}async function Se(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??F,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 Ce(e,t,n){u||!Xd(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 we=f.kind===`goal`?P??f.item.subagentExecution??{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0}:{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0},Te=j===`previewing`||j===`applying`,Ee=(()=>{if(f.kind!==`goal`)return[];let e=new Map;for(let t of we.allowedDomains){let n=Nb(t);n&&e.set(n,{matchingTodoCount:0,value:n})}if(we.domainCandidates)for(let t of we.domainCandidates){let n=Nb(t.domain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+t.matchingTodoCount,value:n})}else for(let t of f.item.agentTodos){if(t.done||t.taskClass!==`advancement_task`)continue;let n=Nb(t.taskDomain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+1,value:n})}return[...e.values()]})();function De(){w(we.allowedDomains),ee(we.modelConfig?.model??``),A(we.modelConfig?.reasoning_effort??``),O(we.maxChildren||2),E(null),M(`idle`),N(null)}function Oe(){let e=[...new Set(C.map(e=>Nb(e)))];return e.every(e=>!!e)?e:null}function ke(e,t){w(n=>t?[...n,e].filter((e,t,n)=>n.indexOf(e)===t):n.filter(t=>t!==e)),N(null),M(`idle`),E(null)}async function Ae(e,t=e){if(f.kind!==`goal`||!r.onPreviewGoalSubagentConfiguration)return;let n=e?Oe():[];if(t&&!k.trim()&&te){M(`error`),E(m(`drawer.subagentModelRequired`));return}if(e&&!n){M(`error`),E(m(`drawer.subagentDomainInvalid`)),N(null);return}let i={allowedDomains:n??[],enabled:e,goalId:f.item.goalId,maxChildren:e?D:0,...Db(t,k,te)};M(`previewing`),E(m(`drawer.subagentPreviewing`)),N(null);try{let e=await r.onPreviewGoalSubagentConfiguration(i);if(!e.changed){ae.current=fe??null,re({...e.configuration,domainCandidates:we.domainCandidates}),w(e.configuration.allowedDomains),ee(e.configuration.modelConfig?.model??``),A(e.configuration.modelConfig?.reasoning_effort??``),O(e.configuration.maxChildren||2),M(`success`),E(m(`drawer.subagentNoChange`));return}N({...i,changed:e.changed,previewId:e.previewId}),M(`ready`),E(m(`drawer.subagentPreviewReady`))}catch(e){M(`error`),E(e instanceof Error?e.message:m(`drawer.subagentPreviewFailed`))}}async function je(){if(!(!ne||!r.onApplyGoalSubagentConfiguration)){M(`applying`),E(m(`drawer.subagentApplying`));try{let e=await r.onApplyGoalSubagentConfiguration({allowedDomains:ne.allowedDomains,enabled:ne.enabled,goalId:ne.goalId,maxChildren:ne.maxChildren,modelConfig:ne.modelConfig,previewId:ne.previewId});ae.current=fe??null,re({...e,domainCandidates:we.domainCandidates}),w(e.allowedDomains),ee(e.modelConfig?.model??``),A(e.modelConfig?.reasoning_effort??``),O(e.maxChildren||2),M(`success`),E(m(`drawer.subagentApplied`)),N(null);try{await r.onRefresh?.()}catch{M(`warning`),E(m(`drawer.subagentAppliedRefreshFailed`))}}catch(e){M(`error`),E(e instanceof Error?e.message:m(`drawer.subagentApplyFailed`))}}}return(0,B.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:ce,role:`dialog`,children:[(0,B.jsxs)(`header`,{className:`personal-drawer-header${f.kind===`todo`?` is-task-inspector`:``}`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{id:`personal-drawer-title`,ref:ue,tabIndex:-1,children:me}),(0,B.jsx)(`p`,{children:ge})]}),(0,B.jsxs)(`div`,{className:`personal-drawer-header-actions`,children:[f.kind===`todo`&&l?(0,B.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,B.jsx)(Fm,{size:17}):(0,B.jsx)(jm,{size:17})}):null,(0,B.jsxs)(`button`,{"aria-label":m(`drawer.closeDetail`,{context:ge}),className:`personal-icon-button personal-drawer-close`,onClick:pe,ref:L,type:`button`,children:[(0,B.jsx)(Zp,{className:`personal-mobile-back`,size:18}),(0,B.jsx)(oh,{className:`personal-desktop-close`,size:18})]})]})]}),(0,B.jsxs)(`div`,{className:`personal-drawer-body`,children:[f.kind===`attention`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card is-attention`,children:[(0,B.jsx)(`small`,{children:f.item.blocking?m(`drawer.attentionBlocking`):m(`drawer.attentionWaiting`)}),(0,B.jsx)(`h3`,{children:f.item.text}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,B.jsx)(`dd`,{children:f.item.priority??`medium`})]}),ye?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`common.waiting`)}),(0,B.jsx)(`dd`,{children:m(`tasks.waitingAge`,{age:ye})})]}):null]})]}),(0,B.jsx)(yb,{item:f.item,onSelect:n,successor:Yd(f.item,t)}),!u&&Xd(f.item)?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void Ce(f.item,`approve`,m(`common.confirm`)),type:`button`,children:[(0,B.jsx)(om,{size:17}),m(`drawer.decisionReview`)]}),(0,B.jsxs)(`details`,{className:`personal-compact-menu`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(_m,{size:17}),m(`drawer.decisionMore`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{onClick:()=>void r.onExplainDecision?.(f.item),type:`button`,children:[(0,B.jsx)(Nm,{size:16}),m(`drawer.explainDecision`)]}),Ab.map(e=>(0,B.jsx)(`button`,{onClick:()=>void Ce(f.item,e.resolution,m(e.key)),type:`button`,children:m(e.key)},e.resolution))]})]})]}):null]}):null,f.kind===`todo`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-task-inspector-summary`,children:[(0,B.jsxs)(`div`,{className:`personal-task-inspector-status`,children:[(0,B.jsxs)(`span`,{className:f.item.done?`is-done`:f.item.status===`blocked`?`is-blocked`:`is-open`,children:[(0,B.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,B.jsx)(`span`,{children:f.item.priority}):null,(0,B.jsx)(`span`,{children:f.item.taskClass===`advancement_task`?m(`drawer.taskAdvancement`):f.item.taskClass??m(`drawer.taskOrdinary`)})]}),(0,B.jsx)(`h3`,{children:f.item.text})]}),(0,B.jsxs)(`section`,{"aria-label":m(`drawer.taskInfo`),className:`personal-task-inspector-fields`,children:[(0,B.jsx)(`h4`,{children:m(`drawer.taskInfo`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`common.owner`)}),(0,B.jsx)(`dd`,{children:f.item.ownerLabel??f.item.claimedBy??m(`drawer.notAssigned`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`common.status`)}),(0,B.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,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,B.jsx)(`dd`,{children:f.item.priority??m(`drawer.notSet`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.dependencies`)}),(0,B.jsx)(`dd`,{children:f.item.dependencies?.join(` · `)||m(`common.none`)})]}),f.item.status===`deferred`||f.item.resumeWhen?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.resumeWhen`)}),(0,B.jsx)(`dd`,{children:f.item.resumeWhen||m(`drawer.notSet`)})]}):null,f.item.resumeWhen?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.resumeState`)}),(0,B.jsx)(`dd`,{children:f.item.resumeReady?m(`drawer.resumeReady`):m(`drawer.resumePending`)})]}):null,f.item.resumeReceiptId?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.resumeReceipt`)}),(0,B.jsx)(`dd`,{children:f.item.resumeReceiptId})]}):null,(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.nextTransition`)}),(0,B.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,B.jsxs)(`div`,{className:`personal-task-inspector-actions`,"aria-label":m(`drawer.taskActions`),children:[(0,B.jsxs)(`details`,{className:`personal-task-management`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(_m,{size:16}),m(`drawer.taskManage`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:m(`drawer.reassign`)}),(0,B.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.reassign`),(0,B.jsx)(`select`,{"aria-label":m(`drawer.reassign`),onChange:e=>oe(e.target.value),value:F,children:e.filter(e=>e.available).map(e=>(0,B.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))}),(0,B.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-${F}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:F,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,B.jsx)(`strong`,{children:m(`drawer.taskDeferUntil`)}),(0,B.jsxs)(`label`,{className:`personal-inline-agent-select personal-inline-resume-when`,children:[m(`drawer.taskDeferUntil`),(0,B.jsx)(`input`,{"aria-label":m(`drawer.taskDeferCondition`),"aria-invalid":!!I.trim()&&!be,onChange:e=>se(e.target.value),placeholder:m(`drawer.taskDeferPlaceholder`),value:I}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,disabled:!be,onClick:()=>void Se(f.item,`defer`,m(`drawer.taskDefer`),be??void 0),type:`button`,children:m(`drawer.taskDeferReview`)}),(0,B.jsx)(`small`,{children:I.trim()&&!be?m(`drawer.taskDeferInvalid`):m(`drawer.taskDeferSupported`)})]}),(0,B.jsx)(`div`,{className:`personal-task-management-secondary`,children:kb.map(e=>(0,B.jsx)(`button`,{onClick:()=>void Se(f.item,e.operation,m(e.key)),type:`button`,children:m(e.key)},e.operation))})]})]}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void Se(f.item,`complete`,m(`drawer.taskComplete`)),type:`button`,children:[(0,B.jsx)(om,{size:17}),m(`drawer.taskComplete`)]})]}):null,f.item.done?(0,B.jsxs)(`div`,{className:`personal-task-completed-note`,children:[(0,B.jsx)(om,{size:16}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:m(`drawer.taskCompletedTitle`)}),(0,B.jsx)(`small`,{children:m(`drawer.taskCompletedNote`)})]})]}):null]}):null,f.kind===`goal`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,B.jsx)(`small`,{children:Yi(f.item.state,p)}),(0,B.jsx)(`h3`,{children:f.item.title}),(0,B.jsx)(`p`,{children:f.item.agentSentence}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.tokens`)}),(0,B.jsxs)(`dd`,{children:[eb(f.item.usage?.tokens24h,m(`drawer.usageNotMeasured`),Zy),` / `,eb(f.item.usage?.tokens7d,m(`drawer.usageNotMeasured`),Zy)]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.cost`)}),(0,B.jsxs)(`dd`,{children:[eb(f.item.usage?.costUsd24h,m(`drawer.usageNotMeasured`),Qy),` / `,eb(f.item.usage?.costUsd7d,m(`drawer.usageNotMeasured`),Qy)]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.duration`)}),(0,B.jsxs)(`dd`,{children:[eb(f.item.usage?.durationMs24h,m(`drawer.usageNotMeasured`),$y),` / `,eb(f.item.usage?.durationMs7d,m(`drawer.usageNotMeasured`),$y)]})]})]})]}),(0,B.jsx)(vb,{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,B.jsxs)(B.Fragment,{children:[f.item.repository?(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-repository`,children:[(0,B.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,B.jsx)(`small`,{children:m(`drawer.repository`)}),(0,B.jsx)(`em`,{children:m(`common.readOnly`)})]}),(0,B.jsxs)(`h3`,{children:[(0,B.jsx)(Cm,{size:16}),f.item.repository.label]}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.branch`)}),(0,B.jsx)(`dd`,{children:f.item.repository.branch||`detached`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Role`}),(0,B.jsx)(`dd`,{children:m(`drawer.repositoryRole`)})]})]}),(0,B.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,B.jsx)(mm,{size:15}),m(y===`copied`?`drawer.copyRepositoryDone`:`drawer.copyRepository`)]}),y===`error`?(0,B.jsx)(`p`,{className:`personal-copy-feedback is-error`,role:`status`,children:m(`drawer.copyRepositoryError`)}):y===`copied`?(0,B.jsx)(`p`,{className:`personal-copy-feedback`,role:`status`,children:m(`drawer.copyRepositorySuccess`)}):null]}):null,u?(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,B.jsx)(`small`,{children:m(`drawer.larkConnection`)}),(0,B.jsx)(`h3`,{children:m(`drawer.remoteDetailsUnavailable`)}),(0,B.jsx)(`p`,{children:m(`drawer.remoteDetailsDescription`)})]}):(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,B.jsx)(`small`,{children:m(`drawer.larkConnection`)}),t?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`h3`,{children:[t.app_label,(0,B.jsx)(`span`,{className:`personal-connection-status`,children:m(`drawer.connected`)})]}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.group`)}),(0,B.jsx)(`dd`,{children:t.chat_name})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.topic`)}),(0,B.jsxs)(`dd`,{children:[`# `,t.topic_name]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.trigger`)}),(0,B.jsx)(`dd`,{children:t.incoming_mode===`mentions`?m(`lark.someoneMentions`):m(`lark.allMessages`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.replyMode`)}),(0,B.jsx)(`dd`,{children:m(`lark.topicReply`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.autoNotify`)}),(0,B.jsx)(`dd`,{children:e?.humanGateAutoNotifyEnabled?m(`common.on`):m(`common.off`)})]}),e?.lastNotifiedAt?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.lastNotification`)}),(0,B.jsx)(`dd`,{children:e.lastNotifiedAt})]}):null]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h3`,{children:m(`drawer.larkNotConfigured`)}),(0,B.jsx)(`p`,{children:m(`drawer.larkNotConfiguredDescription`)})]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onOpenNotificationSettings?.(f.item.goalId),type:`button`,children:[(0,B.jsx)(nm,{size:16}),m(t?`drawer.larkConfigure`:`drawer.larkConnect`)]})]})]})})(),(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-session`,children:[(0,B.jsx)(`small`,{children:m(`drawer.runDetails`)}),_e?.sessionId?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h3`,{children:Xi(_e.sessionStatus??_e.status,m)}),(0,B.jsx)(`p`,{children:_e.title}),r.onOpenRunSession?(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onOpenRunSession?.(_e),type:`button`,children:[(0,B.jsx)(Bm,{size:16}),m(`drawer.runLatest`)]}):null]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h3`,{children:m(`drawer.noRun`)}),(0,B.jsx)(`p`,{children:m(`drawer.noRunDescription`)})]})]}),u?null:(0,B.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`heartbeat`,f.item.goalId),type:`button`,children:[(0,B.jsx)(Hm,{size:16}),m(`drawer.setupHeartbeat`)]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`monitor`,f.item.goalId),type:`button`,children:[(0,B.jsx)(am,{size:16}),m(`drawer.scheduleAdd`)]})]}),f.item.subagentExecution?(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-subagents`,children:[(0,B.jsxs)(`div`,{className:`personal-subagent-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:m(`drawer.subagentLabel`)}),(0,B.jsxs)(`h3`,{children:[(0,B.jsx)(rm,{size:16}),m(`drawer.subagentTitle`)]})]}),(0,B.jsxs)(`button`,{"aria-checked":we.enabled,"aria-label":m(ne&&j===`ready`?`drawer.subagentPending`:we.enabled?`drawer.subagentDisable`:`drawer.subagentEnable`),className:`personal-subagent-switch`,"data-pending":ne&&j===`ready`?`true`:void 0,disabled:u||Te||!!ne||!r.onPreviewGoalSubagentConfiguration,onClick:()=>void Ae(!we.enabled),role:`switch`,type:`button`,children:[(0,B.jsx)(`span`,{}),m(ne&&j===`ready`?`drawer.subagentPending`:we.enabled?`common.on`:`common.off`)]})]}),(0,B.jsx)(`p`,{children:m(`drawer.subagentDescription`)}),ne&&j===`ready`?(0,B.jsxs)(`div`,{className:`personal-subagent-preview`,children:[(0,B.jsx)(`strong`,{children:m(ne.enabled?`drawer.subagentConfirmEnable`:`drawer.subagentConfirmDisable`)}),(0,B.jsx)(`p`,{children:ne.enabled?m(`drawer.subagentPreviewSummary`,{count:ne.maxChildren,domains:ne.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)}):m(`drawer.subagentDisableSummary`)}),ne.modelConfig===void 0?null:(0,B.jsxs)(`p`,{children:[m(`drawer.subagentModel`),`: `,ne.modelConfig?.model||m(`drawer.subagentModelDefault`),` · `,ne.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`button`,{className:`personal-primary-action`,onClick:()=>void je(),type:`button`,children:m(`common.confirm`)}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:De,type:`button`,children:m(`common.cancel`)})]})]}):null,T?(0,B.jsxs)(`p`,{className:`personal-subagent-feedback is-${j}`,role:`status`,children:[j===`previewing`||j===`applying`?(0,B.jsx)(Wm,{className:`personal-spin`,size:13}):null,T]}):null,(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.subagentModel`)}),(0,B.jsx)(`dd`,{children:we.modelConfig?.model||m(`drawer.subagentModelDefault`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.subagentEffort`)}),(0,B.jsx)(`dd`,{children:we.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.subagentCurrentBoundary`)}),(0,B.jsx)(`dd`,{children:we.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.subagentChildLimit`)}),(0,B.jsx)(`dd`,{children:we.maxChildren||0})]})]}),u?(0,B.jsx)(`p`,{className:`personal-subagent-read-only`,children:m(`drawer.subagentRemoteReadOnly`)}):(0,B.jsxs)(`div`,{className:`personal-subagent-fields`,children:[(0,B.jsxs)(`fieldset`,{className:`personal-subagent-domain-picker`,disabled:Te,children:[(0,B.jsx)(`legend`,{children:m(`drawer.subagentDomains`)}),Ee.length>0?(0,B.jsx)(`div`,{className:`personal-subagent-domain-options`,children:Ee.map(e=>{let t=C.includes(e.value);return(0,B.jsxs)(`label`,{className:`personal-subagent-domain-option${t?` is-selected`:``}`,children:[(0,B.jsx)(`input`,{"aria-label":e.value,checked:t,onChange:t=>ke(e.value,t.target.checked),type:`checkbox`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.value}),(0,B.jsx)(`small`,{children:m(`drawer.subagentDomainTodoCount`,{count:e.matchingTodoCount})})]})]},e.value)})}):(0,B.jsx)(`p`,{className:`personal-subagent-domain-empty`,children:m(`drawer.subagentDomainsEmpty`)}),(0,B.jsx)(`small`,{children:m(`drawer.subagentDomainsHint`)})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:m(`drawer.subagentModel`)}),(0,B.jsx)(`input`,{"aria-label":m(`drawer.subagentModel`),disabled:Te,value:k,placeholder:`gpt-5.6-luna`,onChange:e=>{ee(e.target.value),N(null),M(`idle`),E(null)}})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:m(`drawer.subagentEffort`)}),(0,B.jsxs)(`select`,{"aria-label":m(`drawer.subagentEffort`),disabled:Te,value:te,onChange:e=>{A(e.target.value),N(null),M(`idle`),E(null)},children:[(0,B.jsx)(`option`,{value:``,children:m(`drawer.subagentModelDefault`)}),[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`].map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,disabled:Te,type:`button`,onClick:()=>{ee(`gpt-5.6-luna`),A(`max`),N(null),M(`idle`),E(null)},children:m(`drawer.subagentLunaPreset`)}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,disabled:Te,type:`button`,onClick:()=>{ee(``),A(``),N(null),M(`idle`),E(null)},children:m(`drawer.subagentClearModel`)}),(0,B.jsx)(`p`,{children:m(`drawer.subagentModelHint`)}),(0,B.jsxs)(`label`,{className:`personal-subagent-limit-field`,children:[(0,B.jsx)(`span`,{children:m(`drawer.subagentMaxChildren`)}),(0,B.jsx)(`select`,{"aria-label":m(`drawer.subagentMaxChildren`),disabled:Te,onChange:e=>{O(Number(e.target.value)),N(null),M(`idle`),E(null)},value:D,children:jb.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,disabled:Te,onClick:()=>void Ae(we.enabled,!0),type:`button`,children:m(`drawer.subagentPreviewBoundary`)})]})]}):null]}):null,f.kind===`run`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{"aria-label":m(`drawer.runView`),className:`personal-run-drawer-tabs`,role:`tablist`,children:[(0,B.jsx)(`button`,{"aria-selected":x===`record`,onClick:()=>S(`record`),role:`tab`,type:`button`,children:m(`drawer.executionRecordAndResult`)}),(0,B.jsx)(`button`,{"aria-selected":x===`details`,onClick:()=>S(`details`),role:`tab`,type:`button`,children:m(`drawer.detailsAndActions`)})]}),x===`record`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card personal-session-summary`,children:[(0,B.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Xi(f.item.sessionStatus??f.item.status,m)]}),(0,B.jsx)(`h3`,{children:f.item.title}),(0,B.jsx)(`p`,{children:f.item.latestActivity}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,B.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]})]})]}),(0,B.jsxs)(`section`,{"aria-label":m(`drawer.executionRecord`),className:`personal-session-message-record`,children:[(0,B.jsx)(`h3`,{children:m(`drawer.executionRecord`)}),f.item.sessionMessages?.length?(0,B.jsx)(`ol`,{children:f.item.sessionMessages.map(e=>(0,B.jsxs)(`li`,{className:`is-${e.role}`,children:[(0,B.jsx)(`i`,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:e.role===`user`?m(`drawer.runRoleUser`):e.role===`assistant`?m(`drawer.runRoleAssistant`):m(`drawer.runRoleSystem`)}),e.createdAt?(0,B.jsx)(`time`,{children:new Date(e.createdAt).toLocaleTimeString(p,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}):null]}),(0,B.jsx)(`p`,{children:e.text})]})]},e.messageId))}):(0,B.jsx)(`p`,{className:`personal-session-empty`,children:ve?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,B.jsxs)(`div`,{className:`personal-session-active-step`,children:[(0,B.jsx)(`i`,{}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:m(`drawer.analysis`)}),(0,B.jsx)(`small`,{children:m(`drawer.agentWorking`)})]})]}):null]}),f.item.outputs?.length?(0,B.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-run-outputs-title`,children:[(0,B.jsx)(`h3`,{id:`personal-run-outputs-title`,children:m(`drawer.outputs`)}),(0,B.jsx)(`ol`,{children:f.item.outputs.map(e=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.title}),(0,B.jsx)(`small`,{children:e.createdAt??e.kind??m(`files.emptySummary`)})]})},e.outputId))})]}):null]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,B.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Xi(f.item.status,m)]}),(0,B.jsx)(`h3`,{children:f.item.title}),(0,B.jsx)(`p`,{children:f.item.latestActivity}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,B.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.sessionStatus`)}),(0,B.jsx)(`dd`,{children:Xi(f.item.sessionStatus??f.item.status,m)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.sessionRecoverable`)}),(0,B.jsx)(`dd`,{children:f.item.resumable===!1?m(`drawer.resumeNo`):m(`drawer.resumeYes`)})]})]})]}),f.item.sessionStatus===`resume_failed`&&!u?(0,B.jsxs)(`section`,{className:`personal-recovery-panel`,"aria-label":m(`drawer.recoveryFailed`),children:[(0,B.jsx)(`strong`,{children:m(`drawer.recoveryFailed`)}),(0,B.jsx)(`p`,{children:m(`drawer.recoveryDescription`)}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,B.jsx)(Wm,{size:16}),m(`drawer.recoveryRetry`)]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,B.jsx)(Bm,{size:16}),m(`drawer.recoveryNewSession`)]})]}):null,u?null:(0,B.jsxs)(`section`,{className:`personal-correction-panel`,children:[(0,B.jsx)(`header`,{children:(0,B.jsxs)(`span`,{children:[(0,B.jsx)(rm,{size:16}),m(`drawer.correctionLabel`,{agent:f.item.agentLabel})]})}),(0,B.jsx)(`p`,{children:m(`drawer.correctionDescription`)}),(0,B.jsxs)(`div`,{className:`personal-correction-composer`,children:[(0,B.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,B.jsx)(`button`,{"aria-label":m(`drawer.correctionSend`),disabled:!h.trim(),onClick:()=>void xe(),type:`button`,children:(0,B.jsx)(qm,{size:16})})]})]}),u?null:(0,B.jsxs)(`details`,{className:`personal-compact-menu personal-run-more`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(_m,{size:17}),m(`drawer.moreRunActions`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{disabled:!f.item.canInterrupt,onClick:()=>void r.onInterruptRun?.(f.item),type:`button`,children:[(0,B.jsx)(zm,{size:16}),m(`drawer.runInterrupt`)]}),(0,B.jsxs)(`button`,{disabled:f.item.resumable===!1,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,B.jsx)(Wm,{size:16}),m(`drawer.recoveryRetry`)]}),(0,B.jsxs)(`button`,{onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,B.jsx)(Bm,{size:16}),m(`drawer.runNewSession`)]}),(0,B.jsxs)(`button`,{onClick:()=>void r.onCloseRunSession?.(f.item),type:`button`,children:[(0,B.jsx)(eh,{size:16}),m(`drawer.runCloseSession`)]})]})]})]})]}):null,f.kind===`output`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,B.jsx)(`small`,{children:f.item.kind??`output`}),(0,B.jsx)(`h3`,{children:f.item.title}),(0,B.jsx)(`p`,{children:f.item.summary??m(`drawer.outputRecorded`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.outputTodo`)}),(0,B.jsx)(`dd`,{children:f.item.todoId??m(`drawer.notLinked`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.outputRun`)}),(0,B.jsx)(`dd`,{children:f.item.runId??m(`drawer.notLinked`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Agent`}),(0,B.jsx)(`dd`,{children:f.item.agentLabel??f.item.agentId??`LoopX`})]})]})]}),f.item.report?(0,B.jsxs)(`section`,{className:`personal-report-detail`,"data-testid":`personal-periodic-report-detail`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsxs)(`strong`,{children:[`+`,f.item.report.addedCount]}),m(`files.reportAdded`)]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:f.item.report.changedCount}),m(`files.reportChanged`)]})]}),(0,B.jsxs)(`p`,{children:[f.item.report.periodStartAt,` → `,f.item.report.periodEndAt]}),(0,B.jsx)(`ol`,{children:f.item.report.items.map(e=>(0,B.jsxs)(`li`,{"data-change-kind":e.changeKind,children:[(0,B.jsxs)(`small`,{children:[e.changeKind,` · `,e.status]}),(0,B.jsx)(`strong`,{children:e.title}),(0,B.jsx)(`p`,{children:e.summary})]},e.sourceRef))}),(0,B.jsxs)(`footer`,{children:[(0,B.jsxs)(`span`,{children:[m(`files.reportPublication`),`: `,f.item.report.publicationId]}),(0,B.jsxs)(`span`,{children:[m(`files.reportGeneration`),`: `,f.item.report.generationId]})]})]}):null,f.item.safePreview?(0,B.jsx)(`pre`,{"aria-label":m(`drawer.outputSafePreview`),className:`personal-safe-preview`,children:f.item.safePreview}):(0,B.jsx)(`p`,{className:`personal-preview-unavailable`,children:m(`drawer.previewUnavailable`)}),(0,B.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,B.jsxs)(`button`,{className:`personal-primary-action`,disabled:!r.onOpenOutput,onClick:()=>{r.onOpenOutput?.(f.item),c()},type:`button`,children:[(0,B.jsx)(vm,{size:16}),m(`files.openConversation`)]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!r.onExportOutput,onClick:()=>void r.onExportOutput?.(f.item),type:`button`,children:[(0,B.jsx)(gm,{size:16}),m(`files.exportSummary`)]})]})]}):null,f.kind===`proposal`?(0,B.jsxs)(B.Fragment,{children:[f.item.actionKind===`team.plan`&&f.item.status===`applied`?(0,B.jsx)(bb,{proposal:f.item,t:m}):(0,B.jsxs)(`section`,{className:`personal-proposal-card`,children:[(0,B.jsxs)(`small`,{children:[f.item.actionKind,` · `,f.item.status]}),(0,B.jsx)(`h3`,{children:f.item.title}),(0,B.jsx)(`p`,{children:f.item.impact}),f.item.reviewPlan&&f.item.actionKind!==`team.plan`?(0,B.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,B.jsx)(`p`,{className:`personal-proposal-explainer`,children:m(`drawer.proposalExplainer`)}):null,(0,B.jsx)(`dl`,{children:f.item.fields.map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e.label}),(0,B.jsx)(`dd`,{children:e.value})]},e.key))})]}),f.item.status===`applied`&&f.item.actionKind!==`team.plan`?(0,B.jsxs)(`p`,{className:`personal-proposal-state ${f.item.actionKind===`operation.execute`&&f.item.reviewPlan?.reason===`readback_unverified`?`is-gated`:`is-applied`}`,children:[(0,B.jsx)(om,{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,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>{let e=f.item.goalId;c(),r.onOpenGoal?.(e)},type:`button`,children:[(0,B.jsx)(vm,{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,B.jsx)(`p`,{className:`personal-proposal-state is-stale`,children:m(`drawer.proposalStale`)}):null,f.item.status===`error`?(0,B.jsxs)(`div`,{className:`personal-proposal-state is-error`,children:[(0,B.jsx)(`span`,{children:f.item.reviewPlan?.reason===`readback_unverified`?m(`actionReview.readback_unverified`):m(`drawer.proposalApplyFailed`)}),f.item.errorMessage?(0,B.jsx)(`small`,{children:f.item.errorMessage}):null,(0,B.jsx)(`small`,{children:m(f.item.actionKind===`team.plan`?`proposal.teamPlan.retryHint`:`drawer.proposalApplyFailedHint`)})]}):null,f.item.status===`rejected`?(0,B.jsx)(`p`,{className:`personal-proposal-state is-error`,children:m(`drawer.proposalRejected`)}):null,f.item.status===`deferred`?(0,B.jsx)(`p`,{className:`personal-proposal-state is-gated`,children:m(`drawer.proposalDeferred`)}):null,f.item.status===`gated`?(0,B.jsxs)(`div`,{className:`personal-proposal-state is-gated`,children:[(0,B.jsxs)(`span`,{children:[(0,B.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,B.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,B.jsxs)(`section`,{className:`personal-detail-card personal-gate-cli-hint`,children:[(0,B.jsx)(`small`,{children:m(`drawer.gateApproveHint`)}),(0,B.jsxs)(`code`,{children:[`loopx todo complete --goal-id `,t,` --todo-id `,n,` --decision-outcome approve`]}),(0,B.jsx)(`small`,{children:m(`drawer.gateRejectHint`)})]})})():null,!u&&f.item.workspaceCandidates?.length?(0,B.jsx)(`div`,{className:`personal-workspace-candidates`,"aria-label":m(`drawer.workspaceCandidates`),children:f.item.workspaceCandidates.map(e=>(0,B.jsxs)(`button`,{onClick:()=>void r.onSelectWorkspaceCandidate?.(f.item,e.workspaceRef),type:`button`,children:[(0,B.jsx)(`strong`,{children:e.label}),(0,B.jsx)(`small`,{children:e.workspaceRef})]},e.workspaceRef))}):null,!u&&f.item.actionKind!==`operation.execute`&&f.item.status===`error`?(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void(f.item.actionKind===`team.plan`?r.onApplyProposal?.(f.item):r.onTransitionProposal?.(f.item,`regenerate`)),type:`button`,children:[(0,B.jsx)(Wm,{size:17}),m(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,B.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,B.jsx)(om,{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,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,B.jsx)(Wm,{size:16}),m(`drawer.proposalRecheck`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&[`ready`,`gated`].includes(f.item.status)?(0,B.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`defer`),type:`button`,children:m(`drawer.proposalDefer`)}),(0,B.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,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:c,type:`button`,children:m(`drawer.proposalClose`)})]}):null,f.kind===`schedule`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,B.jsxs)(`small`,{children:[f.item.scheduleKind===`heartbeat`?`Goal Heartbeat`:`continuous_monitor`,` · `,f.item.status??`active`]}),(0,B.jsx)(`h3`,{children:f.item.label}),(0,B.jsx)(`p`,{children:f.item.target??f.item.schedule??m(`drawer.scheduleDefaultTarget`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.scheduleTimezone`)}),(0,B.jsx)(`dd`,{children:f.item.timezone??m(`drawer.scheduleLocalTimezone`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.scheduleNext`)}),(0,B.jsx)(`dd`,{children:f.item.nextRunAt??m(`drawer.schedulePending`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.scheduleLast`)}),(0,B.jsx)(`dd`,{children:f.item.previousRunAt??m(`drawer.scheduleNeverRun`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.scheduleNotification`)}),(0,B.jsx)(`dd`,{children:f.item.notificationRule??m(`drawer.scheduleDefaultNotification`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:m(`drawer.scheduleStopCondition`)}),(0,B.jsx)(`dd`,{children:f.item.stopCondition??m(`drawer.scheduleDefaultStop`)})]})]})]}),!u&&f.item.scheduleKind===`monitor`?(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`run_now`),type:`button`,children:[(0,B.jsx)(Bm,{size:16}),m(`drawer.scheduleRunNow`)]}):null,u?null:(0,B.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,B.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,B.jsx)(Bm,{size:16}):(0,B.jsx)(zm,{size:16}),f.item.status===`paused`?m(`drawer.scheduleResume`):m(`drawer.schedulePause`)]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`edit`),type:`button`,children:[(0,B.jsx)(am,{size:16}),m(`drawer.scheduleEdit`)]})]}),u?null:(0,B.jsxs)(`button`,{className:`personal-danger-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`stop`),type:`button`,children:[(0,B.jsx)(eh,{size:16}),m(`drawer.scheduleStop`,{kind:f.item.scheduleKind===`heartbeat`?` Heartbeat`:m(`drawer.titleSchedule`)})]}),(0,B.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-execution-history-title`,children:[(0,B.jsx)(`h3`,{id:`personal-execution-history-title`,children:m(`drawer.executionHistory`)}),f.item.executionHistory?.length?(0,B.jsx)(`ol`,{children:f.item.executionHistory.map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.label}),(0,B.jsx)(`small`,{children:e.timestamp})]}),(0,B.jsx)(`em`,{className:`is-${e.status}`,children:e.status})]},`${e.timestamp}:${e.runId??t}`))}):(0,B.jsx)(`p`,{children:m(`drawer.noExecutionHistory`)})]})]}):null,f.kind===`run`||f.kind===`proposal`||f.kind===`schedule`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{"aria-expanded":_,className:`personal-diagnostics-trigger`,onClick:()=>v(e=>!e),type:`button`,children:[(0,B.jsx)(`span`,{children:m(`drawer.advancedDiagnostics`)}),(0,B.jsx)(sm,{className:_?`is-open`:``,size:16})]}),_?(0,B.jsxs)(`div`,{className:`personal-diagnostics`,children:[(0,B.jsxs)(`code`,{children:[`goal_id: `,he]}),(0,B.jsxs)(`code`,{children:[`kind: `,f.kind]}),f.kind===`run`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`code`,{children:[`session_id: `,f.item.sessionId??m(`drawer.notLinked`)]}),(0,B.jsxs)(`code`,{children:[`turn_id: `,f.item.turnId??m(`common.none`)]}),(0,B.jsxs)(`code`,{children:[`adapter: `,f.item.agentId]}),(0,B.jsxs)(`code`,{children:[`status: `,f.item.sessionStatus??f.item.status]})]}):f.kind===`proposal`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`code`,{children:[`action: `,f.item.actionKind]}),(0,B.jsxs)(`code`,{children:[`status: `,f.item.status]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`code`,{children:[`schedule_id: `,f.item.scheduleId]}),(0,B.jsxs)(`code`,{children:[`status: `,f.item.status??`active`]})]})]}):null]}):null]})]})}var Ib=[`checking`,`connecting`,`downloading`,`installing_app`,`installing_runtime`],Lb={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 Rb(e,t=`update_failed`){return{phase:`error`,details:{code:typeof e==`string`&&Object.hasOwn(Lb,e)?e:t}}}function zb(){let{locale:e}=Ji(),t=e===`zh-CN`,[n,r]=(0,z.useState)(!1),i=(0,z.useRef)(null),[a,o]=(0,z.useState)(`stable`),[s,c]=(0,z.useState)({phase:`idle`}),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(!1),p=(0,z.useRef)(!1),m=window.__TAURI__?.core.invoke,h=Ib.includes(s.phase);(0,z.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,z.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(Rb(t))})}).catch(()=>{e&&c(Rb(null,`desktop_status_unavailable`))}),()=>{e=!1}},[m]),(0,z.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(Rb(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:Lb[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,B.jsxs)(`div`,{className:`personal-desktop-update`,children:[(0,B.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,B.jsx)(gm,{size:16,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:v}),(0,B.jsx)(lm,{size:14,"aria-hidden":`true`})]}),(0,B.jsxs)(`section`,{ref:i,popover:`auto`,id:`desktop-update-panel`,className:`personal-update-panel`,"aria-label":t?`LoopX 更新`:`LoopX updates`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:t?`LoopX 更新`:`LoopX updates`}),(0,B.jsx)(`button`,{type:`button`,"aria-label":t?`关闭更新面板`:`Close updates`,onClick:()=>i.current?.hidePopover(),children:(0,B.jsx)(oh,{size:16,"aria-hidden":`true`})})]}),(0,B.jsxs)(`small`,{children:[l,` · `,a===`main`?t?`main 预览版`:`main preview`:t?`稳定版`:`Stable`]}),s.details?.version?(0,B.jsxs)(`p`,{children:[t?`目标版本:`:`Target: `,s.details.version]}):null,(0,B.jsxs)(`p`,{role:`status`,"aria-live":`polite`,children:[h?(0,B.jsx)(Um,{className:`is-spinning`,size:14,"aria-hidden":`true`}):null,_[s.phase]]}),s.phase===`downloading`&&s.details?.total?(0,B.jsx)(`progress`,{"aria-label":t?`下载进度`:`Download progress`,max:s.details.total,value:s.details.received??0}):null,m?(0,B.jsx)(`div`,{className:`personal-update-actions`,children:s.phase===`restart_required`?(0,B.jsx)(`button`,{type:`button`,onClick:()=>void g(`restart`),children:t?`重启完成更新`:`Restart to finish`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void g(`check`),children:t?`检查更新`:`Check for updates`}),s.phase===`available`?(0,B.jsx)(`button`,{type:`button`,onClick:()=>void g(`apply`),children:t?`更新并准备重启`:`Install update`}):null]})}):(0,B.jsx)(`p`,{children:t?`请在 LoopX App 中更新;浏览器自身无需安装包。`:`Update from the LoopX App; the browser needs no installer.`}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:t?`高级选项`:`Advanced options`}),(0,B.jsxs)(`label`,{children:[t?`更新通道`:`Update channel`,(0,B.jsxs)(`select`,{disabled:h||s.phase===`restart_required`,value:a,onChange:e=>{o(e.target.value),c({phase:`idle`})},children:[(0,B.jsx)(`option`,{value:`stable`,children:t?`稳定版(推荐)`:`Stable (recommended)`}),(0,B.jsx)(`option`,{value:`main`,children:t?`main 预览版`:`main preview`})]})]}),(0,B.jsx)(`p`,{children:t?`App 与匹配的 CLI 一起更新,服务可能短暂断开。不删除 Goal 数据。`:`Updates the App and matching CLI. Services may briefly disconnect. Goal data is not deleted.`}),m?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{children:t?`启动失败时,可重装当前 App 随附的运行时。`:`If startup fails, reinstall this App's bundled runtime.`}),(0,B.jsx)(`button`,{disabled:h||s.phase===`restart_required`,type:`button`,onClick:()=>void g(`repair`),children:t?`修复当前版本`:`Repair this version`})]}):null,m&&d?(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:t?`恢复上个版本`:`Restore previous version`}),(0,B.jsx)(`p`,{children:t?`将恢复已保留的 App 和它的运行时,需要重启。`:`Restore the retained App and its runtime, then restart.`}),(0,B.jsx)(`button`,{disabled:h,type:`button`,onClick:()=>void g(`rollback`),children:t?`确认恢复上版`:`Restore previous version`})]}):null]})]})]})}var Bb=e=>`loopx-sidebar-goal-order-v1:${encodeURIComponent(e)}`;function Vb(e){try{let t=JSON.parse(e??`null`);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?[...new Set(t)]:[]}catch{return[]}}function Hb(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 Ub(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 Wb(e,t){let n=Bb(t),[r,i]=(0,z.useState)(()=>{try{return Vb(localStorage.getItem(n))}catch{return[]}}),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(null),d=(0,z.useRef)(null),f=(0,z.useRef)(!1),p=Hb(e,r),m=p.map(e=>e.goalId);function h(t,a,s){let l=Ub(r,m,t,a,s);if(l===r)return;i(l);let u=Hb(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 Gb=`/ssh-hosts`,Kb=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/;function qb(e){return typeof e==`string`&&Kb.test(e.trim())}function Jb(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!qb(t)||n.has(t)?[]:(n.add(t),[{alias:t}])}),schemaVersion:`ssh_host_catalog_v0`}}async function Yb(e=fetch,t=Gb){let n=await e(t,{cache:`no-store`});if(!n.ok)throw Error(`无法读取本机 SSH Host(HTTP ${n.status})。`);return Jb(await n.json())}function Xb(e,t){let n=e.trim();if(!qb(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 Zb=`/api/ssh-source/ensure`,Qb=`/api/ssh-source/goal-lifecycle`;async function $b(e,t){let n=await fetch(Zb,{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 ex(e,t,n,r,i=fetch){let a=await i(Qb,{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 tx({activeSource:e,connectionState:t,errorMessage:n,onAdd:r,onConfiguredHostsLoaded:i,onRemove:a,onSelect:o,sources:s}){let{t:c}=Ji(),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(null),[p,m]=(0,z.useState)(`configured`),[h,g]=(0,z.useState)([]),[_,v]=(0,z.useState)(null),[y,b]=(0,z.useState)(!1),[x,S]=(0,z.useState)(!1),[C,w]=(0,z.useState)(``),[T,E]=(0,z.useState)(``),[D,O]=(0,z.useState)(`8876`),[k,ee]=(0,z.useState)(``),te=`configured:`,A=[...s.map(e=>({label:e.label,value:e.id})),...h.filter(e=>!s.some(t=>t.label===e.alias)).map(e=>({group:c(`source.configuredGroup`,{count:h.length}),label:e.alias,value:`${te}${e.alias}`}))],j=(0,z.useMemo)(()=>h.some(e=>e.alias===C)?Xb(C,D):{error:c(`source.selectHost`)},[h,C,D,c]);(0,z.useEffect)(()=>{M()},[]);async function M(){b(!0),v(null);try{let e=await Yb();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),M()}function N(){u(!1),m(`configured`),v(null),S(!1),w(``),f(null),E(``),O(`8876`),ee(``)}function P(){let e=r({label:T,statusUrl:k});if(e.error){f(e.error);return}N()}function re(){if(`error`in j){f(j.error??c(`source.invalid`));return}let e=r({ensureTunnel:!0,hostAlias:j.hostAlias,label:j.label,statusUrl:j.statusUrl});if(e.error){f(e.error);return}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=Xb(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 j){f(j.error??c(`source.invalid`));return}try{await navigator.clipboard.writeText(j.command),S(!0),f(null)}catch{f(c(`source.copyError`))}}return(0,B.jsxs)(`section`,{"aria-label":c(`source.controlPlane`),className:`personal-status-source`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`span`,{children:`Control plane`}),(0,B.jsx)(`button`,{"aria-label":c(`source.addSsh`),onClick:ne,title:c(`source.add`),type:`button`,children:(0,B.jsx)(Vm,{size:14})})]}),(0,B.jsx)(rb,{ariaLabel:c(`source.select`),className:`personal-status-source-select`,icon:(0,B.jsx)(Ym,{size:15}),onChange:e=>{if(e.startsWith(te)){ie(e.slice(11));return}o(e)},options:A,value:e.id}),(0,B.jsxs)(`div`,{className:`personal-status-source-meta`,children:[(0,B.jsxs)(`span`,{className:`is-${t}`,children:[(0,B.jsx)(`i`,{}),c(t===`loading`?`source.connecting`:t===`error`?`source.notAvailable`:`source.connected`)]}),(0,B.jsx)(`small`,{children:e.readOnly?c(`source.readOnly`):c(`source.localInteractive`)}),e.kind===`ssh_tunnel`?(0,B.jsx)(`button`,{"aria-label":c(`source.remove`,{source:e.label}),onClick:()=>a(e.id),title:c(`source.removeCurrent`),type:`button`,children:(0,B.jsx)(rh,{size:12})}):null]}),n?(0,B.jsx)(`p`,{className:`personal-status-source-error`,role:`alert`,children:n}):null,l?(0,B.jsxs)(`div`,{className:`personal-status-source-form`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:c(`source.addSsh`)}),(0,B.jsx)(`button`,{"aria-label":c(`source.closeForm`),onClick:N,type:`button`,children:(0,B.jsx)(oh,{size:13})})]}),(0,B.jsxs)(`div`,{"aria-label":c(`source.addMethod`),className:`personal-status-source-modes`,role:`tablist`,children:[(0,B.jsx)(`button`,{"aria-selected":p===`configured`,onClick:()=>{m(`configured`),f(null)},role:`tab`,type:`button`,children:c(`source.configured`)}),(0,B.jsx)(`button`,{"aria-selected":p===`manual`,onClick:()=>{m(`manual`),f(null)},role:`tab`,type:`button`,children:c(`source.manual`)})]}),p===`configured`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:c(`source.configuredCount`,{count:h.length})}),(0,B.jsxs)(`span`,{className:`personal-status-source-field-row`,children:[(0,B.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,B.jsx)(`datalist`,{id:`loopx-configured-ssh-hosts`,children:h.map(e=>(0,B.jsx)(`option`,{value:e.alias},e.alias))}),(0,B.jsx)(`button`,{"aria-label":c(`source.refreshHosts`),disabled:y,onClick:()=>void M(),title:c(`source.refreshHosts`),type:`button`,children:(0,B.jsx)(Gm,{size:13})})]})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:c(`source.localPort`)}),(0,B.jsx)(`input`,{"aria-label":c(`source.localPort`),inputMode:`numeric`,onChange:e=>{O(e.target.value),S(!1)},value:D})]}),(0,B.jsxs)(`div`,{className:`personal-status-source-command`,children:[(0,B.jsx)(`code`,{children:`error`in j?c(`source.tunnelCommandPending`):j.command}),(0,B.jsxs)(`button`,{"aria-label":c(`source.copyCommand`),disabled:`error`in j,onClick:()=>void ae(),type:`button`,children:[(0,B.jsx)(mm,{size:12}),c(x?`source.copied`:`source.copy`)]})]}),_?(0,B.jsx)(`p`,{className:`is-error`,children:_}):null,(0,B.jsx)(`p`,{children:c(`source.description`)}),(0,B.jsx)(`button`,{className:`personal-status-source-add`,disabled:`error`in j,onClick:re,type:`button`,children:c(`source.addConfigured`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:c(`source.name`)}),(0,B.jsx)(`input`,{autoFocus:!0,maxLength:48,onChange:e=>E(e.target.value),placeholder:c(`source.namePlaceholder`),value:T})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:c(`source.statusUrl`)}),(0,B.jsx)(`input`,{onChange:e=>ee(e.target.value),placeholder:`http://127.0.0.1:8876/status.json`,value:k})]}),(0,B.jsx)(`p`,{children:(0,B.jsx)(`code`,{children:`ssh -N -L 8876:127.0.0.1:8766 `})}),(0,B.jsx)(`p`,{children:c(`source.manualDescription`)}),(0,B.jsx)(`button`,{className:`personal-status-source-add`,onClick:P,type:`button`,children:c(`source.addConfigured`)})]}),d?(0,B.jsx)(`p`,{className:`is-error`,role:`alert`,children:d}):null]}):null]})}var nx={需修复:`is-danger`,等你:`is-warning`,等待条件:`is-info`,推进中:`is-success`,安静运行:`is-quiet`,已完成:`is-quiet`,已停止:`is-stopped`};function rx({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,z.useState)(!1),g=Wb(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,B.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,B.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,B.jsx)(`span`,{className:`personal-goal-state-dot ${e.loadState?``:nx[e.state]}`}),(0,B.jsxs)(`span`,{className:`personal-goal-link-copy`,children:[(0,B.jsx)(`strong`,{children:e.title}),(0,B.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,B.jsx)(cm,{size:15})]}),!t&&m?(0,B.jsxs)(`div`,{className:`personal-goal-move-actions`,children:[(0,B.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,B.jsx)(em,{"aria-hidden":`true`,size:13})}),(0,B.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,B.jsx)(Xp,{"aria-hidden":`true`,size:13})})]}):null,c&&y(t?`resume`:`stop`)?(0,B.jsxs)(B.Fragment,{children:[(0,B.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,B.jsx)(Am,{size:13}):t?(0,B.jsx)(Wm,{size:13}):(0,B.jsx)(zm,{size:13})}),t&&y(`delete`)?(0,B.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,B.jsx)(rh,{size:13})}):null]}):null]},e.goalId);return(0,B.jsxs)(`div`,{className:`personal-goal-directory`,children:[(0,B.jsxs)(`div`,{className:`personal-sidebar-brand`,children:[(0,B.jsx)(`span`,{className:`personal-brand-mark`,children:(0,B.jsx)(rm,{size:18})}),(0,B.jsx)(`span`,{children:(0,B.jsx)(`strong`,{children:`LoopX`})})]}),d?(0,B.jsx)(tx,{...d}):null,(0,B.jsxs)(`nav`,{"aria-label":p(`home.workspace`),className:`personal-sidebar-nav`,children:[(0,B.jsxs)(`button`,{"aria-current":u===null?`page`:void 0,className:`personal-manager-link`,onClick:()=>l(null),type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-manager-icon`,children:(0,B.jsx)(rm,{size:17})}),(0,B.jsx)(`span`,{children:p(`sidebar.manager`)}),e>0?(0,B.jsx)(`span`,{className:`personal-sidebar-count`,children:e}):null,(0,B.jsx)(cm,{size:15})]}),(0,B.jsxs)(`div`,{className:`personal-sidebar-section-title`,children:[(0,B.jsx)(`span`,{children:`Goals`}),(0,B.jsxs)(`span`,{className:`personal-sidebar-title-actions`,children:[(0,B.jsx)(`small`,{children:_.length}),(0,B.jsx)(`button`,{"aria-label":p(`sidebar.sortGoals`),title:p(`sidebar.sortGoals`),"aria-pressed":m,onClick:()=>h(!m),type:`button`,children:(0,B.jsx)($p,{"aria-hidden":`true`,size:15})}),a?(0,B.jsx)(`button`,{"aria-label":p(`sidebar.createGoal`),onClick:a,type:`button`,children:(0,B.jsx)(Vm,{size:15})}):null]})]}),g.saveFailed?(0,B.jsx)(`p`,{role:`status`,children:p(`sidebar.orderNotSaved`)}):null,(0,B.jsx)(`span`,{className:`personal-sr-only`,role:`status`,children:g.lastMoved?p(`sidebar.goalMoved`,{goal:g.lastMoved.title,position:g.lastMoved.position}):``}),(0,B.jsx)(`div`,{className:`personal-goal-list`,children:_.map(e=>b(e,!1))}),v.length||n.phase===`loading`||n.phase===`error`?(0,B.jsxs)(`details`,{className:`personal-stopped-goals`,open:n.phase===`error`||void 0,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(sm,{size:13}),(0,B.jsx)(`span`,{children:p(`sidebar.stopped`)}),n.phase===`loading`?(0,B.jsx)(Am,{"aria-label":p(`sidebar.stoppedLoading`),className:`is-spinning`,size:13}):(0,B.jsx)(`small`,{children:v.length})]}),(0,B.jsxs)(`div`,{className:`personal-goal-list is-stopped`,children:[n.phase===`error`?(0,B.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`alert`,children:[(0,B.jsx)(`span`,{children:p(`sidebar.stoppedLoadFailed`)}),s?(0,B.jsx)(`button`,{onClick:s,type:`button`,children:p(`sidebar.retryStopped`)}):null]}):null,v.map(e=>b(e,!0))]})]}):null]}),(0,B.jsxs)(`div`,{className:`personal-sidebar-footer`,children:[(0,B.jsx)(zb,{}),o?(0,B.jsxs)(`button`,{"aria-label":p(`settings.open`),className:`personal-sidebar-utility`,onClick:o,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-sidebar-utility-icon`,children:(0,B.jsx)(Xm,{size:17})}),(0,B.jsx)(`span`,{className:`personal-sidebar-utility-copy`,children:(0,B.jsx)(`strong`,{children:p(`settings.open`)})}),(0,B.jsx)(cm,{"aria-hidden":`true`,size:15})]}):null]})]})}var ix=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,z.useId)(),[c,l]=(0,z.useState)(!1),u=!i||c,d=i?96:148,[f,p]=(0,z.useState)(n),[m,h]=(0,z.useState)(t===`all`?e.doneTodoCount??n.length:n.length),[g,_]=(0,z.useState)(void 0),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(!1),[S,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)({top:0,height:600}),[E,D]=(0,z.useState)(null),O=(0,z.useRef)(null),k=(0,z.useRef)(null),[ee,te]=(0,z.useState)(0);(0,z.useEffect)(()=>{let e=O.current;if(!e)return;let t=new ResizeObserver(()=>T({top:e.scrollTop,height:e.clientHeight}));return t.observe(e),()=>{t.disconnect(),k.current?.abort()}},[]);let A=g===void 0||w.top+w.height>=f.length*d-d*2;(0,z.useEffect)(()=>{if(!r||!u||!A||g===null||b||k.current)return;let n=new AbortController;k.current=n,y(!0);let i=new URLSearchParams({goal_id:e.goalId});t!==`all`&&i.set(`agent_id`,t),g&&i.set(`cursor`,g),fetch(`/api/chat/completed-todos?${i}`,{signal:n.signal}).then(async e=>{if(e.status===409&&C(!0),!e.ok)throw Error(`history unavailable`);let t=ix.parse(await e.json());if(n.signal.aborted)return;let r=t.items.map(e=>({todoId:e.todo_id,text:e.text,claimedBy:e.claimed_by,evidence:e.evidence,priority:e.priority,taskClass:e.task_class,done:!0,status:`done`}));p(e=>g===void 0?r:[...e,...r.filter(t=>!e.some(e=>e.todoId===t.todoId))]),h(t.total),_(t.next_cursor)}).catch(()=>{n.signal.aborted||x(!0)}).finally(()=>{n.signal.aborted||(k.current=null,y(!1))})},[r,u,A,g,b,ee,e.goalId,t,v]),(0,z.useEffect)(()=>{O.current&&(O.current.scrollTop=0),T({top:0,height:O.current?.clientHeight??600}),D(null)},[i]);let j=Math.max(0,Math.floor(w.top/d)-3),M=Math.min(f.length,Math.ceil((w.top+w.height)/d)+3),ne=Array.from({length:Math.max(0,M-j)},(e,t)=>j+t);return E!==null&&El(e=>!e),children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:c?`▾`:`▸`}),` `,o(`tasks.completed`)]}):(0,B.jsxs)(`strong`,{children:[(0,B.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-done`}),o(`tasks.completed`)]}),(0,B.jsx)(`span`,{children:m})]}),(0,B.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,B.jsx)(`div`,{className:`personal-completed-window`,style:{height:f.length*d},children:ne.map(t=>{let n=f[t];return(0,B.jsx)(`div`,{className:`personal-task-card personal-completed-row`,style:{top:t*d,height:d},children:(0,B.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,B.jsx)(`span`,{className:`is-done`,children:`✓`}),(0,B.jsx)(`strong`,{children:n.text}),(0,B.jsx)(`small`,{children:n.claimedBy??e.agentLabel??e.agentId})]})},n.todoId)})}),(0,B.jsx)(`div`,{className:`personal-completed-footer`,role:`status`,children:v?o(`tasks.historyLoading`):b?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:o(S?`tasks.historyExpired`:`tasks.historyError`)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{S&&(_(void 0),O.current&&(O.current.scrollTop=0)),C(!1),x(!1),te(e=>e+1)},children:o(`tasks.historyRetry`)})]}):r?g===null?o(`tasks.historyEnd`):(0,B.jsx)(`button`,{type:`button`,onClick:()=>{O.current&&(O.current.scrollTop=f.length*d)},children:o(`tasks.historyMore`)}):o(`tasks.historyLocalOnly`)})]})]})}function ox({children:e,count:t,label:n,tone:r,listView:i=!1}){let a=(0,z.useId)(),o=(0,z.useRef)(null),s=(0,z.useRef)([]),c=(0,z.useRef)(null),[l,u]=(0,z.useState)({after:!1,before:!1}),d=(0,z.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,z.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,z.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,B.jsxs)(`details`,{className:`personal-task-group tone-${r}`,open:!0,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(sm,{size:16}),(0,B.jsx)(`strong`,{children:n}),(0,B.jsx)(`span`,{children:t})]}),(0,B.jsx)(`div`,{className:`personal-task-list-rows`,children:e})]}):(0,B.jsxs)(`section`,{className:`personal-object-list personal-task-lane`,children:[(0,B.jsxs)(`header`,{id:a,children:[(0,B.jsxs)(`strong`,{children:[(0,B.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-${r}`}),n]}),(0,B.jsx)(`span`,{children:t})]}),(0,B.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 sx({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,z.useState)(!1),[p,m]=(0,z.useState)({goalId:``,laneId:`all`}),h=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!c)return;let e=window.requestAnimationFrame(()=>h.current?.scrollIntoView({block:`nearest`,inline:`nearest`}));return()=>window.cancelAnimationFrame(e)},[c]);let g=l.filter(e=>e.goalId===t.goalId).map(e=>({...e,goalTitle:t.title})),_=e=>e.priority===`P0`?0:e.priority===`P1`?1:e.priority===`P2`?2:3,v=(0,z.useMemo)(()=>{let e=new Map((t.agentLanes??[]).map(e=>[e.agentId,e]));for(let n of t.agentTodos)n.claimedBy&&!e.has(n.claimedBy)&&e.set(n.claimedBy,{agentId:n.claimedBy,label:n.claimedBy});return[...e.values()]},[t.agentLanes,t.agentTodos]),y=p.goalId===t.goalId&&v.some(e=>e.agentId===p.laneId)?p.laneId:`all`,b=e=>y===`all`||e===y,x=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&!e.done).filter(e=>b(e.claimedBy)).sort((e,t)=>_(e)-_(t)),S=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&e.done).filter(e=>b(e.claimedBy)),C=n.filter(e=>e.kind===`schedule`&&b(e.schedule.agentId)),w=n.filter(e=>e.kind===`run`&&!!e.run.todoId&&b(e.run.agentId)),T=!g.length&&!x.length&&!S.length&&!C.length,E=n.filter(e=>e.kind===`message`&&(e.message.role===`user`||e.message.role===`assistant`)),D=E.reduce((e,t,n)=>t.message.role===`user`?n:e,-1),O=D>=0?E[D]?.message:null,k=D>=0?E.slice(D+1).reverse().find(e=>e.message.role===`assistant`)?.message:null,ee=D>=0&&E.slice(D+1).some(e=>e.message.role===`assistant`&&e.message.pending);return(0,B.jsxs)(`section`,{"aria-label":u(`header.tasks`),className:`personal-task-board${d?` is-list-view`:``}`,children:[(0,B.jsxs)(`header`,{className:`personal-task-view-toolbar`,children:[(0,B.jsx)(`div`,{children:(0,B.jsx)(`strong`,{children:u(`header.tasks`)})}),(0,B.jsxs)(`div`,{className:`personal-task-view-switch`,role:`group`,"aria-label":u(`tasks.viewLabel`),children:[(0,B.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(!0),children:u(`tasks.listView`)}),(0,B.jsx)(`button`,{type:`button`,"aria-pressed":!d,onClick:()=>f(!1),children:u(`tasks.boardView`)})]})]}),v.length>1?(0,B.jsxs)(`section`,{"aria-label":u(`tasks.agentLaneFilter`),className:`personal-task-lane-filter`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(rm,{size:15}),(0,B.jsx)(`span`,{children:(0,B.jsx)(`strong`,{children:u(`tasks.agentLane`)})})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{className:`sr-only`,children:u(`tasks.agentLaneFilter`)}),(0,B.jsxs)(`select`,{"aria-label":u(`tasks.agentLaneFilter`),onChange:e=>m({goalId:t.goalId,laneId:e.target.value}),value:y,children:[(0,B.jsx)(`option`,{value:`all`,children:u(`tasks.allAgentLanes`,{count:v.length})}),v.map(e=>(0,B.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))]}),(0,B.jsx)(sm,{"aria-hidden":!0,size:14})]})]}):null,O?(0,B.jsxs)(`section`,{"aria-label":u(`tasks.chatRecent`),className:`personal-task-chat-receipt`,children:[(0,B.jsx)(`span`,{className:`personal-task-chat-icon`,children:(0,B.jsx)(Pm,{size:18})}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:u(ee?`tasks.chatPending`:k?`tasks.chatAgentReplied`:`tasks.chatRecent`)}),(0,B.jsx)(`small`,{children:t.agentLabel??t.agentId})]}),(0,B.jsxs)(`p`,{className:`is-user`,children:[(0,B.jsx)(`b`,{children:u(`common.you`)}),O.text]}),k&&!k.pending?(0,B.jsxs)(`p`,{className:`is-assistant`,children:[(0,B.jsx)(`b`,{children:u(`common.agent`)}),k.text]}):null,(0,B.jsx)(`small`,{children:u(ee?`tasks.chatPendingDescription`:`tasks.chatUnchangedDescription`)})]}),(0,B.jsxs)(`footer`,{children:[(0,B.jsxs)(`button`,{onClick:i,type:`button`,children:[(0,B.jsx)(Pm,{size:14}),u(`tasks.chatViewReply`)]}),k&&!ee&&r?(0,B.jsxs)(`button`,{onClick:()=>r(k.text),type:`button`,children:[(0,B.jsx)(km,{size:14}),u(`tasks.convertToTask`)]}):null]})]}):null,(0,B.jsxs)(`div`,{className:d?`personal-task-grouped-list`:`personal-task-kanban`,children:[(0,B.jsxs)(ox,{listView:d,count:g.length,label:u(`timeline.waitingConfirmation`),tone:`attention`,children:[g.map(e=>{let t=Zi(e.updatedAt,u);return(0,B.jsxs)(`button`,{onClick:()=>s({item:e,kind:`attention`}),type:`button`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`is-attention`,children:`!`}),(0,B.jsx)(`strong`,{children:e.text}),(0,B.jsxs)(`small`,{children:[(0,B.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?u(`tasks.blocked`):u(`tasks.pending`)}),t?(0,B.jsx)(`span`,{className:`personal-task-age`,children:u(`tasks.waitingAge`,{age:t})}):null]})]},e.todoId)}),g.length?null:(0,B.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyConfirm`)})]}),(0,B.jsxs)(ox,{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,B.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,B.jsxs)(`button`,{"aria-pressed":c===e.todoId,onClick:()=>s({item:n,kind:`todo`}),type:`button`,children:[(0,B.jsx)(`span`,{children:`○`}),(0,B.jsx)(`strong`,{children:e.text}),(0,B.jsxs)(`small`,{children:[e.priority?(0,B.jsx)(`span`,{className:`personal-priority-badge is-${e.priority.toLowerCase()}`,children:e.priority}):null,e.status===`blocked`?(0,B.jsx)(`span`,{className:`personal-priority-badge is-blocked`,children:u(`tasks.blocked`)}):null,r?(0,B.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,B.jsx)(`span`,{className:`personal-task-session-status`,children:u(`drawer.taskStatusDeferred`)}):r?null:(0,B.jsx)(`span`,{className:`personal-task-session-status`,children:u(`tasks.waiting`)}),e.claimedBy??t.agentLabel??t.agentId]})]}),(0,B.jsxs)(`div`,{className:`personal-task-card-actions`,children:[r?(0,B.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,B.jsx)(vm,{size:14}),(0,B.jsx)(`span`,{children:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`)})]}):null,a?(0,B.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,B.jsx)(Am,{className:`personal-spin`,size:14}):(0,B.jsx)(om,{size:14})}):null,(0,B.jsx)(`button`,{"aria-label":u(`tasks.moreActions`,{name:e.text}),onClick:()=>s({item:n,kind:`todo`}),title:u(`common.actions`),type:`button`,children:(0,B.jsx)(_m,{size:14})})]})]},e.todoId)}),x.length?null:(0,B.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyRunning`)})]}),(0,B.jsxs)(ox,{listView:d,count:C.length,label:u(`tasks.scheduled`),tone:`schedule`,children:[C.map(e=>(0,B.jsxs)(`button`,{onClick:()=>s({item:e.schedule,kind:`schedule`}),type:`button`,children:[(0,B.jsx)(`span`,{children:`◷`}),(0,B.jsx)(`strong`,{children:e.schedule.label}),(0,B.jsx)(`small`,{children:e.schedule.status===`paused`?u(`schedule.paused`):u(`schedule.active`)})]},e.id)),C.length?null:(0,B.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptySchedules`)})]}),(0,B.jsx)(ax,{goal:t,agentId:y,seed:S,enabled:e,listView:d,onSelect:s},`${t.goalId}:${y}:${e}`)]}),T?(0,B.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyGoal`)}):null]})}var cx=yd(W(),q(W())),lx=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:cx,owner_agent:W().optional(),actor_agent:W().optional(),from_agent:W().optional(),to_agent:W().optional()}),ux=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:cx.optional()}),dx=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(lx),edges:q(ux)}).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`})}),fx=J({ok:X(!0),goal_id:W(),observed_at:W().datetime({offset:!0}),graph:dx.nullable(),acceptance:ef.nullable()});function px(e,t){let n=fx.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 mx(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 px(await r.json(),e)}function hx(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 gx(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 _x(e){return[`gate`,`gate_summary`,`lease`].includes(e.kind)?0:e.kind===`deliverable`?1:2}function vx(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{gx(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(` `)+` -`}var 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":{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 _x({graph:e,nodes:t,selected:n,onSelect:r,copy:i}){let a=(0,z.useId)().replace(/:/g,``),o=[0,1,2].map(e=>t.filter(t=>mx(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,B.jsx)(`div`,{className:`delivery-map-scroll`,role:`region`,"aria-label":i.map,tabIndex:0,children:(0,B.jsxs)(`div`,{className:`delivery-map`,style:{height:c},children:[[i.conditions,i.work,i.context].map((e,t)=>(0,B.jsx)(`strong`,{className:`delivery-map-heading`,style:{left:t*320+12},children:e},e)),(0,B.jsxs)(`svg`,{"aria-hidden":`true`,width:`960`,height:c,children:[(0,B.jsx)(`defs`,{children:(0,B.jsx)(`marker`,{id:a,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto-start-reverse`,children:(0,B.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,B.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,B.jsxs)(`span`,{children:[i.kind[e.kind],(0,B.jsx)(`em`,{"data-state":e.state,children:i.state[e.state]})]}),(0,B.jsx)(`strong`,{title:e.title,children:e.title}),(0,B.jsx)(`small`,{children:e.owner_agent??i.unavailable})]},e.node_id)})]})})}function vx({goal:e,items:t,userTodos:n,onSelect:r,active:i}){let{locale:a}=Ji(),o=gx[a],[s,c]=(0,z.useState)({kind:`loading`}),[l,u]=(0,z.useState)(0),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(`all`),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(()=>window.matchMedia(`(min-width: 1024px)`).matches),[y,b]=(0,z.useState)(``),x=(0,z.useRef)(null),S=n.filter(t=>t.goalId===e.goalId),C=JSON.stringify([e.agentTodos,e.acceptanceObservation,S]),w=(0,z.useRef)(C);w.current=C,(0,z.useEffect)(()=>{if(!i)return;let t=new AbortController,n=w.current;return c(e=>({...e,kind:`loading`})),b(``),dx(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),ee=p===`related`&&!k?`all`:p,te=(0,z.useMemo)(()=>O?fx(O,d,ee,h):[],[O,d,ee,h]),A=O?.edges.filter(e=>e.from_node_id===h||e.to_node_id===h)??[],j=new Map(O?.nodes.map(e=>[e.node_id,e])),M=()=>{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([hx(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,B.jsxs)(`section`,{className:`delivery-review`,"aria-label":o.title,children:[(0,B.jsxs)(`header`,{className:`delivery-review-toolbar`,children:[(0,B.jsx)(`h2`,{children:o.title}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{type:`button`,disabled:s.kind===`loading`,onClick:()=>u(e=>e+1),children:[(0,B.jsx)(Hm,{size:15}),o.refresh]}),(0,B.jsxs)(`button`,{type:`button`,disabled:!D,onClick:re,children:[(0,B.jsx)(hm,{size:15}),o.export]})]})]}),y?(0,B.jsx)(`p`,{role:`status`,children:y}):null,T?(0,B.jsxs)(B.Fragment,{children:[s.kind===`ready`?null:(0,B.jsx)(`p`,{role:s.kind===`error`?`alert`:`status`,className:`delivery-notice`,children:s.kind===`error`?o.refreshError:o.loading}),(0,B.jsxs)(`p`,{className:`delivery-snapshot-time`,children:[o.observed,` · `,(0,B.jsx)(`time`,{dateTime:T.observed_at,children:new Date(T.observed_at).toLocaleString(a)})]}),E?(0,B.jsx)(`p`,{role:`alert`,className:`delivery-notice`,children:o.changed}):null,(0,B.jsxs)(`p`,{className:`delivery-boundary`,children:[o.scope,` `,o.acceptanceBoundary]}),O?(0,B.jsxs)(B.Fragment,{children:[px(O)?(0,B.jsxs)(`details`,{className:`delivery-notice`,children:[(0,B.jsx)(`summary`,{children:o.incomplete}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:o.omittedGates}),(0,B.jsx)(`dd`,{children:O.limits.user_gate_truncated_count})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:o.missing}),(0,B.jsx)(`dd`,{children:O.limits.missing_predecessor_count??o.unavailable})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:o.clipped}),(0,B.jsx)(`dd`,{children:O.limits.predecessor_truncated===void 0?o.unavailable:O.limits.predecessor_truncated?o.yes:o.no})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:o.sourceClipped}),(0,B.jsx)(`dd`,{children:O.limits.source_truncated===void 0?o.unavailable:O.limits.source_truncated?o.yes:o.no})]})]})]}):null,(0,B.jsxs)(`section`,{className:`delivery-chain`,"aria-label":o.chain,children:[(0,B.jsxs)(`header`,{className:`delivery-chain-toolbar`,children:[(0,B.jsx)(`h3`,{children:o.chain}),(0,B.jsxs)(`span`,{children:[o.visible,` `,te.length,`/`,O.nodes.length]}),(0,B.jsxs)(`div`,{role:`group`,"aria-label":o.view,children:[(0,B.jsx)(`button`,{type:`button`,"aria-pressed":_,onClick:()=>v(!0),children:o.map}),(0,B.jsx)(`button`,{type:`button`,"aria-pressed":!_,onClick:()=>v(!1),children:o.list})]})]}),(0,B.jsxs)(`div`,{className:`delivery-filters`,children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(Gm,{size:16}),(0,B.jsx)(`input`,{"aria-label":o.search,placeholder:o.search,value:d,onChange:e=>f(e.target.value)})]}),(0,B.jsxs)(`select`,{"aria-label":o.filter,value:ee,onChange:e=>m(e.target.value),children:[(0,B.jsx)(`option`,{value:`all`,children:o.all}),(0,B.jsx)(`option`,{value:`conditions`,children:o.conditions}),(0,B.jsx)(`option`,{value:`evidence`,children:o.evidence}),(0,B.jsx)(`option`,{value:`related`,disabled:!k,children:o.related})]}),(0,B.jsx)(`button`,{type:`button`,onClick:M,children:o.reset})]}),te.length?_?(0,B.jsx)(_x,{graph:O,nodes:te,selected:h,onSelect:ne,copy:o}):(0,B.jsx)(`ul`,{className:`delivery-node-list`,children:te.map(e=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":h===e.node_id,onClick:()=>ne(e.node_id),children:[(0,B.jsx)(`span`,{children:o.kind[e.kind]}),(0,B.jsx)(`strong`,{children:e.title}),(0,B.jsx)(`small`,{children:e.owner_agent??o.unavailable}),(0,B.jsx)(`em`,{"data-state":e.state,children:o.state[e.state]})]})},e.node_id))}):(0,B.jsx)(`p`,{className:`delivery-empty`,role:`status`,children:o.empty})]}),(0,B.jsx)(`section`,{className:`delivery-node-detail`,"aria-label":o.details,ref:x,children:k?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[o.kind[k.kind],` · `,o.state[k.state]]}),(0,B.jsx)(`h3`,{children:k.title}),k.owner_agent?(0,B.jsx)(`p`,{children:k.owner_agent}):null]}),k.from_agent||k.to_agent?(0,B.jsxs)(`p`,{children:[k.from_agent??o.unavailable,` → `,k.to_agent??o.unavailable]}):null,(0,B.jsx)(`div`,{className:`delivery-source-actions`,children:P.length?P.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,disabled:!D,onClick:()=>r(e),children:[(0,B.jsx)(_m,{size:15}),e.kind===`todo`?o.openTask:e.kind===`attention`?o.openGate:o.openRun]},`${e.kind}:${t}`)):(0,B.jsx)(`p`,{children:o.sourceUnavailable})}),(0,B.jsx)(`h4`,{children:o.relations}),A.length?(0,B.jsx)(`ul`,{className:`delivery-relations`,children:A.map(e=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>ne(e.from_node_id),children:j.get(e.from_node_id).title}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(Zp,{size:13}),o.relation[e.relation],(0,B.jsx)(Zp,{size:13})]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>ne(e.to_node_id),children:j.get(e.to_node_id).title})]}),(0,B.jsx)(`p`,{children:e.reason})]},e.edge_id))}):(0,B.jsx)(`p`,{children:o.noRelations}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:o.refs}),(0,B.jsx)(`code`,{children:k.node_id}),Object.entries(k.refs).map(([e,t])=>(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`strong`,{children:e}),` `,t.join(`, `)]},e))]})]}):(0,B.jsx)(`p`,{children:o.select})})]}):(0,B.jsx)(`p`,{className:`delivery-notice`,children:o.noGraph})]}):(0,B.jsx)(`p`,{role:s.kind===`error`?`alert`:`status`,className:`delivery-notice`,children:s.kind===`error`?o.error:o.loading}),(0,B.jsx)(hb,{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:`查看任务`,outputs:`查看成果`,usage:`最近 24 小时`,execution:`执行记录`,remote:`此来源仅提供同步的状态与验收观察,交付链需要实时本机来源。`}:{progress:`Current progress`,attention:`Needs you`,none:`No pending decisions are loaded.`,details:`Goal information`,tasks:`View tasks`,outputs:`View outputs`,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,B.jsxs)(`section`,{className:`goal-overview`,"aria-label":c(`header.overview`),children:[(0,B.jsxs)(`header`,{className:`goal-overview-heading`,children:[(0,B.jsx)(`h2`,{children:c(`header.overview`)}),(0,B.jsxs)(`button`,{onClick:a,type:`button`,children:[(0,B.jsx)(wm,{size:15}),u.details]})]}),(0,B.jsxs)(`div`,{className:`goal-overview-summary`,children:[(0,B.jsxs)(`section`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`h3`,{children:u.progress}),(0,B.jsx)(`span`,{children:Yi(t.state,l)})]}),(0,B.jsx)(`strong`,{children:t.nextSentence}),(0,B.jsx)(`p`,{children:t.agentSentence}),(0,B.jsxs)(`div`,{className:`goal-overview-links`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>s(`tasks`),children:[u.tasks,(0,B.jsx)(Zp,{size:14})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>s(`files`),children:[u.outputs,(0,B.jsx)(Zp,{size:14})]})]}),f?(0,B.jsxs)(`button`,{className:`goal-overview-run`,type:`button`,onClick:()=>o({kind:`run`,item:f.run}),children:[(0,B.jsxs)(`small`,{children:[u.execution,` · `,f.run.agentLabel]}),(0,B.jsx)(`strong`,{children:f.run.title}),(0,B.jsx)(Zp,{size:15})]}):null]}),(0,B.jsxs)(`section`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`h3`,{children:u.attention}),(0,B.jsx)(`span`,{children:d.length})]}),d.length?(0,B.jsx)(`ul`,{children:d.slice(0,3).map(e=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>o({kind:`attention`,item:e}),children:[(0,B.jsx)(`span`,{children:e.text}),(0,B.jsx)(Zp,{size:15})]})},e.todoId))}):(0,B.jsx)(`p`,{children:u.none}),d.length>3?(0,B.jsxs)(`button`,{type:`button`,onClick:()=>s(`tasks`),children:[u.tasks,` (`,d.length,`)`,(0,B.jsx)(Zp,{size:14})]}):null]})]}),(0,B.jsxs)(`dl`,{className:`goal-overview-usage`,"aria-label":u.usage,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`dt`,{children:[c(`drawer.tokensShort`),` · `,u.usage]}),(0,B.jsx)(`dd`,{children:Zy(t.usage?.tokens24h,c(`drawer.usageNotMeasured`),Jy)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`dt`,{children:[c(`drawer.costShort`),` · `,u.usage]}),(0,B.jsx)(`dd`,{children:Zy(t.usage?.costUsd24h,c(`drawer.usageNotMeasured`),Yy)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`dt`,{children:[c(`drawer.durationShort`),` · `,u.usage]}),(0,B.jsx)(`dd`,{children:Zy(t.usage?.durationMs24h,c(`drawer.usageNotMeasured`),Xy)})]})]}),i?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`goal-overview-source-note`,children:u.remote}),(0,B.jsx)(hb,{goal:t})]}):(0,B.jsx)(vx,{active:e,goal:t,items:n,userTodos:r,onSelect:o})]})}function bx({activeTab:e,panels:t,scrollRef:n}){let[r,i]=(0,z.useState)(()=>new Set([e])),a=(0,z.useRef)({});return(0,z.useEffect)(()=>i(t=>t.has(e)?t:new Set([...t,e])),[e]),(0,z.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,B.jsx)(`div`,{className:`personal-goal-view-panel`,"data-goal-panel":n,hidden:n!==e,children:t[n]},n):null)}function xx(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 Sx(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 Cx(e){return e.history_permission_guidance?.api_document_url??null}function wx(e,t,n){if(e instanceof Fh){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 Tx({embedded:e=!1,focusGoalConnection:t=!1,goals:n,initialGoalId:r,onChanged:i,onClose:a}){let{t:o}=Ji(),[s,c]=(0,z.useState)(`connections`),[l,u]=(0,z.useState)([]),[d,f]=(0,z.useState)([]),[p,m]=(0,z.useState)(!0),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(``),[y,b]=(0,z.useState)(t),[x,S]=(0,z.useState)(``),[C,w]=(0,z.useState)(r??n[0]?.goalId??``),[T,E]=(0,z.useState)(``),[D,O]=(0,z.useState)([]),[k,ee]=(0,z.useState)(``),[te,A]=(0,z.useState)(!1),[j,M]=(0,z.useState)(null),[ne,N]=(0,z.useState)(`addressed_only`),[P,re]=(0,z.useState)(t&&r?`goal`:`manager`),[ie,ae]=(0,z.useState)(`async_inbox`),[F,oe]=(0,z.useState)(`topic_reply`),[I,se]=(0,z.useState)(``),[L,ce]=(0,z.useState)(!1),[le,ue]=(0,z.useState)({}),[de,fe]=(0,z.useState)(!1),[pe,me]=(0,z.useState)(null),[he,ge]=(0,z.useState)(null),[_e,ve]=(0,z.useState)(null),[ye,be]=(0,z.useState)(null),[xe,Se]=(0,z.useState)(!1),[Ce,we]=(0,z.useState)(`loopx-workspace-bot`),[Te,Ee]=(0,z.useState)(`feishu`),[De,Oe]=(0,z.useState)(null),[ke,Ae]=(0,z.useState)(!1),[je,R]=(0,z.useState)(null),Me=(0,z.useRef)(null),Ne=(0,z.useRef)(null),Pe=(0,z.useRef)(!1);async function Fe(){m(!0),g(null);try{let[e,t]=await Promise.all([Qg(),s_()]);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(wx(e,o(`lark.error.configuration`),o))}finally{m(!1)}}(0,z.useEffect)(()=>{Fe()},[]),(0,z.useEffect)(()=>{if(!t||p||Pe.current||!r)return;Pe.current=!0;let e=d.find(e=>e.goal_id===r);e?Je(e):qe(n.find(e=>e.goalId===r))},[d,t,n,r,p]),(0,z.useEffect)(()=>{if(!y||!x||_e){O([]),ee(``),A(!1),M(null);return}let e=!1;A(!0),M(null);let t=window.setTimeout(()=>{a_(x,T).then(t=>{e||(O(t),ee(e=>t.some(t=>t.chat_id===e)?e:t[0]?.chat_id??``))}).catch(t=>{e||(O([]),ee(``),M(wx(t,o(`lark.error.groupLoad`),o)))}).finally(()=>{e||A(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[x,T,y,_e]),(0,z.useEffect)(()=>{if(!xe||!De||[`ready`,`failed`,`cancelled`].includes(De.status))return;let e=!1,t=window.setTimeout(()=>{t_(De.setup_id).then(async t=>{e||(Oe(t),t.verification_url&&Ne.current!==t.verification_url&&(Ne.current=t.verification_url,Me.current&&!Me.current.closed&&(Me.current.location.href=t.verification_url)),t.status===`ready`&&(await Fe(),S(t.app_ref),ue({}),Se(!1)),t.status===`failed`&&R(t.error??o(`lark.error.appCreate`)))}).catch(t=>{e||R(wx(t,o(`lark.error.setupPoll`),o))})},650);return()=>{e=!0,window.clearTimeout(t)}},[xe,De]);let Ie=n.find(e=>e.goalId===C),Le=Ie?.agentId?[{agentId:Ie.agentId,label:Ie.agentLabel??Ie.agentId}]:[],Re=Ie?.agentLanes?.length?Ie.agentLanes:Le,ze=Re.some(e=>e.agentId===I),Be=[];L?Be=Re.map(e=>({agentId:e.agentId,appRef:le[e.agentId]??x})):ze&&(Be=[{agentId:I,appRef:x}]);let V=Be.map(e=>e.agentId),Ve=!!_e||Be.length>0&&Be.every(e=>l.some(t=>t.app_ref===e.appRef&&t.reply_ready)),He=o(`lark.connect`);he?He=o(`lark.saveConnection`):L&&(He=o(`lark.connectAllAgentsAction`,{count:V.length}));let Ue=l.find(e=>e.app_ref===x),We=D.find(e=>e.chat_id===k),Ge=(0,z.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,_]),Ke=(0,z.useMemo)(()=>d.filter(e=>Sx(e,o).state===`unverified`).length,[d,o]);function qe(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??``),ee(``),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),R(null),Ne.current=null,Se(!0)}async function Xe(){if(!(ke||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(Ce))){Ae(!0),R(null),Ne.current=null,Me.current=window.open(window.location.href,`_blank`);try{let e=await e_({appRef:Ce,brand:Te});Oe(e)}catch(e){Me.current?.close(),R(wx(e,o(`lark.error.setupStart`),o))}finally{Ae(!1)}}}async function Ze(){let e=De;if(Se(!1),Me.current?.close(),e&&![`ready`,`failed`,`cancelled`].includes(e.status))try{await n_(e.setup_id)}catch{}}async function Qe(){if(!(!x||!C||!_e&&!We||P===`goal`&&V.length===0||de)){fe(!0),me(null);try{let e={...P===`manager`?{..._e?{connectionId:_e.connection_id}:{appRef:x,chatId:We.chat_id,chatName:We.chat_name}}:_e?{connectionId:_e.connection_id,agentId:I}:{agentBindings:Be,chatId:We.chat_id,chatName:We.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 c_({...e,execute:!1});if(!t.ok)throw new Fh(t.public_summary??t.blocker??o(`lark.error.bindPreview`),{error_code:t.blocker??`provider_api_failed`});let n=await c_({...e,execute:!0});if(!n.ok)throw new Fh(n.public_summary??n.blocker??o(`lark.error.bind`),{error_code:n.blocker??`provider_api_failed`});b(!1),await Fe(),i?.()}catch(e){me(wx(e,o(`lark.error.bind`),o))}finally{fe(!1)}}}async function $e(e,t){if(ye!==t){be(t);return}try{await l_(e,t),be(null),await Fe(),i?.()}catch(e){g(wx(e,o(`lark.error.disconnect`),o))}}return(0,B.jsxs)(`section`,{className:`personal-lark-settings${e?` is-embedded`:``}`,"aria-label":o(`lark.configuration`),children:[e?null:(0,B.jsxs)(`header`,{className:`personal-lark-header`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:o(`settings.goalConnections`)}),(0,B.jsx)(`h1`,{children:`Lark`})]}),(0,B.jsx)(`button`,{"aria-label":o(`lark.closeSettings`),className:`personal-icon-button`,onClick:a,type:`button`,children:(0,B.jsx)(ah,{size:18})})]}),(0,B.jsxs)(`nav`,{className:`personal-lark-tabs`,"aria-label":o(`lark.management`),children:[(0,B.jsxs)(`button`,{"aria-current":s===`apps`?`page`:void 0,onClick:()=>c(`apps`),type:`button`,children:[o(`lark.apps`),` `,(0,B.jsx)(`span`,{children:p?`…`:l.length})]}),(0,B.jsxs)(`button`,{"aria-current":s===`connections`?`page`:void 0,onClick:()=>c(`connections`),type:`button`,children:[o(`lark.connections`),` `,(0,B.jsx)(`span`,{children:p?`…`:d.length})]})]}),h?(0,B.jsx)(`p`,{className:`personal-notification-error`,children:h}):null,p?(0,B.jsxs)(`div`,{className:`personal-lark-loading`,children:[(0,B.jsx)(km,{className:`is-spinning`,size:18}),o(`lark.loading`)]}):null,!p&&s===`apps`?(0,B.jsxs)(`div`,{className:`personal-lark-apps`,children:[(0,B.jsxs)(`div`,{className:`personal-lark-app-toolbar`,children:[(0,B.jsx)(`span`,{children:o(`lark.reusableApps`,{count:l.length})}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:Ye,type:`button`,children:[(0,B.jsx)(Bm,{size:16}),o(`lark.newApp`)]})]}),(0,B.jsxs)(`div`,{className:`personal-lark-app-grid`,children:[l.map(e=>(0,B.jsxs)(`article`,{className:`personal-lark-app-card`,children:[(0,B.jsx)(`span`,{className:`personal-lark-app-avatar`,children:(0,B.jsx)(nm,{size:19})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:e.label}),(0,B.jsxs)(`small`,{children:[e.brand,` · lark-cli profile`]})]}),(0,B.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,B.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,B.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noProfiles`)}):null]})]}):null,!p&&s===`connections`?(0,B.jsxs)(`div`,{className:`personal-lark-connections`,children:[Ke>0?(0,B.jsxs)(`p`,{className:`personal-lark-route-readiness`,role:`status`,children:[(0,B.jsx)(Nm,{size:15}),o(`lark.routesUnverified`,{count:Ke})]}):null,(0,B.jsxs)(`div`,{className:`personal-lark-toolbar`,children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(Gm,{size:16}),(0,B.jsx)(`input`,{"aria-label":o(`lark.searchConnections`),onChange:e=>v(e.target.value),placeholder:o(`lark.searchPlaceholder`),type:`search`,value:_})]}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,disabled:l.length===0||n.length===0,onClick:()=>qe(),type:`button`,children:[(0,B.jsx)(Bm,{size:16}),o(`lark.connectApp`)]})]}),(0,B.jsxs)(`div`,{className:`personal-lark-table`,role:`table`,"aria-label":o(`lark.goalTopicConnections`),children:[(0,B.jsxs)(`div`,{className:`personal-lark-table-head`,role:`row`,children:[(0,B.jsx)(`span`,{children:o(`lark.connection`)}),(0,B.jsx)(`span`,{children:o(`common.goal`)}),(0,B.jsx)(`span`,{children:o(`lark.capture`)}),(0,B.jsx)(`span`,{children:o(`lark.processing`)}),(0,B.jsx)(`span`,{children:o(`common.actions`)})]}),Ge.map(e=>{let t=Sx(e,o);return(0,B.jsxs)(`div`,{className:`personal-lark-table-row`,role:`row`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.chat_name}),(0,B.jsxs)(`small`,{children:[e.app_label,` · `,t.label]}),(0,B.jsx)(`small`,{children:t.detail}),t.state===`unverified`?(0,B.jsxs)(`a`,{href:`https://open.feishu.cn/document/server-docs/im-v1/message/events/receive?lang=zh-CN`,rel:`noreferrer`,target:`_blank`,children:[(0,B.jsx)(_m,{size:12}),o(`lark.openEventSettings`)]}):null,Cx(e)?(0,B.jsxs)(`a`,{href:Cx(e)??void 0,rel:`noreferrer`,target:`_blank`,children:[(0,B.jsx)(_m,{size:12}),o(`lark.historyPermission`)]}):null]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.goal_title}),(0,B.jsxs)(`small`,{children:[`# `,e.topic_name]})]}),(0,B.jsx)(`span`,{children:e.capture_scope===`addressed_only`?o(`lark.mentionsOnly`):o(`lark.allTopicMessages`)}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.conversation_kind===`manager`?o(`lark.managerConversation`):xx(e.ingress_mode,o).label}),(0,B.jsx)(`small`,{children:e.conversation_kind===`manager`?o(`lark.managerConversationDescription`):e.agent_id??xx(e.ingress_mode,o).detail})]}),(0,B.jsxs)(`span`,{className:`personal-lark-row-actions`,children:[(0,B.jsx)(`button`,{"aria-label":o(`lark.settingsConfigure`,{goal:e.goal_title}),onClick:()=>Je(e),type:`button`,children:(0,B.jsx)(Ym,{size:15})}),(0,B.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,B.jsx)(ih,{size:15}),ye===e.connection_id?o(`common.confirm`):null]})]})]},e.connection_id)}),Ge.length===0?(0,B.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noConnections`)}):null]})]}):null,y?(0,B.jsx)(`div`,{className:`personal-lark-modal-backdrop`,role:`presentation`,children:(0,B.jsxs)(`section`,{"aria-labelledby":`connect-lark-title`,"aria-modal":`true`,className:`personal-lark-modal`,role:`dialog`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:`Goal Topic connection`}),(0,B.jsx)(`h2`,{id:`connect-lark-title`,children:o(he?`lark.editConnection`:`lark.connectApp`)})]}),(0,B.jsx)(`button`,{"aria-label":o(`lark.closeConnection`),onClick:()=>b(!1),type:`button`,children:(0,B.jsx)(ah,{size:18})})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.conversationKind`)}),(0,B.jsxs)(`select`,{"aria-label":o(`lark.conversationKind`),disabled:!!_e,value:P,onChange:e=>re(e.target.value),children:[(0,B.jsx)(`option`,{value:`manager`,children:o(`lark.managerConversation`)}),(0,B.jsx)(`option`,{value:`goal`,children:o(`lark.workerConversation`)})]})]}),P===`manager`?(0,B.jsx)(`p`,{children:o(`lark.managerConversationDescription`)}):null,_e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,B.jsx)(`div`,{children:_e.app_label})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,B.jsx)(`div`,{children:_e.chat_name})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,B.jsx)(`div`,{children:_e.goal_title})]}),(0,B.jsx)(`small`,{children:o(`lark.editPreservesIdentity`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,B.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,B.jsx)(`option`,{value:``,children:o(`lark.appLoading`)}):(0,B.jsxs)(B.Fragment,{children:[l.map(e=>(0,B.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,B.jsx)(`option`,{value:`__register__`,children:o(`lark.registerAnother`)})]})}),(0,B.jsx)(`small`,{children:o(`lark.defaultAgentAppDescription`)})]}),Ue?.ready&&!Ue.reply_ready?(0,B.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.appPermissions`)}):null,(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,B.jsx)(`input`,{"aria-label":o(`lark.groupSearch`),onChange:e=>E(e.target.value),placeholder:o(`lark.groupSearch`),type:`search`,value:T}),te?(0,B.jsxs)(`div`,{className:`personal-lark-group-state`,role:`status`,children:[(0,B.jsx)(km,{className:`is-spinning`,size:15}),o(`lark.groupLoading`)]}):null,!te&&j?(0,B.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:j}):null,!te&&!j&&D.length===0?(0,B.jsx)(`div`,{className:`personal-lark-group-state`,role:`status`,children:o(`lark.groupEmpty`)}):null,!te&&!j&&D.length>0?(0,B.jsx)(`select`,{"aria-label":o(`lark.groupChat`),onChange:e=>ee(e.target.value),value:k,children:D.map(e=>(0,B.jsx)(`option`,{value:e.chat_id,children:e.chat_name},e.chat_id))}):null]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,B.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,B.jsx)(`option`,{value:e.goalId,children:e.title},e.goalId))})]})]}),(0,B.jsxs)(`label`,{className:`personal-lark-check`,children:[(0,B.jsx)(`input`,{checked:!0,readOnly:!0,type:`checkbox`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:o(`lark.createAutomatically`)}),(0,B.jsx)(`small`,{children:o(`lark.createAutomaticallyDescription`)})]})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.topicPreview`)}),(0,B.jsxs)(`div`,{className:`personal-lark-topic-preview`,children:[(0,B.jsx)(Nm,{size:15}),`# `,Ie?.title??Ie?.goalId??`Goal`]})]}),P===`goal`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.captureScope`)}),(0,B.jsxs)(`select`,{"aria-label":o(`lark.captureScope`),disabled:_e?.ingress_mode===`direct_session`,onChange:e=>N(e.target.value),value:ne,children:[(0,B.jsx)(`option`,{value:`addressed_only`,children:o(`lark.captureAddressed`)}),(0,B.jsx)(`option`,{value:`configured_chat_all`,children:o(`lark.captureAll`)})]}),(0,B.jsx)(`small`,{children:o(`lark.captureScopeDescription`)})]}),(0,B.jsxs)(`fieldset`,{"aria-label":o(`lark.agentIngress`),className:`personal-lark-ingress`,children:[(0,B.jsx)(`legend`,{children:o(`lark.agentIngress`)}),(0,B.jsx)(`div`,{children:[`live_steering`,`session_queue`,`async_inbox`].map(e=>{let t=xx(e,o);return(0,B.jsxs)(`label`,{className:ie===e?`is-active`:``,children:[(0,B.jsx)(`input`,{"aria-label":t.label,checked:ie===e,name:`lark-agent-ingress`,onChange:()=>ae(e),type:`radio`,value:e}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:t.label}),(0,B.jsx)(`small`,{children:t.detail})]})]},e)})})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.targetAgent`)}),(0,B.jsxs)(`select`,{"aria-label":o(`lark.targetAgent`),disabled:!!_e?.agent_id,onChange:e=>se(e.target.value),value:I,children:[ze?null:(0,B.jsx)(`option`,{disabled:!0,value:I,children:I?o(`lark.agentUnavailable`,{agent:I}):o(`lark.noAgentConfigured`)}),Re.map(e=>(0,B.jsx)(`option`,{value:e.agentId,children:e.label===e.agentId?e.agentId:`${e.label} · ${e.agentId}`},e.agentId))]}),(0,B.jsx)(`small`,{children:o(`lark.targetAgentDescription`)})]}),!he&&Re.length>1?(0,B.jsxs)(`label`,{"aria-label":o(`lark.connectAllAgents`),className:`personal-lark-check`,children:[(0,B.jsx)(`input`,{checked:L,onChange:e=>ce(e.target.checked),type:`checkbox`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:o(`lark.connectAllAgents`)}),(0,B.jsx)(`small`,{children:o(`lark.connectAllAgentsDescription`,{count:Re.length})})]})]}):null,!he&&L&&Re.length>1?(0,B.jsxs)(`fieldset`,{"aria-label":o(`lark.agentApps`),className:`personal-lark-agent-apps`,children:[(0,B.jsx)(`legend`,{children:o(`lark.agentApps`)}),(0,B.jsx)(`small`,{children:o(`lark.agentAppsDescription`)}),(0,B.jsx)(`div`,{children:Re.map(e=>(0,B.jsxs)(`label`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.label}),(0,B.jsx)(`small`,{children:e.agentId})]}),(0,B.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,B.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&&!Ve?(0,B.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.agentAppPermissions`)}):null,V.length===0?(0,B.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:o(`lark.selectRegisteredAgent`)}):null]}):null,(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.replyMode`)}),(0,B.jsx)(`select`,{"aria-label":o(`lark.replyMode`),onChange:e=>oe(e.target.value),value:F,children:(0,B.jsx)(`option`,{value:`topic_reply`,children:o(`lark.topicReply`)})}),(0,B.jsx)(`small`,{children:o(`lark.replyModeDescription`)})]}),(0,B.jsxs)(`p`,{className:`personal-lark-cardinality`,children:[(0,B.jsx)(am,{size:15}),o(`lark.cardinality`)]}),pe?(0,B.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:pe}):null,(0,B.jsxs)(`footer`,{children:[(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>b(!1),type:`button`,children:o(`lark.cancel`)}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,disabled:p||!x||!_e&&(!Ue?.reply_ready||!k)||P===`goal`&&(!Ve||V.length===0)||!C||de,onClick:()=>void Qe(),type:`button`,children:[de?(0,B.jsx)(km,{className:`is-spinning`,size:15}):null,He]})]})]})}):null,xe?(0,B.jsx)(`div`,{className:`personal-lark-modal-backdrop is-setup`,role:`presentation`,children:(0,B.jsxs)(`section`,{"aria-labelledby":`new-lark-app-title`,"aria-modal":`true`,className:`personal-lark-modal personal-lark-setup-modal`,role:`dialog`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:o(`lark.reusableWorkspaceApp`)}),(0,B.jsx)(`h2`,{id:`new-lark-app-title`,children:o(`lark.newApp`)})]}),(0,B.jsx)(`button`,{"aria-label":o(`lark.closeCreate`),onClick:()=>void Ze(),type:`button`,children:(0,B.jsx)(ah,{size:18})})]}),De?(0,B.jsxs)(`div`,{className:`personal-lark-setup-progress`,children:[(0,B.jsx)(`span`,{className:`personal-lark-setup-icon is-${De.status}`,children:De.status===`ready`?(0,B.jsx)(am,{size:22}):(0,B.jsx)(km,{className:De.status===`failed`?``:`is-spinning`,size:22})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:De.status===`ready`?o(`lark.appCreated`):De.status===`failed`?o(`lark.appCreateFailed`):o(`lark.waitingFeishu`)}),(0,B.jsx)(`p`,{children:De.status===`waiting_for_feishu`?o(`lark.waitingFeishuDescription`):De.status===`starting`?o(`lark.waitingLink`):De.error})]}),De.verification_url?(0,B.jsxs)(`a`,{href:De.verification_url,rel:`noreferrer`,target:`_blank`,children:[(0,B.jsx)(_m,{size:15}),o(`lark.reopenFeishu`)]}):null]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`personal-lark-setup-copy`,children:o(`lark.setupCopy`)}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.profileName`)}),(0,B.jsx)(`input`,{"aria-label":o(`lark.profileName`),autoComplete:`off`,onChange:e=>we(e.target.value),placeholder:`loopx-workspace-bot`,value:Ce})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.region`)}),(0,B.jsxs)(`select`,{"aria-label":o(`lark.region`),onChange:e=>Ee(e.target.value),value:Te,children:[(0,B.jsx)(`option`,{value:`feishu`,children:`Feishu`}),(0,B.jsx)(`option`,{value:`lark`,children:`Lark`})]})]}),Ce&&!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(Ce)?(0,B.jsx)(`p`,{className:`personal-notification-error`,children:o(`lark.profileValidation`)}):null]}),je?(0,B.jsx)(`p`,{className:`personal-notification-error`,children:je}):null,(0,B.jsxs)(`footer`,{children:[(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void Ze(),type:`button`,children:o(`lark.cancel`)}),De?null:(0,B.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,B.jsx)(km,{className:`is-spinning`,size:15}):(0,B.jsx)(_m,{size:15}),o(`lark.continueFeishu`)]})]})]})}):null]})}function Ex(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Dx(e,t,n){let r=Ex(t),i=Ex(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 Ox(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 kx(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 Ax({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,B.jsxs)(`div`,{className:`personal-report-schedule`,children:[(0,B.jsxs)(`label`,{className:`is-boolean`,htmlFor:e,children:[(0,B.jsx)(`span`,{children:a?`按日历汇报`:`Calendar reports`}),(0,B.jsx)(`input`,{id:e,type:`checkbox`,role:`switch`,checked:!!o,disabled:!r,onChange:e=>e.target.checked?p({}):r?.(null)})]}),o?(0,B.jsxs)(B.Fragment,{children:[d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{htmlFor:`${e}-frequency`,children:[(0,B.jsx)(`span`,{children:a?`频率`:`Frequency`}),(0,B.jsxs)(`select`,{id:`${e}-frequency`,value:c.FREQ,disabled:!r,onChange:e=>p({FREQ:e.target.value}),children:[(0,B.jsx)(`option`,{value:`DAILY`,children:a?`每天`:`Daily`}),(0,B.jsx)(`option`,{value:`WEEKLY`,children:a?`每周`:`Weekly`})]})]}),c.FREQ===`WEEKLY`&&(0,B.jsxs)(`label`,{htmlFor:`${e}-day`,children:[(0,B.jsx)(`span`,{children:a?`星期`:`Weekday`}),(0,B.jsx)(`select`,{id:`${e}-day`,value:c.BYDAY,disabled:!r,onChange:e=>p({BYDAY:e.target.value}),children:l.map((e,t)=>(0,B.jsx)(`option`,{value:e,children:f[t]},e))})]}),(0,B.jsxs)(`label`,{htmlFor:`${e}-time`,children:[(0,B.jsxs)(`span`,{children:[a?`当地时间`:`Local time`,` (`,n,`)`]}),(0,B.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,B.jsx)(`p`,{role:`alert`,children:a?`此计划需在 JSON 模式中编辑;当前内容已保留。`:`Edit this schedule in JSON mode; its current value is preserved.`}),(0,B.jsx)(`p`,{children:a?`由现有唤醒检查到期计划;实际送达以回执为准。`:`Existing wakes check the schedule; delivery is confirmed by its receipt.`})]}):(0,B.jsx)(`p`,{children:a?`未设置日历计划;保持阶段结束时汇报。`:`No calendar schedule; report at validated stage boundaries.`})]})}function jx({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,B.jsx)(Ax,{id:n,value:i,timezone:a,onChange:r?e=>r(t.key,e):void 0});if(t.input_kind===`boolean`)return(0,B.jsxs)(`label`,{className:`is-boolean`,htmlFor:n,children:[(0,B.jsx)(`span`,{children:o}),(0,B.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,B.jsxs)(`label`,{htmlFor:n,children:[(0,B.jsx)(`span`,{children:o}),(0,B.jsxs)(`select`,{id:n,onChange:r?e=>r(t.key,e.target.value):void 0,value:typeof i==`string`?i:``,children:[(0,B.jsx)(`option`,{value:``}),(t.options??[]).map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]});if(t.input_kind===`string_list`)return(0,B.jsxs)(`label`,{htmlFor:n,children:[(0,B.jsx)(`span`,{children:o}),(0,B.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,B.jsxs)(`label`,{htmlFor:n,children:[(0,B.jsx)(`span`,{children:o}),(0,B.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 Mx({copy:e={},disabled:t=!1,editor:n,enabledAction:r,omitKeys:i=[],onChange:a,value:o}){let s=(0,z.useId)(),c=new Set(i);return(0,B.jsx)(`fieldset`,{className:`personal-capability-fields`,disabled:t,children:n.fields.filter(e=>!c.has(e.key)).map(t=>{let n=(0,B.jsx)(jx,{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,B.jsxs)(`div`,{className:`personal-capability-enabled-row`,children:[n,r]},t.key):n})})}var Nx={en:{manager_runtime:{displayName:`Manager runtime`,description:`Selects the persistent host-tool profile used by owner manager conversations.`},steward_executor:{displayName:`Steward executor`,description:`Selects the executor, model, and reasoning effort the steward channel answers on for this machine, ahead of the Chat service environment.`},todo_replan_cadence:{displayName:`Goal review cadence`,description:`Configures the Goal review cadence.`},change_quality_qualification:{displayName:`Change quality qualification`,description:`Prepares a provider-neutral review packet, allows at most one policy-authorized safe-fix pass, and can require an exact-diff receipt.`},explore_graph:{displayName:`Explore Graph`,description:`Organizes bounded exploration as a typed evidence graph so branches, findings, and synthesis remain inspectable.`},explore_harness:{displayName:`Explore Harness`,description:`Selects a capability-owned planning and research harness profile for bounded multi-step exploration.`},lark_event_inbox:{displayName:`Lark event inbox`,description:`Receives provider events through a local-private inbox binding before LoopX projects them into governed work.`,readOnlyReason:`This capability requires a local-private inbox binding. Manage it in Lark settings or through the capability CLI.`},lark_kanban_heartbeat_sync:{displayName:`Lark Kanban heartbeat sync`,description:`Synchronizes accepted LoopX work state to the configured Lark Kanban heartbeat surface.`},local_authority_shadow:{displayName:`Local authority shadow`,description:`Observes post-commit Todo and task-lease state through the shared authority contract without taking write authority.`},multi_subagent:{displayName:`Adaptive child capacity`,description:`Sets bounded child-agent capacity and the public-safe responsibility domains in which parallel work may be delegated.`},peer_task_coordination:{displayName:`Registered-peer task coordination`,description:`Routes explicitly scoped peer-owned work to one registered coordinator without granting cross-owner mutation authority.`},periodic_report:{displayName:`Periodic reports`,description:`Turns validated Goal stage progress into a frozen report and automatically delivers it through the configured Goal Channel with exact readback.`},pull_request_review:{displayName:`Pull-request review`,description:`Ranks the public GitHub PR review queue with a machine-level default; it never grants GitHub, Todo, push, or merge authority.`},reward_memory:{displayName:`Reward Memory experiment`,description:`Configures a reviewed local-private provider binding for Goal-scoped Agent recall and evidence-backed outcome learning.`}},"zh-CN":{manager_runtime:{displayName:`管家 Runtime`,description:`选择管家会话持续生效的宿主工具模式。`},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 状态,但不取得写入权。`},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 绑定。`}}},Px={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.`},executor_endpoint:{label:`Steward executor`,description:`The executor this machine's steward channel answers on. The choice outranks the Chat service environment and the shipped default.`},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 开放常规宿主工具,但受保护操作仍单独校验。`},executor_endpoint:{label:`管家执行器`,description:`本机管家通道使用的执行器;优先级高于 Chat 服务环境变量与出货默认值。`},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 Fx(e,t){let n=Nx[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 Ix(e){return Px[e]}Object.freeze(Object.keys(Nx.en).sort());function Lx(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 Rx({values:e,t}){return(0,B.jsxs)(`details`,{className:`personal-capability-raw-values`,children:[(0,B.jsx)(`summary`,{children:t(`capabilities.rawJson`)}),(0,B.jsx)(`div`,{className:`personal-capability-value-grid`,children:e.map(({label:e,value:t})=>(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`strong`,{children:e}),(0,B.jsx)(`pre`,{children:t?JSON.stringify(t,null,2):`—`})]},e))})]})}function zx({source:e,t}){return e?(0,B.jsxs)(`p`,{className:`personal-capability-effective-source`,children:[(0,B.jsx)(Xm,{"aria-hidden":!0,size:15}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:t(`capabilities.effectiveSource`)}),t(`capabilities.source.${e}`)]})]}):null}function Bx({available:e,description:t,t:n}){return e?null:(0,B.jsxs)(`section`,{className:`personal-capability-editor-status is-read-only`,children:[(0,B.jsx)(rh,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:n(`capabilities.readOnly`)}),(0,B.jsx)(`p`,{children:t})]})]})}function Vx(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 Hx(e,t){return[...e].sort((e,n)=>{let r=Vx(e)-Vx(n);if(r!==0)return r;let i=Fx(e,t),a=Fx(n,t);return i.display_name.localeCompare(a.display_name,t)||e.capability_id.localeCompare(n.capability_id)})}function Ux({capabilities:e,locale:t,onSelect:n,scope:r,selectedCapabilityId:i,t:a}){return(0,B.jsx)(`nav`,{"aria-label":a(r===`goal`?`capabilities.catalog`:`machine.capabilityCatalog`),className:`personal-capability-list`,tabIndex:0,children:Hx(e,t).map(e=>{let o=Fx(e,t);return(0,B.jsxs)(`button`,{"aria-current":i===o.capability_id?`page`:void 0,onClick:()=>n(o.capability_id),type:`button`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(`strong`,{children:o.display_name})}),(0,B.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 Wx({capability:e,locale:t,source:n}){let{t:r}=Ji(),i=Fx(e,t);return(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`span`,{className:`personal-settings-icon`,children:(0,B.jsx)(Zm,{"aria-hidden":!0,size:18})}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`personal-capability-heading-row`,children:[(0,B.jsx)(`h2`,{children:i.display_name}),(0,B.jsx)(zx,{source:n,t:r})]}),e.context_contribution&&(0,B.jsxs)(`details`,{className:`personal-capability-help`,"data-testid":`capability-context-phases`,children:[(0,B.jsx)(`summary`,{children:t===`zh-CN`?`主 Agent 协作指导`:`Coordinator workflow guidance`}),(0,B.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,B.jsx)(`dl`,{children:e.context_contribution.supported_phases.map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:(0,B.jsx)(`code`,{children:e})}),(0,B.jsx)(`dd`,{children:Gx[e][t===`zh-CN`?`zh`:`en`]})]},e))}),(0,B.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,B.jsxs)(`details`,{className:`personal-capability-help`,children:[(0,B.jsx)(`summary`,{children:t===`zh-CN`?`配置说明`:`Configuration help`}),(0,B.jsx)(`p`,{children:i.description}),(0,B.jsx)(`dl`,{children:e.configuration_editor.fields.map(e=>{let n=Ix(t)[e.key],r=n?.description??e.description;return r?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:n?.label??e.label}),(0,B.jsx)(`dd`,{children:r})]},e.key):null})})]},e.capability_id)]})]})}var Gx={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 Kx({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.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,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{className:`personal-notification-toggle`,children:[(0,B.jsx)(`input`,{checked:n?.humanGateAutoNotifyEnabled??!1,disabled:a||n?.configured!==!0||!e.onToggleGoalAutoNotify,onChange:e=>void l(e.target.checked),type:`checkbox`}),(0,B.jsx)(`span`,{children:i(`notifications.autoNotify`)}),a?(0,B.jsx)(km,{"aria-hidden":!0,className:`is-spinning`,size:14}):null]}),s?(0,B.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:s}):null]})}function qx({goalId:e,onApplied:t,selected:n,t:r}){let[i,a]=(0,z.useState)({busy:null,draft:{},partialWrite:null,preview:null}),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(`guided`),[u,d]=(0,z.useState)(``),f=(0,z.useMemo)(()=>n?Ox(n.configuration_editor,u):null,[n,u]),p=c===`guided`||f!==null;(0,z.useEffect)(()=>{l(`guided`),d(``),a({busy:null,draft:Dx(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 Vg(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=Dx(n.configuration_editor,i.draft,n.default),o=await Hg(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`?kx(r.draft,e,t):{...r.draft,[e]:t},preview:null})),s(null)}function _(e){if(!n||i.busy)return;d(e);let t=Ox(n.configuration_editor,e);a(e=>({...e,preview:null,draft:t?Dx(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 Jx({mutationError:e,onApplied:t,partialWrite:n,preview:r}){let{t:i}=Ji();return(0,B.jsxs)(B.Fragment,{children:[e?(0,B.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:e}):null,n?(0,B.jsxs)(`section`,{"aria-live":`polite`,className:`personal-capability-recovery`,children:[(0,B.jsx)(rh,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:i(`capabilities.partialWrite`)}),(0,B.jsx)(`p`,{children:i(`capabilities.partialWriteDescription`)}),(0,B.jsx)(`small`,{children:n.recommended_action})]}),(0,B.jsxs)(`button`,{onClick:t,type:`button`,children:[(0,B.jsx)(Hm,{"aria-hidden":!0,size:15}),i(`capabilities.refreshSource`)]})]}):null,r?(0,B.jsxs)(`section`,{className:`personal-capability-preview`,"aria-label":i(`capabilities.preview`),children:[(0,B.jsx)(`strong`,{children:i(`capabilities.preview`)}),(0,B.jsx)(`span`,{children:i(`machine.action.${r.action}`)}),(0,B.jsx)(`small`,{children:i(`capabilities.previewLocked`)})]}):null]})}function Yx({callbacks:e,catalog:t,goalId:n,notification:r,onApplied:i,onNotificationChanged:a}){let{locale:o,t:s}=Ji(),c=(0,z.useMemo)(()=>Hx(t.capabilities,o),[t.capabilities,o]),[l,u]=(0,z.useState)(()=>c[0]?.capability_id??``),d=(0,z.useMemo)(()=>c.find(e=>e.capability_id===l)??c[0],[c,l]),f=(0,z.useMemo)(()=>d?Fx(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}=qx({goalId:n,onApplied:i,selected:f,t:s}),{busy:C,draft:w,partialWrite:T,preview:E}=x;if(!d||!f)return(0,B.jsx)(`p`,{className:`personal-capability-empty`,children:s(`capabilities.empty`)});let D=f.available_scopes.includes(`goal`),O=Lx(f,`goal`),k=f.configuration_editor.read_only_reason??s(D?`capabilities.previewOnly`:`capabilities.machineOnly`);async function ee(){if(!f||!O||C||!y)return;let e=Dx(f.configuration_editor,w,f.default);await S(e)}async function te(){!O||C||await S(null)}return(0,B.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,B.jsx)(Ux,{capabilities:t.capabilities,locale:o,onSelect:u,scope:`goal`,selectedCapabilityId:f.capability_id,t:s}),(0,B.jsxs)(`article`,{"aria-label":f.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,B.jsx)(Wx,{capability:d,locale:o,source:f.effective_configuration?.source}),(0,B.jsx)(Bx,{available:O,t:s,description:k}),f.capability_id===`lark_event_inbox`?(0,B.jsxs)(`section`,{className:`personal-capability-linked-setting`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:s(`capabilities.larkInboxNotificationSetting`)}),(0,B.jsx)(`p`,{children:s(`capabilities.larkInboxNotificationDescription`)})]}),(0,B.jsx)(Kx,{callbacks:e,goalId:n,notification:r,onChanged:a})]}):null,O?(0,B.jsxs)(B.Fragment,{children:[_===`json`||!f.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,B.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,B.jsxs)(`button`,{disabled:!!C||!y,onClick:g,type:`button`,children:[(0,B.jsx)(fm,{"aria-hidden":!0,size:14}),s(_===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,_===`guided`?(0,B.jsx)(`section`,{className:`personal-capability-field-summary`,children:(0,B.jsx)(Mx,{disabled:!!C,copy:Ix(o),editor:f.configuration_editor,onChange:m,value:w,enabledAction:(0,B.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:g,type:`button`,children:[(0,B.jsx)(fm,{"aria-hidden":!0,size:14}),s(`machine.editJson`)]})})}):(0,B.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`goal-configuration-json`,children:[(0,B.jsx)(`span`,{children:s(`capabilities.jsonConfiguration`)}),(0,B.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,B.jsx)(`small`,{id:`goal-configuration-json-help`,children:s(`capabilities.jsonHelp`)}),y?null:(0,B.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:s(`capabilities.jsonInvalid`)})]})]}):null,(0,B.jsx)(Jx,{mutationError:b,onApplied:i,partialWrite:T,preview:E}),O?(0,B.jsxs)(`footer`,{className:`personal-capability-actions`,children:[f.current&&f.available_scopes.includes(`machine`)?(0,B.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void te(),type:`button`,children:s(`capabilities.restoreInheritance`)}):null,(0,B.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void ee(),type:`button`,children:s(C===`preview`?`common.loading`:`capabilities.previewChanges`)}),(0,B.jsx)(`button`,{className:`is-primary`,disabled:!!C||!E||!y,onClick:()=>void p(),type:`button`,children:s(C===`apply`?`common.loading`:`capabilities.applyPreview`)})]}):null,(0,B.jsx)(Rx,{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 Xx({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(!1);function d(){t&&(u(!0),c(null),Bg(t).then(o).catch(e=>c(e instanceof Error?e.message:i(`capabilities.loadFailed`))).finally(()=>u(!1)))}return(0,z.useEffect)(d,[t]),t?l&&!a?(0,B.jsxs)(`p`,{"aria-live":`polite`,className:`personal-capability-empty`,children:[(0,B.jsx)(km,{className:`personal-spin`,size:18}),i(`capabilities.loading`)]}):s?(0,B.jsxs)(`section`,{className:`personal-capability-error`,role:`alert`,children:[(0,B.jsx)(rh,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:i(`capabilities.loadFailed`)}),(0,B.jsx)(`small`,{children:s})]}),(0,B.jsxs)(`button`,{onClick:d,type:`button`,children:[(0,B.jsx)(Hm,{"aria-hidden":!0,size:15}),i(`capabilities.retry`)]})]}):a?(0,B.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":a.revision,children:[(0,B.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(Xm,{"aria-hidden":!0,size:17}),i(`capabilities.atomicOverride`)]}),(0,B.jsx)(`p`,{children:i(`capabilities.atomicOverrideDescription`)})]}),(0,B.jsx)(Yx,{callbacks:e,catalog:a.capability_catalog,goalId:t,notification:n,onApplied:d,onNotificationChanged:r})]}):null:(0,B.jsx)(`p`,{className:`personal-capability-empty`,children:i(`capabilities.chooseGoal`)})}function Zx(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Qx(e,t){let n=t?.machine_namespace;return n?e?.machine_configuration?.namespaces[n]:void 0}function $x(e,t,n){return{...Zx(e.default),...Zx(t),...n}}function eS(e,t){for(let n of e.configuration_editor.fields){let e=t[n.key];if(n.required&&(e==null||e===``))return!1}return e.capability_id===`periodic_report`&&t.enabled===!0?!!(String(t.profile_preset??``).trim()&&String(t.route_ref??``).trim()&&String(t.timezone??``).trim()):!0}function tS(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}catch{return null}}function nS(e){return e?e===`absent`?e:e.replace(/^sha256:/,``).slice(0,12):`—`}function rS(){let{locale:e,t}=Ji(),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)({}),[c,l]=(0,z.useState)(`{}`),[u,d]=(0,z.useState)(`guided`),[f,p]=(0,z.useState)(null),[m,h]=(0,z.useState)(`upsert`),[g,_]=(0,z.useState)(null),[v,y]=(0,z.useState)(null),[b,x]=(0,z.useState)(`load`),[S,C]=(0,z.useState)(null),[w,T]=(0,z.useState)(null),E=(0,z.useMemo)(()=>Hx(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=>Lx(e,`machine`))??E[0],k=O?Fx(O,e):void 0,ee=Qx(n,k),te=!!(k?.machine_namespace&&ee),A=!!(k&&Lx(k,`machine`)),j=(0,z.useMemo)(()=>tS(c),[c]),M=k?u===`json`?j:$x(k,ee,o):null,ne=!!(k&&(u===`json`?j:eS(k,M??{})));async function N(){r(await zg())}(0,z.useEffect)(()=>{let e=!0;return zg().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,z.useEffect)(()=>{if(!k)return;let e=Qx(n,k),t=Dx(k.configuration_editor,e??k.default,k.default),r=$x(k,e,t);s(t),l(JSON.stringify(r,null,2)),d(A?`guided`:`json`),p(null),h(`upsert`),y(null)},[n,i,e]);function P(e,t){s(n=>k?.capability_id===`periodic_report`?kx(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($x(k,ee,o),null,2));else if(j)s(Dx(k.configuration_editor,j,k.default));else{C(t(`machine.jsonInvalid`));return}d(e),p(null),h(`upsert`),C(null)}}async function ie(){if(!(!A||!k?.machine_namespace||!M||!ne||b)){x(`preview`),C(null),T(null);try{h(`upsert`),p(await Ug(k.machine_namespace,M))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function ae(){if(!(!A||!k?.machine_namespace||!te||b)){x(`preview`),C(null),T(null);try{h(`remove`),p(await Gg(k.machine_namespace))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function F(){if(!A||!k?.machine_namespace||!f||b||m===`upsert`&&!M)return;x(`apply`),C(null);let e=m;try{let n=e===`remove`?await Kg(k.machine_namespace,f.plan_revision):await Wg(k.machine_namespace,M,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 qg(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 Jg(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,B.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:t(`common.loading`)}):k?(0,B.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n?.revision,children:[(0,B.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(Xm,{"aria-hidden":!0,size:17}),t(`machine.liveDefault`)]}),(0,B.jsx)(`p`,{children:t(`machine.liveDefaultDescription`)})]}),(0,B.jsxs)(`div`,{className:`personal-capability-body`,children:[n?.status===`invalid`?(0,B.jsxs)(`section`,{className:`personal-machine-error`,"data-testid":`machine-invalid-repair`,role:`alert`,children:[(0,B.jsx)(`strong`,{children:t(`machine.invalidStoredConfiguration`)}),(0,B.jsx)(`p`,{children:t(`machine.invalidStoredConfigurationDescription`)})]}):null,(0,B.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,B.jsx)(Ux,{capabilities:E,locale:e,onSelect:a,scope:`machine`,selectedCapabilityId:k.capability_id,t}),(0,B.jsxs)(`article`,{"aria-label":k.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,B.jsx)(Wx,{capability:O,locale:e,source:k.available_scopes.includes(`machine`)?te?`machine_default`:`capability_default`:void 0}),(0,B.jsx)(Bx,{available:A,t,description:k.available_scopes.includes(`machine`)?t(`machine.editorUnavailableDescription`):t(`machine.goalOnly`)}),k.capability_id===`periodic_report`?(0,B.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,B.jsx)(Xm,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:ee?.schedule?e===`zh-CN`?`日历与阶段汇报`:`Calendar and stage reports`:t(`machine.periodicReportActivation`)}),(0,B.jsx)(`p`,{children:ee?.schedule?ee.enabled===!0?e===`zh-CN`?`已配置日历计划,由现有唤醒检查;是否送达请核对报告回执。`:`A calendar schedule is configured and checked by existing wakes. Verify delivery in the report receipt.`:e===`zh-CN`?`日历计划已保存;启用此能力后才会检查和投递。`:`The schedule is saved; enable this capability to check and deliver reports.`:t(`machine.periodicReportActivationDescription`)})]})]}):null,k.capability_id===`change_quality_qualification`?(0,B.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,B.jsx)(Xm,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:t(`machine.changeQualityActivation`)}),(0,B.jsx)(`p`,{children:t(`machine.changeQualityActivationDescription`)})]})]}):null,k.capability_id===`todo_replan_cadence`?(0,B.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,B.jsx)(Xm,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:t(`machine.replanCadenceActivation`)}),(0,B.jsx)(`p`,{children:t(`machine.replanCadenceActivationDescription`)})]})]}):null,k.capability_id===`pull_request_review`?(0,B.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,B.jsx)(Xm,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:e===`zh-CN`?`只改变队列排序`:`Queue ordering only`}),(0,B.jsx)(`p`,{children:e===`zh-CN`?`默认先审阅其他开发者的 PR;选择 owner-first 才会优先当前已认证审阅者自己的 PR。此配置不会发布 review、写 Todo、push 或 merge。`:`The default reviews other developers' PRs first; choose owner-first only when the authenticated reviewer's own PRs should lead. This setting never posts a review, writes Todos, pushes, or merges.`})]})]}):null,A?(0,B.jsxs)(B.Fragment,{children:[u===`json`||!k.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,B.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,B.jsxs)(`button`,{onClick:()=>re(u===`guided`?`json`:`guided`),type:`button`,children:[(0,B.jsx)(fm,{"aria-hidden":!0,size:14}),t(u===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,u===`guided`?(0,B.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,B.jsx)(Mx,{copy:Ix(e),disabled:!!b,editor:k.configuration_editor,onChange:P,value:o,enabledAction:(0,B.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:()=>re(`json`),type:`button`,children:[(0,B.jsx)(fm,{"aria-hidden":!0,size:14}),t(`machine.editJson`)]})}),ne?null:(0,B.jsx)(`p`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.requiredFields`)})]}):(0,B.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`machine-configuration-json`,children:[(0,B.jsx)(`span`,{children:t(`machine.jsonConfiguration`)}),(0,B.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,B.jsx)(`small`,{id:`machine-configuration-json-help`,children:t(`machine.jsonConfigurationHelp`)}),j?null:(0,B.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.jsonInvalid`)})]})]}):null,S?(0,B.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:S}):null,w?(0,B.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(am,{"aria-hidden":!0,size:16}),w]}):null,f?(0,B.jsxs)(`section`,{"aria-label":t(`machine.preview`),className:`personal-machine-preview`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:t(`machine.preview`)}),(0,B.jsx)(`span`,{children:t(`machine.action.${f.action}`)})]}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`machine.currentRevision`)}),(0,B.jsx)(`dd`,{title:f.current_revision,children:nS(f.current_revision)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`machine.desiredRevision`)}),(0,B.jsx)(`dd`,{title:f.desired_revision,children:nS(f.desired_revision)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`machine.changedNamespaces`)}),(0,B.jsx)(`dd`,{children:f.changed_namespaces.join(`, `)||t(`common.none`)})]})]}),(0,B.jsx)(`p`,{children:t(`machine.previewLocked`)})]}):null,g?.rollback_available&&g.transaction_id?(0,B.jsxs)(`section`,{className:`personal-machine-rollback`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:t(`machine.rollbackAvailable`)}),(0,B.jsx)(`p`,{children:t(v?`machine.rollbackPreviewDescription`:`machine.rollbackDescription`)})]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!!b||!!(v&&!v.rollback_allowed),onClick:()=>void(v?I():oe()),type:`button`,children:[(0,B.jsx)(Um,{"aria-hidden":!0,size:15}),t(b===`rollback`||b===`rollback-preview`?`common.loading`:v?`machine.confirmRollback`:`machine.previewRollback`)]})]}):null,A?(0,B.jsxs)(`footer`,{className:`personal-capability-actions`,children:[te?(0,B.jsxs)(`button`,{className:`is-danger`,disabled:!!b,onClick:()=>void ae(),type:`button`,children:[(0,B.jsx)(nh,{"aria-hidden":!0,size:15}),t(`machine.previewRemoval`)]}):null,(0,B.jsx)(`button`,{disabled:!!b||!ne,onClick:()=>void ie(),type:`button`,children:t(b===`preview`?`common.loading`:`machine.previewChanges`)}),(0,B.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,B.jsx)(Rx,{values:[{label:t(`machine.currentValue`),value:ee},{label:t(`capabilities.defaultValue`),value:k.default}],t},k.capability_id):null]})]})]})]}):(0,B.jsx)(`p`,{className:`personal-capability-empty`,children:t(`machine.capabilityEmpty`)})}function iS(e,t){return t(e===`invalid`?`machine.credentialInvalid`:e===`configured`?`machine.credentialConfigured`:`machine.credentialAbsent`)}function aS(e,t){return t(e===`machine_store`?`machine.credentialSourceMachine`:e===`service_environment`?`machine.credentialSourceEnvironment`:`machine.credentialSourceUnset`)}function oS(){let{t:e}=Ji(),[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(null),p=(0,z.useCallback)(async()=>{c(`load`);try{let e=await Lg();n(e),o(String(e.base_url.value??``))}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}},[e]);(0,z.useEffect)(()=>{p()},[p]);async function m(t,r){c(`store`),u(null),f(null);try{let e=await Rg(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,B.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:e(`common.loading`)});let h=t?`${iS(t.provider_key.configured?`configured`:`absent`,e)} · ${aS(t.provider_key.source,e)}`:``,g=t?`${t.base_url.value??e(`machine.credentialAbsent`)} · ${aS(t.base_url.source,e)}`:``;return(0,B.jsxs)(`section`,{className:`personal-operator-credential`,"data-testid":`operator-credential-settings`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(Tm,{"aria-hidden":!0,size:17}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:e(`machine.credentialTitle`)}),(0,B.jsx)(`p`,{children:e(`machine.credentialDescription`)})]}),(0,B.jsx)(`span`,{className:`personal-operator-credential-status`,children:t?iS(t.status,e):e(`common.loading`)})]}),t?(0,B.jsxs)(`dl`,{className:`personal-operator-credential-readback`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e(`machine.credentialApiKey`)}),(0,B.jsx)(`dd`,{children:h})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e(`machine.credentialFingerprint`)}),(0,B.jsx)(`dd`,{children:(0,B.jsx)(`code`,{children:t.provider_key.fingerprint??e(`common.none`)})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e(`machine.credentialBaseUrl`)}),(0,B.jsx)(`dd`,{children:g})]})]}):null,t?.status===`invalid`&&t.repair?(0,B.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:t.repair}):null,(0,B.jsxs)(`label`,{htmlFor:`operator-credential-api-key`,children:[(0,B.jsx)(`span`,{children:e(`machine.credentialApiKey`)}),(0,B.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,B.jsxs)(`label`,{htmlFor:`operator-credential-base-url`,children:[(0,B.jsx)(`span`,{children:e(`machine.credentialBaseUrl`)}),(0,B.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,B.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:l}):null,d?(0,B.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(am,{"aria-hidden":!0,size:16}),d]}):null,(0,B.jsxs)(`footer`,{className:`personal-operator-credential-actions`,children:[(0,B.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,B.jsxs)(`button`,{disabled:!!s||t?.provider_key.configured!==!0,onClick:()=>void m({clear_provider_key:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,B.jsx)(nh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearKey`)]}),(0,B.jsxs)(`button`,{disabled:!!s||t?.base_url.configured!==!0,onClick:()=>void m({clear_base_url:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,B.jsx)(nh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearUrl`)]})]}),(0,B.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(Xm,{"aria-hidden":!0,size:17}),e(`machine.credentialTitle`)]}),(0,B.jsx)(`p`,{children:e(`machine.credentialBoundary`)})]})]})}var sS={appearance:Im,capabilities:Zm,language:Em,lark:Ym,machine:qm,provider:Tm};function cS({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,z.useState)(i),h=[...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`)}],g=[{label:f(`settings.languageEnglish`),value:`en`},{label:f(`settings.languageSimplifiedChinese`),value:`zh-CN`}],_={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,B.jsxs)(`section`,{"aria-label":f(`settings.title`),className:`personal-settings-page`,"data-pw-theme":l,children:[(0,B.jsxs)(`aside`,{className:`personal-settings-sidebar`,children:[(0,B.jsxs)(`button`,{autoFocus:!0,className:`personal-settings-back`,onClick:s,type:`button`,children:[(0,B.jsx)(Xp,{size:17}),(0,B.jsx)(`span`,{children:f(`settings.back`)})]}),(0,B.jsxs)(`div`,{className:`personal-settings-title`,children:[(0,B.jsx)(`small`,{children:f(`settings.eyebrow`)}),(0,B.jsx)(`strong`,{children:f(`settings.title`)})]}),(0,B.jsx)(`nav`,{"aria-label":f(`settings.categories`),className:`personal-settings-tabs`,children:h.map(e=>{let t=sS[e.key];return(0,B.jsxs)(`button`,{"aria-current":p===e.key?`page`:void 0,onClick:()=>m(e.key),type:`button`,children:[(0,B.jsx)(t,{size:17}),(0,B.jsx)(`span`,{children:(0,B.jsx)(`strong`,{children:e.label})})]},e.key)})})]}),(0,B.jsxs)(`main`,{className:`personal-settings-body`,children:[(0,B.jsx)(`header`,{className:`personal-settings-header`,children:(0,B.jsx)(`div`,{children:(0,B.jsx)(`h1`,{children:_.title})})}),p===`lark`?(0,B.jsx)(Tx,{embedded:!0,focusGoalConnection:t,goals:n,initialGoalId:r,onChanged:o,onClose:s}):null,p===`provider`?(0,B.jsx)(`div`,{className:`personal-provider-settings`,children:(0,B.jsx)(oS,{})}):null,p===`machine`?(0,B.jsx)(rS,{}):null,p===`capabilities`?(0,B.jsx)(Xx,{callbacks:e,goalId:r,notification:a.find(e=>e.goalId===r),onChanged:o}):null,p===`appearance`?(0,B.jsxs)(`section`,{className:`personal-detail-card personal-appearance-settings`,children:[(0,B.jsx)(`small`,{children:f(`settings.workspaceDisplay`)}),(0,B.jsx)(`h3`,{children:f(`settings.appearance`)}),(0,B.jsxs)(`div`,{className:`personal-settings-choice-group`,role:`radiogroup`,"aria-label":f(`settings.workspaceTheme`),children:[(0,B.jsxs)(`button`,{"aria-checked":l===`loopx`,onClick:()=>c(`loopx`),role:`radio`,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-settings-theme-swatch is-loopx`}),(0,B.jsx)(`strong`,{children:f(`settings.themeLoopx`)})]}),(0,B.jsxs)(`button`,{"aria-checked":l===`paper`,onClick:()=>c(`paper`),role:`radio`,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-settings-theme-swatch is-paper`}),(0,B.jsx)(`strong`,{children:f(`settings.themeDefault`)})]}),(0,B.jsxs)(`button`,{"aria-checked":l===`brutal`,onClick:()=>c(`brutal`),role:`radio`,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-settings-theme-swatch is-brutal`}),(0,B.jsx)(`strong`,{children:f(`settings.themeHighContrast`)})]})]})]}):null,p===`language`?(0,B.jsxs)(`section`,{className:`personal-settings-card`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`span`,{className:`personal-settings-icon`,children:(0,B.jsx)(Em,{size:18})}),(0,B.jsx)(`div`,{children:(0,B.jsx)(`h2`,{children:f(`settings.language`)})})]}),(0,B.jsx)(`div`,{"aria-label":f(`settings.language`),className:`personal-language-options`,role:`radiogroup`,children:g.map(e=>(0,B.jsxs)(`button`,{"aria-checked":u===e.value,className:u===e.value?`is-selected`:``,onClick:()=>d(e.value),role:`radio`,type:`button`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(`strong`,{children:e.label})}),u===e.value?(0,B.jsx)(am,{"aria-hidden":!0,size:17}):null]},e.value))})]}):null]})]})}var lS=`loopx-pw-theme`,uS=`loopx`;function dS(){try{let e=window.localStorage.getItem(lS);return e===`loopx`||e===`paper`||e===`brutal`?e:uS}catch{return uS}}function fS(e){try{window.localStorage.setItem(lS,e)}catch{}}function pS({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,z.useRef)(null),u=(0,z.useRef)(null);return(0,z.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,B.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,B.jsx)(`button`,{"aria-hidden":!0,className:`personal-sidebar-backdrop`,onClick:a,tabIndex:-1,type:`button`}):null,(0,B.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,B.jsxs)(`div`,{className:`personal-workspace-sidebar-inner`,children:[i?(0,B.jsxs)(`button`,{className:`personal-sr-only`,onClick:a,type:`button`,children:[c(`common.close`),` `,c(`header.goalNavigation`)]}):null,o]})}),(0,B.jsx)(`main`,{"aria-hidden":i||void 0,className:`personal-workspace-main`,inert:i||void 0,children:r}),n?(0,B.jsx)(`aside`,{className:`personal-workspace-drawer`,"data-context-drawer":!0,"data-drawer-mode":t,children:e}):null]})}function mS(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 hS(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 gS(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 _S({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=[],d=[];e.filter(e=>!e.loadState).forEach(e=>{let t=qy(e);t===`history`?u.push(e):t===`stopped`?d.push(e):l[t].push(e)});let f=e=>(0,B.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,B.jsxs)(`span`,{className:`personal-home-goal-meta`,children:[(0,B.jsx)(`i`,{}),e.agentLaneCount&&e.agentLaneCount>1?a(`header.workAgentCount`,{count:e.agentLaneCount}):e.agentLabel??e.agentId]}),(0,B.jsx)(`strong`,{children:e.title}),(0,B.jsx)(`p`,{children:e.loadError?a(`startup.error.${e.loadError}`):e.needsYou??e.nextSentence}),(0,B.jsxs)(`footer`,{children:[(0,B.jsx)(`span`,{children:e.loadState?a(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Yi(e.state,i)}),(0,B.jsx)(`small`,{title:e.latestActivity,children:e.loadState?``:e.latestActivity?gS(e.latestActivity,i,a):e.agentTodos.length?a(`home.taskCount`,{count:e.agentTodos.length}):a(`home.noActivity`)})]})]},e.goalId);return(0,B.jsxs)(`section`,{"aria-label":a(`home.workspace`),className:`personal-home-board`,children:[r&&(!r.ok||r.issues.length>0||r.freshnessWarning)?(0,B.jsxs)(`div`,{className:`personal-system-health-banner`,role:`alert`,children:[(0,B.jsxs)(`div`,{className:`personal-system-health-header`,children:[(0,B.jsx)(lm,{size:15}),(0,B.jsx)(`strong`,{children:a(`home.systemHealth`,{summary:r.summary})}),r.freshnessWarning?(0,B.jsxs)(`small`,{children:[`(`,r.freshnessWarning,`)`]}):null]}),r.issues.length>0?(0,B.jsx)(`ul`,{className:`personal-system-health-issues`,children:r.issues.map((e,t)=>(0,B.jsx)(`li`,{children:e},t))}):null]}):null,o.some(e=>e.loadState)?(0,B.jsxs)(`section`,{className:`personal-home-lane`,"aria-live":`polite`,children:[(0,B.jsx)(`header`,{children:a(`startup.progress`,{loaded:o.filter(e=>!e.loadState).length,total:o.length})}),s?(0,B.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`status`,children:[(0,B.jsx)(`span`,{children:a(`startup.failedCount`,{count:s})}),(0,B.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,onClick:n,type:`button`,children:a(`startup.retryFailed`)})]}):null,o.filter(e=>e.loadState).map(f)]}):null,(0,B.jsx)(`div`,{className:`personal-home-lanes`,children:c.map(e=>(0,B.jsxs)(`section`,{className:`personal-home-lane is-${e.key}`,"data-testid":`personal-home-lane-${e.key}`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{}),e.label]}),(0,B.jsx)(`b`,{children:l[e.key].length})]}),(0,B.jsx)(`div`,{className:`personal-home-lane-list`,children:l[e.key].length?l[e.key].map(f):(0,B.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.empty`)})})]},e.key))}),(0,B.jsxs)(`details`,{className:`personal-home-history`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(`span`,{children:a(`home.history`)}),(0,B.jsx)(`b`,{children:u.length}),(0,B.jsx)(`small`,{children:a(`home.completedGoals`)})]}),(0,B.jsx)(`div`,{children:u.length?u.map(f):(0,B.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.noCompletedGoals`)})})]}),d.length?(0,B.jsxs)(`details`,{className:`personal-home-history is-stopped`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(`span`,{children:a(`home.stopped`)}),(0,B.jsx)(`b`,{children:d.length}),(0,B.jsx)(`small`,{children:a(`home.preservedState`)})]}),(0,B.jsx)(`div`,{children:d.map(f)})]}):null]})}function vS({items:e,onSelect:t,reportState:n}){let{locale:r,t:i}=Ji();return(0,B.jsxs)(`section`,{className:`personal-object-list personal-files-list`,"data-testid":`personal-goal-outputs`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:i(`files.title`)}),(0,B.jsx)(`span`,{children:e.length})]}),n?.loading?(0,B.jsxs)(`p`,{className:`personal-object-list-state`,role:`status`,children:[(0,B.jsx)(Hm,{className:`is-spinning`,size:14}),i(`files.loadingReports`)]}):null,n?.error?(0,B.jsxs)(`p`,{className:`personal-object-list-state is-error`,role:`alert`,children:[(0,B.jsx)(lm,{size:14}),i(`files.reportLoadFailed`),`: `,n.error]}):null,!n?.loading&&!n?.error&&e.length===0?(0,B.jsxs)(`p`,{className:`personal-object-list-state`,children:[(0,B.jsx)(xm,{size:14}),i(`files.empty`)]}):null,e.map(e=>(0,B.jsxs)(`button`,{"data-output-kind":e.output.kind,onClick:()=>t({item:e.output,kind:`output`}),type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-file-icon`,children:(0,B.jsx)(xm,{size:16})}),(0,B.jsx)(`strong`,{children:e.output.title}),e.output.report?(0,B.jsx)(`em`,{children:i(`files.reportDelta`,{added:e.output.report.addedCount,changed:e.output.report.changedCount})}):null,(0,B.jsx)(`p`,{children:e.output.summary??e.output.safePreview??e.output.kind??i(`files.emptySummary`)}),(0,B.jsx)(`small`,{title:e.output.createdAt,children:[e.output.goalTitle,e.output.kind===`report`?i(`files.verifiedReport`):null,e.output.todoId?`${i(`common.task`)} ${e.output.todoId}`:null,gS(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,z.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,B.jsxs)(`aside`,{"aria-label":o(`conversation.receipt`),className:`personal-manager-conversation-tray`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(nm,{size:16}),(0,B.jsx)(`strong`,{children:a??o(`conversation.title`)}),(0,B.jsx)(`small`,{children:t.at(-1)?.pending?o(`conversation.replying`):o(`common.recently`)})]}),(0,B.jsxs)(`div`,{className:`personal-manager-conversation-actions`,children:[r&&l?(0,B.jsxs)(`button`,{className:`personal-manager-conversation-btn`,onClick:()=>r(l.text),title:o(`conversation.convertHint`),type:`button`,children:[(0,B.jsx)(Om,{size:13}),(0,B.jsx)(`span`,{children:o(`conversation.toTask`)})]}):null,(0,B.jsx)(`button`,{className:`personal-manager-conversation-link`,onClick:i,type:`button`,children:o(`conversation.full`)}),n?(0,B.jsx)(`button`,{"aria-label":o(`conversation.close`),className:`personal-manager-conversation-close`,onClick:n,title:o(`conversation.close`),type:`button`,children:(0,B.jsx)(ah,{size:14})}):null]})]}),(0,B.jsx)(`div`,{"aria-live":`polite`,className:`personal-manager-conversation-messages`,children:c.map(t=>(0,B.jsxs)(`article`,{className:`is-${t.role}`,children:[(0,B.jsx)(`strong`,{children:t.role===`user`?o(`common.you`):t.agentLabel??e??o(`header.manager`)}),(0,B.jsxs)(`div`,{className:`personal-manager-conversation-bubble`,children:[t.role===`user`?(0,B.jsx)(`p`,{children:t.text}):(0,B.jsx)(cb,{text:t.text}),t.pending?(0,B.jsx)(`small`,{children:o(`conversation.agentPending`)}):null,(0,B.jsx)(pb,{delivery:t.returnDelivery})]})]},t.id))})]})}function bS({onClose:e,onOpenDetails:t,run:n}){let{t:r}=Ji();return(0,B.jsxs)(`section`,{"aria-label":r(`session.record`),className:`personal-session-record`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(nm,{size:17}),r(`session.record`)]}),(0,B.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,B.jsx)(ah,{size:15})})]}),(0,B.jsx)(`div`,{children:(0,B.jsx)(`strong`,{children:n.title})}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Agent`}),(0,B.jsx)(`dd`,{children:n.agentLabel})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`common.status`)}),(0,B.jsx)(`dd`,{children:Xi(n.sessionStatus??n.status,r)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Session`}),(0,B.jsx)(`dd`,{title:n.sessionId,children:n.sessionId})]})]}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:t,type:`button`,children:r(`session.details`)})]})}function xS(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??Ky(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>qy(e)===`running`).slice(0,4).forEach(e=>r.push({id:`run:${e.goalId}`,kind:`run`,run:{agentId:e.agentId,agentLabel:e.agentLabel??e.agentId,completedSteps:e.doneTodoCount??e.agentTodos.filter(e=>e.done).length,goalId:e.goalId,goalTitle:e.title,latestActivity:e.agentSentence,runId:`goal:${e.goalId}`,status:`running`,title:e.nextSentence,totalSteps:Math.max((e.doneTodoCount??0)+e.agentTodos.filter(e=>!e.done).length,1)}})),r;let i=e.goals.find(e=>e.goalId===t);if(!i)return r;if(i.needsYou){let t=e.userTodos.find(e=>e.goalId===i.goalId);r.push({attention:t?{...t,goalTitle:i.title}:{blocking:i.needsYouBlocking??!1,goalId:i.goalId,goalTitle:i.title,text:i.needsYou,todoId:`${i.goalId}:attention`},id:`attention:${i.goalId}`,kind:`attention`})}r.push({id:`run:${i.goalId}`,kind:`run`,run:{agentId:i.agentId,agentLabel:i.agentLabel??i.agentId,completedSteps:i.doneTodoCount??i.agentTodos.filter(e=>e.done).length,goalId:i.goalId,goalTitle:i.title,latestActivity:i.agentSentence,runId:`goal:${i.goalId}`,status:i.state===`推进中`?`running`:i.state===`需修复`?`failed`:`waiting`,title:i.nextSentence,totalSteps:Math.max((i.doneTodoCount??0)+i.agentTodos.filter(e=>!e.done).length,1)}}),i.agentTodos.filter(e=>e.taskClass===`continuous_monitor`).forEach(t=>{let a=e.timeline?.find(e=>e.kind===`run`&&e.run.goalId===i.goalId&&e.run.todoId===t.todoId&&!!e.run.sessionId);r.push({id:`schedule:${i.goalId}:${t.todoId}`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:a?[{label:a.run.latestActivity||a.run.title,runId:a.run.runId,status:a.run.status===`waiting`||a.run.status===`queued`?`running`:a.run.status,timestamp:i.latestActivity||n(`common.recently`)}]:[],goalId:i.goalId,label:t.text,schedule:t.evidence??n(`schedule.summary`),scheduleId:t.todoId,scheduleKind:`monitor`,sessionId:a?.run.sessionId,status:t.done||t.status===`paused`?`paused`:`active`,stopCondition:n(`drawer.scheduleDefaultStop`),target:t.text,timezone:`Asia/Shanghai`}})});let a=e.timeline?.find(e=>e.kind===`proposal`&&e.proposal.actionKind===`heartbeat.bind`&&e.proposal.goalId===i.goalId);if(a){let e=e=>a.proposal.fields.find(t=>t.key===e)?.value;r.push({id:`schedule:${i.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:[],goalId:i.goalId,label:`${n(`schedule.heartbeat`)} · ${i.title}`,nextRunAt:n(`drawer.schedulePending`),notificationRule:n(`drawer.scheduleDefaultNotification`),schedule:e(`cadence`)??n(`schedule.summary`),scheduleId:`${i.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:a.proposal.status===`applied`?`active`:`draft`,stopCondition:e(`stop_condition`)??n(`drawer.scheduleDefaultStop`),timezone:e(`timezone`)??`Asia/Shanghai`}})}return r}function SS(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function CS(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 wS(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 TS(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 ES(e,t){let n=TS(e),r=Ny(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`?Wy(Uy(e.receipt),t):t(`proposal.summary.teamPlan`,{goal:zy(e.normalized_parameters),count:Ry(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`?wS(e,r,t):e.action_kind===`team.plan`?Ly(e.normalized_parameters,t):CS(e.normalized_parameters,t),goalId:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:void 0,impact:e.action_kind===`operation.execute`?t(`proposal.impact.operation`):e.action_kind===`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`):t(`proposal.impact.default`),previewId:e.proposal_id,lifecycleOperation:n,gate:e.gate?{kind:String(e.gate.kind??`protected_action`),nextAction:typeof e.gate.next_action==`string`?e.gate.next_action:void 0,summary:String(e.gate.summary??t(`proposal.gate.default`))}:void 0,primaryLabel:e.action_kind===`operation.execute`?o?.kind===`result`?o.resultDeliveryVerified?t(`proposal.primary.operationResultVerified`):t(`proposal.primary.operationResultPending`):t(`proposal.primary.operationGroup`):e.action_kind===`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:e.status===`applied`&&e.action_kind!==`operation.execute`&&r.interaction!==`completed`?`error`:SS(e.status),teamPlanOutcome:e.action_kind===`team.plan`?Uy(e.receipt)??void 0:void 0,teamPlanAssignments:e.action_kind===`team.plan`?By(e.receipt,e.normalized_parameters):void 0,teamPlanGapLanes:e.action_kind===`team.plan`?Vy(e.receipt,e.normalized_parameters):void 0,title:c}}function DS(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 OS(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 kS(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 AS(e,t){let n=kS(e,[`目标`,`Objective`]),r=kS(e,[`完成标准`,`Completion criteria`]),i=kS(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||OS(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 jS(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 MS(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 NS(e,t){return kS(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 PS(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 FS(e,t){let n=e.toLowerCase();return t.find(e=>n.includes(e.agentId.toLowerCase())||n.includes(e.label.toLowerCase()))}function IS(e){let t=kS(e,[`标题`,`任务标题`,`Todo 标题`]),n=kS(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 LS=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),RS=5242880,zS=4;function BS(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 VS({agents:e=[{agentId:`codex`,available:!0,capability:`代码与项目执行`,label:`Codex`}],callbacks:t={},goalArchiveLoadState:n={error:null,phase:`ready`},managerChannelBinding:r,managerRuntime:i,model:a,readOnly:o=!1,selectedAgentId:s,selectedGoalId:c,statusSourceControl:l}){let{locale:u,t:d}=Ji(),[f,p]=(0,z.useState)(c??null),[m,h]=(0,z.useState)(s??e.find(e=>e.available)?.agentId??`codex`),[g,_]=(0,z.useState)(null),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(null),[S,C]=(0,z.useState)({}),[w,T]=(0,z.useState)(`chat`),[E,D]=(0,z.useState)(!1),[O,k]=(0,z.useState)(!1),[ee,te]=(0,z.useState)(!1),[A,j]=(0,z.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{}}}),[M,ne]=(0,z.useState)(!1),[N,P]=(0,z.useState)([]),[re,ie]=(0,z.useState)(null),[ae,F]=(0,z.useState)(null),[oe,I]=(0,z.useState)(()=>new Set),[se,L]=(0,z.useState)(()=>new Set),[ce,le]=(0,z.useState)(`idle`),[ue,de]=(0,z.useState)([]),[fe,pe]=(0,z.useState)([]),[me,he]=(0,z.useState)(!1),[ge,_e]=(0,z.useState)(dS),[ve,ye]=(0,z.useState)({}),[be,xe]=(0,z.useState)([]),Se=(0,z.useRef)(!1),Ce=(0,z.useRef)(NaN),we=(0,z.useRef)(null),Te=(0,z.useRef)(null),Ee=(0,z.useRef)(null),De=(0,z.useRef)(null),Oe=(0,z.useRef)(new Set),ke=(0,z.useRef)(new Set),[Ae,je]=(0,z.useState)(null),R=c===void 0?f:c,Me=s??m,Ne=`${R??`manager`}:${Me}`,Pe=A[Ne]??``;(0,z.useEffect)(()=>{P([]),ie(null)},[Ne]);function Fe(e,t){j(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 Ie(e){Fe(Ne,e)}function Le(e){return vh.find(t=>t.id===e)?.prompt??``}(0,z.useEffect)(()=>{let e=we.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[Pe]);let Re=(0,z.useMemo)(()=>a.goals.map(e=>{let t=ve[e.goalId];return t?{...e,repository:{branch:t.branch,identity:t.identity,label:t.label,readOnly:!0}}:e}),[ve,a.goals]),ze=(0,z.useMemo)(()=>Re.filter(e=>qy(e)===`needs_you`).length,[Re]),Be=(0,z.useMemo)(()=>Re.filter(e=>qy(e)===`needs_you`&&(e.needsYouBlocking||e.state===`等你`)).length,[Re]),V=Re.find(e=>e.goalId===R)??null;function Ve(e){Ee.current=document.activeElement instanceof HTMLElement?document.activeElement:null,he(!1),_(e)}function He(){_(null),window.requestAnimationFrame(()=>{let e=Ee.current;e?.isConnected&&e.getClientRects().length?e.focus({preventScroll:!0}):document.querySelector(`.personal-mobile-menu`)?.focus({preventScroll:!0})})}let Ue=g?.kind===`settings`,We=R,Ge=(0,z.useMemo)(()=>{let e=Object.values(S).filter(e=>e.actionKind===`heartbeat.bind`&&e.goalId&&e.status===`applied`).map(e=>({id:`schedule:${e.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:Me,executionHistory:[],goalId:e.goalId,label:e.title,nextRunAt:d(`drawer.schedulePending`),notificationRule:d(`drawer.scheduleDefaultNotification`),schedule:e.fields.find(e=>e.key===`cadence`)?.value??d(`schedule.summary`),scheduleId:`${e.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:e.status===`applied`?`active`:`draft`,stopCondition:e.fields.find(e=>e.key===`stop_condition`)?.value??d(`drawer.scheduleDefaultStop`),timezone:e.fields.find(e=>e.key===`timezone`)?.value??`Asia/Shanghai`}})),t=[...xS(a,We,d),...a.timeline??[],...e,...hS(Object.values(S)).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)||ue.includes(e.proposal.previewId)).filter(e=>!R||e.kind===`message`?!0:e.kind===`proposal`?!e.proposal.goalId||e.proposal.goalId===R:e.kind===`attention`?e.attention.goalId===R:e.kind===`run`?e.run.goalId===R:e.kind===`schedule`?e.schedule.goalId===R:e.output.goalId===R)},[We,a,S,Me,R,ue,d]),Ke=(0,z.useMemo)(()=>b?Ge.filter(e=>e.kind===`message`?!0:e.kind===`run`?e.run.runId===b.runId:e.kind===`output`&&e.output.runId===b.runId):Ge,[b,Ge]);(0,z.useEffect)(()=>{if(!b)return;let e=Ge.find(e=>e.kind===`run`&&e.run.runId===b.runId);!e||e.kind!==`run`||JSON.stringify({completedSteps:b.completedSteps,latestActivity:b.latestActivity,messages:b.sessionMessages,sessionStatus:b.sessionStatus,status:b.status,totalSteps:b.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})&&x(e.run)},[b,Ge]);let qe=(0,z.useMemo)(()=>Ge.flatMap(e=>e.kind===`message`?[e.message]:[]),[Ge]),Je=(0,z.useMemo)(()=>V?Ge.flatMap(e=>e.kind===`message`?[e.message]:[]):[],[Ge,V]);(0,z.useEffect)(()=>{V||E||qe.some(e=>e.pending)&&k(!0)},[E,qe,V]),(0,z.useEffect)(()=>{!V||w===`chat`||Je.some(e=>e.pending)&&te(!0)},[Je,V,w]);let Ye=(0,z.useMemo)(()=>Ge.filter(e=>e.kind===`message`||e.kind===`proposal`&&(ue.includes(e.proposal.previewId)||fe.includes(e.proposal.previewId))),[Ge,ue,fe]),Xe=Ye[Ye.length-1],Ze=Xe?.kind===`message`?Xe.message.text.length:0;(0,z.useEffect)(()=>{if(!E||!Te.current)return;let e=window.requestAnimationFrame(()=>{Te.current&&(Te.current.scrollTop=Te.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[Ye.length,E,Ze]);let Qe=(0,z.useMemo)(()=>{if(g?.kind===`settings`)return null;if(g?.kind===`attention`)return{kind:`attention`,item:Jd(g.item,a.attentionHistory??a.userTodos)};if(g?.kind===`goal`){let e=Re.find(e=>e.goalId===g.item.goalId);return e?{item:e,kind:`goal`}:g}if(g?.kind!==`run`)return g;let e=Ge.find(e=>e.kind===`run`&&e.run.runId===g.item.runId);return e?{item:e.run,kind:`run`}:g},[Ge,g,Re,a.attentionHistory,a.userTodos]);(0,z.useEffect)(()=>{if(o){ye({}),xe([]);return}let e=!1;return Promise.all([Xg(),s_()]).then(([t,n])=>{e||(ye(Object.fromEntries(t.map(e=>[e.goal_id,e.repository]))),xe(n))}).catch(()=>{}),()=>{e=!0}},[o]),(0,z.useEffect)(()=>{if(!me)return;function e(e){e.key===`Escape`&&he(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[me]),(0,z.useEffect)(()=>{if(R||!Ge.length)return;if(!Se.current){Se.current=!0;try{Ce.current=Date.parse(window.localStorage.getItem(`loopx-pw-last-visit`)??``),window.localStorage.setItem(`loopx-pw-last-visit`,new Date().toISOString())}catch{Ce.current=NaN}}let e=Ce.current,t=Ge.filter(e=>e.kind===`run`).map(e=>e.run),n=t=>{let n=Date.parse(t??``);return!Number.isNaN(e)&&!Number.isNaN(n)&&n>e},r={attention:ze,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};je(e=>e?.attention===r.attention&&e.done===r.done&&e.failed===r.failed?e:r)},[Ge,ze,R]),(0,z.useEffect)(()=>{if(o){C({});return}let e=!1;return Hh(R?{goalId:R}:{contextKind:`manager`}).then(t=>{if(e)return;let n=t.filter(e=>[`preview_ready`,`gated`,`deferred`,`applying`].includes(e.status)||e.action_kind===`operation.execute`&&e.status===`applied`).map(e=>ES(e,d)),r=Object.fromEntries(n.map(e=>[e.previewId,e]));C(e=>({...e,...r})),R||pe(n.map(e=>e.previewId))}).catch(()=>{}),()=>{e=!0}},[o,R,d]);async function $e(e,n={}){if(o)throw Error(d(`source.readOnlyWriteError`));let r;try{r=t.onPreviewAction?await t.onPreviewAction(e):ES(await Bh(e),d)}catch(t){if(!(t instanceof Fh)||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??d(`proposal.workspaceGate.defaultSummary`))},impact:d(o?`proposal.workspaceGate.agentImpact`:`proposal.workspaceGate.selectionImpact`),previewId:`workspace-choice-${Date.now().toString(36)}`,sourceRequest:e,status:`gated`,title:d(o?`proposal.workspaceGate.agentTitle`:`proposal.workspaceGate.selectionTitle`),workspaceCandidates:i}}return de(e=>e.includes(r.previewId)?e:[...e,r.previewId]),C(e=>({...e,[r.previewId]:r})),n.select!==!1&&_({item:r,kind:`proposal`}),r}function et(){lt(null),Fe(`manager:${Me}`,d(`composer.createGoalTemplate`)),window.requestAnimationFrame(()=>we.current?.focus())}async function tt(e,n){he(!1);let r={delete:`Deleted from the owner workspace`,resume:`Resumed from the owner workspace`,stop:`Stopped from the owner workspace`},i={delete:d(`proposal.summary.lifecycleDelete`,{title:e.title}),resume:d(`proposal.summary.lifecycleResume`,{title:e.title}),stop:d(`proposal.summary.lifecycleStop`,{title:e.title})},a=null,o=!1;try{if(n===`stop`){if(Oe.current.has(e.goalId))return;Oe.current.add(e.goalId),I(new Set(Oe.current)),_(null),a={goalId:e.goalId,next:`stopped`,optimisticApplied:!0,previous:e.activationState},F(d(`feedback.applying`,{title:i.stop})),t.onGoalActivationStateChange?.(e.goalId,`stopped`)}if(t.onExecuteGoalLifecycle){if(n===`delete`)throw Error(`The selected status source does not authorize Goal deletion.`);let a=await t.onExecuteGoalLifecycle({goalId:e.goalId,operation:n,reason:r[n]});if(!a.projectionVerified)throw Error(`Goal lifecycle projection did not verify.`);o=!0,t.onGoalActivationStateChange?.(e.goalId,a.activationState),F(d(`feedback.completed`,{title:i[n]})),n===`stop`&<(null),await at([e.goalId]);return}let s=await $e({actionKind:`goal.lifecycle`,context:{kind:`goal_directory`,goal_id:e.goalId},idempotencyKey:`workspace-goal-${n}-${e.goalId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:n,reason:r[n]},summary:i[n]},{select:n!==`stop`});if(s.goalId!==e.goalId||s.lifecycleOperation!==n)throw _(null),Error(d(`actionReview.targetChanged`));n===`stop`&&(s.reviewPlan?.interaction===`direct`?(o=!0,await ot(s,{lifecycleProjection:a??void 0,presentation:`feedback`})):(a&&t.onGoalActivationStateChange?.(a.goalId,a.previous),F(s.gate?d(`feedback.gateRequired`,{summary:s.gate.summary}):d(`feedback.notCompleted`,{status:s.status})),_({item:s,kind:`proposal`})))}catch(e){a&&!o&&t.onGoalActivationStateChange?.(a.goalId,a.previous),F(d(`feedback.executionFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{n===`stop`&&(Oe.current.delete(e.goalId),I(new Set(Oe.current)))}}function nt(e,t){Ie(d(t?e===`heartbeat`?`composer.heartbeatTemplate`:`composer.monitorTemplate`:e===`heartbeat`?`composer.heartbeatTemplateWithoutGoal`:`composer.monitorTemplateWithoutGoal`)),_(null),window.requestAnimationFrame(()=>we.current?.focus())}async function rt(e,n,r=``){let i=await t.onRequestScheduleConfig?.(e,n);if(i){de(e=>e.includes(i.previewId)?e:[...e,i.previewId]),C(e=>({...e,[i.previewId]:i})),_({item:i,kind:`proposal`});return}if(!n){Ie(d(e===`heartbeat`?`composer.heartbeatGoalQuestion`:`composer.monitorGoalQuestion`));return}let a=Date.now().toString(36);await $e({actionKind:e===`heartbeat`?`heartbeat.bind`:`monitor.create`,context:{kind:`schedule`,goal_id:n},idempotencyKey:`workspace-${e}-${n}-${a}`,normalizedParameters:e===`heartbeat`?{agent_id:Me,cadence:jS(r),goal_id:n,stop_condition:PS(r),timezone:`Asia/Shanghai`}:{agent_id:Me,cadence:jS(r),goal_id:n,stop_condition:PS(r),target:NS(r,d),target_key:`goal-${n}`,timezone:`Asia/Shanghai`},summary:e===`heartbeat`?d(`proposal.summary.heartbeat`):d(`proposal.summary.monitor`,{target:NS(r,d)})})}async function it(e){if(!ke.current.has(e.todoId)){ke.current.add(e.todoId),L(new Set(ke.current)),F(d(`feedback.preparingPreview`,{title:e.text}));try{await $e({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:d(`tasks.markComplete`,{name:e.text})}),F(null)}catch(e){F(d(`feedback.previewFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{ke.current.delete(e.todoId),L(new Set(ke.current))}}}function at(e){let n=t.onReconcileStatus,r=n?n({invalidateGoalIds:e}):t.onRefresh?.();return Promise.resolve(r).catch(()=>{F(d(`feedback.goalRefreshFailed`))})}async function ot(e,n={}){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=n.presentation!==`feedback`,o=e.actionKind===`goal.lifecycle`&&e.goalId&&(e.lifecycleOperation===`stop`||e.lifecycleOperation===`resume`)?{goalId:e.goalId,next:e.lifecycleOperation===`stop`?`stopped`:`active`,optimisticApplied:!1,previous:a.goals.find(t=>t.goalId===e.goalId)?.activationState??(e.lifecycleOperation===`stop`?`active`:`stopped`)}:null,s=n.lifecycleProjection??o;F(d(`feedback.applying`,{title:e.title}));let c={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`pending`,reason:`apply_pending`,canApply:!1}:void 0,status:`applying`};C(t=>({...t,[e.previewId]:c})),i&&_({item:c,kind:`proposal`}),s&&!s.optimisticApplied&&t.onGoalActivationStateChange?.(s.goalId,s.next);try{if(t.onApplyProposal){await t.onApplyProposal(e);let n={...e,status:`applied`};C(t=>({...t,[e.previewId]:n})),i&&_({item:n,kind:`proposal`}),F(d(`feedback.completed`,{title:e.title})),e.actionKind===`goal.lifecycle`&&((e.lifecycleOperation===`stop`||e.lifecycleOperation===`delete`)&<(null),e.lifecycleOperation===`delete`&&e.goalId&&t.onGoalDeleted?.(e.goalId),at(e.goalId?[e.goalId]:void 0));return}let n=await Uh(e.previewId);if(n.proposal.proposal_id!==e.previewId||n.proposal.action_kind!==e.actionKind||e.actionKind===`goal.lifecycle`&&(n.proposal.normalized_parameters.goal_id!==e.goalId||TS(n.proposal)!==e.lifecycleOperation))throw new Fh(d(`actionReview.targetChanged`),{error_code:`action_response_mismatch`});let r=ES(n.proposal,d);if(C(t=>({...t,[e.previewId]:r})),i&&_({item:r,kind:`proposal`}),r.reviewPlan?.interaction!==`completed`){s&&t.onGoalActivationStateChange?.(s.goalId,s.previous),_({item:r,kind:`proposal`}),F(n.proposal.status===`stale`?d(`feedback.stale`):d(`actionReview.${r.reviewPlan.reason}`));return}F(d(`feedback.completed`,{title:r.title})),r.actionKind===`todo.create`&&await t.onRefresh?.(),r.actionKind===`goal.lifecycle`&&(r.lifecycleOperation===`stop`||r.lifecycleOperation===`delete`)&<(null),r.actionKind===`goal.lifecycle`&&r.lifecycleOperation===`delete`&&r.goalId&&t.onGoalDeleted?.(r.goalId),r.actionKind===`goal.lifecycle`&&at(r.goalId?[r.goalId]:void 0)}catch(n){if(s&&t.onGoalActivationStateChange?.(s.goalId,s.previous),n instanceof Fh&&n.payload.error_code===`protected_action`){let r=n.payload.gate,i=r&&typeof r==`object`?r:{},a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`gated`,reason:`authority_gate`,canApply:!1}:void 0,gate:{kind:String(i.kind??`protected_action`),nextAction:typeof i.next_action==`string`?i.next_action:void 0,summary:String(i.summary??n.message)},status:`gated`};C(t=>({...t,[e.previewId]:a})),_({item:a,kind:`proposal`}),F(d(`feedback.gateRequired`,{summary:a.gate.summary})),e.actionKind===`goal.create`&&e.goalId&&(t.onRefresh?.(),lt(e.goalId));return}let r=n instanceof Fh&&Py(n.payload),i=n instanceof Fh&&n.payload.error_code===`action_response_mismatch`,a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:r?`refresh`:`repair`,reason:i?`readback_unverified`:r?`stale_proposal`:`apply_failed`,canApply:!1}:void 0,errorMessage:n instanceof Error?n.message:String(n),status:r?`stale`:`error`};C(t=>({...t,[e.previewId]:a})),_({item:a,kind:`proposal`}),F(d(`feedback.executionFailed`,{error:a.errorMessage}))}}let st={...t,onOpenRunSession:async e=>{e.goalId!==R&<(e.goalId),T(`chat`),await t.onOpenRunSession?.(e),x(e),_(null)},onOpenGoal:e=>{lt(e),at([e])},onOpenGoalView:e=>{T(e),e===`chat`&&x(null),_(null)},onOpenOutput:e=>{e.goalId!==R&<(e.goalId),T(`files`),t.onOpenOutput?.(e)},onApplyProposal:ot,onCancelProposal:async e=>{_(null),C(t=>{let n={...t};return delete n[e.previewId],n});try{t.onCancelProposal?.(e),t.onCancelProposal||await Wh(e.previewId)}catch(t){C(t=>({...t,[e.previewId]:e})),F(d(`feedback.cancelFailed`,{error:t instanceof Error?t.message:String(t)}))}},onTransitionProposal:async(e,t)=>{let n=ES(await Gh(e.previewId,t),d);de(e=>e.includes(n.previewId)?e:[...e,n.previewId]),C(r=>{let i={...r};return t===`regenerate`&&delete i[e.previewId],i[n.previewId]=n,i}),_({item:n,kind:`proposal`})},onSelectWorkspaceCandidate:async(e,t)=>{e.sourceRequest&&(C(t=>{let n={...t};return delete n[e.previewId],n}),await $e({...e.sourceRequest,idempotencyKey:`${e.sourceRequest.idempotencyKey}-${t}`,normalizedParameters:{...e.sourceRequest.normalizedParameters,workspace_ref:t}}))},onPreviewAction:$e,onRequestScheduleConfig:(e,t)=>nt(e,t),onOpenNotificationSettings:e=>Ve({goalId:e,kind:`settings`,tab:`lark`}),onFetchNotificationTargets:()=>mg(),onSetupGoalChannel:e=>gg(e),onToggleGoalAutoNotify:e=>_g(e),onUpdateSchedule:async(e,t)=>{let n=Date.now().toString(36),r=e.scheduleKind===`heartbeat`;await $e({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??Me,...!r&&t===`run_now`?{endpoint_id:Me}:{},...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}`})}},ct=o?{onOpenGoal:st.onOpenGoal,onOpenGoalView:st.onOpenGoalView,onOpenOutput:st.onOpenOutput}:st;function lt(e){p(e),D(!1),k(!1),te(!1),x(null),_(null),T(`tasks`),he(!1),t.onSelectGoal?.(e)}function ut(e){h(e),t.onSelectAgent?.(e)}function dt(e){_e(e),fS(e)}async function ft(n){let r=n?[]:N,i=(n??Pe).trim()||(r.length?d(`composer.imageAnalysisPrompt`):``);if(!(!i||M)){n||(Ie(``),P([])),ie(null),ne(!0);try{if(r.length){R?w!==`chat`&&te(!0):k(!0);let e=await t.onSendMessage?.(i,Me,R,r);e&&await $e(e);return}let n=Cb(i,{agents:e.map(e=>({agentId:e.agentId,label:e.label})),goalId:R,todos:(V?.agentTodos??[]).map(e=>({text:e.text,todoId:e.todoId}))});if(n.route===`clarify`){Ie(i);let e=d(`composer.clarifySingleAction`);n.missingFields.includes(`resume_when`)&&(e=d(`composer.clarifyDefer`)),F(e);return}if(n.actionKind===`goal.create`){let e=AS(i,d),t=DS(e.title);await $e({actionKind:`goal.create`,context:{kind:`manager`,goal_id:null,natural_language:i},idempotencyKey:`workspace-goal-intent-${t}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Me,completion_criteria:e.completionCriteria,execution_boundary:e.executionBoundary,goal_id:t,heartbeat:{cadence:jS(i),enabled:n.normalizedParameters.heartbeat_enabled===!0,timezone:`Asia/Shanghai`},initial_todos:e.initialTodos,objective:e.objective,permission:e.permission,stop_condition:PS(i),title:e.title,workspace_ref:`current`},summary:d(`proposal.summary.goalCreate`,{title:e.title})});return}if(R&&n.actionKind===`heartbeat.bind`){await rt(`heartbeat`,R,i);return}if(R&&n.actionKind===`monitor.create`){let e=MS(i,d);if(e){Ie(i),F(e);return}await rt(`monitor`,R,i);return}let a=FS(i,e);if(R&&a&&n.actionKind===`agent.bind`){await $e({actionKind:`agent.bind`,context:{kind:`goal`,goal_id:R,natural_language:i},idempotencyKey:`workspace-agent-bind-${R}-${a.agentId}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:a.agentId,goal_id:R},summary:`将 ${a.label} 绑定到 ${V?.title??R}`});return}if(R&&n.actionKind===`todo.create`){if(n.normalizedParameters.start_execution===!0){await $e({actionKind:`todo.create`,context:{kind:`goal`,goal_id:R,natural_language:i},idempotencyKey:`workspace-task-start-${R}-${Date.now().toString(36)}`,normalizedParameters:{endpoint_id:a?.agentId??Me,goal_id:R,start_execution:!0,text:i},summary:`交给 Agent 执行:${i.slice(0,120)}`});return}let e=a?.agentId??(/(交给|分配给|让).{0,24}(agent|codex|claude|kiro|kimi)/iu.test(i)?Me:null);await $e({actionKind:`todo.create`,context:{kind:`goal`,goal_id:R,natural_language:i},idempotencyKey:`workspace-todo-create-${R}-${Date.now().toString(36)}`,normalizedParameters:{...e?{endpoint_id:e}:{},goal_id:R,text:IS(i)},summary:`创建 Todo:${IS(i)}`});return}let o=V?.agentTodos.find(e=>i.includes(e.todoId)||i.includes(e.text)),s=typeof n.normalizedParameters.operation==`string`?n.normalizedParameters.operation:null;if(R&&o&&n.actionKind===`todo.update`&&s){await $e({actionKind:`todo.update`,context:{kind:`todo`,goal_id:R,todo_id:o.todoId,natural_language:i},idempotencyKey:`workspace-todo-update-${o.todoId}-${s}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Me,...s===`reassign`&&a?{endpoint_id:a.agentId}:{},...s===`block`?{note:i}:{},...s===`defer`&&typeof n.normalizedParameters.resume_when==`string`?{resume_when:n.normalizedParameters.resume_when}:{},goal_id:R,operation:s,todo_id:o.todoId},summary:`更新 Todo:${o.text}`});return}R?w!==`chat`&&te(!0):k(!0);let c=await t.onSendMessage?.(i,Me,R);c&&await $e(c)}catch(e){n||(Ie(i),P(r));let t=e instanceof Error?e.message:d(`feedback.sendGenericError`);F(d(`feedback.sendFailed`,{error:t}))}finally{ne(!1)}}}let pt=e.find(e=>e.agentId===Me)?.label??Me,mt=!V&&Pe.startsWith(d(`composer.createGoalDraftLead`)),ht=Ge.filter(e=>e.kind===`run`&&!!e.run.sessionId&&!!e.run.canInterrupt&&(e.run.status===`running`||e.run.status===`queued`)).length;async function gt(e){if(!e?.length)return;let t=zS-N.length,n=Array.from(e).slice(0,Math.max(0,t)),r=n.find(e=>!LS.has(e.type)),i=n.find(e=>e.size>RS);if(t<=0){ie(d(`composer.imageCountError`,{count:zS}));return}if(r){ie(d(`composer.imageTypeError`));return}if(i){ie(d(`composer.imageSizeError`,{size:RS/1024/1024}));return}try{let t=await Promise.all(n.map(e=>BS(e,d)));P(e=>[...e,...t].slice(0,zS)),ie(e.length>n.length?d(`composer.imageCountError`,{count:zS}):null)}catch(e){ie(e instanceof Error?e.message:d(`composer.imageReadGenericError`))}finally{De.current&&(De.current.value=``)}}function _t(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(),gt(t))}async function vt(){let e=await s_();xe(e)}async function yt(){await Promise.all([vt(),t.onRefresh?.()])}async function bt(){if(!(!t.onRefresh||ce===`loading`)){le(`loading`);try{await t.onRefresh(),le(`done`)}catch{le(`error`)}window.setTimeout(()=>le(`idle`),1800)}}let xt=Ue?(0,B.jsx)(cS,{callbacks:ct,focusGoalConnection:!!(g?.kind===`settings`&&g.goalId),goalNotifications:a.goalNotifications??[],goals:Re,initialGoalId:g?.kind===`settings`?g.goalId??R:R,initialTab:g?.kind===`settings`?g.tab??`lark`:`lark`,onChanged:()=>void yt(),onClose:He,onThemeChange:dt,theme:ge}):null;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{hidden:Ue,children:(0,B.jsx)(pS,{drawer:Qe?(0,B.jsx)(Mb,{agents:e,attentionHistory:a.attentionHistory??a.userTodos,onSelectAttention:e=>_({kind:`attention`,item:e}),callbacks:ct,goalNotifications:a.goalNotifications??[],goals:Re,inspectorExpanded:v,larkConnections:o?[]:be,onClose:()=>{Qe.kind===`proposal`&&[`applied`,`rejected`].includes(Qe.item.status)&&(Qe.item.actionKind!==`heartbeat.bind`||Qe.item.status!==`applied`)&&C(e=>{let t={...e};return delete t[Qe.item.previewId],t}),y(!1),_(null)},onToggleInspectorSize:()=>y(e=>!e),readOnly:o,runs:Ge.flatMap(e=>e.kind===`run`?[e.run]:[]),selection:Qe}):null,drawerMode:Qe?.kind===`todo`?v?`inspector-full`:`inspector`:`panel`,drawerOpen:Qe!==null,mobileSidebarOpen:me,onCloseMobileSidebar:()=>he(!1),theme:ge,main:(0,B.jsxs)(`div`,{className:`personal-channel`,children:[(0,B.jsx)(tb,{agents:e,managerChatOpen:E,managerChannelBinding:r,managerRuntime:i,mobileNavigationOpen:me,onOpenGoalCapabilities:V&&!o?()=>Ve({goalId:V.goalId,kind:`settings`,tab:`capabilities`}):void 0,onRefresh:t.onRefresh?()=>void bt():void 0,onOpenNavigation:()=>he(!0),onOpenManagerChat:()=>{k(!1),D(!0)},onSelectGoalTab:e=>{T(e),e===`chat`&&(x(null),te(!1))},onSelectAgent:ut,onReturnManagerHome:()=>{D(!1),k(!1),window.requestAnimationFrame(()=>Te.current?.scrollTo({behavior:`smooth`,top:0}))},selectedAgentId:Me,refreshState:ce,readOnlySourceLabel:o?l?.activeSource.label:void 0,selectedGoal:V,selectedGoalTab:w}),(0,B.jsxs)(`div`,{className:`personal-channel-scroll`,"data-active-goal-view":V?w:void 0,ref:Te,children:[!V&&!E&&Ae&&Ae.done+Ae.failed+Ae.attention>0?(0,B.jsxs)(`section`,{className:`personal-digest-card`,"aria-label":d(`digest.away`),children:[(0,B.jsx)(`strong`,{children:d(`digest.away`)}),(0,B.jsxs)(`div`,{className:`personal-digest-stats`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:Ae.done}),d(`digest.completed`)]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:Ae.failed}),d(`digest.failed`)]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:Ae.attention}),d(`digest.needsYou`)]})]})]}):null,!V&&!E?(0,B.jsxs)(`section`,{className:`personal-manager-greeting`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(nm,{size:20})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:d(`home.greeting`)}),(0,B.jsx)(`p`,{children:a.goals.some(e=>e.activationState===`active`&&e.loadState)?d(`startup.partial`):(0,B.jsxs)(B.Fragment,{children:[d(`home.waitingCount`,{count:ze}),` `,d(`home.blockingSummary`,{count:Be})]})})]})]}):null,V?.loadState?(0,B.jsx)(`section`,{className:`personal-manager-greeting`,role:`status`,"data-testid":`goal-status-loading`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:d(V.loadState===`error`?`startup.goalError`:`startup.goalLoading`)}),(0,B.jsx)(`p`,{children:d(V.loadError?`startup.error.${V.loadError}`:`startup.independent`)}),V.loadState===`error`?(0,B.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,type:`button`,onClick:()=>void t.onRefresh?.(),children:d(`startup.retry`)}):null]})}):V?(0,B.jsx)(bx,{activeTab:w,scrollRef:Te,panels:{overview:(0,B.jsx)(yx,{active:!Ue&&w===`overview`,goal:V,items:Ge,userTodos:a.userTodos,readOnly:o,onOpenDetails:()=>_({kind:`goal`,item:V}),onSelect:_,onView:T}),tasks:(0,B.jsx)(ix,{historyEnabled:!o,goal:V,items:Ge,onDraftTaskFromMessage:o?void 0:e=>{Ie(`创建一个 Task:${mS(e)}`),F(d(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>we.current?.focus())},onOpenChat:()=>T(`chat`),onQuickComplete:o?void 0:it,onSelect:_,quickCompletingTodoIds:se,selectedTodoId:Qe?.kind===`todo`?Qe.item.todoId:null,userTodos:a.userTodos}),files:(0,B.jsx)(vS,{items:Ge.filter(e=>e.kind===`output`),onSelect:_,reportState:a.periodicReports}),chat:(0,B.jsxs)(B.Fragment,{children:[V&&b?.goalId===V.goalId?(0,B.jsx)(bS,{onClose:()=>x(null),onOpenDetails:()=>_({item:b,kind:`run`}),run:b}):null,(0,B.jsx)(mb,{items:Ke,onSelect:_,selectedGoal:V})]})}},`${l?.activeSource.statusUrl??`/status.json`}:${V.goalId}`):E?(0,B.jsx)(mb,{items:Ye,onSelect:_,selectedGoal:null}):(0,B.jsx)(_S,{goals:Re,onRetry:()=>void t.onRefresh?.(),onSelectGoal:lt,systemHealth:a.systemHealth})]}),(0,B.jsx)(`div`,{className:`personal-composer-wrap`,children:o?(0,B.jsxs)(`div`,{className:`personal-read-only-notice`,children:[(0,B.jsx)(`strong`,{children:d(`source.readOnlyNoticeTitle`)}),(0,B.jsx)(`span`,{children:d(`source.readOnlyNoticeDescription`)})]}):(0,B.jsxs)(B.Fragment,{children:[!V&&!E&&O&&qe.length?(0,B.jsx)(yS,{messages:qe,onClose:()=>k(!1),onOpenConversation:()=>{k(!1),D(!0)}}):null,V&&w!==`chat`&&ee&&Je.length?(0,B.jsx)(yS,{agentLabel:pt,messages:Je,onClose:()=>te(!1),onDraftTask:w===`tasks`?e=>{Ie(`创建一个 Task:${mS(e)}`),F(d(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>we.current?.focus())}:void 0,onOpenConversation:()=>{te(!1),T(`chat`)},title:`${V.title} · ${pt}`}):null,ae?(0,B.jsxs)(`div`,{className:`personal-action-feedback`,role:`status`,children:[(0,B.jsx)(`span`,{children:ae}),(0,B.jsx)(`button`,{"aria-label":d(`common.closeActionReceipt`),onClick:()=>F(null),type:`button`,children:(0,B.jsx)(ah,{size:14})})]}):null,(0,B.jsx)(`p`,{className:`personal-composer-hint`,children:V?ht>0?d(`composer.goalRunningHint`,{agent:pt,count:ht}):d(`composer.goalMessageHint`,{agent:pt}):d(`composer.managerMessageHint`)}),V?(0,B.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,B.jsxs)(`button`,{"aria-label":d(`composer.nextAction`),disabled:M,onClick:()=>void ft(d(`composer.nextActionPrompt`)),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(Mm,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.nextAction`)})]}),(0,B.jsxs)(`button`,{"aria-label":d(`composer.agentProgress`),disabled:M,onClick:()=>void ft(d(`composer.agentProgressPrompt`)),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(Km,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.agentProgress`)})]}),(0,B.jsxs)(`button`,{"aria-label":d(`composer.monitor`),disabled:M,onClick:()=>void ft(d(`composer.monitorShortcutTemplate`,{target:d(`schedule.defaultTarget`)})),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(im,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.monitor`)})]}),(0,B.jsxs)(`button`,{"aria-label":d(`composer.blockers`),disabled:M||!Le(`gate`),onClick:()=>void ft(Le(`gate`)),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(lm,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.blockers`)})]}),(0,B.jsxs)(`button`,{"aria-label":d(`composer.evidence`),disabled:M||!Le(`evidence`),onClick:()=>void ft(Le(`evidence`)),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(xm,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.evidence`)})]})]}):(0,B.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,B.jsxs)(`button`,{"aria-label":d(`composer.globalTasks`),disabled:M,onClick:()=>void ft(d(`composer.globalTasksPrompt`)),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(Mm,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.globalTasks`)})]}),(0,B.jsxs)(`button`,{"aria-label":d(`composer.globalProgress`),disabled:M,onClick:()=>void ft(d(`composer.globalProgressPrompt`)),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(Km,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.globalProgress`)})]}),(0,B.jsxs)(`button`,{"aria-label":d(`composer.createGoal`),onClick:et,title:d(`composer.createGoalHint`),type:`button`,children:[(0,B.jsx)(Bm,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.createGoal`)})]})]}),mt?(0,B.jsxs)(`div`,{className:`personal-goal-draft-status`,role:`status`,children:[(0,B.jsx)(`strong`,{children:d(`composer.createGoalDraft`)}),(0,B.jsx)(`span`,{children:d(`composer.createGoalDraftDescription`)})]}):null,N.length?(0,B.jsx)(`div`,{className:`personal-composer-images`,"aria-label":d(`composer.imagesPending`),children:N.map(e=>(0,B.jsxs)(`figure`,{children:[(0,B.jsx)(`img`,{alt:e.name,src:e.dataUrl}),(0,B.jsx)(`button`,{"aria-label":d(`composer.sentImageAlt`,{name:e.name}),onClick:()=>P(t=>t.filter(t=>t.id!==e.id)),type:`button`,children:(0,B.jsx)(ah,{size:13})})]},e.id))}):null,re?(0,B.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:re}):null,(0,B.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(),gt(t))},children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(nm,{size:17}),e.find(e=>e.agentId===Me)?.label??Me]}),(0,B.jsx)(`button`,{"aria-label":d(`composer.addImage`),className:`personal-composer-attach`,disabled:M||N.length>=zS,onClick:()=>De.current?.click(),title:d(`composer.attachImageHint`),type:`button`,children:(0,B.jsx)(Lm,{size:17})}),(0,B.jsx)(`input`,{accept:`image/png,image/jpeg,image/webp,image/gif`,"aria-label":d(`composer.imagePicker`),className:`personal-composer-file-input`,disabled:M||N.length>=zS,multiple:!0,onChange:e=>void gt(e.target.files),ref:De,type:`file`}),(0,B.jsx)(`textarea`,{"aria-label":d(`composer.sendMessage`),onChange:e=>Ie(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),ft())},onPaste:_t,placeholder:V?d(`composer.goalPlaceholder`,{goal:V.title}):d(`composer.managerPlaceholder`),ref:we,rows:1,value:Pe}),(0,B.jsx)(`button`,{"aria-label":d(mt?`composer.createGoal`:`composer.send`),disabled:!Pe.trim()&&N.length===0||M,onClick:()=>void ft(),title:d(mt?`composer.createGoalHint`:`composer.sendMessageHint`),type:`button`,children:(0,B.jsx)(Km,{size:18})})]})]})})]}),sidebar:(0,B.jsx)(ex,{attentionCount:ze,goals:Re,goalArchiveLoadState:n,goalLifecycleOperations:t.onExecuteGoalLifecycle?[`stop`,`resume`]:void 0,lifecycleBusyGoalIds:oe,onRequestGoalCreate:o?void 0:et,onRequestGoalLifecycle:o&&!t.onExecuteGoalLifecycle?void 0:(e,t)=>void tt(e,t),onRetryGoalArchive:t.onRetryGoalArchive||t.onRefresh?()=>void(t.onRetryGoalArchive??t.onRefresh)?.():void 0,onOpenSettings:o?void 0:()=>Ve({kind:`settings`}),onSelectGoal:lt,selectedGoalId:R,statusSourceControl:l},l?.activeSource.statusUrl??`/status.json`)})}),xt]})}function HS(e){return(e??``).replace(/\s+/gu,` `).trim()}function US(e,t=120){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t-1).join(``)}…`}function WS(e,t,n){let r=HS(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`):US(r)}function GS(e,t){return t({advancing:`projection.agentAdvancingGoal`,idle:`projection.agentIdle`,needs_you:`projection.agentNeedsDecision`,stopped:`projection.agentStopped`,waiting_external:`projection.agentWaitingExternal`}[e])}function KS({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 qS=`/status.json`,JS=`loopx-status-source-catalog-v1`,YS={id:`local`,kind:`local`,label:`本机`,readOnly:!1,statusUrl:qS};function XS(e,t){let n=uh(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 ZS(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 QS(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=XS(n.statusUrl,t);if(!r||r.length>48||!(`url`in i))return null;let a=Wb(n.hostAlias)?n.hostAlias.trim():void 0;return{...a?{hostAlias:a}:{},id:ZS(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url}}function $S(){return{schemaVersion:1,sources:[YS]}}function eC(e,t){try{let n=e.getItem(JS);if(!n)return $S();let r=JSON.parse(n);if(r.schemaVersion!==1||!Array.isArray(r.sources))return $S();let i=new Set([YS.statusUrl]);return{schemaVersion:1,sources:[YS,...r.sources.flatMap(e=>{let n=QS(e,t);return!n||i.has(n.statusUrl)?[]:(i.add(n.statusUrl),[n])})]}}catch{return $S()}}function tC(e,t){e.setItem(JS,JSON.stringify({schemaVersion:1,sources:t.sources.filter(e=>e.kind===`ssh_tunnel`)}))}function nC(e,t){let n=new Set(t.filter(Wb).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 rC(e,t,n){let r=t.label.trim();if(!r)return{error:`请填写来源名称。`};if(r.length>48)return{error:`来源名称不能超过 48 个字符。`};let i=XS(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&&!Wb(t.hostAlias))return{error:`请选择有效的 SSH Host。`};let a=t.hostAlias?.trim(),o={...a?{hostAlias:a}:{},id:ZS(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url};return{catalog:{...e,sources:[...e.sources,o]},source:o}}function iC(e,t){return{...e,sources:e.sources.filter(e=>e.kind===`local`||e.id!==t)}}function aC(e,t,n){if(!t.trim()||uh(t,n).source?.isRelative)return YS;let r=t.trim();try{r=new URL(r,n).toString()}catch{return null}return e.sources.find(e=>e.statusUrl===r)??null}function oC(e,t,n){return aC(e,t,n)||(uh(t,n).source?.isRelative?YS:{id:`temporary`,kind:`ssh_tunnel`,label:`临时来源`,readOnly:!0,statusUrl:t.trim()})}function sC(e,t,n,r){return oC(e,t??n,r)}var cC={delete:`删除`,deploy:`部署`,merge:`合并`,payment:`付款`,release:`发布`};function lC(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:`请求受保护操作:${cC[n.operation]} · ${n.target}`}}var uC=qS;async function dC(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 kp(await t.json())}function fC(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 pC(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??fC(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 mC(e){return(e??``).replace(/\s+/g,` `).trim()}function hC(e,t=132){let n=mC(e);return n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}…`}function gC(e){let t=new Map;for(let n of e?.goals??[])t.set(n.goal_id,n);return t}function _C(e,t){return e===void 0||t===void 0?void 0:e+t}function vC(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 yC(e){return e?.items.find(e=>!e.done)}function bC(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 SC(e,t,n){let r=[];for(let t of e){let e=vC(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 CC(e){return e?.map(e=>({dataUrl:e.data_url,id:e.id,mimeType:e.mime_type,name:e.name,size:e.size}))}var wC=`loopx.personal-agent-selection.v1`;function TC(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(wC)??`{}`);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 EC={需修复:`danger`,等你:`warning`,等待条件:`info`,推进中:`success`,安静运行:`neutral`,已停止:`neutral`,已完成:`neutral`};function DC(e,t){return mC(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 OC(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 kC(e,t){return[`agent`,`assistant`].includes(e.trim().toLowerCase())&&t.trim().length>0}var AC=`已发现的项目 Agent`;function jC(e){switch(Sy(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 DC(e)}}function MC(e,t){switch(Cy(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 AC}}function NC(e,t){let n=e.project_asset;return t===`user`?bC(n?.user_todos,e.user_todos,`project_asset.user_todos`):bC(n?.agent_todos,e.agent_todos,`project_asset.agent_todos`)}function PC(e){return hC(e.title??e.text,112)}function FC(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 IC(e,t){return{resumeWhen:e.resume_when??null,resumeReady:e.resume_ready??null,resumeReceiptId:FC(e),claimedBy:e.claimed_by??null,done:e.status!==`deferred`&&e.done,evidence:e.evidence?hC(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:PC(e),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.index}`}}function LC(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 RC(e){return LC(e).map(t=>IC(t,e))}function zC(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=IC(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 BC(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:hC(e.title,112),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.claimed_by??`unknown`}:current`}}function VC(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=BC(t,n);r.has(i.todoId)||r.set(i.todoId,i)}return[...r.values()]}function HC(e){let t=e.queueItem?.project_asset?.agent_todos,n=e.queueItem?.agent_todos,r=LC(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=>IC(t,e)),l=r.find(e=>!e.done);return{doneTodoCount:o,nextTodoText:mC(t?.next??``)||(l?mC(l.title??``)||mC(l.text??``):``)||null,recentCompleted:c}}function UC(e,t){let n=mC(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`):WS(n,t,`projection.validationRecorded`):``}function WC(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 GC(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=[UC(r?.summary,n),WS(i?.health_check,n),WS(i?.recommended_action,n)].find(e=>e!==``&&e!==`暂无`)??n(`projection.runRecorded`),s=KS({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 KC(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 qC(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 JC(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 YC(e,t){let n=t.queueItem?.stale_latest_run_warning;return t.severity===`high`||!!qC(e,t)||!!(n?.requires_refresh_state||n?.severity===`high`)||JC(t)}function XC(e,t){let n=qC(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 ZC(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 QC(e,t){let n=e.latestRun?.operator_gate;return WS(n?.operator_question??n?.reason_summary??n?.follow_up??e.queueItem?.recommended_action??e.latestRun?.recommended_action,t,`projection.confirmAgentDecision`)}function $C(e,t){if(t.goal.activation_state===`stopped`)return`已停止`;let n=vC(t,`user`),r=vC(t,`agent`),i=!!yC(n),a=!!yC(r);return[`user_or_controller`,`controller`].includes(t.waitingOn)||i||ZC(t)?`等你`:YC(e,t)?`需修复`:t.waitingOn===`external_evidence`?`等待条件`:xC(t)===`eligible`||a?`推进中`:KC(t)?`已完成`:`安静运行`}function ew(e,t,n,r){if(n===`已停止`)return GS(`stopped`,r);if(n===`需修复`)return WS(XC(e,t),r,`projection.statusRefreshNeeded`);if(n===`等你`)return GS(`needs_you`,r);if(n===`推进中`){let e=[(vC(t,`agent`)?.items??[]).filter(e=>!e.done).flatMap(e=>[e.title,e.text]).map(e=>mC(e)).find(e=>e!==``&&e!==`暂无`),t.queueItem?.recommended_action,t.latestRun?.recommended_action].map(e=>mC(e)).find(e=>e!==``&&e!==`暂无`);return e?WS(e,r,`projection.agentAdvancingGoal`):GS(`advancing`,r)}return GS(n===`等待条件`?`waiting_external`:`idle`,r)}function tw(e,t){return t.some(t=>e.includes(t))}function nw(e,t,n){if(t.goals.some(e=>e.activationState===`active`&&e.loadState))return{text:`Goal 状态尚未全部加载,暂不能给出完整统计。可先打开已加载的 Goal,失败项可重试。`,lines:[]};if(tw(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(tw(n,[`现在`,`下一步`,`我该`,`该做什么`,`优先处理`])){let e=t.userTodos[0];if(e)return{text:e.blocking?`先处理「${DC(e.goalId)}」:${e.text}`:`当前最先处理「${DC(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(tw(n,[`等我`,`阻塞`,`需要我`,`全局待办`]))return t.userTodos.length===0?{text:`目前没有 Goal 在等你,开放用户待办为 0。`,lines:[]}:{text:`有 ${t.userTodos.length} 项开放用户待办,阻塞项优先:`,lines:t.userTodos.slice(0,3).map(e=>`${DC(e.goalId)} · ${e.blocking?`阻塞`:`待处理`} · ${e.text}`)};if(tw(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 rw(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=SC(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(NC(e,`user`)?.items??[]).map((r,i)=>({projectedDone:r.done,details:Kd(r),actionKind:r.action_kind??null,blocking:n,goalId:e.goal_id,sourceOrder:t,taskClass:r.task_class??null,text:PC(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)||!ZC(t)?[]:[{details:Kd({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:QC(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=$C(e,a),l=f.find(e=>e.goalId===t.id),u=l?.text??null,d=HC(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=VC(RC(a),h,a),b=[d.nextTodoText,a.queueItem?.recommended_action,a.latestRun?.recommended_action,ew(e,a,c,n)].map(e=>WS(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,runEvidence:GC(e,a,n),state:c,...r?{subagentExecution:{allowedDomains:t.spawn_policy?.allowed_domains??[],domainCandidates:zC(e,a,y),enabled:t.spawn_policy?.mode===`multi_subagent`&&t.spawn_policy.spawn_allowed===!0&&t.spawn_policy.max_children>0,maxChildren:t.spawn_policy?.max_children??0,modelConfig:t.spawn_policy?.model_config}}:{},title:DC(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:_C(e.input_tokens_24h,e.output_tokens_24h),tokens7d:_C(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?hC(e.current_todo.title,96):null,lastActivityAt:e.last_activity_at??null,state:e.state??null}))}}function iw({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,z.useState)([]),[b,x]=(0,z.useState)(!1),[S,C]=(0,z.useState)(null),[w,T]=(0,z.useState)(null),E=(0,z.useMemo)(()=>{let e=rw(c,u,_,b);if(!l)return e;let t=Object.values(l.snapshots).map(e=>rw(e,pC(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,ee]=(0,z.useState)(null),[te,A]=(0,z.useState)(null),[j,M]=(0,z.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:MC(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:MC(`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,z.useState)(TC),L=gh(re,I[N]??oe(N),ie),[ce,le]=(0,z.useState)(!1),[ue,de]=(0,z.useState)(!1),[fe,pe]=(0,z.useState)(`chat`),[me,he]=(0,z.useState)(``),[ge,_e]=(0,z.useState)({}),[ve,ye]=(0,z.useState)({}),[be,xe]=(0,z.useState)(null),[Se,Ce]=(0,z.useState)({}),[we,Te]=(0,z.useState)([]),[Ee,De]=(0,z.useState)(null),[Oe,ke]=(0,z.useState)({}),Ae=(0,z.useRef)(1),je=(0,z.useRef)(1),R=(0,z.useRef)(new Map),Me=(0,z.useRef)(new Set),Ne=(0,z.useRef)(new Map),Pe=(0,z.useRef)(new Map),Fe=(0,z.useRef)(new Set),Ie=(0,z.useRef)(new Set),Le=(0,z.useRef)(null),Re=(0,z.useRef)(null),ze=(0,z.useRef)(null),Be=(0,z.useRef)(null);(0,z.useRef)(null);let V=ge[N]??[];ve[N];let Ve=(e,t)=>e===`manager`?_(`header.manager`):t,He=D?E.userTodos.filter(e=>e.goalId===D.goalId):E.userTodos,Ue=D?.agentTodos??[];WC(Ue,D?.needsYou?3:4);let We=Ue.filter(e=>e.done).length,Ge=Ue.length>0?`${We}/${Ue.length}`:`暂无计划`;D&&({...E},He.filter(e=>e.blocking).length,He.length),(0,z.useEffect)(()=>{let e=lh(f.activeSource.statusUrl,window.location.href),t=e.source?ph(O,e.source):null;if(!D||!t?.indexUrl||!t.detailUrl){ee(null),A(null),M(!1);return}let{detailUrl:n,indexUrl:r}=t,i=!1;return ee(null),A(null),M(!0),mh(r,D.goalId).then(async e=>{let t=e.items[0]?.detail_ref;return t?hh(n,t):null}).then(e=>{i||ee(e)}).catch(e=>{i||A(Ap(e))}).finally(()=>{i||M(!1)}),()=>{i=!0}},[O,D?.goalId,f.activeSource.statusUrl]);let Ke=D?void 0:Se[N]?.sessionId;(0,z.useEffect)(()=>{if(h||!Ke)return;let e=!1,t,n=async()=>{try{let t=await Xh(Ke);if(e)return;let n=t.messages.filter(e=>e.origin===`manager_followup`);_e(e=>{let t=e[N]??[],r=new Set(t.map(e=>e.sourceMessageId)),i=n.filter(e=>!r.has(e.message_id)),a=new Map(n.map(e=>[e.message_id,e.return_delivery])),o=!1,s=t.map(e=>{let t=e.sourceMessageId?a.get(e.sourceMessageId):void 0;return JSON.stringify(t)===JSON.stringify(e.returnDelivery)?e:(o=!0,{...e,returnDelivery:t})});return!i.length&&!o?e:{...e,[N]:[...s,...i.map(e=>({id:Ae.current++,sourceMessageId:e.message_id,role:`assistant`,agentLabel:Ve(N,L.label),sourceLabel:`管家交接回执`,text:OC(e.text),lines:[],returnDelivery:e.return_delivery}))]}})}catch{}finally{e||(t=setTimeout(n,3e3))}};return n(),()=>{e=!0,t&&clearTimeout(t)}},[h,Ke,N,L.label]);function qe(e,t){Ce(n=>{if(t===null){let t={...n};return delete t[e],t}return{...n,[e]:t}})}(0,z.useEffect)(()=>{if(h){y([]),x(!1),C(null),T(null);return}let e=!1;return qh().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,z.useEffect)(()=>{try{window.localStorage.setItem(wC,JSON.stringify(I))}catch{}},[I]),(0,z.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 $h({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:Ve(e,L.label),attachments:CC(t.attachments),id:Ae.current++,lines:[],role:t.role===`user`?`user`:`assistant`,returnDelivery:t.return_delivery,sourceLabel:t.role===`user`?void 0:t.role===`error`?`本地会话记录`:e===`manager`?`恢复的${_(`header.manager`)}会话`:`恢复的 ${L.label} 会话`,text:t.role===`user`?t.text:OC(t.text)}))}),L.agentId===`status-only`))return;let c=s.sessions[0];if(o=c?.session_id??null,c&&!c.resumable){Me.current.add(t),qe(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 Yh(l,n===`manager`?I[e]:L.agentId,`resume_latest`,n);if(i)return;n===`manager`&&u.session.manager_runtime&&C(u.session.manager_runtime),R.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(qe(e,{agentId:u.agent_id||L.agentId,resumable:!0,sessionId:u.session_id,status:f?`running`:`ready`,turnId:f||void 0}),Me.current.delete(t),!f)return;let p=`${u.session_id}:${f}`;if(Ie.current.has(p))return;Ie.current.add(p),Ne.current.set(e,f),qe(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`running`,turnId:f}),xe(e),a=new AbortController,Pe.current.set(e,a);let m=``,h=Je(e,{activity:[`正在恢复进行中的 Agent 回合`],agentLabel:Ve(e,L.label),lines:[],pending:!0,sourceLabel:e===`manager`?`恢复的${_(`header.manager`)}会话`:`恢复的 ${L.label} 会话`,text:``});try{let t=await og(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()||`${Ve(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(_h).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 Fh&&t.payload.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t instanceof Error?t.message:`无法恢复进行中的 Agent 回合。`})}finally{Ie.current.delete(p),Ne.current.get(e)===f&&Ne.current.delete(e),qe(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`ready`}),Pe.current.get(e)===a&&Pe.current.delete(e),i||xe(t=>t===e?null:t)}}catch(n){if(i)return;n instanceof Fh&&n.payload.error_code===`resume_failed`&&(Me.current.add(t),o&&qe(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,z.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 Zh({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,z.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 Zh({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=>Xh(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,z.useEffect)(()=>{if(!ce)return;let e=window.requestAnimationFrame(()=>{Le.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()});return()=>{window.cancelAnimationFrame(e),Re.current?.focus()}},[ce]),(0,z.useEffect)(()=>{if(!ue)return;let e=window.requestAnimationFrame(()=>ze.current?.focus());return()=>{window.cancelAnimationFrame(e),Be.current?.focus()}},[ue]),(0,z.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.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?gh(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=nw(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}),Jh({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.current.get(c);if(!e){let t=Me.current.has(c)?`new`:`resume_latest`,n=r===`manager`?I[r]:a.agentId,o=await Yh(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,R.current.set(c,e),qe(r,{agentId:o.agent_id||a.agentId,resumable:!0,sessionId:e,status:`ready`}),Me.current.delete(c)}let o=``;l=Je(r,{activity:[r===`manager`?`正在连接管家`:`正在连接 Agent`],agentLabel:Ve(r,a.label),lines:[],pending:!0,sourceLabel:r===`manager`?`${_(`header.manager`)} · 跨 Goal`:`${a.label} Agent · ${DC(i.goalId)}`,text:``});let s=(await ig(e,n,{attachments:t?.attachments,signal:(()=>{let e=new AbortController;return Pe.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)=>{Ne.current.set(r,n),qe(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`running`,turnId:n})}})).response;Ye(r,l,{lines:s.gate?[s.gate.summary,s.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:OC(s.message||o.trim())||`${Ve(r,a.label)} 已完成分析。`});let u=s.proposals.filter(_h);if(u.length>0&&!i&&Ye(r,l,{lines:[`请进入要修改的 Goal,预览并确认具体变更。`]}),u.length>0&&i){let e=u.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`&&s.protected_action){let e=lC(r,n,s.protected_action);if(e)return e}}catch(e){if(Fe.current.delete(r)){let e={agentLabel:Ve(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 t=e instanceof Fh?e.payload:null;t&&yh(t)&&R.current.delete(c),t?.error_code===`resume_failed`&&(R.current.delete(c),Me.current.add(c),qe(r,{agentId:a.agentId,resumable:!1,sessionId:Se[r]?.sessionId??`resume-failed`,status:`resume_failed`}));let n=t?.gate,i=n&&typeof n==`object`?String(n.summary??``):``,o={agentLabel:Ve(r,a.label),lines:i?[i]:[],pending:!1,reconnect:t?.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t?.error_code===`resume_failed`?`原 ${Ve(r,a.label)} 会话无法恢复。本地历史已经保留,请在运行详情里选择“重试恢复”或“开始新 Session”。`:e instanceof Error?e.message:`${Ve(r,a.label)} 会话暂时不可用。`};l===null?Je(r,o):Ye(r,l,o)}finally{Ne.current.delete(r),Pe.current.delete(r);let e=R.current.get(c);e&&qe(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),xe(e=>e===r?null:e)}}async function Ze(e){let t=e?.goalId??N,n=Se[t],r=e?.agentId??n?.agentId??L.agentId,i=`${t}:${r}`,a=e?.sessionId??n?.sessionId??R.current.get(i),o=e?.turnId??n?.turnId??Ne.current.get(t);if(!(!a||!o))try{Fe.current.add(t),await rg(a,o),Pe.current.get(t)?.abort()}catch(e){throw Fe.current.delete(t),e}finally{Ne.current.delete(t),qe(t,{agentId:r,resumable:!0,sessionId:a,status:`ready`}),Pe.current.delete(t),xe(e=>e===t?null:e)}}async function Qe(e){let t=e.goalId,n=`${t}:${e.agentId}`,r=e.sessionId??Se[t]?.sessionId??R.current.get(n);if(r)try{let i=await cg(r);R.current.set(n,r),Me.current.delete(n),qe(t,{agentId:e.agentId,resumable:i.session.resumable,sessionId:r,status:i.session.status})}catch{qe(t,{agentId:e.agentId,resumable:!1,sessionId:r,status:`resume_failed`})}}function $e(e){let t=`${e.goalId}:${e.agentId}`;R.current.delete(t),Me.current.add(t),qe(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:`new-session-pending`,status:`ready`})}async function et(e){let t=`${e.goalId}:${e.agentId}`,n=e.sessionId??Se[e.goalId]?.sessionId??R.current.get(t);n&&n!==`new-session-pending`&&await sg(n),R.current.delete(t),Me.current.add(t),qe(e.goalId,null)}function tt(e){re.some(t=>t.agentId===e&&t.available)&&(se(t=>({...t,[N]:e})),le(!1))}function nt(){i(``),pe(`chat`)}function rt(e){i(e),pe(`chat`)}D&&EC[D.state],D&&(`${L.label}${D.state}`,Ue.length>0&&`${Ge}`,He.length>0&&`${He.length}`),D?.state===`需修复`||!D&&!c.ok?(D&&jC(D.agentId),D?.nextSentence,D?.agentSentence):D?.state===`等你`?(D.needsYouBlocking,D.needsYouBlocking,D.needsYou??D.nextSentence,D.needsYou):(D&&jC(D.agentId),D?.nextSentence);let it=[...!D&&Se.manager?.status===`resume_failed`?[{id:`run:manager:resume-failed`,kind:`run`,run:{agentId:Se.manager.agentId,agentLabel:jC(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=>kC(e.role,e.text))===!0;return{id:`run:task:${e.session_id}`,kind:`run`,run:{agentId:e.agent_id,agentLabel:jC(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`:kC(e.role,e.text)?`assistant`:`error`,text:e.role===`user`?e.text:OC(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?[{id:`run:${D.goalId}`,kind:`run`,run:{agentId:Se[D.goalId]?.agentId??D.agentId,agentLabel:jC(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}]:[]}}]:[],...V.map(e=>({id:`message:${e.id}`,kind:`message`,message:{agentLabel:e.agentLabel,attachments:e.attachments,id:String(e.id),pending:e.pending,returnDelivery:e.returnDelivery,role:e.role,text:e.text||(e.pending?`Agent 正在处理…`:e.lines.join(` -`))}})),...(D?[D]:E.goals).flatMap(e=>e.runEvidence?[{id:`output:${e.goalId}:${e.runEvidence.generatedAt||`latest`}`,kind:`output`,output:{agentLabel:jC(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:jC(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(` +`}function yx({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,B.jsxs)(`details`,{className:`delivery-acceptance-contract`,children:[(0,B.jsx)(`summary`,{children:n.title}),(0,B.jsxs)(`div`,{className:`delivery-acceptance-content`,children:[(0,B.jsx)(`p`,{children:n.boundary}),r?null:(0,B.jsx)(`p`,{role:`status`,className:`delivery-notice`,children:n.retained}),(0,B.jsxs)(`dl`,{className:`delivery-acceptance-source`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:n.source}),(0,B.jsx)(`dd`,{children:(0,B.jsx)(`code`,{children:e})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:n.revision}),(0,B.jsx)(`dd`,{children:t.revision})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:n.digest}),(0,B.jsx)(`dd`,{children:(0,B.jsx)(`code`,{children:t.digest})})]})]}),(0,B.jsx)(`h3`,{children:n.objective}),(0,B.jsx)(`p`,{children:t.objective||n.unknown}),t.non_goals.length?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h3`,{children:n.nonGoals}),(0,B.jsx)(`ul`,{children:t.non_goals.map((e,t)=>(0,B.jsx)(`li`,{children:e},t))})]}):null,(0,B.jsx)(`h3`,{children:n.criteria}),t.criteria.length?(0,B.jsx)(`ul`,{children:t.criteria.map(e=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`code`,{children:e.id}),` · `,e.description]},e.id))}):(0,B.jsx)(`p`,{children:n.noCriteria}),(0,B.jsx)(`h3`,{children:n.tasks}),t.tasks.length?(0,B.jsx)(`ul`,{className:`delivery-acceptance-tasks`,children:t.tasks.map(e=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`code`,{children:e.todo_id}),` · `,(0,B.jsx)(`strong`,{children:n.taskState[e.state]})]}),(0,B.jsxs)(`p`,{children:[n.criteria,`: `,e.criterion_ids.length?e.criterion_ids.join(`, `):n.unknown]}),e.applicable===!1?(0,B.jsx)(`p`,{children:n.notApplicable}):null,e.reason?(0,B.jsx)(`p`,{children:e.reason}):null]},e.todo_id))}):(0,B.jsx)(`p`,{children:n.noTasks}),(0,B.jsx)(`h3`,{children:n.verification}),(0,B.jsx)(`p`,{children:n.verificationState[t.status]}),t.held_todo_ids.length?(0,B.jsxs)(`p`,{children:[n.heldTasks,`: `,t.held_todo_ids.join(`, `)]}):null,(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:n.receipt}),t.verification?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{children:n.receiptNote}),(0,B.jsxs)(`dl`,{className:`delivery-acceptance-source`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:n.operation}),(0,B.jsx)(`dd`,{children:(0,B.jsx)(`code`,{children:t.verification.operation_id})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:n.revision}),(0,B.jsx)(`dd`,{children:t.verification.contract_revision})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:n.digest}),(0,B.jsx)(`dd`,{children:(0,B.jsx)(`code`,{children:t.verification.contract_digest})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:n.verificationScope}),(0,B.jsx)(`dd`,{children:t.verification.todo_id??n.allCriteria})]})]}),(0,B.jsx)(`ul`,{children:t.verification.results.map(e=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`code`,{children:e.criterion_id}),` · `,e.passed?n.passed:n.failed,` · `,n.exitCode,`: `,e.exit_code??n.unknown]},e.criterion_id))})]}):(0,B.jsx)(`p`,{children:n.unknown})]}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:n.help}),(0,B.jsx)(`p`,{children:n.guidance}),(0,B.jsx)(`p`,{children:(0,B.jsx)(`code`,{children:i})}),(0,B.jsx)(`p`,{children:(0,B.jsx)(`code`,{children:`loopx goal-acceptance --help`})}),(0,B.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 bx={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 可隐藏本区块。`}},xx={en:{contract:bx.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:bx[`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 Sx({graph:e,nodes:t,selected:n,onSelect:r,copy:i}){let a=(0,z.useId)().replace(/:/g,``),o=[0,1,2].map(e=>t.filter(t=>_x(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,B.jsx)(`div`,{className:`delivery-map-scroll`,role:`region`,"aria-label":i.map,tabIndex:0,children:(0,B.jsxs)(`div`,{className:`delivery-map`,style:{height:c},children:[[i.conditions,i.work,i.context].map((e,t)=>(0,B.jsx)(`strong`,{className:`delivery-map-heading`,style:{left:t*320+12},children:e},e)),(0,B.jsxs)(`svg`,{"aria-hidden":`true`,width:`960`,height:c,children:[(0,B.jsx)(`defs`,{children:(0,B.jsx)(`marker`,{id:a,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto-start-reverse`,children:(0,B.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,B.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,B.jsxs)(`span`,{children:[i.kind[e.kind],(0,B.jsx)(`em`,{"data-state":e.state,children:i.state[e.state]})]}),(0,B.jsx)(`strong`,{title:e.title,children:e.title}),(0,B.jsx)(`small`,{children:e.owner_agent??i.unavailable})]},e.node_id)})]})})}function Cx({goal:e,items:t,userTodos:n,onSelect:r,active:i}){let{locale:a}=Ji(),o=xx[a],[s,c]=(0,z.useState)({kind:`loading`}),[l,u]=(0,z.useState)(0),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(`all`),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(()=>window.matchMedia(`(min-width: 1024px)`).matches),[y,b]=(0,z.useState)(``),x=(0,z.useRef)(null),S=n.filter(t=>t.goalId===e.goalId),C=JSON.stringify([e.agentTodos,e.acceptanceObservation,S]),w=(0,z.useRef)(C);w.current=C,(0,z.useEffect)(()=>{if(!i)return;let t=new AbortController,n=w.current;return c(e=>({...e,kind:`loading`})),b(``),mx(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),ee=p===`related`&&!k?`all`:p,te=(0,z.useMemo)(()=>O?hx(O,d,ee,h):[],[O,d,ee,h]),A=O?.edges.filter(e=>e.from_node_id===h||e.to_node_id===h)??[],j=new Map(O?.nodes.map(e=>[e.node_id,e])),M=()=>{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([vx(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,B.jsxs)(`section`,{className:`delivery-review`,"aria-label":o.title,children:[(0,B.jsxs)(`header`,{className:`delivery-review-toolbar`,children:[(0,B.jsx)(`h2`,{children:o.title}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{type:`button`,disabled:s.kind===`loading`,onClick:()=>u(e=>e+1),children:[(0,B.jsx)(Um,{size:15}),o.refresh]}),(0,B.jsxs)(`button`,{type:`button`,disabled:!D,onClick:re,children:[(0,B.jsx)(gm,{size:15}),o.export]})]})]}),y?(0,B.jsx)(`p`,{role:`status`,children:y}):null,T?(0,B.jsxs)(B.Fragment,{children:[s.kind===`ready`?null:(0,B.jsx)(`p`,{role:s.kind===`error`?`alert`:`status`,className:`delivery-notice`,children:s.kind===`error`?o.refreshError:o.loading}),(0,B.jsxs)(`p`,{className:`delivery-snapshot-time`,children:[o.observed,` · `,(0,B.jsx)(`time`,{dateTime:T.observed_at,children:new Date(T.observed_at).toLocaleString(a)})]}),E?(0,B.jsx)(`p`,{role:`alert`,className:`delivery-notice`,children:o.changed}):null,(0,B.jsxs)(`p`,{className:`delivery-boundary`,children:[o.scope,` `,o.acceptanceBoundary]}),O?(0,B.jsxs)(B.Fragment,{children:[gx(O)?(0,B.jsxs)(`details`,{className:`delivery-notice`,children:[(0,B.jsx)(`summary`,{children:o.incomplete}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:o.omittedGates}),(0,B.jsx)(`dd`,{children:O.limits.user_gate_truncated_count})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:o.missing}),(0,B.jsx)(`dd`,{children:O.limits.missing_predecessor_count??o.unavailable})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:o.clipped}),(0,B.jsx)(`dd`,{children:O.limits.predecessor_truncated===void 0?o.unavailable:O.limits.predecessor_truncated?o.yes:o.no})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:o.sourceClipped}),(0,B.jsx)(`dd`,{children:O.limits.source_truncated===void 0?o.unavailable:O.limits.source_truncated?o.yes:o.no})]})]})]}):null,(0,B.jsxs)(`section`,{className:`delivery-chain`,"aria-label":o.chain,children:[(0,B.jsxs)(`header`,{className:`delivery-chain-toolbar`,children:[(0,B.jsx)(`h3`,{children:o.chain}),(0,B.jsxs)(`span`,{children:[o.visible,` `,te.length,`/`,O.nodes.length]}),(0,B.jsxs)(`div`,{role:`group`,"aria-label":o.view,children:[(0,B.jsx)(`button`,{type:`button`,"aria-pressed":_,onClick:()=>v(!0),children:o.map}),(0,B.jsx)(`button`,{type:`button`,"aria-pressed":!_,onClick:()=>v(!1),children:o.list})]})]}),(0,B.jsxs)(`div`,{className:`delivery-filters`,children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(Km,{size:16}),(0,B.jsx)(`input`,{"aria-label":o.search,placeholder:o.search,value:d,onChange:e=>f(e.target.value)})]}),(0,B.jsxs)(`select`,{"aria-label":o.filter,value:ee,onChange:e=>m(e.target.value),children:[(0,B.jsx)(`option`,{value:`all`,children:o.all}),(0,B.jsx)(`option`,{value:`conditions`,children:o.conditions}),(0,B.jsx)(`option`,{value:`evidence`,children:o.evidence}),(0,B.jsx)(`option`,{value:`related`,disabled:!k,children:o.related})]}),(0,B.jsx)(`button`,{type:`button`,onClick:M,children:o.reset})]}),te.length?_?(0,B.jsx)(Sx,{graph:O,nodes:te,selected:h,onSelect:ne,copy:o}):(0,B.jsx)(`ul`,{className:`delivery-node-list`,children:te.map(e=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":h===e.node_id,onClick:()=>ne(e.node_id),children:[(0,B.jsx)(`span`,{children:o.kind[e.kind]}),(0,B.jsx)(`strong`,{children:e.title}),(0,B.jsx)(`small`,{children:e.owner_agent??o.unavailable}),(0,B.jsx)(`em`,{"data-state":e.state,children:o.state[e.state]})]})},e.node_id))}):(0,B.jsx)(`p`,{className:`delivery-empty`,role:`status`,children:o.empty})]}),(0,B.jsx)(`section`,{className:`delivery-node-detail`,"aria-label":o.details,ref:x,children:k?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[o.kind[k.kind],` · `,o.state[k.state]]}),(0,B.jsx)(`h3`,{children:k.title}),k.owner_agent?(0,B.jsx)(`p`,{children:k.owner_agent}):null]}),k.from_agent||k.to_agent?(0,B.jsxs)(`p`,{children:[k.from_agent??o.unavailable,` → `,k.to_agent??o.unavailable]}):null,(0,B.jsx)(`div`,{className:`delivery-source-actions`,children:P.length?P.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,disabled:!D,onClick:()=>r(e),children:[(0,B.jsx)(vm,{size:15}),e.kind===`todo`?o.openTask:e.kind===`attention`?o.openGate:o.openRun]},`${e.kind}:${t}`)):(0,B.jsx)(`p`,{children:o.sourceUnavailable})}),(0,B.jsx)(`h4`,{children:o.relations}),A.length?(0,B.jsx)(`ul`,{className:`delivery-relations`,children:A.map(e=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>ne(e.from_node_id),children:j.get(e.from_node_id).title}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(Qp,{size:13}),o.relation[e.relation],(0,B.jsx)(Qp,{size:13})]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>ne(e.to_node_id),children:j.get(e.to_node_id).title})]}),(0,B.jsx)(`p`,{children:e.reason})]},e.edge_id))}):(0,B.jsx)(`p`,{children:o.noRelations}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:o.refs}),(0,B.jsx)(`code`,{children:k.node_id}),Object.entries(k.refs).map(([e,t])=>(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`strong`,{children:e}),` `,t.join(`, `)]},e))]})]}):(0,B.jsx)(`p`,{children:o.select})})]}):(0,B.jsx)(`p`,{className:`delivery-notice`,children:o.noGraph})]}):(0,B.jsx)(`p`,{role:s.kind===`error`?`alert`:`status`,className:`delivery-notice`,children:s.kind===`error`?o.error:o.loading}),(0,B.jsx)(yx,{goalId:e.goalId,contract:T?.acceptance?.goal_acceptance_contract,copy:o.contract,current:D}),(0,B.jsx)(vb,{goal:T?{...e,acceptanceObservation:T.acceptance}:e})]})}function wx({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:`查看任务`,outputs:`查看成果`,usage:`最近 24 小时`,execution:`执行记录`,remote:`此来源仅提供同步的状态与验收观察,交付链需要实时本机来源。`}:{progress:`Current progress`,attention:`Needs you`,none:`No pending decisions are loaded.`,details:`Goal information`,tasks:`View tasks`,outputs:`View outputs`,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,B.jsxs)(`section`,{className:`goal-overview`,"aria-label":c(`header.overview`),children:[(0,B.jsxs)(`header`,{className:`goal-overview-heading`,children:[(0,B.jsx)(`h2`,{children:c(`header.overview`)}),(0,B.jsxs)(`button`,{onClick:a,type:`button`,children:[(0,B.jsx)(Tm,{size:15}),u.details]})]}),(0,B.jsxs)(`div`,{className:`goal-overview-summary`,children:[(0,B.jsxs)(`section`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`h3`,{children:u.progress}),(0,B.jsx)(`span`,{children:Yi(t.state,l)})]}),(0,B.jsx)(`strong`,{children:t.nextSentence}),(0,B.jsx)(`p`,{children:t.agentSentence}),(0,B.jsxs)(`div`,{className:`goal-overview-links`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>s(`tasks`),children:[u.tasks,(0,B.jsx)(Qp,{size:14})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>s(`files`),children:[u.outputs,(0,B.jsx)(Qp,{size:14})]})]}),f?(0,B.jsxs)(`button`,{className:`goal-overview-run`,type:`button`,onClick:()=>o({kind:`run`,item:f.run}),children:[(0,B.jsxs)(`small`,{children:[u.execution,` · `,f.run.agentLabel]}),(0,B.jsx)(`strong`,{children:f.run.title}),(0,B.jsx)(Qp,{size:15})]}):null]}),(0,B.jsxs)(`section`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`h3`,{children:u.attention}),(0,B.jsx)(`span`,{children:d.length})]}),d.length?(0,B.jsx)(`ul`,{children:d.slice(0,3).map(e=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>o({kind:`attention`,item:e}),children:[(0,B.jsx)(`span`,{children:e.text}),(0,B.jsx)(Qp,{size:15})]})},e.todoId))}):(0,B.jsx)(`p`,{children:u.none}),d.length>3?(0,B.jsxs)(`button`,{type:`button`,onClick:()=>s(`tasks`),children:[u.tasks,` (`,d.length,`)`,(0,B.jsx)(Qp,{size:14})]}):null]})]}),(0,B.jsxs)(`dl`,{className:`goal-overview-usage`,"aria-label":u.usage,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`dt`,{children:[c(`drawer.tokensShort`),` · `,u.usage]}),(0,B.jsx)(`dd`,{children:eb(t.usage?.tokens24h,c(`drawer.usageNotMeasured`),Zy)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`dt`,{children:[c(`drawer.costShort`),` · `,u.usage]}),(0,B.jsx)(`dd`,{children:eb(t.usage?.costUsd24h,c(`drawer.usageNotMeasured`),Qy)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`dt`,{children:[c(`drawer.durationShort`),` · `,u.usage]}),(0,B.jsx)(`dd`,{children:eb(t.usage?.durationMs24h,c(`drawer.usageNotMeasured`),$y)})]})]}),i?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`goal-overview-source-note`,children:u.remote}),(0,B.jsx)(vb,{goal:t})]}):(0,B.jsx)(Cx,{active:e,goal:t,items:n,userTodos:r,onSelect:o})]})}function Tx({activeTab:e,panels:t,scrollRef:n}){let[r,i]=(0,z.useState)(()=>new Set([e])),a=(0,z.useRef)({});return(0,z.useEffect)(()=>i(t=>t.has(e)?t:new Set([...t,e])),[e]),(0,z.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,B.jsx)(`div`,{className:`personal-goal-view-panel`,"data-goal-panel":n,hidden:n!==e,children:t[n]},n):null)}function Ex(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 Dx(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 Ox(e){return e.history_permission_guidance?.api_document_url??null}function kx(e,t,n){if(e instanceof Ih){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 Ax({embedded:e=!1,focusGoalConnection:t=!1,goals:n,initialGoalId:r,onChanged:i,onClose:a}){let{t:o}=Ji(),[s,c]=(0,z.useState)(`connections`),[l,u]=(0,z.useState)([]),[d,f]=(0,z.useState)([]),[p,m]=(0,z.useState)(!0),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(``),[y,b]=(0,z.useState)(t),[x,S]=(0,z.useState)(``),[C,w]=(0,z.useState)(r??n[0]?.goalId??``),[T,E]=(0,z.useState)(``),[D,O]=(0,z.useState)([]),[k,ee]=(0,z.useState)(``),[te,A]=(0,z.useState)(!1),[j,M]=(0,z.useState)(null),[ne,N]=(0,z.useState)(`addressed_only`),[P,re]=(0,z.useState)(t&&r?`goal`:`manager`),[ie,ae]=(0,z.useState)(`async_inbox`),[F,oe]=(0,z.useState)(`topic_reply`),[I,se]=(0,z.useState)(``),[L,ce]=(0,z.useState)(!1),[le,ue]=(0,z.useState)({}),[de,fe]=(0,z.useState)(!1),[pe,me]=(0,z.useState)(null),[he,ge]=(0,z.useState)(null),[_e,ve]=(0,z.useState)(null),[ye,be]=(0,z.useState)(null),[xe,Se]=(0,z.useState)(!1),[Ce,we]=(0,z.useState)(`loopx-workspace-bot`),[Te,Ee]=(0,z.useState)(`feishu`),[De,Oe]=(0,z.useState)(null),[ke,Ae]=(0,z.useState)(!1),[je,R]=(0,z.useState)(null),Me=(0,z.useRef)(null),Ne=(0,z.useRef)(null),Pe=(0,z.useRef)(!1);async function Fe(){m(!0),g(null);try{let[e,t]=await Promise.all([$g(),c_()]);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(kx(e,o(`lark.error.configuration`),o))}finally{m(!1)}}(0,z.useEffect)(()=>{Fe()},[]),(0,z.useEffect)(()=>{if(!t||p||Pe.current||!r)return;Pe.current=!0;let e=d.find(e=>e.goal_id===r);e?Je(e):qe(n.find(e=>e.goalId===r))},[d,t,n,r,p]),(0,z.useEffect)(()=>{if(!y||!x||_e){O([]),ee(``),A(!1),M(null);return}let e=!1;A(!0),M(null);let t=window.setTimeout(()=>{o_(x,T).then(t=>{e||(O(t),ee(e=>t.some(t=>t.chat_id===e)?e:t[0]?.chat_id??``))}).catch(t=>{e||(O([]),ee(``),M(kx(t,o(`lark.error.groupLoad`),o)))}).finally(()=>{e||A(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[x,T,y,_e]),(0,z.useEffect)(()=>{if(!xe||!De||[`ready`,`failed`,`cancelled`].includes(De.status))return;let e=!1,t=window.setTimeout(()=>{n_(De.setup_id).then(async t=>{e||(Oe(t),t.verification_url&&Ne.current!==t.verification_url&&(Ne.current=t.verification_url,Me.current&&!Me.current.closed&&(Me.current.location.href=t.verification_url)),t.status===`ready`&&(await Fe(),S(t.app_ref),ue({}),Se(!1)),t.status===`failed`&&R(t.error??o(`lark.error.appCreate`)))}).catch(t=>{e||R(kx(t,o(`lark.error.setupPoll`),o))})},650);return()=>{e=!0,window.clearTimeout(t)}},[xe,De]);let Ie=n.find(e=>e.goalId===C),Le=Ie?.agentId?[{agentId:Ie.agentId,label:Ie.agentLabel??Ie.agentId}]:[],Re=Ie?.agentLanes?.length?Ie.agentLanes:Le,ze=Re.some(e=>e.agentId===I),Be=[];L?Be=Re.map(e=>({agentId:e.agentId,appRef:le[e.agentId]??x})):ze&&(Be=[{agentId:I,appRef:x}]);let V=Be.map(e=>e.agentId),Ve=!!_e||Be.length>0&&Be.every(e=>l.some(t=>t.app_ref===e.appRef&&t.reply_ready)),He=o(`lark.connect`);he?He=o(`lark.saveConnection`):L&&(He=o(`lark.connectAllAgentsAction`,{count:V.length}));let Ue=l.find(e=>e.app_ref===x),We=D.find(e=>e.chat_id===k),Ge=(0,z.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,_]),Ke=(0,z.useMemo)(()=>d.filter(e=>Dx(e,o).state===`unverified`).length,[d,o]);function qe(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??``),ee(``),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),R(null),Ne.current=null,Se(!0)}async function Xe(){if(!(ke||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(Ce))){Ae(!0),R(null),Ne.current=null,Me.current=window.open(window.location.href,`_blank`);try{let e=await t_({appRef:Ce,brand:Te});Oe(e)}catch(e){Me.current?.close(),R(kx(e,o(`lark.error.setupStart`),o))}finally{Ae(!1)}}}async function Ze(){let e=De;if(Se(!1),Me.current?.close(),e&&![`ready`,`failed`,`cancelled`].includes(e.status))try{await r_(e.setup_id)}catch{}}async function Qe(){if(!(!x||!C||!_e&&!We||P===`goal`&&V.length===0||de)){fe(!0),me(null);try{let e={...P===`manager`?{..._e?{connectionId:_e.connection_id}:{appRef:x,chatId:We.chat_id,chatName:We.chat_name}}:_e?{connectionId:_e.connection_id,agentId:I}:{agentBindings:Be,chatId:We.chat_id,chatName:We.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 l_({...e,execute:!1});if(!t.ok)throw new Ih(t.public_summary??t.blocker??o(`lark.error.bindPreview`),{error_code:t.blocker??`provider_api_failed`});let n=await l_({...e,execute:!0});if(!n.ok)throw new Ih(n.public_summary??n.blocker??o(`lark.error.bind`),{error_code:n.blocker??`provider_api_failed`});b(!1),await Fe(),i?.()}catch(e){me(kx(e,o(`lark.error.bind`),o))}finally{fe(!1)}}}async function $e(e,t){if(ye!==t){be(t);return}try{await u_(e,t),be(null),await Fe(),i?.()}catch(e){g(kx(e,o(`lark.error.disconnect`),o))}}return(0,B.jsxs)(`section`,{className:`personal-lark-settings${e?` is-embedded`:``}`,"aria-label":o(`lark.configuration`),children:[e?null:(0,B.jsxs)(`header`,{className:`personal-lark-header`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:o(`settings.goalConnections`)}),(0,B.jsx)(`h1`,{children:`Lark`})]}),(0,B.jsx)(`button`,{"aria-label":o(`lark.closeSettings`),className:`personal-icon-button`,onClick:a,type:`button`,children:(0,B.jsx)(oh,{size:18})})]}),(0,B.jsxs)(`nav`,{className:`personal-lark-tabs`,"aria-label":o(`lark.management`),children:[(0,B.jsxs)(`button`,{"aria-current":s===`apps`?`page`:void 0,onClick:()=>c(`apps`),type:`button`,children:[o(`lark.apps`),` `,(0,B.jsx)(`span`,{children:p?`…`:l.length})]}),(0,B.jsxs)(`button`,{"aria-current":s===`connections`?`page`:void 0,onClick:()=>c(`connections`),type:`button`,children:[o(`lark.connections`),` `,(0,B.jsx)(`span`,{children:p?`…`:d.length})]})]}),h?(0,B.jsx)(`p`,{className:`personal-notification-error`,children:h}):null,p?(0,B.jsxs)(`div`,{className:`personal-lark-loading`,children:[(0,B.jsx)(Am,{className:`is-spinning`,size:18}),o(`lark.loading`)]}):null,!p&&s===`apps`?(0,B.jsxs)(`div`,{className:`personal-lark-apps`,children:[(0,B.jsxs)(`div`,{className:`personal-lark-app-toolbar`,children:[(0,B.jsx)(`span`,{children:o(`lark.reusableApps`,{count:l.length})}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:Ye,type:`button`,children:[(0,B.jsx)(Vm,{size:16}),o(`lark.newApp`)]})]}),(0,B.jsxs)(`div`,{className:`personal-lark-app-grid`,children:[l.map(e=>(0,B.jsxs)(`article`,{className:`personal-lark-app-card`,children:[(0,B.jsx)(`span`,{className:`personal-lark-app-avatar`,children:(0,B.jsx)(rm,{size:19})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:e.label}),(0,B.jsxs)(`small`,{children:[e.brand,` · lark-cli profile`]})]}),(0,B.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,B.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,B.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noProfiles`)}):null]})]}):null,!p&&s===`connections`?(0,B.jsxs)(`div`,{className:`personal-lark-connections`,children:[Ke>0?(0,B.jsxs)(`p`,{className:`personal-lark-route-readiness`,role:`status`,children:[(0,B.jsx)(Pm,{size:15}),o(`lark.routesUnverified`,{count:Ke})]}):null,(0,B.jsxs)(`div`,{className:`personal-lark-toolbar`,children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(Km,{size:16}),(0,B.jsx)(`input`,{"aria-label":o(`lark.searchConnections`),onChange:e=>v(e.target.value),placeholder:o(`lark.searchPlaceholder`),type:`search`,value:_})]}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,disabled:l.length===0||n.length===0,onClick:()=>qe(),type:`button`,children:[(0,B.jsx)(Vm,{size:16}),o(`lark.connectApp`)]})]}),(0,B.jsxs)(`div`,{className:`personal-lark-table`,role:`table`,"aria-label":o(`lark.goalTopicConnections`),children:[(0,B.jsxs)(`div`,{className:`personal-lark-table-head`,role:`row`,children:[(0,B.jsx)(`span`,{children:o(`lark.connection`)}),(0,B.jsx)(`span`,{children:o(`common.goal`)}),(0,B.jsx)(`span`,{children:o(`lark.capture`)}),(0,B.jsx)(`span`,{children:o(`lark.processing`)}),(0,B.jsx)(`span`,{children:o(`common.actions`)})]}),Ge.map(e=>{let t=Dx(e,o);return(0,B.jsxs)(`div`,{className:`personal-lark-table-row`,role:`row`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.chat_name}),(0,B.jsxs)(`small`,{children:[e.app_label,` · `,t.label]}),(0,B.jsx)(`small`,{children:t.detail}),t.state===`unverified`?(0,B.jsxs)(`a`,{href:`https://open.feishu.cn/document/server-docs/im-v1/message/events/receive?lang=zh-CN`,rel:`noreferrer`,target:`_blank`,children:[(0,B.jsx)(vm,{size:12}),o(`lark.openEventSettings`)]}):null,Ox(e)?(0,B.jsxs)(`a`,{href:Ox(e)??void 0,rel:`noreferrer`,target:`_blank`,children:[(0,B.jsx)(vm,{size:12}),o(`lark.historyPermission`)]}):null]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.goal_title}),(0,B.jsxs)(`small`,{children:[`# `,e.topic_name]})]}),(0,B.jsx)(`span`,{children:e.capture_scope===`addressed_only`?o(`lark.mentionsOnly`):o(`lark.allTopicMessages`)}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.conversation_kind===`manager`?o(`lark.managerConversation`):Ex(e.ingress_mode,o).label}),(0,B.jsx)(`small`,{children:e.conversation_kind===`manager`?o(`lark.managerConversationDescription`):e.agent_id??Ex(e.ingress_mode,o).detail})]}),(0,B.jsxs)(`span`,{className:`personal-lark-row-actions`,children:[(0,B.jsx)(`button`,{"aria-label":o(`lark.settingsConfigure`,{goal:e.goal_title}),onClick:()=>Je(e),type:`button`,children:(0,B.jsx)(Xm,{size:15})}),(0,B.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,B.jsx)(ah,{size:15}),ye===e.connection_id?o(`common.confirm`):null]})]})]},e.connection_id)}),Ge.length===0?(0,B.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noConnections`)}):null]})]}):null,y?(0,B.jsx)(`div`,{className:`personal-lark-modal-backdrop`,role:`presentation`,children:(0,B.jsxs)(`section`,{"aria-labelledby":`connect-lark-title`,"aria-modal":`true`,className:`personal-lark-modal`,role:`dialog`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:`Goal Topic connection`}),(0,B.jsx)(`h2`,{id:`connect-lark-title`,children:o(he?`lark.editConnection`:`lark.connectApp`)})]}),(0,B.jsx)(`button`,{"aria-label":o(`lark.closeConnection`),onClick:()=>b(!1),type:`button`,children:(0,B.jsx)(oh,{size:18})})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.conversationKind`)}),(0,B.jsxs)(`select`,{"aria-label":o(`lark.conversationKind`),disabled:!!_e,value:P,onChange:e=>re(e.target.value),children:[(0,B.jsx)(`option`,{value:`manager`,children:o(`lark.managerConversation`)}),(0,B.jsx)(`option`,{value:`goal`,children:o(`lark.workerConversation`)})]})]}),P===`manager`?(0,B.jsx)(`p`,{children:o(`lark.managerConversationDescription`)}):null,_e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,B.jsx)(`div`,{children:_e.app_label})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,B.jsx)(`div`,{children:_e.chat_name})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,B.jsx)(`div`,{children:_e.goal_title})]}),(0,B.jsx)(`small`,{children:o(`lark.editPreservesIdentity`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,B.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,B.jsx)(`option`,{value:``,children:o(`lark.appLoading`)}):(0,B.jsxs)(B.Fragment,{children:[l.map(e=>(0,B.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,B.jsx)(`option`,{value:`__register__`,children:o(`lark.registerAnother`)})]})}),(0,B.jsx)(`small`,{children:o(`lark.defaultAgentAppDescription`)})]}),Ue?.ready&&!Ue.reply_ready?(0,B.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.appPermissions`)}):null,(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,B.jsx)(`input`,{"aria-label":o(`lark.groupSearch`),onChange:e=>E(e.target.value),placeholder:o(`lark.groupSearch`),type:`search`,value:T}),te?(0,B.jsxs)(`div`,{className:`personal-lark-group-state`,role:`status`,children:[(0,B.jsx)(Am,{className:`is-spinning`,size:15}),o(`lark.groupLoading`)]}):null,!te&&j?(0,B.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:j}):null,!te&&!j&&D.length===0?(0,B.jsx)(`div`,{className:`personal-lark-group-state`,role:`status`,children:o(`lark.groupEmpty`)}):null,!te&&!j&&D.length>0?(0,B.jsx)(`select`,{"aria-label":o(`lark.groupChat`),onChange:e=>ee(e.target.value),value:k,children:D.map(e=>(0,B.jsx)(`option`,{value:e.chat_id,children:e.chat_name},e.chat_id))}):null]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,B.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,B.jsx)(`option`,{value:e.goalId,children:e.title},e.goalId))})]})]}),(0,B.jsxs)(`label`,{className:`personal-lark-check`,children:[(0,B.jsx)(`input`,{checked:!0,readOnly:!0,type:`checkbox`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:o(`lark.createAutomatically`)}),(0,B.jsx)(`small`,{children:o(`lark.createAutomaticallyDescription`)})]})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.topicPreview`)}),(0,B.jsxs)(`div`,{className:`personal-lark-topic-preview`,children:[(0,B.jsx)(Pm,{size:15}),`# `,Ie?.title??Ie?.goalId??`Goal`]})]}),P===`goal`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.captureScope`)}),(0,B.jsxs)(`select`,{"aria-label":o(`lark.captureScope`),disabled:_e?.ingress_mode===`direct_session`,onChange:e=>N(e.target.value),value:ne,children:[(0,B.jsx)(`option`,{value:`addressed_only`,children:o(`lark.captureAddressed`)}),(0,B.jsx)(`option`,{value:`configured_chat_all`,children:o(`lark.captureAll`)})]}),(0,B.jsx)(`small`,{children:o(`lark.captureScopeDescription`)})]}),(0,B.jsxs)(`fieldset`,{"aria-label":o(`lark.agentIngress`),className:`personal-lark-ingress`,children:[(0,B.jsx)(`legend`,{children:o(`lark.agentIngress`)}),(0,B.jsx)(`div`,{children:[`live_steering`,`session_queue`,`async_inbox`].map(e=>{let t=Ex(e,o);return(0,B.jsxs)(`label`,{className:ie===e?`is-active`:``,children:[(0,B.jsx)(`input`,{"aria-label":t.label,checked:ie===e,name:`lark-agent-ingress`,onChange:()=>ae(e),type:`radio`,value:e}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:t.label}),(0,B.jsx)(`small`,{children:t.detail})]})]},e)})})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.targetAgent`)}),(0,B.jsxs)(`select`,{"aria-label":o(`lark.targetAgent`),disabled:!!_e?.agent_id,onChange:e=>se(e.target.value),value:I,children:[ze?null:(0,B.jsx)(`option`,{disabled:!0,value:I,children:I?o(`lark.agentUnavailable`,{agent:I}):o(`lark.noAgentConfigured`)}),Re.map(e=>(0,B.jsx)(`option`,{value:e.agentId,children:e.label===e.agentId?e.agentId:`${e.label} · ${e.agentId}`},e.agentId))]}),(0,B.jsx)(`small`,{children:o(`lark.targetAgentDescription`)})]}),!he&&Re.length>1?(0,B.jsxs)(`label`,{"aria-label":o(`lark.connectAllAgents`),className:`personal-lark-check`,children:[(0,B.jsx)(`input`,{checked:L,onChange:e=>ce(e.target.checked),type:`checkbox`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:o(`lark.connectAllAgents`)}),(0,B.jsx)(`small`,{children:o(`lark.connectAllAgentsDescription`,{count:Re.length})})]})]}):null,!he&&L&&Re.length>1?(0,B.jsxs)(`fieldset`,{"aria-label":o(`lark.agentApps`),className:`personal-lark-agent-apps`,children:[(0,B.jsx)(`legend`,{children:o(`lark.agentApps`)}),(0,B.jsx)(`small`,{children:o(`lark.agentAppsDescription`)}),(0,B.jsx)(`div`,{children:Re.map(e=>(0,B.jsxs)(`label`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.label}),(0,B.jsx)(`small`,{children:e.agentId})]}),(0,B.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,B.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&&!Ve?(0,B.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.agentAppPermissions`)}):null,V.length===0?(0,B.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:o(`lark.selectRegisteredAgent`)}):null]}):null,(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.replyMode`)}),(0,B.jsx)(`select`,{"aria-label":o(`lark.replyMode`),onChange:e=>oe(e.target.value),value:F,children:(0,B.jsx)(`option`,{value:`topic_reply`,children:o(`lark.topicReply`)})}),(0,B.jsx)(`small`,{children:o(`lark.replyModeDescription`)})]}),(0,B.jsxs)(`p`,{className:`personal-lark-cardinality`,children:[(0,B.jsx)(om,{size:15}),o(`lark.cardinality`)]}),pe?(0,B.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:pe}):null,(0,B.jsxs)(`footer`,{children:[(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>b(!1),type:`button`,children:o(`lark.cancel`)}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,disabled:p||!x||!_e&&(!Ue?.reply_ready||!k)||P===`goal`&&(!Ve||V.length===0)||!C||de,onClick:()=>void Qe(),type:`button`,children:[de?(0,B.jsx)(Am,{className:`is-spinning`,size:15}):null,He]})]})]})}):null,xe?(0,B.jsx)(`div`,{className:`personal-lark-modal-backdrop is-setup`,role:`presentation`,children:(0,B.jsxs)(`section`,{"aria-labelledby":`new-lark-app-title`,"aria-modal":`true`,className:`personal-lark-modal personal-lark-setup-modal`,role:`dialog`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:o(`lark.reusableWorkspaceApp`)}),(0,B.jsx)(`h2`,{id:`new-lark-app-title`,children:o(`lark.newApp`)})]}),(0,B.jsx)(`button`,{"aria-label":o(`lark.closeCreate`),onClick:()=>void Ze(),type:`button`,children:(0,B.jsx)(oh,{size:18})})]}),De?(0,B.jsxs)(`div`,{className:`personal-lark-setup-progress`,children:[(0,B.jsx)(`span`,{className:`personal-lark-setup-icon is-${De.status}`,children:De.status===`ready`?(0,B.jsx)(om,{size:22}):(0,B.jsx)(Am,{className:De.status===`failed`?``:`is-spinning`,size:22})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:De.status===`ready`?o(`lark.appCreated`):De.status===`failed`?o(`lark.appCreateFailed`):o(`lark.waitingFeishu`)}),(0,B.jsx)(`p`,{children:De.status===`waiting_for_feishu`?o(`lark.waitingFeishuDescription`):De.status===`starting`?o(`lark.waitingLink`):De.error})]}),De.verification_url?(0,B.jsxs)(`a`,{href:De.verification_url,rel:`noreferrer`,target:`_blank`,children:[(0,B.jsx)(vm,{size:15}),o(`lark.reopenFeishu`)]}):null]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`personal-lark-setup-copy`,children:o(`lark.setupCopy`)}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.profileName`)}),(0,B.jsx)(`input`,{"aria-label":o(`lark.profileName`),autoComplete:`off`,onChange:e=>we(e.target.value),placeholder:`loopx-workspace-bot`,value:Ce})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.region`)}),(0,B.jsxs)(`select`,{"aria-label":o(`lark.region`),onChange:e=>Ee(e.target.value),value:Te,children:[(0,B.jsx)(`option`,{value:`feishu`,children:`Feishu`}),(0,B.jsx)(`option`,{value:`lark`,children:`Lark`})]})]}),Ce&&!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(Ce)?(0,B.jsx)(`p`,{className:`personal-notification-error`,children:o(`lark.profileValidation`)}):null]}),je?(0,B.jsx)(`p`,{className:`personal-notification-error`,children:je}):null,(0,B.jsxs)(`footer`,{children:[(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void Ze(),type:`button`,children:o(`lark.cancel`)}),De?null:(0,B.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,B.jsx)(Am,{className:`is-spinning`,size:15}):(0,B.jsx)(vm,{size:15}),o(`lark.continueFeishu`)]})]})]})}):null]})}function jx(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Mx(e,t,n){let r=jx(t),i=jx(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 Nx(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 Px(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 Fx({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,B.jsxs)(`div`,{className:`personal-report-schedule`,children:[(0,B.jsxs)(`label`,{className:`is-boolean`,htmlFor:e,children:[(0,B.jsx)(`span`,{children:a?`按日历汇报`:`Calendar reports`}),(0,B.jsx)(`input`,{id:e,type:`checkbox`,role:`switch`,checked:!!o,disabled:!r,onChange:e=>e.target.checked?p({}):r?.(null)})]}),o?(0,B.jsxs)(B.Fragment,{children:[d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{htmlFor:`${e}-frequency`,children:[(0,B.jsx)(`span`,{children:a?`频率`:`Frequency`}),(0,B.jsxs)(`select`,{id:`${e}-frequency`,value:c.FREQ,disabled:!r,onChange:e=>p({FREQ:e.target.value}),children:[(0,B.jsx)(`option`,{value:`DAILY`,children:a?`每天`:`Daily`}),(0,B.jsx)(`option`,{value:`WEEKLY`,children:a?`每周`:`Weekly`})]})]}),c.FREQ===`WEEKLY`&&(0,B.jsxs)(`label`,{htmlFor:`${e}-day`,children:[(0,B.jsx)(`span`,{children:a?`星期`:`Weekday`}),(0,B.jsx)(`select`,{id:`${e}-day`,value:c.BYDAY,disabled:!r,onChange:e=>p({BYDAY:e.target.value}),children:l.map((e,t)=>(0,B.jsx)(`option`,{value:e,children:f[t]},e))})]}),(0,B.jsxs)(`label`,{htmlFor:`${e}-time`,children:[(0,B.jsxs)(`span`,{children:[a?`当地时间`:`Local time`,` (`,n,`)`]}),(0,B.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,B.jsx)(`p`,{role:`alert`,children:a?`此计划需在 JSON 模式中编辑;当前内容已保留。`:`Edit this schedule in JSON mode; its current value is preserved.`}),(0,B.jsx)(`p`,{children:a?`由现有唤醒检查到期计划;实际送达以回执为准。`:`Existing wakes check the schedule; delivery is confirmed by its receipt.`})]}):(0,B.jsx)(`p`,{children:a?`未设置日历计划;保持阶段结束时汇报。`:`No calendar schedule; report at validated stage boundaries.`})]})}function Ix({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,B.jsx)(Fx,{id:n,value:i,timezone:a,onChange:r?e=>r(t.key,e):void 0});if(t.input_kind===`boolean`)return(0,B.jsxs)(`label`,{className:`is-boolean`,htmlFor:n,children:[(0,B.jsx)(`span`,{children:o}),(0,B.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,B.jsxs)(`label`,{htmlFor:n,children:[(0,B.jsx)(`span`,{children:o}),(0,B.jsxs)(`select`,{id:n,onChange:r?e=>r(t.key,e.target.value):void 0,value:typeof i==`string`?i:``,children:[(0,B.jsx)(`option`,{value:``}),(t.options??[]).map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]});if(t.input_kind===`string_list`)return(0,B.jsxs)(`label`,{htmlFor:n,children:[(0,B.jsx)(`span`,{children:o}),(0,B.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,B.jsxs)(`label`,{htmlFor:n,children:[(0,B.jsx)(`span`,{children:o}),(0,B.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 Lx({copy:e={},disabled:t=!1,editor:n,enabledAction:r,omitKeys:i=[],onChange:a,value:o}){let s=(0,z.useId)(),c=new Set(i);return(0,B.jsx)(`fieldset`,{className:`personal-capability-fields`,disabled:t,children:n.fields.filter(e=>!c.has(e.key)).map(t=>{let n=(0,B.jsx)(Ix,{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,B.jsxs)(`div`,{className:`personal-capability-enabled-row`,children:[n,r]},t.key):n})})}var Rx={en:{manager_runtime:{displayName:`Manager runtime`,description:`Selects the persistent host-tool profile used by owner manager conversations.`},steward_executor:{displayName:`Steward executor`,description:`Selects the executor, model, and reasoning effort the steward channel answers on for this machine, ahead of the Chat service environment.`},todo_replan_cadence:{displayName:`Goal review cadence`,description:`Configures the Goal review cadence.`},change_quality_qualification:{displayName:`Change quality qualification`,description:`Prepares a provider-neutral review packet, allows at most one policy-authorized safe-fix pass, and can require an exact-diff receipt.`},explore_graph:{displayName:`Explore Graph`,description:`Organizes bounded exploration as a typed evidence graph so branches, findings, and synthesis remain inspectable.`},explore_harness:{displayName:`Explore Harness`,description:`Selects a capability-owned planning and research harness profile for bounded multi-step exploration.`},lark_event_inbox:{displayName:`Lark event inbox`,description:`Receives provider events through a local-private inbox binding before LoopX projects them into governed work.`,readOnlyReason:`This capability requires a local-private inbox binding. Manage it in Lark settings or through the capability CLI.`},lark_kanban_heartbeat_sync:{displayName:`Lark Kanban heartbeat sync`,description:`Synchronizes accepted LoopX work state to the configured Lark Kanban heartbeat surface.`},local_authority_shadow:{displayName:`Local authority shadow`,description:`Observes post-commit Todo and task-lease state through the shared authority contract without taking write authority.`},multi_subagent:{displayName:`Adaptive child capacity`,description:`Sets bounded child-agent capacity and the public-safe responsibility domains in which parallel work may be delegated.`},peer_task_coordination:{displayName:`Registered-peer task coordination`,description:`Routes explicitly scoped peer-owned work to one registered coordinator without granting cross-owner mutation authority.`},periodic_report:{displayName:`Periodic reports`,description:`Turns validated Goal stage progress into a frozen report and automatically delivers it through the configured Goal Channel with exact readback.`},pull_request_review:{displayName:`Pull-request review`,description:`Ranks the public GitHub PR review queue with a machine-level default; it never grants GitHub, Todo, push, or merge authority.`},reward_memory:{displayName:`Reward Memory experiment`,description:`Configures a reviewed local-private provider binding for Goal-scoped Agent recall and evidence-backed outcome learning.`}},"zh-CN":{manager_runtime:{displayName:`管家 Runtime`,description:`选择管家会话持续生效的宿主工具模式。`},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 状态,但不取得写入权。`},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 绑定。`}}},zx={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.`},executor_endpoint:{label:`Steward executor`,description:`The executor this machine's steward channel answers on. The choice outranks the Chat service environment and the shipped default.`},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 开放常规宿主工具,但受保护操作仍单独校验。`},executor_endpoint:{label:`管家执行器`,description:`本机管家通道使用的执行器;优先级高于 Chat 服务环境变量与出货默认值。`},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 Bx(e,t){let n=Rx[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 Vx(e){return zx[e]}Object.freeze(Object.keys(Rx.en).sort());function Hx(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 Ux({values:e,t}){return(0,B.jsxs)(`details`,{className:`personal-capability-raw-values`,children:[(0,B.jsx)(`summary`,{children:t(`capabilities.rawJson`)}),(0,B.jsx)(`div`,{className:`personal-capability-value-grid`,children:e.map(({label:e,value:t})=>(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`strong`,{children:e}),(0,B.jsx)(`pre`,{children:t?JSON.stringify(t,null,2):`—`})]},e))})]})}function Wx({source:e,t}){return e?(0,B.jsxs)(`p`,{className:`personal-capability-effective-source`,children:[(0,B.jsx)(Zm,{"aria-hidden":!0,size:15}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:t(`capabilities.effectiveSource`)}),t(`capabilities.source.${e}`)]})]}):null}function Gx({available:e,description:t,t:n}){return e?null:(0,B.jsxs)(`section`,{className:`personal-capability-editor-status is-read-only`,children:[(0,B.jsx)(ih,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:n(`capabilities.readOnly`)}),(0,B.jsx)(`p`,{children:t})]})]})}function Kx(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 qx(e,t){return[...e].sort((e,n)=>{let r=Kx(e)-Kx(n);if(r!==0)return r;let i=Bx(e,t),a=Bx(n,t);return i.display_name.localeCompare(a.display_name,t)||e.capability_id.localeCompare(n.capability_id)})}function Jx({capabilities:e,locale:t,onSelect:n,scope:r,selectedCapabilityId:i,t:a}){return(0,B.jsx)(`nav`,{"aria-label":a(r===`goal`?`capabilities.catalog`:`machine.capabilityCatalog`),className:`personal-capability-list`,tabIndex:0,children:qx(e,t).map(e=>{let o=Bx(e,t);return(0,B.jsxs)(`button`,{"aria-current":i===o.capability_id?`page`:void 0,onClick:()=>n(o.capability_id),type:`button`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(`strong`,{children:o.display_name})}),(0,B.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 Yx({capability:e,locale:t,source:n}){let{t:r}=Ji(),i=Bx(e,t);return(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`span`,{className:`personal-settings-icon`,children:(0,B.jsx)(Qm,{"aria-hidden":!0,size:18})}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`personal-capability-heading-row`,children:[(0,B.jsx)(`h2`,{children:i.display_name}),(0,B.jsx)(Wx,{source:n,t:r})]}),e.context_contribution&&(0,B.jsxs)(`details`,{className:`personal-capability-help`,"data-testid":`capability-context-phases`,children:[(0,B.jsx)(`summary`,{children:t===`zh-CN`?`主 Agent 协作指导`:`Coordinator workflow guidance`}),(0,B.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,B.jsx)(`dl`,{children:e.context_contribution.supported_phases.map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:(0,B.jsx)(`code`,{children:e})}),(0,B.jsx)(`dd`,{children:Xx[e][t===`zh-CN`?`zh`:`en`]})]},e))}),(0,B.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,B.jsxs)(`details`,{className:`personal-capability-help`,children:[(0,B.jsx)(`summary`,{children:t===`zh-CN`?`配置说明`:`Configuration help`}),(0,B.jsx)(`p`,{children:i.description}),(0,B.jsx)(`dl`,{children:e.configuration_editor.fields.map(e=>{let n=Vx(t)[e.key],r=n?.description??e.description;return r?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:n?.label??e.label}),(0,B.jsx)(`dd`,{children:r})]},e.key):null})})]},e.capability_id)]})]})}var Xx={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 Zx({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.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,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{className:`personal-notification-toggle`,children:[(0,B.jsx)(`input`,{checked:n?.humanGateAutoNotifyEnabled??!1,disabled:a||n?.configured!==!0||!e.onToggleGoalAutoNotify,onChange:e=>void l(e.target.checked),type:`checkbox`}),(0,B.jsx)(`span`,{children:i(`notifications.autoNotify`)}),a?(0,B.jsx)(Am,{"aria-hidden":!0,className:`is-spinning`,size:14}):null]}),s?(0,B.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:s}):null]})}function Qx({goalId:e,onApplied:t,selected:n,t:r}){let[i,a]=(0,z.useState)({busy:null,draft:{},partialWrite:null,preview:null}),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(`guided`),[u,d]=(0,z.useState)(``),f=(0,z.useMemo)(()=>n?Nx(n.configuration_editor,u):null,[n,u]),p=c===`guided`||f!==null;(0,z.useEffect)(()=>{l(`guided`),d(``),a({busy:null,draft:Mx(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 Hg(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=Mx(n.configuration_editor,i.draft,n.default),o=await Ug(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`?Px(r.draft,e,t):{...r.draft,[e]:t},preview:null})),s(null)}function _(e){if(!n||i.busy)return;d(e);let t=Nx(n.configuration_editor,e);a(e=>({...e,preview:null,draft:t?Mx(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 $x({mutationError:e,onApplied:t,partialWrite:n,preview:r}){let{t:i}=Ji();return(0,B.jsxs)(B.Fragment,{children:[e?(0,B.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:e}):null,n?(0,B.jsxs)(`section`,{"aria-live":`polite`,className:`personal-capability-recovery`,children:[(0,B.jsx)(ih,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:i(`capabilities.partialWrite`)}),(0,B.jsx)(`p`,{children:i(`capabilities.partialWriteDescription`)}),(0,B.jsx)(`small`,{children:n.recommended_action})]}),(0,B.jsxs)(`button`,{onClick:t,type:`button`,children:[(0,B.jsx)(Um,{"aria-hidden":!0,size:15}),i(`capabilities.refreshSource`)]})]}):null,r?(0,B.jsxs)(`section`,{className:`personal-capability-preview`,"aria-label":i(`capabilities.preview`),children:[(0,B.jsx)(`strong`,{children:i(`capabilities.preview`)}),(0,B.jsx)(`span`,{children:i(`machine.action.${r.action}`)}),(0,B.jsx)(`small`,{children:i(`capabilities.previewLocked`)})]}):null]})}function eS({callbacks:e,catalog:t,goalId:n,notification:r,onApplied:i,onNotificationChanged:a}){let{locale:o,t:s}=Ji(),c=(0,z.useMemo)(()=>qx(t.capabilities,o),[t.capabilities,o]),[l,u]=(0,z.useState)(()=>c[0]?.capability_id??``),d=(0,z.useMemo)(()=>c.find(e=>e.capability_id===l)??c[0],[c,l]),f=(0,z.useMemo)(()=>d?Bx(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}=Qx({goalId:n,onApplied:i,selected:f,t:s}),{busy:C,draft:w,partialWrite:T,preview:E}=x;if(!d||!f)return(0,B.jsx)(`p`,{className:`personal-capability-empty`,children:s(`capabilities.empty`)});let D=f.available_scopes.includes(`goal`),O=Hx(f,`goal`),k=f.configuration_editor.read_only_reason??s(D?`capabilities.previewOnly`:`capabilities.machineOnly`);async function ee(){if(!f||!O||C||!y)return;let e=Mx(f.configuration_editor,w,f.default);await S(e)}async function te(){!O||C||await S(null)}return(0,B.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,B.jsx)(Jx,{capabilities:t.capabilities,locale:o,onSelect:u,scope:`goal`,selectedCapabilityId:f.capability_id,t:s}),(0,B.jsxs)(`article`,{"aria-label":f.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,B.jsx)(Yx,{capability:d,locale:o,source:f.effective_configuration?.source}),(0,B.jsx)(Gx,{available:O,t:s,description:k}),f.capability_id===`lark_event_inbox`?(0,B.jsxs)(`section`,{className:`personal-capability-linked-setting`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:s(`capabilities.larkInboxNotificationSetting`)}),(0,B.jsx)(`p`,{children:s(`capabilities.larkInboxNotificationDescription`)})]}),(0,B.jsx)(Zx,{callbacks:e,goalId:n,notification:r,onChanged:a})]}):null,O?(0,B.jsxs)(B.Fragment,{children:[_===`json`||!f.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,B.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,B.jsxs)(`button`,{disabled:!!C||!y,onClick:g,type:`button`,children:[(0,B.jsx)(pm,{"aria-hidden":!0,size:14}),s(_===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,_===`guided`?(0,B.jsx)(`section`,{className:`personal-capability-field-summary`,children:(0,B.jsx)(Lx,{disabled:!!C,copy:Vx(o),editor:f.configuration_editor,onChange:m,value:w,enabledAction:(0,B.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:g,type:`button`,children:[(0,B.jsx)(pm,{"aria-hidden":!0,size:14}),s(`machine.editJson`)]})})}):(0,B.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`goal-configuration-json`,children:[(0,B.jsx)(`span`,{children:s(`capabilities.jsonConfiguration`)}),(0,B.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,B.jsx)(`small`,{id:`goal-configuration-json-help`,children:s(`capabilities.jsonHelp`)}),y?null:(0,B.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:s(`capabilities.jsonInvalid`)})]})]}):null,(0,B.jsx)($x,{mutationError:b,onApplied:i,partialWrite:T,preview:E}),O?(0,B.jsxs)(`footer`,{className:`personal-capability-actions`,children:[f.current&&f.available_scopes.includes(`machine`)?(0,B.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void te(),type:`button`,children:s(`capabilities.restoreInheritance`)}):null,(0,B.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void ee(),type:`button`,children:s(C===`preview`?`common.loading`:`capabilities.previewChanges`)}),(0,B.jsx)(`button`,{className:`is-primary`,disabled:!!C||!E||!y,onClick:()=>void p(),type:`button`,children:s(C===`apply`?`common.loading`:`capabilities.applyPreview`)})]}):null,(0,B.jsx)(Ux,{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 tS({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(!1);function d(){t&&(u(!0),c(null),Vg(t).then(o).catch(e=>c(e instanceof Error?e.message:i(`capabilities.loadFailed`))).finally(()=>u(!1)))}return(0,z.useEffect)(d,[t]),t?l&&!a?(0,B.jsxs)(`p`,{"aria-live":`polite`,className:`personal-capability-empty`,children:[(0,B.jsx)(Am,{className:`personal-spin`,size:18}),i(`capabilities.loading`)]}):s?(0,B.jsxs)(`section`,{className:`personal-capability-error`,role:`alert`,children:[(0,B.jsx)(ih,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:i(`capabilities.loadFailed`)}),(0,B.jsx)(`small`,{children:s})]}),(0,B.jsxs)(`button`,{onClick:d,type:`button`,children:[(0,B.jsx)(Um,{"aria-hidden":!0,size:15}),i(`capabilities.retry`)]})]}):a?(0,B.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":a.revision,children:[(0,B.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(Zm,{"aria-hidden":!0,size:17}),i(`capabilities.atomicOverride`)]}),(0,B.jsx)(`p`,{children:i(`capabilities.atomicOverrideDescription`)})]}),(0,B.jsx)(eS,{callbacks:e,catalog:a.capability_catalog,goalId:t,notification:n,onApplied:d,onNotificationChanged:r})]}):null:(0,B.jsx)(`p`,{className:`personal-capability-empty`,children:i(`capabilities.chooseGoal`)})}function nS(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function rS(e,t){let n=t?.machine_namespace;return n?e?.machine_configuration?.namespaces[n]:void 0}function iS(e,t,n){return{...nS(e.default),...nS(t),...n}}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}return e.capability_id===`periodic_report`&&t.enabled===!0?!!(String(t.profile_preset??``).trim()&&String(t.route_ref??``).trim()&&String(t.timezone??``).trim()):!0}function oS(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}catch{return null}}function sS(e){return e?e===`absent`?e:e.replace(/^sha256:/,``).slice(0,12):`—`}function cS(){let{locale:e,t}=Ji(),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)({}),[c,l]=(0,z.useState)(`{}`),[u,d]=(0,z.useState)(`guided`),[f,p]=(0,z.useState)(null),[m,h]=(0,z.useState)(`upsert`),[g,_]=(0,z.useState)(null),[v,y]=(0,z.useState)(null),[b,x]=(0,z.useState)(`load`),[S,C]=(0,z.useState)(null),[w,T]=(0,z.useState)(null),E=(0,z.useMemo)(()=>qx(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=>Hx(e,`machine`))??E[0],k=O?Bx(O,e):void 0,ee=rS(n,k),te=!!(k?.machine_namespace&&ee),A=!!(k&&Hx(k,`machine`)),j=(0,z.useMemo)(()=>oS(c),[c]),M=k?u===`json`?j:iS(k,ee,o):null,ne=!!(k&&(u===`json`?j:aS(k,M??{})));async function N(){r(await Bg())}(0,z.useEffect)(()=>{let e=!0;return Bg().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,z.useEffect)(()=>{if(!k)return;let e=rS(n,k),t=Mx(k.configuration_editor,e??k.default,k.default),r=iS(k,e,t);s(t),l(JSON.stringify(r,null,2)),d(A?`guided`:`json`),p(null),h(`upsert`),y(null)},[n,i,e]);function P(e,t){s(n=>k?.capability_id===`periodic_report`?Px(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(iS(k,ee,o),null,2));else if(j)s(Mx(k.configuration_editor,j,k.default));else{C(t(`machine.jsonInvalid`));return}d(e),p(null),h(`upsert`),C(null)}}async function ie(){if(!(!A||!k?.machine_namespace||!M||!ne||b)){x(`preview`),C(null),T(null);try{h(`upsert`),p(await Wg(k.machine_namespace,M))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function ae(){if(!(!A||!k?.machine_namespace||!te||b)){x(`preview`),C(null),T(null);try{h(`remove`),p(await Kg(k.machine_namespace))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function F(){if(!A||!k?.machine_namespace||!f||b||m===`upsert`&&!M)return;x(`apply`),C(null);let e=m;try{let n=e===`remove`?await qg(k.machine_namespace,f.plan_revision):await Gg(k.machine_namespace,M,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 Jg(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 Yg(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,B.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:t(`common.loading`)}):k?(0,B.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n?.revision,children:[(0,B.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(Zm,{"aria-hidden":!0,size:17}),t(`machine.liveDefault`)]}),(0,B.jsx)(`p`,{children:t(`machine.liveDefaultDescription`)})]}),(0,B.jsxs)(`div`,{className:`personal-capability-body`,children:[n?.status===`invalid`?(0,B.jsxs)(`section`,{className:`personal-machine-error`,"data-testid":`machine-invalid-repair`,role:`alert`,children:[(0,B.jsx)(`strong`,{children:t(`machine.invalidStoredConfiguration`)}),(0,B.jsx)(`p`,{children:t(`machine.invalidStoredConfigurationDescription`)})]}):null,(0,B.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,B.jsx)(Jx,{capabilities:E,locale:e,onSelect:a,scope:`machine`,selectedCapabilityId:k.capability_id,t}),(0,B.jsxs)(`article`,{"aria-label":k.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,B.jsx)(Yx,{capability:O,locale:e,source:k.available_scopes.includes(`machine`)?te?`machine_default`:`capability_default`:void 0}),(0,B.jsx)(Gx,{available:A,t,description:k.available_scopes.includes(`machine`)?t(`machine.editorUnavailableDescription`):t(`machine.goalOnly`)}),k.capability_id===`periodic_report`?(0,B.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,B.jsx)(Zm,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:ee?.schedule?e===`zh-CN`?`日历与阶段汇报`:`Calendar and stage reports`:t(`machine.periodicReportActivation`)}),(0,B.jsx)(`p`,{children:ee?.schedule?ee.enabled===!0?e===`zh-CN`?`已配置日历计划,由现有唤醒检查;是否送达请核对报告回执。`:`A calendar schedule is configured and checked by existing wakes. Verify delivery in the report receipt.`:e===`zh-CN`?`日历计划已保存;启用此能力后才会检查和投递。`:`The schedule is saved; enable this capability to check and deliver reports.`:t(`machine.periodicReportActivationDescription`)})]})]}):null,k.capability_id===`change_quality_qualification`?(0,B.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,B.jsx)(Zm,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:t(`machine.changeQualityActivation`)}),(0,B.jsx)(`p`,{children:t(`machine.changeQualityActivationDescription`)})]})]}):null,k.capability_id===`todo_replan_cadence`?(0,B.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,B.jsx)(Zm,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:t(`machine.replanCadenceActivation`)}),(0,B.jsx)(`p`,{children:t(`machine.replanCadenceActivationDescription`)})]})]}):null,k.capability_id===`pull_request_review`?(0,B.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,B.jsx)(Zm,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:e===`zh-CN`?`只改变队列排序`:`Queue ordering only`}),(0,B.jsx)(`p`,{children:e===`zh-CN`?`默认先审阅其他开发者的 PR;选择 owner-first 才会优先当前已认证审阅者自己的 PR。此配置不会发布 review、写 Todo、push 或 merge。`:`The default reviews other developers' PRs first; choose owner-first only when the authenticated reviewer's own PRs should lead. This setting never posts a review, writes Todos, pushes, or merges.`})]})]}):null,A?(0,B.jsxs)(B.Fragment,{children:[u===`json`||!k.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,B.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,B.jsxs)(`button`,{onClick:()=>re(u===`guided`?`json`:`guided`),type:`button`,children:[(0,B.jsx)(pm,{"aria-hidden":!0,size:14}),t(u===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,u===`guided`?(0,B.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,B.jsx)(Lx,{copy:Vx(e),disabled:!!b,editor:k.configuration_editor,onChange:P,value:o,enabledAction:(0,B.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:()=>re(`json`),type:`button`,children:[(0,B.jsx)(pm,{"aria-hidden":!0,size:14}),t(`machine.editJson`)]})}),ne?null:(0,B.jsx)(`p`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.requiredFields`)})]}):(0,B.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`machine-configuration-json`,children:[(0,B.jsx)(`span`,{children:t(`machine.jsonConfiguration`)}),(0,B.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,B.jsx)(`small`,{id:`machine-configuration-json-help`,children:t(`machine.jsonConfigurationHelp`)}),j?null:(0,B.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.jsonInvalid`)})]})]}):null,S?(0,B.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:S}):null,w?(0,B.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(om,{"aria-hidden":!0,size:16}),w]}):null,f?(0,B.jsxs)(`section`,{"aria-label":t(`machine.preview`),className:`personal-machine-preview`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:t(`machine.preview`)}),(0,B.jsx)(`span`,{children:t(`machine.action.${f.action}`)})]}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`machine.currentRevision`)}),(0,B.jsx)(`dd`,{title:f.current_revision,children:sS(f.current_revision)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`machine.desiredRevision`)}),(0,B.jsx)(`dd`,{title:f.desired_revision,children:sS(f.desired_revision)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`machine.changedNamespaces`)}),(0,B.jsx)(`dd`,{children:f.changed_namespaces.join(`, `)||t(`common.none`)})]})]}),(0,B.jsx)(`p`,{children:t(`machine.previewLocked`)})]}):null,g?.rollback_available&&g.transaction_id?(0,B.jsxs)(`section`,{className:`personal-machine-rollback`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:t(`machine.rollbackAvailable`)}),(0,B.jsx)(`p`,{children:t(v?`machine.rollbackPreviewDescription`:`machine.rollbackDescription`)})]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!!b||!!(v&&!v.rollback_allowed),onClick:()=>void(v?I():oe()),type:`button`,children:[(0,B.jsx)(Wm,{"aria-hidden":!0,size:15}),t(b===`rollback`||b===`rollback-preview`?`common.loading`:v?`machine.confirmRollback`:`machine.previewRollback`)]})]}):null,A?(0,B.jsxs)(`footer`,{className:`personal-capability-actions`,children:[te?(0,B.jsxs)(`button`,{className:`is-danger`,disabled:!!b,onClick:()=>void ae(),type:`button`,children:[(0,B.jsx)(rh,{"aria-hidden":!0,size:15}),t(`machine.previewRemoval`)]}):null,(0,B.jsx)(`button`,{disabled:!!b||!ne,onClick:()=>void ie(),type:`button`,children:t(b===`preview`?`common.loading`:`machine.previewChanges`)}),(0,B.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,B.jsx)(Ux,{values:[{label:t(`machine.currentValue`),value:ee},{label:t(`capabilities.defaultValue`),value:k.default}],t},k.capability_id):null]})]})]})]}):(0,B.jsx)(`p`,{className:`personal-capability-empty`,children:t(`machine.capabilityEmpty`)})}function lS(e,t){return t(e===`invalid`?`machine.credentialInvalid`:e===`configured`?`machine.credentialConfigured`:`machine.credentialAbsent`)}function uS(e,t){return t(e===`machine_store`?`machine.credentialSourceMachine`:e===`service_environment`?`machine.credentialSourceEnvironment`:`machine.credentialSourceUnset`)}function dS(){let{t:e}=Ji(),[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(null),p=(0,z.useCallback)(async()=>{c(`load`);try{let e=await Rg();n(e),o(String(e.base_url.value??``))}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}},[e]);(0,z.useEffect)(()=>{p()},[p]);async function m(t,r){c(`store`),u(null),f(null);try{let e=await zg(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,B.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:e(`common.loading`)});let h=t?`${lS(t.provider_key.configured?`configured`:`absent`,e)} · ${uS(t.provider_key.source,e)}`:``,g=t?`${t.base_url.value??e(`machine.credentialAbsent`)} · ${uS(t.base_url.source,e)}`:``;return(0,B.jsxs)(`section`,{className:`personal-operator-credential`,"data-testid":`operator-credential-settings`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(Em,{"aria-hidden":!0,size:17}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:e(`machine.credentialTitle`)}),(0,B.jsx)(`p`,{children:e(`machine.credentialDescription`)})]}),(0,B.jsx)(`span`,{className:`personal-operator-credential-status`,children:t?lS(t.status,e):e(`common.loading`)})]}),t?(0,B.jsxs)(`dl`,{className:`personal-operator-credential-readback`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e(`machine.credentialApiKey`)}),(0,B.jsx)(`dd`,{children:h})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e(`machine.credentialFingerprint`)}),(0,B.jsx)(`dd`,{children:(0,B.jsx)(`code`,{children:t.provider_key.fingerprint??e(`common.none`)})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e(`machine.credentialBaseUrl`)}),(0,B.jsx)(`dd`,{children:g})]})]}):null,t?.status===`invalid`&&t.repair?(0,B.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:t.repair}):null,(0,B.jsxs)(`label`,{htmlFor:`operator-credential-api-key`,children:[(0,B.jsx)(`span`,{children:e(`machine.credentialApiKey`)}),(0,B.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,B.jsxs)(`label`,{htmlFor:`operator-credential-base-url`,children:[(0,B.jsx)(`span`,{children:e(`machine.credentialBaseUrl`)}),(0,B.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,B.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:l}):null,d?(0,B.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(om,{"aria-hidden":!0,size:16}),d]}):null,(0,B.jsxs)(`footer`,{className:`personal-operator-credential-actions`,children:[(0,B.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,B.jsxs)(`button`,{disabled:!!s||t?.provider_key.configured!==!0,onClick:()=>void m({clear_provider_key:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,B.jsx)(rh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearKey`)]}),(0,B.jsxs)(`button`,{disabled:!!s||t?.base_url.configured!==!0,onClick:()=>void m({clear_base_url:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,B.jsx)(rh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearUrl`)]})]}),(0,B.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(Zm,{"aria-hidden":!0,size:17}),e(`machine.credentialTitle`)]}),(0,B.jsx)(`p`,{children:e(`machine.credentialBoundary`)})]})]})}var fS={appearance:Lm,capabilities:Qm,language:Dm,lark:Xm,machine:Jm,provider:Em};function pS({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,z.useState)(i),h=[...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`)}],g=[{label:f(`settings.languageEnglish`),value:`en`},{label:f(`settings.languageSimplifiedChinese`),value:`zh-CN`}],_={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,B.jsxs)(`section`,{"aria-label":f(`settings.title`),className:`personal-settings-page`,"data-pw-theme":l,children:[(0,B.jsxs)(`aside`,{className:`personal-settings-sidebar`,children:[(0,B.jsxs)(`button`,{autoFocus:!0,className:`personal-settings-back`,onClick:s,type:`button`,children:[(0,B.jsx)(Zp,{size:17}),(0,B.jsx)(`span`,{children:f(`settings.back`)})]}),(0,B.jsxs)(`div`,{className:`personal-settings-title`,children:[(0,B.jsx)(`small`,{children:f(`settings.eyebrow`)}),(0,B.jsx)(`strong`,{children:f(`settings.title`)})]}),(0,B.jsx)(`nav`,{"aria-label":f(`settings.categories`),className:`personal-settings-tabs`,children:h.map(e=>{let t=fS[e.key];return(0,B.jsxs)(`button`,{"aria-current":p===e.key?`page`:void 0,onClick:()=>m(e.key),type:`button`,children:[(0,B.jsx)(t,{size:17}),(0,B.jsx)(`span`,{children:(0,B.jsx)(`strong`,{children:e.label})})]},e.key)})})]}),(0,B.jsxs)(`main`,{className:`personal-settings-body`,children:[(0,B.jsx)(`header`,{className:`personal-settings-header`,children:(0,B.jsx)(`div`,{children:(0,B.jsx)(`h1`,{children:_.title})})}),p===`lark`?(0,B.jsx)(Ax,{embedded:!0,focusGoalConnection:t,goals:n,initialGoalId:r,onChanged:o,onClose:s}):null,p===`provider`?(0,B.jsx)(`div`,{className:`personal-provider-settings`,children:(0,B.jsx)(dS,{})}):null,p===`machine`?(0,B.jsx)(cS,{}):null,p===`capabilities`?(0,B.jsx)(tS,{callbacks:e,goalId:r,notification:a.find(e=>e.goalId===r),onChanged:o}):null,p===`appearance`?(0,B.jsxs)(`section`,{className:`personal-detail-card personal-appearance-settings`,children:[(0,B.jsx)(`small`,{children:f(`settings.workspaceDisplay`)}),(0,B.jsx)(`h3`,{children:f(`settings.appearance`)}),(0,B.jsxs)(`div`,{className:`personal-settings-choice-group`,role:`radiogroup`,"aria-label":f(`settings.workspaceTheme`),children:[(0,B.jsxs)(`button`,{"aria-checked":l===`loopx`,onClick:()=>c(`loopx`),role:`radio`,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-settings-theme-swatch is-loopx`}),(0,B.jsx)(`strong`,{children:f(`settings.themeLoopx`)})]}),(0,B.jsxs)(`button`,{"aria-checked":l===`paper`,onClick:()=>c(`paper`),role:`radio`,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-settings-theme-swatch is-paper`}),(0,B.jsx)(`strong`,{children:f(`settings.themeDefault`)})]}),(0,B.jsxs)(`button`,{"aria-checked":l===`brutal`,onClick:()=>c(`brutal`),role:`radio`,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-settings-theme-swatch is-brutal`}),(0,B.jsx)(`strong`,{children:f(`settings.themeHighContrast`)})]})]})]}):null,p===`language`?(0,B.jsxs)(`section`,{className:`personal-settings-card`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`span`,{className:`personal-settings-icon`,children:(0,B.jsx)(Dm,{size:18})}),(0,B.jsx)(`div`,{children:(0,B.jsx)(`h2`,{children:f(`settings.language`)})})]}),(0,B.jsx)(`div`,{"aria-label":f(`settings.language`),className:`personal-language-options`,role:`radiogroup`,children:g.map(e=>(0,B.jsxs)(`button`,{"aria-checked":u===e.value,className:u===e.value?`is-selected`:``,onClick:()=>d(e.value),role:`radio`,type:`button`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(`strong`,{children:e.label})}),u===e.value?(0,B.jsx)(om,{"aria-hidden":!0,size:17}):null]},e.value))})]}):null]})]})}var mS=`loopx-pw-theme`,hS=`loopx`;function gS(){try{let e=window.localStorage.getItem(mS);return e===`loopx`||e===`paper`||e===`brutal`?e:hS}catch{return hS}}function _S(e){try{window.localStorage.setItem(mS,e)}catch{}}function vS({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,z.useRef)(null),u=(0,z.useRef)(null);return(0,z.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,B.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,B.jsx)(`button`,{"aria-hidden":!0,className:`personal-sidebar-backdrop`,onClick:a,tabIndex:-1,type:`button`}):null,(0,B.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,B.jsxs)(`div`,{className:`personal-workspace-sidebar-inner`,children:[i?(0,B.jsxs)(`button`,{className:`personal-sr-only`,onClick:a,type:`button`,children:[c(`common.close`),` `,c(`header.goalNavigation`)]}):null,o]})}),(0,B.jsx)(`main`,{"aria-hidden":i||void 0,className:`personal-workspace-main`,inert:i||void 0,children:r}),n?(0,B.jsx)(`aside`,{className:`personal-workspace-drawer`,"data-context-drawer":!0,"data-drawer-mode":t,children:e}):null]})}function yS(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 bS(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 xS(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 SS({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=[],d=[];e.filter(e=>!e.loadState).forEach(e=>{let t=Xy(e);t===`history`?u.push(e):t===`stopped`?d.push(e):l[t].push(e)});let f=e=>(0,B.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,B.jsxs)(`span`,{className:`personal-home-goal-meta`,children:[(0,B.jsx)(`i`,{}),e.agentLaneCount&&e.agentLaneCount>1?a(`header.workAgentCount`,{count:e.agentLaneCount}):e.agentLabel??e.agentId]}),(0,B.jsx)(`strong`,{children:e.title}),(0,B.jsx)(`p`,{children:e.loadError?a(`startup.error.${e.loadError}`):e.needsYou??e.nextSentence}),(0,B.jsxs)(`footer`,{children:[(0,B.jsx)(`span`,{children:e.loadState?a(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Yi(e.state,i)}),(0,B.jsx)(`small`,{title:e.latestActivity,children:e.loadState?``:e.latestActivity?xS(e.latestActivity,i,a):e.agentTodos.length?a(`home.taskCount`,{count:e.agentTodos.length}):a(`home.noActivity`)})]})]},e.goalId);return(0,B.jsxs)(`section`,{"aria-label":a(`home.workspace`),className:`personal-home-board`,children:[r&&(!r.ok||r.issues.length>0||r.freshnessWarning)?(0,B.jsxs)(`div`,{className:`personal-system-health-banner`,role:`alert`,children:[(0,B.jsxs)(`div`,{className:`personal-system-health-header`,children:[(0,B.jsx)(um,{size:15}),(0,B.jsx)(`strong`,{children:a(`home.systemHealth`,{summary:r.summary})}),r.freshnessWarning?(0,B.jsxs)(`small`,{children:[`(`,r.freshnessWarning,`)`]}):null]}),r.issues.length>0?(0,B.jsx)(`ul`,{className:`personal-system-health-issues`,children:r.issues.map((e,t)=>(0,B.jsx)(`li`,{children:e},t))}):null]}):null,o.some(e=>e.loadState)?(0,B.jsxs)(`section`,{className:`personal-home-lane`,"aria-live":`polite`,children:[(0,B.jsx)(`header`,{children:a(`startup.progress`,{loaded:o.filter(e=>!e.loadState).length,total:o.length})}),s?(0,B.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`status`,children:[(0,B.jsx)(`span`,{children:a(`startup.failedCount`,{count:s})}),(0,B.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,onClick:n,type:`button`,children:a(`startup.retryFailed`)})]}):null,o.filter(e=>e.loadState).map(f)]}):null,(0,B.jsx)(`div`,{className:`personal-home-lanes`,children:c.map(e=>(0,B.jsxs)(`section`,{className:`personal-home-lane is-${e.key}`,"data-testid":`personal-home-lane-${e.key}`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{}),e.label]}),(0,B.jsx)(`b`,{children:l[e.key].length})]}),(0,B.jsx)(`div`,{className:`personal-home-lane-list`,children:l[e.key].length?l[e.key].map(f):(0,B.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.empty`)})})]},e.key))}),(0,B.jsxs)(`details`,{className:`personal-home-history`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(`span`,{children:a(`home.history`)}),(0,B.jsx)(`b`,{children:u.length}),(0,B.jsx)(`small`,{children:a(`home.completedGoals`)})]}),(0,B.jsx)(`div`,{children:u.length?u.map(f):(0,B.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.noCompletedGoals`)})})]}),d.length?(0,B.jsxs)(`details`,{className:`personal-home-history is-stopped`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(`span`,{children:a(`home.stopped`)}),(0,B.jsx)(`b`,{children:d.length}),(0,B.jsx)(`small`,{children:a(`home.preservedState`)})]}),(0,B.jsx)(`div`,{children:d.map(f)})]}):null]})}function CS({items:e,onSelect:t,reportState:n}){let{locale:r,t:i}=Ji();return(0,B.jsxs)(`section`,{className:`personal-object-list personal-files-list`,"data-testid":`personal-goal-outputs`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:i(`files.title`)}),(0,B.jsx)(`span`,{children:e.length})]}),n?.loading?(0,B.jsxs)(`p`,{className:`personal-object-list-state`,role:`status`,children:[(0,B.jsx)(Um,{className:`is-spinning`,size:14}),i(`files.loadingReports`)]}):null,n?.error?(0,B.jsxs)(`p`,{className:`personal-object-list-state is-error`,role:`alert`,children:[(0,B.jsx)(um,{size:14}),i(`files.reportLoadFailed`),`: `,n.error]}):null,!n?.loading&&!n?.error&&e.length===0?(0,B.jsxs)(`p`,{className:`personal-object-list-state`,children:[(0,B.jsx)(Sm,{size:14}),i(`files.empty`)]}):null,e.map(e=>(0,B.jsxs)(`button`,{"data-output-kind":e.output.kind,onClick:()=>t({item:e.output,kind:`output`}),type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-file-icon`,children:(0,B.jsx)(Sm,{size:16})}),(0,B.jsx)(`strong`,{children:e.output.title}),e.output.report?(0,B.jsx)(`em`,{children:i(`files.reportDelta`,{added:e.output.report.addedCount,changed:e.output.report.changedCount})}):null,(0,B.jsx)(`p`,{children:e.output.summary??e.output.safePreview??e.output.kind??i(`files.emptySummary`)}),(0,B.jsx)(`small`,{title:e.output.createdAt,children:[e.output.goalTitle,e.output.kind===`report`?i(`files.verifiedReport`):null,e.output.todoId?`${i(`common.task`)} ${e.output.todoId}`:null,xS(e.output.createdAt,r,i)].filter(Boolean).join(` · `)})]},e.id))]})}function wS({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,z.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,B.jsxs)(`aside`,{"aria-label":o(`conversation.receipt`),className:`personal-manager-conversation-tray`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(rm,{size:16}),(0,B.jsx)(`strong`,{children:a??o(`conversation.title`)}),(0,B.jsx)(`small`,{children:t.at(-1)?.pending?o(`conversation.replying`):o(`common.recently`)})]}),(0,B.jsxs)(`div`,{className:`personal-manager-conversation-actions`,children:[r&&l?(0,B.jsxs)(`button`,{className:`personal-manager-conversation-btn`,onClick:()=>r(l.text),title:o(`conversation.convertHint`),type:`button`,children:[(0,B.jsx)(km,{size:13}),(0,B.jsx)(`span`,{children:o(`conversation.toTask`)})]}):null,(0,B.jsx)(`button`,{className:`personal-manager-conversation-link`,onClick:i,type:`button`,children:o(`conversation.full`)}),n?(0,B.jsx)(`button`,{"aria-label":o(`conversation.close`),className:`personal-manager-conversation-close`,onClick:n,title:o(`conversation.close`),type:`button`,children:(0,B.jsx)(oh,{size:14})}):null]})]}),(0,B.jsx)(`div`,{"aria-live":`polite`,className:`personal-manager-conversation-messages`,children:c.map(t=>(0,B.jsxs)(`article`,{className:`is-${t.role}`,children:[(0,B.jsx)(`strong`,{children:t.role===`user`?o(`common.you`):t.agentLabel??e??o(`header.manager`)}),(0,B.jsxs)(`div`,{className:`personal-manager-conversation-bubble`,children:[t.role===`user`?(0,B.jsx)(`p`,{children:t.text}):(0,B.jsx)(db,{text:t.text}),t.pending?(0,B.jsx)(`small`,{children:o(`conversation.agentPending`)}):null,(0,B.jsx)(Ey,{request:t.collaboration}),(0,B.jsx)(gb,{delivery:t.returnDelivery})]})]},t.id))})]})}function TS({onClose:e,onOpenDetails:t,run:n}){let{t:r}=Ji();return(0,B.jsxs)(`section`,{"aria-label":r(`session.record`),className:`personal-session-record`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(rm,{size:17}),r(`session.record`)]}),(0,B.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,B.jsx)(oh,{size:15})})]}),(0,B.jsx)(`div`,{children:(0,B.jsx)(`strong`,{children:n.title})}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Agent`}),(0,B.jsx)(`dd`,{children:n.agentLabel})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`common.status`)}),(0,B.jsx)(`dd`,{children:Xi(n.sessionStatus??n.status,r)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Session`}),(0,B.jsx)(`dd`,{title:n.sessionId,children:n.sessionId})]})]}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:t,type:`button`,children:r(`session.details`)})]})}function ES(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??Yy(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>Xy(e)===`running`).slice(0,4).forEach(e=>r.push({id:`run:${e.goalId}`,kind:`run`,run:{agentId:e.agentId,agentLabel:e.agentLabel??e.agentId,completedSteps:e.doneTodoCount??e.agentTodos.filter(e=>e.done).length,goalId:e.goalId,goalTitle:e.title,latestActivity:e.agentSentence,runId:`goal:${e.goalId}`,status:`running`,title:e.nextSentence,totalSteps:Math.max((e.doneTodoCount??0)+e.agentTodos.filter(e=>!e.done).length,1)}})),r;let i=e.goals.find(e=>e.goalId===t);if(!i)return r;if(i.needsYou){let t=e.userTodos.find(e=>e.goalId===i.goalId);r.push({attention:t?{...t,goalTitle:i.title}:{blocking:i.needsYouBlocking??!1,goalId:i.goalId,goalTitle:i.title,text:i.needsYou,todoId:`${i.goalId}:attention`},id:`attention:${i.goalId}`,kind:`attention`})}r.push({id:`run:${i.goalId}`,kind:`run`,run:{agentId:i.agentId,agentLabel:i.agentLabel??i.agentId,completedSteps:i.doneTodoCount??i.agentTodos.filter(e=>e.done).length,goalId:i.goalId,goalTitle:i.title,latestActivity:i.agentSentence,runId:`goal:${i.goalId}`,status:i.state===`推进中`?`running`:i.state===`需修复`?`failed`:`waiting`,title:i.nextSentence,totalSteps:Math.max((i.doneTodoCount??0)+i.agentTodos.filter(e=>!e.done).length,1)}}),i.agentTodos.filter(e=>e.taskClass===`continuous_monitor`).forEach(t=>{let a=e.timeline?.find(e=>e.kind===`run`&&e.run.goalId===i.goalId&&e.run.todoId===t.todoId&&!!e.run.sessionId);r.push({id:`schedule:${i.goalId}:${t.todoId}`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:a?[{label:a.run.latestActivity||a.run.title,runId:a.run.runId,status:a.run.status===`waiting`||a.run.status===`queued`?`running`:a.run.status,timestamp:i.latestActivity||n(`common.recently`)}]:[],goalId:i.goalId,label:t.text,schedule:t.evidence??n(`schedule.summary`),scheduleId:t.todoId,scheduleKind:`monitor`,sessionId:a?.run.sessionId,status:t.done||t.status===`paused`?`paused`:`active`,stopCondition:n(`drawer.scheduleDefaultStop`),target:t.text,timezone:`Asia/Shanghai`}})});let a=e.timeline?.find(e=>e.kind===`proposal`&&e.proposal.actionKind===`heartbeat.bind`&&e.proposal.goalId===i.goalId);if(a){let e=e=>a.proposal.fields.find(t=>t.key===e)?.value;r.push({id:`schedule:${i.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:[],goalId:i.goalId,label:`${n(`schedule.heartbeat`)} · ${i.title}`,nextRunAt:n(`drawer.schedulePending`),notificationRule:n(`drawer.scheduleDefaultNotification`),schedule:e(`cadence`)??n(`schedule.summary`),scheduleId:`${i.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:a.proposal.status===`applied`?`active`:`draft`,stopCondition:e(`stop_condition`)??n(`drawer.scheduleDefaultStop`),timezone:e(`timezone`)??`Asia/Shanghai`}})}return r}function DS(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function OS(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 kS(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 AS(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 jS(e,t){let n=AS(e),r=Iy(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`?qy(Ky(e.receipt),t):t(`proposal.summary.teamPlan`,{goal:Hy(e.normalized_parameters),count:Vy(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`?kS(e,r,t):e.action_kind===`team.plan`?By(e.normalized_parameters,t):OS(e.normalized_parameters,t),goalId:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:void 0,impact:e.action_kind===`operation.execute`?t(`proposal.impact.operation`):e.action_kind===`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`):t(`proposal.impact.default`),previewId:e.proposal_id,lifecycleOperation:n,gate:e.gate?{kind:String(e.gate.kind??`protected_action`),nextAction:typeof e.gate.next_action==`string`?e.gate.next_action:void 0,summary:String(e.gate.summary??t(`proposal.gate.default`))}:void 0,primaryLabel:e.action_kind===`operation.execute`?o?.kind===`result`?o.resultDeliveryVerified?t(`proposal.primary.operationResultVerified`):t(`proposal.primary.operationResultPending`):t(`proposal.primary.operationGroup`):e.action_kind===`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:e.status===`applied`&&e.action_kind!==`operation.execute`&&r.interaction!==`completed`?`error`:DS(e.status),teamPlanOutcome:e.action_kind===`team.plan`?Ky(e.receipt)??void 0:void 0,teamPlanAssignments:e.action_kind===`team.plan`?Uy(e.receipt,e.normalized_parameters):void 0,teamPlanGapLanes:e.action_kind===`team.plan`?Wy(e.receipt,e.normalized_parameters):void 0,title:c}}function MS(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 NS(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 PS(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 FS(e,t){let n=PS(e,[`目标`,`Objective`]),r=PS(e,[`完成标准`,`Completion criteria`]),i=PS(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||NS(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 IS(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 LS(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 RS(e,t){return PS(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 zS(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 BS(e,t){let n=e.toLowerCase();return t.find(e=>n.includes(e.agentId.toLowerCase())||n.includes(e.label.toLowerCase()))}function VS(e){let t=PS(e,[`标题`,`任务标题`,`Todo 标题`]),n=PS(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 HS=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),US=5242880,WS=4;function GS(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 KS({agents:e=[{agentId:`codex`,available:!0,capability:`代码与项目执行`,label:`Codex`}],callbacks:t={},goalArchiveLoadState:n={error:null,phase:`ready`},managerChannelBinding:r,managerRuntime:i,model:a,readOnly:o=!1,selectedAgentId:s,selectedGoalId:c,statusSourceControl:l}){let{locale:u,t:d}=Ji(),[f,p]=(0,z.useState)(c??null),[m,h]=(0,z.useState)(s??e.find(e=>e.available)?.agentId??`codex`),[g,_]=(0,z.useState)(null),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(null),[S,C]=(0,z.useState)({}),[w,T]=(0,z.useState)(`chat`),[E,D]=(0,z.useState)(!1),[O,k]=(0,z.useState)(!1),[ee,te]=(0,z.useState)(!1),[A,j]=(0,z.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{}}}),[M,ne]=(0,z.useState)(!1),[N,P]=(0,z.useState)([]),[re,ie]=(0,z.useState)(null),[ae,F]=(0,z.useState)(null),[oe,I]=(0,z.useState)(()=>new Set),[se,L]=(0,z.useState)(()=>new Set),[ce,le]=(0,z.useState)(`idle`),[ue,de]=(0,z.useState)([]),[fe,pe]=(0,z.useState)([]),[me,he]=(0,z.useState)(!1),[ge,_e]=(0,z.useState)(gS),[ve,ye]=(0,z.useState)({}),[be,xe]=(0,z.useState)([]),Se=(0,z.useRef)(!1),Ce=(0,z.useRef)(NaN),we=(0,z.useRef)(null),Te=(0,z.useRef)(null),Ee=(0,z.useRef)(null),De=(0,z.useRef)(null),Oe=(0,z.useRef)(new Set),ke=(0,z.useRef)(new Set),[Ae,je]=(0,z.useState)(null),R=c===void 0?f:c,Me=s??m,Ne=`${R??`manager`}:${Me}`,Pe=A[Ne]??``;(0,z.useEffect)(()=>{P([]),ie(null)},[Ne]);function Fe(e,t){j(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 Ie(e){Fe(Ne,e)}function Le(e){return yh.find(t=>t.id===e)?.prompt??``}(0,z.useEffect)(()=>{let e=we.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[Pe]);let Re=(0,z.useMemo)(()=>a.goals.map(e=>{let t=ve[e.goalId];return t?{...e,repository:{branch:t.branch,identity:t.identity,label:t.label,readOnly:!0}}:e}),[ve,a.goals]),ze=(0,z.useMemo)(()=>Re.filter(e=>Xy(e)===`needs_you`).length,[Re]),Be=(0,z.useMemo)(()=>Re.filter(e=>Xy(e)===`needs_you`&&(e.needsYouBlocking||e.state===`等你`)).length,[Re]),V=Re.find(e=>e.goalId===R)??null;function Ve(e){Ee.current=document.activeElement instanceof HTMLElement?document.activeElement:null,he(!1),_(e)}function He(){_(null),window.requestAnimationFrame(()=>{let e=Ee.current;e?.isConnected&&e.getClientRects().length?e.focus({preventScroll:!0}):document.querySelector(`.personal-mobile-menu`)?.focus({preventScroll:!0})})}let Ue=g?.kind===`settings`,We=R,Ge=(0,z.useMemo)(()=>{let e=Object.values(S).filter(e=>e.actionKind===`heartbeat.bind`&&e.goalId&&e.status===`applied`).map(e=>({id:`schedule:${e.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:Me,executionHistory:[],goalId:e.goalId,label:e.title,nextRunAt:d(`drawer.schedulePending`),notificationRule:d(`drawer.scheduleDefaultNotification`),schedule:e.fields.find(e=>e.key===`cadence`)?.value??d(`schedule.summary`),scheduleId:`${e.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:e.status===`applied`?`active`:`draft`,stopCondition:e.fields.find(e=>e.key===`stop_condition`)?.value??d(`drawer.scheduleDefaultStop`),timezone:e.fields.find(e=>e.key===`timezone`)?.value??`Asia/Shanghai`}})),t=[...ES(a,We,d),...a.timeline??[],...e,...bS(Object.values(S)).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)||ue.includes(e.proposal.previewId)).filter(e=>!R||e.kind===`message`?!0:e.kind===`proposal`?!e.proposal.goalId||e.proposal.goalId===R:e.kind===`attention`?e.attention.goalId===R:e.kind===`run`?e.run.goalId===R:e.kind===`schedule`?e.schedule.goalId===R:e.output.goalId===R)},[We,a,S,Me,R,ue,d]),Ke=(0,z.useMemo)(()=>b?Ge.filter(e=>e.kind===`message`?!0:e.kind===`run`?e.run.runId===b.runId:e.kind===`output`&&e.output.runId===b.runId):Ge,[b,Ge]);(0,z.useEffect)(()=>{if(!b)return;let e=Ge.find(e=>e.kind===`run`&&e.run.runId===b.runId);!e||e.kind!==`run`||JSON.stringify({completedSteps:b.completedSteps,latestActivity:b.latestActivity,messages:b.sessionMessages,sessionStatus:b.sessionStatus,status:b.status,totalSteps:b.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})&&x(e.run)},[b,Ge]);let qe=(0,z.useMemo)(()=>Ge.flatMap(e=>e.kind===`message`?[e.message]:[]),[Ge]),Je=(0,z.useMemo)(()=>V?Ge.flatMap(e=>e.kind===`message`?[e.message]:[]):[],[Ge,V]);(0,z.useEffect)(()=>{V||E||qe.some(e=>e.pending)&&k(!0)},[E,qe,V]),(0,z.useEffect)(()=>{!V||w===`chat`||Je.some(e=>e.pending)&&te(!0)},[Je,V,w]);let Ye=(0,z.useMemo)(()=>Ge.filter(e=>e.kind===`message`||e.kind===`proposal`&&(ue.includes(e.proposal.previewId)||fe.includes(e.proposal.previewId))),[Ge,ue,fe]),Xe=Ye[Ye.length-1],Ze=Xe?.kind===`message`?Xe.message.text.length:0;(0,z.useEffect)(()=>{if(!E||!Te.current)return;let e=window.requestAnimationFrame(()=>{Te.current&&(Te.current.scrollTop=Te.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[Ye.length,E,Ze]);let Qe=(0,z.useMemo)(()=>{if(g?.kind===`settings`)return null;if(g?.kind===`attention`)return{kind:`attention`,item:Jd(g.item,a.attentionHistory??a.userTodos)};if(g?.kind===`goal`){let e=Re.find(e=>e.goalId===g.item.goalId);return e?{item:e,kind:`goal`}:g}if(g?.kind!==`run`)return g;let e=Ge.find(e=>e.kind===`run`&&e.run.runId===g.item.runId);return e?{item:e.run,kind:`run`}:g},[Ge,g,Re,a.attentionHistory,a.userTodos]);(0,z.useEffect)(()=>{if(o){ye({}),xe([]);return}let e=!1;return Promise.all([Zg(),c_()]).then(([t,n])=>{e||(ye(Object.fromEntries(t.map(e=>[e.goal_id,e.repository]))),xe(n))}).catch(()=>{}),()=>{e=!0}},[o]),(0,z.useEffect)(()=>{if(!me)return;function e(e){e.key===`Escape`&&he(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[me]),(0,z.useEffect)(()=>{if(R||!Ge.length)return;if(!Se.current){Se.current=!0;try{Ce.current=Date.parse(window.localStorage.getItem(`loopx-pw-last-visit`)??``),window.localStorage.setItem(`loopx-pw-last-visit`,new Date().toISOString())}catch{Ce.current=NaN}}let e=Ce.current,t=Ge.filter(e=>e.kind===`run`).map(e=>e.run),n=t=>{let n=Date.parse(t??``);return!Number.isNaN(e)&&!Number.isNaN(n)&&n>e},r={attention:ze,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};je(e=>e?.attention===r.attention&&e.done===r.done&&e.failed===r.failed?e:r)},[Ge,ze,R]),(0,z.useEffect)(()=>{if(o){C({});return}let e=!1;return Uh(R?{goalId:R}:{contextKind:`manager`}).then(t=>{if(e)return;let n=t.filter(e=>[`preview_ready`,`gated`,`deferred`,`applying`].includes(e.status)||e.action_kind===`operation.execute`&&e.status===`applied`).map(e=>jS(e,d)),r=Object.fromEntries(n.map(e=>[e.previewId,e]));C(e=>({...e,...r})),R||pe(n.map(e=>e.previewId))}).catch(()=>{}),()=>{e=!0}},[o,R,d]);async function $e(e,n={}){if(o)throw Error(d(`source.readOnlyWriteError`));let r;try{r=t.onPreviewAction?await t.onPreviewAction(e):jS(await Vh(e),d)}catch(t){if(!(t instanceof Ih)||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??d(`proposal.workspaceGate.defaultSummary`))},impact:d(o?`proposal.workspaceGate.agentImpact`:`proposal.workspaceGate.selectionImpact`),previewId:`workspace-choice-${Date.now().toString(36)}`,sourceRequest:e,status:`gated`,title:d(o?`proposal.workspaceGate.agentTitle`:`proposal.workspaceGate.selectionTitle`),workspaceCandidates:i}}return de(e=>e.includes(r.previewId)?e:[...e,r.previewId]),C(e=>({...e,[r.previewId]:r})),n.select!==!1&&_({item:r,kind:`proposal`}),r}function et(){lt(null),Fe(`manager:${Me}`,d(`composer.createGoalTemplate`)),window.requestAnimationFrame(()=>we.current?.focus())}async function tt(e,n){he(!1);let r={delete:`Deleted from the owner workspace`,resume:`Resumed from the owner workspace`,stop:`Stopped from the owner workspace`},i={delete:d(`proposal.summary.lifecycleDelete`,{title:e.title}),resume:d(`proposal.summary.lifecycleResume`,{title:e.title}),stop:d(`proposal.summary.lifecycleStop`,{title:e.title})},a=null,o=!1;try{if(n===`stop`){if(Oe.current.has(e.goalId))return;Oe.current.add(e.goalId),I(new Set(Oe.current)),_(null),a={goalId:e.goalId,next:`stopped`,optimisticApplied:!0,previous:e.activationState},F(d(`feedback.applying`,{title:i.stop})),t.onGoalActivationStateChange?.(e.goalId,`stopped`)}if(t.onExecuteGoalLifecycle){if(n===`delete`)throw Error(`The selected status source does not authorize Goal deletion.`);let a=await t.onExecuteGoalLifecycle({goalId:e.goalId,operation:n,reason:r[n]});if(!a.projectionVerified)throw Error(`Goal lifecycle projection did not verify.`);o=!0,t.onGoalActivationStateChange?.(e.goalId,a.activationState),F(d(`feedback.completed`,{title:i[n]})),n===`stop`&<(null),await at([e.goalId]);return}let s=await $e({actionKind:`goal.lifecycle`,context:{kind:`goal_directory`,goal_id:e.goalId},idempotencyKey:`workspace-goal-${n}-${e.goalId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:n,reason:r[n]},summary:i[n]},{select:n!==`stop`});if(s.goalId!==e.goalId||s.lifecycleOperation!==n)throw _(null),Error(d(`actionReview.targetChanged`));n===`stop`&&(s.reviewPlan?.interaction===`direct`?(o=!0,await ot(s,{lifecycleProjection:a??void 0,presentation:`feedback`})):(a&&t.onGoalActivationStateChange?.(a.goalId,a.previous),F(s.gate?d(`feedback.gateRequired`,{summary:s.gate.summary}):d(`feedback.notCompleted`,{status:s.status})),_({item:s,kind:`proposal`})))}catch(e){a&&!o&&t.onGoalActivationStateChange?.(a.goalId,a.previous),F(d(`feedback.executionFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{n===`stop`&&(Oe.current.delete(e.goalId),I(new Set(Oe.current)))}}function nt(e,t){Ie(d(t?e===`heartbeat`?`composer.heartbeatTemplate`:`composer.monitorTemplate`:e===`heartbeat`?`composer.heartbeatTemplateWithoutGoal`:`composer.monitorTemplateWithoutGoal`)),_(null),window.requestAnimationFrame(()=>we.current?.focus())}async function rt(e,n,r=``){let i=await t.onRequestScheduleConfig?.(e,n);if(i){de(e=>e.includes(i.previewId)?e:[...e,i.previewId]),C(e=>({...e,[i.previewId]:i})),_({item:i,kind:`proposal`});return}if(!n){Ie(d(e===`heartbeat`?`composer.heartbeatGoalQuestion`:`composer.monitorGoalQuestion`));return}let a=Date.now().toString(36);await $e({actionKind:e===`heartbeat`?`heartbeat.bind`:`monitor.create`,context:{kind:`schedule`,goal_id:n},idempotencyKey:`workspace-${e}-${n}-${a}`,normalizedParameters:e===`heartbeat`?{agent_id:Me,cadence:IS(r),goal_id:n,stop_condition:zS(r),timezone:`Asia/Shanghai`}:{agent_id:Me,cadence:IS(r),goal_id:n,stop_condition:zS(r),target:RS(r,d),target_key:`goal-${n}`,timezone:`Asia/Shanghai`},summary:e===`heartbeat`?d(`proposal.summary.heartbeat`):d(`proposal.summary.monitor`,{target:RS(r,d)})})}async function it(e){if(!ke.current.has(e.todoId)){ke.current.add(e.todoId),L(new Set(ke.current)),F(d(`feedback.preparingPreview`,{title:e.text}));try{await $e({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:d(`tasks.markComplete`,{name:e.text})}),F(null)}catch(e){F(d(`feedback.previewFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{ke.current.delete(e.todoId),L(new Set(ke.current))}}}function at(e){let n=t.onReconcileStatus,r=n?n({invalidateGoalIds:e}):t.onRefresh?.();return Promise.resolve(r).catch(()=>{F(d(`feedback.goalRefreshFailed`))})}async function ot(e,n={}){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=n.presentation!==`feedback`,o=e.actionKind===`goal.lifecycle`&&e.goalId&&(e.lifecycleOperation===`stop`||e.lifecycleOperation===`resume`)?{goalId:e.goalId,next:e.lifecycleOperation===`stop`?`stopped`:`active`,optimisticApplied:!1,previous:a.goals.find(t=>t.goalId===e.goalId)?.activationState??(e.lifecycleOperation===`stop`?`active`:`stopped`)}:null,s=n.lifecycleProjection??o;F(d(`feedback.applying`,{title:e.title}));let c={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`pending`,reason:`apply_pending`,canApply:!1}:void 0,status:`applying`};C(t=>({...t,[e.previewId]:c})),i&&_({item:c,kind:`proposal`}),s&&!s.optimisticApplied&&t.onGoalActivationStateChange?.(s.goalId,s.next);try{if(t.onApplyProposal){await t.onApplyProposal(e);let n={...e,status:`applied`};C(t=>({...t,[e.previewId]:n})),i&&_({item:n,kind:`proposal`}),F(d(`feedback.completed`,{title:e.title})),e.actionKind===`goal.lifecycle`&&((e.lifecycleOperation===`stop`||e.lifecycleOperation===`delete`)&<(null),e.lifecycleOperation===`delete`&&e.goalId&&t.onGoalDeleted?.(e.goalId),at(e.goalId?[e.goalId]:void 0));return}let n=await Wh(e.previewId);if(n.proposal.proposal_id!==e.previewId||n.proposal.action_kind!==e.actionKind||e.actionKind===`goal.lifecycle`&&(n.proposal.normalized_parameters.goal_id!==e.goalId||AS(n.proposal)!==e.lifecycleOperation))throw new Ih(d(`actionReview.targetChanged`),{error_code:`action_response_mismatch`});let r=jS(n.proposal,d);if(C(t=>({...t,[e.previewId]:r})),i&&_({item:r,kind:`proposal`}),r.reviewPlan?.interaction!==`completed`){s&&t.onGoalActivationStateChange?.(s.goalId,s.previous),_({item:r,kind:`proposal`}),F(n.proposal.status===`stale`?d(`feedback.stale`):d(`actionReview.${r.reviewPlan.reason}`));return}F(d(`feedback.completed`,{title:r.title})),r.actionKind===`todo.create`&&await t.onRefresh?.(),r.actionKind===`goal.lifecycle`&&(r.lifecycleOperation===`stop`||r.lifecycleOperation===`delete`)&<(null),r.actionKind===`goal.lifecycle`&&r.lifecycleOperation===`delete`&&r.goalId&&t.onGoalDeleted?.(r.goalId),r.actionKind===`goal.lifecycle`&&at(r.goalId?[r.goalId]:void 0)}catch(n){if(s&&t.onGoalActivationStateChange?.(s.goalId,s.previous),n instanceof Ih&&n.payload.error_code===`protected_action`){let r=n.payload.gate,i=r&&typeof r==`object`?r:{},a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`gated`,reason:`authority_gate`,canApply:!1}:void 0,gate:{kind:String(i.kind??`protected_action`),nextAction:typeof i.next_action==`string`?i.next_action:void 0,summary:String(i.summary??n.message)},status:`gated`};C(t=>({...t,[e.previewId]:a})),_({item:a,kind:`proposal`}),F(d(`feedback.gateRequired`,{summary:a.gate.summary})),e.actionKind===`goal.create`&&e.goalId&&(t.onRefresh?.(),lt(e.goalId));return}let r=n instanceof Ih&&Ly(n.payload),i=n instanceof Ih&&n.payload.error_code===`action_response_mismatch`,a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:r?`refresh`:`repair`,reason:i?`readback_unverified`:r?`stale_proposal`:`apply_failed`,canApply:!1}:void 0,errorMessage:n instanceof Error?n.message:String(n),status:r?`stale`:`error`};C(t=>({...t,[e.previewId]:a})),_({item:a,kind:`proposal`}),F(d(`feedback.executionFailed`,{error:a.errorMessage}))}}let st={...t,onOpenRunSession:async e=>{e.goalId!==R&<(e.goalId),T(`chat`),await t.onOpenRunSession?.(e),x(e),_(null)},onOpenGoal:e=>{lt(e),at([e])},onOpenGoalView:e=>{T(e),e===`chat`&&x(null),_(null)},onOpenOutput:e=>{e.goalId!==R&<(e.goalId),T(`files`),t.onOpenOutput?.(e)},onApplyProposal:ot,onCancelProposal:async e=>{_(null),C(t=>{let n={...t};return delete n[e.previewId],n});try{t.onCancelProposal?.(e),t.onCancelProposal||await Gh(e.previewId)}catch(t){C(t=>({...t,[e.previewId]:e})),F(d(`feedback.cancelFailed`,{error:t instanceof Error?t.message:String(t)}))}},onTransitionProposal:async(e,t)=>{let n=jS(await Kh(e.previewId,t),d);de(e=>e.includes(n.previewId)?e:[...e,n.previewId]),C(r=>{let i={...r};return t===`regenerate`&&delete i[e.previewId],i[n.previewId]=n,i}),_({item:n,kind:`proposal`})},onSelectWorkspaceCandidate:async(e,t)=>{e.sourceRequest&&(C(t=>{let n={...t};return delete n[e.previewId],n}),await $e({...e.sourceRequest,idempotencyKey:`${e.sourceRequest.idempotencyKey}-${t}`,normalizedParameters:{...e.sourceRequest.normalizedParameters,workspace_ref:t}}))},onPreviewAction:$e,onRequestScheduleConfig:(e,t)=>nt(e,t),onOpenNotificationSettings:e=>Ve({goalId:e,kind:`settings`,tab:`lark`}),onFetchNotificationTargets:()=>hg(),onSetupGoalChannel:e=>_g(e),onToggleGoalAutoNotify:e=>vg(e),onUpdateSchedule:async(e,t)=>{let n=Date.now().toString(36),r=e.scheduleKind===`heartbeat`;await $e({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??Me,...!r&&t===`run_now`?{endpoint_id:Me}:{},...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}`})}},ct=o?{onOpenGoal:st.onOpenGoal,onOpenGoalView:st.onOpenGoalView,onOpenOutput:st.onOpenOutput}:st;function lt(e){p(e),D(!1),k(!1),te(!1),x(null),_(null),T(`tasks`),he(!1),t.onSelectGoal?.(e)}function ut(e){h(e),t.onSelectAgent?.(e)}function dt(e){_e(e),_S(e)}async function ft(n){let r=n?[]:N,i=(n??Pe).trim()||(r.length?d(`composer.imageAnalysisPrompt`):``);if(!(!i||M)){n||(Ie(``),P([])),ie(null),ne(!0);try{if(r.length){R?w!==`chat`&&te(!0):k(!0);let e=await t.onSendMessage?.(i,Me,R,r);e&&await $e(e);return}let n=Eb(i,{agents:e.map(e=>({agentId:e.agentId,label:e.label})),goalId:R,todos:(V?.agentTodos??[]).map(e=>({text:e.text,todoId:e.todoId}))});if(n.route===`clarify`){Ie(i);let e=d(`composer.clarifySingleAction`);n.missingFields.includes(`resume_when`)&&(e=d(`composer.clarifyDefer`)),F(e);return}if(n.actionKind===`goal.create`){let e=FS(i,d),t=MS(e.title);await $e({actionKind:`goal.create`,context:{kind:`manager`,goal_id:null,natural_language:i},idempotencyKey:`workspace-goal-intent-${t}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Me,completion_criteria:e.completionCriteria,execution_boundary:e.executionBoundary,goal_id:t,heartbeat:{cadence:IS(i),enabled:n.normalizedParameters.heartbeat_enabled===!0,timezone:`Asia/Shanghai`},initial_todos:e.initialTodos,objective:e.objective,permission:e.permission,stop_condition:zS(i),title:e.title,workspace_ref:`current`},summary:d(`proposal.summary.goalCreate`,{title:e.title})});return}if(R&&n.actionKind===`heartbeat.bind`){await rt(`heartbeat`,R,i);return}if(R&&n.actionKind===`monitor.create`){let e=LS(i,d);if(e){Ie(i),F(e);return}await rt(`monitor`,R,i);return}let a=BS(i,e);if(R&&a&&n.actionKind===`agent.bind`){await $e({actionKind:`agent.bind`,context:{kind:`goal`,goal_id:R,natural_language:i},idempotencyKey:`workspace-agent-bind-${R}-${a.agentId}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:a.agentId,goal_id:R},summary:`将 ${a.label} 绑定到 ${V?.title??R}`});return}if(R&&n.actionKind===`todo.create`){if(n.normalizedParameters.start_execution===!0){await $e({actionKind:`todo.create`,context:{kind:`goal`,goal_id:R,natural_language:i},idempotencyKey:`workspace-task-start-${R}-${Date.now().toString(36)}`,normalizedParameters:{endpoint_id:a?.agentId??Me,goal_id:R,start_execution:!0,text:i},summary:`交给 Agent 执行:${i.slice(0,120)}`});return}let e=a?.agentId??(/(交给|分配给|让).{0,24}(agent|codex|claude|kiro|kimi)/iu.test(i)?Me:null);await $e({actionKind:`todo.create`,context:{kind:`goal`,goal_id:R,natural_language:i},idempotencyKey:`workspace-todo-create-${R}-${Date.now().toString(36)}`,normalizedParameters:{...e?{endpoint_id:e}:{},goal_id:R,text:VS(i)},summary:`创建 Todo:${VS(i)}`});return}let o=V?.agentTodos.find(e=>i.includes(e.todoId)||i.includes(e.text)),s=typeof n.normalizedParameters.operation==`string`?n.normalizedParameters.operation:null;if(R&&o&&n.actionKind===`todo.update`&&s){await $e({actionKind:`todo.update`,context:{kind:`todo`,goal_id:R,todo_id:o.todoId,natural_language:i},idempotencyKey:`workspace-todo-update-${o.todoId}-${s}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Me,...s===`reassign`&&a?{endpoint_id:a.agentId}:{},...s===`block`?{note:i}:{},...s===`defer`&&typeof n.normalizedParameters.resume_when==`string`?{resume_when:n.normalizedParameters.resume_when}:{},goal_id:R,operation:s,todo_id:o.todoId},summary:`更新 Todo:${o.text}`});return}R?w!==`chat`&&te(!0):k(!0);let c=await t.onSendMessage?.(i,Me,R);c&&await $e(c)}catch(e){n||(Ie(i),P(r));let t=e instanceof Error?e.message:d(`feedback.sendGenericError`);F(d(`feedback.sendFailed`,{error:t}))}finally{ne(!1)}}}let pt=e.find(e=>e.agentId===Me)?.label??Me,mt=!V&&Pe.startsWith(d(`composer.createGoalDraftLead`)),ht=Ge.filter(e=>e.kind===`run`&&!!e.run.sessionId&&!!e.run.canInterrupt&&(e.run.status===`running`||e.run.status===`queued`)).length;async function gt(e){if(!e?.length)return;let t=WS-N.length,n=Array.from(e).slice(0,Math.max(0,t)),r=n.find(e=>!HS.has(e.type)),i=n.find(e=>e.size>US);if(t<=0){ie(d(`composer.imageCountError`,{count:WS}));return}if(r){ie(d(`composer.imageTypeError`));return}if(i){ie(d(`composer.imageSizeError`,{size:US/1024/1024}));return}try{let t=await Promise.all(n.map(e=>GS(e,d)));P(e=>[...e,...t].slice(0,WS)),ie(e.length>n.length?d(`composer.imageCountError`,{count:WS}):null)}catch(e){ie(e instanceof Error?e.message:d(`composer.imageReadGenericError`))}finally{De.current&&(De.current.value=``)}}function _t(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(),gt(t))}async function vt(){let e=await c_();xe(e)}async function yt(){await Promise.all([vt(),t.onRefresh?.()])}async function bt(){if(!(!t.onRefresh||ce===`loading`)){le(`loading`);try{await t.onRefresh(),le(`done`)}catch{le(`error`)}window.setTimeout(()=>le(`idle`),1800)}}let xt=Ue?(0,B.jsx)(pS,{callbacks:ct,focusGoalConnection:!!(g?.kind===`settings`&&g.goalId),goalNotifications:a.goalNotifications??[],goals:Re,initialGoalId:g?.kind===`settings`?g.goalId??R:R,initialTab:g?.kind===`settings`?g.tab??`lark`:`lark`,onChanged:()=>void yt(),onClose:He,onThemeChange:dt,theme:ge}):null;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{hidden:Ue,children:(0,B.jsx)(vS,{drawer:Qe?(0,B.jsx)(Fb,{agents:e,attentionHistory:a.attentionHistory??a.userTodos,onSelectAttention:e=>_({kind:`attention`,item:e}),callbacks:ct,goalNotifications:a.goalNotifications??[],goals:Re,inspectorExpanded:v,larkConnections:o?[]:be,onClose:()=>{Qe.kind===`proposal`&&[`applied`,`rejected`].includes(Qe.item.status)&&(Qe.item.actionKind!==`heartbeat.bind`||Qe.item.status!==`applied`)&&C(e=>{let t={...e};return delete t[Qe.item.previewId],t}),y(!1),_(null)},onToggleInspectorSize:()=>y(e=>!e),readOnly:o,runs:Ge.flatMap(e=>e.kind===`run`?[e.run]:[]),selection:Qe}):null,drawerMode:Qe?.kind===`todo`?v?`inspector-full`:`inspector`:`panel`,drawerOpen:Qe!==null,mobileSidebarOpen:me,onCloseMobileSidebar:()=>he(!1),theme:ge,main:(0,B.jsxs)(`div`,{className:`personal-channel`,children:[(0,B.jsx)(ib,{agents:e,managerChatOpen:E,managerChannelBinding:r,managerRuntime:i,mobileNavigationOpen:me,onOpenGoalCapabilities:V&&!o?()=>Ve({goalId:V.goalId,kind:`settings`,tab:`capabilities`}):void 0,onRefresh:t.onRefresh?()=>void bt():void 0,onOpenNavigation:()=>he(!0),onOpenManagerChat:()=>{k(!1),D(!0)},onSelectGoalTab:e=>{T(e),e===`chat`&&(x(null),te(!1))},onSelectAgent:ut,onReturnManagerHome:()=>{D(!1),k(!1),window.requestAnimationFrame(()=>Te.current?.scrollTo({behavior:`smooth`,top:0}))},selectedAgentId:Me,refreshState:ce,readOnlySourceLabel:o?l?.activeSource.label:void 0,selectedGoal:V,selectedGoalTab:w}),(0,B.jsxs)(`div`,{className:`personal-channel-scroll`,"data-active-goal-view":V?w:void 0,ref:Te,children:[!V&&!E&&Ae&&Ae.done+Ae.failed+Ae.attention>0?(0,B.jsxs)(`section`,{className:`personal-digest-card`,"aria-label":d(`digest.away`),children:[(0,B.jsx)(`strong`,{children:d(`digest.away`)}),(0,B.jsxs)(`div`,{className:`personal-digest-stats`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:Ae.done}),d(`digest.completed`)]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:Ae.failed}),d(`digest.failed`)]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:Ae.attention}),d(`digest.needsYou`)]})]})]}):null,!V&&!E?(0,B.jsxs)(`section`,{className:`personal-manager-greeting`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(rm,{size:20})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:d(`home.greeting`)}),(0,B.jsx)(`p`,{children:a.goals.some(e=>e.activationState===`active`&&e.loadState)?d(`startup.partial`):(0,B.jsxs)(B.Fragment,{children:[d(`home.waitingCount`,{count:ze}),` `,d(`home.blockingSummary`,{count:Be})]})})]})]}):null,V?.loadState?(0,B.jsx)(`section`,{className:`personal-manager-greeting`,role:`status`,"data-testid":`goal-status-loading`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:d(V.loadState===`error`?`startup.goalError`:`startup.goalLoading`)}),(0,B.jsx)(`p`,{children:d(V.loadError?`startup.error.${V.loadError}`:`startup.independent`)}),V.loadState===`error`?(0,B.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,type:`button`,onClick:()=>void t.onRefresh?.(),children:d(`startup.retry`)}):null]})}):V?(0,B.jsx)(Tx,{activeTab:w,scrollRef:Te,panels:{overview:(0,B.jsx)(wx,{active:!Ue&&w===`overview`,goal:V,items:Ge,userTodos:a.userTodos,readOnly:o,onOpenDetails:()=>_({kind:`goal`,item:V}),onSelect:_,onView:T}),tasks:(0,B.jsx)(sx,{historyEnabled:!o,goal:V,items:Ge,onDraftTaskFromMessage:o?void 0:e=>{Ie(`创建一个 Task:${yS(e)}`),F(d(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>we.current?.focus())},onOpenChat:()=>T(`chat`),onQuickComplete:o?void 0:it,onSelect:_,quickCompletingTodoIds:se,selectedTodoId:Qe?.kind===`todo`?Qe.item.todoId:null,userTodos:a.userTodos}),files:(0,B.jsx)(CS,{items:Ge.filter(e=>e.kind===`output`),onSelect:_,reportState:a.periodicReports}),chat:(0,B.jsxs)(B.Fragment,{children:[V&&b?.goalId===V.goalId?(0,B.jsx)(TS,{onClose:()=>x(null),onOpenDetails:()=>_({item:b,kind:`run`}),run:b}):null,(0,B.jsx)(_b,{items:Ke,onSelect:_,selectedGoal:V})]})}},`${l?.activeSource.statusUrl??`/status.json`}:${V.goalId}`):E?(0,B.jsx)(_b,{items:Ye,onSelect:_,selectedGoal:null}):(0,B.jsx)(SS,{goals:Re,onRetry:()=>void t.onRefresh?.(),onSelectGoal:lt,systemHealth:a.systemHealth})]}),(0,B.jsx)(`div`,{className:`personal-composer-wrap`,children:o?(0,B.jsxs)(`div`,{className:`personal-read-only-notice`,children:[(0,B.jsx)(`strong`,{children:d(`source.readOnlyNoticeTitle`)}),(0,B.jsx)(`span`,{children:d(`source.readOnlyNoticeDescription`)})]}):(0,B.jsxs)(B.Fragment,{children:[!V&&!E&&O&&qe.length?(0,B.jsx)(wS,{messages:qe,onClose:()=>k(!1),onOpenConversation:()=>{k(!1),D(!0)}}):null,V&&w!==`chat`&&ee&&Je.length?(0,B.jsx)(wS,{agentLabel:pt,messages:Je,onClose:()=>te(!1),onDraftTask:w===`tasks`?e=>{Ie(`创建一个 Task:${yS(e)}`),F(d(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>we.current?.focus())}:void 0,onOpenConversation:()=>{te(!1),T(`chat`)},title:`${V.title} · ${pt}`}):null,ae?(0,B.jsxs)(`div`,{className:`personal-action-feedback`,role:`status`,children:[(0,B.jsx)(`span`,{children:ae}),(0,B.jsx)(`button`,{"aria-label":d(`common.closeActionReceipt`),onClick:()=>F(null),type:`button`,children:(0,B.jsx)(oh,{size:14})})]}):null,(0,B.jsx)(`p`,{className:`personal-composer-hint`,children:V?ht>0?d(`composer.goalRunningHint`,{agent:pt,count:ht}):d(`composer.goalMessageHint`,{agent:pt}):d(`composer.managerMessageHint`)}),V?(0,B.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,B.jsxs)(`button`,{"aria-label":d(`composer.nextAction`),disabled:M,onClick:()=>void ft(d(`composer.nextActionPrompt`)),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(Nm,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.nextAction`)})]}),(0,B.jsxs)(`button`,{"aria-label":d(`composer.agentProgress`),disabled:M,onClick:()=>void ft(d(`composer.agentProgressPrompt`)),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(qm,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.agentProgress`)})]}),(0,B.jsxs)(`button`,{"aria-label":d(`composer.monitor`),disabled:M,onClick:()=>void ft(d(`composer.monitorShortcutTemplate`,{target:d(`schedule.defaultTarget`)})),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(am,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.monitor`)})]}),(0,B.jsxs)(`button`,{"aria-label":d(`composer.blockers`),disabled:M||!Le(`gate`),onClick:()=>void ft(Le(`gate`)),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(um,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.blockers`)})]}),(0,B.jsxs)(`button`,{"aria-label":d(`composer.evidence`),disabled:M||!Le(`evidence`),onClick:()=>void ft(Le(`evidence`)),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(Sm,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.evidence`)})]})]}):(0,B.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,B.jsxs)(`button`,{"aria-label":d(`composer.globalTasks`),disabled:M,onClick:()=>void ft(d(`composer.globalTasksPrompt`)),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(Nm,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.globalTasks`)})]}),(0,B.jsxs)(`button`,{"aria-label":d(`composer.globalProgress`),disabled:M,onClick:()=>void ft(d(`composer.globalProgressPrompt`)),title:d(`composer.sendMessageHint`),type:`button`,children:[(0,B.jsx)(qm,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.globalProgress`)})]}),(0,B.jsxs)(`button`,{"aria-label":d(`composer.createGoal`),onClick:et,title:d(`composer.createGoalHint`),type:`button`,children:[(0,B.jsx)(Vm,{size:13}),(0,B.jsx)(`span`,{children:d(`composer.createGoal`)})]})]}),mt?(0,B.jsxs)(`div`,{className:`personal-goal-draft-status`,role:`status`,children:[(0,B.jsx)(`strong`,{children:d(`composer.createGoalDraft`)}),(0,B.jsx)(`span`,{children:d(`composer.createGoalDraftDescription`)})]}):null,N.length?(0,B.jsx)(`div`,{className:`personal-composer-images`,"aria-label":d(`composer.imagesPending`),children:N.map(e=>(0,B.jsxs)(`figure`,{children:[(0,B.jsx)(`img`,{alt:e.name,src:e.dataUrl}),(0,B.jsx)(`button`,{"aria-label":d(`composer.sentImageAlt`,{name:e.name}),onClick:()=>P(t=>t.filter(t=>t.id!==e.id)),type:`button`,children:(0,B.jsx)(oh,{size:13})})]},e.id))}):null,re?(0,B.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:re}):null,(0,B.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(),gt(t))},children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(rm,{size:17}),e.find(e=>e.agentId===Me)?.label??Me]}),(0,B.jsx)(`button`,{"aria-label":d(`composer.addImage`),className:`personal-composer-attach`,disabled:M||N.length>=WS,onClick:()=>De.current?.click(),title:d(`composer.attachImageHint`),type:`button`,children:(0,B.jsx)(Rm,{size:17})}),(0,B.jsx)(`input`,{accept:`image/png,image/jpeg,image/webp,image/gif`,"aria-label":d(`composer.imagePicker`),className:`personal-composer-file-input`,disabled:M||N.length>=WS,multiple:!0,onChange:e=>void gt(e.target.files),ref:De,type:`file`}),(0,B.jsx)(`textarea`,{"aria-label":d(`composer.sendMessage`),onChange:e=>Ie(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),ft())},onPaste:_t,placeholder:V?d(`composer.goalPlaceholder`,{goal:V.title}):d(`composer.managerPlaceholder`),ref:we,rows:1,value:Pe}),(0,B.jsx)(`button`,{"aria-label":d(mt?`composer.createGoal`:`composer.send`),disabled:!Pe.trim()&&N.length===0||M,onClick:()=>void ft(),title:d(mt?`composer.createGoalHint`:`composer.sendMessageHint`),type:`button`,children:(0,B.jsx)(qm,{size:18})})]})]})})]}),sidebar:(0,B.jsx)(rx,{attentionCount:ze,goals:Re,goalArchiveLoadState:n,goalLifecycleOperations:t.onExecuteGoalLifecycle?[`stop`,`resume`]:void 0,lifecycleBusyGoalIds:oe,onRequestGoalCreate:o?void 0:et,onRequestGoalLifecycle:o&&!t.onExecuteGoalLifecycle?void 0:(e,t)=>void tt(e,t),onRetryGoalArchive:t.onRetryGoalArchive||t.onRefresh?()=>void(t.onRetryGoalArchive??t.onRefresh)?.():void 0,onOpenSettings:o?void 0:()=>Ve({kind:`settings`}),onSelectGoal:lt,selectedGoalId:R,statusSourceControl:l},l?.activeSource.statusUrl??`/status.json`)})}),xt]})}function qS(e){return(e??``).replace(/\s+/gu,` `).trim()}function JS(e,t=120){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t-1).join(``)}…`}function YS(e,t,n){let r=qS(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`):JS(r)}function XS(e,t){return t({advancing:`projection.agentAdvancingGoal`,idle:`projection.agentIdle`,needs_you:`projection.agentNeedsDecision`,stopped:`projection.agentStopped`,waiting_external:`projection.agentWaitingExternal`}[e])}function ZS({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 QS=`/status.json`,$S=`loopx-status-source-catalog-v1`,eC={id:`local`,kind:`local`,label:`本机`,readOnly:!1,statusUrl:QS};function tC(e,t){let n=dh(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 nC(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 rC(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=qb(n.hostAlias)?n.hostAlias.trim():void 0;return{...a?{hostAlias:a}:{},id:nC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url}}function iC(){return{schemaVersion:1,sources:[eC]}}function aC(e,t){try{let n=e.getItem($S);if(!n)return iC();let r=JSON.parse(n);if(r.schemaVersion!==1||!Array.isArray(r.sources))return iC();let i=new Set([eC.statusUrl]);return{schemaVersion:1,sources:[eC,...r.sources.flatMap(e=>{let n=rC(e,t);return!n||i.has(n.statusUrl)?[]:(i.add(n.statusUrl),[n])})]}}catch{return iC()}}function oC(e,t){e.setItem($S,JSON.stringify({schemaVersion:1,sources:t.sources.filter(e=>e.kind===`ssh_tunnel`)}))}function sC(e,t){let n=new Set(t.filter(qb).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 cC(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&&!qb(t.hostAlias))return{error:`请选择有效的 SSH Host。`};let a=t.hostAlias?.trim(),o={...a?{hostAlias:a}:{},id:nC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url};return{catalog:{...e,sources:[...e.sources,o]},source:o}}function lC(e,t){return{...e,sources:e.sources.filter(e=>e.kind===`local`||e.id!==t)}}function uC(e,t,n){if(!t.trim()||dh(t,n).source?.isRelative)return eC;let r=t.trim();try{r=new URL(r,n).toString()}catch{return null}return e.sources.find(e=>e.statusUrl===r)??null}function dC(e,t,n){return uC(e,t,n)||(dh(t,n).source?.isRelative?eC:{id:`temporary`,kind:`ssh_tunnel`,label:`临时来源`,readOnly:!0,statusUrl:t.trim()})}function fC(e,t,n,r){return dC(e,t??n,r)}var pC={delete:`删除`,deploy:`部署`,merge:`合并`,payment:`付款`,release:`发布`};function mC(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:`请求受保护操作:${pC[n.operation]} · ${n.target}`}}var hC=QS;async function gC(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 Ap(await t.json())}function _C(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 vC(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??_C(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 yC(e){return(e??``).replace(/\s+/g,` `).trim()}function bC(e,t=132){let n=yC(e);return n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}…`}function xC(e){let t=new Map;for(let n of e?.goals??[])t.set(n.goal_id,n);return t}function SC(e,t){return e===void 0||t===void 0?void 0:e+t}function CC(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 wC(e){return e?.items.find(e=>!e.done)}function TC(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 EC(e){return e?.queueItem?.project_asset?.quota?.state??e?.queueItem?.quota?.state??e?.goal.quota?.state??`waiting`}function DC(e,t,n){let r=[];for(let t of e){let e=CC(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 OC(e){return e?.map(e=>({dataUrl:e.data_url,id:e.id,mimeType:e.mime_type,name:e.name,size:e.size}))}var kC=`loopx.personal-agent-selection.v1`;function AC(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(kC)??`{}`);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 jC={需修复:`danger`,等你:`warning`,等待条件:`info`,推进中:`success`,安静运行:`neutral`,已停止:`neutral`,已完成:`neutral`};function MC(e,t){return yC(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 NC(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 PC(e,t){return[`agent`,`assistant`].includes(e.trim().toLowerCase())&&t.trim().length>0}var FC=`已发现的项目 Agent`;function IC(e){switch(Cy(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 MC(e)}}function LC(e,t){switch(wy(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 FC}}function RC(e,t){let n=e.project_asset;return t===`user`?TC(n?.user_todos,e.user_todos,`project_asset.user_todos`):TC(n?.agent_todos,e.agent_todos,`project_asset.agent_todos`)}function zC(e){return bC(e.title??e.text,112)}function BC(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 VC(e,t){return{resumeWhen:e.resume_when??null,resumeReady:e.resume_ready??null,resumeReceiptId:BC(e),claimedBy:e.claimed_by??null,done:e.status!==`deferred`&&e.done,evidence:e.evidence?bC(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:zC(e),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.index}`}}function HC(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 UC(e){return HC(e).map(t=>VC(t,e))}function WC(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=VC(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 GC(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:bC(e.title,112),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.claimed_by??`unknown`}:current`}}function KC(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=GC(t,n);r.has(i.todoId)||r.set(i.todoId,i)}return[...r.values()]}function qC(e){let t=e.queueItem?.project_asset?.agent_todos,n=e.queueItem?.agent_todos,r=HC(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=>VC(t,e)),l=r.find(e=>!e.done);return{doneTodoCount:o,nextTodoText:yC(t?.next??``)||(l?yC(l.title??``)||yC(l.text??``):``)||null,recentCompleted:c}}function JC(e,t){let n=yC(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`):YS(n,t,`projection.validationRecorded`):``}function YC(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 XC(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=[JC(r?.summary,n),YS(i?.health_check,n),YS(i?.recommended_action,n)].find(e=>e!==``&&e!==`暂无`)??n(`projection.runRecorded`),s=ZS({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 ZC(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 QC(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 $C(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 ew(e,t){let n=t.queueItem?.stale_latest_run_warning;return t.severity===`high`||!!QC(e,t)||!!(n?.requires_refresh_state||n?.severity===`high`)||$C(t)}function tw(e,t){let n=QC(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 nw(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 rw(e,t){let n=e.latestRun?.operator_gate;return YS(n?.operator_question??n?.reason_summary??n?.follow_up??e.queueItem?.recommended_action??e.latestRun?.recommended_action,t,`projection.confirmAgentDecision`)}function iw(e,t){if(t.goal.activation_state===`stopped`)return`已停止`;let n=CC(t,`user`),r=CC(t,`agent`),i=!!wC(n),a=!!wC(r);return[`user_or_controller`,`controller`].includes(t.waitingOn)||i||nw(t)?`等你`:ew(e,t)?`需修复`:t.waitingOn===`external_evidence`?`等待条件`:EC(t)===`eligible`||a?`推进中`:ZC(t)?`已完成`:`安静运行`}function aw(e,t,n,r){if(n===`已停止`)return XS(`stopped`,r);if(n===`需修复`)return YS(tw(e,t),r,`projection.statusRefreshNeeded`);if(n===`等你`)return XS(`needs_you`,r);if(n===`推进中`){let e=[(CC(t,`agent`)?.items??[]).filter(e=>!e.done).flatMap(e=>[e.title,e.text]).map(e=>yC(e)).find(e=>e!==``&&e!==`暂无`),t.queueItem?.recommended_action,t.latestRun?.recommended_action].map(e=>yC(e)).find(e=>e!==``&&e!==`暂无`);return e?YS(e,r,`projection.agentAdvancingGoal`):XS(`advancing`,r)}return XS(n===`等待条件`?`waiting_external`:`idle`,r)}function ow(e,t){return t.some(t=>e.includes(t))}function sw(e,t,n){if(t.goals.some(e=>e.activationState===`active`&&e.loadState))return{text:`Goal 状态尚未全部加载,暂不能给出完整统计。可先打开已加载的 Goal,失败项可重试。`,lines:[]};if(ow(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(ow(n,[`现在`,`下一步`,`我该`,`该做什么`,`优先处理`])){let e=t.userTodos[0];if(e)return{text:e.blocking?`先处理「${MC(e.goalId)}」:${e.text}`:`当前最先处理「${MC(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(ow(n,[`等我`,`阻塞`,`需要我`,`全局待办`]))return t.userTodos.length===0?{text:`目前没有 Goal 在等你,开放用户待办为 0。`,lines:[]}:{text:`有 ${t.userTodos.length} 项开放用户待办,阻塞项优先:`,lines:t.userTodos.slice(0,3).map(e=>`${MC(e.goalId)} · ${e.blocking?`阻塞`:`待处理`} · ${e.text}`)};if(ow(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 cw(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=xC(e.usage_summary),s=DC(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(RC(e,`user`)?.items??[]).map((r,i)=>({projectedDone:r.done,details:Kd(r),actionKind:r.action_kind??null,blocking:n,goalId:e.goal_id,sourceOrder:t,taskClass:r.task_class??null,text:zC(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)||!nw(t)?[]:[{details:Kd({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:rw(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=iw(e,a),l=f.find(e=>e.goalId===t.id),u=l?.text??null,d=qC(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=KC(UC(a),h,a),b=[d.nextTodoText,a.queueItem?.recommended_action,a.latestRun?.recommended_action,aw(e,a,c,n)].map(e=>YS(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:aw(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:XC(e,a,n),state:c,...r?{subagentExecution:{allowedDomains:t.spawn_policy?.allowed_domains??[],domainCandidates:WC(e,a,y),enabled:t.spawn_policy?.mode===`multi_subagent`&&t.spawn_policy.spawn_allowed===!0&&t.spawn_policy.max_children>0,maxChildren:t.spawn_policy?.max_children??0,modelConfig:t.spawn_policy?.model_config}}:{},title:MC(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:SC(e.input_tokens_24h,e.output_tokens_24h),tokens7d:SC(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?bC(e.current_todo.title,96):null,lastActivityAt:e.last_activity_at??null,state:e.state??null}))}}function lw({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,z.useState)([]),[b,x]=(0,z.useState)(!1),[S,C]=(0,z.useState)(null),[w,T]=(0,z.useState)(null),E=(0,z.useMemo)(()=>{let e=cw(c,u,_,b);if(!l)return e;let t=Object.values(l.snapshots).map(e=>cw(e,vC(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,ee]=(0,z.useState)(null),[te,A]=(0,z.useState)(null),[j,M]=(0,z.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:LC(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:LC(`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,z.useState)(AC),L=_h(re,I[N]??oe(N),ie),[ce,le]=(0,z.useState)(!1),[ue,de]=(0,z.useState)(!1),[fe,pe]=(0,z.useState)(`chat`),[me,he]=(0,z.useState)(``),[ge,_e]=(0,z.useState)({}),[ve,ye]=(0,z.useState)({}),[be,xe]=(0,z.useState)(null),[Se,Ce]=(0,z.useState)({}),[we,Te]=(0,z.useState)([]),[Ee,De]=(0,z.useState)(null),[Oe,ke]=(0,z.useState)({}),Ae=(0,z.useRef)(1),je=(0,z.useRef)(1),R=(0,z.useRef)(new Map),Me=(0,z.useRef)(new Set),Ne=(0,z.useRef)(new Map),Pe=(0,z.useRef)(new Map),Fe=(0,z.useRef)(new Set),Ie=(0,z.useRef)(new Set),Le=(0,z.useRef)(null),Re=(0,z.useRef)(null),ze=(0,z.useRef)(null),Be=(0,z.useRef)(null);(0,z.useRef)(null);let V=ge[N]??[];ve[N];let Ve=(e,t)=>e===`manager`?_(`header.manager`):t,He=D?E.userTodos.filter(e=>e.goalId===D.goalId):E.userTodos,Ue=D?.agentTodos??[];YC(Ue,D?.needsYou?3:4);let We=Ue.filter(e=>e.done).length,Ge=Ue.length>0?`${We}/${Ue.length}`:`暂无计划`;D&&({...E},He.filter(e=>e.blocking).length,He.length),(0,z.useEffect)(()=>{let e=uh(f.activeSource.statusUrl,window.location.href),t=e.source?mh(O,e.source):null;if(!D||!t?.indexUrl||!t.detailUrl){ee(null),A(null),M(!1);return}let{detailUrl:n,indexUrl:r}=t,i=!1;return ee(null),A(null),M(!0),hh(r,D.goalId).then(async e=>{let t=e.items[0]?.detail_ref;return t?gh(n,t):null}).then(e=>{i||ee(e)}).catch(e=>{i||A(jp(e))}).finally(()=>{i||M(!1)}),()=>{i=!0}},[O,D?.goalId,f.activeSource.statusUrl]);let Ke=D?void 0:Se[N]?.sessionId;(0,z.useEffect)(()=>{if(h||!Ke)return;let e=!1,t,n=async()=>{try{let t=await Zh(Ke);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:Ve(N,L.label),sourceLabel:`管家交接回执`,text:NC(e.text),lines:[],returnDelivery:e.return_delivery}))]}})}catch{}finally{e||(t=setTimeout(n,3e3))}};return n(),()=>{e=!0,t&&clearTimeout(t)}},[h,Ke,N,L.label]);function qe(e,t){Ce(n=>{if(t===null){let t={...n};return delete t[e],t}return{...n,[e]:t}})}(0,z.useEffect)(()=>{if(h){y([]),x(!1),C(null),T(null);return}let e=!1;return Jh().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,z.useEffect)(()=>{try{window.localStorage.setItem(kC,JSON.stringify(I))}catch{}},[I]),(0,z.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 eg({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:Ve(e,L.label),attachments:OC(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:NC(t.text)}))}),L.agentId===`status-only`))return;let c=s.sessions[0];if(o=c?.session_id??null,c&&!c.resumable){Me.current.add(t),qe(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 Xh(l,n===`manager`?I[e]:L.agentId,`resume_latest`,n);if(i)return;n===`manager`&&u.session.manager_runtime&&C(u.session.manager_runtime),R.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(qe(e,{agentId:u.agent_id||L.agentId,resumable:!0,sessionId:u.session_id,status:f?`running`:`ready`,turnId:f||void 0}),Me.current.delete(t),!f)return;let p=`${u.session_id}:${f}`;if(Ie.current.has(p))return;Ie.current.add(p),Ne.current.set(e,f),qe(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`running`,turnId:f}),xe(e),a=new AbortController,Pe.current.set(e,a);let m=``,h=Je(e,{activity:[`正在恢复进行中的 Agent 回合`],agentLabel:Ve(e,L.label),lines:[],pending:!0,sourceLabel:e===`manager`?`恢复的${_(`header.manager`)}会话`:`恢复的 ${L.label} 会话`,text:``});try{let t=await sg(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()||`${Ve(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(vh).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 Ih&&t.payload.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t instanceof Error?t.message:`无法恢复进行中的 Agent 回合。`})}finally{Ie.current.delete(p),Ne.current.get(e)===f&&Ne.current.delete(e),qe(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`ready`}),Pe.current.get(e)===a&&Pe.current.delete(e),i||xe(t=>t===e?null:t)}}catch(n){if(i)return;n instanceof Ih&&n.payload.error_code===`resume_failed`&&(Me.current.add(t),o&&qe(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,z.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 Qh({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,z.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 Qh({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=>Zh(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,z.useEffect)(()=>{if(!ce)return;let e=window.requestAnimationFrame(()=>{Le.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()});return()=>{window.cancelAnimationFrame(e),Re.current?.focus()}},[ce]),(0,z.useEffect)(()=>{if(!ue)return;let e=window.requestAnimationFrame(()=>ze.current?.focus());return()=>{window.cancelAnimationFrame(e),Be.current?.focus()}},[ue]),(0,z.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.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?_h(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=sw(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}),Yh({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.current.get(c);if(!e){let t=Me.current.has(c)?`new`:`resume_latest`,n=r===`manager`?I[r]:a.agentId,o=await Xh(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,R.current.set(c,e),qe(r,{agentId:o.agent_id||a.agentId,resumable:!0,sessionId:e,status:`ready`}),Me.current.delete(c)}let o=``;l=Je(r,{activity:[r===`manager`?`正在连接管家`:`正在连接 Agent`],agentLabel:Ve(r,a.label),lines:[],pending:!0,sourceLabel:r===`manager`?`${_(`header.manager`)} · 跨 Goal`:`${a.label} Agent · ${MC(i.goalId)}`,text:``});let s=(await ag(e,n,{attachments:t?.attachments,signal:(()=>{let e=new AbortController;return Pe.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}),Ne.current.set(r,n),qe(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`running`,turnId:n})}})).response;Ye(r,l,{lines:s.gate?[s.gate.summary,s.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:NC(s.message||o.trim())||`${Ve(r,a.label)} 已完成分析。`});let u=s.proposals.filter(vh);if(u.length>0&&!i&&Ye(r,l,{lines:[`请进入要修改的 Goal,预览并确认具体变更。`]}),u.length>0&&i){let e=u.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`&&s.protected_action){let e=mC(r,n,s.protected_action);if(e)return e}}catch(e){if(Fe.current.delete(r)){let e={agentLabel:Ve(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 t=e instanceof Ih?e.payload:null;t&&bh(t)&&R.current.delete(c),t?.error_code===`resume_failed`&&(R.current.delete(c),Me.current.add(c),qe(r,{agentId:a.agentId,resumable:!1,sessionId:Se[r]?.sessionId??`resume-failed`,status:`resume_failed`}));let n=t?.gate,i=n&&typeof n==`object`?String(n.summary??``):``,o={agentLabel:Ve(r,a.label),lines:i?[i]:[],pending:!1,reconnect:t?.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t?.error_code===`resume_failed`?`原 ${Ve(r,a.label)} 会话无法恢复。本地历史已经保留,请在运行详情里选择“重试恢复”或“开始新 Session”。`:e instanceof Error?e.message:`${Ve(r,a.label)} 会话暂时不可用。`};l===null?Je(r,o):Ye(r,l,o)}finally{Ne.current.delete(r),Pe.current.delete(r);let e=R.current.get(c);e&&qe(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),xe(e=>e===r?null:e)}}async function Ze(e){let t=e?.goalId??N,n=Se[t],r=e?.agentId??n?.agentId??L.agentId,i=`${t}:${r}`,a=e?.sessionId??n?.sessionId??R.current.get(i),o=e?.turnId??n?.turnId??Ne.current.get(t);if(!(!a||!o))try{Fe.current.add(t),await ig(a,o),Pe.current.get(t)?.abort()}catch(e){throw Fe.current.delete(t),e}finally{Ne.current.delete(t),qe(t,{agentId:r,resumable:!0,sessionId:a,status:`ready`}),Pe.current.delete(t),xe(e=>e===t?null:e)}}async function Qe(e){let t=e.goalId,n=`${t}:${e.agentId}`,r=e.sessionId??Se[t]?.sessionId??R.current.get(n);if(r)try{let i=await lg(r);R.current.set(n,r),Me.current.delete(n),qe(t,{agentId:e.agentId,resumable:i.session.resumable,sessionId:r,status:i.session.status})}catch{qe(t,{agentId:e.agentId,resumable:!1,sessionId:r,status:`resume_failed`})}}function $e(e){let t=`${e.goalId}:${e.agentId}`;R.current.delete(t),Me.current.add(t),qe(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:`new-session-pending`,status:`ready`})}async function et(e){let t=`${e.goalId}:${e.agentId}`,n=e.sessionId??Se[e.goalId]?.sessionId??R.current.get(t);n&&n!==`new-session-pending`&&await cg(n),R.current.delete(t),Me.current.add(t),qe(e.goalId,null)}function tt(e){re.some(t=>t.agentId===e&&t.available)&&(se(t=>({...t,[N]:e})),le(!1))}function nt(){i(``),pe(`chat`)}function rt(e){i(e),pe(`chat`)}D&&jC[D.state],D&&(`${L.label}${D.state}`,Ue.length>0&&`${Ge}`,He.length>0&&`${He.length}`),D?.state===`需修复`||!D&&!c.ok?(D&&IC(D.agentId),D?.nextSentence,D?.agentSentence):D?.state===`等你`?(D.needsYouBlocking,D.needsYouBlocking,D.needsYou??D.nextSentence,D.needsYou):(D&&IC(D.agentId),D?.nextSentence);let it=[...!D&&Se.manager?.status===`resume_failed`?[{id:`run:manager:resume-failed`,kind:`run`,run:{agentId:Se.manager.agentId,agentLabel:IC(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=>PC(e.role,e.text))===!0;return{id:`run:task:${e.session_id}`,kind:`run`,run:{agentId:e.agent_id,agentLabel:IC(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`:PC(e.role,e.text)?`assistant`:`error`,text:e.role===`user`?e.text:NC(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?[{id:`run:${D.goalId}`,kind:`run`,run:{agentId:Se[D.goalId]?.agentId??D.agentId,agentLabel:IC(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}]:[]}}]:[],...V.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:IC(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:IC(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}}]:[]],at=f.connectionState===`connected`,ot=new Map(E.goals.map(e=>[e.goalId,e.title])),st=e=>qd(e,f.activeSource.statusUrl,at&&!l?.errors[e.goalId],ot.get(e.goalId)),ct={...Gy(E),userTodos:E.userTodos.map(st),attentionHistory:(E.attentionHistory??E.userTodos).map(st),periodicReports:{error:te,loading:j},timeline:it};return(0,B.jsxs)(`div`,{className:p===`dark`?`dark`:``,"data-testid":`personal-goal-home`,children:[Ee?(0,B.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,B.jsx)(VS,{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=>rt(e.goalId),onCorrectRun:async(e,t)=>{if(!e.sessionId)throw Error(`这个 Run 还没有可纠偏的执行 Session。`);let n=await Uh((await Bh({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(qe(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:r?`running`:`ready`,turnId:r}),r){Ne.current.set(e.goalId,r);let t=new AbortController;Pe.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 og(e.sessionId,r,{signal:t.signal,onDelta:t=>{n+=t,Ye(e.goalId,i,{text:n})}});Ye(e.goalId,i,{activity:[],pending:!1,text:OC(a.response.message||n.trim())||`${e.agentLabel} 已完成纠偏。`})}catch(t){let n=Fe.current.delete(e.goalId);Ye(e.goalId,i,{activity:[],pending:!1,text:n?`已中断。你可以在当前会话继续发送消息。`:t instanceof Error?t.message:`纠偏回合失败。`})}finally{Ne.current.delete(e.goalId),Pe.current.delete(e.goalId),qe(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:`ready`})}}},onCloseRunSession:et,onInterruptRun:async e=>Ze(e),onOpenGoal:rt,onOpenRunSession:async e=>{if(!e.sessionId)return;let t=e.sessionId,n=await Xh(t);ke(e=>({...e,[t]:n})),rt(e.goalId),_e(t=>({...t,[e.goalId]:n.messages.map(t=>({agentLabel:t.role===`user`?void 0:e.agentLabel,attachments:CC(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:OC(t.text)}))})),qe(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=>rt(e.goalId),...b?{onPreviewGoalSubagentConfiguration:async e=>{let t=await dg(e);return{changed:t.changed,configuration:{allowedDomains:t.after.orchestration.allowed_domains,enabled:t.feature_summary.multi_subagent===`enabled`,maxChildren:t.after.orchestration.max_children,modelConfig:t.after.orchestration.model_config},previewId:t.preview_id}},onApplyGoalSubagentConfiguration:async({previewId:e,...t})=>{let n=await fg(t,e);return{allowedDomains:n.after.orchestration.allowed_domains,enabled:n.feature_summary.multi_subagent===`enabled`,maxChildren:n.after.orchestration.max_children,modelConfig:n.after.orchestration.model_config}}}:{},...g?{onExecuteGoalLifecycle:async({goalId:e,operation:t,reason:n})=>{let r=await Zb(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:Qe,onSelectAgent:tt,onSelectGoal:e=>e?rt(e):nt(),onSendMessage:async(e,t,n,r)=>Xe(e,{agentId:t,goalId:n,attachments:r}),onStartNewRunSession:$e},goalArchiveLoadState:e,managerChannelBinding:w,managerRuntime:S,model:ct,readOnly:h,selectedAgentId:L.agentId,selectedGoalId:D?.goalId??null,statusSourceControl:f})]})}function aw({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,B.jsx)(`div`,{className:i===`dark`?`dark`:``,children:(0,B.jsxs)(`main`,{className:`min-h-screen bg-[#f6f7f9] text-slate-950 dark:bg-[#09090b] dark:text-zinc-50`,children:[(0,B.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,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-xl font-semibold`,children:`LoopX Workspace`}),(0,B.jsx)(`p`,{className:`mt-1 break-all text-sm text-slate-500 dark:text-zinc-400`,children:`Personal Workspace`})]}),(0,B.jsx)(_y,{"aria-label":`切换主题`,onClick:a,size:`icon`,variant:`secondary`,children:i===`dark`?(0,B.jsx)(eh,{className:`h-4 w-4`}):(0,B.jsx)(Fm,{className:`h-4 w-4`})})]}),(0,B.jsxs)(`div`,{className:`grid min-h-[calc(100vh-80px)] sm:grid-cols-[240px_1fr]`,children:[(0,B.jsxs)(`aside`,{className:`hidden border-r border-slate-200 p-6 dark:border-zinc-800 sm:block`,"aria-label":`Workspace`,children:[(0,B.jsx)(`strong`,{children:`LoopX`}),(0,B.jsx)(`p`,{className:`mt-6 text-sm`,children:`Workspace`}),(0,B.jsx)(`p`,{className:`mt-8 text-xs text-slate-500`,children:`Goals`}),[1,2,3].map(e=>(0,B.jsx)(`div`,{className:`mt-4 h-8 rounded bg-slate-100 dark:bg-zinc-900`},e))]}),(0,B.jsx)(`div`,{className:`p-4 sm:p-8`,children:(0,B.jsx)(vy,{"data-testid":`initial-status-state`,children:(0,B.jsx)(yy,{className:`flex min-h-64 items-center justify-center p-6`,children:(0,B.jsxs)(`div`,{className:`max-w-xl text-center`,children:[e?(0,B.jsx)(lm,{className:`mx-auto h-6 w-6 text-rose-600 dark:text-rose-300`}):(0,B.jsx)(Hm,{className:`mx-auto h-6 w-6 animate-spin text-slate-500 dark:text-zinc-400`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e?`无法加载实时状态`:`正在加载实时状态`}),e?(0,B.jsxs)(B.Fragment,{children:[(0,B.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,B.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-slate-400 dark:text-zinc-500`,children:`重新加载不会执行任务,也不会改变 Goal 配置。`}):null,(0,B.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:(0,B.jsxs)(_y,{disabled:t,onClick:n,children:[(0,B.jsx)(Hm,{className:`h-4 w-4`}),`重试`]})})]}):(0,B.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 ow(){let e=rT.useSearch(),t=rT.useNavigate(),[n,r]=(0,z.useState)(`light`),[i,a]=(0,z.useState)(null),o=(0,z.useRef)(null),s=(0,z.useRef)(e.goalId);s.current=e.goalId;let[c,l]=(0,z.useState)(jp),[u,d]=(0,z.useState)({kind:`example`,label:`bundled example`}),[f,p]=(0,z.useState)(()=>eC(window.localStorage,window.location.href)),m=(0,z.useRef)(f);m.current=f;let[h,g]=(0,z.useState)(e.statusUrl),[_,v]=(0,z.useState)(null),[y,b]=(0,z.useState)(!1),[x,S]=(0,z.useState)({error:null,phase:`idle`}),[C,w]=(0,z.useState)(e.statusUrl.trim()||null),[T,E]=(0,z.useState)(!1),D=(0,z.useRef)(null),O=(0,z.useRef)(u_(e.statusUrl.trim()||null)),k=!T&&u.kind===`example`?e.statusUrl.trim():``,ee=C??k,te=u.kind===`url`?u.label:uC,A=!!(_&&C),j=sC(f,C,te,window.location.href),M=u.kind===`example`&&!T,ne=c.attention_queue,N=c.run_history,P=(0,z.useMemo)(()=>pC(N.goals,ne.items),[N.goals,ne.items]);function re(e,t,n=0){S({error:null,phase:`loading`}),dC(dh(e,`stopped`,window.location.href)).then(r=>{if(!m_(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=>L_(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=>{m_(O.current,t)&&S({error:Ap(e),phase:`error`})})}function ie(){let e=u.kind===`url`?u.label:h||uC,t=f_(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=>L_(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})}),p_(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=f_(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 Fp(n,window.location.href).catch(()=>null);if(!m_(O.current,c))return;if(e){let o=(t.retryOnly||t.reuseSnapshots)&&u.kind===`url`&&u.label===n?Np(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=Ip(e);if(r)l(m);else if(!await ae(n,m,c))return;if(S({error:null,phase:`loading`}),await Rp(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})},()=>m_(O.current,c),()=>s.current,d.signal),p&&(t.resyncAttempt??0)<1&&m_(O.current,c)){await F(n,{resyncAttempt:1});return}m_(O.current,c)&&S({error:null,phase:`ready`});return}let o=await dC(dh(n,`active`,window.location.href));if(!m_(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(!p_(O.current,c))return;r||v(Ap(e))}finally{!r&&p_(O.current,c)&&b(!1)}}function oe(e,t={}){o.current?.abort();let n=d_(O.current,e.statusUrl);D.current=null,E(!1),w(e.statusUrl),b(!0),v(null),(async()=>{if(t.ensureTunnel&&e.kind===`ssh_tunnel`){let t=new URL(e.statusUrl,window.location.href).port;if(t)try{await Xb(e.label,t)}catch{}}O.current.selectionRevision===n&&await F(e.statusUrl,{selectionRevision:n})})()}function I(e){m.current=e,p(e);try{tC(window.localStorage,e)}catch{}}let se={activeSource:j,connectionState:y?`loading`:A?`error`:`connected`,errorMessage:A?`未切换到 ${C??`所选来源`}:${_}`:null,onAdd:e=>{let t=rC(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=nC(t,e);n!==t&&I(n)},onRemove:e=>{I(iC(f,e)),j.id===e&&oe(YS)},onSelect:e=>{let t=f.sources.find(t=>t.id===e);t&&oe(t,{ensureTunnel:t.kind===`ssh_tunnel`})},sources:j.id===`temporary`?[...f.sources,j]:f.sources};(0,z.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(uC))},[T,C,e.statusUrl,u.kind,u.label]),(0,z.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,z.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 M?(0,B.jsx)(aw,{error:_,isLoading:y,onRetry:()=>void F(ee||uC),requestedUrl:ee||uC,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)}):(0,B.jsx)(iw,{goalArchiveLoadState:x,isLoading:y,onGoalActivationStateChange:(e,t)=>{O.current.projectionRevision+=1,l(n=>Dp(n,e,t)),a(n=>n&&{...n,snapshots:Object.fromEntries(Object.entries(n.snapshots).map(([n,r])=>[n,Dp(r,e,t)]))})},onGoalDeleted:e=>{O.current.projectionRevision+=1,l(t=>Op(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||uC,{background:!0,invalidateGoalIds:e?.invalidateGoalIds,reuseSnapshots:!0}),onRetryGoalArchive:ie,onRefresh:()=>F(u.kind===`url`?u.label:h||uC,{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 sw=H_(`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 cw({className:e,variant:t,...n}){return(0,B.jsx)(`span`,{className:hy(sw({variant:t}),e),...n})}var lw=[{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`}],uw=[{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`}],dw=[{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.`}],fw=[`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`],pw=[{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 mw({children:e,icon:t,title:n}){return(0,B.jsxs)(`section`,{className:`rounded-lg border border-slate-200 bg-white shadow-sm`,children:[(0,B.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,B.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,B.jsx)(t,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function hw(){return(0,B.jsx)(mw,{icon:rm,title:`Status Contract Explorer`,children:(0,B.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,"data-testid":`developer-contract-explorer`,children:lw.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(cw,{variant:`info`,children:e.label}),(0,B.jsx)(cw,{variant:`neutral`,children:`public contract`})]}),(0,B.jsx)(`div`,{className:`mt-2 break-words font-mono text-xs text-slate-700`,children:e.source}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.detail})]},e.label))})})}function gw(){return(0,B.jsx)(mw,{icon:Cm,title:`Projection Diffing`,children:(0,B.jsx)(`div`,{className:`overflow-x-auto`,"data-testid":`developer-projection-diffing`,children:(0,B.jsxs)(`table`,{className:`min-w-full border-separate border-spacing-0 text-left text-sm`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`bg-slate-50 text-xs uppercase tracking-normal text-slate-500`,children:[(0,B.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Axis`}),(0,B.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Current`}),(0,B.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Proposed`}),(0,B.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Gate`})]})}),(0,B.jsx)(`tbody`,{children:uw.map(e=>(0,B.jsxs)(`tr`,{className:`align-top`,children:[(0,B.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 font-semibold text-slate-950`,children:e.axis}),(0,B.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.current}),(0,B.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.proposed}),(0,B.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.gate})]},e.axis))})]})})})}function _w(){return(0,B.jsx)(mw,{icon:ym,title:`Fixture Generation`,children:(0,B.jsx)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-fixture-generation`,children:dw.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:e.title}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.title))})})}function vw(){return(0,B.jsx)(mw,{icon:dm,title:`Smoke Checklist`,children:(0,B.jsx)(`div`,{className:`space-y-2 p-4`,"data-testid":`developer-smoke-checklist`,children:fw.map(e=>(0,B.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,B.jsx)(em,{className:`mt-0.5 h-4 w-4 shrink-0 text-emerald-600`}),(0,B.jsx)(`code`,{className:`break-all text-xs font-semibold leading-5 text-slate-700`,children:e})]},e))})})}function yw(){return(0,B.jsx)(mw,{icon:fm,title:`Component Examples`,children:(0,B.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-3`,"data-testid":`developer-component-examples`,children:pw.map(e=>(0,B.jsxs)(`article`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.badges.map(e=>(0,B.jsx)(cw,{variant:e===`read-only`||e===`public-safe`?`success`:`neutral`,children:e},e))}),(0,B.jsx)(`h3`,{className:`mt-3 text-sm font-semibold leading-6 text-slate-950`,children:e.name}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.name))})})}function bw(){return(0,B.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,B.jsxs)(`div`,{className:`mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,B.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,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.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,B.jsx)(th,{className:`h-4 w-4`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold`,children:`Developer Cockpit`}),(0,B.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Projection extension`})]})]}),(0,B.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,B.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://huangruiteng.github.io/loopx/`,children:[(0,B.jsx)(Dm,{className:`h-4 w-4`}),`LoopX home`]}),(0,B.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://huangruiteng.github.io/loopx/docs/showcases/index.en.html`,children:[(0,B.jsx)(_m,{className:`h-4 w-4`}),`Public cases`]}),(0,B.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,B.jsx)(fm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,B.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,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)(cw,{variant:`success`,children:`read-only`}),(0,B.jsx)(cw,{variant:`neutral`,children:`public fixtures`})]}),(0,B.jsx)(`p`,{children:`This route uses static public contracts only; live status feeds, registry files, and browser write APIs stay outside the cockpit.`})]})]}),(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)(cw,{variant:`info`,children:`developers/projections`}),(0,B.jsx)(cw,{variant:`success`,children:`public-safe`}),(0,B.jsx)(cw,{variant:`neutral`,children:`no browser writes`})]}),(0,B.jsx)(`h1`,{className:`mt-3 text-3xl font-semibold tracking-normal text-slate-950`,children:`LoopX Projection Developer Cockpit`}),(0,B.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,B.jsxs)(`div`,{className:`grid min-w-[260px] gap-2 text-sm`,children:[(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Source of truth`}),(0,B.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`status contract + compact fixtures`})]}),(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Boundary`}),(0,B.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`read-only extension surface`})]})]})]})}),(0,B.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,B.jsx)(hw,{}),(0,B.jsx)(gw,{})]}),(0,B.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,B.jsx)(_w,{}),(0,B.jsx)(vw,{})]}),(0,B.jsx)(yw,{}),(0,B.jsx)(mw,{icon:Xm,title:`Extension Boundary`,children:(0,B.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-extension-boundary`,children:[(0,B.jsxs)(`div`,{className:`rounded-md border border-emerald-200 bg-emerald-50 px-3 py-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Allowed`}),(0,B.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,B.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Review`}),(0,B.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,B.jsxs)(`div`,{className:`rounded-md border border-rose-200 bg-rose-50 px-3 py-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Stop`}),(0,B.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(),Sw=yd(W(),G().finite()).default({}),Cw=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(),ww=J({arm_id:W(),selected_run_id:W().nullable(),score_countable:K(),metrics:yd(W(),xw),effort:Sw,insight:Cw.nullable().optional()}),Tw=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:Sw,redacted_insight:Cw.nullable().optional(),upload_provenance:J({producer_id:W(),producer_version:W(),observed_at:W(),source_revision:W()}).passthrough()}).passthrough(),Ew=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(),Dw=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(),Ew),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(),Ow=J({baseline_value:G().finite(),candidate_value:G().finite(),delta:G().finite(),direction:Y([`improved`,`flat`,`regressed`]).optional()}).passthrough(),kw=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(),Ow)}).passthrough(),Aw=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(Dw),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(ww),eligible_comparisons:q(kw),largest_eligible_primary_contrast:kw.nullable()})),runs:q(Tw),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 jw(e){return Aw.parse(e)}function Mw(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 Nw=[{id:`campaign`,label:`Campaign`},{id:`arms`,label:`Arms`},{id:`cases`,label:`Cases`},{id:`runs`,label:`Runs`}];function Pw(e){return e==null?`—`:`${(e*100).toFixed(e>=.995?0:1)}%`}function Fw(e){return e==null?`—`:new Intl.NumberFormat(`en`,{maximumFractionDigits:2,notation:`compact`}).format(e)}function Iw(e){if(e==null)return`—`;let t=e/6e4;return t>=120?`${(t/60).toFixed(1)} h`:`${Fw(t)} min`}function Lw(e){let t=Object.entries(e);return t.length?t.map(([e,t])=>`${e} (${t})`).join(`, `):`—`}function Rw(e){if(!e)return`—`;let t=e.total==null?Fw(e.value):`${Fw(e.value)}/${Fw(e.total)}`;return e.unit?`${t} ${e.unit}`:t}function zw(e,t){let n=e.metrics[t];return!n||n.case_denominator===0?`—`:n.suite_micro_rate==null?`${Fw(n.value_mean)} mean`:`${Pw(n.suite_micro_rate)} · ${Fw(n.suite_micro_numerator)}/${Fw(n.suite_micro_denominator)}`}function Bw(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}${Fw(r.delta)}`}}function Vw({children:e,tone:t=`neutral`}){return(0,B.jsx)(`span`,{className:`benchmark-state benchmark-state-${t}`,children:e})}function Hw({packet:e,primaryMetric:t}){return(0,B.jsxs)(`div`,{className:`benchmark-view-stack`,children:[(0,B.jsxs)(`section`,{"aria-labelledby":`arm-summary-title`,children:[(0,B.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`benchmark-kicker`,children:`ARM SUMMARY`}),(0,B.jsx)(`h2`,{id:`arm-summary-title`,children:`Comparable outcomes, denominator first`})]}),(0,B.jsx)(`p`,{children:`Only one score-countable run per declared case × arm cell is selected.`})]}),(0,B.jsx)(`div`,{className:`benchmark-arm-grid`,children:e.arms.map(e=>{let n=Object.values(e.binary_outcomes)[0];return(0,B.jsxs)(`article`,{className:`benchmark-arm-card`,children:[(0,B.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`benchmark-mono`,children:e.arm_role}),(0,B.jsx)(`h3`,{children:e.arm_id})]}),(0,B.jsx)(Vw,{tone:e.coverage_rate===1?`success`:`warning`,children:e.coverage_rate===1?`Complete`:`Provisional`})]}),(0,B.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`dt`,{children:[`Primary · `,t]}),(0,B.jsx)(`dd`,{children:zw(e,t)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Score-countable coverage`}),(0,B.jsxs)(`dd`,{children:[e.selected_score_countable_case_count,`/`,e.intended_case_count]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Binary success`}),(0,B.jsx)(`dd`,{children:n?`${n.success_count}/${n.case_denominator}`:`Not declared`})]})]})]},e.arm_id)})})]}),(0,B.jsxs)(`section`,{"aria-labelledby":`contrast-title`,children:[(0,B.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`benchmark-kicker`,children:`MATCHED CONTRASTS`}),(0,B.jsx)(`h2`,{id:`contrast-title`,children:`Direction counts on eligible pairs`})]}),(0,B.jsx)(`p`,{children:`Raw run volume is never used as a comparison denominator.`})]}),(0,B.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,B.jsxs)(`table`,{children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`Candidate arm`}),(0,B.jsx)(`th`,{children:`Matched denominator`}),(0,B.jsx)(`th`,{children:`Improved`}),(0,B.jsx)(`th`,{children:`Flat`}),(0,B.jsx)(`th`,{children:`Regressed`}),(0,B.jsx)(`th`,{children:`Binary transitions`})]})}),(0,B.jsxs)(`tbody`,{children:[Object.entries(e.contrasts).map(([e,t])=>(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:(0,B.jsx)(`strong`,{children:e})}),(0,B.jsx)(`td`,{children:t.matched_pair_denominator}),(0,B.jsx)(`td`,{className:`benchmark-positive`,children:t.primary_metric_directions.improved}),(0,B.jsx)(`td`,{children:t.primary_metric_directions.flat}),(0,B.jsx)(`td`,{className:`benchmark-negative`,children:t.primary_metric_directions.regressed}),(0,B.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,B.jsx)(`tr`,{children:(0,B.jsx)(`td`,{colSpan:6,children:`No matched comparisons are countable yet.`})})]})]})})]}),(0,B.jsxs)(`section`,{"aria-labelledby":`runtime-health-title`,children:[(0,B.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`benchmark-kicker`,children:`RUNTIME HEALTH`}),(0,B.jsx)(`h2`,{id:`runtime-health-title`,children:`Qualified observations, without execution authority`})]}),(0,B.jsxs)(`p`,{children:[e.campaign.runtime_observation_count,` public-safe runtime observations.`]})]}),(0,B.jsxs)(`div`,{className:`benchmark-runtime-list`,children:[Object.entries(e.campaign.runtime_classification_counts).map(([e,t])=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{children:e}),(0,B.jsx)(`strong`,{children:t})]},e)),e.campaign.runtime_observation_count===0&&(0,B.jsx)(`p`,{className:`benchmark-muted`,children:`No runtime observations uploaded.`})]})]})]})}function Uw({packet:e}){return(0,B.jsx)(`div`,{className:`benchmark-detail-grid`,children:e.arms.map(t=>(0,B.jsxs)(`article`,{className:`benchmark-detail-card`,children:[(0,B.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`benchmark-mono`,children:t.arm_role}),(0,B.jsx)(`h2`,{children:t.arm_id})]}),(0,B.jsxs)(Vw,{tone:t.coverage_rate===1?`success`:`warning`,children:[t.selected_score_countable_case_count,`/`,t.intended_case_count,` countable`]})]}),(0,B.jsx)(`div`,{className:`benchmark-factor-row`,children:Object.entries(t.factor_assignments).map(([e,t])=>(0,B.jsxs)(`span`,{children:[e,`: `,(0,B.jsx)(`strong`,{children:t})]},e))}),(0,B.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[e.design.metric_catalog.map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`dt`,{children:[e.role,` · `,e.metric_name]}),(0,B.jsx)(`dd`,{children:zw(t,e.metric_name)})]},e.metric_name)),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Runs terminal / observed`}),(0,B.jsxs)(`dd`,{children:[t.terminal_run_count,`/`,t.run_count]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Median duration`}),(0,B.jsx)(`dd`,{children:Iw(t.effort.duration_ms?.median)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Protocols`}),(0,B.jsx)(`dd`,{children:Lw(t.protocol_counts)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Runner revisions`}),(0,B.jsx)(`dd`,{children:Lw(t.runner_revision_counts)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Orchestrator runtimes`}),(0,B.jsxs)(`dd`,{children:[Object.keys(t.orchestrator_runtime_counts).length||0,` distinct`]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Failure classes`}),(0,B.jsx)(`dd`,{children:Lw(t.failure_class_counts)})]})]})]},t.arm_id))})}function Ww({packet:e,primaryMetric:t,onOpenRun:n}){return(0,B.jsx)(`div`,{className:`benchmark-table-shell benchmark-wide-table`,children:(0,B.jsxs)(`table`,{children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`Case`}),(0,B.jsx)(`th`,{children:`Design status`}),(0,B.jsx)(`th`,{children:`Largest eligible delta`}),e.arms.map(e=>(0,B.jsx)(`th`,{children:e.arm_id},e.arm_id))]})}),(0,B.jsx)(`tbody`,{children:e.cases.map(r=>{let i=Bw(r,t);return(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:(0,B.jsx)(`strong`,{children:r.case_id})}),(0,B.jsx)(`td`,{children:(0,B.jsx)(Vw,{tone:r.complete_declared_design?`success`:`warning`,children:r.complete_declared_design?`Complete`:`Provisional`})}),(0,B.jsx)(`td`,{className:i?.direction===`improved`?`benchmark-positive`:i?.direction===`regressed`?`benchmark-negative`:void 0,children:i?.text??`—`}),r.arms.map(r=>(0,B.jsx)(`td`,{children:r.selected_run_id&&r.score_countable?(0,B.jsxs)(`button`,{className:`benchmark-cell-link`,onClick:()=>n(r.selected_run_id),type:`button`,children:[(0,B.jsxs)(`span`,{children:[t,`: `,Rw(r.metrics[t])]}),e.design.metric_catalog.filter(e=>e.metric_name!==t).map(e=>(0,B.jsxs)(`small`,{className:`benchmark-cell-metric`,children:[e.metric_name,`: `,Rw(r.metrics[e.metric_name])]},e.metric_name)),(0,B.jsxs)(`small`,{children:[`Countable · `,Iw(r.effort.duration_ms),` `,(0,B.jsx)(Zp,{"aria-hidden":`true`,size:12})]}),r.insight&&(0,B.jsxs)(`small`,{children:[r.insight.failure_class,` · `,r.insight.confidence]})]}):(0,B.jsx)(`span`,{className:`benchmark-muted`,children:`Not countable`})},r.arm_id))]},r.case_id)})})]})})}function Gw({run:e,packet:t}){return(0,B.jsxs)(`aside`,{"aria-label":`Run detail for ${e.run_id}`,className:`benchmark-run-detail`,children:[(0,B.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`benchmark-mono`,children:`RUN DETAIL`}),(0,B.jsx)(`h2`,{children:e.run_id})]}),(0,B.jsx)(Vw,{tone:e.countability.score_countable?`success`:`warning`,children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]}),(0,B.jsxs)(`dl`,{className:`benchmark-stat-list benchmark-run-facts`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Case / arm`}),(0,B.jsxs)(`dd`,{children:[e.case_id,` · `,e.arm_id]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Lifecycle`}),(0,B.jsxs)(`dd`,{children:[e.status,` · `,e.observed_at]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Protocol`}),(0,B.jsx)(`dd`,{children:e.protocol_id})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Qualification`}),(0,B.jsxs)(`dd`,{children:[`Integrity `,e.countability.integrity_qualified?`qualified`:`not qualified`,` · result `,e.countability.official_result_present?`present`:`missing`]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Treatment fidelity`}),(0,B.jsx)(`dd`,{children:e.treatment_fidelity})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Effort`}),(0,B.jsxs)(`dd`,{children:[Iw(e.effort.duration_ms),` · `,Fw(e.effort.agent_steps),` steps · `,Fw(e.effort.token_count),` tokens`]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Runner revision`}),(0,B.jsx)(`dd`,{children:e.runner_revision??`—`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Upload provenance`}),(0,B.jsxs)(`dd`,{children:[e.upload_provenance.producer_id,` · `,e.upload_provenance.source_revision]})]})]}),(0,B.jsx)(`div`,{className:`benchmark-run-metrics`,children:t.design.metric_catalog.map(t=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{children:t.metric_name}),(0,B.jsx)(`strong`,{children:Rw(e.metrics[t.metric_name])})]},t.metric_name))}),e.redacted_insight&&(0,B.jsxs)(`div`,{className:`benchmark-insight`,children:[(0,B.jsxs)(`span`,{className:`benchmark-mono`,children:[`REDACTED CASE INSIGHT · `,e.redacted_insight.confidence]}),(0,B.jsx)(`p`,{children:e.redacted_insight.causal_summary}),(0,B.jsxs)(`small`,{children:[`Implication: `,e.redacted_insight.implication]}),(0,B.jsx)(`br`,{}),(0,B.jsxs)(`small`,{children:[`Next probe: `,e.redacted_insight.next_probe]}),!!e.redacted_insight.evidence_refs?.length&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`br`,{}),(0,B.jsxs)(`small`,{children:[`Evidence: `,e.redacted_insight.evidence_refs.join(`, `)]})]})]})]})}function Kw({packet:e,selectedRunId:t,onSelectRun:n}){let r=e.runs.find(e=>e.run_id===t)??e.runs[0];return(0,B.jsxs)(`div`,{className:`benchmark-runs-layout`,children:[(0,B.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,B.jsxs)(`table`,{children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`Run`}),(0,B.jsx)(`th`,{children:`Case`}),(0,B.jsx)(`th`,{children:`Arm`}),(0,B.jsx)(`th`,{children:`Status`}),(0,B.jsx)(`th`,{children:`Countability`})]})}),(0,B.jsx)(`tbody`,{children:e.runs.map(e=>(0,B.jsxs)(`tr`,{"aria-selected":e.run_id===r?.run_id,children:[(0,B.jsx)(`td`,{children:(0,B.jsx)(`button`,{className:`benchmark-run-link`,onClick:()=>n(e.run_id),type:`button`,children:e.run_id})}),(0,B.jsx)(`td`,{children:e.case_id}),(0,B.jsx)(`td`,{children:e.arm_id}),(0,B.jsx)(`td`,{children:e.status}),(0,B.jsx)(`td`,{children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]},e.run_id))})]})}),r&&(0,B.jsx)(Gw,{packet:e,run:r})]})}function qw(){let e=cT.useSearch(),t=cT.useNavigate(),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(0),c=(0,z.useMemo)(()=>{let t=e.dashboardUrl||`/chat/benchmark-study.example.json`;try{return{url:Mw(t,window.location.href),error:null}}catch(e){return{url:``,error:e instanceof Error?e.message:`Invalid dashboard source`}}},[e.dashboardUrl]);if((0,z.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 jw(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,z.useEffect)(()=>{n&&(document.title=`${n.design.labels.title??n.study_id} · LoopX Benchmark`)},[n]),i)return(0,B.jsxs)(`main`,{className:`benchmark-page benchmark-loading`,children:[(0,B.jsx)(lm,{"aria-hidden":`true`}),(0,B.jsx)(`h1`,{children:`Dashboard packet unavailable`}),(0,B.jsx)(`p`,{children:i}),(0,B.jsxs)(`button`,{onClick:()=>s(e=>e+1),type:`button`,children:[(0,B.jsx)(Hm,{"aria-hidden":`true`,size:16}),` Retry readback`]})]});if(!n)return(0,B.jsxs)(`main`,{"aria-busy":`true`,className:`benchmark-page benchmark-loading`,children:[(0,B.jsx)(Jp,{"aria-hidden":`true`}),(0,B.jsx)(`h1`,{children:`Reading benchmark study`}),(0,B.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,B.jsxs)(`main`,{className:`benchmark-page`,children:[(0,B.jsxs)(`header`,{className:`benchmark-hero`,children:[(0,B.jsxs)(`div`,{className:`benchmark-hero-topline`,children:[(0,B.jsx)(`a`,{className:`benchmark-wordmark`,href:`/chat/`,children:`LoopX`}),(0,B.jsxs)(`div`,{className:`benchmark-readonly`,children:[(0,B.jsx)(Xm,{"aria-hidden":`true`,size:15}),` Derived read-only projection`]})]}),(0,B.jsxs)(`div`,{className:`benchmark-hero-grid`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`p`,{className:`benchmark-kicker`,children:[`BENCHMARK STUDY / `,n.benchmark_id]}),(0,B.jsxs)(`div`,{className:`benchmark-title-row`,children:[(0,B.jsx)(`h1`,{children:n.design.labels.title??n.study_id}),(0,B.jsx)(Vw,{tone:n.status===`complete`?`success`:`warning`,children:n.status})]}),(0,B.jsx)(`p`,{className:`benchmark-lead`,children:`One declared study, explicit denominators, and the same countability rules from campaign summary to exact run.`})]}),(0,B.jsxs)(`dl`,{className:`benchmark-identity`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Study`}),(0,B.jsx)(`dd`,{children:n.study_id})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Protocol`}),(0,B.jsx)(`dd`,{children:n.design.protocol_id})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Case set`}),(0,B.jsx)(`dd`,{children:n.design.case_set.case_set_id})]})]})]}),(0,B.jsxs)(`div`,{className:`benchmark-kpi-grid`,children:[(0,B.jsxs)(`article`,{children:[(0,B.jsx)(mm,{"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:`Score-countable cells`}),(0,B.jsxs)(`strong`,{children:[n.campaign.selected_score_countable_cell_count,(0,B.jsxs)(`small`,{children:[` / `,n.campaign.intended_cell_denominator]})]}),(0,B.jsxs)(`p`,{children:[Pw(n.campaign.selected_score_countable_coverage_rate),` declared coverage`]})]}),(0,B.jsxs)(`article`,{children:[(0,B.jsx)(um,{"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:`Complete designs`}),(0,B.jsxs)(`strong`,{children:[n.campaign.complete_declared_design_case_count,(0,B.jsxs)(`small`,{children:[` / `,n.campaign.intended_case_count]})]}),(0,B.jsx)(`p`,{children:`Cases with every declared arm`})]}),(0,B.jsxs)(`article`,{children:[(0,B.jsx)(Zp,{"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:`Matched comparisons`}),(0,B.jsx)(`strong`,{children:n.campaign.matched_pair_countable_count}),(0,B.jsx)(`p`,{children:`Eligible pairs only`})]}),(0,B.jsxs)(`article`,{children:[(0,B.jsx)(Jp,{"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:`In flight`}),(0,B.jsx)(`strong`,{children:n.campaign.in_flight_run_count}),(0,B.jsx)(`p`,{children:n.status===`provisional`?`Coverage remains provisional`:`Declared coverage complete`})]})]})]}),(0,B.jsxs)(`nav`,{"aria-label":`Benchmark dashboard views`,className:`benchmark-tabs`,children:[Nw.map(t=>(0,B.jsx)(`button`,{"aria-current":e.view===t.id?`page`:void 0,onClick:()=>u(t.id),type:`button`,children:t.label},t.id)),(0,B.jsxs)(`button`,{className:`benchmark-refresh`,onClick:()=>s(e=>e+1),type:`button`,children:[(0,B.jsx)(Hm,{"aria-hidden":`true`,size:14}),` Refresh local readback`]})]}),(0,B.jsxs)(`div`,{className:`benchmark-content`,children:[e.view===`campaign`&&(0,B.jsx)(Hw,{packet:n,primaryMetric:l}),e.view===`arms`&&(0,B.jsx)(Uw,{packet:n}),e.view===`cases`&&(0,B.jsx)(Ww,{onOpenRun:e=>u(`runs`,e),packet:n,primaryMetric:l}),e.view===`runs`&&(0,B.jsx)(Kw,{onSelectRun:e=>u(`runs`,e),packet:n,selectedRunId:e.runId})]}),(0,B.jsxs)(`footer`,{className:`benchmark-footer`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(Xm,{"aria-hidden":`true`,size:16}),(0,B.jsxs)(`span`,{children:[`Scores: `,n.authority.score_source]}),(0,B.jsx)(`span`,{children:`Dashboard cannot launch, grade, or mutate runs.`})]}),(0,B.jsxs)(`code`,{title:d,children:[`local`,d]})]})]})}var Jw=J({goalId:W().optional().default(``),statusUrl:W().optional().default(``)}),Yw=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(``)}),Xw=Yw.omit({mode:!0}),Zw=J({dashboardUrl:W().optional().default(``),view:Y([`campaign`,`arms`,`cases`,`runs`]).optional().default(`campaign`),runId:W().optional().default(``)});function Qw(){let e=`https://huangruiteng.github.io/loopx/docs/showcases/index.en.html`;return(0,z.useEffect)(()=>{window.location.replace(e)},[]),(0,B.jsx)(`a`,{href:e,children:`Open LoopX cases / 浏览案例`})}function $w({goalId:e,statusUrl:t}){let n=t?lh(t,window.location.href):null;return n?.error?(0,B.jsx)(`main`,{role:`alert`,children:n.error}):(0,B.jsx)(ii,{replace:!0,to:`/`,search:{goalId:e,statusUrl:t}})}function eT(){let e=iT.useSearch();return e.mode===`ops`?(0,B.jsx)($w,{...e}):e.mode===`developer`?(0,B.jsx)(ii,{replace:!0,to:`/developers/projections`}):(0,B.jsx)(Qw,{})}function tT(){return(0,B.jsx)($w,{...aT.useSearch()})}var nT=Ci({component:()=>(0,B.jsx)(Mi,{}),errorComponent:()=>(0,B.jsxs)(`main`,{role:`alert`,className:`p-8`,children:[(0,B.jsx)(`h1`,{children:`页面暂时无法显示 / Page unavailable`}),(0,B.jsx)(`p`,{children:`请重新加载页面;这不会执行任务。 / Reloading does not execute tasks.`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`重新加载 / Reload`})]})}),rT=xi({getParentRoute:()=>nT,path:`/`,validateSearch:e=>Jw.parse(e),component:ow}),iT=xi({getParentRoute:()=>nT,path:`/frontstage`,validateSearch:e=>Yw.parse(e),component:eT}),aT=xi({getParentRoute:()=>nT,path:`/deprecated/frontstage/ops`,validateSearch:e=>Xw.parse(e),component:tT}),oT=xi({getParentRoute:()=>nT,path:`/frontstage/developer`,component:()=>(0,B.jsx)(ii,{replace:!0,to:`/developers/projections`})}),sT=xi({getParentRoute:()=>nT,path:`/developers/projections`,component:bw}),cT=xi({getParentRoute:()=>nT,path:`/benchmarks/study`,validateSearch:e=>Zw.parse(e),component:qw}),lT=nT.addChildren([rT,iT,aT,oT,sT,cT]);function uT(e){return!e||e===`/`||e===`./`?`/`:(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``)||`/`}var dT=Li({routeTree:lT,basepath:uT(`/chat/`),trailingSlash:`preserve`}),fT=document.getElementById(`root`);if(!fT)throw Error(`Root element not found`);var pT=new je({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}});(0,Vi.createRoot)(fT).render((0,B.jsx)(Pe,{client:pT,children:(0,B.jsx)(qi,{children:(0,B.jsx)(Bi,{router:dT})})})); \ No newline at end of file +`),summary:k.summary,title:k.title}}]:[]],at=f.connectionState===`connected`,ot=new Map(E.goals.map(e=>[e.goalId,e.title])),st=e=>qd(e,f.activeSource.statusUrl,at&&!l?.errors[e.goalId],ot.get(e.goalId)),ct={...Jy(E),userTodos:E.userTodos.map(st),attentionHistory:(E.attentionHistory??E.userTodos).map(st),periodicReports:{error:te,loading:j},timeline:it};return(0,B.jsxs)(`div`,{className:p===`dark`?`dark`:``,"data-testid":`personal-goal-home`,children:[Ee?(0,B.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,B.jsx)(KS,{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=>rt(e.goalId),onCorrectRun:async(e,t)=>{if(!e.sessionId)throw Error(`这个 Run 还没有可纠偏的执行 Session。`);let n=await Wh((await Vh({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(qe(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:r?`running`:`ready`,turnId:r}),r){Ne.current.set(e.goalId,r);let t=new AbortController;Pe.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 sg(e.sessionId,r,{signal:t.signal,onDelta:t=>{n+=t,Ye(e.goalId,i,{text:n})}});Ye(e.goalId,i,{activity:[],pending:!1,text:NC(a.response.message||n.trim())||`${e.agentLabel} 已完成纠偏。`})}catch(t){let n=Fe.current.delete(e.goalId);Ye(e.goalId,i,{activity:[],pending:!1,text:n?`已中断。你可以在当前会话继续发送消息。`:t instanceof Error?t.message:`纠偏回合失败。`})}finally{Ne.current.delete(e.goalId),Pe.current.delete(e.goalId),qe(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:`ready`})}}},onCloseRunSession:et,onInterruptRun:async e=>Ze(e),onOpenGoal:rt,onOpenRunSession:async e=>{if(!e.sessionId)return;let t=e.sessionId,n=await Zh(t);ke(e=>({...e,[t]:n})),rt(e.goalId),_e(t=>({...t,[e.goalId]:n.messages.map(t=>({agentLabel:t.role===`user`?void 0:e.agentLabel,attachments:OC(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:NC(t.text)}))})),qe(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=>rt(e.goalId),...b?{onPreviewGoalSubagentConfiguration:async e=>{let t=await fg(e);return{changed:t.changed,configuration:{allowedDomains:t.after.orchestration.allowed_domains,enabled:t.feature_summary.multi_subagent===`enabled`,maxChildren:t.after.orchestration.max_children,modelConfig:t.after.orchestration.model_config},previewId:t.preview_id}},onApplyGoalSubagentConfiguration:async({previewId:e,...t})=>{let n=await pg(t,e);return{allowedDomains:n.after.orchestration.allowed_domains,enabled:n.feature_summary.multi_subagent===`enabled`,maxChildren:n.after.orchestration.max_children,modelConfig:n.after.orchestration.model_config}}}:{},...g?{onExecuteGoalLifecycle:async({goalId:e,operation:t,reason:n})=>{let r=await ex(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:Qe,onSelectAgent:tt,onSelectGoal:e=>e?rt(e):nt(),onSendMessage:async(e,t,n,r)=>Xe(e,{agentId:t,goalId:n,attachments:r}),onStartNewRunSession:$e},goalArchiveLoadState:e,managerChannelBinding:w,managerRuntime:S,model:ct,readOnly:h,selectedAgentId:L.agentId,selectedGoalId:D?.goalId??null,statusSourceControl:f})]})}function uw({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,B.jsx)(`div`,{className:i===`dark`?`dark`:``,children:(0,B.jsxs)(`main`,{className:`min-h-screen bg-[#f6f7f9] text-slate-950 dark:bg-[#09090b] dark:text-zinc-50`,children:[(0,B.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,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-xl font-semibold`,children:`LoopX Workspace`}),(0,B.jsx)(`p`,{className:`mt-1 break-all text-sm text-slate-500 dark:text-zinc-400`,children:`Personal Workspace`})]}),(0,B.jsx)(vy,{"aria-label":`切换主题`,onClick:a,size:`icon`,variant:`secondary`,children:i===`dark`?(0,B.jsx)(th,{className:`h-4 w-4`}):(0,B.jsx)(Im,{className:`h-4 w-4`})})]}),(0,B.jsxs)(`div`,{className:`grid min-h-[calc(100vh-80px)] sm:grid-cols-[240px_1fr]`,children:[(0,B.jsxs)(`aside`,{className:`hidden border-r border-slate-200 p-6 dark:border-zinc-800 sm:block`,"aria-label":`Workspace`,children:[(0,B.jsx)(`strong`,{children:`LoopX`}),(0,B.jsx)(`p`,{className:`mt-6 text-sm`,children:`Workspace`}),(0,B.jsx)(`p`,{className:`mt-8 text-xs text-slate-500`,children:`Goals`}),[1,2,3].map(e=>(0,B.jsx)(`div`,{className:`mt-4 h-8 rounded bg-slate-100 dark:bg-zinc-900`},e))]}),(0,B.jsx)(`div`,{className:`p-4 sm:p-8`,children:(0,B.jsx)(yy,{"data-testid":`initial-status-state`,children:(0,B.jsx)(by,{className:`flex min-h-64 items-center justify-center p-6`,children:(0,B.jsxs)(`div`,{className:`max-w-xl text-center`,children:[e?(0,B.jsx)(um,{className:`mx-auto h-6 w-6 text-rose-600 dark:text-rose-300`}):(0,B.jsx)(Um,{className:`mx-auto h-6 w-6 animate-spin text-slate-500 dark:text-zinc-400`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e?`无法加载实时状态`:`正在加载实时状态`}),e?(0,B.jsxs)(B.Fragment,{children:[(0,B.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,B.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-slate-400 dark:text-zinc-500`,children:`重新加载不会执行任务,也不会改变 Goal 配置。`}):null,(0,B.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:(0,B.jsxs)(vy,{disabled:t,onClick:n,children:[(0,B.jsx)(Um,{className:`h-4 w-4`}),`重试`]})})]}):(0,B.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 dw(){let e=cT.useSearch(),t=cT.useNavigate(),[n,r]=(0,z.useState)(`light`),[i,a]=(0,z.useState)(null),o=(0,z.useRef)(null),s=(0,z.useRef)(e.goalId);s.current=e.goalId;let[c,l]=(0,z.useState)(Mp),[u,d]=(0,z.useState)({kind:`example`,label:`bundled example`}),[f,p]=(0,z.useState)(()=>aC(window.localStorage,window.location.href)),m=(0,z.useRef)(f);m.current=f;let[h,g]=(0,z.useState)(e.statusUrl),[_,v]=(0,z.useState)(null),[y,b]=(0,z.useState)(!1),[x,S]=(0,z.useState)({error:null,phase:`idle`}),[C,w]=(0,z.useState)(e.statusUrl.trim()||null),[T,E]=(0,z.useState)(!1),D=(0,z.useRef)(null),O=(0,z.useRef)(d_(e.statusUrl.trim()||null)),k=!T&&u.kind===`example`?e.statusUrl.trim():``,ee=C??k,te=u.kind===`url`?u.label:hC,A=!!(_&&C),j=fC(f,C,te,window.location.href),M=u.kind===`example`&&!T,ne=c.attention_queue,N=c.run_history,P=(0,z.useMemo)(()=>vC(N.goals,ne.items),[N.goals,ne.items]);function re(e,t,n=0){S({error:null,phase:`loading`}),gC(fh(e,`stopped`,window.location.href)).then(r=>{if(!h_(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=>R_(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=>{h_(O.current,t)&&S({error:jp(e),phase:`error`})})}function ie(){let e=u.kind===`url`?u.label:h||hC,t=p_(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=>R_(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=p_(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 Ip(n,window.location.href).catch(()=>null);if(!h_(O.current,c))return;if(e){let o=(t.retryOnly||t.reuseSnapshots)&&u.kind===`url`&&u.label===n?Pp(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=Lp(e);if(r)l(m);else if(!await ae(n,m,c))return;if(S({error:null,phase:`loading`}),await zp(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})},()=>h_(O.current,c),()=>s.current,d.signal),p&&(t.resyncAttempt??0)<1&&h_(O.current,c)){await F(n,{resyncAttempt:1});return}h_(O.current,c)&&S({error:null,phase:`ready`});return}let o=await gC(fh(n,`active`,window.location.href));if(!h_(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(jp(e))}finally{!r&&m_(O.current,c)&&b(!1)}}function oe(e,t={}){o.current?.abort();let n=f_(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 $b(e.label,t)}catch{}}O.current.selectionRevision===n&&await F(e.statusUrl,{selectionRevision:n})})()}function I(e){m.current=e,p(e);try{oC(window.localStorage,e)}catch{}}let se={activeSource:j,connectionState:y?`loading`:A?`error`:`connected`,errorMessage:A?`未切换到 ${C??`所选来源`}:${_}`:null,onAdd:e=>{let t=cC(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=sC(t,e);n!==t&&I(n)},onRemove:e=>{I(lC(f,e)),j.id===e&&oe(eC)},onSelect:e=>{let t=f.sources.find(t=>t.id===e);t&&oe(t,{ensureTunnel:t.kind===`ssh_tunnel`})},sources:j.id===`temporary`?[...f.sources,j]:f.sources};(0,z.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(hC))},[T,C,e.statusUrl,u.kind,u.label]),(0,z.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,z.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 M?(0,B.jsx)(uw,{error:_,isLoading:y,onRetry:()=>void F(ee||hC),requestedUrl:ee||hC,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)}):(0,B.jsx)(lw,{goalArchiveLoadState:x,isLoading:y,onGoalActivationStateChange:(e,t)=>{O.current.projectionRevision+=1,l(n=>Op(n,e,t)),a(n=>n&&{...n,snapshots:Object.fromEntries(Object.entries(n.snapshots).map(([n,r])=>[n,Op(r,e,t)]))})},onGoalDeleted:e=>{O.current.projectionRevision+=1,l(t=>kp(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||hC,{background:!0,invalidateGoalIds:e?.invalidateGoalIds,reuseSnapshots:!0}),onRetryGoalArchive:ie,onRefresh:()=>F(u.kind===`url`?u.label:h||hC,{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 fw=U_(`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,B.jsx)(`span`,{className:gy(fw({variant:t}),e),...n})}var mw=[{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`}],hw=[{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`}],gw=[{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.`}],_w=[`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`],vw=[{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 yw({children:e,icon:t,title:n}){return(0,B.jsxs)(`section`,{className:`rounded-lg border border-slate-200 bg-white shadow-sm`,children:[(0,B.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,B.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,B.jsx)(t,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function bw(){return(0,B.jsx)(yw,{icon:im,title:`Status Contract Explorer`,children:(0,B.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,"data-testid":`developer-contract-explorer`,children:mw.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(pw,{variant:`info`,children:e.label}),(0,B.jsx)(pw,{variant:`neutral`,children:`public contract`})]}),(0,B.jsx)(`div`,{className:`mt-2 break-words font-mono text-xs text-slate-700`,children:e.source}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.detail})]},e.label))})})}function xw(){return(0,B.jsx)(yw,{icon:wm,title:`Projection Diffing`,children:(0,B.jsx)(`div`,{className:`overflow-x-auto`,"data-testid":`developer-projection-diffing`,children:(0,B.jsxs)(`table`,{className:`min-w-full border-separate border-spacing-0 text-left text-sm`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`bg-slate-50 text-xs uppercase tracking-normal text-slate-500`,children:[(0,B.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Axis`}),(0,B.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Current`}),(0,B.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Proposed`}),(0,B.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Gate`})]})}),(0,B.jsx)(`tbody`,{children:hw.map(e=>(0,B.jsxs)(`tr`,{className:`align-top`,children:[(0,B.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 font-semibold text-slate-950`,children:e.axis}),(0,B.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.current}),(0,B.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.proposed}),(0,B.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.gate})]},e.axis))})]})})})}function Sw(){return(0,B.jsx)(yw,{icon:bm,title:`Fixture Generation`,children:(0,B.jsx)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-fixture-generation`,children:gw.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:e.title}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.title))})})}function Cw(){return(0,B.jsx)(yw,{icon:fm,title:`Smoke Checklist`,children:(0,B.jsx)(`div`,{className:`space-y-2 p-4`,"data-testid":`developer-smoke-checklist`,children:_w.map(e=>(0,B.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,B.jsx)(tm,{className:`mt-0.5 h-4 w-4 shrink-0 text-emerald-600`}),(0,B.jsx)(`code`,{className:`break-all text-xs font-semibold leading-5 text-slate-700`,children:e})]},e))})})}function ww(){return(0,B.jsx)(yw,{icon:pm,title:`Component Examples`,children:(0,B.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-3`,"data-testid":`developer-component-examples`,children:vw.map(e=>(0,B.jsxs)(`article`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.badges.map(e=>(0,B.jsx)(pw,{variant:e===`read-only`||e===`public-safe`?`success`:`neutral`,children:e},e))}),(0,B.jsx)(`h3`,{className:`mt-3 text-sm font-semibold leading-6 text-slate-950`,children:e.name}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.name))})})}function Tw(){return(0,B.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,B.jsxs)(`div`,{className:`mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,B.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,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.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,B.jsx)(nh,{className:`h-4 w-4`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold`,children:`Developer Cockpit`}),(0,B.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Projection extension`})]})]}),(0,B.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,B.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://huangruiteng.github.io/loopx/`,children:[(0,B.jsx)(Om,{className:`h-4 w-4`}),`LoopX home`]}),(0,B.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://huangruiteng.github.io/loopx/docs/showcases/index.en.html`,children:[(0,B.jsx)(vm,{className:`h-4 w-4`}),`Public cases`]}),(0,B.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,B.jsx)(pm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,B.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,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)(pw,{variant:`success`,children:`read-only`}),(0,B.jsx)(pw,{variant:`neutral`,children:`public fixtures`})]}),(0,B.jsx)(`p`,{children:`This route uses static public contracts only; live status feeds, registry files, and browser write APIs stay outside the cockpit.`})]})]}),(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)(pw,{variant:`info`,children:`developers/projections`}),(0,B.jsx)(pw,{variant:`success`,children:`public-safe`}),(0,B.jsx)(pw,{variant:`neutral`,children:`no browser writes`})]}),(0,B.jsx)(`h1`,{className:`mt-3 text-3xl font-semibold tracking-normal text-slate-950`,children:`LoopX Projection Developer Cockpit`}),(0,B.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,B.jsxs)(`div`,{className:`grid min-w-[260px] gap-2 text-sm`,children:[(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Source of truth`}),(0,B.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`status contract + compact fixtures`})]}),(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Boundary`}),(0,B.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`read-only extension surface`})]})]})]})}),(0,B.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,B.jsx)(bw,{}),(0,B.jsx)(xw,{})]}),(0,B.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,B.jsx)(Sw,{}),(0,B.jsx)(Cw,{})]}),(0,B.jsx)(ww,{}),(0,B.jsx)(yw,{icon:Zm,title:`Extension Boundary`,children:(0,B.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-extension-boundary`,children:[(0,B.jsxs)(`div`,{className:`rounded-md border border-emerald-200 bg-emerald-50 px-3 py-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Allowed`}),(0,B.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,B.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Review`}),(0,B.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,B.jsxs)(`div`,{className:`rounded-md border border-rose-200 bg-rose-50 px-3 py-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Stop`}),(0,B.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 Ew=J({value:G().finite(),total:G().finite().positive().optional(),unit:W().optional(),higher_is_better:K()}).passthrough(),Dw=yd(W(),G().finite()).default({}),Ow=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(),kw=J({arm_id:W(),selected_run_id:W().nullable(),score_countable:K(),metrics:yd(W(),Ew),effort:Dw,insight:Ow.nullable().optional()}),Aw=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(),Ew),countability:J({integrity_qualified:K(),official_result_present:K(),score_countable:K()}).passthrough(),treatment_fidelity:W(),effort:Dw,redacted_insight:Ow.nullable().optional(),upload_provenance:J({producer_id:W(),producer_version:W(),observed_at:W(),source_revision:W()}).passthrough()}).passthrough(),jw=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(),Mw=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(),jw),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(),Nw=J({baseline_value:G().finite(),candidate_value:G().finite(),delta:G().finite(),direction:Y([`improved`,`flat`,`regressed`]).optional()}).passthrough(),Pw=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(),Nw)}).passthrough(),Fw=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(Mw),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(kw),eligible_comparisons:q(Pw),largest_eligible_primary_contrast:Pw.nullable()})),runs:q(Aw),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 Iw(e){return Fw.parse(e)}function Lw(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 Rw=[{id:`campaign`,label:`Campaign`},{id:`arms`,label:`Arms`},{id:`cases`,label:`Cases`},{id:`runs`,label:`Runs`}];function zw(e){return e==null?`—`:`${(e*100).toFixed(e>=.995?0:1)}%`}function Bw(e){return e==null?`—`:new Intl.NumberFormat(`en`,{maximumFractionDigits:2,notation:`compact`}).format(e)}function Vw(e){if(e==null)return`—`;let t=e/6e4;return t>=120?`${(t/60).toFixed(1)} h`:`${Bw(t)} min`}function Hw(e){let t=Object.entries(e);return t.length?t.map(([e,t])=>`${e} (${t})`).join(`, `):`—`}function Uw(e){if(!e)return`—`;let t=e.total==null?Bw(e.value):`${Bw(e.value)}/${Bw(e.total)}`;return e.unit?`${t} ${e.unit}`:t}function Ww(e,t){let n=e.metrics[t];return!n||n.case_denominator===0?`—`:n.suite_micro_rate==null?`${Bw(n.value_mean)} mean`:`${zw(n.suite_micro_rate)} · ${Bw(n.suite_micro_numerator)}/${Bw(n.suite_micro_denominator)}`}function Gw(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}${Bw(r.delta)}`}}function Kw({children:e,tone:t=`neutral`}){return(0,B.jsx)(`span`,{className:`benchmark-state benchmark-state-${t}`,children:e})}function qw({packet:e,primaryMetric:t}){return(0,B.jsxs)(`div`,{className:`benchmark-view-stack`,children:[(0,B.jsxs)(`section`,{"aria-labelledby":`arm-summary-title`,children:[(0,B.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`benchmark-kicker`,children:`ARM SUMMARY`}),(0,B.jsx)(`h2`,{id:`arm-summary-title`,children:`Comparable outcomes, denominator first`})]}),(0,B.jsx)(`p`,{children:`Only one score-countable run per declared case × arm cell is selected.`})]}),(0,B.jsx)(`div`,{className:`benchmark-arm-grid`,children:e.arms.map(e=>{let n=Object.values(e.binary_outcomes)[0];return(0,B.jsxs)(`article`,{className:`benchmark-arm-card`,children:[(0,B.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`benchmark-mono`,children:e.arm_role}),(0,B.jsx)(`h3`,{children:e.arm_id})]}),(0,B.jsx)(Kw,{tone:e.coverage_rate===1?`success`:`warning`,children:e.coverage_rate===1?`Complete`:`Provisional`})]}),(0,B.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`dt`,{children:[`Primary · `,t]}),(0,B.jsx)(`dd`,{children:Ww(e,t)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Score-countable coverage`}),(0,B.jsxs)(`dd`,{children:[e.selected_score_countable_case_count,`/`,e.intended_case_count]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Binary success`}),(0,B.jsx)(`dd`,{children:n?`${n.success_count}/${n.case_denominator}`:`Not declared`})]})]})]},e.arm_id)})})]}),(0,B.jsxs)(`section`,{"aria-labelledby":`contrast-title`,children:[(0,B.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`benchmark-kicker`,children:`MATCHED CONTRASTS`}),(0,B.jsx)(`h2`,{id:`contrast-title`,children:`Direction counts on eligible pairs`})]}),(0,B.jsx)(`p`,{children:`Raw run volume is never used as a comparison denominator.`})]}),(0,B.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,B.jsxs)(`table`,{children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`Candidate arm`}),(0,B.jsx)(`th`,{children:`Matched denominator`}),(0,B.jsx)(`th`,{children:`Improved`}),(0,B.jsx)(`th`,{children:`Flat`}),(0,B.jsx)(`th`,{children:`Regressed`}),(0,B.jsx)(`th`,{children:`Binary transitions`})]})}),(0,B.jsxs)(`tbody`,{children:[Object.entries(e.contrasts).map(([e,t])=>(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:(0,B.jsx)(`strong`,{children:e})}),(0,B.jsx)(`td`,{children:t.matched_pair_denominator}),(0,B.jsx)(`td`,{className:`benchmark-positive`,children:t.primary_metric_directions.improved}),(0,B.jsx)(`td`,{children:t.primary_metric_directions.flat}),(0,B.jsx)(`td`,{className:`benchmark-negative`,children:t.primary_metric_directions.regressed}),(0,B.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,B.jsx)(`tr`,{children:(0,B.jsx)(`td`,{colSpan:6,children:`No matched comparisons are countable yet.`})})]})]})})]}),(0,B.jsxs)(`section`,{"aria-labelledby":`runtime-health-title`,children:[(0,B.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`benchmark-kicker`,children:`RUNTIME HEALTH`}),(0,B.jsx)(`h2`,{id:`runtime-health-title`,children:`Qualified observations, without execution authority`})]}),(0,B.jsxs)(`p`,{children:[e.campaign.runtime_observation_count,` public-safe runtime observations.`]})]}),(0,B.jsxs)(`div`,{className:`benchmark-runtime-list`,children:[Object.entries(e.campaign.runtime_classification_counts).map(([e,t])=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{children:e}),(0,B.jsx)(`strong`,{children:t})]},e)),e.campaign.runtime_observation_count===0&&(0,B.jsx)(`p`,{className:`benchmark-muted`,children:`No runtime observations uploaded.`})]})]})]})}function Jw({packet:e}){return(0,B.jsx)(`div`,{className:`benchmark-detail-grid`,children:e.arms.map(t=>(0,B.jsxs)(`article`,{className:`benchmark-detail-card`,children:[(0,B.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`benchmark-mono`,children:t.arm_role}),(0,B.jsx)(`h2`,{children:t.arm_id})]}),(0,B.jsxs)(Kw,{tone:t.coverage_rate===1?`success`:`warning`,children:[t.selected_score_countable_case_count,`/`,t.intended_case_count,` countable`]})]}),(0,B.jsx)(`div`,{className:`benchmark-factor-row`,children:Object.entries(t.factor_assignments).map(([e,t])=>(0,B.jsxs)(`span`,{children:[e,`: `,(0,B.jsx)(`strong`,{children:t})]},e))}),(0,B.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[e.design.metric_catalog.map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`dt`,{children:[e.role,` · `,e.metric_name]}),(0,B.jsx)(`dd`,{children:Ww(t,e.metric_name)})]},e.metric_name)),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Runs terminal / observed`}),(0,B.jsxs)(`dd`,{children:[t.terminal_run_count,`/`,t.run_count]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Median duration`}),(0,B.jsx)(`dd`,{children:Vw(t.effort.duration_ms?.median)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Protocols`}),(0,B.jsx)(`dd`,{children:Hw(t.protocol_counts)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Runner revisions`}),(0,B.jsx)(`dd`,{children:Hw(t.runner_revision_counts)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Orchestrator runtimes`}),(0,B.jsxs)(`dd`,{children:[Object.keys(t.orchestrator_runtime_counts).length||0,` distinct`]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Failure classes`}),(0,B.jsx)(`dd`,{children:Hw(t.failure_class_counts)})]})]})]},t.arm_id))})}function Yw({packet:e,primaryMetric:t,onOpenRun:n}){return(0,B.jsx)(`div`,{className:`benchmark-table-shell benchmark-wide-table`,children:(0,B.jsxs)(`table`,{children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`Case`}),(0,B.jsx)(`th`,{children:`Design status`}),(0,B.jsx)(`th`,{children:`Largest eligible delta`}),e.arms.map(e=>(0,B.jsx)(`th`,{children:e.arm_id},e.arm_id))]})}),(0,B.jsx)(`tbody`,{children:e.cases.map(r=>{let i=Gw(r,t);return(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:(0,B.jsx)(`strong`,{children:r.case_id})}),(0,B.jsx)(`td`,{children:(0,B.jsx)(Kw,{tone:r.complete_declared_design?`success`:`warning`,children:r.complete_declared_design?`Complete`:`Provisional`})}),(0,B.jsx)(`td`,{className:i?.direction===`improved`?`benchmark-positive`:i?.direction===`regressed`?`benchmark-negative`:void 0,children:i?.text??`—`}),r.arms.map(r=>(0,B.jsx)(`td`,{children:r.selected_run_id&&r.score_countable?(0,B.jsxs)(`button`,{className:`benchmark-cell-link`,onClick:()=>n(r.selected_run_id),type:`button`,children:[(0,B.jsxs)(`span`,{children:[t,`: `,Uw(r.metrics[t])]}),e.design.metric_catalog.filter(e=>e.metric_name!==t).map(e=>(0,B.jsxs)(`small`,{className:`benchmark-cell-metric`,children:[e.metric_name,`: `,Uw(r.metrics[e.metric_name])]},e.metric_name)),(0,B.jsxs)(`small`,{children:[`Countable · `,Vw(r.effort.duration_ms),` `,(0,B.jsx)(Qp,{"aria-hidden":`true`,size:12})]}),r.insight&&(0,B.jsxs)(`small`,{children:[r.insight.failure_class,` · `,r.insight.confidence]})]}):(0,B.jsx)(`span`,{className:`benchmark-muted`,children:`Not countable`})},r.arm_id))]},r.case_id)})})]})})}function Xw({run:e,packet:t}){return(0,B.jsxs)(`aside`,{"aria-label":`Run detail for ${e.run_id}`,className:`benchmark-run-detail`,children:[(0,B.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`benchmark-mono`,children:`RUN DETAIL`}),(0,B.jsx)(`h2`,{children:e.run_id})]}),(0,B.jsx)(Kw,{tone:e.countability.score_countable?`success`:`warning`,children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]}),(0,B.jsxs)(`dl`,{className:`benchmark-stat-list benchmark-run-facts`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Case / arm`}),(0,B.jsxs)(`dd`,{children:[e.case_id,` · `,e.arm_id]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Lifecycle`}),(0,B.jsxs)(`dd`,{children:[e.status,` · `,e.observed_at]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Protocol`}),(0,B.jsx)(`dd`,{children:e.protocol_id})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Qualification`}),(0,B.jsxs)(`dd`,{children:[`Integrity `,e.countability.integrity_qualified?`qualified`:`not qualified`,` · result `,e.countability.official_result_present?`present`:`missing`]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Treatment fidelity`}),(0,B.jsx)(`dd`,{children:e.treatment_fidelity})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Effort`}),(0,B.jsxs)(`dd`,{children:[Vw(e.effort.duration_ms),` · `,Bw(e.effort.agent_steps),` steps · `,Bw(e.effort.token_count),` tokens`]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Runner revision`}),(0,B.jsx)(`dd`,{children:e.runner_revision??`—`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Upload provenance`}),(0,B.jsxs)(`dd`,{children:[e.upload_provenance.producer_id,` · `,e.upload_provenance.source_revision]})]})]}),(0,B.jsx)(`div`,{className:`benchmark-run-metrics`,children:t.design.metric_catalog.map(t=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{children:t.metric_name}),(0,B.jsx)(`strong`,{children:Uw(e.metrics[t.metric_name])})]},t.metric_name))}),e.redacted_insight&&(0,B.jsxs)(`div`,{className:`benchmark-insight`,children:[(0,B.jsxs)(`span`,{className:`benchmark-mono`,children:[`REDACTED CASE INSIGHT · `,e.redacted_insight.confidence]}),(0,B.jsx)(`p`,{children:e.redacted_insight.causal_summary}),(0,B.jsxs)(`small`,{children:[`Implication: `,e.redacted_insight.implication]}),(0,B.jsx)(`br`,{}),(0,B.jsxs)(`small`,{children:[`Next probe: `,e.redacted_insight.next_probe]}),!!e.redacted_insight.evidence_refs?.length&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`br`,{}),(0,B.jsxs)(`small`,{children:[`Evidence: `,e.redacted_insight.evidence_refs.join(`, `)]})]})]})]})}function Zw({packet:e,selectedRunId:t,onSelectRun:n}){let r=e.runs.find(e=>e.run_id===t)??e.runs[0];return(0,B.jsxs)(`div`,{className:`benchmark-runs-layout`,children:[(0,B.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,B.jsxs)(`table`,{children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`Run`}),(0,B.jsx)(`th`,{children:`Case`}),(0,B.jsx)(`th`,{children:`Arm`}),(0,B.jsx)(`th`,{children:`Status`}),(0,B.jsx)(`th`,{children:`Countability`})]})}),(0,B.jsx)(`tbody`,{children:e.runs.map(e=>(0,B.jsxs)(`tr`,{"aria-selected":e.run_id===r?.run_id,children:[(0,B.jsx)(`td`,{children:(0,B.jsx)(`button`,{className:`benchmark-run-link`,onClick:()=>n(e.run_id),type:`button`,children:e.run_id})}),(0,B.jsx)(`td`,{children:e.case_id}),(0,B.jsx)(`td`,{children:e.arm_id}),(0,B.jsx)(`td`,{children:e.status}),(0,B.jsx)(`td`,{children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]},e.run_id))})]})}),r&&(0,B.jsx)(Xw,{packet:e,run:r})]})}function Qw(){let e=pT.useSearch(),t=pT.useNavigate(),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(0),c=(0,z.useMemo)(()=>{let t=e.dashboardUrl||`/chat/benchmark-study.example.json`;try{return{url:Lw(t,window.location.href),error:null}}catch(e){return{url:``,error:e instanceof Error?e.message:`Invalid dashboard source`}}},[e.dashboardUrl]);if((0,z.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 Iw(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,z.useEffect)(()=>{n&&(document.title=`${n.design.labels.title??n.study_id} · LoopX Benchmark`)},[n]),i)return(0,B.jsxs)(`main`,{className:`benchmark-page benchmark-loading`,children:[(0,B.jsx)(um,{"aria-hidden":`true`}),(0,B.jsx)(`h1`,{children:`Dashboard packet unavailable`}),(0,B.jsx)(`p`,{children:i}),(0,B.jsxs)(`button`,{onClick:()=>s(e=>e+1),type:`button`,children:[(0,B.jsx)(Um,{"aria-hidden":`true`,size:16}),` Retry readback`]})]});if(!n)return(0,B.jsxs)(`main`,{"aria-busy":`true`,className:`benchmark-page benchmark-loading`,children:[(0,B.jsx)(Yp,{"aria-hidden":`true`}),(0,B.jsx)(`h1`,{children:`Reading benchmark study`}),(0,B.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,B.jsxs)(`main`,{className:`benchmark-page`,children:[(0,B.jsxs)(`header`,{className:`benchmark-hero`,children:[(0,B.jsxs)(`div`,{className:`benchmark-hero-topline`,children:[(0,B.jsx)(`a`,{className:`benchmark-wordmark`,href:`/chat/`,children:`LoopX`}),(0,B.jsxs)(`div`,{className:`benchmark-readonly`,children:[(0,B.jsx)(Zm,{"aria-hidden":`true`,size:15}),` Derived read-only projection`]})]}),(0,B.jsxs)(`div`,{className:`benchmark-hero-grid`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`p`,{className:`benchmark-kicker`,children:[`BENCHMARK STUDY / `,n.benchmark_id]}),(0,B.jsxs)(`div`,{className:`benchmark-title-row`,children:[(0,B.jsx)(`h1`,{children:n.design.labels.title??n.study_id}),(0,B.jsx)(Kw,{tone:n.status===`complete`?`success`:`warning`,children:n.status})]}),(0,B.jsx)(`p`,{className:`benchmark-lead`,children:`One declared study, explicit denominators, and the same countability rules from campaign summary to exact run.`})]}),(0,B.jsxs)(`dl`,{className:`benchmark-identity`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Study`}),(0,B.jsx)(`dd`,{children:n.study_id})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Protocol`}),(0,B.jsx)(`dd`,{children:n.design.protocol_id})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Case set`}),(0,B.jsx)(`dd`,{children:n.design.case_set.case_set_id})]})]})]}),(0,B.jsxs)(`div`,{className:`benchmark-kpi-grid`,children:[(0,B.jsxs)(`article`,{children:[(0,B.jsx)(hm,{"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:`Score-countable cells`}),(0,B.jsxs)(`strong`,{children:[n.campaign.selected_score_countable_cell_count,(0,B.jsxs)(`small`,{children:[` / `,n.campaign.intended_cell_denominator]})]}),(0,B.jsxs)(`p`,{children:[zw(n.campaign.selected_score_countable_coverage_rate),` declared coverage`]})]}),(0,B.jsxs)(`article`,{children:[(0,B.jsx)(dm,{"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:`Complete designs`}),(0,B.jsxs)(`strong`,{children:[n.campaign.complete_declared_design_case_count,(0,B.jsxs)(`small`,{children:[` / `,n.campaign.intended_case_count]})]}),(0,B.jsx)(`p`,{children:`Cases with every declared arm`})]}),(0,B.jsxs)(`article`,{children:[(0,B.jsx)(Qp,{"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:`Matched comparisons`}),(0,B.jsx)(`strong`,{children:n.campaign.matched_pair_countable_count}),(0,B.jsx)(`p`,{children:`Eligible pairs only`})]}),(0,B.jsxs)(`article`,{children:[(0,B.jsx)(Yp,{"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:`In flight`}),(0,B.jsx)(`strong`,{children:n.campaign.in_flight_run_count}),(0,B.jsx)(`p`,{children:n.status===`provisional`?`Coverage remains provisional`:`Declared coverage complete`})]})]})]}),(0,B.jsxs)(`nav`,{"aria-label":`Benchmark dashboard views`,className:`benchmark-tabs`,children:[Rw.map(t=>(0,B.jsx)(`button`,{"aria-current":e.view===t.id?`page`:void 0,onClick:()=>u(t.id),type:`button`,children:t.label},t.id)),(0,B.jsxs)(`button`,{className:`benchmark-refresh`,onClick:()=>s(e=>e+1),type:`button`,children:[(0,B.jsx)(Um,{"aria-hidden":`true`,size:14}),` Refresh local readback`]})]}),(0,B.jsxs)(`div`,{className:`benchmark-content`,children:[e.view===`campaign`&&(0,B.jsx)(qw,{packet:n,primaryMetric:l}),e.view===`arms`&&(0,B.jsx)(Jw,{packet:n}),e.view===`cases`&&(0,B.jsx)(Yw,{onOpenRun:e=>u(`runs`,e),packet:n,primaryMetric:l}),e.view===`runs`&&(0,B.jsx)(Zw,{onSelectRun:e=>u(`runs`,e),packet:n,selectedRunId:e.runId})]}),(0,B.jsxs)(`footer`,{className:`benchmark-footer`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(Zm,{"aria-hidden":`true`,size:16}),(0,B.jsxs)(`span`,{children:[`Scores: `,n.authority.score_source]}),(0,B.jsx)(`span`,{children:`Dashboard cannot launch, grade, or mutate runs.`})]}),(0,B.jsxs)(`code`,{title:d,children:[`local`,d]})]})]})}var $w=J({goalId:W().optional().default(``),statusUrl:W().optional().default(``)}),eT=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=eT.omit({mode:!0}),nT=J({dashboardUrl:W().optional().default(``),view:Y([`campaign`,`arms`,`cases`,`runs`]).optional().default(`campaign`),runId:W().optional().default(``)});function rT(){let e=`https://huangruiteng.github.io/loopx/docs/showcases/index.en.html`;return(0,z.useEffect)(()=>{window.location.replace(e)},[]),(0,B.jsx)(`a`,{href:e,children:`Open LoopX cases / 浏览案例`})}function iT({goalId:e,statusUrl:t}){let n=t?uh(t,window.location.href):null;return n?.error?(0,B.jsx)(`main`,{role:`alert`,children:n.error}):(0,B.jsx)(ii,{replace:!0,to:`/`,search:{goalId:e,statusUrl:t}})}function aT(){let e=lT.useSearch();return e.mode===`ops`?(0,B.jsx)(iT,{...e}):e.mode===`developer`?(0,B.jsx)(ii,{replace:!0,to:`/developers/projections`}):(0,B.jsx)(rT,{})}function oT(){return(0,B.jsx)(iT,{...uT.useSearch()})}var sT=Ci({component:()=>(0,B.jsx)(Mi,{}),errorComponent:()=>(0,B.jsxs)(`main`,{role:`alert`,className:`p-8`,children:[(0,B.jsx)(`h1`,{children:`页面暂时无法显示 / Page unavailable`}),(0,B.jsx)(`p`,{children:`请重新加载页面;这不会执行任务。 / Reloading does not execute tasks.`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`重新加载 / Reload`})]})}),cT=xi({getParentRoute:()=>sT,path:`/`,validateSearch:e=>$w.parse(e),component:dw}),lT=xi({getParentRoute:()=>sT,path:`/frontstage`,validateSearch:e=>eT.parse(e),component:aT}),uT=xi({getParentRoute:()=>sT,path:`/deprecated/frontstage/ops`,validateSearch:e=>tT.parse(e),component:oT}),dT=xi({getParentRoute:()=>sT,path:`/frontstage/developer`,component:()=>(0,B.jsx)(ii,{replace:!0,to:`/developers/projections`})}),fT=xi({getParentRoute:()=>sT,path:`/developers/projections`,component:Tw}),pT=xi({getParentRoute:()=>sT,path:`/benchmarks/study`,validateSearch:e=>nT.parse(e),component:Qw}),mT=sT.addChildren([cT,lT,uT,dT,fT,pT]);function hT(e){return!e||e===`/`||e===`./`?`/`:(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``)||`/`}var gT=Li({routeTree:mT,basepath:hT(`/chat/`),trailingSlash:`preserve`}),_T=document.getElementById(`root`);if(!_T)throw Error(`Root element not found`);var vT=new je({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}});(0,Vi.createRoot)(_T).render((0,B.jsx)(Pe,{client:vT,children:(0,B.jsx)(qi,{children:(0,B.jsx)(Bi,{router:gT})})})); \ No newline at end of file diff --git a/loopx/web/chat/assets/index-wAFS2mYU.css b/loopx/web/chat/assets/index-wAFS2mYU.css deleted file mode 100644 index e85644d9b1..0000000000 --- a/loopx/web/chat/assets/index-wAFS2mYU.css +++ /dev/null @@ -1 +0,0 @@ -.delivery-review{min-width:0;color:var(--pw-text);gap:20px;padding:0;display:grid}.delivery-review h2,.delivery-review h3,.delivery-review h4,.delivery-review p{margin:0}.delivery-review h2{font-size:20px;font-weight:600;line-height:28px}.delivery-review h3{font-size:16px;font-weight:600;line-height:24px}.delivery-review h4{font-size:14px;line-height:20px}.delivery-review p{overflow-wrap:anywhere;line-height:1.6}.delivery-review button,.delivery-review select,.delivery-review input{color:inherit;font:inherit}.delivery-review button,.delivery-review select{border:1px solid var(--pw-line);background:var(--pw-card);cursor:pointer;border-radius:6px;min-height:44px;padding:8px 12px}.delivery-review button:disabled{opacity:.5;cursor:not-allowed}.delivery-review button[aria-pressed=true]{border-color:var(--pw-text);background:var(--pw-hover,var(--pw-card))}.delivery-review :is(button,input,select,summary,[tabindex]):focus-visible{outline:2px solid var(--color-link,#0070f3);outline-offset:3px}.delivery-review-toolbar,.delivery-chain-toolbar{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;display:flex}.delivery-review-toolbar>div,.delivery-chain-toolbar>div,.delivery-source-actions{flex-wrap:wrap;gap:8px;display:flex}.delivery-review-toolbar button,.delivery-source-actions button{align-items:center;gap:8px;display:inline-flex}.delivery-snapshot-time,.delivery-boundary,.delivery-chain-toolbar>span{color:var(--pw-muted);font-size:12px}.delivery-notice{border:1px solid var(--pw-line);border-left:3px solid var(--pw-amber,#a96500);border-radius:6px;padding:12px 16px;font-size:13px}.delivery-notice dl{flex-wrap:wrap;gap:8px 24px;margin:12px 0 0;display:flex}.delivery-notice dl>div{gap:8px;display:flex}.delivery-notice dd{margin:0;font-weight:600}.delivery-chain{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;min-width:0;overflow:hidden}.delivery-chain-toolbar{border-bottom:1px solid var(--pw-line);padding:16px}.delivery-chain-toolbar h3{margin-right:auto}.delivery-filters{border-bottom:1px solid var(--pw-line);flex-wrap:wrap;gap:8px;padding:12px 16px;display:flex}.delivery-filters label{flex:1;align-items:center;gap:8px;min-width:160px;display:flex}.delivery-filters input{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:6px;width:100%;min-width:0;padding:10px 8px}.delivery-map-scroll{overscroll-behavior:contain;max-height:540px;overflow:auto}.delivery-map{width:960px;min-height:172px;position:relative}.delivery-map-heading{color:var(--pw-muted);font-size:12px;font-weight:500;position:absolute;top:16px}.delivery-map svg{color:var(--pw-muted);pointer-events:none;position:absolute;inset:0}.delivery-map svg>path{fill:none;stroke:currentColor;stroke-width:1px;opacity:.3}.delivery-map svg>path.is-related{stroke-width:2px;opacity:1}.delivery-map .delivery-map-node{text-align:left;background:var(--pw-card);border-radius:12px;gap:8px;width:280px;height:100px;padding:12px;display:grid;position:absolute}.delivery-map-node>span{color:var(--pw-muted);justify-content:space-between;align-items:center;font-size:11px;display:flex}.delivery-map-node>strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.delivery-map-node>small{color:var(--pw-muted);white-space:nowrap;text-overflow:ellipsis;font-size:11px;overflow:hidden}.delivery-review em{color:var(--pw-muted);font-size:11px;font-style:normal}.delivery-review em[data-state=blocked],.delivery-review em[data-state=waiting]{color:var(--pw-amber,#a96500)}.delivery-node-list,.delivery-relations{margin:0;padding:0;list-style:none}.delivery-node-list li+li{border-top:1px solid var(--pw-line)}.delivery-node-list button{text-align:left;border-radius:0;grid-template-columns:88px minmax(0,1fr) 120px 72px;align-items:center;gap:12px;width:100%;padding:16px;display:grid}.delivery-node-list strong,.delivery-node-list small{overflow-wrap:anywhere}.delivery-node-list span,.delivery-node-list small{color:var(--pw-muted);font-size:12px}.delivery-node-detail{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;gap:16px;padding:20px;display:grid}.delivery-node-detail header{gap:8px;display:grid}.delivery-node-detail header>span,.delivery-node-detail header>p,.delivery-source-actions p{color:var(--pw-muted);font-size:12px}.delivery-node-detail summary{cursor:pointer;min-height:44px;padding-top:12px}.delivery-node-detail code,.delivery-node-detail details p{overflow-wrap:anywhere;font-size:12px}.delivery-relations{gap:12px;display:grid}.delivery-relations li{border-bottom:1px solid var(--pw-line);padding-bottom:12px}.delivery-relations li>div{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:8px;display:grid}.delivery-relations button{text-align:left;overflow-wrap:anywhere;font-size:12px}.delivery-relations span{align-items:center;gap:4px;font-size:11px;display:flex}.delivery-relations p{color:var(--pw-muted);padding-top:8px;font-size:12px}.delivery-empty{padding:24px}@media (width<=640px){.delivery-review{gap:16px}.delivery-review-toolbar>div{width:100%}.delivery-review-toolbar button{flex:1;justify-content:center;font-size:12px}.delivery-filters label{flex-basis:100%}.delivery-filters select{flex:1;min-width:0}.delivery-node-list button{grid-template-columns:minmax(0,1fr) auto;gap:8px}.delivery-node-list strong{grid-column:1/-1}.delivery-relations li>div{grid-template-columns:minmax(0,1fr)}.delivery-node-detail{padding:16px}}.delivery-notice summary{cursor:pointer;min-height:24px}.personal-goal-view-panel{min-width:0}.personal-goal-view-panel[hidden]{display:none}.personal-goal-view-panel[data-goal-panel=tasks]{height:100%}.goal-overview{gap:24px;min-width:0;display:grid}.goal-overview h2,.goal-overview h3,.goal-overview p{margin:0}.goal-overview h2{font-size:20px;font-weight:600}.goal-overview h3{font-size:14px;font-weight:600}.goal-overview button{border:1px solid var(--pw-line);background:var(--pw-card);min-height:40px;color:var(--pw-text);font:inherit;cursor:pointer;text-align:left;border-radius:6px;align-items:center;gap:8px;padding:8px 12px;display:inline-flex}.goal-overview button:focus-visible{outline:2px solid var(--pw-blue);outline-offset:3px}.goal-overview-heading,.goal-overview-summary header{justify-content:space-between;align-items:center;gap:16px;display:flex}.goal-overview-heading button,.goal-overview-summary header span{color:var(--pw-muted);font-size:12px}.goal-overview-summary{grid-template-columns:1fr 1fr;gap:20px;display:grid}.goal-overview-summary>section{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;align-content:start;gap:16px;min-width:0;padding:20px;display:grid}.goal-overview-summary p,.goal-overview-source-note{color:var(--pw-muted);font-size:13px;line-height:1.6}.goal-overview-summary strong,.goal-overview-summary p,.goal-overview-summary button span{overflow-wrap:anywhere}.goal-overview-summary ul{margin:0;padding:0;list-style:none}.goal-overview-summary li+li{margin-top:8px}.goal-overview-summary li button{justify-content:space-between;width:100%;display:flex}.goal-overview-links{gap:8px;display:flex}.goal-overview-summary .goal-overview-run{grid-template-columns:1fr auto;gap:4px 12px;display:grid}.goal-overview-run small{color:var(--pw-muted);font-size:12px}.goal-overview-run strong{grid-row:2;font-size:13px}.goal-overview-run svg{grid-area:1/2/3}.goal-overview-usage{border-block:1px solid var(--pw-line);grid-template-columns:repeat(3,minmax(0,1fr));margin:0;padding-block:12px;display:grid}.goal-overview-usage>div{padding-inline:16px}.goal-overview-usage>div+div{border-left:1px solid var(--pw-line)}.goal-overview-usage dt{color:var(--pw-muted);font-size:11px}.goal-overview-usage dd{margin:8px 0 0;font-size:14px}@media (width<=640px){.goal-overview-summary{grid-template-columns:1fr}.goal-overview-usage>div{padding-inline:8px}}.personal-workspace-shell{--pw-bg:#fbfaf7;--pw-card:#fff;--pw-line:#eceae3;--pw-line-strong:#e0ddd4;--pw-muted:#82889a;--pw-faint:#aab0bf;--pw-text:#23262e;--pw-blue:#2f66e9;--pw-blue-ink:#2456c8;--pw-blue-soft:#ebf1fe;--pw-amber:#a86a12;--pw-amber-bg:#fbf2df;--pw-red:#c2402f;--pw-red-bg:#fcecea;--pw-green:#2e7d5b;--pw-green-bg:#e6f3ec;background:var(--pw-bg);min-height:100vh;color:var(--pw-text);grid-template-columns:272px minmax(520px,1fr);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;display:grid}.personal-workspace-shell.has-drawer{grid-template-columns:256px minmax(500px,1fr) minmax(340px,404px)}.personal-workspace-shell.has-task-inspector{grid-template-columns:minmax(520px,1fr) minmax(520px,50vw)}.personal-workspace-shell.has-task-inspector .personal-workspace-sidebar{display:none}.personal-workspace-shell.has-task-inspector.is-task-inspector-full{grid-template-columns:minmax(600px,1fr)}.personal-workspace-shell.is-task-inspector-full .personal-workspace-main{display:none}.personal-workspace-sidebar{border-right:1px solid var(--pw-line);background:#f5f3ee;min-width:0}.personal-workspace-sidebar-inner{width:100%;height:100%}.personal-sr-only{clip:rect(0, 0, 0, 0)!important;white-space:nowrap!important;border:0!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;position:absolute!important;overflow:hidden!important}.personal-workspace-main{min-width:0}.personal-workspace-drawer{border-left:1px solid var(--pw-line);background:#fff;min-width:0;position:relative;box-shadow:-14px 0 36px #1e1c140d}.personal-workspace-drawer[data-drawer-mode=inspector]{z-index:3;width:auto;position:relative;box-shadow:-8px 0 24px #1e284014}.personal-workspace-drawer[data-drawer-mode=inspector-full]{min-width:0;box-shadow:none;grid-column:1}.personal-sidebar-backdrop{display:none}.personal-workspace-shell :focus-visible:not(textarea):not(input){outline-offset:2px;outline:2px solid #5f87ed}.personal-goal-directory{flex-direction:column;width:100%;height:100vh;display:flex;position:sticky;top:0}.personal-sidebar-brand{border-bottom:1px solid var(--pw-line);align-items:center;gap:11px;height:74px;padding:0 18px;display:flex}.personal-sidebar-brand>span:last-child{gap:1px;display:grid}.personal-sidebar-brand strong{letter-spacing:.01em;font-size:16px}.personal-sidebar-brand small{color:var(--pw-muted);font-size:11px}.personal-brand-mark,.personal-manager-icon{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:10px;place-items:center;display:grid;box-shadow:0 2px 6px #2f66e947}.personal-brand-mark{width:34px;height:34px}.personal-manager-icon{width:30px;height:30px;color:var(--pw-blue-ink);background:var(--pw-blue-soft);box-shadow:none}.personal-status-source{border-bottom:1px solid var(--pw-line);gap:7px;padding:12px 14px;display:grid;position:relative}.personal-status-source>header{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;justify-content:space-between;align-items:center;padding:0 3px;font-size:10px;font-weight:700;display:flex}.personal-status-source>header button,.personal-status-source-meta button,.personal-status-source-form header button{width:25px;height:25px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-status-source>header button:hover,.personal-status-source-meta button:hover,.personal-status-source-form header button:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-status-source-select{width:100%}.personal-status-source-meta{min-width:0;color:var(--pw-muted);align-items:center;gap:7px;padding:0 3px;font-size:10.5px;display:flex}.personal-status-source-meta>span{white-space:nowrap;align-items:center;gap:5px;display:inline-flex}.personal-status-source-meta>span i{background:#3fbf82;border-radius:50%;width:6px;height:6px}.personal-status-source-meta>span.is-loading i{background:#e5a33d}.personal-status-source-meta>span.is-error i{background:#dd5b47}.personal-status-source-meta small{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}.personal-status-source-meta button{width:22px;height:22px;color:var(--pw-faint);margin-left:auto}.personal-status-source-error{color:var(--pw-red);overflow-wrap:anywhere;margin:0 3px;font-size:10px;line-height:1.4}.personal-status-source-form{z-index:12;border:1px solid var(--pw-line-strong);background:#fff;border-radius:12px;gap:10px;padding:13px;display:grid;position:absolute;top:calc(100% - 4px);left:12px;right:12px;box-shadow:0 12px 32px #1e1c1424}.personal-status-source-form>header{justify-content:space-between;align-items:center;font-size:12.5px;display:flex}.personal-status-source-form label{color:var(--pw-muted);gap:5px;font-size:10.5px;display:grid}.personal-status-source-form input,.personal-status-source-form select{border:1px solid var(--pw-line-strong);width:100%;min-width:0;height:34px;color:var(--pw-text);background:#fff;border-radius:8px;outline:0;padding:0 9px;font:12px/1.2 inherit}.personal-status-source-form input:focus,.personal-status-source-form select:focus{border-color:#8aa7ed;box-shadow:0 0 0 2px #2f66e91a}.personal-status-source-form input:disabled,.personal-status-source-form select:disabled{color:var(--pw-faint);background:#f6f5f2}.personal-status-source-form p{color:var(--pw-muted);overflow-wrap:anywhere;margin:0;font-size:10px;line-height:1.45}.personal-status-source-form p.is-error{color:var(--pw-red)}.personal-status-source-form code{font:9.5px/1.5 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-status-source-add{background:var(--pw-blue);color:#fff;cursor:pointer;border:0;border-radius:8px;min-height:34px;font-size:11.5px;font-weight:650}.personal-status-source-add:hover{background:var(--pw-blue-ink)}.personal-status-source-add:disabled{cursor:not-allowed;opacity:.48}.personal-status-source-modes{background:#f2f1ed;border-radius:9px;grid-template-columns:1fr 1fr;gap:3px;padding:3px;display:grid}.personal-status-source-modes button{min-height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;padding:0 8px;font-size:10.5px;font-weight:650}.personal-status-source-modes button[aria-selected=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-status-source-field-row{grid-template-columns:minmax(0,1fr) 34px;gap:6px;display:grid}.personal-status-source-field-row>button{border:1px solid var(--pw-line-strong);width:34px;height:34px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:8px;place-items:center;padding:0;display:grid}.personal-status-source-field-row>button:hover{color:var(--pw-text);background:#f8f7f4}.personal-status-source-field-row>button:disabled{cursor:wait;opacity:.45}.personal-status-source-command{background:#f6f5f2;border-radius:8px;gap:7px;padding:8px 9px;display:grid}.personal-status-source-command code{color:#4e5668;overflow-wrap:anywhere}.personal-status-source-command button{border:1px solid var(--pw-line-strong);min-height:25px;color:var(--pw-blue-ink);cursor:pointer;background:#fff;border-radius:7px;justify-content:center;justify-self:end;align-items:center;gap:5px;padding:0 8px;font-size:10px;font-weight:650;display:inline-flex}.personal-status-source-command button:disabled{color:var(--pw-faint);cursor:not-allowed}.personal-sidebar-nav{flex:1;padding:12px;overflow:auto}.personal-manager-link,.personal-goal-link,.personal-sidebar-utility{width:100%;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0}.personal-manager-link{border-radius:11px;grid-template-columns:30px 1fr auto auto;align-items:center;gap:10px;padding:8px 10px;font-weight:650;display:grid}.personal-manager-link:hover,.personal-goal-link:hover{background:#ffffffa6}.personal-manager-link[aria-current=page],.personal-goal-link[aria-current=page]{background:#fff;box-shadow:0 1px 4px #1e1c141a}.personal-sidebar-count{background:var(--pw-amber-bg);min-width:22px;color:var(--pw-amber);text-align:center;border-radius:99px;padding:2px 7px;font-size:11px;font-weight:650}.personal-sidebar-section-title{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;justify-content:space-between;padding:20px 10px 7px;font-size:11px;font-weight:650;display:flex}.personal-sidebar-title-actions{align-items:center;gap:6px;display:flex}.personal-sidebar-title-actions button{width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-sidebar-title-actions button:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141f}.personal-goal-list{gap:2px;display:grid}.personal-goal-row{border-radius:11px;grid-template-columns:minmax(0,1fr) 28px 28px;align-items:center;gap:2px;display:grid}.personal-goal-row:has(.personal-goal-move-actions){grid-template-columns:minmax(0,1fr) 52px 28px}.personal-goal-row[data-reorder-goal]>.personal-goal-link{cursor:grab;-webkit-user-select:none;user-select:none}.personal-goal-row[data-reorder-goal]>.personal-goal-link:active{cursor:grabbing}.personal-goal-row.is-drop-before{box-shadow:0 -2px var(--color-link,#0070f3)}.personal-goal-row.is-drop-after{box-shadow:0 2px var(--color-link,#0070f3)}.personal-goal-move-actions{display:flex}.personal-goal-move-actions button{min-width:26px;min-height:44px;color:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;place-items:center;display:grid}.personal-goal-move-actions button:disabled{opacity:.35;cursor:default}.personal-goal-move-actions button:not(:disabled):hover{background:var(--color-surface-soft,#f2f2f2)}.personal-goal-link{border-radius:11px;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:10px;min-height:44px;padding:7px 5px 7px 10px;display:grid}.personal-goal-lifecycle{width:26px;height:26px;color:var(--pw-faint);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-goal-lifecycle:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141f}.personal-goal-lifecycle:disabled{opacity:.45;cursor:wait}.personal-goal-lifecycle.is-pending svg{animation:.8s linear infinite personal-goal-lifecycle-spin}@keyframes personal-goal-lifecycle-spin{to{transform:rotate(360deg)}}.personal-goal-delete:hover{color:var(--pw-danger)}.personal-goal-link-copy{gap:2px;min-width:0;display:grid}.personal-goal-link-copy strong,.personal-goal-link-copy small{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.personal-goal-link-copy strong{font-size:13px;font-weight:600}.personal-goal-link-copy small{color:var(--pw-muted);align-items:center;gap:5px;font-size:11px;display:flex}.personal-goal-state-dot{background:#e8ecf1;border-radius:9px;width:30px;height:30px;position:relative}.personal-goal-state-dot:after{content:"";background:#9aa3b2;border-radius:50%;width:7px;height:7px;position:absolute;bottom:3px;right:3px;box-shadow:0 0 0 2px #ffffffd9}.personal-goal-row:nth-child(5n+1) .personal-goal-state-dot{background:#e3ebfd}.personal-goal-row:nth-child(5n+2) .personal-goal-state-dot{background:#eee7fb}.personal-goal-row:nth-child(5n+3) .personal-goal-state-dot{background:#e2f2e4}.personal-goal-row:nth-child(5n+4) .personal-goal-state-dot{background:#fbf0dc}.personal-goal-row:nth-child(5n) .personal-goal-state-dot{background:#e8ecf1}.personal-goal-state-dot.is-danger:after{background:#dd5b47}.personal-goal-state-dot.is-warning:after{background:#e5a33d}.personal-goal-state-dot.is-info:after{background:#54a5e8}.personal-goal-state-dot.is-success:after{background:#3fae7c}.personal-goal-state-dot.is-quiet:after{background:#b6bcc9}.personal-goal-state-dot.is-stopped:after{background:#8f96a4}.personal-stopped-goals{border-top:1px solid var(--pw-line);margin-top:14px;padding-top:8px}.personal-stopped-goals>summary{min-height:34px;color:var(--pw-muted);cursor:pointer;letter-spacing:.04em;border-radius:9px;grid-template-columns:16px minmax(0,1fr) auto;align-items:center;gap:6px;padding:5px 10px;font-size:11px;font-weight:650;list-style:none;display:grid}.personal-stopped-goals>summary::-webkit-details-marker{display:none}.personal-stopped-goals>summary:hover{color:var(--pw-text);background:#ffffff8c}.personal-stopped-goals>summary>svg:first-child{transition:transform .14s}.personal-stopped-goals[open]>summary>svg:first-child{transform:rotate(180deg)}.personal-stopped-goals>summary small{text-align:center;background:#ebe9e3;border-radius:99px;min-width:22px;padding:2px 6px}.personal-goal-list.is-stopped{opacity:.82;margin-top:2px}.personal-stopped-goal-error{background:var(--pw-red-bg);color:var(--pw-red);border:1px solid #edc1ba;border-radius:9px;gap:7px;margin:6px 8px;padding:9px 10px;font-size:11px;line-height:1.45;display:grid}.personal-stopped-goal-error button{min-height:28px;color:inherit;cursor:pointer;font:inherit;background:0 0;border:1px solid;border-radius:7px;justify-self:start;padding:0 9px;font-weight:650}.personal-priority-dot{background:#aab2bf;border-radius:50%;width:7px;height:7px}.personal-priority-dot.is-high{background:#dd5b47}.personal-priority-dot.is-medium{background:#e5a33d}.personal-priority-dot.is-low{background:#3fae7c}.personal-sidebar-footer{border-top:1px solid var(--pw-line);flex-shrink:0;padding:12px}.personal-update-trigger{width:100%;min-height:44px;color:var(--pw-text);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;align-items:center;gap:8px;padding:0 9px;font-size:13px;display:flex}.personal-update-trigger span{text-align:left;flex:1}.personal-update-trigger:hover{background:var(--pw-card)}.personal-update-trigger:focus-visible{outline-offset:2px;outline:2px solid #0070f3}.personal-update-panel{box-sizing:border-box;width:min(320px,100vw - 24px);max-height:calc(100dvh - 104px);color:var(--pw-text);background:var(--pw-card,#fff);font:inherit;border:1px solid var(--pw-line);border-radius:12px;margin:0;padding:16px;font-size:13px;line-height:1.6;position:fixed;inset:auto auto 80px 12px;overflow-y:auto;box-shadow:0 8px 28px #0000001f}.personal-update-panel header{justify-content:space-between;align-items:center;display:flex}.personal-update-panel button{min-height:44px;color:inherit;background:var(--pw-card,#fff);border:1px solid var(--pw-line);cursor:pointer;border-radius:6px;padding:6px 10px}.personal-update-panel header button{border:0;place-items:center;min-width:44px;display:grid}.personal-update-panel summary{cursor:pointer;align-content:center;min-height:44px}.personal-update-panel p{margin:10px 0}.personal-update-panel label,.personal-update-panel small,.personal-update-panel code{display:block}.personal-update-panel select{width:100%;min-height:44px;color:inherit;background:var(--pw-card);border:1px solid var(--pw-line);border-radius:6px;margin-top:6px}.personal-update-actions{flex-wrap:wrap;gap:8px;display:flex}.personal-update-actions button{border:1px solid var(--pw-line);border-radius:6px;min-height:44px;padding:6px 10px}.personal-update-panel a{text-decoration:underline}.personal-update-panel :focus-visible{outline-offset:2px;outline:2px solid #0070f3}.personal-sidebar-utility{border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;grid-template-columns:32px minmax(0,1fr) auto;align-items:center;gap:10px;min-height:54px;padding:7px 9px;font-size:13px;display:grid;box-shadow:0 1px 4px #1e1c1412}.personal-sidebar-utility:hover{background:#fff;border-color:#d6d2c8;box-shadow:0 2px 7px #1e1c141a}.personal-sidebar-utility-icon{background:var(--pw-blue-soft);width:32px;height:32px;color:var(--pw-blue-ink);border-radius:9px;place-items:center;display:grid}.personal-sidebar-utility-copy{gap:2px;min-width:0;display:grid}.personal-sidebar-utility-copy strong,.personal-sidebar-utility-copy small{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.personal-sidebar-utility-copy strong{font-size:13px;font-weight:700}.personal-sidebar-utility-copy small{color:var(--pw-muted);font-size:10.5px}.personal-sidebar-utility>svg{color:var(--pw-faint)}.personal-owner-row{min-height:40px;color:var(--pw-muted);border-radius:10px;align-items:center;gap:10px;margin-top:2px;padding:8px 10px;font-size:13px;display:flex}.personal-channel{grid-template-rows:auto minmax(0,1fr) auto;grid-template-columns:minmax(0,1fr);min-width:0;height:100vh;display:grid}.personal-channel-header{z-index:8;border-bottom:1px solid var(--pw-line);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fbfaf7eb;justify-content:space-between;align-items:center;gap:16px;min-height:72px;padding:12px 26px;display:flex;position:relative;overflow:visible}.personal-goal-tabs{background:#f2f1ed;border-radius:10px;align-self:center;align-items:center;gap:2px;margin-left:auto;padding:3px;display:flex}.personal-goal-tabs button{min-height:30px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;padding:0 13px;font-size:12.5px;font-weight:600}.personal-goal-tabs button:hover{color:var(--pw-text)}.personal-goal-tabs button[aria-current=page]{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-channel-title{min-width:0}.personal-channel-title h1{letter-spacing:-.015em;margin:0;font-size:17.5px;font-weight:700;line-height:1.25}.personal-channel-title p{color:var(--pw-muted);white-space:nowrap;text-overflow:ellipsis;margin:3px 0 0;font-size:12px;overflow:hidden}.personal-channel-title p.personal-manager-execution{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.personal-execution-chip{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:999px;flex:none;align-items:center;gap:6px;padding:0 8px;font-family:SFMono-Regular,Consolas,monospace;font-size:11px;line-height:18px;display:inline-flex}.personal-execution-chip-endpoint{color:var(--pw-text);font-weight:650}.personal-execution-chip-kind{color:var(--pw-faint)}.personal-execution-chip-model{color:var(--pw-muted)}.personal-execution-chip.is-unavailable{border-color:var(--pw-amber);background:var(--pw-amber-bg)}.personal-execution-chip.is-unavailable .personal-execution-chip-endpoint,.personal-execution-chip.is-unavailable .personal-execution-chip-kind,.personal-execution-chip.is-unavailable .personal-execution-chip-model{color:var(--pw-amber)}.personal-execution-note{color:var(--pw-muted);text-overflow:ellipsis;font-size:11px;overflow:hidden}.personal-execution-rule-note{color:var(--pw-faint);text-overflow:ellipsis;font-size:11px;overflow:hidden}.personal-workspace-shell[data-pw-theme=brutal] .personal-execution-chip{border-color:#141414;border-radius:4px}.personal-channel-actions{flex:none;align-items:center;gap:9px;display:flex}.personal-icon-button.personal-mobile-menu{display:none}.personal-select{min-width:0;position:relative}.personal-select-trigger{border:1px solid var(--pw-line-strong);width:100%;min-height:36px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border-radius:10px;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:7px;padding:0 9px;font-size:12px;font-weight:500;line-height:16px;display:grid}.personal-select-trigger:hover,.personal-select-trigger[aria-expanded=true]{border-color:var(--pw-faint)}.personal-select-trigger:focus-visible{border-color:var(--pw-blue);outline-offset:1px;outline:2px solid #0070f329}.personal-select-trigger>svg{color:var(--pw-muted);transition:transform .15s}.personal-select-trigger>svg.is-open{transform:rotate(180deg)}.personal-select-icon{color:var(--pw-muted);place-items:center;display:grid}.personal-select-value{white-space:nowrap;align-items:center;gap:6px;min-width:0;display:flex}.personal-select-value>small{color:var(--pw-faint);flex:none;font-size:10px;font-weight:500}.personal-select-value>span{text-overflow:ellipsis;min-width:0;overflow:hidden}.personal-select-listbox{z-index:50;border:1px solid var(--pw-line);background:#fff;border-radius:12px;min-width:max(100%,204px);max-width:min(300px,80vw);max-height:260px;padding:4px;display:grid;position:absolute;top:calc(100% + 5px);left:0;overflow:auto;box-shadow:0 10px 24px #00000017}.personal-agent-select .personal-select-listbox{min-width:216px;left:auto;right:0}.personal-select-option-wrap{display:grid}.personal-select-group-label{color:var(--pw-faint);letter-spacing:0;text-transform:uppercase;padding:8px 8px 4px;font:500 10px/14px Geist Mono Variable,Geist Mono,monospace}.personal-select-option{width:100%;min-height:32px;color:var(--pw-text);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;grid-template-columns:minmax(0,1fr) 16px;align-items:center;gap:10px;padding:6px 8px;font-size:12px;font-weight:400;line-height:16px;display:grid}.personal-select-option:hover,.personal-select-option:focus-visible{background:#f2f2f2;outline:0}.personal-select-option[aria-selected=true]{font-weight:600}.personal-select-option[disabled]{color:var(--pw-faint);cursor:not-allowed}.personal-select-option>svg{color:var(--pw-text);justify-self:end}.personal-agent-select{width:188px}.personal-read-only-source{border:1px solid var(--pw-line-strong);max-width:190px;height:38px;color:var(--pw-text);white-space:nowrap;background:#fff;border-radius:10px;align-items:center;gap:7px;padding:0 10px;font-size:12.5px;font-weight:600;display:inline-flex;overflow:hidden}.personal-read-only-source>svg{color:var(--pw-muted);flex:none}.personal-read-only-source>small{color:var(--pw-muted);background:#f2f1ed;border-radius:99px;padding:2px 6px;font-size:9.5px;font-weight:650}.personal-live-indicator{color:var(--pw-muted);white-space:nowrap;flex:none;align-items:center;gap:6px;padding:7px 4px;font-size:12px;display:inline-flex}.personal-live-indicator i{background:#3fbf82;border-radius:50%;width:7px;height:7px}.personal-composer-attach{cursor:pointer;border:0;flex:none;place-items:center;display:grid;position:relative;overflow:hidden}.personal-composer-attach:disabled{cursor:not-allowed;opacity:.45}.personal-composer-file-input{opacity:0;pointer-events:none;width:1px;height:1px;position:fixed;overflow:hidden}.personal-action-feedback{border:1px solid var(--pw-line);background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:10px;justify-content:space-between;align-items:center;gap:12px;margin:0 0 8px;padding:9px 12px;font-size:13px;font-weight:650;display:flex}.personal-action-feedback button{color:inherit;cursor:pointer;background:0 0;border:0;place-items:center;display:grid}.personal-refresh-control{flex:none;align-items:center;gap:6px;display:inline-flex}.personal-refresh-control small{color:var(--pw-muted);white-space:nowrap;font-size:11px}.personal-refresh-control.is-error small{color:var(--pw-danger)}.personal-icon-button{border:1px solid var(--pw-line);width:36px;min-width:36px;height:36px;min-height:36px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:10px;flex:0 0 36px;place-items:center;padding:0;display:inline-grid}.personal-icon-button:hover{border-color:var(--pw-line-strong);color:var(--pw-text)}.personal-channel-scroll{min-width:0;min-height:0;padding:22px max(26px,50% - 410px);overflow:auto}.personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-kanban){padding-inline:max(26px,50vw - 770px)}.personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-board){overflow:hidden}.personal-manager-greeting{align-items:center;gap:14px;margin-bottom:16px;padding:18px 20px;display:flex}.personal-home-lanes{grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;display:grid}.personal-system-health-banner{color:#991b1b;background:#fef2f2;border:1px solid #fecaca;border-radius:12px;margin-bottom:16px;padding:12px 16px}.personal-system-health-header{align-items:center;gap:8px;font-size:13px;font-weight:600;display:flex}.personal-system-health-header small{color:#b91c1c;font-size:11.5px;font-weight:400}.personal-system-health-issues{color:#b91c1c;margin:6px 0 0 24px;padding:0;font-size:12px;line-height:1.5}.personal-home-lane{border:1px solid var(--pw-line);background:#fff;border-radius:16px;flex-direction:column;min-width:0;min-height:100%;display:flex;box-shadow:0 1px 4px #1e1c140a}.personal-manager-greeting>span{background:var(--pw-blue-soft);width:38px;height:38px;color:var(--pw-blue);border-radius:12px;place-items:center;display:grid}.personal-manager-greeting div{gap:3px;display:grid}.personal-manager-greeting strong{letter-spacing:-.01em}.personal-manager-greeting p{color:var(--pw-muted);margin:0;font-size:13px}.personal-proposal-explainer{background:var(--pw-blue-soft);color:var(--pw-text);border-radius:10px;padding:10px 12px;font-size:12px;line-height:1.55}.personal-home-board{gap:12px;min-width:0;display:grid}.personal-home-lanes{grid-template-columns:repeat(4,minmax(170px,1fr));gap:10px;min-width:0;display:grid}.personal-home-lane{border:1px solid var(--pw-line);background:#ffffff85;border-radius:15px;align-content:start;min-width:0;min-height:260px;padding:12px;display:grid}.personal-home-lane>header{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-home-lane>header span{align-items:center;gap:7px;font-size:13px;font-weight:700;display:inline-flex}.personal-home-lane>header i,.personal-home-goal-meta i{background:var(--pw-faint);border-radius:50%;width:8px;height:8px}.personal-home-lane>header b{min-width:24px;color:var(--pw-muted);font-variant-numeric:tabular-nums;text-align:right;font-size:12px}.personal-home-lane>p{min-height:34px;color:var(--pw-muted);margin:7px 0 10px;font-size:10.5px;line-height:1.55}.personal-home-lane.is-needs_you>header i,.personal-home-lane.is-needs_you .personal-home-goal-meta i{background:var(--pw-amber)}.personal-home-lane.is-running>header i,.personal-home-lane.is-running .personal-home-goal-meta i{background:var(--pw-green)}.personal-home-lane.is-observing>header i,.personal-home-lane.is-observing .personal-home-goal-meta i{background:var(--pw-blue)}.personal-home-lane.is-scheduled>header i,.personal-home-lane.is-scheduled .personal-home-goal-meta i{background:#8b6bd8}.personal-home-lane-list{align-content:start;gap:9px;display:grid}.personal-home-goal-card{border:1px solid var(--pw-line);width:100%;min-width:0;color:inherit;cursor:pointer;text-align:left;background:#fff;border-radius:12px;gap:7px;padding:12px;transition:border-color .14s,transform .14s,box-shadow .14s;display:grid;box-shadow:0 1px 4px #1e1c140f}.personal-home-goal-card:hover{border-color:var(--pw-line-strong);transform:translateY(-1px);box-shadow:0 4px 12px #1e1c1414}.personal-home-goal-card:focus-visible{outline-offset:2px;outline:2px solid #7da2ff}.personal-home-goal-meta{min-width:0;color:var(--pw-muted);text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:6px;font-size:10.5px;display:flex;overflow:hidden}.personal-home-goal-card>strong{text-overflow:ellipsis;font-size:13px;line-height:1.45;overflow:hidden}.personal-home-goal-card>p{color:var(--pw-muted);-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:0;font-size:11px;line-height:1.55;display:-webkit-box;overflow:hidden}.personal-home-goal-card>footer{justify-content:space-between;align-items:center;gap:8px;padding-top:2px;display:flex}.personal-home-goal-card>footer span{color:var(--pw-muted);background:#f2f1ed;border-radius:99px;flex:none;padding:2px 7px;font-size:9.5px}.personal-home-goal-card>footer small{color:var(--pw-faint);text-overflow:ellipsis;white-space:nowrap;font-size:9.5px;overflow:hidden}.personal-home-empty{border:1px dashed var(--pw-line-strong);min-height:96px;color:var(--pw-faint);border-radius:11px;place-items:center;font-size:11px;display:grid}.personal-home-history{border:1px solid var(--pw-line);background:#fff9;border-radius:13px}.personal-home-history>summary{cursor:pointer;align-items:center;gap:9px;min-height:44px;padding:0 14px;list-style:none;display:flex}.personal-home-history>summary::-webkit-details-marker{display:none}.personal-home-history>summary span{font-size:12.5px;font-weight:700}.personal-home-history>summary b{color:var(--pw-muted);font-size:11px}.personal-home-history>summary small{color:var(--pw-faint);margin-left:auto;font-size:10.5px}.personal-home-history>div{grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:9px;padding:0 12px 12px;display:grid}.personal-session-record{background:var(--pw-blue-soft);border:1px solid #cfdcf9;border-radius:14px;grid-template-columns:minmax(0,1fr) auto;gap:10px 16px;margin-bottom:12px;padding:14px 16px;display:grid}.personal-session-record>header{grid-column:1/-1;justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-session-record>header span{color:var(--pw-blue-ink);align-items:center;gap:7px;font-size:12px;font-weight:700;display:inline-flex}.personal-session-record>header button{width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;place-items:center;padding:0;display:grid}.personal-session-record>header button:hover{color:var(--pw-text);background:#ffffffb3}.personal-session-record>div{min-width:0}.personal-session-record>div strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;display:block;overflow:hidden}.personal-session-record>div p{color:var(--pw-muted);margin:4px 0 0;font-size:11px}.personal-session-record dl{grid-column:1/-1;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0;display:grid}.personal-session-record dl div{background:#ffffff9e;border-radius:9px;gap:2px;min-width:0;padding:8px 10px;display:grid}.personal-session-record dt{color:var(--pw-faint);font-size:9.5px}.personal-session-record dd{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;margin:0;font:10.5px/1.4 SF Mono,ui-monospace,Menlo,Consolas,monospace;overflow:hidden}.personal-session-record>.personal-secondary-action{grid-area:2/2;align-self:center}.personal-channel-timeline{gap:10px;display:grid}.personal-live-region{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:fixed;overflow:hidden}.personal-timeline-row{border:1px solid var(--pw-line);background:var(--pw-card);width:100%;min-height:64px;color:inherit;cursor:pointer;text-align:left;border-radius:14px;grid-template-columns:38px minmax(0,1fr) auto auto 16px;align-items:center;gap:12px;padding:11px 15px;transition:border-color .14s,box-shadow .14s;display:grid}.personal-timeline-row:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-timeline-row:focus-visible{outline-offset:2px;outline:2px solid #7da2ff}.personal-row-icon{border-radius:11px;place-items:center;width:34px;height:34px;display:grid}.personal-row-icon.is-attention{color:var(--pw-amber);background:var(--pw-amber-bg)}.personal-row-icon.is-run{color:var(--pw-blue-ink);background:var(--pw-blue-soft)}.personal-row-icon.is-output{color:var(--pw-green);background:var(--pw-green-bg)}.personal-row-copy,.personal-run-identity{gap:3px;min-width:0;display:grid}.personal-row-copy strong,.personal-row-copy small,.personal-row-copy span,.personal-run-identity strong,.personal-run-identity small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.personal-row-copy strong{font-size:13.5px;font-weight:600}.personal-row-copy small,.personal-run-identity small,.personal-row-copy span{color:var(--pw-muted);font-size:11px}.personal-row-status{color:var(--pw-muted);white-space:nowrap;background:#f2f1ed;border-radius:99px;align-items:center;gap:5px;padding:2.5px 10px;font-size:11px;font-weight:600;display:inline-flex}.personal-row-status.is-running{background:var(--pw-green-bg);color:var(--pw-green)}.personal-run-row{grid-template-columns:38px minmax(90px,.65fr) minmax(160px,1.4fr) 90px auto auto 16px}.personal-run-open-label{color:var(--pw-blue-ink);white-space:nowrap;font-size:10.5px;font-weight:650}.personal-run-identity strong{font-size:12px}.personal-run-progress{gap:5px;display:grid}.personal-run-progress small{color:var(--pw-muted);font-variant-numeric:tabular-nums;font-size:10px}.personal-run-progress i{background:#f0efeb;border-radius:99px;height:4px;display:block;overflow:hidden}.personal-run-progress b{border-radius:inherit;background:var(--pw-blue);height:100%;display:block}.personal-output-row time{color:var(--pw-muted);font-size:11px}.personal-spin{animation:1.2s linear infinite pw-spin}@keyframes pw-spin{to{transform:rotate(360deg)}}.personal-message{gap:11px;max-width:84%;padding:6px 2px;display:flex}.personal-message.is-user{background:var(--pw-blue-soft);color:var(--pw-text);border:1px solid #dbe7fd;border-radius:16px 16px 4px;justify-self:end;padding:11px 15px}.personal-message-avatar{background:var(--pw-blue-soft);height:34px;color:var(--pw-blue-ink);border-radius:11px;flex:0 0 34px;place-items:center;display:grid}.personal-message header{align-items:baseline;gap:8px;display:flex}.personal-message header strong{font-size:12px}.personal-message time{color:var(--pw-faint);font-size:10px}.personal-message p{white-space:pre-wrap;margin:6px 0 0;font-size:13.5px;line-height:1.7}.personal-message-pending{color:var(--pw-muted);font-size:11px}.personal-return-delivery{color:var(--pw-muted);margin-top:7px;font-size:11px;font-weight:600;display:inline-block}.personal-return-delivery.is-delivered{color:var(--pw-green)}.personal-return-delivery.is-verification_required{color:var(--pw-blue-ink)}.personal-return-delivery.is-explicit_unverified{color:var(--pw-amber)}.personal-message-images{flex-wrap:wrap;gap:7px;margin-top:8px;display:flex}.personal-message-images img{object-fit:cover;border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;width:min(220px,100%);max-height:180px}.personal-md{overflow-wrap:anywhere;font-size:13.5px;line-height:1.7}.personal-md>*+*{margin-top:8px}.personal-md p{margin:0}.personal-md-heading.is-h1,.personal-md-heading.is-h2{font-size:14.5px}.personal-md-code{color:#4d5361;background:#f0efe9;border-radius:5px;padding:1px 5px;font-family:SF Mono,ui-monospace,Menlo,Consolas,monospace;font-size:.86em}.personal-md-pre{color:#e8ecf3;white-space:pre;background:#23262e;border-radius:10px;margin:0;padding:12px 14px;font:12px/1.65 SF Mono,ui-monospace,Menlo,Consolas,monospace;overflow-x:auto}.personal-md-pre code{font:inherit}.personal-md-link{color:var(--pw-blue-ink);text-underline-offset:2px;word-break:break-all;text-decoration:underline}.personal-agent-avatar{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:13px;flex:none;place-items:center;width:44px;height:44px;font-size:18px;font-weight:700;display:grid;box-shadow:0 2px 6px #2f66e947}.personal-agent-health.is-off{color:var(--pw-muted);background:#f2f1ed}.personal-agent-persona dl{border-top:1px solid var(--pw-line);margin-top:14px;padding-top:13px}.personal-detail-card-title{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-detail-card-title em{color:var(--pw-muted);background:#f1f1ee;border-radius:99px;padding:2px 8px;font-size:10px;font-style:normal;font-weight:650}.personal-goal-repository h3{align-items:center;gap:8px;display:flex}.personal-goal-notification h3{justify-content:space-between;align-items:center;gap:8px;display:flex}.personal-connection-status{background:var(--pw-green-bg);color:var(--pw-green);border-radius:99px;padding:2px 8px;font-size:10px;font-weight:650}.personal-subagent-heading{justify-content:space-between;align-items:flex-start;gap:14px;display:flex}.personal-subagent-heading h3{align-items:center;gap:7px;margin-bottom:0;display:flex}.personal-subagent-switch{border:1px solid var(--pw-line-strong);min-height:32px;color:var(--pw-muted);cursor:pointer;background:#f2f1ed;border-radius:99px;flex:none;align-items:center;gap:7px;padding:4px 9px 4px 5px;font-size:11px;font-weight:700;display:inline-flex}.personal-subagent-switch>span{background:#c8c8c2;border-radius:99px;width:30px;height:18px;transition:background .18s;position:relative}.personal-subagent-switch>span:after{content:"";background:#fff;border-radius:50%;width:12px;height:12px;transition:transform .18s;position:absolute;top:3px;left:3px}.personal-subagent-switch[aria-checked=true]{background:var(--pw-green-bg);color:var(--pw-green);border-color:#b9dccb}.personal-subagent-switch[aria-checked=true]>span{background:var(--pw-green)}.personal-subagent-switch[aria-checked=true]>span:after{transform:translate(12px)}.personal-subagent-switch[data-pending=true]{color:#8a6b00;opacity:1;background:#fffbed;border-color:#d8c67a}.personal-subagent-switch:disabled{cursor:default;opacity:.55}.personal-subagent-switch[data-pending=true]:disabled{opacity:1}.personal-subagent-fields{border-top:1px solid var(--pw-line);grid-template-columns:minmax(0,1fr) 112px;gap:10px;margin-top:14px;padding-top:13px;display:grid}.personal-subagent-fields label{color:var(--pw-text);align-content:start;gap:6px;font-size:11.5px;font-weight:650;display:grid}.personal-subagent-fields input:not([type=checkbox]),.personal-subagent-fields select{border:1px solid var(--pw-line-strong);min-width:0;min-height:38px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 10px;font-size:12px}.personal-subagent-fields label small{color:var(--pw-faint);font-size:10.5px;font-weight:450;line-height:1.45}.personal-subagent-domain-picker{border:0;grid-column:1/-1;min-width:0;margin:0;padding:0}.personal-subagent-domain-picker>legend{color:var(--pw-text);margin-bottom:7px;padding:0;font-size:11.5px;font-weight:650}.personal-subagent-domain-picker>small{color:var(--pw-faint);margin-top:7px;font-size:10.5px;line-height:1.45;display:block}.personal-subagent-domain-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;display:grid}.personal-subagent-domain-option{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:9px;grid-template-columns:auto minmax(0,1fr);min-height:44px;padding:8px 9px;align-items:center!important;display:grid!important}.personal-subagent-domain-option:hover{border-color:#b9c9dc}.personal-subagent-domain-option:has(input:focus-visible){outline:2px solid var(--pw-blue);outline-offset:2px}.personal-subagent-domain-option.is-selected{background:var(--pw-blue-soft);border-color:#9fc4ed}.personal-subagent-domain-option input{width:15px;height:15px;accent-color:var(--pw-blue);margin:0}.personal-subagent-domain-option>span{gap:1px;min-width:0;display:grid}.personal-subagent-domain-option strong{text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;overflow:hidden}.personal-subagent-domain-option small{font-size:9.5px!important;font-weight:450!important}.personal-subagent-domain-empty{border:1px dashed var(--pw-line-strong);background:var(--pw-bg);color:var(--pw-muted);border-radius:9px;grid-column:1/-1;margin:0;padding:10px;font-size:10.5px;line-height:1.5}.personal-subagent-limit-field{grid-column:1/-1;width:112px}.personal-subagent-fields .personal-secondary-action{grid-column:1/-1;margin-top:0}.personal-subagent-preview{background:#fffbed;border:1px solid #d8c67a;border-radius:10px;margin-top:10px;padding:12px}.personal-subagent-preview>strong{font-size:12.5px}.personal-subagent-preview>p{margin:5px 0 0}.personal-subagent-preview>div{grid-template-columns:1fr 1fr;gap:8px;display:grid}.personal-subagent-preview .personal-primary-action,.personal-subagent-preview .personal-secondary-action{min-height:38px;margin-top:10px}.personal-subagent-feedback{align-items:flex-start;gap:7px;display:flex;margin:10px 0 0!important}.personal-subagent-feedback.is-success{color:var(--pw-green)!important}.personal-subagent-feedback.is-warning{color:#8a6b00!important}.personal-subagent-feedback.is-error{color:var(--pw-red)!important}.personal-subagent-read-only{margin-bottom:0}.personal-settings-page{--pw-bg:#fbfaf7;--pw-card:#fff;--pw-line:#eceae3;--pw-line-strong:#e0ddd4;--pw-muted:#82889a;--pw-faint:#aab0bf;--pw-text:#23262e;--pw-blue:#2f66e9;--pw-blue-ink:#2456c8;--pw-blue-soft:#ebf1fe;--pw-red:#c2402f;--pw-red-bg:#fcecea;--pw-green:#2e7d5b;--pw-green-bg:#e6f3ec;background:var(--pw-bg);height:100dvh;min-height:0;color:var(--pw-text);grid-template-rows:minmax(0,1fr);grid-template-columns:268px minmax(0,1fr);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;display:grid;overflow:hidden}.personal-settings-sidebar{overscroll-behavior:contain;scrollbar-gutter:stable;border-right:1px solid var(--pw-line);background:#f5f3ee;flex-direction:column;gap:14px;min-width:0;height:100%;min-height:0;padding:18px 14px;display:flex;position:relative;overflow-y:auto}.personal-settings-page :focus-visible{outline-offset:2px;outline:2px solid #5f87ed}.personal-settings-back{width:100%;min-height:40px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:10px;align-items:center;gap:8px;padding:0 10px;font-size:13px;font-weight:650;display:inline-flex}.personal-settings-back:hover{color:var(--pw-text);background:#ffffffa6}.personal-settings-title{border-bottom:1px solid var(--pw-line);gap:3px;padding:8px 10px 10px;display:grid}.personal-settings-title small{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-settings-title strong{letter-spacing:-.02em;font-size:18px}.personal-settings-header{justify-content:space-between;align-items:flex-start;gap:24px;margin-bottom:24px;display:flex}.personal-settings-header small{color:var(--pw-blue);letter-spacing:.08em;text-transform:uppercase;font-size:11px;font-weight:700}.personal-settings-header h1{letter-spacing:-.035em;margin:4px 0 2px;font-size:28px}.personal-settings-tabs{gap:3px;display:grid}.personal-settings-tabs button{width:100%;min-height:54px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:11px;grid-template-columns:32px minmax(0,1fr);align-items:center;gap:9px;padding:8px 10px;display:grid}.personal-settings-tabs button:hover{color:var(--pw-text);background:#ffffffa6}.personal-settings-tabs button[aria-current=page]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c141a}.personal-settings-tabs button>span{gap:2px;min-width:0;display:grid}.personal-settings-tabs strong{font-size:13px}.personal-settings-body{overscroll-behavior:contain;scrollbar-gutter:stable;min-width:0;min-height:0;padding:30px clamp(24px,5vw,72px);overflow:auto}.personal-settings-body:has(>.personal-capability-settings){grid-template-rows:auto minmax(0,1fr);display:grid;overflow:hidden}.personal-settings-body>.personal-settings-header{min-width:0}.personal-settings-page *,.personal-settings-page :before,.personal-settings-page :after{box-sizing:border-box}.personal-appearance-settings{max-width:680px}.personal-settings-choice-group{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:14px;display:grid}.personal-settings-choice-group button{border:1px solid var(--pw-line);min-height:60px;color:inherit;cursor:pointer;text-align:left;background:#fff;border-radius:12px;grid-template-columns:34px minmax(0,1fr);align-items:center;gap:10px;padding:13px;display:grid}.personal-settings-choice-group button:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-settings-choice-group button[aria-checked=true]{background:#f7f9ff;border-color:#9fb9f4;box-shadow:0 0 0 3px #2f66e91a}.personal-settings-choice-group strong{align-self:center;font-size:13px}.personal-settings-theme-swatch{border:1px solid var(--pw-line-strong);border-radius:10px;width:34px;height:34px;display:block}.personal-settings-theme-swatch.is-loopx{background:linear-gradient(135deg,#171717 0 44%,#0070f3 44% 54%,#fafafa 54% 76%,#fff 76%);border-radius:6px}.personal-settings-theme-swatch.is-paper{background:linear-gradient(135deg,#fbfaf7 0 48%,#2f66e9 48% 58%,#fff 58%)}.personal-settings-theme-swatch.is-brutal{background:linear-gradient(135deg,#ffd91a 0 45%,#ff8fd0 45% 70%,#8fdcff 70%);border:2px solid #141414;border-radius:5px;box-shadow:2px 2px #141414}.personal-lark-settings{background:var(--pw-bg);min-height:100vh;color:var(--pw-text);padding:30px clamp(24px,5vw,72px);position:relative}.personal-lark-settings.is-embedded{background:0 0;min-height:0;padding:0}.personal-lark-header{justify-content:space-between;align-items:flex-start;gap:24px;max-width:1180px;margin:0 auto;display:flex}.personal-lark-header small{color:var(--pw-blue);letter-spacing:.08em;text-transform:uppercase;font-size:11px;font-weight:700}.personal-lark-header h1{letter-spacing:-.035em;margin:4px 0 2px;font-size:28px}.personal-lark-header p{color:var(--pw-muted);margin:0;font-size:13px}.personal-lark-tabs{border-bottom:1px solid var(--pw-line);gap:24px;max-width:1180px;margin:28px auto 20px;display:flex}.personal-lark-settings.is-embedded .personal-lark-tabs{margin-top:0}.personal-lark-tabs button{min-height:42px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-bottom:2px solid #0000;align-items:center;gap:8px;padding:0 2px;font-weight:650;display:flex}.personal-lark-tabs button[aria-current=page]{border-color:var(--pw-blue);color:var(--pw-text)}.personal-lark-tabs span{min-width:20px;height:20px;color:var(--pw-muted);background:#efeee9;border-radius:99px;place-items:center;padding:0 5px;font-size:10px;display:inline-grid}.personal-lark-section-heading{max-width:1180px;margin:0 auto 18px}.personal-lark-section-heading small{color:var(--pw-blue);letter-spacing:.07em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-lark-section-heading h2{letter-spacing:-.025em;margin:4px 0;font-size:21px}.personal-lark-section-heading p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-lark-subtabs{margin-top:0}.personal-settings-content{max-width:1180px;margin:0 auto}.personal-settings-card{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:16px;max-width:720px;overflow:hidden;box-shadow:0 8px 30px #1e1c140a}.personal-settings-card>header{border-bottom:1px solid var(--pw-line);align-items:center;gap:13px;padding:20px;display:flex}.personal-settings-card>header h2{letter-spacing:-.02em;margin:0;font-size:17px}.personal-settings-card>header p{color:var(--pw-muted);margin:4px 0 0;font-size:12px;line-height:1.5}.personal-settings-icon{background:var(--pw-blue-soft);width:40px;height:40px;color:var(--pw-blue);border-radius:12px;flex:none;place-items:center;display:grid}.personal-language-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:18px 20px;display:grid}.personal-language-options>button{border:1px solid var(--pw-line);min-height:66px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border-radius:12px;justify-content:space-between;align-items:center;gap:18px;padding:13px 15px;transition:border-color .15s,background-color .15s,box-shadow .15s;display:flex}.personal-language-options>button:hover{border-color:var(--pw-line-strong);background:#fcfbf8}.personal-language-options>button.is-selected{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-color:#9bb5f0;box-shadow:0 0 0 1px #2f66e814}.personal-language-options>button>span{gap:4px;display:grid}.personal-language-options strong{font-size:13px}.personal-settings-card>footer{border-top:1px solid var(--pw-line);color:var(--pw-faint);background:#faf9f6;padding:13px 20px;font-size:11px}.personal-machine-loading{min-height:220px;color:var(--pw-muted);place-items:center;font-size:13px;display:grid}.personal-machine-layout{grid-template-columns:210px minmax(0,1fr);gap:22px;max-width:1080px;display:grid}.personal-machine-namespaces{min-width:0}.personal-machine-namespaces>div{gap:3px;margin-bottom:10px;padding:0 4px;display:grid}.personal-machine-namespaces>div small,.personal-machine-editor>header small,.personal-machine-editor-bar small{color:var(--pw-blue);letter-spacing:.07em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-machine-namespaces>div strong{font-size:13px}.personal-machine-namespaces nav{gap:5px;display:grid}.personal-machine-namespaces button{width:100%;min-height:52px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:1px solid #0000;border-radius:10px;gap:3px;padding:9px 11px;display:grid}.personal-machine-namespaces button:hover{border-color:var(--pw-line);background:#fff9}.personal-machine-namespaces button[aria-current=page]{border-color:var(--pw-line-strong);color:var(--pw-text);background:#fff;box-shadow:0 2px 8px #1e1c140d}.personal-machine-namespaces button span{overflow-wrap:anywhere;font-size:12px;font-weight:650}.personal-machine-namespaces button small{color:var(--pw-muted);font-size:10px}.personal-machine-content{min-width:0}.personal-machine-summary{border:1px solid var(--pw-line);background:#fff;border-radius:14px;justify-content:space-between;align-items:center;gap:20px;margin-bottom:14px;padding:14px 16px;display:flex}.personal-machine-summary>div{align-items:center;gap:11px;min-width:0;display:flex}.personal-machine-summary>div>span:last-child{gap:3px;display:grid}.personal-machine-summary>div small{color:var(--pw-muted);text-transform:uppercase;font-size:10px;font-weight:650}.personal-machine-summary>div strong{font-size:13px}.personal-machine-summary dl{gap:22px;margin:0;display:flex}.personal-machine-summary dl div{gap:3px;display:grid}.personal-machine-summary dt{color:var(--pw-muted);font-size:10px}.personal-machine-summary dd{margin:0;font-family:SFMono-Regular,Consolas,monospace;font-size:11px;font-weight:650}.personal-machine-editor-bar{justify-content:space-between;align-items:center;gap:14px;margin-bottom:10px;padding:0 2px;display:flex}.personal-machine-editor-mode{border:1px solid var(--pw-line);background:#f5f4f0;border-radius:9px;flex:none;gap:3px;padding:3px;display:flex}.personal-machine-editor-mode button{min-height:44px;color:var(--pw-muted);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:6px;padding:0 12px;font-size:11px;font-weight:650}.personal-machine-editor-mode button[aria-pressed=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c1414}.personal-machine-editor{border:1px solid var(--pw-line);background:#fff;border-radius:16px;overflow:hidden;box-shadow:0 8px 30px #1e1c140a}.personal-machine-editor>header{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:flex-start;gap:20px;padding:20px;display:flex}.personal-machine-editor>header h2{letter-spacing:-.02em;margin:4px 0 3px;font-size:18px}.personal-machine-editor>header p{max-width:610px;color:var(--pw-muted);margin:0;font-size:12px;line-height:1.55}.personal-machine-switch{min-height:44px;color:var(--pw-muted);cursor:pointer;white-space:nowrap;flex:none;align-items:center;gap:9px;font-size:12px;font-weight:650;display:flex}.personal-machine-switch input{width:42px;height:24px;accent-color:var(--pw-blue);cursor:pointer;margin:0}.personal-machine-scope-note{color:var(--pw-blue-ink);background:#f6f8fd;border:1px solid #cfdaf3;border-radius:12px;align-items:flex-start;gap:10px;margin:18px 20px 0;padding:13px 14px;display:flex}.personal-machine-scope-note svg{flex:none;margin-top:1px}.personal-machine-scope-note strong{font-size:12px}.personal-machine-scope-note p{color:#52627f;margin:3px 0 0;font-size:11px;line-height:1.55}.personal-machine-editor fieldset{border:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:0;padding:20px;display:grid}.personal-machine-editor fieldset label{align-content:start;gap:6px;min-width:0;display:grid}.personal-machine-editor fieldset label:last-child{grid-column:1/-1}.personal-machine-editor fieldset label>span{font-size:12px;font-weight:650}.personal-machine-editor fieldset label>small{color:var(--pw-muted);font-size:10.5px;line-height:1.45}.personal-machine-editor input[type=text],.personal-machine-editor fieldset input{border:1px solid var(--pw-line-strong);width:100%;min-width:0;min-height:42px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 11px;font-size:13px}.personal-machine-editor fieldset:disabled{opacity:.58}.personal-machine-editor fieldset:disabled input{cursor:not-allowed}.personal-machine-json-editor>label{gap:7px;padding:20px;display:grid}.personal-machine-json-editor>label>span{font-size:12px;font-weight:650}.personal-machine-json-editor>label>small{color:var(--pw-muted);font-size:10.5px;line-height:1.5}.personal-machine-json-editor textarea{resize:vertical;border:1px solid var(--pw-line-strong);width:100%;min-width:0;color:var(--pw-text);tab-size:2;background:#fafafa;border-radius:9px;padding:12px 13px;font:12px/1.6 SFMono-Regular,Consolas,monospace}.personal-machine-json-editor textarea:focus-visible{outline:2px solid var(--pw-blue);outline-offset:2px}.personal-machine-validation,.personal-machine-error,.personal-machine-notice{border-radius:9px;margin:0 20px 16px;padding:10px 12px;font-size:11px;line-height:1.5}.personal-machine-validation,.personal-machine-error{background:var(--pw-red-bg);color:var(--pw-red);border:1px solid #edc1ba}.personal-machine-notice{background:var(--pw-green-bg);color:var(--pw-green);border:1px solid #bcdacb;align-items:center;gap:8px;display:flex}.personal-machine-preview{background:#f8faff;border:1px solid #aebfec;border-radius:12px;margin:0 20px 18px;padding:14px}.personal-machine-preview header{justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-machine-preview header strong{font-size:12px}.personal-machine-preview header span{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:99px;padding:3px 8px;font-size:10px;font-weight:650}.personal-machine-preview dl{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:12px 0;display:grid}.personal-machine-preview dl div{background:#fff;border:1px solid #dfe5f3;border-radius:8px;min-width:0;padding:8px}.personal-machine-preview dt{color:var(--pw-muted);font-size:9.5px}.personal-machine-preview dd{overflow-wrap:anywhere;margin:4px 0 0;font-family:SFMono-Regular,Consolas,monospace;font-size:10.5px;font-weight:650}.personal-machine-preview p{color:#52627f;margin:0;font-size:10.5px;line-height:1.5}.personal-machine-rollback{border:1px solid var(--pw-line);background:#faf9f6;border-radius:12px;justify-content:space-between;align-items:center;gap:18px;margin:0 20px 18px;padding:13px 14px;display:flex}.personal-machine-rollback strong{font-size:12px}.personal-machine-rollback p{color:var(--pw-muted);margin:3px 0 0;font-size:10.5px;line-height:1.45}.personal-machine-rollback .personal-secondary-action{flex:none;width:auto;min-height:40px;margin:0;padding:0 13px}.personal-machine-editor>footer{border-top:1px solid var(--pw-line);background:#faf9f6;justify-content:flex-end;gap:10px;padding:15px 20px;display:flex}.personal-machine-editor>footer .personal-primary-action,.personal-machine-editor>footer .personal-secondary-action,.personal-machine-editor>footer .personal-danger-action{width:auto;min-height:42px;margin:0;padding:0 15px}.personal-machine-unavailable{border:1px dashed var(--pw-line-strong);min-height:180px;color:var(--pw-muted);background:#fff;border-radius:14px;justify-items:start;gap:8px;padding:26px;display:grid}.personal-machine-unavailable strong{color:var(--pw-text);font-size:13px}.personal-machine-unavailable p{max-width:540px;margin:0;font-size:11px;line-height:1.6}.personal-lark-loading,.personal-lark-empty{min-height:130px;color:var(--pw-muted);justify-content:center;align-items:center;gap:8px;font-size:13px;display:flex}.personal-lark-apps{max-width:1180px;margin:0 auto}.personal-lark-app-toolbar{color:var(--pw-muted);justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;font-size:11px;display:flex}.personal-lark-app-toolbar .personal-primary-action{width:auto;min-height:40px;margin:0;padding:0 16px}.personal-lark-app-grid{grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px;display:grid}.personal-lark-app-card{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:15px;grid-template-columns:42px minmax(0,1fr) auto;align-items:center;gap:11px;padding:18px;display:grid}.personal-lark-app-avatar{background:var(--pw-blue-soft);width:42px;height:42px;color:var(--pw-blue);border-radius:12px;place-items:center;display:grid}.personal-lark-app-card div{gap:3px;display:grid}.personal-lark-app-card small,.personal-lark-app-card p{color:var(--pw-muted);font-size:11px}.personal-lark-app-card em{border-radius:99px;padding:3px 9px;font-size:10px;font-style:normal;font-weight:650}.personal-lark-app-card em.is-ready{background:var(--pw-green-bg);color:var(--pw-green)}.personal-lark-app-card em.is-off{color:var(--pw-muted);background:#f1f1ee}.personal-lark-app-card p{grid-column:2/-1;margin:0}.personal-lark-connections{max-width:1180px;margin:0 auto}.personal-lark-route-readiness{background:var(--pw-amber-bg);color:var(--pw-amber);border:1px solid #ead49a;border-radius:10px;align-items:center;gap:8px;margin:0 0 12px;padding:10px 12px;font-size:12px;font-weight:650;line-height:1.5;display:flex}.personal-lark-route-readiness svg{flex:none}.personal-lark-toolbar{justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;display:flex}.personal-lark-toolbar>label{border:1px solid var(--pw-line);max-width:680px;height:40px;color:var(--pw-faint);background:#fff;border-radius:10px;flex:1;align-items:center;gap:8px;padding:0 12px;display:flex}.personal-lark-toolbar input{width:100%;font:inherit;background:0 0;border:0;outline:0}.personal-lark-toolbar .personal-primary-action{flex:none;width:auto;min-height:40px;margin-top:0;padding:0 16px}.personal-lark-table{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:14px;overflow:hidden}.personal-lark-table-head,.personal-lark-table-row{grid-template-columns:1.35fr 1.35fr .72fr .72fr 100px;align-items:center;gap:16px;padding:12px 16px;display:grid}.personal-lark-table-head{border-bottom:1px solid var(--pw-line);min-height:42px;color:var(--pw-faint);letter-spacing:.04em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-lark-table-row{border-bottom:1px solid var(--pw-line);min-height:70px;font-size:12px}.personal-lark-table-row:last-of-type{border-bottom:0}.personal-lark-table-row>span{gap:3px;min-width:0;display:grid}.personal-lark-table-row strong,.personal-lark-table-row small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.personal-lark-table-row small{color:var(--pw-muted);font-size:10px}.personal-lark-row-actions{justify-content:flex-end;display:flex!important}.personal-lark-row-actions button,.personal-lark-modal header button{border:1px solid var(--pw-line);min-height:30px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:8px;align-items:center;gap:4px;padding:0 8px;font-size:10px;display:inline-flex}.personal-lark-row-actions button.is-confirm{background:var(--pw-red-bg);color:var(--pw-red);border-color:#e6b0aa}.personal-lark-modal-backdrop{z-index:80;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background:#1e1f2361;place-items:center;padding:24px;display:grid;position:fixed;inset:0}.personal-lark-modal{border:1px solid var(--pw-line);background:#fff;border-radius:18px;gap:14px;width:min(560px,100%);max-height:calc(100vh - 48px);padding:22px;display:grid;overflow:auto;box-shadow:0 24px 70px #14182340}.personal-lark-modal header{justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.personal-lark-modal header small{color:var(--pw-muted);font-size:10px}.personal-lark-modal h2{letter-spacing:-.02em;margin:3px 0 0;font-size:20px}.personal-lark-modal>label{color:var(--pw-muted);gap:7px;font-size:11px;font-weight:650;display:grid}.personal-lark-modal>label>small{color:var(--pw-faint);font-size:10px;font-weight:450;line-height:1.45}.personal-lark-modal input[type=search],.personal-lark-modal input[type=text],.personal-lark-modal input:not([type]),.personal-lark-modal select{border:1px solid var(--pw-line-strong);width:100%;min-height:40px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 11px}.personal-lark-modal label:has(input[type=search]){grid-template-columns:1fr}.personal-lark-modal label:has(input[type=search]) input{margin-bottom:2px}.personal-lark-group-state{border:1px dashed var(--pw-line-strong);min-height:40px;color:var(--pw-muted);background:#fafaf8;border-radius:9px;align-items:center;gap:7px;padding:9px 11px;font-size:11px;font-weight:500;line-height:1.45;display:flex}.personal-lark-group-state.is-error{background:var(--pw-red-bg);color:var(--pw-red);border-style:solid;border-color:#efc3bd}.personal-lark-check{border:1px solid var(--pw-line);background:#fafaf8;border-radius:10px;align-items:flex-start;padding:12px;gap:10px!important;display:flex!important}.personal-lark-check input{accent-color:var(--pw-blue);margin-top:2px}.personal-lark-check span{gap:2px;display:grid}.personal-lark-check strong{color:var(--pw-text)}.personal-lark-check small{font-weight:400}.personal-lark-agent-apps{color:var(--pw-muted);border:0;gap:7px;margin:0;padding:0;display:grid}.personal-lark-agent-apps legend{margin-bottom:1px;font-size:11px;font-weight:650}.personal-lark-agent-apps>small{color:var(--pw-faint);font-size:10px;line-height:1.45}.personal-lark-agent-apps>div{gap:8px;display:grid}.personal-lark-agent-apps label{border:1px solid var(--pw-line);background:#fafaf8;border-radius:10px;grid-template-columns:minmax(0,1fr) minmax(180px,1fr);align-items:center;gap:12px;padding:10px 11px;display:grid}.personal-lark-agent-apps label>span{gap:2px;min-width:0;display:grid}.personal-lark-agent-apps label strong{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;font-size:11px;overflow:hidden}.personal-lark-agent-apps label small{color:var(--pw-faint);text-overflow:ellipsis;white-space:nowrap;font-size:9px;overflow:hidden}.personal-lark-agent-apps select{min-width:0}.personal-lark-ingress{color:var(--pw-muted);border:0;gap:7px;margin:0;padding:0;display:grid}.personal-lark-ingress legend{margin-bottom:1px;font-size:11px;font-weight:650}.personal-lark-ingress>div{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;display:grid}.personal-lark-ingress label{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:10px;min-height:84px;padding:11px;display:block;position:relative}.personal-lark-ingress label.is-active{border-color:var(--pw-blue);background:#2f69eb0f;box-shadow:0 0 0 1px #2f69eb24}.personal-lark-ingress input{opacity:0;width:1px;height:1px;position:absolute}.personal-lark-ingress span{gap:5px;display:grid}.personal-lark-ingress strong{color:var(--pw-text);font-size:11px}.personal-lark-ingress small{color:var(--pw-faint);font-size:9px;font-weight:450;line-height:1.35}.personal-lark-topic-preview{border:1px solid var(--pw-line);min-height:40px;color:var(--pw-text);background:#f7f7f4;border-radius:9px;align-items:center;gap:8px;padding:0 11px;font-size:12px;font-weight:500;display:flex}.personal-lark-topic-preview.is-locked{color:var(--pw-muted)}.personal-lark-cardinality{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:9px;align-items:center;gap:8px;margin:0;padding:10px 12px;font-size:11px;display:flex}.personal-lark-modal footer{z-index:2;border-top:1px solid var(--pw-line);background:#fff;justify-content:flex-end;gap:9px;margin:0 -22px -22px;padding:12px 22px 22px;display:flex;position:sticky;bottom:-22px}.personal-lark-modal footer button{width:auto;min-width:96px;margin-top:0;padding:0 16px}@media (width<=640px){.personal-lark-agent-apps label{grid-template-columns:1fr}}.personal-lark-modal-backdrop.is-setup{z-index:90}.personal-lark-setup-modal{width:min(620px,100%)}.personal-lark-setup-copy{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-lark-setup-progress{border:1px solid var(--pw-line);background:#fafaf8;border-radius:13px;grid-template-columns:46px minmax(0,1fr);align-items:center;gap:13px;min-height:132px;padding:18px;display:grid}.personal-lark-setup-progress>div{gap:5px;display:grid}.personal-lark-setup-progress p{color:var(--pw-muted);margin:0;font-size:11px;line-height:1.5}.personal-lark-setup-progress a{width:fit-content;color:var(--pw-blue);grid-column:2;align-items:center;gap:6px;font-size:11px;font-weight:650;text-decoration:none;display:inline-flex}.personal-lark-setup-icon{background:var(--pw-blue-soft);width:46px;height:46px;color:var(--pw-blue);border-radius:13px;place-items:center;display:grid}.personal-lark-setup-icon.is-ready{background:var(--pw-green-bg);color:var(--pw-green)}.personal-lark-setup-icon.is-failed,.personal-row-status.is-blocking{background:var(--pw-red-bg);color:var(--pw-red)}.personal-proposal-row{width:100%;color:inherit;cursor:pointer;text-align:left;background:#f5f8ff;border:1px solid #c3d3f9;border-radius:14px;grid-template-columns:36px minmax(0,1fr) auto;align-items:center;gap:12px;padding:14px;display:grid}.personal-proposal-row:hover{border-color:#8fabe9;box-shadow:0 2px 10px #2f66e814}.personal-proposal-row>span:first-child{color:#315fc8;background:#e4ebff;border-radius:11px;place-items:center;width:36px;height:36px;display:grid}.personal-proposal-row>span:nth-child(2){gap:3px;min-width:0;display:grid}.personal-proposal-row small{color:#5f74ad;font-size:10px}.personal-proposal-row strong{font-size:13px}.personal-proposal-row p{color:#686f7c;margin:0;font-size:11px}.personal-proposal-row>b{color:#315fc8;font-size:11px}.personal-proposal-row.is-applied{background:#f3fbf7;border-color:#b5ddcc}.personal-proposal-row.is-error,.personal-proposal-row.is-stale{background:#fff7f7;border-color:#efc3c3}.personal-proposal-row.is-gated{background:#fffaf0;border-color:#ead39c}.personal-gated-summary{background:#fffaf0;border:1px solid #ead39c;border-radius:14px}.personal-gated-summary>summary{color:#6d5620;cursor:pointer;align-items:center;gap:9px;padding:12px 14px;list-style:none;display:flex}.personal-gated-summary>summary::-webkit-details-marker{display:none}.personal-gated-summary>summary>span{color:#9a741d;background:#fff1c9;border-radius:9px;place-items:center;width:30px;height:30px;display:grid}.personal-gated-summary>summary small{color:#927d4c;margin-left:auto}.personal-gated-summary>div{gap:8px;padding:0 8px 8px;display:grid}.personal-gated-summary .personal-proposal-row{background:#fffdf7}.personal-schedule-row{border:1px solid var(--pw-line);background:var(--pw-card);width:100%;color:inherit;cursor:pointer;text-align:left;border-radius:14px;grid-template-columns:36px minmax(0,1fr) auto 16px;align-items:center;gap:12px;padding:13px 15px;display:grid}.personal-schedule-row:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-schedule-icon{width:34px;height:34px;color:var(--pw-muted);background:#f2f1ed;border-radius:11px;place-items:center;display:grid}.personal-schedule-copy{gap:2px;min-width:0;display:grid}.personal-schedule-copy small,.personal-schedule-copy p{color:var(--pw-muted);margin:0;font-size:10px}.personal-schedule-copy strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;overflow:hidden}.personal-schedule-status{background:var(--pw-green-bg);color:var(--pw-green);border-radius:99px;align-items:center;padding:2.5px 10px;font-size:11px;font-weight:600;display:inline-flex}.personal-schedule-status.is-paused{color:var(--pw-muted);background:#f2f1ed}.personal-timeline-empty{text-align:center;place-items:center;padding:70px 20px;display:grid}.personal-timeline-empty>span{background:var(--pw-blue-soft);width:44px;height:44px;color:var(--pw-blue);border-radius:14px;place-items:center;margin-bottom:14px;display:grid}.personal-timeline-empty p{max-width:420px;color:var(--pw-muted);font-size:13px}.personal-object-list{border:1px solid var(--pw-line);background:#fff;border-radius:14px;overflow:hidden}.personal-object-list>header,.personal-object-list>button{border:0;border-bottom:1px solid var(--pw-line);width:100%;min-height:52px;color:inherit;text-align:left;background:0 0;grid-template-columns:28px minmax(0,1fr) auto;align-items:center;gap:10px;padding:10px 15px;display:grid}.personal-object-list>header{min-height:46px;color:var(--pw-faint);letter-spacing:.06em;grid-template-columns:minmax(0,1fr) auto;font-size:12px;font-weight:650}.personal-object-list>button{cursor:pointer}.personal-object-list>button:hover{background:#faf9f6}.personal-object-list>button:last-child{border-bottom:0}.personal-object-list>button>p{color:var(--pw-muted);text-overflow:ellipsis;white-space:nowrap;grid-column:2/-1;margin:-3px 0 0;font-size:12px;line-height:1.45;overflow:hidden}.personal-object-list>button>em{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:999px;justify-self:end;padding:2px 7px;font-size:10px;font-style:normal;font-weight:700}.personal-object-list small{color:var(--pw-muted)}.personal-object-list>button>small{white-space:nowrap;align-items:center;gap:8px;display:inline-flex}.personal-object-list-state{border-bottom:1px solid var(--pw-line);color:var(--pw-muted);align-items:center;gap:8px;margin:0;padding:14px 15px;font-size:12px;line-height:1.5;display:flex}.personal-object-list-state.is-error{color:var(--pw-red);background:var(--pw-red-bg)}.personal-object-list .is-done{color:var(--pw-green)}.personal-object-list .is-attention{color:var(--pw-amber);font-weight:700}.personal-task-age{color:var(--pw-faint);font-size:11px}.personal-task-empty{color:var(--pw-muted);margin:0;padding:4px 15px 16px;font-size:12.5px}.personal-task-lane-filter{border:1px solid var(--pw-line);background:#fff;border-radius:10px;justify-content:space-between;align-items:center;gap:16px;min-height:50px;padding:8px 12px;display:flex}.personal-capability-settings{grid-template-rows:auto minmax(0,1fr);gap:16px;width:100%;min-width:0;max-width:1050px;min-height:0;display:grid;overflow:hidden}.personal-capability-body{flex-direction:column;gap:16px;min-width:0;min-height:0;display:flex;overflow:hidden}.personal-capability-body>.personal-capability-layout{flex:auto}.personal-provider-settings{width:100%;min-width:0;max-width:1050px}.personal-provider-settings>.personal-operator-credential{margin-top:0}.personal-capability-scope-note{overscroll-behavior:contain;max-height:120px;color:var(--pw-muted);padding:12px 0;overflow:auto}.personal-capability-scope-note summary{cursor:pointer;align-items:center;gap:8px;font-size:12px;display:flex}.personal-capability-scope-note p{padding:10px 0 0 25px}.personal-capability-scope-note svg{flex:none;margin-top:2px}.personal-operator-credential{border:1px solid var(--pw-border);background:var(--pw-surface);border-radius:10px;gap:12px;margin:16px 0 24px;padding:16px;display:grid}.personal-operator-credential>header{grid-template-columns:auto 1fr auto;align-items:start;gap:10px;display:grid}.personal-operator-credential>header strong{font-size:13px;display:block}.personal-operator-credential>header p{color:var(--pw-muted);margin:4px 0 0;font-size:12px;line-height:1.5}.personal-operator-credential-status{color:var(--pw-muted);font-family:var(--pw-font-mono);font-size:11px}.personal-operator-credential-readback{gap:6px;margin:0;font-size:12px;display:grid}.personal-operator-credential-readback>div{grid-template-columns:140px 1fr;gap:10px;display:grid}.personal-operator-credential-readback dt{color:var(--pw-muted)}.personal-operator-credential-readback dd{overflow-wrap:anywhere;margin:0}.personal-operator-credential label{gap:4px;font-size:12px;display:grid}.personal-operator-credential input{border:1px solid var(--pw-border);background:var(--pw-canvas);color:inherit;border-radius:8px;padding:7px 9px;font-size:12px}.personal-operator-credential input:disabled{opacity:.6}.personal-capability-scope-note p{margin:0;font-size:12px;line-height:1.55}.personal-capability-scope-note strong{color:var(--pw-text);display:block}.personal-capability-layout{grid-template-columns:220px minmax(0,1fr);align-items:stretch;gap:24px;min-width:0;min-height:0;display:grid;overflow:hidden}.personal-capability-list{overscroll-behavior:contain;scrollbar-gutter:stable;align-content:start;gap:6px;min-height:0;padding:3px;display:grid;overflow-y:auto}.personal-capability-list button{min-height:44px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border:1px solid #0000;border-radius:6px;justify-content:space-between;align-items:center;gap:8px;padding:10px 12px;display:flex}.personal-capability-list button:hover{border-color:#b8c9f5}.personal-capability-list button[aria-current=page]{background:#f4f7ff;border-color:#8cacf0;box-shadow:0 0 0 3px #2f66e914}.personal-capability-list button>span{gap:2px;min-width:0;display:grid}.personal-capability-list em{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:999px;flex:none;padding:3px 6px;font-size:9px;font-style:normal;font-weight:750}.personal-capability-list strong{overflow-wrap:anywhere;font-size:13px;font-weight:500;line-height:1.5}.personal-capability-detail{overscroll-behavior:contain;scrollbar-gutter:stable;border:1px solid var(--pw-line);background:#fff;border-radius:14px;align-self:start;min-width:0;min-height:0;max-height:100%;overflow:auto}.personal-capability-detail>header{border-bottom:1px solid var(--pw-line);align-items:flex-start;gap:12px;padding:24px;display:flex}.personal-capability-detail>header>div{flex:1;min-width:0}.personal-capability-help{color:var(--pw-muted);margin-top:8px;font-size:12px}.personal-capability-help summary{cursor:pointer}.personal-capability-help p{padding-top:12px}.personal-capability-help dl{gap:12px;margin-bottom:0;display:grid}.personal-capability-help dt{color:var(--pw-text);font-weight:500}.personal-capability-help dd{margin:4px 0 0;line-height:1.6}.personal-capability-detail h2{margin:2px 0 4px;font-size:17px}.personal-capability-detail p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.55}.personal-capability-value-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:16px 18px;display:grid}.personal-capability-raw-values{border-top:1px solid var(--pw-line)}.personal-capability-raw-values>summary{cursor:pointer;color:var(--pw-text);padding:16px 18px;font-size:12px}.personal-capability-raw-values>summary:focus-visible{outline:2px solid var(--pw-blue);outline-offset:-2px}.personal-capability-value-grid section{min-width:0}.personal-capability-value-grid strong,.personal-capability-field-summary>strong{font-size:11px}.personal-capability-value-grid pre{border:1px solid var(--pw-line);min-height:72px;max-height:220px;color:var(--pw-text);background:#faf9f6;border-radius:9px;margin:7px 0 0;padding:11px;font-size:10.5px;line-height:1.5;overflow:auto}.personal-capability-editor-status{border-radius:10px;align-items:flex-start;gap:10px;margin:20px 24px;padding:12px;display:flex}.personal-capability-heading-row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;display:flex}.personal-capability-heading-row .personal-capability-effective-source{color:var(--pw-muted);align-items:center;gap:6px;margin:0;display:flex}.personal-capability-effective-source span{color:var(--pw-muted);flex-wrap:wrap;gap:6px;font-size:11px;display:flex}.personal-capability-effective-source strong{color:var(--pw-text)}.personal-capability-editor-status svg{flex:none;margin-top:1px}.personal-capability-editor-status strong{font-size:12px}.personal-capability-editor-status p{margin-top:3px}.personal-capability-editor-status.is-preview{background:var(--pw-blue-soft);color:var(--pw-blue-ink)}.personal-capability-editor-status.is-read-only{color:#9a5a10;background:#fff5e8}.personal-capability-linked-setting{border:1px solid var(--pw-line);background:var(--pw-bg);border-radius:10px;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:16px;margin:0 24px 20px;padding:14px;display:grid}.personal-capability-linked-setting>div{gap:4px;display:grid}.personal-capability-linked-setting strong{font-size:12px}.personal-capability-linked-setting .personal-notification-toggle{justify-self:end;min-height:44px}.personal-capability-linked-setting .personal-notification-error{grid-column:1/-1}.personal-capability-behavior-note{border:1px solid var(--pw-line);background:var(--pw-amber-bg);color:var(--pw-amber);border-radius:6px;align-items:flex-start;gap:10px;margin:16px 24px;padding:12px;display:flex}.personal-capability-behavior-note svg{flex:none;margin-top:1px}.personal-capability-behavior-note strong{font-size:12px}.personal-capability-behavior-note p{color:inherit;margin-top:3px}.personal-capability-editor-mode{color:var(--pw-muted);justify-content:flex-end;align-items:center;gap:12px;margin:8px 24px 0;font-size:11px;display:flex}.personal-capability-editor-mode button{min-height:44px;color:var(--pw-muted);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;gap:6px;padding:0 12px;font-size:11px;font-weight:650;display:inline-flex}.personal-capability-editor-mode button:hover{background:var(--pw-blue-soft);color:var(--pw-text)}.personal-capability-editor-mode button:disabled{cursor:not-allowed;opacity:.45}.personal-capability-field-summary{padding:20px 24px 24px}.personal-capability-field-summary .personal-capability-fields{margin-top:0}.personal-capability-fields{border:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:0;padding:0;display:grid}.personal-report-schedule{grid-column:1/-1;grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr));gap:12px;min-width:0;display:grid}.personal-report-schedule p{color:var(--pw-muted);overflow-wrap:anywhere;grid-column:1/-1;margin:0;font-size:12px}.personal-capability-fields label{align-content:start;gap:6px;min-width:0;display:grid}.personal-capability-fields label>span{font-size:12px;font-weight:650}.personal-capability-fields input:not([type=checkbox]),.personal-capability-fields select,.personal-capability-fields textarea{border:1px solid var(--pw-line-strong);width:100%;min-width:0;min-height:42px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:8px 11px;font-size:13px}.personal-capability-fields .is-boolean{border-bottom:1px solid var(--pw-line);grid-column:1/-1;grid-template-columns:minmax(0,1fr) auto;align-items:center;min-height:48px;padding-bottom:12px}.personal-capability-enabled-row{border-bottom:1px solid var(--pw-line);grid-column:1/-1;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:16px;min-width:0;min-height:60px;padding-bottom:12px;display:grid}.personal-capability-enabled-row>.is-boolean{display:contents}.personal-capability-enabled-row>.is-boolean>span{grid-area:1/1}.personal-capability-enabled-row>.is-boolean>input{grid-area:1/3}.personal-capability-enabled-row>.personal-capability-edit-json{grid-area:1/2}.personal-capability-edit-json{min-height:44px;color:var(--pw-muted);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;align-items:center;gap:6px;padding:0 8px;font-size:11px;display:inline-flex}.personal-capability-edit-json:hover{background:var(--pw-blue-soft);color:var(--pw-text)}.personal-capability-edit-json:disabled{cursor:not-allowed;opacity:.45}.personal-capability-fields .is-boolean input{appearance:none;border:1px solid var(--pw-line-strong);background:var(--pw-line);cursor:pointer;border-radius:999px;width:40px;height:24px;margin:0;padding:2px}.personal-capability-fields .is-boolean input:before{content:"";background:#fff;border-radius:50%;width:18px;height:18px;display:block}.personal-capability-fields .is-boolean input:checked{background:var(--pw-text)}.personal-capability-fields .is-boolean input:checked:before{transform:translate(16px)}.personal-capability-fields .is-boolean input:focus-visible{outline:2px solid var(--pw-blue);outline-offset:3px}.personal-capability-fields:disabled{opacity:.62}.personal-capability-json-editor{gap:7px;margin:0;padding:0 18px 18px;display:grid}.personal-capability-json-editor>span{font-size:11px;font-weight:650}.personal-capability-json-editor>small{color:var(--pw-muted);font-size:10.5px;line-height:1.5}.personal-capability-json-editor textarea{resize:vertical;border:1px solid var(--pw-line-strong);width:100%;min-width:0;color:var(--pw-text);tab-size:2;background:#fafafa;border-radius:9px;padding:12px 13px;font:12px/1.6 SFMono-Regular,Consolas,monospace}.personal-capability-json-editor textarea:focus-visible{outline:2px solid var(--pw-blue);outline-offset:2px}.personal-capability-preview{background:#f4f7ff;border:1px solid #9fb9f4;border-radius:10px;grid-template-columns:minmax(0,1fr) auto;gap:3px 12px;margin:0 18px 16px;padding:12px;display:grid}.personal-capability-preview strong{font-size:12px}.personal-capability-preview span{color:var(--pw-blue-ink);font-size:11px;font-weight:700}.personal-capability-preview small{color:var(--pw-muted);grid-column:1/-1;font-size:10.5px}.personal-capability-actions,.personal-operator-credential-actions{border-top:1px solid var(--pw-line);background:0 0;justify-content:flex-end;gap:9px;padding:14px 18px;display:flex}.personal-capability-actions button,.personal-operator-credential-actions button{border:1px solid var(--pw-line-strong);min-height:44px;color:var(--pw-text);cursor:pointer;font:inherit;background:#fff;border-radius:9px;padding:0 14px;font-size:12px;font-weight:700}.personal-capability-actions button.is-primary,.personal-operator-credential-actions button.is-primary{border-color:var(--pw-blue);background:var(--pw-blue);color:#fff}.personal-capability-actions button.is-danger,.personal-operator-credential-actions button.is-danger{color:var(--pw-red);align-items:center;gap:6px;margin-right:auto;display:inline-flex}.personal-capability-actions button:disabled,.personal-operator-credential-actions button:disabled{cursor:not-allowed;opacity:.5}.personal-capability-empty,.personal-capability-error{border:1px solid var(--pw-line);max-width:720px;min-height:56px;color:var(--pw-muted);background:#fff;border-radius:11px;align-items:center;gap:9px;margin:0;padding:14px;font-size:12px;display:flex}.personal-capability-error{color:var(--pw-red);border-color:#efc1ba}.personal-capability-error span{gap:2px;display:grid}.personal-capability-error small{color:var(--pw-muted)}.personal-capability-error button{min-height:44px;color:inherit;cursor:pointer;background:0 0;border:1px solid;border-radius:9px;align-items:center;gap:6px;margin-left:auto;padding:0 12px;display:inline-flex}.personal-capability-recovery{color:#74530d;background:#fffaf0;border:1px solid #dfc98d;border-radius:10px;grid-template-columns:auto minmax(0,1fr) auto;align-items:start;gap:9px;margin:0 20px 16px;padding:12px;font-size:11px;line-height:1.5;display:grid}.personal-capability-recovery div{gap:3px;display:grid}.personal-capability-recovery p{margin:0}.personal-capability-recovery small{color:var(--pw-muted);overflow-wrap:anywhere}.personal-capability-recovery button{min-height:40px;color:inherit;cursor:pointer;background:0 0;border:1px solid;border-radius:8px;align-items:center;gap:6px;padding:0 10px;display:inline-flex}.personal-task-lane-filter>div{min-width:0;color:var(--pw-muted);align-items:center;gap:9px;display:flex}.personal-task-lane-filter>div>span{gap:1px;display:grid}.personal-task-lane-filter strong{color:var(--pw-text);font-size:12px}.personal-task-lane-filter small{color:var(--pw-faint);font-size:10.5px}.personal-task-lane-filter label{border:1px solid var(--pw-line-strong);background:var(--pw-bg);border-radius:8px;align-items:center;gap:6px;min-height:34px;padding:0 9px;display:flex}.personal-task-lane-filter select{max-width:300px;color:var(--pw-text);font:inherit;appearance:none;background:0 0;border:0;outline:0;font-size:11.5px;font-weight:600}.personal-task-board{flex-direction:column;gap:12px;height:100%;min-height:0;display:flex}.personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-board.is-list-view){overflow-y:auto}.personal-task-board.is-list-view{gap:24px;height:auto;min-height:100%}.personal-task-view-toolbar{flex:none;justify-content:space-between;align-items:center;gap:16px;display:flex}.personal-task-view-toolbar>div:first-child{gap:4px;display:grid}.personal-task-view-toolbar strong{font-size:16px;font-weight:600}.personal-task-view-toolbar span{color:var(--pw-muted);font-size:12px}.personal-task-view-switch{border:1px solid var(--pw-line);background:var(--pw-bg);border-radius:8px;flex:none;padding:3px;display:flex}.personal-task-view-switch button{min-height:36px;color:var(--pw-muted);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:5px;padding:0 14px;font-size:13px}.personal-task-view-switch button[aria-pressed=true]{background:var(--pw-text);color:var(--pw-bg)}.personal-task-grouped-list{gap:24px;padding-bottom:24px;display:grid}.personal-completed-list{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px}.personal-completed-list>header{min-height:48px;color:var(--pw-text);padding:2px 16px}.personal-completed-list>header>button{color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;min-height:44px;padding:0}.personal-completed-list .personal-task-lane-scroll{height:480px;max-height:60vh;overflow-y:auto}.personal-completed-list .personal-task-lane-scroll[hidden]{display:none}.personal-completed-list .personal-completed-row>button{border:0;border-bottom:1px solid var(--pw-line);text-align:left;background:0 0;grid-template-columns:20px minmax(0,1fr);gap:8px 12px;width:100%;height:100%;padding:16px;display:grid}.personal-completed-list .personal-completed-row>button>strong{-webkit-line-clamp:2}.personal-completed-list .personal-completed-row>button>small{grid-column:2}.personal-task-group{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;min-width:0}.personal-task-group>summary{cursor:pointer;align-items:center;gap:8px;min-height:48px;padding:10px 16px;list-style:none;display:flex}.personal-task-group>summary::-webkit-details-marker{display:none}.personal-task-group>summary strong{font-size:12px;font-weight:600;line-height:18px}.personal-task-group>summary span{background:var(--pw-line);color:var(--pw-muted);border-radius:6px;padding:2px 7px;font-size:12px}.personal-task-group>summary svg{color:var(--pw-muted);transform:rotate(-90deg)}.personal-task-group[open]>summary svg{transform:none}.personal-task-group.tone-attention>summary{color:var(--pw-amber)}.personal-task-list-rows{padding:0 16px 8px}.personal-task-list-rows>button,.personal-task-list-rows>.personal-task-card>button{border:0;border-top:1px solid var(--pw-line);width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border-radius:0;grid-template-columns:20px minmax(0,1fr);gap:8px 12px;padding:16px 4px;display:grid}.personal-task-list-rows>button:hover,.personal-task-list-rows>.personal-task-card>button:hover{background:var(--pw-line)}.personal-task-list-rows>button>strong,.personal-task-list-rows>.personal-task-card>button>strong{-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;font-size:14px;font-weight:500;line-height:20px;display:-webkit-box;overflow:hidden}.personal-task-list-rows>button>small,.personal-task-list-rows>.personal-task-card>button>small{color:var(--pw-muted);overflow-wrap:anywhere;flex-wrap:wrap;grid-column:2;align-items:center;gap:8px;font-size:12px;line-height:16px;display:flex}.personal-task-list-rows .personal-task-card-actions{background:var(--pw-card);top:auto;bottom:12px}@media (width>=721px){.personal-channel-header:has(~.personal-channel-scroll[data-active-goal-view=tasks] .is-list-view){flex-wrap:wrap}.personal-channel-header:has(~.personal-channel-scroll[data-active-goal-view=tasks] .is-list-view) .personal-channel-title{flex-basis:100%}}.personal-task-kanban{flex:1;grid-template-columns:repeat(auto-fit,minmax(172px,1fr));align-items:stretch;gap:12px;min-height:0;display:grid}.personal-task-chat-receipt{background:#f8faff;border:1px solid #d8e2f8;border-radius:10px;grid-template-columns:28px minmax(0,1fr) auto;align-items:center;gap:10px;padding:8px 12px;display:grid;box-shadow:0 1px 3px #2f66e90a}.personal-task-chat-icon{background:var(--pw-blue-soft);width:28px;height:28px;color:var(--pw-blue-ink);border-radius:8px;place-items:center;display:grid}.personal-task-chat-receipt>div{min-width:0}.personal-task-chat-receipt header{align-items:center;gap:8px;display:flex}.personal-task-chat-receipt header strong{font-size:12px;font-weight:650}.personal-task-chat-receipt header small{color:var(--pw-faint);font-size:10px}.personal-task-chat-receipt p{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;grid-template-columns:36px minmax(0,1fr);gap:5px;margin:3px 0;font-size:12px;line-height:1.4;display:grid;overflow:hidden}.personal-task-chat-receipt p b{color:var(--pw-faint);font-size:10px;font-weight:650}.personal-task-chat-receipt p.is-assistant{max-height:2.8em;color:var(--pw-muted);white-space:normal}.personal-task-chat-receipt>div>small{color:var(--pw-muted);font-size:10.5px;line-height:1.4}.personal-task-chat-receipt footer{gap:6px;display:flex}.personal-task-chat-receipt footer button{min-height:26px;color:var(--pw-blue-ink);cursor:pointer;white-space:nowrap;background:#fff;border:1px solid #b9c9ee;border-radius:7px;align-items:center;gap:4px;padding:3px 8px;font-size:10.5px;font-weight:650;display:inline-flex}.personal-task-chat-receipt footer button:hover{border-color:var(--pw-blue);background:var(--pw-blue-soft)}.personal-task-kanban .personal-object-list{background:#f6f4ee;flex-direction:column;min-height:0;padding:0;display:flex}.personal-task-kanban .personal-object-list>header{background:#f6f4ee;border-bottom:1px solid #e0ddd4b8;flex:none;align-items:center;gap:8px;min-height:38px;padding:10px 16px 7px;display:flex}.personal-task-kanban .personal-object-list>header>strong{align-items:center;gap:7px;min-width:0;font-size:12px;display:inline-flex}.personal-task-kanban .personal-object-list>header>span{margin-left:auto}.personal-task-lane-scroll{overscroll-behavior-y:contain;scrollbar-color:#bebbb2 transparent;scrollbar-gutter:stable;scrollbar-width:thin;-webkit-overflow-scrolling:touch;flex-direction:column;flex:auto;gap:8px;min-height:0;padding:8px;scroll-padding-block:8px;display:flex;overflow-y:auto}.personal-task-lane-scroll:focus-visible{outline:2px solid var(--pw-blue);outline-offset:-3px}.personal-task-lane-scroll.has-overflow-before{box-shadow:inset 0 12px 10px -13px #34312b94}.personal-task-lane-scroll.has-overflow-after{box-shadow:inset 0 -16px 12px -15px #34312bb3}.personal-task-lane-scroll.has-overflow-before.has-overflow-after{box-shadow:inset 0 12px 10px -13px #34312b94,inset 0 -16px 12px -15px #34312bb3}.personal-task-lane-scroll::-webkit-scrollbar{width:10px}.personal-task-lane-scroll::-webkit-scrollbar-track{background:0 0}.personal-task-lane-scroll::-webkit-scrollbar-thumb{background:#bebbb2 padding-box padding-box;border:3px solid #0000;border-radius:999px;min-height:40px}.personal-task-lane-scroll::-webkit-scrollbar-thumb:hover{background:#97938a padding-box padding-box}.personal-kanban-dot{background:var(--pw-faint);border-radius:50%;width:8px;height:8px}.personal-kanban-dot.tone-attention{background:var(--pw-amber)}.personal-kanban-dot.tone-progress{background:var(--pw-blue)}.personal-kanban-dot.tone-schedule{background:#8a6fd6}.personal-kanban-dot.tone-done{background:var(--pw-green)}.personal-task-kanban .personal-task-lane-scroll>button,.personal-task-kanban .personal-task-card>button{border:1px solid var(--pw-line);width:100%;min-height:0;color:inherit;text-align:left;cursor:pointer;background:#fff;border-radius:10px;grid-template-columns:18px minmax(0,1fr);align-items:center;gap:6px 8px;padding:10px 12px;display:grid;box-shadow:0 1px 3px #1e1c140f}.personal-task-kanban .personal-task-lane-scroll>button:hover,.personal-task-kanban .personal-task-card>button:hover{border-color:var(--pw-line-strong);background:#fff;box-shadow:0 2px 8px #1e1c1417}.personal-task-kanban .personal-task-lane-scroll>button>small,.personal-task-kanban .personal-task-card>button>small{white-space:normal;text-align:left;flex-wrap:wrap;grid-column:1/-1;justify-content:flex-start;align-items:center;gap:8px;display:inline-flex}.personal-task-kanban .personal-task-lane-scroll>button:last-child{border-bottom:1px solid var(--pw-line)}.personal-task-kanban .personal-task-lane-scroll>button:last-child:hover{border-color:var(--pw-line-strong)}.personal-task-lane-scroll>button,.personal-task-card{flex:none;min-width:0}.personal-task-lane-scroll>button>small,.personal-task-card>button>small{font-size:12px;line-height:16px}.personal-task-lane-scroll>button>strong,.personal-task-card>button>strong{-webkit-line-clamp:3;overflow-wrap:anywhere;-webkit-box-orient:vertical;font-size:14px;font-weight:500;line-height:20px;display:-webkit-box;overflow:hidden}.personal-task-card{position:relative}.personal-completed-window{flex-shrink:0;position:relative}.personal-completed-row{padding-bottom:8px;position:absolute;inset-inline:0}.personal-completed-row>button{width:100%;height:100%}.personal-completed-row>button>strong{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.personal-completed-footer{color:var(--pw-muted);text-align:center;flex-shrink:0;padding:12px 4px;font-size:12px}.personal-completed-footer button{border:1px solid var(--pw-line);min-height:32px;color:inherit;cursor:pointer;background:0 0;border-radius:6px}.personal-task-card>button{width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:start;display:grid}.personal-task-card-actions{opacity:0;gap:4px;transition:opacity .12s;display:flex;position:absolute;top:6px;right:6px}.personal-task-card:hover .personal-task-card-actions,.personal-task-card:focus-within .personal-task-card-actions,.personal-task-card.has-session .personal-task-card-actions{opacity:1}.personal-task-card.is-selected>button,.personal-task-kanban .personal-task-lane-scroll>button.is-selected{background:#f5f8ff;border-color:#7c9df1;box-shadow:0 0 0 2px #2f66e91f,0 4px 14px #1e34681a}.personal-task-card.is-selected:before{z-index:2;background:var(--pw-blue);content:"";border-radius:0 3px 3px 0;width:3px;position:absolute;top:8px;bottom:8px;left:0}.personal-task-card-actions button{border:1px solid var(--pw-line-strong);width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:7px;place-items:center;padding:0;display:grid;box-shadow:0 1px 3px #1e1c141f}.personal-task-card-actions button:hover{color:var(--pw-text);border-color:var(--pw-text)}.personal-task-card-actions button:disabled{cursor:wait;opacity:.72}.personal-task-card-actions .personal-task-session-link{width:auto;color:var(--pw-blue-ink);opacity:1;gap:5px;padding:0 8px;display:flex}.personal-task-session-link span{white-space:nowrap;font-size:10.5px;font-weight:650}.personal-task-session-status{color:var(--pw-blue-ink);font-weight:650}.personal-task-kanban .personal-task-empty{border:1px dashed var(--pw-line-strong);text-align:center;border-radius:10px;margin:2px 0 4px;padding:16px 10px;font-size:12px}.personal-workspace-shell.has-drawer .personal-task-kanban{grid-template-columns:repeat(2,minmax(0,1fr))}.personal-workspace-shell.has-task-inspector .personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-kanban){padding-inline:20px}.personal-workspace-shell.has-task-inspector .personal-task-kanban{grid-template-columns:repeat(4,260px);width:max-content;min-width:100%}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-receipt{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-icon{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-receipt footer button{color:#141414;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-composer-wrap{background:linear-gradient(transparent, var(--pw-bg) 22%);padding:10px max(26px,50% - 410px) 20px}.personal-read-only-notice{border:1px solid var(--pw-line);min-height:46px;color:var(--pw-muted);background:#f5f4f1;border-radius:12px;justify-content:center;align-items:center;gap:8px;padding:10px 16px;font-size:11.5px;display:flex}.personal-read-only-notice strong{color:var(--pw-text);white-space:nowrap}.personal-manager-conversation-tray{width:100%;max-height:320px;color:inherit;font:inherit;text-align:left;background:#fffffff7;border:1px solid #bfcdf1;border-radius:14px;gap:9px;margin-bottom:10px;padding:12px 14px;animation:.16s cubic-bezier(.16,1,.3,1) pw-tray-in;display:grid;overflow:hidden;box-shadow:0 5px 20px #223e781a}@keyframes pw-tray-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}.personal-manager-conversation-tray:hover{border-color:#8fa9ee;box-shadow:0 7px 24px #223e7824}.personal-manager-conversation-tray:focus-within{border-color:var(--pw-blue);box-shadow:0 0 0 3px #2f66e921,0 5px 20px #223e781a}.personal-manager-conversation-tray>header{justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-manager-conversation-tray>header>span{color:var(--pw-blue-ink);align-items:center;gap:7px;display:flex}.personal-manager-conversation-tray>header strong{font-size:16px;font-weight:600;line-height:24px}.personal-manager-conversation-tray>header small{color:var(--pw-faint);font-size:12px;font-weight:500;line-height:16px}.personal-manager-conversation-actions{align-items:center;gap:8px;display:flex}.personal-manager-conversation-btn{min-height:32px;color:var(--pw-blue-ink);cursor:pointer;background:#f4f7fe;border:1px solid #b9c9ee;border-radius:8px;align-items:center;gap:5px;padding:5px 10px;font-size:12px;font-weight:600;line-height:16px;transition:all .12s;display:inline-flex}.personal-manager-conversation-btn:hover{background:var(--pw-blue-soft);border-color:var(--pw-blue)}.personal-manager-conversation-link{min-height:32px;color:var(--pw-blue);cursor:pointer;background:0 0;border:0;border-radius:7px;align-items:center;padding:5px 8px;font-size:14px;font-weight:500;line-height:20px;transition:background .12s;display:inline-flex}.personal-manager-conversation-link:hover{background:var(--pw-blue-soft)}.personal-manager-conversation-close{width:32px;height:32px;color:var(--pw-faint);cursor:pointer;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;padding:0;transition:all .12s;display:inline-flex}.personal-manager-conversation-close:hover{color:#ef4444;background:#fee2e2}.personal-manager-conversation-messages{gap:7px;max-height:220px;display:grid;overflow-y:auto}.personal-manager-conversation-messages article{background:#f5f7fc;border-radius:10px;grid-template-columns:86px minmax(0,1fr);gap:10px;padding:10px 12px;font-size:14px;line-height:20px;display:grid}.personal-manager-conversation-messages article.is-user{background:#edf3ff}.personal-manager-conversation-messages article strong{color:var(--pw-muted);font-size:12px;font-weight:500;line-height:16px}.personal-manager-conversation-bubble{min-width:0}.personal-manager-conversation-bubble p{white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.personal-manager-conversation-bubble .personal-md{font-size:14px;line-height:20px}.personal-manager-conversation-bubble small{color:var(--pw-blue);margin-top:4px;font-size:12px;line-height:16px;display:inline-block}.personal-quick-prompts{flex-wrap:wrap;gap:8px;margin-bottom:9px;display:flex}.personal-quick-prompts button{border:1px solid var(--pw-line-strong);min-height:32px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:99px;align-items:center;gap:6px;padding:5px 12px;font-size:12.5px;transition:all .14s;display:inline-flex}.personal-quick-prompts button:hover{border-color:var(--pw-blue);color:var(--pw-blue-ink)}.personal-quick-prompts button:disabled{opacity:.45;cursor:default}.personal-goal-draft-status{color:var(--pw-muted);background:#f5f7ff;border:1px solid #cfd9f5;border-radius:10px;align-items:center;gap:8px;margin-bottom:9px;padding:8px 11px;font-size:11px;display:flex}.personal-goal-draft-status strong{color:var(--pw-text)}.personal-channel-composer{border:1px solid var(--pw-line-strong);background:#fff;border-radius:16px;grid-template-columns:auto 36px minmax(0,1fr) 40px;align-items:center;min-height:56px;padding:7px 7px 7px 14px;transition:border-color .15s,box-shadow .15s;display:grid;box-shadow:0 2px 10px #1e1c1412}.personal-channel-composer:focus-within{border-color:var(--pw-blue);box-shadow:0 0 0 3px #2f66e921,0 2px 10px #1e1c1412}.personal-channel-composer>span{color:#535b68;align-items:center;gap:7px;padding-right:12px;font-size:12.5px;font-weight:650;display:flex}.personal-channel-composer textarea{resize:none;border:0;border-left:1px solid var(--pw-line);width:100%;max-height:120px;color:inherit;font:inherit;background:0 0;outline:0;padding:9px 12px;line-height:1.4}.personal-channel-composer>button,.personal-correction-composer button{background:var(--pw-blue);color:#fff;cursor:pointer;border:0;border-radius:12px;place-items:center;width:40px;height:40px;display:grid;box-shadow:0 2px 6px #2f66e952}.personal-channel-composer>button:hover{background:var(--pw-blue-ink)}.personal-channel-composer>button:disabled,.personal-correction-composer button:disabled{opacity:.4;cursor:default;box-shadow:none}.personal-channel-composer>.personal-composer-attach{width:34px;height:34px;color:var(--pw-muted);box-shadow:none;background:0 0;border-radius:9px}.personal-channel-composer>.personal-composer-attach:hover{background:var(--pw-blue-soft);color:var(--pw-blue-ink)}.personal-composer-images{gap:8px;margin:0 0 8px;display:flex;overflow-x:auto}.personal-composer-images figure{flex:0 0 74px;height:58px;margin:0;position:relative}.personal-composer-images img{object-fit:cover;border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;width:100%;height:100%}.personal-composer-images button{border:1px solid var(--pw-line-strong);width:20px;height:20px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:50%;place-items:center;padding:0;display:grid;position:absolute;top:-5px;right:-5px;box-shadow:0 1px 4px #1e1c142e}.personal-composer-error{color:var(--pw-red);margin:0 0 7px;font-size:11.5px}.personal-context-drawer{grid-template-rows:auto minmax(0,1fr);height:100vh;display:grid}.personal-drawer-header{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:flex-start;min-height:84px;padding:20px 18px 16px;display:flex}.personal-drawer-header h2{letter-spacing:-.01em;margin:0;font-size:15.5px;font-weight:700}.personal-drawer-header p{color:var(--pw-faint);letter-spacing:.07em;text-transform:uppercase;margin:4px 0 0;font-size:11px;font-weight:650}.personal-drawer-close{flex:0 0 44px;width:44px;height:44px;margin-top:2px}.personal-drawer-body{padding:18px;overflow:auto}.personal-context-drawer[data-context-kind=todo]{background:#fbfbfc}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header{background:#fff;min-height:68px;padding:11px 22px}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header h2{font-size:14px}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header p{text-overflow:ellipsis;white-space:nowrap;max-width:330px;overflow:hidden}.personal-drawer-header-actions{align-items:center;gap:6px;display:flex}.personal-drawer-header-actions .personal-icon-button{flex:none}.personal-context-drawer[data-context-kind=todo] .personal-drawer-body{padding:0}.personal-task-inspector-summary{border-bottom:1px solid var(--pw-line);background:#fff;padding:24px 24px 20px}.personal-task-inspector-summary h3{letter-spacing:-.015em;overflow-wrap:anywhere;margin:14px 0 0;font-size:18px;font-weight:680;line-height:1.55}.personal-task-inspector-status{flex-wrap:wrap;align-items:center;gap:7px;display:flex}.personal-task-inspector-status>span{color:#62697a;background:#f1f2f5;border-radius:6px;align-items:center;gap:6px;min-height:24px;padding:2px 8px;font-size:11px;font-weight:650;display:inline-flex}.personal-task-inspector-status>span:first-child{padding-left:7px}.personal-task-inspector-status i{background:var(--pw-blue);border-radius:50%;width:7px;height:7px}.personal-task-inspector-status .is-done{background:var(--pw-green-bg);color:var(--pw-green)}.personal-task-inspector-status .is-done i{background:var(--pw-green)}.personal-task-inspector-status .is-blocked{background:var(--pw-red-bg);color:var(--pw-red)}.personal-task-inspector-status .is-blocked i{background:var(--pw-red)}.personal-task-inspector-fields{background:#fff;padding:20px 24px 22px}.personal-task-inspector-fields h4{color:var(--pw-text);margin:0 0 9px;font-size:12px;font-weight:700}.personal-task-inspector-fields dl{border-top:1px solid var(--pw-line);margin:0}.personal-task-inspector-fields dl div{border-bottom:1px solid var(--pw-line);grid-template-columns:92px minmax(0,1fr);gap:14px;min-height:44px;padding:11px 0;font-size:12px;line-height:1.55;display:grid}.personal-task-inspector-fields dt{color:var(--pw-muted)}.personal-task-inspector-fields dd{color:var(--pw-text);overflow-wrap:anywhere;margin:0}.personal-task-inspector-actions{border-top:1px solid var(--pw-line-strong);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fffffff5;grid-template-columns:auto minmax(170px,1fr);gap:10px;padding:13px 18px;display:grid;position:sticky;bottom:0;box-shadow:0 -8px 26px #1e284012}.personal-task-inspector-actions>.personal-primary-action{min-height:40px;margin:0}.personal-task-management{position:relative}.personal-task-management>summary{border:1px solid var(--pw-line-strong);min-width:128px;min-height:40px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:9px;justify-content:center;align-items:center;gap:7px;padding:0 14px;font-size:12px;font-weight:650;list-style:none;display:flex}.personal-task-management>summary::-webkit-details-marker{display:none}.personal-task-management[open]>summary{color:var(--pw-blue-ink);border-color:#9db3e9}.personal-task-management>div{border:1px solid var(--pw-line-strong);background:#fff;border-radius:12px;gap:9px;width:390px;padding:14px;display:grid;position:absolute;bottom:calc(100% + 9px);left:0;box-shadow:0 16px 38px #1e284029}.personal-task-management>div>strong{color:var(--pw-muted);font-size:10.5px;font-weight:650}.personal-task-management-secondary{border-top:1px solid var(--pw-line);grid-template-columns:1fr 1fr;gap:7px;padding-top:4px;display:grid}.personal-task-management-secondary button{border:1px solid var(--pw-line-strong);min-height:34px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:8px;font-size:11.5px}.personal-task-management-secondary button:hover{background:#f6f7fa}.personal-task-completed-note{background:var(--pw-green-bg);color:var(--pw-green);border:1px solid #cde4d8;border-radius:10px;align-items:center;gap:10px;margin:12px 24px 24px;padding:12px 14px;display:flex}.personal-task-completed-note>span{gap:2px;display:grid}.personal-task-completed-note strong{font-size:12px}.personal-task-completed-note small{color:#5d786c;font-size:10.5px}.personal-detail-card,.personal-correction-panel{border:1px solid var(--pw-line);background:#fff;border-radius:14px;padding:15px}.personal-proposal-card{background:#f5f8ff;border:1px solid #c3d3f9;border-radius:14px;padding:16px}.personal-proposal-card>small{color:#5270bd;letter-spacing:.05em;font-size:11px;font-weight:650}.personal-proposal-card h3{margin:8px 0;font-size:15.5px}.personal-proposal-card p{color:#5f6570;font-size:12px;line-height:1.55}.personal-proposal-card dl{gap:8px;margin:14px 0 0;display:grid}.personal-proposal-card dl div{grid-template-columns:82px minmax(0,1fr);gap:10px;font-size:11.5px;display:grid}.personal-proposal-card dt{color:var(--pw-faint)}.personal-proposal-card dd{overflow-wrap:anywhere;margin:0}.personal-context-drawer .personal-team-plan-result{border-color:var(--pw-line);background:var(--pw-card)}.personal-context-drawer .personal-team-plan-result h3{margin:0;font-size:18px;font-weight:600}.personal-context-drawer .personal-team-plan-result>p{color:var(--pw-muted);margin:16px 0 0;font-weight:400}.personal-team-plan-result .personal-team-plan-assignments{gap:16px;margin:20px 0}.personal-team-plan-result .personal-team-plan-assignments>div{grid-template-columns:minmax(0,1fr);gap:4px;font-size:13px}.personal-team-plan-result .personal-team-plan-assignments dt{color:var(--pw-muted);font-size:12px}.personal-team-plan-result .is-pending dd{color:var(--pw-muted)}.personal-team-plan-result details{border-top:1px solid var(--pw-line);margin-top:16px;padding-top:12px}.personal-team-plan-result summary{cursor:pointer;color:var(--pw-muted);font-size:12px}.personal-proposal-state{border-radius:9px;align-items:center;gap:7px;margin:10px 0 0;padding:10px 12px;font-size:11px;display:flex}.personal-proposal-state.is-applied{background:var(--pw-green-bg);color:var(--pw-green)}.personal-proposal-state.is-stale,.personal-proposal-state.is-error{background:var(--pw-red-bg);color:var(--pw-red)}.personal-proposal-state.is-gated{color:#825a00;background:#fff6df;gap:6px;display:grid}.personal-proposal-state.is-gated>span{gap:3px;display:grid}.personal-proposal-state.is-gated small{line-height:1.5}.personal-workspace-candidates{gap:8px;margin-top:10px;display:grid}.personal-workspace-candidates button{color:#263e76;cursor:pointer;text-align:left;background:#fff;border:1px solid #c3d3f9;border-radius:10px;gap:3px;min-height:48px;padding:9px 12px;display:grid}.personal-workspace-candidates small{color:var(--pw-muted)}.personal-detail-card.is-attention{background:#fffdf7;border-color:#f1d8ac}.personal-detail-card small{color:var(--pw-muted);font-size:11px}.personal-detail-card h3{margin:7px 0;font-size:14.5px;line-height:1.5}.personal-detail-card p,.personal-correction-panel p{color:var(--pw-muted);font-size:12px;line-height:1.55}.personal-detail-card dl{gap:9px;margin:14px 0 0;display:grid}.personal-detail-card dl div{grid-template-columns:74px minmax(0,1fr);gap:10px;font-size:12px;display:grid}.personal-detail-card dt{color:var(--pw-faint)}.personal-detail-card dd{overflow-wrap:anywhere;margin:0}.personal-run-drawer-tabs{background:#efefec;border-radius:11px;grid-template-columns:1fr 1fr;gap:4px;padding:4px;display:grid}.personal-run-drawer-tabs button{min-height:36px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;padding:0 8px;font-size:12px;font-weight:650}.personal-run-drawer-tabs button[aria-selected=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c141f}.personal-session-summary{margin-top:12px}.personal-session-message-record{margin-top:14px}.personal-session-message-record>h3{color:var(--pw-faint);letter-spacing:.06em;text-transform:uppercase;margin:0 0 10px;font-size:11px}.personal-session-message-record ol{gap:0;margin:0;padding:0;list-style:none;display:grid}.personal-session-message-record li{grid-template-columns:13px minmax(0,1fr);gap:9px;padding-bottom:15px;display:grid}.personal-session-message-record li>i,.personal-session-active-step>i{background:var(--pw-green);width:9px;height:9px;box-shadow:0 0 0 3px var(--pw-green-bg);border-radius:50%;margin-top:5px}.personal-session-message-record li.is-user>i{background:var(--pw-blue);box-shadow:0 0 0 3px var(--pw-blue-soft)}.personal-session-message-record li.is-error>i{background:var(--pw-red);box-shadow:0 0 0 3px var(--pw-red-bg)}.personal-session-message-record li>div{border-bottom:1px solid var(--pw-line);gap:5px;min-width:0;padding:0 0 15px;display:grid}.personal-session-message-record li header{justify-content:space-between;align-items:center;gap:8px;display:flex}.personal-session-message-record li strong{font-size:12px}.personal-session-message-record time{color:var(--pw-faint);font-size:10px}.personal-session-message-record li p{max-height:180px;color:var(--pw-muted);white-space:pre-wrap;margin:0;font-size:11.5px;line-height:1.6;overflow:auto}.personal-session-empty{border:1px dashed var(--pw-line-strong);color:var(--pw-muted);text-align:center;border-radius:10px;margin:0;padding:18px 12px;font-size:11.5px}.personal-session-active-step{grid-template-columns:13px minmax(0,1fr);align-items:start;gap:9px;padding-top:4px;display:grid}.personal-session-active-step>i{background:var(--pw-blue);box-shadow:0 0 0 3px var(--pw-blue-soft);animation:1.4s ease-in-out infinite personal-session-pulse}.personal-session-active-step>span{gap:3px;display:grid}.personal-session-active-step strong{font-size:12px}.personal-session-active-step small{color:var(--pw-muted);font-size:10.5px}@keyframes personal-session-pulse{50%{opacity:.35}}.personal-todo-actions{grid-template-columns:1fr 1fr;gap:8px;margin-top:12px;display:grid}.personal-todo-actions>button{margin-top:0}.personal-todo-actions-title{color:var(--pw-faint);letter-spacing:.06em;grid-column:1/-1;font-size:11px;font-weight:650}.personal-todo-actions .personal-primary-action,.personal-todo-actions .personal-compact-menu{grid-column:1/-1;margin-top:0}.personal-inline-agent-select{border:1px solid var(--pw-line);color:var(--pw-muted);border-radius:10px;grid-column:1/-1;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px;padding:8px;font-size:11px;display:grid}.personal-inline-agent-select select{border:1px solid var(--pw-line-strong);color:#333;background:#fff;border-radius:8px;min-width:0;min-height:36px;padding:0 8px}.personal-inline-agent-select .personal-secondary-action{width:auto;min-height:36px;margin:0;padding:0 12px}.personal-inline-resume-when input{border:1px solid var(--pw-line-strong);color:#333;background:#fff;border-radius:8px;min-width:0;min-height:36px;padding:0 8px}.personal-inline-resume-when small{color:var(--pw-faint);grid-column:2/-1}.personal-primary-action,.personal-secondary-action,.personal-danger-action{cursor:pointer;border-radius:11px;justify-content:center;align-items:center;gap:8px;width:100%;min-height:42px;margin-top:12px;font-size:13.5px;font-weight:650;display:flex}.personal-primary-action{border:1px solid var(--pw-blue);background:var(--pw-blue);color:#fff;box-shadow:0 2px 6px #2f66e947}.personal-primary-action:hover{background:var(--pw-blue-ink)}.personal-secondary-action{border:1px solid var(--pw-line-strong);color:var(--pw-text);background:#fff}.personal-secondary-action:hover{border-color:var(--pw-faint)}.personal-danger-action{color:var(--pw-red);background:#fff;border:1px solid #efd2cd}.personal-danger-action:hover{background:var(--pw-red-bg)}.personal-primary-action:disabled,.personal-secondary-action:disabled,.personal-danger-action:disabled{opacity:.46;cursor:default;box-shadow:none}.personal-drawer-action-grid{grid-template-columns:1fr 1fr;gap:8px;display:grid}.personal-correction-panel{margin-top:12px}.personal-correction-panel header{justify-content:space-between;align-items:center;display:flex}.personal-correction-panel header span{align-items:center;gap:7px;font-size:12px;font-weight:700;display:flex}.personal-correction-panel header button{color:var(--pw-muted);cursor:pointer;background:0 0;border:0}.personal-correction-composer{border:1px solid var(--pw-line-strong);border-radius:12px;position:relative;overflow:hidden}.personal-correction-composer:focus-within{border-color:var(--pw-blue)}.personal-correction-composer textarea{resize:vertical;width:100%;min-height:84px;font:inherit;border:0;outline:0;padding:10px 56px 10px 12px;font-size:12.5px}.personal-correction-composer button{border-radius:10px;width:34px;height:34px;position:absolute;bottom:6px;right:6px}.personal-recovery-panel{background:#fffaf0;border:1px solid #eccf94;border-radius:12px;margin-top:12px;padding:14px}.personal-recovery-panel>strong{font-size:13px}.personal-recovery-panel>p,.personal-preview-unavailable{color:var(--pw-muted);font-size:12px;line-height:1.5}.personal-compact-menu{margin-top:12px;position:relative}.personal-compact-menu>summary{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:11px;justify-content:center;align-items:center;gap:8px;min-height:42px;padding:0 12px;font-size:12.5px;font-weight:650;list-style:none;display:flex}.personal-compact-menu>summary::-webkit-details-marker{display:none}.personal-compact-menu[open]>summary{border-color:var(--pw-faint)}.personal-compact-menu>div{border:1px solid var(--pw-line);background:#fff;border-radius:11px;margin-top:6px;padding:6px;display:grid;box-shadow:0 8px 24px #1e1c141a}.personal-compact-menu>div button{min-height:40px;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;align-items:center;gap:8px;padding:0 10px;display:flex}.personal-compact-menu>div button:hover{background:#f5f4f1}.personal-compact-menu>div button:disabled{color:var(--pw-faint);cursor:default;opacity:.55}.personal-safe-preview{border:1px solid var(--pw-line);color:#333943;white-space:pre-wrap;overflow-wrap:anywhere;background:#f7f6f3;border-radius:11px;max-height:280px;margin:12px 0 0;padding:14px;font:12px/1.6 Geist Mono,SFMono-Regular,Consolas,monospace;overflow:auto}.personal-report-detail{border:1px solid var(--pw-line);background:#fff;border-radius:14px;margin-top:12px;padding:14px}.personal-report-detail>header{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;display:grid}.personal-report-detail>header span{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:10px;flex-direction:column;gap:2px;padding:10px;font-size:10px;font-weight:650;display:flex}.personal-report-detail>header strong{font-size:18px}.personal-report-detail>p{color:var(--pw-muted);margin:10px 0;font-size:11px}.personal-report-detail ol{gap:8px;margin:0;padding:0;list-style:none;display:grid}.personal-report-detail li{border:1px solid var(--pw-line);border-radius:10px;gap:4px;padding:10px;display:grid}.personal-report-detail li[data-change-kind=changed]{background:#fffaf0;border-color:#e8d3a5}.personal-report-detail li small{color:var(--pw-muted);text-transform:uppercase;font-size:10px}.personal-report-detail li strong{font-size:12px;line-height:1.45}.personal-report-detail li p{color:var(--pw-muted);margin:0;font-size:11px;line-height:1.5}.personal-report-detail>footer{color:var(--pw-faint);overflow-wrap:anywhere;gap:4px;margin-top:10px;font:10px/1.5 Geist Mono,SFMono-Regular,Consolas,monospace;display:grid}.personal-execution-history{margin-top:18px}.personal-execution-history h3{letter-spacing:.07em;text-transform:uppercase;color:var(--pw-faint);margin:0 0 10px;font-size:11.5px;font-weight:650}.personal-execution-history>p{color:var(--pw-muted);font-size:12px}.personal-execution-history ol{border-top:1px solid var(--pw-line);margin:0;padding:0;list-style:none}.personal-execution-history li{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:center;gap:12px;min-height:50px;display:flex}.personal-execution-history li>span{gap:3px;display:grid}.personal-execution-history li strong{font-size:12px}.personal-execution-history li small{color:var(--pw-muted);font-size:10px}.personal-execution-history li em{color:var(--pw-muted);font-size:10px;font-style:normal}.personal-execution-history li em.is-completed{color:var(--pw-green)}.personal-execution-history li em.is-failed{color:var(--pw-red)}.personal-mobile-back{display:none}.personal-message:not(.is-user)>div{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:4px 16px 16px;flex:1;min-width:0;padding:10px 14px}.personal-md{gap:8px;margin-top:5px;font-size:13.5px;line-height:1.7;display:grid}.personal-md p{white-space:normal;overflow-wrap:anywhere;margin:0}.personal-md-heading{letter-spacing:-.01em;font-weight:700}.personal-md-heading.is-h1{font-size:15.5px}.personal-md-heading.is-h2{font-size:14.5px}.personal-md-heading.is-h3,.personal-md-heading.is-h4{font-size:13.5px}.personal-md-list{gap:4px;margin:0;padding-left:20px;display:grid}.personal-md ul.personal-md-list{list-style-type:disc}.personal-md ol.personal-md-list{list-style-type:decimal}.personal-md-list li{overflow-wrap:anywhere;padding-left:2px}.personal-md-list li::marker{color:var(--pw-faint)}.personal-md-code{border:1px solid var(--pw-line);overflow-wrap:anywhere;background:#f5f4f1;border-radius:6px;padding:1px 5px;font:12px/1.5 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-md-pre{border:1px solid var(--pw-line);background:#f7f6f3;border-radius:11px;margin:0;padding:12px 14px;overflow-x:auto}.personal-md-pre code{color:#333943;white-space:pre;font:12px/1.65 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-md-link{color:var(--pw-blue-ink);border-bottom:1px solid #c3d3f9;text-decoration:none}.personal-md-link:hover{border-bottom-color:var(--pw-blue-ink)}.personal-agent-persona-head{align-items:center;gap:12px;display:flex}.personal-agent-avatar{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:14px;flex:0 0 46px;place-items:center;height:46px;font-size:19px;font-weight:700;display:grid;box-shadow:0 2px 8px #2f66e942}.personal-agent-persona-id{flex:1;min-width:0}.personal-agent-persona-id h3{margin:0}.personal-agent-persona-id p{margin:2px 0 0}.personal-agent-health{border-radius:99px;flex:none;padding:2.5px 10px;font-size:11px;font-weight:650}.personal-agent-health.is-ok{background:var(--pw-green-bg);color:var(--pw-green)}.personal-agent-health.is-off,.personal-row-status.is-blocking{background:var(--pw-red-bg);color:var(--pw-red)}.personal-row-status.is-pending{background:var(--pw-amber-bg);color:var(--pw-amber)}.personal-row-status.is-failed{background:var(--pw-red-bg);color:var(--pw-red)}.personal-row-status.is-completed{background:var(--pw-green-bg);color:var(--pw-green)}.personal-row-status.is-queued,.personal-row-status.is-waiting,.personal-row-status.is-interrupted{color:var(--pw-muted);background:#f2f1ed}.personal-diagnostics-trigger{border:0;border-top:1px solid var(--pw-line);width:100%;color:var(--pw-muted);cursor:pointer;background:0 0;justify-content:space-between;align-items:center;margin-top:18px;padding:12px 0;font-size:12.5px;display:flex}.personal-diagnostics-trigger svg{transition:transform .16s}.personal-diagnostics-trigger svg.is-open{transform:rotate(180deg)}.personal-diagnostics{color:var(--pw-muted);overflow-wrap:anywhere;background:#f5f4f1;border-radius:10px;gap:7px;padding:12px;font-size:10.5px;display:grid}.personal-copy-feedback{color:var(--pw-green);margin:7px 0 0;font-size:11px}.personal-copy-feedback.is-error{color:var(--pw-red)}@media (width<=1300px){.personal-workspace-shell.has-drawer .personal-live-indicator{display:none}.personal-workspace-shell.has-drawer .personal-channel-title p{max-width:260px}.personal-home-lanes{grid-template-columns:repeat(2,minmax(190px,1fr))}}@media (width<=1100px){.personal-machine-layout{grid-template-columns:1fr;gap:14px}.personal-machine-namespaces nav{overscroll-behavior-x:contain;scroll-snap-type:x proximity;display:flex;overflow-x:auto}.personal-machine-namespaces button{scroll-snap-align:start;flex:0 0 180px}.personal-machine-summary{flex-wrap:wrap;align-items:flex-start}.personal-machine-editor-bar{flex-direction:column;align-items:stretch}.personal-machine-editor-mode{width:100%}.personal-machine-editor-mode button{flex:1 1 0}.personal-machine-editor fieldset{grid-template-columns:1fr}.personal-machine-editor fieldset label:last-child{grid-column:auto}.personal-machine-preview dl{grid-template-columns:1fr}}@media (width<=1050px){.personal-workspace-shell,.personal-workspace-shell.has-drawer{grid-template-columns:minmax(0,1fr)}.personal-workspace-sidebar{z-index:40;width:min(310px,86vw);display:none;position:fixed;inset:0 auto 0 0;box-shadow:18px 0 50px #1e1c1429}.personal-workspace-shell.mobile-sidebar-open .personal-workspace-sidebar{display:block}.personal-sidebar-backdrop{z-index:35;cursor:default;background:#14182047;border:0;display:block;position:fixed;inset:0}.personal-icon-button.personal-mobile-menu{flex:0 0 36px;display:inline-grid}.personal-workspace-drawer{z-index:30;width:min(410px,90vw);position:fixed;inset:0 0 0 auto}.personal-workspace-drawer[data-drawer-mode=inspector],.personal-workspace-drawer[data-drawer-mode=inspector-full]{width:min(520px,92vw);position:fixed;inset:0 0 0 auto;box-shadow:-18px 0 44px #1e284024}.personal-run-row{grid-template-columns:36px minmax(0,1fr) auto 16px}.personal-run-identity,.personal-run-progress{display:none}.personal-home-lanes{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (width<=720px){.personal-workspace-shell,.personal-workspace-shell.has-drawer{grid-template-columns:1fr}.personal-workspace-shell,.personal-workspace-main,.personal-channel{width:100%;max-width:100vw;overflow-x:hidden}.personal-workspace-sidebar{z-index:40;width:min(310px,86vw);display:none;position:fixed;inset:0 auto 0 0;box-shadow:18px 0 50px #1e1c1429}.personal-workspace-shell.mobile-sidebar-open .personal-workspace-sidebar{display:block}.personal-icon-button.personal-mobile-menu{flex:0 0 36px;display:inline-grid}.personal-channel-header{grid-template-columns:36px minmax(0,1fr) auto;gap:10px;min-height:60px;padding:10px 14px;display:grid}.personal-channel-title p{display:none}.personal-channel-title p.personal-manager-execution{display:flex}.personal-channel-actions{min-width:0}.personal-agent-select{min-width:0;max-width:132px}.personal-channel-actions>.personal-icon-button{display:none}.personal-goal-tabs{order:4;grid-column:1/-1;align-self:auto;margin-left:0;overflow-x:auto}.personal-channel-actions .personal-live-indicator{display:none}.personal-channel-scroll,.personal-composer-wrap{padding-left:14px;padding-right:14px}.personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-board){overflow-y:auto}.personal-task-board{height:auto;min-height:100%}.personal-task-kanban,.personal-workspace-shell.has-drawer .personal-task-kanban,.personal-workspace-shell.has-task-inspector .personal-task-kanban{grid-template-columns:minmax(0,1fr);width:100%;height:auto}.personal-task-kanban .personal-object-list{min-height:auto}.personal-task-lane-scroll,.personal-task-lane-scroll.has-overflow-before,.personal-task-lane-scroll.has-overflow-after{min-height:auto;box-shadow:none;scrollbar-gutter:auto;flex:none;padding-right:8px;overflow:visible}.personal-quick-prompts{flex-wrap:nowrap;overflow-x:auto}.personal-quick-prompts button{flex:none;min-height:36px}.personal-manager-conversation-tray>header{flex-wrap:wrap;align-items:flex-start}.personal-manager-conversation-actions{justify-content:flex-end;width:100%}.personal-manager-conversation-messages article{grid-template-columns:minmax(0,1fr);gap:4px}.personal-timeline-row,.personal-output-row{grid-template-columns:34px minmax(0,1fr) 14px;gap:9px;padding:10px 12px}.personal-timeline-row>time,.personal-timeline-row>.personal-row-status,.personal-timeline-row .personal-priority-dot{display:none}.personal-channel-composer{grid-template-columns:40px 36px minmax(0,1fr) 40px}.personal-task-chat-receipt{grid-template-columns:32px minmax(0,1fr);padding:11px}.personal-task-lane-filter{flex-direction:column;align-items:stretch;gap:8px}.personal-task-lane-filter label,.personal-task-lane-filter select{width:100%;max-width:none}.personal-capability-layout,.personal-capability-value-grid,.personal-capability-fields,.personal-capability-linked-setting{grid-template-columns:minmax(0,1fr)}.personal-capability-linked-setting .personal-notification-toggle{justify-self:start}.personal-capability-layout{grid-template-rows:auto minmax(0,1fr)}.personal-capability-list{min-width:0;max-height:90px;padding:3px;display:flex;overflow-x:auto}.personal-capability-list button{flex:0 0 180px}.personal-task-chat-icon{width:32px;height:32px}.personal-task-chat-receipt footer{grid-column:1/-1;justify-content:flex-end}.personal-channel-composer>span{justify-content:center;min-width:0;padding:0;font-size:0}.personal-composer-wrap{max-width:100vw}.personal-workspace-drawer,.personal-workspace-drawer[data-drawer-mode=inspector],.personal-workspace-drawer[data-drawer-mode=inspector-full]{width:100vw}.personal-inspector-size{display:none!important}.personal-context-drawer{height:100dvh}.personal-drawer-body{padding-bottom:max(18px, env(safe-area-inset-bottom))}.personal-composer-wrap{padding-bottom:max(16px, env(safe-area-inset-bottom))}.personal-mobile-back{display:block}.personal-desktop-close{display:none}.personal-goal-tabs button{min-height:34px}.personal-correction-composer{padding-bottom:2px}.personal-correction-composer textarea{min-height:84px;padding-right:56px;padding-bottom:max(14px, env(safe-area-inset-bottom))}.personal-correction-composer button{width:40px;height:40px}.personal-todo-actions{grid-template-columns:1fr}.personal-task-management>div{width:calc(100vw - 28px)}.personal-home-lanes{grid-template-columns:1fr}.personal-home-lane{min-height:0}.personal-session-record,.personal-session-record dl{grid-template-columns:1fr}.personal-session-record>.personal-secondary-action{grid-area:auto/1}.personal-settings-page{grid-template-rows:auto minmax(0,1fr);grid-template-columns:minmax(0,1fr)}.personal-settings-sidebar{border-right:0;border-bottom:1px solid var(--pw-line);gap:10px;height:auto;max-height:30dvh;padding:12px 14px;position:static;overflow:auto}.personal-settings-title{display:none}.personal-settings-tabs{display:flex;overflow-x:auto}.personal-settings-tabs button{flex:0 0 180px}.personal-settings-body{padding:20px 14px}.personal-settings-header{align-items:center;gap:14px}.personal-settings-header h1{font-size:24px}.personal-machine-layout{grid-template-columns:1fr;gap:14px}.personal-machine-namespaces nav{overscroll-behavior-x:contain;scroll-snap-type:x proximity;display:flex;overflow-x:auto}.personal-machine-namespaces button{scroll-snap-align:start;flex:0 0 180px}.personal-machine-summary{align-items:flex-start}.personal-machine-editor-bar{flex-direction:column;align-items:stretch}.personal-machine-editor-mode{width:100%}.personal-machine-editor-mode button{flex:1 1 0}.personal-machine-summary dl{flex-direction:column;gap:8px}.personal-machine-editor fieldset{grid-template-columns:1fr}.personal-machine-editor fieldset label:last-child{grid-column:auto}.personal-machine-preview dl{grid-template-columns:1fr}.personal-machine-rollback{flex-direction:column;align-items:stretch}.personal-machine-rollback .personal-secondary-action{width:100%}.personal-lark-settings.is-embedded .personal-lark-tabs{overflow-x:auto}.personal-lark-settings.is-embedded .personal-lark-tabs button{flex:none}}@media (prefers-reduced-motion:reduce){.personal-timeline-row,.personal-diagnostics-trigger svg,.personal-workspace-sidebar,.personal-stopped-goals>summary>svg:first-child,.personal-subagent-switch>span,.personal-subagent-switch>span:after{transition:none}.personal-goal-lifecycle.is-pending svg,.personal-spin{animation:none}}.personal-workspace-shell[data-pw-theme=loopx],.personal-settings-page[data-pw-theme=loopx]{--pw-bg:#fafafa;--pw-card:#fff;--pw-line:#ebebeb;--pw-line-strong:#dedede;--pw-muted:#6b6b6b;--pw-faint:#8f8f8f;--pw-text:#171717;--pw-blue:#0070f3;--pw-blue-ink:#0060d1;--pw-blue-soft:#edf6ff;--pw-amber:#9a6200;--pw-amber-bg:#fff7df;--pw-red:#d90000;--pw-red-bg:#fff0f0;--pw-green:#197342;--pw-green-bg:#edf9f1;font-family:Geist Variable,Geist,Inter,Helvetica Neue,Arial,PingFang SC,Microsoft YaHei,sans-serif}.personal-workspace-shell[data-pw-theme=loopx] .personal-workspace-sidebar,.personal-settings-page[data-pw-theme=loopx] .personal-settings-sidebar{background:#fff}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-header{box-shadow:none;background:#fafafaf0}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-title h1{letter-spacing:0;font-size:20px;font-weight:600;line-height:28px}.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-section-title{letter-spacing:0;font-size:12px;font-weight:500;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link-copy strong,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane>header span,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card>strong{font-size:14px;font-weight:600;line-height:20px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link-copy small,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane>p,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card>p{font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-select-trigger,.personal-workspace-shell[data-pw-theme=loopx] .personal-select-option{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-workspace-drawer{box-shadow:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-brand-mark{box-shadow:none;background:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-icon{color:#171717;background:#f2f2f2;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-greeting>span{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-utility,.personal-settings-page[data-pw-theme=loopx] .personal-settings-back,.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-utility:hover,.personal-settings-page[data-pw-theme=loopx] .personal-settings-back:hover,.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button:hover{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link[aria-current=page],.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link[aria-current=page],.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button[aria-current=page]{box-shadow:none;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes{background:#f2f2f2;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes button{border-radius:4px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page],.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes button[aria-selected=true]{box-shadow:0 1px 2px #0000000f}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs{background:0 0;border-radius:0;align-self:stretch;gap:20px;padding:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button{border-radius:0;min-height:46px;padding:0 1px;font-size:12px;font-weight:500;position:relative}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page]{box-shadow:none;color:#171717;background:0 0}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page]:after{content:"";background:#171717;height:2px;position:absolute;bottom:-1px;left:0;right:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-count{color:#4d4d4d;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-state-dot,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-row:nth-child(n) .personal-goal-state-dot{background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-agent-select .personal-select-trigger,.personal-workspace-shell[data-pw-theme=loopx] .personal-read-only-source,.personal-workspace-shell[data-pw-theme=loopx] .personal-icon-button,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-select .personal-select-trigger,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action,.personal-settings-page[data-pw-theme=loopx] .personal-secondary-action{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane,.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row,.personal-workspace-shell[data-pw-theme=loopx] .personal-detail-card,.personal-settings-page[data-pw-theme=loopx] .personal-detail-card,.personal-settings-page[data-pw-theme=loopx] .personal-settings-card,.personal-settings-page[data-pw-theme=loopx] .personal-lark-app-card,.personal-settings-page[data-pw-theme=loopx] .personal-lark-table,.personal-settings-page[data-pw-theme=loopx] .personal-lark-topic-panel{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lanes{border-block:1px solid #ebebeb;gap:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane{border:0;background:0 0;border-left:1px solid #ebebeb;border-radius:0;min-height:260px;padding:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane:first-child{border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card{box-shadow:none;border-radius:12px;transform:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card:hover{box-shadow:none;border-color:#a1a1a1;transform:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-timeline{gap:8px}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row,.personal-workspace-shell[data-pw-theme=loopx] .personal-schedule-row{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-schedule-row:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-row-icon{color:#4d4d4d;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-run-open-label{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-run-progress b{background:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-message.is-user{background:#f2f2f2;border-color:#dedede;border-radius:12px 12px 4px;padding:10px 12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message-avatar{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message:not(.is-user)>div{box-shadow:none;border-radius:4px 12px 12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message p,.personal-workspace-shell[data-pw-theme=loopx] .personal-md{font-size:13px;line-height:1.65}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-empty>span{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row{box-shadow:none;background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row>span:first-child{color:#171717;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row small,.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row>b{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record{background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record>header span{color:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record dl div{background:#fafafa;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt{box-shadow:none;background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-icon{color:#171717;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt footer button{color:#171717;border-color:#dedede;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt footer button:hover{background:#f2f2f2;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban{border-block:1px solid #ebebeb;gap:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list{border:0;background:0 0;border-left:1px solid #ebebeb;border-radius:0;gap:8px;padding:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list:first-child{border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>header{padding:4px 2px 8px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>header>strong{font-size:12px;font-weight:600}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-lane-scroll>button>strong,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button>strong{overflow-wrap:anywhere;font-size:14px;font-weight:500;line-height:20px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button>small,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button>small{color:#6b6b6b;font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card.is-selected>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button.is-selected{background:#fff;border-color:#171717;box-shadow:0 0 0 1px #171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card.is-selected:before{background:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card-actions button{box-shadow:none;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card-actions .personal-task-session-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-session-status{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-empty{border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>header{letter-spacing:0;min-height:44px;padding:8px 14px;font-weight:500}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button{min-height:58px;padding:10px 14px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button:hover{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-file-icon{color:#4d4d4d;background:#fafafa;border:1px solid #ebebeb;border-radius:6px;place-items:center;width:28px;height:28px;display:grid}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>strong{font-size:13px;font-weight:600}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>p,.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>small{font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-primary-action,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action{box-shadow:none;background:#171717;border-color:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-primary-action:hover,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action:hover{background:#333;border-color:#333}.personal-workspace-shell[data-pw-theme=loopx] .personal-md-code,.personal-workspace-shell[data-pw-theme=loopx] .personal-safe-preview,.personal-workspace-shell[data-pw-theme=loopx] .personal-diagnostics{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-md-pre{color:#fafafa;background:#171717;border:1px solid #242424}.personal-workspace-shell[data-pw-theme=loopx] .personal-digest-card{background:#fff;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-action-feedback{color:#171717;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button{color:#171717;box-shadow:none;background:#fff;border-color:#dedede;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button:hover{color:#171717;box-shadow:none;background:#f2f2f2;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-draft-status{color:#6b6b6b;background:#f2f2f2;border-color:#dedede;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-draft-status strong{color:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer{box-shadow:none;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer:focus-within{border-color:#0070f3;box-shadow:0 0 0 2px #0070f31f}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-correction-composer button{box-shadow:none;background:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-correction-composer button:hover{background:#333}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>.personal-composer-attach{color:#6b6b6b;background:0 0}.personal-settings-theme-swatch.is-loopx{background:linear-gradient(135deg,#171717 0 48%,#fafafa 48% 78%,#fff 78%)}.personal-settings-page[data-pw-theme=loopx] .personal-settings-header small,.personal-settings-page[data-pw-theme=loopx] .personal-lark-header small,.personal-settings-page[data-pw-theme=loopx] .personal-lark-section-heading small{color:#0070f3;font-family:Geist Mono Variable,Geist Mono,JetBrains Mono,SFMono-Regular,monospace;font-weight:500}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button{box-shadow:none;border-radius:12px}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button:hover{box-shadow:none;border-color:#c8c8c8}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button[aria-checked=true]{background:#fff;border-color:#171717;box-shadow:0 0 0 1px #171717}@media (width<=720px){.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list{border-top:1px solid #ebebeb;border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane:first-child,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list:first-child{border-top:0}}.personal-workspace-shell[data-pw-theme=brutal],.personal-settings-page[data-pw-theme=brutal]{--pw-bg:#fdf8e7;--pw-card:#fff;--pw-line:#141414;--pw-line-strong:#141414;--pw-muted:#3f3f3f;--pw-faint:#666;--pw-text:#141414;--pw-blue:#141414;--pw-blue-ink:#141414;--pw-blue-soft:#ffe23f;--pw-amber:#141414;--pw-amber-bg:#ffd23f;--pw-red:#141414;--pw-red-bg:#ff9d8a;--pw-green:#141414;--pw-green-bg:#8fe6a4}.personal-workspace-shell[data-pw-theme=brutal] :focus-visible:not(textarea):not(input),.personal-settings-page[data-pw-theme=brutal] :focus-visible:not(textarea):not(input){outline-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-workspace-sidebar{background:#ffd91a;border-right:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-brand{border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-brand-mark{color:#ffd91a;box-shadow:none;background:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-icon{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-link:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-link:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-utility:hover{background:#ffffff8c}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-link[aria-current=page],.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-link[aria-current=page]{background:#ff8fd0;border:2px solid #141414;border-radius:4px;font-weight:700;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-count{color:#141414;background:#fff;border:2px solid #141414;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-section-title{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-title-actions button:hover{box-shadow:none;background:#fff;border:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-footer{border-top:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-sidebar{background:#ffd91a;border-right:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-title{border-bottom:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-title small,.personal-settings-page[data-pw-theme=brutal] .personal-settings-header small,.personal-settings-page[data-pw-theme=brutal] .personal-settings-back,.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button{color:#141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-back:hover,.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button:hover{background:#ffffff8c}.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button[aria-current=page]{color:#141414;background:#ff8fd0;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-detail-card,.personal-settings-page[data-pw-theme=brutal] .personal-machine-editor,.personal-settings-page[data-pw-theme=brutal] .personal-machine-summary,.personal-settings-page[data-pw-theme=brutal] .personal-lark-app-card,.personal-settings-page[data-pw-theme=brutal] .personal-lark-table,.personal-settings-page[data-pw-theme=brutal] .personal-lark-topic-panel{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-machine-namespaces button[aria-current=page],.personal-settings-page[data-pw-theme=brutal] .personal-machine-preview,.personal-settings-page[data-pw-theme=brutal] .personal-machine-scope-note,.personal-settings-page[data-pw-theme=brutal] .personal-machine-rollback{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button:hover{background:#fff8d6;border-color:#141414;transform:translate(-1px,-1px);box-shadow:4px 4px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button[aria-checked=true]{background:#ffe23f;border-color:#141414;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-primary-action,.personal-settings-page[data-pw-theme=brutal] .personal-secondary-action,.personal-settings-page[data-pw-theme=brutal] .personal-lark-toolbar label{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-primary-action{background:#ffe23f}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs{border-bottom:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs button[aria-current=page]{color:#141414;border-color:#141414}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs span,.personal-settings-page[data-pw-theme=brutal] .personal-lark-app-card em,.personal-settings-page[data-pw-theme=brutal] .personal-connection-status{color:#141414;background:#ffe23f;border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-header{background:#fdf8e7;border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs{background:0 0;gap:6px;padding:0}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs button{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs button[aria-current=page]{background:#ffe23f;font-weight:700;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-agent-select .personal-select-trigger,.personal-workspace-shell[data-pw-theme=brutal] .personal-icon-button{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-live-indicator i{border:1.5px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-message.is-user{background:#8fdcff;border:2px solid #141414;border-radius:8px 8px 2px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-message-avatar{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-pre{color:#fdf8e7;background:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-code{color:#141414;background:#ffe23f;border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-link{color:#141414;text-decoration-thickness:2px}.personal-workspace-shell[data-pw-theme=brutal] .personal-object-list{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-object-list>button:hover{background:#fff8d6}.personal-workspace-shell[data-pw-theme=brutal] .personal-row-status{border:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list{background:#fff}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list>header{background:#fff;border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-lane-scroll>button,.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-card>button{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-lane-scroll>button:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-card:hover>button{background:#fff;border-color:#141414;transform:translate(-1px,-1px);box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list>header>span{color:#fff;background:#141414;border-radius:3px;padding:1px 7px}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot{border:2px solid #141414;border-radius:2px;width:10px;height:10px}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-attention{background:#ff9d5c}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-progress{background:#35c5f0}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-schedule{background:#b49bf0}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-done{background:#7ddb8a}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-empty{border:2px dashed #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-card-actions button{color:#141414;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-composer-wrap{background:linear-gradient(transparent, var(--pw-bg) 22%)}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-banner{color:#141414;background:#fee2e2;border:2px solid #141414;border-radius:6px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-header{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-header small{color:#555}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-issues{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray{background:#fff;border:2px solid #141414;border-radius:6px;box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray:focus-within{border-color:#141414;box-shadow:5px 5px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-btn{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-btn:hover{background:#ffd91a}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-link{color:#141414;text-decoration:underline}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-close{color:#141414;border:1.5px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-messages article{background:#fdf8e7;border:1.5px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-messages article.is-user{background:#8fdcff}.personal-workspace-shell[data-pw-theme=brutal] .personal-quick-prompts button{color:#141414;background:#fff;border:2px solid #141414;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-quick-prompts button:hover{color:#141414;background:#ffe23f;border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer{border:2px solid #141414;border-radius:6px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer:focus-within{border-color:#141414;box-shadow:5px 5px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer textarea{border-left:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>button,.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>.personal-composer-attach,.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer button{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>button:hover{background:#ffd91a;transform:translate(1px,1px);box-shadow:1px 1px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer{border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer:focus-within{border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-workspace-drawer{box-shadow:none;border-left:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-detail-card,.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-panel{border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-detail-card.is-attention{background:#fff3c9;border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-primary-action{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-primary-action:hover{background:#ffd91a;transform:translate(1px,1px);box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-secondary-action{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-secondary-action:hover{border-color:#141414;transform:translate(1px,1px);box-shadow:1px 1px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-danger-action{color:#141414;background:#ff9d8a;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>summary{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>div{border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>div button:hover{background:#fff8d6}.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-agent-select{border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-agent-select select,.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-resume-when input,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-fields input:not([type=checkbox]),.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-fields select,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-domain-option,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-preview{color:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch{background:#fff;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch[aria-checked=true]{background:#baf2c7}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch>span{background:#777}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch[aria-checked=true]>span{background:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-preview{background:#fff3c9;box-shadow:2px 2px #141414}.personal-digest-card{border:1px solid var(--pw-line);background:linear-gradient(135deg,#fff,#fbf7ee);border-radius:14px;justify-content:space-between;align-items:center;gap:14px;margin-bottom:12px;padding:13px 16px;display:flex}.personal-digest-card>strong{letter-spacing:.01em;font-size:13px}.personal-digest-stats{gap:8px;display:flex}.personal-digest-stats span{border:1px solid var(--pw-line-strong);color:var(--pw-muted);background:#fff;border-radius:99px;align-items:baseline;gap:6px;padding:6px 13px;font-size:12px;display:inline-flex}.personal-digest-stats b{color:var(--pw-text);font-size:14px}.personal-composer-hint{color:var(--pw-faint);margin:0 0 8px;font-size:11.5px}.personal-priority-badge{color:var(--pw-muted);background:#f2f1ed;border-radius:6px;padding:1px 7px;font-size:10.5px;font-weight:700}.personal-priority-badge.is-p0{background:var(--pw-red-bg);color:var(--pw-red)}.personal-priority-badge.is-p1{background:var(--pw-amber-bg);color:var(--pw-amber)}.personal-priority-badge.is-blocked{background:var(--pw-red-bg);color:var(--pw-red)}.personal-workspace-shell[data-pw-theme=brutal] .personal-digest-card{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-digest-stats span{color:#141414;border:2px solid #141414;border-radius:99px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-priority-badge{border:1.5px solid #141414;border-radius:3px}.personal-goal-notification code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);word-break:break-all;border-radius:5px;padding:1px 5px;font-size:11px}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-notification code{background:#fff;border:1.5px solid #141414;border-radius:3px}.personal-proposal-state.is-error:has(small){align-items:start;gap:4px;display:grid}.personal-proposal-state.is-error small{word-break:break-all;line-height:1.5}.personal-gate-cli-hint{gap:6px;margin-top:10px;display:grid}.personal-gate-cli-hint code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);-webkit-user-select:all;user-select:all;word-break:break-all;border-radius:7px;padding:8px 10px;font-size:11.5px;line-height:1.5;display:block}.personal-gate-cli-hint small{color:var(--pw-muted);line-height:1.5}.personal-notification-list{gap:0;margin:12px 0 0;padding:0;list-style:none;display:grid}.personal-notification-row{border-top:1px solid var(--pw-line);gap:8px;padding:12px 0;display:grid}.personal-notification-row:first-child{border-top:0;padding-top:4px}.personal-notification-row-head{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-notification-row-head strong{font-size:13px}.personal-notification-badge{border-radius:99px;flex:none;padding:2px 8px;font-size:11px;font-weight:650}.personal-notification-badge.is-on{background:var(--pw-green-bg);color:var(--pw-green)}.personal-notification-badge.is-off{background:var(--pw-bg,#f5f4ef);color:var(--pw-muted)}.personal-notification-meta{color:var(--pw-muted);flex-wrap:wrap;gap:4px 12px;font-size:11.5px;display:flex}.personal-notification-toggle{color:var(--pw-text);cursor:pointer;align-items:center;gap:8px;font-size:12.5px;display:flex}.personal-notification-toggle input{accent-color:var(--pw-blue);cursor:pointer;width:15px;height:15px}.personal-notification-bind{gap:8px;display:flex}.personal-notification-bind select{border:1px solid var(--pw-line-strong);min-width:0;height:34px;color:var(--pw-text);background:#fff;border-radius:8px;flex:1;padding:0 10px;font-size:12.5px}.personal-notification-bind .personal-secondary-action{flex:none}.personal-notification-confirm{border:1px solid var(--pw-line);background:var(--pw-bg,#faf9f5);border-radius:9px;gap:8px;padding:10px 12px;display:grid}.personal-notification-confirm p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-notification-actions{gap:8px;display:flex}.personal-notification-error{color:var(--pw-red);margin:0;font-size:12px;line-height:1.5}.personal-notification-hint{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-notification-hint code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);-webkit-user-select:all;user-select:all;border-radius:5px;margin-top:4px;padding:2px 7px;font-size:11px;display:inline-block}.is-spinning{animation:.9s linear infinite personal-notification-spin}@keyframes personal-notification-spin{to{transform:rotate(360deg)}}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-badge{border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-bind select{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-confirm{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-settings-card{border:2px solid #141414;border-radius:4px;box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-settings-icon{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-language-options>button{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-language-options>button.is-selected{color:#141414;background:#8fdcff}@media (width<=720px){.personal-lark-settings{padding:20px 16px calc(24px + env(safe-area-inset-bottom))}.personal-lark-header h1{font-size:24px}.personal-lark-tabs{gap:18px;margin-top:20px}.personal-settings-card>header,.personal-language-options{padding-left:15px;padding-right:15px}}.personal-goal-acceptance h4{margin:16px 0 8px;font-size:14px}.personal-goal-acceptance .personal-acceptance-observation{border-top:1px solid var(--color-border,#ebebeb);padding:8px 0}.personal-goal-acceptance dd,.personal-goal-acceptance p{overflow-wrap:anywhere}.personal-goal-acceptance details{margin-top:16px}.personal-channel-scroll[data-active-goal-view=overview]{padding-inline:max(24px,50% - 560px)}.personal-channel-header[data-goal-selected=true]{grid-template-columns:auto minmax(0,1fr) auto;gap:4px 16px;padding-block:12px 0;display:grid}.personal-channel-header[data-goal-selected=true] .personal-channel-title{grid-area:1/1/auto/3}.personal-channel-header[data-goal-selected=true] .personal-channel-title h1{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.personal-channel-header[data-goal-selected=true] .personal-channel-actions{grid-area:1/3}.personal-goal-navigation{grid-area:2/1/auto/-1;justify-content:space-between;align-items:center;gap:16px;min-width:0;display:flex}.personal-channel-header[data-goal-selected=true] .personal-goal-tabs{order:0;margin-left:0;overflow:visible}.personal-channel-actions>.personal-goal-settings-action{justify-content:center;align-items:center;min-width:44px;min-height:44px;display:inline-flex}@media (width<=1050px){.personal-channel-header[data-goal-selected=true] .personal-mobile-menu{grid-area:1/1}.personal-channel-header[data-goal-selected=true] .personal-channel-title{grid-column:2}}@media (width<=720px){.personal-channel-header[data-goal-selected=true]{gap:4px 8px}.personal-goal-navigation{gap:12px}.personal-goal-navigation .personal-agent-select{max-width:132px}.personal-goal-navigation .personal-select-value>small{display:none}.personal-channel-header[data-goal-selected=true] .personal-goal-tabs{gap:8px}.personal-goal-navigation .personal-goal-tabs button{min-width:44px;padding-inline:0}.personal-goal-navigation .personal-read-only-source{max-width:132px}.personal-channel-scroll[data-active-goal-view=overview]{padding-inline:14px}}.benchmark-page{--benchmark-ink:#171717;--benchmark-body:#4d4d4d;--benchmark-muted:#767676;--benchmark-canvas:#fafafa;--benchmark-surface:#fff;--benchmark-soft:#f2f2f2;--benchmark-border:#e5e5e5;--benchmark-link:#0068d7;width:100%;max-width:100vw;min-height:100vh;color:var(--benchmark-ink);background:var(--benchmark-canvas);font-family:Geist,Inter,Helvetica Neue,Arial,sans-serif;overflow-x:clip}.benchmark-page,.benchmark-page *{box-sizing:border-box}.benchmark-hero{border-bottom:1px solid var(--benchmark-border);background:var(--benchmark-surface);padding:24px max(24px,50vw - 600px)}.benchmark-hero-topline,.benchmark-title-row,.benchmark-card-heading,.benchmark-footer>div{align-items:center;display:flex}.benchmark-hero-topline{justify-content:space-between;margin-bottom:64px}.benchmark-wordmark{color:var(--benchmark-ink);letter-spacing:-.04em;font-weight:650;text-decoration:none}.benchmark-readonly{color:var(--benchmark-muted);align-items:center;gap:8px;font-size:12px;display:inline-flex}.benchmark-hero-grid{grid-template-columns:minmax(0,1.5fr) minmax(260px,.5fr);align-items:end;gap:64px;display:grid}.benchmark-kicker,.benchmark-mono{color:var(--benchmark-muted);letter-spacing:.08em;text-transform:uppercase;margin:0 0 8px;font:500 11px/16px Geist Mono,JetBrains Mono,monospace}.benchmark-title-row{align-items:baseline;gap:16px}.benchmark-title-row h1{letter-spacing:-.05em;max-width:780px;margin:0;font-size:clamp(32px,4.5vw,48px);font-weight:600;line-height:1}.benchmark-lead{max-width:680px;color:var(--benchmark-body);margin:20px 0 0;font-size:16px;line-height:24px}.benchmark-identity,.benchmark-stat-list{margin:0}.benchmark-identity>div{border-top:1px solid var(--benchmark-border);grid-template-columns:80px minmax(0,1fr);gap:16px;padding:10px 0;display:grid}.benchmark-identity dt,.benchmark-stat-list dt{color:var(--benchmark-muted);font-size:12px}.benchmark-identity dd{text-overflow:ellipsis;white-space:nowrap;margin:0;font:500 12px/18px Geist Mono,monospace;overflow:hidden}.benchmark-kpi-grid{border:1px solid var(--benchmark-border);border-radius:12px;grid-template-columns:repeat(4,minmax(0,1fr));margin-top:64px;display:grid;overflow:hidden}.benchmark-kpi-grid article{border-right:1px solid var(--benchmark-border);min-width:0;padding:20px 24px}.benchmark-kpi-grid article:last-child{border-right:0}.benchmark-kpi-grid svg{color:var(--benchmark-muted)}.benchmark-kpi-grid span{color:var(--benchmark-muted);margin-top:16px;font-size:12px;display:block}.benchmark-kpi-grid strong{letter-spacing:-.04em;font-variant-numeric:tabular-nums;margin-top:6px;font-size:30px;font-weight:600;display:block}.benchmark-kpi-grid strong small{color:var(--benchmark-muted);letter-spacing:0;font-size:14px;font-weight:400}.benchmark-kpi-grid p{color:var(--benchmark-body);margin:8px 0 0;font-size:12px}.benchmark-state{border:1px solid var(--benchmark-border);width:fit-content;color:var(--benchmark-body);background:var(--benchmark-soft);text-transform:capitalize;border-radius:999px;align-items:center;padding:3px 8px;font:500 11px/16px Geist Mono,monospace;display:inline-flex}.benchmark-state-success{color:#087a44;background:#ecf9f2;border-color:#b8e7ce}.benchmark-state-warning{color:#8a5100;background:#fff8e8;border-color:#f0d2a3}.benchmark-state-info{color:#0057b8;background:#eef6ff;border-color:#b9d7f5}.benchmark-tabs{z-index:3;border-bottom:1px solid var(--benchmark-border);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fafafaf0;align-items:center;gap:4px;padding:12px max(24px,50vw - 600px);display:flex;position:sticky;top:0}.benchmark-tabs button,.benchmark-loading button{min-height:40px;color:var(--benchmark-body);cursor:pointer;background:0 0;border:0;border-radius:6px;padding:0 14px;font-size:13px;font-weight:500}.benchmark-tabs button[aria-current=page]{color:#fff;background:var(--benchmark-ink)}.benchmark-tabs .benchmark-refresh{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);align-items:center;gap:7px;margin-left:auto;display:inline-flex}.benchmark-tabs button:focus-visible,.benchmark-cell-link:focus-visible,.benchmark-run-link:focus-visible,.benchmark-loading button:focus-visible{outline:2px solid var(--benchmark-link);outline-offset:2px}.benchmark-content{width:min(100vw - 48px,1200px);min-width:0;margin:0 auto;padding:40px 0 64px}.benchmark-view-stack{gap:48px;min-width:0;display:grid}.benchmark-view-stack>section{min-width:0}.benchmark-section-heading{justify-content:space-between;align-items:end;gap:24px;margin-bottom:16px;display:flex}.benchmark-section-heading h2,.benchmark-detail-card h2,.benchmark-run-detail h2{letter-spacing:-.02em;margin:0;font-size:20px;line-height:28px}.benchmark-section-heading>p{max-width:420px;color:var(--benchmark-muted);text-align:right;margin:0;font-size:12px;line-height:18px}.benchmark-arm-grid,.benchmark-detail-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;display:grid}.benchmark-arm-card,.benchmark-detail-card,.benchmark-run-detail{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:12px;padding:24px}.benchmark-card-heading{justify-content:space-between;align-items:start;gap:24px}.benchmark-card-heading h3{letter-spacing:-.02em;margin:0;font-size:16px;line-height:24px}.benchmark-stat-list{margin-top:24px}.benchmark-stat-list>div{border-top:1px solid var(--benchmark-border);grid-template-columns:minmax(0,1fr) auto;gap:16px;padding:11px 0;display:grid}.benchmark-stat-list dd{font-variant-numeric:tabular-nums;text-align:right;margin:0;font:500 12px/18px Geist Mono,monospace}.benchmark-factor-row{flex-wrap:wrap;gap:8px;margin-top:20px;display:flex}.benchmark-factor-row span{color:var(--benchmark-muted);background:var(--benchmark-soft);border-radius:6px;padding:5px 8px;font-size:11px}.benchmark-runtime-list{flex-wrap:wrap;gap:8px;display:flex}.benchmark-runtime-list>div{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:6px;align-items:center;gap:20px;padding:9px 11px;font:500 11px/16px Geist Mono,monospace;display:inline-flex}.benchmark-runtime-list>div span{color:var(--benchmark-muted)}.benchmark-runtime-list>div strong{font-weight:600}.benchmark-table-shell{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:12px;width:100%;max-width:100%;overflow:auto}.benchmark-table-shell table{border-collapse:collapse;width:100%;font-size:12px}.benchmark-table-shell th,.benchmark-table-shell td{border-bottom:1px solid var(--benchmark-border);text-align:left;white-space:nowrap;padding:14px 16px}.benchmark-table-shell tr:last-child td{border-bottom:0}.benchmark-table-shell th{color:var(--benchmark-muted);background:var(--benchmark-soft);letter-spacing:.03em;text-transform:uppercase;font-size:11px;font-weight:500}.benchmark-table-shell td{color:var(--benchmark-body)}.benchmark-positive{color:#087a44!important}.benchmark-negative{color:#b42318!important}.benchmark-muted{color:var(--benchmark-muted)}.benchmark-wide-table{min-height:300px}.benchmark-cell-link,.benchmark-run-link{color:var(--benchmark-ink);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:0}.benchmark-cell-link span{font-family:Geist Mono,monospace;display:block}.benchmark-cell-link small{color:var(--benchmark-link);align-items:center;gap:4px;margin-top:5px;display:flex}.benchmark-cell-link small+small{color:var(--benchmark-muted)}.benchmark-cell-link .benchmark-cell-metric{color:var(--benchmark-body);font-family:Geist Mono,monospace}.benchmark-run-link{max-width:280px;color:var(--benchmark-link);text-overflow:ellipsis;overflow:hidden}.benchmark-runs-layout{grid-template-columns:minmax(0,1.3fr) minmax(340px,.7fr);align-items:start;gap:16px;display:grid}.benchmark-table-shell tr[aria-selected=true] td{background:#f3f7fb}.benchmark-run-detail{position:sticky;top:82px}.benchmark-run-detail h2{overflow-wrap:anywhere;max-width:340px}.benchmark-run-facts dd{overflow-wrap:anywhere;white-space:normal;max-width:310px}.benchmark-run-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:20px;display:grid}.benchmark-run-metrics>div{background:var(--benchmark-soft);border-radius:6px;padding:10px}.benchmark-run-metrics span,.benchmark-run-metrics strong{display:block}.benchmark-run-metrics span{color:var(--benchmark-muted);font-size:10px}.benchmark-run-metrics strong{margin-top:5px;font:600 12px/18px Geist Mono,monospace}.benchmark-insight{border-left:2px solid var(--benchmark-link);margin-top:20px;padding:4px 0 4px 14px}.benchmark-insight p{color:var(--benchmark-body);margin:8px 0;font-size:13px;line-height:20px}.benchmark-insight small{color:var(--benchmark-muted);line-height:18px}.benchmark-footer{border-top:1px solid var(--benchmark-border);color:var(--benchmark-muted);background:var(--benchmark-surface);justify-content:space-between;gap:24px;padding:20px max(24px,50vw - 600px);font-size:11px;display:flex}.benchmark-footer>div{flex-wrap:wrap;gap:12px}.benchmark-footer code{text-overflow:ellipsis;white-space:nowrap;max-width:360px;overflow:hidden}.benchmark-loading{text-align:center;place-content:center;min-height:100vh;display:grid}.benchmark-loading svg{color:var(--benchmark-muted);margin:0 auto}.benchmark-loading h1{margin:18px 0 0;font-size:24px}.benchmark-loading p{max-width:520px;color:var(--benchmark-muted);margin:8px auto 0}.benchmark-loading button{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);align-items:center;gap:8px;margin:20px auto 0;display:inline-flex}@media (width<=900px){.benchmark-hero-grid,.benchmark-runs-layout{grid-template-columns:1fr}.benchmark-hero-grid{gap:32px}.benchmark-kpi-grid{grid-template-columns:repeat(2,1fr)}.benchmark-kpi-grid article:nth-child(2){border-right:0}.benchmark-kpi-grid article:nth-child(-n+2){border-bottom:1px solid var(--benchmark-border)}.benchmark-run-detail{position:static}}@media (width<=640px){.benchmark-hero{padding-inline:20px}.benchmark-hero-topline{margin-bottom:40px}.benchmark-title-row,.benchmark-section-heading,.benchmark-footer{flex-direction:column;align-items:flex-start}.benchmark-title-row h1{font-size:34px}.benchmark-kpi-grid,.benchmark-arm-grid,.benchmark-detail-grid{grid-template-columns:1fr}.benchmark-kpi-grid article{border-right:0;border-bottom:1px solid var(--benchmark-border)}.benchmark-kpi-grid article:last-child{border-bottom:0}.benchmark-tabs{padding-inline:20px;overflow-x:auto}.benchmark-tabs .benchmark-refresh{display:none}.benchmark-content{width:calc(100vw - 40px);padding-top:28px}.benchmark-section-heading>p{text-align:left}.benchmark-footer code{max-width:100%}}@media (prefers-reduced-motion:reduce){.benchmark-page *,.benchmark-page :before,.benchmark-page :after{scroll-behavior:auto!important;transition:none!important}}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-latin-wght-normal-BgDaEnEv.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2)format("woff2-variations");unicode-range:U+2000-2001,U+2004-2008,U+200A,U+23B8-23BD,U+2500-259F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-amber-950:oklch(27.9% .077 45.635);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-800:oklch(43.2% .095 166.913);--color-emerald-900:oklch(37.8% .077 168.94);--color-emerald-950:oklch(26.2% .051 172.552);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-800:oklch(44.3% .11 240.79);--color-sky-900:oklch(39.1% .09 240.876);--color-sky-950:oklch(29.3% .066 243.157);--color-rose-50:oklch(96.9% .015 12.422);--color-rose-100:oklch(94.1% .03 12.58);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-600:oklch(58.6% .253 17.585);--color-rose-700:oklch(51.4% .222 16.935);--color-rose-800:oklch(45.5% .188 13.697);--color-rose-900:oklch(41% .159 10.272);--color-rose-950:oklch(27.1% .105 12.094);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-zinc-50:oklch(98.5% 0 0);--color-zinc-100:oklch(96.7% .001 286.375);--color-zinc-200:oklch(92% .004 286.32);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-400:oklch(70.5% .015 286.067);--color-zinc-500:oklch(55.2% .016 285.938);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-zinc-950:oklch(14.1% .005 285.823);--color-white:#fff;--spacing:.25rem;--container-xl:36rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-normal:0em;--radius-md:.375rem;--radius-lg:.5rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.\!visible{visibility:visible!important}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.fixed{position:fixed}.relative{position:relative}.static{position:static}.m-0{margin:calc(var(--spacing) * 0)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-8{margin-top:calc(var(--spacing) * 8)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-64{min-height:calc(var(--spacing) * 64)}.min-h-\[calc\(100vh-80px\)\]{min-height:calc(100vh - 80px)}.min-h-screen{min-height:100vh}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-9{width:calc(var(--spacing) * 9)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[1500px\]{max-width:1500px}.max-w-xl{max-width:var(--container-xl)}.min-w-\[260px\]{min-width:260px}.min-w-full{min-width:100%}.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.border-separate{border-collapse:separate}.border-spacing-0{--tw-border-spacing-x:calc(var(--spacing) * 0);--tw-border-spacing-y:calc(var(--spacing) * 0);border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}.animate-spin{animation:var(--animate-spin)}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-slate-100>:not(:last-child)){border-color:var(--color-slate-100)}.overflow-x-auto{overflow-x:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-200{border-color:var(--color-amber-200)}.border-emerald-200{border-color:var(--color-emerald-200)}.border-rose-200{border-color:var(--color-rose-200)}.border-sky-200{border-color:var(--color-sky-200)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-200\/80{border-color:#e2e8f0cc}@supports (color:color-mix(in lab, red, red)){.border-slate-200\/80{border-color:color-mix(in oklab, var(--color-slate-200) 80%, transparent)}}.border-slate-300{border-color:var(--color-slate-300)}.border-slate-900{border-color:var(--color-slate-900)}.border-transparent{border-color:#0000}.bg-\[\#f6f7f9\]{background-color:#f6f7f9}.bg-\[\#f7f7f4\]{background-color:#f7f7f4}.bg-amber-50{background-color:var(--color-amber-50)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-rose-50{background-color:var(--color-rose-50)}.bg-sky-50{background-color:var(--color-sky-50)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-slate-950{background-color:var(--color-slate-950)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.bg-white\/70{background-color:color-mix(in oklab, var(--color-white) 70%, transparent)}}.bg-white\/95{background-color:#fffffff2}@supports (color:color-mix(in lab, red, red)){.bg-white\/95{background-color:color-mix(in oklab, var(--color-white) 95%, transparent)}}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.pt-0{padding-top:calc(var(--spacing) * 0)}.text-center{text-align:center}.text-left{text-align:left}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[11px\]{font-size:11px}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-7{--tw-leading:calc(var(--spacing) * 7);line-height:calc(var(--spacing) * 7)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\[0\.14em\]{--tw-tracking:.14em;letter-spacing:.14em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-amber-900{color:var(--color-amber-900)}.text-amber-950{color:var(--color-amber-950)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-emerald-800{color:var(--color-emerald-800)}.text-emerald-950{color:var(--color-emerald-950)}.text-rose-600{color:var(--color-rose-600)}.text-rose-700{color:var(--color-rose-700)}.text-rose-800{color:var(--color-rose-800)}.text-rose-900{color:var(--color-rose-900)}.text-sky-800{color:var(--color-sky-800)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-slate-900{color:var(--color-slate-900)}.text-slate-950{color:var(--color-slate-950)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_1px_2px_rgba\(15\,23\,42\,0\.04\)\]{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0f172a0a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.hover\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\:bg-slate-100:hover{background-color:var(--color-slate-100)}.hover\:bg-slate-800:hover{background-color:var(--color-slate-800)}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-slate-400:focus{--tw-ring-color:var(--color-slate-400)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-slate-400:focus-visible{--tw-ring-color:var(--color-slate-400)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:block{display:block}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-\[240px_1fr\]{grid-template-columns:240px 1fr}.sm\:p-8{padding:calc(var(--spacing) * 8)}.sm\:px-5{padding-inline:calc(var(--spacing) * 5)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}}@media (width>=48rem){.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=80rem){.xl\:sticky{position:sticky}.xl\:top-4{top:calc(var(--spacing) * 4)}.xl\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-\[260px_minmax\(0\,1fr\)\]{grid-template-columns:260px minmax(0,1fr)}.xl\:grid-cols-\[minmax\(0\,1\.35fr\)_minmax\(360px\,0\.65fr\)\]{grid-template-columns:minmax(0,1.35fr) minmax(360px,.65fr)}.xl\:grid-cols-\[minmax\(0\,1fr\)_420px\]{grid-template-columns:minmax(0,1fr) 420px}.xl\:self-start{align-self:flex-start}}:where(.dark\:divide-zinc-900:where(.dark,.dark *)>:not(:last-child)){border-color:var(--color-zinc-900)}.dark\:border-amber-900:where(.dark,.dark *){border-color:var(--color-amber-900)}.dark\:border-emerald-900:where(.dark,.dark *){border-color:var(--color-emerald-900)}.dark\:border-rose-900:where(.dark,.dark *){border-color:var(--color-rose-900)}.dark\:border-sky-900:where(.dark,.dark *){border-color:var(--color-sky-900)}.dark\:border-zinc-100:where(.dark,.dark *){border-color:var(--color-zinc-100)}.dark\:border-zinc-700:where(.dark,.dark *){border-color:var(--color-zinc-700)}.dark\:border-zinc-800:where(.dark,.dark *){border-color:var(--color-zinc-800)}.dark\:bg-\[\#09090b\]:where(.dark,.dark *){background-color:#09090b}.dark\:bg-amber-950:where(.dark,.dark *){background-color:var(--color-amber-950)}.dark\:bg-amber-950\/40:where(.dark,.dark *){background-color:#46190166}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-950\/40:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-amber-950) 40%, transparent)}}.dark\:bg-emerald-950:where(.dark,.dark *){background-color:var(--color-emerald-950)}.dark\:bg-rose-950:where(.dark,.dark *){background-color:var(--color-rose-950)}.dark\:bg-sky-950:where(.dark,.dark *){background-color:var(--color-sky-950)}.dark\:bg-zinc-50:where(.dark,.dark *){background-color:var(--color-zinc-50)}.dark\:bg-zinc-900:where(.dark,.dark *){background-color:var(--color-zinc-900)}.dark\:bg-zinc-950:where(.dark,.dark *){background-color:var(--color-zinc-950)}.dark\:bg-zinc-950\/40:where(.dark,.dark *){background-color:#09090b66}@supports (color:color-mix(in lab, red, red)){.dark\:bg-zinc-950\/40:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-zinc-950) 40%, transparent)}}.dark\:text-amber-100:where(.dark,.dark *){color:var(--color-amber-100)}.dark\:text-amber-200:where(.dark,.dark *){color:var(--color-amber-200)}.dark\:text-amber-300:where(.dark,.dark *){color:var(--color-amber-300)}.dark\:text-emerald-200:where(.dark,.dark *){color:var(--color-emerald-200)}.dark\:text-emerald-300:where(.dark,.dark *){color:var(--color-emerald-300)}.dark\:text-rose-100:where(.dark,.dark *){color:var(--color-rose-100)}.dark\:text-rose-200:where(.dark,.dark *){color:var(--color-rose-200)}.dark\:text-rose-300:where(.dark,.dark *){color:var(--color-rose-300)}.dark\:text-sky-200:where(.dark,.dark *){color:var(--color-sky-200)}.dark\:text-zinc-50:where(.dark,.dark *){color:var(--color-zinc-50)}.dark\:text-zinc-100:where(.dark,.dark *){color:var(--color-zinc-100)}.dark\:text-zinc-200:where(.dark,.dark *){color:var(--color-zinc-200)}.dark\:text-zinc-300:where(.dark,.dark *){color:var(--color-zinc-300)}.dark\:text-zinc-400:where(.dark,.dark *){color:var(--color-zinc-400)}.dark\:text-zinc-500:where(.dark,.dark *){color:var(--color-zinc-500)}.dark\:text-zinc-950:where(.dark,.dark *){color:var(--color-zinc-950)}@media (hover:hover){.dark\:hover\:bg-zinc-200:where(.dark,.dark *):hover{background-color:var(--color-zinc-200)}.dark\:hover\:bg-zinc-900:where(.dark,.dark *):hover{background-color:var(--color-zinc-900)}}.dark\:focus\:ring-zinc-500:where(.dark,.dark *):focus,.dark\:focus-visible\:ring-zinc-500:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--color-zinc-500)}}:root{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;font-family:Geist Variable,Geist,Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.dark{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}body{-webkit-font-smoothing:antialiased;text-rendering:geometricprecision;margin:0}button,input,select{font:inherit}.personal-home{--personal-accent:#2563eb;--personal-border:#e2ded6;color:#23272d;background:#f8f7f3;grid-template-columns:196px minmax(0,1fr);width:100%;min-height:100vh;display:grid;overflow-x:clip}.personal-sidebar{border-right:1px solid var(--personal-border);background:#fcfbf8;flex-direction:column;height:100vh;padding:1.5rem 1rem;display:flex;position:sticky;top:0}.personal-wordmark{color:#181d24;letter-spacing:-.01em;align-items:center;gap:.625rem;padding-inline:.5rem;font-size:.9375rem;font-weight:700;text-decoration:none;display:flex}.personal-wordmark-mark,.personal-manager-icon{color:#fff;background:#1e40af;border-radius:.625rem;flex:none;place-items:center;width:1.875rem;height:1.875rem;display:grid;box-shadow:0 1px 2px #0f172a24}.personal-nav{gap:.25rem;margin-top:2rem;display:grid}.personal-nav-item{color:#646971;text-align:left;background:0 0;border:0;border-radius:.625rem;align-items:center;gap:.625rem;width:100%;padding:.625rem .75rem;font-size:.875rem;font-weight:500;text-decoration:none;display:flex}.personal-nav-item-active{color:#1e40af;background:#e8eefc}.personal-nav-item:disabled{cursor:default;opacity:.72}.personal-health{color:#71717a;align-items:center;gap:.5rem;margin-top:auto;padding:.75rem .5rem 0;font-size:.75rem;display:flex}.personal-health-dot,.personal-state-dot{background:#94a3b8;border-radius:9999px;flex:none;width:.5rem;height:.5rem}.personal-health-dot.is-healthy{background:#22c55e;box-shadow:0 0 0 3px #22c55e1f}.personal-health-dot.is-unhealthy{background:#e11d48;box-shadow:0 0 0 3px #e11d481f}.personal-main{min-width:0;padding-bottom:6rem;position:relative}.personal-header{border-bottom:1px solid var(--personal-border);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fcfbf8eb;justify-content:space-between;align-items:center;gap:1.5rem;min-height:7rem;padding:1.5rem clamp(1.5rem,5vw,4.5rem);display:flex}.personal-header h1{color:#181d24;letter-spacing:-.035em;margin:0;font-size:clamp(1.625rem,2.5vw,2rem);font-weight:650}.personal-header p{color:#71717a;margin:.375rem 0 0;font-size:.875rem}.personal-primary-link,.personal-row-action{color:#fff;background:var(--personal-accent);border-radius:.625rem;flex:none;justify-content:center;align-items:center;gap:.375rem;font-size:.8125rem;font-weight:600;text-decoration:none;display:inline-flex;box-shadow:0 1px 2px #2563eb33}.personal-primary-link{min-height:2.375rem;padding-inline:.875rem}.personal-content{width:min(100%,70rem);margin-inline:auto;padding:2rem clamp(1.5rem,5vw,4.5rem)}.personal-manager-summary{background:#ffffffb8;border:1px solid #dbe0e8;border-radius:.75rem;align-items:center;gap:.875rem;padding:.875rem 1rem;display:flex;box-shadow:0 1px 2px #0f172a09}.personal-manager-summary p{color:#474f5b;margin:0;font-size:.875rem;line-height:1.5}.personal-manager-icon{color:#1e40af;width:1.75rem;height:1.75rem;box-shadow:none;background:#e2e9f9}.personal-section{margin-top:2.25rem}.personal-section-heading{justify-content:space-between;align-items:end;gap:1rem;margin-bottom:.75rem;display:flex}.personal-section-heading h2{color:#23272d;letter-spacing:-.01em;margin:0;font-size:1rem;font-weight:650}.personal-section-heading p{color:#7d7d85;margin:.25rem 0 0;font-size:.75rem}.personal-section-heading>span{color:#7d7d85;font-variant-numeric:tabular-nums;font-size:.75rem}.personal-list{border:1px solid var(--personal-border);background:#ffffffdb;border-radius:.75rem;overflow:hidden;box-shadow:0 2px 8px #1d232b09}.personal-list-row{border-bottom:1px solid #ebe8e2;align-items:center;gap:1rem;min-width:0;padding:1rem;display:grid}.personal-list-row:last-child{border-bottom:0}.personal-needs-row{grid-template-columns:auto minmax(0,1fr) auto auto}.personal-goal-row{color:inherit;grid-template-columns:minmax(0,1fr) auto auto;text-decoration:none;transition:background-color .12s}.personal-goal-row:hover{background:#f8fafc}.personal-goal-meta{align-items:center;gap:.75rem;display:inline-flex}.personal-state-dot.is-blocking{background:#d97706;box-shadow:0 0 0 3px #d977061f}.personal-row-copy{min-width:0}.personal-row-copy strong,.personal-row-copy span{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.personal-row-copy strong{color:#2a2f36;font-size:.875rem;font-weight:580}.personal-row-copy span{color:#7d7d85;margin-top:.3125rem;font-size:.75rem}.personal-row-action{color:#1e40af;min-height:2rem;box-shadow:none;background:#e8eefc;padding-inline:.75rem}.personal-empty{color:#7d7d85;text-align:center;padding:1.5rem 1rem;font-size:.8125rem}.personal-source-tools{color:#94949c;justify-content:flex-end;align-items:center;gap:.25rem;margin-top:1rem;font-size:.6875rem;display:flex}.personal-source-tools button{min-height:1.75rem;color:inherit;background:0 0;border:0;border-radius:.375rem;align-items:center;gap:.25rem;padding-inline:.375rem;display:inline-flex}.personal-source-tools button:not(:disabled):hover{color:#475569;background:#f1efea}.personal-manager-input{color:#7d7d85;text-align:left;cursor:pointer;background:#fffffff0;border:1px solid #d8d6d0;border-radius:9999px;align-items:center;gap:.625rem;min-width:12rem;padding:.75rem 1rem;font-size:.8125rem;transition:border-color .12s,box-shadow .12s,color .12s;display:inline-flex;position:fixed;bottom:1.5rem;right:1.5rem;box-shadow:0 8px 24px #0f172a14}.personal-manager-input:hover{color:#475569;border-color:#bfc9da;box-shadow:0 10px 28px #0f172a1f}.personal-manager-backdrop{z-index:50;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a33;justify-content:flex-end;display:flex;position:fixed;inset:0}.personal-manager-drawer{color:#23272d;background:#fcfbf8;grid-template-rows:auto auto minmax(0,1fr) auto;width:min(26.25rem,100vw);min-width:0;height:100%;display:grid;box-shadow:-12px 0 36px #0f172a29}.personal-manager-drawer-header{border-bottom:1px solid var(--personal-border);grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;padding:1rem;display:grid}.personal-manager-drawer-header h2,.personal-manager-drawer-header p{margin:0}.personal-manager-drawer-header h2{color:#181d24;font-size:.9375rem;font-weight:650}.personal-manager-drawer-header p{color:#7d7d85;margin-top:.125rem;font-size:.6875rem}.personal-manager-source{color:#475569;background:#f1efea;border-radius:9999px;padding:.25rem .5rem;font-size:.6875rem}.personal-manager-drawer-header button,.personal-manager-composer button{color:#646971;cursor:pointer;background:0 0;border:0;border-radius:.5rem;flex:none;place-items:center;width:2rem;height:2rem;display:inline-grid}.personal-manager-drawer-header button:hover{color:#23272d;background:#f1efea}.personal-manager-quick-actions{border-bottom:1px solid #ebe8e2;gap:.5rem;padding:.75rem 1rem;display:flex;overflow-x:auto}.personal-manager-thread{min-width:0;padding:1rem;overflow-y:auto}.personal-message-answer{white-space:pre-wrap;color:#323944;line-height:1.7}.personal-message-pending{color:#64748b}.personal-message-activity{color:#646a74;border-top:1px solid #d6d3cc;margin-top:.625rem;padding-top:.5rem}.personal-message-activity summary{cursor:pointer;width:fit-content;font-size:.6875rem;font-weight:600}.personal-message-activity ol{gap:.25rem;margin:.5rem 0 0;padding-left:1.125rem;font-size:.6875rem;display:grid}.personal-message-reconnect{color:#1e40af;background:#fff;border:1px solid #cbd5e1;border-radius:.5rem;margin-top:.625rem;padding:.35rem .65rem;font-size:.6875rem;font-weight:700}.personal-message-reconnect:hover{background:#eff6ff;border-color:#93c5fd}.personal-manager-composer{border-top:1px solid var(--personal-border);padding:.875rem 1rem max(.875rem, env(safe-area-inset-bottom));background:#fcfbf8;align-items:center;gap:.5rem;display:flex}.personal-manager-composer input{color:#23272d;background:#fff;border:1px solid #d8d6d0;border-radius:.625rem;outline:none;width:100%;min-width:0;height:2.5rem;padding-inline:.75rem}.personal-manager-composer input:focus{border-color:#60a5fa;box-shadow:0 0 0 3px #3b82f61f}.personal-manager-composer button{color:#fff;background:var(--personal-accent)}.personal-manager-composer button:disabled{cursor:default;opacity:.42}@media (width<=760px){.personal-home{display:block}.personal-sidebar{border-right:0;border-bottom:1px solid var(--personal-border);grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;height:auto;padding:.75rem 1rem;display:grid;position:static}.personal-nav{justify-content:flex-end;min-width:0;margin-top:0;display:flex}.personal-nav-item{width:auto;padding:.5rem}.personal-nav-item:not(.personal-nav-item-active){font-size:0}.personal-health{margin-top:0;padding:0;font-size:0}.personal-header{min-height:auto;padding:1.25rem 1rem}.personal-content{padding:1.5rem 1rem}.personal-list{box-shadow:none;background:0 0;border:0;overflow:visible}.personal-list-row{border:1px solid var(--personal-border);background:#ffffffe6;border-radius:.75rem;margin-bottom:.625rem}.personal-needs-row{grid-template-columns:auto minmax(0,1fr) auto}.personal-needs-row .personal-row-action{grid-column:2/-1;justify-self:start}.personal-manager-input{bottom:1rem;right:1rem}}@media (width<=640px){.personal-manager-backdrop{align-items:flex-end}.personal-manager-drawer{width:100%;max-width:none;height:100dvh}}@media (width<=420px){.personal-wordmark-mark{display:none}.personal-sidebar{grid-template-columns:auto minmax(0,1fr) auto;padding-inline:.75rem}.personal-nav{gap:0}.personal-nav-item{gap:.25rem;padding-inline:.375rem}.personal-header{align-items:flex-start}.personal-primary-link{padding-inline:.625rem}.personal-primary-link svg{display:none}.personal-needs-row,.personal-goal-row{grid-template-columns:minmax(0,1fr) auto}.personal-needs-row .personal-state-dot{display:none}.personal-manager-input{min-width:0;max-width:calc(100vw - 2rem)}.personal-goal-meta svg{display:none}.personal-manager-drawer-header{grid-template-columns:auto minmax(0,1fr) auto auto}}.personal-workspace{--workspace-accent:#2563eb;--workspace-border:#e5e2dc;--workspace-muted:#70747e;color:#1e2228;background:#faf9f6;grid-template-columns:4.5rem 20rem minmax(0,1fr);height:100vh;min-height:42rem;display:grid;overflow:hidden}.personal-global-rail{border-right:1px solid var(--workspace-border);background:#fcfbf8;flex-direction:column;align-items:center;min-height:0;padding:1.125rem .75rem;display:flex}.personal-rail-logo{color:#fff;background:#1e40af;border-radius:.75rem;place-items:center;width:2.5rem;height:2.5rem;display:grid;box-shadow:0 4px 12px #1e40af2e}.personal-global-rail nav{gap:.5rem;margin-top:2rem;display:grid}.personal-global-rail nav button,.personal-global-rail>button{color:#80848c;cursor:pointer;background:0 0;border:0;border-radius:.625rem;place-items:center;width:2.5rem;height:2.5rem;display:grid}.personal-global-rail nav button.is-active{color:#1e40af;background:#e8eefc}.personal-global-rail nav button:disabled{cursor:default;opacity:.42}.personal-global-rail .personal-health-dot{margin-top:auto}.personal-goal-sidebar{border-right:1px solid var(--workspace-border);background:#fcfbf8;grid-template-rows:auto auto minmax(0,1fr) auto;min-width:0;min-height:0;display:grid}.personal-goal-sidebar>header{justify-content:space-between;align-items:center;height:4.75rem;padding:0 1.25rem;display:flex}.personal-goal-sidebar>header h1{letter-spacing:-.02em;margin:0;font-size:1rem;font-weight:680}.personal-goal-sidebar>header button,.personal-goal-sidebar>footer button{color:#70747e;background:0 0;border:0;border-radius:.5rem;place-items:center;width:2rem;height:2rem;display:grid}.personal-goal-sidebar>header button:disabled{opacity:.4}.personal-manager-row,.personal-goal-list-row{width:calc(100% - 1.5rem);min-width:0;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:.75rem;align-items:center;gap:.75rem;margin:0 .75rem;padding:.75rem;display:grid}.personal-manager-row{grid-template-columns:auto minmax(0,1fr);margin-bottom:.5rem}.personal-manager-row.is-selected,.personal-goal-list-row.is-selected{background:#e9eefa}.personal-goal-icon{color:#2563eb;background:#ffffffe6;border-radius:.625rem;place-items:center;width:2.25rem;height:2.25rem;display:grid;box-shadow:0 1px 2px #0f172a0f}.personal-manager-row strong,.personal-manager-row small,.personal-goal-list-copy strong,.personal-goal-list-copy small{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.personal-manager-row strong,.personal-goal-list-copy strong{font-size:.8125rem;font-weight:620}.personal-manager-row small,.personal-goal-list-copy small{color:var(--workspace-muted);margin-top:.25rem;font-size:.6875rem}.personal-goal-scroll{min-height:0;padding-bottom:1rem;overflow-y:auto}.personal-goal-list-row{grid-template-columns:auto minmax(0,1fr) auto;margin-bottom:.25rem}.personal-goal-list-row:hover{background:#f5f3ef}.personal-goal-list-row.is-selected:hover{background:#e9eefa}.personal-goal-list-row .personal-state-dot{width:.4375rem;height:.4375rem}.personal-state-dot.is-progressing{background:#10b981}.personal-state-dot.is-repair{background:#f43f5e}.personal-goal-list-row .rounded-full{padding-inline:.45rem;font-size:.625rem}.personal-goal-sidebar>footer{border-top:1px solid var(--workspace-border);min-height:3.25rem;color:var(--workspace-muted);justify-content:space-between;align-items:center;padding:0 1.25rem;font-size:.6875rem;display:flex}.personal-chat-pane{background:#faf9f6;grid-template-rows:auto minmax(0,1fr) auto;min-width:0;min-height:0;display:grid}.personal-chat-header{z-index:20;border-bottom:1px solid var(--workspace-border);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);background:#fcfbf8f0;justify-content:space-between;align-items:center;gap:1rem;min-width:0;min-height:4.75rem;padding:.75rem clamp(1rem,2.5vw,2rem);display:flex;position:relative}.personal-chat-title,.personal-chat-actions{align-items:center;gap:.75rem;min-width:0;display:flex}.personal-chat-title{flex:auto;overflow:hidden}.personal-chat-title>div{min-width:0}.personal-chat-actions{flex:none}.personal-chat-title h2,.personal-chat-title p{margin:0}.personal-chat-title h2{color:#181d24;letter-spacing:-.02em;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;font-weight:680;overflow:hidden}.personal-chat-title p{max-width:28rem;color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.15rem;font-size:.6875rem;overflow:hidden}.personal-chat-back,.personal-mobile-goals-button,.personal-chat-actions>button{color:#5b606a;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:.625rem;flex:none;place-items:center;width:2.25rem;height:2.25rem;display:grid}.personal-mobile-goals-button,.personal-agent-menu-backdrop{display:none}.personal-chat-back:hover,.personal-chat-actions>button:hover{border-color:var(--workspace-border);background:#fff}.personal-chat-actions>button.personal-progress-trigger{border-color:var(--workspace-border);color:#3c434e;background:#fffc;gap:.4rem;width:auto;padding-inline:.75rem;font-size:.6875rem;font-weight:620;display:inline-flex}.personal-agent-picker{position:relative}.personal-agent-trigger{color:#292e36;cursor:pointer;background:#fff;border:1px solid #dadadc;border-radius:.625rem;align-items:center;gap:.45rem;min-height:2.25rem;padding:0 .75rem;font-size:.75rem;font-weight:600;display:inline-flex}.personal-agent-menu{z-index:40;border:1px solid var(--workspace-border);background:#fffffffa;border-radius:.875rem;width:min(21rem,100vw - 2rem);padding:.5rem;position:absolute;top:calc(100% + .5rem);right:0;box-shadow:0 18px 48px #0f172a29}.personal-agent-menu-title,.personal-agent-menu-footer{color:var(--workspace-muted);padding:.5rem .625rem;font-size:.6875rem}.personal-agent-menu-title{color:#23272d;font-weight:650}.personal-agent-menu-footer{border-top:1px solid var(--workspace-border);margin-top:.375rem}.personal-agent-menu>button{width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:.625rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.625rem;padding:.625rem;display:grid}.personal-agent-menu>button:hover,.personal-agent-menu>button.is-selected{background:#eff3fc}.personal-agent-menu>button:disabled{cursor:not-allowed;opacity:.52}.personal-agent-menu strong,.personal-agent-menu small{display:block}.personal-agent-menu strong{font-size:.75rem}.personal-agent-menu small{color:var(--workspace-muted);margin-top:.125rem;font-size:.65rem}.personal-agent-avatar{color:#1e40af;background:#e2e9f9;border-radius:.625rem;flex:none;place-items:center;width:2rem;height:2rem;font-size:.75rem;font-weight:700;display:grid}.personal-agent-online{background:#10b981;border-radius:9999px;width:.4375rem;height:.4375rem}.personal-agent-online.is-offline{background:#94a3b8}.personal-live-badge{color:#33634e;background:#f5fcf8;border:1px solid #d1eddf;border-radius:9999px;align-items:center;gap:.375rem;padding:.35rem .625rem;font-size:.65rem;display:inline-flex}.personal-live-badge>span{background:#10b981;border-radius:9999px;width:.375rem;height:.375rem}.personal-chat-scroll{width:100%;min-height:0;padding:2rem clamp(1rem,5vw,5rem) 1.5rem;overflow-y:auto}.personal-chat-scroll>*{width:min(100%,56rem);margin-inline:auto}.personal-chat-welcome{background:#f1efea;border-radius:1rem;align-items:flex-start;gap:.875rem;margin-top:clamp(4rem,14vh,9rem);padding:1rem 1.125rem;display:flex}.personal-chat-welcome h3,.personal-chat-welcome p{margin:0}.personal-chat-welcome h3{font-size:.875rem;font-weight:650}.personal-chat-welcome p{color:#474f5b;margin-top:.25rem;font-size:.8125rem;line-height:1.55}.personal-manager-quick-actions{border:0;justify-content:center;gap:.625rem;padding:1rem 0;display:flex;overflow-x:auto}.personal-manager-quick-actions button{color:#3c434e;cursor:pointer;background:#ffffffc7;border:1px solid #d7dae1;border-radius:.625rem;flex:none;padding:.625rem .875rem;font-size:.75rem}.personal-manager-quick-actions button:hover{color:#1e40af;border-color:#a3b5dc}.personal-goal-summary{border:1px solid var(--workspace-border);background:#ffffffd1;border-radius:.875rem;overflow:hidden;box-shadow:0 2px 8px #0f172a08}.personal-goal-summary>div{border-bottom:1px solid #ebe8e2;grid-template-columns:7rem minmax(0,1fr);gap:1rem;padding:.8rem 1rem;font-size:.75rem;display:grid}.personal-goal-summary>div:last-child{border-bottom:0}.personal-goal-summary span{color:var(--workspace-muted)}.personal-goal-summary strong{min-width:0;font-weight:560}.personal-goal-summary .is-attention{background:#fffbeb}.personal-goal-summary .is-attention span,.personal-goal-summary .is-attention strong{color:#92400e}.personal-goal-projection{gap:.75rem;display:grid}.personal-projection-author{align-items:center;gap:.75rem;padding:0 .125rem .25rem;display:flex}.personal-projection-author strong,.personal-projection-author small{display:block}.personal-projection-author strong{color:#23272d;font-size:.8125rem;font-weight:660}.personal-projection-author small{color:var(--workspace-muted);margin-top:.15rem;font-size:.65rem}.personal-plan-card{border:1px solid var(--workspace-border);background:#ffffffdb;border-radius:.875rem;overflow:hidden;box-shadow:0 2px 8px #0f172a06}.personal-plan-card>header{border-bottom:1px solid #ebe8e2;justify-content:space-between;align-items:center;gap:1rem;min-height:3.25rem;padding:.75rem 1rem;display:flex}.personal-plan-card>header strong,.personal-plan-card>header small{display:block}.personal-plan-card>header strong{font-size:.75rem;font-weight:660}.personal-plan-card>header small{color:var(--workspace-muted);margin-top:.2rem;font-size:.625rem}.personal-plan-card>header>span{color:#5a5e65;background:#faf9f6;border:1px solid #e0ddd7;border-radius:.5rem;flex:none;padding:.25rem .45rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.65rem}.personal-plan-row{color:#343a43;border-bottom:1px solid #f0eee9;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;min-height:2.625rem;padding:.625rem 1rem;font-size:.75rem;display:grid}.personal-plan-row svg{color:#2563eb}.personal-plan-row.is-done svg{color:#059669}.personal-plan-row.is-done>span{color:#5c626b}.personal-plan-row small{color:var(--workspace-muted);font-size:.625rem}.personal-plan-card>button{color:#545b66;cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;gap:.25rem;width:100%;min-height:2.625rem;font-size:.6875rem;display:flex}.personal-plan-card>button:hover{color:#1e40af;background:#f8f9fc}.personal-plan-card.is-empty>header{border-bottom:0}.personal-plan-card.is-empty>p{color:var(--workspace-muted);margin:-.25rem 0 0;padding:0 1rem 1rem;font-size:.75rem;line-height:1.55}.personal-run-evidence-card{border:1px solid var(--workspace-border);width:100%;min-height:3.75rem;color:inherit;text-align:left;cursor:pointer;background:#ffffffd1;border-radius:.875rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;padding:.75rem 1rem;display:grid}.personal-run-evidence-card:hover{background:#fff;border-color:#c7ccd6}.personal-evidence-icon{color:#059669;background:#ecfdf5;border-radius:.625rem;place-items:center;width:2rem;height:2rem;display:grid}.personal-run-evidence-card strong,.personal-run-evidence-card small{display:block}.personal-run-evidence-card strong{font-size:.75rem;font-weight:650}.personal-run-evidence-card small{max-width:38rem;color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.2rem;font-size:.65rem;overflow:hidden}.personal-run-evidence-card em{color:var(--workspace-muted);white-space:nowrap;font-size:.625rem;font-style:normal}.personal-decision-card{background:#fffaee;border:1px solid #f5c068;border-radius:.875rem;justify-content:space-between;align-items:center;gap:1.5rem;margin-top:1rem;padding:1rem;display:flex}.personal-decision-card span{color:#b45309;text-transform:uppercase;font-size:.6875rem;font-weight:700}.personal-decision-card h3,.personal-decision-card p{margin:0}.personal-decision-card h3{margin-top:.25rem;font-size:.9375rem;font-weight:650}.personal-decision-card p{color:var(--workspace-muted);margin-top:.25rem;font-size:.75rem}.personal-decision-actions{flex:none;gap:.5rem;display:flex}.personal-decision-actions button,.personal-execution-card button,.personal-ops-link{color:#1e40af;cursor:pointer;background:#fff;border:1px solid #bbc9ea;border-radius:.625rem;justify-content:center;align-items:center;min-height:2.25rem;padding:0 .75rem;font-size:.75rem;font-weight:600;text-decoration:none;display:inline-flex}.personal-decision-actions button:last-child{border-color:var(--workspace-accent);color:#fff;background:var(--workspace-accent)}.personal-manager-thread{min-width:0;padding:1.25rem 0 0;overflow:visible}.personal-manager-message{color:#474f5b;background:#f1efea;border-radius:.875rem;width:fit-content;max-width:min(88%,43rem);margin-bottom:1rem;padding:.75rem .875rem;font-size:.8125rem;line-height:1.55}.personal-manager-message.is-user{color:#fff;background:#2563eb;margin-left:auto}.personal-message-author{color:#1e40af;margin-bottom:.25rem;font-size:.6875rem;font-weight:700;display:block}.personal-manager-message p,.personal-manager-message ul{margin:0}.personal-manager-message ul{gap:.375rem;margin-top:.5rem;padding-left:1rem;display:grid}.personal-manager-message small{color:#7d7d85;margin-top:.5rem;font-size:.625rem;display:block}.personal-manager-message.is-user small{color:#dbeafe}.personal-manager-message.is-pending{color:#64748b;background:#f8fafc}.personal-proposal-list{gap:.75rem;width:min(100%,43rem);margin:0 0 1.25rem;display:grid}.personal-proposal-card{background:#f9fbff;border:1px solid #d3dcee;border-radius:.875rem;gap:.625rem;padding:.875rem;display:grid}.personal-proposal-card>header{align-items:center;gap:.5rem;display:flex}.personal-proposal-card>header span{color:#1e40af;background:#dbeafe;border-radius:999px;padding:.125rem .5rem;font-size:.625rem;font-weight:700}.personal-proposal-card>header strong{font-size:.75rem}.personal-proposal-card>header small{color:var(--workspace-muted);margin-left:auto;font-size:.625rem}.personal-proposal-card>p,.personal-proposal-card>small{margin:0}.personal-proposal-card>p{color:#1e293b;font-size:.8125rem;font-weight:600;line-height:1.5}.personal-proposal-card>small,.personal-proposal-status{color:#64748b;font-size:.6875rem;line-height:1.5}.personal-proposal-card>code{color:#475569;background:#f1f5f9;border-radius:.375rem;width:fit-content;padding:.25rem .375rem;font-size:.625rem}.personal-proposal-card.is-approved{background:#f7fefa;border-color:#a7f3d0}.personal-proposal-card.is-stale,.personal-proposal-card.is-error{background:#fffbeb;border-color:#fdba74}.personal-proposal-actions{flex-wrap:wrap;gap:.5rem;display:flex}.personal-proposal-actions button{color:#475569;cursor:pointer;background:#fff;border:1px solid #cbd5e1;border-radius:.625rem;min-height:2.25rem;padding:0 .75rem;font-size:.6875rem;font-weight:650}.personal-proposal-actions button:first-child{border-color:var(--workspace-accent);color:#fff;background:var(--workspace-accent)}.personal-proposal-actions button:disabled{cursor:wait;opacity:.55}.personal-execution-card{border:1px solid var(--workspace-border);background:#fffc;border-radius:.875rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;margin-top:1.25rem;padding:.875rem;display:grid}.personal-execution-card strong,.personal-execution-card p{margin:0}.personal-execution-card strong{font-size:.8125rem}.personal-execution-card p{color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.25rem;font-size:.6875rem;overflow:hidden}.personal-manager-composer{background:#fffffff5;border:1px solid #d5d5d6;border-radius:1rem;grid-template-rows:1fr;grid-template-columns:auto minmax(0,1fr) auto;gap:.5rem;width:min(100% - 2rem,58rem);min-height:4rem;margin:0 auto 1rem;padding:.5rem .625rem;display:grid;position:relative;box-shadow:0 10px 30px #0f172a14}.personal-manager-composer input{color:#23272d;background:0 0;border:0;outline:none;grid-area:1/2;height:2.75rem;padding:0 .25rem}.personal-manager-composer input:focus{box-shadow:none;border:0}.personal-composer-tools{grid-area:1/1;align-self:center;align-items:center;min-width:0;display:flex}.personal-composer-tools button{color:#334155;cursor:pointer;background:#f5f3ef;border:0;border-radius:.75rem;align-items:center;gap:.35rem;width:auto;min-width:0;height:2.5rem;min-height:2.5rem;padding:0 .625rem;font-size:.6875rem;font-weight:620;display:inline-flex}.personal-composer-tools button span{text-overflow:ellipsis;white-space:nowrap;max-width:8rem;display:block;overflow:hidden}.personal-manager-composer .personal-send-button{color:#fff;background:var(--workspace-accent);cursor:pointer;border:0;border-radius:.75rem;grid-area:1/3;align-self:center;place-items:center;width:2.5rem;height:2.5rem;display:grid}.personal-manager-composer .personal-send-button:disabled{cursor:default;opacity:.34}.personal-details-backdrop{z-index:70;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a2e;justify-content:flex-end;display:flex;position:fixed;inset:0}.personal-running-details{background:#fcfbf8;width:min(28rem,100vw);height:100%;padding:1rem;overflow-y:auto;box-shadow:-12px 0 36px #0f172a29}.personal-running-details>header{justify-content:space-between;align-items:center;gap:1rem;padding-bottom:1rem;display:flex}.personal-running-details h2,.personal-running-details header p{margin:0}.personal-running-details h2{font-size:1rem;font-weight:680}.personal-running-details header p{color:var(--workspace-muted);margin-top:.25rem;font-size:.6875rem}.personal-running-details header button{cursor:pointer;background:#f1efea;border:0;border-radius:.625rem;place-items:center;width:2.25rem;height:2.25rem;display:grid}.personal-diagnosis-card{border:1px solid var(--workspace-border);background:#fff;border-radius:.875rem;padding:1rem}.personal-diagnosis-card>span{color:#059669;font-size:.6875rem;font-weight:700}.personal-diagnosis-card h3{margin:.375rem 0 1rem;font-size:.875rem;line-height:1.5}.personal-diagnosis-card dl,.personal-diagnosis-card dd{margin:0}.personal-diagnosis-card dl{gap:.625rem;display:grid}.personal-diagnosis-card dl>div{grid-template-columns:3.5rem minmax(0,1fr);gap:.75rem;font-size:.75rem;display:grid}.personal-diagnosis-card dt{color:var(--workspace-muted)}.personal-running-details details{border-bottom:1px solid var(--workspace-border);padding:1rem .25rem}.personal-running-details summary{cursor:pointer;font-size:.8125rem;font-weight:620}.personal-running-details details p{color:var(--workspace-muted);margin:.75rem 0 0;font-size:.75rem;line-height:1.55}.personal-details-todo-list{gap:.375rem;margin:.75rem 0 0;padding:0;list-style:none;display:grid}.personal-details-todo-list li{color:#484f59;padding-left:1rem;font-size:.71875rem;line-height:1.45;position:relative}.personal-details-todo-list li:before{content:"";background:#2563eb;border-radius:9999px;width:.375rem;height:.375rem;position:absolute;top:.45em;left:0}.personal-details-todo-list li.is-done{color:#7e838b}.personal-details-todo-list li.is-done:before{background:#059669}.personal-ops-link{gap:.375rem;width:100%;margin-top:1rem}.dark .personal-workspace,.dark .personal-chat-pane{color:#f4f4f5;background:#131417}.dark .personal-global-rail,.dark .personal-goal-sidebar,.dark .personal-chat-header,.dark .personal-running-details{color:#f4f4f5;background:#191a1e}.dark .personal-plan-card,.dark .personal-run-evidence-card,.dark .personal-projection-author strong{color:#f4f4f5;background:#1e1f23}.dark .personal-plan-card>header,.dark .personal-plan-row{border-color:#3f3f46}.dark .personal-plan-row,.dark .personal-plan-row.is-done>span{color:#d4d4d8}.dark .personal-decision-card{background:#45290d;border-color:#92400e}@media (width<=1000px){.personal-workspace{grid-template-columns:3.75rem 16.5rem minmax(0,1fr)}.personal-live-badge{display:none}.personal-chat-scroll{padding-inline:1.25rem}}@media (width<=720px){.personal-workspace{grid-template-rows:minmax(0,1fr);grid-template-columns:1fr;height:100dvh;min-height:100dvh;overflow:hidden}.personal-global-rail{display:none}.personal-goal-sidebar{border-right:0;height:100dvh;display:none}.personal-workspace.mobile-goals-visible .personal-goal-sidebar{display:grid}.personal-workspace.mobile-goals-visible .personal-chat-pane{display:none}.personal-chat-pane{height:100dvh;min-height:0}.personal-chat-header{-webkit-backdrop-filter:none;backdrop-filter:none;gap:.5rem;min-height:4.25rem;padding-inline:.75rem}.personal-mobile-goals-button{display:grid}.personal-goal-sidebar>header button,.personal-goal-sidebar>footer button{width:2.75rem;height:2.75rem}.personal-chat-title p,.personal-chat-title>span,.personal-chat-actions>button:first-of-type,.personal-chat-actions>button.personal-progress-trigger span{display:none}.personal-chat-actions>button.personal-progress-trigger{width:2.75rem;padding:0}.personal-chat-back,.personal-mobile-goals-button,.personal-chat-actions>button{width:2.75rem;height:2.75rem}.personal-agent-trigger{min-height:2.75rem;padding-inline:.5rem}.personal-agent-menu-backdrop{z-index:35;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a33;border:0;display:block;position:fixed;inset:0}.personal-agent-menu{z-index:40;border-radius:1rem;width:auto;max-height:calc(100dvh - 1.5rem);position:fixed;inset:auto .75rem .75rem;overflow-y:auto}.personal-agent-menu>button{min-height:3.5rem}.personal-chat-scroll{padding:1rem .75rem}.personal-chat-welcome{margin-top:1rem}.personal-manager-quick-actions{grid-template-columns:repeat(2,minmax(0,1fr));display:grid;overflow:visible}.personal-manager-quick-actions button{white-space:normal;width:100%}.personal-manager-quick-actions button:last-child{grid-column:1/-1}.personal-goal-summary>div{grid-template-columns:5.5rem minmax(0,1fr)}.personal-decision-card{flex-direction:column;align-items:stretch}.personal-run-evidence-card{grid-template-columns:auto minmax(0,1fr) auto}.personal-run-evidence-card em,.personal-plan-row small{display:none}.personal-decision-actions{grid-template-columns:1fr 1fr;display:grid}.personal-decision-actions button,.personal-manager-quick-actions button,.personal-execution-card button,.personal-ops-link,.personal-running-details header button{min-height:2.75rem}.personal-running-details header button{width:2.75rem;height:2.75rem}.personal-execution-card{grid-template-columns:auto minmax(0,1fr) auto}.personal-execution-card .rounded-full{display:none}.personal-execution-card button{grid-column:2/-1;justify-self:start}.personal-manager-composer{margin-bottom:.5rem;position:sticky;bottom:.5rem}.personal-composer-tools button,.personal-send-button{min-width:2.75rem;min-height:2.75rem}}.chat-shell{background:radial-gradient(circle at 48% 0,#ffffffeb,#0000 30rem),#f7f8f6}.chat-goal-map{isolation:isolate;position:relative;overflow:hidden}.chat-goal-map:before{z-index:0;content:"";opacity:.44;background-image:radial-gradient(#94a3b83b .7px,#0000 .7px);background-size:18px 18px;position:absolute;inset:0;-webkit-mask-image:linear-gradient(#0000,#000 18% 84%,#0000);mask-image:linear-gradient(#0000,#000 18% 84%,#0000)}.chat-map-goal:after{content:"";background:#cbd5e1;width:1px;height:3rem;position:absolute;top:100%;left:50%}.chat-map-branches:before{content:"";background:#cbd5e1;height:1px;position:absolute;top:-1.5rem;left:16.666%;right:16.666%}.chat-map-branches>div{position:relative}.chat-map-branches>div:before{content:"";background:#cbd5e1;width:1px;height:1.5rem;position:absolute;bottom:100%;left:50%}.chat-map-branches:after{content:"";background:#cbd5e1;width:1px;height:2.5rem;position:absolute;top:100%;left:50%}@media (width<=767px){.chat-map-goal:after,.chat-map-branches:before,.chat-map-branches:after,.chat-map-branches>div:before{display:none}}@property --tw-border-spacing-x{syntax:"";inherits:false;initial-value:0}@property --tw-border-spacing-y{syntax:"";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/loopx/web/chat/index.html b/loopx/web/chat/index.html index 6f93e7807f..ecb391dc00 100644 --- a/loopx/web/chat/index.html +++ b/loopx/web/chat/index.html @@ -18,8 +18,8 @@ content="LoopX 个人 Agent 工作区:在同一个频道里查看、纠偏并推进 Goal。" /> LoopX 个人 Agent 工作区 - - + +
diff --git a/tests/control_plane/test_goal_acceptance_cli.py b/tests/control_plane/test_goal_acceptance_cli.py new file mode 100644 index 0000000000..3a2e094fd6 --- /dev/null +++ b/tests/control_plane/test_goal_acceptance_cli.py @@ -0,0 +1,359 @@ +"""One owner contract, actual validation and independent canonical readback.""" + +from __future__ import annotations + +import hashlib +import json +import sys + +import pytest +from canonical_authority_fixture import ( + initialize_canonical_authority, + isolate_sqlite_runtime, +) + +from loopx.control_plane.coordination.runtime_shadow import ( + build_todo_runtime_shadow_projection, +) +from loopx.control_plane.testing.canary_harness import ( + run_json_cli_result, + write_fixture_registry, +) + + +@pytest.fixture(params=["file", "sqlite"]) +def acceptance_goal(tmp_path, monkeypatch, request): + if request.param == "sqlite": + isolate_sqlite_runtime(tmp_path, monkeypatch) + project = tmp_path / "project" + project.mkdir() + state = project / "state.md" + state.write_text("---\nstatus: active\n---\n# Fixture\n## Agent Todo\n") + runtime, registry = tmp_path / "runtime", tmp_path / "registry.json" + write_fixture_registry( + project=project, + runtime_root=runtime, + registry_path=registry, + goal_id="goal-acceptance", + domain="acceptance", + adapter_kind="generic_project_goal_v0", + state_file=str(state), + registered_agents=["agent-a"], + ) + todo = { + "schema_version": "todo_item_v0", + "todo_id": "todo_export", + "role": "agent", + "text": "Write the export artifact", + "status": "open", + "done": False, + "task_class": "advancement_task", + "action_kind": "implement", + "index": 1, + "source_section": "Agent Todo", + "archive_state": "active", + "claimed_by": "agent-a", + } + projection = build_todo_runtime_shadow_projection( + goal_id="goal-acceptance", todos=[todo], handoff_mode="soft_claim" + ) + initialize_canonical_authority( + runtime, "goal-acceptance", projection, state_path=state, provider=request.param + ) + document = { + "objective": "Produce a usable export", + "non_goals": ["No unrelated code cleanup"], + "criteria": [ + { + "id": "export", + "description": "The exported artifact has the expected content", + "validation_argv": [ + sys.executable, + "-c", + "from pathlib import Path; assert Path('artifact.txt').read_text() == 'accepted'", + ], + "validation_timeout_seconds": 5, + } + ], + "bindings": [{"todo_id": "todo_export", "criterion_ids": ["export"]}], + } + document_path = tmp_path / "acceptance.json" + document_path.write_text(json.dumps(document)) + + def run(*arguments): + return run_json_cli_result( + *arguments, + registry_path=registry, + runtime_root=runtime, + ) + + def cli(*arguments): + return run("goal-acceptance", *arguments, "--goal-id", "goal-acceptance") + + return project, document_path, cli, run + + +def test_owner_configure_validation_failure_success_and_disable(acceptance_goal): + project, document, cli, _ = acceptance_goal + code, before = cli("inspect") + assert code == 0 and before["goal_acceptance_contract"] == {"enabled": False} + revision = before["provider_revision"] + code, preview = cli( + "configure", + "--document", + str(document), + "--expected-provider-revision", + revision, + ) + assert code == 0 and preview["status"] == "planned" + assert cli("inspect")[1] == before + code, configured = cli( + "configure", + "--document", + str(document), + "--expected-provider-revision", + revision, + "--operation-id", + "configure-acceptance", + "--execute", + ) + assert code == 0, configured + contract = configured["goal_acceptance_contract"] + assert contract["enabled"] and contract["tasks"][0]["state"] == "ready" + assert "validation_argv" not in json.dumps(configured) + code, failed = cli("verify", "--agent-id", "agent-a", "--execute") + assert code == 1 and failed["checks_passed"] is False + assert cli("inspect")[1]["goal_acceptance_contract"]["status"] == "failed" + (project / "artifact.txt").write_text("accepted") + code, passed = cli("verify", "--agent-id", "agent-a", "--execute") + assert code == 0 and passed["checks_passed"] is True, passed + observed = cli("inspect")[1] + assert observed["goal_acceptance_contract"]["status"] == "accepted" + assert "validation_argv" not in json.dumps(observed) + code, disabled = cli( + "disable", + "--expected-provider-revision", + observed["provider_revision"], + "--execute", + ) + assert code == 0 and disabled["goal_acceptance_contract"] == {"enabled": False} + + +def test_agents_cannot_rewrite_acceptance_and_stale_owner_write_rejects( + acceptance_goal, +): + _, document, cli, _ = acceptance_goal + original = cli("inspect")[1] + args = ( + "configure", + "--document", + str(document), + "--expected-provider-revision", + original["provider_revision"], + "--execute", + ) + code, error = cli(*args, "--agent-id", "agent-a") + assert code == 1, error + assert cli("inspect")[1] == original + code, configured = cli(*args) + assert code == 0, configured + code, error = cli(*args) + assert code == 1 and "revision" in error["error"], error + assert cli("inspect")[1]["goal_acceptance_contract"]["revision"] == 1 + + +def test_cli_rejects_claimed_results_and_missing_configuration_basis(acceptance_goal): + _, document, cli, _ = acceptance_goal + code, result = cli("configure", "--document", str(document), "--execute") + assert code == 1 and "expected-provider-revision" in result["error"] + code, result = cli("verify", "--document", str(document), "--execute") + assert code == 1 and "configuration arguments" in result["error"] + + +@pytest.mark.parametrize("change", ["before", "during"]) +def test_changed_verifier_cannot_turn_missing_artifact_into_acceptance( + acceptance_goal, change +): + project, document_path, cli, _ = acceptance_goal + verifier = project / "verify.py" + verifier.write_text( + "from pathlib import Path\nPath(__file__).write_text('pass\\n')\n" + if change == "during" + else "from pathlib import Path\nassert Path('artifact.txt').read_text() == 'accepted'\n" + ) + document = json.loads(document_path.read_text()) + criterion = document["criteria"][0] + criterion["validation_argv"] = [sys.executable, "verify.py"] + criterion["validation_files"] = [ + { + "path": "verify.py", + "sha256": hashlib.sha256(verifier.read_bytes()).hexdigest(), + } + ] + document_path.write_text(json.dumps(document)) + basis = cli("inspect")[1]["provider_revision"] + code, configured = cli( + "configure", + "--document", + str(document_path), + "--expected-provider-revision", + basis, + "--execute", + ) + assert code == 0, configured + if change == "before": + verifier.write_text("pass\n") + code, result = cli("verify", "--execute") + assert code == 1 and result["checks_passed"] is False, result + assert cli("inspect")[1]["goal_acceptance_contract"]["status"] == "failed" + + +def test_passing_artifact_check_does_not_hide_unconfirmed_work(acceptance_goal): + project, document_path, cli, _ = acceptance_goal + document = json.loads(document_path.read_text()) + document["bindings"] = [] + document_path.write_text(json.dumps(document)) + (project / "artifact.txt").write_text("accepted") + basis = cli("inspect")[1]["provider_revision"] + code, result = cli( + "configure", + "--document", + str(document_path), + "--expected-provider-revision", + basis, + "--execute", + ) + assert code == 0, result + code, result = cli("verify", "--execute") + assert ( + code == 1 + and result["checks_passed"] is True + and result["acceptance_ready"] is False + ) + assert result["goal_acceptance_contract"]["status"] == "held" + + +def test_bound_todo_completes_only_after_its_criteria_actually_run(acceptance_goal): + """The completion plan names criteria; this proves the host runs them. + + Only real execution separates the two attempts below: the configuration, + the binding and the command are identical, and just the artifact differs. + """ + project, document, cli, run = acceptance_goal + code, configured = cli( + "configure", + "--document", + str(document), + "--expected-provider-revision", + cli("inspect")[1]["provider_revision"], + "--execute", + ) + assert code == 0 and configured["goal_acceptance_contract"]["tasks"] == [ + { + "todo_id": "todo_export", + "state": "ready", + "criterion_ids": ["export"], + "reason": "The owner confirmed this work's current acceptance association.", + "reason_code": "goal_acceptance_ready", + "applicable": True, + } + ], configured + complete = ( + "todo", + "complete", + "--todo-id", + "todo_export", + "--goal-id", + "goal-acceptance", + "--agent-id", + "agent-a", + ) + code, refused = run(*complete) + assert code == 1 and refused["reason_code"] == "goal_acceptance_validation_rejected", refused + assert "validation_argv" not in json.dumps(refused) + + (project / "artifact.txt").write_text("accepted") + code, completed = run(*complete) + assert code == 0 and completed["changed"] is True, completed + evidence = completed["goal_acceptance_completion"] + assert evidence["results"] == [ + {"criterion_id": "export", "exit_code": 0, "passed": True} + ] + assert evidence["contract_digest"] == configured["goal_acceptance_contract"]["digest"] + assert evidence["source_binding"]["todo_id"] == "todo_export" + assert "validation_argv" not in json.dumps(completed) + # Todo criteria passing is not an independent judgment that the Goal is met. + assert cli("inspect")[1]["goal_acceptance_contract"]["status"] == "unverified" + + +def _configure(cli, document): + code, configured = cli( + "configure", + "--document", + str(document), + "--expected-provider-revision", + cli("inspect")[1]["provider_revision"], + "--execute", + ) + assert code == 0, configured + return configured + + +@pytest.mark.parametrize( + "escape", + [ + pytest.param((), id="supersede"), + pytest.param(("--task-class", "blocker"), id="task_class"), + pytest.param( + ("--status", "deferred", "--resume-when", "resume_at:2099-01-01T00:00:00Z"), + id="deferred", + ), + ], +) +def test_bound_work_cannot_be_closed_by_editing_its_way_out_of_the_gate( + acceptance_goal, escape +): + """Acceptance binds work, so neither a second terminal verb nor a field the + guarded party may rewrite can close it without the criteria running. + + `supersede` reaches the same `done: true` write as `complete`; `task_class` + and `status` are inputs to the old applicability test. Each row closes the + Todo terminally in the absence of `artifact.txt` if the gate is keyed on the + command name or on the Todo's current shape. + """ + _, document, cli, run = acceptance_goal + _configure(cli, document) + common = ("--todo-id", "todo_export", "--goal-id", "goal-acceptance", "--agent-id", "agent-a") + if escape: + code, updated = run("todo", "update", *common, *escape) + assert code == 0, updated + terminal = ("todo", "complete", *common) + else: + terminal = ("todo", "supersede", *common, "--reason", "pivot") + code, refused = run(*terminal) + assert code == 1, refused + assert refused["reason_code"] in { + "goal_acceptance_validation_required", + "goal_acceptance_stale", + }, refused + assert "validation_argv" not in json.dumps(refused) + # The refusal must be a refusal, not a report: the work stays open. + contract = cli("inspect")[1]["goal_acceptance_contract"] + assert contract["status"] != "accepted" + assert contract["verification"] is None + + +def test_preview_discloses_the_criteria_the_real_call_will_run(acceptance_goal): + """A preview that hid this showed an unconditional close the real call gates.""" + _, document, cli, run = acceptance_goal + configured = _configure(cli, document) + common = ("--todo-id", "todo_export", "--goal-id", "goal-acceptance", "--agent-id", "agent-a") + code, preview = run("todo", "complete", *common, "--dry-run") + assert code == 0, preview + assert preview["goal_acceptance_pending"] == { + "contract_revision": configured["goal_acceptance_contract"]["revision"], + "contract_digest": configured["goal_acceptance_contract"]["digest"], + "criterion_ids": ["export"], + } + assert "validation_argv" not in json.dumps(preview) + assert cli("inspect")[1]["goal_acceptance_contract"]["verification"] is None diff --git a/tests/control_plane/test_goal_acceptance_runtime.py b/tests/control_plane/test_goal_acceptance_runtime.py new file mode 100644 index 0000000000..2143313449 --- /dev/null +++ b/tests/control_plane/test_goal_acceptance_runtime.py @@ -0,0 +1,99 @@ +"""Acceptance holds come from canonical TS authority, including public CLI reads.""" +from __future__ import annotations + +import hashlib +import json +import subprocess +import sys +from pathlib import Path + +from canonical_authority_fixture import initialize_canonical_authority + +from loopx.control_plane.coordination.local_authority import read_canonical_todo_fields_if_promoted +from loopx.control_plane.coordination.local_authority_shadow_projection import canonical_bytes +from loopx.control_plane.coordination.runtime_shadow import build_todo_runtime_shadow_projection +from loopx.control_plane.testing.quota_fixtures import quota_status_payload +from loopx.control_plane.todos.summary_item import todo_summary_source_items +from loopx.control_plane.todos.todo_semantics import todo_item_is_actionable_open +from loopx.quota import build_quota_should_run +from loopx.status import active_state_todo_fields + + +def seed(tmp_path: Path, *, enabled: bool, monitor: bool = False): + state = tmp_path / "state.md" + state.write_text("# Goal\n\n## Agent Todo\n\n- [ ] Stale display work\n") + runtime = tmp_path / "runtime" + goal = {"id": "goal-a", "repo": str(tmp_path), "state_file": str(state), + "domain": "software", "adapter": {"kind": "read_only_project_map_v0"}} + records = [{"schema_version": "todo_item_v0", "todo_id": "todo_work", "index": 1, + "role": "agent", "status": "open", "done": False, "text": "Configured work", + "task_class": "advancement_task", "archive_state": "active", "source_section": "Agent Todo"}] + if monitor: + records.append({**records[0], "todo_id": "todo_monitor", "index": 2, "text": "Inspect current progress", + "task_class": "continuous_monitor", "next_due_at": "2026-01-01T00:00:00Z", "cadence": "1h"}) + projection = build_todo_runtime_shadow_projection(goal_id=goal["id"], todos=records) + if enabled: + document = {"objective": "Deliver a verified result", "non_goals": [], "bindings": [], + "criteria": [{"id": "criterion-a", "description": "The check passes", "validation_argv": ["true"], + "validation_timeout_seconds": 5, "validation_files": []}]} + projection["goal_acceptance"] = {"schema_version": "loopx_goal_acceptance_v0", "enabled": True, + "revision": 1, "digest": hashlib.sha256(canonical_bytes(document)).hexdigest(), + "document": document, "bindings": [], "verification": None} + initialize_canonical_authority(runtime, goal["id"], projection, state_path=state) + registry = tmp_path / "registry.json" + registry.write_text(json.dumps({"schema_version": 1, "common_runtime_root": str(runtime), "goals": [goal]})) + return goal, runtime, state, registry + + +def test_same_provider_snapshot_keeps_holds_visible_and_excludes_selection(tmp_path): + goal, runtime, state, _ = seed(tmp_path, enabled=True, monitor=True) + state.unlink() + fields = read_canonical_todo_fields_if_promoted(runtime_root=runtime, goal_id=goal["id"]) + summary = fields["agent_todos"] + assert summary["goal_acceptance_contract"]["status"] == "held" + assert summary["first_executable_items"] == [] + assert summary["executable_backlog_items"] == [] + visible = {item["todo_id"]: item for item in todo_summary_source_items(summary)} + held = visible["todo_work"] + assert held["status"] == "open" + assert held["goal_acceptance_guard"]["reason_code"] == "goal_acceptance_unbound" + assert held["goal_acceptance_guard"]["reason"] + assert not todo_item_is_actionable_open(held) + assert todo_item_is_actionable_open(visible["todo_monitor"]) + assert "goal_acceptance_guard" not in visible["todo_monitor"] + assert "validation_argv" not in json.dumps(fields) + assert not state.exists() + + +def test_quota_cannot_select_unbound_work(tmp_path): + goal, runtime, _, _ = seed(tmp_path, enabled=True) + fields = active_state_todo_fields(goal, runtime_root=runtime) + status = quota_status_payload(goal_id=goal["id"], status="ready", agent_todos=fields["agent_todos"], + user_todos=fields["user_todos"], recommended_action="Configured work") + decision = build_quota_should_run(status, goal_id=goal["id"]) + assert decision["should_run"] is False + assert "goal_acceptance_unbound" in json.dumps(status) + + +def test_public_status_cli_retains_safe_contract_sidecar_without_extra_source(tmp_path): + goal, runtime, state, registry = seed(tmp_path, enabled=True) + state.unlink() + result = subprocess.run([sys.executable, "-m", "loopx.cli", "--registry", str(registry), + "--format", "json", "status", "--goal-id", goal["id"]], capture_output=True, text=True, timeout=60) + assert result.returncode == 0, result.stdout + result.stderr + items = json.loads(result.stdout)["attention_queue"]["items"] + item = next(item for item in items if item["goal_id"] == goal["id"]) + contract = item["agent_todos"]["goal_acceptance_contract"] + assert contract["status"] == "held" + assert contract["criteria"] == [{"id": "criterion-a", "description": "The check passes"}] + assert item["agent_todos"]["first_executable_items"] == [] + assert "validation_argv" not in json.dumps(contract) + assert not state.exists() + + +def test_absent_acceptance_does_not_change_summary_shape_or_executability(tmp_path): + goal, runtime, _, _ = seed(tmp_path, enabled=False) + summary = active_state_todo_fields(goal, runtime_root=runtime)["agent_todos"] + assert "goal_acceptance_contract" not in summary + assert summary["first_executable_items"][0]["todo_id"] == "todo_work" + assert "goal_acceptance_guard" not in json.dumps(summary) diff --git a/tests/control_plane_ts/goal_acceptance_authority.test.ts b/tests/control_plane_ts/goal_acceptance_authority.test.ts new file mode 100644 index 0000000000..868251f4c0 --- /dev/null +++ b/tests/control_plane_ts/goal_acceptance_authority.test.ts @@ -0,0 +1,454 @@ +import assert from "node:assert/strict"; +import {randomUUID} from "node:crypto"; +import {mkdtemp, readFile, rm, writeFile} from "node:fs/promises"; +import {tmpdir} from "node:os"; +import {join} from "node:path"; +import {spawnSync} from "node:child_process"; +import test, {type TestContext} from "node:test"; +import {Pool} from "pg"; +import type {JsonObject} from "../../loopx/control_plane/effect_program.ts"; +import type {AuthorityStore} from "../../loopx/control_plane/coordination/authority_store.ts"; +import {FileAuthorityStore} from "../../loopx/control_plane/coordination/file_authority_store.ts"; +import {SqliteAuthorityStore} from "../../loopx/control_plane/coordination/sqlite_authority_store.ts"; +import {PostgreSqlAuthorityStore, installPostgreSqlAuthorityStoreSchema} from "../../loopx/control_plane/coordination/postgresql_authority_store.ts"; +import {prepareCoordinationProjectionCommit, validateCoordinationTodoReadModel} from "../../loopx/control_plane/coordination/coordination_projection.ts"; +import {openLocalAuthorityStore, selectLocalSqliteAuthority} from "../../loopx/control_plane/coordination/local_authority_provider.ts"; +import {sqliteRuntimeIdentity} from "../../loopx/control_plane/coordination/sqlite_runtime.ts"; +import {loadLegacyCoordinationWriterFence} from "../../loopx/control_plane/coordination/legacy_writer_fence.ts"; +import {shadowManagementStatePath} from "../../loopx/control_plane/coordination/shadow_management.ts"; +import {authorityProjectionFixture} from "./authority_projection_fixture.ts"; +import {acceptanceCompletionRequirements, acceptanceWorkGuard, goalAcceptanceTodoDigest, goalAcceptanceWorkDigest, + normalizeGoalAcceptanceDocument, projectGoalAcceptance, readGoalAcceptance, validateAcceptanceCompletion} from "../../loopx/control_plane/goals/acceptance_contract.ts"; +import {commitGoalAcceptanceVerification, commitLocalGoalAcceptance, commitLocalGoalAcceptanceVerification, + configureGoalAcceptance, inspectGoalAcceptance, inspectLocalGoalAcceptance} from "../../loopx/control_plane/goals/acceptance_authority.ts"; + +const goal = "goal-acceptance-test"; +test("documented owner configuration satisfies the canonical acceptance contract", async () => { + const reference = await readFile(new URL("../../docs/reference/goal-acceptance-observations.md", import.meta.url), "utf8"); + const example = reference.match(/```json\n([\s\S]*?)\n```/); + assert.ok(example, "the operation guide must include a runnable configuration"); + assert.doesNotThrow(() => normalizeGoalAcceptanceDocument(JSON.parse(example[1]))); +}); + +function todo(todo_id: string, extra: JsonObject = {}): JsonObject { + return {todo_id, role: "agent", status: "open", done: false, archive_state: "active", + text: `Implement ${todo_id}`, task_class: "advancement_task", action_kind: "implement", ...extra}; +} +function document(): JsonObject { + return {objective: "Deliver independently validated work", non_goals: ["Grant additional permissions"], + criteria: [{id: "prerequisite", description: "Prerequisite passes its own check", validation_argv: [process.execPath, "-e", "process.exit(0)"]}, + {id: "outcome", description: "Final outcome passes its check", validation_argv: [process.execPath, "-e", "process.exit(0)"]}], + bindings: [{todo_id: "todo_first", criterion_ids: ["prerequisite"]}, {todo_id: "todo_second", criterion_ids: ["outcome"]}]}; +} +function originalHead() { + return authorityProjectionFixture(goal, [todo("todo_first"), todo("todo_second"), + todo("todo_gate", {role: "user", task_class: "user_gate"}), + todo("todo_monitor", {task_class: "continuous_monitor"}), + todo("todo_completed", {status: "done", done: true})], [], "native", {other_contract: {retained: true}}); +} +async function seed(store: AuthorityStore) { + assert.equal((await store.commitAuthority({operation_id: "seed", expected_provider_revision: null, + events: [], receipts: [], next_projection: originalHead()})).status, "applied"); +} +async function head(store: AuthorityStore) { + const result = await store.loadAuthority(); + assert.equal(result.status, "loaded"); + if (result.status !== "loaded") throw new Error("test head unavailable"); + return result; +} +async function configureRequest(store: AuthorityStore, extra: JsonObject = {}): Promise { + return {goal_id: goal, actor_agent_id: null, operation_id: randomUUID(), disable: false, + expected_provider_revision: (await head(store)).provider_revision, document: document(), ...extra}; +} +async function verifyRequest(store: AuthorityStore, extra: JsonObject = {}): Promise { + const basis = await inspectGoalAcceptance(store, goal); + return {goal_id: goal, operation_id: randomUUID(), expected_provider_revision: basis.provider_revision, + revision: basis.revision, contract_digest: basis.contract_digest, + results: ["outcome", "prerequisite"].map(criterion_id => ({criterion_id, passed: true, exit_code: 0})), ...extra}; +} +async function update(store: AuthorityStore, todoId: string, patch: JsonObject) { + const current = await head(store); + const previous = (current.head.todos as JsonObject[]).find(item => item.todo_id === todoId); + const result = await store.commitAuthority(prepareCoordinationProjectionCommit({goal_id: goal, + operation_id: randomUUID(), expected_provider_revision: current.provider_revision, projection: current.head, + mutations: [{kind: "todo_upsert", todo: previous ? {...previous, ...patch} : patch}]})); + assert.equal(result.status, "applied"); +} +const providers = ["file", "sqlite", "postgresql"] as const; +// SQLite authority needs the WAL-reset driver; the public Node minimum ships +// an older one. Skip those rows there rather than fail, and keep the file +// rows running: the qualified runtime job executes every row for real. +const sqliteQualified = sqliteRuntimeIdentity().sqlite_authority_qualified === true; +async function fixture(t: TestContext, provider: typeof providers[number]): Promise { + if (provider !== "postgresql") { + const dir = await mkdtemp(join(tmpdir(), "goal-acceptance-")); + t.after(() => rm(dir, {recursive: true, force: true})); + return provider === "file" ? new FileAuthorityStore(dir, goal) : new SqliteAuthorityStore(dir, goal); + } + const pool = new Pool({connectionString: process.env.LOOPX_TEST_POSTGRES_URL, max: 4}); + const db = {connect: async () => { + const client = await pool.connect(); + return {query: async (sql: string, values?: readonly unknown[]) => client.query(sql, values ? [...values] : undefined), + release: () => client.release()}; + }}; + const tenant = `acceptance-${randomUUID()}`; + t.after(async () => { + try { + for (const table of ["authority_commits", "authority_heads"]) { + await pool.query(`DELETE FROM loopx_control_plane.${table} WHERE tenant_id=$1 AND goal_id=$2`, [tenant, goal]); + } + } finally { await pool.end(); } + }); + await installPostgreSqlAuthorityStoreSchema(db, `postgresql:${"b".repeat(32)}`); + return new PostgreSqlAuthorityStore(db, {tenant_id: tenant, goal_id: goal}); +} + +for (const provider of providers) { + const options = {skip: (provider === "postgresql" && !process.env.LOOPX_TEST_POSTGRES_URL) || + (provider === "sqlite" && !sqliteQualified)}; + test(`${provider}: default off, owner configure, private inspection and public held work`, options, async t => { + const store = await fixture(t, provider); await seed(store); + const before = await head(store); + assert.deepEqual(projectGoalAcceptance(before.head, goal), {enabled: false}); + assert.equal(acceptanceWorkGuard(before.head, goal, "todo_first"), null); + assert.equal(acceptanceCompletionRequirements(before.head, goal, "todo_first"), null); + assert.deepEqual(await head(store), before); + const doc = document(); doc.bindings = [{todo_id: "todo_first", criterion_ids: ["prerequisite"]}]; + const request = await configureRequest(store, {document: doc}); + const result = await configureGoalAcceptance(store, request); + assert.equal(result.status, "applied"); + assert.equal(result.source_authority, `${provider}_v0`); + assert.equal(result.projection_delivery, "not_required"); + const after = await head(store); + const {goal_acceptance, ...remaining} = after.head; + assert.deepEqual(remaining, before.head, "Todo manifest, records, leases and adjacent contracts are untouched"); + assert.ok(goal_acceptance); + const inspection = await inspectGoalAcceptance(store, goal); + assert.equal(inspection.provider_revision, after.provider_revision); + assert.equal(((inspection.contract as JsonObject).criteria as JsonObject[])[0].validation_timeout_seconds, 5); + assert.ok((inspection.tasks as JsonObject[]).every(task => typeof task.todo_semantic_digest === "string")); + const projection = projectGoalAcceptance(after.head, goal); + assert.equal(projection.status, "held"); + assert.deepEqual(projection.held_todo_ids, ["todo_second"]); + assert.equal(acceptanceWorkGuard(after.head, goal, "todo_first")?.allowed, true); + assert.equal(acceptanceWorkGuard(after.head, goal, "todo_second")?.allowed, false); + for (const id of ["todo_gate", "todo_monitor", "todo_completed"]) assert.equal(acceptanceWorkGuard(after.head, goal, id), null); + assert.equal(acceptanceWorkGuard(after.head, goal, "todo_missing")?.allowed, false); + assert.ok(!JSON.stringify(projection).includes("validation_argv")); + assert.ok(!JSON.stringify(result).includes("process.exit")); + assert.throws(() => acceptanceCompletionRequirements(after.head, goal, "todo_second"), /unbound/); + }); + + test(`${provider}: missing CAS, owner violations, malformed criteria and unknown bindings have no effect`, options, async t => { + const store = await fixture(t, provider); await seed(store); + const request = await configureRequest(store); + const noCas = {...request}; delete noCas.expected_provider_revision; + const noActor = {...request}; delete noActor.actor_agent_id; + const invalidDocuments: JsonObject[] = [ + {...document(), objective: " "}, {...document(), criteria: []}, {...document(), accepted: true}, + {...document(), criteria: [{id: "a", description: "", validation_argv: ["check"]}]}, + {...document(), criteria: [{id: "a", description: "Check", validation_argv: []}]}, + {...document(), criteria: [{id: "a", description: "Check", validation_argv: [" "]}]}, + {...document(), criteria: [{id: "a", description: "Check", validation_argv: ["check"], validation_timeout_seconds: 30}]}, + {...document(), bindings: [{todo_id: "todo_first", criterion_ids: ["unknown"]}]}, + {...document(), bindings: [{todo_id: "todo_first", criterion_ids: ["outcome", "outcome"]}]}, + {...document(), bindings: [{todo_id: "todo_missing", criterion_ids: ["outcome"]}]}, + {...document(), bindings: [{todo_id: "todo_gate", criterion_ids: ["outcome"]}]}, + ]; + const before = await head(store); + for (const invalid of [noCas, noActor, {...request, actor_agent_id: "agent"}, {...request, expected_provider_revision: null}, + {...request, operation_id: "x".repeat(257)}, + ...invalidDocuments.map(document => ({...request, document}))]) { + await assert.rejects(() => configureGoalAcceptance(store, invalid)); + assert.deepEqual(await head(store), before); + } + assert.equal((await store.readReceipt(String(request.operation_id))).status, "missing"); + const stale = await configureGoalAcceptance(store, {...request, expected_provider_revision: "stale"}); + assert.equal(stale.status, "conflict"); + assert.deepEqual(await head(store), before); + }); + + test(`${provider}: CAS concurrency, exact retry, changed-content rejection, disable and versioned re-enable`, options, async t => { + const store = await fixture(t, provider); await seed(store); + const first = await configureRequest(store), second = {...first, operation_id: randomUUID()}; + const results = await Promise.all([configureGoalAcceptance(store, first), configureGoalAcceptance(store, second)]); + assert.deepEqual(results.map(result => result.status).sort(), ["applied", "conflict"]); + const winner = results[0].status === "applied" ? first : second; + const after = await head(store); + assert.equal((await configureGoalAcceptance(store, winner)).status, "replayed"); + assert.equal((await configureGoalAcceptance(store, {...winner, document: {...document(), objective: "Changed"}})).reason_code, + "coordination_operation_identity_mismatch"); + assert.deepEqual(await head(store), after); + const disable = await configureRequest(store, {document: null, disable: true}); + await assert.rejects(() => configureGoalAcceptance(store, {...disable, actor_agent_id: "agent"})); + assert.equal((await configureGoalAcceptance(store, disable)).status, "applied"); + assert.deepEqual(projectGoalAcceptance((await head(store)).head, goal), {enabled: false}); + assert.equal((await configureGoalAcceptance(store, winner)).status, "replayed"); + assert.equal(acceptanceWorkGuard((await head(store)).head, goal, "todo_first"), null); + assert.equal((await configureGoalAcceptance(store, await configureRequest(store))).status, "applied"); + assert.equal(projectGoalAcceptance((await head(store)).head, goal).revision, 2); + assert.equal((await store.readReceipt(String(winner.operation_id))).status, "found"); + assert.equal((await store.readReceipt(String(disable.operation_id))).status, "found"); + }); + + test(`${provider}: declaration drift and new work are held; status, claims and display do not change binding`, options, async t => { + const store = await fixture(t, provider); await seed(store); + await configureGoalAcceptance(store, await configureRequest(store)); + await update(store, "todo_first", {status: "blocked", done: false, claimed_by: "receiver", note: "Progress", + title: "Display title", completed_at: null, completion_validation_sha256: "prior-receipt"}); + assert.equal(acceptanceWorkGuard((await head(store)).head, goal, "todo_first")?.allowed, true); + await update(store, "todo_first", {required_capabilities: ["write"]}); + assert.equal(acceptanceWorkGuard((await head(store)).head, goal, "todo_first")?.state, "stale"); + await configureGoalAcceptance(store, await configureRequest(store)); + await update(store, "todo_first", {text: "Different actual work"}); + assert.equal(acceptanceWorkGuard((await head(store)).head, goal, "todo_first")?.state, "stale"); + const newTodo = (authorityProjectionFixture(goal, [todo("todo_new")]).todos as JsonObject[])[0]; + await update(store, "todo_new", newTodo); + const projection = projectGoalAcceptance((await head(store)).head, goal); + assert.deepEqual(projection.held_todo_ids, ["todo_first", "todo_new"]); + assert.equal(acceptanceWorkGuard((await head(store)).head, goal, "todo_second")?.allowed, true); + }); + + test(`${provider}: verification exact coverage, failed checks, private metadata and no completion shortcut`, options, async t => { + const store = await fixture(t, provider); await seed(store); + await configureGoalAcceptance(store, await configureRequest(store)); + const request = await verifyRequest(store); + const before = await head(store); + const invalid = [[], [{criterion_id: "outcome", passed: true, exit_code: 0}], + [{criterion_id: "outcome", passed: true, exit_code: 1}, {criterion_id: "prerequisite", passed: true, exit_code: 0}], + [{criterion_id: "outcome", passed: false, exit_code: 0}, {criterion_id: "prerequisite", passed: true, exit_code: 0}], + [{criterion_id: "outcome", passed: false, exit_code: -9}, {criterion_id: "prerequisite", passed: true, exit_code: 0}], + [{criterion_id: "outcome", passed: true, exit_code: 0}, {criterion_id: "outcome", passed: true, exit_code: 0}], + [{criterion_id: "unknown", passed: true, exit_code: 0}, {criterion_id: "prerequisite", passed: true, exit_code: 0}]]; + for (const results of invalid) await assert.rejects(() => commitGoalAcceptanceVerification(store, {...request, results})); + await assert.rejects(() => commitGoalAcceptanceVerification(store, {...request, actor_agent_id: "agent"})); + await assert.rejects(() => commitGoalAcceptanceVerification(store, {...request, accepted: true})); + assert.deepEqual(await head(store), before); + const failure = await verifyRequest(store, {results: [ + {criterion_id: "outcome", passed: false, exit_code: null, status: "timeout", stdout_captured: false}, + {criterion_id: "prerequisite", passed: true, exit_code: 0}]}); + assert.equal((await commitGoalAcceptanceVerification(store, failure)).status, "applied"); + assert.equal(projectGoalAcceptance((await head(store)).head, goal).status, "failed"); + const success = await verifyRequest(store); + (success.results as JsonObject[])[0].command_label = "private-execution-label"; + (success.results as JsonObject[])[0].summary = "private-runner-context"; + assert.equal((await commitGoalAcceptanceVerification(store, success)).status, "applied"); + const accepted = await head(store); + assert.equal(projectGoalAcceptance(accepted.head, goal).status, "accepted"); + assert.deepEqual(accepted.head.todos, before.head.todos, "acceptance never marks Todos done or closes a Goal"); + assert.ok(!JSON.stringify(accepted.head).includes("private-execution-label")); + assert.ok(!JSON.stringify(await store.readReceipt(String(success.operation_id))).includes("private-runner-context")); + assert.equal((await commitGoalAcceptanceVerification(store, success)).status, "replayed"); + assert.equal((await commitGoalAcceptanceVerification(store, {...success, results: failure.results})).reason_code, + "coordination_operation_identity_mismatch"); + assert.throws(() => validateAcceptanceCompletion(accepted.head, goal, "todo_first", {accepted: true}), /fields/); + await update(store, "todo_second", {status: "blocked", done: false}); + assert.equal(projectGoalAcceptance((await head(store)).head, goal).status, "accepted"); + await update(store, "todo_first", {text: "New declaration"}); + assert.notEqual(projectGoalAcceptance((await head(store)).head, goal).status, "accepted"); + }); + + test(`${provider}: stale verification after work/config changes and partial checks cannot accept the whole contract`, options, async t => { + const store = await fixture(t, provider); await seed(store); + await configureGoalAcceptance(store, await configureRequest(store)); + const staleWork = await verifyRequest(store); + await update(store, "todo_first", {text: "Changed while validators ran"}); + assert.equal((await commitGoalAcceptanceVerification(store, staleWork)).status, "conflict"); + assert.equal((await store.readReceipt(String(staleWork.operation_id))).status, "missing"); + await configureGoalAcceptance(store, await configureRequest(store)); + assert.equal((await commitGoalAcceptanceVerification(store, {...staleWork, + expected_provider_revision: (await head(store)).provider_revision})).reason_code, "goal_acceptance_contract_stale"); + const partial = await verifyRequest(store, {todo_id: "todo_first", results: [{criterion_id: "prerequisite", passed: true, exit_code: 0}]}); + assert.equal((await commitGoalAcceptanceVerification(store, partial)).status, "applied"); + assert.equal(projectGoalAcceptance((await head(store)).head, goal).status, "partial"); + await commitGoalAcceptanceVerification(store, await verifyRequest(store)); + const successful = await head(store); + await configureGoalAcceptance(store, await configureRequest(store)); + assert.equal(projectGoalAcceptance((await head(store)).head, goal).status, "stale"); + assert.deepEqual(((await head(store)).head.goal_acceptance as JsonObject).verification, + (successful.head.goal_acceptance as JsonObject).verification, "historical execution evidence is retained"); + }); + + test(`${provider}: persisted verification validates its complete basis and returns only compact results`, options, async t => { + const store = await fixture(t, provider); await seed(store); + await configureGoalAcceptance(store, await configureRequest(store)); + await commitGoalAcceptanceVerification(store, await verifyRequest(store)); + const accepted = (await head(store)).head; + const state = accepted.goal_acceptance as JsonObject; + const original = state.verification as JsonObject; + const corrupt = (receipt: JsonObject) => ({...accepted, goal_acceptance: {...state, verification: receipt}}); + for (const field of ["operation_id", "contract_revision", "contract_digest", "work_digest", "todo_id", "results"]) { + const missing = {...original}; delete missing[field]; + assert.throws(() => readGoalAcceptance(corrupt(missing), goal), /fields/); + } + for (const patch of [{operation_id: " op "}, {contract_revision: "1"}, {contract_revision: 2}, + {contract_digest: "0".repeat(64)}, {work_digest: 3}, {todo_id: ""}, {todo_id: "todo_unknown"}, + {results: [{criterion_id: "outcome", passed: false, exit_code: 1}]}, + {todo_id: "todo_first", results: [{criterion_id: "outcome", passed: true, exit_code: 0}]}]) { + assert.throws(() => readGoalAcceptance(corrupt({...original, ...patch}), goal)); + } + const metadata = {...original, results: (original.results as JsonObject[]).map(row => + ({...row, command_label: "private-receipt-label", summary: "private-receipt-context"}))}; + assert.ok(!JSON.stringify(projectGoalAcceptance(corrupt(metadata), goal)).includes("private-receipt")); + assert.equal(projectGoalAcceptance(corrupt({...original, work_digest: "0".repeat(64)}), goal).status, "stale"); + assert.equal(projectGoalAcceptance(accepted, goal).status, "accepted"); + }); + + test(`${provider}: fresh prerequisite execution is bound to atomic completion; final criterion is not inferred`, options, async t => { + const store = await fixture(t, provider); await seed(store); + await configureGoalAcceptance(store, await configureRequest(store)); + const basis = await head(store); + const requirements = acceptanceCompletionRequirements(basis.head, goal, "todo_first")!; + assert.deepEqual(requirements.criterion_ids, ["prerequisite"]); + const results = requirements.criteria.map(criterion => { + const execution = spawnSync(criterion.validation_argv[0], criterion.validation_argv.slice(1), + {stdio: "ignore", timeout: criterion.validation_timeout_seconds * 1000}); + return {criterion_id: criterion.id, passed: execution.status === 0, exit_code: execution.status}; + }); + const evidence = {contract_revision: requirements.contract_revision, contract_digest: requirements.contract_digest, + todo_id: requirements.todo_id, todo_semantic_digest: requirements.todo_semantic_digest, results}; + const receipt = validateAcceptanceCompletion(basis.head, goal, "todo_first", evidence)!; + assert.ok(!JSON.stringify(receipt).includes("validation_argv")); + assert.throws(() => validateAcceptanceCompletion(basis.head, goal, "todo_first", {...evidence, + results: [{criterion_id: "prerequisite", passed: false, exit_code: 1}]}), /failed/); + assert.throws(() => validateAcceptanceCompletion(basis.head, goal, "todo_second", evidence), /basis changed/); + const target = (basis.head.todos as JsonObject[]).find(item => item.todo_id === "todo_first")!; + const completion = prepareCoordinationProjectionCommit({goal_id: goal, operation_id: "complete-prerequisite", + expected_provider_revision: basis.provider_revision, projection: basis.head, + mutations: [{kind: "todo_upsert", todo: {...target, status: "done", done: true}}]}); + completion.receipts = [receipt]; + assert.equal((await store.commitAuthority(completion)).status, "applied"); + const completed = await head(store); + assert.equal((completed.head.todos as JsonObject[]).find(item => item.todo_id === "todo_first")!.done, true); + assert.deepEqual((await store.readReceipt("complete-prerequisite")).status, "found"); + assert.equal(projectGoalAcceptance(completed.head, goal).status, "unverified"); + assert.equal((await store.commitAuthority({...completion, operation_id: "stale-completion"})).status, "conflict"); + const secondBasis = acceptanceCompletionRequirements(completed.head, goal, "todo_second")!; + await update(store, "todo_second", {required_write_scopes: ["src"]}); + assert.throws(() => validateAcceptanceCompletion((completed.head), goal, "todo_second", {...evidence, + todo_id: "todo_second", todo_semantic_digest: secondBasis.todo_semantic_digest}), /exactly/); + const changed = await head(store); + assert.throws(() => validateAcceptanceCompletion(changed.head, goal, "todo_second", evidence), /stale/); + }); + + test(`${provider}: lost commit response recovers immutable operation; dry-run changes no provider facts`, options, async t => { + const store = await fixture(t, provider); await seed(store); + const request = await configureRequest(store); + const before = await head(store); + assert.equal((await configureGoalAcceptance(store, {...request, dry_run: true})).status, "planned"); + assert.deepEqual(await head(store), before); + const commit = store.commitAuthority.bind(store); + store.commitAuthority = async input => {await commit(input); throw new Error("response lost after durable commit");}; + assert.equal((await configureGoalAcceptance(store, request)).status, "recovered"); + store.commitAuthority = commit; + assert.equal((await configureGoalAcceptance(store, request)).status, "replayed"); + }); + + test(`${provider}: file pins bind trusted criteria and contract revisions without entering public projection`, options, async t => { + const store = await fixture(t, provider); await seed(store); + const doc = document(); + const criterion = (doc.criteria as JsonObject[])[0]; + criterion.validation_files = [{path: "checks/verify.py", sha256: "a".repeat(64)}]; + await configureGoalAcceptance(store, await configureRequest(store, {document: doc})); + const current = await head(store); + const requirements = acceptanceCompletionRequirements(current.head, goal, "todo_first")!; + assert.deepEqual(requirements.criteria[0].validation_files, criterion.validation_files); + assert.ok(!JSON.stringify(projectGoalAcceptance(current.head, goal)).includes("checks/verify.py")); + const tampered = structuredClone(current.head); + const tamperedDocument = (tampered.goal_acceptance as JsonObject).document as JsonObject; + (tamperedDocument.criteria as JsonObject[]).find(item => item.id === "prerequisite")!.validation_files = + [{path: "checks/verify.py", sha256: "b".repeat(64)}]; + assert.throws(() => readGoalAcceptance(tampered, goal), /contract digest mismatch/); + await commitGoalAcceptanceVerification(store, await verifyRequest(store)); + const verified = await head(store); + criterion.validation_files = [{path: "checks/verify.py", sha256: "b".repeat(64)}]; + await configureGoalAcceptance(store, await configureRequest(store, {document: doc})); + const changed = projectGoalAcceptance((await head(store)).head, goal); + assert.notEqual(changed.digest, requirements.contract_digest); + assert.equal(changed.revision, requirements.contract_revision + 1); + assert.equal(changed.status, "stale"); + assert.deepEqual(((await head(store)).head.goal_acceptance as JsonObject).verification, + (verified.head.goal_acceptance as JsonObject).verification); + }); + +} + +test("file pins are bounded, safe relative paths with exact hashes and deterministic ordering", () => { + const normalize = (validation_files: unknown) => normalizeGoalAcceptanceDocument({...document(), + criteria: (document().criteria as JsonObject[]).map(item => ({...item, validation_files}))}); + assert.ok(normalizeGoalAcceptanceDocument(document()).criteria.every(item => item.validation_files.length === 0)); + const files = [{path: "checks/z.py", sha256: "a".repeat(64)}, {path: ".checks/a.py", sha256: "b".repeat(64)}]; + assert.deepEqual(normalize(files), normalize([...files].reverse())); + assert.deepEqual(normalize([{path: "checks/a.py", sha256: "A".repeat(64)}]), + normalize([{path: "checks/a.py", sha256: "a".repeat(64)}])); + for (const path of ["", "/verify.py", "../verify.py", "checks/../verify.py", "./verify.py", "checks/./verify.py", + "checks//verify.py", "checks/", "C:/verify.py", "C:\\verify.py", "checks\\verify.py", "verify.py\n", "checks/a b.py", "a".repeat(1025)]) { + assert.throws(() => normalize([{path, sha256: "a".repeat(64)}]), /path/); + } + for (const files of [null, {}, [{path: "verify.py", sha256: "a".repeat(63)}], + [{path: "verify.py", sha256: "g".repeat(64)}], [{path: "verify.py", sha256: "a".repeat(64), extra: true}], + [{path: "verify.py", sha256: "a".repeat(64)}, {path: "verify.py", sha256: "b".repeat(64)}], + Array.from({length: 17}, (_, index) => ({path: `check-${index}.py`, sha256: "a".repeat(64)}))]) { + assert.throws(() => normalize(files)); + } +}); + +test("normalization is deterministic and digest includes work declarations but excludes observations", () => { + const first = normalizeGoalAcceptanceDocument(document()); + const second = normalizeGoalAcceptanceDocument({...document(), criteria: [...(document().criteria as JsonObject[])].reverse(), + bindings: [...(document().bindings as JsonObject[])].reverse()}); + assert.deepEqual(first, second); + assert.throws(() => normalizeGoalAcceptanceDocument({...document(), + criteria: (document().criteria as JsonObject[]).map(item => ({...item, validation_timeout_seconds: 13}))}), /total at most 25 seconds/); + const original = todo("todo_first"); + for (const patch of [{status: "done", done: true}, {claimed_by: "agent"}, {index: 3, source_section: "Done"}, + {completion_validation_sha256: "receipt", completion_turn_key: "turn"}]) { + assert.equal(goalAcceptanceTodoDigest({...original, ...patch}), goalAcceptanceTodoDigest(original)); + } + for (const patch of [{text: "Other work"}, {task_repository: "git:example.test/repository"}, + {required_capabilities: ["write"]}, {required_write_scopes: ["src"]}, {action_kind: "review"}, {future_work_declaration: true}]) { + assert.notEqual(goalAcceptanceTodoDigest({...original, ...patch}), goalAcceptanceTodoDigest(original)); + } + assert.throws(() => projectGoalAcceptance({...originalHead(), goal_acceptance: null}, goal), /object/); + assert.deepEqual(projectGoalAcceptance({}, goal), {enabled: false}, "feature off preserves legacy callers without a read model"); +}); + +test("work fingerprints ignore row permutations without weakening canonical read-model validation", () => { + const original = originalHead(); + const rows = original.todos as JsonObject[]; + const permutations = [[...rows].reverse(), [...rows.slice(2), ...rows.slice(0, 2)]]; + const digest = goalAcceptanceWorkDigest(original, goal); + for (const todos of permutations) { + assert.equal(goalAcceptanceWorkDigest({...original, todos}, goal), digest); + assert.equal(goalAcceptanceWorkDigest(authorityProjectionFixture(goal, todos, [], "legacy"), goal), digest); + assert.throws(() => validateCoordinationTodoReadModel({...original, todos}, goal), /deterministic todo_id order/); + } + assert.throws(() => goalAcceptanceWorkDigest({...original, todos: [...rows, rows[0]]}, goal), /duplicate/); + assert.throws(() => goalAcceptanceWorkDigest(original, "different-goal"), /goal mismatch/); +}); + +for (const provider of ["file", "sqlite"] as const) { + test(`${provider}: local exported effects use selected store, writer gate and private inspection`, + {skip: provider === "sqlite" && !sqliteQualified}, async t => { + const root = await mkdtemp(join(tmpdir(), "goal-acceptance-local-")); + t.after(() => rm(root, {recursive: true, force: true})); + if (provider === "sqlite") await selectLocalSqliteAuthority(root, goal, true); + const store = await openLocalAuthorityStore(root, goal); await seed(store); + const before = await inspectLocalGoalAcceptance({runtime_root: root, goal_id: goal}); + assert.equal(before.status, "loaded"); + assert.deepEqual(before.goal_acceptance_contract, {enabled: false}); + const request = {...await configureRequest(store), runtime_root: root}; + assert.equal((await commitLocalGoalAcceptance(request)).status, "applied"); + const inspect = await inspectLocalGoalAcceptance({runtime_root: root, goal_id: goal, todo_id: "todo_first"}); + assert.equal(inspect.source_authority, `${provider}_v0`); + assert.equal((inspect.tasks as JsonObject[]).length, 1); + const verified = await commitLocalGoalAcceptanceVerification({...await verifyRequest(store), runtime_root: root}); + assert.equal((verified.goal_acceptance_contract as JsonObject).status, "accepted"); + assert.equal((await loadLegacyCoordinationWriterFence(root, goal)).status, "missing", "acceptance never promotes a provider"); + // An unreadable maintenance state is not permission to bypass the writer. + await writeFile(shadowManagementStatePath(root, goal), "invalid maintenance state"); + const blocked = await commitLocalGoalAcceptance({...await configureRequest(store), runtime_root: root}); + assert.equal(blocked.status, "failed"); + assert.equal((await inspectLocalGoalAcceptance({runtime_root: root, goal_id: goal})).status, "loaded"); + }); +} diff --git a/tests/control_plane_ts/goal_acceptance_runtime.test.ts b/tests/control_plane_ts/goal_acceptance_runtime.test.ts new file mode 100644 index 0000000000..5887dd52eb --- /dev/null +++ b/tests/control_plane_ts/goal_acceptance_runtime.test.ts @@ -0,0 +1,279 @@ +import assert from "node:assert/strict"; +import {randomUUID} from "node:crypto"; +import {mkdtemp, rm} from "node:fs/promises"; +import {tmpdir} from "node:os"; +import {join} from "node:path"; +import test, {type TestContext} from "node:test"; +import {Pool} from "pg"; +import type {JsonObject} from "../../loopx/control_plane/effect_program.ts"; +import type {AuthorityStore} from "../../loopx/control_plane/coordination/authority_store.ts"; +import {FileAuthorityStore} from "../../loopx/control_plane/coordination/file_authority_store.ts"; +import {PostgreSqlAuthorityStore, installPostgreSqlAuthorityStoreSchema} from "../../loopx/control_plane/coordination/postgresql_authority_store.ts"; +import {canonicalAuthoritySha256} from "../../loopx/control_plane/coordination/authority_store_codec.ts"; +import {coordinationTodoReadModel} from "../../loopx/control_plane/coordination/coordination_projection.ts"; +import {acceptanceWorkGuard, goalAcceptanceTodoDigest, normalizeGoalAcceptanceDocument} from "../../loopx/control_plane/goals/acceptance_contract.ts"; +import {executeCoordinationTodoClaim} from "../../loopx/control_plane/coordination/todo_claim.ts"; +import {executeCoordinationTodoUpdate} from "../../loopx/control_plane/coordination/todo_update.ts"; +import {executeCanonicalTaskLeaseAcquire} from "../../loopx/control_plane/coordination/task_lease_acquire.ts"; +import {executeCoordinationTodoTerminalLifecycle, type CoordinationTodoTerminalLifecycleInput} from "../../loopx/control_plane/coordination/todo_terminal_lifecycle.ts"; +import {listLocalCoordinationTodos, readLocalCoordinationTodo} from "../../loopx/control_plane/coordination/local_authority_runtime.ts"; + +const now = new Date("2026-09-17T12:00:00Z"); +const todo = (extra: JsonObject = {}): JsonObject => ({schema_version: "todo_domain_record_v0", + todo_id: "todo_work", role: "agent", status: "open", done: false, text: "Deliver the configured result", + task_class: "advancement_task", archive_state: "active", ...extra}); +function acceptance(records: JsonObject[], bound = true): JsonObject { + const document = normalizeGoalAcceptanceDocument({objective: "Deliver a verified result", non_goals: [], + criteria: [{id: "criterion-a", description: "The configured check succeeds", validation_argv: ["true"], validation_timeout_seconds: 10}], + bindings: bound ? [{todo_id: "todo_work", criterion_ids: ["criterion-a"]}] : []}); + return {schema_version: "loopx_goal_acceptance_v0", enabled: true, revision: 1, + digest: canonicalAuthoritySha256(document), document, verification: null, + bindings: bound ? [{todo_id: "todo_work", todo_semantic_digest: goalAcceptanceTodoDigest(records[0]!), + revision: 1, criterion_ids: ["criterion-a"], confirmed_by: "owner"}] : []}; +} +function projection(records: JsonObject[], state?: JsonObject): JsonObject { + records = [...records].sort((a, b) => String(a.todo_id).localeCompare(String(b.todo_id))); + return {goal_id: "goal-a", handoff_mode: "legacy", todos: records, leases: [], + todo_read_model: coordinationTodoReadModel(records, "loopx_todo_domain_read_record_v0"), + unrelated_extension: {value: "retained"}, ...(state ? {goal_acceptance: state} : {})}; +} +const claim = {goal_id: "goal-a", todo_id: "todo_work", claimed_by: "agent-a", actor_agent_id: "agent-a", + expected_role: "agent", registered_agents: ["agent-a", "agent-b"], operation_id: "claim", dry_run: false, now}; +const acquire = {goal_id: "goal-a", todo_id: "todo_work", owner: "agent-a", idempotency_key: "execution-a", + expected_version: null, ttl_seconds: 60, write_scopes: [], registered_agents: ["agent-a"], now}; +const terminal: CoordinationTodoTerminalLifecycleInput = {goal_id: "goal-a", todo_id: "todo_work", expected_role: "agent", + command: "complete", actor_agent_id: "agent-a", registered_agents: ["agent-a"], lifecycle_grants: [], + authority_reason: null, decision_outcome: null, operation_id: "complete", lease_idempotency_key: null, + lease_expected_version: null, allow_user_gate_auto_acquire: false, requested_no_followup: true, + requested_completion_turn_key: null, requested_completion_identity_source: null, linked_successor_todo_ids: [], + successor_intents: [], note: null, evidence: null, reason: null, clear_claim: false, + validation_declaration: null, validation_receipt: null, completion_policy_request: null, dry_run: false, now}; +const runnerReceipt = (label = "criterion-a", passed = true): JsonObject => ({schema_version: "issue_fix_validation_command_v0", + command_label: label, passed, exit_code: passed ? 0 : 1, stdout_captured: false, + stderr_captured: false, local_path_captured: false}); +async function loaded(store: AuthorityStore) { + const head = await store.loadAuthority(); + assert.equal(head.status, "loaded"); + if (head.status !== "loaded") throw new Error("missing synthetic head"); + return head; +} +async function replace(store: AuthorityStore, head: JsonObject, operation_id: string) { + const current = await loaded(store); + assert.equal((await store.commitAuthority({operation_id, expected_provider_revision: current.provider_revision, + next_projection: head, events: [], receipts: []})).status, "applied"); +} +async function seeded(t: TestContext, provider: string, state: "bound" | "unbound" | "off", extra: JsonObject = {}) { + const root = await mkdtemp(join(tmpdir(), "loopx-acceptance-runtime-")); + t.after(() => rm(root, {recursive: true, force: true})); + let store: AuthorityStore; + if (provider === "postgresql") { + const pool = new Pool({connectionString: process.env.LOOPX_TEST_POSTGRES_URL, max: 2}); + t.after(() => pool.end()); + const database = {connect: async () => { + const client = await pool.connect(); + return {query: async (sql: string, values?: readonly unknown[]) => client.query(sql, values ? [...values] : undefined), + release: () => client.release()}; + }}; + await installPostgreSqlAuthorityStoreSchema(database, `postgresql:${"b".repeat(32)}`); + store = new PostgreSqlAuthorityStore(database, {tenant_id: `acceptance-${randomUUID()}`, goal_id: "goal-a"}); + } else store = new FileAuthorityStore(join(root, "authority", "file-v0"), "goal-a"); + const records = [todo(extra)]; + const head = projection(records, state === "off" ? undefined : acceptance(records, state === "bound")); + assert.equal((await store.commitAuthority({operation_id: "seed", expected_provider_revision: null, + next_projection: head, events: [], receipts: []})).status, "applied"); + return {store, root, head}; +} + +for (const provider of ["file", ...(process.env.LOOPX_TEST_POSTGRES_URL ? ["postgresql"] : [])]) { + test(`${provider}: absent acceptance preserves ordinary completion, receipts, and unrelated fields`, async t => { + const {store, head} = await seeded(t, provider, "off"); + const result = await executeCoordinationTodoTerminalLifecycle(store, terminal); + assert.equal(result.status, "applied"); + assert.equal(Object.hasOwn(result, "goal_acceptance_completion"), false); + const after = await loaded(store); + assert.deepEqual(after.head.unrelated_extension, head.unrelated_extension); + assert.equal(Object.hasOwn(after.head, "goal_acceptance"), false); + assert.equal((await executeCoordinationTodoTerminalLifecycle(store, terminal)).status, "replayed"); + }); + + test(`${provider}: unbound work rejects claim/lease/completion with actor precedence and no writes`, async t => { + const {store} = await seeded(t, provider, "unbound"); + const before = await loaded(store); + assert.equal((await executeCoordinationTodoClaim(store, {...claim, actor_agent_id: "intruder"})).reason_code, "actor_not_registered"); + assert.equal((await executeCoordinationTodoClaim(store, claim)).reason_code, "goal_acceptance_unbound"); + assert.equal((await executeCanonicalTaskLeaseAcquire(store, {...acquire, owner: "intruder"})).reason_code, "owner_not_registered"); + assert.equal((await executeCanonicalTaskLeaseAcquire(store, acquire)).reason_code, "goal_acceptance_unbound"); + assert.equal((await executeCoordinationTodoTerminalLifecycle(store, terminal)).reason_code, "goal_acceptance_unbound"); + assert.deepEqual(await loaded(store), before); + assert.equal((await store.readReceipt("complete")).status, "missing"); + }); + + test(`${provider}: semantic edits stay visible, invalidate claims, and preserve head extensions`, async t => { + const {store, head} = await seeded(t, provider, "bound"); + assert.equal((await executeCoordinationTodoClaim(store, claim)).status, "applied"); + assert.equal((await executeCoordinationTodoUpdate(store, {goal_id: "goal-a", todo_id: "todo_work", expected_role: "agent", + actor_agent_id: "agent-a", registered_agents: ["agent-a"], operation_id: "edit", patch: {text: "Changed work"}, + clear_fields: [], dry_run: false, now})).status, "applied"); + const after = await loaded(store); + assert.deepEqual(after.head.goal_acceptance, head.goal_acceptance); + assert.deepEqual(after.head.unrelated_extension, head.unrelated_extension); + assert.equal(acceptanceWorkGuard(after.head, "goal-a", "todo_work")?.reason_code, "goal_acceptance_stale"); + assert.equal((await executeCoordinationTodoClaim(store, claim)).reason_code, "goal_acceptance_stale", "old claim receipt cannot authorize stale work"); + assert.equal((await executeCoordinationTodoTerminalLifecycle(store, terminal)).reason_code, "goal_acceptance_stale"); + }); + + test(`${provider}: acquisition replay checks current acceptance after current lease proof`, async t => { + const {store} = await seeded(t, provider, "bound"); + assert.equal((await executeCanonicalTaskLeaseAcquire(store, acquire)).status, "applied"); + const current = await loaded(store); + await replace(store, {...current.head, goal_acceptance: acceptance(current.head.todos as JsonObject[], false)}, "unbind"); + assert.equal((await executeCanonicalTaskLeaseAcquire(store, acquire)).reason_code, "goal_acceptance_unbound"); + assert.equal((await executeCanonicalTaskLeaseAcquire(store, {...acquire, expected_version: 999, idempotency_key: "another"})).reason_code, "version_mismatch"); + }); + + test(`${provider}: completion runs fresh effects and rejects forged, failed, stale, or incomplete receipts`, async t => { + const {store} = await seeded(t, provider, "bound"); + const before = await loaded(store); + const plan = await executeCoordinationTodoTerminalLifecycle(store, terminal); + assert.equal(plan.status, "execute_validation"); + assert.equal(plan.validation_effect, null); + assert.deepEqual(plan.goal_acceptance_validation_effects, [{criterion_id: "criterion-a", effect: { + kind: "caller_validation", validation_command: null, validation_argv: ["true"], validation_label: "criterion-a", + validation_timeout_seconds: 10, validation_files: [], task_repository: null}}]); + const binding = plan.goal_acceptance_source_binding as JsonObject; + const attempt = {...terminal, goal_acceptance_source_binding: binding}; + for (const receipts of [[{criterion_id: "criterion-a", receipt: {passed: true}}], [], + [{criterion_id: "criterion-a", receipt: runnerReceipt("criterion-a", false)}], + [{criterion_id: "unconfigured", receipt: runnerReceipt("unconfigured")}], + [{criterion_id: "criterion-a", receipt: runnerReceipt()}, {criterion_id: "criterion-a", receipt: runnerReceipt()}]]) { + assert.equal((await executeCoordinationTodoTerminalLifecycle(store, {...attempt, + goal_acceptance_validation_receipts: receipts})).reason_code, "goal_acceptance_validation_rejected"); + } + const good = {...attempt, goal_acceptance_validation_receipts: [{criterion_id: "criterion-a", receipt: runnerReceipt()}]}; + for (const field of ["provider_revision", "contract_digest", "todo_semantic_digest", "operation_id"]) { + assert.equal((await executeCoordinationTodoTerminalLifecycle(store, {...good, + goal_acceptance_source_binding: {...binding, [field]: "stale"}})).reason_code, "goal_acceptance_validation_rejected"); + } + assert.deepEqual(await loaded(store), before); + assert.equal((await executeCoordinationTodoTerminalLifecycle(store, good)).status, "applied"); + assert.equal((await loaded(store)).head.todos instanceof Array, true); + const retained = await store.readReceipt("complete"); + assert.equal(retained.status, "found"); + assert.match(JSON.stringify(retained), /goal_acceptance_completion/); + assert.doesNotMatch(JSON.stringify(retained), /validation_argv/); + assert.equal((await executeCoordinationTodoTerminalLifecycle(store, terminal)).status, "replayed"); + }); + + test(`${provider}: intervening head changes require fresh validation, not an old success`, async t => { + const {store} = await seeded(t, provider, "bound"); + const plan = await executeCoordinationTodoTerminalLifecycle(store, terminal); + const current = await loaded(store); + await replace(store, {...current.head, unrelated_extension: {value: "new"}}, "intervening"); + const result = await executeCoordinationTodoTerminalLifecycle(store, {...terminal, + goal_acceptance_source_binding: plan.goal_acceptance_source_binding as JsonObject, + goal_acceptance_validation_receipts: [{criterion_id: "criterion-a", receipt: runnerReceipt()}]}); + assert.equal(result.reason_code, "goal_acceptance_validation_rejected"); + assert.equal(((await loaded(store)).head.todos as JsonObject[])[0]!.done, false); + }); +} + +test("canonical list/read expose only enabled public-safe acceptance sidecars", async t => { + const {store, root} = await seeded(t, "file", "bound"); + const records = [todo(), todo({todo_id: "todo_new", text: "New work"}), + todo({todo_id: "todo_monitor", task_class: "continuous_monitor"}), + todo({todo_id: "todo_gate", role: "user", task_class: "user_gate"})]; + await replace(store, projection(records, acceptance(records)), "add"); + const list = await listLocalCoordinationTodos({schema_version: "loopx_local_coordination_todo_list_request_v0", + runtime_root: root, goal_id: "goal-a"}); + assert.equal(list.status, "loaded", JSON.stringify(list)); + assert.equal((list.goal_acceptance_contract as JsonObject).status, "held"); + assert.doesNotMatch(JSON.stringify(list), /validation_argv/); + const guards = list.goal_acceptance_work_guards as JsonObject; + assert.deepEqual(Object.keys(guards), ["todo_new", "todo_work"]); + assert.equal((guards.todo_new as JsonObject).allowed, false); + assert.equal((list.todos as JsonObject[]).some(record => "goal_acceptance_guard" in record), false); + const read = await readLocalCoordinationTodo({schema_version: "loopx_local_coordination_todo_read_request_v0", + runtime_root: root, goal_id: "goal-a", todo_id: "todo_new"}); + assert.equal((read.goal_acceptance_guard as JsonObject).reason_code, "goal_acceptance_unbound"); + await replace(store, projection(records), "disable"); + const disabled = await listLocalCoordinationTodos({schema_version: "loopx_local_coordination_todo_list_request_v0", + runtime_root: root, goal_id: "goal-a"}); + assert.equal(Object.hasOwn(disabled, "goal_acceptance_contract"), false); + assert.equal(Object.hasOwn(disabled, "goal_acceptance_work_guards"), false); +}); + +test("completion plans both validators and rejects a combined budget exceeding 29 seconds", async t => { + const declaration = {validation_command: null, validation_command_argv: ["true"], + validation_label: "caller-check", validation_timeout_seconds: null}; + const {store} = await seeded(t, "file", "bound", {completion_validation_required: true, + completion_validation_sha256: canonicalAuthoritySha256(declaration)}); + const before = await loaded(store); + const rejected = await executeCoordinationTodoTerminalLifecycle(store, {...terminal, validation_declaration: declaration}); + assert.equal(rejected.reason_code, "goal_acceptance_validation_budget_exceeded"); + assert.deepEqual(await loaded(store), before); + const boundedDeclaration = {...declaration, validation_timeout_seconds: 5}; + const bounded = await seeded(t, "file", "bound", {completion_validation_required: true, + completion_validation_sha256: canonicalAuthoritySha256(boundedDeclaration)}); + const plan = await executeCoordinationTodoTerminalLifecycle(bounded.store, {...terminal, validation_declaration: boundedDeclaration}); + assert.equal(plan.status, "execute_validation"); + assert.equal((plan.validation_effect as JsonObject).validation_label, "caller-check"); + assert.equal((plan.goal_acceptance_validation_effects as unknown[]).length, 1); + const result = await executeCoordinationTodoTerminalLifecycle(bounded.store, {...terminal, + validation_declaration: boundedDeclaration, validation_receipt: runnerReceipt("caller-check"), + goal_acceptance_source_binding: plan.goal_acceptance_source_binding as JsonObject, + goal_acceptance_validation_receipts: [{criterion_id: "criterion-a", receipt: runnerReceipt()}]}); + assert.equal(result.status, "applied"); + assert.equal((result.validation_receipt as JsonObject).command_label, "caller-check"); + assert.ok(result.goal_acceptance_completion); +}); + +test("planning cannot assign stale work during a semantic edit and monitors stay outside acceptance", async t => { + const {store} = await seeded(t, "file", "bound"); + const before = await loaded(store); + const update = await executeCoordinationTodoUpdate(store, {goal_id: "goal-a", todo_id: "todo_work", expected_role: "agent", + actor_agent_id: "agent-a", registered_agents: ["agent-a"], operation_id: "claim-and-edit", patch: {text: "Different work"}, + planning_intent: {claimed_by: "agent-a"}, clear_fields: [], dry_run: false, now}); + assert.equal(update.reason_code, "goal_acceptance_stale"); + assert.deepEqual(await loaded(store), before); + const monitor = await seeded(t, "file", "unbound", {task_class: "continuous_monitor"}); + assert.equal((await executeCoordinationTodoClaim(monitor.store, claim)).status, "applied"); + assert.equal((await executeCoordinationTodoTerminalLifecycle(monitor.store, terminal)).status, "applied"); +}); + +test("verifier file pins travel unchanged to the acceptance execution adapter", async t => { + const {store} = await seeded(t, "file", "bound"); + const current = await loaded(store); + const state = current.head.goal_acceptance as JsonObject; + const document = state.document as JsonObject; + const files = [{path: "verify.py", sha256: "a".repeat(64)}]; + const pinned = normalizeGoalAcceptanceDocument({...document, + criteria: (document.criteria as JsonObject[]).map(criterion => ({...criterion, validation_files: files}))}); + await replace(store, {...current.head, goal_acceptance: {...state, document: pinned, + digest: canonicalAuthoritySha256(pinned)}}, "pin-verifier"); + const plan = await executeCoordinationTodoTerminalLifecycle(store, terminal); + assert.equal(plan.status, "execute_validation"); + assert.deepEqual(((plan.goal_acceptance_validation_effects as JsonObject[])[0]!.effect as JsonObject).validation_files, files); +}); + +test("a competing commit cannot separate acceptance evidence from Todo completion", async t => { + const {store} = await seeded(t, "file", "bound"); + const plan = await executeCoordinationTodoTerminalLifecycle(store, terminal); + let raced = false; + const contender = new Proxy(store, {get(target, property) { + if (property === "commitAuthority") return async (commit: Parameters[0]) => { + raced = true; + const current = await loaded(store); + await replace(store, {...current.head, unrelated_extension: {value: "competing update"}}, "racer"); + return store.commitAuthority(commit); + }; + const value = Reflect.get(target, property); + return typeof value === "function" ? value.bind(target) : value; + }}); + const result = await executeCoordinationTodoTerminalLifecycle(contender, {...terminal, + goal_acceptance_source_binding: plan.goal_acceptance_source_binding as JsonObject, + goal_acceptance_validation_receipts: [{criterion_id: "criterion-a", receipt: runnerReceipt()}]}); + assert.equal(raced, true); + assert.equal(result.status, "conflict"); + assert.equal(((await loaded(store)).head.todos as JsonObject[])[0]!.done, false); + assert.equal((await store.readReceipt("complete")).status, "missing"); +}); diff --git a/tests/test_goal_acceptance_contract_rendering.py b/tests/test_goal_acceptance_contract_rendering.py new file mode 100644 index 0000000000..cef22d4db9 --- /dev/null +++ b/tests/test_goal_acceptance_contract_rendering.py @@ -0,0 +1,96 @@ +"""Read-only rendering never upgrades association or unknown checks to acceptance.""" +from copy import deepcopy + +import pytest + +from loopx.presentation.renderers.goal_acceptance_observation_markdown import ( + append_goal_acceptance_observation_markdown, +) + + +def render(contract=None, *, source="release-demo"): + observation = { + "schema_version": "goal_acceptance_observation_projection_v0", + "goal_id": source, "historical_progress": [], "acceptance_gaps": [], "guards": [], + } + if contract is not None: + observation["goal_acceptance_contract"] = contract + lines = [] + append_goal_acceptance_observation_markdown( + lines, {"id": "release-demo", "acceptance_observation": observation} + ) + return "\n".join(lines) + + +@pytest.fixture +def contract(): + return { + "enabled": True, "revision": 7, "digest": "a" * 64, "status": "held", + "non_goals": [], "held_todo_ids": ["todo_unbound", "todo_stale"], "verification": None, + "objective": "Deliver a recoverable release", + "criteria": [{"id": "recovery", "description": "An independent recovery check passes."}], + "tasks": [ + {"todo_id": "todo_confirmed", "state": "ready", "criterion_ids": ["recovery"]}, + {"todo_id": "todo_unbound", "state": "unbound", "criterion_ids": [], "reason": "No criterion is associated."}, + {"todo_id": "todo_stale", "state": "stale", "criterion_ids": ["recovery"], "reason": "Prior contract revision."}, + ], + } + + +def test_absent_and_disabled_preserve_baseline(contract): + baseline = render() + for disabled in ({"enabled": False}, {**contract, "enabled": False, "verification": {"status": "passed"}}): + assert render(disabled) == baseline + + +@pytest.mark.parametrize("status, expected", [ + (None, "unknown"), ("unverified", "artifact checks not verified"), + ("failed", "artifact checks failed"), ("stale", "artifact checks stale"), + ("accepted", "artifact checks passed"), ("held", "task associations require confirmation"), + ("partial", "task checks passed; Goal-wide verification unknown"), +]) +def test_source_revision_and_independent_states(contract, status, expected): + contract["status"] = status + if status not in {None, "unverified"}: + contract["verification"] = { + "operation_id": "verify-release-7", "contract_revision": 6 if status == "stale" else 7, + "contract_digest": "c" * 64 if status == "stale" else contract["digest"], + "todo_id": "todo_confirmed" if status == "partial" else None, + "results": [{"criterion_id": "recovery", "passed": status != "failed", "exit_code": 1 if status == "failed" else 0}], + } + before = deepcopy(contract) + output = render(contract) + assert f"artifact verification: {expected}" in output + assert "todo\\_confirmed: task association confirmed" in output + assert "todo\\_unbound: task association missing; criteria=unknown" in output + assert "todo\\_stale: task association stale" in output + assert "Prior contract revision." in output + assert "Goal source: release-demo" in output + assert "contract revision: 7" in output + assert contract["digest"] in output + assert "criterion recovery: An independent recovery check passes." in output + assert "does not automatically approve or complete the Goal" in output + if status != "accepted": + assert "artifact checks passed" not in output + if status == "stale": + assert "contract revision: 6" in output and "c" * 64 in output + if status == "partial": + assert "verification scope: todo\\_confirmed" in output + assert contract == before + + +def test_empty_observations_remain_unknown_and_other_goal_is_not_used(contract): + assert "task associations: unknown" in render({**contract, "tasks": []}) + other_goal = render(contract, source="other-goal") + assert "source unavailable; acceptance unknown" in other_goal + assert contract["digest"] not in other_goal + assert "task association confirmed" not in other_goal + + +def test_revision_is_read_from_source_and_markup_is_escaped(contract): + updated = {**contract, "revision": 8, "digest": "sha256:" + "b" * 64, "objective": "[example](https://example.com)\n# title"} + output = render(updated) + assert "contract revision: 8" in output and updated["digest"] in output + assert contract["digest"] not in output + assert "\n# title" not in output + assert "\\[example\\]" in output