@teammy/server 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/main.js +9204 -6966
- package/dist/project-pi-entry.js +60 -18
- package/dist/runtime/workflows/task-bootstrap/prompt.md +1 -1
- package/dist/web/assets/Assistant-ZM9at-n8.js +1 -0
- package/dist/web/assets/Computers-B9XbkIvb.css +1 -0
- package/dist/web/assets/Computers-CV-4FaxZ.js +3 -0
- package/dist/web/assets/Conversation-B-uSxDxY.css +1 -0
- package/dist/web/assets/Conversation-CZ8mOF1T.js +1 -0
- package/dist/web/assets/Dashboard-DIunax0h.css +1 -0
- package/dist/web/assets/Dashboard-wZpQ1Qxb.js +1 -0
- package/dist/web/assets/Files-DD-tWR-r.js +1 -0
- package/dist/web/assets/Help-DGI26Qe5.js +616 -0
- package/dist/web/assets/Help-DX51vBK7.css +1 -0
- package/dist/web/assets/{HtmlPreview-DcbwgS0C.js → HtmlPreview-TOlZ7wbO.js} +1 -1
- package/dist/web/assets/{Markdown-hcMXu8Z6.js → Markdown-Drn0H2RJ.js} +4 -4
- package/dist/web/assets/MessageComposer-DavJdQPa.css +1 -0
- package/dist/web/assets/MessageComposer-SftlQB1e.js +1 -0
- package/dist/web/assets/{Materials-CK-mbNmo.css → ResourceLibrary-COmSSC8U.css} +1 -1
- package/dist/web/assets/ResourceLibrary-RyTep8PC.js +6 -0
- package/dist/web/assets/WorkspaceTree-BEiahyEL.js +1 -0
- package/dist/web/assets/file-links-BYBi3BDP.js +1 -0
- package/dist/web/assets/index-6PvvMCD7.css +1 -0
- package/dist/web/assets/index-BQicHl1a.js +66 -0
- package/dist/web/assets/workflow-DM6NUqoB.svg +111 -0
- package/dist/web/downloads/teammy-skill.zip +0 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/Assistant-C7QfFYLo.css +0 -1
- package/dist/web/assets/Assistant-Drm0mOLL.js +0 -1
- package/dist/web/assets/Dashboard-C6aBw_W-.css +0 -1
- package/dist/web/assets/Dashboard-DRhlMd50.js +0 -1
- package/dist/web/assets/Files-BP2rAhTa.js +0 -1
- package/dist/web/assets/Materials-CTSi5rOS.js +0 -6
- package/dist/web/assets/Memory-C-z-5rpe.css +0 -1
- package/dist/web/assets/Memory-H9tRDj1a.js +0 -1
- package/dist/web/assets/Sessions-BwXwXx6i.css +0 -1
- package/dist/web/assets/Sessions-CvUoOrHZ.js +0 -1
- package/dist/web/assets/WorkspaceTree-D52TBZvy.js +0 -1
- package/dist/web/assets/file-links-QvRdAx7G.js +0 -1
- package/dist/web/assets/index-Bb8MF7Vk.js +0 -66
- package/dist/web/assets/index-Swfty9kO.css +0 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1680" height="1052" viewBox="0 0 1680 1052" role="img" aria-labelledby="diagram-title diagram-description">
|
|
2
|
+
<title id="diagram-title">Teammy 协作循环</title>
|
|
3
|
+
<desc id="diagram-description">工作循环:本地 Agent 上报任务和进展,服务端统筹分配、下发任务,本地继续执行。决策循环:服务端向人类发送消息,人类接收、判断并向本地 Agent 给出执行要求,本地工作产生的信息回到服务端。外围展示服务端专业角色、本地目录分工、代码平台和共享项目背景。</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<marker id="arrow-work" viewBox="0 0 12 12" refX="9" refY="6" markerWidth="8" markerHeight="8" orient="auto-start-reverse" markerUnits="userSpaceOnUse"><path d="M2 2L9 6L2 10" fill="none" stroke="#b75639" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></marker><marker id="arrow-human" viewBox="0 0 12 12" refX="9" refY="6" markerWidth="8" markerHeight="8" orient="auto-start-reverse" markerUnits="userSpaceOnUse"><path d="M2 2L9 6L2 10" fill="none" stroke="#70639f" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></marker><marker id="arrow-branch" viewBox="0 0 12 12" refX="9" refY="6" markerWidth="6" markerHeight="6" orient="auto-start-reverse" markerUnits="userSpaceOnUse"><path d="M2 2L9 6L2 10" fill="none" stroke="#96918c" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></marker>
|
|
6
|
+
<pattern id="dots" width="19" height="19" patternUnits="userSpaceOnUse"><circle cx="1" cy="1" r="0.7" fill="#bdb5aa" opacity=".35"/></pattern>
|
|
7
|
+
<style>
|
|
8
|
+
text{font-family:-apple-system,BlinkMacSystemFont,'PingFang SC','Noto Sans CJK SC','Microsoft YaHei',sans-serif} .mono{font-family:'SFMono-Regular',Consolas,monospace}
|
|
9
|
+
.node,.route,.annotation,.branch,.loop-summary{transition:opacity .25s ease}.node{cursor:pointer;outline:none}.node:focus-visible .node-hit,.node.selected .node-hit{stroke:#82796a;stroke-width:2.3}.node:hover .node-hit{stroke-width:2}.dimmed{opacity:.1}.branch-hidden .branch{opacity:0;pointer-events:none}.mode-work .human:not(.shared){opacity:.09}.mode-human .work:not(.shared){opacity:.09}.mode-work [data-node=human]{opacity:.09;pointer-events:none}.mode-work .branch,.mode-human .branch{opacity:.22}.branch-hidden.mode-work .branch,.branch-hidden.mode-human .branch{opacity:0}.paused .particle{display:none}
|
|
10
|
+
@media(prefers-reduced-motion:reduce){.particle{display:none}.node,.route,.annotation,.branch{transition:none}}
|
|
11
|
+
</style>
|
|
12
|
+
</defs>
|
|
13
|
+
<rect width="1680" height="1052" fill="#f5f3ed"/>
|
|
14
|
+
<rect x="382" y="192" width="916" height="674" fill="url(#dots)" opacity=".44"/>
|
|
15
|
+
<path d="M 495 420 C495 300 600 208 840 208 C1080 208 1185 300 1185 420" fill="none" stroke="#d7d1e4" stroke-width="48" opacity=".18"/>
|
|
16
|
+
<path d="M 660 531 C 770 490 910 490 1020 531" fill="none" stroke="#e6c5b7" stroke-width="50" opacity=".18"/>
|
|
17
|
+
|
|
18
|
+
<g aria-hidden="true">
|
|
19
|
+
<text x="64" y="42" font-size="11" fill="#77747b" class="mono" letter-spacing="1.8">COLLABORATION MAP</text>
|
|
20
|
+
<text x="64" y="111" font-size="44" fill="#242329" font-weight="500" letter-spacing="-1.4">Teammy 协作循环</text>
|
|
21
|
+
<path d="M64 166H1616" stroke="#d5d1ca"/>
|
|
22
|
+
</g>
|
|
23
|
+
|
|
24
|
+
<g class="branch route" data-edge="roles-link" data-source="server" data-target="roles"><path d="M 405 540 L 317 540" fill="none" stroke="#96918c" stroke-width="1.3" stroke-dasharray="3 6" stroke-linecap="round" marker-end="url(#arrow-branch)" marker-start="url(#arrow-branch)"/></g><g class="branch route" data-edge="directory-link" data-source="local" data-target="directories"><path d="M 1275 540 L 1363 540" fill="none" stroke="#96918c" stroke-width="1.3" stroke-dasharray="3 6" stroke-linecap="round" marker-end="url(#arrow-branch)" marker-start="url(#arrow-branch)"/></g><g class="branch route" data-edge="project-context" data-source="knowledge" data-target="server"><path d="M 394 956 C 339 956, 340 724, 444 633" fill="none" stroke="#96918c" stroke-width="1.3" stroke-dasharray="3 6" stroke-linecap="round" marker-end="url(#arrow-branch)" marker-start="url(#arrow-branch)"/></g><g class="branch route" data-edge="sync" data-source="local" data-target="knowledge"><path d="M 1236 633 C 1340 724, 1341 956, 1289 956" fill="none" stroke="#96918c" stroke-width="1.3" stroke-dasharray="3 6" stroke-linecap="round" marker-end="url(#arrow-branch)" /></g><g class="branch route" data-edge="pr-event" data-source="git" data-target="roles"><path d="M 189 907 L 189 662" fill="none" stroke="#96918c" stroke-width="1.3" stroke-dasharray="3 6" stroke-linecap="round" marker-end="url(#arrow-branch)" /></g>
|
|
25
|
+
<g class="route primary work" data-edge="dispatch" data-source="server" data-target="local">
|
|
26
|
+
<path id="path-dispatch" d="M 660 530 C 770 490, 910 490, 1017 530" fill="none" stroke="#b75639" stroke-width="2.8" stroke-linecap="round" marker-end="url(#arrow-work)"/>
|
|
27
|
+
<circle r="4.2" class="particle" fill="#b75639" stroke="#f5f3ed" stroke-width="2"><animateMotion dur="5.2s" repeatCount="indefinite" path="M 660 530 C 770 490, 910 490, 1017 530"/></circle>
|
|
28
|
+
</g><g class="route primary work" data-edge="report-work" data-source="local" data-target="server">
|
|
29
|
+
<path id="path-report-work" d="M 1146 667 C 1146 830, 534 830, 534 669" fill="none" stroke="#b75639" stroke-width="2.8" stroke-linecap="round" marker-end="url(#arrow-work)"/>
|
|
30
|
+
<circle r="4.2" class="particle" fill="#b75639" stroke="#f5f3ed" stroke-width="2"><animateMotion dur="7.8s" repeatCount="indefinite" path="M 1146 667 C 1146 830, 534 830, 534 669"/></circle>
|
|
31
|
+
</g><g class="route primary human" data-edge="notify" data-source="server" data-target="human">
|
|
32
|
+
<path id="path-notify" d="M 493 420 C 493 332, 565 278, 671 278" fill="none" stroke="#70639f" stroke-width="2.8" stroke-linecap="round" marker-end="url(#arrow-human)"/>
|
|
33
|
+
<circle r="4.2" class="particle" fill="#70639f" stroke="#f5f3ed" stroke-width="2"><animateMotion dur="5.5s" repeatCount="indefinite" path="M 493 420 C 493 332, 565 278, 671 278"/></circle>
|
|
34
|
+
</g><g class="route primary human" data-edge="decide" data-source="human" data-target="local">
|
|
35
|
+
<path id="path-decide" d="M 1008 278 C 1115 278, 1187 332, 1187 419" fill="none" stroke="#70639f" stroke-width="2.8" stroke-linecap="round" marker-end="url(#arrow-human)"/>
|
|
36
|
+
<circle r="4.2" class="particle" fill="#70639f" stroke="#f5f3ed" stroke-width="2"><animateMotion dur="5.8s" repeatCount="indefinite" path="M 1008 278 C 1115 278, 1187 332, 1187 419"/></circle>
|
|
37
|
+
</g><g class="route primary human" data-edge="report-human" data-source="local" data-target="server">
|
|
38
|
+
<path id="path-report-human" d="M 1162 665 C 1162 848, 518 848, 518 668" fill="none" stroke="#70639f" stroke-width="2.8" stroke-linecap="round" marker-end="url(#arrow-human)"/>
|
|
39
|
+
<circle r="4.2" class="particle" fill="#70639f" stroke="#f5f3ed" stroke-width="2"><animateMotion dur="8.5s" repeatCount="indefinite" path="M 1162 665 C 1162 848, 518 848, 518 668"/></circle>
|
|
40
|
+
</g>
|
|
41
|
+
|
|
42
|
+
<g class="node human" data-node="human" role="button" tabindex="0" aria-label="人类决策:接收消息、补充信息、作出决定">
|
|
43
|
+
<rect class="node-hit" x="675" y="215" width="330" height="126" rx="63" fill="#e5def0" stroke="#cec3df"/>
|
|
44
|
+
<text x="840" y="271" font-size="26" fill="#3e354c" text-anchor="middle" font-weight="500">人类决策</text>
|
|
45
|
+
<text x="840" y="304" font-size="14" fill="#756982" text-anchor="middle" >网页 · 企业微信</text>
|
|
46
|
+
</g>
|
|
47
|
+
|
|
48
|
+
<g class="node shared" data-node="server" role="button" tabindex="0" aria-label="服务端 Agent Tim:理解项目、统筹分配、协调事项">
|
|
49
|
+
<circle class="node-hit" cx="534" cy="540" r="126" fill="#28252c" stroke="#28252c"/>
|
|
50
|
+
<circle cx="534" cy="540" r="115" fill="none" stroke="#4a444e" stroke-width=".7"/>
|
|
51
|
+
<text x="534" y="482" font-size="14" fill="#bbb2c0" text-anchor="middle" >服务端 Agent</text>
|
|
52
|
+
<text x="534" y="534" font-size="42" fill="#faf6f0" text-anchor="middle" font-weight="500">Tim</text>
|
|
53
|
+
<path d="M497 551H571" stroke="#716574"/>
|
|
54
|
+
<text x="534" y="584" font-size="15" fill="#e0d7dd" text-anchor="middle" >统筹 · 分配 · 跟进</text>
|
|
55
|
+
</g>
|
|
56
|
+
|
|
57
|
+
<g class="node shared" data-node="local" role="button" tabindex="0" aria-label="本地 Agent:接收任务、执行、维护进展和上报">
|
|
58
|
+
<circle class="node-hit" cx="1146" cy="540" r="126" fill="#ebd3c3" stroke="#d4b5a1"/>
|
|
59
|
+
<circle cx="1146" cy="540" r="115" fill="none" stroke="#d4b5a1" stroke-width=".7"/>
|
|
60
|
+
<text x="1146" y="534" font-size="30" fill="#46372f" text-anchor="middle" font-weight="500">本地 Agent</text>
|
|
61
|
+
<path d="M1109 551H1183" stroke="#c5a58f"/>
|
|
62
|
+
<text x="1146" y="584" font-size="15" fill="#6c5141" text-anchor="middle" >执行 · 更新进展</text>
|
|
63
|
+
</g>
|
|
64
|
+
|
|
65
|
+
<g class="annotation human"><text x="604" y="371" font-size="16" fill="#70639f" text-anchor="middle" font-weight="500">通知与提问</text></g>
|
|
66
|
+
<g class="annotation human"><text x="1076" y="371" font-size="16" fill="#70639f" text-anchor="middle" font-weight="500">确认与委托</text></g>
|
|
67
|
+
<g class="annotation work"><text x="840" y="479" font-size="16" fill="#b75639" text-anchor="middle" font-weight="500">任务下发</text></g>
|
|
68
|
+
|
|
69
|
+
<g class="annotation work">
|
|
70
|
+
<text x="840" y="637" font-size="23" fill="#b75639" text-anchor="middle" font-weight="500">01 工作循环</text>
|
|
71
|
+
</g>
|
|
72
|
+
<g class="annotation human">
|
|
73
|
+
<text x="840" y="406" font-size="18" fill="#70639f" text-anchor="middle" font-weight="500">02 决策循环</text>
|
|
74
|
+
</g>
|
|
75
|
+
|
|
76
|
+
<g class="shared annotation">
|
|
77
|
+
<rect x="730" y="812" width="220" height="30" fill="#f5f3ed"/>
|
|
78
|
+
<circle cx="754" cy="827" r="3.5" fill="#b75639"/><circle cx="766" cy="827" r="3.5" fill="#70639f"/>
|
|
79
|
+
<text x="781" y="832" font-size="16" fill="#5e5458" font-weight="500">进展与结果上报</text>
|
|
80
|
+
</g>
|
|
81
|
+
|
|
82
|
+
<g class="branch node" data-node="roles" role="button" tabindex="0" aria-label="服务端分工" transform="translate(64 429)">
|
|
83
|
+
<rect class="node-hit" width="250" height="230" fill="#f5f3ed" stroke="#d5d1ca"/>
|
|
84
|
+
<text x="18" y="30" font-size="12" fill="#77747b" letter-spacing="1.2">服务端分工</text>
|
|
85
|
+
<path d="M18 47H232" stroke="#d5d1ca"/>
|
|
86
|
+
<g transform="translate(18 77)"><text x="0" y="0" font-size="16" fill="#242329" font-weight="500">会话 Agent</text><path d="M0 36H214" stroke="#e3dfd8"/></g><g transform="translate(18 133)"><text x="0" y="0" font-size="16" fill="#242329" font-weight="500">事项负责人</text><text x="0" y="23" font-size="12" fill="#77747b" >通用 / MR / 资料</text><path d="M0 36H214" stroke="#e3dfd8"/></g><g transform="translate(18 189)"><text x="0" y="0" font-size="16" fill="#242329" font-weight="500">专业协作者</text></g>
|
|
87
|
+
</g>
|
|
88
|
+
<g class="branch node" data-node="directories" role="button" tabindex="0" aria-label="本地分工" transform="translate(1366 429)">
|
|
89
|
+
<rect class="node-hit" width="250" height="230" fill="#f5f3ed" stroke="#d5d1ca"/>
|
|
90
|
+
<text x="18" y="30" font-size="12" fill="#77747b" letter-spacing="1.2">本地分工</text>
|
|
91
|
+
<path d="M18 47H232" stroke="#d5d1ca"/>
|
|
92
|
+
<g transform="translate(18 77)"><text x="0" y="0" font-size="16" fill="#242329" font-weight="500">本地协调 Agent</text><text x="0" y="23" font-size="12" fill="#77747b" >选择目录</text><path d="M0 36H214" stroke="#e3dfd8"/></g><g transform="translate(18 133)"><text x="0" y="0" font-size="16" fill="#242329" font-weight="500">目录 Agent</text><path d="M0 36H214" stroke="#e3dfd8"/></g><g transform="translate(18 189)"><text x="0" y="0" font-size="16" fill="#242329" font-weight="500">网页 / 专用群</text><text x="0" y="23" font-size="12" fill="#77747b" >问答 · 审批</text></g>
|
|
93
|
+
</g>
|
|
94
|
+
<g class="branch">
|
|
95
|
+
<text x="212" y="803" font-size="13" fill="#77747b" >触发评审</text>
|
|
96
|
+
<text x="350" y="875" font-size="12" fill="#96918c" >查询</text>
|
|
97
|
+
<text x="1310" y="875" font-size="12" fill="#96918c" >同步</text>
|
|
98
|
+
</g>
|
|
99
|
+
|
|
100
|
+
<g class="branch node" data-node="git" role="button" tabindex="0" aria-label="代码平台:代码仓库与 PR/MR 事件">
|
|
101
|
+
<rect class="node-hit" x="64" y="910" width="250" height="88" fill="#eeebe4" stroke="#d5d1ca"/>
|
|
102
|
+
<text x="84" y="947" font-size="19" fill="#242329" font-weight="500">代码平台</text>
|
|
103
|
+
<text x="84" y="977" font-size="13" fill="#77747b" >仓库 · PR / MR</text>
|
|
104
|
+
</g>
|
|
105
|
+
|
|
106
|
+
<g class="branch node" data-node="knowledge" role="button" tabindex="0" aria-label="共享项目背景:工作区与看板、会话库、资料与记忆、事项与事件">
|
|
107
|
+
<rect class="node-hit" x="394" y="910" width="892" height="88" fill="#eeebe4" stroke="#d5d1ca"/>
|
|
108
|
+
<text x="416" y="936" font-size="11" fill="#77747b" letter-spacing="1.3">共享项目背景</text>
|
|
109
|
+
<g transform="translate(416 974)"><text x="0" y="0" font-size="16" fill="#242329" font-weight="500">工作区与看板</text><path d="M198 -15V5" stroke="#d6d0c7"/></g><g transform="translate(634 974)"><text x="0" y="0" font-size="16" fill="#242329" font-weight="500">会话库</text><path d="M198 -15V5" stroke="#d6d0c7"/></g><g transform="translate(852 974)"><text x="0" y="0" font-size="16" fill="#242329" font-weight="500">资料与记忆</text><path d="M198 -15V5" stroke="#d6d0c7"/></g><g transform="translate(1070 974)"><text x="0" y="0" font-size="16" fill="#242329" font-weight="500">事项与事件</text></g>
|
|
110
|
+
</g>
|
|
111
|
+
</svg>
|
|
Binary file
|
package/dist/web/index.html
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<meta name="theme-color" content="#161615" />
|
|
7
7
|
<title>Teammy 工作台</title>
|
|
8
8
|
<link rel="icon" type="image/png" href="./assets/teammy-favicon-BiDvlPj2.png" />
|
|
9
|
-
<script type="module" crossorigin src="./assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-BQicHl1a.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="./assets/index-6PvvMCD7.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root" data-teammy-ui-version="11"></div>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
main#main[data-page=assistant]{height:100dvh;padding:0}.assistant-layout{grid-template-columns:var(--pane-width) minmax(0, 1fr);height:100%;min-height:0}.assistant-list{border-right:1px solid var(--color-line);background:var(--color-surface);flex-direction:column;min-height:0;display:flex}.assistant-list-heading,.assistant-thread-heading{border-bottom:1px solid var(--color-line);flex:0 0 76px;justify-content:space-between;align-items:center;padding:0 24px;display:flex}.assistant-list-heading h1{margin:0;font-size:20px}.assistant-thread-heading h2{text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:17px;overflow:hidden}.assistant-message-scroll{flex:1;min-height:0;overflow-y:auto}.assistant-list-status{color:var(--color-muted);font-size:var(--text-sm);margin:20px 24px}.assistant-message-item{border:0;border-bottom:1px solid var(--color-line);text-align:left;width:100%;color:var(--color-text);background:0 0;border-radius:0;align-items:center;gap:12px;padding:20px 24px;display:flex}.assistant-message-item:hover{background:var(--color-hover)}.assistant-message-item.selected{background:var(--color-soft)}.assistant-message-item.archived{color:var(--color-muted)}.assistant-message-item.archived strong{font-weight:400}.assistant-new-chat{width:32px;height:32px;min-height:32px;color:var(--brand-orange);background:var(--color-accent-soft);padding:6px}.assistant-new-chat .icon{width:20px;height:20px}.assistant-new-chat:after{top:calc(100% + 6px);bottom:auto}.assistant-message-copy{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.assistant-message-copy>.selection-content{width:fit-content;max-width:100%;color:var(--color-text);margin:-5px -8px;padding:5px 8px;display:block;overflow:visible}.assistant-message-item.archived .selection-content{color:inherit}.assistant-message-copy .selection-inner{min-width:0;display:block}.assistant-message-copy .selection-inner strong{display:block}.assistant-message-copy strong,.assistant-message-copy>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.assistant-message-copy strong{font-size:var(--text-base);font-weight:600}.assistant-message-copy>span,.assistant-message-copy time{font-size:var(--text-xs);color:var(--color-muted)}.assistant-message-dot{border-radius:50%;flex:0 0 7px;width:7px;height:7px}.assistant-message-dot.unread{background:var(--brand-orange)}.assistant-thread{background:var(--color-canvas);flex-direction:column;min-width:0;min-height:0;display:flex}.assistant-transcript{flex:1;min-height:0;padding:28px clamp(20px,4vw,64px);overflow-y:auto}.assistant-matter-state{border-bottom:1px solid var(--color-line);color:var(--color-muted);font-size:var(--text-xs);overflow-wrap:anywhere;padding:10px 28px;line-height:1.6}.assistant-bubble-row{margin:0 0 24px;display:flex}.assistant-bubble-row.mine{justify-content:flex-end}.assistant-bubble{border-radius:4px var(--radius-lg) var(--radius-lg);background:var(--color-soft);overflow-wrap:anywhere;min-width:100px;max-width:min(88%,800px);padding:14px 18px}.assistant-bubble-row.mine .assistant-bubble{background:var(--color-accent-soft);border-radius:var(--radius-lg) 4px var(--radius-lg) var(--radius-lg)}.assistant-bubble-meta{font-size:var(--text-xs);color:var(--color-muted);align-items:baseline;gap:16px;margin-bottom:8px;display:flex}.assistant-debug-reply{font-size:var(--text-xs);background:var(--color-surface);margin-top:12px;padding:4px 10px}.assistant-bubble .markdown>:first-child{margin-top:0}.assistant-bubble .markdown>:last-child{margin-bottom:0}.assistant-bubble .markdown{font-size:var(--text-base);line-height:1.75}.assistant-bubble .markdown h1,.assistant-bubble .markdown h2{font-size:18px}.assistant-bubble .markdown h3,.assistant-bubble .markdown h4,.assistant-bubble .markdown h5,.assistant-bubble .markdown h6{font-size:var(--text-base)}.assistant-bubble .markdown :is(h1,h2,h3,h4,h5,h6){margin:18px 0 8px;line-height:1.5}.assistant-bubble .markdown :is(p,ul,ol){margin:10px 0}.assistant-bubble .markdown :is(ul,ol){padding-left:1.5em}.assistant-bubble .markdown li+li{margin-top:4px}.assistant-bubble .markdown li>:is(ul,ol){margin:4px 0}.assistant-bubble pre{max-width:100%;overflow-x:auto}.assistant-composer{background:var(--color-surface);border:1px solid var(--color-line);border-radius:var(--radius-lg);align-items:flex-end;gap:12px;margin:0 28px 28px;padding:12px;display:flex}.assistant-reply-hint{font-size:var(--text-xs);color:var(--color-muted);margin:0 28px 10px;line-height:1.7}.assistant-composer:focus-within{border-color:var(--color-muted)}.assistant-composer textarea{box-shadow:none;resize:vertical;background:0 0;border:0;flex:1;min-height:56px;max-height:220px;padding:8px}.assistant-composer textarea:focus{box-shadow:none;outline:none}.assistant-send{flex:0 0 40px;place-items:center;width:40px;height:40px;padding:0;display:grid}.assistant-empty{height:100%;min-height:240px;color:var(--color-muted);flex-direction:column;justify-content:center;align-items:center;gap:20px;display:flex}.assistant-empty .mascot{width:96px;height:144px}.assistant-empty p{margin:0}.assistant-archived{color:var(--color-muted);font-size:var(--text-sm);justify-content:center;align-items:center;gap:8px;padding:24px;display:flex}.assistant-thread>.notice{margin:0 28px 12px}.assistant-typing{gap:5px;padding:8px 0;display:inline-flex}.assistant-typing i{background:var(--color-muted);border-radius:50%;width:5px;height:5px;animation:1.4s infinite assistant-pulse}.assistant-typing i:nth-child(2){animation-delay:.15s}.assistant-typing i:nth-child(3){animation-delay:.3s}@keyframes assistant-pulse{0%,70%,to{opacity:.35}35%{opacity:1}}@media (prefers-reduced-motion:reduce){.assistant-typing i{animation:none}}@media (width<=900px){.assistant-layout{grid-template-columns:240px minmax(0,1fr)}.assistant-message-item{padding:16px}.assistant-composer{margin:0 16px 16px}.assistant-reply-hint{margin:0 16px 10px}.assistant-bubble{max-width:96%}}@media (width<=600px){.assistant-layout{grid-template-columns:150px minmax(0,1fr)}.assistant-list-heading,.assistant-thread-heading{padding:0 12px}.assistant-transcript{padding:16px 10px}.assistant-composer{gap:4px;margin:0 8px 12px;padding:6px}.assistant-reply-hint{margin:0 8px 10px}}.assistant-participants{text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:45%;color:var(--color-muted);font-size:var(--text-sm);margin-left:16px;overflow:hidden}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,K as t,M as n,N as r,P as i,S as a,X as o,Y as s,a as c,b as l,i as u,j as d,k as f,m as p,n as m,nt as ee,o as h,p as g,r as te,t as ne,tt as _,w as v,x as re}from"./index-Bb8MF7Vk.js";import{t as y}from"./Markdown-hcMXu8Z6.js";var b=_(),x=n(),S=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),C=e=>e.replace(/[#*_`>]/g,``).replace(/\s+/g,` `).trim();function w({mine:e=!1,author:t,time:n,children:r}){return(0,x.jsx)(`div`,{className:`assistant-bubble-row ${e?`mine`:``}`,children:(0,x.jsxs)(`div`,{className:`assistant-bubble`,children:[(0,x.jsxs)(`div`,{className:`assistant-bubble-meta`,children:[(0,x.jsx)(`span`,{children:t}),(0,x.jsx)(`time`,{dateTime:n,children:S(n)})]}),r]})})}function T({me:n}){let{projectId:_,request:T}=p(),E=d(),ae=e(_,n,`assistant-selection`),D=e(_,n,`assistant-drafts`),oe=(0,b.useCallback)(e=>T(`agents/outbox`,c,{signal:e}),[T]),O=f(oe,3e3,e(_,n,`outbox`)),se=(0,b.useCallback)(e=>T(`agents/chats`,ne,{signal:e}),[T]),k=f(se,3e3,e(_,n,`chats`)),[A,ce]=(0,b.useState)(()=>{let e=new URLSearchParams(location.search),t=e.get(`chat`);return t?`chat:${t}`:e.get(`message`)??E?.get(ae)??``}),j=A.startsWith(`chat:`)?A.slice(5):``,M=!A||!!j,[N,P]=(0,b.useState)(()=>E?.get(e(_,n,`chat`,j))),F=N?.id===j?N:E?.get(e(_,n,`chat`,j)),le=k.data?.chats.find(e=>e.id===j),[ue,I]=(0,b.useState)(),[L,R]=(0,b.useState)(()=>E?.get(D)??{}),z=L[A]??``,B=e=>R(t=>({...t,[A]:e})),[V,H]=(0,b.useState)(!1),[U,de]=(0,b.useState)(!1),[fe,W]=(0,b.useState)(``),[pe,G]=(0,b.useState)(``),K=(0,b.useRef)(new Map),me=(0,b.useRef)(null),q=(0,b.useRef)(!0),J=(0,b.useRef)(A);J.current=A,(0,b.useEffect)(()=>{N&&E?.set(e(_,n,`chat`,N.id),N)},[E,_,n,N]),(0,b.useEffect)(()=>{E?.set(D,L)},[E,D,L]);function Y(e){J.current=e,ce(e),E?.set(ae,e);let t=new URL(location.href);e.startsWith(`chat:`)?t.searchParams.set(`chat`,e.slice(5)):t.searchParams.delete(`chat`),e&&!e.startsWith(`chat:`)&&e!==`debug`?t.searchParams.set(`message`,e):t.searchParams.delete(`message`),history.replaceState(history.state,``,t)}(0,b.useEffect)(()=>{!A&&k.data?.chats.length&&Y(`chat:${k.data.chats[0].id}`)},[A,k.data]);let X=(O.data?.messages??[]).filter(e=>e.box===`debug`).reverse(),Z=O.data?.messages.find(e=>e.id===(A===`debug`?ue:A));(0,b.useEffect)(()=>{A!==`debug`&&Z?.conversationId&&Y(`chat:${Z.conversationId}`)},[A,Z?.conversationId]);let Q=X.filter(e=>!e.readAt).map(e=>e.id).join(`,`);(0,b.useEffect)(()=>{Z&&!Z.readAt&&A!==`debug`&&T(`agents/outbox/${Z.id}/read`,h,{method:`POST`}).then(()=>{window.dispatchEvent(new Event(`teammy:outbox`)),O.reload()}).catch(e=>W(i(e)))},[Z?.id,Z?.readAt,A,T,O.reload]),(0,b.useEffect)(()=>{A===`debug`&&Q&&Promise.all(Q.split(`,`).map(e=>T(`agents/outbox/${e}/read`,h,{method:`POST`}))).then(()=>{window.dispatchEvent(new Event(`teammy:outbox`)),O.reload()}).catch(e=>W(i(e)))},[A,Q,T,O.reload]),(0,b.useEffect)(()=>{if(G(``),!j)return;let t=!0,a=-1,c=!1,l=new AbortController,d=e=>{!t||e.id!==j||e.cursor<a||(a=e.cursor,c=!0,e.redirect?Y(`chat:${e.redirect}`):(P(e),G(``)))};T(`agents/chats/${j}`,m,{signal:l.signal}).then(d).catch(a=>{t&&!l.signal.aborted&&(a instanceof r&&[401,403,404].includes(a.status)&&(E?.delete(e(_,n,`chat`,j)),P(e=>e?.id===j?void 0:e)),c||G(i(a)))});let f=e=>{let n=Number(e.lastEventId);return!t||!Number.isSafeInteger(n)||n<=a?!1:(a=n,!0)},p=new EventSource(ee(`/api/v1/projects/${encodeURIComponent(_)}/agents/chats/${encodeURIComponent(j)}/events`));p.addEventListener(`snapshot`,e=>{if(t)try{d(m.parse(JSON.parse(e.data)))}catch(e){G(i(e))}}),p.onerror=()=>{t&&G(`对话连接中断,正在重新连接…`)},p.addEventListener(`context`,e=>{if(!f(e))return;let t=m.pick({kind:!0,title:!0,status:!0,visibility:!0,participants:!0,pending:!0,hold:!0,redirect:!0}).parse(JSON.parse(e.data));t.redirect?Y(`chat:${t.redirect}`):P(e=>e?.id===j?{...e,...t,cursor:a}:e)}),p.addEventListener(`message`,e=>{if(!f(e))return;let t=te.parse(JSON.parse(e.data));P(n=>n?.id===j?{...n,readCursor:Math.max(n.readCursor,t.seq),cursor:Math.max(n.cursor,Number(e.lastEventId)||0),messages:[...n.messages.filter(e=>e.id!==t.id),t].sort((e,t)=>e.seq-t.seq)}:n)}),p.addEventListener(`message_removed`,e=>{if(!f(e))return;let{id:t}=s({id:o()}).parse(JSON.parse(e.data));P(e=>e?.id===j?{...e,cursor:a,messages:e.messages.filter(e=>e.id!==t)}:e)}),p.addEventListener(`run`,e=>{if(!f(e))return;let t=u.parse(JSON.parse(e.data));P(n=>n?.id===j?{...n,cursor:Math.max(n.cursor,Number(e.lastEventId)||0),runs:n.runs.some(e=>e.id===t.id)?n.runs:[...n.runs,t]}:n)});for(let e of[`delta`,`reset`,`state`])p.addEventListener(e,t=>{if(!f(t))return;let n=JSON.parse(t.data);P(r=>r?.id===j?{...r,cursor:Math.max(r.cursor,Number(t.lastEventId)||0),messages:r.messages.map(t=>t.runId!==n.id||t.role!==`assistant`?t:{...t,body:e===`delta`?t.body+(n.text??``):e===`reset`?``:n.answer??t.body,state:n.state??t.state}),runs:r.runs.map(t=>t.id===n.id?{...t,answer:e===`delta`?t.answer+(n.text??``):e===`reset`?``:n.answer??t.answer,state:n.state??t.state,error:n.error===void 0?t.error:n.error}:t)}:r)});return()=>{t=!1,l.abort(),p.close()}},[_,j,n,T,E]),(0,b.useEffect)(()=>{if(!F?.kind||F.id!==j)return;let e=()=>{document.visibilityState===`visible`&&T(`agents/chats/${j}/read`,s({ok:t()}),{method:`POST`,body:{cursor:F.readCursor}}).then(()=>{k.reload(),window.dispatchEvent(new Event(`teammy:outbox`))}).catch(e=>W(i(e)))},n=setTimeout(e,300);return document.addEventListener(`visibilitychange`,e),()=>{clearTimeout(n),document.removeEventListener(`visibilitychange`,e)}},[j,F?.readCursor,F?.kind,T]),(0,b.useEffect)(()=>{q.current&&me.current?.scrollIntoView({block:`end`})},[A,N?.messages,Z?.recipients,X.length]);function he(){window.dispatchEvent(new Event(`teammy:outbox`)),O.reload()}async function $(e){if(q.current=!0,Y(e),W(``),I(void 0),e.startsWith(`chat:`)||e===`debug`)return;let t=O.data?.messages.find(t=>t.id===e)?.conversationId;if(t)Y(`chat:${t}`);else try{await T(`agents/outbox/${e}/read`,h,{method:`POST`}),he()}catch(e){W(i(e))}}async function ge(){if(!U){de(!0),W(``);try{let e=await T(`agents/chats`,m,{method:`POST`});P(e),await $(`chat:${e.id}`),k.reload()}catch(e){W(i(e))}finally{de(!1)}}}async function _e(e){e.preventDefault();let t=z.trim();if(!t||V||U)return;H(!0),W(``);let n=K.current.get(A);n&&n.text===t||(n={text:t,id:crypto.randomUUID()},K.current.set(A,n));try{if(M){let e=n.target??j;if(!e){let r=await T(`agents/chats`,m,{method:`POST`});e=r.id,n.target=e,K.current.set(`chat:${e}`,n),R(n=>({...n,[`chat:${e}`]:t})),J.current===A&&(P(r),Y(`chat:${e}`))}let r=await T(`agents/chats/${e}`,u.extend({conversationId:o().optional()}),{method:`POST`,body:{text:t,requestId:n.id}});r.conversationId&&r.conversationId!==e&&(J.current===A||J.current===`chat:${e}`)&&Y(`chat:${r.conversationId}`),P(t=>t?.id===e?{...t,runs:t.runs.some(e=>e.id===r.id)?t.runs:[...t.runs,r]}:t),k.reload()}else{let e=await T(`agents/outbox/${Z.id}/reply`,s({conversationId:o()}),{method:`POST`,body:{body:t,requestId:n.id}});he(),J.current===A&&Y(`chat:${e.conversationId}`),k.reload(),I(void 0)}K.current.delete(A),n.target&&K.current.delete(`chat:${n.target}`),R(e=>({...e,[A]:``,...n.target?{[`chat:${n.target}`]:``}:{}}))}catch(e){W(i(e))}finally{H(!1)}}let ve=M||!!Z&&!Z.archivedAt,ye=M&&!F&&(!!j||!k.data);return(0,x.jsxs)(`div`,{className:`split-layout assistant-layout`,"data-testid":`assistant-page`,children:[(0,x.jsxs)(`aside`,{className:`assistant-list`,"aria-label":`消息列表`,children:[(0,x.jsxs)(`header`,{className:`assistant-list-heading`,children:[(0,x.jsx)(`h1`,{children:`消息`}),(0,x.jsx)(re,{className:`assistant-new-chat`,icon:`plus`,label:`新建对话`,disabled:U,onClick:()=>void ge(),"data-testid":`assistant-launcher`})]}),(0,x.jsxs)(`div`,{className:`assistant-message-scroll`,children:[k.loading&&!k.data&&(0,x.jsx)(`p`,{className:`assistant-list-status`,role:`status`,children:`加载中…`}),k.data?.chats.map(e=>(0,x.jsxs)(`button`,{type:`button`,"data-testid":`assistant-chat-${e.id}`,className:`assistant-message-item assistant-chat-item ${j===e.id?`selected`:``}`,"aria-pressed":j===e.id,onClick:()=>void $(`chat:${e.id}`),children:[(0,x.jsx)(`span`,{className:`assistant-message-dot ${e.unread||e.state===`running`||e.state===`queued`?`unread`:``}`}),(0,x.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,x.jsx)(g,{selected:j===e.id,children:(0,x.jsx)(`strong`,{children:e.title})}),(0,x.jsxs)(`time`,{dateTime:e.updatedAt,children:[new Date(e.updatedAt).toLocaleDateString([],{month:`numeric`,day:`numeric`}),` `,S(e.updatedAt)]})]})]},e.id)),!!X.length&&(0,x.jsxs)(`button`,{type:`button`,"data-testid":`debug-outbox`,className:`assistant-message-item ${A===`debug`?`selected`:``}`,onClick:()=>void $(`debug`),children:[(0,x.jsx)(`span`,{className:`assistant-message-dot ${Q?`unread`:``}`}),(0,x.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,x.jsx)(g,{selected:A===`debug`,children:(0,x.jsx)(`strong`,{children:`运行提醒`})}),(0,x.jsx)(`span`,{children:C(X.at(-1).body)})]})]}),O.data?.messages.filter(e=>e.box!==`debug`&&!e.conversationId).sort((e,t)=>Number(!!e.archivedAt)-Number(!!t.archivedAt)).map(e=>(0,x.jsxs)(`button`,{type:`button`,"data-testid":`outbox-${e.id}`,className:`assistant-message-item ${e.archivedAt?`archived`:``} ${A===e.id?`selected`:``}`,onClick:()=>void $(e.id),children:[(0,x.jsx)(`span`,{className:`assistant-message-dot ${e.readAt?``:`unread`}`}),(0,x.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,x.jsx)(g,{selected:A===e.id,children:(0,x.jsx)(`strong`,{children:C(e.body)})}),(0,x.jsxs)(`time`,{dateTime:e.createdAt,children:[new Date(e.createdAt).toLocaleDateString([],{month:`numeric`,day:`numeric`}),` `,S(e.createdAt)]})]})]},e.id))]}),(0,x.jsx)(v,{error:!0,children:O.error||k.error})]}),(0,x.jsxs)(`section`,{className:`assistant-thread`,"aria-label":M?`Tim对话`:`消息内容`,children:[(0,x.jsxs)(`header`,{className:`assistant-thread-heading`,children:[(0,x.jsx)(`h2`,{children:M?le?.title??F?.title??(j?`无标题`:`Tim`):A===`debug`?`运行提醒`:`项目消息`}),F?.kind===`matter`&&(0,x.jsxs)(`span`,{className:`assistant-participants`,title:F.participants?.join(`、`),children:[F.visibility===`project`?`项目共享 · `:``,F.participants?.join(`、`)]})]}),F?.kind===`matter`&&(F.hold||F.pending||F.status===`completed`)&&(0,x.jsx)(`div`,{className:`assistant-matter-state`,role:`status`,children:F.hold?`${F.hold.scope===`all`?`已暂停`:`暂缓修改`} · ${F.hold.reason}`:F.pending?`待确认 · ${F.pending.members.join(`、`)}:${F.pending.question}`:`已完成`}),(0,x.jsxs)(`div`,{className:`assistant-transcript`,role:`log`,"aria-live":`polite`,"data-testid":`assistant-transcript`,onScroll:e=>{let t=e.currentTarget;q.current=t.scrollHeight-t.scrollTop-t.clientHeight<100},children:[M?ye?(0,x.jsxs)(`div`,{className:`assistant-empty`,"data-testid":`assistant-loading`,children:[(0,x.jsx)(a,{}),(0,x.jsx)(`p`,{role:`status`,children:pe||k.error?`暂时无法加载对话`:`加载中…`})]}):F?.messages.length?F.messages.filter(e=>e.body||[`queued`,`running`,`failed`].includes(e.state)).map(e=>(0,x.jsx)(`div`,{className:`assistant-turn`,children:(0,x.jsxs)(w,{mine:e.role===`user`&&e.author===n,author:`${e.role===`assistant`?`Tim`:e.author}${e.source===`wecom`?` · 企业微信`:``}`,time:e.createdAt,children:[e.body&&(0,x.jsx)(`div`,{className:`markdown`,children:(0,x.jsx)(y,{children:e.body})}),e.role===`assistant`&&[`queued`,`running`].includes(e.state)&&(0,x.jsxs)(`span`,{className:`assistant-typing`,"aria-label":`正在回答`,children:[(0,x.jsx)(`i`,{}),(0,x.jsx)(`i`,{}),(0,x.jsx)(`i`,{})]}),e.state===`failed`&&(0,x.jsx)(v,{error:!0,children:F.runs.find(t=>t.id===e.runId)?.error||`本次回答未完成。`})]})},e.id)):(0,x.jsxs)(`div`,{className:`assistant-empty`,children:[(0,x.jsx)(a,{}),(0,x.jsx)(`p`,{children:`有什么项目问题想聊聊?`})]}):!O.data&&O.loading?(0,x.jsx)(`div`,{className:`assistant-empty`,children:(0,x.jsx)(`p`,{role:`status`,children:`加载中…`})}):A===`debug`?X.map(e=>(0,x.jsx)(ie,{item:e,onReply:e.archivedAt?void 0:()=>{I(e.id),B(``),W(``)}},e.id)):Z&&(0,x.jsx)(ie,{item:Z}),(0,x.jsx)(`div`,{ref:me})]}),(0,x.jsx)(v,{error:!0,children:fe||(M?pe:``)}),ve?(0,x.jsxs)(`form`,{className:`assistant-composer`,onSubmit:e=>void _e(e),children:[(0,x.jsx)(`textarea`,{value:z,disabled:U,onChange:e=>B(e.target.value),"aria-label":M?`向Tim提问`:`回复消息`,placeholder:M?`问问Tim…`:`回复…`,rows:2,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,x.jsx)(`button`,{className:`primary assistant-send`,type:`submit`,disabled:V||U||ye||!z.trim(),"aria-label":`发送`,children:(0,x.jsx)(l,{name:`send`})})]}):A!==`debug`&&Z&&(0,x.jsxs)(`div`,{className:`assistant-archived`,children:[(0,x.jsx)(l,{name:`archive`}),`已归档`]})]})]})}function ie({item:e,onReply:t}){return(0,x.jsx)(`div`,{"data-testid":`outbox-thread-${e.id}`,children:(0,x.jsxs)(w,{author:e.box===`debug`?`运行提醒`:`Tim`,time:e.createdAt,children:[(0,x.jsx)(`div`,{className:`markdown`,children:(0,x.jsx)(y,{children:e.body})}),t&&(0,x.jsx)(`button`,{type:`button`,className:`assistant-debug-reply`,onClick:t,children:`回复`})]})})}export{T as Assistant};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.task-board{min-width:0}.task-board .page-header{align-items:flex-start;margin-bottom:40px}.task-board .page-header>div{min-width:0}.task-board .page-header h1,.task-board .page-header p{overflow-wrap:anywhere}.task-board-lanes{grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr));align-items:start;gap:24px;margin-bottom:32px;display:grid}.task-lane{min-width:0}.task-lane h2{font-size:var(--text-base);border-bottom:1px solid var(--color-line);align-items:center;gap:10px;padding:0 0 16px;font-weight:600;display:flex}.task-lane .count{margin-left:auto}.task-lane-content{flex-direction:column;gap:12px;padding-top:16px;display:flex}.lane-dot{border:1.5px solid var(--color-muted);border-radius:50%;width:8px;height:8px}.task-lane[data-stage=in_progress] .lane-dot{border-color:var(--brand-orange);background:var(--brand-orange)}.task-lane[data-stage=in_review] .lane-dot{border-color:var(--brand-black);background:var(--brand-black)}.task-lane[data-stage=completed] .lane-dot{border-color:var(--color-muted);background:var(--color-muted)}.task-lane-empty{font-size:var(--text-xs);color:var(--color-muted);padding:44px 0}.task-card{border:1px solid var(--color-line);border-radius:var(--radius-md);background:var(--color-surface);overflow-wrap:anywhere;min-width:0;position:relative}.task-card>.task-card-heading{border-radius:inherit;padding:16px;list-style:none;position:relative}.task-card-heading::-webkit-details-marker{display:none}.task-card-heading:hover{background:var(--color-soft)}.task-card[open]>.task-card-heading{padding-right:48px}.task-card-meta{flex-wrap:wrap;align-items:center;gap:8px;margin-top:8px;display:flex}.task-confirmation{border-radius:var(--radius-sm);background:var(--color-accent-soft);color:var(--brand-orange);font-size:calc(var(--text-xs) - 1px);align-items:center;gap:3px;padding:0 4px;font-weight:400;line-height:18px;display:inline-flex}.task-confirmation .icon{width:12px;height:12px}.task-card-confirm{flex-direction:column;align-items:flex-end;gap:8px;margin-top:16px;display:flex}.task-card-confirm button{min-height:32px;font-size:var(--text-xs);padding:4px 12px}.task-status-field legend{font-size:var(--text-sm);margin-bottom:8px;font-weight:600}.task-status-options{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;display:grid}.task-status-choice{cursor:pointer;position:relative}.task-status-choice input{opacity:0;width:100%;height:100%;min-height:0;cursor:inherit;position:absolute;inset:0}.task-status-choice span{border:1px solid var(--color-line);border-radius:var(--radius-md);background:var(--color-surface);min-height:36px;font-size:var(--text-sm);justify-content:center;align-items:center;font-weight:550;display:flex}.task-status-choice:hover span{background:var(--color-soft)}.task-status-choice input:checked+span{border-color:var(--brand-black);background:var(--brand-black);color:var(--color-on-dark)}.task-status-choice input:focus-visible+span{outline:2px solid var(--brand-orange);outline-offset:3px}.task-status-choice input:disabled+span{opacity:.45;cursor:default}.task-card-heading h3{font-size:var(--text-base);font-weight:650;line-height:1.55}.task-card-edit{opacity:0;pointer-events:none;position:absolute;top:10px;right:8px}.task-card[open]:hover>.task-card-edit{opacity:1;pointer-events:auto}.task-card[open]:has(:focus-visible)>.task-card-edit{opacity:1;pointer-events:auto}.task-progress{font-size:var(--text-sm);white-space:pre-wrap;line-height:1.85}.task-card small{color:var(--color-muted);font-size:var(--text-xs)}.task-card-details{padding:0 16px 16px}.task-card-details h4{font-size:var(--text-xs);margin:16px 0 4px;font-weight:600}.task-card-details p{font-size:var(--text-sm);margin:0}.task-card-sources{flex-direction:column;align-items:flex-start;gap:8px;margin:16px 0;display:flex}.task-card-sources a{text-align:left;overflow-wrap:anywhere;max-width:100%;font-size:var(--text-xs);min-height:28px;color:var(--color-muted);justify-content:flex-start;gap:8px;padding:4px 0;text-decoration:none;display:inline-flex}.task-card-sources a:hover{color:var(--color-link);text-decoration:underline}.task-mention{border-radius:var(--radius-sm);background:var(--color-accent-soft);color:inherit;padding:0 2px}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,C as t,D as n,M as r,O as i,P as a,T as o,_ as s,b as c,g as l,h as u,k as d,m as f,nt as p,tt as m,w as h,x as g,y as _}from"./index-Bb8MF7Vk.js";import{t as v}from"./project-links-Dy6-B89_.js";import"./file-links-QvRdAx7G.js";var y=m(),b=r(),x=[{status:`planned`,label:`计划`},{status:`in_progress`,label:`进行中`},{status:`in_review`,label:`待验收`},{status:`completed`,label:`已完成`},{status:null,label:`未明确`}];function S({members:t,project:n}){let{request:r,projectId:i}=f(),a=(0,y.useCallback)(e=>r(`tasks`,u,{signal:e}),[r]),c=d(a,3e3,e(i,`tasks`)),[l,p]=(0,y.useState)(),m=c.data,g=new Map(t.map(e=>[e.id,e.displayName||e.id]));return(0,b.jsxs)(`div`,{className:`task-board`,children:[(0,b.jsx)(o,{title:n?.projectName.trim()?`${n.projectName.trim()}|工作看板`:`工作看板`,description:n?.description.trim()||``}),(0,b.jsx)(h,{error:!0,children:c.error}),(0,b.jsx)(`section`,{className:`task-board-lanes`,"aria-label":`任务进度`,"data-testid":`progress-board`,children:x.filter(e=>e.status!==null||m?.tasks.some(e=>e.status===null)).map(e=>{let t=m?.tasks.filter(t=>t.status===e.status)??[];return(0,b.jsxs)(`section`,{className:`task-lane`,"aria-label":e.label,"data-stage":e.status??`unknown`,children:[(0,b.jsxs)(`h2`,{children:[(0,b.jsx)(`span`,{className:`lane-dot`}),e.label,(0,b.jsx)(s,{children:m?t.length:`—`})]}),(0,b.jsx)(`div`,{className:`task-lane-content`,children:t.length?t.map(e=>(0,b.jsx)(C,{task:e,names:g,onEdit:()=>p(e),onSaved:()=>void c.reload()},e.id)):(0,b.jsx)(`p`,{className:`task-lane-empty`,children:c.error&&!m?`读取失败`:m?`暂无任务`:`读取中…`})})]},e.label)})}),l&&(0,b.jsx)(T,{task:l,onClose:()=>p(void 0),onSaved:()=>{p(void 0),c.reload()}},l.id)]})}function C({task:e,names:t,onEdit:r,onSaved:o}){let{projectId:s,request:u}=f(),d=i(),[m,_]=(0,y.useState)(!1),[x,S]=(0,y.useState)(``);async function C(){if(!m){_(!0),S(``);try{await u(`tasks/${e.id}/correction`,l,{method:`PATCH`,signal:d,body:{needsConfirmation:!1,expectedRevision:e.revision}}),d.aborted||o()}catch(e){d.aborted||S(a(e))}finally{_(!1)}}}return(0,b.jsxs)(`details`,{className:`task-card`,"data-testid":`task-card`,"data-task-id":e.id,"data-owner":e.owner,"data-status":e.status??`unknown`,children:[(0,b.jsxs)(`summary`,{className:`task-card-heading`,"data-testid":`task-toggle`,children:[(0,b.jsx)(`h3`,{children:e.title}),(0,b.jsxs)(`span`,{className:`task-card-meta`,children:[(0,b.jsx)(`small`,{children:t.get(e.owner)??e.owner}),e.needsConfirmation&&(0,b.jsxs)(`span`,{className:`task-confirmation`,"data-testid":`task-confirmation`,children:[(0,b.jsx)(c,{name:`attention`,size:`small`}),`需要确认`]})]})]}),(0,b.jsx)(g,{icon:`edit`,className:`task-card-edit`,label:`纠正任务:${e.title}`,"data-testid":`task-correct`,disabled:m,onClick:r}),(0,b.jsxs)(`div`,{className:`task-card-details`,children:[(0,b.jsx)(`h4`,{children:`目标`}),(0,b.jsx)(`p`,{children:e.goal?(0,b.jsx)(w,{value:e.goal,names:t}):`目标未明确`}),(0,b.jsx)(`h4`,{children:`当前进展`}),(0,b.jsx)(`p`,{className:`task-progress`,children:(0,b.jsx)(w,{value:e.progress,names:t})}),(0,b.jsx)(`div`,{className:`task-card-sources`,children:e.sources.map(t=>(0,b.jsxs)(`a`,{"data-testid":`task-source`,href:p(t.kind===`material`?`/projects/${s}/materials?id=${t.materialId}&revision=${t.revision}`:v(s,e.owner,t.path)),children:[(0,b.jsx)(c,{name:`file`,size:`small`}),(0,b.jsx)(`span`,{children:t.path})]},t.path))}),e.syncedAt&&(0,b.jsxs)(`small`,{children:[`资料同步于 `,(0,b.jsx)(n,{value:e.syncedAt})]}),e.needsConfirmation&&(0,b.jsxs)(`div`,{className:`task-card-confirm`,children:[(0,b.jsx)(h,{error:!0,children:x}),(0,b.jsx)(`button`,{className:`primary`,"data-testid":`task-confirm-save`,disabled:m,onClick:()=>void C(),children:m?`正在保存…`:`保存`})]})]})]})}function w({value:e,names:t}){return e.split(/(@[a-z][a-z0-9_-]*)/gi).map((e,n)=>e.startsWith(`@`)&&t.has(e.slice(1))?(0,b.jsx)(`mark`,{className:`task-mention`,children:e},n):e)}function T({task:e,onClose:n,onSaved:r}){let{request:o}=f(),s=i(),[c,u]=(0,y.useState)(e.title),[d,p]=(0,y.useState)(e.status??``),[m,g]=(0,y.useState)(e.goal??``),[v,S]=(0,y.useState)(e.progress),[C,w]=(0,y.useState)(!1),[T,E]=(0,y.useState)(``),D={...c===e.title?{}:{title:c},...d===(e.status??``)?{}:{status:d||null},...m===(e.goal??``)?{}:{goal:m||null},...v===e.progress?{}:{progress:v},...e.needsConfirmation?{needsConfirmation:!1}:{}};async function O(){if(!C&&Object.keys(D).length){w(!0),E(``);try{await o(`tasks/${e.id}/correction`,l,{method:`PATCH`,signal:s,body:{...D,expectedRevision:e.revision}}),s.aborted||r()}catch(e){s.aborted||E(a(e))}finally{w(!1)}}}return(0,b.jsx)(t,{id:`task-correction`,title:`纠正任务`,onClose:n,children:(0,b.jsxs)(`form`,{className:`stack`,"aria-busy":C,onSubmit:e=>{e.preventDefault(),O()},children:[(0,b.jsx)(_,{id:`task-title`,label:`标题`,children:(0,b.jsx)(`input`,{value:c,required:!0,onChange:e=>u(e.target.value)})}),(0,b.jsxs)(`fieldset`,{className:`task-status-field`,disabled:C,children:[(0,b.jsx)(`legend`,{children:`状态`}),(0,b.jsx)(`div`,{className:`task-status-options`,"data-testid":`task-status`,children:x.filter(e=>e.status!==null).map(e=>(0,b.jsxs)(`label`,{className:`task-status-choice`,children:[(0,b.jsx)(`input`,{type:`radio`,name:`task-status`,value:e.status,checked:d===e.status,onChange:()=>p(e.status)}),(0,b.jsx)(`span`,{children:e.label})]},e.status))}),(0,b.jsx)(`small`,{children:`待验收:任务成果已提交,等待验收或最终确认。`})]}),(0,b.jsx)(_,{id:`task-goal`,label:`目标`,children:(0,b.jsx)(`textarea`,{value:m,onChange:e=>g(e.target.value)})}),(0,b.jsx)(_,{id:`task-progress`,label:`当前进展`,children:(0,b.jsx)(`textarea`,{value:v,onChange:e=>S(e.target.value)})}),(0,b.jsx)(h,{error:!0,children:T}),(0,b.jsx)(`div`,{className:`row wrap`,children:(0,b.jsx)(`button`,{type:`submit`,className:`primary`,disabled:C||!Object.keys(D).length,"data-testid":`task-correction-save`,children:`保存`})})]})})}function E({members:e,config:t}){return(0,b.jsx)(S,{members:e,project:t})}export{E as Dashboard};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,E as t,L as n,M as r,N as i,b as a,c as o,d as s,k as c,l,m as u,nt as d,s as f,tt as p,u as m,v as h,w as g,x as _,z as v}from"./index-Bb8MF7Vk.js";import{t as y}from"./Markdown-hcMXu8Z6.js";import{t as b}from"./project-links-Dy6-B89_.js";import{t as x}from"./file-links-QvRdAx7G.js";import{n as S,t as C}from"./WorkspaceTree-D52TBZvy.js";import{t as w}from"./HtmlPreview-DcbwgS0C.js";var T=p(),E=r();function D(e,t){let n=t.split(`/`).slice(0,-1);return n.map((t,r)=>S(e,n.slice(0,r+1).join(`/`))).concat(S(e,``))}function O({members:e,me:t,onRefresh:r}){let{api:a,projectId:p}=u(),[y,w]=(0,T.useState)(()=>{let t=new URLSearchParams(location.search),n=t.get(`owner`),r=v.safeParse(t.get(`path`));return n&&(m(n)||e.some(e=>e.id===n))&&r.success&&!l(r.data)?{owner:n,path:r.data}:void 0}),[O,A]=(0,T.useState)(()=>new Set(y?D(y.owner,y.path):[S(t,``)])),[j,M]=(0,T.useState)(()=>y?{...y,kind:`file`}:void 0),[N,P]=(0,T.useState)(0),[F,I]=(0,T.useState)(()=>{let e=new URLSearchParams(location.search);return!y&&(e.has(`owner`)||e.has(`path`))?`文件链接不完整或目标已不可用。`:``}),L=(0,T.useCallback)(async e=>{if(y)try{return{owner:y.owner,...await a.file(y.owner,y.path,void 0,e)}}catch(e){throw e instanceof i&&e.code===`FILE_NOT_FOUND`?Error(`找不到这个文件,可能已被删除或移动。`):e}},[y?.owner,y?.path,N]),R=c(L),z=R.data?.owner===y?.owner&&R.data?.file.path===y?.path?R.data:void 0;function B(e,t){let n=t.split(`/`).filter(Boolean);A(t=>{let r=new Set(t);for(let t=0;t<=n.length;t++)r.add(S(e,n.slice(0,t).join(`/`)));return r})}function V(e,t){I(``),B(e,t.split(`/`).slice(0,-1).join(`/`)),w({owner:e,path:t}),M({owner:e,path:t,kind:`file`}),history.replaceState(null,``,d(b(p,e,t)))}function H(t){if(!y)return!1;let n=x(m(y.owner)?y.path:`${y.owner}/${y.path}`,t);if(!n)return!/^[a-z][a-z0-9+.-]*:/i.test(t)&&!t.startsWith(`//`)&&(I(`该链接超出工作区,请在原仓库查看。`),!0);if(l(n.path))return I(`配置文件不在文件浏览中显示。`),!0;if(o(n.path))return location.assign(d(`/projects/${p}/memory`)),!0;let[r,...i]=n.path.split(`/`),a=e.some(e=>e.id===r),s=a?r:f,c=a?i.join(`/`):n.path;return I(``),n.directory?(B(s,c),M({owner:s,path:c,kind:`directory`})):s===y.owner&&c===y.path?n.anchor&&[...document.querySelectorAll(`.markdown h1,.markdown h2,.markdown h3,.markdown h4`)].find(e=>e.textContent?.trim().toLowerCase().replace(/\s+/g,`-`)===n.anchor.toLowerCase())?.scrollIntoView({block:`center`}):V(s,c),!0}return(0,E.jsxs)(`div`,{className:`split-layout file-explorer`,"data-testid":`file-browser`,children:[(0,E.jsxs)(`aside`,{className:`file-tree-pane`,"aria-label":`文件资源管理器`,children:[(0,E.jsx)(s,{title:`工作区`,icon:`files`,children:(0,E.jsx)(_,{icon:`refresh`,label:`刷新文件`,"data-testid":`files-refresh`,onClick:()=>{I(``),P(e=>e+1),r()}})}),(0,E.jsx)(C,{members:e,expanded:O,selected:j,revealed:!R.loading&&!R.error&&z?{owner:z.owner,path:z.file.path,file:z.file}:void 0,onSelect:V,onToggle:(e,t)=>{M({owner:e,path:t,kind:`directory`}),A(n=>{let r=new Set(n),i=S(e,t);return r.has(i)?r.delete(i):r.add(i),r})}},N)]}),(0,E.jsx)(`section`,{className:`file-detail`,"data-testid":`file-preview`,"data-owner-id":y?.owner,"data-file-path":y?.path,"aria-label":n.filePreview,children:y?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(g,{error:!0,children:F||!R.loading&&R.error}),R.error&&(0,E.jsx)(`button`,{className:`file-entry-retry`,"data-testid":`files-retry`,onClick:()=>void R.reload(),children:n.retry}),R.loading?(0,E.jsx)(`p`,{className:`preview-body`,role:`status`,children:n.loading}):!R.error&&z&&(0,E.jsx)(k,{owner:z.owner,file:z.file,onLink:H},`${z.owner}:${z.file.path}:${z.file.sha256}`)]}):F?(0,E.jsx)(g,{error:!0,children:F}):(0,E.jsx)(h,{mascot:!0,title:`查看工作区文件`,description:n.pickFile})})]})}function k({owner:r,file:i,onLink:o}){let{readTextBlob:s,blobUrl:l,projectId:d}=u(),[f,p]=(0,T.useState)(!1),h=i.size>524288,v=/\.(md|markdown)$/i.test(i.path),b=/\.html?$/i.test(i.path),x=(0,T.useCallback)(e=>h?Promise.resolve(void 0):s(i,e),[i.sha256,i.size,h]),S=c(x,!1,e(d,`file-body`,i.sha256));return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`header`,{className:`file-detail-header`,children:[(0,E.jsxs)(`span`,{className:`file-detail-path`,title:`${m(r)?`teamcontext`:r}/${i.path}`,children:[(0,E.jsxs)(`span`,{children:[m(r)?`teamcontext`:r,` / `]}),i.path]}),(0,E.jsxs)(t,{label:`文件操作`,children:[(v||b)&&(0,E.jsx)(_,{icon:f?`preview`:`code`,label:f?`切换为预览`:`切换为原文`,"data-testid":`file-toggle-raw`,"aria-pressed":f,onClick:()=>p(!f)}),(0,E.jsx)(`a`,{className:`icon-button`,"data-testid":`file-download`,"aria-label":n.download,title:n.download,href:l(i.sha256),download:i.path.split(`/`).at(-1),children:(0,E.jsx)(a,{name:`download`})})]})]}),h?(0,E.jsx)(`div`,{className:`empty`,children:(0,E.jsx)(`p`,{children:n.previewLarge})}):S.error?(0,E.jsxs)(`div`,{className:`preview-body`,children:[(0,E.jsx)(g,{error:!0,children:S.error}),(0,E.jsx)(`button`,{"data-testid":`file-preview-retry`,onClick:()=>void S.reload(),children:n.retry})]}):S.loading?(0,E.jsx)(`p`,{className:`preview-body`,role:`status`,children:n.loading}):(0,E.jsx)(`div`,{className:`preview-body${b&&!f?` preview-body-html`:``}`,children:b&&!f?(0,E.jsx)(w,{url:l(i.sha256),name:i.path.split(`/`).at(-1)}):v&&!f?(0,E.jsx)(`article`,{className:`markdown`,"data-testid":`file-content`,"data-format":`markdown`,children:(0,E.jsx)(y,{onLink:o,children:S.data??``})}):(0,E.jsx)(`pre`,{className:`raw`,"data-testid":`file-content`,"data-format":`text`,children:S.data})})]})}export{O as Files};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,C as r,F as i,G as a,J as o,M as s,P as c,Q as l,U as u,V as d,W as f,X as p,Y as m,b as h,d as g,et as _,f as v,k as y,m as b,nt as x,tt as S,v as C,w,x as T,y as E}from"./index-Bb8MF7Vk.js";import{n as D,r as O,t as k}from"./Markdown-hcMXu8Z6.js";import{i as ee,r as te}from"./WorkspaceTree-D52TBZvy.js";import{t as A}from"./HtmlPreview-DcbwgS0C.js";function j(e){return _(u,e)}var M=S(),N=p().regex(/^R\d{6,}$/),P=m({name:p().min(1),sha256:n,size:o().int().nonnegative()}),F=l().refine(e=>/^https?:\/\//i.test(e),`Use an HTTP or HTTPS URL.`);m({operationId:e(),title:p().trim().default(``),text:p().optional(),url:F.optional(),originals:a(P).default([])}).strict().refine(e=>!!e.text?.trim()||!!e.url||e.originals.length>0,`Provide text, a link or a file.`),m({expectedRevision:d,title:p().trim().min(1).optional(),url:F.nullable().optional(),content:p().optional(),summary:p().optional(),sourceVersion:p().optional(),contentDate:p().optional(),originals:a(P).optional()}).strict();var I=m({id:N,projectId:p(),title:p(),submittedBy:p(),createdAt:p(),revision:d,source:m({kind:f([`web`,`chat`,`group`]),url:p().nullable(),groupId:p().optional(),messageId:p().optional(),sourceVersion:p().optional(),contentDate:p().optional()}),originals:a(P),content:p().nullable(),summary:p().nullable(),state:f([`waiting`,`running`,`ready`,`failed`]),error:p().nullable(),url:p()}),L=m({materials:a(I),nextCursor:o().nullable()});m({query:p().trim().min(1),scope:f([`all`,`workspace`,`materials`]).default(`all`),materialId:N.optional(),originalHash:n.optional(),after:p().default(``),limit:j().int().min(1).max(200).default(30)}).strict();var R=m({items:a(m({key:p(),kind:f([`workspace`,`materials`]),title:p(),snippet:p(),url:p(),path:p()})),nextCursor:p().nullable()}),z=s();function B(e){let t=(e.content??``).trimStart().split(`
|
|
2
|
-
`);return t[0]?.replace(/^#\s+/,``).trim()===e.title.trim()&&t[0].startsWith(`# `)&&t.shift(),t.join(`
|
|
3
|
-
`).trimStart()}function V(){let e=new URLSearchParams(location.search),t=e.get(`id`);return t?{id:t,...e.get(`original`)?{original:e.get(`original`)}:{},...e.get(`revision`)?{revision:e.get(`revision`)}:{}}:void 0}function H(){let{request:e,projectId:n}=b(),[r,i]=(0,M.useState)(V),[a,o]=(0,M.useState)(r),[s,l]=(0,M.useState)(()=>new Set(r?[r.id]:[])),[u,d]=(0,M.useState)(!1),[f,p]=(0,M.useState)(``),[m,_]=(0,M.useState)(``),[S,E]=(0,M.useState)(``),[D,O]=(0,M.useState)([]),[A,j]=(0,M.useState)(),[N,P]=(0,M.useState)(!1),[F,R]=(0,M.useState)(``),H=(0,M.useRef)(null),U=(0,M.useCallback)(t=>e(`materials`,L,{signal:t}),[e]),W=y(U,5e3,t(n,`materials`)),G=(0,M.useCallback)(t=>r?e(`materials/${encodeURIComponent(r.id)}${r.revision?`?revision=${encodeURIComponent(r.revision)}`:``}`,I,{signal:t}):Promise.resolve(null),[e,r?.id,r?.revision]),K=y(G,5e3),q=K.data?.id===r?.id?K.data:null,J=[...new Map([...D,...W.data?.materials??[],...q?[q]:[]].map(e=>[e.id,e])).values()].sort((e,t)=>t.createdAt.localeCompare(e.createdAt)||t.id.localeCompare(e.id)),Y=A===void 0?W.data?.nextCursor:A;function X(e,t=``){i(e),o(e),_(``),E(t),d(!1),l(t=>new Set([...t,e.id])),history.replaceState(null,``,x(`/projects/${n}/materials?${new URLSearchParams({...e})}`))}(0,M.useEffect)(()=>{let e=()=>{let e=V();i(e),o(e),_(``),p(``),E(``),d(!1),e&&l(t=>new Set([...t,e.id]))};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);async function ae(){if(Y&&!N){P(!0),R(``);try{let t=await e(`materials?before=${Y}`,L);O(e=>[...e,...t.materials]),j(t.nextCursor)}catch(e){R(c(e))}finally{P(!1)}}}let Z=J.find(e=>e.id===a?.id),Q=Z?.originals.find(e=>e.sha256===a?.original)?.name??Z?.title??`当前资料`;function $(){o(void 0),E(``),H.current?.focus()}return(0,z.jsxs)(`div`,{className:`split-layout file-explorer session-explorer`,"data-testid":`materials-page`,children:[(0,z.jsxs)(`aside`,{className:`file-tree-pane`,"aria-label":`资料目录`,children:[(0,z.jsx)(g,{title:`资料`,icon:`materials`,children:(0,z.jsx)(T,{icon:`plus`,label:`新增资料`,onClick:()=>{d(!0),R(``)}})}),(0,z.jsx)(w,{error:!0,children:W.error||F}),W.data?J.length===0?(0,z.jsx)(`p`,{className:`tree-status`,children:`暂无资料`}):(0,z.jsx)(`div`,{role:`tree`,"aria-label":`项目资料`,onKeyDown:te,children:J.map(e=>(0,z.jsxs)(`div`,{role:`none`,children:[(0,z.jsxs)(v,{role:`treeitem`,"aria-level":1,"aria-expanded":s.has(e.id),"aria-selected":!u&&r?.id===e.id&&!r.original,className:`tree-item tree-folder`,style:{"--tree-level":1},"data-testid":`material-folder`,title:e.title,onClick:()=>{let t=s.has(e.id);X({id:e.id}),t&&l(t=>{let n=new Set(t);return n.delete(e.id),n})},leading:(0,z.jsx)(`span`,{className:`tree-chevron ${s.has(e.id)?`expanded`:``}`,children:(0,z.jsx)(h,{name:`chevron`,size:`small`})}),children:[(0,z.jsx)(h,{name:`files`}),(0,z.jsx)(`span`,{className:`tree-name`,children:e.title})]}),s.has(e.id)&&(0,z.jsx)(`div`,{role:`group`,children:[...e.originals].sort((e,t)=>ee(e.name,t.name)).map((t,n)=>(0,z.jsxs)(v,{role:`treeitem`,"aria-level":2,"aria-selected":!u&&r?.id===e.id&&r.original===t.sha256,className:`tree-item`,style:{"--tree-level":2},"data-testid":`material-original`,title:t.name,onClick:()=>X({id:e.id,original:t.sha256,...e.id===r?.id&&r.revision?{revision:r.revision}:{}}),leading:(0,z.jsx)(`span`,{className:`tree-chevron`}),children:[(0,z.jsx)(h,{name:`file`}),(0,z.jsx)(`span`,{className:`tree-name`,children:t.name})]},`${t.sha256}:${n}`))})]},e.id))}):(0,z.jsx)(`p`,{className:`tree-status`,children:`加载中…`}),Y&&(0,z.jsx)(`button`,{className:`tree-action`,disabled:N,onClick:()=>void ae(),children:N?`加载中…`:`加载更多`})]}),(0,z.jsxs)(`section`,{className:`session-reader`,"aria-label":`资料内容与搜索`,children:[(0,z.jsx)(`div`,{className:`session-reader-content`,children:u?(0,z.jsx)(ie,{onCancel:()=>d(!1),onSaved:e=>{X({id:e}),W.reload()}}):m?(0,z.jsx)(ne,{query:m,scope:a,onSelect:e=>X(e,m)},`${m}/${a?.id}/${a?.original}`):r?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(w,{error:!0,children:K.error}),q?r.original?(0,z.jsx)(re,{material:q,hash:r.original,highlight:S},`${q.id}:${r.original}`):(0,z.jsxs)(`article`,{className:`material-body`,children:[(0,z.jsx)(`h1`,{children:q.title}),r.revision&&(0,z.jsx)(`button`,{className:`material-link`,onClick:()=>X({id:r.id}),children:`查看最新内容`}),!r.revision&&(q.state===`waiting`||q.state===`running`)?(0,z.jsx)(`p`,{className:`muted`,role:`status`,children:`正在整理…`}):null,(0,z.jsx)(w,{error:!0,children:q.error??``}),!r.revision&&q.state===`failed`&&(0,z.jsx)(`button`,{onClick:()=>void e(`materials/${r.id}/retry`,I,{method:`POST`}).then(()=>K.reload()).catch(e=>R(c(e))),children:`重试整理`}),q.content?(0,z.jsx)(`div`,{className:`markdown`,children:(0,z.jsx)(k,{highlight:S,children:B(q)})}):(0,z.jsx)(`p`,{className:`muted`,children:`正文尚未整理,可以先查看左侧原件。`})]}):(0,z.jsx)(`p`,{role:`status`,children:`加载中…`})]}):(0,z.jsx)(C,{mascot:!0,title:`选择资料开始阅读`,description:`也可以在下方搜索资料内容。`})}),!u&&(0,z.jsxs)(`form`,{className:`session-search-dock`,"data-testid":`material-search-form`,onSubmit:e=>{e.preventDefault(),_(f.trim()),E(``)},children:[a&&(0,z.jsxs)(`button`,{type:`button`,className:`search-scope-chip`,title:`清除搜索范围`,"aria-label":`清除范围:${Q}`,onClick:$,children:[(0,z.jsxs)(`span`,{className:`scope-label`,children:[`搜索:`,Q]}),(0,z.jsx)(`span`,{"aria-hidden":`true`,children:`×`})]}),(0,z.jsxs)(`div`,{className:`session-search-input-row`,children:[(0,z.jsx)(`input`,{ref:H,"aria-label":`搜索资料`,placeholder:`搜索资料内容`,value:f,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Backspace`&&!f&&a&&(e.preventDefault(),$())}}),(m||f||S)&&(0,z.jsx)(T,{icon:`close`,label:`清空搜索`,onClick:()=>{p(``),_(``),E(``),H.current?.focus()}}),(0,z.jsx)(T,{icon:`search`,type:`submit`,label:`搜索`,disabled:!f.trim()})]})]})]})]})}function ne({query:e,scope:t,onSelect:n}){let{request:r}=b(),[i,a]=(0,M.useState)(``),o=(0,M.useCallback)(n=>r(`resources/search?${new URLSearchParams({query:e,scope:`materials`,after:i,...t?{materialId:t.id}:{},...t?.original?{originalHash:t.original}:{}})}`,R,{signal:n}),[r,e,t?.id,t?.original,i]),s=y(o);return(0,z.jsxs)(`section`,{className:`session-results stack`,"aria-label":`搜索结果`,children:[(0,z.jsx)(w,{error:!0,children:s.error}),s.loading?(0,z.jsx)(`p`,{role:`status`,children:`正在搜索…`}):s.data?.items.length===0?(0,z.jsx)(`p`,{className:`empty`,children:`没有找到匹配的资料`}):s.data?.items.map(t=>(0,z.jsxs)(`button`,{className:`session-item`,"data-testid":`material-match`,onClick:()=>{let e=new URL(t.url,location.origin).searchParams;n({id:e.get(`id`),...e.get(`original`)?{original:e.get(`original`)}:{},...e.get(`revision`)?{revision:e.get(`revision`)}:{}})},children:[(0,z.jsx)(`strong`,{children:t.title.replace(/^R\d+ · /,``)}),(0,z.jsx)(`span`,{className:`session-excerpt`,children:(0,z.jsx)(D,{value:O(t.snippet,e),query:e})})]},t.key)),s.data?.nextCursor&&(0,z.jsx)(`button`,{disabled:s.loading,onClick:()=>a(s.data.nextCursor),children:`下一页`})]})}function re({material:e,hash:n,highlight:r}){let{projectId:i}=b(),a=e.originals.find(e=>e.sha256===n),o=x(`/api/v1/projects/${i}/materials/${e.id}/originals/${n}?revision=${e.revision}`),[s,c]=(0,M.useState)(!1),l=(0,M.useCallback)(async e=>{let t=await fetch(o,{signal:e});if(!t.ok)throw Error(`原件暂时无法读取。`);let n=await t.arrayBuffer();try{let e=new TextDecoder(`utf8`,{fatal:!0}).decode(n);return e.includes(`\0`)?null:e}catch{return null}},[o]),u=y(l,!1,t(i,`material-original`,n));if(!a)return(0,z.jsx)(w,{error:!0,children:`找不到此原件。`});let d=/\.(md|markdown)$/i.test(a.name),f=/\.html?$/i.test(a.name);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`header`,{className:`file-detail-header`,children:[(0,z.jsx)(`span`,{className:`file-detail-path`,children:a.name}),(0,z.jsxs)(`div`,{className:`toolbar-actions`,children:[(d||f)&&(0,z.jsx)(T,{icon:s?`preview`:`code`,label:s?`切换为预览`:`切换为原文`,"aria-pressed":s,onClick:()=>c(!s)}),(0,z.jsx)(`a`,{className:`icon-button`,"aria-label":`下载原件`,title:`下载原件`,href:o,download:a.name,children:(0,z.jsx)(h,{name:`download`})})]})]}),(0,z.jsx)(w,{error:!0,children:u.error}),u.loading?(0,z.jsx)(`p`,{role:`status`,children:`加载中…`}):u.data===null?(0,z.jsx)(`p`,{className:`muted`,children:`此格式请下载后查看。`}):u.data!==void 0&&(0,z.jsx)(`div`,{className:`preview-body${f&&!s?` preview-body-html`:``}`,"data-testid":`material-original-content`,children:f&&!s?(0,z.jsx)(A,{url:o,name:a.name}):d&&!s?(0,z.jsx)(`article`,{className:`markdown`,children:(0,z.jsx)(k,{highlight:r,children:u.data})}):(0,z.jsx)(`pre`,{className:`raw`,children:(0,z.jsx)(D,{value:u.data,query:r})})})]})}function U(e){if(e.kind===`text`){try{if([`http:`,`https:`].includes(new URL(e.text.trim()).protocol))return`link`}catch{}return`text`}let{name:t,type:n}=e.file;return n.startsWith(`image/`)||/\.(png|jpe?g|gif|webp|svg|heic|avif)$/i.test(t)?`imageFile`:/\.(csv|tsv|xlsx?|ods)$/i.test(t)?`spreadsheetFile`:/\.(json|ya?ml|xml|html?|css|[cm]?[jt]sx?|py|go|rs|sh|sql)$/i.test(t)?`codeFile`:n.startsWith(`text/`)||/\.(pdf|docx?|odt|rtf|md|txt)$/i.test(t)?`file`:`attachment`}function W(e){try{return new URL(e.trim()).hostname}catch{return e.trim().split(`
|
|
4
|
-
`)[0]?.slice(0,80)||`文本`}}function G(e){try{return new URL(e.trim()).href}catch{return e.trim().split(`
|
|
5
|
-
`).slice(1).join(`
|
|
6
|
-
`)}}function ie({onSaved:e,onCancel:t}){let{request:n,projectId:a}=b(),[o,s]=(0,M.useState)([]),[l,u]=(0,M.useState)(),[d,f]=(0,M.useState)(!1),[p,m]=(0,M.useState)(``),g=(0,M.useRef)(null),_=(0,M.useRef)(i()),v=(0,M.useRef)(new Map);function y(e){s(e),_.current=i(),m(``)}async function S(){f(!0),m(``);try{let t=[];for(let[e,n]of o.entries()){let r=v.current.get(n.id);if(!r){let t=n.kind===`file`?n.file.name:`${W(n.text)}.txt`,i=await fetch(x(`/api/v1/projects/${a}/materials/uploads`),{method:`POST`,headers:{"content-type":`application/octet-stream`,"x-teammy-web":`1`},body:n.kind===`file`?n.file:new Blob([n.text],{type:`text/plain`})}),o=await i.json();if(!i.ok)throw Error(o.error?.message??`第 ${e+1} 项上传失败。`);r={name:t,sha256:o.sha256,size:o.size},v.current.set(n.id,r)}t.push(r)}let r=o.length===1&&o[0]?.kind===`text`?o[0].text.trim():``,i;try{let e=new URL(r);[`http:`,`https:`].includes(e.protocol)&&(i=e.href)}catch{}e((await n(`materials`,I,{method:`POST`,body:{operationId:_.current,originals:t,...i?{url:i}:{}}})).id)}catch(e){m(c(e))}finally{f(!1)}}return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`form`,{className:`material-form`,onSubmit:e=>{e.preventDefault(),S()},children:[(0,z.jsx)(`h1`,{children:`新增资料`}),(0,z.jsx)(`p`,{className:`muted`,children:`上传附件到项目,以便于Tim进行理解`}),(0,z.jsx)(w,{error:!0,children:p}),(0,z.jsxs)(`fieldset`,{disabled:d,children:[(0,z.jsxs)(`div`,{className:`attachment-grid`,children:[o.map(e=>(0,z.jsxs)(`article`,{className:`attachment-card`,"data-testid":`attachment-card`,children:[e.kind===`text`?(0,z.jsxs)(`button`,{type:`button`,className:`attachment-content`,"aria-label":`编辑:${W(e.text)}`,onClick:()=>u({id:e.id,text:e.text}),children:[(0,z.jsx)(h,{name:U(e)}),(0,z.jsx)(`span`,{className:`attachment-name`,children:W(e.text)}),G(e.text)&&(0,z.jsx)(`span`,{className:`attachment-excerpt`,children:G(e.text)})]}):(0,z.jsxs)(`div`,{className:`attachment-content`,children:[(0,z.jsx)(h,{name:U(e)}),(0,z.jsx)(`span`,{className:`attachment-name`,children:e.file.name})]}),(0,z.jsx)(T,{className:`attachment-remove`,icon:`close`,label:`移除:${e.kind===`file`?e.file.name:W(e.text)}`,onClick:()=>{v.current.delete(e.id),y(o.filter(t=>t.id!==e.id))}})]},e.id)),(0,z.jsxs)(`button`,{type:`button`,className:`attachment-add`,onClick:()=>u({text:``}),children:[(0,z.jsx)(h,{name:`addText`}),(0,z.jsx)(`span`,{children:`添加文本/链接`})]}),(0,z.jsxs)(`button`,{type:`button`,className:`attachment-add`,onClick:()=>g.current?.click(),children:[(0,z.jsx)(h,{name:`addFile`}),(0,z.jsx)(`span`,{children:`添加文件`})]})]}),(0,z.jsx)(`input`,{ref:g,type:`file`,multiple:!0,hidden:!0,"aria-label":`原始文件`,onChange:e=>{y([...o,...[...e.target.files??[]].map(e=>({id:i(),kind:`file`,file:e}))]),e.target.value=``}}),(0,z.jsxs)(`div`,{className:`actions attachment-actions`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:t,children:`取消`}),(0,z.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!o.length,children:d?`上传中…`:`提交资料`})]})]})]}),l&&(0,z.jsx)(r,{id:`material-text-editor`,title:`添加文本/链接`,onClose:()=>u(void 0),children:(0,z.jsxs)(`form`,{className:`stack`,onSubmit:e=>{if(e.preventDefault(),!l.text.trim())return;let t={id:l.id??i(),kind:`text`,text:l.text};v.current.delete(t.id),y(l.id?o.map(e=>e.id===l.id?t:e):[...o,t]),u(void 0)},children:[(0,z.jsx)(E,{id:`material-attachment-text`,label:`文本或链接`,children:(0,z.jsx)(`textarea`,{autoFocus:!0,rows:8,value:l.text,onChange:e=>u({...l,text:e.target.value}),placeholder:`粘贴文本或网页链接`})}),(0,z.jsx)(`div`,{className:`actions`,children:(0,z.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!l.text.trim(),children:l.id?`保存`:`添加`})})]})})]})}export{H as Materials};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.memory-page{flex:1;width:100%;max-width:1000px;min-height:0;margin:0 auto;padding:0 8px 24px 0;overflow-y:auto}.memory-cards{gap:14px;display:grid}.memory-card{background:var(--color-surface,white);border:1px solid var(--color-line);border-radius:14px;align-items:flex-start;gap:16px;min-width:0;padding:20px 22px;display:flex}.memory-status{color:var(--color-muted);flex:none;padding-top:7px;display:flex}.memory-status.is-kept{color:var(--brand-orange)}.memory-content{flex:1;min-width:0}.memory-text{text-align:left;width:100%;font:inherit;overflow-wrap:anywhere;color:inherit;background:0 0;border:0;border-radius:0;padding:4px 0;line-height:1.7;display:block}.memory-text:hover{background:0 0}.memory-content textarea{resize:vertical;width:100%;min-height:64px;font:inherit;line-height:1.7;display:block}.memory-actions{flex-shrink:0;gap:4px;display:flex}.memory-empty{color:var(--color-muted);margin:24px 0}@media (width<=680px){.memory-card{gap:8px;padding:14px 12px}.memory-actions{gap:0}.memory-actions .icon-button{width:32px;height:32px;padding:4px}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,A as t,F as n,G as r,J as i,K as a,M as o,P as s,T as c,W as l,X as u,Y as d,b as f,k as p,m,tt as h,w as g,x as _}from"./index-Bb8MF7Vk.js";var v=h(),y=u().trim().min(1).max(120).refine(e=>!/[\r\n]/.test(e),`请使用一句简短的项目记忆。`),b=d({id:e(),text:y,state:l([`draft`,`kept`]),revision:i().int().positive(),createdAt:u(),updatedAt:u()}),x=d({cards:r(b)});d({id:e(),text:y}).strict(),d({expectedRevision:i().int().positive(),text:y.optional(),action:l([`keep`,`discard`,`delete`]).optional()}).strict().refine(e=>e.text!==void 0||e.action!==void 0,`没有需要保存的修改。`),d({text:y}).strict();var S=o();function C(){let{request:e,projectId:r}=m(),i=(0,v.useCallback)(t=>e(`memory`,x,{signal:t}),[e]),a=p(i,5e3,t(r,`memory`)),[o,s]=(0,v.useState)(null),[l,u]=(0,v.useState)({}),d=(0,v.useRef)(null),f=[...a.data?.cards??[]];for(let e of Object.values(l))f.some(t=>t.id===e.id)||f.push(e);if(a.data&&!d.current&&(d.current=[...f].sort((e,t)=>Number(t.state===`kept`)-Number(e.state===`kept`)).map(e=>e.id)),d.current){let e=new Map(d.current.map((e,t)=>[e,t]));for(let t of f)e.has(t.id)||(e.set(t.id,d.current.length),d.current.push(t.id));f.sort((t,n)=>e.get(t.id)-e.get(n.id))}return(0,S.jsxs)(`section`,{className:`memory-page`,children:[(0,S.jsx)(c,{title:`记忆`,children:(0,S.jsx)(_,{icon:`plus`,label:`新增记忆`,disabled:!!o,onClick:()=>s(n())})}),(0,S.jsx)(g,{error:!0,children:a.error}),!a.data&&a.loading&&(0,S.jsx)(`p`,{role:`status`,children:`加载中…`}),(0,S.jsxs)(`div`,{className:`memory-cards`,children:[o&&(0,S.jsx)(w,{id:o,onDone:()=>s(null),reload:a.reload},o),f.map(e=>(0,S.jsx)(w,{id:e.id,card:e,reload:a.reload,onEditing:t=>u(n=>{let r={...n};return t?r[e.id]=e:delete r[e.id],r})},e.id))]}),a.data&&f.length===0&&!o&&(0,S.jsx)(`p`,{className:`memory-empty`,children:`暂无记忆`})]})}function w({id:e,card:t,reload:n,onDone:r,onEditing:i}){let{request:o}=m(),[c,l]=(0,v.useState)(!t),[u,p]=(0,v.useState)(t?.text??``),[h,x]=(0,v.useState)(t?.revision),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(``),D=(0,v.useRef)(!1),O=(0,v.useRef)(!1);function k(){O.current=!1,i?.(!0),p(t?.text??``),x(t?.revision),E(``),l(!0)}function A(){O.current=!0,l(!1),E(``),i?.(!1),r?.()}async function j(f){if(!D.current){if(!f&&t&&u===t.text)l(!1),i?.(!1);else if((!f||f===`keep`)&&!y.safeParse(c?u:t?.text).success)E(`请填写一句记忆,最多 120 个字符。`);else{D.current=!0,w(!0),E(``);try{t?await o(`memory/${e}`,d({saved:a()}),{method:`PATCH`,body:{expectedRevision:c?h:t.revision,...f?{action:f}:{},...c&&f!==`discard`&&f!==`delete`?{text:u}:{}}}):await o(`memory`,b,{method:`POST`,body:{id:e,text:u}}),l(!1),await n(),i?.(!1),r?.()}catch(e){E(s(e)),await n()}finally{D.current=!1,w(!1)}}}}return(0,S.jsxs)(`article`,{className:`memory-card`,"data-testid":`memory-card`,"data-memory-id":e,children:[(0,S.jsx)(`span`,{className:`memory-status ${t?.state===`kept`?`is-kept`:``}`,role:`img`,"aria-label":t?.state===`kept`?`已保留`:`待确认`,children:(0,S.jsx)(f,{name:t?.state===`kept`?`check`:`question`})}),(0,S.jsxs)(`div`,{className:`memory-content`,children:[c?(0,S.jsx)(`textarea`,{autoFocus:!0,"aria-label":`记忆内容`,value:u,maxLength:120,rows:2,disabled:C,onChange:e=>p(e.target.value.replace(/[\r\n]+/g,` `)),onBlur:e=>{O.current?O.current=!1:e.relatedTarget instanceof Element&&e.relatedTarget.closest(`.memory-actions`)||T||j()},onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Escape`&&(e.preventDefault(),A()),e.key===`Enter`&&(e.preventDefault(),j()))}}):(0,S.jsx)(`button`,{type:`button`,className:`memory-text`,"aria-label":`编辑记忆:${t?.text??``}`,onClick:k,children:t?.text}),(0,S.jsx)(g,{error:!0,children:T})]}),(0,S.jsxs)(`div`,{className:`memory-actions`,onMouseDown:e=>{c&&e.preventDefault()},children:[(!t||t.state===`draft`)&&(0,S.jsx)(_,{icon:`check`,label:t?`保留记忆`:`保存记忆`,disabled:C,onClick:()=>void j(t?`keep`:void 0)}),c&&t?.state===`kept`&&(0,S.jsx)(_,{icon:`check`,label:`保存记忆`,disabled:C,onClick:()=>void j()}),(0,S.jsx)(_,{icon:`close`,label:t?t.state===`draft`?`舍弃记忆`:`删除记忆`:`取消新增`,disabled:C,onClick:()=>{t?j(t.state===`draft`?`discard`:`delete`):A()}})]})]})}export{C as Memory};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.session-handoff{border-block:1px solid var(--color-line);padding-block:10px}.session-handoff>summary{cursor:pointer;font-weight:600}.session-handoff[open]>summary{margin-bottom:12px}.session-handoff button{min-height:28px;padding:4px 10px;font-size:12px}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,D as r,G as i,H as a,I as o,J as s,K as c,L as l,M as u,N as d,O as f,P as p,R as m,V as h,W as g,X as _,Y as v,Z as y,b,d as x,f as S,k as C,m as w,nt as T,q as E,tt as D,v as O,w as k,x as A}from"./index-Bb8MF7Vk.js";import{n as j,r as M,t as N}from"./Markdown-hcMXu8Z6.js";import{n as P}from"./project-links-Dy6-B89_.js";import{i as F,r as I}from"./WorkspaceTree-D52TBZvy.js";var L=D(),R=g([`overview`,`handoff`]),z=v({title:_().trim().min(1),summary:_().trim().min(1)}).strict(),B=v({markdown:_().trim().min(1)}).strict(),V=z.extend({sourceRevision:h,sourceHash:n,generatedAt:_(),stale:c()}),H=v({kind:R,status:g([`absent`,`queued`,`running`,`succeeded`,`failed`]),available:c(),currentRevision:h,sourceRevision:h.nullable(),stale:c(),result:y([z,B]).nullable(),generatedAt:_().nullable(),error:_().nullable()}),U=g([`claude-code`,`codex`,`cursor`,`pi`,`dsh`]),W=v({formatVersion:E(1),adapterVersion:E(1),agent:U,nativeId:_().min(1).max(512),cwd:_().min(1).max(4096),messages:i(v({id:_().min(1).max(1024),role:g([`user`,`assistant`]),text:_().min(1),source:_().min(1).max(1024)}).strict())}).strict().refine(e=>new Set(e.messages.map(e=>e.id)).size===e.messages.length,`Duplicate message IDs.`);v({operationId:e(),sessionKey:n,parentRevision:h,blob:m}).strict(),v({revision:h,hash:n.nullable(),cleared:c()});var G=v({owner:a,sessionKey:n,agent:U,nativeId:_(),cwd:_(),title:_(),revision:h,updatedAt:_(),messageCount:s().int().nonnegative(),blob:m,overview:V.optional()}),K=v({sessions:i(G),nextCursor:h.nullable()}),q=v({totalSessions:s().int().nonnegative(),totalMessages:s().int().nonnegative(),memberCount:s().int().nonnegative(),updatedAt:_().nullable()});v({owner:a.optional(),sessionKey:n.optional()}).strict().refine(e=>!e.sessionKey||!!e.owner,`A session scope requires an owner.`);var J=v({matches:i(v({owner:a,sessionKey:n,revision:h,messageId:_(),source:g([`message`,`handoff`]).default(`message`),role:g([`user`,`assistant`]),snippet:_(),title:_()})),nextCursor:h.nullable()}),Y=v({owner:a,key:n,revision:h.refine(e=>e>0).optional(),messageId:_().min(1).optional(),source:g([`message`,`handoff`]).optional()});function X(e){let t=new URLSearchParams(e);if(![`owner`,`sessionKey`,`revision`,`messageId`].some(e=>t.has(e)))return{};let n=Y.safeParse({owner:t.get(`owner`),key:t.get(`sessionKey`),...t.has(`revision`)?{revision:Number(t.get(`revision`))}:{},...t.has(`messageId`)?{messageId:t.get(`messageId`)}:{},...t.has(`source`)?{source:t.get(`source`)}:{}});return n.success?{target:n.data}:{error:`对话链接不完整或已损坏。`}}var Z=u();function Q({members:e,refresh:t,selected:n,onOwner:r,onSession:i}){let[a,o]=(0,L.useState)(()=>new Set(n?.key?[n.owner]:[])),[s,c]=(0,L.useState)(e[0]?.id??``);return(0,Z.jsx)(`div`,{role:`tree`,"aria-label":`成员对话`,"data-testid":`session-tree`,onKeyDown:I,children:[...e].sort((e,t)=>F(e.id,t.id)).map(e=>(0,Z.jsxs)(`div`,{role:`none`,children:[(0,Z.jsxs)(S,{type:`button`,role:`treeitem`,"aria-level":1,"aria-expanded":a.has(e.id),"aria-selected":n?.owner===e.id&&!n.key,className:`tree-item tree-folder`,style:{"--tree-level":1},tabIndex:s===e.id?0:-1,"data-testid":`session-owner`,"data-owner-id":e.id,onFocus:()=>c(e.id),onClick:()=>{o(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),r(e.id)},leading:(0,Z.jsx)(`span`,{className:`tree-chevron ${a.has(e.id)?`expanded`:``}`,children:(0,Z.jsx)(b,{name:`chevron`,size:`small`})}),children:[(0,Z.jsx)(b,{name:`files`}),(0,Z.jsx)(`span`,{className:`tree-name`,title:e.id,children:e.id})]}),a.has(e.id)&&(0,Z.jsx)($,{owner:e.id,selected:n,onSession:i,focused:s,onFocus:c},`${e.id}/${t}`)]},e.id))})}function $({owner:e,selected:n,onSession:r,focused:i,onFocus:a}){let{request:s,projectId:c}=w(),l=(0,L.useCallback)(t=>s(`sessions?${new URLSearchParams({owner:e,limit:`50`,order:`updated`})}`,K,{signal:t}),[e,s]),u=C(l,15e3,t(c,`session-tree`,e)),[d,f]=(0,L.useState)(),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(``),v=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>v.current?.abort(),[]);let y=d?d.nextCursor:u.data?.nextCursor;return(0,Z.jsxs)(`div`,{role:`group`,"aria-busy":u.loading||m,children:[(0,Z.jsx)(k,{error:!0,children:u.error||g}),u.error&&(0,Z.jsx)(`button`,{onClick:()=>void u.reload(),children:`重试`}),u.loading&&!u.data&&(0,Z.jsx)(`span`,{className:`tree-status`,role:`status`,children:`正在加载…`}),[...new Map([...d?.sessions??[],...u.data?.sessions??[]].map(e=>[e.sessionKey,e])).values()].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)||e.sessionKey.localeCompare(t.sessionKey)).map(t=>(0,Z.jsxs)(S,{type:`button`,role:`treeitem`,"aria-level":2,"aria-selected":n?.owner===e&&n.key===t.sessionKey,className:`tree-item`,style:{"--tree-level":2},tabIndex:i===`${e}/${t.sessionKey}`?0:-1,"data-testid":`session-row`,"data-owner-id":e,"data-session-key":t.sessionKey,title:o(t.title||t.nativeId),onFocus:()=>a(`${e}/${t.sessionKey}`),onClick:()=>r({owner:e,key:t.sessionKey,title:t.title||t.nativeId}),leading:(0,Z.jsx)(`span`,{className:`tree-chevron`}),children:[(0,Z.jsx)(b,{name:`sessions`}),(0,Z.jsx)(`span`,{className:`tree-name`,children:o(t.title||t.nativeId)})]},t.sessionKey)),y!=null&&(0,Z.jsx)(`button`,{className:`tree-action`,"data-testid":`session-tree-more`,disabled:m,onClick:async()=>{h(!0),_(``);let t=new AbortController;v.current=t;try{let n=await s(`sessions?${new URLSearchParams({owner:e,after:String(y),limit:`50`,order:`updated`})}`,K,{signal:t.signal});f(e=>({sessions:[...e?.sessions??[],...n.sessions],nextCursor:n.nextCursor}))}catch(e){t.signal.aborted||_(p(e))}finally{t.signal.aborted||h(!1)}},children:`加载更多`})]})}function ee({info:e,targeted:t=!1,highlight:n=``}){let[r,i]=(0,L.useState)(t),a=(0,L.useRef)(null);return(0,L.useEffect)(()=>{t&&a.current?.scrollIntoView({block:`center`})},[t]),(0,Z.jsxs)(`details`,{ref:a,open:r,className:`session-handoff`,onToggle:e=>i(e.currentTarget.open),children:[(0,Z.jsx)(`summary`,{children:`交接说明`}),r&&(0,Z.jsx)(te,{info:e,revision:t?e.revision:void 0,highlight:n})]})}function te({info:e,revision:t,highlight:n}){let{request:i}=w(),a=`sessions/${encodeURIComponent(e.owner)}/${e.sessionKey}`,o=(0,L.useCallback)(e=>i(`${a}/analysis/handoff${t===void 0?``:`?revision=${t}`}`,H,{signal:e}),[i,a,t]),s=C(o,5e3),c=f(),[l,u]=(0,L.useState)(!1),[d,m]=(0,L.useState)(``),h=s.data,g=l||h?.status===`queued`||h?.status===`running`,_=h?.result&&`markdown`in h.result?h.result.markdown:void 0;return(0,Z.jsxs)(`div`,{className:`stack`,"data-testid":`session-handoff`,children:[(0,Z.jsx)(k,{error:!0,children:d||s.error}),s.loading&&!h&&(0,Z.jsx)(`small`,{role:`status`,children:`正在加载…`}),h&&(0,Z.jsxs)(`div`,{className:`inline-actions`,children:[h.status===`failed`&&t===void 0&&(0,Z.jsx)(`button`,{"data-testid":`session-handoff-generate`,disabled:g||!h.available,onClick:async()=>{u(!0),m(``);try{await i(`${a}/handoff`,H,{method:`POST`,signal:c}),await s.reload()}catch(e){c.aborted||m(p(e))}finally{c.aborted||u(!1)}},children:g?`正在整理…`:`重试`}),!h.available&&(0,Z.jsx)(`small`,{children:`请先配置项目模型接入点`}),h.status===`failed`&&(0,Z.jsx)(`small`,{children:`整理未完成,可重试`}),h.available&&h.status!==`failed`&&(!_||h.stale||g)&&(0,Z.jsx)(`small`,{role:`status`,children:h.status===`running`||l?`正在整理…`:_?`对话已有新内容,等待自动更新…`:`等待自动整理…`}),h.currentRevision!==e.revision&&(0,Z.jsx)(`small`,{children:`交接说明使用最新对话;当前阅读的是历史原文`})]}),_&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`small`,{children:[`基于版本 `,h.sourceRevision,` · `,(0,Z.jsx)(r,{value:h.generatedAt})]}),(0,Z.jsx)(`div`,{className:`markdown`,"data-testid":`session-handoff-body`,children:(0,Z.jsx)(N,{highlight:n,children:_})})]})]})}function ne({members:e}){let{request:n,projectId:r,api:i}=w(),a=(0,L.useCallback)(async e=>{let[t,r]=await Promise.all([n(`sessions/stats`,q,{signal:e}),i.members(e)]);return{...t,members:r.members}},[n,i]),s=C(a,!0,t(r,`session-stats`)),[c,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(``),[p,m]=(0,L.useState)(0),[h]=(0,L.useState)(()=>X(location.search)),[g,_]=(0,L.useState)(h.target),[v,y]=(0,L.useState)(h.target),[b,S]=(0,L.useState)(h.error??``),[E,D]=(0,L.useState)(``),j=(0,L.useRef)(null),M=g?.key?g.title?`搜索对话:${o(g.title)}`:`搜索当前对话`:g?`搜索:${g.owner} 的对话内容`:``,N=()=>{_(void 0),D(``),F(),j.current?.focus()};function F(){if(!v?.messageId)return;let{messageId:e,...t}=v;y(t),history.replaceState(null,``,T(P(r,t.owner,t.key,t)))}let I=(0,L.useCallback)(e=>{_(t=>t?.owner===e.owner&&t.key===e.sessionKey&&t.title!==e.title?{...t,title:e.title}:t)},[]);(0,L.useEffect)(()=>{let e=()=>{let e=X(location.search);y(e.target),_(e.target),S(e.error??``),f(``),u(``),D(``)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let R=(e,t=``)=>{y(e),_(e),f(``),D(t),S(``),history.replaceState(null,``,T(P(r,e.owner,e.key,e)))};return(0,Z.jsxs)(`div`,{className:`split-layout file-explorer session-explorer`,children:[(0,Z.jsxs)(`section`,{className:`file-tree-pane`,"aria-label":`${l.sessions}目录`,children:[(0,Z.jsx)(x,{title:l.sessions,icon:`sessions`,count:(0,Z.jsx)(`span`,{"data-testid":`session-total`,children:s.data?.totalSessions??`—`}),children:(0,Z.jsx)(A,{icon:`refresh`,label:`刷新${l.sessions}`,"data-testid":`sessions-refresh`,disabled:s.loading,onClick:()=>{s.reload(),m(e=>e+1)}})}),(0,Z.jsx)(k,{error:!0,children:s.error}),(0,Z.jsx)(Q,{members:(s.data?.members??e).filter(e=>e.hasSessions),refresh:p,selected:g,onOwner:e=>{_({owner:e}),y(void 0),f(``),D(``),S(``),history.replaceState(null,``,T(`/projects/${encodeURIComponent(r)}/sessions`))},onSession:R})]}),(0,Z.jsxs)(`section`,{className:`session-reader`,"aria-label":`对话内容与搜索`,children:[(0,Z.jsx)(`div`,{className:`session-reader-content`,children:b?(0,Z.jsx)(k,{error:!0,children:b}):d?(0,Z.jsx)(re,{query:d,refresh:p,scope:{...g?{owner:g.owner}:{},...g?.key?{sessionKey:g.key}:{}},onSelect:e=>R(e,d)},`${d}/${g?.owner??``}/${g?.key??``}`):v?(0,Z.jsx)(ie,{selection:v,highlight:E,onLoaded:I,onLatest:()=>R({owner:v.owner,key:v.key})},`${v.owner}/${v.key}/${v.revision}/${v.source}/${p}`):(0,Z.jsx)(O,{mascot:!0,title:`选择对话开始阅读`,description:`也可以在下方搜索会话库内容。`})}),(0,Z.jsxs)(`form`,{className:`session-search-dock`,"data-testid":`session-search-form`,onSubmit:e=>{e.preventDefault(),f(c.trim()),D(``),S(``),m(e=>e+1)},children:[g&&(0,Z.jsxs)(`button`,{type:`button`,className:`search-scope-chip`,"data-testid":`session-search-scope`,title:`清除搜索范围`,"aria-label":`清除范围:${M}`,onClick:N,children:[(0,Z.jsx)(`span`,{className:`scope-label`,children:M}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`×`})]}),(0,Z.jsxs)(`div`,{className:`session-search-input-row`,children:[(0,Z.jsx)(`input`,{ref:j,"aria-label":`搜索对话`,"data-testid":`session-query`,value:c,maxLength:500,placeholder:`搜索会话库内容`,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Backspace`&&!c&&g&&(e.preventDefault(),N())}}),(d||c||E)&&(0,Z.jsx)(A,{icon:`close`,label:`清空搜索`,"data-testid":`session-search-clear`,onClick:()=>{u(``),f(``),D(``),F(),j.current?.focus()}}),(0,Z.jsx)(A,{icon:`search`,type:`submit`,label:`搜索`,"data-testid":`session-search`,disabled:!c.trim()})]})]})]})]})}function re({query:e,refresh:t,scope:n,onSelect:r}){let{request:i}=w(),[a,s]=(0,L.useState)(0),c=(0,L.useCallback)(t=>i(`sessions/search?${new URLSearchParams({q:e,after:String(a),limit:`30`,order:`updated`,...n.owner?{owner:n.owner}:{},...n.sessionKey?{sessionKey:n.sessionKey}:{}})}`,J,{signal:t}),[i,e,a,t,n.owner,n.sessionKey]),l=C(c);return(0,Z.jsxs)(`section`,{className:`session-results stack`,"aria-label":`搜索结果`,"aria-busy":l.loading,children:[(0,Z.jsx)(k,{error:!0,children:l.error}),l.error&&(0,Z.jsx)(`button`,{onClick:()=>void l.reload(),children:`重试`}),l.loading&&(0,Z.jsx)(`p`,{role:`status`,children:`正在搜索…`}),!l.loading&&l.data?.matches.map(t=>(0,Z.jsxs)(`button`,{className:`session-item`,"data-testid":`session-match`,"data-message-id":t.messageId,onClick:()=>r({owner:t.owner,key:t.sessionKey,revision:t.revision,messageId:t.messageId||void 0,source:t.source,title:t.title}),children:[(0,Z.jsx)(`strong`,{children:o(t.title)}),(0,Z.jsxs)(`small`,{children:[t.owner,` ·`,` `,t.source===`handoff`?`交接说明`:t.role===`user`?`用户`:`助手`]}),(0,Z.jsx)(`span`,{className:`session-excerpt`,children:(0,Z.jsx)(j,{value:M(t.snippet,e),query:e})})]},`${t.owner}:${t.sessionKey}:${t.revision}:${t.source}:${t.messageId}`)),!l.loading&&l.data?.matches.length===0&&(0,Z.jsx)(`p`,{className:`empty`,children:`没有找到匹配的对话`}),l.data?.nextCursor!=null&&(0,Z.jsx)(`button`,{"data-testid":`sessions-next`,disabled:l.loading,onClick:()=>s(l.data.nextCursor),children:`下一页`}),a>0&&(0,Z.jsx)(`button`,{disabled:l.loading,onClick:()=>s(0),children:`返回第一页`})]})}function ie({selection:e,highlight:t,onLoaded:n,onLatest:r}){let{request:i}=w(),a=(0,L.useCallback)(async t=>{try{return await i(`sessions/${encodeURIComponent(e.owner)}/${e.key}${e.revision===void 0?``:`?revision=${e.revision}`}`,G,{signal:t})}catch(e){throw e instanceof d&&e.code===`SESSION_NOT_FOUND`?Error(`找不到这条对话或引用的版本,原链接可能已失效。`):e}},[i,e.owner,e.key,e.revision]),o=C(a,5e3);return(0,L.useEffect)(()=>{o.data&&n(o.data)},[o.data,n]),(0,Z.jsxs)(`section`,{className:`session-conversation stack`,"data-testid":`session-detail`,children:[(0,Z.jsx)(k,{error:!0,children:o.error}),o.error&&(0,Z.jsx)(`button`,{onClick:()=>void o.reload(),children:`重试`}),o.loading&&!o.data&&(0,Z.jsx)(`p`,{role:`status`,children:`正在读取对话…`}),o.data&&(0,Z.jsx)(ae,{info:o.data,messageId:e.messageId,handoff:e.source===`handoff`,highlight:t,pinned:e.revision!==void 0,onLatest:r},o.data.blob.sha256)]})}function ae({info:e,messageId:t,handoff:n,highlight:i,pinned:a,onLatest:s}){let{readTextBlob:c,projectId:l}=w(),u=(0,L.useCallback)(async t=>W.parse(JSON.parse(await c(e.blob,t))),[e.blob.sha256,e.blob.size]),d=C(u),f=(0,L.useRef)(null);return(0,L.useEffect)(()=>{d.data&&t&&f.current?.scrollIntoView({block:`center`})},[d.data,t]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`header`,{className:`conversation-header`,children:[(0,Z.jsx)(`h2`,{className:`session-title`,children:o(e.title||e.nativeId)}),(0,Z.jsxs)(`p`,{children:[e.owner,` · `,e.agent,` · `,e.messageCount,` 条消息`]}),(0,Z.jsxs)(`small`,{children:[(0,Z.jsx)(r,{value:e.updatedAt}),a&&(0,Z.jsxs)(Z.Fragment,{children:[` `,`· 引用版本 `,e.revision,` ·`,` `,(0,Z.jsx)(`a`,{href:T(P(l,e.owner,e.sessionKey)),onClick:e=>{e.preventDefault(),s()},children:`查看最新`})]})]}),e.overview&&(0,Z.jsx)(`p`,{"data-testid":`session-summary`,children:e.overview.summary}),e.overview?.stale&&(0,Z.jsx)(`small`,{children:`摘要待更新`})]}),(0,Z.jsx)(ee,{info:e,targeted:n,highlight:n?i:``}),(0,Z.jsx)(k,{error:!0,children:d.error}),d.error&&(0,Z.jsx)(`button`,{onClick:()=>void d.reload(),children:`重新读取`}),d.loading&&(0,Z.jsx)(`p`,{role:`status`,children:`正在读取对话…`}),d.data&&(0,Z.jsxs)(Z.Fragment,{children:[t&&!d.data.messages.some(e=>e.id===t)&&(0,Z.jsx)(k,{children:`该版本中找不到引用的消息,已打开对话原文。`}),(0,Z.jsx)(`div`,{className:`session-messages`,children:d.data.messages.map(e=>(0,Z.jsxs)(`article`,{className:`session-message ${e.role} ${e.id===t?`matched`:``}`,"data-testid":`session-message`,"data-message-id":e.id,ref:e.id===t?f:void 0,children:[(0,Z.jsx)(`div`,{className:`message-role`,children:e.role===`user`?`用户`:`助手`}),(0,Z.jsx)(`div`,{className:`markdown`,children:(0,Z.jsx)(N,{highlight:i,children:e.text})})]},e.id))})]})]})}export{ne as Sessions};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,M as t,P as n,b as r,c as i,f as a,k as o,l as s,m as c,s as l,tt as u,u as d,w as f}from"./index-Bb8MF7Vk.js";var p=u(),m=new Intl.Collator(`zh-CN`,{numeric:!0,sensitivity:`base`});function h(e,t){return m.compare(e,t)||(e<t?-1:+(e>t))}var g=t();function _(e){let t=e.target.closest(`[role="treeitem"]`);if(!t)return;let n=[...e.currentTarget.querySelectorAll(`[role="treeitem"]`)],r=n.indexOf(t),i=Number(t.getAttribute(`aria-level`)),a;switch(e.key){case`ArrowDown`:a=n[r+1];break;case`ArrowUp`:a=n[r-1];break;case`Home`:a=n[0];break;case`End`:a=n.at(-1);break;case`ArrowRight`:t.getAttribute(`aria-expanded`)===`false`?t.click():Number(n[r+1]?.getAttribute(`aria-level`))>i&&(a=n[r+1]);break;case`ArrowLeft`:t.getAttribute(`aria-expanded`)===`true`?t.click():a=n.slice(0,r).reverse().find(e=>Number(e.getAttribute(`aria-level`))<i);break;default:return}e.preventDefault(),a?.focus()}var v=(e,t)=>`${e}/${t}`,y=e=>({"--tree-level":e});function b({members:e,...t}){let[n,r]=(0,p.useState)(()=>`folder:${v(e.find(e=>e.hasFiles)?.id??`_project`,``)}`);return(0,g.jsx)(`div`,{role:`tree`,"aria-label":`工作区文件`,"data-testid":`workspace-tree`,onKeyDown:_,children:(0,g.jsx)(S,{owner:l,path:``,level:1,members:e.filter(e=>e.hasFiles),context:{...t,focused:n,onFocus:r}})})}function x({owner:e,path:t,level:n,context:i}){let o=i.expanded.has(v(e,t)),s=`folder:${v(e,t)}`;return(0,g.jsxs)(`div`,{role:`none`,children:[(0,g.jsxs)(a,{type:`button`,role:`treeitem`,className:`tree-item tree-folder`,style:y(n),"aria-label":t||e,"aria-level":n,"aria-expanded":o,"aria-selected":i.selected?.kind===`directory`&&i.selected.owner===e&&i.selected.path===t,tabIndex:i.focused===s?0:-1,"data-testid":`directory-row`,"data-owner-id":e,"data-directory-path":t,onFocus:()=>i.onFocus(s),onClick:()=>i.onToggle(e,t),leading:(0,g.jsx)(`span`,{className:`tree-chevron ${o?`expanded`:``}`,children:(0,g.jsx)(r,{name:`chevron`,size:`small`})}),children:[(0,g.jsx)(r,{name:`files`}),(0,g.jsx)(`span`,{className:`tree-name`,children:t.split(`/`).at(-1)||e})]}),o&&(0,g.jsx)(S,{owner:e,path:t,level:n+1,context:i})]})}function S({owner:t,path:l,level:u,context:m,members:_=[]}){let{api:b,projectId:S}=c(),C=(0,p.useCallback)(e=>b.tree(t,l,void 0,``,e),[t,l]),w=o(C,!1,e(S,`file-tree`,t,l)),[T,E]=(0,p.useState)(),[D,O]=(0,p.useState)(!1),[k,A]=(0,p.useState)(``),j=(0,p.useRef)(null);(0,p.useEffect)(()=>()=>j.current?.abort(),[]);let M=T?.revision===w.data?.revision?T:void 0,N=M?M.nextCursor:w.data?.nextCursor;async function P(){if(!N||!w.data||D)return;O(!0),A(``);let e=new AbortController;j.current=e;try{let n=await b.tree(t,l,w.data.revision,N,e.signal);e.signal.aborted||E({...n,entries:[...M?.entries??[],...n.entries]})}catch(t){e.signal.aborted||A(n(t))}finally{e.signal.aborted||O(!1)}}let F=[...(w.data?.entries??[]).filter(e=>!s(e.path)),...(M?.entries??[]).filter(e=>!s(e.path))],I=m.revealed;if(I?.owner===t&&!s(I.path)&&(!l||I.path.startsWith(l+`/`))){let e=l?I.path.slice(l.length+1):I.path,t=e.indexOf(`/`),n=t<0?I.path:[l,e.slice(0,t)].filter(Boolean).join(`/`);F.some(e=>e.path===n)||F.push(t<0?{...I.file,kind:`file`}:{kind:`directory`,path:n})}let L=[...F.filter(e=>t!==`_project`||!i(e.path)).map(e=>({...e,owner:t})),..._.map(e=>({kind:`directory`,path:``,owner:e.id}))].sort((e,t)=>e.kind===t.kind?h(e.path.split(`/`).at(-1)||e.owner,t.path.split(`/`).at(-1)||t.owner):e.kind===`directory`?-1:1);return(0,g.jsxs)(`div`,{role:`group`,"aria-label":v(d(t)?`teamcontext`:t,l),"aria-busy":w.loading||D,children:[w.loading&&(0,g.jsx)(`p`,{className:`tree-status`,role:`status`,children:`正在加载…`}),(0,g.jsx)(f,{error:!0,children:w.error||k}),w.error&&(0,g.jsx)(`button`,{className:`tree-action`,onClick:()=>void w.reload(),children:`重试`}),L.map(e=>e.kind===`directory`?(0,g.jsx)(x,{owner:e.owner,path:e.path,level:u,context:m},v(e.owner,e.path)):(0,g.jsxs)(a,{type:`button`,role:`treeitem`,className:`tree-item`,style:y(u),"aria-label":e.path,"aria-level":u,"aria-selected":m.selected?.kind===`file`&&m.selected.owner===t&&m.selected.path===e.path,tabIndex:m.focused===`file:${v(t,e.path)}`?0:-1,"data-testid":`file-row`,"data-owner-id":t,"data-file-path":e.path,onFocus:()=>m.onFocus(`file:${v(t,e.path)}`),onClick:()=>m.onSelect(t,e.path),leading:(0,g.jsx)(`span`,{className:`tree-chevron`}),children:[(0,g.jsx)(r,{name:`file`}),(0,g.jsx)(`span`,{className:`tree-name`,children:e.path.split(`/`).at(-1)})]},e.path)),N&&(0,g.jsx)(`button`,{className:`tree-action`,"data-testid":`files-load-more`,disabled:D,onClick:()=>void P(),children:D?`正在加载…`:`加载更多`})]})}export{h as i,v as n,_ as r,b as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{z as e}from"./index-Bb8MF7Vk.js";function t(t,n){if(!n||/^(?:[a-z][a-z0-9+.-]*:|\/)/i.test(n))return null;try{let r=n.split(/[?#]/,1)[0],i=r?t.split(`/`).slice(0,-1):t.split(`/`);for(let e of r.split(`/`)){let t=decodeURIComponent(e);if(t&&t!==`.`){if(t===`..`){if(!i.length)return null;i.pop()}else{if(t.includes(`/`)||t.includes(`\\`))return null;i.push(t)}}}return{path:i.length?e.parse(i.join(`/`)):``,directory:r.endsWith(`/`),anchor:n.includes(`#`)?decodeURIComponent(n.slice(n.indexOf(`#`)+1)):``}}catch{return null}}export{t};
|