@clawos-dev/clawd 0.2.513 → 0.2.515
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.
|
@@ -21138,7 +21138,7 @@ var AttachmentSignUrlArgs = external_exports.object({
|
|
|
21138
21138
|
sessionId: external_exports.string().min(1),
|
|
21139
21139
|
/** 相对 session.cwd 的路径;允许传绝对路径,daemon 端会归一化(必须在 cwd 内) */
|
|
21140
21140
|
relPath: external_exports.string().min(1),
|
|
21141
|
-
/** TTL 秒数;缺省
|
|
21141
|
+
/** TTL 秒数;缺省 / null = 永久 URL(不带 e 字段);只有显式传秒数才限时 */
|
|
21142
21142
|
ttlSeconds: external_exports.number().int().positive().nullable().optional(),
|
|
21143
21143
|
/** 视图模式:缺省 'raw' 返 /files/... 裸文件 URL;'md-rendered' 返
|
|
21144
21144
|
* /share/md/... viewer URL(同一签名,daemon 端换前缀),外人浏览器打开就是
|
|
@@ -24149,7 +24149,7 @@ var METHOD_DOCS = {
|
|
|
24149
24149
|
summary: "\u62C9\u5F53\u524D pty \u5C4F\u5E55\u5168\u91CF\u5FEB\u7167\uFF08\u5207\u56DE\u4F1A\u8BDD / \u5237\u65B0\u65F6\u7528\uFF09\uFF0C\u8FD4\u56DE { data, atSeq, popupKind }\u3002body: { sessionId }\u3002**\u7F3A sessionId \u9759\u9ED8\u8FD4 ok:false\uFF1B\u975E tui / pty \u5DF2\u9000\u51FA\u8FD4 ok:true \u4F46 data=null, atSeq=0** \u2014\u2014 \u4E24\u8005\u90FD\u4E0D\u62A5\u9519\uFF0C\u8981\u5206\u6E05\u5F97\u770B ok\u3002\u53EA\u6709\u8D8A\u6743\u8BBF\u95EE\u8BE5\u4F1A\u8BDD\u624D\u629B\u9519"
|
|
24150
24150
|
},
|
|
24151
24151
|
"attachment.signUrl": {
|
|
24152
|
-
summary: "\u7ED9\u5DF2\u5165\u7FA4**\u4E14\u975E stale** \u7684\u6587\u4EF6\u7B7E\u53D1 HMAC \u4E0B\u8F7D URL\uFF08\u8DE8\u8BBE\u5907\u53EF\u76F4\u63A5\u6253\u5F00\uFF09\u3002**\u9ED8\u8BA4
|
|
24152
|
+
summary: "\u7ED9\u5DF2\u5165\u7FA4**\u4E14\u975E stale** \u7684\u6587\u4EF6\u7B7E\u53D1 HMAC \u4E0B\u8F7D URL\uFF08\u8DE8\u8BBE\u5907\u53EF\u76F4\u63A5\u6253\u5F00\uFF09\u3002**\u9ED8\u8BA4\u6C38\u4E0D\u8FC7\u671F**\uFF1B\u7528\u6237\u8981\u9650\u65F6\u94FE\u63A5\u624D\u663E\u5F0F\u4F20 ttlSeconds\uFF08\u79D2\uFF09\u3002\u4E0D\u5728\u6E05\u5355\u91CC\u548C stale \u62A5\u540C\u4E00\u4E2A\u9519\uFF0C\u5206\u4E0D\u51FA\u662F\u54EA\u79CD",
|
|
24153
24153
|
args: AttachmentSignUrlArgs
|
|
24154
24154
|
},
|
|
24155
24155
|
"attachment.groupAdd": {
|
package/dist/cli.cjs
CHANGED
|
@@ -5800,7 +5800,7 @@ var init_attachment_schemas = __esm({
|
|
|
5800
5800
|
sessionId: external_exports.string().min(1),
|
|
5801
5801
|
/** 相对 session.cwd 的路径;允许传绝对路径,daemon 端会归一化(必须在 cwd 内) */
|
|
5802
5802
|
relPath: external_exports.string().min(1),
|
|
5803
|
-
/** TTL 秒数;缺省
|
|
5803
|
+
/** TTL 秒数;缺省 / null = 永久 URL(不带 e 字段);只有显式传秒数才限时 */
|
|
5804
5804
|
ttlSeconds: external_exports.number().int().positive().nullable().optional(),
|
|
5805
5805
|
/** 视图模式:缺省 'raw' 返 /files/... 裸文件 URL;'md-rendered' 返
|
|
5806
5806
|
* /share/md/... viewer URL(同一签名,daemon 端换前缀),外人浏览器打开就是
|
|
@@ -9143,7 +9143,7 @@ var init_methods = __esm({
|
|
|
9143
9143
|
summary: "\u62C9\u5F53\u524D pty \u5C4F\u5E55\u5168\u91CF\u5FEB\u7167\uFF08\u5207\u56DE\u4F1A\u8BDD / \u5237\u65B0\u65F6\u7528\uFF09\uFF0C\u8FD4\u56DE { data, atSeq, popupKind }\u3002body: { sessionId }\u3002**\u7F3A sessionId \u9759\u9ED8\u8FD4 ok:false\uFF1B\u975E tui / pty \u5DF2\u9000\u51FA\u8FD4 ok:true \u4F46 data=null, atSeq=0** \u2014\u2014 \u4E24\u8005\u90FD\u4E0D\u62A5\u9519\uFF0C\u8981\u5206\u6E05\u5F97\u770B ok\u3002\u53EA\u6709\u8D8A\u6743\u8BBF\u95EE\u8BE5\u4F1A\u8BDD\u624D\u629B\u9519"
|
|
9144
9144
|
},
|
|
9145
9145
|
"attachment.signUrl": {
|
|
9146
|
-
summary: "\u7ED9\u5DF2\u5165\u7FA4**\u4E14\u975E stale** \u7684\u6587\u4EF6\u7B7E\u53D1 HMAC \u4E0B\u8F7D URL\uFF08\u8DE8\u8BBE\u5907\u53EF\u76F4\u63A5\u6253\u5F00\uFF09\u3002**\u9ED8\u8BA4
|
|
9146
|
+
summary: "\u7ED9\u5DF2\u5165\u7FA4**\u4E14\u975E stale** \u7684\u6587\u4EF6\u7B7E\u53D1 HMAC \u4E0B\u8F7D URL\uFF08\u8DE8\u8BBE\u5907\u53EF\u76F4\u63A5\u6253\u5F00\uFF09\u3002**\u9ED8\u8BA4\u6C38\u4E0D\u8FC7\u671F**\uFF1B\u7528\u6237\u8981\u9650\u65F6\u94FE\u63A5\u624D\u663E\u5F0F\u4F20 ttlSeconds\uFF08\u79D2\uFF09\u3002\u4E0D\u5728\u6E05\u5355\u91CC\u548C stale \u62A5\u540C\u4E00\u4E2A\u9519\uFF0C\u5206\u4E0D\u51FA\u662F\u54EA\u79CD",
|
|
9147
9147
|
args: AttachmentSignUrlArgs
|
|
9148
9148
|
},
|
|
9149
9149
|
"attachment.groupAdd": {
|
|
@@ -45324,7 +45324,8 @@ var ATTACHMENT_SHARING_HINT = `## \u628A\u4EA7\u51FA\u6587\u4EF6\u5206\u4EAB\u7E
|
|
|
45324
45324
|
call({ method: "attachment.groupAdd", args: { relPath: "<\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84>", origin: "agent" } })
|
|
45325
45325
|
2. \u7B7E\u540D\u62FF URL\uFF1A
|
|
45326
45326
|
call({ method: "attachment.signUrl", args: { relPath: "<\u540C\u4E00\u4E2A\u7EDD\u5BF9\u8DEF\u5F84>" } })
|
|
45327
|
-
\u8FD4\u56DE\u7684 \`url\` \u5C31\u662F\u5BF9\u65B9\u53EF\u76F4\u63A5\u6253\u5F00/\u4E0B\u8F7D\u7684\u94FE\u63A5\u3002
|
|
45327
|
+
\u8FD4\u56DE\u7684 \`url\` \u5C31\u662F\u5BF9\u65B9\u53EF\u76F4\u63A5\u6253\u5F00/\u4E0B\u8F7D\u7684\u94FE\u63A5\u3002**\u9ED8\u8BA4\u6C38\u4E45\u6709\u6548**\uFF1B\u7528\u6237\u660E\u786E\u8981\u9650\u65F6\u94FE\u63A5\u65F6\u624D\u52A0
|
|
45328
|
+
\`ttlSeconds: <\u79D2\u6570>\`\uFF08\u5982\u4E00\u5929 = 86400\uFF09\uFF0C\u5230\u70B9\u540E\u94FE\u63A5\u5931\u6548\u3002
|
|
45328
45329
|
|
|
45329
45330
|
- \`relPath\` \u5FC5\u987B\u4F20**\u7EDD\u5BF9\u8DEF\u5F84**\uFF08\u4F60\u4EA7\u51FA\u6587\u4EF6\u7684\u771F\u5B9E\u8DEF\u5F84\uFF09\uFF0C\u4E0D\u8981\u4F20\u76F8\u5BF9\u8DEF\u5F84\u3002
|
|
45330
45331
|
- \u8DE8\u8BBE\u5907\u88AB\u59D4\u6D3E\uFF08guest\uFF09\u7684\u4F1A\u8BDD\u53EA\u80FD\u5206\u4EAB\u81EA\u5DF1\u5DE5\u4F5C\u76EE\u5F55\u5185\u7684\u6587\u4EF6\uFF0C\u8D8A\u754C\u4F1A\u88AB\u62D2\u3002
|
|
@@ -62425,7 +62426,7 @@ function createHttpRouter(deps) {
|
|
|
62425
62426
|
};
|
|
62426
62427
|
const msgByCode = {
|
|
62427
62428
|
BAD_SIG: "\u94FE\u63A5\u7B7E\u540D\u65E0\u6548\uFF0C\u8BF7\u8054\u7CFB\u5206\u4EAB\u8005\u91CD\u65B0\u751F\u6210",
|
|
62428
|
-
EXPIRED: "\u94FE\u63A5\u5DF2\u8FC7\u671F\
|
|
62429
|
+
EXPIRED: "\u94FE\u63A5\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u8054\u7CFB\u5206\u4EAB\u8005\u91CD\u65B0\u751F\u6210",
|
|
62429
62430
|
MALFORMED: "\u94FE\u63A5\u683C\u5F0F\u9519\u8BEF"
|
|
62430
62431
|
};
|
|
62431
62432
|
sendHtml(res, statusByCode[r.code], loader.renderErrorHtml(r.code, msgByCode[r.code]));
|
|
@@ -66543,7 +66544,7 @@ function computeMethodAccess(args) {
|
|
|
66543
66544
|
}
|
|
66544
66545
|
|
|
66545
66546
|
// src/version.ts
|
|
66546
|
-
var version = "0.2.
|
|
66547
|
+
var version = "0.2.515".length > 0 ? "0.2.515" : "dev";
|
|
66547
66548
|
|
|
66548
66549
|
// src/cli-probe/probe.ts
|
|
66549
66550
|
var fs77 = __toESM(require("fs"), 1);
|
|
@@ -66754,7 +66755,6 @@ function buildPersonaHandlers(deps) {
|
|
|
66754
66755
|
var import_node_path66 = __toESM(require("path"), 1);
|
|
66755
66756
|
init_protocol();
|
|
66756
66757
|
init_protocol();
|
|
66757
|
-
var DEFAULT_TTL_SECONDS = 24 * 3600;
|
|
66758
66758
|
function assertGuestAttachmentPath(ctx, absPath, personaRoot, method, usersRoot) {
|
|
66759
66759
|
if (!ctx || ctx.principal.kind !== "guest" || !personaRoot) return;
|
|
66760
66760
|
const userWorkDir = usersRoot ? deriveUserWorkDir(ctx.principal.id, usersRoot) : void 0;
|
|
@@ -66845,8 +66845,7 @@ function buildAttachmentHandlers(deps) {
|
|
|
66845
66845
|
`relPath not in session group files or stale: ${args.relPath}`
|
|
66846
66846
|
);
|
|
66847
66847
|
}
|
|
66848
|
-
const
|
|
66849
|
-
const parts = signUrlParts(secret, candidateAbs, ttl);
|
|
66848
|
+
const parts = signUrlParts(secret, candidateAbs, args.ttlSeconds ?? null);
|
|
66850
66849
|
const prefix = args.view === "md-rendered" ? "/share/md" : "/files";
|
|
66851
66850
|
const url = buildSignedFileUrl(httpBaseUrl, parts, prefix);
|
|
66852
66851
|
return {
|
|
@@ -21140,7 +21140,7 @@ var AttachmentSignUrlArgs = external_exports.object({
|
|
|
21140
21140
|
sessionId: external_exports.string().min(1),
|
|
21141
21141
|
/** 相对 session.cwd 的路径;允许传绝对路径,daemon 端会归一化(必须在 cwd 内) */
|
|
21142
21142
|
relPath: external_exports.string().min(1),
|
|
21143
|
-
/** TTL 秒数;缺省
|
|
21143
|
+
/** TTL 秒数;缺省 / null = 永久 URL(不带 e 字段);只有显式传秒数才限时 */
|
|
21144
21144
|
ttlSeconds: external_exports.number().int().positive().nullable().optional(),
|
|
21145
21145
|
/** 视图模式:缺省 'raw' 返 /files/... 裸文件 URL;'md-rendered' 返
|
|
21146
21146
|
* /share/md/... viewer URL(同一签名,daemon 端换前缀),外人浏览器打开就是
|
|
@@ -24150,7 +24150,7 @@ var METHOD_DOCS = {
|
|
|
24150
24150
|
summary: "\u62C9\u5F53\u524D pty \u5C4F\u5E55\u5168\u91CF\u5FEB\u7167\uFF08\u5207\u56DE\u4F1A\u8BDD / \u5237\u65B0\u65F6\u7528\uFF09\uFF0C\u8FD4\u56DE { data, atSeq, popupKind }\u3002body: { sessionId }\u3002**\u7F3A sessionId \u9759\u9ED8\u8FD4 ok:false\uFF1B\u975E tui / pty \u5DF2\u9000\u51FA\u8FD4 ok:true \u4F46 data=null, atSeq=0** \u2014\u2014 \u4E24\u8005\u90FD\u4E0D\u62A5\u9519\uFF0C\u8981\u5206\u6E05\u5F97\u770B ok\u3002\u53EA\u6709\u8D8A\u6743\u8BBF\u95EE\u8BE5\u4F1A\u8BDD\u624D\u629B\u9519"
|
|
24151
24151
|
},
|
|
24152
24152
|
"attachment.signUrl": {
|
|
24153
|
-
summary: "\u7ED9\u5DF2\u5165\u7FA4**\u4E14\u975E stale** \u7684\u6587\u4EF6\u7B7E\u53D1 HMAC \u4E0B\u8F7D URL\uFF08\u8DE8\u8BBE\u5907\u53EF\u76F4\u63A5\u6253\u5F00\uFF09\u3002**\u9ED8\u8BA4
|
|
24153
|
+
summary: "\u7ED9\u5DF2\u5165\u7FA4**\u4E14\u975E stale** \u7684\u6587\u4EF6\u7B7E\u53D1 HMAC \u4E0B\u8F7D URL\uFF08\u8DE8\u8BBE\u5907\u53EF\u76F4\u63A5\u6253\u5F00\uFF09\u3002**\u9ED8\u8BA4\u6C38\u4E0D\u8FC7\u671F**\uFF1B\u7528\u6237\u8981\u9650\u65F6\u94FE\u63A5\u624D\u663E\u5F0F\u4F20 ttlSeconds\uFF08\u79D2\uFF09\u3002\u4E0D\u5728\u6E05\u5355\u91CC\u548C stale \u62A5\u540C\u4E00\u4E2A\u9519\uFF0C\u5206\u4E0D\u51FA\u662F\u54EA\u79CD",
|
|
24154
24154
|
args: AttachmentSignUrlArgs
|
|
24155
24155
|
},
|
|
24156
24156
|
"attachment.groupAdd": {
|
|
@@ -591,4 +591,4 @@ Minimum version required to store current data is: `+s+`.
|
|
|
591
591
|
|
|
592
592
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
593
593
|
|
|
594
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},xoe="DialogDescriptionWarning",yoe=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${s4(xoe).contentName}}.`;return g.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},boe=q5,woe=Y5,o4=X5,a4=Q5,l4=J5,c4=t4,Soe=r4;const koe=boe,Coe=woe,u4=g.forwardRef(({className:e,...t},n)=>h.jsx(o4,{ref:n,className:ne("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",e),...t}));u4.displayName=o4.displayName;const d4=g.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(Coe,{children:[h.jsx(u4,{}),h.jsxs(a4,{ref:r,className:ne("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2","gap-4 rounded-lg border border-border bg-elevated p-6 shadow-lg",e),...n,children:[t,h.jsxs(Soe,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-accent",children:[h.jsx(qr,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));d4.displayName=a4.displayName;const h4=({className:e,...t})=>h.jsx("div",{className:ne("flex flex-col space-y-1.5 text-left",e),...t});h4.displayName="DialogHeader";const f4=g.forwardRef(({className:e,...t},n)=>h.jsx(l4,{ref:n,className:ne("text-lg font-semibold leading-none text-text-100",e),...t}));f4.displayName=l4.displayName;const Eoe=g.forwardRef(({className:e,...t},n)=>h.jsx(c4,{ref:n,className:ne("text-sm text-text-300",e),...t}));Eoe.displayName=c4.displayName;function Noe({persona:e,open:t,onClose:n,onDelete:r,embedded:i,onLoadPersonality:s,onSavePersonality:o,onLoadPersonalityLocal:a,onSavePersonalityLocal:l,hasPersonalityLocal:c=!1,onDirtyChange:u,initialPersonality:d,onShareCapability:f,readOnly:p=!1,larkBot:m}){const[v,b]=g.useState(!1),[_,x]=g.useState(!1),y=v||_,S=Ke.useRef(u);g.useEffect(()=>{S.current=u}),g.useEffect(()=>{var k;(k=S.current)==null||k.call(S,y)},[y]);const C=()=>{y&&!window.confirm("修改未保存,确定关闭?")||n()};return t?h.jsxs(h.Fragment,{children:[!i&&h.jsx("div",{className:"absolute inset-0 z-30 bg-black/30",onClick:C,"aria-hidden":"true"}),h.jsxs("aside",{className:i?"flex h-full w-full flex-col bg-bg-0":"absolute right-0 top-0 z-40 flex h-full w-[420px] flex-col bg-bg-0 border-l border-border shadow-xl","data-testid":"persona-settings-drawer",children:[h.jsxs("header",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx(X8,{className:"h-4 w-4 text-text-300"}),h.jsx("span",{className:"text-[13px] font-medium text-text-100 truncate",children:"Persona 设置"})]}),h.jsx("button",{type:"button",onClick:C,"aria-label":"关闭",className:"rounded-sm p-1.5 text-text-400 hover:bg-bg-200 hover:text-text-100",children:h.jsx(qr,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-6 flex flex-col gap-4",children:[h.jsxs("header",{className:"flex items-start justify-between gap-3",children:[h.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h2",{className:"text-lg font-semibold text-text-100 truncate",children:e.label}),e.public?h.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm bg-bg-200 px-1.5 py-0.5 text-[10px] text-text-200",children:[h.jsx(g8,{className:"h-3 w-3"})," 公开"]}):h.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm bg-error-dim px-1.5 py-0.5 text-[10px] text-error",children:[h.jsx(p8,{className:"h-3 w-3"})," 已关闭"]})]}),h.jsx("span",{className:"font-mono text-[11px] text-text-400 truncate","data-testid":"persona-id-subtitle",children:e.personaId})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[f?h.jsxs("button",{type:"button",onClick:f,"aria-label":"分享给他人",title:"分享给他人",className:"inline-flex items-center gap-1 rounded-sm px-2 py-1.5 text-xs text-text-200 hover:bg-bg-200 hover:text-text-100",children:[h.jsx(Yx,{className:"h-3.5 w-3.5"}),"分享"]}):null,r?h.jsx("button",{type:"button",onClick:r,"aria-label":"删除 persona",className:"rounded-sm p-1.5 text-text-400 hover:bg-bg-200 hover:text-error",children:h.jsx(Xx,{className:"h-4 w-4"})}):null]})]}),h.jsx("hr",{className:"border-border"}),m?h.jsxs(h.Fragment,{children:[h.jsx(Poe,{...m}),h.jsx("hr",{className:"border-border"})]}):null,s?h.jsxs(h.Fragment,{children:[h.jsx(n2,{onLoad:s,...o&&!e.personalityManaged?{onSave:o}:{},onDirtyChange:b,initialPersonality:d,readOnly:p||!!e.personalityManaged,title:e.personalityManaged?"内置人格":"人格 (Personality)",hint:e.personalityManaged?p?"这个 persona 自带的人格,随 clawd 版本更新。":"这个 persona 自带的人格,随 clawd 版本更新——在这里改不会保留,要加自己的规则请写下面的「你的补充」。":void 0,testIdPrefix:"persona-personality"}),(e.personalityManaged||c)&&a?h.jsx(n2,{onLoad:a,...l?{onSave:l}:{},onDirtyChange:x,readOnly:p,title:p?"补充设定":"你的补充",hint:p?"这个 persona 的补充设定,由它的主人维护。与内置人格叠加生效。":"写入 <persona-dir>/.clawd/personality.local.md,不会被更新覆盖。与内置人格叠加生效,冲突时以你写的为准;对 owner 和访客会话都生效,要区分对象请在正文里写明。只对新启动的会话生效。",placeholder:"例:回答一律先给结论,再展开。",testIdPrefix:"persona-personality-local"}):null,h.jsx("hr",{className:"border-border"})]}):null,h.jsx(Roe,{settings:e.sandboxSettings??null}),h.jsx("hr",{className:"border-border"}),h.jsx(Moe,{skills:e.skills??[]}),h.jsx("hr",{className:"border-border"}),h.jsx(Aoe,{plugins:e.plugins??[]})]})]})]}):null}function t2({qrUrl:e,busy:t,onCancel:n,title:r="扫码关联飞书 Bot",hint:i="用手机飞书扫码,按页面提示创建应用。确认后自动完成关联。"}){const[s,o]=g.useState(null);return g.useEffect(()=>{let a=!1;return Du.toDataURL(e,{width:240,margin:1}).then(l=>{a||o(l)}).catch(()=>{a||o(null)}),()=>{a=!0}},[e]),h.jsx(koe,{open:!0,onOpenChange:a=>a||n==null?void 0:n(),children:h.jsxs(d4,{className:"max-w-xs","data-testid":"lark-bot-qr-dialog",onInteractOutside:a=>a.preventDefault(),onEscapeKeyDown:a=>a.preventDefault(),children:[h.jsx(h4,{children:h.jsx(f4,{children:r})}),h.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s?h.jsx("img",{src:s,alt:"飞书扫码创建应用二维码",className:"h-60 w-60 rounded bg-white p-2","data-testid":"lark-bot-qr-img"}):h.jsx("div",{className:"flex h-60 w-60 items-center justify-center text-[12px] text-text-400",children:"二维码生成中…"}),h.jsx("span",{className:"text-center text-[12px] text-text-300",children:i}),n?h.jsx("button",{type:"button",disabled:t,onClick:n,className:"rounded border border-border px-3 py-1.5 text-[12px] text-text-300 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-provision-cancel",children:"取消"}):null]})]})})}const Toe={expired:"二维码已过期,请重新扫码。",cancelled:"已取消。",access_denied:"你在飞书上取消了本次授权。",lark_protocol_error:"飞书返回了未预期的响应,请重试。",cloud_unreachable:"云端暂时不可达,请稍后重试。",internal_error:"关联失败。若飞书中已创建应用,可在开发者后台删除后重试,或改用手动绑定填入其凭证。"},Ioe=new Set(["expired","access_denied","lark_protocol_error","cloud_unreachable","internal_error"]);function Poe({status:e,onProvision:t,onCancelProvision:n,onBindManual:r,onUnbind:i,onUpgrade:s}){const[o,a]=g.useState(!1),[l,c]=g.useState(null),[u,d]=g.useState(""),[f,p]=g.useState(""),[m,v]=g.useState(null),b=k=>{k&&(a(!0),c(null),k().catch(N=>c(N instanceof Error?N.message:String(N))).finally(()=>a(!1)))},_=()=>{v(null),b(t)},x=!o&&!!u&&!!f,y=()=>{!x||!r||b(()=>r({appId:u,appSecret:f}))},S=Eu(y),C=h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(ap,{className:"h-3.5 w-3.5 text-text-400","aria-hidden":!0}),h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"飞书 Bot"})]});return e?h.jsxs("section",{className:"flex flex-col gap-1.5","data-testid":"lark-bot-section",children:[C,e.state==="unbound"||e.state==="provisioning"?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-[11px] text-text-400",children:"关联一个飞书 bot 后,这个 persona 就是它:拉进群后群成员 @ 它提问、或直接私聊它, 推理跑在你本机,回复自动发回去。"}),t?h.jsx("button",{type:"button",disabled:o||e.state==="provisioning",onClick:_,className:"self-start rounded border border-border bg-bg-200 px-3 py-1.5 text-[12px] font-medium text-text-100 hover:bg-bg-300 disabled:opacity-50","data-testid":"lark-bot-provision",children:e.state==="provisioning"?"等待扫码…":"扫码关联飞书 Bot"}):null,e.state==="unbound"&&e.errorReason&&!m?h.jsxs("div",{className:"flex flex-col gap-1.5 rounded border border-error bg-error-dim px-2 py-1.5","data-testid":"lark-bot-provision-error",children:[h.jsx("span",{className:"text-[11px] text-error",children:Toe[e.errorReason]}),h.jsxs("div",{className:"flex gap-1.5",children:[Ioe.has(e.errorReason)&&t?h.jsx("button",{type:"button",disabled:o,onClick:_,className:"rounded border border-border px-2 py-1 text-[11px] text-text-100 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-provision-retry",children:"重新扫码"}):null,h.jsx("button",{type:"button",onClick:()=>v(e.errorReason??null),className:"rounded border border-border px-2 py-1 text-[11px] text-text-300 hover:bg-bg-200","data-testid":"lark-bot-provision-error-dismiss",children:"知道了"})]})]}):null,e.state==="provisioning"&&e.qrUrl?h.jsx(t2,{qrUrl:e.qrUrl,busy:o,onCancel:n?()=>b(n):void 0}):null,r&&e.state==="unbound"?h.jsxs("details",{"data-testid":"lark-bot-manual-details",children:[h.jsx("summary",{className:"cursor-pointer text-[11px] text-text-400 hover:text-text-300",children:"已有飞书应用?手动填入凭证"}),h.jsxs("div",{className:"mt-1.5 flex flex-col gap-1.5","data-testid":"lark-bot-manual-form",children:[h.jsx("span",{className:"text-[11px] text-text-400",children:"先在飞书开放平台(open.feishu.cn)创建企业自建应用并启用机器人能力,再填入凭证:"}),h.jsx("input",{value:u,onChange:k=>d(k.target.value),...S,placeholder:"App ID(cli_ 开头)",className:"rounded border border-border bg-bg-100 px-2 py-1 text-[12px] text-text-200","data-testid":"lark-bot-manual-appid"}),h.jsx("input",{value:f,onChange:k=>p(k.target.value),...S,type:"password",placeholder:"App Secret",className:"rounded border border-border bg-bg-100 px-2 py-1 text-[12px] text-text-200","data-testid":"lark-bot-manual-secret"}),h.jsx("button",{type:"button",disabled:!x,onClick:y,className:"self-start rounded border border-border px-3 py-1.5 text-[12px] text-text-100 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-manual-submit",children:o?"绑定中…":"绑定"})]})]}):null]}):null,e.state==="bound"||e.state==="broken"?h.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.state==="bound"&&e.needsUpgrade?h.jsxs("div",{className:"flex flex-col gap-1.5 rounded border border-warning/30 bg-warning-dim px-2 py-1.5","data-testid":"lark-bot-upgrade-notice",children:[h.jsx("span",{className:"text-[11px] text-warning",children:"这个 bot 的权限配置有更新,扫码重新授权后生效。在此之前,新增能力对它不起作用。"}),s?h.jsx("button",{type:"button",disabled:o,onClick:()=>b(s),className:"self-start rounded border border-warning/30 bg-warning/10 px-2 py-1 text-[11px] text-warning hover:bg-warning/20 disabled:opacity-50","data-testid":"lark-bot-upgrade",children:"更新授权"}):null]}):null,e.state==="bound"&&e.upgradeQrUrl?h.jsx(t2,{qrUrl:e.upgradeQrUrl,busy:o,onCancel:n?()=>b(n):void 0,title:"扫码更新授权",hint:"用手机飞书扫码,确认页会列出将要添加的权限。期间 bot 照常服务,不会中断。"}):null,e.state==="broken"?h.jsxs("div",{className:"rounded border border-error bg-error-dim px-2 py-1.5 text-[11px] text-error","data-testid":"lark-bot-broken",children:["Bot 凭证失效:",e.brokenReason??"未知原因","。请解绑后重新填入有效凭证绑定。"]}):null,h.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-text-200",children:[h.jsx("span",{className:"font-medium text-text-100",children:e.botName??"未命名 bot"}),e.appId?h.jsx("span",{className:"text-[11px] text-text-400",children:e.appId}):null]}),h.jsx("span",{className:"text-[11px] text-text-400",children:"把 bot 拉进任意飞书群,群成员 @ 它即可提问。"}),e.groups.length>0?h.jsx("ul",{className:"flex flex-col gap-0.5","data-testid":"lark-bot-groups",children:e.groups.map(k=>h.jsxs("li",{className:"text-[11px] text-text-300 truncate",children:["· ",k.chatName??k.chatId]},k.chatId))}):h.jsx("span",{className:"text-[11px] text-text-400","data-testid":"lark-bot-groups-empty",children:"还没有服务中的群。"}),i?h.jsx("button",{type:"button",disabled:o,onClick:()=>b(i),className:"self-start rounded border border-border px-3 py-1.5 text-[12px] text-error hover:bg-error-dim disabled:opacity-50","data-testid":"lark-bot-unbind",children:"解绑"}):null]}):null,l?h.jsx("div",{className:"rounded border border-error bg-error-dim px-2 py-1.5 text-[11px] text-error","data-testid":"lark-bot-error",children:l}):null]}):h.jsxs("section",{className:"flex flex-col gap-1.5","data-testid":"lark-bot-section",children:[C,h.jsx("span",{className:"text-[11px] text-text-400",children:"状态加载中…"})]})}function Roe({settings:e}){var t,n,r,i,s,o,a,l,c,u,d,f,p;return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-sandbox-setting-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Sandbox Setting"}),h.jsx("span",{className:"text-[11px] text-text-400",children:"约束此 persona 的沙箱权限(只读,需通过文件修改)。"})]}),e==null?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-sandbox-setting-empty",children:"暂无 sandbox 配置"}):h.jsxs("div",{className:"flex flex-col gap-1.5 rounded-md border border-border bg-bg-100 px-3 py-2",children:[h.jsx(Od,{label:"权限默认模式",value:((t=e.permissions)==null?void 0:t.defaultMode)??"—"}),h.jsx(Od,{label:"沙箱启用",value:Eg((n=e.sandbox)==null?void 0:n.enabled)}),h.jsx(Od,{label:"沙箱内自动放行 Bash",value:Eg((r=e.sandbox)==null?void 0:r.autoAllowBashIfSandboxed)}),h.jsx(Od,{label:"允许非沙箱命令",value:Eg((i=e.sandbox)==null?void 0:i.allowUnsandboxedCommands)}),h.jsxs("div",{className:"mt-1 flex flex-col gap-1.5 border-t border-border pt-1.5",children:[h.jsx(Gl,{label:"沙箱外命令",paths:(s=e.sandbox)==null?void 0:s.excludedCommands}),h.jsx(Gl,{label:"允许读取",paths:(a=(o=e.sandbox)==null?void 0:o.filesystem)==null?void 0:a.allowRead}),h.jsx(Gl,{label:"拒绝读取",paths:(c=(l=e.sandbox)==null?void 0:l.filesystem)==null?void 0:c.denyRead}),h.jsx(Gl,{label:"允许写入",paths:(d=(u=e.sandbox)==null?void 0:u.filesystem)==null?void 0:d.allowWrite}),h.jsx(Gl,{label:"拒绝写入",paths:(p=(f=e.sandbox)==null?void 0:f.filesystem)==null?void 0:p.denyWrite})]})]})]})}function Eg(e){return e===!0?"是":e===!1?"否":"—"}function Od({label:e,value:t}){return h.jsxs("div",{className:"flex items-center justify-between gap-3 text-[12px]",children:[h.jsx("span",{className:"text-text-300",children:e}),h.jsx("span",{className:"font-mono text-text-100",children:t})]})}function Gl({label:e,paths:t}){const n=!t||t.length===0;return h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[11px] text-text-300",children:e}),n?h.jsx("span",{className:"text-[11px] text-text-400",children:"—"}):h.jsx("div",{className:"flex flex-wrap gap-1",children:t.map((r,i)=>h.jsx("span",{className:"rounded-sm border border-border bg-bg-0 px-1.5 py-0.5 font-mono text-[11px] text-text-200",children:r},`${e}-${i}-${r}`))})]})}function Moe({skills:e}){return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-skills-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Persona Skills"}),h.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 text-[10px] text-text-300",children:e.length})]}),h.jsxs("span",{className:"text-[11px] text-text-400",children:["此 persona 私有 skills(来自"," ",h.jsx("code",{className:"font-mono",children:"<persona-dir>/.claude/skills/"}),")。"]})]}),e.length===0?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-skills-empty",children:"暂无 skills"}):h.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border bg-bg-100",children:e.map(t=>h.jsxs("li",{className:"flex flex-col gap-0.5 px-3 py-2","data-testid":"persona-skill-row",children:[h.jsx("span",{className:"font-mono text-[13px] text-text-100",children:t.name}),t.description?h.jsx("span",{className:"text-[12px] text-text-300",children:t.description}):h.jsx("span",{className:"text-[11px] text-text-400 italic",children:"无描述"})]},t.name))})]})}function Aoe({plugins:e}){return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-plugins-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Enabled Plugins"}),h.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 text-[10px] text-text-300",children:e.length})]}),h.jsxs("span",{className:"text-[11px] text-text-400",children:["此 persona 已启用的插件(来自"," ",h.jsx("code",{className:"font-mono",children:"<persona-dir>/.claude/settings.json"})," ","的 ",h.jsx("code",{className:"font-mono",children:"enabledPlugins"}),")。"]})]}),e.length===0?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-plugins-empty",children:"暂无启用插件"}):h.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border bg-bg-100",children:e.map(t=>h.jsx("li",{className:"flex flex-col gap-0.5 px-3 py-2","data-testid":"persona-plugin-row",children:h.jsx("span",{className:"font-mono text-[13px] text-text-100",children:t.id})},t.id))})]})}function n2({onLoad:e,onSave:t,onDirtyChange:n,initialPersonality:r,readOnly:i=!1,title:s,hint:o,placeholder:a,testIdPrefix:l}){const c=r!==void 0,[u,d]=g.useState(c),[f,p]=g.useState(c?r:""),[m,v]=g.useState(c?r:""),[b,_]=g.useState(null),[x,y]=g.useState(!1),[S,C]=g.useState(null),k=Ke.useRef(e),N=Ke.useRef(t),T=Ke.useRef(n);Ke.useEffect(()=>{k.current=e,N.current=t,T.current=n});const z=Ke.useCallback(()=>{d(!1),_(null),k.current().then(A=>{p(A),v(A),d(!0)}).catch(A=>{_(A instanceof Error?A.message:String(A))})},[]);Ke.useEffect(()=>{c||z()},[c,z]);const I=!i&&u&&m!==f;Ke.useEffect(()=>{i||T.current(I)},[I,i]);const B=()=>{N.current&&(y(!0),C(null),N.current(m).then(()=>{p(m),y(!1)}).catch(A=>{C(A instanceof Error?A.message:String(A)),y(!1)}))},M=()=>{v(f),C(null)},R=Eu(()=>{!I||x||B()},()=>{!I||x||M()});return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":`${l}-section`,children:[h.jsx("span",{className:"text-[12px] font-medium text-text-200",children:s}),b?h.jsxs("div",{"data-testid":`${l}-load-error`,className:"rounded-md border border-error bg-error-dim px-3 py-2 text-[12px] text-error flex items-center justify-between gap-2",children:[h.jsxs("span",{children:["加载失败:",b]}),h.jsx("button",{type:"button",onClick:z,className:"rounded-sm border border-error px-2 py-0.5 text-[11px] hover:bg-error/10",children:"重试"})]}):null,S?h.jsxs("div",{"data-testid":`${l}-save-error`,className:"rounded-md border border-error bg-error-dim px-3 py-2 text-[12px] text-error",children:["保存失败:",S]}):null,h.jsx("textarea",{"data-testid":`${l}-textarea`,value:m,onChange:A=>v(A.target.value),...R,readOnly:i,disabled:!i&&(!u||x),placeholder:u?a??"":"加载中…",rows:8,className:"min-h-[8rem] max-h-[18rem] resize-y rounded-md border border-border bg-bg-100 px-2 py-1.5 font-mono text-[11px] text-text-100 disabled:opacity-60"}),o?h.jsx("p",{className:"text-[10px] text-text-400",children:o}):i?null:h.jsx("p",{className:"text-[10px] text-text-400",children:"写入人格文件。修改只对新启动的会话生效。"}),u&&I?h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx("button",{type:"button",onClick:M,disabled:x,className:"rounded-sm border border-border px-2 py-1 text-[12px] text-text-200 hover:bg-bg-200 disabled:opacity-60",children:"放弃"}),h.jsx("button",{type:"button",onClick:B,disabled:x,"data-testid":`${l}-save-btn`,className:"rounded-sm bg-accent-dim px-2 py-1 text-[12px] text-text-100 hover:opacity-90 disabled:opacity-60",children:x?"保存中…":"保存"})]}):null]})}const Loe={state:"unbound",groups:[]};function Doe(e,t){const[n,r]=g.useState(null);g.useEffect(()=>{if(!e)return;let c=!1;r(null);const u=async()=>{try{const p=await e.request("larkBot:status",{personaId:t});c||r(p)}catch{c||r(Loe)}};u();const d=e.on("larkBot:state",p=>{const m=p;if(m.personaId!==t)return;const{personaId:v,...b}=m;r(b)}),f=e.on("daemon:connected",()=>{u()});return()=>{c=!0,d(),f()}},[e,t]);const i=g.useCallback(async()=>{e&&await e.request("larkBot:provision",{personaId:t})},[e,t]),s=g.useCallback(async()=>{e&&await e.request("larkBot:provisionCancel",{personaId:t})},[e,t]),o=g.useCallback(async c=>{e&&await e.request("larkBot:bindManual",{personaId:t,...c})},[e,t]),a=g.useCallback(async()=>{e&&await e.request("larkBot:upgrade",{personaId:t})},[e,t]),l=g.useCallback(async()=>{e&&await e.request("larkBot:unbind",{personaId:t})},[e,t]);return{status:n,provision:i,cancelProvision:s,bindManual:o,unbind:l,upgrade:a}}function joe(e,t="owner"){var k;const{persona:n}=cI(e),r=f$(e),i=p$(),s=m$(),{httpBaseUrl:o}=op(),a=Xi(),l=Doe(t==="guest"?null:a,e),{capabilities:c}=d1((n==null?void 0:n.tool)??"claude"),u=g.useMemo(()=>!(n!=null&&n.public)||!o||/^https?:\/\/(127\.0\.0\.1|localhost|0\.0\.0\.0|\[?::1\]?)([:/]|$)/i.test(o)?null:`${o}/s/${e}`,[n==null?void 0:n.public,o,e]),d=g.useCallback((N,T)=>{i(e,T).catch(z=>{Me("persona",`${N} failed`,z)})},[i,e]),f=g.useCallback(N=>d("togglePublic",{public:N}),[d]),p=g.useCallback(async N=>{await i(e,{codexSandbox:{network:N}}),await r.refresh()},[i,e,r]),m=g.useCallback(N=>d("changeTool",{tool:N}),[d]),v=g.useCallback(N=>d("changeModel",{model:N}),[d]),b=g.useCallback(N=>d("changeEffort",{effort:N}),[d]),_=g.useCallback(()=>!n||!confirm(`删除 persona "${n.label}"?`)?!1:(s(e).catch(N=>{Me("persona","delete failed",N)}),!0),[n,s,e]),x=g.useCallback(async()=>r.loaded?r.personality:(await r.refresh()).personality,[r]),y=g.useCallback(async N=>{await i(e,{personality:N}),await r.refresh()},[i,e,r]),S=g.useCallback(async()=>r.loaded?r.personalityLocal:(await r.refresh()).personalityLocal,[r]),C=g.useCallback(async N=>{await i(e,{personalityLocal:N}),await r.refresh()},[i,e,r]);return{persona:n,detail:r,models:(c==null?void 0:c.models)??[],configSchema:(c==null?void 0:c.configSchema)??[],larkBot:l,guestShareUrl:u,changeTool:m,changeModel:v,changeEffort:b,togglePublic:f,guestNetwork:((k=r.codexSandbox)==null?void 0:k.network)??!1,toggleGuestNetwork:p,remove:_,loadPersonality:x,savePersonality:y,loadPersonalityLocal:S,savePersonalityLocal:C}}function Ooe({personaId:e,open:t,onClose:n,api:r,embedded:i,onDirtyChange:s,onShareCapability:o,viewerRole:a="owner"}){const l=joe(e,a),{persona:c,detail:u}=l,d=g.useCallback(()=>{l.remove()&&n()},[l,n]);if(!c)return null;const f=a==="guest";return h.jsx(Noe,{embedded:i,persona:{...c,skills:u.skills,plugins:u.plugins,sandboxSettings:u.sandboxSettings,personalityManaged:u.personalityManaged},open:t,onClose:n,onLoadPersonality:l.loadPersonality,onLoadPersonalityLocal:l.loadPersonalityLocal,hasPersonalityLocal:u.personalityLocal!=="",onDirtyChange:s,readOnly:f,...f?{}:{onTogglePublic:l.togglePublic,guestShareUrl:l.guestShareUrl,onChangeTool:l.changeTool,onChangeModel:l.changeModel,onChangeEffort:l.changeEffort,models:l.models,configSchema:l.configSchema,onDelete:d,onSavePersonality:l.savePersonality,onSavePersonalityLocal:l.savePersonalityLocal,larkBot:{status:l.larkBot.status,onProvision:l.larkBot.provision,onCancelProvision:l.larkBot.cancelProvision,onBindManual:l.larkBot.bindManual,onUnbind:l.larkBot.unbind,onUpgrade:l.larkBot.upgrade},...o?{onShareCapability:o}:{}}})}const Boe={resolve:()=>{}},zoe=g.createContext(Boe);function $oe(){return g.useContext(zoe)}const Foe={...$s,h1:({node:e,...t})=>h.jsx("h1",{...t,className:"mt-4 mb-3 text-[18px] font-semibold leading-tight text-text-100"}),h2:({node:e,...t})=>h.jsx("h2",{...t,className:"mt-4 mb-2 text-[16px] font-semibold leading-tight text-text-100"}),h3:({node:e,...t})=>h.jsx("h3",{...t,className:"mt-3 mb-2 text-[14px] font-semibold leading-tight text-text-100"}),h4:({node:e,...t})=>h.jsx("h4",{...t,className:"mt-3 mb-1 text-[13px] font-semibold text-text-100"}),h5:({node:e,...t})=>h.jsx("h5",{...t,className:"mt-2 mb-1 text-[12px] font-semibold text-text-100"}),h6:({node:e,...t})=>h.jsx("h6",{...t,className:"mt-2 mb-1 text-[12px] font-semibold text-text-300"}),p:({node:e,...t})=>h.jsx("p",{...t,className:"my-2 leading-relaxed"}),ul:({node:e,...t})=>h.jsx("ul",{...t,className:"my-2 list-disc space-y-1 pl-5"}),ol:({node:e,...t})=>h.jsx("ol",{...t,className:"my-2 list-decimal space-y-1 pl-5"}),li:({node:e,...t})=>h.jsx("li",{...t,className:"leading-relaxed"}),blockquote:({node:e,...t})=>h.jsx("blockquote",{...t,className:"my-2 border-l-2 border-border pl-3 italic text-text-300"}),code:({node:e,className:t,children:n,...r})=>t?h.jsx("code",{...r,className:`${t} font-mono text-[12px]`,children:n}):h.jsx("code",{...r,className:"rounded bg-bg-50 px-1 py-0.5 font-mono text-[12px] text-text-100",children:n}),pre:({node:e,...t})=>h.jsx("pre",{...t,className:"my-2 overflow-auto rounded border border-border bg-bg-0 p-3 text-[12px] font-mono text-text-100"}),hr:({node:e,...t})=>h.jsx("hr",{...t,className:"my-3 border-border"}),table:({node:e,...t})=>h.jsx("table",{...t,className:"my-2 w-full border-collapse text-[12px]"}),thead:({node:e,...t})=>h.jsx("thead",{...t,className:"bg-bg-50"}),th:({node:e,...t})=>h.jsx("th",{...t,className:"border border-border px-2 py-1 text-left font-semibold"}),td:({node:e,...t})=>h.jsx("td",{...t,className:"border border-border px-2 py-1"}),strong:({node:e,...t})=>h.jsx("strong",{...t,className:"font-semibold text-text-100"}),em:({node:e,...t})=>h.jsx("em",{...t,className:"italic"})};function Hoe(e){const t=e.split("/");return t[t.length-1]||e}function p4({relPath:e,loadMarkdown:t,headerRight:n,showTitleBar:r=!1}){const[i,s]=g.useState(null),[o,a]=g.useState(null),[l,c]=g.useState(!1);return g.useEffect(()=>{if(!e)return;let u=!1;return c(!0),a(null),s(null),(async()=>{try{const d=await t(e);if(u)return;s(d)}catch(d){if(u)return;a(d.message||String(d))}finally{u||c(!1)}})(),()=>{u=!0}},[e,t]),h.jsxs("div",{className:"flex flex-col h-full",children:[r&&e?h.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[h.jsx("div",{"data-testid":"md-preview-title",className:"truncate text-[13px] font-medium text-text-100",title:e,children:Hoe(e)}),h.jsx("div",{className:"flex items-center gap-1",children:n})]}):null,h.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 text-[13px] text-text-100",children:l?h.jsx("div",{"data-testid":"md-preview-loading",className:"text-text-400",children:"Loading…"}):o?h.jsx("div",{"data-testid":"md-preview-error",className:"text-destructive whitespace-pre-wrap",children:o}):i!==null?h.jsx("div",{"data-testid":"md-preview-content",className:"max-w-none",children:h.jsx(tl,{remarkPlugins:[nl],components:Foe,children:i})}):null})]})}function Uoe({open:e,onOpenChange:t,relPath:n,loadMarkdown:r,onShare:i}){return e?h.jsx("div",{"data-testid":"md-preview-drawer",className:`${e1} z-50 flex w-1/2 max-w-[900px] flex-col border-l border-border bg-elevated shadow-2xl`,children:h.jsx(p4,{relPath:n,loadMarkdown:r,showTitleBar:!0,headerRight:h.jsxs(h.Fragment,{children:[i?h.jsx("button",{type:"button","data-testid":"md-preview-share","aria-label":"Share rendered preview link",onClick:i,className:"inline-flex h-6 w-6 items-center justify-center rounded text-text-400 hover:bg-bg-50 hover:text-text-200",children:h.jsx(k8,{className:"h-4 w-4"})}):null,h.jsx("button",{type:"button","aria-label":"Close preview",onClick:()=>t(!1),className:"inline-flex h-6 w-6 items-center justify-center rounded text-text-400 hover:bg-bg-50 hover:text-text-200",children:h.jsx(qr,{className:"h-4 w-4"})})]})})}):null}const r2=4;function Woe({children:e,onHeightChange:t}){const n=g.useRef(null),[r,i]=g.useState(0);return g.useEffect(()=>{const s=n.current;if(!s)return;const o=()=>i(s.offsetHeight>0?s.offsetHeight+r2*2:0);if(o(),typeof ResizeObserver>"u")return;const a=new ResizeObserver(o);return a.observe(s),()=>a.disconnect()},[]),g.useEffect(()=>{t==null||t(r)},[r,t]),h.jsx("div",{"data-testid":"chat-floating-dock","data-height":r,className:"relative z-20 h-0 shrink-0",children:h.jsx("div",{ref:n,className:"absolute left-4 right-4 flex flex-col items-end gap-1",style:{bottom:r2},children:e})})}const Voe=250;function qoe(e){if(!e||!Number.isFinite(e))return null;const t=e/1e3;if(t<60)return`${t.toFixed(0)}s`;const n=Math.floor(t/60);return`${n}m${Math.round(t-n*60).toString().padStart(2,"0")}s`}function Koe({agents:e}){var a,l,c;const[t,n]=g.useState(!1);if(e.length===0)return null;const r=e.length===1?e[0]:null,i=r?r.description:`${e.length} 个后台任务`,s=r?qoe((l=(a=r.progress)==null?void 0:a.stats)==null?void 0:l.durationMs):null,o=r?(c=r.progress)==null?void 0:c.lastToolName:null;return h.jsxs("div",{"data-testid":"running-agents-chip","data-agent-count":e.length,className:"relative",children:[t?h.jsx("div",{"data-testid":"running-agents-popover",className:"absolute bottom-full right-0 z-20 mb-1 w-[min(560px,80vw)]",children:h.jsx("div",{className:"min-w-0 overflow-y-auto rounded-lg border border-bg-200/60 bg-bg-100 px-2 py-1 shadow-lg",style:{maxHeight:Voe},children:e.map(u=>h.jsx(AA,{expandable:!1,description:u.description,input:u.input,output:u.output,...u.error!==void 0?{error:u.error}:{},pending:u.pending,notifications:u.notifications,...u.toolResultExtra?{toolResultExtra:u.toolResultExtra}:{},...u.progress?{progress:u.progress}:{}},u.toolUseId))})}):null,h.jsxs("button",{type:"button","data-testid":"running-agents-chip-toggle","aria-expanded":t,onClick:()=>n(u=>!u),className:ne("flex max-w-[min(560px,80vw)] min-w-0 items-center gap-2 rounded-full","border border-bg-200/60 bg-bg-100/95 px-3 py-1 text-[12px] shadow-md backdrop-blur","hover:bg-bg-200/95 transition-colors"),children:[h.jsx(lr,{className:"w-3 h-3 shrink-0 animate-spin text-blue-400"}),h.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-text-200",children:i}),s?h.jsx("span",{className:"shrink-0 tabular-nums text-text-400",children:s}):null,o?h.jsxs("span",{className:"shrink-0 font-mono tabular-nums text-blue-400",children:["now:",o]}):null,h.jsx(hI,{className:ne("w-3.5 h-3.5 shrink-0 text-text-400 transition-transform",t&&"rotate-180")})]})]})}const Goe={closeTrailing:!1},Yoe={closeTrailing:!0};function Xoe(e){return e?Goe:Yoe}function Qoe({session:e,api:t,onPromoteQuickAsk:n}){const r=uM(e.sessionId);return h.jsx(m4,{state:r,extras:{session:e,api:t,...n?{onPromoteQuickAsk:n}:{}}})}function Zoe({headerMeta:e,connState:t,liveWorktreeRoot:n,onOpenConfig:r,variant:i="full",ephemeral:s,onPromote:o,hideHeader:a=!1,flatProcess:l=!1,lines:c,pendingPermissions:u,procAlive:d,rewindableUserMessageIds:f,onPermissionRespond:p,onPermissionInterrupt:m,onRewind:v,onFork:b,onQuickAsk:_,topSlot:x,realtimeQuestionAnswers:y,onSubmitQuestion:S,onCancelQuestion:C,liveQuestionToolUseIds:k,api:N,cwd:T,tool:z,sessionKey:I,onSend:B,awaitingUser:M,queued:R,onDequeue:A,onAbort:D,onNewSession:$,onClearSession:F,configSlot:j,chatRootRef:O,chatBodyRef:E,drawers:H,xtermSlot:q,fileSharingScope:L,onShareFile:re,onOpenInTab:ie,onPreviewMarkdown:K,onOpenFilePath:_e,dispatchOrigin:Ee}){const[ue,Le]=g.useState(0),Ae=g.useMemo(()=>i==="full"?Lq(fM(c)):[],[c,i]),Oe=g.useMemo(()=>new Set(Ae.map(ge=>ge.toolUseId)),[Ae]);return h.jsx(Fee,{children:h.jsxs("div",{ref:O,"data-cc-chat-root":"",className:"flex flex-col h-full bg-bg-100",children:[a?null:h.jsx(Ute,{meta:e,...z?{tool:z}:{},connState:t,variant:i,...n!==void 0?{liveWorktreeRoot:n}:{},...i==="full"&&r?{onOpenConfig:r}:{},...i==="quickask"?{ephemeral:s??!1,...o?{onPromote:o}:{}}:{}}),h.jsx("div",{ref:E,"data-testid":"chat-body",className:"flex-1 overflow-y-auto min-h-0",style:{overflowAnchor:"none",paddingBottom:ue},children:h.jsx(DA,{lines:c,...p?{onPermissionRespond:p}:{},...m&&d?{onPermissionInterrupt:m}:{},topSlot:x,...v?{onRewind:v}:{},rewindableUserMessageIds:f,...b?{onFork:b}:{},..._?{onQuickAsk:_}:{},realtimeQuestionAnswers:y,onSubmitQuestion:S,...C?{onCancelQuestion:C}:{},liveQuestionToolUseIds:k,...L?{fileSharingScope:L}:{},...re?{onShareFile:re}:{},...ie?{onOpenInTab:ie}:{},...K?{onPreviewMarkdown:K}:{},..._e?{onOpenFilePath:_e}:{},...Ee?{dispatchOrigin:Ee}:{},...i==="full"&&!l?{turnCollapse:Xoe(d)}:{},dockedAgentToolUseIds:Oe})}),q,h.jsx(Woe,{onHeightChange:Le,children:h.jsx(Koe,{agents:Ae})}),e.larkChatName?h.jsx("div",{className:"mx-3 mb-3 rounded-lg border border-border bg-bg-200 px-3 py-2 text-[12px] text-text-400","data-testid":"lark-readonly-notice",children:e.larkChatType==="p2p"?`此会话由与「${e.larkChatName}」的飞书私聊驱动——对方消息触发,这里仅供观察。`:`此会话由飞书群「${e.larkChatName}」驱动——群成员 @ bot 提问触发,这里仅供观察。`}):h.jsx(Fte,{meta:e,...N?{api:N}:{},cwd:T,...z?{tool:z}:{},sessionKey:I,onSend:B,awaitingUser:M,...R?{queued:R}:{},...A?{onDequeue:A}:{},...D?{onAbort:D}:{},...$?{onNewSession:$}:{},...F?{onClearSession:F}:{},...j?{configSlot:j}:{}}),H]})})}function m4({state:e,extras:t,onQuickAskInternal:n,onPreviewMdInternal:r}){const{session:i,api:s,liveGitBranch:o,liveWorktreeRoot:a,onNewSession:l,onTurnEnd:c,onOpenConfig:u,onFork:d,onQuickAsk:f,viewerRole:p,onPromoteQuickAsk:m,configSlot:v,hideHeader:b,flatProcess:_}=t,{capabilities:x}=d1(i.tool||"claude"),y=(x==null?void 0:x.features)??iI(i.tool),[S,C]=g.useState(null),[k,N]=g.useState(null),T=op(),z=!!s&&T.actionsLevel==="owner"&&y.fileSharing,I=cI(i.ownerPersonaId??null).persona,B=(I==null?void 0:I.label)??null,M=!!B&&!!i.ownerPersonaId,R=$oe(),A=g.useMemo(()=>({resolve:(Z,be)=>R.resolve(Z,be,i.sessionId),...R.onOpenSession?{onOpenSession:R.onOpenSession}:{}}),[R,i.sessionId]),D=g.useCallback((Z,be)=>{C({kind:Z,text:be}),setTimeout(()=>{C(ke=>(ke==null?void 0:ke.text)===be?null:ke)},2e3)},[]),$=Xi(),F=Uz(),j=sM(i.sessionId,i.toolSessionId),{events:O,pendingQuestions:E,clearQuestion:H,markQuestionSubmitted:q,status:L}=j,re=e.historyLoading,ie=cM(L);g.useEffect(()=>{Me("chat-panel","sessionStatus",{sessionId:i.sessionId,sessionStatus:L,procAlive:ie})},[L,ie,i.sessionId]);const K=e.lines,_e=e.pendingPermissions,Ee=_e[0]??null,ue=g.useMemo(()=>Mq(O),[O]),[Le,Ae]=g.useState(null),[Oe,ge]=g.useState(()=>new Set);Iq(s,i.sessionId,i.toolSessionId,y.observe);const tt=g.useRef(i.sessionId);g.useEffect(()=>{if(tt.current=i.sessionId,!y.rewind){Ae(null);return}let Z=!1;return Ae(null),(async()=>{try{const be=await s.sessionRewindableMessageIds(i.sessionId);if(Z)return;Ae(new Set(be.userMessageIds))}catch{Z||Ae(null)}})(),()=>{Z=!0}},[s,i.sessionId,y.rewind]);const Nt=g.useCallback(()=>{const Z=i.sessionId;s.sessionRewindableMessageIds(Z).then(be=>{tt.current===Z&&Ae(new Set(be.userMessageIds))}).catch(()=>{})},[s,i.sessionId]),st=g.useMemo(()=>{if(Le!==null){const Qe=new Set(Le);for(const Mr of Oe)Qe.delete(Mr);return Qe}const Z=new Set(["Edit","Write","MultiEdit","NotebookEdit"]),be=new Set;let ke=null;for(const Qe of K)Qe.kind==="user-text"?ke=Qe.uuid??null:ke&&Qe.kind==="tool-call"&&Z.has(Qe.tool)&&!Oe.has(ke)&&be.add(ke);return be},[K,Oe,Le]),pt=g.useRef(c);pt.current=c,Pq(i.sessionId,i.toolSessionId,()=>{nt(null),ge(new Set)});const jt=sne({sessionStatus:L}),mt=g.useRef(null);g.useEffect(()=>{var ke;const Z=mt.current,be=(Z==null?void 0:Z.sid)===i.sessionId;be&&Z.phase===jt||(mt.current={sid:i.sessionId,phase:jt},Me("session-phase",jt,{sid:i.sessionId,phase:jt,prev:be?Z.phase:null,desc:ine[jt]}),be&&Z.phase==="turn-running"&&jt!=="turn-running"&&((ke=pt.current)==null||ke.call(pt),Nt()))},[jt,i.sessionId,Nt]);const gt=g.useCallback(async()=>{const Z=await s.sessionInterrupt(i.sessionId).catch(()=>{});return(Z==null?void 0:Z.queued)??[]},[s,i.sessionId]),[Xe,nt]=g.useState(null),zt=g.useCallback(Z=>{nt(Z)},[]),[_n,tn]=g.useState(!1),U=g.useCallback(()=>{s.sessionStop(i.sessionId).catch(()=>{}),tn(!1)},[s,i.sessionId]);g.useCallback(Z=>{s.pinSession(i.sessionId,Z).catch(be=>{Me("chat-panel","pinSession failed",{err:be==null?void 0:be.message})})},[s,i.sessionId]);const X=m?"quickask":"full",{container:xe,onCollapse:Pe,hostExtras:Be}=Xte(),xt=g.useRef(0),xn=g.useRef(null);g.useEffect(()=>{const Z=be=>{if(be.key!=="Escape")return;if(!ie){xt.current=0;return}if(be.isComposing)return;const Qe=be.target;if(Qe&&Qe.closest("[data-cc-chat-root]")!==xn.current)return;const Mr=Date.now();Mr-xt.current<2e3?(xt.current=0,tn(!0)):(xt.current=Mr,gt())};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[gt,ie]);const $t=g.useRef(null),dn=g.useRef(!0),oe=g.useRef(void 0),ye=g.useRef(0),Ze=g.useRef(0),Tt=g.useRef(void 0);g.useEffect(()=>{N(null)},[i.sessionId]),g.useEffect(()=>{const Z=$t.current;if(!Z)return;const be=150,ke=Qe=>{Date.now()<Ze.current&&(Qe.preventDefault(),Ze.current=Date.now()+be)};return Z.addEventListener("wheel",ke,{passive:!1}),()=>Z.removeEventListener("wheel",ke)},[]),g.useEffect(()=>{const Z=$t.current;if(!Z)return;const be=32,ke=()=>{const Qe=Z.scrollHeight-Z.scrollTop-Z.clientHeight;dn.current=Qe<=be};return Z.addEventListener("scroll",ke,{passive:!0}),()=>Z.removeEventListener("scroll",ke)},[]),g.useLayoutEffect(()=>{var Bu;const Z=$t.current;if(!Z)return;const be=Tt.current!==i.sessionId;be&&(Tt.current=i.sessionId,dn.current=!0,oe.current=void 0,ye.current=0,Ze.current=0);const ke=oe.current,Qe=(Bu=K[0])==null?void 0:Bu.seq;oe.current=Qe,!be&&ke!==void 0&&Qe!==void 0&&Qe<ke?(Z.scrollTop=Z.scrollHeight-ye.current,Ze.current=Date.now()+200):dn.current&&(Z.scrollTop=Z.scrollHeight),ye.current=Z.scrollHeight-Z.scrollTop},[K,Ee==null?void 0:Ee.requestId,i.sessionId]);const Rr=g.useMemo(()=>{const Z={};for(const[be,ke]of Object.entries(E))ke.submittedAnswers&&(Z[be]=ke.submittedAnswers);return Z},[E]),ae=g.useMemo(()=>new Set(Object.keys(E)),[E]),Je=g.useCallback(async(Z,be)=>{try{await s.answerQuestion({sessionId:i.sessionId,toolUseId:Z,answers:be}),q(Z,be)}catch{}},[s,i.sessionId,q]),hn=g.useCallback(async Z=>{try{await s.cancelQuestion({sessionId:i.sessionId,toolUseId:Z}),H(Z)}catch{}},[s,i.sessionId,H]),Gs=g.useCallback(async(Z,be)=>{var ke;if(Ee)try{await((ke=e.respondPermission)==null?void 0:ke.call(e,Ee.requestId,Z?"allow":"deny"))}catch{}},[e,Ee]),Nl=g.useCallback(async()=>{const Z=i.sessionId;try{await s.sessionStop(Z)}catch{}e.clearSession?await e.clearSession():await s.sessionNew(Z)},[e,s,i.sessionId]),qo=g.useMemo(()=>e.historyError?h.jsxs("div",{className:"flex justify-center py-2 text-[12px] text-text-400","data-testid":"history-error",children:["历史未加载完(",e.historyError,");切走再切回可重试"]}):re&&K.length===0?h.jsx("div",{className:"flex justify-center py-4","data-testid":"history-loading",children:h.jsx(lr,{className:"w-4 h-4 text-text-400 animate-spin"})}):null,[re,K.length,e.historyError]),bi=e.meta,Ko=h.jsxs(h.Fragment,{children:[i.toolSessionId&&y.subagents?h.jsx(Qte,{api:s,cwd:i.cwd,toolSessionId:i.toolSessionId,toolKind:i.tool??"claude"}):null,Xe&&y.rewind?h.jsx(Jte,{open:!0,onOpenChange:Z=>{Z||nt(null)},api:s,sessionId:i.sessionId,userMessageId:Xe,lines:K,procAlive:ie,onNoChanges:Z=>{ge(be=>{if(be.has(Z))return be;const ke=new Set(be);return ke.add(Z),ke})}}):null,_n?h.jsx(Joe,{onConfirm:U,onCancel:()=>tn(!1)}):null]}),Go={kind:"session",sessionId:i.sessionId},Yo=g.useCallback(async Z=>{if(s)try{await WS(s,$,i.sessionId,Z)}catch(be){const ke=be.message;Me("chat-panel","open-in-tab failed",{err:ke}),D("err",`Open in tab 失败:${ke}`)}},[s,$,i.sessionId,D]),[ns,wi]=g.useState(!1),[Xo,Fp]=g.useState(null),It=g.useCallback(Z=>{if(r){r(Z);return}Fp(Z),wi(!0)},[r]),Ou=g.useCallback(Z=>{if(!s)return;const be=async()=>{try{await s.attachmentGroupAdd(i.sessionId,Z)}catch(Qe){Me("chat-panel","file-link groupAdd skipped",{err:Qe.message})}},ke=Qe=>{const Mr=Qe.message;Me("chat-panel","file-link open failed",{err:Mr}),D("err",`打开文件失败:${Mr}`)};if(Rp(Z)){be().then(()=>It(Z),ke);return}WS(s,$,i.sessionId,Z,60,be).catch(ke)},[s,$,i.sessionId,It,D]),Hp=g.useCallback(async Z=>{if(!s)throw new Error("daemon api not ready");const be=await Ly(s,$,i.sessionId,Z,60),ke=await fetch(be);if(!ke.ok)throw new Error(`fetch ${ke.status} ${ke.statusText}`);return await ke.text()},[s,$,i.sessionId]),yt=g.useCallback(async(Z,be)=>{if(s)try{const{url:ke}=await s.attachmentSignUrl({sessionId:i.sessionId,relPath:Z,ttlSeconds:86400,...be?{view:be}:{}}),Qe=await vq(ke);D(Qe?"ok":"err",Qe?"分享链接已复制到剪贴板(24h 有效)":"复制失败:请手动复制")}catch(ke){const Qe=ke.message;Me("chat-panel","share-file failed",{err:Qe}),D("err",`生成分享链接失败:${Qe}`)}},[s,i.sessionId,D]),Pt=g.useCallback(()=>N(null),[]),hr=k==="files"&&z&&s?{title:"Edited Files",onBack:Pt,content:h.jsx(xse,{api:s,scope:Go,sessionId:i.sessionId,onShareFile:yt,onOpenInTab:Yo,onPreviewMarkdown:It})}:k==="cron"?{title:`定时任务${ue.length?` (${ue.length})`:""}`,onBack:Pt,content:h.jsx("div",{className:"p-3",children:h.jsx(rne,{jobs:ue})})}:k==="persona"&&M&&s&&i.ownerPersonaId?{title:`Persona · ${B??""}`,onBack:Pt,content:h.jsx(Ooe,{personaId:i.ownerPersonaId,open:!0,onClose:Pt,api:s,embedded:!0,...p?{viewerRole:p}:{}},i.ownerPersonaId)}:null,Xn=X==="full"?h.jsx(Gte,{session:i,meta:bi,...o!==void 0?{liveGitBranch:o}:{},...a!==void 0?{liveWorktreeRoot:a}:{},...M?{personaName:B}:{},...M?{onOpenPersona:()=>N("persona")}:{},...z?{onOpenFiles:()=>N("files")}:{},cronActiveCount:ue.length,onCronClick:()=>N("cron"),onForceStop:()=>tn(!0),...p?{viewerRole:p}:{},...x!=null&&x.toolSessionIdLabel?{toolSessionIdLabel:x.toolSessionIdLabel}:{},drill:hr,...Pe?{onCollapse:Pe}:{},...Be?{title:Be.title,leadingEntries:Be.leadingEntries}:{}}):null;return h.jsxs(h.Fragment,{children:[xe&&Xn?hl.createPortal(Xn,xe):null,h.jsx(Zoe,{headerMeta:bi,connState:e.connState,...a!==void 0?{liveWorktreeRoot:a}:{},...u?{onOpenConfig:u}:{},variant:X,...b?{hideHeader:b}:{},..._?{flatProcess:_}:{},...X==="quickask"?{ephemeral:i.ephemeral!==!1,onPromote:()=>void(m==null?void 0:m(i.sessionId))}:{},lines:K,pendingPermissions:_e,procAlive:ie,rewindableUserMessageIds:st,onPermissionRespond:Gs,onPermissionInterrupt:gt,onRewind:y.rewind?zt:void 0,...d&&y.fork?{onFork:d}:{},...n&&y.fork?{onQuickAsk:n}:f&&y.fork?{onQuickAsk:f}:{},topSlot:qo,realtimeQuestionAnswers:Rr,onSubmitQuestion:Je,onCancelQuestion:hn,liveQuestionToolUseIds:ae,api:s,cwd:i.cwd,...i.tool?{tool:i.tool}:{},sessionKey:i.sessionId,onSend:e.sendText,queued:e.queued,onDequeue:e.dequeue,awaitingUser:_e.length>0||Object.values(E).some(Z=>!Z.submittedAnswers),onAbort:gt,...l?{onNewSession:l}:{},onClearSession:Nl,...v?{configSlot:v}:{},chatRootRef:xn,chatBodyRef:$t,drawers:Ko,xtermSlot:F==="tui"&&ie&&y.tui?h.jsx(_se,{sessionId:i.sessionId,client:$},i.sessionId):null,fileSharingScope:Go,...s?{onShareFile:yt}:{},...s?{onOpenInTab:Yo}:{},...s?{onPreviewMarkdown:It}:{},...s?{onOpenFilePath:Ou}:{},dispatchOrigin:A}),s?h.jsx(Uoe,{open:ns,onOpenChange:wi,relPath:Xo,loadMarkdown:Hp,onShare:Xo?()=>void yt(Xo,"md-rendered"):void 0}):null,S?h.jsx("div",{"data-testid":"share-toast",role:"status","aria-live":"polite",className:S.kind==="ok"?"fixed left-1/2 top-4 z-50 -translate-x-1/2 rounded-md border border-emerald-500/40 bg-emerald-500/10 px-3 py-2 text-[12px] text-emerald-700 shadow-md dark:text-emerald-300":"fixed left-1/2 top-4 z-50 -translate-x-1/2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive shadow-md",children:S.text}):null]})}function Joe({onConfirm:e,onCancel:t}){return h.jsx("div",{role:"dialog","aria-modal":"true","data-testid":"force-stop-confirm",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:t,children:h.jsxs("div",{className:"max-w-sm w-[92%] rounded-lg border border-red-400/40 bg-bg-0 p-4 shadow-xl",onClick:n=>n.stopPropagation(),children:[h.jsxs("div",{className:"flex items-start gap-2 mb-3",children:[h.jsx(Jh,{className:"w-5 h-5 text-red-500 shrink-0 mt-0.5"}),h.jsx("div",{className:"text-[14px] text-text-100",children:"强制停止会话进程?会丢失 initialize / 预热缓存,下一次发送需要重新 spawn。"})]}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx("button",{type:"button",onClick:t,className:"h-8 px-3 rounded-md text-[12px] text-text-300 hover:bg-text-100/5 cursor-pointer",children:"取消"}),h.jsx("button",{type:"button","data-testid":"force-stop-confirm-ok",onClick:e,className:"h-8 px-3 rounded-md bg-red-500 text-white text-[12px] font-medium hover:bg-red-600 cursor-pointer",children:"强制停止"})]})]})})}function eae(e){return e.split("/").pop()||e}function tae({state:e,api:t,onSwitchTab:n,onCloseQuickAsk:r,onCloseMd:i,loadMarkdown:s,quickAskSession:o,onPromoteQuickAsk:a}){if(!dM(e))return null;const l=[];e.quickAsk&&l.push({id:"quick-ask",label:"问一下",title:"问一下",icon:h.jsx(h0,{className:"w-3.5 h-3.5"})});for(const c of e.mds)l.push({id:{kind:"md",relPath:c},label:eae(c),title:c,icon:h.jsx(pi,{className:"w-3.5 h-3.5"})});return h.jsxs("div",{className:"flex flex-col h-full bg-bg-50/60 border-l border-border-strong",children:[h.jsx(lf,{delayDuration:200,skipDelayDuration:100,children:h.jsx("div",{className:["flex items-stretch h-9 border-b border-text-100/10 shrink-0 overflow-x-auto","[scrollbar-width:none] [-ms-overflow-style:none]","[&::-webkit-scrollbar]:hidden"].join(" "),role:"tablist",children:l.map(c=>{const u=Tq(e.active,c.id),d=c.id==="quick-ask"?"quick-ask":`md:${c.id.relPath}`;return h.jsxs(wp,{children:[h.jsx(Sp,{asChild:!0,children:h.jsxs("div",{role:"tab","aria-selected":u,"data-tab-title":c.title,onClick:()=>n(c.id),className:["group relative flex items-center gap-2 px-3 h-full cursor-pointer select-none","text-[12px] max-w-[180px] shrink-0 transition-colors duration-100",u?"text-text-100":"text-text-400 hover:text-text-100 hover:bg-text-100/[0.04]"].join(" "),children:[c.icon,h.jsx("span",{className:"truncate",children:c.label}),h.jsx("button",{type:"button","aria-label":`关闭 ${c.label}`,className:["ml-1 rounded p-0.5 shrink-0 transition-opacity","hover:bg-text-100/10",u?"opacity-70 hover:opacity-100":"opacity-0 group-hover:opacity-70"].join(" "),onClick:f=>{f.stopPropagation(),c.id==="quick-ask"?r():i(c.id.relPath)},children:h.jsx(qr,{className:"w-3 h-3"})}),u?h.jsx("span",{"aria-hidden":"true",className:"absolute left-2 right-2 -bottom-px h-[2px] rounded-full bg-accent"}):null]})}),h.jsx(Nu,{side:"bottom",align:"start",className:"max-w-sm break-all",children:c.title})]},d)})})}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden relative",children:[e.quickAsk&&o?h.jsx("div",{className:"absolute inset-0",style:{display:e.active==="quick-ask"?"block":"none"},children:h.jsx(Qoe,{session:o,api:t,...a?{onPromoteQuickAsk:a}:{}})}):null,e.mds.map(c=>{const u=e.active!==null&&e.active!=="quick-ask"&&e.active.relPath===c;return h.jsx("div",{className:"absolute inset-0",style:{display:u?"block":"none"},children:h.jsx(p4,{relPath:c,loadMarkdown:s,showTitleBar:!1})},`md-body:${c}`)})]})]})}function nae(e){const t=e instanceof Error?e.message:String(e);return t.length>200?`${t.slice(0,200)}…`:t}function rae({state:e,extras:t}){const{api:n,session:r}=t,i=Xi(),[s,o]=g.useState(bq()),[a,l]=g.useState(null),c=r.ownerPersonaId!==OT,u=g.useRef(s);u.current=s;const d=g.useRef(!1),f=g.useCallback(async T=>{const z=u.current.quickAsk;l(null);let I;try{I=await fq(n,r,T)}catch(B){Me("quick-ask","fork failed",B),d.current||l(nae(B));return}if(!I){d.current||l("这条会话还没准备好(没有可派生的对话记录),稍后再试");return}if(d.current){n.sessionDelete(I.sessionId).catch(()=>{});return}Sd(z)&&n.sessionDelete(z.sessionId).catch(()=>{}),o(B=>wq(B,{sessionId:I.sessionId}))},[n,r]),p=g.useCallback(async T=>{const z=u.current.quickAsk,I=(z==null?void 0:z.sessionId)===T;try{await pq(n,{sessionId:T,stillEphemeral:I&&Sd(z)})&&o(M=>Cq(M))}catch(B){Me("quick-ask","promote failed",B)}},[n]),m=g.useCallback(T=>{o(z=>Sq(z,T))},[]),v=g.useCallback(T=>{o(z=>Nq(z,T))},[]),b=g.useCallback(()=>{const T=u.current.quickAsk;Sd(T)&&n.sessionDelete(T.sessionId).catch(()=>{}),o(z=>kq(z))},[n]),_=g.useCallback(T=>{o(z=>Eq(z,T))},[]);g.useEffect(()=>()=>{d.current=!0;const T=u.current.quickAsk;Sd(T)&&n.sessionDelete(T.sessionId).catch(()=>{})},[]);const x=Wi("sessions")??[],y=s.quickAsk?x.find(T=>T.sessionId===s.quickAsk.sessionId)??{sessionId:s.quickAsk.sessionId,cwd:r.cwd,tool:r.tool}:null,S=g.useCallback(async T=>{const z=await Ly(n,i,r.sessionId,T,60),I=await fetch(z);if(!I.ok)throw new Error(`fetch ${I.status} ${I.statusText}`);return I.text()},[n,i,r.sessionId]),C=h.jsx(m4,{state:e,extras:t,onQuickAskInternal:f,onPreviewMdInternal:m}),{initialSize:k,setSize:N}=yq("chat-panel-right-slot-width",480);return h.jsxs(My,{orientation:"horizontal",className:"flex-1 flex min-w-0 min-h-0",children:[h.jsx(cf,{id:"chat",minSize:"400px",children:h.jsxs("div",{className:"relative flex flex-col min-w-0 min-h-0 h-full",children:[C,a?h.jsxs("div",{"data-testid":"quick-ask-error",className:"absolute bottom-24 left-1/2 z-10 -translate-x-1/2 max-w-[90%] rounded-md border border-border bg-bg-200 px-3 py-2 text-[12px] text-text-300 shadow-lg",children:[h.jsxs("span",{className:"mr-2",children:["问一下没能打开:",a]}),h.jsx("button",{type:"button","aria-label":"关闭提示",onClick:()=>l(null),className:"text-text-400 hover:text-text-200 cursor-pointer",children:"✕"})]}):null]})}),dM(s)?h.jsxs(h.Fragment,{children:[h.jsx(iM,{className:"w-1 bg-text-100/10 hover:bg-text-100/25 transition-colors cursor-col-resize"}),h.jsx(cf,{id:"right-slot",defaultSize:`${k}px`,minSize:"360px",maxSize:"800px",onResize:T=>N(T.inPixels),children:h.jsx(tae,{state:s,api:n,onSwitchTab:v,onCloseQuickAsk:b,onCloseMd:_,loadMarkdown:S,quickAskSession:y,...c?{onPromoteQuickAsk:p}:{}})})]}):null]})}function iae({extras:e}){const t=uM(e.session.sessionId);return h.jsx(rae,{state:t,extras:e})}function sae(e,t,n){const r=e?t.find(s=>s.id===e):void 0;if(r!=null&&r.efforts&&r.efforts.length>0)return{options:r.efforts,defaultValue:r.defaultEffort??""};const i=n.find(s=>s.name==="effort");return{options:(i==null?void 0:i.options)??[],defaultValue:typeof(i==null?void 0:i.default)=="string"?i.default:""}}function oae(e,t,n){var l;if(!t)return((l=(e??[]).find(c=>c.id===""))==null?void 0:l.label)??"未指定";const r=t.toLowerCase(),i=[["opus","Opus"],["fable","Fable"],["sonnet","Sonnet"],["haiku","Haiku"]];for(const[c,u]of i){if(!r.includes(c))continue;const d=r.match(new RegExp(`${c}-(\\d+)(?:-(\\d+))?`));return d?d[2]?`${u} ${d[1]}.${d[2]}`:`${u} ${d[1]}`:u}const s=e??[],o=s.find(c=>c.id===t);if(o)return o.label;const a=s.find(c=>c.id&&t.toLowerCase().includes(c.id.toLowerCase()));return a?a.label:t}function aae(e,t){var m,v,b,_;const{models:n,modes:r,configSchema:i}=t,s=e.resolvedModel??e.model,o=sae(s,n,i),a=o.options,l=a.some(x=>x.value===e.effort)?e.effort:o.defaultValue,c=e.effort===""&&e.resolvedEffort?((m=a.find(x=>x.value===e.resolvedEffort))==null?void 0:m.label)??e.resolvedEffort:((v=a.find(x=>x.value===l))==null?void 0:v.label)??null,u=((b=i.find(x=>x.name==="permissionMode"))==null?void 0:b.default)??"",d=r.some(x=>x.id===e.permissionMode)?e.permissionMode:u,p=d===u?null:((_=r.find(x=>x.id===d))==null?void 0:_.label)??null;return{modelLabel:oae(n,s),effortOptions:a,effortValue:l,effortLabel:c,modeValue:d,modeLabel:p,modeTone:p===null?null:d==="bypassPermissions"?"danger":"info"}}function lae(e){let t;return e.map(n=>{const r=n.group&&n.group!==t?n.group:null;return n.group&&(t=n.group),{...n,groupHeading:r}})}function cae({models:e=[],modes:t=[],configSchema:n=[],model:r,resolvedModel:i,resolvedEffort:s,effort:o,permissionMode:a,onPatch:l}){var p;const c=aae({model:r,resolvedModel:i,resolvedEffort:s,effort:o,permissionMode:a},{models:e,modes:t,configSchema:n}),u=i??r,d=e.map(m=>{const v=m.id===""&&i?`${m.description?`${m.description};`:""}当前:${i}`:m.description;return{value:m.id,label:m.label,...v?{description:v}:{},...m.group?{group:m.group}:{}}}),f=t.map(m=>({value:m.id,label:m.label,...m.description?{description:m.description}:{}}));return h.jsxs(CR,{children:[h.jsx(ER,{asChild:!0,children:h.jsxs("button",{type:"button","data-testid":"session-config-chip",title:"Model / reasoning effort / permission mode",className:"inline-flex items-center gap-1 h-7 px-2.5 rounded-full text-[11px] text-text-400 transition-colors outline-none cursor-pointer hover:bg-text-100/5 hover:text-text-200 data-[state=open]:bg-text-100/5",children:[h.jsx("span",{className:"truncate max-w-[120px]","data-testid":"session-config-chip-model",children:u||c.modelLabel}),c.effortLabel?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-500",children:"·"}),h.jsx("span",{className:"truncate max-w-[80px]","data-testid":"session-config-chip-effort",children:c.effortLabel})]}):null,c.modeLabel?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-500",children:"·"}),h.jsx("span",{"data-testid":"session-config-chip-mode","data-tone":c.modeTone,className:ne("font-semibold",c.modeTone==="danger"?"text-red-400":"text-blue-400"),children:c.modeLabel})]}):null]})}),h.jsxs(by,{side:"top",align:"end",className:"w-[230px]","data-testid":"session-config-menu",children:[h.jsx(Ng,{testid:"session-config-model",label:"Model",current:r,currentLabel:c.modelLabel,options:d,onSelect:m=>l({model:m})}),h.jsx(Ng,{testid:"session-config-effort",label:"Reasoning effort",current:c.effortValue,currentLabel:c.effortLabel??"—",options:c.effortOptions,onSelect:m=>l({effort:m})}),f.length>0?h.jsx(Ng,{testid:"session-config-mode",label:"Permission mode",current:c.modeValue,currentLabel:((p=t.find(m=>m.id===c.modeValue))==null?void 0:p.label)??"—",currentTone:c.modeTone,options:f,onSelect:m=>l({permissionMode:m})}):null]})]})}function Ng({testid:e,label:t,current:n,currentLabel:r,currentTone:i,options:s,onSelect:o}){const a=s.length===0;return h.jsxs(gW,{children:[h.jsxs(NR,{"data-testid":e,disabled:a,className:"gap-2 text-[12px]",children:[h.jsx("span",{className:"flex-1 text-text-200",children:t}),h.jsx("span",{className:ne("truncate max-w-[100px]",i==="danger"?"text-red-400 font-semibold":i==="info"?"text-blue-400 font-semibold":"text-text-400"),children:r}),h.jsx(On,{className:"w-3.5 h-3.5 shrink-0 text-text-500"})]}),h.jsx(TR,{className:"w-[220px] max-h-[320px] overflow-y-auto",children:lae(s).map((l,c)=>{const u=l.value===n;return h.jsxs(Ke.Fragment,{children:[l.groupHeading?h.jsxs(h.Fragment,{children:[c>0?h.jsx(wy,{}):null,h.jsx(IR,{"data-testid":`${e}-group`,children:l.groupHeading})]}):null,h.jsxs(so,{"data-testid":`${e}-option-${l.value||"default"}`,onSelect:()=>o(l.value),className:"items-start gap-2",children:[h.jsxs("span",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:ne("block text-[12px]",u?"text-text-100 font-medium":"text-text-300"),children:l.label}),l.description?h.jsx("span",{className:"block text-[11px] text-text-400 mt-0.5",children:l.description}):null]}),u?h.jsx(_u,{className:"w-3.5 h-3.5 shrink-0 text-accent mt-0.5"}):null]})]},l.value||"default")})})]})}function uae(e,t,n=0){const[r,i]=g.useState(null),[s,o]=g.useState(!1),a=g.useCallback(async()=>{if(!t){i(null);return}o(!0);try{const l=await e.getGitBranch(t);i(l.branch??null)}catch{i(null)}finally{o(!1)}},[e,t]);return g.useEffect(()=>{a()},[a,n]),{branch:r,loading:s,refresh:()=>void a()}}function dae(e,t,n=0){const[r,i]=g.useState(null),[s,o]=g.useState(!1),a=g.useCallback(async()=>{if(!t){i(null);return}o(!0);try{const l=await e.getGitRoot(t);i(l.gitRoot??null)}catch{i(null)}finally{o(!1)}},[e,t]);return g.useEffect(()=>{a()},[a,n]),{worktreeRoot:r,loading:s,refresh:()=>void a()}}function hae({api:e,session:t,focused:n,totalPanes:r,onFocus:i,onClose:s,onNewSession:o,onOpenConfig:a,onFork:l,onQuickAsk:c,className:u,viewerRole:d="owner",hideHeader:f}){const{capabilities:p}=d1(t.tool),[m,v]=g.useState(0),{branch:b}=uae(e,t.cwd,m),{worktreeRoot:_}=dae(e,t.cwd,m),x=r>1,y=S=>{e.sessionUpdate(t.sessionId,S).catch(C=>{console.error("[session-config] session:update failed",t.sessionId,C)})};return h.jsxs("div",{className:`group/pane relative flex-1 ${u??"flex"} flex-row min-w-0 min-h-0 overflow-hidden ${x?`rounded-md border transition-colors ${n?"border-accent ring-1 ring-accent":"border-border"}`:""}`,onMouseDown:i,"data-testid":`session-pane-${t.sessionId}`,children:[h.jsx(My,{orientation:"horizontal",className:"flex-1 flex min-w-0 min-h-0",children:h.jsx(cf,{id:"chat",minSize:"400px",children:h.jsx("div",{className:"flex flex-col min-w-0 min-h-0 h-full",children:h.jsx(fae,{api:e,session:t,liveGitBranch:b,liveWorktreeRoot:_,onNewSession:o,onTurnEnd:()=>v(S=>S+1),onOpenConfig:a,onFork:l,onQuickAsk:c,viewerRole:d,hideHeader:f,configSlot:p?h.jsx(cae,{models:p.models,modes:p.permissionModes,configSchema:p.configSchema,model:t.model??"",...t.resolvedModel?{resolvedModel:t.resolvedModel}:{},...t.resolvedEffort?{resolvedEffort:t.resolvedEffort}:{},effort:t.effort??"",permissionMode:t.permissionMode??"",onPatch:y}):null})})})}),x&&h.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),s()},className:"absolute top-1.5 right-1.5 z-10 p-1 rounded-md bg-bg-100/80 backdrop-blur-sm border border-border opacity-0 group-hover/pane:opacity-100 transition-opacity text-text-400 hover:text-text-100 hover:bg-bg-200","aria-label":"close pane","data-testid":`session-pane-close-${t.sessionId}`,children:h.jsx(qr,{className:"w-3.5 h-3.5"})})]})}function fae({api:e,session:t,liveGitBranch:n,liveWorktreeRoot:r,onNewSession:i,onTurnEnd:s,onOpenConfig:o,onFork:a,onQuickAsk:l,viewerRole:c,configSlot:u,hideHeader:d}){return h.jsx(iae,{extras:{session:t,api:e,...n!==void 0?{liveGitBranch:n}:{},...r!==void 0?{liveWorktreeRoot:r}:{},onNewSession:i,onTurnEnd:s,onOpenConfig:o,...a?{onFork:f=>{a(f)}}:{},...l?{onQuickAsk:f=>{l(f)}}:{},...c?{viewerRole:c}:{},...u?{configSlot:u}:{},...d?{hideHeader:d}:{}}})}function pae({personas:e,sessions:t,api:n,selfPrincipalId:r,selectedPersonaId:i,selectedSessionId:s,selectedSession:o,onSelectPersona:a,onSelectSession:l,onCreateSession:c,onDeleteSession:u,onEditSession:d,onCloseSession:f}){return h.jsxs("div",{className:"flex h-screen min-h-0 bg-bg-50","data-testid":"guest-share-page",children:[h.jsx("aside",{className:"w-[280px] shrink-0 overflow-y-auto border-r border-border bg-bg-50",children:h.jsx(iV,{personas:e,sessions:t,activePersonaId:i,activeSessionId:s,onSelectPersona:a,onSelectSession:l,onCreateSession:c,onDeleteSession:u,onEditSession:d,showCopyResume:!1,treatSessionsAsRoots:!0,...r?{ownerPrincipalId:r}:{},isPersonaExpanded:()=>!0})}),h.jsx("main",{className:"flex-1 min-w-0 min-h-0 flex",children:o?h.jsx(hae,{api:n,session:o,focused:!0,totalPanes:1,onFocus:()=>{},onClose:f,onNewSession:()=>{},onOpenConfig:()=>{},viewerRole:"guest"}):h.jsx("div",{className:"flex flex-1 items-center justify-center p-6 text-xs text-text-400","data-testid":"guest-share-empty",children:"选择左侧 persona 开始对话"})})]})}function mae(){const e=Xi(),t=g.useMemo(()=>new Wx(e),[e]),n=d$(e),{sessions:r,refresh:i}=h$(n),{personas:s}=lI(),o=_$(),a=g.useMemo(()=>{const S=window.location.pathname.match(/^\/s\/([^/]+)/);return S?decodeURIComponent(S[1]):null},[]),l=g.useMemo(()=>r.filter(S=>!S.ephemeral&&S.larkChatId==null),[r]),c=g.useMemo(()=>a?s.filter(S=>S.personaId===a):s,[s,a]),[u,d]=g.useState(null),[f,p]=g.useState(null),[m,v]=g.useState(null);g.useEffect(()=>{let S=!1;return e.request("whoami",{}).then(C=>{S||d(C.capability.id)}).catch(()=>{}),()=>{S=!0}},[e]),g.useEffect(()=>{a&&p(a)},[a]);const b=g.useCallback(async(S,C)=>{const k=await t.sessionCreate({ownerPersonaId:S,...C.trim()?{label:C.trim()}:{}});await i(),p(S),v(k.sessionId)},[t,i]),_=g.useCallback(async S=>{await t.sessionDelete(S),await i(),v(C=>C===S?null:C)},[t,i]),x=g.useCallback(async(S,C)=>{await t.sessionUpdate(S,{label:C.label}),await i()},[t,i]),y=g.useMemo(()=>l.find(S=>S.sessionId===m)??null,[l,m]);return h.jsx(Vx.Provider,{value:o,children:h.jsx(pae,{personas:c,sessions:l,api:t,selfPrincipalId:u,selectedPersonaId:f,selectedSessionId:m,selectedSession:y,onSelectPersona:p,onSelectSession:v,onCreateSession:(S,C)=>void b(S,C),onDeleteSession:S=>void _(S),onEditSession:(S,C)=>void x(S,C),onCloseSession:()=>v(null)})})}const i2="https://app.ttcadvisory.com";function gae({onAuthed:e}){const[t,n]=g.useState(!1),[r,i]=g.useState(null),s=g.useRef(null);g.useEffect(()=>()=>{s.current&&window.removeEventListener("message",s.current)},[]);const o=g.useCallback(()=>{s.current&&(window.removeEventListener("message",s.current),s.current=null),n(!0),i(null);const a=window.location.origin,l=`${i2}/auth/authorize?callback_url=${encodeURIComponent(a)}&auto=1`,c=async d=>{if(d.origin!==i2)return;const f=d.data;if((f==null?void 0:f.type)==="AUTH_CANCEL"){u(),n(!1);return}if(!((f==null?void 0:f.type)!=="AUTH_SUCCESS"||!f.token)){u();try{const p=await fetch(`${window.location.origin}/share/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ttcToken:f.token})});if(!p.ok){const v=await p.json().catch(()=>({}));throw new Error(v.code??`exchange failed (${p.status})`)}const m=await p.json();if(!m.visitorToken)throw new Error("no visitorToken in response");e(m.visitorToken)}catch(p){i(p instanceof Error?p.message:String(p)),n(!1)}}},u=()=>{window.removeEventListener("message",c),s.current=null};s.current=d=>void c(d),window.addEventListener("message",s.current),window.open(l,"ttc-login","width=480,height=640")},[e]);return h.jsx("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 font-sans text-text-100","data-testid":"guest-login",children:h.jsxs("div",{className:"flex w-full max-w-xs flex-col gap-3 rounded-lg border border-border bg-bg-100 px-5 py-6",children:[h.jsx("h1",{className:"text-base font-semibold",children:"登录后进入分享"}),h.jsx("p",{className:"text-[11px] leading-snug text-text-400",children:"使用飞书账号登录,即可在浏览器里与分享给你的 persona 交互,无需安装。"}),r?h.jsxs("p",{className:"text-[11px] leading-snug text-error","data-testid":"guest-login-error",children:["登录失败:",r]}):null,h.jsx("button",{type:"button",disabled:t,onClick:()=>o(),"data-testid":"guest-login-button",className:"w-full rounded border border-border bg-bg-50 px-2 py-1.5 text-xs text-text-200 transition-colors hover:bg-text-100/5 hover:text-text-100 disabled:opacity-50",children:t?"请在弹窗中完成授权…":"飞书登录"})]})})}const N_="clawd-visitor:token";function vae(e,t){const r=`${e.protocol==="https:"?"wss:":"ws:"}//${e.host}`;return t!=null&&t.devPath?`${r}${t.devPath}`:r}function _ae(){return{async getUrl(e){const t=localStorage.getItem(N_);if(!t)throw new Error("NO_VISITOR_TOKEN");const n=vae(window.location,{});return await JT(e).upsert({id:"guest",name:"访客",mode:"remote",url:n,token:t}),{url:n}}}}function xae(e){const t=n=>{document.documentElement.classList.toggle("dark",n==="dark")};return t(e.theme.mode),e.onThemeChange(n=>t(n.mode))}function yae(){const e=Xi(),t=g.useMemo(()=>u$(e),[e]);return h.jsx(Vz,{cache:t.cache,children:h.jsx(Gz,{children:h.jsx(mae,{})})})}function bae({host:e}){const[t]=g.useState(()=>localStorage.getItem(N_)),[n,r]=g.useState(!1),[i,s]=g.useState(null);return g.useEffect(()=>xae(e),[e]),g.useEffect(()=>{if(!t)return;let o=!1;return _ae().getUrl(e).then(()=>{o||r(!0)}).catch(a=>{o||s(a instanceof Error?a.message:String(a))}),()=>{o=!0}},[e,t]),t?h.jsx(Lb,{host:e,children:h.jsx(fw,{children:i?h.jsxs("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 text-center text-xs text-error","data-testid":"guest-share-connect-error",children:["连接失败:",i]}):n?h.jsx(Hz,{host:e,children:h.jsx(yae,{})}):h.jsx("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 text-xs text-text-400",children:"正在连接…"})})}):h.jsx(Lb,{host:e,children:h.jsx(fw,{children:h.jsx(gae,{onAuthed:o=>{localStorage.setItem(N_,o),window.location.reload()}})})})}function wae({filePath:e,oldString:t,newString:n,content:r}){const i=g.useMemo(()=>r!=null?r.split(/\r?\n/).map(s=>({type:"add",text:s})):Sae(t??"",n??""),[t,n,r]);return h.jsxs("div",{"data-testid":"inline-diff",className:"min-w-0 max-w-full rounded-lg border border-bg-300/60 bg-bg-50 overflow-hidden text-[12px] font-mono",children:[h.jsx("div",{className:"flex min-w-0 items-center gap-2 px-3 py-1.5 border-b border-bg-300/40 bg-bg-100/30",children:h.jsx("span",{className:"min-w-0 text-text-400 truncate",title:e,children:e})}),h.jsx("div",{className:"max-h-[320px] max-w-full overflow-auto",children:i.map((s,o)=>h.jsxs("div",{"data-testid":`diff-line-${s.type}`,className:ne("flex min-w-max gap-2 px-3 py-0.5 whitespace-pre",s.type==="add"?"bg-success/10 text-success":s.type==="remove"?"bg-error/10 text-error":"text-text-300"),children:[h.jsx("span",{className:"w-3 shrink-0 select-none opacity-60",children:s.type==="add"?"+":s.type==="remove"?"-":" "}),h.jsx("span",{className:"flex-1",children:s.text||" "})]},o))})]})}function Sae(e,t){const n=e.split(/\r?\n/),r=t.split(/\r?\n/),i=n.length,s=r.length,o=Array.from({length:i+1},()=>new Array(s+1).fill(0));for(let u=i-1;u>=0;u--)for(let d=s-1;d>=0;d--)o[u][d]=n[u]===r[d]?o[u+1][d+1]+1:Math.max(o[u+1][d],o[u][d+1]);const a=[];let l=0,c=0;for(;l<i&&c<s;)n[l]===r[c]?(a.push({type:"equal",text:n[l]}),l++,c++):o[l+1][c]>=o[l][c+1]?(a.push({type:"remove",text:n[l]}),l++):(a.push({type:"add",text:r[c]}),c++);for(;l<i;)a.push({type:"remove",text:n[l++]});for(;c<s;)a.push({type:"add",text:r[c++]});return a}function kae({items:e}){return e.length===0?null:h.jsxs("div",{"data-testid":"todo-checklist",className:"rounded-lg border border-bg-300/60 bg-bg-50 px-3 py-2 text-[13px]",children:[h.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-400/70 mb-1.5",children:"Todos"}),h.jsx("ul",{className:"flex flex-col gap-1",children:e.map((t,n)=>{const r=t.status==="in_progress"&&t.activeForm||t.content;return h.jsxs("li",{"data-testid":`todo-item-${t.status}`,className:"flex items-start gap-2",children:[h.jsx(Cae,{status:t.status}),h.jsx("span",{className:ne("flex-1 leading-snug",t.status==="completed"?"text-text-400 line-through":t.status==="in_progress"?"text-text-100 font-medium":"text-text-200"),children:r})]},n)})})]})}function Cae({status:e}){return e==="completed"?h.jsx(qx,{className:"w-3.5 h-3.5 text-success mt-0.5 shrink-0"}):e==="in_progress"?h.jsx(lr,{className:"w-3.5 h-3.5 text-warning mt-0.5 shrink-0 animate-spin"}):h.jsx(Q$,{className:"w-3.5 h-3.5 text-text-400 mt-0.5 shrink-0"})}function Eae(e){const t=e??{};return Array.isArray(t.todos)?t.todos.map(n=>{if(!n||typeof n!="object")return null;const r=n,i=typeof r.content=="string"?r.content:"",s=r.status==="pending"||r.status==="in_progress"||r.status==="completed"?r.status:"pending",o=typeof r.activeForm=="string"?r.activeForm:void 0;return{content:i,status:s,activeForm:o}}).filter(n=>n!==null):[]}function Nae({description:e,prompt:t,subagentType:n}){return h.jsxs("div",{"data-testid":"task-checklist",className:"rounded-lg border border-bg-300/60 bg-bg-50 px-3 py-2 text-[13px]",children:[h.jsxs("div",{className:"flex items-center gap-2 text-text-200 font-medium",children:[h.jsx(ap,{className:"w-3.5 h-3.5 text-accent shrink-0"}),h.jsx("span",{className:"truncate",children:e||"subagent task"}),n?h.jsx("span",{className:"shrink-0 px-1.5 py-0.5 rounded-md text-[10px] font-mono bg-accent/10 text-accent",children:n}):null]}),t?h.jsx("div",{className:"mt-1 text-[12px] text-text-400 leading-snug line-clamp-3",children:t}):null]})}function Tae(e){const t=e??{};return{description:typeof t.description=="string"?t.description:"",prompt:typeof t.prompt=="string"?t.prompt:void 0,subagentType:typeof t.subagent_type=="string"?t.subagent_type:void 0}}const Iae={render:({input:e})=>Ke.createElement(kae,{items:Eae(e)})},Pae={render:({input:e})=>{const{description:t,prompt:n,subagentType:r}=Tae(e);return Ke.createElement(Nae,{description:t,prompt:n,subagentType:r})}},g4={render:({input:e,output:t,error:n,pending:r,fileScope:i,onShareFile:s,onOpenInTab:o,onPreviewMarkdown:a})=>{const l=Mae(e),c=l?Ke.createElement(wae,{filePath:l.filePath,oldString:l.oldString,newString:l.newString,content:l.content}):void 0;return Ke.createElement(EA,{tool:Rae(e),input:e,output:t,error:n,pending:r,expandedBody:c,...i?{fileScope:i}:{},...s?{onShareFile:s}:{},...o?{onOpenInTab:o}:{},...a?{onPreviewMarkdown:a}:{}})}};function Rae(e){const t=e??{};return"content"in t&&t.content!==void 0?"Write":("old_string"in t&&t.old_string!==void 0,"Edit")}function Mae(e){const t=e??{},n=typeof t.file_path=="string"?t.file_path:null;if(!n)return null;const r=typeof t.old_string=="string"?t.old_string:void 0,i=typeof t.new_string=="string"?t.new_string:void 0,s=typeof t.content=="string"?t.content:void 0;return r==null&&i==null&&s==null?null:{filePath:n,oldString:r,newString:i,content:s}}kl.register("claude","TodoWrite",Iae);kl.register("claude","Task",Pae);kl.register("claude","Edit",g4);kl.register("claude","Write",g4);const v4=document.getElementById("root");if(!v4)throw new Error("guest-main: #root not found");const Aae=XL({});Tg.createRoot(v4).render(h.jsx(Ke.StrictMode,{children:h.jsx(bae,{host:Aae})}));
|
|
594
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},xoe="DialogDescriptionWarning",yoe=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${s4(xoe).contentName}}.`;return g.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},boe=q5,woe=Y5,o4=X5,a4=Q5,l4=J5,c4=t4,Soe=r4;const koe=boe,Coe=woe,u4=g.forwardRef(({className:e,...t},n)=>h.jsx(o4,{ref:n,className:ne("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",e),...t}));u4.displayName=o4.displayName;const d4=g.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(Coe,{children:[h.jsx(u4,{}),h.jsxs(a4,{ref:r,className:ne("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2","gap-4 rounded-lg border border-border bg-elevated p-6 shadow-lg",e),...n,children:[t,h.jsxs(Soe,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-accent",children:[h.jsx(qr,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));d4.displayName=a4.displayName;const h4=({className:e,...t})=>h.jsx("div",{className:ne("flex flex-col space-y-1.5 text-left",e),...t});h4.displayName="DialogHeader";const f4=g.forwardRef(({className:e,...t},n)=>h.jsx(l4,{ref:n,className:ne("text-lg font-semibold leading-none text-text-100",e),...t}));f4.displayName=l4.displayName;const Eoe=g.forwardRef(({className:e,...t},n)=>h.jsx(c4,{ref:n,className:ne("text-sm text-text-300",e),...t}));Eoe.displayName=c4.displayName;function Noe({persona:e,open:t,onClose:n,onDelete:r,embedded:i,onLoadPersonality:s,onSavePersonality:o,onLoadPersonalityLocal:a,onSavePersonalityLocal:l,hasPersonalityLocal:c=!1,onDirtyChange:u,initialPersonality:d,onShareCapability:f,readOnly:p=!1,larkBot:m}){const[v,b]=g.useState(!1),[_,x]=g.useState(!1),y=v||_,S=Ke.useRef(u);g.useEffect(()=>{S.current=u}),g.useEffect(()=>{var k;(k=S.current)==null||k.call(S,y)},[y]);const C=()=>{y&&!window.confirm("修改未保存,确定关闭?")||n()};return t?h.jsxs(h.Fragment,{children:[!i&&h.jsx("div",{className:"absolute inset-0 z-30 bg-black/30",onClick:C,"aria-hidden":"true"}),h.jsxs("aside",{className:i?"flex h-full w-full flex-col bg-bg-0":"absolute right-0 top-0 z-40 flex h-full w-[420px] flex-col bg-bg-0 border-l border-border shadow-xl","data-testid":"persona-settings-drawer",children:[h.jsxs("header",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx(X8,{className:"h-4 w-4 text-text-300"}),h.jsx("span",{className:"text-[13px] font-medium text-text-100 truncate",children:"Persona 设置"})]}),h.jsx("button",{type:"button",onClick:C,"aria-label":"关闭",className:"rounded-sm p-1.5 text-text-400 hover:bg-bg-200 hover:text-text-100",children:h.jsx(qr,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-6 flex flex-col gap-4",children:[h.jsxs("header",{className:"flex items-start justify-between gap-3",children:[h.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h2",{className:"text-lg font-semibold text-text-100 truncate",children:e.label}),e.public?h.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm bg-bg-200 px-1.5 py-0.5 text-[10px] text-text-200",children:[h.jsx(g8,{className:"h-3 w-3"})," 公开"]}):h.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm bg-error-dim px-1.5 py-0.5 text-[10px] text-error",children:[h.jsx(p8,{className:"h-3 w-3"})," 已关闭"]})]}),h.jsx("span",{className:"font-mono text-[11px] text-text-400 truncate","data-testid":"persona-id-subtitle",children:e.personaId})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[f?h.jsxs("button",{type:"button",onClick:f,"aria-label":"分享给他人",title:"分享给他人",className:"inline-flex items-center gap-1 rounded-sm px-2 py-1.5 text-xs text-text-200 hover:bg-bg-200 hover:text-text-100",children:[h.jsx(Yx,{className:"h-3.5 w-3.5"}),"分享"]}):null,r?h.jsx("button",{type:"button",onClick:r,"aria-label":"删除 persona",className:"rounded-sm p-1.5 text-text-400 hover:bg-bg-200 hover:text-error",children:h.jsx(Xx,{className:"h-4 w-4"})}):null]})]}),h.jsx("hr",{className:"border-border"}),m?h.jsxs(h.Fragment,{children:[h.jsx(Poe,{...m}),h.jsx("hr",{className:"border-border"})]}):null,s?h.jsxs(h.Fragment,{children:[h.jsx(n2,{onLoad:s,...o&&!e.personalityManaged?{onSave:o}:{},onDirtyChange:b,initialPersonality:d,readOnly:p||!!e.personalityManaged,title:e.personalityManaged?"内置人格":"人格 (Personality)",hint:e.personalityManaged?p?"这个 persona 自带的人格,随 clawd 版本更新。":"这个 persona 自带的人格,随 clawd 版本更新——在这里改不会保留,要加自己的规则请写下面的「你的补充」。":void 0,testIdPrefix:"persona-personality"}),(e.personalityManaged||c)&&a?h.jsx(n2,{onLoad:a,...l?{onSave:l}:{},onDirtyChange:x,readOnly:p,title:p?"补充设定":"你的补充",hint:p?"这个 persona 的补充设定,由它的主人维护。与内置人格叠加生效。":"写入 <persona-dir>/.clawd/personality.local.md,不会被更新覆盖。与内置人格叠加生效,冲突时以你写的为准;对 owner 和访客会话都生效,要区分对象请在正文里写明。只对新启动的会话生效。",placeholder:"例:回答一律先给结论,再展开。",testIdPrefix:"persona-personality-local"}):null,h.jsx("hr",{className:"border-border"})]}):null,h.jsx(Roe,{settings:e.sandboxSettings??null}),h.jsx("hr",{className:"border-border"}),h.jsx(Moe,{skills:e.skills??[]}),h.jsx("hr",{className:"border-border"}),h.jsx(Aoe,{plugins:e.plugins??[]})]})]})]}):null}function t2({qrUrl:e,busy:t,onCancel:n,title:r="扫码关联飞书 Bot",hint:i="用手机飞书扫码,按页面提示创建应用。确认后自动完成关联。"}){const[s,o]=g.useState(null);return g.useEffect(()=>{let a=!1;return Du.toDataURL(e,{width:240,margin:1}).then(l=>{a||o(l)}).catch(()=>{a||o(null)}),()=>{a=!0}},[e]),h.jsx(koe,{open:!0,onOpenChange:a=>a||n==null?void 0:n(),children:h.jsxs(d4,{className:"max-w-xs","data-testid":"lark-bot-qr-dialog",onInteractOutside:a=>a.preventDefault(),onEscapeKeyDown:a=>a.preventDefault(),children:[h.jsx(h4,{children:h.jsx(f4,{children:r})}),h.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s?h.jsx("img",{src:s,alt:"飞书扫码创建应用二维码",className:"h-60 w-60 rounded bg-white p-2","data-testid":"lark-bot-qr-img"}):h.jsx("div",{className:"flex h-60 w-60 items-center justify-center text-[12px] text-text-400",children:"二维码生成中…"}),h.jsx("span",{className:"text-center text-[12px] text-text-300",children:i}),n?h.jsx("button",{type:"button",disabled:t,onClick:n,className:"rounded border border-border px-3 py-1.5 text-[12px] text-text-300 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-provision-cancel",children:"取消"}):null]})]})})}const Toe={expired:"二维码已过期,请重新扫码。",cancelled:"已取消。",access_denied:"你在飞书上取消了本次授权。",lark_protocol_error:"飞书返回了未预期的响应,请重试。",cloud_unreachable:"云端暂时不可达,请稍后重试。",internal_error:"关联失败。若飞书中已创建应用,可在开发者后台删除后重试,或改用手动绑定填入其凭证。"},Ioe=new Set(["expired","access_denied","lark_protocol_error","cloud_unreachable","internal_error"]);function Poe({status:e,onProvision:t,onCancelProvision:n,onBindManual:r,onUnbind:i,onUpgrade:s}){const[o,a]=g.useState(!1),[l,c]=g.useState(null),[u,d]=g.useState(""),[f,p]=g.useState(""),[m,v]=g.useState(null),b=k=>{k&&(a(!0),c(null),k().catch(N=>c(N instanceof Error?N.message:String(N))).finally(()=>a(!1)))},_=()=>{v(null),b(t)},x=!o&&!!u&&!!f,y=()=>{!x||!r||b(()=>r({appId:u,appSecret:f}))},S=Eu(y),C=h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(ap,{className:"h-3.5 w-3.5 text-text-400","aria-hidden":!0}),h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"飞书 Bot"})]});return e?h.jsxs("section",{className:"flex flex-col gap-1.5","data-testid":"lark-bot-section",children:[C,e.state==="unbound"||e.state==="provisioning"?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-[11px] text-text-400",children:"关联一个飞书 bot 后,这个 persona 就是它:拉进群后群成员 @ 它提问、或直接私聊它, 推理跑在你本机,回复自动发回去。"}),t?h.jsx("button",{type:"button",disabled:o||e.state==="provisioning",onClick:_,className:"self-start rounded border border-border bg-bg-200 px-3 py-1.5 text-[12px] font-medium text-text-100 hover:bg-bg-300 disabled:opacity-50","data-testid":"lark-bot-provision",children:e.state==="provisioning"?"等待扫码…":"扫码关联飞书 Bot"}):null,e.state==="unbound"&&e.errorReason&&!m?h.jsxs("div",{className:"flex flex-col gap-1.5 rounded border border-error bg-error-dim px-2 py-1.5","data-testid":"lark-bot-provision-error",children:[h.jsx("span",{className:"text-[11px] text-error",children:Toe[e.errorReason]}),h.jsxs("div",{className:"flex gap-1.5",children:[Ioe.has(e.errorReason)&&t?h.jsx("button",{type:"button",disabled:o,onClick:_,className:"rounded border border-border px-2 py-1 text-[11px] text-text-100 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-provision-retry",children:"重新扫码"}):null,h.jsx("button",{type:"button",onClick:()=>v(e.errorReason??null),className:"rounded border border-border px-2 py-1 text-[11px] text-text-300 hover:bg-bg-200","data-testid":"lark-bot-provision-error-dismiss",children:"知道了"})]})]}):null,e.state==="provisioning"&&e.qrUrl?h.jsx(t2,{qrUrl:e.qrUrl,busy:o,onCancel:n?()=>b(n):void 0}):null,r&&e.state==="unbound"?h.jsxs("details",{"data-testid":"lark-bot-manual-details",children:[h.jsx("summary",{className:"cursor-pointer text-[11px] text-text-400 hover:text-text-300",children:"已有飞书应用?手动填入凭证"}),h.jsxs("div",{className:"mt-1.5 flex flex-col gap-1.5","data-testid":"lark-bot-manual-form",children:[h.jsx("span",{className:"text-[11px] text-text-400",children:"先在飞书开放平台(open.feishu.cn)创建企业自建应用并启用机器人能力,再填入凭证:"}),h.jsx("input",{value:u,onChange:k=>d(k.target.value),...S,placeholder:"App ID(cli_ 开头)",className:"rounded border border-border bg-bg-100 px-2 py-1 text-[12px] text-text-200","data-testid":"lark-bot-manual-appid"}),h.jsx("input",{value:f,onChange:k=>p(k.target.value),...S,type:"password",placeholder:"App Secret",className:"rounded border border-border bg-bg-100 px-2 py-1 text-[12px] text-text-200","data-testid":"lark-bot-manual-secret"}),h.jsx("button",{type:"button",disabled:!x,onClick:y,className:"self-start rounded border border-border px-3 py-1.5 text-[12px] text-text-100 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-manual-submit",children:o?"绑定中…":"绑定"})]})]}):null]}):null,e.state==="bound"||e.state==="broken"?h.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.state==="bound"&&e.needsUpgrade?h.jsxs("div",{className:"flex flex-col gap-1.5 rounded border border-warning/30 bg-warning-dim px-2 py-1.5","data-testid":"lark-bot-upgrade-notice",children:[h.jsx("span",{className:"text-[11px] text-warning",children:"这个 bot 的权限配置有更新,扫码重新授权后生效。在此之前,新增能力对它不起作用。"}),s?h.jsx("button",{type:"button",disabled:o,onClick:()=>b(s),className:"self-start rounded border border-warning/30 bg-warning/10 px-2 py-1 text-[11px] text-warning hover:bg-warning/20 disabled:opacity-50","data-testid":"lark-bot-upgrade",children:"更新授权"}):null]}):null,e.state==="bound"&&e.upgradeQrUrl?h.jsx(t2,{qrUrl:e.upgradeQrUrl,busy:o,onCancel:n?()=>b(n):void 0,title:"扫码更新授权",hint:"用手机飞书扫码,确认页会列出将要添加的权限。期间 bot 照常服务,不会中断。"}):null,e.state==="broken"?h.jsxs("div",{className:"rounded border border-error bg-error-dim px-2 py-1.5 text-[11px] text-error","data-testid":"lark-bot-broken",children:["Bot 凭证失效:",e.brokenReason??"未知原因","。请解绑后重新填入有效凭证绑定。"]}):null,h.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-text-200",children:[h.jsx("span",{className:"font-medium text-text-100",children:e.botName??"未命名 bot"}),e.appId?h.jsx("span",{className:"text-[11px] text-text-400",children:e.appId}):null]}),h.jsx("span",{className:"text-[11px] text-text-400",children:"把 bot 拉进任意飞书群,群成员 @ 它即可提问。"}),e.groups.length>0?h.jsx("ul",{className:"flex flex-col gap-0.5","data-testid":"lark-bot-groups",children:e.groups.map(k=>h.jsxs("li",{className:"text-[11px] text-text-300 truncate",children:["· ",k.chatName??k.chatId]},k.chatId))}):h.jsx("span",{className:"text-[11px] text-text-400","data-testid":"lark-bot-groups-empty",children:"还没有服务中的群。"}),i?h.jsx("button",{type:"button",disabled:o,onClick:()=>b(i),className:"self-start rounded border border-border px-3 py-1.5 text-[12px] text-error hover:bg-error-dim disabled:opacity-50","data-testid":"lark-bot-unbind",children:"解绑"}):null]}):null,l?h.jsx("div",{className:"rounded border border-error bg-error-dim px-2 py-1.5 text-[11px] text-error","data-testid":"lark-bot-error",children:l}):null]}):h.jsxs("section",{className:"flex flex-col gap-1.5","data-testid":"lark-bot-section",children:[C,h.jsx("span",{className:"text-[11px] text-text-400",children:"状态加载中…"})]})}function Roe({settings:e}){var t,n,r,i,s,o,a,l,c,u,d,f,p;return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-sandbox-setting-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Sandbox Setting"}),h.jsx("span",{className:"text-[11px] text-text-400",children:"约束此 persona 的沙箱权限(只读,需通过文件修改)。"})]}),e==null?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-sandbox-setting-empty",children:"暂无 sandbox 配置"}):h.jsxs("div",{className:"flex flex-col gap-1.5 rounded-md border border-border bg-bg-100 px-3 py-2",children:[h.jsx(Od,{label:"权限默认模式",value:((t=e.permissions)==null?void 0:t.defaultMode)??"—"}),h.jsx(Od,{label:"沙箱启用",value:Eg((n=e.sandbox)==null?void 0:n.enabled)}),h.jsx(Od,{label:"沙箱内自动放行 Bash",value:Eg((r=e.sandbox)==null?void 0:r.autoAllowBashIfSandboxed)}),h.jsx(Od,{label:"允许非沙箱命令",value:Eg((i=e.sandbox)==null?void 0:i.allowUnsandboxedCommands)}),h.jsxs("div",{className:"mt-1 flex flex-col gap-1.5 border-t border-border pt-1.5",children:[h.jsx(Gl,{label:"沙箱外命令",paths:(s=e.sandbox)==null?void 0:s.excludedCommands}),h.jsx(Gl,{label:"允许读取",paths:(a=(o=e.sandbox)==null?void 0:o.filesystem)==null?void 0:a.allowRead}),h.jsx(Gl,{label:"拒绝读取",paths:(c=(l=e.sandbox)==null?void 0:l.filesystem)==null?void 0:c.denyRead}),h.jsx(Gl,{label:"允许写入",paths:(d=(u=e.sandbox)==null?void 0:u.filesystem)==null?void 0:d.allowWrite}),h.jsx(Gl,{label:"拒绝写入",paths:(p=(f=e.sandbox)==null?void 0:f.filesystem)==null?void 0:p.denyWrite})]})]})]})}function Eg(e){return e===!0?"是":e===!1?"否":"—"}function Od({label:e,value:t}){return h.jsxs("div",{className:"flex items-center justify-between gap-3 text-[12px]",children:[h.jsx("span",{className:"text-text-300",children:e}),h.jsx("span",{className:"font-mono text-text-100",children:t})]})}function Gl({label:e,paths:t}){const n=!t||t.length===0;return h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[11px] text-text-300",children:e}),n?h.jsx("span",{className:"text-[11px] text-text-400",children:"—"}):h.jsx("div",{className:"flex flex-wrap gap-1",children:t.map((r,i)=>h.jsx("span",{className:"rounded-sm border border-border bg-bg-0 px-1.5 py-0.5 font-mono text-[11px] text-text-200",children:r},`${e}-${i}-${r}`))})]})}function Moe({skills:e}){return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-skills-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Persona Skills"}),h.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 text-[10px] text-text-300",children:e.length})]}),h.jsxs("span",{className:"text-[11px] text-text-400",children:["此 persona 私有 skills(来自"," ",h.jsx("code",{className:"font-mono",children:"<persona-dir>/.claude/skills/"}),")。"]})]}),e.length===0?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-skills-empty",children:"暂无 skills"}):h.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border bg-bg-100",children:e.map(t=>h.jsxs("li",{className:"flex flex-col gap-0.5 px-3 py-2","data-testid":"persona-skill-row",children:[h.jsx("span",{className:"font-mono text-[13px] text-text-100",children:t.name}),t.description?h.jsx("span",{className:"text-[12px] text-text-300",children:t.description}):h.jsx("span",{className:"text-[11px] text-text-400 italic",children:"无描述"})]},t.name))})]})}function Aoe({plugins:e}){return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-plugins-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Enabled Plugins"}),h.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 text-[10px] text-text-300",children:e.length})]}),h.jsxs("span",{className:"text-[11px] text-text-400",children:["此 persona 已启用的插件(来自"," ",h.jsx("code",{className:"font-mono",children:"<persona-dir>/.claude/settings.json"})," ","的 ",h.jsx("code",{className:"font-mono",children:"enabledPlugins"}),")。"]})]}),e.length===0?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-plugins-empty",children:"暂无启用插件"}):h.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border bg-bg-100",children:e.map(t=>h.jsx("li",{className:"flex flex-col gap-0.5 px-3 py-2","data-testid":"persona-plugin-row",children:h.jsx("span",{className:"font-mono text-[13px] text-text-100",children:t.id})},t.id))})]})}function n2({onLoad:e,onSave:t,onDirtyChange:n,initialPersonality:r,readOnly:i=!1,title:s,hint:o,placeholder:a,testIdPrefix:l}){const c=r!==void 0,[u,d]=g.useState(c),[f,p]=g.useState(c?r:""),[m,v]=g.useState(c?r:""),[b,_]=g.useState(null),[x,y]=g.useState(!1),[S,C]=g.useState(null),k=Ke.useRef(e),N=Ke.useRef(t),T=Ke.useRef(n);Ke.useEffect(()=>{k.current=e,N.current=t,T.current=n});const z=Ke.useCallback(()=>{d(!1),_(null),k.current().then(A=>{p(A),v(A),d(!0)}).catch(A=>{_(A instanceof Error?A.message:String(A))})},[]);Ke.useEffect(()=>{c||z()},[c,z]);const I=!i&&u&&m!==f;Ke.useEffect(()=>{i||T.current(I)},[I,i]);const B=()=>{N.current&&(y(!0),C(null),N.current(m).then(()=>{p(m),y(!1)}).catch(A=>{C(A instanceof Error?A.message:String(A)),y(!1)}))},M=()=>{v(f),C(null)},R=Eu(()=>{!I||x||B()},()=>{!I||x||M()});return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":`${l}-section`,children:[h.jsx("span",{className:"text-[12px] font-medium text-text-200",children:s}),b?h.jsxs("div",{"data-testid":`${l}-load-error`,className:"rounded-md border border-error bg-error-dim px-3 py-2 text-[12px] text-error flex items-center justify-between gap-2",children:[h.jsxs("span",{children:["加载失败:",b]}),h.jsx("button",{type:"button",onClick:z,className:"rounded-sm border border-error px-2 py-0.5 text-[11px] hover:bg-error/10",children:"重试"})]}):null,S?h.jsxs("div",{"data-testid":`${l}-save-error`,className:"rounded-md border border-error bg-error-dim px-3 py-2 text-[12px] text-error",children:["保存失败:",S]}):null,h.jsx("textarea",{"data-testid":`${l}-textarea`,value:m,onChange:A=>v(A.target.value),...R,readOnly:i,disabled:!i&&(!u||x),placeholder:u?a??"":"加载中…",rows:8,className:"min-h-[8rem] max-h-[18rem] resize-y rounded-md border border-border bg-bg-100 px-2 py-1.5 font-mono text-[11px] text-text-100 disabled:opacity-60"}),o?h.jsx("p",{className:"text-[10px] text-text-400",children:o}):i?null:h.jsx("p",{className:"text-[10px] text-text-400",children:"写入人格文件。修改只对新启动的会话生效。"}),u&&I?h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx("button",{type:"button",onClick:M,disabled:x,className:"rounded-sm border border-border px-2 py-1 text-[12px] text-text-200 hover:bg-bg-200 disabled:opacity-60",children:"放弃"}),h.jsx("button",{type:"button",onClick:B,disabled:x,"data-testid":`${l}-save-btn`,className:"rounded-sm bg-accent-dim px-2 py-1 text-[12px] text-text-100 hover:opacity-90 disabled:opacity-60",children:x?"保存中…":"保存"})]}):null]})}const Loe={state:"unbound",groups:[]};function Doe(e,t){const[n,r]=g.useState(null);g.useEffect(()=>{if(!e)return;let c=!1;r(null);const u=async()=>{try{const p=await e.request("larkBot:status",{personaId:t});c||r(p)}catch{c||r(Loe)}};u();const d=e.on("larkBot:state",p=>{const m=p;if(m.personaId!==t)return;const{personaId:v,...b}=m;r(b)}),f=e.on("daemon:connected",()=>{u()});return()=>{c=!0,d(),f()}},[e,t]);const i=g.useCallback(async()=>{e&&await e.request("larkBot:provision",{personaId:t})},[e,t]),s=g.useCallback(async()=>{e&&await e.request("larkBot:provisionCancel",{personaId:t})},[e,t]),o=g.useCallback(async c=>{e&&await e.request("larkBot:bindManual",{personaId:t,...c})},[e,t]),a=g.useCallback(async()=>{e&&await e.request("larkBot:upgrade",{personaId:t})},[e,t]),l=g.useCallback(async()=>{e&&await e.request("larkBot:unbind",{personaId:t})},[e,t]);return{status:n,provision:i,cancelProvision:s,bindManual:o,unbind:l,upgrade:a}}function joe(e,t="owner"){var k;const{persona:n}=cI(e),r=f$(e),i=p$(),s=m$(),{httpBaseUrl:o}=op(),a=Xi(),l=Doe(t==="guest"?null:a,e),{capabilities:c}=d1((n==null?void 0:n.tool)??"claude"),u=g.useMemo(()=>!(n!=null&&n.public)||!o||/^https?:\/\/(127\.0\.0\.1|localhost|0\.0\.0\.0|\[?::1\]?)([:/]|$)/i.test(o)?null:`${o}/s/${e}`,[n==null?void 0:n.public,o,e]),d=g.useCallback((N,T)=>{i(e,T).catch(z=>{Me("persona",`${N} failed`,z)})},[i,e]),f=g.useCallback(N=>d("togglePublic",{public:N}),[d]),p=g.useCallback(async N=>{await i(e,{codexSandbox:{network:N}}),await r.refresh()},[i,e,r]),m=g.useCallback(N=>d("changeTool",{tool:N}),[d]),v=g.useCallback(N=>d("changeModel",{model:N}),[d]),b=g.useCallback(N=>d("changeEffort",{effort:N}),[d]),_=g.useCallback(()=>!n||!confirm(`删除 persona "${n.label}"?`)?!1:(s(e).catch(N=>{Me("persona","delete failed",N)}),!0),[n,s,e]),x=g.useCallback(async()=>r.loaded?r.personality:(await r.refresh()).personality,[r]),y=g.useCallback(async N=>{await i(e,{personality:N}),await r.refresh()},[i,e,r]),S=g.useCallback(async()=>r.loaded?r.personalityLocal:(await r.refresh()).personalityLocal,[r]),C=g.useCallback(async N=>{await i(e,{personalityLocal:N}),await r.refresh()},[i,e,r]);return{persona:n,detail:r,models:(c==null?void 0:c.models)??[],configSchema:(c==null?void 0:c.configSchema)??[],larkBot:l,guestShareUrl:u,changeTool:m,changeModel:v,changeEffort:b,togglePublic:f,guestNetwork:((k=r.codexSandbox)==null?void 0:k.network)??!1,toggleGuestNetwork:p,remove:_,loadPersonality:x,savePersonality:y,loadPersonalityLocal:S,savePersonalityLocal:C}}function Ooe({personaId:e,open:t,onClose:n,api:r,embedded:i,onDirtyChange:s,onShareCapability:o,viewerRole:a="owner"}){const l=joe(e,a),{persona:c,detail:u}=l,d=g.useCallback(()=>{l.remove()&&n()},[l,n]);if(!c)return null;const f=a==="guest";return h.jsx(Noe,{embedded:i,persona:{...c,skills:u.skills,plugins:u.plugins,sandboxSettings:u.sandboxSettings,personalityManaged:u.personalityManaged},open:t,onClose:n,onLoadPersonality:l.loadPersonality,onLoadPersonalityLocal:l.loadPersonalityLocal,hasPersonalityLocal:u.personalityLocal!=="",onDirtyChange:s,readOnly:f,...f?{}:{onTogglePublic:l.togglePublic,guestShareUrl:l.guestShareUrl,onChangeTool:l.changeTool,onChangeModel:l.changeModel,onChangeEffort:l.changeEffort,models:l.models,configSchema:l.configSchema,onDelete:d,onSavePersonality:l.savePersonality,onSavePersonalityLocal:l.savePersonalityLocal,larkBot:{status:l.larkBot.status,onProvision:l.larkBot.provision,onCancelProvision:l.larkBot.cancelProvision,onBindManual:l.larkBot.bindManual,onUnbind:l.larkBot.unbind,onUpgrade:l.larkBot.upgrade},...o?{onShareCapability:o}:{}}})}const Boe={resolve:()=>{}},zoe=g.createContext(Boe);function $oe(){return g.useContext(zoe)}const Foe={...$s,h1:({node:e,...t})=>h.jsx("h1",{...t,className:"mt-4 mb-3 text-[18px] font-semibold leading-tight text-text-100"}),h2:({node:e,...t})=>h.jsx("h2",{...t,className:"mt-4 mb-2 text-[16px] font-semibold leading-tight text-text-100"}),h3:({node:e,...t})=>h.jsx("h3",{...t,className:"mt-3 mb-2 text-[14px] font-semibold leading-tight text-text-100"}),h4:({node:e,...t})=>h.jsx("h4",{...t,className:"mt-3 mb-1 text-[13px] font-semibold text-text-100"}),h5:({node:e,...t})=>h.jsx("h5",{...t,className:"mt-2 mb-1 text-[12px] font-semibold text-text-100"}),h6:({node:e,...t})=>h.jsx("h6",{...t,className:"mt-2 mb-1 text-[12px] font-semibold text-text-300"}),p:({node:e,...t})=>h.jsx("p",{...t,className:"my-2 leading-relaxed"}),ul:({node:e,...t})=>h.jsx("ul",{...t,className:"my-2 list-disc space-y-1 pl-5"}),ol:({node:e,...t})=>h.jsx("ol",{...t,className:"my-2 list-decimal space-y-1 pl-5"}),li:({node:e,...t})=>h.jsx("li",{...t,className:"leading-relaxed"}),blockquote:({node:e,...t})=>h.jsx("blockquote",{...t,className:"my-2 border-l-2 border-border pl-3 italic text-text-300"}),code:({node:e,className:t,children:n,...r})=>t?h.jsx("code",{...r,className:`${t} font-mono text-[12px]`,children:n}):h.jsx("code",{...r,className:"rounded bg-bg-50 px-1 py-0.5 font-mono text-[12px] text-text-100",children:n}),pre:({node:e,...t})=>h.jsx("pre",{...t,className:"my-2 overflow-auto rounded border border-border bg-bg-0 p-3 text-[12px] font-mono text-text-100"}),hr:({node:e,...t})=>h.jsx("hr",{...t,className:"my-3 border-border"}),table:({node:e,...t})=>h.jsx("table",{...t,className:"my-2 w-full border-collapse text-[12px]"}),thead:({node:e,...t})=>h.jsx("thead",{...t,className:"bg-bg-50"}),th:({node:e,...t})=>h.jsx("th",{...t,className:"border border-border px-2 py-1 text-left font-semibold"}),td:({node:e,...t})=>h.jsx("td",{...t,className:"border border-border px-2 py-1"}),strong:({node:e,...t})=>h.jsx("strong",{...t,className:"font-semibold text-text-100"}),em:({node:e,...t})=>h.jsx("em",{...t,className:"italic"})};function Hoe(e){const t=e.split("/");return t[t.length-1]||e}function p4({relPath:e,loadMarkdown:t,headerRight:n,showTitleBar:r=!1}){const[i,s]=g.useState(null),[o,a]=g.useState(null),[l,c]=g.useState(!1);return g.useEffect(()=>{if(!e)return;let u=!1;return c(!0),a(null),s(null),(async()=>{try{const d=await t(e);if(u)return;s(d)}catch(d){if(u)return;a(d.message||String(d))}finally{u||c(!1)}})(),()=>{u=!0}},[e,t]),h.jsxs("div",{className:"flex flex-col h-full",children:[r&&e?h.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[h.jsx("div",{"data-testid":"md-preview-title",className:"truncate text-[13px] font-medium text-text-100",title:e,children:Hoe(e)}),h.jsx("div",{className:"flex items-center gap-1",children:n})]}):null,h.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 text-[13px] text-text-100",children:l?h.jsx("div",{"data-testid":"md-preview-loading",className:"text-text-400",children:"Loading…"}):o?h.jsx("div",{"data-testid":"md-preview-error",className:"text-destructive whitespace-pre-wrap",children:o}):i!==null?h.jsx("div",{"data-testid":"md-preview-content",className:"max-w-none",children:h.jsx(tl,{remarkPlugins:[nl],components:Foe,children:i})}):null})]})}function Uoe({open:e,onOpenChange:t,relPath:n,loadMarkdown:r,onShare:i}){return e?h.jsx("div",{"data-testid":"md-preview-drawer",className:`${e1} z-50 flex w-1/2 max-w-[900px] flex-col border-l border-border bg-elevated shadow-2xl`,children:h.jsx(p4,{relPath:n,loadMarkdown:r,showTitleBar:!0,headerRight:h.jsxs(h.Fragment,{children:[i?h.jsx("button",{type:"button","data-testid":"md-preview-share","aria-label":"Share rendered preview link",onClick:i,className:"inline-flex h-6 w-6 items-center justify-center rounded text-text-400 hover:bg-bg-50 hover:text-text-200",children:h.jsx(k8,{className:"h-4 w-4"})}):null,h.jsx("button",{type:"button","aria-label":"Close preview",onClick:()=>t(!1),className:"inline-flex h-6 w-6 items-center justify-center rounded text-text-400 hover:bg-bg-50 hover:text-text-200",children:h.jsx(qr,{className:"h-4 w-4"})})]})})}):null}const r2=4;function Woe({children:e,onHeightChange:t}){const n=g.useRef(null),[r,i]=g.useState(0);return g.useEffect(()=>{const s=n.current;if(!s)return;const o=()=>i(s.offsetHeight>0?s.offsetHeight+r2*2:0);if(o(),typeof ResizeObserver>"u")return;const a=new ResizeObserver(o);return a.observe(s),()=>a.disconnect()},[]),g.useEffect(()=>{t==null||t(r)},[r,t]),h.jsx("div",{"data-testid":"chat-floating-dock","data-height":r,className:"relative z-20 h-0 shrink-0",children:h.jsx("div",{ref:n,className:"absolute left-4 right-4 flex flex-col items-end gap-1",style:{bottom:r2},children:e})})}const Voe=250;function qoe(e){if(!e||!Number.isFinite(e))return null;const t=e/1e3;if(t<60)return`${t.toFixed(0)}s`;const n=Math.floor(t/60);return`${n}m${Math.round(t-n*60).toString().padStart(2,"0")}s`}function Koe({agents:e}){var a,l,c;const[t,n]=g.useState(!1);if(e.length===0)return null;const r=e.length===1?e[0]:null,i=r?r.description:`${e.length} 个后台任务`,s=r?qoe((l=(a=r.progress)==null?void 0:a.stats)==null?void 0:l.durationMs):null,o=r?(c=r.progress)==null?void 0:c.lastToolName:null;return h.jsxs("div",{"data-testid":"running-agents-chip","data-agent-count":e.length,className:"relative",children:[t?h.jsx("div",{"data-testid":"running-agents-popover",className:"absolute bottom-full right-0 z-20 mb-1 w-[min(560px,80vw)]",children:h.jsx("div",{className:"min-w-0 overflow-y-auto rounded-lg border border-bg-200/60 bg-bg-100 px-2 py-1 shadow-lg",style:{maxHeight:Voe},children:e.map(u=>h.jsx(AA,{expandable:!1,description:u.description,input:u.input,output:u.output,...u.error!==void 0?{error:u.error}:{},pending:u.pending,notifications:u.notifications,...u.toolResultExtra?{toolResultExtra:u.toolResultExtra}:{},...u.progress?{progress:u.progress}:{}},u.toolUseId))})}):null,h.jsxs("button",{type:"button","data-testid":"running-agents-chip-toggle","aria-expanded":t,onClick:()=>n(u=>!u),className:ne("flex max-w-[min(560px,80vw)] min-w-0 items-center gap-2 rounded-full","border border-bg-200/60 bg-bg-100/95 px-3 py-1 text-[12px] shadow-md backdrop-blur","hover:bg-bg-200/95 transition-colors"),children:[h.jsx(lr,{className:"w-3 h-3 shrink-0 animate-spin text-blue-400"}),h.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-text-200",children:i}),s?h.jsx("span",{className:"shrink-0 tabular-nums text-text-400",children:s}):null,o?h.jsxs("span",{className:"shrink-0 font-mono tabular-nums text-blue-400",children:["now:",o]}):null,h.jsx(hI,{className:ne("w-3.5 h-3.5 shrink-0 text-text-400 transition-transform",t&&"rotate-180")})]})]})}const Goe={closeTrailing:!1},Yoe={closeTrailing:!0};function Xoe(e){return e?Goe:Yoe}function Qoe({session:e,api:t,onPromoteQuickAsk:n}){const r=uM(e.sessionId);return h.jsx(m4,{state:r,extras:{session:e,api:t,...n?{onPromoteQuickAsk:n}:{}}})}function Zoe({headerMeta:e,connState:t,liveWorktreeRoot:n,onOpenConfig:r,variant:i="full",ephemeral:s,onPromote:o,hideHeader:a=!1,flatProcess:l=!1,lines:c,pendingPermissions:u,procAlive:d,rewindableUserMessageIds:f,onPermissionRespond:p,onPermissionInterrupt:m,onRewind:v,onFork:b,onQuickAsk:_,topSlot:x,realtimeQuestionAnswers:y,onSubmitQuestion:S,onCancelQuestion:C,liveQuestionToolUseIds:k,api:N,cwd:T,tool:z,sessionKey:I,onSend:B,awaitingUser:M,queued:R,onDequeue:A,onAbort:D,onNewSession:$,onClearSession:F,configSlot:j,chatRootRef:O,chatBodyRef:E,drawers:H,xtermSlot:q,fileSharingScope:L,onShareFile:re,onOpenInTab:ie,onPreviewMarkdown:K,onOpenFilePath:_e,dispatchOrigin:Ee}){const[ue,Le]=g.useState(0),Ae=g.useMemo(()=>i==="full"?Lq(fM(c)):[],[c,i]),Oe=g.useMemo(()=>new Set(Ae.map(ge=>ge.toolUseId)),[Ae]);return h.jsx(Fee,{children:h.jsxs("div",{ref:O,"data-cc-chat-root":"",className:"flex flex-col h-full bg-bg-100",children:[a?null:h.jsx(Ute,{meta:e,...z?{tool:z}:{},connState:t,variant:i,...n!==void 0?{liveWorktreeRoot:n}:{},...i==="full"&&r?{onOpenConfig:r}:{},...i==="quickask"?{ephemeral:s??!1,...o?{onPromote:o}:{}}:{}}),h.jsx("div",{ref:E,"data-testid":"chat-body",className:"flex-1 overflow-y-auto min-h-0",style:{overflowAnchor:"none",paddingBottom:ue},children:h.jsx(DA,{lines:c,...p?{onPermissionRespond:p}:{},...m&&d?{onPermissionInterrupt:m}:{},topSlot:x,...v?{onRewind:v}:{},rewindableUserMessageIds:f,...b?{onFork:b}:{},..._?{onQuickAsk:_}:{},realtimeQuestionAnswers:y,onSubmitQuestion:S,...C?{onCancelQuestion:C}:{},liveQuestionToolUseIds:k,...L?{fileSharingScope:L}:{},...re?{onShareFile:re}:{},...ie?{onOpenInTab:ie}:{},...K?{onPreviewMarkdown:K}:{},..._e?{onOpenFilePath:_e}:{},...Ee?{dispatchOrigin:Ee}:{},...i==="full"&&!l?{turnCollapse:Xoe(d)}:{},dockedAgentToolUseIds:Oe})}),q,h.jsx(Woe,{onHeightChange:Le,children:h.jsx(Koe,{agents:Ae})}),e.larkChatName?h.jsx("div",{className:"mx-3 mb-3 rounded-lg border border-border bg-bg-200 px-3 py-2 text-[12px] text-text-400","data-testid":"lark-readonly-notice",children:e.larkChatType==="p2p"?`此会话由与「${e.larkChatName}」的飞书私聊驱动——对方消息触发,这里仅供观察。`:`此会话由飞书群「${e.larkChatName}」驱动——群成员 @ bot 提问触发,这里仅供观察。`}):h.jsx(Fte,{meta:e,...N?{api:N}:{},cwd:T,...z?{tool:z}:{},sessionKey:I,onSend:B,awaitingUser:M,...R?{queued:R}:{},...A?{onDequeue:A}:{},...D?{onAbort:D}:{},...$?{onNewSession:$}:{},...F?{onClearSession:F}:{},...j?{configSlot:j}:{}}),H]})})}function m4({state:e,extras:t,onQuickAskInternal:n,onPreviewMdInternal:r}){const{session:i,api:s,liveGitBranch:o,liveWorktreeRoot:a,onNewSession:l,onTurnEnd:c,onOpenConfig:u,onFork:d,onQuickAsk:f,viewerRole:p,onPromoteQuickAsk:m,configSlot:v,hideHeader:b,flatProcess:_}=t,{capabilities:x}=d1(i.tool||"claude"),y=(x==null?void 0:x.features)??iI(i.tool),[S,C]=g.useState(null),[k,N]=g.useState(null),T=op(),z=!!s&&T.actionsLevel==="owner"&&y.fileSharing,I=cI(i.ownerPersonaId??null).persona,B=(I==null?void 0:I.label)??null,M=!!B&&!!i.ownerPersonaId,R=$oe(),A=g.useMemo(()=>({resolve:(Z,be)=>R.resolve(Z,be,i.sessionId),...R.onOpenSession?{onOpenSession:R.onOpenSession}:{}}),[R,i.sessionId]),D=g.useCallback((Z,be)=>{C({kind:Z,text:be}),setTimeout(()=>{C(ke=>(ke==null?void 0:ke.text)===be?null:ke)},2e3)},[]),$=Xi(),F=Uz(),j=sM(i.sessionId,i.toolSessionId),{events:O,pendingQuestions:E,clearQuestion:H,markQuestionSubmitted:q,status:L}=j,re=e.historyLoading,ie=cM(L);g.useEffect(()=>{Me("chat-panel","sessionStatus",{sessionId:i.sessionId,sessionStatus:L,procAlive:ie})},[L,ie,i.sessionId]);const K=e.lines,_e=e.pendingPermissions,Ee=_e[0]??null,ue=g.useMemo(()=>Mq(O),[O]),[Le,Ae]=g.useState(null),[Oe,ge]=g.useState(()=>new Set);Iq(s,i.sessionId,i.toolSessionId,y.observe);const tt=g.useRef(i.sessionId);g.useEffect(()=>{if(tt.current=i.sessionId,!y.rewind){Ae(null);return}let Z=!1;return Ae(null),(async()=>{try{const be=await s.sessionRewindableMessageIds(i.sessionId);if(Z)return;Ae(new Set(be.userMessageIds))}catch{Z||Ae(null)}})(),()=>{Z=!0}},[s,i.sessionId,y.rewind]);const Nt=g.useCallback(()=>{const Z=i.sessionId;s.sessionRewindableMessageIds(Z).then(be=>{tt.current===Z&&Ae(new Set(be.userMessageIds))}).catch(()=>{})},[s,i.sessionId]),st=g.useMemo(()=>{if(Le!==null){const Qe=new Set(Le);for(const Mr of Oe)Qe.delete(Mr);return Qe}const Z=new Set(["Edit","Write","MultiEdit","NotebookEdit"]),be=new Set;let ke=null;for(const Qe of K)Qe.kind==="user-text"?ke=Qe.uuid??null:ke&&Qe.kind==="tool-call"&&Z.has(Qe.tool)&&!Oe.has(ke)&&be.add(ke);return be},[K,Oe,Le]),pt=g.useRef(c);pt.current=c,Pq(i.sessionId,i.toolSessionId,()=>{nt(null),ge(new Set)});const jt=sne({sessionStatus:L}),mt=g.useRef(null);g.useEffect(()=>{var ke;const Z=mt.current,be=(Z==null?void 0:Z.sid)===i.sessionId;be&&Z.phase===jt||(mt.current={sid:i.sessionId,phase:jt},Me("session-phase",jt,{sid:i.sessionId,phase:jt,prev:be?Z.phase:null,desc:ine[jt]}),be&&Z.phase==="turn-running"&&jt!=="turn-running"&&((ke=pt.current)==null||ke.call(pt),Nt()))},[jt,i.sessionId,Nt]);const gt=g.useCallback(async()=>{const Z=await s.sessionInterrupt(i.sessionId).catch(()=>{});return(Z==null?void 0:Z.queued)??[]},[s,i.sessionId]),[Xe,nt]=g.useState(null),zt=g.useCallback(Z=>{nt(Z)},[]),[_n,tn]=g.useState(!1),U=g.useCallback(()=>{s.sessionStop(i.sessionId).catch(()=>{}),tn(!1)},[s,i.sessionId]);g.useCallback(Z=>{s.pinSession(i.sessionId,Z).catch(be=>{Me("chat-panel","pinSession failed",{err:be==null?void 0:be.message})})},[s,i.sessionId]);const X=m?"quickask":"full",{container:xe,onCollapse:Pe,hostExtras:Be}=Xte(),xt=g.useRef(0),xn=g.useRef(null);g.useEffect(()=>{const Z=be=>{if(be.key!=="Escape")return;if(!ie){xt.current=0;return}if(be.isComposing)return;const Qe=be.target;if(Qe&&Qe.closest("[data-cc-chat-root]")!==xn.current)return;const Mr=Date.now();Mr-xt.current<2e3?(xt.current=0,tn(!0)):(xt.current=Mr,gt())};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[gt,ie]);const $t=g.useRef(null),dn=g.useRef(!0),oe=g.useRef(void 0),ye=g.useRef(0),Ze=g.useRef(0),Tt=g.useRef(void 0);g.useEffect(()=>{N(null)},[i.sessionId]),g.useEffect(()=>{const Z=$t.current;if(!Z)return;const be=150,ke=Qe=>{Date.now()<Ze.current&&(Qe.preventDefault(),Ze.current=Date.now()+be)};return Z.addEventListener("wheel",ke,{passive:!1}),()=>Z.removeEventListener("wheel",ke)},[]),g.useEffect(()=>{const Z=$t.current;if(!Z)return;const be=32,ke=()=>{const Qe=Z.scrollHeight-Z.scrollTop-Z.clientHeight;dn.current=Qe<=be};return Z.addEventListener("scroll",ke,{passive:!0}),()=>Z.removeEventListener("scroll",ke)},[]),g.useLayoutEffect(()=>{var Bu;const Z=$t.current;if(!Z)return;const be=Tt.current!==i.sessionId;be&&(Tt.current=i.sessionId,dn.current=!0,oe.current=void 0,ye.current=0,Ze.current=0);const ke=oe.current,Qe=(Bu=K[0])==null?void 0:Bu.seq;oe.current=Qe,!be&&ke!==void 0&&Qe!==void 0&&Qe<ke?(Z.scrollTop=Z.scrollHeight-ye.current,Ze.current=Date.now()+200):dn.current&&(Z.scrollTop=Z.scrollHeight),ye.current=Z.scrollHeight-Z.scrollTop},[K,Ee==null?void 0:Ee.requestId,i.sessionId]);const Rr=g.useMemo(()=>{const Z={};for(const[be,ke]of Object.entries(E))ke.submittedAnswers&&(Z[be]=ke.submittedAnswers);return Z},[E]),ae=g.useMemo(()=>new Set(Object.keys(E)),[E]),Je=g.useCallback(async(Z,be)=>{try{await s.answerQuestion({sessionId:i.sessionId,toolUseId:Z,answers:be}),q(Z,be)}catch{}},[s,i.sessionId,q]),hn=g.useCallback(async Z=>{try{await s.cancelQuestion({sessionId:i.sessionId,toolUseId:Z}),H(Z)}catch{}},[s,i.sessionId,H]),Gs=g.useCallback(async(Z,be)=>{var ke;if(Ee)try{await((ke=e.respondPermission)==null?void 0:ke.call(e,Ee.requestId,Z?"allow":"deny"))}catch{}},[e,Ee]),Nl=g.useCallback(async()=>{const Z=i.sessionId;try{await s.sessionStop(Z)}catch{}e.clearSession?await e.clearSession():await s.sessionNew(Z)},[e,s,i.sessionId]),qo=g.useMemo(()=>e.historyError?h.jsxs("div",{className:"flex justify-center py-2 text-[12px] text-text-400","data-testid":"history-error",children:["历史未加载完(",e.historyError,");切走再切回可重试"]}):re&&K.length===0?h.jsx("div",{className:"flex justify-center py-4","data-testid":"history-loading",children:h.jsx(lr,{className:"w-4 h-4 text-text-400 animate-spin"})}):null,[re,K.length,e.historyError]),bi=e.meta,Ko=h.jsxs(h.Fragment,{children:[i.toolSessionId&&y.subagents?h.jsx(Qte,{api:s,cwd:i.cwd,toolSessionId:i.toolSessionId,toolKind:i.tool??"claude"}):null,Xe&&y.rewind?h.jsx(Jte,{open:!0,onOpenChange:Z=>{Z||nt(null)},api:s,sessionId:i.sessionId,userMessageId:Xe,lines:K,procAlive:ie,onNoChanges:Z=>{ge(be=>{if(be.has(Z))return be;const ke=new Set(be);return ke.add(Z),ke})}}):null,_n?h.jsx(Joe,{onConfirm:U,onCancel:()=>tn(!1)}):null]}),Go={kind:"session",sessionId:i.sessionId},Yo=g.useCallback(async Z=>{if(s)try{await WS(s,$,i.sessionId,Z)}catch(be){const ke=be.message;Me("chat-panel","open-in-tab failed",{err:ke}),D("err",`Open in tab 失败:${ke}`)}},[s,$,i.sessionId,D]),[ns,wi]=g.useState(!1),[Xo,Fp]=g.useState(null),It=g.useCallback(Z=>{if(r){r(Z);return}Fp(Z),wi(!0)},[r]),Ou=g.useCallback(Z=>{if(!s)return;const be=async()=>{try{await s.attachmentGroupAdd(i.sessionId,Z)}catch(Qe){Me("chat-panel","file-link groupAdd skipped",{err:Qe.message})}},ke=Qe=>{const Mr=Qe.message;Me("chat-panel","file-link open failed",{err:Mr}),D("err",`打开文件失败:${Mr}`)};if(Rp(Z)){be().then(()=>It(Z),ke);return}WS(s,$,i.sessionId,Z,60,be).catch(ke)},[s,$,i.sessionId,It,D]),Hp=g.useCallback(async Z=>{if(!s)throw new Error("daemon api not ready");const be=await Ly(s,$,i.sessionId,Z,60),ke=await fetch(be);if(!ke.ok)throw new Error(`fetch ${ke.status} ${ke.statusText}`);return await ke.text()},[s,$,i.sessionId]),yt=g.useCallback(async(Z,be)=>{if(s)try{const{url:ke}=await s.attachmentSignUrl({sessionId:i.sessionId,relPath:Z,...be?{view:be}:{}}),Qe=await vq(ke);D(Qe?"ok":"err",Qe?"分享链接已复制到剪贴板":"复制失败:请手动复制")}catch(ke){const Qe=ke.message;Me("chat-panel","share-file failed",{err:Qe}),D("err",`生成分享链接失败:${Qe}`)}},[s,i.sessionId,D]),Pt=g.useCallback(()=>N(null),[]),hr=k==="files"&&z&&s?{title:"Edited Files",onBack:Pt,content:h.jsx(xse,{api:s,scope:Go,sessionId:i.sessionId,onShareFile:yt,onOpenInTab:Yo,onPreviewMarkdown:It})}:k==="cron"?{title:`定时任务${ue.length?` (${ue.length})`:""}`,onBack:Pt,content:h.jsx("div",{className:"p-3",children:h.jsx(rne,{jobs:ue})})}:k==="persona"&&M&&s&&i.ownerPersonaId?{title:`Persona · ${B??""}`,onBack:Pt,content:h.jsx(Ooe,{personaId:i.ownerPersonaId,open:!0,onClose:Pt,api:s,embedded:!0,...p?{viewerRole:p}:{}},i.ownerPersonaId)}:null,Xn=X==="full"?h.jsx(Gte,{session:i,meta:bi,...o!==void 0?{liveGitBranch:o}:{},...a!==void 0?{liveWorktreeRoot:a}:{},...M?{personaName:B}:{},...M?{onOpenPersona:()=>N("persona")}:{},...z?{onOpenFiles:()=>N("files")}:{},cronActiveCount:ue.length,onCronClick:()=>N("cron"),onForceStop:()=>tn(!0),...p?{viewerRole:p}:{},...x!=null&&x.toolSessionIdLabel?{toolSessionIdLabel:x.toolSessionIdLabel}:{},drill:hr,...Pe?{onCollapse:Pe}:{},...Be?{title:Be.title,leadingEntries:Be.leadingEntries}:{}}):null;return h.jsxs(h.Fragment,{children:[xe&&Xn?hl.createPortal(Xn,xe):null,h.jsx(Zoe,{headerMeta:bi,connState:e.connState,...a!==void 0?{liveWorktreeRoot:a}:{},...u?{onOpenConfig:u}:{},variant:X,...b?{hideHeader:b}:{},..._?{flatProcess:_}:{},...X==="quickask"?{ephemeral:i.ephemeral!==!1,onPromote:()=>void(m==null?void 0:m(i.sessionId))}:{},lines:K,pendingPermissions:_e,procAlive:ie,rewindableUserMessageIds:st,onPermissionRespond:Gs,onPermissionInterrupt:gt,onRewind:y.rewind?zt:void 0,...d&&y.fork?{onFork:d}:{},...n&&y.fork?{onQuickAsk:n}:f&&y.fork?{onQuickAsk:f}:{},topSlot:qo,realtimeQuestionAnswers:Rr,onSubmitQuestion:Je,onCancelQuestion:hn,liveQuestionToolUseIds:ae,api:s,cwd:i.cwd,...i.tool?{tool:i.tool}:{},sessionKey:i.sessionId,onSend:e.sendText,queued:e.queued,onDequeue:e.dequeue,awaitingUser:_e.length>0||Object.values(E).some(Z=>!Z.submittedAnswers),onAbort:gt,...l?{onNewSession:l}:{},onClearSession:Nl,...v?{configSlot:v}:{},chatRootRef:xn,chatBodyRef:$t,drawers:Ko,xtermSlot:F==="tui"&&ie&&y.tui?h.jsx(_se,{sessionId:i.sessionId,client:$},i.sessionId):null,fileSharingScope:Go,...s?{onShareFile:yt}:{},...s?{onOpenInTab:Yo}:{},...s?{onPreviewMarkdown:It}:{},...s?{onOpenFilePath:Ou}:{},dispatchOrigin:A}),s?h.jsx(Uoe,{open:ns,onOpenChange:wi,relPath:Xo,loadMarkdown:Hp,onShare:Xo?()=>void yt(Xo,"md-rendered"):void 0}):null,S?h.jsx("div",{"data-testid":"share-toast",role:"status","aria-live":"polite",className:S.kind==="ok"?"fixed left-1/2 top-4 z-50 -translate-x-1/2 rounded-md border border-emerald-500/40 bg-emerald-500/10 px-3 py-2 text-[12px] text-emerald-700 shadow-md dark:text-emerald-300":"fixed left-1/2 top-4 z-50 -translate-x-1/2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive shadow-md",children:S.text}):null]})}function Joe({onConfirm:e,onCancel:t}){return h.jsx("div",{role:"dialog","aria-modal":"true","data-testid":"force-stop-confirm",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:t,children:h.jsxs("div",{className:"max-w-sm w-[92%] rounded-lg border border-red-400/40 bg-bg-0 p-4 shadow-xl",onClick:n=>n.stopPropagation(),children:[h.jsxs("div",{className:"flex items-start gap-2 mb-3",children:[h.jsx(Jh,{className:"w-5 h-5 text-red-500 shrink-0 mt-0.5"}),h.jsx("div",{className:"text-[14px] text-text-100",children:"强制停止会话进程?会丢失 initialize / 预热缓存,下一次发送需要重新 spawn。"})]}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx("button",{type:"button",onClick:t,className:"h-8 px-3 rounded-md text-[12px] text-text-300 hover:bg-text-100/5 cursor-pointer",children:"取消"}),h.jsx("button",{type:"button","data-testid":"force-stop-confirm-ok",onClick:e,className:"h-8 px-3 rounded-md bg-red-500 text-white text-[12px] font-medium hover:bg-red-600 cursor-pointer",children:"强制停止"})]})]})})}function eae(e){return e.split("/").pop()||e}function tae({state:e,api:t,onSwitchTab:n,onCloseQuickAsk:r,onCloseMd:i,loadMarkdown:s,quickAskSession:o,onPromoteQuickAsk:a}){if(!dM(e))return null;const l=[];e.quickAsk&&l.push({id:"quick-ask",label:"问一下",title:"问一下",icon:h.jsx(h0,{className:"w-3.5 h-3.5"})});for(const c of e.mds)l.push({id:{kind:"md",relPath:c},label:eae(c),title:c,icon:h.jsx(pi,{className:"w-3.5 h-3.5"})});return h.jsxs("div",{className:"flex flex-col h-full bg-bg-50/60 border-l border-border-strong",children:[h.jsx(lf,{delayDuration:200,skipDelayDuration:100,children:h.jsx("div",{className:["flex items-stretch h-9 border-b border-text-100/10 shrink-0 overflow-x-auto","[scrollbar-width:none] [-ms-overflow-style:none]","[&::-webkit-scrollbar]:hidden"].join(" "),role:"tablist",children:l.map(c=>{const u=Tq(e.active,c.id),d=c.id==="quick-ask"?"quick-ask":`md:${c.id.relPath}`;return h.jsxs(wp,{children:[h.jsx(Sp,{asChild:!0,children:h.jsxs("div",{role:"tab","aria-selected":u,"data-tab-title":c.title,onClick:()=>n(c.id),className:["group relative flex items-center gap-2 px-3 h-full cursor-pointer select-none","text-[12px] max-w-[180px] shrink-0 transition-colors duration-100",u?"text-text-100":"text-text-400 hover:text-text-100 hover:bg-text-100/[0.04]"].join(" "),children:[c.icon,h.jsx("span",{className:"truncate",children:c.label}),h.jsx("button",{type:"button","aria-label":`关闭 ${c.label}`,className:["ml-1 rounded p-0.5 shrink-0 transition-opacity","hover:bg-text-100/10",u?"opacity-70 hover:opacity-100":"opacity-0 group-hover:opacity-70"].join(" "),onClick:f=>{f.stopPropagation(),c.id==="quick-ask"?r():i(c.id.relPath)},children:h.jsx(qr,{className:"w-3 h-3"})}),u?h.jsx("span",{"aria-hidden":"true",className:"absolute left-2 right-2 -bottom-px h-[2px] rounded-full bg-accent"}):null]})}),h.jsx(Nu,{side:"bottom",align:"start",className:"max-w-sm break-all",children:c.title})]},d)})})}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden relative",children:[e.quickAsk&&o?h.jsx("div",{className:"absolute inset-0",style:{display:e.active==="quick-ask"?"block":"none"},children:h.jsx(Qoe,{session:o,api:t,...a?{onPromoteQuickAsk:a}:{}})}):null,e.mds.map(c=>{const u=e.active!==null&&e.active!=="quick-ask"&&e.active.relPath===c;return h.jsx("div",{className:"absolute inset-0",style:{display:u?"block":"none"},children:h.jsx(p4,{relPath:c,loadMarkdown:s,showTitleBar:!1})},`md-body:${c}`)})]})]})}function nae(e){const t=e instanceof Error?e.message:String(e);return t.length>200?`${t.slice(0,200)}…`:t}function rae({state:e,extras:t}){const{api:n,session:r}=t,i=Xi(),[s,o]=g.useState(bq()),[a,l]=g.useState(null),c=r.ownerPersonaId!==OT,u=g.useRef(s);u.current=s;const d=g.useRef(!1),f=g.useCallback(async T=>{const z=u.current.quickAsk;l(null);let I;try{I=await fq(n,r,T)}catch(B){Me("quick-ask","fork failed",B),d.current||l(nae(B));return}if(!I){d.current||l("这条会话还没准备好(没有可派生的对话记录),稍后再试");return}if(d.current){n.sessionDelete(I.sessionId).catch(()=>{});return}Sd(z)&&n.sessionDelete(z.sessionId).catch(()=>{}),o(B=>wq(B,{sessionId:I.sessionId}))},[n,r]),p=g.useCallback(async T=>{const z=u.current.quickAsk,I=(z==null?void 0:z.sessionId)===T;try{await pq(n,{sessionId:T,stillEphemeral:I&&Sd(z)})&&o(M=>Cq(M))}catch(B){Me("quick-ask","promote failed",B)}},[n]),m=g.useCallback(T=>{o(z=>Sq(z,T))},[]),v=g.useCallback(T=>{o(z=>Nq(z,T))},[]),b=g.useCallback(()=>{const T=u.current.quickAsk;Sd(T)&&n.sessionDelete(T.sessionId).catch(()=>{}),o(z=>kq(z))},[n]),_=g.useCallback(T=>{o(z=>Eq(z,T))},[]);g.useEffect(()=>()=>{d.current=!0;const T=u.current.quickAsk;Sd(T)&&n.sessionDelete(T.sessionId).catch(()=>{})},[]);const x=Wi("sessions")??[],y=s.quickAsk?x.find(T=>T.sessionId===s.quickAsk.sessionId)??{sessionId:s.quickAsk.sessionId,cwd:r.cwd,tool:r.tool}:null,S=g.useCallback(async T=>{const z=await Ly(n,i,r.sessionId,T,60),I=await fetch(z);if(!I.ok)throw new Error(`fetch ${I.status} ${I.statusText}`);return I.text()},[n,i,r.sessionId]),C=h.jsx(m4,{state:e,extras:t,onQuickAskInternal:f,onPreviewMdInternal:m}),{initialSize:k,setSize:N}=yq("chat-panel-right-slot-width",480);return h.jsxs(My,{orientation:"horizontal",className:"flex-1 flex min-w-0 min-h-0",children:[h.jsx(cf,{id:"chat",minSize:"400px",children:h.jsxs("div",{className:"relative flex flex-col min-w-0 min-h-0 h-full",children:[C,a?h.jsxs("div",{"data-testid":"quick-ask-error",className:"absolute bottom-24 left-1/2 z-10 -translate-x-1/2 max-w-[90%] rounded-md border border-border bg-bg-200 px-3 py-2 text-[12px] text-text-300 shadow-lg",children:[h.jsxs("span",{className:"mr-2",children:["问一下没能打开:",a]}),h.jsx("button",{type:"button","aria-label":"关闭提示",onClick:()=>l(null),className:"text-text-400 hover:text-text-200 cursor-pointer",children:"✕"})]}):null]})}),dM(s)?h.jsxs(h.Fragment,{children:[h.jsx(iM,{className:"w-1 bg-text-100/10 hover:bg-text-100/25 transition-colors cursor-col-resize"}),h.jsx(cf,{id:"right-slot",defaultSize:`${k}px`,minSize:"360px",maxSize:"800px",onResize:T=>N(T.inPixels),children:h.jsx(tae,{state:s,api:n,onSwitchTab:v,onCloseQuickAsk:b,onCloseMd:_,loadMarkdown:S,quickAskSession:y,...c?{onPromoteQuickAsk:p}:{}})})]}):null]})}function iae({extras:e}){const t=uM(e.session.sessionId);return h.jsx(rae,{state:t,extras:e})}function sae(e,t,n){const r=e?t.find(s=>s.id===e):void 0;if(r!=null&&r.efforts&&r.efforts.length>0)return{options:r.efforts,defaultValue:r.defaultEffort??""};const i=n.find(s=>s.name==="effort");return{options:(i==null?void 0:i.options)??[],defaultValue:typeof(i==null?void 0:i.default)=="string"?i.default:""}}function oae(e,t,n){var l;if(!t)return((l=(e??[]).find(c=>c.id===""))==null?void 0:l.label)??"未指定";const r=t.toLowerCase(),i=[["opus","Opus"],["fable","Fable"],["sonnet","Sonnet"],["haiku","Haiku"]];for(const[c,u]of i){if(!r.includes(c))continue;const d=r.match(new RegExp(`${c}-(\\d+)(?:-(\\d+))?`));return d?d[2]?`${u} ${d[1]}.${d[2]}`:`${u} ${d[1]}`:u}const s=e??[],o=s.find(c=>c.id===t);if(o)return o.label;const a=s.find(c=>c.id&&t.toLowerCase().includes(c.id.toLowerCase()));return a?a.label:t}function aae(e,t){var m,v,b,_;const{models:n,modes:r,configSchema:i}=t,s=e.resolvedModel??e.model,o=sae(s,n,i),a=o.options,l=a.some(x=>x.value===e.effort)?e.effort:o.defaultValue,c=e.effort===""&&e.resolvedEffort?((m=a.find(x=>x.value===e.resolvedEffort))==null?void 0:m.label)??e.resolvedEffort:((v=a.find(x=>x.value===l))==null?void 0:v.label)??null,u=((b=i.find(x=>x.name==="permissionMode"))==null?void 0:b.default)??"",d=r.some(x=>x.id===e.permissionMode)?e.permissionMode:u,p=d===u?null:((_=r.find(x=>x.id===d))==null?void 0:_.label)??null;return{modelLabel:oae(n,s),effortOptions:a,effortValue:l,effortLabel:c,modeValue:d,modeLabel:p,modeTone:p===null?null:d==="bypassPermissions"?"danger":"info"}}function lae(e){let t;return e.map(n=>{const r=n.group&&n.group!==t?n.group:null;return n.group&&(t=n.group),{...n,groupHeading:r}})}function cae({models:e=[],modes:t=[],configSchema:n=[],model:r,resolvedModel:i,resolvedEffort:s,effort:o,permissionMode:a,onPatch:l}){var p;const c=aae({model:r,resolvedModel:i,resolvedEffort:s,effort:o,permissionMode:a},{models:e,modes:t,configSchema:n}),u=i??r,d=e.map(m=>{const v=m.id===""&&i?`${m.description?`${m.description};`:""}当前:${i}`:m.description;return{value:m.id,label:m.label,...v?{description:v}:{},...m.group?{group:m.group}:{}}}),f=t.map(m=>({value:m.id,label:m.label,...m.description?{description:m.description}:{}}));return h.jsxs(CR,{children:[h.jsx(ER,{asChild:!0,children:h.jsxs("button",{type:"button","data-testid":"session-config-chip",title:"Model / reasoning effort / permission mode",className:"inline-flex items-center gap-1 h-7 px-2.5 rounded-full text-[11px] text-text-400 transition-colors outline-none cursor-pointer hover:bg-text-100/5 hover:text-text-200 data-[state=open]:bg-text-100/5",children:[h.jsx("span",{className:"truncate max-w-[120px]","data-testid":"session-config-chip-model",children:u||c.modelLabel}),c.effortLabel?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-500",children:"·"}),h.jsx("span",{className:"truncate max-w-[80px]","data-testid":"session-config-chip-effort",children:c.effortLabel})]}):null,c.modeLabel?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-500",children:"·"}),h.jsx("span",{"data-testid":"session-config-chip-mode","data-tone":c.modeTone,className:ne("font-semibold",c.modeTone==="danger"?"text-red-400":"text-blue-400"),children:c.modeLabel})]}):null]})}),h.jsxs(by,{side:"top",align:"end",className:"w-[230px]","data-testid":"session-config-menu",children:[h.jsx(Ng,{testid:"session-config-model",label:"Model",current:r,currentLabel:c.modelLabel,options:d,onSelect:m=>l({model:m})}),h.jsx(Ng,{testid:"session-config-effort",label:"Reasoning effort",current:c.effortValue,currentLabel:c.effortLabel??"—",options:c.effortOptions,onSelect:m=>l({effort:m})}),f.length>0?h.jsx(Ng,{testid:"session-config-mode",label:"Permission mode",current:c.modeValue,currentLabel:((p=t.find(m=>m.id===c.modeValue))==null?void 0:p.label)??"—",currentTone:c.modeTone,options:f,onSelect:m=>l({permissionMode:m})}):null]})]})}function Ng({testid:e,label:t,current:n,currentLabel:r,currentTone:i,options:s,onSelect:o}){const a=s.length===0;return h.jsxs(gW,{children:[h.jsxs(NR,{"data-testid":e,disabled:a,className:"gap-2 text-[12px]",children:[h.jsx("span",{className:"flex-1 text-text-200",children:t}),h.jsx("span",{className:ne("truncate max-w-[100px]",i==="danger"?"text-red-400 font-semibold":i==="info"?"text-blue-400 font-semibold":"text-text-400"),children:r}),h.jsx(On,{className:"w-3.5 h-3.5 shrink-0 text-text-500"})]}),h.jsx(TR,{className:"w-[220px] max-h-[320px] overflow-y-auto",children:lae(s).map((l,c)=>{const u=l.value===n;return h.jsxs(Ke.Fragment,{children:[l.groupHeading?h.jsxs(h.Fragment,{children:[c>0?h.jsx(wy,{}):null,h.jsx(IR,{"data-testid":`${e}-group`,children:l.groupHeading})]}):null,h.jsxs(so,{"data-testid":`${e}-option-${l.value||"default"}`,onSelect:()=>o(l.value),className:"items-start gap-2",children:[h.jsxs("span",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:ne("block text-[12px]",u?"text-text-100 font-medium":"text-text-300"),children:l.label}),l.description?h.jsx("span",{className:"block text-[11px] text-text-400 mt-0.5",children:l.description}):null]}),u?h.jsx(_u,{className:"w-3.5 h-3.5 shrink-0 text-accent mt-0.5"}):null]})]},l.value||"default")})})]})}function uae(e,t,n=0){const[r,i]=g.useState(null),[s,o]=g.useState(!1),a=g.useCallback(async()=>{if(!t){i(null);return}o(!0);try{const l=await e.getGitBranch(t);i(l.branch??null)}catch{i(null)}finally{o(!1)}},[e,t]);return g.useEffect(()=>{a()},[a,n]),{branch:r,loading:s,refresh:()=>void a()}}function dae(e,t,n=0){const[r,i]=g.useState(null),[s,o]=g.useState(!1),a=g.useCallback(async()=>{if(!t){i(null);return}o(!0);try{const l=await e.getGitRoot(t);i(l.gitRoot??null)}catch{i(null)}finally{o(!1)}},[e,t]);return g.useEffect(()=>{a()},[a,n]),{worktreeRoot:r,loading:s,refresh:()=>void a()}}function hae({api:e,session:t,focused:n,totalPanes:r,onFocus:i,onClose:s,onNewSession:o,onOpenConfig:a,onFork:l,onQuickAsk:c,className:u,viewerRole:d="owner",hideHeader:f}){const{capabilities:p}=d1(t.tool),[m,v]=g.useState(0),{branch:b}=uae(e,t.cwd,m),{worktreeRoot:_}=dae(e,t.cwd,m),x=r>1,y=S=>{e.sessionUpdate(t.sessionId,S).catch(C=>{console.error("[session-config] session:update failed",t.sessionId,C)})};return h.jsxs("div",{className:`group/pane relative flex-1 ${u??"flex"} flex-row min-w-0 min-h-0 overflow-hidden ${x?`rounded-md border transition-colors ${n?"border-accent ring-1 ring-accent":"border-border"}`:""}`,onMouseDown:i,"data-testid":`session-pane-${t.sessionId}`,children:[h.jsx(My,{orientation:"horizontal",className:"flex-1 flex min-w-0 min-h-0",children:h.jsx(cf,{id:"chat",minSize:"400px",children:h.jsx("div",{className:"flex flex-col min-w-0 min-h-0 h-full",children:h.jsx(fae,{api:e,session:t,liveGitBranch:b,liveWorktreeRoot:_,onNewSession:o,onTurnEnd:()=>v(S=>S+1),onOpenConfig:a,onFork:l,onQuickAsk:c,viewerRole:d,hideHeader:f,configSlot:p?h.jsx(cae,{models:p.models,modes:p.permissionModes,configSchema:p.configSchema,model:t.model??"",...t.resolvedModel?{resolvedModel:t.resolvedModel}:{},...t.resolvedEffort?{resolvedEffort:t.resolvedEffort}:{},effort:t.effort??"",permissionMode:t.permissionMode??"",onPatch:y}):null})})})}),x&&h.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),s()},className:"absolute top-1.5 right-1.5 z-10 p-1 rounded-md bg-bg-100/80 backdrop-blur-sm border border-border opacity-0 group-hover/pane:opacity-100 transition-opacity text-text-400 hover:text-text-100 hover:bg-bg-200","aria-label":"close pane","data-testid":`session-pane-close-${t.sessionId}`,children:h.jsx(qr,{className:"w-3.5 h-3.5"})})]})}function fae({api:e,session:t,liveGitBranch:n,liveWorktreeRoot:r,onNewSession:i,onTurnEnd:s,onOpenConfig:o,onFork:a,onQuickAsk:l,viewerRole:c,configSlot:u,hideHeader:d}){return h.jsx(iae,{extras:{session:t,api:e,...n!==void 0?{liveGitBranch:n}:{},...r!==void 0?{liveWorktreeRoot:r}:{},onNewSession:i,onTurnEnd:s,onOpenConfig:o,...a?{onFork:f=>{a(f)}}:{},...l?{onQuickAsk:f=>{l(f)}}:{},...c?{viewerRole:c}:{},...u?{configSlot:u}:{},...d?{hideHeader:d}:{}}})}function pae({personas:e,sessions:t,api:n,selfPrincipalId:r,selectedPersonaId:i,selectedSessionId:s,selectedSession:o,onSelectPersona:a,onSelectSession:l,onCreateSession:c,onDeleteSession:u,onEditSession:d,onCloseSession:f}){return h.jsxs("div",{className:"flex h-screen min-h-0 bg-bg-50","data-testid":"guest-share-page",children:[h.jsx("aside",{className:"w-[280px] shrink-0 overflow-y-auto border-r border-border bg-bg-50",children:h.jsx(iV,{personas:e,sessions:t,activePersonaId:i,activeSessionId:s,onSelectPersona:a,onSelectSession:l,onCreateSession:c,onDeleteSession:u,onEditSession:d,showCopyResume:!1,treatSessionsAsRoots:!0,...r?{ownerPrincipalId:r}:{},isPersonaExpanded:()=>!0})}),h.jsx("main",{className:"flex-1 min-w-0 min-h-0 flex",children:o?h.jsx(hae,{api:n,session:o,focused:!0,totalPanes:1,onFocus:()=>{},onClose:f,onNewSession:()=>{},onOpenConfig:()=>{},viewerRole:"guest"}):h.jsx("div",{className:"flex flex-1 items-center justify-center p-6 text-xs text-text-400","data-testid":"guest-share-empty",children:"选择左侧 persona 开始对话"})})]})}function mae(){const e=Xi(),t=g.useMemo(()=>new Wx(e),[e]),n=d$(e),{sessions:r,refresh:i}=h$(n),{personas:s}=lI(),o=_$(),a=g.useMemo(()=>{const S=window.location.pathname.match(/^\/s\/([^/]+)/);return S?decodeURIComponent(S[1]):null},[]),l=g.useMemo(()=>r.filter(S=>!S.ephemeral&&S.larkChatId==null),[r]),c=g.useMemo(()=>a?s.filter(S=>S.personaId===a):s,[s,a]),[u,d]=g.useState(null),[f,p]=g.useState(null),[m,v]=g.useState(null);g.useEffect(()=>{let S=!1;return e.request("whoami",{}).then(C=>{S||d(C.capability.id)}).catch(()=>{}),()=>{S=!0}},[e]),g.useEffect(()=>{a&&p(a)},[a]);const b=g.useCallback(async(S,C)=>{const k=await t.sessionCreate({ownerPersonaId:S,...C.trim()?{label:C.trim()}:{}});await i(),p(S),v(k.sessionId)},[t,i]),_=g.useCallback(async S=>{await t.sessionDelete(S),await i(),v(C=>C===S?null:C)},[t,i]),x=g.useCallback(async(S,C)=>{await t.sessionUpdate(S,{label:C.label}),await i()},[t,i]),y=g.useMemo(()=>l.find(S=>S.sessionId===m)??null,[l,m]);return h.jsx(Vx.Provider,{value:o,children:h.jsx(pae,{personas:c,sessions:l,api:t,selfPrincipalId:u,selectedPersonaId:f,selectedSessionId:m,selectedSession:y,onSelectPersona:p,onSelectSession:v,onCreateSession:(S,C)=>void b(S,C),onDeleteSession:S=>void _(S),onEditSession:(S,C)=>void x(S,C),onCloseSession:()=>v(null)})})}const i2="https://app.ttcadvisory.com";function gae({onAuthed:e}){const[t,n]=g.useState(!1),[r,i]=g.useState(null),s=g.useRef(null);g.useEffect(()=>()=>{s.current&&window.removeEventListener("message",s.current)},[]);const o=g.useCallback(()=>{s.current&&(window.removeEventListener("message",s.current),s.current=null),n(!0),i(null);const a=window.location.origin,l=`${i2}/auth/authorize?callback_url=${encodeURIComponent(a)}&auto=1`,c=async d=>{if(d.origin!==i2)return;const f=d.data;if((f==null?void 0:f.type)==="AUTH_CANCEL"){u(),n(!1);return}if(!((f==null?void 0:f.type)!=="AUTH_SUCCESS"||!f.token)){u();try{const p=await fetch(`${window.location.origin}/share/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ttcToken:f.token})});if(!p.ok){const v=await p.json().catch(()=>({}));throw new Error(v.code??`exchange failed (${p.status})`)}const m=await p.json();if(!m.visitorToken)throw new Error("no visitorToken in response");e(m.visitorToken)}catch(p){i(p instanceof Error?p.message:String(p)),n(!1)}}},u=()=>{window.removeEventListener("message",c),s.current=null};s.current=d=>void c(d),window.addEventListener("message",s.current),window.open(l,"ttc-login","width=480,height=640")},[e]);return h.jsx("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 font-sans text-text-100","data-testid":"guest-login",children:h.jsxs("div",{className:"flex w-full max-w-xs flex-col gap-3 rounded-lg border border-border bg-bg-100 px-5 py-6",children:[h.jsx("h1",{className:"text-base font-semibold",children:"登录后进入分享"}),h.jsx("p",{className:"text-[11px] leading-snug text-text-400",children:"使用飞书账号登录,即可在浏览器里与分享给你的 persona 交互,无需安装。"}),r?h.jsxs("p",{className:"text-[11px] leading-snug text-error","data-testid":"guest-login-error",children:["登录失败:",r]}):null,h.jsx("button",{type:"button",disabled:t,onClick:()=>o(),"data-testid":"guest-login-button",className:"w-full rounded border border-border bg-bg-50 px-2 py-1.5 text-xs text-text-200 transition-colors hover:bg-text-100/5 hover:text-text-100 disabled:opacity-50",children:t?"请在弹窗中完成授权…":"飞书登录"})]})})}const N_="clawd-visitor:token";function vae(e,t){const r=`${e.protocol==="https:"?"wss:":"ws:"}//${e.host}`;return t!=null&&t.devPath?`${r}${t.devPath}`:r}function _ae(){return{async getUrl(e){const t=localStorage.getItem(N_);if(!t)throw new Error("NO_VISITOR_TOKEN");const n=vae(window.location,{});return await JT(e).upsert({id:"guest",name:"访客",mode:"remote",url:n,token:t}),{url:n}}}}function xae(e){const t=n=>{document.documentElement.classList.toggle("dark",n==="dark")};return t(e.theme.mode),e.onThemeChange(n=>t(n.mode))}function yae(){const e=Xi(),t=g.useMemo(()=>u$(e),[e]);return h.jsx(Vz,{cache:t.cache,children:h.jsx(Gz,{children:h.jsx(mae,{})})})}function bae({host:e}){const[t]=g.useState(()=>localStorage.getItem(N_)),[n,r]=g.useState(!1),[i,s]=g.useState(null);return g.useEffect(()=>xae(e),[e]),g.useEffect(()=>{if(!t)return;let o=!1;return _ae().getUrl(e).then(()=>{o||r(!0)}).catch(a=>{o||s(a instanceof Error?a.message:String(a))}),()=>{o=!0}},[e,t]),t?h.jsx(Lb,{host:e,children:h.jsx(fw,{children:i?h.jsxs("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 text-center text-xs text-error","data-testid":"guest-share-connect-error",children:["连接失败:",i]}):n?h.jsx(Hz,{host:e,children:h.jsx(yae,{})}):h.jsx("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 text-xs text-text-400",children:"正在连接…"})})}):h.jsx(Lb,{host:e,children:h.jsx(fw,{children:h.jsx(gae,{onAuthed:o=>{localStorage.setItem(N_,o),window.location.reload()}})})})}function wae({filePath:e,oldString:t,newString:n,content:r}){const i=g.useMemo(()=>r!=null?r.split(/\r?\n/).map(s=>({type:"add",text:s})):Sae(t??"",n??""),[t,n,r]);return h.jsxs("div",{"data-testid":"inline-diff",className:"min-w-0 max-w-full rounded-lg border border-bg-300/60 bg-bg-50 overflow-hidden text-[12px] font-mono",children:[h.jsx("div",{className:"flex min-w-0 items-center gap-2 px-3 py-1.5 border-b border-bg-300/40 bg-bg-100/30",children:h.jsx("span",{className:"min-w-0 text-text-400 truncate",title:e,children:e})}),h.jsx("div",{className:"max-h-[320px] max-w-full overflow-auto",children:i.map((s,o)=>h.jsxs("div",{"data-testid":`diff-line-${s.type}`,className:ne("flex min-w-max gap-2 px-3 py-0.5 whitespace-pre",s.type==="add"?"bg-success/10 text-success":s.type==="remove"?"bg-error/10 text-error":"text-text-300"),children:[h.jsx("span",{className:"w-3 shrink-0 select-none opacity-60",children:s.type==="add"?"+":s.type==="remove"?"-":" "}),h.jsx("span",{className:"flex-1",children:s.text||" "})]},o))})]})}function Sae(e,t){const n=e.split(/\r?\n/),r=t.split(/\r?\n/),i=n.length,s=r.length,o=Array.from({length:i+1},()=>new Array(s+1).fill(0));for(let u=i-1;u>=0;u--)for(let d=s-1;d>=0;d--)o[u][d]=n[u]===r[d]?o[u+1][d+1]+1:Math.max(o[u+1][d],o[u][d+1]);const a=[];let l=0,c=0;for(;l<i&&c<s;)n[l]===r[c]?(a.push({type:"equal",text:n[l]}),l++,c++):o[l+1][c]>=o[l][c+1]?(a.push({type:"remove",text:n[l]}),l++):(a.push({type:"add",text:r[c]}),c++);for(;l<i;)a.push({type:"remove",text:n[l++]});for(;c<s;)a.push({type:"add",text:r[c++]});return a}function kae({items:e}){return e.length===0?null:h.jsxs("div",{"data-testid":"todo-checklist",className:"rounded-lg border border-bg-300/60 bg-bg-50 px-3 py-2 text-[13px]",children:[h.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-400/70 mb-1.5",children:"Todos"}),h.jsx("ul",{className:"flex flex-col gap-1",children:e.map((t,n)=>{const r=t.status==="in_progress"&&t.activeForm||t.content;return h.jsxs("li",{"data-testid":`todo-item-${t.status}`,className:"flex items-start gap-2",children:[h.jsx(Cae,{status:t.status}),h.jsx("span",{className:ne("flex-1 leading-snug",t.status==="completed"?"text-text-400 line-through":t.status==="in_progress"?"text-text-100 font-medium":"text-text-200"),children:r})]},n)})})]})}function Cae({status:e}){return e==="completed"?h.jsx(qx,{className:"w-3.5 h-3.5 text-success mt-0.5 shrink-0"}):e==="in_progress"?h.jsx(lr,{className:"w-3.5 h-3.5 text-warning mt-0.5 shrink-0 animate-spin"}):h.jsx(Q$,{className:"w-3.5 h-3.5 text-text-400 mt-0.5 shrink-0"})}function Eae(e){const t=e??{};return Array.isArray(t.todos)?t.todos.map(n=>{if(!n||typeof n!="object")return null;const r=n,i=typeof r.content=="string"?r.content:"",s=r.status==="pending"||r.status==="in_progress"||r.status==="completed"?r.status:"pending",o=typeof r.activeForm=="string"?r.activeForm:void 0;return{content:i,status:s,activeForm:o}}).filter(n=>n!==null):[]}function Nae({description:e,prompt:t,subagentType:n}){return h.jsxs("div",{"data-testid":"task-checklist",className:"rounded-lg border border-bg-300/60 bg-bg-50 px-3 py-2 text-[13px]",children:[h.jsxs("div",{className:"flex items-center gap-2 text-text-200 font-medium",children:[h.jsx(ap,{className:"w-3.5 h-3.5 text-accent shrink-0"}),h.jsx("span",{className:"truncate",children:e||"subagent task"}),n?h.jsx("span",{className:"shrink-0 px-1.5 py-0.5 rounded-md text-[10px] font-mono bg-accent/10 text-accent",children:n}):null]}),t?h.jsx("div",{className:"mt-1 text-[12px] text-text-400 leading-snug line-clamp-3",children:t}):null]})}function Tae(e){const t=e??{};return{description:typeof t.description=="string"?t.description:"",prompt:typeof t.prompt=="string"?t.prompt:void 0,subagentType:typeof t.subagent_type=="string"?t.subagent_type:void 0}}const Iae={render:({input:e})=>Ke.createElement(kae,{items:Eae(e)})},Pae={render:({input:e})=>{const{description:t,prompt:n,subagentType:r}=Tae(e);return Ke.createElement(Nae,{description:t,prompt:n,subagentType:r})}},g4={render:({input:e,output:t,error:n,pending:r,fileScope:i,onShareFile:s,onOpenInTab:o,onPreviewMarkdown:a})=>{const l=Mae(e),c=l?Ke.createElement(wae,{filePath:l.filePath,oldString:l.oldString,newString:l.newString,content:l.content}):void 0;return Ke.createElement(EA,{tool:Rae(e),input:e,output:t,error:n,pending:r,expandedBody:c,...i?{fileScope:i}:{},...s?{onShareFile:s}:{},...o?{onOpenInTab:o}:{},...a?{onPreviewMarkdown:a}:{}})}};function Rae(e){const t=e??{};return"content"in t&&t.content!==void 0?"Write":("old_string"in t&&t.old_string!==void 0,"Edit")}function Mae(e){const t=e??{},n=typeof t.file_path=="string"?t.file_path:null;if(!n)return null;const r=typeof t.old_string=="string"?t.old_string:void 0,i=typeof t.new_string=="string"?t.new_string:void 0,s=typeof t.content=="string"?t.content:void 0;return r==null&&i==null&&s==null?null:{filePath:n,oldString:r,newString:i,content:s}}kl.register("claude","TodoWrite",Iae);kl.register("claude","Task",Pae);kl.register("claude","Edit",g4);kl.register("claude","Write",g4);const v4=document.getElementById("root");if(!v4)throw new Error("guest-main: #root not found");const Aae=XL({});Tg.createRoot(v4).render(h.jsx(Ke.StrictMode,{children:h.jsx(bae,{host:Aae})}));
|
package/dist/share-ui/guest.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Clawd 分享</title>
|
|
7
|
-
<script type="module" crossorigin src="/share-ui/assets/guest
|
|
7
|
+
<script type="module" crossorigin src="/share-ui/assets/guest-CGrg1A9a.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/share-ui/assets/guest-UkS4T7xe.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body style="margin: 0">
|