@piagent/platform 1.42.0 → 1.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/docs/command-reference-vietnamese.md +2 -2
- package/docs/distribution-standard.md +6 -6
- package/docs/operator-manual-vietnamese.md +7 -7
- package/docs/publishing-for-teams.md +1 -0
- package/docs/release-install-policy.md +2 -2
- package/docs/team-onboarding.md +2 -2
- package/docs-site/architecture.html +1 -1
- package/docs-site/assets/search-en.json +1 -1
- package/docs-site/assets/search-vi.json +1 -1
- package/docs-site/benchmark.html +1 -1
- package/docs-site/commands.html +1 -1
- package/docs-site/context-engine.html +1 -1
- package/docs-site/ecosystem.html +1 -1
- package/docs-site/en/architecture.html +1 -1
- package/docs-site/en/benchmark.html +1 -1
- package/docs-site/en/commands.html +1 -1
- package/docs-site/en/context-engine.html +1 -1
- package/docs-site/en/ecosystem.html +1 -1
- package/docs-site/en/index.html +9 -9
- package/docs-site/en/mcp-approval.html +1 -1
- package/docs-site/en/mcp-auth.html +1 -1
- package/docs-site/en/mcp-servers.html +1 -1
- package/docs-site/en/mcp.html +1 -1
- package/docs-site/en/permissions.html +1 -1
- package/docs-site/en/profiles.html +1 -1
- package/docs-site/en/quickstart.html +1 -1
- package/docs-site/en/runtime.html +1 -1
- package/docs-site/en/scope.html +1 -1
- package/docs-site/en/security.html +1 -1
- package/docs-site/en/team.html +1 -1
- package/docs-site/en/update.html +3 -3
- package/docs-site/en/whats-new.html +30 -19
- package/docs-site/en/windows.html +1 -1
- package/docs-site/en/workflows.html +1 -1
- package/docs-site/index.html +9 -9
- package/docs-site/mcp-approval.html +1 -1
- package/docs-site/mcp-auth.html +1 -1
- package/docs-site/mcp-servers.html +1 -1
- package/docs-site/mcp.html +1 -1
- package/docs-site/permissions.html +1 -1
- package/docs-site/profiles.html +1 -1
- package/docs-site/quickstart.html +1 -1
- package/docs-site/releases.json +36 -0
- package/docs-site/runtime.html +1 -1
- package/docs-site/scope.html +1 -1
- package/docs-site/security.html +1 -1
- package/docs-site/team.html +1 -1
- package/docs-site/update.html +3 -3
- package/docs-site/whats-new.html +30 -19
- package/docs-site/windows.html +1 -1
- package/docs-site/workflows.html +1 -1
- package/evals/private-holdout-v1/public-exposure.v2.json +1 -1
- package/package.json +1 -1
- package/packages/piagent-core/managed/dist/workspace/manifest.json +1 -1
- package/packages/piagent-core/managed/dist/workspace/worker.mjs +1 -1
- package/packages/piagent-core/package.json +1 -1
- package/packages/piagent-core/security/workspace-file-reader.ts +3 -1
- package/packages/piagent-webui/dist/client/assets/ActivityPanel-DRAiHliI.js +1 -0
- package/packages/piagent-webui/dist/client/assets/App-JMuP_9-r.js +5 -0
- package/packages/piagent-webui/dist/client/assets/GatewayApp-awcOLVTi.js +93 -0
- package/packages/piagent-webui/dist/client/assets/InspectionApp-DtDc9NxN.js +1 -0
- package/packages/piagent-webui/dist/client/assets/{LineReview-DzonwD-g.js → LineReview-DZ9ez8kO.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/{MarkdownMessage-DchODuO7.js → MarkdownMessage-D7bbIWJe.js} +2 -2
- package/packages/piagent-webui/dist/client/assets/SessionAgentWorkspace-DLwK12hX.js +1 -0
- package/packages/piagent-webui/dist/client/assets/SessionInspectorDrawer-CsPNI6aU.js +2 -0
- package/packages/piagent-webui/dist/client/assets/SettingsNavigation-CM0s3QUC.js +3 -0
- package/packages/piagent-webui/dist/client/assets/SettingsPage-Cr6M2FVg.js +1 -0
- package/packages/piagent-webui/dist/client/assets/TerminalPanel-A78JVp4e.js +2 -0
- package/packages/piagent-webui/dist/client/assets/{TerminalView-BML7uS6R.js → TerminalView-CR4TO5f1.js} +3 -3
- package/packages/piagent-webui/dist/client/assets/{WorkspaceCodeEditor-B7ieqDnt.js → WorkspaceCodeEditor-DPOp-ZoD.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/WorkspaceExplorer-H8Ogln3d.js +5 -0
- package/packages/piagent-webui/dist/client/assets/{WorkspaceQuickOpen-CGoGfUPk.js → WorkspaceQuickOpen-vQ5DqfJl.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/composer-drafts-BtMaVw8W.js +1 -0
- package/packages/piagent-webui/dist/client/assets/index-qi6mjvTy.js +37 -0
- package/packages/piagent-webui/dist/client/assets/latest-request-DXcYQW86.js +1 -0
- package/packages/piagent-webui/dist/client/assets/{tab-close-Crj8vsUq.js → tab-close-DHDqCxTL.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/terminal-transport-Dk5pYNX5.js +1 -0
- package/packages/piagent-webui/dist/client/assets/transcript-view-model-BNGQCkzY.js +3 -0
- package/packages/piagent-webui/dist/client/assets/{ui-preferences-B3UfDp-5.js → ui-preferences-Dy4qeODT.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/vendor-CA5pzJiI.js +136 -0
- package/packages/piagent-webui/dist/client/assets/view-model-CWNiS4JN.js +1 -0
- package/packages/piagent-webui/dist/client/assets/workspace-navigation-C8GtShbg.js +1 -0
- package/packages/piagent-webui/dist/client/index.html +3 -5
- package/packages/piagent-webui/gateway/signed-session-journal.ts +16 -6
- package/packages/piagent-webui/server/loopback-server.ts +19 -5
- package/packages/piagent-webui/server/static-bundle.ts +10 -2
- package/scripts/verify-local.sh +17 -1
- package/packages/piagent-webui/dist/client/assets/App-DBx4BU3F.js +0 -5
- package/packages/piagent-webui/dist/client/assets/SessionInspectorDrawer-BHHNlct3.js +0 -1
- package/packages/piagent-webui/dist/client/assets/SettingsPage-DX28MsZA.js +0 -1
- package/packages/piagent-webui/dist/client/assets/TerminalPanel-C--BiN0p.js +0 -2
- package/packages/piagent-webui/dist/client/assets/WorkspaceExplorer-BOafuPU-.js +0 -5
- package/packages/piagent-webui/dist/client/assets/index-C7Azrwpq.js +0 -132
- package/packages/piagent-webui/dist/client/assets/vendor-Ch5hIe0W.js +0 -136
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={active:`Đang hoạt động`,"pause-requested":`Đang yêu cầu tạm dừng`,paused:`Đã tạm dừng`,terminal:`Đã kết thúc`,idle:`Đang chờ`,running:`Đang chạy`,stopping:`Đang dừng`,settled:`Đã ổn định`,unknown:`Chưa xác định`,pending:`Chưa xong`,completed:`Hoàn thành`,blocked:`Bị chặn`,partial:`Một phần`,failed:`Thất bại`,satisfied:`Đã đạt`,unavailable:`Không có dữ liệu`,connected:`Đã kết nối`,disconnected:`Mất kết nối`,reconnecting:`Đang kết nối lại`,"resync-required":`Cần đồng bộ lại`,none:`Không có`,waiting:`Đang chờ duyệt`,current:`Mới nhất`,stale:`Đã cũ`,"not-run":`Chưa chạy`,"in-progress":`Đang làm`,done:`Đã xong`,skipped:`Bỏ qua`,resume:`Tiếp tục`,retry:`Thử lại`,observed:`Đã ghi nhận`,requested:`Đã yêu cầu`,"possible-interruption":`Có thể bị gián đoạn`,complete:`Đầy đủ`,"aggregate-only":`Chỉ có dữ liệu tổng hợp`,off:`Tắt`,minimal:`Tối thiểu`,low:`Thấp`,medium:`Trung bình`,high:`Cao`,xhigh:`Rất cao`,max:`Tối đa`,orphaned:`Mất owner`,cancelled:`Đã hủy`,succeeded:`Thành công`,"stale-result":`Kết quả đến muộn`,accepted:`Đã nhận`,rejected:`Không nhận`,"not-recorded":`Chưa có kết quả`,parent:`Task cha`,helper:`Helper`,"read-only":`Chỉ đọc`,"workspace-write":`Ghi trong project`,"trusted-full-access":`Toàn quyền`,bypass:`Bypass`,"single-writer":`Một writer`,retriever:`Retriever`,scout:`Scout`,planner:`Planner`,worker:`Worker`,reviewer:`Reviewer`,oracle:`Oracle`,researcher:`Researcher`,ready:`Sẵn sàng`,missing:`Chưa có bằng chứng`,interrupted:`Bị gián đoạn`,stopped:`Đã dừng`,aborted:`Đã hủy do lỗi`,incomplete:`Chưa có kết luận`,passed:`Đạt`,"not-applicable":`Không áp dụng`,smoke:`Smoke`,"public-regression":`Public regression`,capability:`Capability`,"private-holdout":`Private holdout`,"production-shadow":`Production shadow`,"pdf-converter-unavailable":`Host chưa cài pdftotext (poppler) nên chưa đọc được .pdf`,"pdf-text-unavailable":`PDF này không có text bóc được; nhiều khả năng là bản scan, cần OCR trước`,"pdf-extraction-failed":`Không chuyển được PDF này sang text`,"docx-unreadable":`File .docx này hỏng, bị mã hóa, hoặc không phải file Word thật`,"document-text-empty":`Tài liệu không có chữ nào để đọc`,"document-size-limit":`Tài liệu vượt giới hạn dung lượng`,"text-size-limit":`File text vượt giới hạn dung lượng`,"text-content-invalid":`Nội dung file không phải văn bản (file nhị phân), chưa gửi vào chat được`,"image-mime-mismatch":`Nội dung ảnh không khớp với đuôi file`,"model-image-input-unavailable":`Model hiện tại không nhận ảnh`,"attachment-capacity-limit":`Đã chạm giới hạn số file hoặc dung lượng đính kèm`,"no-readable-root":`Chưa có thư mục nào đọc được`,"document-roots-unavailable":`Không xác định được thư mục tài liệu`,"document-not-listed":`Tài liệu không còn trong danh sách; hãy tải lại`,"document-unavailable":`Không mở được tài liệu này`,"document-protected":`Tài liệu nằm trong protectedPaths nên không được đọc`,"document-changed":`File đã thay đổi sau khi liệt kê; chưa đọc gì cả`,"document-unreadable":`Không đọc được nội dung tài liệu`,"document-needs-ocr":`Tài liệu là bản scan, cần OCR trước khi đọc được chữ`,"document-converter-unavailable":`Host chưa cài pdftotext (poppler) nên chưa đọc được .pdf`,"session-command-effect-unknown":`Pi đã nhận yêu cầu nhưng đang đồng bộ trạng thái; không gửi lại để tránh chạy trùng`},t={active:`Active`,"pause-requested":`Pause requested`,paused:`Paused`,terminal:`Finished`,idle:`Idle`,running:`Running`,stopping:`Stopping`,settled:`Settled`,unknown:`Unknown`,pending:`Pending`,completed:`Completed`,blocked:`Blocked`,partial:`Partial`,failed:`Failed`,satisfied:`Satisfied`,unavailable:`Unavailable`,connected:`Connected`,disconnected:`Disconnected`,reconnecting:`Reconnecting`,"resync-required":`Resync required`,none:`None`,waiting:`Awaiting approval`,current:`Current`,stale:`Stale`,"not-run":`Not run`,"in-progress":`In progress`,done:`Done`,skipped:`Skipped`,resume:`Resume`,retry:`Retry`,observed:`Observed`,requested:`Requested`,"possible-interruption":`Possible interruption`,complete:`Complete`,"aggregate-only":`Aggregate only`,off:`Off`,minimal:`Minimal`,low:`Low`,medium:`Medium`,high:`High`,xhigh:`Extra high`,max:`Maximum`,orphaned:`Owner missing`,cancelled:`Cancelled`,succeeded:`Succeeded`,"stale-result":`Stale result`,accepted:`Accepted`,rejected:`Rejected`,"not-recorded":`Not recorded`,parent:`Parent task`,helper:`Helper`,"read-only":`Read only`,"workspace-write":`Workspace write`,"trusted-full-access":`Full access`,bypass:`Bypass`,"single-writer":`Single writer`,retriever:`Retriever`,scout:`Scout`,planner:`Planner`,worker:`Worker`,reviewer:`Reviewer`,oracle:`Oracle`,researcher:`Researcher`,ready:`Ready`,missing:`Evidence missing`,interrupted:`Interrupted`,stopped:`Stopped`,aborted:`Aborted`,incomplete:`Incomplete`,passed:`Passed`,"not-applicable":`Not applicable`,smoke:`Smoke`,"public-regression":`Public regression`,capability:`Capability`,"private-holdout":`Private holdout`,"production-shadow":`Production shadow`,"pdf-converter-unavailable":`This host has no pdftotext (poppler), so .pdf cannot be read`,"pdf-text-unavailable":`This PDF holds no extractable text; it is probably scanned and needs OCR first`,"pdf-extraction-failed":`The PDF could not be converted to text`,"docx-unreadable":`This .docx is corrupt, encrypted, or not really a Word document`,"document-text-empty":`The document contains no readable text`,"document-size-limit":`The document is over the size limit`,"text-size-limit":`The text file is over the size limit`,"text-content-invalid":`The file is not text (binary), so it cannot go into the chat`,"image-mime-mismatch":`The image content does not match its file extension`,"model-image-input-unavailable":`The current model does not accept images`,"attachment-capacity-limit":`The attachment count or size limit was reached`,"no-readable-root":`No readable directory is available`,"document-roots-unavailable":`The document directories could not be resolved`,"document-not-listed":`The document is no longer listed; reload the list`,"document-unavailable":`This document could not be opened`,"document-protected":`The document is under protectedPaths and is not readable`,"document-changed":`The file changed after it was listed; nothing was read`,"document-unreadable":`The document content could not be read`,"document-needs-ocr":`The document is scanned and needs OCR before it holds text`,"document-converter-unavailable":`This host has no pdftotext (poppler), so .pdf cannot be read`,"session-command-effect-unknown":`Pi received the request and is resyncing; do not resend it, to avoid a duplicate run`};function n(n,r=`vi`){return n?(r===`vi`?e:t)[n]??n.replaceAll(`-`,` `):r===`vi`?`Chưa có`:`Not available`}function r(e){return[`completed`,`satisfied`,`current`,`connected`,`done`,`passed`].includes(e??``)?`positive`:[`blocked`,`failed`,`error`,`expired`].includes(e??``)?`danger`:[`pause-requested`,`paused`,`waiting`,`stale`,`stale-result`,`orphaned`,`partial`,`reconnecting`].includes(e??``)?`warning`:[`running`,`active`,`in-progress`].includes(e??``)?`info`:`neutral`}function i(e){return e?e.length>22?`${e.slice(0,10)}…${e.slice(-7)}`:e:`—`}function a(e,t=`vi`){return e.session.model.state===`known`&&e.session.model.value?e.session.model.value.displayName:t===`vi`?`Model chưa xác định`:`Unknown model`}function o(e,t=`vi`){return e.session.thinking.state===`known`&&e.session.thinking.value?n(e.session.thinking.value,t):t===`vi`?`Chưa xác định`:`Unknown`}function s(e,t=`vi`){let r=e.session.permissionProfile;return r.state===`known`&&r.value?n(r.value,t):t===`vi`?`Quyền chưa xác định`:`Unknown permission`}function c(e,t=`vi`){let n=e.relatedFileRefs.length,r=e.verifierAttemptRefs.length;return!n&&!r?t===`vi`?`Chưa có bằng chứng liên kết`:`No linked evidence`:t===`vi`?`${n} file · ${r} lần kiểm tra`:`${n} files · ${r} verifier runs`}function l(e,t=`vi`){let n=e.task;return n?{completed:n.progress.completed,total:n.progress.total,percent:Math.max(0,Math.min(100,n.progress.percent)),text:t===`vi`?`${n.progress.completed}/${n.progress.total} tiêu chí`:`${n.progress.completed}/${n.progress.total} criteria`}:{completed:0,total:0,percent:0,text:t===`vi`?`Chưa có task đang chạy`:`No active task`}}export{s as a,r as c,a as i,c as n,l as o,n as r,o as s,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Dn as t,In as n,zt as r}from"./vendor-CA5pzJiI.js";import{i,n as a}from"./ui-preferences-Dy4qeODT.js";var o=e(n(),1),s=t(),c=`piagent-workspace-open`;function l(e,t=1){let n=/^(.+?)(?::(\d+)(?::\d+)?)?$/.exec(e.replace(/^@/,``)),r=n?.[1];return!r||r.length>4096||/^[~/]/.test(r)||/[\\\x00-\x1f\x7f:]/.test(r)||r.split(`/`).some(e=>!e||e===`.`||e===`..`)?null:{path:r,line:Math.max(1,Math.min(1e6,Number(n?.[2])||t||1))}}var u=(0,o.createContext)(null);function d({sessionRef:e,onOpen:t,children:n}){return(0,s.jsx)(u.Provider,{value:e?n=>{t(),window.dispatchEvent(new CustomEvent(c,{detail:{sessionRef:e,...n}}))}:null,children:n})}function f({path:e,line:t,children:n}){let c=(0,o.useContext)(u),{locale:d}=i(),f=l(e,t);return!c||!f?n?(0,s.jsx)(s.Fragment,{children:n}):null:(0,s.jsx)(r,{size:`small`,onClick:()=>c(f),sx:{textTransform:`none`,verticalAlign:`baseline`},children:n??a(d,`Mở trong editor`,`Open in editor`)})}function p({children:e}){return(0,s.jsx)(s.Fragment,{children:o.Children.map(e,e=>typeof e==`string`?e.split(/((?<![\w@])@[\w./-]+\.[\w]+(?::\d+)?)/g).map((e,t)=>e.startsWith(`@`)&&l(e)?(0,s.jsx)(f,{path:e,children:e},t):e):e)})}export{l as a,d as i,f as n,p as r,c as t};
|
|
@@ -7,12 +7,10 @@
|
|
|
7
7
|
<meta name="csp-nonce" content="__PIAGENT_CSP_NONCE__" />
|
|
8
8
|
<meta name="piagent-webui-mode" content="__PIAGENT_WEBUI_MODE__" />
|
|
9
9
|
<title>Piagent WebUI</title>
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-qi6mjvTy.js"></script>
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/ui-preferences-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/bootstrap-CedkNtRG.js">
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/api-BUjrtT1B.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-CA5pzJiI.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/ui-preferences-Dy4qeODT.js">
|
|
16
14
|
<link rel="stylesheet" crossorigin href="/assets/index-Dqb2hNan.css">
|
|
17
15
|
</head>
|
|
18
16
|
<body>
|
|
@@ -2,6 +2,8 @@ import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
|
+
// Windows uses inherited ACLs in the Gateway profile; Node mode bits do not represent them.
|
|
6
|
+
const POSIX_PERMISSIONS = process.platform !== "win32";
|
|
5
7
|
const MAX_BYTES = 8 * 1024 * 1024, MAX_RECORDS = 4000;
|
|
6
8
|
type SessionRecord = { identity: { sessionRef: string }; idempotencyKeyDigest: string };
|
|
7
9
|
type Journal<T> = { version: 1; sequence: number; records: Array<{ sequence: number; receipt: T }> };
|
|
@@ -24,7 +26,7 @@ export class SignedSessionJournal<T extends SessionRecord> {
|
|
|
24
26
|
}
|
|
25
27
|
#checkDirectory(): void {
|
|
26
28
|
const stat = fs.lstatSync(this.#root);
|
|
27
|
-
if (!stat.isDirectory() || stat.isSymbolicLink() || (stat.mode & 0o077)
|
|
29
|
+
if (!stat.isDirectory() || stat.isSymbolicLink() || (POSIX_PERMISSIONS && (stat.mode & 0o077))
|
|
28
30
|
|| typeof process.getuid === "function" && stat.uid !== process.getuid()
|
|
29
31
|
|| stat.dev !== this.#directory.dev || stat.ino !== this.#directory.ino) throw new Error("workspace-journal-unsafe");
|
|
30
32
|
}
|
|
@@ -37,12 +39,17 @@ export class SignedSessionJournal<T extends SessionRecord> {
|
|
|
37
39
|
}
|
|
38
40
|
#read(sessionRef: string): Journal<T> {
|
|
39
41
|
this.#checkDirectory();
|
|
40
|
-
let descriptor: number;
|
|
41
|
-
|
|
42
|
+
let descriptor: number, before: fs.Stats;
|
|
43
|
+
const file = this.#file(sessionRef);
|
|
44
|
+
try {
|
|
45
|
+
before = fs.lstatSync(file);
|
|
46
|
+
if (!before.isFile() || before.isSymbolicLink()) throw new Error("workspace-journal-unsafe");
|
|
47
|
+
descriptor = fs.openSync(file, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW ?? 0) | (fs.constants.O_NONBLOCK ?? 0));
|
|
48
|
+
}
|
|
42
49
|
catch (error) { if ((error as NodeJS.ErrnoException).code === "ENOENT") return { version: 1, sequence: 0, records: [] }; throw error; }
|
|
43
50
|
try {
|
|
44
51
|
const stat = fs.fstatSync(descriptor);
|
|
45
|
-
if (!stat.isFile() || stat.nlink !== 1 || stat.size > MAX_BYTES || (stat.mode & 0o077)
|
|
52
|
+
if (!stat.isFile() || stat.dev !== before.dev || stat.ino !== before.ino || stat.nlink !== 1 || stat.size > MAX_BYTES || (POSIX_PERMISSIONS && (stat.mode & 0o077))
|
|
46
53
|
|| typeof process.getuid === "function" && stat.uid !== process.getuid()) throw new Error("workspace-journal-unsafe");
|
|
47
54
|
const { value, mac } = JSON.parse(fs.readFileSync(descriptor, "utf8")) as { value: Journal<T>; mac: string };
|
|
48
55
|
if (!value || typeof mac !== "string" || !/^[a-f0-9]{64}$/.test(mac) || !timingSafeEqual(Buffer.from(mac, "hex"), Buffer.from(this.#sign(sessionRef, value), "hex"))
|
|
@@ -70,8 +77,11 @@ export class SignedSessionJournal<T extends SessionRecord> {
|
|
|
70
77
|
descriptor = fs.openSync(temporary, fs.constants.O_WRONLY | fs.constants.O_CREAT | fs.constants.O_EXCL | fs.constants.O_NOFOLLOW, 0o600);
|
|
71
78
|
fs.writeFileSync(descriptor, bytes); fs.fsyncSync(descriptor); fs.closeSync(descriptor); descriptor = undefined;
|
|
72
79
|
this.#checkDirectory(); fs.renameSync(temporary, this.#file(sessionRef));
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
// Windows cannot open a directory with the Node read-only file API.
|
|
81
|
+
if (process.platform !== "win32") {
|
|
82
|
+
const directory = fs.openSync(this.#root, fs.constants.O_RDONLY);
|
|
83
|
+
try { fs.fsyncSync(directory); } finally { fs.closeSync(directory); }
|
|
84
|
+
}
|
|
75
85
|
} finally { if (descriptor !== undefined) fs.closeSync(descriptor); fs.rmSync(temporary, { force: true }); }
|
|
76
86
|
}
|
|
77
87
|
}
|
|
@@ -36,12 +36,27 @@ export type LoopbackServer = {
|
|
|
36
36
|
close(): Promise<void>;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
function
|
|
39
|
+
function acceptsGzip(header: string | undefined): boolean {
|
|
40
|
+
// Opt in only to an explicit gzip token, respecting a refusal/invalid quality.
|
|
41
|
+
const token = header?.split(",").map(value => value.trim().toLowerCase())
|
|
42
|
+
.find(value => value.split(";", 1)[0].trim() === "gzip");
|
|
43
|
+
if (!token) return false;
|
|
44
|
+
const parameters = token.split(";").slice(1).map(value => value.trim());
|
|
45
|
+
if (!parameters.length) return true;
|
|
46
|
+
return parameters.length === 1 && /^q\s*=\s*(?:0(?:\.\d{0,3})?|1(?:\.0{0,3})?)$/.test(parameters[0])
|
|
47
|
+
&& Number(parameters[0].split("=")[1].trim()) > 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function serveAsset(response: ServerResponse, asset: StaticAsset, encoding: string | undefined, head: boolean): void {
|
|
51
|
+
const gzip = asset.gzipBody && acceptsGzip(encoding);
|
|
52
|
+
const body = gzip ? asset.gzipBody! : asset.body;
|
|
40
53
|
response.statusCode = 200;
|
|
41
54
|
response.setHeader("Cache-Control", "no-store");
|
|
42
55
|
response.setHeader("Content-Type", asset.contentType);
|
|
43
|
-
response.setHeader("
|
|
44
|
-
response.
|
|
56
|
+
if (asset.gzipBody) response.setHeader("Vary", "Accept-Encoding");
|
|
57
|
+
if (gzip) response.setHeader("Content-Encoding", "gzip");
|
|
58
|
+
response.setHeader("Content-Length", body.length);
|
|
59
|
+
response.end(head ? undefined : body);
|
|
45
60
|
}
|
|
46
61
|
|
|
47
62
|
export async function startLoopbackServer(options: {
|
|
@@ -453,8 +468,7 @@ export async function startLoopbackServer(options: {
|
|
|
453
468
|
if (request.method !== "GET" && request.method !== "HEAD") return errorResponse(response, 405, "method-not-allowed");
|
|
454
469
|
const asset = assets.get(url.pathname);
|
|
455
470
|
if (!asset || url.search) return errorResponse(response, 404, "not-found");
|
|
456
|
-
|
|
457
|
-
serveAsset(response, asset);
|
|
471
|
+
serveAsset(response, asset, request.headers["accept-encoding"], request.method === "HEAD");
|
|
458
472
|
});
|
|
459
473
|
const gatewaySocket = options.gatewayProtocol ? attachGatewayWebSocket({
|
|
460
474
|
server, origin: () => origin, authority: auth, protocol: options.gatewayProtocol
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { gzipSync } from "node:zlib";
|
|
3
4
|
|
|
4
5
|
const MAX_FILE_BYTES = 2 * 1024 * 1024;
|
|
5
6
|
const MAX_TOTAL_BYTES = 16 * 1024 * 1024;
|
|
@@ -9,7 +10,7 @@ const MIME = new Map([
|
|
|
9
10
|
[".svg", "image/svg+xml"], [".woff2", "font/woff2"]
|
|
10
11
|
]);
|
|
11
12
|
|
|
12
|
-
export type StaticAsset = { body: Buffer; contentType: string };
|
|
13
|
+
export type StaticAsset = { body: Buffer; contentType: string; gzipBody?: Buffer };
|
|
13
14
|
|
|
14
15
|
export function loadStaticBundle(root: string): ReadonlyMap<string, StaticAsset> {
|
|
15
16
|
const absoluteRoot = path.resolve(root), rootStat = fs.lstatSync(absoluteRoot);
|
|
@@ -30,7 +31,14 @@ export function loadStaticBundle(root: string): ReadonlyMap<string, StaticAsset>
|
|
|
30
31
|
try {
|
|
31
32
|
const opened = fs.fstatSync(descriptor);
|
|
32
33
|
if (!opened.isFile() || opened.dev !== stat.dev || opened.ino !== stat.ino || opened.size !== stat.size) throw new Error("static-asset-race");
|
|
33
|
-
|
|
34
|
+
const body = fs.readFileSync(descriptor);
|
|
35
|
+
// Only immutable code/styles. HTML receives a per-server CSP nonce later.
|
|
36
|
+
// Compression is paid once at startup, never on an API or asset request.
|
|
37
|
+
const compressed = body.length >= 1024 && [".js", ".css"].includes(path.extname(relative))
|
|
38
|
+
? gzipSync(body) : undefined;
|
|
39
|
+
assets.set(relative === "index.html" ? "/" : `/${relative}`, {
|
|
40
|
+
body, contentType, gzipBody: compressed && compressed.length < body.length ? compressed : undefined
|
|
41
|
+
});
|
|
34
42
|
} finally { fs.closeSync(descriptor); }
|
|
35
43
|
}
|
|
36
44
|
};
|
package/scripts/verify-local.sh
CHANGED
|
@@ -921,7 +921,23 @@ node "$ROOT/scripts/check-third-party-neutrality.mjs" >/dev/null
|
|
|
921
921
|
run_quietly "npm run build --workspace @piagent/webui" npm run build --workspace @piagent/webui
|
|
922
922
|
# Integration files each own a real SDK and may run bounded worker processes.
|
|
923
923
|
# Limit competing files without changing selection, assertions or deadlines.
|
|
924
|
-
|
|
924
|
+
# These end-to-end managed journeys run Chromium, Gateway, SDK and broker
|
|
925
|
+
# processes together. Give them a dedicated slot rather than competing with
|
|
926
|
+
# another SDK-heavy test on the small macOS CI runner. Keep their assertions
|
|
927
|
+
# and deadlines unchanged, and still select every top-level test exactly once.
|
|
928
|
+
managed_browser_tests=(
|
|
929
|
+
"$ROOT/tests/managed-dashboard-relay.test.mjs"
|
|
930
|
+
"$ROOT/tests/managed-inference-error-web.test.mjs"
|
|
931
|
+
)
|
|
932
|
+
other_tests=()
|
|
933
|
+
for test_file in "$ROOT"/tests/*.test.mjs; do
|
|
934
|
+
case "$test_file" in
|
|
935
|
+
"${managed_browser_tests[0]}"|"${managed_browser_tests[1]}") ;;
|
|
936
|
+
*) other_tests+=("$test_file") ;;
|
|
937
|
+
esac
|
|
938
|
+
done
|
|
939
|
+
run_quietly "managed browser integration tests" env PIAGENT_NO_UPDATE_CHECK=1 node --test --test-concurrency=1 "${managed_browser_tests[@]}"
|
|
940
|
+
run_quietly "remaining Node tests" env PIAGENT_NO_UPDATE_CHECK=1 node --test --test-concurrency=2 "${other_tests[@]}"
|
|
925
941
|
run_quietly "npm run test:webui:e2e" npm run test:webui:e2e
|
|
926
942
|
if [[ -x "$ROOT/node_modules/.bin/tsc" ]]; then
|
|
927
943
|
run_quietly "npm run typecheck" npm run typecheck
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownMessage-DchODuO7.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-Ch5hIe0W.js","assets/index-C7Azrwpq.js","assets/ui-preferences-B3UfDp-5.js","assets/bootstrap-CedkNtRG.js","assets/api-BUjrtT1B.js","assets/index-Dqb2hNan.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{Bt as n,Ct as r,D as i,Dn as a,Dt as o,Ft as s,In as c,Jt as l,Lt as u,Mt as d,Nt as f,Ot as p,Rt as m,St as h,Tt as g,Ut as _,Vt as v,Wt as ee,_t as y,a as b,c as x,ct as S,d as C,gt as w,i as T,it as E,j as D,l as O,mt as te,n as k,o as ne,ot as A,r as re,rt as j,s as ie,st as ae,u as oe,v as M,wt as se,xt as ce,zt as le}from"./vendor-Ch5hIe0W.js";import{i as N,n as P}from"./ui-preferences-B3UfDp-5.js";import{$ as ue,A as de,H as fe,I as pe,J as me,N as he,O as ge,Q as _e,S as ve,U as ye,V as be,W as xe,X as Se,Y as Ce,Z as we,_ as Te,at as Ee,b as De,ct as Oe,f as ke,g as Ae,h as je,it as Me,k as Ne,lt as Pe,m as Fe,nt as Ie,ot as Le,q as Re,rt as ze,st as Be,tt as Ve,v as He,y as Ue,z as F}from"./api-BUjrtT1B.js";import{A as We,C as Ge,D as I,E as Ke,F as qe,M as Je,N as Ye,O as Xe,P as Ze,S as L,T as Qe,_ as R,a as $e,b as et,g as tt,h as nt,i as rt,j as it,k as z,o as at,s as ot,v as B,w as V,x as H,y as U}from"./index-C7Azrwpq.js";import{a as st,c as ct,d as lt,i as ut,l as dt,n as ft,o as pt,p as mt,r as ht,s as gt,t as _t,u as vt}from"./LineReview-DzonwD-g.js";var W=t(c(),1);function yt(e){return Array.isArray(e)?`[${e.map(yt).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${yt(t)}`).join(`,`)}}`:JSON.stringify(e)}async function bt(e){let t=new TextEncoder().encode(yt(e)),n=await crypto.subtle.digest(`SHA-256`,t);return`sha256:${[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}async function xt(e,t,n){if(!t.target||t.state===`unavailable`)throw Error(`review-target-unavailable`);let r=new Date,i=new Date(r.getTime()+3e5),a=t.target,o={...structuredClone(e.identity),agentOperationId:null,toolCallId:null},s={runtimeRevision:e.revision.runtimeRevision,taskRevision:a.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:a.workspaceRevision,indexRevision:a.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:a.patchPreimage},c={view:a.view,fileRef:a.fileRef,diffRef:a.diffRef,reviewState:n,contentDigest:a.contentDigest},l={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`review-command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:i.toISOString(),capabilityScope:`reviewActions`,action:`review.mark`,actionDigest:``,identity:o,expectedRevisions:s,payload:c};return l.actionDigest=await bt({action:l.action,identity:o,expectedRevisions:s,payload:c}),l}function G(e){return Array.isArray(e)?`[${e.map(G).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${G(t)}`).join(`,`)}}`:JSON.stringify(e)}async function St(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(G(e)));return`sha256:${[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}async function Ct(e,t,n=[]){if(t.state!==`ready`||!t.target)throw Error(`source-mutation-preview-unavailable`);let r=new Date,i=t.target,a={...structuredClone(e.identity),agentOperationId:null,toolCallId:null};if(n.length>128||new Set(n).size!==n.length||n.some(e=>!i.hunkRefs.includes(e))||G(n)!==G(i.hunkRefs.filter(e=>n.includes(e))))throw Error(`source-mutation-hunk-unavailable`);let o={runtimeRevision:e.revision.runtimeRevision,taskRevision:i.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:i.workspaceRevision,indexRevision:i.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:i.workspacePreimage,indexPreimage:i.indexPreimage,patchPreimage:i.patchPreimage},s={fileRef:i.fileRef,hunkRefs:[...n],contentDigest:i.contentDigest},c={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`source-mutation.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:new Date(r.getTime()+3e5).toISOString(),capabilityScope:`reviewActions`,action:t.action,actionDigest:``,identity:a,expectedRevisions:o,payload:s};return c.actionDigest=await St({action:c.action,identity:a,expectedRevisions:o,payload:s}),c}function wt(e){return Array.isArray(e)?`[${e.map(wt).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${wt(t)}`).join(`,`)}}`:JSON.stringify(e)}async function Tt(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(wt(e)));return`sha256:${[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}async function Et(e,t,n=null,r=null){if(!e.identity.taskId||!e.identity.taskRunId||!e.revision.taskRevision||!e.revision.workspaceRevision)throw Error(`source-open-task-authority-unavailable`);if(r!==null&&n===null)throw Error(`source-open-location-invalid`);let i=new Date,a={...structuredClone(e.identity),agentOperationId:null,toolCallId:null},o={runtimeRevision:e.revision.runtimeRevision,taskRevision:e.revision.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:e.revision.workspaceRevision,indexRevision:e.revision.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:null},s={fileRef:t,line:n,column:r},c={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`source-open.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:i.toISOString(),expiresAt:new Date(i.getTime()+3e5).toISOString(),capabilityScope:`reviewActions`,action:`source.open-in-vscode`,actionDigest:``,identity:a,expectedRevisions:o,payload:s};return c.actionDigest=await Tt({action:c.action,identity:a,expectedRevisions:o,payload:s}),c}var Dt=new Set(`as.async.await.break.case.catch.class.const.continue.def.delete.do.else.enum.export.extends.finally.for.from.function.if.implements.import.in.interface.let.new.of.package.private.protected.public.return.static.struct.switch.throw.try.type.var.while.with.yield`.split(`.`)),Ot=new Set([`false`,`nil`,`null`,`None`,`true`,`undefined`]),kt=new Set([`py`,`rb`,`sh`,`bash`,`zsh`,`yaml`,`yml`,`toml`]);function At(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<0?``:t.slice(n+1).toLowerCase()}function jt(e){return/[A-Za-z_$]/.test(e)}function Mt(e){return/[A-Za-z0-9_$-]/.test(e)}function Nt(e){return e>=`0`&&e<=`9`}function Pt(e,t,n){if(!n)return;let r=e[e.length-1];r?.kind===t?r.text+=n:e.push({kind:t,text:n})}function Ft(e,t){let n=[],r=At(t),i=0;for(;i<e.length;){if(e.startsWith(`//`,i)||e.startsWith(`/*`,i)||e[i]===`#`&&kt.has(r)){Pt(n,`comment`,e.slice(i));break}let t=e[i]??``;if(t===`"`||t===`'`||t==="`"){let r=t,a=i+1;for(;a<e.length;){if(e[a]===`\\`){a+=2;continue}if(e[a]===r){a+=1;break}a+=1}let o=e.slice(i,a);Pt(n,e.slice(a).match(/^\s*:/)&&r===`"`?`property`:`string`,o),i=a;continue}if(Nt(t)||t===`.`&&Nt(e[i+1]??``)){let t=i+1;for(;t<e.length&&/[0-9A-Fa-f_xXob.+-]/.test(e[t]??``);)t+=1;Pt(n,`number`,e.slice(i,t)),i=t;continue}if(jt(t)){let t=i+1;for(;t<e.length&&Mt(e[t]??``);)t+=1;let r=e.slice(i,t);Pt(n,Dt.has(r)?`keyword`:Ot.has(r)?`literal`:`plain`,r),i=t;continue}Pt(n,`plain`,t),i+=1}return n}var It=[{view:`task`,label:`Thay đổi của task`,shortLabel:`Task`},{view:`working-tree`,label:`Toàn bộ working tree`,shortLabel:`Working Tree`},{view:`staged`,label:`Đã chuẩn bị commit`,shortLabel:`Staged`}];function Lt(e){return e===`vi`?It:[{view:`task`,label:`Task Changes`,shortLabel:`Task`},{view:`working-tree`,label:`Full Working Tree`,shortLabel:`Working Tree`},{view:`staged`,label:`Staged Changes`,shortLabel:`Staged`}]}var Rt={"pre-existing-user":`Có sẵn trước task`,"runtime-observed-agent":`Pi runtime đã chạm`,"post-baseline-unattributed":`Thay đổi sau baseline · chưa rõ nguồn`,mixed:`Trộn thay đổi người dùng và runtime`};function zt(e,t=`vi`){return t===`vi`?Rt[e.provenance.classification]:{"pre-existing-user":`Pre-existing user change`,"runtime-observed-agent":`Runtime-observed agent touch`,"post-baseline-unattributed":`Post-baseline · unattributed`,mixed:`Mixed user and runtime change`}[e.provenance.classification]}function K(e,t=`vi`){return e.stats.state===`exact`?`+${e.stats.additions??0} −${e.stats.deletions??0}`:t===`vi`?`Dòng thay đổi chưa xác định`:`Line changes unavailable`}function Bt(e,t=`vi`){let n=e.page.total;return e.availability.state===`stale`?t===`vi`?`Đang đồng bộ lại…`:`Resynchronizing…`:e.availability.state===`unavailable`?e.availability.message??(t===`vi`?`Nguồn thay đổi chưa sẵn sàng`:`Source changes unavailable`):n===0?t===`vi`?`Không có file thay đổi`:`No changed files`:t===`vi`?`${n} file${e.page.truncated?` · danh sách đã rút gọn`:``}`:`${n} file${n===1?``:`s`}${e.page.truncated?` · list truncated`:``}`}function Vt(e,t=`vi`){return t===`vi`?`${e.criterionIds.length} tiêu chí · ${e.verifierAttemptIds.length} verifier`:`${e.criterionIds.length} criteria · ${e.verifierAttemptIds.length} verifiers`}function Ht(e,t){return[t.projectRef,t.runtimeInstanceId,t.sessionRef,t.taskId??`no-task`,t.taskRunId??`no-run`,e.sourceProjectionRevision??`no-source-projection-revision`,e.taskViewRevision??`no-task-view-revision`,e.workspaceRevision??`no-workspace-revision`,e.indexRevision??`no-index-revision`].join(``)}function Ut(e,t,n,r){if(!e||e.view!==t||e.availability.state===`stale`||e.identity.projectRef!==r.projectRef||e.identity.runtimeInstanceId!==r.runtimeInstanceId||e.identity.sessionRef!==r.sessionRef||e.identity.taskId!==r.taskId||e.identity.taskRunId!==r.taskRunId)return!1;let i=t===`task`?n.taskViewRevision:t===`working-tree`?n.workspaceRevision:n.indexRevision;if(!(i===null?e.availability.state===`unavailable`:e.viewRevision===i))return!1;let a=e.snapshotBinding;return a?n.sourceProjectionRevision!==null&&a.sourceProjectionRevision===n.sourceProjectionRevision&&a.taskViewRevision===n.taskViewRevision&&a.workspaceRevision===n.workspaceRevision&&a.indexRevision===n.indexRevision:n.sourceProjectionRevision===null}function Wt(e,t){if(!e||e.state!==`unavailable`||e.target!==null||!e.reasonCode)return!1;let n=t?.availability.state===`current`&&t.fallback.kind===`none`;return e.reasonCode===`review-target-unavailable`?n:e.reasonCode===`no-unstaged-change`||e.reasonCode===`no-staged-change`?n&&t.hunks.length>0:[`-target-stale`,`-preview-incomplete`,`-preimage-unavailable`,`-authority-unavailable`].some(t=>e.reasonCode.endsWith(t))}function Gt(e,t,n,r,i,a){return t===n&&Ut(e,a,r,i)?e??null:null}function Kt(e,t,n,r,i,a){let o=e?.identity;return!!(e&&o&&o.projectRef===a.identity.projectRef&&o.runtimeInstanceId===a.identity.runtimeInstanceId&&o.sessionRef===a.identity.sessionRef&&o.taskId===a.identity.taskId&&o.taskRunId===a.identity.taskRunId&&e.view===t&&e.file.fileRef===n&&e.file.fileRevision===i&&e.precondition.expectedViewRevision===r&&e.precondition.expectedFileRevision===i&&e.observed.viewRevision===r&&e.observed.fileRevision===i&&e.availability.state!==`stale`&&e.fallback.kind!==`stale`)}function qt(e,t){return t&&e.some(e=>e.fileRef===t)?t:e[0]?.fileRef??null}var q=a();function Jt(e){let t=e?.target;return t?[t.view,t.fileRef,t.diffRef,t.taskRevision,t.workspaceRevision,t.indexRevision??``,t.viewRevision,t.fileRevision,t.patchPreimage,t.contentDigest].join(``):`no-target`}function Yt(e){return e?[Jt(e),e.state,e.recordedState??``,e.recordedAt??``,e.evidenceRef??``].join(``):`no-review-state`}function Xt(e,t){return e.identity.projectRef===t.identity.projectRef&&e.identity.runtimeInstanceId===t.identity.runtimeInstanceId&&e.identity.sessionRef===t.identity.sessionRef&&e.identity.taskId===t.identity.taskId&&e.identity.taskRunId===t.identity.taskRunId&&e.identity.agentOperationId===t.identity.agentOperationId&&e.identity.toolCallId===t.identity.toolCallId}function Zt(e,t,n,r){return t.phase===`settled`&&t.resultCode===n&&t.action===`review.mark`&&t.commandId===e.commandId&&t.actionDigest===e.actionDigest&&t.idempotencyKeyDigest===r&&Xt(e,t)&&typeof t.settledAt==`string`&&typeof t.settlementEvidenceRef==`string`}function Qt(e,t){return!!(e&&e.projectRef===t.projectRef&&e.runtimeInstanceId===t.runtimeInstanceId&&e.sessionRef===t.sessionRef&&e.taskId===t.taskId&&e.taskRunId===t.taskRunId)}function $t(e,t,n,r,i,a){return e.view===t&&e.fileRef===n&&e.taskRevision===a.revision.taskRevision&&e.workspaceRevision===a.sourceChanges.workingTree.revision&&e.indexRevision===a.sourceChanges.staged.revision&&e.viewRevision===r&&e.fileRevision===i}function en(e,t,n,r,i,a,o){return!e||!Qt(e.identity,a.identity)?!1:e.target?$t(e.target,t,n,r,i,a):e.state===`unavailable`&&!Wt(e,o)}async function tn(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return`sha256:${[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function nn({state:e,busy:t,status:n,deterministicEnabled:r,modelEnabled:i,locale:a,onGenerate:o,onCopy:s,onModel:c}){let l=e.value?.state===`ready`?e.value.summary:null;return(0,q.jsxs)(`section`,{className:`commit-summary-panel`,"aria-labelledby":`commit-summary-title`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Commit summary`}),(0,q.jsx)(`h3`,{id:`commit-summary-title`,children:P(a,`Tóm tắt phần đã stage`,`Staged changes summary`)}),(0,q.jsx)(`span`,{children:P(a,`Bản deterministic dùng 0 model token. Không commit hoặc push.`,`The deterministic version uses 0 model tokens. It does not commit or push.`)})]}),l?(0,q.jsxs)(`div`,{className:`commit-summary-output`,children:[(0,q.jsx)(`strong`,{children:l.title}),l.bodyLines.map((e,t)=>(0,q.jsx)(`code`,{children:e},`${l.summaryRef}.${t}`)),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`button`,{type:`button`,onClick:s,children:`Copy`}),(0,q.jsx)(`button`,{type:`button`,disabled:!i||t,onClick:c,children:P(a,`Nhờ Pi viết lại · tốn model token`,`Ask Pi to rewrite · uses model tokens`)})]})]}):(0,q.jsx)(`button`,{type:`button`,disabled:!r||t,onClick:o,children:t?P(a,`Đang tạo…`,`Generating…`):P(a,`Tạo summary · 0 token`,`Generate summary · 0 tokens`)}),n&&(0,q.jsx)(`p`,{className:`commit-summary-status`,role:`status`,children:n})]})}function rn({file:e,selected:t,onSelect:n,locale:r}){let i=e.path.lastIndexOf(`/`),a=i<0?e.path:e.path.slice(i+1);return(0,q.jsxs)(A,{component:`button`,className:`file-row`,selected:t,"data-selected":t,onClick:n,type:`button`,"aria-label":`${e.status} ${e.path} ${K(e,r)}`,"aria-pressed":t,children:[(0,q.jsx)(`span`,{className:`file-status status-${e.status}`,children:e.status}),(0,q.jsxs)(`span`,{className:`file-name`,children:[(0,q.jsx)(`strong`,{children:a}),e.oldPath&&(0,q.jsxs)(`small`,{children:[P(r,`từ`,`from`),` `,e.oldPath]})]}),(0,q.jsx)(`span`,{className:`file-provenance`,children:zt(e,r)}),(0,q.jsx)(`span`,{className:`file-evidence`,children:Vt(e,r)}),(0,q.jsx)(`span`,{className:`file-stats`,children:K(e,r)})]})}function an({text:e,path:t}){return(0,q.jsx)(q.Fragment,{children:Ft(e,t).map((e,t)=>(0,q.jsx)(`span`,{className:`syntax-${e.kind}`,children:e.text},`${t}.${e.kind}`))})}function on({line:e,side:t,path:n}){let r=e.kind===`deleted`?`old`:`new`,i=r===`old`?e.oldLineNumber??null:e.newLineNumber??null,a=r===`old`?(0,q.jsx)(ht,{path:n,side:`old`,line:i,code:e.text}):(0,q.jsx)(`span`,{children:e.oldLineNumber??``}),o=r===`new`?(0,q.jsx)(ht,{path:n,side:`new`,line:i,code:e.text}):(0,q.jsx)(`span`,{children:e.newLineNumber??``}),s=(0,q.jsx)(ut,{path:n,side:r,line:i});if(t===`inline`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`diff-line diff-${e.kind}`,children:[a,o,(0,q.jsx)(`b`,{children:e.marker}),(0,q.jsx)(`code`,{children:(0,q.jsx)(an,{text:e.text,path:n})})]}),s]});let c=e.kind===`added`?``:e.text,l=e.kind===`deleted`?``:e.text;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`split-line diff-${e.kind}`,children:[a,(0,q.jsx)(`code`,{children:(0,q.jsx)(an,{text:c,path:n})}),o,(0,q.jsx)(`code`,{children:(0,q.jsx)(an,{text:l,path:n})})]}),s]})}function sn({state:e,review:t,mutation:n,revert:r,reviewEnabled:i,reviewBusy:a,reviewError:o,mutationEnabled:s,mutationBusy:c,mutationError:l,revertEnabled:u,revertBusy:d,openEnabled:f,openBusy:p,openStatus:m,detailError:h,mode:g,onMode:v,onReview:ee,onMutation:y,onRevert:b,onOpen:x,onRetry:S,locale:w}){if(e.state===`idle`)return(0,q.jsx)(`div`,{className:`diff-empty`,children:(0,q.jsx)(`p`,{children:P(w,`Chọn một file để xem diff và bằng chứng liên quan.`,`Select a file to inspect its diff and related evidence.`)})});if(e.state===`loading`)return(0,q.jsx)(`div`,{className:`diff-empty`,children:(0,q.jsx)(`p`,{children:P(w,`Đang dựng diff từ Git và task baseline…`,`Building the diff from Git and the task baseline…`)})});if(e.state===`error`||!e.value)return(0,q.jsxs)(`div`,{className:`diff-empty error-state`,children:[(0,q.jsx)(`p`,{children:P(w,`Diff chưa thể đồng bộ với revision hiện tại.`,`The diff could not be reconciled with the current revision.`)}),S&&(0,q.jsx)(`button`,{type:`button`,onClick:S,children:P(w,`Thử đồng bộ lại`,`Retry reconciliation`)})]});let T=e.value;return(0,q.jsxs)(_,{className:`diff-viewer`,sx:{minWidth:0,bgcolor:`background.paper`},children:[(0,q.jsxs)(_,{component:`header`,className:`diff-toolbar`,sx:{position:`sticky`,top:0,zIndex:2,bgcolor:`background.paper`},children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:T.file.path}),(0,q.jsx)(se,{size:`small`,variant:`outlined`,className:`access-badge tone-${I(T.availability.state)}`,label:L(T.availability.state,w)})]}),(0,q.jsxs)(`div`,{className:`diff-actions`,children:[t.state===`ready`&&t.value&&(0,q.jsxs)(`div`,{className:`review-state review-${t.value.state}`,children:[(0,q.jsx)(`span`,{children:t.value.state===`reviewed`?P(w,`Đã review`,`Reviewed`):t.value.state===`stale`?P(w,`Review đã cũ`,`Review stale`):t.value.state===`unavailable`?P(w,`Không thể review`,`Review unavailable`):P(w,`Chưa review`,`Not reviewed`)}),t.value.target&&t.value.state!==`unavailable`&&(0,q.jsx)(`button`,{type:`button`,disabled:!i||a,onClick:()=>ee(t.value.state===`reviewed`?`unreviewed`:`reviewed`),children:a?P(w,`Đang ghi…`,`Saving…`):t.value.state===`reviewed`?P(w,`Bỏ dấu review`,`Mark unreviewed`):t.value.state===`stale`?P(w,`Review lại`,`Review again`):P(w,`Đánh dấu đã review`,`Mark reviewed`)})]}),n.state===`ready`&&n.value?.state===`ready`&&n.value.target&&(0,q.jsxs)(`div`,{className:`source-mutation-preview`,children:[(0,q.jsx)(`span`,{children:n.value.action===`source.stage`?P(w,`Chuẩn bị đúng thay đổi file này để commit`,`Prepare this exact file change for commit`):P(w,`Bỏ khỏi vùng commit; giữ nguyên file đang làm việc`,`Remove from commit while keeping the working file`)}),(0,q.jsx)(`button`,{type:`button`,disabled:!s||c,onClick:()=>y([]),children:c?P(w,`Đang cập nhật Git…`,`Updating Git…`):n.value.action===`source.stage`?`Stage file`:`Unstage file`})]}),r.state===`ready`&&r.value?.state===`ready`&&r.value.target&&(0,q.jsxs)(`div`,{className:`source-revert-preview`,children:[(0,q.jsx)(`span`,{children:P(w,`Hoàn tác phần chưa stage; giữ nguyên index`,`Revert unstaged changes while preserving the index`)}),(0,q.jsx)(`button`,{type:`button`,disabled:!u||d,onClick:()=>b(null),children:d?P(w,`Đang dựng preview…`,`Building preview…`):`Revert file`})]}),(0,q.jsx)(qe,{path:T.file.path}),f&&(0,q.jsx)(`div`,{className:`source-open-action`,children:(0,q.jsx)(`button`,{type:`button`,disabled:p,onClick:x,children:p?P(w,`Đang mở…`,`Opening…`):P(w,`Mở trong VS Code`,`Open in VS Code`)})}),(0,q.jsxs)(oe,{className:`mode-switch`,exclusive:!0,size:`small`,value:g,"aria-label":P(w,`Kiểu hiển thị diff`,`Diff layout`),onChange:(e,t)=>t&&v(t),children:[(0,q.jsx)(C,{value:`inline`,"aria-label":`Inline`,children:`Inline`}),(0,q.jsx)(C,{value:`split`,"aria-label":P(w,`Hai cột`,`Side by side`),children:P(w,`Hai cột`,`Side by side`)})]})]})]}),o&&(0,q.jsx)(`div`,{className:`review-error`,role:`status`,children:o}),l&&(0,q.jsx)(`div`,{className:`review-error`,role:`status`,children:l}),m&&(0,q.jsx)(`div`,{className:`source-open-status`,role:`status`,children:m}),h&&(0,q.jsxs)(`div`,{className:`detail-reconciliation-warning`,role:`status`,children:[(0,q.jsx)(`span`,{children:P(w,`Một thao tác source chưa đồng bộ; diff hiện tại vẫn chính xác.`,`A source action is not reconciled yet; the current diff remains exact.`)}),S&&(0,q.jsx)(`button`,{type:`button`,onClick:S,children:P(w,`Thử đồng bộ lại`,`Retry reconciliation`)})]}),(0,q.jsxs)(`div`,{className:`diff-context`,children:[(0,q.jsx)(`span`,{children:zt(T.file,w)}),(0,q.jsx)(`span`,{children:Vt(T.file,w)}),(0,q.jsxs)(`span`,{className:`additions`,children:[`+`,T.file.stats.additions??`?`]}),(0,q.jsxs)(`span`,{className:`deletions`,children:[`−`,T.file.stats.deletions??`?`]})]}),T.fallback.kind!==`none`&&(0,q.jsxs)(`div`,{className:`diff-fallback`,children:[(0,q.jsx)(`strong`,{children:L(T.fallback.kind,w)}),(0,q.jsx)(`span`,{children:T.fallback.message??T.fallback.reasonCode??P(w,`Nội dung diff không sẵn sàng`,`Diff content unavailable`)})]}),T.hunks.map((e,t)=>(0,q.jsxs)(`section`,{className:`diff-hunk`,"aria-label":`${P(w,`Vùng thay đổi`,`Change region`)} ${t+1}`,children:[(0,q.jsxs)(`div`,{className:`hunk-header`,children:[(0,q.jsx)(`span`,{children:e.header}),(0,q.jsxs)(`span`,{className:`hunk-actions`,children:[n.value?.state===`ready`&&n.value.target?.hunkRefs.includes(e.hunkRef)&&(0,q.jsx)(`button`,{type:`button`,disabled:!s||c,onClick:()=>y([e.hunkRef]),children:n.value.action===`source.stage`?`Stage hunk`:`Unstage hunk`}),r.value?.state===`ready`&&r.value.target&&r.value.preview?.hunks.some(t=>t.hunkRef===e.hunkRef)&&(0,q.jsx)(`button`,{className:`revert-action`,type:`button`,disabled:!u||d,onClick:()=>b(e.hunkRef),children:`Revert hunk`})]})]}),(0,q.jsx)(`div`,{className:g===`split`?`split-code`:`inline-code`,children:e.lines.map(e=>(0,q.jsx)(on,{line:e,side:g,path:T.file.path},e.lineRef))}),T.unchangedRegions[t]&&(0,q.jsxs)(`div`,{className:`unchanged-region`,children:[`… `,T.unchangedRegions[t].lineCount,` `,P(w,`dòng không đổi đã thu gọn`,`unchanged lines collapsed`),` …`]})]},e.hunkRef)),(0,q.jsx)(ft,{path:T.file.path,shownLines:new Set(T.hunks.flatMap(e=>e.lines.map(e=>e.newLineNumber).filter(e=>typeof e==`number`)))}),T.truncation.truncated&&(0,q.jsxs)(`div`,{className:`diff-fallback`,children:[(0,q.jsx)(`strong`,{children:P(w,`Diff đã rút gọn`,`Diff truncated`)}),(0,q.jsxs)(`span`,{children:[P(w,`Còn`,`Another`),` `,T.truncation.omittedLines,` `,P(w,`dòng chưa hiển thị.`,`lines are not shown.`)]})]})]})}function cn({snapshot:e,refreshSnapshot:t,sessionRef:n,findings:r,onSendComments:i}){let{locale:a}=N(),[o,s]=(0,W.useState)(()=>n?ct(n):[]),[c,u]=(0,W.useState)(null);(0,W.useEffect)(()=>{s(n?ct(n):[]),u(null)},[n]),(0,W.useEffect)(()=>{let e=e=>{n&&e.detail===n&&s(ct(n))};return window.addEventListener(pt,e),()=>window.removeEventListener(pt,e)},[n]);let d=(0,W.useCallback)(e=>{s(e),n&<(n,e)},[n]),p=!!(e.task&&e.sourceChanges.task?.state!==`unavailable`&&e.sourceChanges.task?.revision),g=(0,W.useMemo)(()=>Lt(a),[a]),[v,y]=(0,W.useState)(()=>p?`task`:`working-tree`),[b,x]=(0,W.useState)({}),[S,C]=(0,W.useState)(null),[w,T]=(0,W.useState)({state:`idle`}),[E,D]=(0,W.useState)({state:`idle`}),[O,te]=(0,W.useState)({state:`idle`}),[k,ne]=(0,W.useState)({state:`idle`}),[A,j]=(0,W.useState)(null),[ie,ae]=(0,W.useState)(!1),[oe,M]=(0,W.useState)(null),[ce,le]=(0,W.useState)(!1),[ue,ge]=(0,W.useState)(null),[_e,ve]=(0,W.useState)(!1),[Se,we]=(0,W.useState)(null),[Te,Ee]=(0,W.useState)(!1),[De,je]=(0,W.useState)(null),[Ne,Pe]=(0,W.useState)(null),[Fe,Ie]=(0,W.useState)({state:`idle`}),[ze,He]=(0,W.useState)(!1),[Ue,F]=(0,W.useState)(null),[We,Ge]=(0,W.useState)(!1),[I,Ke]=(0,W.useState)(0),[qe,Je]=(0,W.useState)(`inline`),Ye={sourceProjectionRevision:e.sourceChanges.projectionRevision??null,taskViewRevision:e.sourceChanges.task.revision,workspaceRevision:e.sourceChanges.workingTree.revision,indexRevision:e.sourceChanges.staged.revision},Ze=Ht(Ye,e.identity),L=[Ze,I].join(``),Qe=[Ze,e.revision.taskRevision??`no-task-revision`].join(``),R=[n??`default-session`,v,e.identity.projectRef,e.identity.runtimeInstanceId,e.identity.sessionRef,e.identity.taskId??`no-task`,e.identity.taskRunId??`no-run`].join(``),$e=(0,W.useRef)(R);$e.current=R;let et=(0,W.useRef)(0),tt=(0,W.useRef)(R);tt.current!==R&&(tt.current=R,et.current+=1);let nt=et.current,rt=(0,W.useRef)(null),it=b[v],z=it?.state===`ready`?Gt(it.value,it.revisionKey,L,Ye,e.identity,v):null,at=it?.state===`ready`&&!z?{state:`loading`}:it,ot=z?.files??[],B=qt(ot,S),V=B?ot.find(e=>e.fileRef===B)??null:null,H=!!(z&&V),U=e.capabilities.capabilities.reviewActions,ut=JSON.stringify(U),ft=v===`working-tree`?`source.stage`:v===`staged`?`source.unstage`:null,ht=U.status===`available`&&U.actions.reviewMark.available,yt=ft===`source.stage`?U.status===`available`&&U.actions.stage.available:ft===`source.unstage`&&U.status===`available`&&U.actions.unstage.available,bt=v===`working-tree`&&U.status===`available`&&U.actions.revert.available,G=H?[n??`default-session`,v,B,z.viewRevision,V.fileRevision,Qe,I,ut].join(``):`no-detail-request`,St=!!(H&&w.requestKey===G&&w.state===`ready`&&Kt(w.value,v,B,z.viewRevision,V.fileRevision,e)),wt=!!(H&&E.requestKey===G&&E.state===`ready`&&en(E.value,v,B,z.viewRevision,V.fileRevision,e,St?w.value:void 0)),Tt=!!(H&&O.requestKey===G&&O.state===`ready`&&en(O.value,v,B,z.viewRevision,V.fileRevision,e,St?w.value:void 0)),Dt=!!(H&&k.requestKey===G&&k.state===`ready`&&en(k.value,v,B,z.viewRevision,V.fileRevision,e,St?w.value:void 0)),Ot=!!(H&&w.requestKey===G&&w.state===`ready`&&!St),kt=!!(H&&E.requestKey===G&&E.state===`ready`&&!wt),At=!!(H&&O.requestKey===G&&O.state===`ready`&&!Tt),jt=!!(H&&k.requestKey===G&&k.state===`ready`&&!Dt),Mt=!!(H&&w.requestKey===G&&w.state===`error`),Nt=!!(H&&ht&&E.requestKey===G&&E.state===`error`),Pt=!!(H&&yt&&O.requestKey===G&&O.state===`error`),Ft=!!(H&&bt&&k.requestKey===G&&k.state===`error`),It=Ot||kt||At||jt||Mt||Nt||Pt||Ft,Rt=!!(H&&St&&(!ht||wt)&&(!yt||Tt)&&(!bt||Dt)),zt=(0,W.useRef)(null);B&&(zt.current={sourceScope:R,fileRef:B});let K=[R,B??(zt.current?.sourceScope===R?zt.current.fileRef:`no-file`)].join(``),Vt=(0,W.useRef)(K);Vt.current=K;let Wt=(0,W.useRef)(new Set),Xt=(0,W.useRef)(0),Qt=(0,W.useRef)(K);Qt.current!==K&&(Qt.current=K,Xt.current+=1);let an=Xt.current,[on,cn]=(0,W.useState)(null),ln=!!(It&&t&&(!Wt.current.has(K)||on?.scope===K&&on.generation===an&&on.requestKey===G)),J=H?w.requestKey===G?(Ot||Mt)&&ln?{state:`loading`}:Ot||Mt?{state:`error`}:w:{state:`loading`}:{state:`idle`},Y=J.state===`ready`?J.value:void 0,un=new Map;for(let e of Y?.hunks.flatMap(e=>e.lines)??[]){let t=e.kind===`deleted`?`old`:`new`,n=t===`old`?e.oldLineNumber:e.newLineNumber;typeof n==`number`&&Y&&un.set(gt(Y.file.path,t,n),e.text)}let dn=n&&i?{locale:a,findings:r,comments:o,editing:c?.key??null,open:(e,t,n,r)=>u({key:gt(e,t,n),path:e,side:t,line:n,code:r}),save:e=>{c&&d(vt(o,{path:c.path,side:c.side,line:c.line,code:c.code,text:e})),u(null)},cancel:()=>u(null),remove:e=>d(o.filter(t=>gt(t.path,t.side,t.line)!==e))}:null,X=H&&ht?E.requestKey===G?ln?{state:`loading`}:kt||Nt?{state:`error`}:E:{state:`loading`}:{state:`idle`},fn=H&&yt?O.requestKey===G?ln?{state:`loading`}:At||Pt?{state:`error`}:O:{state:`loading`}:{state:`idle`},pn=H&&bt?k.requestKey===G?ln?{state:`loading`}:jt||Ft?{state:`error`}:k:{state:`loading`}:{state:`idle`},mn=H?[n??`default-session`,v,B,z.viewRevision,V.fileRevision,Qe].join(``):`no-source-authority`,Z=(0,W.useRef)(mn);Z.current=mn;let hn=[mn,e.revision.runtimeRevision,e.revision.controlRevision??`no-control-revision`,e.revision.approvalRevision??`no-approval-revision`,e.revision.sessionOptionRevision??`no-session-option-revision`,e.revision.queueRevision??`no-queue-revision`].join(``),Q=(0,W.useRef)(hn);Q.current=hn;let gn=[n??`default-session`,e.identity.projectRef,e.identity.runtimeInstanceId,e.identity.sessionRef,e.identity.taskId??`no-task`,e.identity.taskRunId??`no-run`,e.revision.taskRevision??`no-task-revision`,e.sourceChanges.staged.revision??`no-index-revision`].join(``),$=(0,W.useRef)(gn);$.current=gn;let _n=(0,W.useRef)(``),vn=(0,W.useRef)(``);_n.current=[mn,Jt(X.value)].join(``),vn.current=Yt(X.value),(0,W.useEffect)(()=>{Ie({state:`idle`}),F(null),Ge(!1)},[gn]),(0,W.useEffect)(()=>{!p&&v===`task`&&(y(`working-tree`),C(null))},[p,v]),(0,W.useEffect)(()=>{rt.current=null,Pe(null)},[R,nt]),(0,W.useEffect)(()=>{Rt&&(Wt.current.delete(K),cn(e=>e?.scope===K?null:e))},[Rt,K]),(0,W.useEffect)(()=>{let r=new AbortController,i=L;return x(e=>({...e,[v]:{state:`loading`,revisionKey:i}})),(n?fe(n,v,r.signal):Re(v,r.signal)).then(n=>{if(!n){r.signal.aborted||x(e=>({...e,[v]:{state:`error`,revisionKey:i}}));return}if(!Ut(n,v,Ye,e.identity)){if(r.signal.aborted)return;if(!t||rt.current===R){x(e=>({...e,[v]:{state:`error`,revisionKey:i}}));return}rt.current=R,x(e=>({...e,[v]:{state:`loading`,revisionKey:i}})),t().then(e=>{if(!r.signal.aborted){if(!e){x(e=>({...e,[v]:{state:`error`,revisionKey:i}}));return}Ke(e=>e+1)}}).catch(()=>{r.signal.aborted||x(e=>({...e,[v]:{state:`error`,revisionKey:i}}))});return}rt.current=null,r.signal.aborted||x(e=>({...e,[v]:{state:`ready`,value:n,revisionKey:i}}))}).catch(()=>{r.signal.aborted||x(e=>({...e,[v]:{state:`error`,revisionKey:i}}))}),()=>r.abort()},[v,L,n]);let yn=(0,W.useCallback)(()=>{let e=R,n=nt,r=Ze;rt.current=null,x(e=>({...e,[v]:{state:`loading`,revisionKey:L}})),(async()=>{let i;try{i=await t?.()}catch{}if($e.current!==e||et.current!==n)return;rt.current=e;let a=i?Ht({sourceProjectionRevision:i.sourceChanges.projectionRevision??null,taskViewRevision:i.sourceChanges.task.revision,workspaceRevision:i.sourceChanges.workingTree.revision,indexRevision:i.sourceChanges.staged.revision},i.identity):r;(!i||a===r)&&Ke(e=>e+1)})()},[t,Ze,nt,R,L,v]);(0,W.useEffect)(()=>{if(!B){T({state:`idle`}),D({state:`idle`}),te({state:`idle`}),ne({state:`idle`}),M(null),ge(null),we(null),j(null),je(null);return}let e=new AbortController,t=G;return T({state:`loading`,requestKey:t}),M(null),ge(null),we(null),j(null),je(null),D(ht?{state:`loading`,requestKey:t}:{state:`idle`}),te(yt?{state:`loading`,requestKey:t}:{state:`idle`}),ne(bt?{state:`loading`,requestKey:t}:{state:`idle`}),(n?pe(n,v,B,e.signal):Ae(v,B,e.signal)).then(n=>{e.signal.aborted||T({state:`ready`,value:n,requestKey:t})}).catch(()=>{e.signal.aborted||T({state:`error`,requestKey:t})}),ht&&(n?be(n,v,B,e.signal):de(v,B,e.signal)).then(n=>{e.signal.aborted||D({state:`ready`,value:n,requestKey:t})}).catch(()=>{e.signal.aborted||D({state:`error`,requestKey:t})}),yt&&ft&&(n?ye(n,ft,B,e.signal):me(ft,B,e.signal)).then(n=>{e.signal.aborted||te({state:`ready`,value:n,requestKey:t})}).catch(()=>{e.signal.aborted||te({state:`error`,requestKey:t})}),bt&&(n?xe(n,B,null,e.signal):Ce(B,null,e.signal)).then(n=>{e.signal.aborted||ne({state:`ready`,value:n,requestKey:t})}).catch(()=>{e.signal.aborted||ne({state:`error`,requestKey:t})}),()=>e.abort()},[B,v,Qe,I,n,ut,G]);let bn=(0,W.useCallback)(e=>{if(!H||!t)return;let n=K,r=an,i=G;!e&&Wt.current.has(n)||(Wt.current.add(n),cn({scope:n,generation:r,requestKey:i}),t().then(e=>{e&&Vt.current===n&&Xt.current===r&&Ke(e=>e+1)}).catch(()=>void 0).finally(()=>{cn(e=>e?.scope===n&&e.generation===r&&e.requestKey===i?null:e)}))},[H,an,K,G,t]);(0,W.useEffect)(()=>{!H||!It||!t||Wt.current.has(K)||bn(!1)},[bn,H,It,K,t]);let xn=ot,Sn=(0,W.useMemo)(()=>{let e=new Map;for(let t of xn){let n=t.path.lastIndexOf(`/`),r=n<0?P(a,`Gốc project`,`Project root`):t.path.slice(0,n);e.set(r,[...e.get(r)??[],t])}return[...e.entries()]},[xn,a]),Cn=(0,W.useMemo)(()=>{let t={task:e.sourceChanges.task.counts.files,"working-tree":e.sourceChanges.workingTree.counts.files,staged:e.sourceChanges.staged.counts.files},n=n=>{let r=b[n];return(r?.state===`ready`?Gt(r.value,r.revisionKey,L,Ye,e.identity,n):null)?.page.total??t[n]};return{task:n(`task`),"working-tree":n(`working-tree`),staged:n(`staged`)}},[b,L,e.sourceChanges.task.counts.files,e.sourceChanges.workingTree.counts.files,e.sourceChanges.staged.counts.files]),wn=e=>{Pe(null),y(e),C(null)},Tn=U.status===`available`&&U.actions.reviewMark.available,En=fn.value?.action===`source.stage`?U.status===`available`&&U.actions.stage.available:fn.value?.action===`source.unstage`&&U.status===`available`&&U.actions.unstage.available,Dn=U.status===`available`&&U.actions.revert.available,On=v===`working-tree`&&U.status===`available`&&U.actions.openInVsCode.available&&J.state===`ready`&&J.value?.availability.state===`current`&&J.value.fallback.kind===`none`,kn=v===`staged`&&xn.length>0,An=kn&&U.status===`available`&&U.actions.generateCommitSummaryDeterministic.available,jn=kn&&U.status===`available`&&U.actions.generateCommitSummaryModel.available,Mn=t=>!t||t.identity.projectRef!==e.identity.projectRef||t.identity.runtimeInstanceId!==e.identity.runtimeInstanceId||t.identity.sessionRef!==e.identity.sessionRef||t.identity.taskId!==e.identity.taskId||t.identity.taskRunId!==e.identity.taskRunId?!1:t.summary?t.summary.taskRevision===e.revision.taskRevision&&t.summary.indexRevision===e.sourceChanges.staged.revision:t.state===`unavailable`,Nn=async t=>{if(!B||!X.value||ie)return;let r=X.value,i=Yt(r),o=_n.current,s=Q.current,c=R,l=nt,u=K,d=an,f=Ze,p=!1;ae(!0),M(null),Pe(null);try{let m=await xt(e,r,t);if(_n.current!==o||vn.current!==i||Q.current!==s)return;let h=await tn(m.idempotencyKey);if(_n.current!==o||vn.current!==i||Q.current!==s)return;p=!0;let g=await Me(m);if(!Zt(m,g,t,h)){if(g.phase!==`rejected`){await Pn(c,l,u,d,f,P(a,`Chưa xác nhận được receipt review. Piagent đã đọc lại trạng thái chính thức và sẽ không tự gửi lại lệnh.`,`The review receipt is unconfirmed. Piagent reloaded canonical state and will not resend the command.`));return}_n.current===o&&vn.current===i&&M(g.error?.message??P(a,`Không xác nhận được trạng thái review chính xác; hãy tải lại diff.`,`The exact review state could not be confirmed; reload the diff.`));return}if(_n.current!==o||vn.current!==i)return;D(e=>_n.current===o&&Yt(e.value)===i?{state:`ready`,requestKey:e.requestKey,value:{...r,generatedAt:g.settledAt,state:g.resultCode,recordedState:g.resultCode,recordedAt:g.settledAt,evidenceRef:g.settlementEvidenceRef,reasonCode:null,health:{state:`ok`,reasonCode:null,message:null}}}:e),(n?be(n,v,B):de(v,B)).then(e=>D(t=>_n.current===o&&t.state===`ready`&&t.value?.evidenceRef===g.settlementEvidenceRef?{state:`ready`,value:e,requestKey:t.requestKey}:t)).catch(()=>void 0)}catch{p?await Pn(c,l,u,d,f,P(a,`Mất kết nối khi đang ghi review. Piagent đã đọc lại trạng thái chính thức và sẽ không tự gửi lại lệnh.`,`The connection was lost while saving review. Piagent reloaded canonical state and will not resend the command.`)):_n.current===o&&vn.current===i&&M(P(a,`Không thể ghi trạng thái review. Nội dung source không bị thay đổi.`,`Unable to save review state. Source content was not changed.`))}finally{ae(!1)}},Pn=async(e,n,r,i,a,o)=>{Vt.current===r&&Xt.current===i&&(T({state:`idle`}),D({state:`idle`}),te({state:`idle`}),ne({state:`idle`}),j(null),M(null),ge(null),we(null),je(null),Pe(null));let s;try{s=await t?.()}catch{}if($e.current!==e||et.current!==n)return;let c=s?Ht({sourceProjectionRevision:s.sourceChanges.projectionRevision??null,taskViewRevision:s.sourceChanges.task.revision,workspaceRevision:s.sourceChanges.workingTree.revision,indexRevision:s.sourceChanges.staged.revision},s.identity):a;(!s||c===a)&&Ke(e=>e+1),Pe({scope:e,generation:n,message:o})},Fn=async(n=[])=>{if(!B||!z||!fn.value||fn.value.state!==`ready`||ce)return;let r=Z.current,i=Q.current,o=fn.value,s=R,c=nt,l=K,u=an,d=Ze,f=!1;le(!0),ge(null),Pe(null);try{let p=await Ct(e,o,n);if(Z.current!==r||Q.current!==i)return;f=!0;let m=await Le(p);if(m.phase===`uncertain`){await Pn(s,c,l,u,d,P(a,`Chưa xác nhận được trạng thái Git. Piagent đã tải lại Source Changes và sẽ không tự gửi lại lệnh.`,`Git state is unconfirmed. Piagent refreshed Source Changes and will not resend the command.`));return}if(m.phase!==`settled`||![`staged`,`unstaged`].includes(m.resultCode)){Z.current===r&&ge(m.error?.message??P(a,`File hoặc Git index đã thay đổi; hãy tải lại preview.`,`The file or Git index changed; reload the preview.`));return}Z.current===r&&C(null),await t?.(),Ke(e=>e+1)}catch{f?await Pn(s,c,l,u,d,P(a,`Mất kết nối khi đang cập nhật Git. Piagent đã tải lại Source Changes và sẽ không tự gửi lại lệnh.`,`The connection was lost while updating Git. Piagent refreshed Source Changes and will not resend the command.`)):Z.current===r&&ge(P(a,`Không thể chuẩn bị lệnh cập nhật Git; source chưa bị thay đổi.`,`Unable to prepare the Git update; source was not changed.`))}finally{le(!1)}},In=async e=>{if(!B||!z||!Dn||_e)return;let t=Z.current,r=B;ve(!0),we(null),Pe(null);try{let i=n?await xe(n,r,e):await Ce(r,e);if(Z.current!==t)return;if(i.state!==`ready`||!i.target){we(P(a,`Không thể hoàn tác an toàn: provenance hoặc diff hiện tại không còn đủ bằng chứng.`,`Safe revert is unavailable because provenance or the current diff lacks evidence.`));return}j(i)}catch{Z.current===t&&we(P(a,`Không thể dựng preview hoàn tác. Source chưa bị thay đổi.`,`Unable to build a revert preview. Source was not changed.`))}finally{ve(!1)}},Ln=async()=>{if(!A?.target||!B||!z||!V||_e||!$t(A.target,v,B,z.viewRevision,V.fileRevision,e))return;let r=Z.current,i=Q.current,o=A,s=R,c=nt,l=K,u=an,d=Ze,f=!1;ve(!0),we(null),Pe(null);try{let p=await mt(e,o);if(Z.current!==r||Q.current!==i)return;f=!0;let m=await Oe(p,void 0,n);if(m.phase===`uncertain`){await Pn(s,c,l,u,d,P(a,`Chưa xác nhận được kết quả revert. Piagent đã tải lại Source Changes và sẽ không tự gửi lại lệnh.`,`The revert result is unconfirmed. Piagent refreshed Source Changes and will not resend the command.`));return}if(m.phase!==`settled`||m.resultCode!==`reverted`){Z.current===r&&we(m.error?.message??P(a,`Preview đã cũ; hãy mở lại trước khi xác nhận.`,`The preview is stale; reopen it before confirming.`));return}Z.current===r&&(j(null),C(null)),await t?.(),Ke(e=>e+1)}catch{f?await Pn(s,c,l,u,d,P(a,`Mất kết nối khi đang revert. Piagent đã tải lại Source Changes và sẽ không tự gửi lại lệnh.`,`The connection was lost during revert. Piagent refreshed Source Changes and will not resend the command.`)):Z.current===r&&we(P(a,`Không thể chuẩn bị lệnh revert; source chưa bị thay đổi.`,`Unable to prepare the revert command; source was not changed.`))}finally{ve(!1)}},Rn=async()=>{if(!B||!On||Te)return;let t=Z.current,n=Q.current,r=B;Ee(!0),je(null);try{let i=await Et(e,r);if(Z.current!==t||Q.current!==n)return;let o=await Be(i);if(Z.current!==t)return;o.phase===`settled`&&o.resultCode===`opened`?je(P(a,`VS Code đã nhận yêu cầu mở file.`,`VS Code received the open-file request.`)):je(o.phase===`uncertain`?P(a,`Không xác nhận được VS Code đã nhận file. Piagent sẽ không tự mở lại.`,`It is unknown whether VS Code received the file. Piagent will not retry automatically.`):o.error?.message??P(a,`File hoặc phiên làm việc đã thay đổi; hãy tải lại trước khi mở.`,`The file or session changed; refresh before opening.`))}catch{Z.current===t&&je(P(a,`Không thể mở file trong VS Code. Diff hiện tại vẫn được giữ nguyên.`,`Unable to open the file in VS Code. The current diff remains available.`))}finally{Ee(!1)}},zn=async()=>{if(!An||ze)return;let e=$.current;He(!0),F(null),Ie({state:`loading`});try{let t=n?await he(n):await ke();if($.current!==e)return;if(!Mn(t)){Ie({state:`error`}),F(P(a,`Staged Changes đã đổi trong lúc dựng summary; hãy tạo lại.`,`Staged Changes changed while the summary was generated; generate it again.`));return}Ie({state:`ready`,value:t}),t.state!==`ready`&&F(P(a,`Staged Changes đã thay đổi hoặc chưa có dữ liệu để tóm tắt.`,`Staged Changes changed or has no data to summarize.`))}catch{$.current===e&&(Ie({state:`error`}),F(P(a,`Không thể dựng commit summary từ index hiện tại.`,`Unable to generate a commit summary from the current index.`)))}finally{He(!1)}},Bn=async()=>{let e=Fe.value?.summary;if(!e||!Mn(Fe.value))return;let t=$.current;try{await navigator.clipboard.writeText([e.title,``,...e.bodyLines].join(`
|
|
3
|
-
`)),$.current===t&&F(P(a,`Đã copy summary. Chưa có commit nào được tạo.`,`Summary copied. No commit was created.`))}catch{$.current===t&&F(P(a,`Trình duyệt không cho phép copy tự động.`,`The browser did not allow automatic copying.`))}},Vn=async()=>{let t=Fe.value?.summary;if(!t||!Mn(Fe.value)||!jn||ze)return;let n=$.current;He(!0),F(null);try{let r=await Xe(e,t.modelPrompt,`new-operation`);if($.current!==n||!Mn(Fe.value))return;let i=await Ve(r);if($.current!==n)return;i.phase===`settled`&&i.resultCode===`dispatch-observed`?F(P(a,`Đã gửi yêu cầu sang Chat. Pi sẽ trả commit summary ở hội thoại; chưa commit hoặc push.`,`Request sent to Chat. Pi will return the commit summary in the conversation; nothing was committed or pushed.`)):F(i.phase===`uncertain`?P(a,`Không xác nhận được yêu cầu đã tới Pi; hệ thống sẽ không tự gửi lại.`,`It is unknown whether the request reached Pi; it will not be resent automatically.`):i.error?.message??P(a,`Không thể bắt đầu model work từ session hiện tại.`,`Unable to start model work from the current session.`))}catch{$.current===n&&F(P(a,`Không thể gửi yêu cầu sang Pi session hiện tại.`,`Unable to send the request to the current Pi session.`))}finally{He(!1),Ge(!1)}},Hn=Ne?.scope===R&&Ne.generation===nt?Ne.message:null;return(0,q.jsxs)(f,{component:`section`,variant:`outlined`,className:`source-workspace`,"aria-labelledby":`source-title`,sx:{overflow:`hidden`,minHeight:`calc(100vh - 120px)`,display:`flex`,flexDirection:`column`},children:[(0,q.jsxs)(_,{component:`header`,className:`source-heading`,sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,px:{xs:2,sm:2.5},py:1.75,borderBottom:1,borderColor:`divider`},children:[(0,q.jsxs)(_,{children:[(0,q.jsx)(m,{variant:`overline`,color:`primary.main`,sx:{fontWeight:650,letterSpacing:`.14em`,lineHeight:1},children:`Source changes`}),(0,q.jsx)(m,{variant:`h2`,id:`source-title`,sx:{mt:.5},children:P(a,`Thay đổi trong project`,`Project changes`)})]}),(0,q.jsx)(se,{label:`Git + task baseline`,variant:`outlined`,size:`small`})]}),(0,q.jsx)(ee,{className:`source-tabs`,value:v,onChange:(e,t)=>wn(t),selectionFollowsFocus:!0,variant:`scrollable`,scrollButtons:`auto`,"aria-label":P(a,`Nguồn thay đổi`,`Change sources`),sx:{borderBottom:1,borderColor:`divider`,minHeight:48},children:g.map(e=>(0,q.jsx)(l,{id:`source-tab-${e.view}`,value:e.view,"aria-controls":`source-tabpanel`,disabled:e.view===`task`&&!p,title:e.view===`task`&&!p?P(a,`Session này chưa có task baseline`,`This session has no task baseline`):void 0,label:(0,q.jsxs)(h,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,q.jsx)(`span`,{children:e.label}),Cn[e.view]>0&&(0,q.jsx)(se,{size:`small`,label:Cn[e.view],sx:{height:20,minWidth:24,"& .MuiChip-label":{px:.75}}})]})},e.view))}),v===`staged`&&(0,q.jsx)(nn,{state:Fe,busy:ze,status:Ue,locale:a,deterministicEnabled:An,modelEnabled:jn,onGenerate:()=>{zn()},onCopy:()=>{Bn()},onModel:()=>Ge(!0)}),dn&&(0,q.jsx)(_t,{comments:o,lines:un,linesPath:Y?.file.path,locale:a,onSend:()=>{i?.(dt(o,a===`en`)),d([])},onClear:()=>d([])}),(0,q.jsxs)(_,{className:`source-body`,sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,md:`minmax(286px, 330px) minmax(0, 1fr)`},flex:1,minHeight:620},children:[(0,q.jsxs)(_,{className:`file-panel`,id:`source-tabpanel`,role:`tabpanel`,"aria-labelledby":`source-tab-${v}`,sx:{minWidth:0,borderRight:{md:1},borderBottom:{xs:1,md:0},borderColor:`divider`,bgcolor:`background.default`},children:[(0,q.jsxs)(_,{className:`file-panel-meta`,sx:{minHeight:44,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:1,px:1.5,borderBottom:1,borderColor:`divider`},children:[(0,q.jsx)(`span`,{"aria-live":`polite`,children:at?.state===`ready`&&at.value?Bt(at.value,a):at?.state===`error`?P(a,`Không thể tải danh sách file`,`Unable to load files`):P(a,`Đang tải…`,`Loading…`)}),(0,q.jsxs)(h,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[at?.state===`error`&&(0,q.jsx)(`button`,{className:`source-list-retry`,type:`button`,onClick:yn,children:P(a,`Thử tải lại`,`Retry`)}),(0,q.jsx)(`small`,{children:g.find(e=>e.view===v)?.shortLabel})]})]}),(0,q.jsxs)(_,{className:`file-list`,sx:{maxHeight:{xs:300,md:`calc(100vh - 270px)`},overflow:`auto`,p:.75},children:[Sn.map(([e,t])=>(0,q.jsxs)(_,{children:[(0,q.jsxs)(h,{direction:`row`,className:`file-group-label`,children:[(0,q.jsx)(re,{}),(0,q.jsx)(m,{component:`span`,noWrap:!0,children:e})]}),t.map(e=>(0,q.jsx)(rn,{file:e,selected:e.fileRef===B,onSelect:()=>{Pe(null),C(e.fileRef)},locale:a},e.fileRef))]},e)),at?.state===`ready`&&xn.length===0&&(0,q.jsx)(`div`,{className:`files-empty`,children:P(a,`Không có thay đổi trong view này.`,`No changes in this view.`)})]})]}),(0,q.jsx)(st.Provider,{value:dn,children:(0,q.jsx)(sn,{state:J,review:X,mutation:fn,revert:pn,reviewEnabled:Tn,reviewBusy:ie,reviewError:oe,mutationEnabled:En,mutationBusy:ce,mutationError:ue,revertEnabled:Dn,revertBusy:_e,openEnabled:On,openBusy:Te,openStatus:De,detailError:It&&!ln,mode:qe,onMode:Je,onReview:e=>{Nn(e)},onMutation:e=>{Fn(e)},onRevert:e=>{In(e)},onOpen:()=>{Rn()},onRetry:H&&t?()=>bn(!0):void 0,locale:a})})]}),Hn&&(0,q.jsx)(`div`,{className:`source-action-warning`,role:`status`,children:Hn}),Se&&(0,q.jsx)(`div`,{className:`source-revert-error`,role:`status`,children:Se}),A?.target&&B&&z&&V&&$t(A.target,v,B,z.viewRevision,V.fileRevision,e)&&(0,q.jsx)(`div`,{className:`dialog-backdrop`,role:`presentation`,children:(0,q.jsxs)(`section`,{className:`confirm-dialog`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`revert-dialog-title`,"aria-describedby":`revert-dialog-description`,children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:P(a,`Xác nhận hoàn tác`,`Confirm revert`)}),(0,q.jsxs)(`h3`,{id:`revert-dialog-title`,children:[`Revert `,A.target.hunkRefs.length?`hunk`:`file`,`?`]}),(0,q.jsxs)(`p`,{id:`revert-dialog-description`,children:[P(a,`Thao tác sẽ bỏ`,`This will discard`),` `,(0,q.jsxs)(`strong`,{children:[A.target.summary.additionsDiscarded,` `,P(a,`dòng thêm`,`added lines`)]}),` `,P(a,`và khôi phục`,`and restore`),` `,(0,q.jsxs)(`strong`,{children:[A.target.summary.deletionsRestored,` `,P(a,`dòng xóa`,`deleted lines`)]}),` `,P(a,`trong`,`in`),` `,(0,q.jsx)(`code`,{children:A.target.path}),`.`]}),(0,q.jsx)(`div`,{className:`revert-diff`,"aria-label":P(a,`Các dòng chính xác sẽ được hoàn tác`,`Exact lines to revert`),children:A.preview?.hunks.map(e=>(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`div`,{children:e.header}),e.lines.map((t,n)=>(0,q.jsxs)(`code`,{className:`revert-line revert-${t.kind}`,children:[(0,q.jsx)(`b`,{children:t.marker}),t.text]},`${e.hunkRef}.${n}`))]},e.hunkRef))}),(0,q.jsxs)(`div`,{className:`revert-safety`,children:[(0,q.jsx)(`strong`,{children:P(a,`Phần đã stage được giữ nguyên.`,`Staged content is preserved.`)}),(0,q.jsx)(`span`,{children:P(a,`Không auto-commit. Khả năng khôi phục sau thao tác không được bảo đảm.`,`No auto-commit. Recovery after this action is not guaranteed.`)})]}),(0,q.jsxs)(`div`,{className:`confirm-actions`,children:[(0,q.jsx)(`button`,{type:`button`,disabled:_e,onClick:()=>j(null),children:P(a,`Hủy`,`Cancel`)}),(0,q.jsx)(`button`,{className:`danger-action`,type:`button`,disabled:_e,onClick:()=>{Ln()},children:_e?P(a,`Đang hoàn tác…`,`Reverting…`):P(a,`Xác nhận revert`,`Confirm revert`)})]})]})}),We&&Mn(Fe.value)&&(0,q.jsx)(`div`,{className:`dialog-backdrop`,role:`presentation`,children:(0,q.jsxs)(`section`,{className:`confirm-dialog model-summary-dialog`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`model-summary-dialog-title`,"aria-describedby":`model-summary-dialog-description`,children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:P(a,`Model work có tính phí`,`Token-consuming model work`)}),(0,q.jsx)(`h3`,{id:`model-summary-dialog-title`,children:P(a,`Nhờ Pi viết lại commit summary?`,`Ask Pi to rewrite the commit summary?`)}),(0,q.jsx)(`p`,{id:`model-summary-dialog-description`,children:P(a,`Thao tác này gửi một message vào đúng Pi session hiện tại, bắt đầu một Pi operation và tiêu token theo model/thinking đang chọn. Chỉ staged summary đã rút gọn được gửi; source text không được đính kèm.`,`This sends a message to the exact current Pi session, starts a Pi operation, and consumes tokens using the selected model and thinking level. Only the bounded staged summary is sent; source text is not attached.`)}),(0,q.jsxs)(`div`,{className:`revert-safety`,children:[(0,q.jsx)(`strong`,{children:P(a,`Không tự commit hoặc push.`,`Does not commit or push.`)}),(0,q.jsx)(`span`,{children:P(a,`Kết quả sẽ xuất hiện trong Chat để review và copy.`,`The result will appear in Chat for review and copying.`)})]}),(0,q.jsxs)(`div`,{className:`confirm-actions`,children:[(0,q.jsx)(`button`,{type:`button`,disabled:ze,onClick:()=>Ge(!1),children:P(a,`Hủy`,`Cancel`)}),(0,q.jsx)(`button`,{type:`button`,disabled:ze,onClick:()=>{Vn()},children:ze?P(a,`Đang gửi…`,`Sending…`):P(a,`Xác nhận và gửi sang Pi`,`Confirm and send to Pi`)})]})]})})]})}var ln=/^[a-z0-9][a-z0-9-]{0,63}$/,J=e=>Array.isArray(e)?e.slice(0,200):[],Y=e=>typeof e==`string`||typeof e==`number`?String(e):``;function un(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&t.kind===`fe-change-report`?t:null}catch{return null}}function dn(e){return!!e&&[e.x,e.y,e.w,e.h].every(e=>Number.isFinite(e)&&e>=0)&&e.w>0&&e.h>0}var X=new Map;function fn(e,t,n){let r=`${e??``}\u0000${t}\u0000${n}`;return X.has(r)||(X.set(r,Ue(e,`/api/v1/documents/${encodeURIComponent(t)}/assets/${encodeURIComponent(n)}`).then(async e=>{if(e.state!==`ready`||!e.base64)return{state:`missing`};let t=`data:image/png;base64,${e.base64}`,n=new Image;return n.src=t,await n.decode(),{state:`ready`,src:t,width:n.naturalWidth,height:n.naturalHeight}}).catch(()=>(X.delete(r),{state:`missing`}))),X.size>48&&X.delete(X.keys().next().value)),X.get(r)}function pn(e,t,n){let[r,i]=(0,W.useState)({state:`loading`});return(0,W.useEffect)(()=>{let r=!0;return i({state:`loading`}),fn(e,t,n).then(e=>{r&&i(e)}),()=>{r=!1}},[e,t,n]),r}var mn=(e,t)=>`${Math.max(0,Math.min(100,e/t*100))}%`;function Z(e,t){let n=Math.min(e.x,t.width-1),r=Math.min(e.y,t.height-1);return{...e,x:n,y:r,w:Math.min(e.w,t.width-n),h:Math.min(e.h,t.height-r)}}function hn({asset:e,label:t,frames:n,locale:r}){return(0,q.jsxs)(`figure`,{className:`change-report-figure`,children:[(0,q.jsx)(`figcaption`,{children:t}),e.state===`ready`?(0,q.jsxs)(`div`,{className:`change-report-shot`,children:[(0,q.jsx)(`img`,{src:e.src,alt:t}),n.map(({n:t,box:n})=>{let r=Z(n,e);return(0,q.jsx)(`span`,{className:`change-report-box`,style:{left:mn(r.x,e.width),top:mn(r.y,e.height),width:mn(r.w,e.width),height:mn(r.h,e.height)},children:(0,q.jsx)(`b`,{children:t})},t)})]}):(0,q.jsx)(`p`,{className:`change-report-missing`,children:e.state===`loading`?P(r,`Đang tải ảnh…`,`Loading the screenshot…`):P(r,`Không có ảnh`,`No screenshot`)})]})}function Q({asset:e,box:t,label:n}){if(e.state!==`ready`)return null;let r=Z(t,e),i=e.width===r.w?0:r.x/(e.width-r.w)*100,a=e.height===r.h?0:r.y/(e.height-r.h)*100;return(0,q.jsxs)(`div`,{className:`change-report-zoom`,children:[(0,q.jsx)(`span`,{children:n}),(0,q.jsx)(`div`,{role:`img`,"aria-label":n,className:`change-report-crop`,style:{maxWidth:Math.round(r.w*2.5),aspectRatio:`${r.w} / ${r.h}`,backgroundImage:`url("${e.src}")`,backgroundSize:`${e.width/r.w*100}% auto`,backgroundPosition:`${i}% ${a}%`}})]})}function gn({section:e,viewports:t,sessionRef:n,documentRef:r,locale:i}){let a=ln.test(Y(e.viewport))?Y(e.viewport):t[0],o=pn(n,r,`before-${e.key}-${a}.png`),s=pn(n,r,`after-${e.key}-${a}.png`),[c,l]=(0,W.useState)(!1),u=J(e.boxes).filter(dn).map((e,t)=>({...e,n:Number.isInteger(e.n)?e.n:t+1})),d=e=>u.map(t=>({n:t.n,box:dn(t[e])?t[e]:t})),[f,p]=[P(i,`Cũ`,`Before`),P(i,`Mới`,`After`)];return(0,q.jsxs)(`section`,{className:`change-report-card`,children:[(0,q.jsx)(`h4`,{children:Y(e.title)||e.key}),e.note&&(0,q.jsx)(`p`,{className:`change-report-note`,children:Y(e.note)}),(0,q.jsxs)(`div`,{className:`change-report-pair`,children:[(0,q.jsx)(hn,{asset:o,label:`${f} · ${a}`,frames:d(`before`),locale:i}),(0,q.jsx)(hn,{asset:s,label:`${p} · ${a}`,frames:d(`after`),locale:i})]}),u.length>0&&(0,q.jsx)(`h5`,{children:P(i,`Phóng to theo số`,`Zoom by number`)}),u.map(e=>(0,q.jsxs)(`div`,{className:`change-report-zoom-row`,children:[(0,q.jsxs)(`p`,{children:[(0,q.jsx)(`b`,{className:`change-report-number`,children:e.n}),` `,Y(e.text)]}),(0,q.jsxs)(`div`,{className:`change-report-pair`,children:[(0,q.jsx)(Q,{asset:o,box:dn(e.before)?e.before:e,label:f}),(0,q.jsx)(Q,{asset:s,box:dn(e.after)?e.after:e,label:p})]})]},e.n)),t.filter(e=>e!==a).map(t=>(0,q.jsx)(_n,{name:t,section:e,sessionRef:n,documentRef:r,locale:i},t)),(0,q.jsxs)(`details`,{onToggle:e=>l(e.currentTarget.open),children:[(0,q.jsx)(`summary`,{children:P(i,`Pixel khác nhau (tô đỏ trên ảnh mới)`,`Changed pixels (red on the new screenshot)`)}),c&&(0,q.jsx)($,{name:`diff-${e.key}-${a}.png`,sessionRef:n,documentRef:r,locale:i})]})]})}function $({name:e,sessionRef:t,documentRef:n,locale:r}){return(0,q.jsx)(hn,{asset:pn(t,n,e),label:P(r,`Khác biệt`,`Difference`),frames:[],locale:r})}function _n({name:e,section:t,sessionRef:n,documentRef:r,locale:i}){let[a,o]=(0,W.useState)(!1);return(0,q.jsxs)(`details`,{onToggle:e=>o(e.currentTarget.open),children:[(0,q.jsxs)(`summary`,{children:[P(i,`Khổ khác`,`Other size`),`: `,e]}),a&&(0,q.jsx)(vn,{name:e,section:t,sessionRef:n,documentRef:r,locale:i})]})}function vn({name:e,section:t,sessionRef:n,documentRef:r,locale:i}){let a=pn(n,r,`before-${t.key}-${e}.png`),o=pn(n,r,`after-${t.key}-${e}.png`),s=J(t.otherBoxes?.[e]).filter(dn).map((e,t)=>({n:Number.isInteger(e.n)?e.n:t+1,box:e}));return(0,q.jsxs)(`div`,{className:`change-report-pair narrow`,children:[(0,q.jsx)(hn,{asset:a,label:`${P(i,`Cũ`,`Before`)} · ${e}`,frames:s,locale:i}),(0,q.jsx)(hn,{asset:o,label:`${P(i,`Mới`,`After`)} · ${e}`,frames:s,locale:i})]})}function yn({rows:e,last:t,locale:n}){return(0,q.jsx)(`div`,{className:`change-report-scroll`,children:(0,q.jsxs)(`table`,{className:`change-report-table`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:P(n,`Mục`,`Item`)}),(0,q.jsx)(`th`,{children:P(n,`Cũ`,`Before`)}),(0,q.jsx)(`th`,{children:P(n,`Mới`,`After`)}),(0,q.jsx)(`th`,{children:t===`impact`?P(n,`Ảnh hưởng`,`Impact`):P(n,`File`,`Files`)})]})}),(0,q.jsx)(`tbody`,{children:e.map((e,n)=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsx)(`strong`,{children:Y(e.title)})}),(0,q.jsx)(`td`,{children:Y(e.before)}),(0,q.jsx)(`td`,{children:Y(e.after)}),(0,q.jsx)(`td`,{children:t===`impact`?Y(e.impact):J(e.files).map(e=>(0,q.jsx)(`code`,{children:Y(e)},e))})]},n))})]})})}function bn({value:e,locale:t}){let n=e===`passed`||e===`failed`?e:`skipped`;return(0,q.jsx)(`span`,{className:`change-report-result ${n}`,children:n===`passed`?P(t,`Đạt`,`Passed`):n===`failed`?P(t,`Lỗi`,`Failed`):P(t,`Bỏ qua`,`Skipped`)})}function xn(e){let{locale:t}=N(),[i,a]=(0,W.useState)(!1);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`change-report-actions`,children:(0,q.jsx)(n,{size:`small`,variant:`outlined`,startIcon:(0,q.jsx)(k,{fontSize:`small`}),onClick:()=>a(!0),children:P(t,`Xem toàn màn hình`,`Full screen`)})}),!i&&(0,q.jsx)(Sn,{...e}),(0,q.jsx)(r,{fullScreen:!0,open:i,onClose:()=>a(!1),"aria-label":P(t,`Báo cáo thay đổi giao diện`,`Front-end change report`),children:(0,q.jsxs)(`div`,{className:`change-report-full`,children:[(0,q.jsx)(le,{className:`change-report-close`,onClick:()=>a(!1),"aria-label":P(t,`Đóng toàn màn hình`,`Close full screen`),children:(0,q.jsx)(u,{})}),i&&(0,q.jsx)(Sn,{...e})]})})]})}function Sn({report:e,sessionRef:t,documentRef:n}){let{locale:r}=N(),i=J(e.viewports).filter(e=>ln.test(Y(e)));i.length===0&&i.push(`desktop`,`mobile`);let a=J(e.sections).filter(e=>ln.test(Y(e?.key))),o=e.e2e,s=[...o?[{name:`E2E${o.command?` · ${Y(o.command)}`:``}`,result:o.result,detail:[o.passed!==void 0&&`${Y(o.passed)} ${P(r,`đạt`,`passed`)}`,o.failed&&`${Y(o.failed)} ${P(r,`lỗi`,`failed`)}`,o.skipped&&`${Y(o.skipped)} ${P(r,`bỏ qua`,`skipped`)}`,Y(o.duration),...J(o.notes).map(Y)].filter(Boolean).join(` · `)}]:[],...J(e.checks)],c=(e,t,n)=>n&&(0,q.jsxs)(`section`,{className:`change-report-block`,children:[(0,q.jsx)(`h3`,{children:e}),t]});return(0,q.jsxs)(`div`,{className:`change-report`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(`h2`,{children:Y(e.title)||P(r,`Báo cáo thay đổi giao diện`,`Front-end change report`)}),e.lede&&(0,q.jsx)(`p`,{className:`change-report-note`,children:Y(e.lede)}),(0,q.jsxs)(`div`,{className:`change-report-chips`,children:[e.base&&(0,q.jsxs)(`span`,{children:[P(r,`Cũ`,`Before`),`: `,Y(e.base)]}),e.head&&(0,q.jsxs)(`span`,{children:[P(r,`Mới`,`After`),`: `,Y(e.head)]})]})]}),c(P(r,`Tóm tắt`,`Summary`),(0,q.jsx)(`ul`,{children:J(e.summary).map((e,t)=>(0,q.jsx)(`li`,{children:Y(e)},t))}),J(e.summary).length>0),c(P(r,`Business thay đổi`,`Business changes`),(0,q.jsx)(yn,{rows:J(e.business),last:`impact`,locale:r}),J(e.business).length>0),c(P(r,`Logic thay đổi`,`Logic changes`),(0,q.jsx)(yn,{rows:J(e.logic),last:`files`,locale:r}),J(e.logic).length>0),c(P(r,`UI/UX cũ và mới`,`UI/UX before and after`),a.map(e=>(0,q.jsx)(gn,{section:e,viewports:i,sessionRef:t,documentRef:n,locale:r},e.key)),a.length>0),c(P(r,`Kiểm thử`,`Verification`),(0,q.jsx)(`div`,{className:`change-report-scroll`,children:(0,q.jsx)(`table`,{className:`change-report-table`,children:(0,q.jsx)(`tbody`,{children:s.map((e,t)=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:Y(e.name)}),(0,q.jsx)(`td`,{children:(0,q.jsx)(bn,{value:e.result,locale:r})}),(0,q.jsx)(`td`,{children:Y(e.detail)})]},t))})})}),s.length>0),c(P(r,`File đã đổi`,`Changed files`),(0,q.jsx)(`div`,{className:`change-report-scroll`,children:(0,q.jsx)(`table`,{className:`change-report-table`,children:(0,q.jsx)(`tbody`,{children:J(e.files).map((e,t)=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsx)(`code`,{children:Y(e.path)})}),(0,q.jsx)(`td`,{children:Y(e.kind)}),(0,q.jsx)(`td`,{children:Y(e.summary)})]},t))})})}),J(e.files).length>0),c(P(r,`Rủi ro và việc còn lại`,`Risks and follow-ups`),(0,q.jsx)(`ul`,{children:J(e.risks).map((e,t)=>(0,q.jsx)(`li`,{children:Y(e)},t))}),J(e.risks).length>0)]})}var Cn=(0,W.lazy)(async()=>({default:(await Ze(async()=>{let{MarkdownMessage:e}=await import(`./MarkdownMessage-DchODuO7.js`);return{MarkdownMessage:e}},__vite__mapDeps([0,1,2,3,4,5,6,7]))).MarkdownMessage})),wn=new Set([`md`,`markdown`]),Tn=new Set([`csv`,`tsv`]);function En(e){return e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function Dn(e,t){return e.source===`project`?P(t,`Project`,`Project`):P(t,`Thư mục đã cấp quyền`,`Granted directory`)}function On(e,t){let n=[],r=[],i=``,a=!1,o=0,s=()=>{r.length<40&&r.push(i),i=``},c=()=>{s(),r.some(e=>e.length>0)&&n.push(r),r=[]};for(;o<e.length&&n.length<500;){let n=e[o];if(a){if(n===`"`&&e[o+1]===`"`){i+=`"`,o+=2;continue}if(n===`"`){a=!1,o+=1;continue}i+=n,o+=1;continue}if(n===`"`&&i.length===0){a=!0,o+=1;continue}if(n===t){s(),o+=1;continue}if(n===`
|
|
4
|
-
`||n===`\r`){c(),n===`\r`&&e[o+1]===`
|
|
5
|
-
`&&(o+=1),o+=1;continue}i+=n,o+=1}return n.length<500&&(i.length>0||r.length>0)&&c(),n}function kn({text:e,separator:t}){let n=(0,W.useMemo)(()=>On(e,t),[e,t]);if(n.length===0)return null;let[r,...i]=n,a=Math.min(Math.max(...n.map(e=>e.length)),40);return(0,q.jsx)(_,{sx:{overflowX:`auto`},children:(0,q.jsxs)(_,{component:`table`,className:`document-table`,children:[(0,q.jsx)(_,{component:`thead`,children:(0,q.jsx)(_,{component:`tr`,children:Array.from({length:a},(e,t)=>(0,q.jsx)(_,{component:`th`,children:r[t]??``},t))})}),(0,q.jsx)(_,{component:`tbody`,children:i.map((e,t)=>(0,q.jsx)(_,{component:`tr`,children:Array.from({length:a},(t,n)=>(0,q.jsx)(_,{component:`td`,children:e[n]??``},n))},t))})]})})}function An({document:e,extension:t,sessionRef:n}){let r=e.text??``,i=e.name===`report.json`&&!e.truncated?un(r):null;return i?(0,q.jsx)(xn,{report:i,sessionRef:n,documentRef:e.documentRef}):wn.has(t??``)?(0,q.jsx)(W.Suspense,{fallback:(0,q.jsx)(_,{component:`pre`,className:`document-plain`,children:r}),children:(0,q.jsx)(Cn,{children:r})}):Tn.has(t??``)?(0,q.jsx)(kn,{text:r,separator:t===`tsv`?` `:`,`}):(0,q.jsx)(_,{component:`pre`,className:`document-plain`,children:r})}function jn({sessionRef:e=null}){let{locale:t}=N(),[n,r]=(0,W.useState)({state:`idle`}),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)({state:`idle`}),[l,u]=(0,W.useState)(``),d=(0,W.useRef)(null);(0,W.useEffect)(()=>{let t=new AbortController;return r({state:`loading`}),o(null),c({state:`idle`}),je(e,t.signal).then(e=>r({state:`ready`,value:e})).catch(()=>{t.signal.aborted||r({state:`error`})}),()=>t.abort()},[e]),(0,W.useEffect)(()=>{if(!a){c({state:`idle`});return}let t=new AbortController;return c({state:`loading`}),Fe(e,a,t.signal).then(e=>{c({state:`ready`,value:e}),d.current?.scrollTo({top:0})}).catch(()=>{t.signal.aborted||c({state:`error`})}),()=>t.abort()},[e,a]);let f=n.value,p=l.trim().toLowerCase(),h=(0,W.useMemo)(()=>(f?.documents??[]).filter(e=>!p||e.relativePath.toLowerCase().includes(p)),[f,p]),g=(0,W.useMemo)(()=>(f?.roots??[]).map(e=>({root:e,entries:h.filter(t=>t.rootRef===e.rootRef)})).filter(e=>e.entries.length>0),[f,h]),_=h.find(e=>e.documentRef===a)??f?.documents.find(e=>e.documentRef===a);return(0,q.jsxs)(`section`,{className:`document-workspace surface`,"aria-labelledby":`documents-heading`,children:[(0,q.jsxs)(`header`,{className:`document-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:P(t,`Chỉ đọc · không sửa file`,`Read only · never writes`)}),(0,q.jsx)(`h2`,{id:`documents-heading`,children:P(t,`Tài liệu`,`Documents`)})]}),(0,q.jsx)(`span`,{children:f?`${f.documents.length}${f.truncated?`+`:``} ${P(t,`tài liệu`,`documents`)}`:`—`})]}),(0,q.jsxs)(`div`,{className:`document-body`,children:[(0,q.jsxs)(`aside`,{className:`document-list`,"aria-label":P(t,`Danh sách tài liệu`,`Document list`),children:[(0,q.jsx)(y,{size:`small`,fullWidth:!0,value:l,onChange:e=>u(e.target.value),placeholder:P(t,`Lọc theo tên hoặc thư mục…`,`Filter by name or folder…`),slotProps:{htmlInput:{"aria-label":P(t,`Lọc tài liệu`,`Filter documents`)},input:{startAdornment:(0,q.jsx)(M,{position:`start`,children:(0,q.jsx)(i,{fontSize:`small`})})}}}),n.state===`loading`&&(0,q.jsx)(`p`,{className:`document-empty`,children:P(t,`Đang quét tài liệu…`,`Scanning for documents…`)}),n.state===`error`&&(0,q.jsx)(`p`,{className:`document-empty`,children:P(t,`Không đọc được danh sách tài liệu.`,`The document list could not be read.`)}),f?.state===`unavailable`&&(0,q.jsx)(`p`,{className:`document-empty`,children:L(f.reasonCode,t)}),n.state===`ready`&&f?.state===`ready`&&g.length===0&&(0,q.jsx)(`p`,{className:`document-empty`,children:p?P(t,`Không có tài liệu nào khớp bộ lọc.`,`No document matches the filter.`):P(t,`Chưa tìm thấy tài liệu nào.`,`No documents were found.`)}),g.map(e=>(0,q.jsxs)(`div`,{className:`document-group`,children:[(0,q.jsxs)(`div`,{className:`document-group-heading`,children:[(0,q.jsx)(`strong`,{children:Dn(e.root,t)}),(0,q.jsx)(`span`,{title:e.root.path,children:e.root.path})]}),e.entries.map(e=>(0,q.jsxs)(A,{component:`button`,type:`button`,className:`document-row`,selected:e.documentRef===a,onClick:()=>o(e.documentRef),children:[(0,q.jsx)(ie,{fontSize:`small`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{className:`document-row-copy`,children:[(0,q.jsx)(`strong`,{children:e.name}),(0,q.jsx)(`small`,{children:e.relativePath})]}),(0,q.jsxs)(`span`,{className:`document-row-meta`,children:[e.extension,` · `,En(e.sizeBytes)]})]},e.documentRef))]},e.root.rootRef)),f?.truncated&&(0,q.jsx)(`p`,{className:`document-empty`,children:P(t,`Danh sách đã đạt giới hạn; dùng bộ lọc để thu hẹp.`,`The list reached its limit; use the filter to narrow it.`)})]}),(0,q.jsxs)(`div`,{className:`document-viewer`,ref:d,children:[!a&&(0,q.jsxs)(`div`,{className:`document-placeholder`,children:[(0,q.jsx)(ie,{"aria-hidden":`true`}),(0,q.jsx)(m,{variant:`body2`,children:P(t,`Chọn một tài liệu để đọc nội dung tại đây.`,`Pick a document to read it here.`)}),(0,q.jsx)(m,{variant:`caption`,color:`text.disabled`,children:P(t,`Hỗ trợ .md .txt .csv .json .yaml .docx .pdf`,`Supports .md .txt .csv .json .yaml .docx .pdf`)})]}),a&&s.state===`loading`&&(0,q.jsx)(`p`,{className:`document-empty`,children:P(t,`Đang mở tài liệu…`,`Opening the document…`)}),a&&s.state===`error`&&(0,q.jsx)(`p`,{className:`document-empty`,children:P(t,`Không mở được tài liệu này.`,`This document could not be opened.`)}),s.state===`ready`&&s.value&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`document-toolbar`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:s.value.name??_?.name??`—`}),(0,q.jsx)(`small`,{children:s.value.relativePath??_?.relativePath??``})]}),(0,q.jsxs)(`div`,{className:`document-badges`,children:[s.value.format&&(0,q.jsx)(se,{size:`small`,variant:`outlined`,label:s.value.format}),s.value.truncated&&(0,q.jsx)(se,{size:`small`,color:`warning`,variant:`outlined`,label:P(t,`Đã cắt bớt`,`Truncated`)}),s.value.redacted&&(0,q.jsx)(se,{size:`small`,color:`warning`,variant:`outlined`,label:P(t,`Đã che dữ liệu nhạy cảm`,`Sensitive data redacted`)})]})]}),s.value.state===`unavailable`?(0,q.jsx)(`p`,{className:`document-empty`,children:L(s.value.reasonCode,t)}):(0,q.jsx)(`article`,{className:`document-content`,children:(0,q.jsx)(An,{document:s.value,extension:_?.extension,sessionRef:e})})]})]})]})]})}function Mn(e,t=`vi`){let n=e.state===`running`?`running`:e.state===`failed`?`failed`:`passed`,r=n===`running`?t===`vi`?`đang chạy`:`running`:n===`failed`?t===`vi`?`thất bại`:`failed`:t===`vi`?`hoàn tất`:`completed`,i=e.startedAt??e.finishedAt??``;return{activityRef:`live.${e.toolCallRef}`,kind:[`bash`,`shell`,`exec`].includes(e.toolLabel)?`command`:`tool`,state:n,label:`${e.toolLabel} ${r}`,preview:t===`vi`?`Cập nhật trực tiếp từ Gateway`:`Live update from the Gateway`,toolCallId:e.toolCallRef,toolName:e.toolLabel,commandDigest:null,logRef:null,exitCode:null,exitCodeExact:!1,startedAt:i,finishedAt:n===`running`?null:e.finishedAt??i}}function Nn(e,t=`vi`){let n=e.state===`failed`?t===`vi`?`Lượt chạy gặp lỗi`:`Operation failed`:e.state===`blocked`?t===`vi`?`Lượt chạy bị chặn`:`Operation blocked`:e.state===`aborted`?t===`vi`?`Lượt chạy đã dừng`:`Operation stopped`:t===`vi`?`Chưa xác định kết quả lượt chạy`:`Operation outcome unknown`;return{activityRef:e.activityRef,kind:`system`,state:e.state,label:n,preview:e.reasonCode,toolCallId:null,toolName:null,commandDigest:null,logRef:null,exitCode:null,exitCodeExact:!1,startedAt:e.settledAt,finishedAt:e.settledAt}}function Pn(e,t,n,r=`vi`,i){let a=[...e,...t],o=new Set(a.map(e=>e.activityRef)),s=n.filter(e=>!o.has(e.activityRef)).map(e=>Nn(e,r));if(i===void 0)return{rows:[...e,...s,...t],terminalCount:s.length,runningCount:e.length};let c=i.filter(e=>e.state===`running`).map(e=>Mn(e,r));return{rows:[...c,...s,...t],terminalCount:s.length,runningCount:c.length}}function Fn(e,t=`vi`){return e.state===`passed`&&/ recovered$/i.test(e.label)?t===`vi`?`Đã khôi phục`:`Recovered`:e.state===`passed`&&/ warning$/i.test(e.label)?t===`vi`?`Đã xử lý cảnh báo`:`Handled warning`:e.state===`passed`&&e.exitCodeExact?`Pass · exit ${e.exitCode??0}`:e.state===`failed`&&e.exitCodeExact?`Fail · exit ${e.exitCode??`?`}`:e.state===`blocked`?`Blocked`:e.state===`aborted`?t===`vi`?`Đã dừng`:`Stopped`:e.state===`unknown`?t===`vi`?`Chưa xác định`:`Unknown`:e.state===`failed`?t===`vi`?`Thất bại`:`Failed`:e.state===`running`?t===`vi`?`Đang chạy`:`Running`:e.state.replaceAll(`-`,` `)}function In(e,t=`vi`){let n=Date.parse(e.startedAt),r=e.finishedAt?Date.parse(e.finishedAt):Date.now();if(!Number.isFinite(n)||!Number.isFinite(r)||r<n)return t===`vi`?`Thời gian chưa xác định`:`Unknown duration`;let i=Math.round((r-n)/1e3);return i<60?`${i}s`:`${Math.floor(i/60)}m ${i%60}s`}function Ln({activity:e,preview:t,onPreview:n,locale:r}){return(0,q.jsxs)(`article`,{className:`activity-row`,children:[(0,q.jsx)(`span`,{className:`activity-state tone-${I(e.state)}`,"aria-label":e.state}),(0,q.jsxs)(`div`,{className:`activity-copy`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:e.label}),(0,q.jsx)(`span`,{children:e.kind})]}),(0,q.jsx)(`p`,{children:e.preview||P(r,`Không có mô tả ngắn`,`No short description`)}),t&&(0,q.jsxs)(`div`,{className:`log-preview ${t.state===`error`?`error-state`:``}`,children:[t.state===`loading`?P(r,`Đang tải log ngắn…`,`Loading log preview…`):t.state===`error`?P(r,`Log preview không còn sẵn sàng.`,`Log preview is no longer available.`):t.value?.preview??`${P(r,`Không có nội dung log`,`No log content`)} · ${t.value?.reasonCode??`unavailable`}`,t.value?.truncated&&(0,q.jsx)(`small`,{children:P(r,`Preview đã được rút gọn`,`Preview truncated`)})]})]}),(0,q.jsxs)(`div`,{className:`activity-result`,children:[(0,q.jsx)(`strong`,{children:Fn(e,r)}),(0,q.jsx)(`span`,{children:In(e,r)}),e.logRef&&n&&(0,q.jsx)(`button`,{type:`button`,onClick:n,"aria-expanded":!!t,children:t?P(r,`Ẩn log`,`Hide log`):P(r,`Xem log`,`View log`)})]})]})}function Rn({snapshot:e,sessionRef:t,terminalActivities:n=[],liveActivities:r}){let{locale:i}=N(),[a,o]=(0,W.useState)({}),s=e?.activity.running??[],c=e?.activity.recent??[],{rows:l,terminalCount:u,runningCount:d}=Pn(s,c,n,i,r),f=e=>{if(a[e.activityRef]){o(t=>({...t,[e.activityRef]:void 0}));return}o(t=>({...t,[e.activityRef]:{state:`loading`}})),(t?F(t,e.activityRef):De(e.activityRef)).then(t=>o(n=>({...n,[e.activityRef]:{state:`ready`,value:t}}))).catch(()=>o(t=>({...t,[e.activityRef]:{state:`error`}})))};return(0,q.jsxs)(`section`,{className:`activity-panel surface`,"aria-labelledby":`activity-title`,children:[(0,q.jsxs)(`header`,{className:`panel-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Activity`}),(0,q.jsx)(`h2`,{id:`activity-title`,children:P(i,`Tool, command và kết quả lượt chạy`,`Tools, commands, and operation outcomes`)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`running-count`,children:[d,` `,P(i,`đang chạy`,`running`)]}),(0,q.jsxs)(`span`,{children:[c.length+u,` `,P(i,`gần đây`,`recent`)]})]})]}),(0,q.jsxs)(`div`,{className:`activity-list`,children:[l.map(e=>(0,q.jsx)(Ln,{activity:e,preview:a[e.activityRef],onPreview:e.logRef?()=>f(e):void 0,locale:i},e.activityRef)),l.length===0&&(0,q.jsx)(`div`,{className:`activity-empty`,children:P(i,`Chưa có tool, command hoặc kết quả lượt chạy nào trong timeline hiện tại.`,`No tools, commands, or operation outcomes in the current timeline.`)})]}),e?.activity.page.truncated&&(0,q.jsx)(`footer`,{className:`panel-footnote`,children:P(i,`Timeline đã được rút gọn theo giới hạn local.`,`The timeline was truncated to local limits.`)})]})}function zn(e,t=`vi`){return e===null||!Number.isFinite(e)?t===`vi`?`Không có dữ liệu`:`No data`:Math.abs(e)<1e3?String(Math.round(e)):Math.abs(e)<1e6?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:`${(e/1e6).toFixed(1)}m`}function Bn(e,t=`vi`){return e.state!==`known`||e.tokens===null||e.percent===null?t===`vi`?`Context chưa xác định`:`Unknown context`:`${zn(e.tokens,t)} / ${zn(e.contextWindow,t)} · ${e.percent.toFixed(1)}%`}function Vn(e,t=`vi`){return e.state===`known`?`↑ ${zn(e.input,t)} · ↓ ${zn(e.output,t)}`:t===`vi`?`Không có dữ liệu`:`No data`}function Hn(e,t=`vi`){return e?e.state===`passed`?e.exitCodeExact?`Pass · exit ${e.exitCode??0}`:t===`vi`?`Pass · exit chưa xác định`:`Pass · unknown exit`:e.state===`failed`?e.exitCodeExact?`Fail · exit ${e.exitCode??`?`}`:t===`vi`?`Fail · exit chưa xác định`:`Fail · unknown exit`:e.state===`stale`?e.staleFilesKnown?`Stale · ${e.staleByPaths.length} file`:t===`vi`?`Stale · file chưa xác định`:`Stale · unknown files`:e.state.replaceAll(`-`,` `):t===`vi`?`Chưa có verifier gần nhất`:`No recent verifier`}function Un(e,t=`vi`){return e.task?.blocker??e.task?.reasonCode??e.verification.reasonCode??e.health.issues.find(e=>e.severity===`error`)?.message??(t===`vi`?`Không có blocker được ghi nhận`:`No recorded blocker`)}function Wn({kicker:e,title:t,children:n}){return(0,q.jsxs)(`section`,{className:`evidence-card surface`,children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:e}),(0,q.jsx)(`h3`,{children:t}),n]})}function Gn({snapshot:e}){let{locale:t}=N(),n=e.verification.latest,r=e.usage.context,i=e.continuation,a=e.handoff,o=r.state===`known`&&r.percent!==null?Math.max(0,Math.min(100,r.percent)):0;return(0,q.jsxs)(`section`,{className:`evidence-section`,"aria-labelledby":`evidence-title`,children:[(0,q.jsxs)(`header`,{className:`section-title-row`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Completion evidence`}),(0,q.jsx)(`h2`,{id:`evidence-title`,children:P(t,`Verifier, usage và handoff`,`Verifier, usage, and handoff`)})]}),(0,q.jsx)(`span`,{children:Un(e,t)})]}),(0,q.jsxs)(`div`,{className:`evidence-grid`,children:[(0,q.jsx)(Wn,{kicker:P(t,`Verifier gần nhất`,`Latest verifier`),title:Hn(n,t),children:n?(0,q.jsxs)(`dl`,{className:`evidence-list`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Command`}),(0,q.jsx)(`dd`,{title:n.command,children:n.command})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Exact`}),(0,q.jsx)(`dd`,{children:n.exact?P(t,`Có`,`Yes`):P(t,`Không`,`No`)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Tree digest`}),(0,q.jsx)(`dd`,{title:n.treeDigest??void 0,children:et(n.treeDigest)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:P(t,`File làm stale`,`Stale files`)}),(0,q.jsx)(`dd`,{children:n.staleFilesKnown?n.staleByPaths.length:P(t,`Chưa biết`,`Unknown`)})]})]}):(0,q.jsx)(`p`,{className:`card-empty`,children:e.verification.reasonCode?L(e.verification.reasonCode,t):P(t,`Task chưa chạy verifier.`,`The task has not run a verifier.`)})}),(0,q.jsxs)(Wn,{kicker:`Token & context`,title:Bn(r,t),children:[(0,q.jsx)(`div`,{className:`context-meter`,role:`progressbar`,"aria-label":P(t,`Mức sử dụng context`,`Context usage`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,children:(0,q.jsx)(`span`,{style:{width:`${o}%`}})}),(0,q.jsxs)(`dl`,{className:`evidence-list`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:P(t,`Turn gần nhất`,`Latest turn`)}),(0,q.jsx)(`dd`,{children:Vn(e.usage.latestTurn,t)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Task total`}),(0,q.jsx)(`dd`,{children:Vn(e.usage.taskTotal,t)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Session total`}),(0,q.jsx)(`dd`,{children:Vn(e.usage.sessionTotal,t)})]})]})]}),(0,q.jsxs)(Wn,{kicker:`Continuation budget`,title:L(i.state,t),children:[(0,q.jsxs)(`dl`,{className:`budget-grid`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:P(t,`Còn lại`,`Remaining`)}),(0,q.jsx)(`dd`,{children:zn(i.remaining,t)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:P(t,`Đã dùng`,`Used`)}),(0,q.jsx)(`dd`,{children:zn(i.consumed,t)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:P(t,`Tối đa`,`Maximum`)}),(0,q.jsx)(`dd`,{children:zn(i.maximum,t)})]})]}),i.reasonCode&&(0,q.jsx)(`p`,{className:`card-note`,children:L(i.reasonCode,t)})]}),(0,q.jsx)(Wn,{kicker:`Handoff`,title:a?L(a.state,t):P(t,`Chưa có handoff`,`No handoff`),children:a?(0,q.jsxs)(`div`,{className:`handoff-copy`,children:[(0,q.jsx)(`p`,{children:a.summary}),a.blocker&&(0,q.jsxs)(`div`,{className:`handoff-blocker`,children:[(0,q.jsx)(`strong`,{children:`Blocker`}),(0,q.jsx)(`span`,{children:a.blocker})]}),a.nextSafeAction&&(0,q.jsxs)(`div`,{className:`next-action`,children:[(0,q.jsx)(`strong`,{children:P(t,`Bước an toàn tiếp theo`,`Next safe action`)}),(0,q.jsx)(`span`,{children:a.nextSafeAction})]})]}):(0,q.jsx)(`p`,{className:`card-empty`,children:P(t,`Handoff sẽ xuất hiện khi runtime ghi nhận trạng thái chuyển giao.`,`A handoff will appear when the runtime records a transfer state.`)})})]})]})}function Kn({snapshot:e,events:t,refreshSnapshot:n}){let{locale:r}=N(),[i,a]=(0,W.useState)(),[o,s]=(0,W.useState)(!0),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(null),[m,h]=(0,W.useState)(),[g,_]=(0,W.useState)(null),[v,ee]=(0,W.useState)(``),[y,b]=(0,W.useState)(()=>`message-request.${crypto.randomUUID()}`),[x,S]=(0,W.useState)([]),[C,w]=(0,W.useState)(!1),[T,E]=(0,W.useState)(!1),D=(0,W.useRef)(0),O=(0,W.useMemo)(()=>$e(t),[t]),te=[...t].reverse().find(e=>[`message.completed`,`message.failed`,`agent-operation.settled`].includes(String(e.kind)))?.eventCursor??null;(0,W.useEffect)(()=>{let e=new AbortController;return s(!0),a(void 0),ue(null,50,e.signal).then(e=>a(e)).catch(()=>void 0).finally(()=>s(!1)),()=>e.abort()},[e.identity.sessionRef]),(0,W.useEffect)(()=>{S([]),b(`message-request.${crypto.randomUUID()}`)},[e.identity.sessionRef]),(0,W.useEffect)(()=>{let e=e=>{e.dataTransfer&&[...e.dataTransfer.types].includes(`Files`)&&e.preventDefault()};return window.addEventListener(`dragover`,e),window.addEventListener(`drop`,e),()=>{window.removeEventListener(`dragover`,e),window.removeEventListener(`drop`,e)}},[]),(0,W.useEffect)(()=>{if(!te)return;let e=new AbortController,t=window.setTimeout(()=>{ue(null,50,e.signal).then(e=>a(e)).catch(()=>void 0)},80);return()=>{window.clearTimeout(t),e.abort()}},[te]);let k=async()=>{try{let e=await He();return h(e),e}catch{return}};(0,W.useEffect)(()=>{let e=new AbortController;return He(e.signal).then(h).catch(()=>void 0),()=>e.abort()},[e.identity.sessionRef,e.revision.queueRevision]);let ne=async()=>{let e=i?.page.nextBeforeCursor;if(e)try{let t=await ue(e,i.page.limit);a(e=>e?{...e,items:at(e.items,t.items),page:t.page}:t)}catch{}},A=(0,W.useMemo)(()=>i?.state===`ready`?rt(i.items):[],[i]),re=e.capabilities.capabilities[`control.chat`],j=re.status===`available`?re.actions:null,ie=!!j?.send.available,ae=e.capabilities.capabilities[`control.resumeAndContinue`].status===`available`,oe=ie||ae,M=e.capabilities.capabilities.attachments,se=M.status===`available`,ce=(0,W.useMemo)(()=>new Set(M.status===`available`?M.mimeTypes:[]),[M]),le=(0,W.useMemo)(()=>nt(ce),[ce]),de=se&&!u&&!C&&x.length<4,fe=e.session.operation.liveness===`running`,pe=async()=>{await n?.(),await k()},me=async t=>{let n=c.trim();if(!(!n||u||(t===`resume-and-continue`?!ae:!ie))){d(!0),p(null);try{let i=x.length?{messageRequestId:y,attachmentRefs:x.map(e=>e.attachmentRef)}:void 0,a=t===`resume-and-continue`?await ze(await it(e,n,i)):await Ve(await Xe(e,n,t,i));[`dispatch-observed`,`dispatch-requested`].includes(a.resultCode)?(l(``),S([]),b(`message-request.${crypto.randomUUID()}`),p(a.resultCode===`dispatch-observed`?P(r,`Đã gửi vào Pi session`,`Sent to the Pi session`):P(r,`Pi đã nhận yêu cầu`,`Pi received the request`))):a.resultCode===`held`?(l(``),p(P(r,`Đã giữ trong hàng đợi`,`Held in the queue`))):a.resultCode===`resumed-not-dispatched`?p(P(r,`Task đã mở lại nhưng tin nhắn chưa được gửi; nội dung vẫn được giữ để kiểm tra lại.`,`The task resumed but the message was not sent; the content remains for review.`)):p(`${P(r,`Chưa gửi`,`Not sent`)} · ${L(a.resultCode,r)}`),await pe()}catch{p(P(r,`Không thể gửi; trạng thái Pi có thể đã thay đổi.`,`Unable to send; Pi state may have changed.`))}finally{d(!1)}}},he=async t=>{if(!(!t?.length||!se||C)){w(!0),p(null);try{let n=await U({files:t,snapshot:e,messageRequestId:y,existing:x,allowed:ce,locale:r,stage:Pe});S(n.attachments),p(n.status)}catch{p(P(r,`Không thể đính kèm; file không được gửi vào Pi.`,`Unable to attach the file; it was not sent to Pi.`))}finally{w(!1)}}},ge=()=>{D.current=0,E(!1)},_e=e=>{B(e.dataTransfer)&&(e.preventDefault(),ge(),de&&he(e.dataTransfer.files))},ve=async t=>{if(!(u||C)){w(!0),p(null);try{let n=await R({snapshot:e,messageRequestId:y,attachmentRef:t,locale:r,stage:Pe});n.discarded?S(e=>e.filter(e=>e.attachmentRef!==t)):p(n.status)}catch{p(P(r,`Không thể bỏ file; trạng thái Pi có thể đã thay đổi.`,`Unable to remove the file; Pi state may have changed.`))}finally{w(!1)}}},ye=async(t,n,i)=>{if(!u){d(!0),p(null);try{let a=t===`queue.update`?await Ye(n,i?.trim()??``):t===`queue.delete`?{queueItemRef:n}:{queueItemRef:n,messageRequestId:`message-request.${crypto.randomUUID()}`},o=await Ve(await We(e,t,a));[`updated`,`deleted`,`dispatch-observed`,`dispatch-requested`].includes(o.resultCode)?(_(null),ee(``),p(L(o.resultCode,r))):p(`${P(r,`Chưa thay đổi`,`Not changed`)} · ${L(o.resultCode,r)}`),await pe()}catch{p(P(r,`Hàng đợi đã thay đổi; đã tải lại trạng thái mới nhất.`,`The queue changed; the latest state has been reloaded.`)),await pe()}finally{d(!1)}}};return(0,q.jsxs)(`section`,{className:`chat-panel surface`,"aria-labelledby":`chat-heading`,"data-dragging":T||void 0,onDragEnter:e=>{B(e.dataTransfer)&&(D.current+=1,E(!0))},onDragOver:e=>{B(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer.dropEffect=de?`copy`:`none`)},onDragLeave:e=>{B(e.dataTransfer)&&(--D.current,D.current<=0&&ge())},onDrop:_e,children:[T&&(0,q.jsxs)(`div`,{className:`chat-drop-overlay`,role:`status`,children:[(0,q.jsx)(`strong`,{children:de?P(r,`Thả tài liệu vào đây`,`Drop documents here`):x.length>=4?P(r,`Đã đủ 4 file cho tin nhắn này`,`This message already holds 4 files`):P(r,`Chưa nhận file lúc này`,`Files cannot be attached right now`)}),de&&(0,q.jsx)(`small`,{children:P(r,`.md .txt .csv .json .yaml .docx .pdf và ảnh`,`.md .txt .csv .json .yaml .docx .pdf and images`)})]}),(0,q.jsxs)(`header`,{className:`chat-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:P(r,`Đúng Pi session hiện tại`,`Exact current Pi session`)}),(0,q.jsx)(`h2`,{id:`chat-heading`,children:`Chat`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{children:[A.length,` `,P(r,`message gần nhất`,`recent messages`)]}),(0,q.jsx)(`span`,{className:`chat-read-state`,children:P(r,`Streaming trực tiếp`,`Live streaming`)})]})]}),(0,q.jsxs)(`div`,{className:`chat-body`,"aria-live":`polite`,children:[i?.page.hasOlder&&(0,q.jsx)(`button`,{type:`button`,className:`load-older`,onClick:()=>void ne(),children:P(r,`Tải message cũ hơn`,`Load older messages`)}),o&&(0,q.jsx)(`p`,{className:`chat-empty`,children:P(r,`Đang tải transcript hiện tại…`,`Loading the current transcript…`)}),!o&&i?.state===`unavailable`&&(0,q.jsxs)(`p`,{className:`chat-empty`,children:[P(r,`Transcript cần đồng bộ lại`,`Transcript needs resync`),` · `,L(i.reasonCode,r)]}),!o&&i?.state===`ready`&&A.length===0&&O.assistants.length===0&&(0,q.jsx)(`p`,{className:`chat-empty`,children:P(r,`Chưa có message trong Pi session này.`,`There are no messages in this Pi session.`)}),A.map(e=>e.role===`tool-result`?(0,q.jsxs)(`article`,{className:`chat-tool-result`,children:[(0,q.jsx)(`strong`,{children:e.toolCalls[0]?.toolName??`Tool`}),(0,q.jsx)(`span`,{children:P(r,`Kết quả chi tiết nằm trong Activity`,`Detailed output is available in Activity`)})]},e.messageRef):(0,q.jsxs)(`article`,{className:`chat-message chat-${e.role}`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:e.role===`user`?P(r,`Anh`,`You`):e.role===`custom`?P(r,`Biên nhận Piagent`,`Piagent receipt`):`Pi`}),(0,q.jsx)(`time`,{children:new Date(e.recordedAt).toLocaleTimeString(r===`vi`?`vi-VN`:`en-US`,{hour:`2-digit`,minute:`2-digit`})})]}),(0,q.jsx)(`p`,{children:e.content.text||(e.content.imageCount?`${e.content.imageCount} ${P(r,`ảnh đính kèm`,`attached images`)}`:P(r,`Message trống`,`Empty message`))}),(e.content.redacted||e.content.truncated)&&(0,q.jsx)(`small`,{children:e.content.redacted?P(r,`Đã che dữ liệu nhạy cảm`,`Sensitive data redacted`):P(r,`Nội dung đã rút gọn`,`Content truncated`)})]},e.messageRef)),O.assistants.map(e=>(0,q.jsxs)(`article`,{className:`chat-message chat-assistant chat-streaming`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:`Pi`}),(0,q.jsx)(`span`,{className:`stream-indicator`,children:P(r,`Đang trả lời`,`Responding`)})]}),(0,q.jsx)(`p`,{children:e.text||(e.thinking?P(r,`Đang suy nghĩ…`,`Thinking…`):P(r,`Đang chuẩn bị câu trả lời…`,`Preparing a response…`))}),e.truncated&&(0,q.jsx)(`small`,{children:P(r,`Live preview đã đạt giới hạn`,`Live preview limit reached`)})]},e.messageRef)),O.tools.filter(e=>[`started`,`progress`].includes(e.state)).map(e=>(0,q.jsxs)(`article`,{className:`chat-tool-live`,children:[(0,q.jsx)(`span`,{className:`tool-spinner`,"aria-hidden":`true`}),(0,q.jsx)(`strong`,{children:e.toolName}),(0,q.jsx)(`span`,{children:L(e.state,r)})]},e.toolCallId))]}),m?.state===`ready`&&m.items.length>0&&(0,q.jsxs)(`section`,{className:`held-queue`,"aria-label":P(r,`Tin nhắn đang giữ`,`Held messages`),children:[(0,q.jsxs)(`div`,{className:`held-queue-heading`,children:[(0,q.jsx)(`strong`,{children:P(r,`Đang giữ ${m.heldCount} tin`,`${m.heldCount} held messages`)}),m.quarantinedCount>0&&(0,q.jsxs)(`span`,{children:[m.quarantinedCount,` `,P(r,`tin cần kiểm tra`,`need review`)]})]}),(0,q.jsx)(`ol`,{children:m.items.map(e=>(0,q.jsxs)(`li`,{"data-state":e.state,children:[g===e.queueItemRef?(0,q.jsx)(`textarea`,{"aria-label":P(r,`Sửa tin nhắn đang giữ`,`Edit held message`),rows:2,maxLength:65536,value:v,onChange:e=>ee(e.target.value)}):(0,q.jsx)(`p`,{children:e.preview}),(0,q.jsx)(`div`,{children:g===e.queueItemRef?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,disabled:u||!v.trim(),onClick:()=>void ye(`queue.update`,e.queueItemRef,v),children:P(r,`Lưu`,`Save`)}),(0,q.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>{_(null),ee(``)},children:P(r,`Hủy`,`Cancel`)})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,disabled:u||e.state!==`held`||!j?.dispatchHeld.available,onClick:()=>void ye(`queue.dispatch`,e.queueItemRef),children:P(r,`Gửi`,`Send`)}),(0,q.jsx)(`button`,{type:`button`,disabled:u||e.state!==`held`||e.redacted||e.truncated||!j?.editHeld.available,title:e.redacted||e.truncated?P(r,`Không sửa từ preview đã che hoặc rút gọn`,`Redacted or truncated previews cannot be edited`):void 0,onClick:()=>{_(e.queueItemRef),ee(e.preview)},children:P(r,`Sửa`,`Edit`)}),(0,q.jsx)(`button`,{type:`button`,disabled:u||!j?.deleteHeld.available,onClick:()=>void ye(`queue.delete`,e.queueItemRef),children:P(r,`Xóa`,`Delete`)})]})}),(e.redacted||e.truncated||e.state===`quarantined`)&&(0,q.jsx)(`small`,{children:e.state===`quarantined`?P(r,`Lần gửi trước chưa xác định; không tự gửi lại`,`The previous dispatch is uncertain; it will not be resent automatically`):e.redacted?P(r,`Preview đã che dữ liệu nhạy cảm`,`Sensitive data is redacted in the preview`):P(r,`Preview đã rút gọn`,`Preview truncated`)})]},e.queueItemRef))})]}),(0,q.jsxs)(`footer`,{className:`chat-composer-preview`,children:[x.length>0&&(0,q.jsx)(`ul`,{className:`attachment-list`,"aria-label":P(r,`File sẽ gửi cùng message`,`Files to send with the message`),children:x.map(e=>(0,q.jsxs)(`li`,{"data-kind":e.kind,children:[(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`strong`,{children:e.displayName}),(0,q.jsx)(`small`,{children:tt(e,r)})]}),(0,q.jsx)(`button`,{type:`button`,disabled:u||C,"aria-label":`${P(r,`Bỏ`,`Remove`)} ${e.displayName}`,onClick:()=>void ve(e.attachmentRef),children:P(r,`Bỏ`,`Remove`)})]},e.attachmentRef))}),(0,q.jsx)(`textarea`,{"aria-label":P(r,`Nội dung chat`,`Chat message`),placeholder:ae?P(r,`Nhập việc cần Pi làm ngay sau khi mở lại task…`,`Enter work for Pi immediately after the task resumes…`):ie?P(r,`Nhắn vào đúng Pi session này…`,`Message this exact Pi session…`):P(r,`Chat control chưa khả dụng.`,`Chat control is unavailable.`),disabled:!oe||u,maxLength:65536,rows:2,value:c,onChange:e=>l(e.target.value),onPaste:e=>{e.clipboardData?.files.length&&(e.preventDefault(),de&&he(e.clipboardData.files))}}),(0,q.jsxs)(`div`,{className:`composer-actions`,children:[(0,q.jsx)(`button`,{type:`button`,disabled:!oe||u||!c.trim(),onClick:()=>void me(ae?`resume-and-continue`:fe?`follow-up`:`new-operation`),children:u?P(r,`Đang gửi…`,`Sending…`):ae?P(r,`Tiếp tục & gửi`,`Resume & send`):fe?P(r,`Gửi sau`,`Send next`):P(r,`Gửi`,`Send`)}),(0,q.jsx)(`button`,{type:`button`,disabled:!ie||u||!c.trim()||x.length>0||!j?.hold.available,title:x.length?P(r,`Bản này chưa giữ file trong hàng đợi`,`This version does not hold attachments in the queue`):void 0,onClick:()=>void me(`hold`),children:P(r,`Giữ lại`,`Hold`)}),fe&&(0,q.jsx)(`button`,{type:`button`,className:`interrupt-send`,disabled:!ie||u||!c.trim()||!j?.interruptAndSend.available,onClick:()=>void me(`steer`),children:P(r,`Ngắt & gửi`,`Interrupt & send`)})]}),(0,q.jsxs)(`label`,{className:`attachment-picker ${de?``:`disabled`}`,title:P(r,`Chọn file, hoặc kéo thả / dán thẳng vào khung chat`,`Pick a file, or drag and drop / paste straight into the chat`),children:[(0,q.jsx)(`input`,{type:`file`,multiple:!0,disabled:!de,accept:le||void 0,onChange:e=>{he(e.target.files),e.currentTarget.value=``}}),C?P(r,`Đang đọc tài liệu…`,`Reading documents…`):`${P(r,`Đính kèm hoặc kéo thả`,`Attach or drop`)} (${x.length}/4)`]}),f&&(0,q.jsx)(`small`,{role:`status`,children:f})]})]})}function qn({snapshot:e,refreshSnapshot:t}){let{locale:n}=N(),[r,i]=(0,W.useState)(),[a,o]=(0,W.useState)(``),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(null),h=(0,W.useRef)(0),g=(0,W.useRef)({revision:0,modelDirty:!1,thinkingDirty:!1}),_=e.capabilities.capabilities[`control.sessionOptions`],v=_.status===`available`?_.actions:null,ee=async e=>{let t=++h.current,n=g.current.revision;try{let r=await ve(e);return t===h.current?(i(r),r.state===`ready`&&n===g.current.revision&&(g.current.modelDirty||o(r.activeModelRef??``),g.current.thinkingDirty||c(r.activeThinkingLevel??`off`)),r):r}catch{!e?.aborted&&t===h.current&&i(void 0);return}};(0,W.useEffect)(()=>{let e=new AbortController;return ee(e.signal),()=>e.abort()},[e.identity.sessionRef,e.revision.sessionOptionRevision]);let y=(0,W.useMemo)(()=>r?.models.find(e=>e.modelRef===r.activeModelRef),[r]),b=async i=>{if(!l||d||!r||r.state!==`ready`)return;let o=i===`model`?`session-options.set-model`:`session-options.set-thinking`,c=i===`model`?a:s;f(i),m(null);try{let r=await Ee(await Je(e,o,c));m(r.resultCode===`changed`?P(n,`Đã cập nhật trong Pi và mặc định người dùng`,`Updated in Pi and user defaults`):r.resultCode===`unchanged`?P(n,`Giá trị này đang được dùng`,`This value is already active`):r.resultCode===`effect-unknown`?P(n,`Pi chưa xác nhận được hậu trạng thái; hãy tải lại trước khi thử tiếp`,`Pi could not confirm the resulting state; refresh before trying again`):`${P(n,`Chưa thay đổi`,`Not changed`)} · ${L(r.resultCode,n)}`),u(!1),g.current.revision+=1,i===`model`?g.current.modelDirty=!1:g.current.thinkingDirty=!1,await t?.(),await ee()}catch{m(P(n,`Không thể đổi; trạng thái Pi có thể đã thay đổi.`,`Unable to change the setting; Pi state may have changed.`))}finally{f(null)}};return(0,q.jsxs)(`section`,{className:`session-options surface`,"aria-labelledby":`session-options-title`,children:[(0,q.jsxs)(`div`,{className:`session-options-copy`,children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Model & thinking`}),(0,q.jsx)(`h2`,{id:`session-options-title`,children:P(n,`Thiết lập cho Pi session`,`Pi session settings`)}),(0,q.jsx)(`p`,{children:P(n,`Chỉ thay đổi khi Pi đang chờ. Thao tác này không gọi model, nhưng Pi cũng cập nhật mặc định người dùng.`,`Settings can only change while Pi is idle. This does not call the model, but Pi also updates user defaults.`)})]}),r?.state===`ready`?(0,q.jsxs)(`div`,{className:`session-options-controls`,children:[(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:`Model`}),(0,q.jsx)(`select`,{"aria-label":P(n,`Chọn model`,`Select model`),value:a,disabled:d!==null||!v?.setModel.available,onChange:e=>{g.current.revision+=1,g.current.modelDirty=!0,o(e.target.value),u(!1),m(null)},children:r.models.map(e=>(0,q.jsxs)(`option`,{value:e.modelRef,children:[e.displayName,` · `,e.provider]},e.modelRef))})]}),(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:`Thinking`}),(0,q.jsx)(`select`,{"aria-label":P(n,`Chọn thinking`,`Select thinking`),value:s,disabled:d!==null||!v?.setThinking.available,onChange:e=>{g.current.revision+=1,g.current.thinkingDirty=!0,c(e.target.value),u(!1),m(null)},children:(y?.supportedThinkingLevels??[]).map(e=>(0,q.jsx)(`option`,{value:e,children:L(e,n)},e))})]}),(0,q.jsxs)(`label`,{className:`effect-ack`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:l,disabled:d!==null||!v,onChange:e=>u(e.target.checked)}),(0,q.jsx)(`span`,{children:P(n,`Tôi hiểu thay đổi này áp dụng cho session và mặc định người dùng.`,`I understand this applies to the session and user defaults.`)})]}),(0,q.jsxs)(`div`,{className:`session-option-actions`,children:[(0,q.jsx)(`button`,{type:`button`,disabled:!l||d!==null||!v?.setModel.available||a===r.activeModelRef,onClick:()=>void b(`model`),children:d===`model`?P(n,`Đang đổi…`,`Changing…`):P(n,`Đổi model`,`Change model`)}),(0,q.jsx)(`button`,{type:`button`,disabled:!l||d!==null||!v?.setThinking.available||s===r.activeThinkingLevel,onClick:()=>void b(`thinking`),children:d===`thinking`?P(n,`Đang đổi…`,`Changing…`):P(n,`Đổi thinking`,`Change thinking`)})]}),p&&(0,q.jsx)(`small`,{role:`status`,children:p}),!v?.setModel.available&&(0,q.jsxs)(`small`,{children:[P(n,`Đang khóa thay đổi`,`Changes locked`),` · `,L(v?.setModel.reasonCode??(_.status===`unavailable`?_.reason?.code:`unavailable`),n)]})]}):(0,q.jsxs)(`div`,{className:`session-options-unavailable`,children:[(0,q.jsx)(`strong`,{children:P(n,`Catalog model chưa sẵn sàng`,`Model catalog unavailable`)}),(0,q.jsx)(`span`,{children:L(r?.reasonCode??`authenticated-model-catalog-unavailable`,n)})]})]})}var Jn={stopped:`Đã dừng lượt Pi hiện tại; task vẫn được giữ lại.`,"emergency-stop":`Đã dừng lượt Pi hiện tại.`,"stop-requested":`Đang chờ Pi xác nhận lượt hiện tại đã dừng.`,"already-idle":`Pi đang chờ, không có lượt nào cần dừng.`,"pause-requested":`Đang chờ tool hiện tại kết thúc tại điểm an toàn.`,paused:`Task đã tạm dừng an toàn.`,"already-pausing":`Task đang chờ điểm tạm dừng an toàn.`,"already-paused":`Task đang được tạm dừng.`,resumed:`Task đã hoạt động lại; chưa gửi thêm tin nhắn cho model.`,"pause-cancelled":`Đã hủy yêu cầu tạm dừng; chưa gọi model.`,"already-active":`Task đang hoạt động.`,"resume-rejected":`Chưa thể tiếp tục vì bằng chứng khôi phục chưa đủ an toàn.`,"settlement-unknown":`Chưa xác nhận được Pi đã dừng. Hãy xem trạng thái mới trước khi thử lại.`,"pause-unconfirmed":`Chưa đủ bằng chứng để xác nhận task đã tạm dừng.`},Yn={stopped:`Stopped the current Pi turn; the task remains intact.`,"emergency-stop":`Stopped the current Pi turn.`,"stop-requested":`Waiting for Pi to confirm the current turn has stopped.`,"already-idle":`Pi is idle; there is no turn to stop.`,"pause-requested":`Waiting for the current tool to finish at a safe point.`,paused:`The task is safely paused.`,"already-pausing":`The task is waiting for a safe pause point.`,"already-paused":`The task is paused.`,resumed:`The task is active again; no model message was sent.`,"pause-cancelled":`Cancelled the pause request; no model call was made.`,"already-active":`The task is active.`,"resume-rejected":`Resume is blocked because recovery evidence is not yet safe.`,"settlement-unknown":`Pi stop is unconfirmed. Refresh status before trying again.`,"pause-unconfirmed":`There is not enough evidence to confirm the task is paused.`};function Xn(e,t){return(t===`vi`?Jn:Yn)[e.resultCode]??(e.error?.message||`${P(t,`Chưa thực hiện`,`Not executed`)} · ${L(e.resultCode,t)}`)}function Zn({snapshot:e,refreshSnapshot:t}){let{locale:n}=N(),r=e.capabilities.capabilities[`control.lifecycle`],[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(null),c=r.status===`available`,l=c?r.currentPhase:`unknown`,u=c?r.stopPhaseSupport[l]:null,d=!!(u?.stop===`supported`&&e.identity.agentOperationId),f=!!(c&&r.actions.pause.available),p=!!(c&&r.actions.resume.available);(0,W.useEffect)(()=>{o?.resultCode===`pause-requested`&&e.session.controlState===`paused`&&s({action:`lifecycle.pause`,resultCode:`paused`,text:(n===`vi`?Jn:Yn).paused}),o?.resultCode===`stop-requested`&&e.session.operation.liveness===`idle`&&s({action:`lifecycle.stop`,resultCode:`stopped`,text:(n===`vi`?Jn:Yn).stopped})},[o?.resultCode,n,e.session.controlState,e.session.operation.liveness]);let m=async r=>{if(!i){a(r),s(null);try{let i=await Ie(await z(e,r));s({action:r,resultCode:i.resultCode,text:Xn(i,n)}),await t?.()}catch{s({action:r,resultCode:`request-failed`,text:P(n,`Trạng thái Pi đã thay đổi hoặc kết nối local bị gián đoạn. Hãy tải trạng thái mới rồi thử lại.`,`Pi state changed or the local connection was interrupted. Refresh status before trying again.`)})}finally{a(null)}}};return(0,q.jsxs)(`section`,{className:`lifecycle-panel surface`,"aria-labelledby":`lifecycle-title`,children:[(0,q.jsxs)(`div`,{className:`lifecycle-copy`,children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:P(n,`Điều khiển task`,`Task controls`)}),(0,q.jsx)(`h2`,{id:`lifecycle-title`,children:`Stop, pause & resume`}),(0,q.jsx)(`p`,{children:P(n,`Stop dừng lượt Pi đang chạy. Pause chờ tool hiện tại kết thúc rồi giữ task. Resume chỉ mở lại task, không tự gọi model. Muốn mở lại và giao việc ngay, dùng “Tiếp tục & gửi” trong Chat.`,`Stop ends the running Pi turn. Pause waits for the current tool to reach a safe point and holds the task. Resume reopens the task without calling the model. Use “Resume & send” in Chat to continue with new work.`)})]}),(0,q.jsxs)(`div`,{className:`lifecycle-state`,children:[(0,q.jsx)(`span`,{children:P(n,`Trạng thái`,`Status`)}),(0,q.jsx)(`strong`,{children:L(e.session.controlState,n)}),(0,q.jsxs)(`small`,{children:[`Pi: `,L(e.session.operation.liveness,n),` · phase: `,L(l,n)]})]}),(0,q.jsxs)(`div`,{className:`lifecycle-actions`,children:[(0,q.jsx)(`button`,{type:`button`,className:`danger-action`,disabled:i!==null||!d,onClick:()=>void m(`lifecycle.stop`),title:d?void 0:L(u?.reasonCode??`no-current-operation`,n),children:i===`lifecycle.stop`?P(n,`Đang dừng…`,`Stopping…`):P(n,`Dừng lượt hiện tại`,`Stop current turn`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-action`,disabled:i!==null||!f,onClick:()=>void m(`lifecycle.pause`),title:!f&&c?L(r.actions.pause.reasonCode,n):void 0,children:i===`lifecycle.pause`?P(n,`Đang yêu cầu…`,`Requesting…`):P(n,`Tạm dừng task`,`Pause task`)}),(0,q.jsx)(`button`,{type:`button`,className:`primary-action`,disabled:i!==null||!p,onClick:()=>void m(`lifecycle.resume`),title:!p&&c?L(r.actions.resume.reasonCode,n):void 0,children:i===`lifecycle.resume`?P(n,`Đang mở lại…`,`Resuming…`):P(n,`Tiếp tục task`,`Resume task`)})]}),o&&(0,q.jsx)(`p`,{className:`lifecycle-result result-${o.resultCode===`request-failed`||o.resultCode.includes(`unknown`)||o.resultCode.includes(`unconfirmed`)||o.resultCode===`resume-rejected`?`warning`:`ok`}`,role:`status`,children:o.text}),!c&&(0,q.jsxs)(`p`,{className:`lifecycle-result result-warning`,children:[P(n,`Điều khiển chưa sẵn sàng`,`Controls unavailable`),` · `,L(r.reason?.code,n)]})]})}function Qn(e,t){try{return new Intl.DateTimeFormat(t===`vi`?`vi-VN`:`en-US`,{dateStyle:`short`,timeStyle:`short`}).format(new Date(e))}catch{return e}}function $n({value:e,locale:t}){return(0,q.jsxs)(`span`,{className:`status-pill tone-${I(e)}`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`status-dot`}),L(e,t)]})}function er({snapshot:e}){let{locale:t}=N(),[n,r]=(0,W.useState)(),[i,a]=(0,W.useState)(`loading`),[o,s]=(0,W.useState)(`all`),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(),[f,p]=(0,W.useState)(`idle`),[m,h]=(0,W.useState)(),[g,_]=(0,W.useState)(`idle`),[v,ee]=(0,W.useState)(),[y,b]=(0,W.useState)(`idle`),[x,S]=(0,W.useState)(),[C,w]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{let e=new AbortController;return a(`loading`),we(e.signal).then(t=>{e.signal.aborted||(r(t),a(`ready`),l(e=>e&&t.runs.some(t=>t.runRef===e)?e:t.activeRunRef??t.runs[0]?.runRef??null))}).catch(()=>{e.signal.aborted||a(`error`)}),()=>e.abort()},[e.revision.taskRevision,e.revision.eventCursor]);let T=(0,W.useMemo)(()=>(n?.runs??[]).filter(e=>o===`all`||o===`current`&&e.isCurrentSession||o===`terminal`&&e.terminal),[n,o]);return(0,W.useEffect)(()=>{if(!c){d(void 0),p(`idle`);return}let e=new AbortController;return p(`loading`),_e(c,e.signal).then(t=>{e.signal.aborted||(d(t),p(`ready`))}).catch(()=>{e.signal.aborted||p(`error`)}),()=>e.abort()},[c,e.revision.eventCursor]),(0,W.useEffect)(()=>{if(!c){ee(void 0),b(`idle`);return}let e=new AbortController;return b(`loading`),Te(c,e.signal).then(t=>{e.signal.aborted||(ee(t),b(`ready`))}).catch(()=>{e.signal.aborted||b(`error`)}),()=>e.abort()},[c,e.revision.eventCursor]),(0,W.useEffect)(()=>{if(!c){h(void 0),_(`idle`);return}let e=new AbortController;return _(`loading`),ge(c,e.signal).then(t=>{e.signal.aborted||(h(t),_(`ready`))}).catch(()=>{e.signal.aborted||_(`error`)}),()=>e.abort()},[c,e.revision.eventCursor]),(0,W.useEffect)(()=>{if(!c){S(void 0),w(`idle`);return}let e=new AbortController;return w(`loading`),Se(c,e.signal).then(t=>{e.signal.aborted||(S(t),w(`ready`))}).catch(()=>{e.signal.aborted||w(`error`)}),()=>e.abort()},[c,e.revision.eventCursor]),(0,q.jsxs)(`section`,{className:`task-run-index surface`,"aria-labelledby":`task-run-index-title`,children:[(0,q.jsxs)(`header`,{className:`source-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Long-task dashboard`}),(0,q.jsx)(`h2`,{id:`task-run-index-title`,children:P(t,`Task và các lần chạy gần đây`,`Tasks and recent runs`)})]}),(0,q.jsxs)(`span`,{children:[n?.page.total??0,` `,P(t,`run từ local state`,`runs from local state`)]})]}),(0,q.jsx)(`div`,{className:`task-index-controls`,role:`group`,"aria-label":P(t,`Lọc task run`,`Filter task runs`),children:[[`all`,P(t,`Tất cả`,`All`)],[`current`,P(t,`Session này`,`This session`)],[`terminal`,P(t,`Đã kết thúc`,`Finished`)]].map(([e,t])=>(0,q.jsx)(`button`,{type:`button`,"aria-pressed":o===e,onClick:()=>s(e),children:t},e))}),i===`loading`&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Đang đọc task state bền vững…`,`Reading durable task state…`)}),(i===`error`||n?.state===`unavailable`)&&(0,q.jsx)(`p`,{className:`task-index-empty error-state`,children:P(t,`Task history chưa sẵn sàng; Pi session hiện tại không bị ảnh hưởng.`,`Task history is unavailable; the current Pi session is unaffected.`)}),i===`ready`&&n?.state===`ready`&&(0,q.jsxs)(`div`,{className:`task-run-list`,children:[T.map(e=>(0,q.jsxs)(`article`,{className:`task-run-card`,"data-active":e.isActive,"data-selected":e.runRef===c,children:[(0,q.jsxs)(`div`,{className:`task-run-main`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:e.summary||e.taskId}),e.isActive&&(0,q.jsx)(`span`,{className:`active-run-tag`,children:P(t,`Đang hoạt động`,`Active`)})]}),(0,q.jsxs)(`small`,{children:[e.taskId,` · `,P(t,`lần`,`attempt`),` `,e.attempt,`/`,e.maxAttempts,` · `,P(t,`cập nhật`,`updated`),` `,Qn(e.updatedAt,t)]})]}),(0,q.jsxs)(`div`,{className:`task-run-meta`,children:[(0,q.jsx)($n,{value:e.outcome,locale:t}),(0,q.jsx)(`span`,{children:e.progress.total?`${e.progress.completed}/${e.progress.total} ${P(t,`bước`,`steps`)}`:P(t,`Chưa có work plan`,`No work plan`)}),(0,q.jsx)(`span`,{children:e.sessionLabel??(e.isCurrentSession?P(t,`Session hiện tại`,`Current session`):P(t,`Session khác`,`Other session`))}),(0,q.jsx)(`button`,{type:`button`,"aria-pressed":e.runRef===c,onClick:()=>l(e.runRef),children:P(t,`Xem timeline`,`View timeline`)})]})]},e.runRef)),T.length===0&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Không có task run trong bộ lọc này.`,`No task runs match this filter.`)})]}),n?.warnings.map(e=>(0,q.jsx)(`p`,{className:`task-index-warning`,role:`status`,children:e.message},e.code)),n?.page.truncated&&(0,q.jsxs)(`p`,{className:`task-index-warning`,children:[P(t,`Danh sách đã rút gọn;`,`The list is truncated;`),` `,n.page.total-n.page.returned,` `,P(t,`run cũ chưa hiển thị.`,`older runs are not shown.`)]}),(0,q.jsxs)(`section`,{className:`task-timeline`,"aria-labelledby":`task-timeline-title`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Recovery timeline`}),(0,q.jsx)(`h3`,{id:`task-timeline-title`,children:P(t,`Crash, resume, pause và checkpoint`,`Crash, resume, pause, and checkpoints`)})]}),u?.state===`ready`&&(0,q.jsx)($n,{value:u.continuity.recoveryDecision,locale:t})]}),f===`idle`&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Chọn một run để xem timeline.`,`Select a run to view its timeline.`)}),f===`loading`&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Đang xác minh chuỗi Task Journal…`,`Verifying the Task Journal chain…`)}),(f===`error`||u?.state===`unavailable`)&&(0,q.jsx)(`p`,{className:`task-index-empty error-state`,children:P(t,`Timeline không đủ bằng chứng tin cậy; task hiện tại không bị ảnh hưởng.`,`The timeline lacks trustworthy evidence; the current task is unaffected.`)}),f===`ready`&&u?.state===`ready`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`timeline-continuity`,children:[(0,q.jsxs)(`span`,{children:[`Crash evidence: `,(0,q.jsx)(`strong`,{children:L(u.continuity.crashEvidence,t)})]}),(0,q.jsxs)(`span`,{children:[`Recovery: `,(0,q.jsx)(`strong`,{children:L(u.continuity.recoveryDecision,t)})]})]}),(0,q.jsx)(`ol`,{className:`timeline-events`,children:u.events.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`span`,{className:`timeline-dot tone-${I(e.state)}`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:e.title}),(0,q.jsxs)(`small`,{children:[`#`,e.sequence,` · `,Qn(e.recordedAt,t)]}),e.detail&&(0,q.jsx)(`p`,{children:e.detail})]}),(0,q.jsx)($n,{value:e.state,locale:t})]},e.eventRef))}),u.events.length===0&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Run này chưa có fact timeline bền vững.`,`This run has no durable timeline facts.`)})]}),u?.warnings.map(e=>(0,q.jsx)(`p`,{className:`task-index-warning`,role:`status`,children:e.message},e.code))]}),(0,q.jsxs)(`section`,{className:`task-timeline recovery-history`,"aria-labelledby":`recovery-history-title`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Compaction & recovery`}),(0,q.jsx)(`h3`,{id:`recovery-history-title`,children:P(t,`Lịch sử rút gọn và phục hồi`,`Compaction and recovery history`)})]}),m?.state===`ready`&&(0,q.jsx)($n,{value:m.completeness,locale:t})]}),g===`idle`&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Chọn một run để xem lịch sử rút gọn.`,`Select a run to view compaction history.`)}),g===`loading`&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Đang đọc metadata compaction an toàn…`,`Reading safe compaction metadata…`)}),(g===`error`||m?.state===`unavailable`)&&(0,q.jsx)(`p`,{className:`task-index-empty error-state`,children:P(t,`Lịch sử compaction chưa đủ bằng chứng tin cậy; task hiện tại không bị ảnh hưởng.`,`Compaction history lacks trustworthy evidence; the current task is unaffected.`)}),g===`ready`&&m?.state===`ready`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`timeline-continuity recovery-summary`,children:[(0,q.jsxs)(`span`,{children:[`Context compact: `,(0,q.jsx)(`strong`,{children:m.summary.contextCompactions})]}),(0,q.jsxs)(`span`,{children:[`Tool result: `,(0,q.jsx)(`strong`,{children:m.summary.toolResultCompactions})]}),(0,q.jsxs)(`span`,{children:[`Recovery: `,(0,q.jsx)(`strong`,{children:L(m.recovery.decision,t)})]}),(0,q.jsxs)(`span`,{children:[`Verifier: `,(0,q.jsx)(`strong`,{children:L(m.recovery.verifierState,t)})]})]}),(0,q.jsx)(`p`,{className:`retained-content-note`,children:P(t,`Nội dung capture được giữ trong private runtime state và không gửi vào trình duyệt.`,`Captured content stays in private runtime state and is not sent to the browser.`)}),(0,q.jsx)(`ol`,{className:`timeline-events`,children:m.events.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`span`,{className:`timeline-dot tone-${I(e.kind)}`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:e.title}),(0,q.jsxs)(`small`,{children:[`#`,e.sequence,` · `,Qn(e.recordedAt,t)]}),e.kind===`tool-result-compaction`&&(0,q.jsxs)(`p`,{children:[e.toolName,` · `,e.originalLines??`?`,` `,P(t,`dòng`,`lines`),` · `,e.captureCount,` capture`]}),e.detail&&(0,q.jsx)(`p`,{children:e.detail})]}),(0,q.jsx)($n,{value:`observed`,locale:t})]},e.eventRef))}),m.events.length===0&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Run này chưa có metadata compaction đã quan sát.`,`This run has no observed compaction metadata.`)})]}),m?.warnings.map(e=>(0,q.jsx)(`p`,{className:`task-index-warning`,role:`status`,children:e.message},e.code))]}),(0,q.jsxs)(`section`,{className:`task-timeline handoff-history`,"aria-labelledby":`handoff-history-title`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Handoff`}),(0,q.jsx)(`h3`,{id:`handoff-history-title`,children:P(t,`Bàn giao và việc cần làm tiếp theo`,`Handoff and next work`)})]}),v?.state===`ready`&&(0,q.jsx)($n,{value:v.completeness,locale:t})]}),y===`idle`&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Chọn một run để xem handoff.`,`Select a run to view its handoff.`)}),y===`loading`&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Đang xác minh handoff và next action…`,`Verifying the handoff and next action…`)}),(y===`error`||v?.state===`unavailable`)&&(0,q.jsx)(`p`,{className:`task-index-empty error-state`,children:P(t,`Handoff không đủ bằng chứng tin cậy; WebUI không đề xuất hành động.`,`The handoff lacks trustworthy evidence; WebUI will not suggest an action.`)}),y===`ready`&&v?.state===`ready`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`next-action-card`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:P(t,`Việc tiếp theo`,`Next work`)}),(0,q.jsx)(`strong`,{children:L(v.nextAction.action,t)})]}),(0,q.jsx)(`p`,{children:v.nextAction.reason}),(0,q.jsxs)(`small`,{children:[v.nextAction.exactCommandCount,` verifier command · `,P(t,`chỉ xem, không tự chạy`,`read-only, never auto-run`)]})]}),v.current&&(0,q.jsxs)(`div`,{className:`timeline-continuity handoff-summary`,children:[(0,q.jsxs)(`span`,{children:[`Outcome: `,(0,q.jsx)(`strong`,{children:L(v.current.taskOutcome,t)})]}),(0,q.jsxs)(`span`,{children:[`Gate: `,(0,q.jsx)(`strong`,{children:L(v.current.gateDecision,t)})]}),(0,q.jsxs)(`span`,{children:[`Authority: `,(0,q.jsx)(`strong`,{children:L(v.current.requiredAuthority,t)})]}),(0,q.jsxs)(`span`,{children:[`Tree evidence: `,(0,q.jsx)(`strong`,{children:v.current.treeEvidenceCurrent?`current`:`not current`})]})]}),(0,q.jsx)(`ol`,{className:`timeline-events`,children:v.events.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`span`,{className:`timeline-dot tone-${I(e.completionApproved?`completed`:`handoff`)}`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:P(t,`Handoff projection đã được ghi`,`Handoff projection recorded`)}),(0,q.jsxs)(`small`,{children:[`#`,e.sequence,` · `,Qn(e.recordedAt,t)]}),(0,q.jsxs)(`p`,{children:[e.phase??`unknown`,` · `,L(e.projectedAction,t)]})]}),(0,q.jsx)($n,{value:e.completionApproved?`completed`:`observed`,locale:t})]},e.eventRef))}),!v.current&&v.events.length===0&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Run này chưa có handoff đã quan sát.`,`This run has no observed handoff.`)})]}),v?.warnings.map(e=>(0,q.jsx)(`p`,{className:`task-index-warning`,role:`status`,children:e.message},e.code))]}),(0,q.jsxs)(`section`,{className:`task-timeline subagent-tree`,"aria-labelledby":`subagent-tree-title`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Helper / subagent tree`}),(0,q.jsx)(`h3`,{id:`subagent-tree-title`,children:P(t,`Quyền sở hữu và vòng đời helper`,`Helper ownership and lifecycle`)})]}),x?.state===`ready`&&(0,q.jsx)($n,{value:x.evidenceState,locale:t})]}),C===`idle`&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Chọn một run để xem helper/subagent.`,`Select a run to view helpers and subagents.`)}),C===`loading`&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Đang xác minh helper ledger bền vững…`,`Verifying the durable helper ledger…`)}),(C===`error`||x?.state===`unavailable`)&&(0,q.jsx)(`p`,{className:`task-index-empty error-state`,children:P(t,`Helper ledger không đủ tin cậy; WebUI không suy đoán cây subagent.`,`The helper ledger lacks trustworthy evidence; WebUI will not infer a subagent tree.`)}),C===`ready`&&x?.state===`ready`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`next-action-card`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:P(t,`Quyết định điều phối`,`Delegation decision`)}),(0,q.jsx)(`strong`,{children:x.delegation.action===`dispatch`?P(t,`Gửi 1 helper chỉ đọc`,`Dispatch one read-only helper`):P(t,`Parent tự làm`,`Parent works directly`)})]}),(0,q.jsx)(`p`,{children:x.delegation.reasonCodes.map(e=>L(e,t)).join(` · `)}),(0,q.jsxs)(`small`,{children:[P(t,`Tiết kiệm token dự kiến`,`Projected net token saving`),`: `,x.delegation.projectedNetSavingsRatio===null?P(t,`chưa được chứng minh`,`not proven`):`${Math.round(x.delegation.projectedNetSavingsRatio*100)}%`,` · `,P(t,`ngưỡng`,`threshold`),` `,Math.round(x.delegation.minimumRequiredNetSavingsRatio*100),`% · `,P(t,`tối đa 1 helper, 0 retry, 0 writer`,`max 1 helper, 0 retries, 0 writers`)]})]}),(0,q.jsxs)(`div`,{className:`timeline-continuity subagent-summary`,children:[(0,q.jsxs)(`span`,{children:[P(t,`Tổng helper`,`Total helpers`),`: `,(0,q.jsx)(`strong`,{children:x.summary.total})]}),(0,q.jsxs)(`span`,{children:[P(t,`Đang chạy`,`Running`),`: `,(0,q.jsx)(`strong`,{children:x.summary.active})]}),(0,q.jsxs)(`span`,{children:[P(t,`Kết quả stale`,`Stale results`),`: `,(0,q.jsx)(`strong`,{children:x.summary.staleResults})]}),(0,q.jsxs)(`span`,{children:[P(t,`Writer hiện tại`,`Current writer`),`: `,(0,q.jsx)(`strong`,{children:L(x.writer.state,t)})]})]}),(0,q.jsx)(`p`,{className:`retained-content-note`,children:P(t,`Prompt, output, model và session ID của helper không được gửi vào trình duyệt.`,`Helper prompts, outputs, models, and session IDs are not sent to the browser.`)}),(0,q.jsx)(`ol`,{className:`timeline-events`,children:x.children.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`span`,{className:`timeline-dot tone-${I(e.lifecycleState)}`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`strong`,{children:[L(e.role,t),` · `,L(e.authority,t)]}),(0,q.jsxs)(`small`,{children:[Qn(e.reservedAt,t),` → `,e.completedAt?Qn(e.completedAt,t):P(t,`đang giữ lease`,`lease active`)]}),(0,q.jsxs)(`p`,{children:[e.result.disposition?L(e.result.disposition,t):P(t,`Chưa có result evidence`,`No result evidence`),e.result.calls===null?``:` · ${e.result.calls} calls · ${e.result.tokens??0} tokens`]})]}),(0,q.jsx)($n,{value:e.result.state===`not-recorded`?e.lifecycleState:e.result.state,locale:t})]},e.nodeRef))}),x.children.length===0&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Không có lifecycle helper chi tiết cho run này.`,`No detailed helper lifecycle is available for this run.`)}),(0,q.jsx)(`p`,{className:`retained-content-note`,children:P(t,`Cây lồng nhiều tầng: chưa có durable lineage; WebUI chỉ hiển thị quan hệ task cha → helper trực tiếp.`,`Nested trees: durable lineage is not yet available, so WebUI only shows parent task → direct helper relationships.`)})]}),x?.warnings.map(e=>(0,q.jsx)(`p`,{className:`task-index-warning`,role:`status`,children:e.message},e.code))]})]})}function tr(e,t){if(!e)return P(t,`Chưa có`,`Not available`);try{return new Intl.DateTimeFormat(t===`vi`?`vi-VN`:`en-US`,{dateStyle:`short`,timeStyle:`short`}).format(new Date(e))}catch{return e}}function nr({value:e,locale:t}){return(0,q.jsxs)(`span`,{className:`status-pill tone-${I(e)}`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`status-dot`}),L(e,t)]})}function rr({snapshot:e}){let{locale:t}=N(),[n,r]=(0,W.useState)(),[i,a]=(0,W.useState)(`loading`),o=(0,W.useRef)(null),s=(0,W.useCallback)(()=>{o.current?.abort();let e=new AbortController;o.current=e,a(`loading`),Ne(e.signal).then(t=>{e.signal.aborted||(r(t),a(`ready`))}).catch(()=>{e.signal.aborted||a(`error`)})},[]);return(0,W.useEffect)(()=>(s(),()=>o.current?.abort()),[s,e.identity.projectRef,e.identity.runtimeInstanceId]),(0,q.jsxs)(`section`,{className:`release-monitor surface`,"aria-labelledby":`release-monitor-title`,children:[(0,q.jsxs)(`header`,{className:`source-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Benchmark & release`}),(0,q.jsx)(`h2`,{id:`release-monitor-title`,children:P(t,`Theo dõi chất lượng và mức sẵn sàng phát hành`,`Quality and release readiness`)})]}),(0,q.jsx)(`button`,{type:`button`,onClick:s,disabled:i===`loading`,children:i===`loading`?P(t,`Đang đọc…`,`Loading…`):P(t,`Làm mới`,`Refresh`)})]}),(0,q.jsx)(`p`,{className:`retained-content-note`,children:P(t,`Màn hình chỉ đọc bằng chứng local; không tự chạy benchmark, resume, commit, tag, publish hay push.`,`This screen only reads local evidence; it never runs benchmarks, resumes, commits, tags, publishes, or pushes.`)}),(i===`error`||n?.state===`unavailable`)&&(0,q.jsx)(`p`,{className:`task-index-empty error-state`,children:P(t,`Bằng chứng benchmark/release chưa sẵn sàng; Pi session hiện tại không bị ảnh hưởng.`,`Benchmark and release evidence is unavailable; the current Pi session is unaffected.`)}),i===`loading`&&!n&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Đang xác minh report, manifest và ledger…`,`Verifying reports, manifests, and ledgers…`)}),n&&(0,q.jsxs)(`div`,{className:`release-monitor-grid`,children:[(0,q.jsxs)(`section`,{className:`release-monitor-column`,"aria-labelledby":`benchmark-monitor-title`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Benchmark runs`}),(0,q.jsx)(`h3`,{id:`benchmark-monitor-title`,children:P(t,`Các lần đo gần đây`,`Recent runs`)})]}),(0,q.jsx)(nr,{value:n.benchmark.state,locale:t})]}),n.benchmark.runs.map(e=>(0,q.jsxs)(`article`,{className:`benchmark-run-card`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:e.suiteId}),(0,q.jsx)(nr,{value:e.lifecycle,locale:t})]}),(0,q.jsxs)(`small`,{children:[tr(e.updatedAt,t),` · `,e.completedRuns,`/`,e.expectedRuns,` `,P(t,`lượt`,`runs`),` · `,P(t,`nguồn`,`source`),` `,L(e.sourceState,t)]}),(0,q.jsxs)(`div`,{className:`benchmark-run-facts`,children:[(0,q.jsxs)(`span`,{children:[`Gate `,(0,q.jsx)(`b`,{children:L(e.releaseGate,t)})]}),(0,q.jsxs)(`span`,{children:[P(t,`Điểm`,`Score`),` `,(0,q.jsx)(`b`,{children:e.scores.overall??`—`})]}),(0,q.jsxs)(`span`,{children:[`Claim `,(0,q.jsx)(`b`,{children:L(e.claimTier,t)})]})]})]},e.runRef)),n.benchmark.runs.length===0&&(0,q.jsx)(`p`,{className:`task-index-empty`,children:P(t,`Chưa có run thuộc repo hiện tại với bằng chứng đủ tin cậy.`,`No trustworthy runs are available for the current repository.`)}),n.benchmark.warnings.map(e=>(0,q.jsx)(`p`,{className:`task-index-warning`,role:`status`,children:e.message},e.code)),n.benchmark.page.truncated&&(0,q.jsx)(`p`,{className:`task-index-warning`,children:P(t,`Danh sách được giới hạn để giữ WebUI nhẹ và ổn định.`,`The list is bounded to keep WebUI fast and stable.`)})]}),(0,q.jsxs)(`section`,{className:`release-monitor-column`,"aria-labelledby":`release-readiness-title`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Release readiness`}),(0,q.jsx)(`h3`,{id:`release-readiness-title`,children:P(t,`RC hiện tại`,`Current RC`)})]}),(0,q.jsx)(nr,{value:n.release.state,locale:t})]}),(0,q.jsxs)(`dl`,{className:`release-readiness-facts`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Local safe gate`}),(0,q.jsx)(`dd`,{children:(0,q.jsx)(nr,{value:n.release.localSafeGate,locale:t})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`RC assembly`}),(0,q.jsx)(`dd`,{children:L(n.release.rcAssembly,t)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Beta`}),(0,q.jsx)(`dd`,{children:L(n.release.beta,t)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`GA`}),(0,q.jsx)(`dd`,{children:L(n.release.gaRelease,t)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:P(t,`Báo cáo`,`Report`)}),(0,q.jsx)(`dd`,{children:tr(n.release.generatedAt,t)})]})]}),n.release.sourceState===`stale`&&(0,q.jsx)(`p`,{className:`task-index-warning`,children:P(t,`Báo cáo RC thuộc phiên bản source cũ; không dùng để xác nhận tree hiện tại.`,`The RC report belongs to an older source revision and cannot validate the current tree.`)}),n.release.blockers.length>0&&(0,q.jsxs)(`div`,{className:`release-blockers`,children:[(0,q.jsxs)(`strong`,{children:[n.release.blockerCount,` blocker`]}),(0,q.jsx)(`ul`,{children:n.release.blockers.map((e,t)=>(0,q.jsx)(`li`,{children:e},`${t}-${e}`))})]}),(0,q.jsx)(`p`,{className:`retained-content-note`,children:P(t,`Mọi quyền phát hành đều tắt. Việc phát hành vẫn cần operator phê duyệt ngoài màn hình này.`,`All release authority is disabled. Release still requires operator approval outside this screen.`)})]})]})]})}var ir=e({App:()=>pr,RuntimeOverview:()=>dr,TaskDashboard:()=>lr}),ar=264,or={overview:{vi:[`Tổng quan`,`Task contract, tiến độ và bằng chứng hoàn thành`],en:[`Overview`,`Task contract, progress, and completion evidence`]},chat:{vi:[`Chat & điều khiển`,`Đúng Pi session hiện tại, không tạo runtime thứ hai`],en:[`Chat & controls`,`The exact current Pi session, without a second runtime`]},documents:{vi:[`Tài liệu`,`Mở .md, .docx, .pdf, .csv trong project và thư mục đã cấp quyền`],en:[`Documents`,`Open .md, .docx, .pdf, and .csv from the project and granted directories`]},source:{vi:[`Source Changes`,`Review thay đổi theo task baseline, working tree và staged`],en:[`Source Changes`,`Review task baseline, working tree, and staged changes`]},activity:{vi:[`Activity`,`Tool call, command, verifier và log preview`],en:[`Activity`,`Tool calls, commands, verifiers, and bounded log previews`]},history:{vi:[`Lịch sử task`,`Crash, resume, checkpoint, handoff và helper`],en:[`Task history`,`Crash, resume, checkpoints, handoffs, and helpers`]},release:{vi:[`Release`,`Benchmark evidence và mức sẵn sàng phát hành`],en:[`Release`,`Benchmark evidence and release readiness`]}};function sr({value:e,text:t,locale:n=`vi`}){return(0,q.jsxs)(`span`,{className:`status-pill tone-${I(e)}`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`status-dot`}),t??L(e,n)]})}function cr({locale:e}){return(0,q.jsxs)(`section`,{className:`task-empty surface`,"aria-labelledby":`task-title`,children:[(0,q.jsx)(`div`,{className:`empty-mark`,"aria-hidden":`true`,children:`π`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Task contract`}),(0,q.jsx)(`h2`,{id:`task-title`,children:P(e,`Chưa có task đang chạy`,`No active task`)}),(0,q.jsx)(`p`,{children:P(e,`WebUI đang theo dõi đúng Pi session. Khi task bắt đầu, mục tiêu, tiêu chí và tiến độ sẽ xuất hiện tại đây.`,`WebUI is observing the exact Pi session. Objectives, criteria, and progress will appear here when a task begins.`)})]})]})}function lr({snapshot:e,locale:t}){let n=e.task;if(!n)return(0,q.jsx)(cr,{locale:t});let r=Qe(e,t);return(0,q.jsxs)(`section`,{className:`task-dashboard surface`,"aria-labelledby":`task-title`,children:[(0,q.jsxs)(`header`,{className:`task-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:P(t,`Task hiện tại`,`Current task`)}),(0,q.jsx)(`h2`,{id:`task-title`,children:n.summary}),(0,q.jsxs)(`div`,{className:`task-meta`,children:[(0,q.jsx)(sr,{value:n.outcome,locale:t}),(0,q.jsx)(`span`,{children:L(n.changeMode,t)}),(0,q.jsx)(`span`,{children:L(n.riskLane,t)})]})]}),(0,q.jsxs)(`div`,{className:`progress-number`,"aria-label":`${P(t,`Tiến độ`,`Progress`)} ${r.percent}%`,children:[(0,q.jsxs)(`strong`,{children:[r.percent,`%`]}),(0,q.jsx)(`span`,{children:r.text})]})]}),(0,q.jsx)(`div`,{className:`progress-track`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r.percent,"aria-label":P(t,`Tiến độ tiêu chí`,`Criteria progress`),children:(0,q.jsx)(`span`,{style:{width:`${r.percent}%`}})}),n.blocker&&(0,q.jsxs)(`div`,{className:`blocker`,role:`status`,children:[(0,q.jsx)(`span`,{children:`Blocker`}),(0,q.jsx)(`p`,{children:n.blocker})]}),(0,q.jsxs)(`div`,{className:`criteria-heading`,children:[(0,q.jsx)(`h2`,{children:P(t,`Tiêu chí hoàn thành`,`Completion criteria`)}),(0,q.jsxs)(`span`,{children:[n.criteria.length,` `,P(t,`tiêu chí`,`criteria`)]})]}),(0,q.jsx)(`ol`,{className:`criteria-list`,children:n.criteria.map((e,n)=>(0,q.jsxs)(`li`,{className:`criterion-card`,children:[(0,q.jsx)(`span`,{className:`criterion-index tone-${I(e.state)}`,children:String(n+1).padStart(2,`0`)}),(0,q.jsxs)(`div`,{className:`criterion-copy`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{children:e.obligation}),e.priority===`critical`&&(0,q.jsx)(`span`,{className:`critical-tag`,children:P(t,`Quan trọng`,`Critical`)})]}),(0,q.jsx)(`small`,{children:H(e,t)})]}),(0,q.jsx)(sr,{value:e.state,locale:t})]},e.criterionId))}),n.workPlan.length>0&&(0,q.jsxs)(`details`,{className:`work-plan`,children:[(0,q.jsxs)(`summary`,{children:[P(t,`Kế hoạch thực hiện`,`Work plan`),` · `,n.workPlan.length,` `,P(t,`bước`,`steps`)]}),(0,q.jsx)(`ol`,{children:n.workPlan.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(sr,{value:e.status,locale:t}),(0,q.jsx)(`span`,{children:e.summary})]},e.stepId))})]})]})}function ur({snapshot:e,locale:t}){return(0,q.jsxs)(`aside`,{className:`context-rail`,"aria-label":P(t,`Tóm tắt phiên`,`Session summary`),children:[(0,q.jsxs)(`section`,{className:`surface compact-panel`,children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:`Task contract`}),(0,q.jsxs)(`dl`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Task ID`}),(0,q.jsx)(`dd`,{title:e.identity.taskId??void 0,children:et(e.identity.taskId)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Run ID`}),(0,q.jsx)(`dd`,{title:e.identity.taskRunId??void 0,children:et(e.identity.taskRunId)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Verifier`}),(0,q.jsx)(`dd`,{children:(0,q.jsx)(sr,{value:e.verification.state,locale:t})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`Queue`}),(0,q.jsx)(`dd`,{children:e.session.queue.state===`known`?`${e.session.queue.heldCount??0} ${P(t,`đang giữ`,`held`)}`:L(e.session.queue.state,t)})]})]})]}),(0,q.jsxs)(`section`,{className:`surface compact-panel`,children:[(0,q.jsx)(`p`,{className:`section-kicker`,children:P(t,`Sức khỏe`,`Health`)}),(0,q.jsxs)(`div`,{className:`health-line`,children:[(0,q.jsx)(sr,{value:e.health.state,locale:t}),(0,q.jsxs)(`span`,{children:[e.health.issues.length,` `,P(t,`lưu ý`,`issues`)]})]}),e.health.issues.slice(0,3).map(e=>(0,q.jsx)(`p`,{className:`health-issue`,children:e.message},e.issueRef))]})]})}function dr({snapshot:e,locale:t}){let n=[[`Runtime`,(0,q.jsx)(sr,{value:e.session.operation.liveness,locale:t})],[`Task`,(0,q.jsx)(sr,{value:e.session.controlState,locale:t})],[`Model`,(0,q.jsx)(`strong`,{children:Ge(e,t)})],[`Thinking`,(0,q.jsx)(`strong`,{children:Ke(e,t)})],[P(t,`Quyền`,`Permission`),(0,q.jsx)(`strong`,{children:V(e,t)})],[`Approval`,(0,q.jsx)(sr,{value:e.session.approvalState,locale:t})]];return(0,q.jsx)(f,{variant:`outlined`,className:`runtime-overview`,"aria-label":P(t,`Trạng thái Pi session`,`Pi session status`),sx:{display:`grid`,gridTemplateColumns:{xs:`repeat(2, minmax(0,1fr))`,sm:`repeat(3, minmax(0,1fr))`,xl:`repeat(6, minmax(0,1fr))`},overflow:`hidden`},children:n.map(([e,t])=>(0,q.jsxs)(_,{sx:{minWidth:0,minHeight:72,px:2,py:1.5,display:`flex`,flexDirection:`column`,justifyContent:`center`,gap:.75,borderRight:1,borderBottom:{xs:1,xl:0},borderColor:`divider`,"&:last-child":{borderRight:0}},children:[(0,q.jsx)(m,{variant:`caption`,color:`text.disabled`,sx:{fontWeight:650,letterSpacing:`.11em`,textTransform:`uppercase`},children:e}),t]},e))})}function fr({active:e,snapshot:t,events:n,refreshSnapshot:r,locale:i}){return e===`overview`?(0,q.jsxs)(h,{className:`workspace-stack`,spacing:2.25,children:[(0,q.jsx)(dr,{snapshot:t,locale:i}),(0,q.jsxs)(_,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,lg:`minmax(0,1fr) 300px`},alignItems:`start`,gap:2.25},children:[(0,q.jsx)(lr,{snapshot:t,locale:i}),(0,q.jsx)(ur,{snapshot:t,locale:i})]}),(0,q.jsx)(Gn,{snapshot:t})]}):e===`chat`?(0,q.jsxs)(h,{className:`workspace-stack`,spacing:2.25,children:[(0,q.jsx)(Zn,{snapshot:t,refreshSnapshot:r}),(0,q.jsx)(qn,{snapshot:t,refreshSnapshot:r}),(0,q.jsx)(Kn,{snapshot:t,events:n,refreshSnapshot:r})]}):e===`documents`?(0,q.jsx)(jn,{}):e===`source`?(0,q.jsx)(cn,{snapshot:t,refreshSnapshot:r}):e===`activity`?(0,q.jsx)(Rn,{snapshot:t}):e===`history`?(0,q.jsx)(er,{snapshot:t}):(0,q.jsx)(rr,{snapshot:t})}function pr({snapshot:e,connection:t=`connecting`,events:n=[],refreshSnapshot:r}){let{locale:i,colorMode:a,setLocale:c,setColorMode:l}=N(),[u,f]=(0,W.useState)(`overview`),[ee,y]=(0,W.useState)(!1);if(!e)return(0,q.jsxs)(_,{className:`loading-shell`,children:[(0,q.jsx)(_,{className:`brand-mark`,"aria-hidden":`true`,children:`π`}),(0,q.jsx)(`p`,{className:`section-kicker`,children:`Piagent WebUI · local`}),(0,q.jsx)(m,{variant:`h1`,children:t===`failed`?P(i,`Không thể nối vào Pi session`,`Unable to connect to the Pi session`):P(i,`Đang mở không gian làm việc`,`Opening the workspace`)}),(0,q.jsx)(m,{color:`text.secondary`,children:t===`failed`?P(i,`Hãy mở lại WebUI từ Pi terminal để tạo phiên local mới.`,`Reopen WebUI from the Pi terminal to create a new local session.`):P(i,`Đang tải task contract và trạng thái runtime hiện tại…`,`Loading the task contract and current runtime state…`)}),t!==`failed`&&(0,q.jsx)(v,{size:22}),(0,q.jsx)(sr,{value:t,locale:i})]});let k=or[u][i],re=(e.sourceChanges.task?.counts.files??0)+e.sourceChanges.workingTree.counts.files+e.sourceChanges.staged.counts.files,M=[{id:`overview`,label:P(i,`Tổng quan`,`Overview`),icon:(0,q.jsx)(O,{})},{id:`chat`,label:P(i,`Chat & Task`,`Chat & Task`),icon:(0,q.jsx)(x,{}),count:e.session.queue.heldCount??0},{id:`documents`,label:P(i,`Tài liệu`,`Documents`),icon:(0,q.jsx)(ie,{})},{id:`source`,label:`Source Changes`,icon:(0,q.jsx)(p,{}),count:re},{id:`activity`,label:`Activity`,icon:(0,q.jsx)(s,{}),count:e.activity.running.length},{id:`history`,label:P(i,`Lịch sử`,`History`),icon:(0,q.jsx)(D,{})},{id:`release`,label:`Release`,icon:(0,q.jsx)(ne,{})}],ue=e=>{f(e),y(!1)},de=(0,q.jsxs)(_,{sx:{height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,q.jsxs)(w,{sx:{minHeight:`72px !important`,px:`18px !important`,gap:1.25},children:[(0,q.jsx)(_,{className:`brand-mark`,"aria-hidden":`true`,children:`π`}),(0,q.jsxs)(_,{sx:{minWidth:0},children:[(0,q.jsx)(m,{sx:{fontWeight:650,lineHeight:1.15},children:`Piagent`}),(0,q.jsx)(m,{variant:`caption`,color:`text.disabled`,children:`WebUI · local`})]})]}),(0,q.jsxs)(_,{sx:{mx:1.5,mb:1.25,p:1.35,border:1,borderColor:`divider`,borderRadius:1,bgcolor:`action.hover`},children:[(0,q.jsx)(m,{variant:`caption`,color:`text.disabled`,sx:{display:`block`,textTransform:`uppercase`,letterSpacing:`.09em`},children:P(i,`Pi session hiện tại`,`Current Pi session`)}),(0,q.jsx)(m,{variant:`body2`,noWrap:!0,title:e.session.displayName??void 0,sx:{mt:.45,fontWeight:650},children:e.session.displayName??`Pi session`}),(0,q.jsx)(m,{variant:`caption`,color:`text.secondary`,title:e.identity.sessionRef,children:et(e.identity.sessionRef)})]}),(0,q.jsx)(m,{variant:`caption`,color:`text.disabled`,sx:{px:2.5,pt:1,pb:.5,fontWeight:650,letterSpacing:`.1em`,textTransform:`uppercase`},children:P(i,`Không gian làm việc`,`Workspaces`)}),(0,q.jsx)(ce,{component:`nav`,"aria-label":P(i,`Điều hướng WebUI`,`WebUI navigation`),sx:{py:.5},children:M.map(e=>(0,q.jsxs)(A,{selected:u===e.id,"aria-current":u===e.id?`page`:void 0,onClick:()=>ue(e.id),children:[(0,q.jsx)(E,{sx:{minWidth:36,color:`inherit`,"& .MuiSvgIcon-root":{fontSize:19}},children:e.icon}),(0,q.jsx)(j,{primary:e.label,slotProps:{primary:{sx:{fontSize:13,fontWeight:u===e.id?750:600}}}}),!!e.count&&(0,q.jsx)(S,{badgeContent:e.count,color:e.id===`activity`?`secondary`:`primary`,max:99,sx:{mr:1}})]},e.id))}),(0,q.jsxs)(_,{sx:{mt:`auto`,p:1.5},children:[(0,q.jsx)(ae,{sx:{mb:1.5}}),(0,q.jsxs)(h,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,q.jsxs)(oe,{exclusive:!0,size:`small`,value:i,"aria-label":P(i,`Ngôn ngữ`,`Language`),onChange:(e,t)=>t&&c(t),sx:{flex:1},children:[(0,q.jsx)(C,{value:`vi`,"aria-label":`Tiếng Việt`,sx:{flex:1},children:`VI`}),(0,q.jsx)(C,{value:`en`,"aria-label":`English`,sx:{flex:1},children:`EN`})]}),(0,q.jsx)(te,{title:a===`dark`?P(i,`Chuyển sang giao diện sáng`,`Use light mode`):P(i,`Chuyển sang giao diện tối`,`Use dark mode`),children:(0,q.jsx)(le,{"aria-label":a===`dark`?P(i,`Dùng giao diện sáng`,`Use light mode`):P(i,`Dùng giao diện tối`,`Use dark mode`),onClick:()=>l(a===`dark`?`light`:`dark`),sx:{border:1,borderColor:`divider`,borderRadius:1},children:a===`dark`?(0,q.jsx)(b,{fontSize:`small`}):(0,q.jsx)(T,{fontSize:`small`})})})]})]})]});return(0,q.jsxs)(_,{className:`app-shell`,"data-contract":`snapshot-v1`,children:[(0,q.jsx)(`a`,{className:`skip-link`,href:`#main-content`,children:P(i,`Bỏ qua điều hướng`,`Skip navigation`)}),(0,q.jsx)(g,{position:`fixed`,color:`transparent`,elevation:0,sx:{width:{md:`calc(100% - ${ar}px)`},ml:{md:`${ar}px`},borderBottom:1,borderColor:`divider`,bgcolor:`rgba(var(--piagent-palette-background-defaultChannel) / .88)`,backdropFilter:`blur(18px)`},children:(0,q.jsxs)(w,{sx:{minHeight:`72px !important`,gap:1.5},children:[(0,q.jsx)(le,{edge:`start`,"aria-label":P(i,`Mở menu`,`Open menu`),onClick:()=>y(!0),sx:{display:{md:`none`}},children:(0,q.jsx)(o,{})}),(0,q.jsxs)(_,{sx:{minWidth:0,flex:1},children:[(0,q.jsx)(m,{component:`h1`,variant:`h2`,noWrap:!0,children:k[0]}),(0,q.jsx)(m,{variant:`caption`,color:`text.secondary`,noWrap:!0,sx:{display:{xs:`none`,sm:`block`}},children:k[1]})]}),(0,q.jsxs)(h,{direction:`row`,spacing:1,sx:{alignItems:`center`},"aria-live":`polite`,children:[(0,q.jsx)(se,{variant:`outlined`,size:`small`,color:t===`connected`?`success`:`default`,label:t===`connected`?`Live`:L(t,i)}),e.approvals.pending.length>0&&(0,q.jsx)(se,{color:`warning`,size:`small`,label:`${e.approvals.pending.length} approval`}),(0,q.jsx)(se,{variant:`outlined`,size:`small`,sx:{display:{xs:`none`,sm:`flex`}},label:e.capabilities.capabilities[`control.chat`].status===`available`?P(i,`Chat bật`,`Chat enabled`):P(i,`Chỉ xem`,`Read only`)})]})]})}),(0,q.jsxs)(_,{component:`nav`,"aria-label":P(i,`Sidebar chính`,`Primary sidebar`),sx:{width:{md:ar},flexShrink:{md:0}},children:[(0,q.jsx)(d,{variant:`temporary`,open:ee,onClose:()=>y(!1),ModalProps:{keepMounted:!0},sx:{display:{xs:`block`,md:`none`},"& .MuiDrawer-paper":{width:ar}},children:de}),(0,q.jsx)(d,{variant:`permanent`,open:!0,sx:{display:{xs:`none`,md:`block`},"& .MuiDrawer-paper":{width:ar,borderRight:1,borderColor:`divider`,bgcolor:`background.paper`}},children:de})]}),(0,q.jsx)(_,{component:`main`,id:`main-content`,sx:{ml:{md:`${ar}px`},minWidth:0,pt:`72px`},children:(0,q.jsxs)(_,{className:`workspace-view workspace-${u}`,sx:{width:`100%`,maxWidth:u===`source`?`none`:1580,mx:`auto`,p:{xs:1.5,sm:2.5,lg:3}},children:[e.approvals.pending.length>0&&(0,q.jsx)(_,{sx:{mb:2.25},children:(0,q.jsx)(ot,{snapshot:e,refreshSnapshot:r})}),(0,q.jsx)(fr,{active:u,snapshot:e,events:n,refreshSnapshot:r,locale:i})]})})]})}export{Rn as a,Gn as i,dr as n,jn as o,lr as r,cn as s,ir as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{At as t,Bt as n,Dn as r,Et as i,Ft as a,In as o,Jt as s,Lt as c,Mt as l,Ot as u,Rt as d,St as f,Ut as p,Vt as m,Wt as h,jt as g,l as _,ln as v,mt as y,s as b,zt as x}from"./vendor-Ch5hIe0W.js";import{i as S,n as C}from"./ui-preferences-B3UfDp-5.js";import{a as w,i as T,n as E,o as D,r as O,s as k}from"./App-DBx4BU3F.js";var A=e(o(),1),j=r();function M({active:e,snapshot:t,sessionRef:n,terminalActivities:r,liveActivities:i,refresh:a,findings:o,onSendComments:s}){let{locale:c}=S();return(0,A.useEffect)(()=>{let e=e=>{e.detail?.sessionRef===n&&a()};return window.addEventListener(`piagent-workspace-saved`,e),()=>window.removeEventListener(`piagent-workspace-saved`,e)},[n,a]),e===`source`?(0,j.jsx)(k,{snapshot:t,sessionRef:n,refreshSnapshot:a,findings:o,onSendComments:s}):e===`documents`?(0,j.jsx)(D,{sessionRef:n}):e===`activity`?(0,j.jsx)(w,{snapshot:t,sessionRef:n,terminalActivities:r,liveActivities:i}):(0,j.jsxs)(f,{spacing:2.25,children:[(0,j.jsx)(E,{snapshot:t,locale:c}),(0,j.jsx)(O,{snapshot:t,locale:c}),(0,j.jsx)(T,{snapshot:t})]})}var N=`min(44vw, 860px)`;function P({open:e,active:r,snapshot:o,state:T,sessionRef:E,terminalActivities:D,liveActivities:O,onClose:k,onActive:A,refresh:P,findings:F,onSendComments:I}){let{locale:L}=S(),R=v(),z=g(R.breakpoints.up(`xl`)),B=o?.sourceChanges.workingTree.counts.files??0,V=O===void 0?o?.activity.running.length??0:O.filter(e=>e.state===`running`).length;return(0,j.jsxs)(l,{anchor:`right`,variant:z?`persistent`:`temporary`,open:e,onClose:k,sx:{"& .MuiDrawer-paper":{width:{xs:`100%`,sm:`min(88vw, 980px)`,xl:N},bgcolor:`background.default`}},children:[(0,j.jsxs)(p,{sx:{position:`sticky`,top:0,zIndex:3,bgcolor:`background.paper`,borderBottom:1,borderColor:`divider`},children:[(0,j.jsxs)(f,{direction:`row`,sx:{minHeight:64,px:{xs:1.5,md:2},alignItems:`center`,gap:1},children:[(0,j.jsxs)(p,{sx:{flex:1,minWidth:0},children:[(0,j.jsx)(d,{sx:{fontWeight:650},children:C(L,`Agent Inspector`,`Agent Inspector`)}),(0,j.jsx)(d,{variant:`caption`,color:`text.secondary`,children:C(L,`Thay đổi trong Git · tài liệu · hoạt động của agent`,`Git changes · documents · agent activity`)})]}),(0,j.jsx)(y,{title:C(L,`Làm mới Inspector`,`Refresh Inspector`),children:(0,j.jsx)(x,{onClick:()=>void P(),children:(0,j.jsx)(i,{fontSize:`small`})})}),(0,j.jsx)(x,{"aria-label":C(L,`Đóng Inspector`,`Close Inspector`),onClick:k,children:(0,j.jsx)(c,{})})]}),(0,j.jsxs)(h,{value:r,onChange:(e,t)=>A(t),variant:`scrollable`,scrollButtons:`auto`,children:[(0,j.jsx)(s,{value:`task`,icon:(0,j.jsx)(_,{}),iconPosition:`start`,label:o?.task?`${C(L,`Task`,`Task`)} · ${o.task.progress.completed}/${o.task.progress.total}`:C(L,`Task`,`Task`)}),(0,j.jsx)(s,{value:`source`,icon:(0,j.jsx)(u,{}),iconPosition:`start`,label:`Source Changes${B?` · ${B}`:``}`}),(0,j.jsx)(s,{value:`documents`,icon:(0,j.jsx)(b,{}),iconPosition:`start`,label:C(L,`Tài liệu`,`Documents`)}),(0,j.jsx)(s,{value:`activity`,icon:(0,j.jsx)(a,{}),iconPosition:`start`,label:`${C(L,`Activity`,`Activity`)}${V?` · ${V}`:``}`})]})]}),T===`loading`?(0,j.jsxs)(f,{sx:{alignItems:`center`,py:12},spacing:1.5,children:[(0,j.jsx)(m,{size:25}),(0,j.jsx)(d,{color:`text.secondary`,children:C(L,`Đang dựng Inspector từ session và Git…`,`Building the Inspector from the session and Git…`)})]}):(T===`error`||!o)&&E&&r===`activity`&&D?.length?(0,j.jsx)(p,{sx:{p:{xs:1.5,sm:2.5,xl:3},maxWidth:1500,mx:`auto`,width:`100%`},children:(0,j.jsx)(w,{sessionRef:E,terminalActivities:D,liveActivities:O})}):T===`error`||!o||!E?(0,j.jsxs)(f,{sx:{p:3,maxWidth:720},spacing:2,children:[(0,j.jsx)(t,{severity:`warning`,children:C(L,`Không thể dựng Inspector cho session này. Chat vẫn an toàn; hãy kiểm tra project còn tồn tại và thử làm mới.`,`The Inspector could not be built for this session. Chat remains safe; check that the project still exists and refresh.`)}),(0,j.jsx)(n,{variant:`outlined`,onClick:()=>void P(),children:C(L,`Thử lại`,`Try again`)})]}):(0,j.jsx)(p,{sx:{p:r===`source`?{xs:1,md:1.5}:{xs:1.5,sm:2.5,xl:3},maxWidth:r===`source`?`none`:1500,mx:`auto`,width:`100%`},children:(0,j.jsx)(M,{active:r,snapshot:o,sessionRef:E,terminalActivities:D,liveActivities:O,refresh:P,findings:F,onSendComments:I})})]})}export{P as SessionInspectorDrawer};
|