@blade-hq/agent-react 2612.0.0-beta.103 → 2612.0.0-beta.105
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/dist/{PlanGraph-3D5PCSIJ.js → PlanGraph-WTXKSHID.js} +31 -3
- package/dist/PlanGraph-WTXKSHID.js.map +1 -0
- package/dist/chat/plan/PlanGraph.d.ts +1 -0
- package/dist/chat.css +112 -2
- package/dist/{chunk-WSGAVB4B.js → chunk-BEBV7M7V.js} +71 -18
- package/dist/chunk-BEBV7M7V.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/internal.js +1 -1
- package/dist/rich-input.js +1 -1
- package/dist/rich-input.js.map +1 -1
- package/dist/style.full.css +113 -3
- package/package.json +2 -2
- package/dist/PlanGraph-3D5PCSIJ.js.map +0 -1
- package/dist/chunk-WSGAVB4B.js.map +0 -1
|
@@ -74,6 +74,12 @@ function layoutPlan(nodes) {
|
|
|
74
74
|
height: y
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
+
function isFlatPlan(nodes) {
|
|
78
|
+
const ids = new Set(nodes.map((node) => node.id));
|
|
79
|
+
return nodes.every(
|
|
80
|
+
(node) => !node.parent_id && !(node.depends_on ?? []).some((dependency) => ids.has(dependency))
|
|
81
|
+
);
|
|
82
|
+
}
|
|
77
83
|
function shouldAnimatePlanDone(previous, status, historical) {
|
|
78
84
|
return !historical && previous !== void 0 && previous !== "done" && status === "done";
|
|
79
85
|
}
|
|
@@ -111,7 +117,7 @@ function createPlanGraph(React) {
|
|
|
111
117
|
"data-stage": stage || void 0,
|
|
112
118
|
"data-enter": animateEntry || void 0,
|
|
113
119
|
"data-agent-running": agentRunning || void 0,
|
|
114
|
-
style: { width: WIDTH, height: HEIGHT, transform: `translate(${point.x}px, ${point.y}px)` },
|
|
120
|
+
style: point ? { width: WIDTH, height: HEIGHT, transform: `translate(${point.x}px, ${point.y}px)` } : void 0,
|
|
115
121
|
children: /* @__PURE__ */ jsxs("div", { className: "blade-plan-node-body", children: [
|
|
116
122
|
/* @__PURE__ */ jsxs("div", { className: "blade-plan-node-status", children: [
|
|
117
123
|
status === "done" ? /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { className: animateDone ? "blade-plan-check" : void 0, d: "M3 8l3 3 7-7", pathLength: "1", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ jsx("span", { className: "blade-plan-dot" }),
|
|
@@ -126,13 +132,34 @@ function createPlanGraph(React) {
|
|
|
126
132
|
}
|
|
127
133
|
return function PlanGraph({ plan, historical = false, agentActions }) {
|
|
128
134
|
const firstNodes = React.useRef(new Set(plan.nodes.map((node) => node.id)));
|
|
129
|
-
const
|
|
135
|
+
const flat = React.useMemo(() => isFlatPlan(plan.nodes), [plan.nodes]);
|
|
136
|
+
const { positions, stages, groups, width, height } = React.useMemo(
|
|
137
|
+
() => flat ? { positions: /* @__PURE__ */ new Map(), stages: /* @__PURE__ */ new Map(), groups: [], width: 0, height: 0 } : layoutPlan(plan.nodes),
|
|
138
|
+
[flat, plan.nodes]
|
|
139
|
+
);
|
|
130
140
|
const arrowId = React.useId();
|
|
131
141
|
const statuses = new Map(plan.nodes.map((node) => [
|
|
132
142
|
node.id,
|
|
133
143
|
stages.has(node.id) ? deriveParentStatus(stages.get(node.id) ?? []) : node.status ?? "pending"
|
|
134
144
|
]));
|
|
135
145
|
const live = !historical && plan.phase === "executing";
|
|
146
|
+
if (flat) {
|
|
147
|
+
return (
|
|
148
|
+
// biome-ignore lint/a11y/noNoninteractiveTabindex: keyboard users must be able to scroll the canvas.
|
|
149
|
+
/* @__PURE__ */ jsx("section", { className: "blade-plan-scroll", "aria-label": "\u8BA1\u5212\u6D41\u7A0B\u56FE", tabIndex: 0, children: /* @__PURE__ */ jsx("div", { className: "blade-plan-canvas", "data-layout": "grid", "data-live": live || void 0, children: /* @__PURE__ */ jsx("ul", { className: "blade-plan-nodes", "aria-label": "\u6267\u884C\u6B65\u9AA4", children: plan.nodes.map((node) => /* @__PURE__ */ jsx(
|
|
150
|
+
GraphNode,
|
|
151
|
+
{
|
|
152
|
+
node,
|
|
153
|
+
status: statuses.get(node.id) ?? "pending",
|
|
154
|
+
stage: false,
|
|
155
|
+
historical,
|
|
156
|
+
agentActions: live ? agentActions : void 0,
|
|
157
|
+
animateEntry: !historical && !firstNodes.current.has(node.id)
|
|
158
|
+
},
|
|
159
|
+
node.id
|
|
160
|
+
)) }) }) })
|
|
161
|
+
);
|
|
162
|
+
}
|
|
136
163
|
return (
|
|
137
164
|
// biome-ignore lint/a11y/noNoninteractiveTabindex: keyboard users must be able to scroll the canvas.
|
|
138
165
|
/* @__PURE__ */ jsx("section", { className: "blade-plan-scroll", "aria-label": "\u8BA1\u5212\u6D41\u7A0B\u56FE", tabIndex: 0, children: /* @__PURE__ */ jsxs("div", { className: "blade-plan-canvas", "data-live": live || void 0, style: { width, height }, children: [
|
|
@@ -183,7 +210,8 @@ function createPlanGraph(React) {
|
|
|
183
210
|
}
|
|
184
211
|
export {
|
|
185
212
|
createPlanGraph,
|
|
213
|
+
isFlatPlan,
|
|
186
214
|
layoutPlan,
|
|
187
215
|
shouldAnimatePlanDone
|
|
188
216
|
};
|
|
189
|
-
//# sourceMappingURL=PlanGraph-
|
|
217
|
+
//# sourceMappingURL=PlanGraph-WTXKSHID.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/chat/plan/PlanGraph.tsx"],"sourcesContent":["import type { PlanDocument, PlanLeafStatus, PlanNode } from \"@blade-hq/agent-client\"\nimport {\n deriveParentStatus, isTerminalPlanStatus, matchingPlanExecution, planStatusLabels, type PlanAgentActions,\n} from \"./presentation\"\n\nconst WIDTH = 212\nconst HEIGHT = 124\nconst COLUMN = WIDTH + 52\nconst ROW = HEIGHT + 16\nconst INSET = 16\n\ninterface Point { x: number; y: number }\n\nexport function layoutPlan(nodes: PlanNode[]) {\n const byId = new Map(nodes.map((node) => [node.id, node]))\n const stages = new Map<string, PlanNode[]>()\n for (const node of nodes) {\n if (!node.parent_id) continue\n const children = stages.get(node.parent_id) ?? []\n children.push(node)\n stages.set(node.parent_id, children)\n }\n const layers = new Map<string, number>()\n const layer = (id: string): number => {\n const cached = layers.get(id)\n if (cached !== undefined) return cached\n const node = byId.get(id)\n if (!node) return -1\n // A stage completes after its children. Use the same implicit dependencies\n // as the runner when assigning layers, including dependencies across stages.\n layers.set(id, 0)\n const dependencies = [...(node.depends_on ?? []), ...(stages.get(id) ?? []).map((child) => child.id)]\n const result = Math.max(0, ...dependencies.map((dependency) => layer(dependency) + 1))\n layers.set(id, result)\n return result\n }\n\n const positions = new Map<string, Point>()\n const groups: { id: string; top: number; height: number; width: number }[] = []\n let y = INSET\n const place = (members: PlanNode[], stage?: PlanNode) => {\n const rows = new Map<number, number>()\n const firstLayer = Math.min(...members.map((node) => layer(node.id)))\n const lastLayer = Math.max(...members.map((node) => layer(node.id)))\n const inset = stage ? INSET : 0\n for (const node of members) {\n const column = layer(node.id)\n const row = rows.get(column) ?? 0\n positions.set(node.id, { x: INSET + column * COLUMN, y: y + inset + row * ROW })\n rows.set(column, row + 1)\n }\n const height = Math.max(...rows.values()) * ROW\n if (stage) {\n groups.push({\n id: stage.id,\n top: y,\n height: height + INSET,\n width: (lastLayer - firstLayer) * COLUMN + WIDTH + INSET * 2,\n })\n }\n y += height + inset * 2\n }\n const roots = nodes.filter((node) => !node.parent_id)\n const independent = roots.filter((node) => !stages.has(node.id))\n if (independent.length) place(independent)\n for (const root of roots) {\n const children = stages.get(root.id)\n if (children) place([...children, root], root)\n }\n return {\n positions,\n stages,\n groups,\n width: Math.max(0, ...layers.values()) * COLUMN + WIDTH + INSET * 2,\n height: y,\n }\n}\n\nexport function isFlatPlan(nodes: PlanNode[]): boolean {\n const ids = new Set(nodes.map((node) => node.id))\n return nodes.every(\n (node) => !node.parent_id && !(node.depends_on ?? []).some((dependency) => ids.has(dependency)),\n )\n}\n\nexport function shouldAnimatePlanDone(previous: PlanLeafStatus | undefined, status: PlanLeafStatus, historical: boolean) {\n return !historical && previous !== undefined && previous !== \"done\" && status === \"done\"\n}\n\ninterface PlanGraphProps {\n plan: PlanDocument\n historical?: boolean\n agentActions?: PlanAgentActions\n}\n\n// The classic-script embed loads this factory separately and supplies its React runtime.\nexport function createPlanGraph(React: typeof import(\"react\")) {\n function GraphNode({\n node, status, point, stage, historical, agentActions, animateEntry,\n }: {\n node: PlanNode; status: PlanLeafStatus; point?: Point; stage: boolean\n historical: boolean; agentActions?: PlanAgentActions; animateEntry: boolean\n }) {\n const previousStatus = React.useRef<PlanLeafStatus | undefined>(undefined)\n const [animateDone, setAnimateDone] = React.useState(false)\n React.useEffect(() => {\n if (previousStatus.current !== status) {\n setAnimateDone(shouldAnimatePlanDone(previousStatus.current, status, historical))\n previousStatus.current = status\n }\n }, [status, historical])\n const ref = node.agent_ref\n const execution = !historical && ref?.execution_id\n ? matchingPlanExecution(ref, agentActions?.findExecution?.(ref)) : undefined\n const agentRunning = execution?.status === \"running\" && !isTerminalPlanStatus(status)\n const binding = ref && <>{ref.agent.split(\"/\").filter(Boolean).at(-1)} · {agentRunning ? \"运行中\" : \"已绑定\"}</>\n\n return (\n <li\n className=\"blade-plan-node\"\n data-status={status}\n data-stage={stage || undefined}\n data-enter={animateEntry || undefined}\n data-agent-running={agentRunning || undefined}\n style={point ? { width: WIDTH, height: HEIGHT, transform: `translate(${point.x}px, ${point.y}px)` } : undefined}\n >\n <div className=\"blade-plan-node-body\">\n <div className=\"blade-plan-node-status\">\n {status === \"done\" ? (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n <path className={animateDone ? \"blade-plan-check\" : undefined} d=\"M3 8l3 3 7-7\" pathLength=\"1\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n ) : <span className=\"blade-plan-dot\" />}\n {planStatusLabels[status]}\n </div>\n <div className=\"blade-plan-node-label\" title={node.label}>{node.label}</div>\n {node.note && <div className=\"blade-plan-node-note\" title={node.note}>{node.note}</div>}\n {binding && (execution && agentActions?.openExecution ? (\n <button type=\"button\" className=\"blade-plan-binding\" title={ref?.agent} onClick={() => agentActions.openExecution?.(execution)}>{binding}</button>\n ) : <span className=\"blade-plan-binding\" title={ref?.agent}>{binding}</span>)}\n </div>\n </li>\n )\n }\n\n return function PlanGraph({ plan, historical = false, agentActions }: PlanGraphProps) {\n const firstNodes = React.useRef(new Set(plan.nodes.map((node) => node.id)))\n const flat = React.useMemo(() => isFlatPlan(plan.nodes), [plan.nodes])\n const { positions, stages, groups, width, height } = React.useMemo(\n () => (flat ? { positions: new Map<string, Point>(), stages: new Map<string, PlanNode[]>(), groups: [], width: 0, height: 0 } : layoutPlan(plan.nodes)),\n [flat, plan.nodes],\n )\n const arrowId = React.useId()\n const statuses = new Map(plan.nodes.map((node) => [\n node.id, stages.has(node.id) ? deriveParentStatus(stages.get(node.id) ?? []) : (node.status ?? \"pending\"),\n ]))\n const live = !historical && plan.phase === \"executing\"\n\n if (flat) {\n return (\n // biome-ignore lint/a11y/noNoninteractiveTabindex: keyboard users must be able to scroll the canvas.\n <section className=\"blade-plan-scroll\" aria-label=\"计划流程图\" tabIndex={0}>\n <div className=\"blade-plan-canvas\" data-layout=\"grid\" data-live={live || undefined}>\n <ul className=\"blade-plan-nodes\" aria-label=\"执行步骤\">\n {plan.nodes.map((node) => (\n <GraphNode\n key={node.id}\n node={node}\n status={statuses.get(node.id) ?? \"pending\"}\n stage={false}\n historical={historical}\n agentActions={live ? agentActions : undefined}\n animateEntry={!historical && !firstNodes.current.has(node.id)}\n />\n ))}\n </ul>\n </div>\n </section>\n )\n }\n\n return (\n // biome-ignore lint/a11y/noNoninteractiveTabindex: keyboard users must be able to scroll the canvas.\n <section className=\"blade-plan-scroll\" aria-label=\"计划流程图\" tabIndex={0}>\n <div className=\"blade-plan-canvas\" data-live={live || undefined} style={{ width, height }}>\n {groups.map((group) => {\n const members = [...(stages.get(group.id) ?? []).map((node) => node.id), group.id]\n const left = Math.min(...members.map((id) => positions.get(id)?.x ?? INSET)) - INSET / 2\n return <div key={group.id} className=\"blade-plan-stage\" style={{ left, top: group.top + 4, width: group.width - INSET, height: group.height }} />\n })}\n <svg className=\"blade-plan-edges\" width={width} height={height} aria-hidden=\"true\">\n <defs>\n <marker id={arrowId} viewBox=\"0 0 10 10\" refX={8} refY={5} markerWidth={6} markerHeight={6} orient=\"auto-start-reverse\">\n <path d=\"M0 0l10 5-10 5z\" fill=\"hsl(var(--muted-foreground))\" />\n </marker>\n </defs>\n {plan.nodes.flatMap((node) => [...new Set(node.depends_on)].map((fromId) => {\n const from = positions.get(fromId)\n const to = positions.get(node.id)\n if (!from || !to) return null\n const x1 = from.x + WIDTH\n const y1 = from.y + HEIGHT / 2\n const x2 = to.x - 3\n const y2 = to.y + HEIGHT / 2\n const mid = (x1 + x2) / 2\n const path = `M ${x1} ${y1} C ${mid} ${y1}, ${mid} ${y2}, ${x2} ${y2}`\n const active = live && statuses.get(node.id) === \"running\" && statuses.get(fromId) === \"done\"\n return (\n <g key={`${fromId}:${node.id}`}>\n <path d={path} className=\"blade-plan-edge\" markerEnd={`url(#${arrowId})`} />\n {active && <path d={path} className=\"blade-plan-flow\" />}\n </g>\n )\n }))}\n </svg>\n <ul className=\"blade-plan-nodes\" aria-label=\"执行步骤\">\n {plan.nodes.map((node) => {\n const point = positions.get(node.id)\n if (!point) return null\n return (\n <GraphNode\n key={node.id}\n node={node}\n status={statuses.get(node.id) ?? \"pending\"}\n point={point}\n stage={stages.has(node.id)}\n historical={historical}\n agentActions={live ? agentActions : undefined}\n animateEntry={!historical && !firstNodes.current.has(node.id)}\n />\n )\n })}\n </ul>\n </div>\n </section>\n )\n }\n}\n"],"mappings":";;;;;;;;;AAmH2B,mBAeX,KAfW;AA9G3B,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C;AAAA,WACJ;AAAA,QACA,oBAAC,QAAG,WAAU,oBAAmB,cAAW,4BACzC,eAAK,MAAM,IAAI,CAAC,SAAS;AACxB,gBAAM,QAAQ,UAAU,IAAI,KAAK,EAAE;AACnC,cAAI,CAAC,MAAO,QAAO;AACnB,iBACE;AAAA,YAAC;AAAA;AAAA,cAEC;AAAA,cACA,QAAQ,SAAS,IAAI,KAAK,EAAE,KAAK;AAAA,cACjC;AAAA,cACA,OAAO,OAAO,IAAI,KAAK,EAAE;AAAA,cACzB;AAAA,cACA,cAAc,OAAO,eAAe;AAAA,cACpC,cAAc,CAAC,cAAc,CAAC,WAAW,QAAQ,IAAI,KAAK,EAAE;AAAA;AAAA,YAPvD,KAAK;AAAA,UAQZ;AAAA,QAEJ,CAAC,GACH;AAAA,SACF,GACF;AAAA;AAAA,EAEJ;AACF;","names":[]}
|
|
@@ -16,6 +16,7 @@ export declare function layoutPlan(nodes: PlanNode[]): {
|
|
|
16
16
|
width: number;
|
|
17
17
|
height: number;
|
|
18
18
|
};
|
|
19
|
+
export declare function isFlatPlan(nodes: PlanNode[]): boolean;
|
|
19
20
|
export declare function shouldAnimatePlanDone(previous: PlanLeafStatus | undefined, status: PlanLeafStatus, historical: boolean): boolean;
|
|
20
21
|
interface PlanGraphProps {
|
|
21
22
|
plan: PlanDocument;
|
package/dist/chat.css
CHANGED
|
@@ -188,6 +188,40 @@
|
|
|
188
188
|
overflow: hidden;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
+
.blade-plan-header-row {
|
|
192
|
+
display: flex;
|
|
193
|
+
align-items: center;
|
|
194
|
+
width: 100%;
|
|
195
|
+
min-width: 0;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.blade-plan-header-row > .blade-plan-header {
|
|
199
|
+
flex: 1;
|
|
200
|
+
min-width: 0;
|
|
201
|
+
width: auto;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.blade-plan-header-actions {
|
|
205
|
+
display: flex;
|
|
206
|
+
align-items: center;
|
|
207
|
+
flex-shrink: 0;
|
|
208
|
+
gap: .5rem;
|
|
209
|
+
padding-inline-end: .8rem;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.blade-plan-header-toggle {
|
|
213
|
+
display: inline-flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
justify-content: center;
|
|
216
|
+
padding: .3rem;
|
|
217
|
+
border-radius: 6px;
|
|
218
|
+
color: hsl(var(--foreground));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.blade-plan-header-toggle:hover {
|
|
222
|
+
background: hsl(var(--muted) / .55);
|
|
223
|
+
}
|
|
224
|
+
|
|
191
225
|
.blade-plan-header {
|
|
192
226
|
display: flex;
|
|
193
227
|
align-items: center;
|
|
@@ -228,13 +262,61 @@
|
|
|
228
262
|
}
|
|
229
263
|
|
|
230
264
|
.blade-plan-count progress {
|
|
265
|
+
display: block;
|
|
231
266
|
width: 100%;
|
|
267
|
+
min-width: 4.5rem;
|
|
232
268
|
height: 4px;
|
|
269
|
+
appearance: none;
|
|
270
|
+
-webkit-appearance: none;
|
|
271
|
+
border: 0;
|
|
272
|
+
border-radius: 999px;
|
|
273
|
+
overflow: hidden;
|
|
274
|
+
background: hsl(var(--muted));
|
|
233
275
|
accent-color: hsl(var(--primary));
|
|
234
276
|
}
|
|
235
277
|
|
|
278
|
+
.blade-plan-count progress::-webkit-progress-bar {
|
|
279
|
+
background: hsl(var(--muted));
|
|
280
|
+
border-radius: 999px;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.blade-plan-count progress::-webkit-progress-value {
|
|
284
|
+
background: hsl(var(--primary));
|
|
285
|
+
border-radius: 999px;
|
|
286
|
+
transition: width .2s ease;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.blade-plan-count progress::-moz-progress-bar {
|
|
290
|
+
background: hsl(var(--primary));
|
|
291
|
+
border-radius: 999px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
[data-blade-plan-embedded] > .blade-chat-plan[data-plan-surface-slot] {
|
|
295
|
+
padding: 0;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
[data-blade-plan-embedded] > .blade-chat-plan[data-plan-surface-slot] > .blade-plan-surface {
|
|
299
|
+
border: 0;
|
|
300
|
+
border-radius: 27px 27px 0 0;
|
|
301
|
+
background: transparent;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
[data-blade-plan-embedded="merged"] > .blade-chat-plan[data-plan-surface-slot] > .blade-plan-surface {
|
|
305
|
+
border-radius: 0;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
[data-blade-plan-embedded] > .blade-chat-plan[data-plan-surface-slot] > .blade-plan-surface > .blade-plan-header,
|
|
309
|
+
[data-blade-plan-embedded] > .blade-chat-plan[data-plan-surface-slot] > .blade-plan-surface > .blade-plan-header-row > .blade-plan-header {
|
|
310
|
+
padding: .7rem 1rem;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
[data-blade-plan-embedded] > .blade-chat-plan[data-plan-surface-slot] > .blade-plan-surface > .blade-plan-header-row > .blade-plan-header-actions {
|
|
314
|
+
padding-inline-end: 1rem;
|
|
315
|
+
}
|
|
316
|
+
|
|
236
317
|
.blade-plan-inline {
|
|
237
318
|
max-height: min(14rem, 30vh);
|
|
319
|
+
min-height: 0;
|
|
238
320
|
display: flex;
|
|
239
321
|
border-top: 1px solid hsl(var(--border));
|
|
240
322
|
}
|
|
@@ -258,6 +340,7 @@
|
|
|
258
340
|
.blade-plan-dialog::backdrop { background: rgb(0 0 0 / .5); }
|
|
259
341
|
.blade-plan-dialog-header {
|
|
260
342
|
display: flex;
|
|
343
|
+
flex-shrink: 0;
|
|
261
344
|
justify-content: space-between;
|
|
262
345
|
align-items: center;
|
|
263
346
|
padding: .7rem 1rem;
|
|
@@ -270,6 +353,7 @@
|
|
|
270
353
|
.blade-plan-loading { display: block; min-height: 5rem; padding: 1rem; }
|
|
271
354
|
.blade-plan-approval {
|
|
272
355
|
display: flex;
|
|
356
|
+
flex-shrink: 0;
|
|
273
357
|
align-items: center;
|
|
274
358
|
flex-wrap: wrap;
|
|
275
359
|
gap: .6rem;
|
|
@@ -278,19 +362,25 @@
|
|
|
278
362
|
font-size: .8rem;
|
|
279
363
|
}
|
|
280
364
|
|
|
281
|
-
.blade-plan-approval button
|
|
365
|
+
.blade-plan-approval button,
|
|
366
|
+
.blade-plan-approve-btn {
|
|
282
367
|
background: hsl(var(--primary));
|
|
283
368
|
color: hsl(var(--primary-foreground));
|
|
284
369
|
border-radius: 7px;
|
|
285
370
|
padding: .4rem .7rem;
|
|
371
|
+
font-size: .8rem;
|
|
286
372
|
font-weight: 600;
|
|
373
|
+
white-space: nowrap;
|
|
287
374
|
}
|
|
288
375
|
|
|
289
|
-
.blade-plan-approval button:disabled
|
|
376
|
+
.blade-plan-approval button:disabled,
|
|
377
|
+
.blade-plan-approve-btn:disabled { opacity: .55; }
|
|
290
378
|
.blade-plan-approval [role="alert"] { color: hsl(var(--destructive)); }
|
|
291
379
|
|
|
292
380
|
.blade-plan-scroll {
|
|
381
|
+
flex: 1;
|
|
293
382
|
min-height: 0;
|
|
383
|
+
min-width: 0;
|
|
294
384
|
width: 100%;
|
|
295
385
|
overflow: auto;
|
|
296
386
|
background: hsl(var(--background));
|
|
@@ -303,9 +393,29 @@
|
|
|
303
393
|
background-size: 16px 16px;
|
|
304
394
|
}
|
|
305
395
|
|
|
396
|
+
.blade-plan-canvas[data-layout="grid"] {
|
|
397
|
+
width: 100%;
|
|
398
|
+
min-height: 100%;
|
|
399
|
+
padding: 12px;
|
|
400
|
+
}
|
|
401
|
+
|
|
306
402
|
.blade-plan-edges, .blade-plan-nodes, .blade-plan-stage, .blade-plan-node { position: absolute; }
|
|
307
403
|
.blade-plan-nodes { inset: 0; margin: 0; padding: 0; list-style: none; pointer-events: none; }
|
|
308
404
|
.blade-plan-node { inset: 0 auto auto 0; transition: transform .3s ease; pointer-events: auto; }
|
|
405
|
+
.blade-plan-canvas[data-layout="grid"] .blade-plan-nodes {
|
|
406
|
+
position: static;
|
|
407
|
+
display: grid;
|
|
408
|
+
grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
|
|
409
|
+
gap: 10px;
|
|
410
|
+
}
|
|
411
|
+
.blade-plan-canvas[data-layout="grid"] .blade-plan-node {
|
|
412
|
+
position: static;
|
|
413
|
+
inset: auto;
|
|
414
|
+
}
|
|
415
|
+
.blade-plan-canvas[data-layout="grid"] .blade-plan-node-body {
|
|
416
|
+
height: auto;
|
|
417
|
+
overflow: visible;
|
|
418
|
+
}
|
|
309
419
|
.blade-plan-stage { background: hsl(var(--muted) / .5); border: 1px dashed hsl(var(--border)); border-radius: 12px; }
|
|
310
420
|
.blade-plan-edge, .blade-plan-flow { fill: none; stroke: hsl(var(--muted-foreground)); stroke-width: 1.5px; }
|
|
311
421
|
.blade-plan-flow { stroke: hsl(var(--primary)); stroke-width: 2.5px; stroke-dasharray: 8 15; animation: blade-plan-flow 1.4s linear infinite; }
|
|
@@ -1126,14 +1126,14 @@ var RenderErrorBoundary = class extends Component {
|
|
|
1126
1126
|
// src/chat/plan/PlanSurface.tsx
|
|
1127
1127
|
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1128
1128
|
var PlanGraph = lazy(async () => {
|
|
1129
|
-
const { createPlanGraph } = await import("./PlanGraph-
|
|
1129
|
+
const { createPlanGraph } = await import("./PlanGraph-WTXKSHID.js");
|
|
1130
1130
|
return { default: await createPlanGraph(React) };
|
|
1131
1131
|
});
|
|
1132
1132
|
var STALE_APPROVAL_ERROR = "\u8BA1\u5212\u5DF2\u66F4\u65B0\uFF0C\u8BF7\u91CD\u65B0\u786E\u8BA4";
|
|
1133
1133
|
function PlanCanvas({ plan, historical, agentActions }) {
|
|
1134
1134
|
return /* @__PURE__ */ jsx6(RenderErrorBoundary, { label: "\u8BA1\u5212", children: /* @__PURE__ */ jsx6(Suspense, { fallback: /* @__PURE__ */ jsx6("output", { className: "blade-plan-loading", children: "\u6B63\u5728\u52A0\u8F7D\u8BA1\u5212\u2026" }), children: /* @__PURE__ */ jsx6(PlanGraph, { plan, historical, agentActions }, plan.plan_id) }) });
|
|
1135
1135
|
}
|
|
1136
|
-
function ActivePlanSurface({ plan, sidebar, session, agentActions }) {
|
|
1136
|
+
function ActivePlanSurface({ plan, sidebar, session, agentActions, onOpenPanel }) {
|
|
1137
1137
|
const queue = useSessionState(session?.sessionId, (state2) => plan.phase === "draft" && session ? state2.queue : void 0);
|
|
1138
1138
|
const [submitting, setSubmitting] = useState6(false);
|
|
1139
1139
|
const [receipt, setReceipt] = useState6(null);
|
|
@@ -1172,13 +1172,26 @@ function ActivePlanSurface({ plan, sidebar, session, agentActions }) {
|
|
|
1172
1172
|
setSubmitting(false);
|
|
1173
1173
|
}
|
|
1174
1174
|
}
|
|
1175
|
-
const
|
|
1176
|
-
|
|
1177
|
-
|
|
1175
|
+
const approvalButton = plan.phase === "draft" && session ? /* @__PURE__ */ jsx6("button", { type: "button", className: "blade-plan-approve-btn", onClick: () => void approve(), disabled: submitting || pendingApproval, children: submitting ? "\u6B63\u5728\u63D0\u4EA4\u2026" : "\u786E\u8BA4\u5E76\u5F00\u59CB\u6267\u884C" }) : null;
|
|
1176
|
+
const approvalStatus = plan.phase === "draft" && session ? approvalError ? /* @__PURE__ */ jsx6("span", { role: "alert", children: approvalError }) : receipt?.status === "accepted" ? /* @__PURE__ */ jsx6("output", { children: "\u5DF2\u63D0\u4EA4\uFF0C\u7B49\u5F85\u5F00\u59CB\u6267\u884C" }) : null : null;
|
|
1177
|
+
const approval = approvalButton && /* @__PURE__ */ jsxs6("div", { className: "blade-plan-approval", children: [
|
|
1178
|
+
approvalButton,
|
|
1179
|
+
approvalStatus
|
|
1178
1180
|
] });
|
|
1179
|
-
return /* @__PURE__ */ jsx6(
|
|
1181
|
+
return /* @__PURE__ */ jsx6(
|
|
1182
|
+
PlanSurface,
|
|
1183
|
+
{
|
|
1184
|
+
plan,
|
|
1185
|
+
sidebar,
|
|
1186
|
+
approval,
|
|
1187
|
+
approvalButton,
|
|
1188
|
+
approvalStatus,
|
|
1189
|
+
agentActions,
|
|
1190
|
+
onOpenPanel
|
|
1191
|
+
}
|
|
1192
|
+
);
|
|
1180
1193
|
}
|
|
1181
|
-
function PlanSurface({ plan, historical = false, sidebar = false, approval, agentActions }) {
|
|
1194
|
+
function PlanSurface({ plan, historical = false, sidebar = false, approval, approvalButton, approvalStatus, agentActions, onOpenPanel }) {
|
|
1182
1195
|
const [expanded, setExpanded] = useState6(false);
|
|
1183
1196
|
const dialogRef = useRef4(null);
|
|
1184
1197
|
const titleId = useId();
|
|
@@ -1188,21 +1201,59 @@ function PlanSurface({ plan, historical = false, sidebar = false, approval, agen
|
|
|
1188
1201
|
if (typeof dialog.showModal === "function") dialog.showModal();
|
|
1189
1202
|
else dialog.setAttribute("open", "");
|
|
1190
1203
|
}, [expanded]);
|
|
1191
|
-
const
|
|
1204
|
+
const opensPanel = !sidebar && !historical && Boolean(onOpenPanel);
|
|
1205
|
+
const inlineGraph = !historical && (sidebar || !opensPanel && selectPlanPresentation(plan) === "graph");
|
|
1206
|
+
const inlineApproval = !inlineGraph && !expanded && Boolean(approvalButton);
|
|
1192
1207
|
const parents = new Set(plan.nodes.map((node) => node.parent_id));
|
|
1193
1208
|
const leaves = plan.nodes.filter((node) => !parents.has(node.id));
|
|
1194
1209
|
const done = leaves.filter((node) => node.status === "done").length;
|
|
1195
1210
|
const current = leaves.find((node) => node.status === "running");
|
|
1196
1211
|
const title = historical ? "\u8FDB\u5EA6\u5FEB\u7167" : plan.phase === "draft" ? "\u8BA1\u5212\u8349\u7A3F" : "\u6267\u884C\u8FDB\u5EA6";
|
|
1197
1212
|
if (!expanded && !historical && !sidebar && plan.phase === "completed") return null;
|
|
1213
|
+
const handleOpen = () => {
|
|
1214
|
+
if (opensPanel) onOpenPanel?.();
|
|
1215
|
+
else setExpanded(true);
|
|
1216
|
+
};
|
|
1198
1217
|
return /* @__PURE__ */ jsxs6("section", { className: "blade-plan-surface", "aria-label": title, "data-sidebar": sidebar || void 0, children: [
|
|
1199
|
-
/* @__PURE__ */ jsxs6(
|
|
1218
|
+
inlineApproval ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
1219
|
+
/* @__PURE__ */ jsxs6("div", { className: "blade-plan-header-row", children: [
|
|
1220
|
+
/* @__PURE__ */ jsx6(
|
|
1221
|
+
"button",
|
|
1222
|
+
{
|
|
1223
|
+
type: "button",
|
|
1224
|
+
className: "blade-plan-header",
|
|
1225
|
+
"aria-haspopup": opensPanel ? void 0 : "dialog",
|
|
1226
|
+
onClick: handleOpen,
|
|
1227
|
+
children: /* @__PURE__ */ jsxs6("span", { className: "blade-plan-heading", children: [
|
|
1228
|
+
/* @__PURE__ */ jsx6("span", { className: "blade-plan-caption", children: title }),
|
|
1229
|
+
/* @__PURE__ */ jsx6("strong", { children: plan.title }),
|
|
1230
|
+
current && /* @__PURE__ */ jsx6("span", { className: "blade-plan-current", children: current.label })
|
|
1231
|
+
] })
|
|
1232
|
+
}
|
|
1233
|
+
),
|
|
1234
|
+
/* @__PURE__ */ jsxs6("div", { className: "blade-plan-header-actions", children: [
|
|
1235
|
+
approvalButton,
|
|
1236
|
+
!opensPanel && /* @__PURE__ */ jsx6(
|
|
1237
|
+
"button",
|
|
1238
|
+
{
|
|
1239
|
+
type: "button",
|
|
1240
|
+
className: "blade-plan-header-toggle",
|
|
1241
|
+
"aria-label": "\u5C55\u5F00\u8BA1\u5212",
|
|
1242
|
+
"aria-haspopup": "dialog",
|
|
1243
|
+
onClick: handleOpen,
|
|
1244
|
+
children: /* @__PURE__ */ jsx6(Maximize2, { size: 15, "aria-hidden": "true" })
|
|
1245
|
+
}
|
|
1246
|
+
)
|
|
1247
|
+
] })
|
|
1248
|
+
] }),
|
|
1249
|
+
approvalStatus && /* @__PURE__ */ jsx6("div", { className: "blade-plan-approval", children: approvalStatus })
|
|
1250
|
+
] }) : /* @__PURE__ */ jsxs6(
|
|
1200
1251
|
"button",
|
|
1201
1252
|
{
|
|
1202
1253
|
type: "button",
|
|
1203
1254
|
className: "blade-plan-header",
|
|
1204
|
-
"aria-haspopup": "dialog",
|
|
1205
|
-
onClick:
|
|
1255
|
+
"aria-haspopup": opensPanel ? void 0 : "dialog",
|
|
1256
|
+
onClick: handleOpen,
|
|
1206
1257
|
children: [
|
|
1207
1258
|
/* @__PURE__ */ jsxs6("span", { className: "blade-plan-heading", children: [
|
|
1208
1259
|
/* @__PURE__ */ jsx6("span", { className: "blade-plan-caption", children: title }),
|
|
@@ -1216,13 +1267,13 @@ function PlanSurface({ plan, historical = false, sidebar = false, approval, agen
|
|
|
1216
1267
|
" \u5DF2\u5B8C\u6210",
|
|
1217
1268
|
/* @__PURE__ */ jsx6("progress", { max: Math.max(1, leaves.length), value: done, "aria-label": "\u5B8C\u6210\u8FDB\u5EA6" })
|
|
1218
1269
|
] }),
|
|
1219
|
-
/* @__PURE__ */ jsx6(Maximize2, { size: 15, "aria-label": "\u5C55\u5F00\u8BA1\u5212" })
|
|
1270
|
+
!opensPanel && /* @__PURE__ */ jsx6(Maximize2, { size: 15, "aria-label": "\u5C55\u5F00\u8BA1\u5212" })
|
|
1220
1271
|
]
|
|
1221
1272
|
}
|
|
1222
1273
|
),
|
|
1223
1274
|
inlineGraph && /* @__PURE__ */ jsx6("div", { className: "blade-plan-inline", children: /* @__PURE__ */ jsx6(PlanCanvas, { plan, historical: false, agentActions }) }),
|
|
1224
|
-
!expanded && approval,
|
|
1225
|
-
/* @__PURE__ */ jsx6("dialog", { ref: dialogRef, className: "blade-plan-dialog", "aria-labelledby": titleId, onClose: () => setExpanded(false), children: expanded && /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
1275
|
+
!expanded && !inlineApproval && approval,
|
|
1276
|
+
!opensPanel && /* @__PURE__ */ jsx6("dialog", { ref: dialogRef, className: "blade-plan-dialog", "aria-labelledby": titleId, onClose: () => setExpanded(false), children: expanded && /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
1226
1277
|
/* @__PURE__ */ jsxs6("header", { className: "blade-plan-dialog-header", children: [
|
|
1227
1278
|
/* @__PURE__ */ jsx6("h2", { id: titleId, children: plan.title }),
|
|
1228
1279
|
/* @__PURE__ */ jsx6("button", { type: "button", "aria-label": "\u5173\u95ED\u8BA1\u5212", onClick: () => {
|
|
@@ -1245,16 +1296,18 @@ function SessionPlan({ sessionId, sidebar = false, readOnly = false }) {
|
|
|
1245
1296
|
const plan = useSessionState(sessionId, (state2) => state2.activePlan);
|
|
1246
1297
|
const viewerRole = useSessionState(sessionId, (state2) => state2.viewerRole);
|
|
1247
1298
|
const detail = useChatSessionDetail(sessionId);
|
|
1248
|
-
const { getPlanAgentActions } = useChatEnvironment();
|
|
1299
|
+
const { getPlanAgentActions, openPlanPanel } = useChatEnvironment();
|
|
1249
1300
|
if (!plan) return null;
|
|
1250
1301
|
const viewer = readOnly || (viewerRole ?? detail?.viewer_role) === "viewer";
|
|
1302
|
+
const onOpenPanel = !sidebar && !viewer && openPlanPanel ? () => openPlanPanel(sessionId) : void 0;
|
|
1251
1303
|
return /* @__PURE__ */ jsx6(
|
|
1252
1304
|
ActivePlanSurface,
|
|
1253
1305
|
{
|
|
1254
1306
|
plan,
|
|
1255
1307
|
sidebar,
|
|
1256
1308
|
session: viewer ? void 0 : session ?? void 0,
|
|
1257
|
-
agentActions: getPlanAgentActions?.(sessionId)
|
|
1309
|
+
agentActions: getPlanAgentActions?.(sessionId),
|
|
1310
|
+
onOpenPanel
|
|
1258
1311
|
},
|
|
1259
1312
|
`${sessionId}:${plan.plan_id}`
|
|
1260
1313
|
);
|
|
@@ -1331,7 +1384,7 @@ function CurrentPlanPanel({
|
|
|
1331
1384
|
const customPlan = parsedPlan ? renderPlan?.({ plan: parsedPlan, running: isStreaming, sessionId }) : null;
|
|
1332
1385
|
if (activePlan) {
|
|
1333
1386
|
if (hideTodo && activePlan.phase !== "draft") return null;
|
|
1334
|
-
return /* @__PURE__ */ jsx7("div", { part: "plan", className: cn("blade-chat-plan
|
|
1387
|
+
return /* @__PURE__ */ jsx7("div", { part: "plan", "data-plan-surface-slot": "true", className: cn("blade-chat-plan py-2 empty:hidden", className), children: /* @__PURE__ */ jsx7(SessionPlan, { sessionId, readOnly }) });
|
|
1335
1388
|
}
|
|
1336
1389
|
if (hideTodo || !hasPlanUpdate) return null;
|
|
1337
1390
|
if (customPlan != null) return /* @__PURE__ */ jsx7(Fragment4, { children: customPlan });
|
|
@@ -14911,4 +14964,4 @@ use-stick-to-bottom/dist/StickToBottom.js:
|
|
|
14911
14964
|
js-yaml/dist/js-yaml.mjs:
|
|
14912
14965
|
(*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
|
|
14913
14966
|
*/
|
|
14914
|
-
//# sourceMappingURL=chunk-
|
|
14967
|
+
//# sourceMappingURL=chunk-BEBV7M7V.js.map
|